/* ====================================================================
   Auiva ERP — Design System v4
   Following AuivaLMS admin design language · Arabic RTL First
   Colors: Navy #1e3a6e · Orange #e86520
   ==================================================================== */

/* ── Design Tokens ── */
:root {
    /* Brand */
    --navy:          #1e3a6e;
    --navy-80:       #2a4e8c;
    --navy-60:       #3d6094;
    --navy-dark:     #152d58;
    --orange:        #e86520;
    --orange-dark:   #c4510f;
    --orange-light:  #f97316;

    /* Sidebar */
    --sb-bg:         #1e3a6e;
    --sb-item:       rgba(255,255,255,.75);
    --sb-item-hover: #ffffff;
    --sb-item-active:#ffffff;
    --sb-active-bg:  rgba(255,255,255,.12);
    --sb-section:    rgba(255,255,255,.4);
    --sb-border:     rgba(255,255,255,.1);
    --sb-w:          240px;

    /* Surfaces */
    --bg:            #f1f5f9;
    --card:          #ffffff;
    --border:        #e2e8f0;
    --border-strong: #cbd5e1;

    /* Text */
    --text:          #111827;
    --text-sec:      #374151;
    --text-muted:    #6b7280;
    --text-faint:    #9ca3af;

    /* State colors */
    --green:         #22c55e;
    --green-bg:      #dcfce7;
    --green-text:    #15803d;
    --red:           #ef4444;
    --red-bg:        #fee2e2;
    --red-text:      #dc2626;
    --blue:          #3b82f6;
    --blue-bg:       #dbeafe;
    --blue-text:     #1d4ed8;
    --amber:         #f59e0b;
    --amber-bg:      #fef9c3;
    --amber-text:    #a16207;
    --purple:        #8b5cf6;
    --purple-bg:     #f5f3ff;
    --purple-text:   #6d28d9;
    --cyan:          #06b6d4;
    --cyan-bg:       #cffafe;
    --cyan-text:     #0e7490;

    /* Topbar */
    --tb-h:          58px;

    /* Radii */
    --radius-xs:     6px;
    --radius-sm:     8px;
    --radius:        14px;
    --radius-lg:     16px;
    --radius-xl:     20px;

    /* Shadows — LMS style: subtle */
    --shadow-xs:     0 1px 2px rgba(0,0,0,.05);
    --shadow-sm:     0 1px 4px rgba(0,0,0,.06);
    --shadow-md:     0 4px 16px rgba(0,0,0,.1);
    --shadow-lg:     0 10px 30px rgba(0,0,0,.12);
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Cairo', 'Tajawal', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
}

h1,h2,h3,h4,h5 {
    font-family: 'Cairo', 'Tajawal', system-ui, sans-serif;
    font-weight: 700;
}

a { color: inherit; text-decoration: none; }

