/* ════════════════════════════════════════════════════════════════════════
   Sanad HR — main.css  ·  shared shell + design system (redesign 1, Nov 2026)
   Identity: Brand Guidelines v2.0 (deep teal, brass, cream, Readex Pro).
   Spec: Sanad-HQ/6-product/redesign/01-research.md · report: 04-shell-report.md

   RULES FOR PAGES
   · Use var(--…) tokens only, never new hex. Status colour = .ui-tag tones.
   · No blur, no blurred shadows (hairlines and --ring only). Western digits.
   · Logical properties only (inline-start/end). No left/right in new CSS.
   · No ancestor of .sidebar may set overflow:hidden/auto or transform, and no
     page may add its own 100vh wrapper (the sidebar is sticky).
   · New components carry the ui- prefix so they never collide with the
     4,000+ page-level class rules. Legacy classes (.btn .card .data-table
     .status-badge .stat-card .form-input .modal-overlay .toast .pagination)
     keep working and now wear the identity.

   COMPONENTS (class → use)
   Page header   .ui-page-head > .ui-page-head__main(.ui-crumbs, h1.ui-page-head__title,
                 p.ui-page-head__desc) + .ui-page-head__actions        (legacy .page-head/.page-title)
   Teal hero     .ui-hero (dashboard, profile header, payroll summary only; one per page)
   Card          .ui-card [.is-flush] > .ui-card__head(.ui-card__title, actions) + .ui-card__body
   KPI tiles     .ui-kpis > (a|div).ui-kpi > .ui-kpi__label .ui-kpi__value .ui-kpi__delta.is-up|.is-down
                 inside .ui-hero the tiles turn glass automatically   (legacy .stats-grid/.stat-card)
   Buttons       .btn + .btn-primary | .btn-secondary | .btn-ghost | .btn-danger | .btn-danger-outline
                 sizes .btn-sm (32) .btn-lg (44) .btn-block · icon-only .btn-icon (36×36, needs aria-label)
                 states :disabled, .is-loading (spinner, keeps width) · on teal wrap in .on-dark
                 legacy .btn-accent/.btn-dark/.btn-success/.btn-warning/.btn-outline still styled
   Forms         .ui-form (max 640) .ui-form-grid (2 cols ≥960) · .ui-field > label.ui-label +
                 .ui-input|.ui-select|.ui-textarea + .ui-help + .ui-error · invalid: .ui-field.is-invalid
                 .ui-check / .ui-radio (label wrapping the input) · .ui-error-summary · .ui-form-bar (sticky save bar)
                 legacy .form-group/.form-label/.form-input/.form-select/.form-hint/.form-error
   Tables        .ui-table-card > .ui-table-toolbar + .ui-table-wrap > table.ui-table
                 density .is-compact (32) / default 40 / .is-comfy (48) · .is-zebra · td.num / th.num (end-aligned
                 tabular) · .col-sticky (first column fixed) · .ui-table-wrap.is-tall (sticky header inside)
                 phones: the wrap scrolls sideways and shows «اسحب لرؤية بقية الأعمدة» automatically
                 .ui-bulkbar (replaces the toolbar while rows are selected)       (legacy .table-card/.table-scroll/.data-table)
   Status        .ui-tag + .is-ok | .is-wait | .is-warn | .is-bad | .is-info | .is-neutral (dot + word; never colour alone)
                 .ui-count (brass number pill)                       (legacy .status-badge + .badge-success/warning/danger/info/neutral)
   Tabs          .ui-tabs[role=tablist] > (a|button).ui-tab[.is-active|aria-selected=true] > .ui-tab__count
   Modal         .ui-modal[hidden] > .ui-modal__dialog[.is-wide] > __head(__title, .btn-icon close) __body __foot
                 open/close: data-ui-open="id" / data-ui-close, or SanadUI.openModal(id) / SanadUI.closeModal(id)
                 side drawer: .ui-modal.is-drawer (480, slides from inline-end) · bottom sheet below 640 automatically
                 (legacy .modal-overlay/.modal-content/.modal-header/.modal-title/.modal-footer)
   Toast         SanadUI.toast('تم الحفظ', {type:'ok'|'bad'|'info', timeout:5000})  (legacy .toast)
   Empty state   .ui-empty > .ui-empty__icon .ui-empty__title .ui-empty__text .ui-empty__actions
   Alert         .ui-alert.is-ok|.is-warn|.is-bad|.is-info (banner inside a card)
   Pagination    .ui-pagination > .ui-pagination__info + .ui-pagination__pages > (a|span).ui-page[.is-current]
                 (legacy .pagination/.page-btn)
   Filters bar   .ui-filters > .ui-filters__row (inputs) + .ui-chips > .ui-chip (applied filter, × button)
                 <details class="ui-filters is-collapsible"><summary>…</summary> folds on phones
   Utilities     .ltr (isolated LTR run: ids, iqama, IBAN, phones, negative amounts) · .num (tabular) · .nb
                 .sr-only · .ui-skeleton · .muted · .ui-loadbar
   Focus         every interactive element shows a 2px teal ring (teal-lite on the teal sidebar)

   PAGE STANDARD (redesign 2 — guide: Sanad-HQ/6-product/redesign/07-PAGE-STANDARD.md)
   Page wrapper  .ui-screen (vertical rhythm 20px) · header .ui-page-head + .ui-meta (inline facts)
   KPI v2        .ui-kpi > .ui-kpi__top(.ui-kpi__label + .ui-kpi__icon) .ui-kpi__value .ui-kpi__foot .ui-meter
                 a.ui-kpi.is-active (selected filter) · .ui-kpis.cols-3/.cols-5 · .is-scroll-sm (swipe strip on phones)
   Panel         .ui-panel > .ui-panel__head(.ui-panel__title .ui-panel__sub .ui-panel__actions) .ui-panel__body .ui-panel__foot
                 <details class="ui-panel"> folds · layouts .ui-cols.is-2/.is-3/.is-main-side · .ui-stack
   Lists         .ui-list > .ui-list__item(.ui-icon-tile, .ui-list__main, .ui-list__end) · bars .ui-bars > .ui-bar
   People        .ui-avatar[.is-sm/.is-lg/.is-xl][.tone-1..6] · .ui-person(.ui-person__name, .ui-person__sub)
   Toolbar       .ui-toolbar > .ui-search, .ui-pill-select(select), .ui-seg(segmented), .ui-toolbar__spacer
                 applied filters .ui-chips.is-applied > .ui-chip · quick views .ui-fchips > .ui-fchip.is-on
   Data table    .ui-dtable-wrap[.is-tall|.is-page-sticky][.is-stack-sm] > table.ui-dtable[.is-dense][.is-stack]
                 td.num · .col-check · .col-sticky · .col-actions > .ui-row-actions(.is-reveal) · tfoot = sticky totals
                 phone cards: .is-stack + td.cell-primary / td[data-label] / td.is-chips / .hide-sm · tr[data-href] opens the row
   Menu          <details class="ui-menu"><summary class="btn …"> + .ui-menu__pop > .ui-menu__item
   Stepper       ol.ui-stepper > li.ui-step.is-done/.is-current > .ui-step__dot .ui-step__label .ui-step__sub
   Section nav   .ui-split > nav.ui-snav(.ui-snav__label, .ui-snav__item.is-active, .ui-snav__count) + main (tabs on phones)
   Forms         .ui-form-section > .ui-form-section__intro + __body · .ui-field-row · .ui-switch
   Misc          .ui-attn (needs-action cards) · .ui-dl (facts) · .ui-badge · .ui-notice · .ui-skel · .ui-link · .ui-flip

   SHELL (includes/header.php + sidebar.php + footer.php, assets/js/main.js)
   .app-shell > aside.sidebar(.expanded|.collapsed) + main.main-content > header.topbar + section.page-body
   Sidebar: sticky, full height, own scroll; 256px or a 72px rail (≥1024). Below 1024 it is a drawer.
   ════════════════════════════════════════════════════════════════════════ */

/* ── Readex Pro, local, variable 300–700. The legacy family names used by
      pages ('Open Sans', 'Noto Sans Arabic', 'Roboto Flex') resolve to the same
      files, so every hard-coded font-family renders in the identity font. ── */
@font-face{font-family:'Readex Pro';font-style:normal;font-weight:300 700;font-display:swap;src:url('../fonts/readex-arabic.woff2') format('woff2');unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC}
@font-face{font-family:'Readex Pro';font-style:normal;font-weight:300 700;font-display:swap;src:url('../fonts/readex-latin-ext.woff2') format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:'Readex Pro';font-style:normal;font-weight:300 700;font-display:swap;src:url('../fonts/readex-latin.woff2') format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:'Open Sans';font-style:normal;font-weight:300 800;font-display:swap;src:url('../fonts/readex-arabic.woff2') format('woff2');unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC}
@font-face{font-family:'Open Sans';font-style:normal;font-weight:300 800;font-display:swap;src:url('../fonts/readex-latin-ext.woff2') format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:'Open Sans';font-style:normal;font-weight:300 800;font-display:swap;src:url('../fonts/readex-latin.woff2') format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:'Noto Sans Arabic';font-style:normal;font-weight:300 800;font-display:swap;src:url('../fonts/readex-arabic.woff2') format('woff2');unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC}
@font-face{font-family:'Noto Sans Arabic';font-style:normal;font-weight:300 800;font-display:swap;src:url('../fonts/readex-latin.woff2') format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:'Roboto Flex';font-style:normal;font-weight:300 800;font-display:swap;src:url('../fonts/readex-arabic.woff2') format('woff2');unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC}
@font-face{font-family:'Roboto Flex';font-style:normal;font-weight:300 800;font-display:swap;src:url('../fonts/readex-latin.woff2') format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}

