/* ============================================================
   iCare - Enterprise Suite | styles.css  v2
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;700;900&display=swap');

/* ── TOKENS ─────────────────────────────────────────────── */
:root {
    --bg-base:          #03050a;
    --bg-sidebar:       rgba(9,13,26,0.95);
    --bg-panel:         rgba(15,23,42,0.52);
    --bg-user-card:     rgba(5,8,23,0.65);
    --bg-nav-hover:     rgba(255,255,255,0.05);

    --text-primary:   #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted:     #64748b;
    --text-heading:   #ffffff;

    --border-subtle:    rgba(3,5,10,0.25);
    --border-soft:      rgba(3,5,10,0.35);
    --sidebar-border:   rgba(3,5,10,0.20);
    --sidebar-shadow:   -10px 0 40px rgba(0,0,0,0.55);
    --panel-shadow:     0 10px 30px rgba(0,0,0,0.30);
    --header-border:    rgba(255,255,255,0.04);

    --scrollbar-thumb:  rgba(255,255,255,0.09);
    --scrollbar-hover:  rgba(168,85,247,0.30);

    --active-main-bg:   rgba(59,130,246,0.14);
    --active-sub-bg:    rgba(99,102,241,0.13);
    --status-border:    #050811;

    --nav-sec-bg:       rgba(255,255,255,0.04);
    --nav-sec-border:   rgba(255,255,255,0.08);
    --nav-sec-hover-bg:     rgba(255,255,255,0.08);
    --nav-sec-hover-border: rgba(255,255,255,0.15);
    --nav-sec-text:         #7a8ba0;
    --nav-sec-hover-text:   #e2e8f0;

    --theme-toggle-bg:     rgba(255,255,255,0.05);
    --theme-toggle-border: rgba(255,255,255,0.09);
    --theme-toggle-hover:  rgba(255,255,255,0.10);
    --theme-label-sub:     #64748b;

    --overlay-bg: rgba(0,0,0,0.52);
    --sidebar-w: 268px;

    --ease-smooth: cubic-bezier(.22,.61,.36,1);
    --ease-spring: cubic-bezier(.34,1.56,.64,1);
    --dur-fast: 180ms;
    --dur-med: 280ms;
    --dur-slow: 420ms;
}

[data-theme="light"] {
    --bg-base:       #edf1f7;
    --bg-sidebar:    rgba(251,253,255,0.97);
    --bg-panel:      rgba(255,255,255,0.80);
    --bg-user-card:  rgba(242,246,254,0.98);
    --bg-nav-hover:  rgba(59,130,246,0.06);

    --text-primary:   #1e293b;
    --text-secondary: #475569;
    --text-muted:     #94a3b8;
    --text-heading:   #0f172a;

    --border-subtle:    rgba(237,241,247,0.40);
    --border-soft:      rgba(237,241,247,0.50);
    --sidebar-border:   rgba(237,241,247,0.35);
    --sidebar-shadow:   -4px 0 30px rgba(80,110,180,0.12);
    --panel-shadow:     0 4px 24px rgba(30,60,120,0.09);
    --header-border:    rgba(15,23,42,0.06);

    --scrollbar-thumb: rgba(99,102,241,0.20);
    --scrollbar-hover: rgba(99,102,241,0.45);

    --active-main-bg: rgba(59,130,246,0.10);
    --active-sub-bg:  rgba(99,102,241,0.10);
    --status-border:  #e2eaf5;

    --nav-sec-bg:           rgba(15,23,42,0.04);
    --nav-sec-border:       rgba(15,23,42,0.09);
    --nav-sec-hover-bg:     rgba(59,130,246,0.07);
    --nav-sec-hover-border: rgba(59,130,246,0.18);
    --nav-sec-text:         #64748b;
    --nav-sec-hover-text:   #1e293b;

    --theme-toggle-bg:     rgba(15,23,42,0.05);
    --theme-toggle-border: rgba(15,23,42,0.11);
    --theme-toggle-hover:  rgba(15,23,42,0.09);
    --theme-label-sub:     #64748b;

    --overlay-bg: rgba(0,0,0,0.32);
}

/* ── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    overflow: hidden;
    transition: background 0.5s ease, color 0.4s ease;
}

/* ── App Splash ───────────────────────────────────────── */
.app-splash {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(circle at 15% 20%, rgba(99,102,241,0.18), transparent 50%),
        radial-gradient(circle at 85% 80%, rgba(168,85,247,0.15), transparent 55%),
        var(--bg-base);
    transition: opacity .55s ease, visibility .55s ease;
}
.app-splash.hidden { opacity: 0; visibility: hidden; }
.app-splash-core { text-align: center; }
.app-splash-logo {
    width: 90px; height: 90px; border-radius: 28px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 18px;
    box-shadow: 0 22px 60px rgba(99,102,241,0.35);
    position: relative; overflow: hidden;
}
.app-splash-logo::after {
    content: ''; position: absolute; inset: -40%;
    background: conic-gradient(from 90deg, transparent, rgba(255,255,255,0.35), transparent);
    animation: appSplashSpin 2.2s linear infinite;
}
.app-splash-logo svg { width: 38px; height: 38px; color: #fff; position: relative; z-index: 1; }
.app-splash-title {
    font-size: 30px; font-weight: 900; letter-spacing: -.02em;
    background: linear-gradient(135deg, #60a5fa, #a855f7);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.app-splash-sub {
    font-size: 11px; letter-spacing: .26em; text-transform: uppercase;
    color: var(--text-muted); font-weight: 800; margin-top: 6px;
}
.app-splash-bar { display: flex; gap: 6px; justify-content: center; margin-top: 18px; }
.app-splash-bar span {
    width: 16px; height: 4px; border-radius: 999px;
    background: rgba(99,102,241,0.35);
    animation: appSplashPulse 1.1s ease-in-out infinite;
}
.app-splash-bar span:nth-child(2){ animation-delay: .15s; }
.app-splash-bar span:nth-child(3){ animation-delay: .3s; }
@keyframes appSplashPulse { 0%,100%{ transform: scaleX(.8); opacity:.5;} 50%{ transform: scaleX(1.35); opacity:1;} }
@keyframes appSplashSpin { to { transform: rotate(360deg); } }

/* ── GLOBAL AMBIENT BLOBS — الخلفية الحية لكل الموقع ─────── */
.ambient-blob-1 {
    background: radial-gradient(ellipse at center,
        rgba(37,99,235,0.20) 0%, rgba(99,102,241,0.11) 45%, transparent 70%);
    animation: blobDrift1 13s ease-in-out infinite alternate;
}
.ambient-blob-2 {
    background: radial-gradient(ellipse at center,
        rgba(147,51,234,0.16) 0%, rgba(168,85,247,0.09) 45%, transparent 70%);
    animation: blobDrift2 16s ease-in-out infinite alternate;
}
.ambient-blob-3 {
    background: radial-gradient(ellipse at center,
        rgba(16,185,129,0.10) 0%, rgba(5,150,105,0.05) 55%, transparent 75%);
    animation: blobDrift3 11s ease-in-out infinite alternate;
}
.ambient-blob-4 {
    background: radial-gradient(ellipse at center,
        rgba(79,70,229,0.15) 0%, rgba(99,102,241,0.08) 45%, transparent 70%);
    animation: blobDrift4 19s ease-in-out infinite alternate;
}
[data-theme="light"] .ambient-blob-1 { background: radial-gradient(ellipse, rgba(37,99,235,0.09), transparent 70%); }
[data-theme="light"] .ambient-blob-2 { background: radial-gradient(ellipse, rgba(147,51,234,0.08), transparent 70%); }
[data-theme="light"] .ambient-blob-3 { background: radial-gradient(ellipse, rgba(16,185,129,0.05), transparent 70%); }
[data-theme="light"] .ambient-blob-4 { background: radial-gradient(ellipse, rgba(79,70,229,0.07), transparent 70%); }

@keyframes blobDrift1 {
    from { transform: translate(0,0) scale(1); }
    to   { transform: translate(-28px,18px) scale(1.07); }
}
@keyframes blobDrift2 {
    from { transform: translate(0,0) scale(1); }
    to   { transform: translate(22px,-14px) scale(1.05); }
}
@keyframes blobDrift3 {
    from { transform: translate(-50%,-50%) scale(1); }
    to   { transform: translate(calc(-50% + 18px),calc(-50% - 16px)) scale(1.04); }
}
@keyframes blobDrift4 {
    from { transform: translate(0,0) scale(1); }
    to   { transform: translate(-18px,26px) scale(1.06); }
}

/* ── SUBTLE MESH GRID OVERLAY ───────────────────────────── */
body::after {
    content: '';
    position: fixed; inset: 0; pointer-events: none; z-index: 1;
    background-image:
        linear-gradient(rgba(99,102,241,0.020) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99,102,241,0.020) 1px, transparent 1px);
    background-size: 52px 52px;
    mask-image: radial-gradient(ellipse 90% 90% at 50% 50%, black 10%, transparent 100%);
}
[data-theme="light"] body::after {
    background-image:
        linear-gradient(rgba(99,102,241,0.026) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99,102,241,0.026) 1px, transparent 1px);
}

/* ── TELEGRAM RIPPLE ─────────────────────────────────────── */
#theme-ripple {
    position: fixed; inset: 0;
    pointer-events: none; z-index: 9999; overflow: hidden;
}
#theme-ripple .ripple-circle {
    position: absolute; border-radius: 50%;
    transform: scale(0); transform-origin: center;
    transition: transform .65s cubic-bezier(.4,0,.2,1), opacity .65s cubic-bezier(.4,0,.2,1);
    opacity: 1; pointer-events: none;
}
#theme-ripple .ripple-circle.expanding { transform: scale(1); }
#theme-ripple .ripple-circle.done      { opacity: 0; }