/* ====================================================================
   AUTH PAGES — single centered card (no split illustration panel)
   ==================================================================== */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    position: relative;
    overflow: hidden;
    padding: 1.5rem;
    background-image:
        radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
        linear-gradient(160deg, var(--navy-dark) 0%, var(--navy) 55%, #0e1e38 100%);
    background-size: 26px 26px, auto;
}
/* Soft brand-colored glow orbs — decorative only, no illustration mock-up needed */
.auth-page::before,
.auth-page::after {
    content: ''; position: absolute; border-radius: 50%; filter: blur(70px); pointer-events: none; z-index: 0;
}
.auth-page::before { width: 380px; height: 380px; background: var(--orange); opacity: .22; top: -140px; inset-inline-end: -110px; }
.auth-page::after  { width: 460px; height: 460px; background: #3a5ba0; opacity: .35; bottom: -180px; inset-inline-start: -150px; }

.auth-card {
    position: relative; z-index: 1;
    width: 100%;
    max-width: 440px;
    background: var(--card);
    border-radius: 1.25rem;
    box-shadow: 0 24px 60px rgba(0,0,0,.35);
    overflow: hidden;
}
.auth-card::before {
    content: ''; display: block; height: 4px;
    background: linear-gradient(90deg, var(--orange) 0%, var(--orange-light) 50%, var(--orange) 100%);
}

.auth-panel {
    padding: 2.5rem 2.25rem 2.25rem;
    display: flex;
    flex-direction: column;
}

.auth-footnote {
    position: relative; z-index: 1;
    font-size: .76rem; color: rgba(255,255,255,.45); text-align: center;
}

.auth-logo { display: flex; flex-direction: column; align-items: center; gap: .65rem; margin-bottom: 1.5rem; text-align: center; }
.auth-logo-img { height: 28px; width: auto; object-fit: contain; }
.auth-logo .sub {
    font-size: .66rem; color: var(--orange); font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
    background: rgba(232,101,32,.1); padding: .2rem .65rem; border-radius: 999px;
}

.auth-panel h1   { font-size: 1.4rem; font-weight: 800; margin: 0 0 .3rem; color: var(--text); text-align: center; }
.auth-panel .lead { font-size: .85rem; color: var(--text-muted); margin: 0 0 1.5rem; text-align: center; }

.auth-panel .field { position: relative; margin-bottom: 1.2rem; }
.auth-panel .field label {
    position: absolute; top: .8rem;
    inset-inline-end: .9rem;
    font-size: .875rem; font-weight: 500; color: var(--text-muted);
    transition: top .18s, font-size .18s, color .18s;
    pointer-events: none; background: #fff;
    padding: 0 .2rem; line-height: 1; margin: 0;
}
.auth-panel .field input {
    width: 100%;
    padding: .9rem .9rem .55rem;
    border: 1.5px solid var(--border);
    border-radius: .65rem; font-size: .9rem;
    font-family: inherit; background: #f8fafc; outline: none;
    transition: border-color .18s, box-shadow .18s;
    display: block;
}
.auth-panel .field input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(30,58,110,.12); background: #fff; }
.auth-panel .field input:focus ~ label,
.auth-panel .field input:not(:placeholder-shown) ~ label { top: -.52rem; font-size: .7rem; color: var(--navy); font-weight: 700; }
.auth-panel .field .field-error { color: var(--red); font-size: .72rem; display: block; margin-top: .3rem; }

.eye-btn {
    position: absolute; top: 50%; inset-inline-start: .9rem;
    transform: translateY(-50%); background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: .2rem; display: flex; align-items: center;
}
.auth-panel .field input[type="password"],
.auth-panel .field input.has-eye { padding-inline-start: 2.75rem; }

.check-group { display: flex; align-items: center; gap: .45rem; font-size: .82rem; color: var(--text-muted); cursor: pointer; user-select: none; }
.check-group input[type="checkbox"] { width: auto; cursor: pointer; accent-color: var(--navy); }

/* زر تسجيل الدخول فقط — scoped حتى لا يؤثر على باقي أزرار النظام */
.auth-panel .btn-primary {
    width: 100%; padding: .82rem 1rem; border: none; border-radius: .55rem;
    background: var(--navy);
    color: #fff; font-size: .9rem; font-weight: 700; cursor: pointer;
    transition: filter .15s, transform .15s, box-shadow .15s; font-family: inherit;
    display: flex; align-items: center; justify-content: center; gap: .4rem;
}
.auth-panel .btn-primary:hover { background: var(--navy-80); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(30,58,110,.3); }
.auth-panel .btn-primary:disabled { opacity: .65; cursor: not-allowed; transform: none; }
.auth-panel .btn-primary i { margin-inline-end: .4rem; }

.alert { display: none; align-items: flex-start; gap: .5rem; padding: .65rem .8rem; border-radius: .5rem; font-size: .8125rem; margin-bottom: 1rem; }
.alert.show { display: flex; }
.alert-error { background: var(--red-bg); color: var(--red-text); border: 1px solid #fca5a5; }
/* Bootstrap-style alerts (displayed by default) */
.alert.alert-success { display: flex; background: var(--green-bg); color: var(--green-text); border: 1px solid #86efac; }
.alert.alert-danger  { display: flex; background: var(--red-bg); color: var(--red-text); border: 1px solid #fca5a5; }
.alert.alert-warning { display: flex; background: var(--amber-bg); color: var(--amber-text); border: 1px solid #fcd34d; }
.alert.alert-info    { display: flex; background: var(--blue-bg); color: var(--blue-text); border: 1px solid #93c5fd; }
.alert.alert-primary { display: flex; background: #dbeafe; color: var(--navy); border: 1px solid #93c5fd; }
.alert-dismissible { padding-inline-end: 2.5rem; position: relative; }
.alert-dismissible .btn-close { position: absolute; inset-inline-end: .5rem; top: 50%; transform: translateY(-50%); }

@media (max-width: 480px) {
    .auth-panel { padding: 2rem 1.5rem 1.75rem; }
}

/* ====================================================================
   APP SHELL
   ==================================================================== */
.app-shell { display: flex; min-height: 100vh; }

/* ====================================================================
   SIDEBAR — LMS navy style
   ==================================================================== */
.sidebar {
    width: var(--sb-w);
    min-width: var(--sb-w);
    background: var(--sb-bg);
    height: 100vh;
    position: sticky;
    top: 0;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.3) transparent;
    flex-shrink: 0;
    z-index: 40;
}
.sidebar::-webkit-scrollbar { width: 7px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.28); border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.45); }

/* Brand */
.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: .3rem;
    padding: 0 1.1rem;
    height: var(--tb-h);
    border-bottom: 1px solid var(--sb-border);
    flex-shrink: 0;
}
.brand-logo-img { height: 24px; width: auto; object-fit: contain; }
.brand-logo-mark { display: none; height: 26px; width: 26px; object-fit: contain; }
.brand-version { display: block; font-size: .6rem; color: rgba(255,255,255,.4); font-weight: 400; }

/* Category labels — a level above .nav-group, clustering related groups
   (e.g. "العمليات" groups HR + Projects + Clients) */
.nav-category-label {
    padding: 18px 20px 7px;
    margin-top: 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .11em;
    color: rgba(255,255,255,.38);
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    border-top: 1px solid rgba(255,255,255,.06);
}
.nav-category-label:first-of-type { border-top: none; margin-top: 0; }

/* Collapse-to-rail toggle, pinned to the bottom of the sidebar via margin-top:auto
   on the flex column */
.sidebar-collapse-btn {
    margin: auto 10px 10px;
    position: sticky; bottom: 10px;
    display: flex; align-items: center; gap: 10px;
    padding: 11px 14px;
    border-top: 1px solid var(--sb-border);
    border-left: none; border-right: none; border-bottom: none;
    background: var(--sb-bg); border-radius: 8px;
    color: rgba(255,255,255,.5); font-size: 12.5px; font-weight: 600;
    font-family: 'Cairo', sans-serif; cursor: pointer;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}
.sidebar-collapse-btn i { font-size: 13px; transition: transform .2s; flex-shrink: 0; width: 16px; text-align: center; }
.sidebar-collapse-btn:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ── Collapsed (icon-only rail) mode ───────────────────────────────── */
.sidebar.collapsed { width: 76px; min-width: 76px; }
.sidebar.collapsed .sidebar-search,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-category-label,
.sidebar.collapsed .brand-version,
.sidebar.collapsed .nav-sub-label,
.sidebar.collapsed .sb-toggle-label,
.sidebar.collapsed #sidebarEmptyHint { display: none; }
.sidebar.collapsed .brand-full { display: none; }
.sidebar.collapsed .brand-logo-mark { display: block; }
.sidebar.collapsed .sidebar-brand { align-items: center; padding: 0; }
/* Text nodes (not wrapped in their own element) inherit font-size, so shrinking
   the link/button to 0 hides the label text; every icon has its own explicit
   font-size (.sl-icon/.icon/.g-icon rules below) so it stays fully visible. */
.sidebar.collapsed .sidebar-link,
.sidebar.collapsed .sidebar-home,
.sidebar.collapsed .nav-group-head {
    font-size: 0; justify-content: center; gap: 0;
    margin-inline: 10px; padding-inline: 0;
}
.sidebar.collapsed .nav-group-body { display: none !important; }
.sidebar.collapsed .g-chevron { display: none; }
.sidebar.collapsed .sidebar-collapse-btn { justify-content: center; }

@media (max-width: 960px) {
    .sidebar-collapse-btn { display: none; }
}

/* Sidebar quick-search */
.sidebar-search {
    display: flex; align-items: center; gap: 8px;
    margin: 12px 12px 6px; padding: 8px 10px;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 9px;
    flex-shrink: 0;
    transition: background .15s, border-color .15s;
}
.sidebar-search:focus-within { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.28); }
.sidebar-search i { font-size: 12px; color: rgba(255,255,255,.4); flex-shrink: 0; }
.sidebar-search input {
    flex: 1; min-width: 0; background: none; border: none; outline: none;
    color: #fff; font-size: 12.5px; font-family: inherit;
}
.sidebar-search input::placeholder { color: rgba(255,255,255,.4); }
.sidebar-search .sb-clear {
    display: none; border: none; background: none; color: rgba(255,255,255,.45);
    cursor: pointer; font-size: 11px; padding: 2px;
}
.sidebar-search.has-value .sb-clear { display: block; }
.sidebar-search.has-value .sb-clear:hover { color: #fff; }
.sidebar-empty-hint {
    display: none; padding: 10px 20px; font-size: 12px; color: rgba(255,255,255,.4); text-align: center;
}
.sidebar-empty-hint.show { display: block; }

/* Sub-group labels inside nav-group-body */
.nav-sub-label {
    padding: 10px 18px 4px;
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.35);
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    border-top: 1px solid rgba(255,255,255,.06);
    margin-top: 4px;
}
.nav-sub-label:first-child { border-top: none; margin-top: 0; }

/* Section labels (like LMS nav-section) */
.nav-section-label {
    padding: 18px 20px 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: rgba(255,255,255,.38);
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
}

/* Dashboard home link */
.sidebar-home {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 1px 10px;
    padding: 9px 12px;
    color: var(--sb-item);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: background .15s, color .15s, transform .15s;
}
.sidebar-home:hover { background: rgba(255,255,255,.08); color: var(--sb-item-hover); transform: translateX(-2px); }
.sidebar-home.active { background: rgba(255,255,255,.14); color: var(--sb-item-active); font-weight: 700; }
.sidebar-home.active::before {
    content: ''; position: absolute; inset-inline-start: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 58%; background: var(--orange); border-radius: 0 3px 3px 0;
}
.sidebar-home .icon { font-size: 14px; width: 18px; text-align: center; transition: color .15s; }
.sidebar-home.active .icon { color: var(--orange); }

/* Plan/permission-gated items — always wins over the quick-search filter's
   inline display toggles (see applyNavAccess() in _DashboardLayout.cshtml) */
.plan-hidden { display: none !important; }

/* Nav group — accordion: clickable header + collapsible links. Against the old
   "hidden or just collapsed?" ambiguity: a closed group keeps its link-count
   badge (.g-count) and a chevron visible, so its content is clearly one click
   away. The group holding the current page is server-rendered .open, and the
   user's manual opens persist in localStorage (sb_open_groups). */
.nav-group { margin: 0 0 2px; }

.nav-group-head {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 2px 10px 0;
    padding: 10px 12px;
    color: rgba(255,255,255,.62);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    width: calc(100% - 20px);
    border-radius: 8px;
    text-align: start;
    font-family: 'Cairo', sans-serif;
    user-select: none;
    background: none;
    border: none;
    outline: none;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.nav-group-head:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.85); }
.nav-group-head .g-icon {
    font-size: 11px; width: 24px; height: 24px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 7px; background: rgba(255,255,255,.08); color: var(--orange); opacity: .9;
}
.nav-group-head .g-title { flex: 1; }
.nav-group-head .g-chevron {
    font-size: 9px; flex-shrink: 0; opacity: .5;
    transition: transform .25s ease, opacity .15s;
}
.nav-group-head:hover .g-chevron { opacity: .9; }
.nav-group.open > .nav-group-head .g-chevron { transform: rotate(180deg); }

/* الطي/الفتح عبر grid-rows 0fr→1fr — أنعم من max-height ولا يحتاج قياس ارتفاع */
.nav-group-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .28s ease;
}
.nav-group.open > .nav-group-body { grid-template-rows: 1fr; }
/* أثناء البحث تُفتح كل المجموعات المطابقة قسرياً كي تظهر النتائج */
.sidebar.searching .nav-group-body { grid-template-rows: 1fr; }
.nav-group-body-inner { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

/* Nav items (matching LMS .nav-item) */
.sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 1px 10px;
    padding: 9px 12px;
    color: var(--sb-item);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: background .15s, color .15s, transform .15s;
}
.sidebar-link .sl-icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; transition: color .15s; }
.sidebar-link:hover { background: rgba(255,255,255,.08); color: var(--sb-item-hover); transform: translateX(-2px); }
.sidebar-link.active { background: rgba(255,255,255,.14); color: var(--sb-item-active); font-weight: 700; }
.sidebar-link.active .sl-icon { color: var(--orange); }
.sidebar-link.active::before {
    content: ''; position: absolute; inset-inline-start: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 58%; background: var(--orange); border-radius: 0 3px 3px 0;
}