/* ── 1. Identity tokens (identity-kit/tokens.css v2.0, sections 1–2) ── */
:root{
    --teal-deep:#043738; --teal-top:#074847; --teal-floor:#032a2b;
    --teal:#0a5f5e; --teal-lite:#3fb3aa; --teal-glow:rgba(63,179,170,.16);
    --brass:#c6a978; --brass-lite:#e6d2a8;
    --cream:#f8f4eb; --cream-card:#fffdf8; --charcoal:#231f1c; --ink:#161311; --txt:#1a1613;
    --muted-cap:#7c7264;   /* kit «--muted»: captions only, 4.3:1 */
    --muted-aa:#5f574d; --muted-d:#a99f90; --line:#e8dfcc;
    --white:#ffffff; --on-dark:rgba(248,244,235,.92);
    --glass:rgba(248,244,235,.07); --glass-line:rgba(248,244,235,.16);
    --ghost:rgba(248,244,235,.06); --ghost-line:rgba(248,244,235,.28); --chip:rgba(63,179,170,.20);
    --field-line:#978d7e; --bar:#f3ede1;
    --ring:0 0 0 1px rgba(22,19,17,.08); --ring-dark:0 0 0 1.5px rgba(0,0,0,.42);
    --r-sm:12px; --r-card:20px; --r-hero:28px; --r-pill:999px;
    --font:'Readex Pro',system-ui,-apple-system,'Segoe UI',Tahoma,sans-serif;
    --surface-hero:radial-gradient(ellipse 72% 44% at 80% 2%,rgba(63,179,170,.24),transparent 70%),radial-gradient(ellipse 80% 40% at 8% 100%,rgba(198,169,120,.14),transparent 70%),linear-gradient(180deg,#074847 0%,#043738 48%,#032a2b 100%);
    --surface-band:linear-gradient(150deg,#0a5f5e 0%,#043738 100%);
}

/* ── 2. Product tokens (01-research §3.1) ── */
:root{
    --app-sb-w:256px; --app-rail-w:72px; --app-drawer-w:min(296px,86vw);
    --app-top-h:56px; --app-banner-h:0px;
    --app-sb-bg:linear-gradient(180deg,var(--teal-top),var(--teal-deep) 55%,var(--teal-floor));
    --nav-ink:rgba(248,244,235,.72); --nav-label:rgba(248,244,235,.60); --nav-hover:rgba(248,244,235,.08);
    --nav-active-bg:var(--cream); --nav-active-ink:var(--teal-deep); --nav-active-bar:var(--brass-lite);
    --app-bg:var(--cream); --app-surface:var(--cream-card); --app-sunken:var(--bar);
    --row-hover:#f6f1e6; --row-selected:#e0f1ec;
    --st-ok:#2f7d5f; --st-ok-bg:#e3efe8; --st-ok-ink:#22604a;
    --st-wait:var(--brass); --st-wait-bg:#f0e5d0; --st-wait-ink:var(--charcoal);
    --st-warn:#b7791f; --st-warn-bg:#f6e9cf; --st-warn-ink:#7a5410;
    --st-bad:#a8322d; --st-bad-bg:#f8e3df; --st-bad-ink:#a8322d;
    --st-info:var(--teal); --st-info-bg:#e0f1ec; --st-info-ink:var(--teal);
    --st-neutral-bg:var(--bar); --st-neutral-ink:var(--muted-aa);
    --focus-light:0 0 0 2px var(--cream-card),0 0 0 4px var(--teal);
    --focus-dark:0 0 0 2px var(--teal-lite);
    --ring-pop:0 0 0 1px rgba(22,19,17,.14),0 2px 0 rgba(22,19,17,.06);
    --scrim:rgba(22,19,17,.48);
    --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-5:20px; --sp-6:24px;
    --sp-8:32px; --sp-10:40px; --sp-12:48px; --sp-16:64px;
    --fs-xs:12px; --fs-sm:13px; --fs-tb:14px; --fs-base:15px; --fs-md:16px; --fs-lg:18px;
    --fs-xl:20px; --fs-2xl:24px; --fs-3xl:30px; --fs-kpi:28px; --fs-kpi-lg:40px;
    --lh-tight:1.3; --lh-ui:1.45; --lh-body:1.65;
    --h-ctl:40px; --h-ctl-sm:32px; --h-ctl-touch:44px;
    --h-row:40px; --h-row-compact:32px; --h-row-comfy:48px;
    --r-xs:8px; --r-md:16px;
    --ch-1:var(--teal); --ch-2:#9c7a48; --ch-3:var(--muted-aa); --ch-4:var(--teal-lite);
    --ch-seq-0:#e0f1ec; --ch-seq-4:var(--teal-deep); --ch-grid:var(--line);
}

/* ── 3. Bridge: the legacy names now point at the identity (pages restyle unedited) ── */
:root{
    --brand-ink:var(--charcoal); --brand-blue:var(--teal); --brand-cream:var(--cream);
    --primary:var(--teal); --primary-dark:var(--teal-deep); --primary-light:#1d6f6e;
    --accent:var(--teal-deep); --accent-dim:#b8ada0; --accent-dark:var(--teal-floor);
    --bg:var(--cream); --card:var(--cream-card); --elevated:var(--bar); --sidebar-bg:var(--teal-deep);
    --input-bg:var(--white); --surface:var(--cream-card);
    --text:var(--charcoal); --text-secondary:#45403a; --muted:#685f54; /* 5.7:1 on cream (old #7b7268 was 4.3) */
    --on-primary:#fff; --on-accent:#fff;
    --border:var(--line); --border-light:#f1eadc; --border-outline:#cfc4b0;
    --success:var(--st-ok); --success-bg:var(--st-ok-bg);
    --warning:var(--st-warn-ink); --warning-bg:var(--st-warn-bg);
    --danger:var(--st-bad); --danger-bg:var(--st-bad-bg);
    --info:var(--st-info); --info-bg:var(--st-info-bg);
    --shadow-sm:var(--ring); --shadow-md:var(--ring); --shadow-lg:var(--ring-pop);
    --shadow-xl:var(--ring-pop); --shadow-toast:var(--ring-pop);
    --sb-width:var(--app-sb-w); --sb-collapsed:var(--app-rail-w); --tb-height:var(--app-top-h);
    --radius-sm:8px; --radius-md:10px; --radius-lg:16px; --radius-xl:20px; --radius-2xl:20px; --radius-3xl:28px; --radius-full:999px;
    --transition-fast:150ms ease; --transition-normal:220ms ease; --transition-slow:320ms ease;
    --ring-focus:0 0 0 2px var(--teal);
}

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(12px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
@keyframes spin { to { transform: rotate(360deg) } }
@keyframes zoomIn { from { transform: scale(0.96); opacity: 0 } to { transform: scale(1); opacity: 1 } }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.45 } }
@keyframes shimmer { from { transform: translateX(-100%) } to { transform: translateX(100%) } }
@keyframes heroFloat { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-16px) } }
@keyframes uiLoad { from { inset-inline-start: -30% } to { inset-inline-start: 100% } }

