@font-face {
    font-family: 'Tajawal';
    src: url('/fonts/tajawal/Tajawal-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Tajawal';
    src: url('/fonts/tajawal/Tajawal-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Tajawal';
    src: url('/fonts/tajawal/Tajawal-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Tajawal';
    src: url('/fonts/tajawal/Tajawal-Black.woff2') format('woff2');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --athar-primary: #7b6bd6;
    --athar-primary-dark: #6455c4;
    --athar-primary-light: #9d8df0;
    --athar-accent: #7b6bd6;
    --athar-bg: #f8f7fb;
    --athar-text: #241f33;
    --athar-border: #ecebf2;
    --athar-danger: #e35d54;
    --athar-success: #3fae6f;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
    background-color: var(--athar-bg);
    color: var(--athar-text);
    margin: 0;
}

/* ===== Navbar ===== */
.athar-navbar {
    background: linear-gradient(90deg, var(--athar-primary-dark), var(--athar-primary));
    padding: 0.75rem 0;
}

.athar-brand {
    font-weight: 900;
    font-size: 1.5rem;
    color: #fff !important;
}

    .athar-brand span {
        color: var(--athar-accent);
        font-size: 0.9rem;
        margin-right: 0.4rem;
    }

.athar-navbar .nav-link {
    color: rgba(255, 255, 255, 0.85) !important;
    font-weight: 500;
}

    .athar-navbar .nav-link:hover {
        color: var(--athar-accent) !important;
    }

.athar-navbar .dropdown-menu {
    background-color: var(--athar-primary-dark);
    border: none;
}

.athar-navbar .dropdown-item {
    color: rgba(255, 255, 255, 0.85);
}

    .athar-navbar .dropdown-item:hover {
        background-color: var(--athar-primary-light);
        color: #fff;
    }

.athar-user-greeting {
    color: #fff !important;
}

/* ===== Buttons ===== */
.athar-btn {
    background-color: var(--athar-primary);
    color: #fff;
    border: 1px solid var(--athar-primary);
    font-weight: 500;
    border-radius: 6px;
    padding: 0.5rem 1.25rem;
}

    .athar-btn:hover {
        background-color: var(--athar-primary-dark);
        color: #fff;
    }

.athar-btn-outline {
    background-color: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    padding: 0.4rem 1rem;
}

    .athar-btn-outline:hover {
        background-color: rgba(255, 255, 255, 0.12);
        color: #fff;
    }

/* outline buttons used outside dark backgrounds (cards) need dark text */
.athar-card .athar-btn-outline,
.athar-auth-card .athar-btn-outline {
    color: var(--athar-primary);
    border-color: var(--athar-primary);
}

    .athar-card .athar-btn-outline:hover,
    .athar-auth-card .athar-btn-outline:hover {
        background-color: var(--athar-primary);
        color: #fff;
    }

.athar-btn-accent {
    background-color: var(--athar-accent);
    color: #fff;
    border: 1px solid var(--athar-accent);
    font-weight: 700;
    border-radius: 6px;
    padding: 0.6rem 1.5rem;
}

    .athar-btn-accent:hover {
        background-color: var(--athar-primary-dark);
        color: #fff;
    }

/* ===== Content / Cards ===== */
.athar-content {
    padding-top: 1.5rem;
    padding-bottom: 3rem;
    min-height: calc(100vh - 140px);
}

.athar-page-title {
    color: var(--athar-primary-dark);
    font-weight: 900;
}

.athar-card {
    background: #fff;
    border: 1px solid var(--athar-border);
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(107, 66, 38, 0.08);
}

.athar-permission-group {
    background: var(--athar-bg);
    border: 1px solid var(--athar-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    height: 100%;
}

    .athar-permission-group h6 {
        color: var(--athar-primary);
        font-weight: 700;
        margin-bottom: 0.5rem;
    }

/* ===== Table ===== */
.athar-table thead {
    background-color: var(--athar-primary);
    color: #fff;
}

    .athar-table thead th {
        border: none;
        font-weight: 500;
    }

.athar-table tbody tr:hover {
    background-color: rgba(107, 66, 38, 0.06);
}

/* ===== Badges ===== */
.athar-badge-active {
    background-color: var(--athar-success);
    color: #fff;
}

.athar-badge-inactive {
    background-color: var(--athar-danger);
    color: #fff;
}

/* ===== Stat cards (Dashboard) ===== */
.athar-stat-card {
    background: #fff;
    border: 1px solid var(--athar-border);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(107, 66, 38, 0.08);
}

.athar-stat-value {
    font-size: 2.25rem;
    font-weight: 900;
    color: var(--athar-primary);
}

.athar-stat-label {
    color: #6c757d;
    margin-top: 0.25rem;
}

/* ===== Hero (Home landing page) ===== */
.athar-hero {
    background: linear-gradient(135deg, var(--athar-primary-dark), var(--athar-primary));
    border-radius: 14px;
    padding: 4rem 1.5rem;
    margin-top: 1rem;
    color: #fff;
}

.athar-hero-title {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--athar-accent);
    margin-bottom: 0;
}

.athar-hero-subtitle {
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.athar-hero-text {
    max-width: 640px;
    margin: 1rem auto 0;
    color: rgba(255, 255, 255, 0.85);
}

.athar-hero-welcome {
    font-size: 1.1rem;
    color: var(--athar-accent);
    font-weight: 700;
}

/* ===== Auth pages (Login / Register / AccessDenied) ===== */
.athar-auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--athar-primary-dark), var(--athar-primary));
    padding: 2rem 1rem;
}

.athar-auth-card {
    background: #fff;
    border-radius: 14px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 10px 40px rgba(61, 36, 18, 0.3);
}

.athar-auth-card-wide {
    max-width: 760px;
}

.athar-auth-title {
    color: var(--athar-primary);
    font-weight: 900;
    text-align: center;
    margin-bottom: 0;
}

.athar-auth-subtitle {
    text-align: center;
    color: #6c757d;
    margin-bottom: 1.5rem;
}

/* ===== Footer ===== */
.athar-footer {
    background-color: var(--athar-primary-dark);
    color: rgba(255, 255, 255, 0.75);
    padding: 1rem 0;
    font-size: 0.9rem;
}

/* ===== Location picker (map) ===== */
.athar-map-section {
    background: var(--athar-bg);
    border: 1px solid var(--athar-border);
    border-radius: 8px;
    padding: 1rem;
}

.athar-map-hint {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.75rem;
}

.athar-map {
    /* عزل اتجاه الخريطة عن باقي الصفحة، فـ Leaflet غير مصمم لسياق RTL */
    direction: ltr;
    height: 220px;
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--athar-border);
    z-index: 0;
}