/* ── OVERLAY (mobile) ───────────────────────────────────── */
#sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(3px);
    z-index: 40;
    opacity: 0;
    transition: opacity var(--dur-med) var(--ease-smooth);
    touch-action: none;
    overscroll-behavior: contain;
}

/* ── Panel Loading Overlay ────────────────────────────── */
.panel-loading {
    position: absolute; inset: 0; z-index: 140;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(6px);
    transition: opacity var(--dur-fast) var(--ease-smooth);
    opacity: 1;
    visibility: visible;
}
.panel-loading.hidden { opacity: 0; pointer-events: none; visibility: hidden; }
.panel-loading-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 18px 22px;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    box-shadow: var(--panel-shadow);
}
.pl-ring {
    width: 34px; height: 34px; border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: #6366f1;
    animation: plSpin .7s linear infinite;
}
.pl-title { font-size: 12px; font-weight: 900; color: var(--text-primary); }
.pl-sub { font-size: 10px; font-weight: 700; color: var(--text-muted); }
@keyframes plSpin { to { transform: rotate(360deg); } }
#sidebar-overlay.visible { opacity: 1; }

/* ── Global Modal Dimmer (iframe-aware) ─────────────────── */
#global-modal-dim {
    position: fixed; inset: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(4px);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-fast) var(--ease-smooth);
}
#global-modal-dim.visible { opacity: 1; pointer-events: all; }

/* Keep categories/items iframes ABOVE global dimmer so their modals show correctly */
#inv_categories-tab { position: relative; z-index: 80; isolation: isolate; }
#categories-iframe  { position: relative; z-index: 80; }
#inv_items-tab      { position: relative; z-index: 80; isolation: isolate; }
#items-iframe       { position: relative; z-index: 80; }
/* sys_users iframe — modals live inside the iframe, must be above global dim */
#sys_users-tab      { position: relative; z-index: 80; isolation: isolate; }
#users-iframe       { position: relative; z-index: 80; }
/* settings-panel iframe — same treatment */
#sys_settings-tab   { position: relative; z-index: 80; isolation: isolate; }
#settings-iframe    { position: relative; z-index: 80; }
/* settings iframe */
#sys_settings-tab   { position: relative; z-index: 80; isolation: isolate; }
#settings-iframe    { position: relative; z-index: 80; }
/* Maintenance iframe — lower z-index to appear below sidebar */
#maint_new-tab      { position: relative; z-index: 10; isolation: isolate; }
#maintenance-iframe { position: relative; z-index: 10; }
/* hr_employees iframe — modals live inside the iframe, must be above global dim */
#hr_employees-tab   { position: relative; z-index: 80; isolation: isolate; }
#employees-iframe    { position: relative; z-index: 80; }

/* ── SIDEBAR ────────────────────────────────────────────── */
.glass-sidebar {
    background: var(--bg-sidebar);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-left: 1px solid var(--sidebar-border);
    box-shadow: var(--sidebar-shadow);
    transition: background var(--dur-med) var(--ease-smooth), box-shadow var(--dur-med) var(--ease-smooth), border-color var(--dur-med) var(--ease-smooth);
    overscroll-behavior: contain;
}

#sidebar {
    position: fixed; top: 0; right: 0;
    height: 100%; z-index: 9999;
    width: var(--sidebar-w);
    display: flex; flex-direction: column;
    transition: transform var(--dur-med) var(--ease-smooth);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* Android-style overlay sidebar - works on all screen sizes */
#sidebar {
    transform: translateX(100%);
    width: min(var(--sidebar-w), 85vw);
    max-width: 320px;
}

#sidebar.sidebar-open {
    transform: translateX(0);
}

#main-content {
    padding-right: 0 !important;
    transition: none;
}

#sidebar-overlay {
    display: block;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 9998;
}

#sidebar-overlay.overlay-visible {
    opacity: 1;
    visibility: visible;
}

/* Responsive width adjustments */
@media (max-width: 480px) {
    #sidebar {
        width: 78vw;
        max-width: 280px;
    }
}

@media (max-width: 380px) {
    #sidebar {
        width: 82vw;
        max-width: 260px;
    }
}

/* ── SIDEBAR TOGGLE BUTTON — Always Fixed, Always Visible ── */
#sidebar-toggle-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.08);
    border: 1.5px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2), inset 0 1px 2px rgba(255,255,255,0.08);
    transition:
        right var(--dur-med) var(--ease-smooth),
        top var(--dur-med) var(--ease-smooth),
        background var(--dur-fast) var(--ease-smooth),
        border-color var(--dur-fast) var(--ease-smooth),
        color var(--dur-fast) var(--ease-smooth),
        box-shadow var(--dur-fast) var(--ease-smooth),
        transform var(--dur-fast) var(--ease-smooth);
}

#sidebar-toggle-btn:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.75);
    box-shadow: 0 4px 16px rgba(0,0,0,0.25), inset 0 1px 2px rgba(255,255,255,0.1);
    transform: translateY(-2px);
}

#sidebar-toggle-btn:active {
    transform: scale(0.96) translateY(0);
}

/* ── When sidebar is OPEN — restore original gradient style ── */
#sidebar-toggle-btn.sidebar-open {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: 1px solid rgba(255,255,255,0.18);
    color: white;
    box-shadow: 0 4px 16px rgba(99,102,241,0.4);
}

#sidebar-toggle-btn.sidebar-open:hover {
    box-shadow: 0 0 24px rgba(99,102,241,.70);
    transform: scale(1.08);
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

        #sidebar-toggle-btn.sidebar-open:active {
            transform: scale(0.96);
        }

/* ══════════════════════════════════════════════════════════
   SIDEBAR RESPONSIVE — Mobile & Tablet Optimization
   ══════════════════════════════════════════════════════════ */

/* ── Tablet (768px - 1023px) ────────────────────────────── */
@media (max-width: 1023px) and (min-width: 768px) {
    #sidebar {
        width: min(280px, 75vw);
    }
    
    .brand-logo {
        width: 42px;
        height: 42px;
    }
    
    .brand-name {
        font-size: 17px;
    }
    
    .nav-item {
        padding: 7px 9px;
        font-size: 12.5px;
    }
    
    .nav-item .ni {
        width: 28px;
        height: 28px;
    }
    
    .nav-accordion-btn {
        padding: 6px 9px;
        font-size: 12px;
    }
    
    .sub-nav-item {
        padding: 6px 9px;
        font-size: 12px;
    }
    
    .user-avatar-wrap img {
        width: 36px;
        height: 36px;
    }
}

/* ── Mobile Landscape & Small Tablets (481px - 767px) ──── */
@media (max-width: 767px) and (min-width: 481px) {
    #sidebar {
        width: min(260px, 80vw);
    }
    
    .brand-section {
        padding: 14px 16px 10px;
    }
    
    .brand-logo {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }
    
    .brand-logo svg {
        width: 18px;
        height: 18px;
    }
    
    .brand-name {
        font-size: 16px;
    }
    
    .brand-sub {
        font-size: 8px;
    }
    
    .sidebar-nav {
        padding: 6px 6px 4px;
    }
    
    .nav-item {
        padding: 7px 8px;
        font-size: 12px;
        gap: 8px;
    }
    
    .nav-item .ni {
        width: 28px;
        height: 28px;
        border-radius: 7px;
    }
    
    .nav-item .ni svg {
        width: 14px;
        height: 14px;
    }
    
    .nav-accordion-btn {
        padding: 6px 8px;
        font-size: 11.5px;
    }
    
    .nav-accordion-btn .ni {
        width: 26px;
        height: 26px;
    }
    
    .nav-accordion-btn .ni svg {
        width: 13px;
        height: 13px;
    }
    
    .acc-chevron {
        width: 13px;
        height: 13px;
    }
    
    .sub-nav-item {
        padding: 6px 8px;
        font-size: 11.5px;
    }
    
    .sub-nav-icon {
        width: 24px;
        height: 24px;
        border-radius: 6px;
    }
    
    .sub-nav-icon svg {
        width: 13px;
        height: 13px;
    }
    
    #theme-toggle-btn {
        padding: 8px 10px;
    }
    
    .theme-icon-orb {
        width: 34px;
        height: 34px;
    }
    
    .theme-label-main {
        font-size: 12px;
    }
    
    .theme-label-sub {
        font-size: 9.5px;
    }
    
    .user-status-card {
        padding: 10px 12px 45px;
    }
    
    .user-avatar-wrap img {
        width: 36px;
        height: 36px;
        border-radius: 9px;
    }
    
    .user-name {
        font-size: 12px;
    }
    
    .user-role {
        font-size: 9.5px;
    }
    
    .logout-btn {
        width: 30px;
        height: 30px;
    }
    
    #sidebar-toggle-btn {
        top: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
    }
}