/* ══════════════════════════════════════
   BASE
══════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-padding-top: calc(var(--app-top-h) + var(--app-banner-h) + 8px); -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    background: var(--app-bg);
    color: var(--text);
    overflow-x: hidden;   /* fallback */
    overflow-x: clip;     /* clip, not hidden: never a scroll container (sticky keeps working) */
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}
[dir="rtl"] body, html[dir="rtl"] { font-family: var(--font); }
h1, h2, h3, h4, .sb-wordmark, .topbar-page-title { font-family: var(--font); line-height: var(--lh-tight); letter-spacing: 0; }
button, input, select, textarea { font: inherit; }
a { text-decoration: none; color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.material-symbols-outlined { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

/* Scrollbar: quiet, on cream (was a charcoal track) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d3c9b6; border-radius: 8px; border: 2px solid var(--app-bg); }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }
html { scrollbar-color: #d3c9b6 transparent; scrollbar-width: thin; }

/* Utilities */
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.num, .tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.nb { white-space: nowrap; }
.muted { color: var(--muted); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 2000; background: var(--teal); color: #fff; padding: 10px 16px; border-radius: var(--r-sm); font-weight: 600; }
.skip-link:focus { top: calc(var(--app-banner-h) + 8px); }

/* ══════════════════════════════════════
   APP SHELL
══════════════════════════════════════ */
.app-shell { display: flex; align-items: flex-start; min-height: 100vh; min-height: 100dvh; }

/* support-session banner: part of the shell, sets --app-banner-h from JS */
.support-banner { position: sticky; top: 0; z-index: 1150; background: #7a1f1f; color: #fff; font-size: 13px; padding: 7px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.support-banner a { margin-inline-start: auto; background: #fff; color: #7a1f1f; font-weight: 700; padding: 3px 12px; border-radius: 8px; }
@media (max-width: 640px) { .support-banner { padding: 6px 12px; font-size: 12px; flex-wrap: nowrap; } .support-banner > span:nth-child(2) { display: none; } }

/* ══════════════════════════════════════
   SIDEBAR (teal) — sticky, full height, own scroll
══════════════════════════════════════ */
.sidebar {
    width: var(--app-sb-w);
    flex: 0 0 auto;
    position: sticky;
    top: var(--app-banner-h);
    align-self: flex-start;
    height: calc(100vh - var(--app-banner-h));
    height: calc(100dvh - var(--app-banner-h));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--app-sb-bg);
    color: var(--nav-ink);
    border-inline-end: 1px solid var(--glass-line);
    z-index: 110;
    transition: width var(--transition-normal);
}
.sidebar :focus-visible { outline: 2px solid var(--teal-lite); outline-offset: 1px; }

/* brand: lockup + tenant */
.sb-brand { display: flex; align-items: center; gap: 10px; height: var(--app-top-h); padding: 0 18px; flex-shrink: 0; overflow: hidden; }
.sb-brand-link { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; height: 40px; border-radius: var(--r-sm); }
.sb-lockup { height: 26px; width: auto; display: block; flex-shrink: 0; }
.sb-mark { height: 30px; width: auto; display: none; }
.sb-logo { width: 36px; height: 36px; border-radius: 10px; background: var(--cream); padding: 5px; display: grid; place-items: center; flex-shrink: 0; }
.sb-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sb-logo svg { display: block; }
.sb-wordmark { font-size: 18px; font-weight: 600; color: var(--cream); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-subtitle { font-size: 12px; font-weight: 400; color: var(--nav-label); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-tenant { margin: 0 12px 6px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--glass); border: 1px solid var(--glass-line); font-size: 13px; font-weight: 500; color: var(--on-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.sb-tenant .material-symbols-outlined { font-size: 18px; color: var(--teal-lite); }
.sb-tenant span:last-child { overflow: hidden; text-overflow: ellipsis; }
.sb-close { display: none; }

/* scroll area */
.sb-scroll { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.sb-nav {
    flex: 1 1 auto; min-height: 0;
    display: flex; flex-direction: column; gap: 2px;
    padding: 6px 12px 12px;
    overflow-y: auto; overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: transparent transparent;
}
.sb-nav:hover, .sb-nav:focus-within { scrollbar-color: rgba(248,244,235,.24) transparent; }
.sb-nav::-webkit-scrollbar { width: 6px; }
.sb-nav::-webkit-scrollbar-thumb { background: transparent; border: 0; border-radius: 6px; }
.sb-nav:hover::-webkit-scrollbar-thumb { background: rgba(248,244,235,.24); }

/* section label (group heading text) */
.sb-section-label { font-size: 12px; font-weight: 600; color: var(--nav-label); padding: 14px 12px 4px; white-space: nowrap; overflow: hidden; }

/* nav item */
.sb-link {
    display: flex; align-items: center; gap: 12px;
    min-height: 40px; height: 40px;
    padding: 0 12px;
    border-radius: var(--r-sm);
    color: var(--nav-ink);
    font-size: 14px; font-weight: 500; line-height: 1.3;
    white-space: nowrap;
    position: relative;
    transition: background var(--transition-fast), color var(--transition-fast);
    border: 0; background: transparent; width: 100%; text-align: start; cursor: pointer; font-family: inherit;
}
.sb-link:hover { background: var(--nav-hover); color: var(--cream); }
.sb-link.active { background: var(--nav-active-bg); color: var(--nav-active-ink); font-weight: 600; }
.sb-link.active::before { content: ""; position: absolute; inset-inline-start: -9px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--nav-active-bar); }
[dir="rtl"] .sb-link.active::before { border-radius: 3px 0 0 3px; }
.sb-icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: inherit; }
.sb-icon .material-symbols-outlined { font-size: 20px !important; font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.sb-link.active .sb-icon { color: var(--teal); }
.sb-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sb-count, .sb-notif { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brass-lite); color: var(--charcoal); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; margin-inline-start: 6px; }

/* group = heading button + list (accordion when open; flyout in the rail) */
.sb-group { position: relative; }
.sb-group + .sb-group, .sb-link + .sb-group { margin-top: 2px; }
.sb-group-head {
    display: flex; align-items: center; gap: 12px;
    height: 40px; width: 100%;
    padding: 0 12px;
    border: 0; background: transparent; border-radius: var(--r-sm);
    color: var(--nav-ink); font-family: inherit; font-size: 14px; font-weight: 500;
    text-align: start; white-space: nowrap; cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.sb-group-head:hover { background: var(--nav-hover); color: var(--cream); }
.sb-group-head.active { color: var(--cream); font-weight: 600; }
.sb-group-head.active .sb-icon { color: var(--brass-lite); }
.sb-group.open > .sb-group-head { color: var(--cream); }
.sb-caret { font-size: 18px !important; margin-inline-start: auto; opacity: .7; transition: transform .18s; }
.sb-group.open > .sb-group-head .sb-caret { transform: rotate(180deg); }

.sb-flyout { display: none; }
.sb-group.open > .sb-flyout { display: block; }
.sb-flyout { padding: 2px 0 6px; margin-inline-start: 21px; padding-inline-start: 10px; border-inline-start: 1px solid var(--glass-line); }
.sb-flyout .sb-link { height: 36px; min-height: 36px; font-size: 14px; gap: 10px; padding: 0 10px; }
.sb-flyout .sb-link .sb-icon .material-symbols-outlined { font-size: 18px !important; }
.sb-flyout .sb-link.active::before { inset-inline-start: -11px; top: 7px; bottom: 7px; }
.sb-flyout-title { display: none; }

/* footer: collapse toggle + user card */
.sb-footer { flex-shrink: 0; padding: 8px 12px 12px; border-top: 1px solid var(--glass-line); display: flex; flex-direction: column; gap: 4px; }
.sb-toggle {
    display: flex; align-items: center; gap: 12px; height: 36px; width: 100%; padding: 0 12px;
    border: 0; background: transparent; border-radius: var(--r-sm); cursor: pointer;
    color: var(--nav-label); font-family: inherit; font-size: 13px; font-weight: 500; white-space: nowrap;
}
.sb-toggle:hover { background: var(--nav-hover); color: var(--cream); }
.sb-toggle svg { display: block; flex-shrink: 0; transition: transform .22s; }
[dir="rtl"] .sb-toggle svg { transform: scaleX(-1); }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); white-space: nowrap; overflow: hidden; transition: background var(--transition-fast); }
a.sb-user:hover { background: var(--nav-hover); }
.sb-user-av { width: 32px; height: 32px; border-radius: 10px; background: var(--brass-lite); color: var(--charcoal); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.sb-user-info { flex: 1; min-width: 0; overflow: hidden; }
.sb-user-name { font-size: 13px; font-weight: 600; color: var(--cream); overflow: hidden; text-overflow: ellipsis; }
.sb-user-role { font-size: 12px; color: var(--nav-label); overflow: hidden; text-overflow: ellipsis; }
.wl-powered { font-size: 11px; color: var(--nav-label); padding: 0 24px 10px; white-space: nowrap; overflow: hidden; }

/* tooltip for the rail (one element, placed by JS, never clipped) */
.sb-tip { position: fixed; z-index: 950; pointer-events: none; background: var(--charcoal); color: var(--cream); font-size: 13px; font-weight: 500; line-height: 1.3; padding: 6px 10px; border-radius: var(--r-xs); white-space: nowrap; box-shadow: var(--ring-dark); opacity: 0; transition: opacity .12s; }
.sb-tip.show { opacity: 1; }

/* ── rail: ≥1024 and .collapsed ── */
@media (min-width: 1024px) {
    .sidebar.collapsed { width: var(--app-rail-w); }
    .sidebar.collapsed .sb-brand { padding: 0; justify-content: center; }
    .sidebar.collapsed .sb-brand-link { justify-content: center; flex: 0 0 auto; width: 48px; }
    .sidebar.collapsed .sb-lockup, .sidebar.collapsed .sb-brand-text { display: none; }
    .sidebar.collapsed .sb-mark { display: block; }
    .sidebar.collapsed .sb-tenant { display: none; }
    .sidebar.collapsed .sb-nav { padding: 6px 12px 12px; align-items: center; }
    .sidebar.collapsed .sb-section-label { display: none; }
    .sidebar.collapsed .sb-link, .sidebar.collapsed .sb-group-head { width: 48px; justify-content: center; padding: 0; gap: 0; }
    /* labels stay in the accessibility tree (visually hidden), the tooltip shows them */
    .sidebar.collapsed .sb-label, .sidebar.collapsed .sb-toggle-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
    .sidebar.collapsed .sb-caret, .sidebar.collapsed .sb-count, .sidebar.collapsed .sb-notif { display: none; }
    .sidebar.collapsed .sb-group-head.active { background: var(--nav-hover); }
    .sidebar.collapsed .sb-link.active::before { inset-inline-start: -12px; }
    .sidebar.collapsed .sb-group.open > .sb-flyout { display: none; }
    /* the group list becomes a flyout beside the rail (position set by JS) */
    .sidebar.collapsed .sb-flyout.show {
        display: block; position: fixed; z-index: 900;
        min-width: 232px; max-width: 280px; max-height: calc(100dvh - 16px); overflow-y: auto;
        margin: 0; padding: 8px; border: 1px solid var(--glass-line); border-radius: var(--r-md);
        background: var(--teal-deep); box-shadow: var(--ring-dark);
    }
    .sidebar.collapsed .sb-flyout.show .sb-link { width: 100%; justify-content: flex-start; padding: 0 10px; gap: 10px; }
    .sidebar.collapsed .sb-flyout.show .sb-label { position: static; width: auto; height: auto; clip: auto; overflow: hidden; text-overflow: ellipsis; }
    .sidebar.collapsed .sb-flyout.show .sb-link.active::before { display: none; }
    .sidebar.collapsed .sb-flyout-title { display: block; font-size: 12px; font-weight: 600; color: var(--nav-label); padding: 4px 10px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--glass-line); }
    .sidebar.collapsed .sb-footer { padding: 8px 12px 12px; align-items: center; }
    .sidebar.collapsed .sb-toggle { width: 48px; justify-content: center; padding: 0; }
    [dir="rtl"] .sidebar.collapsed .sb-toggle svg { transform: none; }
    [dir="ltr"] .sidebar.collapsed .sb-toggle svg { transform: scaleX(-1); }
    .sidebar.collapsed .sb-user { padding: 6px; justify-content: center; }
    .sidebar.collapsed .sb-user-info, .sidebar.collapsed .wl-powered { display: none; }
}

/* scrim for the phone drawer */
.sb-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 1190; opacity: 0; transition: opacity .2s; }
.sb-scrim.show { opacity: 1; }
html.sb-locked { overflow: hidden; }   /* html only: body must never become a scroll container (sticky shell) */

/* ══════════════════════════════════════
   MAIN + TOP BAR
══════════════════════════════════════ */
.main-content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.main-content:focus { outline: none; }

.topbar {
    height: var(--app-top-h);
    background: var(--app-surface);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 12px;
    padding: 0 24px;
    position: sticky; top: var(--app-banner-h); z-index: 100;
    flex-shrink: 0;
}
.tb-start, .topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.tb-icon-btn.tb-menu, .tb-icon-btn.tb-search-btn { display: none; }
.tb-crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-crumb { font-size: 13px; color: var(--muted); white-space: nowrap; }
.tb-crumb-sep { color: var(--border-outline); font-size: 13px; }
.topbar-page-title { margin: 0; font-size: 16px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tb-end, .topbar-left { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.tb-icon-btn {
    width: 36px; height: 36px; border-radius: var(--r-sm);
    border: 1px solid transparent; background: transparent;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    color: var(--muted-aa); position: relative; flex-shrink: 0;
    transition: background var(--transition-fast), color var(--transition-fast);
    font-weight: 600; font-size: 13px;
}
.tb-icon-btn:hover, .tb-icon-btn.active { background: var(--app-sunken); color: var(--text); }
.tb-icon-btn svg { display: block; }
.tb-lang-btn { font-size: 13px; font-weight: 600; }
.tb-notif-dot { position: absolute; top: 7px; inset-inline-end: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--st-bad); border: 2px solid var(--app-surface); }
.tb-divider { width: 1px; height: 22px; background: var(--line); margin: 0 4px; flex-shrink: 0; }

/* search slot: «ابحث أو انتقل…» (jump to any page in the menu; Ctrl K) */
.tb-search {
    position: relative;
    display: flex; align-items: center; gap: 8px;
    height: 36px; width: 320px; max-width: 32vw;
    border: 1px solid var(--line); border-radius: var(--r-pill);
    background: var(--app-sunken); padding: 0 12px;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.tb-search:focus-within { border-color: var(--teal); background: var(--white); box-shadow: var(--focus-light); }
.tb-search input { border: 0; background: transparent; outline: none; font-size: 13px; color: var(--text); flex: 1; min-width: 0; height: 100%; }
.tb-search input::-webkit-search-cancel-button { display: none; }
.tb-search input::placeholder { color: var(--muted); }
.tb-search svg { color: var(--muted); flex-shrink: 0; }
.tb-search kbd { font-family: inherit; font-size: 12px; color: var(--muted); background: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; line-height: 20px; direction: ltr; white-space: nowrap; }
.tb-search-pop { position: absolute; top: calc(100% + 6px); inset-inline: 0; min-width: 300px; max-height: 360px; overflow-y: auto; background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--ring-pop); padding: 6px; z-index: 300; }
.tb-search-pop[hidden] { display: none; }
.tb-search-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-xs); color: var(--text); font-size: 14px; cursor: pointer; }
.tb-search-item small { margin-inline-start: auto; color: var(--muted); font-size: 12px; }
.tb-search-item .material-symbols-outlined { font-size: 18px; color: var(--teal); }
.tb-search-item[aria-selected="true"], .tb-search-item:hover { background: var(--st-info-bg); }
.tb-search-empty { padding: 14px; color: var(--muted); font-size: 13px; text-align: center; }

/* user menu */
.tb-usermenu { position: relative; }
.tb-user { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 6px; border-radius: var(--r-pill); cursor: pointer; border: 1px solid transparent; background: transparent; font-family: inherit; color: var(--text); }
.tb-user:hover { background: var(--app-sunken); }
.tb-user-av { width: 32px; height: 32px; border-radius: 50%; background: var(--teal); color: #fff; font-size: 12px; font-weight: 600; display: grid; place-items: center; flex-shrink: 0; }
.tb-user-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.tb-user-arrow { color: var(--muted); flex-shrink: 0; }
.tb-pop { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; min-width: 220px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--ring-pop); padding: 6px; z-index: 300; }
.tb-pop[hidden] { display: none; }
.tb-pop-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.tb-pop-head b { display: block; font-size: 14px; font-weight: 600; }
.tb-pop-head span { font-size: 12px; color: var(--muted); }
.tb-pop a, .tb-pop button.tb-pop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: var(--r-xs); color: var(--text); font-size: 14px; border: 0; background: transparent; cursor: pointer; text-align: start; }
.tb-pop a:hover { background: var(--app-sunken); }
.tb-pop a .material-symbols-outlined { font-size: 18px; color: var(--muted-aa); }
.tb-pop a.is-danger { color: var(--st-bad); }
.tb-pop a.is-danger .material-symbols-outlined { color: var(--st-bad); }

/* company switcher (Phase 11) */
#cgMenu.open { display: block !important; }

/* ══════════════════════════════════════
   PAGE BODY
══════════════════════════════════════ */
.page-body { padding: 24px; flex: 1; min-width: 0; overflow-x: hidden; overflow-x: clip; }

/* ── responsive shell ── */
@media (max-width: 1023.98px) {
    .app-shell { display: block; }
    .sidebar {
        position: fixed; top: 0; bottom: 0; inset-inline-start: 0;
        width: var(--app-drawer-w); height: 100vh; height: 100dvh;
        z-index: 1200; border-inline-end: 0;
        box-shadow: var(--ring-dark);
        transform: translateX(-100%); visibility: hidden;
        transition: transform .24s ease, visibility 0s linear .24s;
    }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    .sidebar.is-open, [dir="rtl"] .sidebar.is-open { transform: none; visibility: visible; transition: transform .24s ease, visibility 0s; }
    .sb-close { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-inline-start: auto; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--cream); cursor: pointer; flex-shrink: 0; }
    .sb-close:hover { background: var(--nav-hover); }
    .sb-toggle { display: none; }
    .sb-link, .sb-group-head { min-height: 44px; height: 44px; }
    .sb-flyout .sb-link { height: 40px; min-height: 40px; }
    .main-content { min-height: 100vh; min-height: 100dvh; }
    .tb-icon-btn.tb-menu { display: inline-flex; }
    .topbar { padding: 0 16px; }
    .tb-search { width: 240px; }
    .tb-crumb, .tb-crumb-sep { display: none; }
}
@media (max-width: 760px) {
    .tb-search { display: none; }
    .tb-icon-btn.tb-search-btn { display: inline-flex; }
    .topbar.search-open .tb-start, .topbar.search-open .tb-end { display: none; }
    .topbar.search-open .tb-search { display: flex; width: 100%; max-width: none; flex: 1; }
    .tb-user-name, .tb-user-arrow, .tb-divider { display: none; }
    .tb-cg-name, .tb-cg-btn > .material-symbols-outlined:last-child { display: none; }
    .tb-cg-btn { padding: 0 !important; width: 36px; justify-content: center; }
    .topbar #cgMenu { position: fixed !important; top: calc(var(--app-top-h) + var(--app-banner-h) + 4px) !important; inset-inline: 8px !important; min-width: 0 !important; }
    .topbar .notif-panel, .topbar .tb-pop { position: fixed; top: calc(var(--app-top-h) + var(--app-banner-h) + 4px); inset-inline: 8px; width: auto; min-width: 0; }
    .tb-end { gap: 2px; }
    .topbar { padding: 0 8px; gap: 4px; }
}
@media (max-width: 640px) {
    .page-body { padding: 16px; }
    .tb-hide-sm { display: none !important; }
    .topbar-page-title { font-size: 15px; }
}

/* ══════════════════════════════════════
   LEGACY COMPONENTS, NOW IN THE IDENTITY
══════════════════════════════════════ */
.page-section { margin-bottom: 24px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { margin: 0; font-size: 24px; font-weight: 600; line-height: 1.3; color: var(--charcoal); }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: none; }