.athar-coords-display {
    font-size: 0.9rem;
    color: var(--athar-primary);
    font-weight: 500;
}

/* ===== Project status badges (Module 2) ===== */
.athar-status-badge {
    color: #fff;
    font-weight: 500;
}

.athar-status-New {
    background-color: #6c757d;
}

.athar-status-InProgress {
    background-color: var(--athar-accent);
    color: #fff;
}

.athar-status-ClientReview {
    background-color: #3D6B8B;
}

.athar-status-Completed {
    background-color: var(--athar-success);
}

/* ===== Project completion progress bar (Module 2) ===== */
.athar-progress-bar {
    background-color: var(--athar-accent);
}

/* ===== Kanban board (Module 2 - Tasks) ===== */
.athar-kanban-column {
    background: var(--athar-bg);
    border: 1px solid var(--athar-border);
    border-radius: 8px;
    padding: 0.75rem;
    min-height: 150px;
}

.athar-kanban-header {
    font-weight: 700;
    color: var(--athar-primary);
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--athar-border);
    padding-bottom: 0.4rem;
}

.athar-kanban-card {
    background: #fff;
    border: 1px solid var(--athar-border);
    border-radius: 6px;
    padding: 0.6rem;
    margin-bottom: 0.6rem;
}

.athar-priority-Low {
    background-color: #6c757d;
    color: #fff;
}

.athar-priority-Medium {
    background-color: var(--athar-accent);
    color: #fff;
}

.athar-priority-High {
    background-color: #B3372C;
    color: #fff;
}