/* Keyboard focus */
.sidebar-link:focus-visible,
.sidebar-home:focus-visible,
.nav-group-head:focus-visible,
.sidebar-search input:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: -1px;
}

/* Admin section divider */
.sidebar-section-divider {
    padding: 16px 20px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: rgba(255,255,255,.4);
    border-top: 1px solid var(--sb-border);
    margin-top: .6rem;
}

/* ====================================================================
   MAIN AREA
   ==================================================================== */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ====================================================================
   TOPBAR — matching LMS admin topbar
   ==================================================================== */
.topbar {
    height: var(--tb-h);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 30;
}

/* Page title in topbar */
.topbar-page {
    display: flex;
    flex-direction: column;
    padding-inline-start: .75rem;
    border-inline-start: 3px solid var(--orange);
    line-height: 1.25;
}
.topbar-title { font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap; }
.topbar-breadcrumb { font-size: .72rem; color: var(--text-muted); }

.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: .375rem; margin-inline-start: auto; }

/* Icon buttons in topbar (matching LMS .topbar-icon-btn) */
.topbar-btn {
    position: relative;
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border-radius: .5rem;
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 16px;
    transition: background .15s, color .15s;
    text-decoration: none;
}
.topbar-btn:hover { background: var(--bg); color: var(--navy); }
.topbar-btn .tb-badge {
    position: absolute; top: -3px; inset-inline-end: -3px;
    min-width: 16px; height: 16px; padding: 0 3px;
    background: var(--red); border-radius: 9999px;
    color: #fff; font-size: .6rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff;
}

/* Topbar separator */
.tb-sep { width: 1px; height: 24px; background: var(--border); margin: 0 .25rem; flex-shrink: 0; }

/* Attendance buttons */
.tb-attend { display: flex; align-items: center; }
.tb-att-btn {
    display: flex; align-items: center; gap: .35rem;
    padding: .28rem .8rem; border-radius: 9999px;
    font-size: .72rem; font-weight: 700; font-family: inherit;
    border: 1.5px solid transparent; cursor: pointer; white-space: nowrap;
    transition: all .15s;
}
.tb-att-btn:disabled { opacity: .55; cursor: not-allowed; }
.tb-att-btn:hover:not(:disabled) { filter: brightness(.92); transform: translateY(-1px); }
.tb-att-in  { background: var(--green-bg); color: var(--green-text); border-color: #86efac; }
.tb-att-out { background: var(--red-bg); color: var(--red-text); border-color: #fca5a5; }
.tb-att-done { display: flex; align-items: center; gap: .35rem; padding: .28rem .8rem; border-radius: 9999px; background: var(--green-bg); border: 1.5px solid #86efac; font-size: .72rem; font-weight: 700; color: var(--green-text); }

/* Pulse dot */
.tb-pulse-wrap { position: relative; }
.tb-pulse-dot { position: absolute; top: 3px; inset-inline-end: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--green); border: 1.5px solid #fff; animation: pulse-blink 2s ease-in-out infinite; }
@keyframes pulse-blink { 0%,100%{opacity:1} 50%{opacity:.25} }

/* User widget in topbar */
.tb-user {
    display: flex; align-items: center; gap: .5rem; cursor: pointer;
    padding: .3rem .5rem .3rem .4rem; border-radius: .5rem;
    border: 1.5px solid transparent;
    transition: background .15s, border-color .15s;
}
.tb-user:hover { background: var(--bg); border-color: var(--border); }
.tb-user-info { line-height: 1.25; }
.tb-user-name { font-size: .8125rem; font-weight: 600; color: var(--text); max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-user-role { font-size: .7rem; color: var(--text-muted); }
.tb-chevron { font-size: .6rem; color: var(--text-faint); margin-inline-start: .1rem; transition: transform .18s; }
.tb-user.open .tb-chevron { transform: rotate(180deg); }

/* Avatar — matching LMS gradient */
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--navy), var(--orange));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: .75rem; font-weight: 700; user-select: none; flex-shrink: 0;
    cursor: pointer; transition: opacity .15s;
}
.avatar:hover { opacity: .88; }
.avatar-lg {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--navy), var(--orange));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: .8125rem; font-weight: 700; flex-shrink: 0;
}

/* Dropdown panel */
.dropdown-wrap { position: relative; }
.dropdown-panel {
    position: absolute; top: calc(100% + 8px); inset-inline-end: 0;
    background: var(--card); border: 1px solid var(--border); border-radius: .75rem;
    box-shadow: var(--shadow-lg); min-width: 210px; z-index: 200;
    display: none; overflow: hidden;
    animation: panel-in .15s ease;
}
@keyframes panel-in { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:translateY(0)} }
.dropdown-panel.open { display: block; }

.dp-header {
    display: flex; align-items: center; gap: .75rem;
    padding: .875rem 1rem; border-bottom: 1px solid var(--bg);
}
.dp-header .dp-name { font-size: .875rem; font-weight: 600; color: var(--text); }
.dp-header .dp-email { font-size: .75rem; color: var(--text-muted); margin-top: .125rem; }

