@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@400;500;600;700&display=swap');

/* ─── Design tokens ─────────────────────────────────────────── */
:root {
    --navy:       #0F2742;
    --navy-light: #162e4a;
    --navy-hover: #1e3a5f;
    --blue:       #2563EB;
    --blue-light: #3b82f6;
    --cyan:       #06B6D4;
    --teal:       #14B8A6;
    --green:      #22C55E;
    --purple:     #8B5CF6;
    --orange:     #F59E0B;
    --red:        #EF4444;
    --bg:         #F1F5F9;
    --surface:    #FFFFFF;
    --border:     #E2E8F0;
    --border-light: #F1F5F9;
    --text-1:     #0F2742;
    --text-2:     #475569;
    --text-3:     #94A3B8;
    --radius-sm:  8px;
    --radius-md:  14px;
    --radius-lg:  18px;
    --shadow-sm:  0 1px 3px rgba(15,39,66,.05), 0 1px 2px rgba(15,39,66,.04);
    --shadow-md:  0 4px 12px rgba(15,39,66,.08), 0 2px 4px rgba(15,39,66,.05);
    --shadow-lg:  0 12px 32px rgba(15,39,66,.12), 0 4px 8px rgba(15,39,66,.06);
}

html, body {
    font-family: 'Inter', 'Outfit', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text-1);
    font-size: 14px;
}

/* Shared responsive strategy (2026-08-05) -- global circuit-breaker for
   page-level horizontal overflow. Deliberately on <html> only, NOT <body>:
   several components (.admin-topbar, drawer headers) use
   `position: sticky`, and setting overflow on <body> is the single most
   common way to silently break sticky positioning for its descendants.
   <html>-only overflow-x:hidden catches any stray wide element (an
   un-wrapped table, a fixed-width flex child, etc.) without that risk.
   This is a backstop, not a substitute for the per-component fixes
   (.table-responsive, .bp-strip's own overflow-x:auto, flex-wrap on
   header/filter rows) -- those remain the actual, correct handling. */
html { overflow-x: hidden; width: 100%; }

/* ─── Dark Navy Sidebar ──────────────────────────────────────── */
.main-sidebar,
.main-sidebar .sidebar {
    background: var(--navy) !important;
}
.main-sidebar .brand-link {
    background: rgba(0,0,0,.2) !important;
    border-bottom: 1px solid rgba(255,255,255,.06) !important;
    padding: 12px 16px !important;
}
.main-sidebar .brand-link:hover { background: rgba(255,255,255,.04) !important; }
.main-sidebar .brand-text {
    color: #fff !important;
    font-weight: 700;
    font-size: .95rem;
    letter-spacing: .2px;
    font-family: 'Outfit', sans-serif;
}
.main-sidebar .brand-image {
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.25) !important;
}
/* Sidebar scrollbar */
.main-sidebar .sidebar { overflow-y: auto; overflow-x: hidden; }

/* Nav items */
.nav-sidebar > .nav-item { margin: 1px 0; }
.nav-sidebar > .nav-item > .nav-link {
    color: rgba(255,255,255,.68) !important;
    border-radius: 8px;
    margin: 0 10px;
    padding: 8px 12px !important;
    font-size: .82rem;
    font-weight: 500;
    transition: all .15s ease;
    border-left: 3px solid transparent;
}
.nav-sidebar > .nav-item > .nav-link:hover {
    color: #fff !important;
    background: rgba(255,255,255,.07) !important;
    border-left-color: rgba(255,255,255,.25) !important;
}
.nav-sidebar > .nav-item > .nav-link.active,
.nav-sidebar > .nav-item.menu-open > .nav-link {
    color: #fff !important;
    background: var(--blue) !important;
    border-left-color: #7bb3ff !important;
    box-shadow: 0 2px 10px rgba(37,99,235,.35);
}
.nav-sidebar > .nav-item > .nav-link .nav-icon {
    color: rgba(255,255,255,.45) !important;
    font-size: .85rem;
    width: 20px;
}
.nav-sidebar > .nav-item > .nav-link:hover .nav-icon,
.nav-sidebar > .nav-item > .nav-link.active .nav-icon { color: #fff !important; }

/* Sub-menu tree */
.nav-sidebar .nav-treeview {
    background: rgba(0,0,0,.12) !important;
    border-radius: 8px;
    margin: 2px 10px;
}
.nav-sidebar .nav-treeview .nav-link {
    color: rgba(255,255,255,.58) !important;
    padding: 6px 10px !important;
    font-size: .79rem;
}
.nav-sidebar .nav-treeview .nav-link:hover { color: #fff !important; background: rgba(255,255,255,.06) !important; }
.nav-sidebar .nav-treeview .nav-link.active { color: #fff !important; background: rgba(37,99,235,.45) !important; }

/* Section labels */
.nav-header { color: rgba(255,255,255,.3) !important; font-size: .65rem !important; letter-spacing: .1em !important; padding: 10px 14px 4px !important; }

/* Sidebar-mini icons */
.sidebar-mini.sidebar-collapse .nav-sidebar > .nav-item > .nav-link > .nav-icon { color: rgba(255,255,255,.68) !important; }

/* ─── Top Navbar ─────────────────────────────────────────────── */
.main-header.navbar {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    min-height: 50px;
}
.main-header .nav-link, .main-header h2 { color: var(--text-1) !important; font-weight: 600; }
.main-header .brand-link { border-bottom: none !important; }

/* ─── Content area ────────────────────────────────────────────── */
.content-wrapper { background: var(--bg) !important; }
.main-footer {
    background: var(--surface) !important;
    border-top: 1px solid var(--border) !important;
    color: var(--text-2) !important;
    font-size: .78rem;
}
.main-footer a { color: var(--blue) !important; }

/* ─── Footer links ────────────────────────────────────────────── */
.mf-inner {
    display: inline-flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}
.mf-copy { white-space: nowrap; }
.mf-links {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}
.mf-link {
    color: var(--text-2) !important;
    text-decoration: none !important;
    font-size: .74rem;
    transition: color .15s;
    white-space: nowrap;
}
.mf-link:hover { color: var(--blue) !important; text-decoration: underline !important; }
.mf-sep { color: var(--text-3); font-size: .7rem; user-select: none; }

/* RTL: reverse the inner flex row */
[dir="rtl"] .mf-inner { flex-direction: row-reverse; }
[dir="rtl"] .mf-links  { flex-direction: row-reverse; }

/* Mobile: stack copyright → links → version */
@media (max-width: 576px) {
    .mf-inner { flex-direction: column; align-items: flex-start; gap: .35rem; }
    [dir="rtl"] .mf-inner { align-items: flex-end; }
    .mf-copy, .mf-link { font-size: .72rem; }
}

/* ─── Section headers ─────────────────────────────────────────── */
.ds-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    /* Top spacing separates this title from the card row above it.
       Bottom spacing gives the cards room to breathe below the label.
       Both are set here so Bootstrap utility overrides don't fight us. */
    margin: 28px 0 14px 0;
    padding: 0;
    /* Stay above cards that use transform on hover (creates new stacking context) */
    position: relative;
    z-index: 2;
}
.ds-section-accent {
    width: 4px;
    height: 20px;
    border-radius: 999px;
    flex-shrink: 0;
    align-self: center;
}
.ds-section-title {
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #334155;
    margin: 0;
    line-height: 1.4;
}
/* Cards sit below section headers in z order */
.ds-card, .kpi-v2, .channel-card {
    position: relative;
    z-index: 1;
}

/* ─── KPI Card v2 (Phase 2 polish) ───────────────────────────── */
.kpi-v2 {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.15rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: .9rem;
    min-height: 96px;
    height: 100%;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.kpi-v2:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: #d1dbe8;
}
.kpi-v2-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
/* ensure col wrapper fills card slot equally */
.col-12.col-sm-6.col-xl-3.mb-3 { display: flex; flex-direction: column; }

.kpi-v2-body { flex: 1; min-width: 0; }
.kpi-v2-label {
    font-size: .67rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-3);
    margin: 0 0 5px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kpi-v2-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-1);
    margin: 0;
    line-height: 1;
    font-family: 'Outfit', sans-serif;
    letter-spacing: -.01em;
}
.kpi-v2-sub {
    font-size: .7rem;
    color: var(--text-3);
    margin: 4px 0 0 0;
}
.kpi-v2-nodata {
    font-size: .62rem;
    background: var(--border-light);
    color: var(--text-3);
    border: 1px solid var(--border);
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
    align-self: flex-start;
    flex-shrink: 0;
}

/* ─── Channel cards ───────────────────────────────────────────── */
.channel-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: .9rem 1.1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: .8rem;
    min-height: 84px;
    height: 100%;
    transition: transform .18s ease, box-shadow .18s ease;
}
.channel-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.channel-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,.07);
}
.channel-body { flex: 1; min-width: 0; }
.channel-label {
    font-size: .67rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-3);
    margin: 0 0 4px 0;
}
.channel-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-1);
    margin: 0;
    font-family: 'Outfit', sans-serif;
    letter-spacing: -.01em;
}
.channel-pct {
    font-size: .68rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--border-light);
    color: var(--text-2);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

/* ─── Branch table (Phase 3A) ────────────────────────────────── */
/* Sticky header row (2026-09-04) -- this wrapper (formerly a bare inline
   `overflow-x:auto`) is the single scrolling ancestor for BOTH the sticky
   BRANCH column (horizontal) and the sticky header row (vertical) below --
   `position: sticky` needs a bounded, actually-scrolling container to
   stick against; without an explicit max-height + overflow-y here, this
   div would auto-grow to fit every row (no internal vertical scroll ever
   happens), and the sticky header would have nothing to stick relative to
   as the OUTER page scrolls instead. Bounding it here keeps the sticky
   header self-contained -- it never has to account for any other sticky
   element elsewhere on the page (a navbar, a filters bar), which is what
   makes this reliable on mobile. 60vh scales with viewport height on its
   own (a short phone screen naturally gets a shorter box), matching the
   `vh`-based scroll-panel convention already used elsewhere (see
   `.help-toc`'s `max-height: 34vh`). A branch count that fits within 60vh
   never shows a scrollbar at all -- no visual change for small tenants. */
.branch-table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 60vh;
}
.branch-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .8rem;
    color: var(--text-2);
}
.branch-table thead tr {
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
}
.branch-table thead th {
    padding: 9px 10px;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-1);
    white-space: nowrap;
    /* Sticky header row (2026-09-04) -- see .branch-table-wrap's comment
       above for why this needs a bounded scroll container to work. Every
       header cell here already has an explicit, opaque background from
       elsewhere in the cascade (this rule's own later `var(--navy)`
       override further down this file, the .bt-name corner cell's own
       #f8fafc, and redesign.css's `.rd-scope` purple #251B74) -- sticky
       positioning never needs a NEW background rule, only this position/
       offset/z-index. z-index:2 sits above the frozen BRANCH column's
       body cells (td.bt-name-val, z-index:1 below) so header text is
       never see-through as rows scroll underneath it. */
    position: sticky;
    top: 0;
    z-index: 2;
}
.branch-table .bt-code  { width: 60px; text-align: center; }
.branch-table .bt-name  { width: 160px; }
.branch-table .bt-seen  { width: 130px; }
.branch-table .bt-status{ width: 100px; }
.branch-table .bt-num   { width: 70px; text-align: right; }
.branch-table .bt-amt   { width: 85px; text-align: right; }
.branch-table .bt-actions { width: 90px; text-align: center; }