.athar-priority-Critical {
    background-color: #7A1A1A;
    color: #fff;
}
/* ===== شعار أثر (حماية حقوق النشر) ===== */
.athar-navbar-logo {
    height: 42px;
    width: auto;
}

.athar-auth-logo {
    max-width: 260px;
    width: 100%;
    height: auto;
}

.athar-footer-logo {
    height: 20px;
    width: auto;
    opacity: 0.85;
}

/* ===== ترويسة وعلامة مائية للتقارير المطبوعة (جاهزة لكل الوحدات القادمة) ===== */
.athar-report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--athar-primary);
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
}

    .athar-report-header img {
        height: 60px;
        width: auto;
    }

.athar-report-watermark {
    position: relative;
}

    .athar-report-watermark::before {
        content: "";
        position: absolute;
        inset: 0;
        background-image: url('/images/logo-outline.png');
        background-repeat: no-repeat;
        background-position: center;
        background-size: 55%;
        opacity: 0.06;
        pointer-events: none;
        z-index: 0;
    }

@media print {
    .app-topbar, .app-sidebar, .app-subbar {
        display: none !important;
    }

    .athar-report-watermark::before {
        opacity: 0.08;
    }
}

.athar-address-suggestions {
    position: absolute;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    max-height: 220px;
    overflow-y: auto;
    width: 100%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.athar-address-suggestion {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.9rem;
}

    .athar-address-suggestion:hover {
        background: #f5f0e8;
    }

.athar-address-suggestion-empty {
    color: #999;
    cursor: default;
}

/* ============================================================
   منظومة أثر — الطبقة البصرية الموحّدة (الطبقة الذهبية القديمة المكرَّرة أُزيلت نهائياً)
   الأصناف التالية لم تكن مُعاد تعريفها بنفسجياً فبقيت ذهبية — أُعيد ترميزها هنا فقط.
   ============================================================ */

/* ===== تبويبات ===== */
.tabs {
    display: flex;
    gap: 16px;
    border-bottom: 1px solid var(--sys-border);
    margin-bottom: 10px;
}

    .tabs .tab-item {
        font-size: 11.5px;
        padding: 6px 2px;
        color: var(--sys-text-secondary);
        text-decoration: none;
        border-bottom: 2px solid transparent;
    }

        .tabs .tab-item.active {
            font-weight: 600;
            color: var(--sys-text);
            border-bottom-color: var(--sys-primary);
        }

.filter-bar select.filter-chip {
    cursor: pointer;
}

/* ===== ملف المستخدم ===== */
.profile-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

    .profile-head .profile-avatar {
        width: 58px;
        height: 58px;
        border-radius: 50%;
        object-fit: cover;
        border: 1px solid var(--sys-border);
    }

    .profile-head h1 {
        font-size: 18px;
        font-weight: 600;
        margin: 2px 0 0;
        color: var(--sys-text);
    }

.tab-content {
    background: var(--sys-surface);
    border: 1px solid var(--sys-border);
    border-radius: var(--sys-radius-card);
    padding: 12px;
    margin-bottom: 12px;
}

.ds-photo-slot {
    width: 100%;
    aspect-ratio: 4/3;
    border: 1px dashed var(--sys-text-faint);
    border-radius: var(--sys-radius-card);
    background: repeating-linear-gradient(45deg, rgba(36,31,51,.04), rgba(36,31,51,.04) 4px, transparent 4px, transparent 8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9.5px;
    color: var(--sys-text-light);
    text-align: center;
    overflow: hidden;
}

    .ds-photo-slot img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.ds-map-slot {
    width: 110px;
    height: 74px;
    flex-shrink: 0;
    border: 1px dashed var(--sys-text-faint);
    border-radius: var(--sys-radius-card);
    background: repeating-linear-gradient(45deg, rgba(36,31,51,.04), rgba(36,31,51,.04) 4px, transparent 4px, transparent 8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: var(--sys-text-light);
    text-align: center;
}

/* ===== الأدوار والصلاحيات ===== */
.role-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.role-card {
    display: block;
    padding: 8px 10px;
    border: 1px solid var(--sys-border);
    border-radius: var(--sys-radius-card);
    text-decoration: none;
    color: var(--sys-text);
    border-right: 2px solid transparent;
}

    .role-card .role-card-name {
        font-size: 12px;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .role-card .role-card-sub {
        font-size: 10px;
        color: var(--sys-text-light);
        margin-top: 2px;
    }

    .role-card.selected {
        background: var(--sys-row-selected);
        border-right-color: var(--sys-primary);
    }

input[type="checkbox"].chk-gold {
    width: 12px;
    height: 12px;
    accent-color: var(--sys-primary);
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
    flex-shrink: 0;
}

    .toggle-switch input {
        opacity: 0;
        width: 0;
        height: 0;
        position: absolute;
    }

    .toggle-switch .slider {
        position: absolute;
        cursor: pointer;
        inset: 0;
        background: var(--sys-border);
        border-radius: 20px;
        transition: .15s;
    }

        .toggle-switch .slider::before {
            content: "";
            position: absolute;
            height: 14px;
            width: 14px;
            left: 2px;
            top: 2px;
            background: #fff;
            border-radius: 50%;
            transition: .15s;
            box-shadow: 0 1px 2px rgba(0,0,0,.15);
        }

    .toggle-switch input:checked + .slider {
        background: var(--sys-primary);
    }

        .toggle-switch input:checked + .slider::before {
            transform: translateX(16px);
        }

/* ===== الأقسام ===== */
.dept-tree .dept-node {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11.5px;
    padding: 5px 8px;
    border-radius: 6px;
}

    .dept-tree .dept-node.selected {
        background: var(--sys-row-selected);
    }

.dept-tree .dept-children {
    border-right: 1px solid var(--sys-row-line);
    padding-right: 12px;
    margin-right: 6px;
}

.dept-tree .dept-toggle {
    cursor: pointer;
    color: #7b6bd6;
    font-size: 16px;
    font-weight: bold;
    margin-left: 4px;
    background: none;
    border: none;
    padding: 0;
}

/* ============================================================
   منظومة أثر — هوية الأنظمة الثمانية (athar-handoff) — تحلّ محل ما فوقها بصرياً
   (نفس الأصناف: .app-topbar/.app-sidebar/.nav-item/.page-head/.stat-strip/
   .filter-bar/.data-table/.tag/.btn-line/.progress-hair/.side-panel/.pager)
   عبر ترتيب الكاسكيد — القيم أدناه هي الأحدث فتُطبَّق تلقائياً بلا تغيير أي View.
   القيم مطابقة حرفياً لكتلة <helmet> والشريط العلوي/الجانبي في المرجع البصري.
   ============================================================ */
:root {
    --sys-nav-bg: #221837;
    --sys-nav-active-bg: #342a4c;
    --sys-nav-active-bar: #8c7ce6;
    --sys-primary: #7b6bd6;
    --sys-primary-hover: #6455c4;
    --sys-primary-text: #6455c4;
    --sys-success: #3fae6f;
    --sys-success-text: #2f8a57;
    --sys-danger: #e35d54;
    --sys-danger-text: #c94a42;
    --sys-warning: #ff9130;
    --sys-warning-text: #c9700f;
    --sys-info: #5090b0;
    --sys-info-text: #3f7590;
    --sys-bg: #f8f7fb;
    --sys-surface: #ffffff;
    --sys-text: #241f33;
    --sys-text-secondary: #5a5370;
    --sys-text-light: #8a83a0;
    --sys-text-faint: #c6c1d6;
    --sys-border: #ecebf2;
    --sys-row-line: #f1f0f6;
    --sys-row-line-light: #f6f5fa;
    --sys-th-bg: #faf9fd;
    --sys-row-selected: rgba(123,107,214,.05);
    --sys-radius-card: 11px;
    --sys-radius-btn: 8px;
    --sys-shadow: 0 1px 2px rgba(36,31,51,.04);
    --sys-font: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
}

html {
    direction: rtl;
}

a {
    color: #6455c4;
    text-decoration: none;
}

    a:hover {
        color: #7b6bd6;
    }

button:focus-visible {
    outline: 2px solid #7b6bd6;
    outline-offset: 2px;
}

.n {
    font-variant-numeric: tabular-nums;
    direction: ltr;
    unicode-bidi: isolate;
}

.sb::-webkit-scrollbar {
    width: 5px;
}

.sb::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.14);
    border-radius: 3px;
}

.cs::-webkit-scrollbar {
    width: 8px;
}

.cs::-webkit-scrollbar-thumb {
    background: rgba(36,31,51,.16);
    border-radius: 4px;
}

/* ===== الشريط العلوي (50px) ===== */
.app-topbar {
    height: 50px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    background: var(--sys-nav-bg);
    font-family: var(--sys-font);
}

    .app-topbar .ds-logo {
        width: 30px;
        height: 30px;
    }

    .app-topbar .ds-brand {
        font-size: 13px;
        font-weight: 600;
        color: #fff;
        white-space: nowrap;
    }

    .app-topbar .topbar-spacer {
        flex: 1;
    }

    .app-topbar .ds-search {
        width: 200px;
        height: 29px;
        border: 1px solid rgba(255,255,255,.14);
        border-radius: var(--sys-radius-btn);
        padding: 0 30px 0 11px;
        font-size: 11.5px;
        background: rgba(255,255,255,.07);
        color: #fff;
    }

        .app-topbar .ds-search::placeholder {
            color: rgba(255,255,255,.5);
        }

.topbar-search-wrap {
    position: relative;
    width: 200px;
}

    .topbar-search-wrap svg {
        position: absolute;
        top: 8px;
        right: 10px;
        width: 13px;
        height: 13px;
        stroke: rgba(255,255,255,.45);
    }

.app-topbar .ds-bell {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    background: rgba(255,255,255,.08);
}

    .app-topbar .ds-bell svg {
        width: 18px;
        height: 18px;
        stroke: #fff;
        stroke-width: 1.7;
    }

    .app-topbar .ds-bell .ds-bell-count,
    .app-topbar .ds-icon-link .ds-bell-count {
        position: absolute;
        top: -3px;
        left: -3px;
        width: 15px;
        height: 15px;
        border-radius: 50%;
        background: var(--sys-danger);
        color: #fff;
        font-size: 8.5px;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

.app-topbar .ds-icon-link {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    background: rgba(255,255,255,.08);
}

    .app-topbar .ds-icon-link svg {
        width: 18px;
        height: 18px;
        stroke: #fff;
        stroke-width: 1.7;
    }

.app-topbar .ds-user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.app-topbar .ds-user-text {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.25;
}

.app-topbar .ds-user-name {
    font-size: 11.5px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

.app-topbar .ds-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.app-topbar .ds-avatar-placeholder {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255,255,255,.13);
    border: 1px solid rgba(255,255,255,.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10.5px;
    font-weight: 600;
    flex-shrink: 0;
}

.app-topbar .ds-role {
    font-size: 9.5px;
    color: rgba(255,255,255,.45);
    white-space: nowrap;
}

/* ===== القائمة الجانبية (200px) ===== */
.app-body {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - 50px);
}

.app-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: var(--sys-nav-bg);
    border-left: 1px solid rgba(255,255,255,.07);
    display: flex;
    flex-direction: column;
    font-family: var(--sys-font);
    min-height: 0;
}

.sidebar-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.32);
    padding: 5px 14px 5px;
}