/* Buttons — pill, 40px, 14/600. One primary per view. */
.btn {
    height: var(--h-ctl);
    border-radius: var(--r-pill);
    border: 1px solid var(--field-line);
    background: var(--white);
    padding: 0 18px;
    cursor: pointer;
    font-family: inherit; font-weight: 600; font-size: 14px; line-height: 1;
    color: var(--charcoal);
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    text-decoration: none; white-space: nowrap;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    position: relative;
}
.btn:hover { background: var(--app-sunken); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.btn:disabled, .btn.is-disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
a.btn.is-disabled, a.btn[aria-disabled="true"] { pointer-events: none; }   /* real :disabled buttons stay hoverable so their title explains why */
.btn .material-symbols-outlined { font-size: 18px; }
.btn-sm { height: var(--h-ctl-sm); padding: 0 12px; font-size: 13px; gap: 6px; }
.btn-lg { height: var(--h-ctl-touch); padding: 0 24px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn-primary:hover { background: var(--teal-deep); border-color: var(--teal-deep); }
.btn-secondary, .btn-outline { background: var(--white); border-color: var(--field-line); color: var(--charcoal); }
.btn-secondary:hover, .btn-outline:hover { background: var(--app-sunken); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--teal); }
.btn-ghost:hover { background: var(--st-info-bg); }
.btn-danger { background: var(--st-bad); color: #fff; border-color: var(--st-bad); }
.btn-danger:hover { background: #8e2925; border-color: #8e2925; }
.btn-danger-outline { background: var(--white); color: var(--st-bad); border-color: var(--st-bad); }
.btn-danger-outline:hover { background: var(--st-bad-bg); }
.btn-success { background: var(--st-ok); color: #fff; border-color: var(--st-ok); }
.btn-success:hover { background: var(--st-ok-ink); }
.btn-warning { background: var(--st-warn-bg); color: var(--st-warn-ink); border-color: var(--st-warn); }
.btn-accent, .btn-dark { background: var(--teal-deep); color: #fff; border-color: var(--teal-deep); }
.btn-accent:hover, .btn-dark:hover { background: var(--teal-floor); }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--r-sm); }
.btn-icon.btn-sm { width: 32px; height: 32px; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--teal) var(--teal) transparent transparent; animation: spin .7s linear infinite; }
.btn-primary.is-loading::after, .btn-danger.is-loading::after, .btn-accent.is-loading::after, .btn-dark.is-loading::after { border-color: #fff #fff transparent transparent; }
.on-dark .btn-primary, .ui-hero .btn-primary { background: var(--brass-lite); color: var(--charcoal); border-color: var(--brass-lite); }
.on-dark .btn-primary:hover, .ui-hero .btn-primary:hover { background: #ecdcb9; }
.on-dark .btn-secondary, .ui-hero .btn-secondary, .on-dark .btn-ghost, .ui-hero .btn-ghost { background: var(--ghost); border-color: var(--ghost-line); color: var(--cream); }
.on-dark .btn-ghost, .ui-hero .btn-ghost { border-color: transparent; }
.on-dark .btn:focus-visible, .ui-hero .btn:focus-visible { outline-color: var(--teal-lite); }

/* Status badge (legacy) → identity tones */
.status-badge { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.4; white-space: nowrap; text-transform: none; letter-spacing: 0; }
.badge-success { background: var(--st-ok-bg); color: var(--st-ok-ink); }
.badge-warning { background: var(--st-warn-bg); color: var(--st-warn-ink); }
.badge-danger { background: var(--st-bad-bg); color: var(--st-bad-ink); }
.badge-info { background: var(--st-info-bg); color: var(--st-info-ink); }
.badge-neutral { background: var(--st-neutral-bg); color: var(--st-neutral-ink); }

/* Stats (legacy) */
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 20px; display: flex; flex-direction: column; gap: 10px; min-height: 100px; box-shadow: none; }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.stat-label { font-size: 13px; font-weight: 500; color: var(--muted-aa); }
.stat-value { font-size: 26px; font-weight: 700; color: var(--teal); line-height: 1; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--muted); font-weight: 500; }

/* Toolbar (legacy) */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.select-wrap { height: 40px; border: 1px solid var(--field-line); background: var(--white); border-radius: var(--r-sm); display: flex; align-items: center; padding: 0 12px; }
.select-wrap select { border: none; outline: none; background: transparent; font-size: 14px; cursor: pointer; color: var(--text); }
.search-wrap { height: 40px; border: 1px solid var(--field-line); background: var(--white); border-radius: var(--r-sm); display: flex; align-items: center; padding: 0 12px; gap: 8px; min-width: min(360px, 100%); }
.search-wrap:focus-within, .select-wrap:focus-within { border-color: var(--teal); box-shadow: var(--focus-light); }
.search-wrap input { border: none; outline: none; background: transparent; flex: 1; min-width: 0; font-size: 14px; color: var(--text); }

/* Forms (legacy names share the new field look) */
.form-group { margin-bottom: 16px; }
.form-label, .ui-label { display: block; font-size: 14px; font-weight: 500; color: var(--charcoal); margin-bottom: 6px; }
.form-input, .form-select, .ui-input, .ui-select, .ui-textarea {
    width: 100%; height: var(--h-ctl);
    background: var(--white);
    border: 1px solid var(--field-line);
    border-radius: var(--r-sm);
    padding: 0 12px;
    font-size: 14px; color: var(--txt);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-input:hover, .form-select:hover, .ui-input:hover, .ui-select:hover, .ui-textarea:hover { border-color: var(--muted-cap); }
.form-input:focus, .form-select:focus, .ui-input:focus, .ui-select:focus, .ui-textarea:focus { border-color: var(--teal); box-shadow: var(--focus-light); background: var(--white); }
.form-input::placeholder, .ui-input::placeholder, .ui-textarea::placeholder { color: var(--muted-cap); }
.form-input:disabled, .ui-input:disabled, .ui-select:disabled, .ui-textarea:disabled { background: var(--app-sunken); color: var(--muted); cursor: not-allowed; }
textarea.form-input, .ui-textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.form-input.error, .ui-field.is-invalid .ui-input, .ui-field.is-invalid .ui-select, .ui-field.is-invalid .ui-textarea, .ui-input[aria-invalid="true"] { border-color: var(--st-bad); }
.form-hint, .ui-help { font-size: 13px; color: var(--muted-aa); margin-top: 6px; }
.form-error, .ui-error { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--st-bad); margin-top: 6px; }
.ui-error::before { content: "!"; display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--st-bad); color: #fff; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.ui-field { margin-bottom: 16px; min-width: 0; }
.ui-field .ui-label .ui-optional { color: var(--muted); font-weight: 400; font-size: 13px; }
.ui-form { max-width: 640px; }
.ui-form-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 960px) { .ui-form-grid { grid-template-columns: 1fr 1fr; } .ui-form-grid > .is-full { grid-column: 1 / -1; } }
.ui-select, select.form-select { appearance: none; -webkit-appearance: none; padding-inline-end: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235f574d' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
[dir="rtl"] .ui-select, [dir="rtl"] select.form-select { background-position: left 12px center; }
.ui-check, .ui-radio { display: inline-flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--txt); cursor: pointer; line-height: 1.5; min-height: 24px; }
.ui-check input, .ui-radio input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--teal); flex-shrink: 0; cursor: pointer; }
.ui-check input:focus-visible, .ui-radio input:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.ui-error-summary { border: 1px solid var(--st-bad); background: var(--st-bad-bg); color: var(--st-bad-ink); border-radius: var(--r-sm); padding: 12px 16px; margin-bottom: 20px; font-size: 14px; }
.ui-error-summary b { display: block; margin-bottom: 4px; }
.ui-error-summary ul { margin: 0; padding-inline-start: 20px; }
.ui-error-summary a { text-decoration: underline; }
.ui-form-bar { position: sticky; bottom: 0; z-index: 40; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 24px; margin: 24px -24px -24px; background: var(--app-surface); border-top: 1px solid var(--line); }
input[dir="ltr"], .ui-input.ltr-field { text-align: left; }
[dir="rtl"] input[dir="ltr"] { text-align: right; }

/* Tables (legacy) */
.table-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; box-shadow: none; }
.table-scroll { overflow: auto; position: relative; }
.data-table { width: 100%; border-collapse: collapse; min-width: 1100px; }
.data-table thead th { background: var(--app-sunken); border-bottom: 1px solid var(--line); padding: 10px 16px; text-align: start; font-size: 13px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--charcoal); white-space: nowrap; }
.data-table tbody td { border-bottom: 1px solid var(--border-light); padding: 10px 16px; font-size: 14px; color: var(--txt); vertical-align: middle; line-height: var(--lh-ui); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--row-hover); }

.name-cell { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.name-meta, .manager-info { line-height: 1.35; }
.name-main { font-weight: 600; font-size: 14px; color: var(--text); }
.name-sub, .manager-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.manager-cell { display: flex; align-items: center; gap: 8px; }
.circle { width: 36px; height: 36px; border-radius: 50%; background: var(--teal-glow); display: grid; place-items: center; font-weight: 600; color: var(--teal); font-size: 12px; flex-shrink: 0; }
.fake-check { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--field-line); }

/* Modals (legacy): scrim with no blur, ring instead of a shadow */
.modal-overlay { position: fixed; inset: 0; background: var(--scrim); z-index: 1000; display: flex; align-items: center; justify-content: center; animation: fadeIn var(--transition-normal); }
.modal-content { background: var(--cream-card); border-radius: var(--r-md); padding: 24px; max-width: 560px; width: 92%; box-shadow: var(--ring-pop); animation: slideUp var(--transition-normal); max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 18px; font-weight: 600; }
.modal-subtitle { font-size: 13px; color: var(--muted-aa); }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

/* Toast (legacy) */
.toast { background: var(--charcoal); color: var(--cream); border-radius: var(--r-sm); box-shadow: var(--ring-pop); font-size: 14px; font-weight: 500; padding: 12px 16px; display: flex; align-items: center; gap: 10px; }
.toast-success { background: var(--charcoal); border-inline-start: 4px solid var(--st-ok); }
.toast-danger { background: var(--charcoal); border-inline-start: 4px solid #e07a74; }
.toast-action { color: var(--brass-lite); font-weight: 600; cursor: pointer; }

/* Progress */
.progress-track { height: 6px; background: var(--app-sunken); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--teal); border-radius: 3px; transition: width var(--transition-slow); }

/* Pagination (legacy) */
.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.page-btn { min-width: 36px; height: 36px; padding: 0 8px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--white); display: inline-grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; font-variant-numeric: tabular-nums; transition: background var(--transition-fast), border-color var(--transition-fast); }
.page-btn:hover { border-color: var(--teal); color: var(--teal); }
.page-btn.active { background: var(--teal); color: #fff; border-color: var(--teal); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Loading */
.spinner { width: 48px; height: 48px; border: 4px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
.loading-overlay { position: fixed; inset: 0; background: rgba(4,55,56,.82); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.skeleton, .ui-skeleton { background: var(--app-sunken); border-radius: var(--r-xs); animation: pulse 1.6s infinite; }
.ui-loadbar { position: relative; height: 2px; overflow: hidden; background: transparent; }
.ui-loadbar::after { content: ""; position: absolute; top: 0; width: 30%; height: 100%; background: var(--teal); animation: uiLoad 1.1s ease-in-out infinite; }

/* Notification panel */
.notif-panel { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; width: min(380px, calc(100vw - 16px)); max-height: 480px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--ring-pop); z-index: 300; display: none; overflow: hidden; animation: slideUp var(--transition-fast); }
.notif-panel.show { display: block; }
.notif-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--app-sunken); }
.notif-title { font-size: 15px; font-weight: 600; color: var(--text); }
.notif-count { background: var(--brass-lite); color: var(--charcoal); font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; min-width: 24px; text-align: center; font-variant-numeric: tabular-nums; }
.notif-list { overflow-y: auto; max-height: 380px; }
.notif-empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.notif-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border-light); transition: background var(--transition-fast); position: relative; }
.notif-item:hover { background: var(--row-hover); }
.notif-item:last-child { border-bottom: none; }
.notif-icon { width: 36px; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center; flex-shrink: 0; }
.notif-icon.green { background: var(--st-ok-bg); color: var(--st-ok-ink); }
.notif-icon.red { background: var(--st-bad-bg); color: var(--st-bad-ink); }
.notif-icon.yellow { background: var(--st-wait-bg); color: var(--charcoal); }
.notif-icon.blue { background: var(--st-info-bg); color: var(--st-info-ink); }
.notif-body { flex: 1; min-width: 0; }
.notif-body-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.notif-body-text { font-size: 12px; color: var(--muted-aa); line-height: 1.5; }
.notif-body-time { font-size: 12px; color: var(--muted); margin-top: 4px; }
.notif-remove { position: absolute; top: 10px; inset-inline-end: 10px; width: 24px; height: 24px; border-radius: var(--r-xs); border: none; background: transparent; cursor: pointer; color: var(--muted); display: grid; place-items: center; opacity: 0; transition: opacity var(--transition-fast); }
.notif-item:hover .notif-remove, .notif-remove:focus-visible { opacity: 1; }
.notif-remove:hover { background: var(--st-bad-bg); color: var(--st-bad); }

/* ══════════════════════════════════════
   NEW COMPONENTS (ui-*)
══════════════════════════════════════ */

/* Page header */
.ui-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.ui-page-head__main { min-width: 0; flex: 1 1 320px; }
.ui-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.ui-crumbs a { color: var(--muted-aa); }
.ui-crumbs a:hover { color: var(--teal); text-decoration: underline; }
.ui-crumbs .sep { color: var(--border-outline); }
.ui-page-head__title { margin: 0; font-size: var(--fs-2xl); font-weight: 600; line-height: var(--lh-tight); color: var(--charcoal); }
.ui-page-head__desc { margin: 6px 0 0; font-size: 14px; color: var(--muted-aa); line-height: 1.6; }
.ui-page-head__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Teal hero (one per page, only dashboard / profile header / payroll summary) */
.ui-hero { background: var(--surface-hero); color: var(--cream); border-radius: var(--r-hero); padding: 28px; min-height: 160px; margin-bottom: 24px; }
.ui-hero h1, .ui-hero h2 { margin: 0; color: var(--cream); font-size: var(--fs-2xl); font-weight: 600; }
.ui-hero p { margin: 6px 0 0; color: var(--on-dark); }
.ui-hero .ui-kicker { color: var(--teal-lite); font-size: 13px; font-weight: 600; }