/* ── Mobile Portrait (320px - 480px) ────────────────────── */
@media (max-width: 480px) {
    #sidebar {
        width: min(240px, 85vw);
        max-width: 280px;
    }
    
    .brand-section {
        padding: 12px 14px 8px;
    }
    
    .brand-logo {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }
    
    .brand-logo svg {
        width: 16px;
        height: 16px;
    }
    
    .brand-name {
        font-size: 15px;
    }
    
    .brand-sub {
        font-size: 7.5px;
        letter-spacing: .18em;
    }
    
    .sidebar-nav {
        padding: 5px 5px 3px;
        gap: 1px;
    }
    
    .nav-item {
        padding: 6px 7px;
        font-size: 11.5px;
        gap: 7px;
        border-radius: 8px;
    }
    
    .nav-item .ni {
        width: 26px;
        height: 26px;
        border-radius: 6px;
    }
    
    .nav-item .ni svg {
        width: 13px;
        height: 13px;
    }
    
    .nav-accordion-btn {
        padding: 5px 7px;
        font-size: 11px;
        border-radius: 8px;
    }
    
    .nav-accordion-btn .ni {
        width: 24px;
        height: 24px;
    }
    
    .nav-accordion-btn .ni svg {
        width: 12px;
        height: 12px;
    }
    
    .acc-chevron {
        width: 12px;
        height: 12px;
    }
    
    .acc-badge {
        font-size: 9px;
        padding: 1px 5px;
    }
    
    .sub-nav-list {
        padding: 3px 0 3px 1px;
        margin-right: 6px;
    }
    
    .sub-nav-item {
        padding: 5px 7px;
        font-size: 11px;
        gap: 7px;
        border-radius: 8px;
    }
    
    .sub-nav-icon {
        width: 22px;
        height: 22px;
        border-radius: 5px;
    }
    
    .sub-nav-icon svg {
        width: 12px;
        height: 12px;
    }
    
    .sub-dot {
        width: 4px;
        height: 4px;
    }
    
    #theme-toggle-btn {
        padding: 7px 9px;
        border-radius: 10px;
        margin-bottom: 6px;
    }
    
    .theme-icon-orb {
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }
    
    .theme-icon-orb svg {
        width: 15px;
        height: 15px;
    }
    
    .theme-label-main {
        font-size: 11.5px;
    }
    
    .theme-label-sub {
        font-size: 9px;
    }
    
    .theme-pill {
        width: 32px;
        height: 18px;
    }
    
    .theme-pill-dot {
        width: 11px;
        height: 11px;
    }
    
    .user-status-card {
        padding: 9px 10px 40px;
    }
    
    .user-avatar-wrap img {
        width: 34px;
        height: 34px;
        border-radius: 8px;
    }
    
    .user-online-dot {
        width: 9px;
        height: 9px;
    }
    
    .user-name {
        font-size: 11.5px;
    }
    
    .user-role {
        font-size: 9px;
    }
    
    .logout-btn {
        width: 28px;
        height: 28px;
        border-radius: 7px;
    }
    
    .logout-btn svg {
        width: 13px;
        height: 13px;
    }
    
    #sidebar-toggle-btn {
        top: 14px;
        right: 14px;
        width: 42px;
        height: 42px;
        border-radius: 10px;
    }
    
    #sidebar-toggle-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* ── Extra Small Mobile (under 380px) ───────────────────── */
@media (max-width: 380px) {
    #sidebar {
        width: min(220px, 88vw);
        max-width: 260px;
    }
    
    .brand-section {
        padding: 10px 12px 7px;
    }
    
    .brand-logo {
        width: 32px;
        height: 32px;
        border-radius: 9px;
    }
    
    .brand-logo svg {
        width: 14px;
        height: 14px;
    }
    
    .brand-name {
        font-size: 14px;
    }
    
    .brand-sub {
        font-size: 7px;
        letter-spacing: .16em;
    }
    
    .sidebar-nav {
        padding: 4px 4px 2px;
    }
    
    .nav-item {
        padding: 5px 6px;
        font-size: 11px;
        gap: 6px;
        border-radius: 7px;
    }
    
    .nav-item .ni {
        width: 24px;
        height: 24px;
        border-radius: 5px;
    }
    
    .nav-item .ni svg {
        width: 12px;
        height: 12px;
    }
    
    .nav-accordion-btn {
        padding: 4px 6px;
        font-size: 10.5px;
        border-radius: 7px;
    }
    
    .nav-accordion-btn .ni {
        width: 22px;
        height: 22px;
    }
    
    .nav-accordion-btn .ni svg {
        width: 11px;
        height: 11px;
    }
    
    .acc-chevron {
        width: 11px;
        height: 11px;
    }
    
    .acc-badge {
        font-size: 8px;
        padding: 1px 4px;
    }
    
    .sub-nav-list {
        padding: 2px 0 2px 1px;
        margin-right: 5px;
    }
    
    .sub-nav-item {
        padding: 4px 6px;
        font-size: 10.5px;
        gap: 6px;
        border-radius: 7px;
    }
    
    .sub-nav-icon {
        width: 20px;
        height: 20px;
        border-radius: 4px;
    }
    
    .sub-nav-icon svg {
        width: 11px;
        height: 11px;
    }
    
    .sub-dot {
        width: 3.5px;
        height: 3.5px;
    }
    
    #theme-toggle-btn {
        padding: 6px 8px;
        border-radius: 9px;
        margin-bottom: 5px;
    }
    
    .theme-icon-orb {
        width: 30px;
        height: 30px;
        border-radius: 7px;
    }
    
    .theme-icon-orb svg {
        width: 14px;
        height: 14px;
    }
    
    .theme-label-main {
        font-size: 11px;
    }
    
    .theme-label-sub {
        font-size: 8.5px;
    }
    
    .theme-pill {
        width: 30px;
        height: 17px;
    }
    
    .theme-pill-dot {
        width: 10px;
        height: 10px;
    }
    
    .user-status-card {
        padding: 8px 9px 35px;
    }
    
    .user-avatar-wrap img {
        width: 32px;
        height: 32px;
        border-radius: 7px;
    }
    
    .user-online-dot {
        width: 8px;
        height: 8px;
    }
    
    .user-name {
        font-size: 11px;
    }
    
    .user-role {
        font-size: 8.5px;
    }
    
    .logout-btn {
        width: 26px;
        height: 26px;
        border-radius: 6px;
    }
    
    .logout-btn svg {
        width: 12px;
        height: 12px;
    }
    
    #sidebar-toggle-btn {
        top: 10px;
        right: 10px;
        width: 38px;
        height: 38px;
        border-radius: 9px;
    }
    
    #sidebar-toggle-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* ── Sidebar Toggle Button Position When Open ───────────── */
@media (max-width: 1023px) {
    #sidebar-toggle-btn.sidebar-open {
        transform: translateX(calc(-1 * min(var(--sidebar-w), 85vw) + 10px));
    }
}

@media (max-width: 480px) {
    #sidebar-toggle-btn.sidebar-open {
        transform: translateX(calc(-1 * min(240px, 85vw) + 8px));
    }
}

@media (max-width: 380px) {
    #sidebar-toggle-btn.sidebar-open {
        transform: translateX(calc(-1 * min(220px, 88vw) + 6px));
    }
}

/* Hamburger Menu Icon Styles */
.hamburger-icon {
    width: 20px;
    height: 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.hamburger-icon span {
    width: 100%;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.hamburger-icon.active span:nth-child(1) {
    transform: translateY(0) rotate(0);
}

.hamburger-icon.active span:nth-child(2) {
    opacity: 1;
    transform: scaleX(1);
}

.hamburger-icon.active span:nth-child(3) {
    transform: translateY(0) rotate(0);
}

/* Close icon flip animation */
#close-icon {
    opacity: 0;
    transform: rotate(45deg) scale(0.8);
    transition: all 0.3s ease;
}

#sidebar-toggle-btn.sidebar-open #close-icon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

#sidebar-toggle-btn.sidebar-open .hamburger-icon {
    opacity: 0;
    transform: scale(0.8);
}

/* Toggle button positioning animation */
#sidebar-toggle-btn {
    transition: 
        right 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        top 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        background 0.3s ease,
        transform 0.3s ease;
}

#sidebar-toggle-btn.sidebar-open {
    right: 20px !important;
    transform: translateX(-282px);
}

/* Very small screens */
@media (max-width: 380px) {
    #sidebar-toggle-btn {
        top: 8px !important;
        right: 10px !important;
        width: 40px !important;
        height: 40px !important;
    }
    
    #sidebar-toggle-btn.sidebar-open {
        transform: translateX(-262px);
    }
}

/* Light mode styles for toggle button */
[data-theme="light"] #sidebar-toggle-btn {
    background: rgba(15,23,42,0.06);
    border-color: rgba(15,23,42,0.12);
    color: rgba(15,23,42,0.5);
}

[data-theme="light"] #sidebar-toggle-btn:hover {
    background: rgba(15,23,42,0.10);
    border-color: rgba(15,23,42,0.18);
    color: rgba(15,23,42,0.7);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1), inset 0 1px 2px rgba(255,255,255,0.1);
}

[data-theme="light"] #sidebar-toggle-btn.sidebar-open {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: 1px solid rgba(99,102,241,0.25);
    color: white;
    box-shadow: 0 4px 16px rgba(99,102,241,0.3);
}

[data-theme="light"] #sidebar-toggle-btn.sidebar-open:hover {
    box-shadow: 0 0 24px rgba(99,102,241,.60);
}

/* ── ICON FLIP & ROTATION ANIMATION ─────────────────────────── */
#sidebar-toggle-btn {
    perspective: 1000px;
}

.icon-flip {
    position: absolute;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-flip.active {
    opacity: 1;
    transform: rotateY(0deg);
    pointer-events: auto;
}

.icon-flip:not(.active) {
    opacity: 0;
    transform: rotateY(90deg);
    pointer-events: none;
}

#sidebar-toggle-btn.sidebar-open {
    transform: rotate(180deg);
}

#sidebar-toggle-btn.sidebar-open #toggle-icon-menu {
    opacity: 0;
    transform: rotateY(90deg);
}

#sidebar-toggle-btn.sidebar-open #toggle-icon-arrow {
    opacity: 1;
    transform: rotateY(0deg);
}

/* ── BRAND ──────────────────────────────────────────────── */
.brand-section {
    padding: 16px 18px 12px;
    text-align: center;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}