.nav-quick-divider {
    height: 1px;
    background: rgba(255,255,255,.09);
    margin: 2px 14px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 7px 14px;
    color: rgba(255,255,255,.82);
    text-decoration: none;
    border-right: 3px solid transparent;
    background: none;
    border-left: none;
    border-top: none;
    border-bottom: none;
    width: 100%;
    text-align: right;
    cursor: pointer;
}

    .nav-item:hover {
        color: #fff;
        background: rgba(255,255,255,.04);
        text-decoration: none;
    }

    .nav-item.active {
        background: var(--sys-nav-active-bg);
        border-right-color: var(--sys-nav-active-bar);
        color: #fff;
        font-weight: 600;
    }

    .nav-item.disabled {
        color: rgba(255,255,255,.32);
        cursor: default;
        justify-content: space-between;
    }

        .nav-item.disabled:hover {
            background: none;
        }

.nav-group {
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.nav-group-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 9px 14px;
    background: none;
    border: none;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-align: right;
}

    .nav-group-header .nav-group-caret {
        font-size: 9px;
        color: rgba(255,255,255,.4);
        transition: transform .15s;
    }

    .nav-group-header.collapsed .nav-group-caret {
        transform: rotate(-90deg);
    }

.nav-subgroup-title {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: rgba(255,255,255,.32);
    padding: 11px 14px 5px;
}