.branch-table tbody .bt-row {
    border-bottom: 1px solid var(--border-light);
    transition: background .12s ease;
}
.branch-table tbody .bt-row:hover { background: #f8fafc; }

.branch-table .bt-code-val  { text-align: center; color: var(--text-3); font-size: .75rem; padding: 10px; }
.branch-table .bt-name-val  { padding: 10px; }
.branch-table .bt-seen-val  { padding: 10px; font-size: .78rem; color: var(--text-3); white-space: nowrap; }

/* Sticky BRANCH column (2026-09-03) -- the table's own wrapper
   (`<div style="overflow-x:auto;">` in SalesPerBranche.razor) is the
   nearest scrolling ancestor, so `position: sticky` on this one column
   anchors correctly with no markup restructuring. BRANCH only, not
   CODE+BRANCH: `inset-inline-start: 0` lets CODE (not sticky) simply
   scroll out of view normally -- a sticky element only clamps once its
   own natural position would otherwise cross the 0 offset, so at
   scrollLeft=0 Branch sits at its normal post-Code position (unchanged),
   and only clamps to the leading edge once scrolled past Code's width;
   there is no point at any scroll offset where CODE and BRANCH would
   visually overlap. `inset-inline-start` (a logical property) resolves
   to the visually-correct leading edge automatically in both directions
   -- left in LTR, right in RTL (this table already flips to
   `direction: rtl` as a whole -- see the dir="rtl" rule further below --
   so no separate RTL positioning override is needed here).
   box-shadow (not border/border-right) provides both the crisp frozen-
   boundary divider (inset) and the soft "content scrolling beneath" cue
   (drop shadow) -- box-shadow avoids a known Safari rendering bug where
   a `border-collapse: collapse` table (this one) combined with a
   bordered sticky cell can misrender the border at the sticky boundary.
   Because box-shadow's offset is a physical (not logical) value, it
   needs an explicit RTL-mirrored override (see the [dir="rtl"] rule
   below) -- the same reason .bt-num/.bt-amt already have their own RTL
   overrides in this file. */
.branch-table th.bt-name,
.branch-table td.bt-name-val {
    position: sticky;
    inset-inline-start: 0;
    z-index: 1;
}
.branch-table th.bt-name {
    /* Frozen corner cell (2026-09-04) -- this is both column-sticky
       (inset-inline-start, from the shared rule above) AND row-sticky
       (top, inherited from .branch-table thead th's own sticky rule),
       so it must out-rank BOTH the plain sticky header cells (z-index:2)
       and the frozen column's body cells (td.bt-name-val, z-index:1) --
       otherwise the header row's other cells would paint over this
       corner as it scrolls, or this corner would paint over its OWN
       column's body cells incorrectly. z-index:3 is the top of the stack. */
    z-index: 3;
    background: #f8fafc; /* matches .branch-table thead tr's own background */
}
.branch-table td.bt-name-val {
    background: var(--surface);
    box-shadow: inset -1px 0 0 var(--border), 4px 0 6px -4px rgba(0,0,0,.15);
}
html[dir="rtl"] .branch-table td.bt-name-val {
    box-shadow: inset 1px 0 0 var(--border), -4px 0 6px -4px rgba(0,0,0,.15);
}
.branch-table tbody .bt-row:hover td.bt-name-val { background: #f8fafc; }
html[data-theme="dark"] .branch-table th.bt-name { background: #243044; }
html[data-theme="dark"] .branch-table tbody .bt-row:hover td.bt-name-val { background: #243044; }

/* Sales by Branch -- Last Seen two-line display (2026-08-03). Display
   layer only: splits the already-correctly-converted "yyyy-MM-dd HH:mm"
   string onto two lines (date, then time) for readability. Centered to
   match this column's existing convention (.bt-code-val is centered the
   same way); .last-seen-time is visually secondary (smaller, muted),
   same relationship .bt-seen-val already has to the row's primary data. */
.last-seen-value {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.35;
}
.last-seen-date {
    font-weight: 600;
    color: var(--text-2, #475569);
}
.last-seen-time {
    font-size: .72rem;
    color: var(--text-3);
}
.branch-table .bt-num-val   { padding: 10px; text-align: right; font-variant-numeric: tabular-nums; }
.branch-table .bt-amt-val   { padding: 10px; text-align: right; font-variant-numeric: tabular-nums; }
.branch-table .bt-actions-val { padding: 10px; text-align: center; }

.bt-branch-name {
    font-weight: 600;
    color: var(--text-1);
    font-size: .82rem;
}

/* Branch status badges */
.bt-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 600;
    white-space: nowrap;
}
.bt-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-online  { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.status-online  .bt-status-dot { background: #22c55e; animation: pulse-dot 2s ease-in-out infinite; }
.status-delayed { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.status-delayed .bt-status-dot { background: #f59e0b; }
.status-offline { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.status-offline .bt-status-dot { background: #ef4444; }
.status-unknown { background: #f8fafc; color: var(--text-3); border: 1px solid var(--border); }
.status-unknown .bt-status-dot { background: var(--text-3); }

/* View Details button (placeholder for Phase 3B) */
.btn-branch-detail {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--navy);
    color: #fff;
    border: 1px solid var(--navy);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: .73rem;
    font-weight: 600;
    cursor: pointer;
    opacity: 1;
    transition: all .15s ease;
    white-space: nowrap;
}
.btn-branch-detail:hover { background: var(--navy-hover); }
.btn-branch-detail:disabled { background: var(--border-light); color: var(--text-3); border-color: var(--border); cursor: not-allowed; opacity: .6; }

/* ─── Premium card shell ──────────────────────────────────────── */
.ds-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.ds-card-header {
    padding: .85rem 1.1rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
    background: var(--surface);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.ds-card-title {
    font-size: .88rem;
    font-weight: 600;
    color: var(--text-1);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 7px;
}
.ds-card-title i { font-size: .82rem; opacity: .85; }
.ds-card-body { padding: 1rem; }

/* ─── Live badge ─────────────────────────────────────────────── */
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
    border-radius: 999px;
    padding: 4px 11px;
    font-size: .73rem;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: .01em;
}
.live-dot {
    width: 6px;
    height: 6px;
    background: var(--green);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(34,197,94,.4); }
    50% { opacity: .8; transform: scale(1.25); box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}

/* Branch health badges */
.health-badge-ok   { display:inline-flex;align-items:center;gap:5px;background:#f0fdf4;color:#15803d;border:1px solid #bbf7d0;border-radius:999px;padding:3px 10px;font-size:.7rem;font-weight:600; }
.health-badge-warn { display:inline-flex;align-items:center;gap:5px;background:#fffbeb;color:#b45309;border:1px solid #fde68a;border-radius:999px;padding:3px 10px;font-size:.7rem;font-weight:600; }
.health-badge-err  { display:inline-flex;align-items:center;gap:5px;background:#fef2f2;color:#b91c1c;border:1px solid #fecaca;border-radius:999px;padding:3px 10px;font-size:.7rem;font-weight:600; }

/* ─── Filter bar ──────────────────────────────────────────────── */
.ds-filter-bar {
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    padding: .85rem 1.1rem;
    margin-bottom: 1.15rem;
}
.ds-filter-bar .form-select-sm {
    height: 34px;
    font-size: .82rem;
    border-color: var(--border);
    color: var(--text-1);
    background-color: var(--bg);
}
.ds-filter-bar .form-select-sm:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 .15rem rgba(37,99,235,.15);
}

/* ─── Export button ───────────────────────────────────────────── */
.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 7px 15px;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: .01em;
    transition: background .15s ease;
    white-space: nowrap;
    opacity: .75;
}
.btn-export:hover { background: var(--navy-hover); opacity: 1; color: #fff; }
.btn-export:disabled { cursor: not-allowed; }

/* ─── Syncfusion grid polish ──────────────────────────────────── */
.e-grid { border: none !important; }
.e-grid .e-headercell {
    background: #f8fafc !important;
    color: var(--text-1) !important;
    font-weight: 700 !important;
    font-size: .76rem !important;
    letter-spacing: .04em !important;
    border-color: var(--border) !important;
    text-transform: uppercase;
}
.e-grid .e-rowcell {
    font-size: .82rem !important;
    color: var(--text-2) !important;
    border-color: var(--border-light) !important;
}
.e-grid .e-row:hover .e-rowcell { background: #f8fafc !important; color: var(--text-1) !important; }
.e-grid .e-alt-row .e-rowcell { background: #fafbfc !important; }
.e-pager {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    font-size: .78rem !important;
    color: var(--text-2) !important;
}
.e-pager .e-currentitem { background: var(--blue) !important; color: #fff !important; border-radius: 6px !important; }
.e-pager .e-numericitem:hover { background: var(--border-light) !important; border-radius: 6px !important; }

/* ─── Chart card sizing ───────────────────────────────────────── */
.chart-canvas-wrap { width: 100%; overflow: hidden; }

/* ─── Form select global ──────────────────────────────────────── */
.form-select:focus, .form-select-sm:focus {
    border-color: var(--blue) !important;
    box-shadow: 0 0 0 .15rem rgba(37,99,235,.15) !important;
}

/* ─── Misc utility ────────────────────────────────────────────── */
.gap-2 { gap: .5rem !important; }

/* ─── Branch Details Drawer (Phase 3B) ─────────────────────── */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,39,66,.40);
    /* z-index (2026-08-19 fix) — was 900, below AdminLTE's own
       .main-header (wwwroot/dist/css/adminlte.css: z-index 1034,
       unconditional -- applies on every layout, not just layout-boxed).
       On narrow/mobile widths the top navbar can render above the drawer,
       covering the Help drawer's own header/close button whenever the
       drawer is opened while the navbar occupies that same screen
       position -- reproducible specifically via the global top-bar Help
       button (reachable mid-scroll) and not via an inline <HelpIcon>
       (opened near the top of the page, before the conflict is visible).
       Raised well above every real z-index in this app (main-header 1034,
       Bootstrap tooltip/popover ~1060-1070, SweetAlert2 ~1060) so the
       drawer -- and BranchDetailsDrawer, which shares this same class --
       always renders as the true top-most layer, matching its own
       role="dialog" aria-modal="true" semantics. Deliberately NOT jumping
       to AdminLTE's unused 9999/10000/100000 values, which only ever
       apply under layout classes (.layout-boxed, .maximized-card) this
       app never sets. */
    z-index: 1200;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}
.drawer-overlay.open { opacity: 1; pointer-events: all; }

.drawer-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(520px, 100vw);
    background: var(--surface);
    box-shadow: -4px 0 32px rgba(15,39,66,.16);
    z-index: 1201;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
}
.drawer-panel.open { transform: translateX(0); }

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .9rem 1.1rem;
    background: var(--navy);
    border-bottom: 1px solid rgba(255,255,255,.14);
    flex-shrink: 0;
    gap: .75rem;
}
.drawer-title {
    font-size: .95rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    font-family: 'Outfit', sans-serif;
}
.drawer-close {
    appearance: none;
    -webkit-appearance: none;
    width: 30px; height: 30px;
    background: rgba(255,255,255,.12);
    border: none; border-radius: 7px;
    color: #fff; font-size: 1rem; font-weight: 700;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: background .15s ease;
}
.drawer-close:hover { background: rgba(255,255,255,.22); }

.drawer-branch-strip {
    padding: .85rem 1.1rem;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
    flex-shrink: 0;
}
.drawer-kpi-pill {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 12px;
    display: inline-block;
}
.drawer-kpi-pill strong {
    display: block;
    font-size: .92rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: var(--text-1);
    line-height: 1.1;
}
.drawer-kpi-label {
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-3);
    font-weight: 600;
}

.drawer-body { flex: 1; overflow-y: auto; }

.drawer-section {
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border-light);
}
.drawer-section-title {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-3);
    margin: 0 0 .7rem 0;
}
.drawer-kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .55rem;
}

/* 2026-07-15: "Fees & Open Checks" pill row (5 pills) — Wide: balanced
   single row. Medium (<=576px, the drawer's own existing full-width
   breakpoint below): 3+2. Narrow (<=380px, small phones): 2+2+1, via
   grid auto-flow — no explicit row-splitting needed, just column count. */
.drawer-fees-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: .5rem;
    margin-top: .3rem;
}
@media (max-width: 576px) {
    .drawer-fees-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 380px) {
    .drawer-fees-grid { grid-template-columns: repeat(2, 1fr); }
}
.drawer-kpi-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .65rem .85rem;
}
.drawer-kpi-card .dkc-label {
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-3);
    margin: 0 0 4px 0;
}
.drawer-kpi-card .dkc-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-1);
    font-family: 'Outfit', sans-serif;
    margin: 0;
}

.drawer-empty {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-3);
}
.drawer-empty i { font-size: 2.5rem; opacity: .18; display: block; margin-bottom: .75rem; }

.phase3c-placeholder {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #fffbeb;
    border: 1px dashed #fde68a;
    border-radius: var(--radius-sm);
    padding: .85rem 1rem;
    font-size: .78rem;
    color: #b45309;
}
.phase3c-placeholder i { margin-top: 2px; flex-shrink: 0; }

@media (max-width: 576px) {
    .drawer-panel { width: 100vw; }
    .drawer-kpi-grid { grid-template-columns: 1fr; }
}

/* ── Interactive Customer Manual — Phase 1 (2026-08-04) ──────────────────
   Help drawer (.help-drawer-panel) reuses .drawer-overlay/.drawer-panel/
   .drawer-header/.drawer-close/.drawer-body as-is (already RTL + mobile
   aware — see the html[dir="rtl"] and @media rules for those classes).
   Everything below is new, help-specific, and uses CSS logical properties
   (inline-start/end) throughout instead of left/right so it follows the
   page's dir attribute automatically, without a duplicate RTL block. */
.help-drawer-panel { width: min(520px, 100vw); }

.help-icon-btn {
    /* Root cause (2026-08-05, mobile audit): adminlte.css (loaded after
       this file) sets `button { ... } button, [type="button"], ... {
       -webkit-appearance: button; }` as part of its Bootstrap Reboot
       normalization -- confirmed by direct inspection of
       wwwroot/dist/css/adminlte.css, which is loaded later in _Host.cshtml
       than this file, so it wins the cascade for any property this class
       doesn't itself set. This file never reset `appearance` anywhere
       (verified: zero prior occurrences), so every custom <button> here
       was subject to WebKit re-applying native OS button chrome (visible
       border/background/corner-radius, and on some WebKit versions,
       intrinsic sizing that resists flex stretch) especially on iOS
       Safari/Android Chrome -- this is what real phone screenshots showed
       as "large rectangular native browser buttons" for the contextual
       Help icons and "native unstyled buttons" for the TOC entries below.
       `appearance: none` must be set on every custom-styled <button> in
       this app's Help UI, not just the ones that "looked wrong" in
       testing, since the underlying cause applies to all of them equally. */
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    min-width: 22px;
    padding: 0;
    margin-inline-start: 6px;
    border: none;
    border-radius: 50%;
    background: rgba(139,92,246,.10);
    color: var(--purple);
    font-size: .78rem;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: background .15s ease, color .15s ease;
}
.help-icon-btn::after {
    /* Enlarges the touch target to ~40px without growing the visible icon. */
    content: "";
    position: absolute;
    inset: -9px;
}
.help-icon-btn:hover, .help-icon-btn:focus-visible {
    background: rgba(139,92,246,.22);
    color: #6d28d9;
    outline: none;
}
.help-icon-btn:focus-visible { box-shadow: 0 0 0 2px rgba(139,92,246,.35); }

.help-header-btn {
    appearance: none;
    -webkit-appearance: none;
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(139,92,246,.10);
    border: 1px solid rgba(139,92,246,.18);
    border-radius: 999px;
    padding: 6px 14px 6px 12px;
    cursor: pointer;
    color: var(--purple);
    font-family: 'Outfit', sans-serif;
    line-height: 1;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
html[dir="rtl"] .help-header-btn { padding: 6px 12px 6px 14px; }
.help-header-btn i { font-size: .85rem; }
.help-header-btn:hover, .help-header-btn:focus-visible {
    background: rgba(139,92,246,.18);
    border-color: rgba(139,92,246,.32);
    color: #6d28d9;
    outline: none;
}
.help-header-btn:focus-visible { box-shadow: 0 0 0 2px rgba(139,92,246,.28); }
.help-header-btn-label {
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .01em;
    white-space: nowrap;
}
@media (max-width: 768px) {
    .help-header-btn { padding: 7px; border-radius: 50%; }
    .help-header-btn-label { display: none; }
}

.help-drawer-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.help-search-box {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: .75rem 1.1rem;
    border-bottom: 1px solid var(--border-light);
}
.help-search-box i { color: var(--text-3); font-size: .85rem; }
.help-search-box input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .45rem .7rem;
    font-size: .82rem;
    color: var(--text-1);
    background: var(--surface);
}
.help-search-box input:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 2px rgba(139,92,246,.18);
}