.dp-item {
    display: flex; align-items: center; gap: .625rem;
    padding: .625rem 1rem; font-size: .875rem; color: var(--text-sec);
    text-decoration: none; background: none; border: none; width: 100%;
    cursor: pointer; font-family: inherit; text-align: start;
    transition: background .12s;
}
.dp-item:hover { background: var(--bg); color: var(--navy); }
.dp-item.danger { color: var(--red-text); }
.dp-item.danger:hover { background: var(--red-bg); }
.dp-item i { width: 16px; text-align: center; color: var(--text-faint); font-size: 13px; }
.dp-item:hover i { color: var(--navy); }
.dp-item.danger i { color: var(--red-text); }
.dp-divider { border: none; border-top: 1px solid var(--bg); margin: .25rem 0; }

/* Notification items */
.notif-item {
    display: flex; align-items: flex-start; gap: .75rem;
    padding: .75rem 1rem; text-decoration: none; color: var(--text);
    transition: background .12s; border-bottom: 1px solid var(--bg); cursor: pointer;
}
.notif-item:last-of-type { border-bottom: none; }
.notif-item:hover { background: var(--bg); }
.notif-item--new { background: #fafbff; }
.notif-icon { width: 34px; height: 34px; border-radius: .5rem; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; color: #fff; }
.notif-icon.bg-blue   { background: var(--blue); }
.notif-icon.bg-green  { background: var(--green); }
.notif-icon.bg-orange { background: var(--orange); }
.notif-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); flex-shrink: 0; margin-top: .35rem; }
.notif-title { font-size: .8125rem; font-weight: 600; color: var(--text); }
.notif-msg   { font-size: .75rem; color: var(--text-muted); margin-top: .125rem; }
.notif-footer {
    display: block; text-align: center; padding: .75rem;
    font-size: .8125rem; font-weight: 600; color: var(--navy);
    border-top: 1px solid var(--bg); text-decoration: none;
    transition: background .12s;
}
.notif-footer:hover { background: var(--bg); }
.notif-mark-all { background: none; border: none; color: var(--navy); font-family: inherit; font-size: .75rem; font-weight: 600; cursor: pointer; padding: 0; }
.notif-mark-all:hover { text-decoration: underline; }

/* Mobile menu button */
.mobile-menu-btn {
    display: none; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: .5rem;
    background: none; border: none; color: var(--text-muted); font-size: 18px;
    cursor: pointer; flex-shrink: 0;
    transition: background .13s, color .13s;
}
.mobile-menu-btn:hover { background: var(--bg); color: var(--navy); }
.mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.48); z-index: 38; }
.mobile-overlay.show { display: block; }

/* ====================================================================
   CONTENT AREA
   ==================================================================== */
.content { padding: 24px; flex: 1; min-width: 0; }