.nav-logout {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,.07);
    padding: 12px 14px;
}

.nav-logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: none;
    border-radius: 7px;
    background: rgba(255,255,255,.05);
    color: rgba(255,255,255,.6);
    font-size: 11.5px;
    text-align: right;
    cursor: pointer;
}

    .nav-logout-btn:hover {
        background: rgba(255,255,255,.1);
        color: #fff;
    }

/* ===== شريط رجوع/مسار التنقّل (38px) ===== */
.app-subbar {
    height: 38px;
    flex-shrink: 0;
    background: var(--sys-surface);
    border-bottom: 1px solid var(--sys-border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
}

    .app-subbar .btn-back {
        display: flex;
        align-items: center;
        gap: 5px;
        height: 30px;
        padding: 0 10px;
        background: #fff;
        border: 1px solid #e4e2ec;
        border-radius: 7px;
        font-size: 12px;
        color: var(--sys-text-secondary);
        cursor: pointer;
    }

        .app-subbar .btn-back:hover {
            background: #f4f2fa;
            border-color: #c9c2e6;
            color: var(--sys-primary-text);
        }

    .app-subbar .app-crumb {
        font-size: 12px;
        color: var(--sys-text-light);
        display: flex;
        align-items: center;
        gap: 6px;
    }

        .app-subbar .app-crumb .crumb-sep {
            color: var(--sys-text-faint);
        }

        .app-subbar .app-crumb .crumb-leaf {
            color: var(--sys-text);
        }

        .app-subbar .app-crumb .crumb-link {
            color: var(--sys-text-light);
            text-decoration: none;
        }

            .app-subbar .app-crumb .crumb-link:hover {
                color: var(--sys-primary);
                text-decoration: underline;
            }

    .app-subbar .app-crumb-dept {
        font-size: 11px;
        color: #a8a2bd;
    }

/* ===== منطقة المحتوى ===== */
.app-content {
    flex: 1;
    min-width: 0;
    padding: 0;
    background: var(--sys-bg);
    font-family: var(--sys-font);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.app-content-body {
    padding: 18px 20px 40px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* ===== ترويسة الصفحة ===== */
.kicker {
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--sys-text-light);
    display: block;
    margin-bottom: 3px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

    .page-head h1 {
        font-size: 19px;
        font-weight: 700;
        color: var(--sys-text);
        margin: 0;
    }

    .page-head .page-head-actions {
        display: flex;
        gap: 8px;
    }

/* ===== شريط الأرقام ===== */
.stat-strip {
    display: flex;
    background: var(--sys-surface);
    border: 1px solid var(--sys-border);
    border-radius: var(--sys-radius-card);
    box-shadow: var(--sys-shadow);
    margin-bottom: 14px;
    overflow: hidden;
}

    .stat-strip .stat-item {
        flex: 1;
        padding: 12px 16px;
        border-left: 1px solid var(--sys-row-line);
        text-align: center;
    }

        .stat-strip .stat-item:first-child {
            border-left: none;
        }

        .stat-strip .stat-item .stat-value {
            font-weight: 700;
            font-size: 22px;
            font-variant-numeric: tabular-nums;
            direction: ltr;
            color: var(--sys-text);
            display: block;
        }

        .stat-strip .stat-item .stat-sub {
            font-size: 10px;
            color: var(--sys-text-light);
        }

    .stat-strip.stat-strip-text .stat-value {
        font-size: 12.5px;
        font-weight: 600;
    }

/* ===== شريط التصفية ===== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

    .filter-bar .filter-search {
        height: 30px;
        border: 1px solid var(--sys-border);
        border-radius: var(--sys-radius-btn);
        padding: 0 12px;
        font-size: 11.5px;
        flex: 1;
        max-width: 260px;
    }

    .filter-bar .filter-chip {
        height: 30px;
        padding: 0 12px;
        font-size: 11.5px;
        border: 1px solid var(--sys-border);
        border-radius: var(--sys-radius-btn);
        background: var(--sys-surface);
        color: var(--sys-text-secondary);
        cursor: pointer;
    }

        .filter-bar .filter-chip.active {
            border-color: var(--sys-primary);
            color: var(--sys-primary-text);
        }

    .filter-bar .filter-clear {
        margin-inline-start: auto;
        font-size: 11px;
        color: var(--sys-text-light);
        cursor: pointer;
    }

/* ===== زر «+» متقطّع لإضافة خيار من مكانه ===== */
.chip-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px dashed var(--sys-text-faint);
    border-radius: var(--sys-radius-btn);
    background: none;
    color: var(--sys-text-light);
    font-size: 15px;
    cursor: pointer;
}

    .chip-add:hover {
        border-color: var(--sys-primary);
        color: var(--sys-primary-text);
    }

/* ===== الجدول (CSS Grid بمتغيّر --cols) ===== */
.data-table {
    --cols: 1fr;
    width: 100%;
    background: var(--sys-surface);
    border: 1px solid var(--sys-border);
    border-radius: var(--sys-radius-card);
    box-shadow: var(--sys-shadow);
}

.data-table-head,
.data-table-row {
    display: grid;
    grid-template-columns: var(--cols);
    align-items: center;
    min-width: 0;
}

.data-table-head {
    background: var(--sys-th-bg);
    border-bottom: 1px solid var(--sys-border);
}

.data-table-row {
    border-top: 1px solid var(--sys-row-line);
}

    .data-table-row:first-child {
        border-top: none;
    }

    .data-table-row.row-selected {
        background: var(--sys-row-selected);
    }

    .data-table-row.row-faded {
        opacity: .55;
    }

.pwd-wrap {
    position: relative;
}

.pwd-toggle {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--sys-text-light);
    display: grid;
    place-items: center;
}

    .pwd-toggle svg {
        width: 16px;
        height: 16px;
    }

    .data-table-row.row-contract-soon {
        background: rgba(255,145,48,.07);
        box-shadow: inset 3px 0 0 var(--sys-warning);
    }
.data-table-row.row-action-required {
    background: rgba(227,93,84,.05);
    box-shadow: inset 3px 0 0 var(--sys-danger);
}
    .data-table-row.row-expanded {
        background: var(--sys-bg);
        grid-column: 1 / -1;
        display: block;
        padding: 10px 14px;
    }

.cell {
    font-size: 11.5px;
    padding: 9px 12px;
    white-space: normal;
    overflow: visible;
    word-break: break-word;
    min-width: 0;
    color: var(--sys-text);
}

.data-table-head .cell {
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--sys-text-light);
    font-weight: 600;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
    line-height: 1.35;
}