.brand-logo {
    width: 46px; height: 46px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 15px;
    margin: 0 auto 8px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 22px rgba(99,102,241,.28);
    border: 1px solid rgba(255,255,255,.12);
    position: relative; overflow: hidden;
}
.brand-logo svg { position: relative; z-index: 1; color: #fff; }
.brand-name {
    font-size: 19px; font-weight: 900;
    background: linear-gradient(135deg, #60a5fa 0%, #a855f7 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    line-height: 1;
}
.brand-sub {
    font-size: 9px; letter-spacing: .22em;
    color: var(--text-muted); font-weight: 700; text-transform: uppercase; margin-top: 2px;
}

/* ── NAV ────────────────────────────────────────────────── */
.sidebar-nav {
    flex: 1; overflow-y: auto;
    padding: 8px 8px 4px;
    display: flex; flex-direction: column; gap: 2px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { 
    background: rgba(99,102,241,.4); 
    border-radius: 99px;
    transition: background .2s ease;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover { 
    background: rgba(99,102,241,.6); 
}
[data-theme="light"] .sidebar-nav::-webkit-scrollbar-thumb { 
    background: rgba(99,102,241,.3); 
}
[data-theme="light"] .sidebar-nav::-webkit-scrollbar-thumb:hover { 
    background: rgba(99,102,241,.5); 
}

/* Main direct link buttons */
.nav-item {
    width: 100%; display: flex; align-items: center; gap: 9px;
    padding: 8px 10px; border-radius: 10px;
    font-size: 13px; font-weight: 700;
    color: var(--text-secondary);
    background: transparent; border: none; cursor: pointer; text-align: right;
    transition: background var(--dur-fast) var(--ease-smooth), color var(--dur-fast) var(--ease-smooth);
}
.nav-item:hover { background: var(--bg-nav-hover); color: var(--text-heading); }
.nav-item .ni { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-item .ni svg { width: 15px; height: 15px; }

.active-main-tab {
    background: linear-gradient(to left, var(--active-main-bg), transparent);
    border-right: 3px solid #3b82f6;
    color: var(--text-heading);
}

/* Divider */
.nav-divider { height: 1px; background: var(--border-subtle); margin: 5px 6px; }

/* Accordion trigger — SECONDARY STYLED */
.nav-accordion-btn {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    padding: 7px 10px 7px 10px;
    border-radius: 10px;
    font-size: 12.5px; font-weight: 700;
    color: var(--nav-sec-text);
    background: var(--nav-sec-bg);
    border: 1px solid var(--nav-sec-border);
    cursor: pointer; text-align: right;
    margin-top: 2px;
    transition: background var(--dur-fast) var(--ease-smooth), border-color var(--dur-fast) var(--ease-smooth), color var(--dur-fast) var(--ease-smooth);
}
.nav-accordion-btn:hover {
    background: var(--nav-sec-hover-bg);
    border-color: var(--nav-sec-hover-border);
    color: var(--nav-sec-hover-text);
}
.nav-accordion-btn .ni { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-accordion-btn .ni svg { width: 14px; height: 14px; }
.nav-acc-left { display: flex; align-items: center; gap: 8px; }
.nav-acc-right { display: flex; align-items: center; gap: 5px; }
.acc-chevron { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; transition: transform var(--dur-med) var(--ease-smooth), color var(--dur-fast) var(--ease-smooth); }
.nav-accordion-btn.open .acc-chevron { transform: rotate(180deg); color: var(--text-secondary); }

/* Badge on accordion */
.acc-badge {
    font-size: 10px; font-weight: 800; line-height: 1;
    padding: 2px 6px; border-radius: 6px;
    background: rgba(99,102,241,0.18); color: #818cf8;
    border: 1px solid rgba(99,102,241,0.22);
}
[data-theme="light"] .acc-badge { background: rgba(99,102,241,0.10); border-color: rgba(99,102,241,0.18); }

/* Accordion body */
.accordion-content {
    max-height: 0; opacity: 0; overflow: hidden;
    transition: max-height var(--dur-med) var(--ease-smooth), opacity var(--dur-fast) var(--ease-smooth);
}
.accordion-content.open { max-height: 500px; opacity: 1; }

.sub-nav-list {
    display: flex; flex-direction: column; gap: 1px;
    padding: 4px 0 4px 2px; margin-right: 8px;
    border-right: 2px solid rgba(255,255,255,0.06);
}
[data-theme="light"] .sub-nav-list { border-color: rgba(15,23,42,0.09); }

/* ── Sub Nav Item — New Design ────────────────────────────── */
.sub-nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 12px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    text-align: right;
    transition: all 200ms var(--ease-smooth);
    position: relative;
}
.sub-nav-item:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.07);
    color: var(--text-primary);
}
.sub-nav-item:hover .sub-nav-icon {
    transform: scale(1.1);
    filter: brightness(1.2);
}
.sub-nav-item.active-sub-tab {
    background: linear-gradient(135deg, rgba(99,102,241,.18), rgba(14,165,233,.07));
    border-color: rgba(99,102,241,0.22);
    color: #e0e7ff !important;
    font-weight: 700;
    box-shadow: 0 2px 12px rgba(99,102,241,.12), inset 0 1px 0 rgba(255,255,255,.07);
}
.sub-nav-item.active-sub-tab::after {
    content: '';
    position: absolute;
    right: 0; top: 20%; bottom: 20%;
    width: 2.5px;
    border-radius: 99px;
    background: linear-gradient(to bottom, #6366f1, #38bdf8);
}
.sub-nav-item.active-sub-tab .sub-nav-icon {
    filter: brightness(1.3);
    box-shadow: 0 0 10px currentColor;
}

/* ── Sub Nav Icon — colored pill ─────────────────────────── */
.sub-nav-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 200ms var(--ease-smooth);
}

/* ── Sub Nav Label ────────────────────────────────────────── */
.sub-nav-label {
    flex: 1;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.01em;
}

/* Light mode overrides */
[data-theme="light"] .sub-nav-item {
    color: #64748b;
}
[data-theme="light"] .sub-nav-item:hover {
    background: rgba(15,23,42,0.06);
    border-color: rgba(15,23,42,0.10);
    color: #1e293b;
}
[data-theme="light"] .sub-nav-item.active-sub-tab {
    background: linear-gradient(135deg, rgba(99,102,241,.13), rgba(14,165,233,.07));
    border-color: rgba(99,102,241,0.25);
    color: #3730a3 !important;
}

.sub-dot {
    width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0;
    background: rgba(148,163,184,0.35); transition: background .2s ease, box-shadow .2s ease;
}
.sub-nav-item.active-sub-tab .sub-dot {
    background: #6366f1; box-shadow: 0 0 7px rgba(99,102,241,.7);
}

/* icon color helpers */
.ni-indigo  { background: rgba(99,102,241,0.13); }
.ni-purple  { background: rgba(168,85,247,0.13); }
.ni-emerald { background: rgba(16,185,129,0.13); }
.ni-orange  { background: rgba(249,115,22,0.13); }
.ni-blue    { background: rgba(59,130,246,0.13); }
.ni-rose    { background: rgba(244,63,94,0.13); }

/* ── THEME TOGGLE ───────────────────────────────────────── */
#theme-toggle-btn {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 9px 11px;
    border-radius: 12px;
    background: var(--theme-toggle-bg);
    border: 1px solid var(--theme-toggle-border);
    cursor: pointer; position: relative; overflow: hidden;
    transition: background .2s ease, border-color .2s ease, transform .18s ease;
    margin-bottom: 7px;
}
#theme-toggle-btn:hover { background: var(--theme-toggle-hover); transform: translateY(-1px); }
#theme-toggle-btn:active { transform: scale(.97); }

/* Icon orb */
.theme-icon-orb {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; position: relative; overflow: hidden;
    transition: transform .55s cubic-bezier(.34,1.56,.64,1);
}
.theme-icon-orb.orb-dark {
    background: linear-gradient(135deg, #0c1526 0%, #1a3560 100%);
    box-shadow: 0 0 0 1px rgba(99,102,241,.22), 0 4px 14px rgba(0,0,0,.45);
}
.theme-icon-orb.orb-light {
    background: linear-gradient(135deg, #fef3c7 0%, #fbbf24 55%, #f97316 100%);
    box-shadow: 0 0 0 1px rgba(245,158,11,.32), 0 4px 14px rgba(249,115,22,.28);
}
.theme-icon-orb svg { width: 17px; height: 17px; position: relative; z-index: 1; transition: opacity .25s ease; }

/* Stars inside dark orb */
.orb-dark::before {
    content: '⋆'; position: absolute;
    top: 3px; right: 5px; font-size: 7px; color: rgba(255,255,255,.55); line-height: 1;
}
.orb-dark::after {
    content: '·'; position: absolute;
    bottom: 5px; left: 6px; font-size: 10px; color: rgba(255,255,255,.3); line-height: 1;
}
/* Rotating shine inside light orb */
.orb-light::before {
    content: ''; position: absolute; inset: -6px;
    background: conic-gradient(from 0deg, transparent 0deg, rgba(255,255,255,.20) 12deg, transparent 24deg, rgba(255,255,255,.12) 36deg, transparent 48deg, rgba(255,255,255,.18) 60deg, transparent 72deg, rgba(255,255,255,.10) 84deg, transparent 96deg, rgba(255,255,255,.16) 108deg, transparent 120deg, rgba(255,255,255,.08) 132deg, transparent 144deg, rgba(255,255,255,.14) 156deg, transparent 168deg, rgba(255,255,255,.10) 180deg, transparent 192deg, rgba(255,255,255,.18) 204deg, transparent 216deg, rgba(255,255,255,.08) 228deg, transparent 240deg, rgba(255,255,255,.14) 252deg, transparent 264deg, rgba(255,255,255,.10) 276deg, transparent 288deg, rgba(255,255,255,.16) 300deg, transparent 312deg, rgba(255,255,255,.08) 324deg, transparent 336deg, rgba(255,255,255,.12) 348deg, transparent 360deg);
    animation: sunSpin 7s linear infinite;
    border-radius: 50%;
}
@keyframes sunSpin { to { transform: rotate(360deg); } }

/* Labels */
.theme-label { flex: 1; text-align: right; }
.theme-label-main { display: block; font-size: 12.5px; font-weight: 800; color: var(--text-primary); line-height: 1.3; transition: color .3s ease; }
.theme-label-sub  { display: block; font-size: 10px; font-weight: 600; color: var(--theme-label-sub); transition: color .3s ease; }

/* Topbar title spacing */
.topbar-title-wrap { padding-top: 6px; }

/* Pill */
.theme-pill {
    width: 34px; height: 19px; border-radius: 10px;
    background: rgba(99,102,241,.20); border: 1px solid rgba(99,102,241,.28);
    position: relative; flex-shrink: 0;
    transition: background .3s ease, border-color .3s ease;
}
[data-theme="light"] .theme-pill { background: #6366f1; border-color: #6366f1; }
.theme-pill-dot {
    position: absolute; top: 2.5px; right: 2.5px;
    width: 12px; height: 12px; border-radius: 50%;
    background: rgba(255,255,255,.36);
    transition: transform .32s cubic-bezier(.34,1.56,.64,1), background .3s ease;
}
[data-theme="light"] .theme-pill-dot { transform: translateX(-14px); background: #fff; }

/* ── USER CARD ──────────────────────────────────────────── */
.user-status-card {
    background: var(--bg-user-card);
    border-top: 1px solid var(--border-subtle);
    backdrop-filter: blur(20px);
    padding: 11px 13px 50px;
    flex-shrink: 0;
    transition: background .4s ease, border-color .4s ease;
}
[data-theme="light"] .user-status-card { background: rgba(241,245,253,.97); box-shadow: 0 -4px 16px rgba(30,60,120,.05); }

.user-card-inner { display: flex; align-items: center; gap: 10px; }
.user-avatar-wrap { position: relative; flex-shrink: 0; }
.user-avatar-wrap img { width: 38px; height: 38px; border-radius: 10px; border: 1.5px solid rgba(99,102,241,.25); }
.user-online-dot { position: absolute; bottom: -2px; right: -2px; width: 10px; height: 10px; background: #22c55e; border-radius: 50%; border: 2px solid var(--bg-base); transition: border-color .4s ease; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12.5px; font-weight: 900; color: var(--text-heading); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[data-theme="light"] .user-name { color: #0f172a; }
.user-role { font-size: 10px; font-weight: 700; color: #818cf8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn { width: 32px; height: 32px; background: rgba(239,68,68,.09); border: 1px solid rgba(239,68,68,.18); border-radius: 9px; display: flex; align-items: center; justify-content: center; color: #f87171; cursor: pointer; flex-shrink: 0; transition: background .18s ease; }
.logout-btn:hover { background: rgba(239,68,68,.18); }
.logout-btn svg { width: 14px; height: 14px; }

/* ── HEADER ─────────────────────────────────────────────── */
.app-header {
    padding: 9px 16px;
    display: flex; justify-content: space-between; align-items: center;
    min-height: 50px;
    position: sticky; top: 0; z-index: 30;
    background: transparent; backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--header-border);
    transition: border-color .4s ease;
    flex-shrink: 0;
}
#page-title {
    font-size: clamp(.95rem, 2.5vw, 1.3rem);
    font-weight: 900; color: var(--text-heading);
    letter-spacing: -.02em; line-height: 1.2;
}
[data-theme="light"] #page-title { color: #0f172a; }

.notif-btn {
    position: relative; width: 34px; height: 34px;
    background: rgba(255,255,255,.04); border: 1px solid var(--border-soft);
    border-radius: 9px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-secondary); flex-shrink: 0;
    transition: background .18s ease;
}
.notif-btn:hover { background: rgba(255,255,255,.09); color: var(--text-heading); }
[data-theme="light"] .notif-btn { background: rgba(15,23,42,.04); border-color: rgba(15,23,42,.10); }
.notif-btn svg { width: 16px; height: 16px; }
.notif-dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; background: #6366f1; border-radius: 50%; border: 1.5px solid var(--bg-base); animation: pulse 2s infinite; }

/* ════════════════════════════════════════════════════════════
   ELECTRON CUSTOM TITLEBAR
   — مخفي تماماً على الويب، يظهر فقط عند body.is-electron
   — الـ sidebar-toggle-btn يتحرك لتحت الـ titlebar تلقائياً
════════════════════════════════════════════════════════════ */
:root {
    --titlebar-h: 38px;          /* ارتفاع الـ titlebar */
    --titlebar-bg-dark:  rgba(7,10,22,0.97);
    --titlebar-bg-light: rgba(246,248,255,0.98);
    --wc-close-hover:    #e81123;
    --wc-min-hover:      rgba(255,255,255,0.12);
    --wc-max-hover:      rgba(255,255,255,0.12);
}

/* ── Titlebar element ───────────────────────────────────── */
#electron-titlebar {
    display: none;                         /* مخفي افتراضياً — يظهر فقط بـ .is-electron */
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--titlebar-h);
    z-index: 99999;
    -webkit-app-region: drag;              /* Electron drag region */
    user-select: none;
    flex-shrink: 0;

    background: var(--titlebar-bg-dark);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);

    display: none;                         /* grid يتفعّل بـ JS */
    align-items: center;
    justify-content: space-between;
    padding: 0 12px 0 0;                   /* padding من اليسار (نهاية RTL) لأزرار الـ controls */
    transition: background .4s ease, border-color .4s ease;
}

/* إظهار الـ titlebar فقط في Electron */
body.is-electron #electron-titlebar { display: flex; }

/* Light theme overrides */
[data-theme="light"] #electron-titlebar {
    background: var(--titlebar-bg-light);
    border-bottom-color: rgba(15,23,42,0.08);
}

/* ── App identity (right side in RTL) ──────────────────── */
.etb-app-identity {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    -webkit-app-region: drag;
    height: 100%;
}
.etb-app-icon {
    width: 22px; height: 22px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(99,102,241,0.35);
}
.etb-app-icon svg { width: 12px; height: 12px; color: #fff; }
.etb-app-name {
    font-size: 12px; font-weight: 900;
    letter-spacing: .04em;
    color: rgba(255,255,255,0.75);
    font-family: 'Cairo', sans-serif;
    -webkit-app-region: drag;
}
[data-theme="light"] .etb-app-name { color: rgba(15,23,42,0.7); }

/* ── Page title (center) ─────────────────────────────────── */
.etb-page-title {
    position: absolute;
    left: 50%; transform: translateX(-50%);
    font-size: 11.5px; font-weight: 800;
    color: rgba(255,255,255,0.5);
    font-family: 'Cairo', sans-serif;
    letter-spacing: .03em;
    white-space: nowrap;
    pointer-events: none;
    -webkit-app-region: drag;
    transition: color .3s ease;
}
[data-theme="light"] .etb-page-title { color: rgba(15,23,42,0.45); }

/* ── Window Controls (LTR order: min, max, close) ─────────
   في RTL الأزرار تكون على اليسار (مثل macOS).
   على Windows/Linux أزرار Electron دايما LTR.
   نحطهم في آخر الـ flex (اليسار في RTL) بـ margin-left: auto ── */
.etb-win-controls {
    display: flex;
    align-items: center;
    gap: 1px;
    -webkit-app-region: no-drag;   /* منع الـ drag على الأزرار */
    margin-right: auto;             /* يدفعهم لليسار في RTL layout */
    height: 100%;
}
.etb-wc-btn {
    width: 46px; height: 100%;
    border: none; background: transparent; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .12s ease;
    -webkit-app-region: no-drag;
    color: rgba(255,255,255,0.55);
    flex-shrink: 0;
}
[data-theme="light"] .etb-wc-btn { color: rgba(15,23,42,0.55); }

.etb-wc-btn svg { width: 11px; height: 11px; pointer-events: none; transition: display .12s ease; }

/* Minimize */
.etb-wc-btn.wc-min:hover  { background: var(--wc-min-hover); color: rgba(255,255,255,0.9); }
/* Maximize / Restore */
.etb-wc-btn.wc-max:hover  { background: var(--wc-max-hover); color: rgba(255,255,255,0.9); }
/* Close */
.etb-wc-btn.wc-close:hover {
    background: var(--wc-close-hover);
    color: #fff;
}
[data-theme="light"] .etb-wc-btn.wc-min:hover  { background: rgba(15,23,42,0.08); color: rgba(15,23,42,0.9); }
[data-theme="light"] .etb-wc-btn.wc-max:hover  { background: rgba(15,23,42,0.08); color: rgba(15,23,42,0.9); }

/* Maximize icon toggle — JS handles primary state, CSS is backup */
#max-icon { display: block; }
#restore-icon { display: none; }
body.is-maximized #max-icon { display: none !important; }
body.is-maximized #restore-icon { display: block !important; }
/* Legacy class-based selectors as fallback */
body.is-maximized .etb-wc-btn.wc-max .icon-maximize   { display: none !important; }
body.is-maximized .etb-wc-btn.wc-max .icon-restore     { display: block !important; }
body:not(.is-maximized) .etb-wc-btn.wc-max .icon-restore  { display: none !important; }
body:not(.is-maximized) .etb-wc-btn.wc-max .icon-maximize { display: block !important; }

/* macOS-style on macOS (أزرار دوائر ملونة) */
body.is-electron.is-mac .etb-win-controls { gap: 6px; padding: 0 8px; }
body.is-electron.is-mac .etb-wc-btn {
    width: 14px; height: 14px; border-radius: 50%;
    background: rgba(255,255,255,0.15);
}
body.is-electron.is-mac .etb-wc-btn svg { display: none; }
body.is-electron.is-mac .etb-wc-btn.wc-close { background: #ff5f57; }
body.is-electron.is-mac .etb-wc-btn.wc-min   { background: #febc2e; }
body.is-electron.is-mac .etb-wc-btn.wc-max   { background: #28c840; }
body.is-electron.is-mac .etb-wc-btn:hover { filter: brightness(1.12); }

/* ══════════════════════════════════════════════════════════
   OFFSET: عندما يكون في Electron — كل العناصر تنزل بـ titlebar-h
   ══════════════════════════════════════════════════════════ */

/* الـ sidebar ينزل */
body.is-electron #sidebar {
    top: var(--titlebar-h);
    height: calc(100vh - var(--titlebar-h));
}

/* الـ main-content ينزل ويحتسب ارتفاعه بدون الـ titlebar */
body.is-electron #main-content {
    margin-top: var(--titlebar-h);
    height: calc(100vh - var(--titlebar-h));
    max-height: calc(100vh - var(--titlebar-h));
}

/* sidebar-toggle-btn ينزل ليبقى تحت الـ titlebar */
body.is-electron #sidebar-toggle-btn {
    top: calc(var(--titlebar-h) + 10px);
}

/* sidebar-overlay يبدأ من تحت الـ titlebar */
body.is-electron #sidebar-overlay {
    top: var(--titlebar-h);
}

body.is-electron {
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
body.is-electron[data-theme="light"] {
    border-color: rgba(15,23,42,0.16);
    box-shadow: inset 0 0 0 1px rgba(15,23,42,0.08);
}

/* ── FOOTER ─────────────────────────────────────────────── */
:root { --footer-h: 44px; }

.footer-animate { transition: transform var(--dur-med) var(--ease-smooth); }
.footer-hidden  { transform: translateY(calc(100% - 2px)) !important; pointer-events: none; }

/* الفوتر بيظهر → content-container يتضغط من أسفل بارتفاعه */
#content-container {
    transition: padding-bottom var(--dur-med) var(--ease-smooth);
    padding-bottom: var(--footer-h);
}
/* الفوتر مخفي → مفيش padding */
#content-container.footer-hidden-pb {
    padding-bottom: 0 !important;
}