/* ====================================================================
   STAT CARDS — LMS style: white + bottom-border accent + icon top-right
   ==================================================================== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1rem; }

.stat-card {
    background: var(--card);
    border-radius: .875rem;
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    border-bottom: 3px solid transparent;
    transition: box-shadow .18s, transform .18s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
    position: absolute; top: 1rem; inset-inline-end: 1rem;
    width: 38px; height: 38px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .875rem;
}

.stat-label { font-size: .8125rem; color: var(--text-muted); font-weight: 500; margin-bottom: .375rem; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-trend { font-size: .75rem; color: var(--text-faint); margin-top: .375rem; }
.stat-trend .up   { color: var(--green-text); font-weight: 600; }
.stat-trend .down { color: var(--red-text); font-weight: 600; }

/* Stat color helpers — border + icon background/color */
.sc-orange { border-bottom-color: var(--orange); }
.sc-orange .stat-icon { background: #fde8d8; color: var(--orange); }
.sc-blue   { border-bottom-color: var(--blue); }
.sc-blue   .stat-icon { background: var(--blue-bg); color: var(--blue-text); }
.sc-green  { border-bottom-color: var(--green); }
.sc-green  .stat-icon { background: var(--green-bg); color: var(--green-text); }
.sc-red    { border-bottom-color: var(--red); }
.sc-red    .stat-icon { background: var(--red-bg); color: var(--red-text); }
.sc-purple { border-bottom-color: var(--purple); }
.sc-purple .stat-icon { background: var(--purple-bg); color: var(--purple-text); }
.sc-amber  { border-bottom-color: var(--amber); }
.sc-amber  .stat-icon { background: var(--amber-bg); color: var(--amber-text); }
.sc-cyan   { border-bottom-color: var(--cyan); }
.sc-cyan   .stat-icon { background: var(--cyan-bg); color: var(--cyan-text); }
.sc-navy   { border-bottom-color: var(--navy); }
.sc-navy   .stat-icon { background: #dbeafe; color: var(--navy); }
/* Alias: .stat-card .icon/.label/.value → same as .stat-icon/.stat-label/.stat-value */
.stat-card .icon  { width: 48px; height: 48px; border-radius: .75rem; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; color: #fff; flex-shrink: 0; }
.stat-card .label { font-size: .8125rem; color: var(--text-muted); font-weight: 500; margin-bottom: .375rem; }
.stat-card .value { font-size: 2rem; font-weight: 800; color: var(--text); line-height: 1; }

/* stat-content wrapper for backward compat */
.stat-content { flex: 1; min-width: 0; }

/* ====================================================================
   CARDS — LMS style
   ==================================================================== */
.erp-card {
    background: var(--card);
    border-radius: .875rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow .18s;
}
.erp-card:hover { box-shadow: var(--shadow-md); }
.erp-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--bg);
    font-weight: 700; font-size: .9375rem; color: var(--text);
}
.erp-card-body { padding: 1.25rem; }
.erp-card-footer { padding: .75rem 1.25rem; border-top: 1px solid var(--bg); background: #f9fafb; }

/* ====================================================================
   DATA TABLE — LMS style
   ==================================================================== */
.data-table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
.data-table thead {
    background: #f9fafb;
}
.data-table thead th {
    text-align: start;
    padding: .75rem 1rem;
    color: var(--text-muted);
    font-weight: 600; font-size: .75rem; text-transform: uppercase;
    letter-spacing: .04em; white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
.data-table tbody td { padding: .875rem 1rem; border-bottom: 1px solid var(--bg); vertical-align: middle; color: var(--text-sec); }
.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:hover td { background: #fafbff; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ====================================================================
   BADGES — LMS style
   ==================================================================== */
.badge {
    display: inline-flex; align-items: center;
    padding: 2px 8px; border-radius: 9999px;
    font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.badge-green   { background: var(--green-bg);  color: var(--green-text); }
.badge-red     { background: var(--red-bg);    color: var(--red-text); }
.badge-blue    { background: var(--blue-bg);   color: var(--blue-text); }
.badge-amber   { background: var(--amber-bg);  color: var(--amber-text); }
.badge-purple  { background: var(--purple-bg); color: var(--purple-text); }
.badge-cyan    { background: var(--cyan-bg);   color: var(--cyan-text); }
.badge-orange  { background: #fde8d8;          color: var(--orange-dark); }
.badge-navy    { background: #dbeafe;          color: var(--navy); }
.badge-gray    { background: #f3f4f6;          color: var(--text-muted); }
.badge-yellow  { background: var(--amber-bg);  color: var(--amber-text); }

/* ── badge-status: inline status pill used in new-style pages ── */
.badge-status {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .2rem .65rem; border-radius: 9999px;
    font-size: .75rem; font-weight: 600; white-space: nowrap;
    border: 1px solid transparent;
}
.badge-status.badge-success { background: var(--green-bg);  color: var(--green-text);  border-color: var(--green-bg); }
.badge-status.badge-muted   { background: #f3f4f6;          color: var(--text-muted);  border-color: #e5e7eb; }
.badge-status.badge-danger  { background: var(--red-bg);    color: var(--red-text);    border-color: var(--red-bg); }
.badge-status.badge-warning { background: var(--amber-bg);  color: var(--amber-text);  border-color: var(--amber-bg); }
.badge-status.badge-info    { background: var(--blue-bg);   color: var(--blue-text);   border-color: var(--blue-bg); }

/* ====================================================================
   BUTTONS
   ==================================================================== */
.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .5rem 1.1rem; border-radius: .5rem; font-family: inherit;
    font-size: .875rem; font-weight: 600; cursor: pointer;
    border: 1.5px solid transparent; transition: all .15s; text-decoration: none;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-sm { padding: .3rem .75rem; font-size: .8125rem; }
.btn-lg { padding: .7rem 1.5rem; font-size: .9375rem; }

.btn-brand { background: var(--orange); color: #fff; border-color: transparent; }
.btn-brand:hover:not(:disabled) { background: var(--orange-dark); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(232,101,32,.3); }

.btn-navy { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-navy:hover:not(:disabled) { background: var(--navy-80); }

.btn-outline { background: transparent; color: var(--text-sec); border-color: var(--border); }
.btn-outline:hover:not(:disabled) { background: var(--bg); border-color: var(--border-strong); color: var(--text); }

.btn-outline-brand { background: transparent; color: var(--orange); border-color: var(--orange); }
.btn-outline-brand:hover:not(:disabled) { background: var(--orange); color: #fff; }

.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-success { background: var(--green); color: #fff; border-color: var(--green); }
.btn-success:hover:not(:disabled) { background: #16a34a; }

.btn-light { background: #f3f4f6; color: var(--text-sec); border-color: transparent; }
.btn-light:hover:not(:disabled) { background: #e5e7eb; }

/* Icon-only small button */
.icon-btn-sm {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: var(--radius-xs);
    border: 1.5px solid transparent; background: #f3f4f6; color: var(--text-muted);
    cursor: pointer; font-size: .8rem; transition: background .14s, color .14s;
}
.icon-btn-sm:hover { background: var(--navy); color: #fff; }
.icon-btn-sm.warning:hover { background: var(--amber); color: #fff; }
.icon-btn-sm.danger:hover  { background: var(--red); color: #fff; }
.icon-btn-sm.success:hover { background: var(--green); color: #fff; }

/* Quick action button (like LMS quick-btn) */
.quick-btn {
    display: flex; align-items: center; gap: .75rem;
    padding: .75rem 1rem; border-radius: .75rem;
    border: 1.5px solid var(--border); background: #fff; cursor: pointer;
    text-decoration: none; font-size: .8125rem; font-weight: 600;
    color: var(--text-sec); transition: all .15s; width: 100%;
}
.quick-btn:hover { border-color: var(--navy); color: var(--navy); background: #f8faff; }
.quick-btn .qicon { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .8rem; flex-shrink: 0; }

/* ====================================================================
   FORMS
   ==================================================================== */
.form-group { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .9rem; }
.form-label { font-size: .845rem; font-weight: 600; color: var(--text); }
.form-label .req { color: var(--red); margin-inline-start: .15rem; }

.form-control,
.form-select {
    width: 100%; padding: .5rem .85rem;
    border: 1.5px solid var(--border);
    border-radius: .5rem;
    font-family: inherit; font-size: .875rem; color: var(--text);
    background: var(--card); outline: none;
    transition: border-color .15s, box-shadow .15s;
    appearance: auto;
}
.form-control::placeholder { color: var(--text-faint); }
.form-control:focus,
.form-select:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(30,58,110,.1); }

textarea.form-control { resize: vertical; min-height: 80px; }

/* ====================================================================
   MODAL
   ==================================================================== */
.modal-overlay {
    display: none;
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    z-index: 500; align-items: center; justify-content: center;
    padding: 1rem;
}
.modal-overlay.show {
    display: flex;
    animation: overlay-in .18s ease;
}
@keyframes overlay-in { from{opacity:0} to{opacity:1} }

.modal-box {
    background: var(--card); border-radius: 1rem;
    box-shadow: var(--shadow-lg); width: 100%; max-height: 92vh;
    overflow-y: auto; animation: modal-in .2s ease;
}
@keyframes modal-in { from{opacity:0;transform:scale(.97) translateY(10px)} to{opacity:1;transform:none} }

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.5rem; border-bottom: 1px solid var(--border);
    font-weight: 700; font-size: 1rem; color: var(--text);
    position: sticky; top: 0; background: var(--card); z-index: 1;
}
.modal-close {
    border: none; background: none; font-size: 1.25rem; cursor: pointer;
    color: var(--text-muted); line-height: 1; padding: .2rem .4rem;
    border-radius: var(--radius-xs); transition: background .13s, color .13s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 1.5rem; }
.modal-footer {
    display: flex; align-items: center; justify-content: flex-end;
    gap: .75rem; padding: 1rem 1.5rem; border-top: 1px solid var(--border);
    background: #f9fafb;
    position: sticky; bottom: 0;
}

/* ── modal-box-* aliases (used by Warehouses and new-style pages) ── */
.modal-box-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.5rem; border-bottom: 1px solid var(--border);
    font-weight: 700; font-size: 1rem; color: var(--text);
    position: sticky; top: 0; background: var(--card); z-index: 1;
}
.modal-box-title { font-size: 1rem; font-weight: 700; color: var(--text); margin: 0; }
.modal-box-body  { padding: 1.5rem; }
.modal-box-footer {
    display: flex; align-items: center; justify-content: flex-end;
    gap: .75rem; padding: 1rem 1.5rem; border-top: 1px solid var(--border);
    background: #f9fafb; position: sticky; bottom: 0;
}

/* ====================================================================
   TOASTS
   ==================================================================== */
.erp-toast {
    position: fixed; bottom: 1.5rem; inset-inline-start: 1.5rem;
    z-index: 9999; min-width: 280px; max-width: 380px;
    background: var(--card); border-radius: .875rem;
    box-shadow: var(--shadow-lg); border: 1px solid var(--border);
    padding: .875rem 1.1rem;
    display: flex; align-items: flex-start; gap: .75rem;
    animation: toast-in .25s ease;
}
@keyframes toast-in { from{opacity:0;transform:translateY(14px)} to{opacity:1;transform:none} }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: .05rem; }
.toast-body .toast-title { font-weight: 700; font-size: .875rem; color: var(--text); }
.toast-body .toast-msg   { font-size: .8rem; color: var(--text-muted); margin-top: .1rem; }
.erp-toast.success .toast-icon { color: var(--green); }
.erp-toast.error   .toast-icon { color: var(--red); }
.erp-toast.info    .toast-icon { color: var(--blue); }
.erp-toast.warning .toast-icon { color: var(--amber); }

/* ====================================================================
   UTILITY
   ==================================================================== */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.25rem; flex-wrap: wrap; gap: .75rem;
}
.page-header h1,
.page-header h4 { font-weight: 800; margin: 0; font-size: 1.125rem; color: var(--text); }
.page-header p  { font-size: .8125rem; color: var(--text-muted); margin: .125rem 0 0; }

.empty-state { text-align: center; padding: 3.5rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 2.25rem; color: var(--text-faint); margin-bottom: .875rem; display: block; }
.empty-state p { font-size: .875rem; margin: .35rem 0 0; }

.loading-row,
.empty-row { text-align: center; color: var(--text-muted); padding: 2rem !important; }
.empty-row i { display: block; font-size: 1.875rem; color: var(--text-faint); margin-bottom: .5rem; }

/* Skeleton loading */
@keyframes shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 800px 100%;
    animation: shimmer 1.5s infinite;
    border-radius: .375rem;
    display: inline-block;
}

/* Scrollbar custom (subtle) */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.user-cell { display: flex; align-items: center; gap: .5rem; }
.user-avatar-sm {
    width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(135deg, var(--navy), var(--orange));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: .65rem; font-weight: 700; flex-shrink: 0;
}

/* Pagination */
.pagination-bar { display: flex; gap: .3rem; padding: .875rem 1.1rem; justify-content: center; flex-wrap: wrap; }
.pagination-bar button {
    padding: .3rem .7rem; border: 1.5px solid var(--border); border-radius: var(--radius-xs);
    background: var(--card); color: var(--text-muted); font-size: .8125rem;
    cursor: pointer; font-family: inherit; transition: all .14s;
}
.pagination-bar button:hover:not(:disabled) { background: var(--navy); color: #fff; border-color: var(--navy); }
.pagination-bar button.active { background: var(--navy); color: #fff; border-color: var(--navy); font-weight: 700; }
.pagination-bar button:disabled { opacity: .4; cursor: not-allowed; }

/* Tabs */
.erp-tabs { display: flex; gap: .2rem; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; }
.erp-tab {
    padding: .6rem 1.15rem; border: none; background: none; font-family: inherit;
    font-size: .875rem; color: var(--text-muted); cursor: pointer;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    transition: color .15s, border-color .15s; font-weight: 600;
}
.erp-tab:hover { color: var(--navy); }
.erp-tab.active { color: var(--orange); border-bottom-color: var(--orange); font-weight: 700; }

/* Search input */
.search-field {
    display: flex; align-items: center; gap: .5rem;
    border: 1.5px solid var(--border); border-radius: .5rem;
    padding: .4rem .85rem; background: var(--card);
    transition: border-color .15s, box-shadow .15s;
}
.search-field:focus-within { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(30,58,110,.1); }
.search-field i { color: var(--text-faint); font-size: .85rem; flex-shrink: 0; }
.search-field input { border: none; outline: none; background: none; font-size: .875rem; font-family: inherit; color: var(--text); width: 100%; }
.search-field input::placeholder { color: var(--text-faint); }

/* Progress bars */
.erp-progress { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.erp-progress-fill { height: 100%; border-radius: 999px; background: var(--navy); transition: width .4s ease; }

/* Toggle switch — like LMS */
.toggle-switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #d1d5db; border-radius: 11px; cursor: pointer; transition: .2s; }
.toggle-slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: white; border-radius: 50%; transition: .2s; }
input:checked + .toggle-slider { background: var(--navy); }
input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Permission matrix */
.perm-matrix { display: flex; flex-direction: column; gap: .15rem; }
.perm-row { display: flex; align-items: center; padding: .5rem .75rem; border-radius: .375rem; gap: .75rem; transition: background .1s; }
.perm-row:hover { background: var(--bg); }
.perm-name { flex: 1; font-size: .8125rem; color: var(--text-sec); font-weight: 500; }
.perm-toggle input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--navy); cursor: pointer; }
.perm-module-header { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); padding: .6rem .75rem .2rem; margin-top: .5rem; border-top: 1px solid var(--border); }
.perm-module-header:first-child { border-top: none; margin-top: 0; }

/* ====================================================================
   RESPONSIVE
   ==================================================================== */
@media (min-width: 860px) {
    .tb-user-info { display: block; }
}

@media (max-width: 960px) {
    .mobile-menu-btn { display: flex; }
    .mobile-overlay  { display: none; }
    .mobile-overlay.show { display: block; }
    .sidebar {
        position: fixed; top: 0; bottom: 0; inset-inline-start: 0;
        transform: translateX(-100%); transition: transform .22s ease; z-index: 50;
    }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    .sidebar.mobile-open { transform: translateX(0) !important; }
    .content { padding: 16px 14px; }
    .tb-attend { display: none; }
    .tb-pulse-wrap { display: none; }
}

@media (max-width: 640px) {
    .tb-sep         { display: none; }
    .topbar-page    { display: none; }
    .stat-grid      { grid-template-columns: 1fr 1fr; }
    .topbar         { padding: 0 14px; }
}
@media (max-width: 400px) {
    .stat-grid { grid-template-columns: 1fr; }
}

/* ====================================================================
   TABLE ACTION CELL
   ==================================================================== */
.action-cell {
    text-align: start; white-space: nowrap;
    display: flex; align-items: center; gap: .35rem; padding: .5rem 1rem !important;
}
.data-table td.action-cell { padding: .5rem 1rem; }

/* ====================================================================
   BACKWARD-COMPAT ALIASES — keep older pages working without rewrite
   ==================================================================== */
.card         { background: var(--card); border-radius: .875rem; box-shadow: var(--shadow-sm); overflow: hidden; }
.card-header  { display:flex; align-items:center; justify-content:space-between; padding:1rem 1.25rem; border-bottom:1px solid var(--bg); font-weight:700; font-size:.9375rem; color:var(--text); }
.card-body    { padding: 1.25rem; }
.card-footer  { padding:.75rem 1.25rem; border-top:1px solid var(--bg); background:#f9fafb; }

.btn-primary  { background:var(--navy); color:#fff; border-color:var(--navy); width:auto; padding:.45rem 1.1rem; border-radius:.5rem; box-shadow:none; transform:none; }
.btn-primary:hover:not(:disabled) { background:var(--navy-80); transform:none; box-shadow:none; }
.btn-secondary { background:#f3f4f6; color:var(--text-sec); border-color:transparent; width:auto; padding:.45rem 1.1rem; }
.btn-secondary:hover:not(:disabled) { background:#e5e7eb; }
.btn-warning   { background:var(--amber); color:#fff; border-color:var(--amber); width:auto; }
.btn-info      { background:var(--blue); color:#fff; border-color:var(--blue); width:auto; }

.tabs { display:flex; gap:.2rem; border-bottom:2px solid var(--border); margin-bottom:1.25rem; }
.tab-btn { padding:.6rem 1.15rem; border:none; background:none; font-family:inherit; font-size:.875rem; color:var(--text-muted); cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-2px; transition:color .15s,border-color .15s; font-weight:600; }
.tab-btn:hover { color:var(--navy); }
.tab-btn.active { color:var(--orange); border-bottom-color:var(--orange); font-weight:700; }

/* ====================================================================
   BOOTSTRAP MODAL STRUCTURE ALIASES — shim for legacy pages
   ==================================================================== */
/* The shim adds/removes .show; the .modal.fade itself acts as overlay */
.modal.fade {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 500;
    align-items: center; justify-content: center; padding: 1rem;
    animation: overlay-in .18s ease;
}
.modal.fade.show { display: flex; }

.modal-dialog { width: 100%; max-width: 520px; }
.modal-dialog.modal-lg  { max-width: 680px; }
.modal-dialog.modal-xl  { max-width: 900px; }
.modal-dialog.modal-sm  { max-width: 360px; }

.modal-content {
    background: var(--card); border-radius: 1rem;
    box-shadow: var(--shadow-lg); width: 100%;
    max-height: 92vh; overflow-y: auto;
    animation: modal-in .2s ease;
}

/* Reuse existing .modal-header / .modal-body / .modal-footer from above */
/* (already defined in the custom modal section — these are the same) */

.btn-close {
    border: none; background: none; cursor: pointer;
    color: var(--text-muted); line-height: 1;
    padding: .2rem .5rem; border-radius: var(--radius-xs);
    font-size: 1.25rem; transition: background .13s, color .13s;
    display: inline-flex; align-items: center; justify-content: center;
}
.btn-close::before { content: '×'; }
.btn-close:hover { background: var(--bg); color: var(--text); }

/* Bootstrap grid/flex utility micro-compat */
.row    { display: flex; flex-wrap: wrap; margin: 0 -.5rem; }
.row > * { padding: .5rem; }
.row.g-1 > * { padding: .25rem; }
.row.g-2 > * { padding: .375rem; }
.row.g-3 > * { padding: .5rem; }
.row.g-4 > * { padding: .75rem; }
.col-12     { width: 100%; }
.col-md-1   { width: 8.333%; }
.col-md-2   { width: 16.667%; }
.col-md-3   { width: 25%; }
.col-md-4   { width: 33.333%; }
.col-md-5   { width: 41.667%; }
.col-md-6   { width: 50%; }
.col-md-7   { width: 58.333%; }
.col-md-8   { width: 66.667%; }
.col-md-9   { width: 75%; }
.col-md-10  { width: 83.333%; }
.col-md-11  { width: 91.667%; }
.col-6      { width: 50%; }
.col-4      { width: 33.333%; }
.col-3      { width: 25%; }
@media (max-width: 768px) {
    .col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11 { width: 100%; }
    .col-6,.col-4 { width: 100%; }
}
.d-flex            { display: flex !important; }
.align-items-center { align-items: center !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-end   { align-items: flex-end !important; }
.flex-wrap         { flex-wrap: wrap !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: .5rem !important; }
.mb-3 { margin-bottom: .75rem !important; }
.mb-4 { margin-bottom: 1.25rem !important; }
.me-1 { margin-inline-end: .25rem !important; }
.me-2 { margin-inline-end: .5rem !important; }
.py-3 { padding-top: .75rem !important; padding-bottom: .75rem !important; }
.p-0  { padding: 0 !important; }
.w-100 { width: 100% !important; }
.text-end   { text-align: end !important; }
.text-center { text-align: center !important; }
.fw-bold    { font-weight: 700 !important; }
.small, small { font-size: .82rem !important; }
.fs-2       { font-size: 1.75rem !important; }
.text-primary { color: var(--navy) !important; }
.text-success { color: var(--green-text) !important; }
.text-danger  { color: var(--red-text) !important; }
.text-warning { color: var(--amber-text) !important; }
.text-info    { color: var(--blue-text) !important; }
.text-muted   { color: var(--text-muted) !important; }
.bg-primary   { background: var(--navy) !important; color: #fff; }
.bg-success   { background: var(--green) !important; color: #fff; }
.bg-danger    { background: var(--red) !important; color: #fff; }
.bg-warning   { background: var(--amber) !important; color: #fff; }
.bg-info      { background: var(--blue) !important; color: #fff; }
.bg-secondary { background: #6b7280 !important; color: #fff; }
.table        { width: 100%; border-collapse: collapse; font-size: .8125rem; }
.table th, .table td { padding: .75rem 1rem; border-bottom: 1px solid var(--bg); vertical-align: middle; }
.table thead th { color: var(--text-muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; background: #f9fafb; }
.table.table-hover tbody tr:hover td { background: #fafbff; }
.table-responsive { overflow-x: auto; }
.table-sm th, .table-sm td { padding: .4rem .75rem; }
.form-select { /* same as .form-control */ }

/* ── col-lg-* (tablet fallback = same as col-md-*) ── */
.col-lg-2  { width: 16.667%; }
.col-lg-3  { width: 25%; }
.col-lg-4  { width: 33.333%; }
.col-lg-6  { width: 50%; }
.col-lg-8  { width: 66.667%; }
.col-lg-9  { width: 75%; }
@media (max-width: 992px) {
    .col-lg-2,.col-lg-3,.col-lg-4,.col-lg-6,.col-lg-8,.col-lg-9 { width: 100%; }
}

/* ── Border/box utilities ── */
.border { border: 1.5px solid var(--border) !important; }
.border-top    { border-top: 1px solid var(--border) !important; }
.border-bottom { border-bottom: 1px solid var(--border) !important; }

/* ── Padding utilities ── */
.p-1 { padding: .25rem !important; }
.p-2 { padding: .5rem !important; }
.p-3 { padding: .75rem !important; }
.p-4 { padding: 1.25rem !important; }
.p-5 { padding: 2rem !important; }

/* ── Margin y/x utilities ── */
.my-1 { margin-top: .25rem !important; margin-bottom: .25rem !important; }
.my-2 { margin-top: .5rem !important; margin-bottom: .5rem !important; }
.my-3 { margin-top: .75rem !important; margin-bottom: .75rem !important; }
.my-4 { margin-top: 1.25rem !important; margin-bottom: 1.25rem !important; }
.mx-1 { margin-inline: .25rem !important; }
.mx-2 { margin-inline: .5rem !important; }
.mx-3 { margin-inline: .75rem !important; }
.mx-auto { margin-inline: auto !important; }

/* ── Missing spacing / sizing utilities ── */
.mb-1 { margin-bottom: .25rem !important; }
.mb-5 { margin-bottom: 2rem !important; }
.py-5 { padding-top: 2.5rem !important; padding-bottom: 2.5rem !important; }
.py-1 { padding-top: .25rem !important; padding-bottom: .25rem !important; }
.ps-3 { padding-inline-start: .75rem !important; }
.pe-3 { padding-inline-end: .75rem !important; }
.mt-1 { margin-top: .25rem !important; }
.mt-2 { margin-top: .5rem !important; }
.mt-3 { margin-top: .75rem !important; }
.mt-4 { margin-top: 1.25rem !important; }
.ms-1 { margin-inline-start: .25rem !important; }
.ms-2 { margin-inline-start: .5rem !important; }
.ms-3 { margin-inline-start: .75rem !important; }
.ms-auto { margin-inline-start: auto !important; }
.me-3 { margin-inline-end: .75rem !important; }
.me-auto { margin-inline-end: auto !important; }
.py-2 { padding-top: .5rem !important; padding-bottom: .5rem !important; }
.py-4 { padding-top: 1.25rem !important; padding-bottom: 1.25rem !important; }
.px-0 { padding-inline: 0 !important; }
.px-3 { padding-inline: .75rem !important; }
.px-4 { padding-inline: 1.25rem !important; }
.gap-1 { gap: .25rem !important; }
.gap-2 { gap: .5rem !important; }
.gap-3 { gap: .75rem !important; }
.fs-3  { font-size: 1.5rem !important; }
.fs-4  { font-size: 1.25rem !important; }
.fs-5  { font-size: 1rem !important; }
.fs-6  { font-size: .875rem !important; }
.text-start { text-align: start !important; }
.border-0 { border: none !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.rounded   { border-radius: .5rem !important; }
.rounded-pill { border-radius: 9999px !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-end    { justify-content: flex-end !important; }
.align-items-start { align-items: flex-start !important; }
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-inline-flex { display: inline-flex !important; }
.overflow-auto { overflow: auto !important; }
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.cursor-pointer { cursor: pointer !important; }
.h-100 { height: 100% !important; }
.w-auto { width: auto !important; }
.flex-fill { flex: 1 1 auto !important; }
.flex-column { flex-direction: column !important; }
.flex-grow-1 { flex-grow: 1 !important; }
.pb-0 { padding-bottom: 0 !important; }
.pb-2 { padding-bottom: .5rem !important; }
.pb-3 { padding-bottom: .75rem !important; }
.pt-2 { padding-top: .5rem !important; }
.pt-3 { padding-top: .75rem !important; }
.lh-1  { line-height: 1 !important; }
.lh-sm { line-height: 1.25 !important; }
.fw-medium { font-weight: 500 !important; }
.fw-normal { font-weight: 400 !important; }
.opacity-75 { opacity: .75 !important; }
.opacity-50 { opacity: .5 !important; }
.text-decoration-none { text-decoration: none !important; }
.text-nowrap { white-space: nowrap !important; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-select-none { user-select: none !important; }
.pointer-events-none { pointer-events: none !important; }
.bg-transparent { background: transparent !important; }
.bg-white { background: #fff !important; }
.bg-light { background: var(--bg) !important; }
.text-white { color: #fff !important; }
.text-black { color: #000 !important; }
.text-dark  { color: var(--text) !important; }

/* ── Bootstrap button variants ── */
.btn-success { background: var(--green); color: #fff; border-color: var(--green); }
.btn-success:hover:not(:disabled) { background: var(--green-text); }
.btn-outline-primary { background: transparent; color: var(--navy); border-color: var(--navy); border-width: 1.5px; }
.btn-outline-primary:hover:not(:disabled) { background: var(--navy); color: #fff; }
.btn-outline-secondary { background: transparent; color: #6b7280; border-color: #d1d5db; border-width: 1.5px; }
.btn-outline-secondary:hover:not(:disabled) { background: #f3f4f6; color: var(--text); }
.btn-outline-danger { background: transparent; color: var(--red-text); border-color: var(--red); border-width: 1.5px; }
.btn-outline-danger:hover:not(:disabled) { background: var(--red); color: #fff; }
.btn-outline-info { background: transparent; color: var(--blue-text); border-color: var(--blue); border-width: 1.5px; }
.btn-outline-info:hover:not(:disabled) { background: var(--blue); color: #fff; }
.btn-outline-warning { background: transparent; color: var(--amber-text); border-color: var(--amber); border-width: 1.5px; }
.btn-outline-warning:hover:not(:disabled) { background: var(--amber); color: #fff; }
.btn-outline-success { background: transparent; color: var(--green-text); border-color: var(--green); border-width: 1.5px; }
.btn-outline-success:hover:not(:disabled) { background: var(--green); color: #fff; }

/* ── Table helpers ── */
.table-light th, .table-light { background: #f9fafb !important; color: var(--text-muted); }
thead.table-light th { background: #f9fafb; color: var(--text-muted); font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* ── Form helpers ── */
.form-text { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; display: block; }
.form-group { display: flex; flex-direction: column; gap: .25rem; }
.form-check { display: flex; align-items: center; gap: .45rem; cursor: pointer; font-size: .875rem; }
.form-check-input { width: 1rem; height: 1rem; cursor: pointer; accent-color: var(--navy); }
.form-check-label { cursor: pointer; font-weight: 500; }
.input-group { display: flex; }
.input-group .form-control { border-radius: 0; flex: 1; }
.input-group .form-control:first-child { border-radius: .5rem 0 0 .5rem; }
.input-group-text { padding: .5rem .75rem; background: #f3f4f6; border: 1.5px solid var(--border); border-inline-start: none; border-radius: 0 .5rem .5rem 0; font-size: .875rem; color: var(--text-muted); display: inline-flex; align-items: center; }

/* ====================================================================
   TOPBAR DAILY-NOTES PANEL
   ==================================================================== */
.dn-panel { padding: 0; }
.dn-item {
    display: flex; align-items: flex-start; gap: .65rem;
    padding: .75rem 1.1rem; border-bottom: 1px solid var(--bg);
    transition: background .1s; cursor: pointer;
}
.dn-item:last-child { border-bottom: none; }
.dn-item:hover { background: var(--bg); }
.dn-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px;
}
.dn-dot.urgent { background: var(--red); }
.dn-dot.important { background: var(--orange); }
.dn-dot.normal { background: var(--blue); }
.dn-body .dn-title { font-size: .8125rem; font-weight: 600; color: var(--text); line-height: 1.35; }
.dn-body .dn-meta  { font-size: .72rem; color: var(--text-muted); margin-top: .15rem; }

/* Pulse ring for urgent daily notes badge */
@keyframes pulse-ring {
    0%   { box-shadow: 0 0 0 0 rgba(232,101,32,.4); }
    70%  { box-shadow: 0 0 0 6px rgba(232,101,32,0); }
    100% { box-shadow: 0 0 0 0 rgba(232,101,32,0); }
}
.dn-pulse-btn { animation: pulse-ring 2s infinite; }

/* ====================================================================
   SIDEBAR V2 — سايدبار شخصي لكل موظف (مبني من السيرفر حسب الصلاحيات)
   ==================================================================== */

/* بطاقة الموظف أعلى القائمة */
.sb-profile {
    display: flex; align-items: center; gap: 10px;
    margin: 12px 12px 4px; padding: 11px 12px;
    background: linear-gradient(135deg, rgba(255,255,255,.1), rgba(255,255,255,.04));
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 12px;
    flex-shrink: 0;
}
.sb-profile-avatar {
    width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--orange), #f0883e);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: .85rem; letter-spacing: .02em;
    box-shadow: 0 3px 10px rgba(232,101,32,.35);
}
.sb-profile-info { min-width: 0; flex: 1; }
.sb-profile-name {
    font-size: .8rem; font-weight: 700; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-profile-role {
    display: flex; align-items: center; gap: 5px;
    font-size: .66rem; color: var(--orange); font-weight: 700; margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-profile-role i { font-size: 9px; flex-shrink: 0; }
.sb-profile-dept {
    display: flex; align-items: center; gap: 5px;
    font-size: .63rem; color: rgba(255,255,255,.5); margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-profile-dept i { font-size: 8.5px; flex-shrink: 0; }

/* وضع الطي: تبقى الصورة الرمزية وحدها */
.sidebar.collapsed .sb-profile { padding: 6px; margin: 10px 12px 2px; justify-content: center; background: none; border-color: transparent; }
.sidebar.collapsed .sb-profile-info { display: none; }
.sidebar.collapsed .sb-profile-avatar { width: 36px; height: 36px; }

/* عدّاد الروابط بجانب عنوان المجموعة */
.nav-group-head .g-count {
    font-size: 9px; font-weight: 700;
    min-width: 18px; height: 18px; padding: 0 5px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 9px;
    background: rgba(255,255,255,.09); color: rgba(255,255,255,.5);
}
.sidebar.collapsed .nav-group-head .g-count { display: none; }

/* لمسات التصميم الجديد: فاصل أنعم بين المجموعات وحالة active أوضح */
.nav-group { margin: 0 0 4px; }
.nav-group-head { padding: 9px 12px 7px; }
.sidebar-link.active {
    background: linear-gradient(90deg, rgba(232,101,32,.22), rgba(255,255,255,.08));
}
.sidebar-link.active::before {
    content: ''; position: absolute; inset-inline-start: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 58%; background: var(--orange); border-radius: 0 3px 3px 0;
}