.cell-num {
    font-variant-numeric: tabular-nums;
    direction: ltr;
    text-align: right;
}
.data-table-compact .cell {
    padding: 5px 6px;
    font-size: 10px;
}

.data-table-compact .data-table-head .cell {
    font-size: 8.5px;
}

.data-table-compact .data-table-row,
.data-table-compact .data-table-head {
    min-width: 0;
}

.profit-table .cell {
    font-size: 12px;
}

.profit-table .data-table-head .cell {
    font-size: 10.5px;
}

.profit-table .data-table-row.row-income {
    background: rgba(46,139,87,.08);
    box-shadow: inset 3px 0 0 #2e8b57;
}

.profit-table .data-table-row.row-expense {
    background: rgba(201,74,66,.07);
    box-shadow: inset 3px 0 0 #c94a42;
}

.profit-table .data-table-row.row-total {
    font-weight: 700;
    background: var(--sys-bg);
    border-top: 2px solid var(--sys-border);
}
/* ===== شارات ملوّنة ===== */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 9.5px;
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid var(--sys-border);
    color: var(--sys-text-secondary);
    background: var(--sys-surface);
    white-space: nowrap;
}

.tag-accent {
    border-color: var(--sys-primary);
    color: var(--sys-primary-text);
    background: rgba(123,107,214,.06);
}