/* ── Footer Base ── */
#luxury-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--footer-h);
    z-index: 10000;
    overflow: hidden;
    background: var(--glass-sidebar-bg, rgba(8,12,30,0.92));
    border-top: 1px solid rgba(255,255,255,0.07);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 -8px 32px rgba(0,0,0,0.45), 0 -1px 0 rgba(255,255,255,0.04);
    transition: transform var(--dur-med) var(--ease-smooth);
}
[data-theme="light"] #luxury-footer {
    background: rgba(248,250,255,0.94);
    border-top-color: rgba(15,23,42,0.09);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}

/* Footer hide when sidebar is open */
#luxury-footer.footer-hidden-by-sidebar {
    transform: translateY(calc(100% - 2px));
    pointer-events: none;
}

/* ── Inner Layout ── */
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 20px;
    position: relative;
    z-index: 1;
    gap: 12px;
}

/* ── Right side: brand + shift btn ── */
.footer-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    min-width: 0;
}

/* ── Brand ── */
.footer-brand {
    display: flex;
    align-items: center;
    gap: 6px;
}
.footer-brand-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6366f1;
    flex-shrink: 0;
}
.footer-brand-icon svg { width: 13px; height: 13px; }
.footer-brand-text {
    font-family: 'Cairo', sans-serif;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.footer-brand-text strong {
    color: #818cf8;
    font-weight: 800;
}
[data-theme="light"] .footer-brand-text strong { color: #4f46e5; }

/* ── Shift Button ── */
.footer-shift-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid rgba(100,116,139,0.28);
    background: rgba(100,116,139,0.10);
    color: #94a3b8;
    font-family: 'Cairo', sans-serif;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 180ms ease;
    white-space: nowrap;
    flex-shrink: 0;
}
.footer-shift-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}
.footer-shift-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #64748b;
    flex-shrink: 0;
    display: block;
}
.footer-shift-label { line-height: 1; }