.help-toc {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 34vh;
    overflow-y: auto;
    padding: .6rem .7rem;
    border-bottom: 1px solid var(--border-light);
}
.help-toc-group { display: flex; flex-direction: column; gap: 2px; }
.help-toc-group-label {
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-3);
    padding: .2rem .65rem .3rem;
}
.help-toc-item {
    /* appearance:none + explicit display:block/width:100% -- belt and
       suspenders against the same WebKit "-webkit-appearance: button"
       cascade issue as .help-icon-btn above. flex-stretch (the
       .help-toc-group parent's default align-items:stretch) should
       already give a plain <button> full width in a column flex
       container, but WebKit's un-reset native button rendering can keep
       an intrinsic/min-content width instead of honoring stretch -- this
       is the proven mechanism behind "topics wrap inline across rows"
       instead of stacking as a clean vertical list. */
    appearance: none;
    -webkit-appearance: none;
    display: block;
    width: 100%;
    text-align: start;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    padding: .48rem .65rem;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.help-toc-item:hover { background: var(--bg); }
.help-toc-item.active {
    background: rgba(139,92,246,.12);
    color: #6d28d9;
}
.help-toc-empty {
    padding: .75rem;
    font-size: .8rem;
    color: var(--text-3);
    text-align: center;
}

.help-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.1rem 1.5rem;
}
.help-content-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-1);
    font-family: 'Outfit', sans-serif;
    line-height: 1.3;
    margin: 0 0 1.1rem 0;
    padding-bottom: .7rem;
    border-bottom: 1px solid var(--border-light);
}
.help-content-field { margin-bottom: 1.15rem; }
.help-content-field:last-child { margin-bottom: 0; }
.help-content-label {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--purple);
    margin-bottom: .35rem;
}
.help-content-field p {
    margin: 0;
    font-size: .87rem;
    line-height: 1.65;
    color: var(--text-2);
}
.help-content-notes {
    background: rgba(245,158,11,.09);
    border-inline-start: 3px solid var(--orange);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: .75rem .9rem;
    margin-top: 1.3rem;
}
.help-content-notes .help-content-label { color: #b45309; }
.help-content-notes p { font-weight: 500; }
.help-content-example {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: .6rem .75rem;
}
.help-content-placeholder {
    padding: 2rem 1rem;
    text-align: center;
    font-size: .82rem;
    color: var(--text-3);
}

.help-empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-3);
}
.help-empty-state i { font-size: 2.5rem; opacity: .2; display: block; margin-bottom: .75rem; }

@media (max-width: 576px) {
    .help-drawer-panel { width: 100vw; }
    .help-toc { max-height: 28vh; }
}

/* ─── Drawer Phase 3B UX additions ─────────────────────────── */
.drawer-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 9px;
    font-size: .65rem;
    font-weight: 600;
    color: var(--text-3);
    white-space: nowrap;
    flex-shrink: 0;
}
.drawer-info-note {
    font-size: .72rem;
    color: var(--text-3);
    background: #f8fafc;
    border-left: 3px solid var(--border);
    padding: 5px 10px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 0 0 .6rem 0;
    line-height: 1.5;
}

/* Daily performance table inside drawer */
.drawer-daily-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .75rem;
    min-width: 560px;
}
.drawer-daily-table thead tr {
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
}
.drawer-daily-table thead th {
    padding: 6px 8px;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-1);
    white-space: nowrap;
    text-align: right;
}
.drawer-daily-table thead th:first-child { text-align: left; }

/* ─── Light Mode: Daily Performance table header (2026-07-15) ───
   Root cause: `.rd-scope table thead th { color:#FFFFFF !important; }`
   (redesign.css) is a bare-element selector meant for tables with a
   dark-purple thead background (branch-table, pt-table, pm-grouped-
   table) — it also matches .drawer-daily-table's plain <table>, forcing
   white text onto this table's LIGHT thead background (#f8fafc),
   making the header unreadable in Light Mode. That global rule is left
   untouched (it's what correctly keeps this same header white-on-dark
   in Dark Mode below) — this is a higher-specificity, Light-Mode-only
   override scoped to .drawer-daily-table alone. ─── */
html[data-theme="light"] .rd-scope .drawer-daily-table thead tr {
    background: #EDEAFB;
    border-bottom: 2px solid #C7C3E8;
}
html[data-theme="light"] .rd-scope .drawer-daily-table thead th {
    color: #251B74 !important;
}
.drawer-daily-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background .1s ease;
}
.drawer-daily-table tbody tr:hover { background: #f8fafc; }
.drawer-daily-table .ddt-date {
    padding: 6px 8px;
    font-weight: 600;
    color: var(--text-1);
    white-space: nowrap;
    font-size: .73rem;
}
.drawer-daily-table .ddt-num {
    padding: 6px 8px;
    text-align: right;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   Stitch-inspired UI polish — Phase 3B+ visual refinement
   All changes are CSS/layout only. No data or backend changes.
   ═══════════════════════════════════════════════════════════ */

/* ─── Dashboard page header ─────────────────────────────── */
.dash-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
}
.dash-header-left { min-width: 0; }
.dash-title {
    font-weight: 700;
    color: var(--text-1);
    font-size: 1.35rem;
    margin: 0 0 3px 0;
    font-family: 'Outfit', sans-serif;
    display: flex;
    align-items: center;
    gap: 10px;
}
.dash-title-icon {
    width: 34px;
    height: 34px;
    background: var(--navy);
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(15,39,66,.25);
}
.dash-title-icon i { color: #fff; font-size: .88rem; }
.dash-subtitle {
    font-size: .8rem;
    color: var(--text-3);
    margin: 0;
    padding-left: 44px;
    letter-spacing: .01em;
}
.dash-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.dash-session-pill {
    font-size: .74rem;
    color: var(--text-2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 11px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
}
.dash-session-pill i { color: var(--blue); font-size: .7rem; }

/* ─── Inline filter bar ─────────────────────────────────── */
.filter-bar-inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.1rem;
}
.filter-group {
    display: flex;
    align-items: center;
    gap: 7px;
}
.filter-label {
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-2);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}
.filter-label i { color: var(--blue); font-size: .7rem; }
.filter-select {
    min-width: 110px;
    max-width: 160px;
    border-radius: var(--radius-sm) !important;
    border-color: var(--border) !important;
    font-size: .82rem;
    height: 32px;
    background: var(--bg);
}
.filter-refresh {
    font-size: .72rem;
    color: var(--text-3);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    margin-left: auto;
}
.filter-refresh i { font-size: .62rem; }

/* ─── KPI card v2 — enhanced visual hierarchy ───────────── */
.kpi-v2 { gap: 1rem; }
.kpi-v2-label { color: var(--text-3); font-size: .66rem; }
.kpi-v2-value { font-size: 1.55rem; }

/* ─── Section header — more impact ─────────────────────── */
.ds-section-title {
    font-size: .75rem;
    color: #1e293b;
}
.ds-section-accent { width: 3px; }

/* ─── Sidebar — Stitch-inspired brand refinement ─────────── */
.main-sidebar .brand-link {
    padding: 10px 14px !important;
    border-bottom: 1px solid rgba(255,255,255,.07) !important;
}
.main-sidebar .brand-text {
    font-size: 1rem !important;
    letter-spacing: .3px;
}
.main-sidebar .brand-image {
    width: 32px !important;
    height: 32px !important;
    margin-right: 8px !important;
    border-radius: 8px !important;
}
.nav-sidebar > .nav-item > .nav-link {
    font-size: .81rem;
    padding: 7px 12px !important;
}

/* ─── Branch table — Stitch-like cleanliness ────────────── */
.branch-table thead th {
    padding: 8px 10px;
    font-size: .68rem;
    letter-spacing: .05em;
    background: var(--navy);
    color: rgba(255,255,255,.85);
    border-bottom: none;
    text-transform: uppercase;
}
.branch-table tbody .bt-row:first-child td { border-top: none; }
.branch-table .bt-branch-name { font-size: .85rem; }
.bt-status-badge { font-size: .72rem; }
.btn-branch-detail {
    font-size: .72rem;
    padding: 4px 11px;
    border-radius: 6px;
}

/* ─── ds-card header — cleaner title ───────────────────── */
.ds-card-header { padding: .8rem 1rem; }
.ds-card-title  { font-size: .86rem; }

/* ─── Charts — reduce extra whitespace ─────────────────── */
.ds-card-body { padding: .85rem; }

/* ─── Phase 4: Dynamic Payment Type Table ───────────────── */
.pt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
}
.pt-table thead tr {
    background: var(--navy);
    border-bottom: 2px solid var(--navy-hover);
}
.pt-table thead th {
    padding: 8px 14px;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: rgba(255,255,255,.85);
    white-space: nowrap;
}
.pt-th-site { width: 35%; }
.pt-th-type { width: 40%; }
.pt-th-amt  { width: 25%; text-align: right; }