.tag-success {
    border-color: var(--sys-success);
    color: var(--sys-success-text);
    background: rgba(63,174,111,.08);
}

.tag-danger {
    border-color: var(--sys-danger);
    color: var(--sys-danger-text);
    background: rgba(227,93,84,.08);
}

.tag-warning {
    border-color: var(--sys-warning);
    color: var(--sys-warning-text);
    background: rgba(255,145,48,.08);
}

.tag-info {
    border-color: var(--sys-info);
    color: var(--sys-info-text);
    background: rgba(80,144,176,.08);
}

.tag-muted {
    border-color: var(--sys-text-faint);
    color: var(--sys-text-light);
    background: var(--sys-row-line-light);
}

/* ===== الأزرار ===== */
.btn-line {
    height: 30px;
    padding: 0 13px;
    font-size: 11.5px;
    border: 1px solid var(--sys-border);
    border-radius: var(--sys-radius-btn);
    background: var(--sys-surface);
    color: var(--sys-text);
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    cursor: pointer;
}

    .btn-line:hover {
        background: var(--sys-row-line-light);
        color: var(--sys-text);
        text-decoration: none;
    }

.btn-line-accent {
    background: var(--sys-primary);
    border-color: var(--sys-primary);
    color: #fff;
    font-weight: 600;
}

    .btn-line-accent:hover {
        background: var(--sys-primary-hover);
        border-color: var(--sys-primary-hover);
        color: #fff;
    }