/* ── Sidebar Active Shift Summary ── */
.sidebar-shift-summary {
    padding: 16px 18px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(15,23,42,0.14);
    color: #cbd5e1;
    font-family: 'Cairo', sans-serif;
    border-radius: 18px 18px 10px 10px;
    margin: 0 12px 18px;
}
.sidebar-shift-label {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}
.sidebar-shift-number {
    font-size: 13px;
    font-weight: 900;
    color: #ffffff;
    line-height: 1.3;
}
.sidebar-shift-name {
    font-size: 11px;
    color: #cbd5e1;
    margin-top: 6px;
    line-height: 1.45;
    min-height: 1.4em;
}
[data-theme="light"] .sidebar-shift-summary {
    background: rgba(255,255,255,0.88);
    border-color: rgba(15,23,42,0.08);
    color: #0f172a;
}
[data-theme="light"] .sidebar-shift-label {
    color: #64748b;
}
[data-theme="light"] .sidebar-shift-name {
    color: #475169;
}

/* ── Left side: copyright ── */
.footer-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
}
.footer-copy {
    font-family: 'Cairo', sans-serif;
    font-size: 9.5px;
    font-weight: 600;
    color: var(--text-muted, #475569);
    white-space: nowrap;
    letter-spacing: 0.02em;
    opacity: 0.75;
}
.footer-copy-sep {
    font-size: 9px;
    color: var(--text-muted, #475569);
    opacity: 0.4;
    flex-shrink: 0;
}
.footer-copy-brand {
    font-family: 'Cairo', sans-serif;
    font-size: 9.5px;
    font-weight: 800;
    color: #6366f1;
    white-space: nowrap;
    opacity: 0.85;
}
[data-theme="light"] .footer-copy-brand { color: #4f46e5; }

/* ── RESPONSIVE: Tablet (max 768px) ── */
@media (max-width: 768px) {
    :root { --footer-h: 48px; }

    .footer-inner {
        padding: 0 14px;
        gap: 8px;
    }
    .footer-brand { gap: 5px; }
    .footer-brand-text { font-size: 9.5px; }
    .footer-copy, .footer-copy-brand { font-size: 9px; }
    .footer-shift-btn { padding: 4px 8px; font-size: 9.5px; }
    /* إخفاء نص الحقوق الأول على موبايل لتوفير المساحة */
    .footer-copy-sep { display: none; }
    .footer-copy { display: none; }
}

/* ── RESPONSIVE: Mobile small (max 480px) ── */
@media (max-width: 480px) {
    :root { --footer-h: 52px; }

    .footer-inner {
        padding: 0 12px;
        gap: 6px;
    }
    /* إخفاء الشعار النصي — تبقى الأيقونة فقط */
    .footer-brand-text { display: none; }
    .footer-brand-icon {
        width: 22px;
        height: 22px;
    }
    .footer-brand-icon svg { width: 14px; height: 14px; }
    /* اختصار الوردية */
    .footer-shift-btn {
        padding: 5px 9px;
        font-size: 9.5px;
        border-radius: 7px;
    }
    /* حقوق الملكية مختصرة */
    .footer-copy-brand { font-size: 8.5px; }
}

/* ── RESPONSIVE: Very small (max 360px) ── */
@media (max-width: 360px) {
    .footer-inner { padding: 0 10px; }
    .footer-brand { display: none; }
    .footer-shift-btn { padding: 4px 8px; }
}

/* ── Glow border top of footer ── */
.glow-border-top {
    position: absolute; top: 0; left: 0; width: 100%; height: 2px;
    background: linear-gradient(90deg, transparent, #3b82f6, #a855f7, #10b981, #3b82f6, transparent);
    background-size: 200% 100%; animation: moveGlow 15s linear infinite;
    box-shadow: 0 -3px 16px rgba(168,85,247,.35);
}
@keyframes moveGlow { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
[data-theme="light"] .glow-border-top { opacity: .6; }

/* ── SCROLLBAR ──────────────────────────────────────────── */
.custom-scrollbar::-webkit-scrollbar { width: 3px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }
.custom-scrollbar:hover::-webkit-scrollbar-thumb { background: var(--scrollbar-hover); }

/* ── AMBIENT LEGACY HELPERS (kept for backwards compat) ─── */
.amb-1 { background: rgba(37,99,235,.09);  transition: background .6s ease; }
.amb-2 { background: rgba(147,51,234,.09); transition: background .6s ease; }
.amb-3 { background: rgba(16,185,129,.05); transition: background .6s ease; }
.amb-4 { background: rgba(79,70,229,.09);  transition: background .6s ease; }
[data-theme="light"] .amb-1 { background: rgba(37,99,235,.05); }
[data-theme="light"] .amb-2 { background: rgba(147,51,234,.06); }
[data-theme="light"] .amb-3 { background: rgba(16,185,129,.04); }
[data-theme="light"] .amb-4 { background: rgba(79,70,229,.05); }

/* ── PULSE ──────────────────────────────────────────────── */
@keyframes pulse {
    0%  { transform: scale(1);   opacity: 1;   box-shadow: 0 0 0 0 rgba(99,102,241,.7); }
    70% { transform: scale(1.1); opacity: .8;  box-shadow: 0 0 0 5px rgba(99,102,241,0); }
    100%{ transform: scale(1);   opacity: 1;   box-shadow: 0 0 0 0 rgba(99,102,241,0); }
}

/* ── GLASS PANEL ────────────────────────────────────────── */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-subtle);
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.04) inset,
        var(--panel-shadow),
        0 1px 0 rgba(255,255,255,0.06) inset;
    transition: background .4s ease, border-color .4s ease, box-shadow .4s ease;
}
.glass-panel:hover {
    border-color: var(--border-soft);
    background: rgba(255,255,255,0.04);
}
[data-theme="light"] .glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 4px 24px rgba(30,60,120,0.07), 0 1px 0 rgba(255,255,255,0.9) inset;
    border-color: var(--border-subtle);
}
[data-theme="light"] .glass-panel:hover {
    background: rgba(255,255,255,0.62);
    border-color: rgba(15,23,42,0.11);
}

/* ── GRADIENT TEXT ──────────────────────────────────────── */
.gradient-text {
    background: linear-gradient(135deg, #60a5fa 0%, #a855f7 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* ── CONTENT AREA ───────────────────────────────────────── */
#main-content { flex: 1; display: flex; flex-direction: column; height: 100%; min-width: 0; overflow: hidden; }

#content-container { flex: 1; overflow-y: auto; padding: 14px 14px 20px; }
@media (min-width: 640px)  { #content-container { padding: 18px 20px 20px; } }
@media (min-width: 1024px) { #content-container { padding: 24px 28px 20px; } }

/* ── IFRAME MODE — يلغي كل الـ padding لما التاب فيه iframe ─── */
/* يُطبَّق تلقائياً بالـ app.js على #content-container */
#content-container.iframe-mode,
#content-container.iframe-mode.p-3 {
    padding: 0 !important;
    overflow: hidden !important;
}
#content-container.iframe-mode .tab-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}
/* الـ iframe نفسه يملأ الحاوية بالكامل */
#content-container.iframe-mode iframe {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    display: block !important;
    flex: 1;
}

/* Dashboard stat grid */
.dashboard-grid {
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 12px;
}
@media (min-width: 640px) { 
    .dashboard-grid { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 14px; 
    } 
}
@media (min-width: 900px) { 
    .dashboard-grid { 
        grid-template-columns: repeat(4, 1fr); 
        gap: 16px; 
    } 
}

/* Responsive dashboard layout */
@media (max-width: 640px) {
    /* Mobile adjustments */
    .app-header {
        padding: 8px 12px;
        min-height: 44px;
    }
    
    #page-title {
        font-size: 1rem;
    }
    
    .notif-btn {
        width: 32px; 
        height: 32px;
    }
    
    /* Content padding adjustments */
    #content-container {
        padding: 12px 12px 60px !important;
    }
    
    /* Tab content adjustments */
    .tab-content {
        padding: 8px;
    }
    
    /* Glass panels on mobile */
    .glass-panel {
        border-radius: 12px;
        padding: 12px;
    }
    
    /* Button adjustments */
    .s-btn-primary, .s-btn-ghost {
        padding: 8px 12px;
        font-size: 11px;
    }
    
    /* Table adjustments */
    .hr-table-wrap {
        border-radius: 12px;
    }
    
    .hr-table thead th {
        padding: 8px 12px;
        font-size: 10px;
    }
    
    .hr-table tbody td {
        padding: 8px 12px;
        font-size: 12px;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    /* Tablet adjustments */
    .app-header {
        padding: 10px 16px;
    }
    
    #content-container {
        padding: 16px 18px 60px !important;
    }
    
    .glass-panel {
        padding: 16px;
    }
}

@media (min-width: 1025px) {
    /* Desktop adjustments */
    #content-container {
        padding: 24px 28px 60px !important;
    }
    
    .glass-panel {
        padding: 20px;
    }
}