.pt-row {
    border-bottom: 1px solid var(--border-light);
    transition: background .1s ease;
}
.pt-row:hover { background: #f8fafc; }
.pt-row:last-child { border-bottom: none; }

.pt-td-site {
    padding: 10px 14px;
    font-weight: 600;
    color: var(--text-1);
    font-size: .83rem;
}
.pt-td-type { padding: 10px 14px; }
.pt-type-badge {
    display: inline-block;
    background: var(--border-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px 10px;
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-2);
    white-space: nowrap;
}
.pt-td-amt {
    padding: 10px 14px;
    text-align: right;
    font-weight: 700;
    color: var(--text-1);
    font-variant-numeric: tabular-nums;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
}

/* ─── Best Selling Items — ranked list ──────────────────────── */
.ri-list { padding: .15rem 0; }

.ri-row {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .42rem .5rem;
    border-radius: 6px;
    transition: background .1s ease;
}
/* Hover: dark-purple tint so text stays readable in the dark redesign theme */
.ri-row:hover { background: rgba(79, 70, 229, 0.12); }

.ri-rank {
    width: 20px;
    height: 20px;
    background: var(--navy);
    color: #fff;
    border-radius: 5px;
    font-size: .62rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0;
}

.ri-name {
    width: 185px;
    font-size: .73rem;
    color: var(--text-1);
    font-weight: 500;
    line-height: 1.35;
    /* allow up to 2 lines; hard-clamp anything longer */
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    flex-shrink: 0;
    cursor: default;
}

.ri-bar-wrap {
    flex: 1;
    height: 7px;
    background: var(--border-light);
    border-radius: 999px;
    overflow: hidden;
    min-width: 40px;
}
.ri-bar {
    height: 100%;
    background: linear-gradient(to right, #2563EB, #14B8A6);
    border-radius: 999px;
    transition: width .4s cubic-bezier(.4,0,.2,1);
    min-width: 4px;
}

.ri-qty {
    font-size: .76rem;
    font-weight: 700;
    color: var(--text-1);
    font-variant-numeric: tabular-nums;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
    min-width: 40px;
    text-align: right;
    flex-shrink: 0;
}

/* 2026-09-14 — chart interactivity (hover/click select, dim). Purely
   visual: BestSellingItemsComp.razor's ToggleSelected/SetHovered only
   toggle plain fields, no I/O. .ri-row already had a :hover background
   (above); -selectable adds the pointer cursor, -selected pins that same
   highlight permanently (plus a left accent so a pinned row reads as
   "on" at a glance), -dimmed fades everything else while something is
   hovered or selected. */
.ri-row-selectable { cursor: pointer; transition: opacity .15s ease, background-color .15s ease; }
.ri-row-selected { background: rgba(79, 70, 229, 0.16); box-shadow: inset 3px 0 0 var(--navy, #251B74); }
.ri-row-dimmed { opacity: .45; }

/* 2026-09-14 (fix: select/dim alone read as "almost unchanged" in manual
   testing) — a clearly visible detail strip for the active (hovered or
   selected) item, rendered inside this same card between the header and
   the rows. Content comes from _activeItem (BestSellingItemsComp.razor's
   @code block), looked up in the already-loaded _top10 list -- no new
   data, no I/O. */
.ri-detail {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem 1rem;
    background: rgba(79, 70, 229, 0.10);
    border: 1px solid rgba(79, 70, 229, 0.25);
    border-radius: 8px;
    padding: .6rem .65rem;
    margin-bottom: .5rem;
}
/* 2026-09-14 (fix: Arabic item names visibly clipped from the bottom
   inside this strip) -- root cause: no explicit line-height, so the
   browser's font-metrics-derived "normal" line-height was used, which is
   too tight for Arabic glyphs (taller ascenders/descenders/diacritics
   than Latin text) -- combined with overflow:hidden (needed here for the
   ellipsis truncation, which clips on all four sides, not just
   horizontally), the tight line box cut straight through the bottom of
   Arabic text. Same root cause/fix as .abv-legend-name's own 2026-08-22
   comment (AreaBranchNetSalesViz.razor) -- line-height:1.6 gives the line
   box a naturally taller line so the glyph is never clipped; nothing here
   has a fixed height, so the row (no fixed height, align-items:center)
   simply grows half a line taller to fit, not "unnecessarily tall".
   English names are one line either way and read identically before/
   after -- only the box got taller, not the text. */
.ri-detail-name {
    font-size: .82rem;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.6;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ri-detail-metric { display: flex; align-items: baseline; gap: .35rem; flex-shrink: 0; }
.ri-detail-label { font-size: .68rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; }
.ri-detail-value { font-size: .82rem; font-weight: 700; color: var(--navy, #251B74); font-variant-numeric: tabular-nums; }

/* 2026-09-14 (hover flicker fix) -- .ri-detail is now ALWAYS rendered
   (never conditionally added/removed) so its box height can never
   change when hover/selection toggles; this class only swaps its
   visibility -- the exact same box keeps reserving the exact same
   space either way, so the row list below it never shifts. visibility
   (not display:none) is required here specifically because display:none
   would collapse the box back to zero height, reintroducing the same
   layout-shift bug this fix removes. */
.ri-detail-hidden { visibility: hidden; }

/* ─── Sales by Service Type — donut + breakdown ─────────────── */
.sst-container {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: .6rem .5rem;
    min-height: 0;
}

.sst-chart-wrap {
    flex-shrink: 0;
    width: 150px;
    height: 150px;
}
.sst-donut { width: 100%; height: 100%; display: block; }

.sst-breakdown { flex: 1; min-width: 0; }

.sst-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border-light);
}
.sst-row:last-child { border-bottom: none; }

.sst-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sst-name {
    /* 2026-08-13: was clipping "Delivery" to "Deliver…" — the label text
       itself was always correct (SalesByServiceTypeComp2.razor), the
       ellipsis truncation was the bug. These four labels (Dining/Delivery/
       Carryout/Car Service, or their Arabic equivalents) are short, fixed,
       known strings that always fit the available row width, so no
       truncation behavior is needed here. */
    flex: 1;
    font-size: .79rem;
    color: var(--text-1);
    font-weight: 500;
    white-space: nowrap;
}
.sst-right {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-shrink: 0;
}
.sst-amt {
    font-size: .79rem;
    font-weight: 700;
    color: var(--text-1);
    font-variant-numeric: tabular-nums;
    font-family: 'Outfit', sans-serif;
    min-width: 44px;
    text-align: right;
}
.sst-pct {
    font-size: .72rem;
    color: var(--text-3);
    min-width: 34px;
    text-align: right;
}
.sst-zero { opacity: .4; }

/* 2026-09-14 — chart interactivity (hover/click select, dim, tooltip).
   Purely visual: SalesByServiceTypeComp2.razor's ToggleSelected/
   SetHovered only toggle plain fields, no I/O. Shared between the donut
   segments (SVG <circle class="sst-seg">) and their matching breakdown
   row so a slice and its row highlight together (same seg.color key). */
.sst-seg { cursor: pointer; transition: opacity .15s ease, filter .15s ease; }
.sst-seg:hover { opacity: .85; }
.sst-seg-selected { filter: drop-shadow(0 0 2.5px rgba(37,27,116,.65)); }
.sst-seg-dimmed { opacity: .3; }
.sst-row-selectable { cursor: pointer; transition: opacity .15s ease, background-color .15s ease; border-radius: 6px; }
.sst-row-selectable:hover { background: rgba(79, 70, 229, 0.10); }
.sst-row-selected { background: rgba(79, 70, 229, 0.16); font-weight: 700; }
.sst-row-dimmed { opacity: .4; }

.sst-empty {
    font-size: .82rem;
    color: var(--text-3);
    text-align: center;
    padding: 1.5rem 0;
    margin: 0;
}

/* sst-chart-wrap center overlay additions */
.sst-chart-wrap { position: relative; }
.sst-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.sst-center-label {
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-3);
    line-height: 1;
}
.sst-center-value {
    font-size: 1.05rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: var(--text-1);
    line-height: 1.2;
    margin-top: 2px;
}

/* ─── Insight cards — Discounts & Voids per Site (Phase 5) ──── */
.ic-card { padding: .55rem .7rem; }

.ic-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .65rem;
    padding-bottom: .45rem;
    border-bottom: 1px solid var(--border-light);
}
.ic-label {
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-3);
}
.ic-total {
    font-size: 1.35rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    line-height: 1;
    color: var(--text-1);
}
.ic-total.ic-zero    { opacity: .3; }
.ic-disc-amt         { color: var(--orange); }
.ic-void-amt         { color: var(--red); }

.ic-empty {
    padding: 1rem .5rem;
    text-align: center;
    color: var(--text-3);
}
.ic-empty-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: .3rem;
    opacity: .2;
}
.ic-empty p { font-size: .79rem; margin: 0; }

/* Single-site stat layout */
.ic-stat { padding: .2rem .05rem; }
.ic-stat-name {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: .3rem;
    /* Long-name safety (2026-09-04) -- a bare block with no wrap control
       relies on the browser's default word-wrapping, which still lets an
       unbroken long Arabic/English token overflow its container instead
       of wrapping; break-word guarantees it always wraps within this
       card, same reasoning as .ic-site below. */
    overflow-wrap: break-word;
    word-break: break-word;
}
.ic-stat-val {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    line-height: 1.1;
}

/* Multi-site ranked list -- branch-label overlap fix (2026-09-04). Root
   cause: .ic-site's old single-line `white-space: nowrap` truncation
   worked geometrically, but 90px is genuinely too narrow for many real
   branch names (especially Arabic) -- names were clipped to just a few
   characters, and the tight .42rem row gap left rows reading as visually
   crowded/colliding, exactly the reported symptom. Fix: let the label
   wrap onto up to 2 lines instead of hard single-line clipping (line-
   clamp is the modern, broadly-supported way to do "wrap, but cap and
   ellipsize beyond N lines" -- Chrome/Edge/Safari/Firefox all support the
   -webkit- prefixed properties despite the name), and widen the row gap
   so a 2-line row never reads as touching its neighbor. Because .ic-list
   is a flex COLUMN, each .ic-row's own height (1 line or 2) simply pushes
   the next row down by the full gap -- rows can never overlap regardless
   of how tall any single label becomes. Width/flex-shrink/cursor and the
   bar/value layout are unchanged, so bars stay exactly as wide and
   aligned as before; the existing title="@SiteName" attribute (Discounts.
   razor/Void.razor, unchanged) remains the full-name tooltip fallback.
   RTL/LTR: no direction-specific text-align here, so this is already
   correct in both -- confirmed no separate [dir="rtl"] rule needed. */
.ic-list  { display: flex; flex-direction: column; gap: .65rem; }
.ic-row   { display: flex; align-items: center; gap: .5rem; }

/* 2026-09-14 — chart interactivity (hover/click select, dim, tooltip).
   Purely visual: Discounts.razor/Void.razor's ToggleSelected/SetHovered
   only toggle plain fields, no I/O. */
.ic-row-selectable { cursor: pointer; border-radius: 6px; transition: opacity .15s ease, background-color .15s ease; padding: .1rem .25rem; margin: -.1rem -.25rem; }
.ic-row-selectable:hover { background: rgba(79, 70, 229, 0.10); }
.ic-row-selected { background: rgba(79, 70, 229, 0.16); }
.ic-row-dimmed { opacity: .4; }

/* 2026-09-14 -- clearly visible detail strip for the active (hovered or
   selected) site, rendered inside the card between the total header and
   the rows. Content comes from _activeSite/_activeSharePct
   (Discounts.razor/Void.razor's own @{ } render block), looked up in the
   already-loaded/grouped _active list -- no new data, no I/O. Same
   shape/rationale as .ri-detail (BestSellingItemsComp.razor) and
   .bsc-ar-detail (BestSellingCategoriesComp2.razor), including
   line-height:1.6 on the name from the start this time -- Arabic
   glyphs/diacritics (taller ascenders/descenders than Latin text) are
   otherwise clipped by the browser's tight default line-height combined
   with this element's own overflow:hidden (needed for ellipsis
   truncation, which clips on all four sides, not just horizontally) --
   see .ri-detail-name's fuller comment for the full diagnosis (same bug
   class, previously found and fixed there). */
.ic-detail {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem 1rem;
    background: rgba(79, 70, 229, 0.10);
    border: 1px solid rgba(79, 70, 229, 0.25);
    border-radius: 8px;
    padding: .6rem .65rem;
    margin-bottom: .5rem;
}
.ic-detail-name {
    font-size: .82rem;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.6;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ic-detail-metric { display: flex; align-items: baseline; gap: .35rem; flex-shrink: 0; }
.ic-detail-label { font-size: .68rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; }
.ic-detail-value { font-size: .82rem; font-weight: 700; color: var(--navy, #251B74); font-variant-numeric: tabular-nums; }
/* 2026-09-14 (hover flicker fix, Discounts per Site / Voids per Site) --
   visibility, NOT display:none: the element must keep occupying its
   normal-flow box (same height) whether hidden or showing real data, or
   the row list below would shift again exactly like before this fix --
   see .ic-detail's own always-rendered markup in Discounts.razor/
   Void.razor, same pattern as .ri-detail-hidden/.bsc-ar-detail-hidden. */
.ic-detail-hidden { visibility: hidden; }

.ic-site  {
    width: 90px;
    font-size: .74rem;
    font-weight: 600;
    color: var(--text-1);
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    min-width: 0;
    cursor: default;
}
.ic-bar-wrap {
    flex: 1;
    height: 7px;
    background: var(--border-light);
    border-radius: 999px;
    overflow: hidden;
    min-width: 30px;
}
.ic-bar {
    height: 100%;
    border-radius: 999px;
    min-width: 4px;
    transition: width .4s ease;
}
.ic-bar-disc { background: linear-gradient(to right, #F59E0B, #EF4444); }
.ic-bar-void { background: linear-gradient(to right, #EF4444, #7F1D1D); }
.ic-val {
    font-size: .74rem;
    font-weight: 700;
    color: var(--text-1);
    font-variant-numeric: tabular-nums;
    min-width: 46px;
    text-align: right;
    flex-shrink: 0;
}

/* ─── Sales by Service Type — vertical layout, larger donut ─── */
/* Override previous horizontal layout.
   New: donut centered on top, breakdown list below. */
.sst-container {
    flex-direction: column !important;
    align-items: center !important;
    gap: .85rem !important;
    padding: .8rem .6rem !important;
}
.sst-chart-wrap {
    width: 230px !important;
    height: 230px !important;
    flex-shrink: 0 !important;
}
.sst-breakdown {
    width: 100% !important;
    max-width: 340px !important;
}
.sst-row {
    padding: .48rem .1rem !important;
}
/* Name: no fixed width so it can flex naturally */
.sst-name {
    width: auto !important;
    flex: 1 !important;
    font-size: .8rem !important;
}
/* Amount + % aligned cleanly */
.sst-right {
    gap: .65rem !important;
}
.sst-amt {
    font-size: .8rem !important;
    min-width: 52px !important;
}
.sst-pct {
    font-size: .74rem !important;
    min-width: 38px !important;
}
/* Slightly larger center text for the bigger donut */
.sst-center-label {
    font-size: .7rem !important;
    letter-spacing: .08em !important;
}
.sst-center-value {
    font-size: 1.3rem !important;
    margin-top: 3px !important;
}

/* 2026-09-14 -- hover/tap "detail panel" (see _activeSeg/_hasActive in
   SalesByServiceTypeComp2.razor): swaps into the same donut-center slot
   the running TOTAL normally occupies -- the single most prominent part
   of the chart -- so tapping/hovering a segment is impossible to miss.
   Sized for the actual rendered 230px donut (the "larger donut" override
   above, not the dead 150px base .sst-chart-wrap rule); 4 lines to fit
   (name/amount/orders/share%) instead of .sst-center-value's 1. */
.sst-center-active-name {
    font-size: .72rem; font-weight: 700; color: var(--text-1); line-height: 1.25;
    max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sst-center-active-value { font-size: 1.1rem; font-weight: 700; font-family: 'Outfit', sans-serif; color: var(--text-1); line-height: 1.2; margin-top: 2px; }
.sst-center-active-orders { font-size: .66rem; font-weight: 600; color: var(--text-3); line-height: 1.2; margin-top: 1px; }
.sst-center-active-pct { font-size: .66rem; font-weight: 600; color: var(--text-3); line-height: 1.2; }

/* Payment Type Breakdown Redesign */
.pm-summary-strip {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    padding: 1rem 1.25rem;
    background: var(--border-light, #f1f5f9);
    border-bottom: 1px solid var(--border, #e2e8f0);
}
.pm-sum-item {
    flex: 1;
    min-width: 150px;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    padding: .65rem .85rem;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.pm-sum-label {
    display: block;
    font-size: .68rem;
    font-weight: 600;
    line-height: 1.1;
    color: var(--text-3, #94a3b8);
    text-transform: uppercase;
    letter-spacing: .02em;
}
.pm-sum-val {
    display: block;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.15;
    color: var(--text-1, #0f2742);
    font-family: 'Outfit', sans-serif;
}
.pm-sum-val.val-cash {
    color: #16a34a;
}
.pm-sum-val.val-credit {
    color: var(--blue, #2563eb);
}
.pm-sum-val.val-other {
    color: var(--text-2, #475569);
}

.pm-table-wrapper {
    padding: 1rem 1.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.pm-grouped-table {
    width: 100%;
    border-collapse: collapse;
}
.pm-grouped-table th {
    font-size: .72rem;
    font-weight: 700;
    color: var(--text-2, #475569);
    text-transform: uppercase;
    letter-spacing: .02em;
    padding: .65rem .75rem;
    border-bottom: 2px solid var(--border, #e2e8f0);
    background: #f8fafc;
}
.pm-grouped-table td {
    font-size: .8rem;
    padding: .65rem .75rem;
    border-bottom: 1px solid var(--border-light, #f1f5f9);
    color: var(--text-2, #475569);
    vertical-align: middle;
}
.pm-grouped-table tr:hover td {
    background: #f8fafc;
}
/* Order Channel Breakdown — logo display standardization (2026-08-03).
   One fixed-size box for every channel row (uploaded logo OR fallback
   icon) so Talabat/elmenus/any future logo never shift row height or
   column alignment regardless of their uploaded image's natural
   dimensions. Reusable class, never a channel-specific selector. */
.order-channel-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.order-channel-logo-box {
    width: 90px;
    height: 32px;
    flex: 0 0 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.order-channel-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    /* Display Scale Sprint (2026-08-03) — per-channel admin-configured
       scale (50%-180%, default 100%), set inline per <img> as --logo-scale.
       Applied ONLY to the image, never to .order-channel-logo-box itself,
       so the fixed 90x32 container/row height/column alignment never
       move; the box's own overflow:hidden clips anything scaled beyond
       its bounds, so a channel can never visually grow past the fixed
       area. Never applied to .order-channel-fallback-icon. */
    transform: scale(var(--logo-scale, 1));
    transform-origin: center;
}
.order-channel-fallback-icon {
    color: var(--text-3, #94a3b8);
    font-size: 1rem;
}
.order-channel-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Order Channel Breakdown — filtered-context summary (2026-09-04). A
   compact, SEPARATE summary anchored right next to the Branch/Channel
   filter controls -- distinct from .pm-summary-strip above (TOTAL
   ORDERS/TOTAL SALES/CURRENT BUSINESS DAY, untouched, always the full
   period regardless of these two filters). Built entirely from design
   tokens (--border-light/--text-1/--text-2/--text-3) already redefined
   for dark mode elsewhere in this file, so no separate dark-mode block
   is needed here. flex-wrap handles narrow/mobile widths on its own; no
   left/right values anywhere, so RTL (html[dir="rtl"]) needs no override
   either -- gap and inherited text direction already do the right thing
   in both directions. Scoped to OrderChannelsComp.razor only -- these
   class names are not shared with any other component. */
.oc-filter-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .9rem;
    padding: .5rem .75rem;
    margin: 0 .5rem .75rem;
    background: var(--border-light);
    border-radius: var(--radius-sm, 8px);
}
.oc-filter-summary-title {
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-3);
}
.oc-filter-summary-item {
    display: flex;
    align-items: baseline;
    gap: .35rem;
}
.oc-filter-summary-label {
    font-size: .74rem;
    color: var(--text-2);
}
.oc-filter-summary-value {
    font-size: .92rem;
    font-weight: 700;
    color: var(--text-1);
    font-variant-numeric: tabular-nums;
}
/* Order Channel Breakdown — Channel aggregation + drill-down (2026-09-04).
   Replaces the old one-row-per-Branch+Channel table (which grew very
   crowded for 20+ branches, the same channel repeated once per branch)
   with one row per Channel, expandable inline to that Channel's own
   branch breakdown. Scoped to .oc-grouped-table (an additional class on
   the SAME <table class="pm-grouped-table oc-grouped-table">, never a
   change to bare .pm-grouped-table/th/td) because SalesByPaymentTypesComp
   also renders a plain (non-expandable) .pm-grouped-table and must be
   completely unaffected by this redesign. Built entirely from the design
   tokens already redefined for dark mode elsewhere in this file
   (--text-1/--text-2/--text-3/--border-light), matching .oc-filter-summary's
   own established precedent -- no separate dark-mode block is needed
   here. padding-inline-start (a logical property, not left/right) is what
   keeps the indented branch name correct in both RTL and LTR without a
   separate html[dir="rtl"] override, the same reasoning already used for
   .abv-legend-val's margin-inline-start in AreaBranchNetSalesViz.razor. */
.oc-channel-row { cursor: pointer; }
.oc-channel-row:hover td,
.oc-grouped-table tr.oc-channel-row-expanded td {
    background: var(--border-light, #f1f5f9);
}
.oc-channel-row:focus-visible { outline: 2px solid var(--blue, #2563eb); outline-offset: -2px; }
.oc-chevron-cell { width: 28px; text-align: center; padding-inline: .25rem !important; }
.oc-chevron {
    color: var(--text-3, #94a3b8);
    font-size: .72rem;
    transition: transform .15s ease;
}
.oc-branch-count { font-weight: 600; color: var(--text-2, #475569); }

/* Child branch rows -- visually indented and distinguished from the
   Channel row they belong to, per the explicit mobile-UX requirement.
   The Channel's own logo/name is deliberately NOT repeated here (only the
   branch identity + its own Orders/Sales/within-Channel Share). */
.oc-branch-row td {
    background: var(--surface, #fff);
    font-size: .78rem;
    padding-top: .5rem;
    padding-bottom: .5rem;
}
.oc-branch-row:hover td { background: var(--border-light, #f1f5f9); }
.oc-branch-name-cell {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding-inline-start: 2.25rem !important;
}
.oc-branch-indent-marker {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-3, #94a3b8);
    flex: 0 0 4px;
}
.oc-branch-code {
    display: block;
    font-size: .68rem;
    color: var(--text-3, #94a3b8);
}

/* Manual Menu Cost Mode, Phase 1A (2026-09-07) -- Cost/Gross Profit/
   Gross Margin columns. .oc-cost-unavailable is deliberately muted, never
   styled like a real (if small) number -- it must read at a glance as
   "no data", not "zero". .oc-cost-warning-icon flags a channel/branch
   whose Cost is a floor (at least one sold item has no cost set yet), a
   separate, milder signal from "unavailable" -- the figure IS real, just
   possibly understated. */
.oc-cost-unavailable {
    color: var(--text-3, #94a3b8);
    font-size: .74rem;
    font-style: italic;
}
.oc-cost-warning-icon {
    color: var(--amber, #d97706);
    font-size: .7rem;
    margin-inline-start: 4px;
}
.oc-cost-cell { white-space: nowrap; }

.pm-table-bar-wrapper {
    width: 50px;
    height: 6px;
    background: var(--border-light, #f1f5f9);
    border-radius: 3px;
    overflow: hidden;
}
.pm-table-progress-bar {
    height: 100%;
    background: var(--blue, #2563eb);
    border-radius: 3px;
}

/* ── Dark Mode: Order Channel Breakdown (2026-08-19) ─────────────────
   .pm-summary-strip/.pm-sum-item/.pm-sum-label/.pm-sum-val/.pm-grouped-table
   already lean on --surface/--border/--text-1/--text-2/--text-3 (already
   redefined for dark mode at this file's own html[data-theme="dark"] {...}
   root block) -- these targeted rules fix the remaining hardcoded light
   literals that have no token equivalent (table header/hover backgrounds,
   the summary strip's own background, the progress-bar track/fill, and
   the logo box's white patch). No channel data/logo files/calculations
   are touched -- styling only. */
html[data-theme="dark"] .pm-summary-strip {
    background: var(--bg, #0F172A);
}
html[data-theme="dark"] .pm-grouped-table th {
    background: var(--surface, #1E293B);
    color: var(--text-2, #94A3B8);
    border-bottom-color: var(--border, #334155);
}
html[data-theme="dark"] .pm-grouped-table td {
    color: var(--text-1, #E2E8F0);
    border-bottom-color: var(--border-light, #1E293B);
}
html[data-theme="dark"] .pm-grouped-table tr:hover td {
    background: rgba(255, 255, 255, .04);
}
html[data-theme="dark"] .order-channel-name {
    color: var(--text-1, #E2E8F0);
}
html[data-theme="dark"] .order-channel-fallback-icon {
    color: var(--text-2, #94A3B8);
}
/* Uploaded channel logo files are never recolored -- most carry a
   baked-in white background. Wrapping ONLY the actual-logo state (never
   the fallback icon, via :has()) in a small bordered/padded/rounded card
   makes that white patch read as an intentional "logo card" instead of a
   raw rectangle dropped on the dark row. box-sizing:border-box keeps the
   box's own 90x32 Light-Mode footprint identical -- row height/column
   alignment never move, only the image's available area shrinks slightly
   to make room for the padding/border. */
html[data-theme="dark"] .order-channel-logo-box:has(.order-channel-logo) {
    box-sizing: border-box;
    background: #fff;
    border: 1px solid var(--border, #334155);
    border-radius: 6px;
    padding: 3px 5px;
}
html[data-theme="dark"] .pm-table-bar-wrapper {
    background: rgba(255, 255, 255, .12);
}
html[data-theme="dark"] .pm-table-progress-bar {
    background: #60A5FA;
}

/* ============================================================
   PRINT / EXPORT TO PDF STYLES
   Triggered by window.print() from the Export button.
   ============================================================ */

/* ── Print-only report header (hidden on screen) ─────────── */
.print-report-header {
    display: none;
}

/* ── Utility: elements hidden in print ───────────────────── */
@media print {
    .no-print { display: none !important; }
}

@media print {

    /* ── Reset ───────────────────────────────────────────── */
    *, *::before, *::after {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    body {
        background: #fff !important;
        color: #111 !important;
        font-size: 9pt !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* ── Hide everything that is not the dashboard content ── */
    .sidebar,
    .nav-menu,
    .navbar,
    .main-nav,
    #sidebar,
    .side-nav,
    .top-bar,
    .page-header-nav,
    .no-print,
    .btn-export,
    .live-badge,
    .dash-session-pill,
    .ds-filter-bar,
    .filter-bar-inner,
    .dash-header-right,
    .branch-details-drawer,
    .modal,
    .modal-backdrop,
    .sf-spinner,
    button:not(.print-show),
    select,
    .form-select,
    .filter-refresh,
    [data-pc-name="spinner"],
    .blazored-modal,
    .spinner-border {
        display: none !important;
    }

    /* ── Main layout: remove sidebar gap ─────────────────── */
    .main-content,
    .content-wrapper,
    main,
    section {
        margin-left: 0 !important;
        padding: 0 8mm !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* ── Page setup ─────────────────────────────────────── */
    @page {
        size: A4 portrait;
        margin: 12mm 10mm 12mm 10mm;
    }

    /* ── Print-only report header ────────────────────────── */
    .print-report-header {
        display: block !important;
        margin-bottom: 8mm;
        padding-bottom: 4mm;
    }
    .print-report-logo-row {
        display: flex;
        align-items: center;
        gap: 12px;
    }
    .print-report-title {
        font-size: 16pt;
        font-weight: 800;
        color: #0f2742;
        font-family: 'Outfit', Arial, sans-serif;
        letter-spacing: -0.02em;
    }
    .print-report-meta {
        font-size: 9pt;
        color: #475569;
        margin-top: 3px;
    }
    .print-report-divider {
        border: none;
        border-top: 2px solid #0f2742;
        margin: 6px 0 0 0;
    }

    /* ── Dashboard header: keep title, hide right side ───── */
    .dash-header {
        margin-bottom: 4mm !important;
    }
    .dash-header-right {
        display: none !important;
    }
    .dash-title {
        font-size: 13pt !important;
        color: #0f2742 !important;
    }
    .dash-subtitle {
        font-size: 8pt !important;
        color: #64748b !important;
    }

    /* ── Section headers ─────────────────────────────────── */
    .ds-section-header {
        page-break-after: avoid;
        break-after: avoid;
        margin-top: 5mm !important;
        margin-bottom: 2mm !important;
    }
    .ds-section-title {
        font-size: 10pt !important;
        font-weight: 700 !important;
        color: #0f2742 !important;
    }
    .ds-section-accent {
        width: 3px !important;
        height: 14px !important;
    }

    /* ── Cards ───────────────────────────────────────────── */
    .ds-card {
        page-break-inside: avoid;
        break-inside: avoid;
        border: 1px solid #e2e8f0 !important;
        background: #fff !important;
        margin-bottom: 4mm !important;
        border-radius: 6px !important;
    }
    .ds-card-header {
        padding: 6px 10px !important;
        border-bottom: 1px solid #f1f5f9 !important;
    }
    .ds-card-title {
        font-size: 9pt !important;
        font-weight: 700 !important;
        color: #0f2742 !important;
    }

    /* ── KPI cards ───────────────────────────────────────── */
    .kpi-card,
    [class*="card1"],
    .row > div > div {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    /* ── Service channel cards ───────────────────────────── */
    .channel-card {
        page-break-inside: avoid;
        break-inside: avoid;
        border: 1px solid #e2e8f0 !important;
        background: #f8fafc !important;
        padding: 6px 10px !important;
    }
    .channel-label { font-size: 8pt !important; }
    .channel-value { font-size: 11pt !important; }
    .channel-pct   { font-size: 8pt !important; }

    /* ── Tables (general) ────────────────────────────────── */
    table {
        width: 100% !important;
        border-collapse: collapse !important;
        font-size: 8pt !important;
        page-break-inside: auto;
    }
    thead {
        display: table-header-group;
    }
    tr {
        page-break-inside: avoid;
        break-inside: avoid;
    }
    th, td {
        padding: 4px 6px !important;
        border-bottom: 1px solid #e2e8f0 !important;
        font-size: 8pt !important;
        color: #111 !important;
    }
    th {
        background: #f1f5f9 !important;
        font-weight: 700 !important;
    }

    /* ── Payment Type Breakdown table ────────────────────── */
    .pm-summary-strip {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 4px !important;
        padding: 4px 6px !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }
    .pm-sum-item {
        flex: 1;
        min-width: 100px !important;
        padding: 4px 6px !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 4px !important;
    }
    .pm-sum-label { font-size: 7pt !important; }
    .pm-sum-val   { font-size: 10pt !important; }
    .pm-table-wrapper {
        overflow: visible !important;
        padding: 4px 0 !important;
    }
    .pm-grouped-table th,
    .pm-grouped-table td {
        font-size: 8pt !important;
        padding: 3px 5px !important;
    }
    .pm-table-bar-wrapper {
        display: none !important;
    }

    /* ── Sales by Branch table ───────────────────────────── */
    .branch-table,
    .segments-table {
        font-size: 7.5pt !important;
    }
    .branch-table th,
    .branch-table td,
    .segments-table th,
    .segments-table td {
        font-size: 7.5pt !important;
        padding: 3px 4px !important;
    }
    /* Sticky header/column (2026-09-04) are screen-only conveniences for a
       scrollable on-screen box -- printing wants every row in normal flow
       across as many pages as needed, never clipped to a fixed-height
       scrollbox or pinned mid-page. */
    .branch-table-wrap {
        max-height: none !important;
        overflow: visible !important;
    }
    .branch-table th.bt-name,
    .branch-table td.bt-name-val,
    .branch-table thead th {
        position: static !important;
    }

    /* ── Best selling ranked list ────────────────────────── */
    .ranked-item {
        page-break-inside: avoid;
        break-inside: avoid;
        padding: 3px 0 !important;
    }
    .rank-bar-wrapper {
        display: none !important;
    }

    /* ── Discounts / Voids charts ────────────────────────── */
    .disc-void-section {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    /* ── Progress bars: keep colored fill visible in PDF ─── */
    .pm-table-progress-bar,
    .progress-bar,
    [class*="progress"] {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* ── Overlays / drawers ──────────────────────────────── */
    .modal-overlay,
    .drawer-overlay,
    .branch-details-drawer,
    .sf-dialog,
    [class*="overlay"],
    [class*="drawer"] {
        display: none !important;
    }

    /* ── Footer ──────────────────────────────────────────── */
    footer,
    .footer,
    .page-footer {
        display: none !important;
    }
}

/* ================================================================
   PORTAL-WIDE DEYAFA BRAND THEME
   Applies to all customer/brand portal pages via AdminLTE.
   Sidebar is handled globally in redesign.css.
   ================================================================ */

/* ── Font: Plus Jakarta Sans on portal content ── */
.content-wrapper,
.modal-content {
    font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
}

/* ── Primary action button → Deyafa yellow ── */
.btn-primary {
    background: linear-gradient(135deg, #FFD23F, #F2B705) !important;
    border-color: #F2B705 !important;
    color: #251B74 !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 12px rgba(255,210,63,.35) !important;
}
.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #F2B705, #D4A017) !important;
    border-color: #D4A017 !important;
    color: #251B74 !important;
    box-shadow: 0 4px 16px rgba(255,210,63,.50) !important;
}

/* ── Info button → Deyafa violet ── */
.btn-info {
    background: #5B5FEF !important;
    border-color: #5B5FEF !important;
    color: #fff !important;
    font-weight: 600 !important;
}
.btn-info:hover { background: #3D35B3 !important; border-color: #3D35B3 !important; }

/* ── Card headers — subtle Deyafa accent ── */
.card > .card-header {
    background: linear-gradient(135deg, #251B74 0%, #33269A 100%);
    color: #fff;
    border-bottom: 2px solid rgba(255,210,63,.45);
    font-weight: 700;
    letter-spacing: .03em;
}
.card > .card-header h3,
.card > .card-header h4,
.card > .card-header h5,
.card > .card-header .card-title {
    color: #fff !important;
    font-weight: 700 !important;
}
.card > .card-header .card-tools .btn-tool {
    color: rgba(255,255,255,.7) !important;
}
.card > .card-header .card-tools .btn-tool:hover { color: #FFD23F !important; }

/* ── Tables — dark purple header on portal tables ── */
.table thead th {
    background: #251B74 !important;
    color: #FFFFFF !important;
    font-weight: 700;
    font-size: .78rem;
    letter-spacing: .05em;
    border-color: rgba(255,255,255,.12) !important;
}
.table tbody tr:hover { background: #F4F3FF; }

/* ── Content area page title ── */
.content-header h1,
.content-header .breadcrumb-item.active {
    color: #251B74;
    font-weight: 800;
}

/* ── Modal headers ── */
.modal-header {
    background: linear-gradient(135deg, #251B74 0%, #33269A 100%);
    color: #fff;
    border-bottom: 2px solid rgba(255,210,63,.45);
}
.modal-header .modal-title { color: #fff !important; font-weight: 700; }
.modal-header .close,
.modal-header button.btn-close { color: rgba(255,255,255,.8) !important; opacity: 1; }
.modal-header .close:hover,
.modal-header button.btn-close:hover { color: #FFD23F !important; }

/* ── Input focus — Deyafa violet ring ── */
.form-control:focus,
.form-select:focus {
    border-color: #5B5FEF !important;
    box-shadow: 0 0 0 .18rem rgba(91,95,239,.20) !important;
}

/* ── Pagination ── */
.page-item.active .page-link {
    background: #251B74 !important;
    border-color: #251B74 !important;
    color: #fff !important;
}
.page-link { color: #33269A !important; }
.page-link:hover { background: #F4F3FF !important; color: #251B74 !important; }

/* ================================================================
   PORTAL PREFERENCES: SETTINGS CONTROL + DARK MODE + RTL
   Pure visual layer — no data or business logic changes.
   ================================================================ */

/* ─── Navbar Settings Control ────────────────────────────────── */
.ps-lang-item {
    display: flex !important;
    align-items: center;
    gap: 0;
    padding: 0 6px !important;
}
.ps-lang-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-2);
    padding: 4px 10px;
    font-size: .74rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1.2;
    transition: all .15s ease;
}
.ps-lang-btn:first-child { border-radius: 6px 0 0 6px; border-right: none; }
.ps-lang-btn:last-child  { border-radius: 0 6px 6px 0; }
.ps-lang-btn.ps-lang-active {
    background: #251B74;
    border-color: #251B74;
    color: #FFD23F;
}
.ps-lang-btn:hover:not(.ps-lang-active) {
    background: var(--border-light);
    color: var(--text-1);
}
.ps-theme-item {
    display: flex !important;
    align-items: center;
    padding: 0 4px !important;
}
.ps-theme-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-2);
    border-radius: 8px;
    width: 32px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .82rem;
    cursor: pointer;
    transition: all .15s ease;
}
.ps-theme-btn:hover { background: var(--border-light); color: var(--text-1); }
html[data-theme="dark"] .ps-theme-btn { color: #FFD23F; border-color: rgba(255,210,63,.5); }
html[data-theme="dark"] .ps-theme-btn:hover { background: rgba(255,210,63,.1); }

/* ─── Dark Mode: CSS variable overrides ──────────────────────── */
html[data-theme="dark"] {
    --bg:           #0F172A;
    --surface:      #1E293B;
    --border:       #334155;
    --border-light: #1E293B;
    --text-1:       #E2E8F0;
    --text-2:       #94A3B8;
    --text-3:       #64748B;
    --shadow-sm:    0 1px 3px rgba(0,0,0,.35);
    --shadow-md:    0 4px 12px rgba(0,0,0,.45);
    --shadow-lg:    0 12px 32px rgba(0,0,0,.55);
}

/* ─── Dark Mode: base elements ───────────────────────────────── */
html[data-theme="dark"] body { background: #0F172A; color: #E2E8F0; }
html[data-theme="dark"] .content-wrapper { background: #0F172A !important; }
html[data-theme="dark"] .main-header.navbar {
    background: #1E293B !important;
    border-bottom-color: #334155;
}
html[data-theme="dark"] .main-header .nav-link,
html[data-theme="dark"] .main-header h2 { color: #E2E8F0 !important; }
html[data-theme="dark"] .main-footer {
    background: #1E293B !important;
    border-top-color: #334155 !important;
    color: #94A3B8 !important;
}

/* ─── Dark Mode: AdminLTE cards ──────────────────────────────── */
html[data-theme="dark"] .card { background: #1E293B; border-color: #334155; color: #E2E8F0; }
html[data-theme="dark"] .card-body { background: #1E293B; color: #E2E8F0; }
html[data-theme="dark"] .card .card-footer { background: #182438; border-top-color: #334155; }

/* ─── Dark Mode: content-header ─────────────────────────────── */
html[data-theme="dark"] .content-header h1,
html[data-theme="dark"] .content-header .breadcrumb-item.active { color: #DAD7FF !important; }
html[data-theme="dark"] .content-header .breadcrumb-item a { color: #A5A7F7 !important; }
html[data-theme="dark"] .content-header .breadcrumb-item + .breadcrumb-item::before { color: #64748B; }

/* ─── Dark Mode: tables ──────────────────────────────────────── */
html[data-theme="dark"] .table { color: #E2E8F0; border-color: #334155; }
html[data-theme="dark"] .table-bordered td,
html[data-theme="dark"] .table-bordered th { border-color: #334155 !important; }
html[data-theme="dark"] .table tbody tr:hover { background: #243044 !important; }
html[data-theme="dark"] .table tbody td { border-color: #334155; }

/* ─── Dark Mode: branch table ────────────────────────────────── */
html[data-theme="dark"] .branch-table thead tr { background: #243044; }
html[data-theme="dark"] .branch-table tbody .bt-row:hover { background: #243044; }

/* ─── Light Mode: drawer header (2026-07-15) ────────────────────
   Explicit, high-specificity guarantee that the header keeps a
   clearly visible background, readable title, and visible icon/
   close controls in Light Mode. Values match the header's existing
   unconditional styling (unchanged in Dark Mode) — this block only
   pins the same treatment explicitly under [data-theme="light"] so
   it can never be silently lost to a lower-specificity rule. ─── */
html[data-theme="light"] .rd-scope .drawer-header {
    background: #251B74;
    border-bottom: 1px solid rgba(255,255,255,.14);
}
html[data-theme="light"] .drawer-title { color: #fff; }
html[data-theme="light"] .drawer-close { background: rgba(255,255,255,.12); color: #fff; }
html[data-theme="light"] .drawer-close:hover { background: rgba(255,255,255,.22); }

/* ─── Dark Mode: drawer ──────────────────────────────────────── */
html[data-theme="dark"] .drawer-branch-strip { background: #243044; }
html[data-theme="dark"] .drawer-kpi-card { background: #243044; }
html[data-theme="dark"] .drawer-info-note { background: #243044; border-left-color: #334155; color: #94A3B8; }
html[data-theme="dark"] .drawer-source-badge { background: #243044; }
html[data-theme="dark"] .drawer-daily-table thead tr { background: #243044; }
html[data-theme="dark"] .drawer-daily-table tbody tr:hover { background: #243044; }

/* ─── Dark Mode: Syncfusion grid ─────────────────────────────── */
html[data-theme="dark"] .e-grid .e-headercell { background: #243044 !important; color: #E2E8F0 !important; border-color: #334155 !important; }
html[data-theme="dark"] .e-grid .e-rowcell { background: #1E293B !important; color: #94A3B8 !important; border-color: #334155 !important; }
html[data-theme="dark"] .e-grid .e-row:hover .e-rowcell { background: #243044 !important; color: #E2E8F0 !important; }
html[data-theme="dark"] .e-grid .e-alt-row .e-rowcell { background: #182438 !important; }
html[data-theme="dark"] .e-pager { background: #1E293B !important; border-color: #334155 !important; color: #94A3B8 !important; }

/* ─── Dark Mode: forms ───────────────────────────────────────── */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .custom-select {
    background-color: #243044 !important;
    border-color: #334155 !important;
    color: #E2E8F0 !important;
}
html[data-theme="dark"] .form-control::placeholder { color: #64748B; }
html[data-theme="dark"] .input-group-text { background: #243044; border-color: #334155; color: #94A3B8; }

/* ─── Dark Mode: modals ──────────────────────────────────────── */
html[data-theme="dark"] .modal-content { background: #1E293B; color: #E2E8F0; border-color: #334155; }
html[data-theme="dark"] .modal-body { background: #1E293B; color: #E2E8F0; }
html[data-theme="dark"] .modal-footer { background: #1E293B; border-top-color: #334155; }

/* ─── Dark Mode: pagination ──────────────────────────────────── */
html[data-theme="dark"] .page-link { background: #1E293B !important; border-color: #334155 !important; color: #A5A7F7 !important; }
html[data-theme="dark"] .page-link:hover { background: #243044 !important; color: #DAD7FF !important; }
html[data-theme="dark"] .page-item.disabled .page-link { background: #182438 !important; color: #64748B !important; }

/* ─── Dark Mode: status & health badges ─────────────────────── */
html[data-theme="dark"] .status-online  { background: #052e16; color: #4ade80; border-color: #166534; }
html[data-theme="dark"] .status-delayed { background: #1c1008; color: #fbbf24; border-color: #92400e; }
html[data-theme="dark"] .status-offline { background: #1c0707; color: #f87171; border-color: #991b1b; }
html[data-theme="dark"] .status-unknown { background: #1e293b; color: #64748b; border-color: #334155; }
html[data-theme="dark"] .health-badge-ok   { background: #052e16; color: #4ade80; border-color: #166534; }
html[data-theme="dark"] .health-badge-warn { background: #1c1008; color: #fbbf24; border-color: #92400e; }
html[data-theme="dark"] .health-badge-err  { background: #1c0707; color: #f87171; border-color: #991b1b; }

/* ─── Dark Mode: live badge ──────────────────────────────────── */
html[data-theme="dark"] .live-badge { background: #052e16; color: #4ade80; border-color: #166534; }

/* ─── Dark Mode: rd-scope (sales dashboard) ──────────────────── */
html[data-theme="dark"] .rd-scope {
    --rd-bg:          #1a1635;
    --rd-bg-2:        #201c40;
    --rd-surface:     #252048;
    --rd-border:      #3d3878;
    --rd-border-light:#312b66;
    --rd-text-1:      #DAD7FF;
    --rd-text-2:      #b0acdc;
    --rd-text-3:      #9490C0;
    --bg:             #1a1635;
    --surface:        #252048;
    --border:         #3d3878;
    --border-light:   #312b66;
    --text-1:         #DAD7FF;
    --text-2:         #b0acdc;
    --text-3:         #9490C0;
    background: #1a1635;
}
html[data-theme="dark"] .rd-scope .rd-filter-select {
    background: #201c40 !important;
    border-color: #3d3878 !important;
    color: #DAD7FF !important;
}
html[data-theme="dark"] .rd-scope .filter-refresh { color: #9490C0; }
html[data-theme="dark"] .rd-scope .dash-session-pill { background: rgba(255,255,255,.06); color: #DAD7FF; }

/* ─── RTL: custom component adjustments ─────────────────────── */
/* Force direction:rtl on the scope so all flex containers order right-to-left.
   This replaces explicit flex-direction:row-reverse (which double-reverses when
   combined with the inherited direction:rtl from html[dir="rtl"]). */
html[dir="rtl"] .rd-scope { direction: rtl; }

/* Numbers always LTR regardless of page direction */
html[dir="rtl"] .rd-scope .kpi-v2-value,
html[dir="rtl"] .rd-scope .channel-value,
html[dir="rtl"] .rd-scope .dkc-value,
html[dir="rtl"] .rd-scope .pm-sum-val,
html[dir="rtl"] .rd-scope [style*="tabular-nums"],
html[dir="rtl"] .kpi-v2-value,
html[dir="rtl"] .channel-value,
html[dir="rtl"] .dkc-value,
html[dir="rtl"] [style*="tabular-nums"] { direction: ltr; unicode-bidi: embed; }

/* Drawer slides from left in RTL */
html[dir="rtl"] .drawer-panel { right: auto; left: 0; transform: translateX(-100%); }
html[dir="rtl"] .drawer-panel.open { transform: translateX(0); }

/* Branch table RTL alignment */
html[dir="rtl"] .branch-table .bt-num  { text-align: left; }
html[dir="rtl"] .branch-table .bt-amt  { text-align: left; }
html[dir="rtl"] .branch-table .bt-num-val,
html[dir="rtl"] .branch-table .bt-amt-val { text-align: left; direction: ltr; }

/* ── Dark mode icon overrides ────────────────────────────────── */
html[data-theme="dark"] .rd-section-icon { color: #9d99f0 !important; }
html[data-theme="dark"] .channel-icon    { filter: brightness(1.6) saturate(.7); }
/* KPI card icons use inline dark-purple colors that vanish against the dark bg.
   Override all of them to a readable light-cyan in dark mode. */
html[data-theme="dark"] .rd-scope .kpi-v2-icon {
    background: rgba(174, 235, 255, 0.10) !important;
    color: #AEEBFF !important;
}
html[data-theme="dark"] .rd-scope .kpi-v2-icon > i {
    color: #AEEBFF !important;
}

/* ── Dark mode: rd-scope card text legibility ────────────────── */
html[data-theme="dark"] .rd-scope .kpi-v2-label   { color: #a5a0d8 !important; }
html[data-theme="dark"] .rd-scope .kpi-v2-sub      { color: #9490C0 !important; }
html[data-theme="dark"] .rd-scope .kpi-v2-nodata   { color: #a5a0d8 !important; }
html[data-theme="dark"] .rd-scope .channel-label   { color: #a5a0d8 !important; }
html[data-theme="dark"] .rd-scope .ds-section-title { color: #c4beec !important; }
html[data-theme="dark"] .rd-scope .ds-card-title    { color: #DAD7FF !important; }
html[data-theme="dark"] .rd-scope .bt-branch-name   { color: #DAD7FF !important; }
html[data-theme="dark"] .rd-scope .bt-seen-val       { color: #9490C0 !important; }
/* drawer label text */
html[data-theme="dark"] .rd-scope .drawer-section-title { color: #9490C0 !important; }
html[data-theme="dark"] .rd-scope .dkc-label             { color: #a5a0d8 !important; }
html[data-theme="dark"] .rd-scope .drawer-kpi-label      { color: #9490C0 !important; }
/* small helper spans inside card headers */
html[data-theme="dark"] .rd-scope .ds-card-header > span { color: #9490C0 !important; }

/* ── Dark mode: Syncfusion chart (BestSellingCategories) ─────── */
html[data-theme="dark"] .rd-scope .e-chart,
html[data-theme="dark"] .rd-scope .e-chart-area { background: var(--rd-surface) !important; }
/* Remove white chart background rect (first SVG rect = chart background) */
html[data-theme="dark"] .rd-scope .e-chart > svg > rect:first-child,
html[data-theme="dark"] .rd-scope .e-chart .e-back-rect { fill: var(--rd-surface) !important; }
/* Plot area border transparent */
html[data-theme="dark"] .rd-scope .e-chart .e-plot-border { fill: transparent !important; stroke: var(--rd-border) !important; }
/* Axis category labels */
html[data-theme="dark"] .rd-scope .e-chart .e-axis-label,
html[data-theme="dark"] .rd-scope .e-chart text { fill: #a5a0d8 !important; }
/* Data labels inside bars */
html[data-theme="dark"] .rd-scope .e-data-label text,
html[data-theme="dark"] .rd-scope .e-chart .e-data-label { fill: #DAD7FF !important; }
/* Global Syncfusion chart fallback */
html[data-theme="dark"] .e-chart-boundary { background: transparent !important; }

/* ================================================================
   COMPREHENSIVE RTL + ARABIC TYPOGRAPHY IMPROVEMENTS
   Strategy: html[dir="rtl"] .rd-scope { direction: rtl } (set above)
   makes ALL flex-row containers order items right-to-left automatically.
   Do NOT add flex-direction:row-reverse here — it would double-reverse.
   Only absolute-position overrides, typography fixes, and number LTR
   overrides are needed below.
   ================================================================ */

/* ── RTL: KPI cards — icon moves to opposite (left) corner ─── */
html[dir="rtl"] .rd-scope .kpi-v2-icon { right: auto !important; left: 1.1rem !important; }
/* KPI label: Arabic typography — no uppercase, no letter-spacing, wraps */
html[dir="rtl"] .rd-scope .kpi-v2-label {
    text-transform: none !important;
    letter-spacing: 0 !important;
    white-space: normal;
    font-size: .78rem;
    line-height: 1.4;
    margin-top: 6px;
    margin-bottom: 10px;
}
/* KPI value stays LTR (numbers are LTR in Arabic layout) */
html[dir="rtl"] .rd-scope .kpi-v2-value { direction: ltr; unicode-bidi: isolate; }

/* ── RTL: section header accent line moves to right ─────────── */
html[dir="rtl"] .rd-scope .ds-section-header::after { left: auto; right: 0; }
html[dir="rtl"] .rd-scope .ds-section-title {
    text-transform: none !important;
    letter-spacing: 0 !important;
}

/* ── RTL: channel label — Arabic typography ──────────────────── */
html[dir="rtl"] .rd-scope .channel-label {
    text-transform: none !important;
    letter-spacing: 0 !important;
}
/* Channel pct badge moves to left corner in RTL */
html[dir="rtl"] .rd-scope .channel-pct { right: auto; left: .75rem; }
/* Progress bar starts from right edge in RTL */
html[dir="rtl"] .rd-scope .rd-channel-prog {
    right: 0; left: auto;
    border-radius: 99px 0 0 99px;
}

/* ── RTL: branch table ───────────────────────────────────────── */
html[dir="rtl"] .rd-scope .branch-table { direction: rtl; }
html[dir="rtl"] .rd-scope .branch-table thead th { text-align: right; }
html[dir="rtl"] .rd-scope .branch-table thead th.bt-num,
html[dir="rtl"] .rd-scope .branch-table thead th.bt-amt { text-align: left; }

/* ── RTL: drawer ─────────────────────────────────────────────── */
html[dir="rtl"] .rd-scope .drawer-section-title {
    text-transform: none !important;
    letter-spacing: 0 !important;
}
html[dir="rtl"] .rd-scope .dkc-label {
    text-transform: none !important;
    letter-spacing: 0 !important;
}
html[dir="rtl"] .rd-scope .drawer-kpi-label {
    text-transform: none !important;
    letter-spacing: 0 !important;
}
/* Drawer info note border flips to right side */
html[dir="rtl"] .rd-scope .drawer-info-note {
    border-left: none;
    border-right: 3px solid var(--border);
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
/* Drawer daily table headers */
html[dir="rtl"] .rd-scope .drawer-daily-table thead th { text-align: right; }
html[dir="rtl"] .rd-scope .drawer-daily-table thead th:first-child { text-align: left; }

/* ── RTL: drawer KPI grid spacing ────────────────────────────── */
html[dir="rtl"] .rd-scope .drawer-kpi-card { text-align: right; }
html[dir="rtl"] .rd-scope .drawer-branch-strip { direction: rtl; }

/* ── RTL: summary strips and payment table ───────────────────── */
html[dir="rtl"] .rd-scope .pm-summary-strip { direction: rtl; }
html[dir="rtl"] .rd-scope .pm-sum-item { text-align: right; }
html[dir="rtl"] .rd-scope .pm-sum-label { text-align: right; }
html[dir="rtl"] .rd-scope .ri-rank { margin-right: 0; margin-left: .5rem; }
html[dir="rtl"] .rd-scope .pt-table { direction: rtl; }
html[dir="rtl"] .rd-scope .pt-table thead th { text-align: right; }

/* ================================================================
   DARK MODE: prevent light hover backgrounds on cards
   (redesign.css defines light tint hovers for some nth-child cards;
   override all of them in dark mode to keep text readable)
   ================================================================ */
html[data-theme="dark"] .rd-scope .kpi-v2:hover { background: #2d2958 !important; }
html[data-theme="dark"] .rd-scope .ds-kpi-row-1 .col-12:nth-child(2) .kpi-v2:hover,
html[data-theme="dark"] .rd-scope .ds-kpi-row-1 .col-12:nth-child(4) .kpi-v2:hover,
html[data-theme="dark"] .rd-scope .ds-kpi-row-2 .col-12:nth-child(3) .kpi-v2:hover { background: #2d2958 !important; }
html[data-theme="dark"] .rd-scope .kpi-v2:hover .kpi-v2-value { color: #DAD7FF !important; }
html[data-theme="dark"] .rd-scope .kpi-v2:hover .kpi-v2-label { color: #a5a0d8 !important; }
html[data-theme="dark"] .rd-scope .channel-card:hover { background: #2d2958 !important; }
html[data-theme="dark"] .rd-scope .branch-table tbody .bt-row:hover { background: #2d2958 !important; color: #DAD7FF !important; }
html[data-theme="dark"] .rd-scope .pm-sum-item:hover { background: #252048 !important; }

/* ================================================================
   CUSTOM BAR CHART (BestSellingCategoriesComp2 — Arabic + English)
   Replaces Syncfusion for both modes: multi-color bars, LTR + RTL safe.
   ================================================================ */
.bsc-ar-chart {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 12px 16px;
    min-height: 280px;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}
.bsc-ar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
/* RTL row: label right, bar middle, qty left */
.bsc-ar-rtl .bsc-ar-row { direction: rtl; }
/* LTR row: label left, bar middle, qty right */
.bsc-ar-ltr .bsc-ar-row { direction: ltr; }

/* 2026-09-14 — chart interactivity (hover/click select, dim, tooltip).
   Purely visual: BestSellingCategoriesComp2.razor's ToggleSelected/
   SetHovered only toggle plain fields, no I/O. Only rows inside the
   foreach get "-selectable" (see the .razor file) -- the plain header
   row above them (Qty Sold column label) is untouched. */
.bsc-ar-row-selectable { cursor: pointer; border-radius: 6px; transition: opacity .15s ease, background-color .15s ease; }
.bsc-ar-row-selectable:hover { background: rgba(79, 70, 229, 0.10); }
.bsc-ar-row-selected { background: rgba(79, 70, 229, 0.16); font-weight: 700; }
.bsc-ar-row-dimmed { opacity: .4; }

/* 2026-09-14 (fix: select/dim alone read as "almost unchanged" in manual
   testing) — a clearly visible detail strip for the active (hovered or
   selected) category, rendered inside this same card between the header
   and the rows. Content comes from ActiveCategory (BestSellingCategoriesComp2.razor's
   @code block), looked up in the already-loaded DisplayCategories list --
   no new data, no I/O. Same shape as .ri-detail (BestSellingItemsComp.razor). */
.bsc-ar-detail {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem 1rem;
    background: rgba(79, 70, 229, 0.10);
    border: 1px solid rgba(79, 70, 229, 0.25);
    border-radius: 8px;
    padding: .6rem .65rem;
    margin-bottom: .5rem;
}
/* 2026-09-14 -- same Arabic-clipping fix/rationale as .ri-detail-name
   above (BestSellingItemsComp.razor) -- see that comment. */
.bsc-ar-detail-name {
    font-size: .82rem;
    font-weight: 700;
    color: var(--rd-text-1, #251B74);
    line-height: 1.6;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bsc-ar-detail-metric { display: flex; align-items: baseline; gap: .35rem; flex-shrink: 0; }
.bsc-ar-detail-label { font-size: .68rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .03em; }
.bsc-ar-detail-value { font-size: .82rem; font-weight: 700; color: var(--rd-text-1, #251B74); font-variant-numeric: tabular-nums; }

/* 2026-09-14 (hover flicker fix) -- same rationale as .ri-detail-hidden
   (BestSellingItemsComp.razor/site.css) -- .bsc-ar-detail is now ALWAYS
   rendered; this class only swaps visibility, never removes the box, so
   its reserved height never changes and the row list below it never
   shifts. visibility (not display:none) is required -- display:none
   would collapse the box back to zero height. */
.bsc-ar-detail-hidden { visibility: hidden; }

.bsc-ar-label {
    flex: 0 0 160px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--rd-text-1, #251B74);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.bsc-ar-rtl .bsc-ar-label { text-align: right; }
.bsc-ar-ltr .bsc-ar-label { text-align: left; }

.bsc-ar-bar-wrap {
    flex: 1;
    height: 20px;
    background: var(--rd-border-light, #DAD7FF);
    border-radius: 4px;
    overflow: hidden;
}
.bsc-ar-bar {
    height: 100%;
    border-radius: 4px;
    transition: width .45s cubic-bezier(.4,0,.2,1);
    min-width: 4px;
}
/* RTL: bar anchors to right edge, fills rightward */
.bsc-ar-rtl .bsc-ar-bar { float: right; }
/* LTR: bar anchors to left edge, fills leftward */
.bsc-ar-ltr .bsc-ar-bar { float: left; }

.bsc-ar-qty {
    flex: 0 0 44px;
    font-size: .82rem;
    font-weight: 700;
    color: var(--rd-text-1, #251B74);
    font-family: 'Plus Jakarta Sans', monospace;
}
.bsc-ar-rtl .bsc-ar-qty { text-align: left; }
.bsc-ar-ltr .bsc-ar-qty { text-align: right; }

/* Dark mode overrides */
.bsc-ar-dark .bsc-ar-label  { color: #DAD7FF; }
.bsc-ar-dark .bsc-ar-bar-wrap { background: #312b66; }
.bsc-ar-dark .bsc-ar-qty    { color: #DAD7FF; }
.bsc-ar-dark .bsc-ar-detail { background: rgba(91, 95, 239, 0.18); border-color: rgba(91, 95, 239, 0.4); }
.bsc-ar-dark .bsc-ar-detail-name  { color: #DAD7FF; }
.bsc-ar-dark .bsc-ar-detail-value { color: #DAD7FF; }

/* ================================================================
   ARABIC SPACING: pm-sum-item (Order Channel + Payment summary strips)
   ================================================================ */
html[dir="rtl"] .rd-scope .pm-sum-item {
    gap: 7px;
    padding: .8rem 1rem;
}
html[dir="rtl"] .rd-scope .pm-sum-label {
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-size: .76rem;
    line-height: 1.4;
    white-space: normal;
}
html[dir="rtl"] .rd-scope .pm-sum-val {
    display: block;
    line-height: 1.3;
    margin-top: 2px;
}

/* ================================================================
   ARABIC SPACING: drawer-kpi-card (Branch Details service channel cards)
   ================================================================ */
html[dir="rtl"] .rd-scope .drawer-kpi-card {
    padding: .9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
html[dir="rtl"] .rd-scope .drawer-kpi-card .dkc-label {
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-size: .74rem;
    line-height: 1.4;
    margin-bottom: 5px;
}
html[dir="rtl"] .rd-scope .drawer-kpi-card .dkc-value {
    display: block;
    line-height: 1.2;
    margin-bottom: 5px;
}
html[dir="rtl"] .rd-scope .drawer-kpi-card p {
    margin-top: 2px !important;
    margin-bottom: 0 !important;
    line-height: 1.4;
}

/* Standard Blazor Server error UI (see Pages/_Host.cshtml #blazor-error-ui)
   was missing its default-hidden rule entirely — with no display:none set
   anywhere, the "An unhandled exception has occurred" banner rendered on
   EVERY page load regardless of whether a real circuit error occurred.
   Root-caused 2026-07-16: zero server-side exceptions in Serilog and zero
   browser pageerror events across a full test session, yet the banner
   showed — confirming it was this missing base rule, not a real error.
   blazor.server.js adds/removes the "blazor-error-boundary"-style visible
   state itself when a genuine circuit error fires; this only restores the
   template's own default of starting hidden. */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

/* Mobile Responsive Lists fix (2026-07-31) — Syncfusion's SfToast
   (Shared/Alerts/Toast.razor) positions itself via fixed Top+Right
   (or Top+Left for Arabic) offsets meant for a desktop-width viewport.
   On a narrow phone viewport that same fixed offset can sit directly
   over a page's title/primary button, since there's far less horizontal
   room to separate the toast from the content below it. Global,
   unscoped, mobile-only override — affects every page that uses this
   shared Toast component, not just Areas/Currencies/Users, since the
   underlying cause (fixed corner offset never viewport-aware) is
   generic to the component, not specific to these three pages.
   !important is required: Syncfusion sets its own inline/computed
   position styles that plain selector specificity can't otherwise beat. */
@media (max-width: 767.98px) {
    .e-toast-container {
        top: 90px !important;
        left: 16px !important;
        right: 16px !important;
        width: auto !important;
        max-width: calc(100vw - 32px) !important;
    }
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