.btn-line-xs {
    height: 24px;
    padding: 0 9px;
    font-size: 10.5px;
    border: 1px solid var(--sys-border);
    border-radius: var(--sys-radius-btn);
    background: var(--sys-surface);
    color: var(--sys-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
}

    .btn-line-xs:hover {
        background: var(--sys-row-line-light);
        color: var(--sys-text);
        text-decoration: none;
    }

    .btn-line-xs.btn-line-accent {
        background: var(--sys-primary);
        border-color: var(--sys-primary);
        color: #fff;
        font-weight: 600;
    }

        .btn-line-xs.btn-line-accent:hover {
            background: var(--sys-primary-hover);
            border-color: var(--sys-primary-hover);
            color: #fff;
        }

    .btn-line-xs.btn-line-danger {
        color: #c94a42;
        border-color: #c94a42;
    }

        .btn-line-xs.btn-line-danger:hover {
            background: rgba(201,74,66,.08);
            color: #c94a42;
        }

.btn-primary {
    height: 30px;
    padding: 0 15px;
    font-size: 11.5px;
    font-weight: 600;
    border: 1px solid var(--sys-primary);
    border-radius: var(--sys-radius-btn);
    background: var(--sys-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    cursor: pointer;
}

    .btn-primary:hover {
        background: var(--sys-primary-hover);
        border-color: var(--sys-primary-hover);
        color: #fff;
        text-decoration: none;
    }

/* ===== شريط تقدّم شعري ===== */
.progress-hair {
    height: 3px;
    width: 100%;
    background: var(--sys-row-line);
    border-radius: 2px;
    overflow: hidden;
}

    .progress-hair > span {
        display: block;
        height: 100%;
        background: var(--sys-primary);
    }

/* ===== لوحة جانبية/سفلية ===== */
.side-panel {
    background: var(--sys-surface);
    border: 1px solid var(--sys-border);
    border-radius: var(--sys-radius-card);
    box-shadow: var(--sys-shadow);
    padding: 14px;
}

    .side-panel .side-panel-title {
        font-size: 12.5px;
        font-weight: 700;
        margin-bottom: 8px;
        color: var(--sys-text);
    }

/* ===== الترقيم ===== */
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 11px;
    color: var(--sys-text-light);
}

    .pager .pager-pages {
        display: flex;
        gap: 4px;
    }

    .pager .pager-page {
        min-width: 22px;
        height: 22px;
        padding: 0 4px;
        border: 1px solid var(--sys-border);
        border-radius: 5px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 10.5px;
        cursor: pointer;
        text-decoration: none;
        color: var(--sys-text-secondary);
    }

        .pager .pager-page.active {
            border-color: var(--sys-primary);
            color: var(--sys-primary-text);
        }