/* Responsive typography */
@media (max-width: 640px) {
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.125rem; }
    h4 { font-size: 1rem; }
}

/* Responsive grid layouts */
@media (max-width: 640px) {
    .s-grid-2, .s-grid-3 {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .s-grid-2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
    
    .s-grid-3 {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
}

@media (min-width: 1025px) {
    .s-grid-3 {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

/* Tab content fade */
.tab-content { opacity: 0; transition: opacity var(--dur-med) var(--ease-smooth); }
.tab-content.visible  { opacity: 1; }
.tab-content.hidden   { display: none !important; }

/* Ensure visible tab-content takes full height in iframe mode */
#content-container.iframe-mode .tab-content.visible {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* ── التقارير العامة — بدون أي padding أو margin ─────────── */
#rep_general-tab {
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
}
#content-container #rep_general-tab,
#content-container.iframe-mode #rep_general-tab {
    padding: 0 !important;
    margin: 0 !important;
}
#rep_general-tab iframe {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ── LIGHT MODE TEXT FIXES ──────────────────────────────── */
[data-theme="light"] .text-slate-400 { color: #64748b !important; }
[data-theme="light"] .text-slate-300 { color: #475569 !important; }
[data-theme="light"] .text-slate-500 { color: #94a3b8 !important; }
[data-theme="light"] .text-white     { color: #0f172a !important; }
[data-theme="light"] .text-slate-200 { color: #1e293b !important; }
[data-theme="light"] .hover\:text-white:hover { color: #0f172a !important; }
[data-theme="light"] .border-white\/5  { border-color: rgba(15,23,42,.07) !important; }
[data-theme="light"] .border-white\/10 { border-color: rgba(15,23,42,.12) !important; }
[data-theme="light"] .active-main-tab  { color: #1e40af !important; }
[data-theme="light"] .glass-panel h3, [data-theme="light"] .glass-panel h4 { color: #0f172a; }
[data-theme="light"] .glass-panel p.text-slate-300 { color: #475569 !important; }
[data-theme="light"] .glass-panel p.text-slate-400 { color: #64748b !important; }

/* ── HR UI ─────────────────────────────────────────────── */
.hr-btn-primary,
.hr-btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .02em;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
    border: 1px solid rgba(255,255,255,.08);
}
.hr-btn-primary {
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    color: #fff;
    box-shadow: 0 10px 24px rgba(14,165,233,.18);
}
.hr-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 26px rgba(99,102,241,.25); }
.hr-btn-ghost {
    background: rgba(255,255,255,.04);
    color: #cbd5f5;
}
.hr-btn-ghost:hover { background: rgba(255,255,255,.08); color: #fff; }

.hr-filter {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    color: #94a3b8;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.06);
    transition: all .2s ease;
}
.hr-filter:hover { color: #fff; background: rgba(255,255,255,.08); }
.hr-filter.active { color: #fff; background: rgba(14,165,233,.18); border-color: rgba(14,165,233,.35); }

.hr-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .04em;
    border: 1px solid transparent;
}
.hr-chip--success { color: #34d399; background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.25); }
.hr-chip--warn    { color: #fbbf24; background: rgba(251,191,36,.14); border-color: rgba(251,191,36,.25); }
.hr-chip--info    { color: #60a5fa; background: rgba(96,165,250,.16); border-color: rgba(96,165,250,.25); }
.hr-chip--indigo  { color: #818cf8; background: rgba(99,102,241,.18); border-color: rgba(99,102,241,.28); }
.hr-chip--rose    { color: #fb7185; background: rgba(251,113,133,.14); border-color: rgba(251,113,133,.25); }
.hr-chip--sky     { color: #38bdf8; background: rgba(56,189,248,.14); border-color: rgba(56,189,248,.25); }
.hr-chip--emerald { color: #10b981; background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.25); }
.hr-chip--muted   { color: #cbd5f5; background: rgba(148,163,184,.16); border-color: rgba(148,163,184,.22); }

.hr-table-wrap {
    width: 100%;
    overflow: auto;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,.06);
    background: rgba(4,8,18,.45);
}
.hr-table { border-collapse: collapse; width: 100%; min-width: 640px; }
.hr-table thead th {
    text-align: right;
    font-size: 11px;
    letter-spacing: .04em;
    color: #94a3b8;
    padding: 14px 16px;
    background: rgba(255,255,255,.03);
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.hr-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,.04);
    color: #e2e8f0;
}
.hr-table tbody tr:hover { background: rgba(255,255,255,.03); }

.hr-avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 900;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #0ea5e9);
    box-shadow: 0 10px 18px rgba(99,102,241,.2);
}
.hr-avatar--emerald { background: linear-gradient(135deg, #10b981, #22c55e); }
.hr-avatar--amber   { background: linear-gradient(135deg, #f59e0b, #f97316); }
.hr-avatar--slate   { background: linear-gradient(135deg, #64748b, #94a3b8); }
.hr-avatar--purple  { background: linear-gradient(135deg, #a855f7, #6366f1); }

.hr-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .03em;
    border: 1px solid transparent;
}
.hr-status--active { color: #34d399; background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.25); }
.hr-status--paused { color: #94a3b8; background: rgba(148,163,184,.15); border-color: rgba(148,163,184,.2); }
.hr-status--late   { color: #fbbf24; background: rgba(251,191,36,.14); border-color: rgba(251,191,36,.25); }
.hr-status--early  { color: #f87171; background: rgba(248,113,113,.14); border-color: rgba(248,113,113,.25); }

.hr-field label {
    display: block;
    font-size: 11px;
    font-weight: 800;
    color: #94a3b8;
    margin-bottom: 6px;
}
.hr-input,
.hr-select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    color: #e2e8f0;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.hr-input:focus,
.hr-select:focus {
    border-color: rgba(99,102,241,.6);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
    background: rgba(255,255,255,.07);
}
.hr-select option { color: #0f172a; }

.hr-rule {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.06);
}

.hr-toolbar {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}
.hr-search {
    flex: 1 1 360px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(255,255,255,.04);
}
.hr-search svg { width: 16px; height: 16px; color: #94a3b8; }
.hr-search input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 700;
}
.hr-actions {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    justify-content: flex-end;
}
.hr-actions .hr-btn-primary,
.hr-actions .hr-btn-ghost {
    padding: 12px 18px;
    min-width: 120px;
}
.hr-toolbar .hr-select {
    min-width: 110px;
    max-width: 140px;
}
#hr-att-employee,
#hr-fin-employee {
    min-width: 220px;
    max-width: 260px;
}
#hr-filter-type { min-width: 110px; }
#hr-filter-status { min-width: 110px; }
.hr-row-actions {
    display: flex;
    gap: 6px;
}
.hr-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(255,255,255,.04);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #cbd5f5;
    transition: all .2s ease;
}
.hr-action-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.hr-action-btn.danger { color: #fca5a5; border-color: rgba(248,113,113,.3); }
.hr-action-btn.danger:hover { background: rgba(248,113,113,.15); color: #fff; }

.hr-empty {
    padding: 18px;
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 700;
}

.hr-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 220;
    display: flex;
    align-items: center;
    justify-content: center;
    /* مخفي بالـ opacity مش display:none */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 250ms ease, visibility 250ms ease;
}
/* Backdrop خلف المودال */
.hr-modal-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 0;
}
.hr-modal-overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.hr-modal-overlay.closing {
    opacity: 0;
    pointer-events: none;
}
/* المودال الكارت دايماً فوق الـ backdrop */
.hr-modal {
    position: relative;
    z-index: 1;
    width: min(900px, 92vw);
    background: rgba(10, 14, 28, 0.97);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 24px;
    box-shadow: 0 40px 120px rgba(0,0,0,.65);
    overflow: hidden;
    /* Entry animation */
    opacity: 0;
    transform: translateY(16px) scale(0.97);
    transition: transform 280ms cubic-bezier(.34,1.56,.64,1), opacity 220ms ease;
}
.hr-modal-overlay.visible .hr-modal {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.hr-modal-overlay.closing .hr-modal {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
}
.hr-modal-sm { width: min(420px, 92vw); }
.hr-modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(99,102,241,.15), rgba(14,165,233,.08));
    position: relative;
}
.hr-modal-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(99,102,241,.8), rgba(14,165,233,.8), transparent);
}
.hr-modal-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.hr-modal-pin {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(255,255,255,.04);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #cbd5f5;
    transition: all .2s ease;
}
.hr-modal-pin.pinned {
    background: rgba(14,165,233,.18);
    border-color: rgba(14,165,233,.45);
    color: #fff;
}
.hr-modal-header h3 {
    font-size: 18px;
    font-weight: 900;
    color: #fff;
}
.hr-modal-sub { font-size: 11px; color: #94a3b8; margin-top: 4px; }
.hr-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(255,255,255,.04);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #cbd5f5;
}
.hr-modal-body { padding: 18px 22px; }
.hr-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}
.hr-modal-footer {
    padding: 16px 22px;
    border-top: 1px solid rgba(255,255,255,.06);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@media (max-width: 920px) {
    .hr-toolbar { flex-wrap: wrap; }
    .hr-actions { flex-wrap: wrap; justify-content: flex-start; width: 100%; }
}

.hr-toast-container {
    position: fixed;
    bottom: 22px;
    left: 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 260;
}
.hr-toast {
    background: rgba(15,23,42,.9);
    color: #e2e8f0;
    border: 1px solid rgba(255,255,255,.08);
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    opacity: 0;
    transform: translateY(8px);
    transition: all .2s ease;
}
.hr-toast.show { opacity: 1; transform: translateY(0); }
.hr-toast.success { border-color: rgba(16,185,129,.4); color: #a7f3d0; }
.hr-toast.error { border-color: rgba(248,113,113,.45); color: #fecaca; }
.hr-toast.warn { border-color: rgba(251,191,36,.45); color: #fde68a; }

[data-theme="light"] .hr-btn-ghost { background: rgba(15,23,42,.04); color: #334155; border-color: rgba(15,23,42,.08); }
[data-theme="light"] .hr-btn-ghost:hover { background: rgba(15,23,42,.08); color: #0f172a; }
[data-theme="light"] .hr-filter { background: rgba(15,23,42,.04); border-color: rgba(15,23,42,.08); color: #475569; }
[data-theme="light"] .hr-filter.active { background: rgba(14,165,233,.18); border-color: rgba(14,165,233,.25); color: #0f172a; }
[data-theme="light"] .hr-table-wrap { background: rgba(255,255,255,.7); border-color: rgba(15,23,42,.08); }
[data-theme="light"] .hr-table thead th { background: rgba(15,23,42,.03); color: #64748b; }
[data-theme="light"] .hr-table tbody td { color: #1e293b; border-color: rgba(15,23,42,.06); }
[data-theme="light"] .hr-rule { background: rgba(15,23,42,.04); border-color: rgba(15,23,42,.06); }
[data-theme="light"] .hr-input,
[data-theme="light"] .hr-select { background: rgba(255,255,255,.9); color: #0f172a; border-color: rgba(15,23,42,.12); }
[data-theme="light"] .hr-search { background: rgba(15,23,42,.04); border-color: rgba(15,23,42,.08); }
[data-theme="light"] .hr-search input { color: #0f172a; }
[data-theme="light"] .hr-modal { background: rgba(255,255,255,.98); border-color: rgba(15,23,42,.08); }
[data-theme="light"] .hr-modal-header h3 { color: #0f172a; }

/* ════════════════════════════════════════════════════════════
   CONNECTION MONITOR — حالة الاتصال بالإنترنت
   ════════════════════════════════════════════════════════════ */

/* Main connection indicator container */
.connection-indicator {
    position: fixed;
    top: 70px;
    left: 16px;
    z-index: 9500;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(99, 102, 241, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    transition: all 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: connSlideIn 400ms ease-out;
}

/* Dark mode styles */
[data-theme="dark"] .connection-indicator,
body:not([data-theme="light"]) .connection-indicator {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(99, 102, 241, 0.25);
}

/* Light mode styles */
[data-theme="light"] .connection-indicator {
    background: rgba(255, 255, 255, 0.90);
    border-color: rgba(99, 102, 241, 0.30);
    box-shadow: 0 4px 16px rgba(30, 60, 120, 0.12);
}

/* Connection indicator dot */
.conn-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: all 200ms ease;
    box-shadow: 0 0 8px currentColor;
    animation: connPulseOnce 400ms ease-out;
}

.conn-dot.conn-connected {
    background: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
}

.conn-dot.conn-disconnected {
    background: #ef4444;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
    animation: connFlash 600ms ease-in-out infinite;
}

/* Connection text label */
.conn-text {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
    white-space: nowrap;
    transition: color 200ms ease;
}

.conn-text.conn-connected {
    color: #10b981;
}

[data-theme="light"] .conn-text.conn-connected {
    color: #059669;
}

.conn-text.conn-disconnected {
    color: #ef4444;
}

[data-theme="light"] .conn-text.conn-disconnected {
    color: #dc2626;
}

/* Connection toast notifications */
.conn-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    z-index: 9600;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.conn-toast.conn-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.conn-toast.conn-success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.35);
    color: #10b981;
}

[data-theme="light"] .conn-toast.conn-success {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.25);
    color: #059669;
}

.conn-toast.conn-error {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.35);
    color: #ef4444;
}

[data-theme="light"] .conn-toast.conn-error {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
    color: #dc2626;
}

/* Toast icon */
.conn-toast-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.conn-toast-icon::before {
    content: '✓';
    font-weight: 900;
    font-size: 13px;
}

.conn-toast.conn-error .conn-toast-icon::before {
    content: '✕';
}

/* Animations */
@keyframes connSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes connPulseOnce {
    0% {
        transform: scale(0.6);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes connFlash {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes connPulse {
    0% {
        box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
    }
    50% {
        box-shadow: 0 0 16px rgba(239, 68, 68, 0.8);
    }
    100% {
        box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
    }
}

/* Responsive adjustments for connection indicator */
@media (max-width: 640px) {
    .connection-indicator {
        top: 60px;
        left: 10px;
        padding: 7px 10px;
        font-size: 10px;
    }

    .conn-dot {
        width: 8px;
        height: 8px;
    }

    .conn-text {
        font-size: 10px;
    }
}

@media (max-width: 380px) {
    .connection-indicator {
        top: 50px;
        left: 8px;
        padding: 6px 9px;
        border-radius: 16px;
    }

    .conn-dot {
        width: 7px;
        height: 7px;
    }

    .conn-text {
        font-size: 9px;
    }
}
/* ── SIDEBAR MISSING CLASSES (offline fix) ──────────────── */

/* main-content class (used instead of tailwind flex-1 flex flex-col h-screen) */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-width: 0;
    overflow: hidden;
    padding-right: 0 !important;
}

/* theme-toggle-wrap */
.theme-toggle-wrap {
    flex-shrink: 0;
    padding: 0 10px 6px;
}

/* theme-icon-slot */
.theme-icon-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* user-avatar in user-status-card */
.user-avatar-wrap img,
img.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1.5px solid rgba(99,102,241,.25);
    display: block;
}

/* nav-item icon ni wrapper */
.nav-item .ni {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.nav-item .ni i,
.nav-item .ni svg {
    width: 15px;
    height: 15px;
}

/* span.ni used in nav-item */
span.ni {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
span.ni i { display: flex; }
span.ni svg { width: 15px; height: 15px; }

/* nav-acc-left / nav-acc-right already in CSS via .nav-acc-left/.nav-acc-right */
/* but if missing: */
.nav-acc-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-acc-right {
    display: flex;
    align-items: center;
    gap: 5px;
}