/* Card */
.ui-card { background: var(--app-surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px; color: var(--txt); min-width: 0; }
.ui-card.is-flush { padding: 0; overflow: hidden; border-radius: var(--r-md); }
.ui-card + .ui-card { margin-top: 16px; }
.ui-grid > .ui-card + .ui-card, .ui-kpis > * { margin-top: 0; }
.ui-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.ui-card.is-flush .ui-card__head { margin: 0; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.ui-card__title { margin: 0; font-size: var(--fs-lg); font-weight: 600; color: var(--charcoal); line-height: 1.35; }
.ui-card__sub { font-size: 13px; color: var(--muted-aa); margin-top: 2px; }
.ui-card.is-flush .ui-card__body { padding: 20px; }
.ui-grid { display: grid; gap: 16px; }
.ui-grid.cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.ui-grid.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }

/* KPI tiles */
.ui-kpis { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 24px; }
.ui-kpi { display: flex; flex-direction: column; gap: 6px; background: var(--app-surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px 20px; color: var(--txt); min-width: 0; transition: border-color var(--transition-fast); }
a.ui-kpi:hover { border-color: var(--teal); }
.ui-kpi__label { font-size: 13px; color: var(--muted-aa); font-weight: 500; }
.ui-kpi__value { font-size: var(--fs-kpi); font-weight: 700; line-height: 1.15; color: var(--teal); font-variant-numeric: tabular-nums; }
.ui-kpi__value small { font-size: 13px; font-weight: 500; color: var(--muted-aa); margin-inline-start: 4px; }
.ui-kpi__delta { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ui-kpi__delta.is-up { color: var(--st-ok-ink); }
.ui-kpi__delta.is-down { color: var(--st-bad); }
.ui-hero .ui-kpi { background: var(--glass); border-color: var(--glass-line); color: var(--cream); }
.ui-hero .ui-kpi__label { color: var(--on-dark); }
.ui-hero .ui-kpi__value { color: var(--brass-lite); }
@media (max-width: 1100px) { .ui-kpis { grid-template-columns: repeat(2, minmax(0,1fr)); } }

/* Status tag */
.ui-tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 1.4; white-space: nowrap; background: var(--st-neutral-bg); color: var(--st-neutral-ink); }
.ui-tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.ui-tag.is-ok { background: var(--st-ok-bg); color: var(--st-ok-ink); }
.ui-tag.is-ok::before { background: var(--st-ok); }
.ui-tag.is-wait { background: var(--st-wait-bg); color: var(--st-wait-ink); }
.ui-tag.is-wait::before { background: var(--brass); }
.ui-tag.is-warn { background: var(--st-warn-bg); color: var(--st-warn-ink); }
.ui-tag.is-warn::before { content: "!"; width: 14px; height: 14px; display: grid; place-items: center; background: var(--st-warn); color: #fff; font-size: 10px; font-weight: 700; }
.ui-tag.is-bad { background: var(--st-bad-bg); color: var(--st-bad-ink); }
.ui-tag.is-info { background: var(--st-info-bg); color: var(--st-info-ink); }
.ui-tag.is-neutral { background: var(--st-neutral-bg); color: var(--st-neutral-ink); }
.ui-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--brass-lite); color: var(--charcoal); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Tabs */
.ui-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.ui-tabs::-webkit-scrollbar { display: none; }
.ui-tabs.is-overflowing { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
[dir="rtl"] .ui-tabs.is-overflowing { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 32px), transparent); }
.ui-tab { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border: 0; background: transparent; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--muted-aa); font-family: inherit; font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer; flex-shrink: 0; }
.ui-tab:hover { color: var(--charcoal); }
.ui-tab.is-active, .ui-tab[aria-selected="true"] { color: var(--charcoal); font-weight: 600; border-bottom-color: var(--teal); }
.ui-tab__count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--app-sunken); color: var(--muted-aa); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ui-tab.is-active .ui-tab__count, .ui-tab[aria-selected="true"] .ui-tab__count { background: var(--st-info-bg); color: var(--teal); }
.on-dark .ui-tabs, .ui-hero .ui-tabs { border-bottom-color: var(--glass-line); }
.on-dark .ui-tab, .ui-hero .ui-tab { color: var(--nav-ink); }
.on-dark .ui-tab.is-active, .ui-hero .ui-tab.is-active, .on-dark .ui-tab[aria-selected="true"] { color: var(--cream); border-bottom-color: var(--brass-lite); }

/* Table */
.ui-table-card { background: var(--app-surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; min-width: 0; }
.ui-table-toolbar, .ui-bulkbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ui-table-toolbar__start, .ui-table-toolbar__end { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ui-bulkbar { background: var(--row-selected); color: var(--teal-deep); font-weight: 600; }
.ui-table-wrap { position: relative; overflow-x: auto; overscroll-behavior-x: contain; }
.ui-table-wrap.is-tall { max-height: 70vh; overflow-y: auto; }
.ui-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.ui-table th { position: sticky; top: 0; z-index: 2; background: var(--app-sunken); height: var(--h-row); padding: 0 16px; text-align: start; font-size: 13px; font-weight: 600; color: var(--charcoal); white-space: nowrap; border-bottom: 1px solid var(--line); }
.ui-table td { height: var(--h-row); padding: 8px 16px; border-bottom: 1px solid var(--border-light); color: var(--txt); vertical-align: middle; line-height: var(--lh-ui); }
.ui-table tbody tr:last-child td { border-bottom: 0; }
.ui-table tbody tr:hover td { background: var(--row-hover); }
.ui-table tbody tr.is-selected td { background: var(--row-selected); }
.ui-table tbody tr.is-selected td:first-child { box-shadow: inset -2px 0 0 var(--teal); }
[dir="ltr"] .ui-table tbody tr.is-selected td:first-child { box-shadow: inset 2px 0 0 var(--teal); }
.ui-table.is-compact th, .ui-table.is-compact td { height: var(--h-row-compact); padding-block: 4px; font-size: 13px; }
.ui-table.is-comfy th, .ui-table.is-comfy td { height: var(--h-row-comfy); }
.ui-table.is-zebra tbody tr:nth-child(even) td { background: #fbf8f1; }
.ui-table .num, .data-table .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-table .col-sticky { position: sticky; inset-inline-start: 0; z-index: 1; background: var(--app-surface); }
.ui-table th.col-sticky { z-index: 3; background: var(--app-sunken); }
.ui-table .sub { display: block; font-size: 12px; color: var(--muted); }
/* phone scroll hint: JS marks any sideways-scrolling table wrapper with data-scroll-hint and
   .is-scrollable / .at-end (attributes and classes only — no element is inserted into page markup) */
@media (max-width: 760px) {
    .is-scrollable[data-scroll-hint]:not(.at-end)::before { content: "↔  " attr(data-scroll-hint); display: block; position: sticky; inset-inline-start: 0; padding: 6px 12px; font-size: 12px; font-weight: 500; line-height: 1.4; white-space: nowrap; color: var(--muted-aa); background: var(--app-sunken); border-bottom: 1px solid var(--line); }
    .table-scroll.is-scrollable, .ui-table-wrap.is-scrollable { box-shadow: inset -12px 0 10px -10px rgba(22,19,17,.18); }
    [dir="rtl"] .table-scroll.is-scrollable, [dir="rtl"] .ui-table-wrap.is-scrollable { box-shadow: inset 12px 0 10px -10px rgba(22,19,17,.18); }
    .table-scroll.at-end, .ui-table-wrap.at-end { box-shadow: none !important; }
}

/* Pagination */
.ui-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; font-size: 13px; color: var(--muted-aa); }
.ui-pagination__pages { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ui-page { min-width: 36px; height: 36px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--white); color: var(--charcoal); font-weight: 600; font-variant-numeric: tabular-nums; }
a.ui-page:hover { border-color: var(--teal); color: var(--teal); }
.ui-page.is-current { background: var(--teal); border-color: var(--teal); color: #fff; }
.ui-page.is-disabled { opacity: .4; pointer-events: none; }

/* Filters bar + chips */
.ui-filters { background: var(--app-surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 16px; margin-bottom: 16px; }
.ui-filters > summary { display: none; }
.ui-filters__row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.ui-filters__row > .ui-field { margin-bottom: 0; flex: 1 1 180px; max-width: 280px; }
.ui-filters__row .ui-label { font-size: 13px; margin-bottom: 4px; }
.ui-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ui-chips:empty { display: none; }
.ui-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding-inline: 12px 6px; border-radius: 999px; background: var(--st-info-bg); color: var(--teal-deep); font-size: 13px; font-weight: 500; }
.ui-chip button, .ui-chip a.x { width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; display: grid; place-items: center; font-size: 16px; line-height: 1; }
.ui-chip button:hover, .ui-chip a.x:hover { background: rgba(10,95,94,.12); }
@media (max-width: 760px) {
    .ui-filters.is-collapsible > summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-weight: 600; list-style: none; min-height: 28px; }
    .ui-filters.is-collapsible > summary::-webkit-details-marker { display: none; }
    .ui-filters.is-collapsible[open] > summary { margin-bottom: 12px; }
    .ui-filters__row > .ui-field { max-width: none; flex-basis: 100%; }
}

/* Modal / drawer / bottom sheet */
.ui-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--scrim); animation: fadeIn .15s; }
.ui-modal[hidden] { display: none; }
.ui-modal__dialog { width: 100%; max-width: 560px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--cream-card); border-radius: var(--r-md); box-shadow: var(--ring-pop); animation: zoomIn .16s ease; outline: none; }
.ui-modal__dialog.is-wide { max-width: 800px; }
.ui-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.ui-modal__title { margin: 0; font-size: var(--fs-lg); font-weight: 600; color: var(--charcoal); }
.ui-modal__body { padding: 20px; overflow-y: auto; }
.ui-modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.ui-modal.is-drawer { justify-content: flex-end; padding: 0; }
.ui-modal.is-drawer .ui-modal__dialog { max-width: 480px; height: 100dvh; max-height: none; border-radius: 0; animation: none; }
@media (max-width: 640px) {
    .ui-modal { align-items: flex-end; padding: 0; }
    .ui-modal__dialog, .ui-modal.is-drawer .ui-modal__dialog { max-width: none; max-height: 92dvh; height: auto; border-radius: var(--r-md) var(--r-md) 0 0; padding-bottom: env(safe-area-inset-bottom); animation: slideUp .2s ease; }
    .ui-modal__foot { flex-wrap: wrap; }
    .ui-modal__foot .btn { flex: 1 1 auto; }
}

/* Toasts */
.ui-toasts { position: fixed; z-index: 1300; bottom: 20px; inset-inline-end: 20px; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.ui-toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; background: var(--charcoal); color: var(--cream); border-radius: var(--r-sm); padding: 12px 14px; font-size: 14px; line-height: 1.5; box-shadow: var(--ring-pop); animation: slideUp .2s ease; }
.ui-toast::before { content: ""; width: 4px; align-self: stretch; border-radius: 2px; background: var(--teal-lite); flex-shrink: 0; }
.ui-toast.is-ok::before { background: #6cc3a0; }
.ui-toast.is-bad::before { background: #e07a74; }
.ui-toast__msg { flex: 1; }
.ui-toast button { border: 0; background: transparent; color: var(--brass-lite); font-family: inherit; font-weight: 600; cursor: pointer; padding: 0 4px; }
@media (max-width: 640px) { .ui-toasts { inset-inline: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); max-width: none; align-items: stretch; } }

/* Empty state */
.ui-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 20px; }
.ui-empty__icon { width: 56px; height: 56px; border-radius: var(--r-sm); background: var(--teal-glow); color: var(--teal); display: grid; place-items: center; margin-bottom: 4px; }
.ui-empty__icon .material-symbols-outlined { font-size: 28px; }
.ui-empty__title { margin: 0; font-size: var(--fs-lg); font-weight: 600; color: var(--charcoal); }
.ui-empty__text { margin: 0; font-size: 14px; color: var(--muted-aa); max-width: 420px; }
.ui-empty__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

/* Alert banner */
.ui-alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: var(--r-sm); border: 1px solid transparent; font-size: 14px; line-height: 1.55; margin-bottom: 16px; background: var(--st-info-bg); color: var(--st-info-ink); border-color: rgba(10,95,94,.25); }
.ui-alert.is-ok { background: var(--st-ok-bg); color: var(--st-ok-ink); border-color: rgba(47,125,95,.3); }
.ui-alert.is-warn { background: var(--st-warn-bg); color: var(--st-warn-ink); border-color: rgba(183,121,31,.35); }
.ui-alert.is-bad { background: var(--st-bad-bg); color: var(--st-bad-ink); border-color: rgba(168,50,45,.3); }
.ui-alert .material-symbols-outlined { font-size: 20px; flex-shrink: 0; }

/* ════════════════════════════════════════════════════════════════════════
   PAGE STANDARD (redesign 2, 15 Nov 2026) — the components every page is built from.
   Guide with HTML snippets and page recipes: Sanad-HQ/6-product/redesign/07-PAGE-STANDARD.md
   Rules: calm cream canvas, one accent (teal), hairlines not shadows, Readex Pro, tabular
   figures, logical properties only, tokens only. Bare names (.panel .kpi .badge .toolbar
   .avatar .drawer .empty) are already used by ~150 page rules, so every class here is ui-*.
   ════════════════════════════════════════════════════════════════════════ */
:root {
    --pg-gap: 20px;                 /* gap between page sections */
    --pg-max: 1440px;               /* content max width on very wide screens */
    --sticky-top: calc(var(--app-top-h) + var(--app-banner-h));
    --tone-1-bg: var(--st-info-bg);   --tone-1-ink: var(--teal);
    --tone-2-bg: var(--st-wait-bg);   --tone-2-ink: #6e5530;
    --tone-3-bg: var(--st-ok-bg);     --tone-3-ink: var(--st-ok-ink);
    --tone-4-bg: var(--bar);          --tone-4-ink: var(--muted-aa);
    --tone-5-bg: #e6eeec;             --tone-5-ink: var(--teal-deep);
    --tone-6-bg: #f1e7dc;             --tone-6-ink: #7a4f2c;
}
.ui-screen { display: flex; flex-direction: column; gap: var(--pg-gap); max-width: var(--pg-max); min-width: 0; }
.ui-screen > * { min-width: 0; flex-shrink: 0; }
.ui-icon, .ui-screen .material-symbols-outlined { font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24; }

/* ── Page header v2: title + context + actions, optional tabs underneath ── */
.ui-page-head { margin-bottom: 0; align-items: flex-end; }
.ui-screen .ui-page-head + .ui-tabs { margin-top: calc(var(--pg-gap) * -1 + 4px); }
.ui-page-head__eyebrow { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--muted-aa); margin-bottom: 6px; }
.ui-page-head__eyebrow a { color: var(--muted-aa); }
.ui-page-head__eyebrow a:hover { color: var(--teal); }
.ui-page-head__title { font-size: 26px; letter-spacing: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ui-page-head__title .ui-tag, .ui-page-head__title .ui-badge { font-size: 13px; }
.ui-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 13.5px; color: var(--muted-aa); }
.ui-meta > li, .ui-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.ui-meta > li + li::before, .ui-meta > span + span::before { content: ""; width: 3px; height: 3px; border-radius: 50%; background: var(--muted-d); margin-inline-end: 8px; }
.ui-meta b { color: var(--charcoal); font-weight: 600; font-variant-numeric: tabular-nums; }
.ui-meta .material-symbols-outlined { font-size: 17px; }

/* tabs driven by older page scripts toggle .active instead of .is-active */
.ui-tab.active { color: var(--charcoal); font-weight: 600; border-bottom-color: var(--teal); }
.ui-tab.active .ui-tab__count { background: var(--st-info-bg); color: var(--teal); }

/* ── Icon tile (used by KPI, list rows, empty states) ── */
.ui-icon-tile { width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center; flex-shrink: 0; background: var(--st-info-bg); color: var(--teal); }
.ui-icon-tile .material-symbols-outlined { font-size: 20px; }
.ui-icon-tile.is-lg { width: 44px; height: 44px; border-radius: 12px; }
.ui-icon-tile.is-lg .material-symbols-outlined { font-size: 22px; }
.ui-icon-tile.is-ok { background: var(--st-ok-bg); color: var(--st-ok-ink); }
.ui-icon-tile.is-warn { background: var(--st-warn-bg); color: var(--st-warn-ink); }
.ui-icon-tile.is-bad { background: var(--st-bad-bg); color: var(--st-bad); }
.ui-icon-tile.is-wait { background: var(--st-wait-bg); color: #6e5530; }
.ui-icon-tile.is-neutral { background: var(--bar); color: var(--muted-aa); }

/* ── KPI v2: label + icon, big tabular value, delta / hint, optional meter ── */
.ui-kpis { margin-bottom: 0; }
.ui-kpis.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.ui-kpis.cols-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
.ui-kpi { position: relative; gap: 4px; padding: 16px 18px 16px; border-radius: var(--r-md); text-decoration: none; }
.ui-kpi__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.ui-kpi__top .ui-kpi__label { padding-top: 2px; }
.ui-kpi__icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--st-info-bg); color: var(--teal); flex-shrink: 0; }
.ui-kpi__icon .material-symbols-outlined { font-size: 18px; }
.ui-kpi__icon.is-warn { background: var(--st-warn-bg); color: var(--st-warn-ink); }
.ui-kpi__icon.is-bad { background: var(--st-bad-bg); color: var(--st-bad); }
.ui-kpi__icon.is-ok { background: var(--st-ok-bg); color: var(--st-ok-ink); }
.ui-kpi__icon.is-wait { background: var(--st-wait-bg); color: #6e5530; }
.ui-kpi__value { color: var(--charcoal); font-weight: 600; letter-spacing: 0; display: flex; align-items: baseline; gap: 2px; flex-wrap: wrap; }
.ui-kpi__value.is-accent { color: var(--teal); }
.ui-kpi__foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 20px; font-size: 12.5px; color: var(--muted-aa); }
.ui-kpi__hint { font-size: 12.5px; color: var(--muted-aa); }
.ui-delta { display: inline-flex; align-items: center; gap: 2px; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--bar); color: var(--muted-aa); direction: ltr; unicode-bidi: isolate; }
.ui-delta.is-up { background: var(--st-ok-bg); color: var(--st-ok-ink); }
.ui-delta.is-down { background: var(--st-bad-bg); color: var(--st-bad); }
.ui-delta.is-warn { background: var(--st-warn-bg); color: var(--st-warn-ink); }
.ui-meter { display: block; height: 6px; border-radius: 999px; background: var(--bar); overflow: hidden; margin-top: 8px; }
.ui-meter > i { display: block; height: 100%; width: var(--v, 0%); border-radius: inherit; background: var(--teal); }
.ui-meter > i.is-warn { background: var(--st-warn); } .ui-meter > i.is-bad { background: var(--st-bad); } .ui-meter > i.is-ok { background: var(--st-ok); } .ui-meter > i.is-brass { background: var(--brass); }
.ui-meter.is-stack { display: flex; gap: 2px; background: transparent; }
.ui-meter.is-stack > i { width: auto; flex: var(--v, 0) 1 0; border-radius: 2px; min-width: 0; }
.ui-meter.is-stack > i:first-child { border-start-start-radius: 999px; border-end-start-radius: 999px; }
.ui-meter.is-stack > i:last-child { border-start-end-radius: 999px; border-end-end-radius: 999px; }
a.ui-kpi::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; border: 1px solid transparent; pointer-events: none; transition: border-color var(--transition-fast); }
a.ui-kpi:hover { border-color: var(--border-outline); background: var(--white); }
.ui-kpi.is-active { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); background: var(--white); }
.ui-kpi.is-active .ui-kpi__label { color: var(--teal); font-weight: 600; }
.ui-kpi.is-compact { padding: 14px 16px; }
.ui-kpi.is-compact .ui-kpi__value { font-size: 24px; }
.ui-hero .ui-kpi { border-radius: var(--r-md); }
.ui-hero .ui-kpi__value { color: var(--brass-lite); }
.ui-hero .ui-kpi__icon { background: var(--glass); color: var(--teal-lite); border: 1px solid var(--glass-line); }
.ui-hero .ui-kpi__hint, .ui-hero .ui-kpi__foot { color: var(--nav-label); }
.ui-hero .ui-meter { background: var(--glass-line); }
.ui-hero .ui-meter > i { background: var(--teal-lite); }

/* ── Panel = section card with a clear title row ── */
.ui-panel { background: var(--app-surface); border: 1px solid var(--line); border-radius: var(--r-md); min-width: 0; overflow: hidden; overflow: clip; }
.ui-panel + .ui-panel { margin-top: 0; }
.ui-panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); min-height: 60px; flex-wrap: wrap; }
.ui-panel__head.is-plain { border-bottom: 0; padding-bottom: 4px; min-height: 0; }
.ui-panel__heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ui-panel__title { margin: 0; font-size: 16px; font-weight: 600; color: var(--charcoal); line-height: 1.35; display: flex; align-items: center; gap: 8px; }
.ui-panel__sub { margin: 2px 0 0; font-size: 13px; color: var(--muted-aa); line-height: 1.5; }
.ui-panel__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ui-panel__body { padding: 20px; }
.ui-panel__body.is-flush { padding: 0; }
.ui-panel__body.is-tight { padding: 8px 20px; }
.ui-panel__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--app-surface); font-size: 13px; color: var(--muted-aa); flex-wrap: wrap; }
.ui-panel.is-sunken { background: var(--app-sunken); }
.ui-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--teal); white-space: nowrap; }
.ui-link:hover { color: var(--teal-deep); text-decoration: underline; text-underline-offset: 3px; }
.ui-link .material-symbols-outlined { font-size: 16px; }
[dir="rtl"] .ui-link .ui-flip, [dir="rtl"] .ui-flip { transform: scaleX(-1); }
details.ui-panel > summary { list-style: none; cursor: pointer; }
details.ui-panel > summary::-webkit-details-marker { display: none; }
details.ui-panel > summary .ui-chev { transition: transform .18s; color: var(--muted-aa); }
details.ui-panel[open] > summary .ui-chev { transform: rotate(180deg); }
details.ui-panel:not([open]) > summary { border-bottom: 0; }

/* layout grids */
.ui-cols { display: grid; gap: var(--pg-gap); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1100px) {
    .ui-cols.is-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .ui-cols.is-main-side { grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); }
    .ui-cols.is-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
.ui-stack { display: flex; flex-direction: column; gap: var(--pg-gap); min-width: 0; }

/* ── List rows inside a panel (pending items, people, documents) ── */
.ui-list { list-style: none; margin: 0; padding: 0; }
.ui-list__item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border-light); min-height: 56px; color: inherit; transition: background var(--transition-fast); }
.ui-list__item:last-child { border-bottom: 0; }
a.ui-list__item:hover { background: var(--row-hover); }
.ui-list__main { flex: 1 1 auto; min-width: 0; }
.ui-list__title, .ui-list__sub { display: block; }
.ui-list__title { font-size: 14px; font-weight: 500; color: var(--charcoal); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-list__sub { font-size: 12.5px; color: var(--muted-aa); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-list__end { display: flex; align-items: center; gap: 10px; flex-shrink: 0; font-size: 13px; color: var(--muted-aa); font-variant-numeric: tabular-nums; }
.ui-list__value { font-size: 16px; font-weight: 600; color: var(--charcoal); font-variant-numeric: tabular-nums; }
.ui-list.is-compact .ui-list__item { min-height: 44px; padding-block: 8px; }

/* bar list (distribution) */
.ui-bars { display: flex; flex-direction: column; gap: 12px; }
.ui-bar { display: grid; grid-template-columns: minmax(84px, 34%) minmax(0,1fr) 36px; align-items: center; gap: 12px; font-size: 13px; }
.ui-bar__label { color: var(--charcoal); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-bar__track { height: 8px; border-radius: 999px; background: var(--bar); overflow: hidden; }
.ui-bar__track > i { display: block; height: 100%; width: var(--v, 0%); background: var(--teal); border-radius: inherit; }
.ui-bar__val { text-align: end; font-weight: 600; color: var(--charcoal); font-variant-numeric: tabular-nums; }

/* ── Avatar ── */
.ui-avatar { --av: 36px; width: var(--av); height: var(--av); border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0; overflow: hidden; background: var(--tone-1-bg); color: var(--tone-1-ink); font-size: calc(var(--av) * .36); font-weight: 600; line-height: 1; letter-spacing: 0; user-select: none; }
.ui-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ui-avatar.is-xs { --av: 24px; } .ui-avatar.is-sm { --av: 28px; } .ui-avatar.is-md { --av: 40px; } .ui-avatar.is-lg { --av: 56px; } .ui-avatar.is-xl { --av: 80px; }
.ui-avatar.is-square { border-radius: 28%; }
.ui-avatar.tone-2 { background: var(--tone-2-bg); color: var(--tone-2-ink); }
.ui-avatar.tone-3 { background: var(--tone-3-bg); color: var(--tone-3-ink); }
.ui-avatar.tone-4 { background: var(--tone-4-bg); color: var(--tone-4-ink); }
.ui-avatar.tone-5 { background: var(--tone-5-bg); color: var(--tone-5-ink); }
.ui-avatar.tone-6 { background: var(--tone-6-bg); color: var(--tone-6-ink); }
.ui-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ui-person__text { min-width: 0; line-height: 1.35; }
.ui-person__name { display: block; font-size: 14px; font-weight: 600; color: var(--charcoal); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.ui-person__name:hover, .ui-person a:hover .ui-person__name { color: var(--teal); }
.ui-person__sub { display: block; font-size: 12.5px; color: var(--muted-aa); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }

/* ── Badge (neutral label / count; status always uses .ui-tag) ── */
.ui-badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--white); color: var(--muted-aa); font-size: 12px; font-weight: 500; white-space: nowrap; line-height: 1; font-variant-numeric: tabular-nums; }
.ui-badge.is-teal { background: var(--st-info-bg); border-color: transparent; color: var(--teal); }
.ui-badge.is-brass { background: var(--st-wait-bg); border-color: transparent; color: #6e5530; }
.ui-badge.is-solid { background: var(--charcoal); border-color: var(--charcoal); color: var(--cream); }
.ui-badge .material-symbols-outlined { font-size: 14px; }
.ui-tag.is-sm { font-size: 12px; padding: 1px 8px; gap: 5px; }
.ui-tag.is-sm::before { width: 6px; height: 6px; }
.ui-hero .ui-tag, .on-dark .ui-tag { background: var(--glass); color: var(--cream); border: 1px solid var(--glass-line); }
.ui-hero .ui-tag.is-ok::before, .on-dark .ui-tag.is-ok::before { background: #6cc3a0; }
.ui-hero .ui-tag.is-bad::before, .on-dark .ui-tag.is-bad::before { background: #e07a74; }
.ui-hero .ui-tag.is-wait::before, .on-dark .ui-tag.is-wait::before { background: var(--brass-lite); }
.ui-hero .ui-tag.is-info::before, .on-dark .ui-tag.is-info::before { background: var(--teal-lite); }

/* ── Toolbar: search + filters + segmented + view actions ── */
.ui-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--app-surface); }
.ui-toolbar.is-bare { padding: 0; border: 0; background: transparent; }
.ui-toolbar__spacer { flex: 1 1 auto; }
.ui-toolbar__group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ui-search { position: relative; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--white); min-width: 0; flex: 1 1 260px; max-width: 420px; transition: border-color var(--transition-fast), box-shadow var(--transition-fast); }
.ui-search:hover { border-color: var(--border-outline); }
.ui-search:focus-within { border-color: var(--teal); box-shadow: var(--focus-light); }
.ui-search .material-symbols-outlined { font-size: 18px; color: var(--muted-aa); }
.ui-search input { border: 0; outline: none; background: transparent; flex: 1; min-width: 0; height: 100%; font-size: 14px; color: var(--txt); }
.ui-search input::placeholder { color: var(--muted-cap); }
.ui-pill-select { position: relative; display: inline-flex; align-items: center; height: 36px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--white); transition: border-color var(--transition-fast); }
.ui-pill-select:hover { border-color: var(--border-outline); }
.ui-pill-select:focus-within { border-color: var(--teal); box-shadow: var(--focus-light); }
.ui-pill-select.is-set { border-color: var(--teal); background: var(--st-info-bg); }
.ui-pill-select select { appearance: none; -webkit-appearance: none; border: 0; outline: none; background: transparent; height: 100%; padding-inline: 12px 30px; font-size: 13.5px; font-weight: 500; color: var(--charcoal); cursor: pointer; max-width: 220px; text-overflow: ellipsis; }
.ui-pill-select::after { content: ""; position: absolute; inset-inline-end: 12px; top: 50%; width: 6px; height: 6px; border-right: 1.5px solid var(--muted-aa); border-bottom: 1.5px solid var(--muted-aa); transform: translateY(-70%) rotate(45deg); pointer-events: none; } /* physical sides on purpose: a down chevron never mirrors */
.ui-pill-select input { border: 0; outline: none; background: transparent; height: 100%; padding: 0 12px; font-size: 13.5px; font-weight: 500; color: var(--charcoal); }
/* segmented control */
.ui-seg { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 11px; background: var(--app-sunken); border: 1px solid var(--line); flex-shrink: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.ui-seg::-webkit-scrollbar { display: none; }
.ui-seg > button, .ui-seg > a { appearance: none; border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 8px; font-family: inherit; font-size: 13px; font-weight: 500; color: var(--muted-aa); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: background var(--transition-fast), color var(--transition-fast); }
.ui-seg > button:hover, .ui-seg > a:hover { color: var(--charcoal); }
.ui-seg > .is-on, .ui-seg > .on, .ui-seg > [aria-pressed="true"], .ui-seg > [aria-current="true"] { background: var(--white); color: var(--charcoal); font-weight: 600; box-shadow: 0 0 0 1px var(--line), 0 1px 0 rgba(22,19,17,.04); }
.ui-seg .ui-tab__count { height: 18px; min-width: 18px; font-size: 11.5px; }
/* filter chips = quick views with counts */
.ui-fchips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ui-fchip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); color: var(--muted-aa); font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast); }
.ui-fchip:hover { border-color: var(--border-outline); color: var(--charcoal); }
.ui-fchip.is-on { background: var(--charcoal); border-color: var(--charcoal); color: var(--cream); }
.ui-fchip__count { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--charcoal); }
.ui-fchip.is-on .ui-fchip__count { color: var(--brass-lite); }
.ui-chips.is-applied { margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--line); align-items: center; }
.ui-chips__label { font-size: 12.5px; color: var(--muted-aa); margin-inline-end: 2px; }

/* ── Data table v2 (.ui-dtable) ── */
.ui-dtable-wrap { position: relative; overflow-x: auto; overscroll-behavior-x: contain; }
.ui-dtable-wrap.is-tall { max-height: calc(100dvh - var(--sticky-top) - 120px); min-height: 240px; overflow: auto; }
.ui-dtable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; color: var(--txt); }
.ui-dtable thead th { position: sticky; top: 0; z-index: 3; height: 40px; padding: 0 14px; background: var(--app-sunken); border-bottom: 1px solid var(--line); text-align: start; font-size: 12.5px; font-weight: 600; color: var(--muted-aa); white-space: nowrap; vertical-align: middle; }
.ui-dtable-wrap.is-page-sticky { overflow: visible; }
.ui-dtable-wrap.is-page-sticky .ui-dtable thead th { top: var(--sticky-top); }
.ui-dtable tbody td { padding: 10px 14px; height: 56px; border-bottom: 1px solid var(--border-light); vertical-align: middle; line-height: var(--lh-ui); background: var(--app-surface); }
.ui-dtable.is-dense tbody td { height: 44px; padding-block: 6px; }
.ui-dtable tbody tr:last-child td { border-bottom: 0; }
.ui-dtable tbody tr:hover td { background: var(--row-hover); }
.ui-dtable tbody tr.is-clickable { cursor: pointer; }
.ui-dtable tbody tr.is-selected td { background: var(--row-selected); }
.ui-dtable tbody tr.is-muted td { opacity: .55; }
.ui-dtable th.num, .ui-dtable td.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-dtable th.center, .ui-dtable td.center { text-align: center; }
.ui-dtable td.mono, .ui-dtable .mono { font-variant-numeric: tabular-nums; letter-spacing: 0; }
.ui-dtable td.nowrap { white-space: nowrap; }
.ui-dtable th.col-check, .ui-dtable td.col-check { width: 44px; padding-inline: 14px 0; }
.ui-dtable input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--teal); cursor: pointer; vertical-align: middle; }
.ui-dtable .col-sticky { position: sticky; inset-inline-start: 0; z-index: 2; }
.ui-dtable thead .col-sticky { z-index: 4; }
.ui-dtable .col-sticky.is-edge { box-shadow: inset -1px 0 0 var(--line); }
[dir="rtl"] .ui-dtable .col-sticky.is-edge { box-shadow: inset 1px 0 0 var(--line); }
.ui-dtable .sub { display: block; font-size: 12.5px; color: var(--muted-aa); margin-top: 1px; }
.ui-dtable .sub:empty { display: none !important; }
.ui-dtable .dim { color: var(--muted-cap); }
.ui-dtable tfoot td { position: sticky; bottom: 0; z-index: 2; padding: 12px 14px; background: var(--bar); border-top: 1px solid var(--line); font-weight: 600; color: var(--charcoal); white-space: nowrap; }
.ui-dtable .ui-amount { font-weight: 600; color: var(--charcoal); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-dtable .ui-amount.is-neg { color: var(--st-bad); }
.ui-dtable .ui-amount.is-muted { color: var(--muted-aa); font-weight: 500; }
.ui-dtable .ui-amount.is-strong { font-size: 15px; color: var(--teal-deep); }
.ui-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.ui-dtable td.col-actions { width: 56px; padding-inline: 4px 12px; text-align: end; }
@media (hover: hover) {
    .ui-dtable tbody tr .ui-row-actions .is-reveal { opacity: 0; transition: opacity var(--transition-fast); }
    .ui-dtable tbody tr:hover .ui-row-actions .is-reveal, .ui-dtable tbody tr:focus-within .ui-row-actions .is-reveal { opacity: 1; }
}
.ui-dtable-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted-aa); flex-wrap: wrap; }

/* phone card list: add .is-stack to the table and .is-stack-sm to its wrapper.
   Cells: .cell-primary (the card title row), [data-label] (label/value rows), .hide-sm (dropped). */
@media (max-width: 760px) {
    .ui-dtable-wrap.is-stack-sm { overflow: visible; max-height: none; }
    .ui-dtable.is-stack, .ui-dtable.is-stack tbody { display: block; }
    .ui-dtable.is-stack thead { display: none; }
    .ui-dtable.is-stack tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); position: relative; }
    .ui-dtable.is-stack tbody tr:last-child { border-bottom: 0; }
    .ui-dtable.is-stack tbody td { display: block; height: auto; padding: 0; border: 0; background: transparent !important; }
    .ui-dtable.is-stack tbody td.cell-primary { flex: 1 1 calc(100% - 40px); order: -2; min-width: 0; }
    .ui-dtable.is-stack tbody td.col-check { order: -3; width: auto; padding: 0; }
    .ui-dtable.is-stack tbody td.col-actions { order: 1; width: auto; padding: 0; margin-inline-start: auto; }
    .ui-dtable.is-stack tbody td[data-label] { order: 2; flex: 1 1 100%; font-size: 13.5px; text-align: start; line-height: 1.5; }
    .ui-dtable.is-stack tbody td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 96px; margin-inline-end: 8px; font-size: 12.5px; color: var(--muted-aa); vertical-align: baseline; }
    .ui-dtable.is-stack tbody td[data-label] .sub { display: inline; margin: 0; }
    .ui-dtable.is-stack tbody td[data-label] .sub::before { content: " · "; }
    .ui-dtable.is-stack tbody td.is-chips { flex: 0 0 auto; order: 1; }
    .ui-dtable.is-stack tbody td.is-chips::before { display: none; }
    .ui-dtable.is-stack tbody td.num[data-label] { text-align: start; }
    .ui-dtable.is-stack tbody td.hide-sm, .ui-dtable.is-stack thead th.hide-sm { display: none; }
    .ui-dtable.is-stack tfoot { display: block; }
    .ui-dtable.is-stack tfoot tr { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 12px 16px; background: var(--bar); }
    .ui-dtable.is-stack tfoot td { position: static; display: block; padding: 0; border: 0; background: transparent; }
    .ui-dtable.is-stack tfoot td:empty { display: none; }
}
@media (max-width: 1200px) { .ui-dtable .hide-lg { display: none; } }

/* ── Row / page actions menu (no JS: <details class="ui-menu">) ── */
.ui-menu { position: relative; display: inline-block; }
.ui-menu > summary { list-style: none; cursor: pointer; }
.ui-menu > summary::-webkit-details-marker { display: none; }
.ui-menu__pop { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 60; min-width: 220px; padding: 6px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--ring-pop); }
.ui-menu__item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--charcoal); font-family: inherit; font-size: 14px; text-align: start; cursor: pointer; white-space: nowrap; }
.ui-menu__item:hover, .ui-menu__item:focus-visible { background: var(--app-sunken); }
.ui-menu__item .material-symbols-outlined { font-size: 18px; color: var(--muted-aa); }
.ui-menu__item.is-danger { color: var(--st-bad); }
.ui-menu__sep { height: 1px; background: var(--line); margin: 6px 4px; }

/* ── Stepper (payroll run, onboarding, wizards) ── */
.ui-stepper { display: flex; align-items: flex-start; gap: 0; margin: 0; padding: 0; list-style: none; counter-reset: step; overflow-x: auto; scrollbar-width: none; }
.ui-stepper::-webkit-scrollbar { display: none; }
.ui-step { position: relative; flex: 1 1 0; min-width: 120px; display: flex; flex-direction: column; gap: 6px; padding-inline-end: 12px; counter-increment: step; }
.ui-step::after { content: ""; position: absolute; top: 13px; inset-inline-start: 34px; inset-inline-end: 8px; height: 2px; border-radius: 2px; background: var(--line); }
.ui-step:last-child::after { display: none; }
.ui-step__dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: var(--white); border: 1.5px solid var(--border-outline); color: var(--muted-aa); position: relative; z-index: 1; font-variant-numeric: tabular-nums; }
.ui-step__dot::before { content: counter(step); }
.ui-step__label { font-size: 13.5px; font-weight: 600; color: var(--muted-aa); line-height: 1.3; }
.ui-step__sub { font-size: 12px; color: var(--muted-cap); line-height: 1.4; }
.ui-step.is-done .ui-step__dot { background: var(--teal); border-color: var(--teal); color: #fff; }
.ui-step.is-done .ui-step__dot::before { content: "✓"; }
.ui-step.is-done::after { background: var(--teal); }
.ui-step.is-done .ui-step__label { color: var(--charcoal); }
.ui-step.is-current .ui-step__dot { border-color: var(--teal); color: var(--teal); box-shadow: 0 0 0 4px var(--st-info-bg); }
.ui-step.is-current .ui-step__label { color: var(--charcoal); }
.ui-hero .ui-step::after { background: var(--glass-line); }
.ui-hero .ui-step__dot { background: transparent; border-color: var(--ghost-line); color: var(--nav-label); }
.ui-hero .ui-step__label { color: var(--nav-label); }
.ui-hero .ui-step__sub { color: var(--nav-label); opacity: .85; }
.ui-hero .ui-step.is-done .ui-step__dot { background: var(--teal-lite); border-color: var(--teal-lite); color: var(--teal-deep); }
.ui-hero .ui-step.is-done::after { background: var(--teal-lite); }
.ui-hero .ui-step.is-done .ui-step__label, .ui-hero .ui-step.is-current .ui-step__label { color: var(--cream); }
.ui-hero .ui-step.is-current .ui-step__dot { border-color: var(--brass-lite); color: var(--brass-lite); box-shadow: 0 0 0 4px rgba(230,210,168,.16); }

/* ── Hero v2 (dashboard, profile header, payroll-run summary only) ── */
.ui-hero { position: relative; overflow: hidden; margin-bottom: 0; border-radius: var(--r-card); }
.ui-hero__row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.ui-hero__main { min-width: 0; flex: 1 1 360px; }
.ui-hero__title { margin: 4px 0 0; font-size: 28px; font-weight: 600; line-height: 1.25; color: var(--cream); }
.ui-hero__sub { margin: 6px 0 0; font-size: 14px; color: var(--on-dark); opacity: .82; line-height: 1.6; }
.ui-hero__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ui-hero__divider { height: 1px; background: var(--glass-line); margin: 22px 0 18px; border: 0; }
.ui-hero .ui-kpis { gap: 12px; }
.ui-hero .ui-meta { color: var(--nav-ink); }
.ui-hero .ui-meta b { color: var(--cream); }
.ui-hero .ui-meta > li + li::before, .ui-hero .ui-meta > span + span::before { background: var(--ghost-line); }

/* ── Attention strip: «يحتاج إجراء» cards ── */
.ui-attn { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.ui-attn__item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--app-surface); color: inherit; min-width: 0; transition: border-color var(--transition-fast), background var(--transition-fast); }
a.ui-attn__item:hover { border-color: var(--border-outline); background: var(--white); }
.ui-attn__num { font-size: 24px; font-weight: 600; color: var(--charcoal); font-variant-numeric: tabular-nums; line-height: 1.1; }
.ui-attn__text { min-width: 0; flex: 1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.ui-attn__text > * { display: block; }
.ui-attn__label { flex: 1 1 0; min-width: 0; line-height: 1.4; }
.ui-attn__sub { flex: 1 1 100%; margin-top: 2px; }
.ui-attn__label { font-size: 13.5px; font-weight: 500; color: var(--charcoal); }
.ui-attn__sub { font-size: 12.5px; color: var(--muted-aa); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-attn__go { color: var(--muted-d); font-size: 20px !important; }
.ui-attn__item.is-warn { border-color: #ecd6a8; background: #fdf8ee; }
.ui-attn__item.is-bad { border-color: #ecc6c1; background: #fcf3f1; }
.ui-attn__item.is-clear .ui-attn__num { color: var(--muted-aa); }

/* ── Description list (profile facts, detail drawers) ── */
.ui-dl { display: grid; grid-template-columns: repeat(var(--dl-cols, 2), minmax(0,1fr)); gap: 0 24px; margin: 0; }
.ui-dl.cols-3 { --dl-cols: 3; } .ui-dl.cols-1 { --dl-cols: 1; }
.ui-dl__item { padding: 12px 0; border-bottom: 1px solid var(--border-light); min-width: 0; }
.ui-dl__item dt, .ui-dl__label { font-size: 12.5px; color: var(--muted-aa); margin: 0 0 3px; font-weight: 500; }
.ui-dl__item dd, .ui-dl__value { margin: 0; font-size: 14.5px; color: var(--charcoal); font-weight: 500; line-height: 1.5; word-break: break-word; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .ui-dl, .ui-dl.cols-3 { --dl-cols: 1; } }

/* ── Section navigation (settings hub, employee profile) ── */
.ui-split { display: grid; grid-template-columns: minmax(0,1fr); gap: var(--pg-gap); align-items: start; }
@media (min-width: 1024px) { .ui-split { grid-template-columns: 236px minmax(0, 1fr); } }
.ui-snav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--sticky-top) + 16px); max-height: calc(100dvh - var(--sticky-top) - 32px); overflow-y: auto; scrollbar-width: thin; padding: 2px; }
.ui-snav__label { font-size: 12px; font-weight: 600; color: var(--muted-aa); padding: 14px 12px 6px; }
.ui-snav__label:first-child { padding-top: 2px; }
.ui-snav__item { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 12px; border-radius: 10px; color: var(--muted-aa); font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; position: relative; border: 0; background: transparent; font-family: inherit; text-align: start; width: 100%; white-space: nowrap; transition: background var(--transition-fast), color var(--transition-fast); }
.ui-snav__item .material-symbols-outlined { font-size: 19px; color: var(--muted-cap); flex-shrink: 0; }
.ui-snav__item:hover { background: var(--app-sunken); color: var(--charcoal); }
.ui-snav__item.is-active, .ui-snav__item.active, .ui-snav__item.on { background: var(--white); color: var(--charcoal); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.ui-snav__item.is-active .material-symbols-outlined, .ui-snav__item.active .material-symbols-outlined, .ui-snav__item.on .material-symbols-outlined { color: var(--teal); }
.ui-snav__item.is-active::before, .ui-snav__item.active::before, .ui-snav__item.on::before { content: ""; position: absolute; inset-inline-start: -2px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--teal); }
.ui-snav__count { margin-inline-start: auto; font-size: 12px; font-weight: 600; color: var(--muted-aa); font-variant-numeric: tabular-nums; }
.ui-snav__item.is-active .ui-snav__count, .ui-snav__item.active .ui-snav__count { color: var(--teal); }
@media (max-width: 1023.98px) {
    .ui-snav { position: static; flex-direction: row; max-height: none; overflow-x: auto; overflow-y: hidden; gap: 4px; padding: 0 0 2px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
    .ui-snav::-webkit-scrollbar { display: none; }
    .ui-snav__label { display: none; }
    .ui-snav__item { width: auto; flex-shrink: 0; border-radius: 0; min-height: 44px; padding: 0 12px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
    .ui-snav__item.is-active, .ui-snav__item.active, .ui-snav__item.on { background: transparent; box-shadow: none; border-bottom-color: var(--teal); }
    .ui-snav__item.is-active::before, .ui-snav__item.active::before, .ui-snav__item.on::before { display: none; }
    .ui-snav__count { margin-inline-start: 4px; }
}

/* ── Form section: intro on one side, fields card on the other (settings, long forms) ── */
.ui-form-section { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px 32px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.ui-form-section:first-child { padding-top: 4px; }
.ui-form-section:last-child { border-bottom: 0; }
@media (min-width: 1200px) { .ui-form-section { grid-template-columns: 260px minmax(0, 1fr); } }
.ui-form-section__intro h3 { margin: 0; font-size: 15px; font-weight: 600; color: var(--charcoal); }
.ui-form-section__intro p { margin: 6px 0 0; font-size: 13.5px; color: var(--muted-aa); line-height: 1.65; }
.ui-form-section__body { min-width: 0; }
.ui-field-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border-light); }
.ui-field-row:last-child { border-bottom: 0; }
.ui-field-row__text b { display: block; font-size: 14px; font-weight: 500; color: var(--charcoal); }
.ui-field-row__text span { display: block; font-size: 13px; color: var(--muted-aa); margin-top: 2px; }
/* switch */
.ui-switch { position: relative; display: inline-block; width: 40px; height: 24px; flex-shrink: 0; cursor: pointer; }
.ui-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.ui-switch__track { position: absolute; inset: 0; border-radius: 999px; background: var(--border-outline); transition: background .18s; }
.ui-switch__track::before { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--white); box-shadow: 0 1px 2px rgba(22,19,17,.2); transition: transform .18s; }
.ui-switch input:checked + .ui-switch__track { background: var(--teal); }
.ui-switch input:checked + .ui-switch__track::before { transform: translateX(16px); }
[dir="rtl"] .ui-switch input:checked + .ui-switch__track::before { transform: translateX(-16px); }
.ui-switch input:focus-visible + .ui-switch__track { box-shadow: var(--focus-light); }

/* ── Empty, skeleton ── */
.ui-empty.is-compact { padding: 28px 16px; }
.ui-empty.is-compact .ui-empty__icon { width: 44px; height: 44px; }
.ui-skel { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--bar) 0%, #ebe3d3 50%, var(--bar) 100%); background-size: 200% 100%; animation: skel 1.4s ease-in-out infinite; }
.ui-skel.is-title { height: 18px; width: 40%; } .ui-skel.is-text { width: 70%; } .ui-skel.is-num { height: 28px; width: 50%; } .ui-skel.is-circle { width: 36px; height: 36px; border-radius: 50%; }
@keyframes skel { from { background-position: 200% 0 } to { background-position: -200% 0 } }

/* ── Notice (page-level alert row, replaces ad-hoc .alert-box) ── */
.ui-notice { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--app-surface); font-size: 14px; line-height: 1.6; color: var(--charcoal); }
.ui-notice .material-symbols-outlined { font-size: 20px; margin-top: 1px; flex-shrink: 0; }
.ui-notice.is-ok { border-color: rgba(47,125,95,.3); background: var(--st-ok-bg); color: var(--st-ok-ink); }
.ui-notice.is-bad { border-color: rgba(168,50,45,.3); background: var(--st-bad-bg); color: var(--st-bad-ink); }
.ui-notice.is-warn { border-color: rgba(183,121,31,.35); background: var(--st-warn-bg); color: var(--st-warn-ink); }
.ui-notice.is-info { border-color: rgba(10,95,94,.22); background: var(--st-info-bg); color: var(--teal-deep); }

/* responsive for the standard */
@media (max-width: 1280px) { .ui-kpis.cols-5 { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 1100px) { .ui-attn { grid-template-columns: minmax(0,1fr); } .ui-kpis.cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 760px) {
    :root { --pg-gap: 16px; }
    .ui-page-head__title { font-size: 22px; }
    .ui-page-head__actions { width: 100%; }
    .ui-kpis.cols-5, .ui-kpis.cols-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    /* .is-scroll-sm: on phones the KPI row becomes one swipeable strip, so the list starts on the first screen */
    .ui-kpis.is-scroll-sm { display: flex; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
    .ui-kpis.is-scroll-sm::-webkit-scrollbar { display: none; }
    .ui-kpis.is-scroll-sm > .ui-kpi { flex: 0 0 168px; scroll-snap-align: start; }
    .ui-kpis.is-scroll-sm .ui-kpi__foot { font-size: 12px; }
    .ui-page-head__actions > .btn, .ui-page-head__actions > .ui-menu { flex: 1 1 auto; }
    .ui-page-head__actions > .ui-menu > summary { width: 100%; }
    .ui-page-head__actions .ui-menu__pop { inset-inline-end: auto; inset-inline-start: 0; max-width: calc(100vw - 32px); }
    .ui-toolbar .ui-pill-select { flex: 1 1 calc(50% - 4px); min-width: 0; }
    .ui-toolbar .ui-pill-select select { max-width: none; width: 100%; }
    .ui-toolbar .ui-seg { width: 100%; }
    .ui-kpis { gap: 10px; }
    .ui-kpi { padding: 12px 14px; }
    .ui-kpi__icon { width: 28px; height: 28px; }
    .ui-panel__head { padding: 14px 16px; min-height: 0; }
    .ui-panel__body { padding: 16px; }
    .ui-list__item { padding: 12px 16px; }
    .ui-toolbar { padding: 10px 12px; }
    .ui-search { flex-basis: 100%; max-width: none; }
    .ui-hero__title { font-size: 22px; }
    .ui-hero__divider { margin: 16px 0 14px; }
    .ui-step { min-width: 96px; }
    .ui-step__sub { display: none; }
}

/* ══════════════════════════════════════
   RESPONSIVE (content)
══════════════════════════════════════ */
@media (max-width: 1200px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 980px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } .search-wrap { min-width: 0; } .ui-grid.cols-2, .ui-grid.cols-3 { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } .ui-card { padding: 16px; } .ui-kpi { padding: 14px 16px; } .ui-kpi__value { font-size: 24px; } .ui-hero { padding: 20px; border-radius: var(--r-card); } .ui-form-bar { margin-inline: -16px; margin-bottom: -16px; padding: 12px 16px; } }
@media (max-width: 480px) { .page-title { font-size: 20px; } }

/* RTL details (legacy modals keep their old button side) */
.modal-footer { justify-content: flex-end; }
[dir="rtl"] .modal-footer { justify-content: flex-start; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Print: never the shell */
@media print {
    .sidebar, .sb-scrim, .topbar, .support-banner, .ui-toasts { display: none !important; }
    .app-shell { display: block; }
    .page-body { padding: 0; }
    body { background: #fff; }
}
