/* Flock - design system v2 (2026-05-24; brand-aligned to Flock Red 2026-06-02)
   Flock Red primary (ITL World brand #DD4C3F), amber demoted to accent.
   BREAKPOINTS (mobile-first, min-width):
     sm = 640px   - large phones / small tablets
     md = 1024px  - tablet landscape / small desktop
     lg = 1440px  - standard desktop
   See docs/ui-overhaul-2026-05-24.html for the full design contract. */

:root {
    /* Tell the browser this page is light by default. Without this, Chrome's
       force-dark (and Dark Reader-style extensions) re-tint our hardcoded
       light surfaces — most visible on /login where the indigo heading
       renders as a washed-out violet. The dark theme block flips this to
       'dark' when html[data-theme="dark"] is set. */
    color-scheme: light;

    /* ---- Primary - Flock Red (ITL brand #DD4C3F) ---- */
    --primary-50:  #fdf3f1;
    --primary-100: #fbe4e0;
    --primary-500: #e15d4e;
    --primary-600: #dd4c3f;
    --primary-700: #b13a30;
    --primary-900: #7c2820;
    --primary-grad: linear-gradient(135deg, #b13a30 0%, #e15d4e 100%);

    /* ---- Accent - legacy amber, demoted to highlight role ---- */
    --accent-50:  #fff7ed;
    --accent-100: #fef3c7;
    --accent-500: #f59e0b;
    --accent-600: #d97706;
    --accent-700: #b45309;
    --accent-grad: linear-gradient(135deg, #b45309 0%, #d97706 100%);

    /* ---- Neutrals - Slate scale ---- */
    --slate-50:  #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-700: #334155;
    --slate-900: #0f172a;
    --slate-950: #020617;

    /* ---- Semantic ---- */
    --success: #059669;
    --warning: #d97706;
    --danger:  #dc2626;
    --info:    #0284c7;

    /* ---- Persona / role accents (kept) ---- */
    --client:   #7c3aed;
    --internal: #0f766e;

    /* ---- Surfaces + text ---- */
    --bg:         var(--slate-50);
    --surface:    #ffffff;
    --text:       var(--slate-900);
    --text-muted: var(--slate-500);
    --border:     var(--slate-200);

    /* ---- Legacy aliases (keep until per-page declarations migrate; one-release deprecation) ---- */
    --primary:        var(--primary-600);
    --primary-hover:  var(--primary-700);
    --secondary:      var(--slate-700);

    /* ---- Fluid type scale ---- */
    --fs-xs:   clamp(11px, 0.7rem  + 0.1vw, 12px);
    --fs-sm:   clamp(12px, 0.8rem  + 0.1vw, 14px);
    --fs-base: clamp(14px, 0.95rem + 0.15vw, 16px);
    --fs-lg:   clamp(16px, 1.05rem + 0.2vw, 18px);
    --fs-xl:   clamp(18px, 1.25rem + 0.3vw, 22px);
    --fs-2xl:  clamp(22px, 1.5rem  + 0.5vw, 30px);
    --fs-3xl:  clamp(28px, 1.9rem  + 1vw,   42px);

    /* ---- Spacing scale ---- */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-8: 48px;

    /* ---- Radius ---- */
    --radius-sm: 4px;
    --radius:    8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* ---- Shadows ---- */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow:    0 2px 6px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.12);
    --shadow-xl: 0 16px 40px rgba(15, 23, 42, 0.18);

    /* ---- Motion ---- */
    --t-fast:    120ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-medium:  200ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-slow:    320ms cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html {
    /* Mobile/PWA chrome resets - cumulative impact is "feels like a real app". */
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: contain;
}
body {
    font-family: Calibri, 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: var(--fs-base);
    line-height: 1.5;
    /* Notched / Dynamic Island devices - shell respects safe areas. */
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
             env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Body scroll-lock applied via JS when mobile drawer / filter sheet is open. */
body.no-scroll { overflow: hidden; }

h1 { font-size: var(--fs-2xl); margin: 0 0 var(--space-4); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: var(--fs-xl);  margin: 0 0 var(--space-3); font-weight: 600; }
h3 { font-size: var(--fs-lg);  margin: 0 0 var(--space-2); font-weight: 600; }
p  { margin: 0 0 var(--space-3); }

/* Focus-visible: tight 2px primary ring, drop the default browser blur ring. */
:focus { outline: none; }
:focus-visible {
    outline: 2px solid var(--primary-600);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

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

/* Disable hover styles on touch devices (cleaner mobile UX). */
@media (hover: none) {
    *:hover { transition: none !important; }
}

/* ------------------ Skeleton / shimmer loaders (CLS elimination) ------------------ */
.skeleton {
    background: linear-gradient(90deg,
        var(--slate-100) 0%,
        var(--slate-200) 50%,
        var(--slate-100) 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s linear infinite;
    border-radius: var(--radius);
    display: block;
}
.skeleton-tile   { height: 88px;  margin-bottom: var(--space-2); }
.skeleton-row    { height: 28px;  margin: 6px 0; }
.skeleton-chart  { height: 260px; }
.skeleton-text   { height: 16px;  width: 80%; }
.skeleton-text-lg{ height: 32px;  width: 60%; }
.skeleton-circle { border-radius: 50%; width: 48px; height: 48px; }
.skeleton-grid {
    display: grid;
    gap: var(--space-3);
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
@keyframes skeleton-shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
    .skeleton { animation: none; opacity: 0.6; }
}

/* ------------------ Touch-target hygiene (WCAG AA: 44x44) ------------------ */
@media (hover: none) and (pointer: coarse) {
    button, a, [role="button"],
    input[type="checkbox"], input[type="radio"],
    select, .ms-item, .nav-link, .btn {
        min-height: 44px;
    }
}

/* ------------------ Layout ------------------ */
/* ------------------ Shell (mobile-first) ------------------
   Mobile baseline:
     - Sidebar slides over content from the left (transform-based).
     - Backdrop dims the content + tap-to-close.
     - Top bar is the mobile chrome (hamburger + brand + status badge).
     - Bottom bar is a 5-item nav strip pinned to viewport bottom.
   Tablet (>= 640): keep mobile bottom bar hidden, sidebar still
     transform-overlay (room for content).
   Desktop (>= 1024): sidebar becomes static grid column; bottom bar
     hidden; mobile topbar hidden.
*/
.page {
    display: block;
    min-height: 100vh;
}
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;            /* top:0 right:auto bottom:0 left:0 */
    width: min(86vw, 320px);
    z-index: 1000;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: var(--space-4) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom));
    transform: translateX(-100%);
    transition: transform var(--t-medium);
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    -webkit-overflow-scrolling: touch;
}
body.has-sidebar-open .sidebar { transform: translateX(0); }
.sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0; pointer-events: none;
    transition: opacity var(--t-medium);
    z-index: 999;
}
body.has-sidebar-open .sidebar-backdrop {
    opacity: 1; pointer-events: auto;
}
.content {
    /* Mobile: clear the fixed .mobile-topbar (56px) plus any notch / status-bar
       inset. We previously added an extra --space-3 here which read on Android
       and standalone PWAs as a bare strip under the topbar. The page's own h1
       margin gives whatever breathing room it needs. */
    padding: calc(60px + env(safe-area-inset-top, 0px)) var(--space-3) calc(72px + env(safe-area-inset-bottom));
    /* Fill the available column on normal screens; only cap (and centre) on
       ultra-wide monitors so a 1080p/1440p screen no longer shows a big empty
       gap between the rail and the content. 1920px > the content column on
       any <= ~2200px-wide screen, so the content fills edge-to-edge there. */
    max-width: 1920px;
    margin: 0 auto;
}
/* Pages sometimes lead with a Razor comment / whitespace text node before
   their first heading. Reset the heading's default browser margin so the
   page title sits flush against the topbar without a phantom gap. */
.content > h1:first-child,
.content > h2:first-child,
.content > .back-to-dashboard + h1,
.content > .back-to-dashboard + h2 { margin-top: 0; }

/* Mobile topbar (hidden on >= 1024 via media query at bottom of this section). */
.mobile-topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 900;
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    padding-top: calc(var(--space-2) + env(safe-area-inset-top));
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    min-height: 56px;
}
.mobile-hamburger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px;
    border: 0; background: transparent; cursor: pointer; color: var(--slate-700);
    border-radius: var(--radius);
    transition: background var(--t-fast), color var(--t-fast);
}
.mobile-hamburger:hover, .mobile-hamburger:focus-visible {
    background: var(--primary-50); color: var(--primary-700);
}
.mobile-brand {
    display: flex; align-items: center; gap: var(--space-2);
    color: var(--primary-700); font-weight: 700; font-size: var(--fs-lg);
    letter-spacing: -0.01em;
}
.mobile-topbar-actions {
    margin-left: auto;
    display: flex; align-items: center; gap: var(--space-2);
}

/* Bottom-bar (mobile only). */
.mobile-bottom-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 900;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.06);
}
.mbb-link {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px;
    padding: var(--space-2) 0;
    min-height: 56px;
    color: var(--slate-500);
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
    background: transparent; border: 0; cursor: pointer;
    transition: color var(--t-fast), background var(--t-fast);
}
.mbb-link:hover, .mbb-link:focus-visible { color: var(--primary-700); background: var(--primary-50); }
.mbb-link.active { color: var(--primary-700); }
.mbb-link.active::before {
    content: ""; position: absolute; top: 0; height: 3px;
    width: 28px; background: var(--primary-600); border-radius: 0 0 var(--radius) var(--radius);
}
.mbb-link { position: relative; }
.mbb-icon { display: inline-flex; width: 22px; height: 22px; }
.mbb-label { font-size: 10px; letter-spacing: 0.02em; }
@media (orientation: landscape) and (max-height: 480px) {
    .mobile-bottom-bar { display: none; }    /* landscape phones - reclaim viewport */
    .content { padding-bottom: var(--space-3); }
}

/* Hide mobile chrome on tablet+ and turn sidebar into a static rail. */
@media (min-width: 1024px) {
    .mobile-topbar, .mobile-bottom-bar, .sidebar-backdrop { display: none; }
    .page {
        display: grid;
        grid-template-columns: clamp(240px, 18vw, 280px) 1fr;
    }
    .sidebar {
        position: sticky;
        top: 0; left: 0;
        height: 100vh;
        transform: none;
        box-shadow: none;
        width: auto;
        padding: var(--space-5) var(--space-4);
    }
    .content {
        padding: var(--space-5) var(--space-5) var(--space-6);
    }
    body.has-sidebar-open .sidebar-backdrop { display: none; }   /* belt and braces */
}

.brand {
    margin-bottom: var(--space-5);
    padding: var(--space-3);
    background: var(--primary-grad);
    border-radius: var(--radius);
    color: #fff;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    box-shadow: var(--shadow);
}
.brand-monogram {
    width: 36px; height: 36px;
    border-radius: 4px;
    background: #fff;
    color: var(--primary);
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    flex: 0 0 36px;
    font-family: Calibri, 'Segoe UI', sans-serif;
}
/* Flock logo — V-formation of birds, lives in the sidebar wordmark. */
.brand-logo {
    width: 40px; height: 40px;
    border-radius: 8px;
    background: #fff;
    color: var(--primary);
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 40px;
}
.brand-logo svg { display: block; }
.brand strong { display: block; font-size: 16px; color: #fff; letter-spacing: 0.5px; }

/* Legacy rules removed 2026-05-26 (per audit):
   - .brand-sub / .user-card / .user-name / .user-meta / .user-parent:
     identity card moved to top-banner avatar dropdown.
   - Duplicate .nav-section / .nav-link / .nav-link-feature:
     live rules live in the Sidebar v3 block near line 2150-2270. */

.badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.badge-client { background: #ede9fe; color: var(--client); }
.badge-internal { background: #ccfbf1; color: var(--internal); }
.badge-role { background: var(--border); color: var(--text-muted); }
.badge-ok { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-error { background: #fee2e2; color: #991b1b; }
.nav-tag-pending {
    display: inline-block; margin-left: 6px;
    background: #fde68a; color: #78350f;
    padding: 1px 6px; border-radius: 8px;
    font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}
.hero-card { background: linear-gradient(135deg, #8f2c23 0%, #e15d4e 100%); color: #fff; padding: 28px; border-radius: 8px; margin: 16px 0 24px 0; }
.hero-card h2 { margin: 0 0 8px 0; color: #fff; }
.hero-card p { margin: 0 0 16px 0; color: #fbe4e0; }
.hero-card-alt { background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%); }
.hero-card-alt p { color: #ccfbf1; }
.hero-card-hotel { background: linear-gradient(135deg, #7c2d12 0%, #ea580c 100%); }
.hero-card-hotel p { color: #fed7aa; }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin: 16px 0 24px 0; }
.hero-grid .hero-card { margin: 0; }
@media (max-width: 1200px) { .hero-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px)  { .hero-grid { grid-template-columns: 1fr; } }

/* Heatmap / margin cells */
.cell-low  { background: #fee2e2 !important; color: #991b1b !important; font-weight: 600; }
.cell-high { background: #dcfce7 !important; color: #166534 !important; font-weight: 600; }

/* ---- Hotel BI dashboard: sticky filter bar + tab strip ---- */
.hotel-bi-filter-bar {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--surface);
    padding: 12px 16px;
    margin: 0 -8px 16px -8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}
/* Rounded "pill" tabs — aligned with the Executive Insights menu
   (.exec-tab) for a consistent look & feel across modules. */
.hotel-bi-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-bottom: 1px solid var(--border);
    margin: 18px 0 16px;
    padding: 0 0 10px;
}
.hbi-tab {
    appearance: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: color .12s, border-color .12s, background .12s, transform .12s, box-shadow .12s;
}
.hbi-tab:hover { color: var(--text); background: var(--surface-2); }
.hbi-tab.active {
    color: #fff;
    background: var(--primary);
    border-color: transparent;
    font-weight: 600;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}
.hbi-tab-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px; height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
}
.hbi-tab.active .hbi-tab-num { background: rgba(255, 255, 255, 0.25); color: #fff; }
.hbi-tab-chat {
    margin-left: auto;
    color: var(--primary);
    border-color: var(--primary);
    background: var(--surface);
    font-weight: 600;
}
.hbi-tab-chat:hover { background: #eff6ff; }
.hotel-bi-tabpanel { min-height: 200px; }

/* ---- Hotel BI dashboard: main + field-panel side-by-side layout ---- */
.hbi-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 20px;
}
.hbi-dashboard-main { min-width: 0; }
.hbi-field-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 12px;
    position: sticky;
    top: 70px;
    align-self: start;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    font-size: 13px;
}
.hbi-field-panel h3 { margin: 0 0 4px; font-size: 13px; }
.hbi-field-help { margin: 0 0 12px; font-size: 11px; }
.hbi-field-section { margin-bottom: 14px; }
.hbi-field-section-label {
    font-size: 10px; font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin: 0 0 4px 0;
}
.hbi-field {
    appearance: none;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px 8px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    color: var(--text);
    font: inherit;
    font-size: 12px;
    transition: background .1s, border-color .1s;
}
.hbi-field:hover:not(:disabled) {
    background: #fdf3f1;
    border-color: var(--primary);
}
.hbi-field:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.hbi-field-measure {
    cursor: default;
    color: var(--text-muted);
}
.hbi-field-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px;
    border-radius: 3px;
    background: var(--border);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
}
.hbi-field-popover {
    margin-top: 12px;
    padding: 10px;
    background: #fffbeb;
    border: 1px solid #f59e0b;
    border-radius: 5px;
}
.hbi-field-popover-title {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 12px;
}
.hbi-field-popover input {
    width: 100%;
    padding: 6px 8px;
    font: inherit;
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 8px;
}
.hbi-field-popover-actions { display: flex; gap: 6px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ---- Chip row ---- */
.hbi-chip-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    background: #f9fafb;
    border: 1px dashed var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    margin: 0 0 12px;
}
.hbi-chip-row-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 4px;
}
.hbi-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: 999px;
    padding: 3px 6px 3px 10px;
    font-size: 12px;
}
.hbi-chip strong { font-weight: 600; }
.hbi-chip-close {
    appearance: none;
    background: transparent;
    border: 0;
    color: var(--primary);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
.hbi-chip-clear { margin-left: auto; }

.hbi-loaded-marker {
    font-size: 11px;
    color: var(--text-muted);
    margin: -6px 0 8px;
}

@media (max-width: 1100px) {
    .hbi-dashboard-grid { grid-template-columns: 1fr; }
    .hbi-field-panel { position: static; max-height: none; }
}

.chat-snapshot-banner {
    background: #ecfeff;
    border: 1px solid #0e7490;
    color: #155e75;
    padding: 8px 12px;
    border-radius: 5px;
    margin: 8px 0;
    font-size: 13px;
}
.chat-snapshot-banner-warn {
    background: #fef3c7;
    border-color: #b45309;
    color: #92400e;
}
.chat-snapshot-banner a { color: inherit; text-decoration: underline; }

.hbi-currency-hint {
    margin-left: auto;
    align-self: center;
    font-size: 12px;
    color: var(--text-muted);
    background: #f1f5f9;
    border-radius: 999px;
    padding: 4px 10px;
}
.hbi-currency-hint strong { color: var(--primary); }

/* Classification tags */
.tag-direct   { background: #dcfce7; color: #166534; }
.tag-bedbank  { background: #fef3c7; color: #92400e; }
.tag-unknown  { background: #e5e7eb; color: #374151; }
.alert-info { background: #dbeafe; color: #8f2c23; padding: 10px; border-radius: 4px; border: 1px solid #93c5fd; }
.alert-warn { background: #fef3c7; color: #92400e; padding: 10px; border-radius: 4px; border: 1px solid #fde68a; }
.btn-lg { padding: 12px 24px; font-size: 16px; }

/* ------------------ Chat page ------------------ */
.chat-page {
    display: flex; flex-direction: column; gap: 12px;
    /* Claim from the top of the content frame down to the viewport floor
       minus the MainLayout top bar. min-height (not height) lets the
       composer stay on screen on tall monitors while still giving the
       thread the rest of the viewport. */
    min-height: calc(100vh - 96px);
    height: calc(100vh - 96px);
}
.chat-header { flex-shrink: 0; }
/* Scope card: small chip row right under the heading so users see who they
   are to the AI (role, tenant, currency, active filters) at a glance. */
.chat-scope-card {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    margin-top: 8px; padding: 8px 10px;
    background: linear-gradient(135deg, #fff7ed, #fef3c7);
    border: 1px solid #fde68a; border-radius: 6px;
    font-size: 12px; color: #7c2d12;
}
.chat-scope-chip {
    background: #fff; border: 1px solid #fcd34d; border-radius: 12px;
    padding: 2px 9px; line-height: 1.5;
}
.chat-scope-chip strong { color: #b45309; font-weight: 700; }
.chat-scope-chip-role     { background: #fef3c7; border-color: #f59e0b; }
.chat-scope-chip-tenant   { background: #dcfce7; border-color: #86efac; color: #14532d; }
.chat-scope-chip-tenant strong { color: #166534; }
.chat-scope-chip-internal { background: #dbeafe; border-color: #93c5fd; color: #8f2c23; }
.chat-scope-chip-internal strong { color: #b13a30; }
.chat-scope-chip-currency { background: #ede9fe; border-color: #c4b5fd; color: #4c1d95; }
.chat-scope-chip-currency strong { color: #5b21b6; }
.chat-scope-chip-date     { background: #fee2e2; border-color: #fca5a5; color: #7f1d1d; }
.chat-scope-chip-date strong { color: #991b1b; }
.chat-scope-edit {
    margin-left: auto; font-size: 11px; color: #b45309;
    text-decoration: underline; cursor: pointer;
}
.chat-scope-edit:hover { color: #7c2d12; }
.chat-header h1 { margin: 0; }
.chat-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.chat-module-selector { display: flex; align-items: center; gap: 6px; }
.chat-module-selector label { font-size: 12px; }
.chat-module-selector select { padding: var(--space-2) var(--space-3); font-size: var(--fs-sm); border: 1px solid var(--slate-300); border-radius: var(--radius-sm); background: white; min-height: 36px; }
.chat-stub-banner {
    background: #fef3c7; border: 1px solid #fde68a; padding: 8px 12px;
    border-radius: 4px; font-size: 12px; color: #78350f; margin-top: 8px;
}
.chat-suggestions {
    display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
}
.chat-chip {
    background: #eff6ff; border: 1px solid #bfdbfe; color: #8f2c23;
    padding: 4px 10px; border-radius: 16px; font-size: 12px;
    cursor: pointer; transition: background 0.15s ease;
}
.chat-chip:hover:not(:disabled) { background: #dbeafe; }
.chat-chip:disabled { opacity: 0.55; cursor: not-allowed; }
.chat-thread {
    flex: 1; overflow-y: auto; padding: 12px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
    display: flex; flex-direction: column; gap: 14px;
}
.chat-turn { display: flex; }
.chat-turn-user { justify-content: flex-end; }
.chat-turn-assistant { justify-content: flex-start; }
.chat-bubble {
    max-width: 80%; padding: 10px 14px; border-radius: 14px;
    background: var(--bg); border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.chat-turn-assistant .chat-bubble { border-bottom-left-radius: 4px; }
.chat-turn-user .chat-bubble { border-bottom-right-radius: 4px; }
.chat-turn-user .chat-bubble { background: var(--primary); color: #fff; border-color: var(--primary); }
.chat-turn-user .chat-role, .chat-turn-user .chat-text { color: #fff; }
.chat-role { font-size: 11px; font-weight: 600; opacity: 0.7; margin-bottom: 4px; }
.chat-text { white-space: pre-wrap; line-height: 1.5; }
.chat-intent { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.chat-intent small { color: var(--text-muted); font-family: monospace; font-size: 11px; }
.chat-chart { max-width: 100%; margin-top: 12px; border-radius: 4px; display: block; }
.chat-table { margin-top: 12px; font-size: 12px; width: 100%; border-collapse: collapse; }
.chat-table th, .chat-table td { padding: 6px 10px; border-bottom: 1px solid #eef0f4; vertical-align: top; }
.chat-table th { text-align: left; font-weight: 600; color: var(--slate-700); background: var(--surface-muted, #f7f8fb); }
.chat-table td.num, .chat-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chat-table tbody tr:hover { background: #fafbff; }

/* ---- Split-by-organisation panes (ChatResponse.Panes side-by-side) ---- */
.chat-panes { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 12px; margin-top: 12px; }
.chat-pane { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; }
.chat-pane-title { font-weight: 600; color: #DD4C3F; margin-bottom: 8px; }
.chat-pane-img { max-width: 100%; height: auto; border-radius: 4px; }
.chat-pane-rollup { margin-top: 12px; }
.chat-pane-rollup > summary { cursor: pointer; color: #6b7280; }

/* ---- Wave-2 chat-pane polish: comparative chart + per-pane delta/spark/empty ---- */
.chat-pane-comparative { background:#fff; border:1px solid #e5e7eb; border-radius:8px; padding:12px; margin-bottom:12px; }
.chat-pane-comparative-title { font-weight:600; color:#6b7280; margin-bottom:8px; }
.chat-pane-header { display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:8px; }
.chat-pane-delta { font-size:11px; padding:2px 8px; border-radius:999px; }
.chat-pane-delta-pos { background:#dcfce7; color:#166534; }
.chat-pane-delta-neg { background:#fee2e2; color:#991b1b; }
.chat-pane-spark { width:100%; height:20px; margin-bottom:8px; opacity:.85; }
.chat-pane-empty { color:#6b7280; font-style:italic; padding:24px 0; text-align:center; }

.chat-bubble-thinking { display: flex; gap: 4px; align-items: center; padding: 16px; }
.chat-thinking-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted);
    animation: chat-bounce 1.2s infinite ease-in-out;
}
.chat-thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-thinking-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes chat-bounce {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* ---- V-formation thinking indicator (ChatThinkingFlock.razor) ---- */
.chat-flock {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--primary, #b13a30);
}
.chat-flock-svg { overflow: visible; }
.chat-flock-label {
    font-size: 12px; color: var(--text-muted, #64748b); font-style: italic;
}
.chat-flock-bird { opacity: 0.55; }
@media (prefers-reduced-motion: no-preference) {
    .chat-flock-bird {
        animation: flock-fade 2.2s ease-in-out infinite,
                   flock-glide 2.6s ease-in-out infinite alternate;
        transform-origin: center;
    }
    .chat-flock-bird-1 { animation-delay: 0s,   0s;   }
    .chat-flock-bird-2 { animation-delay: 0.25s, 0.2s; }
    .chat-flock-bird-3 { animation-delay: 0.5s, 0.4s; }
}
@keyframes flock-fade {
    0%, 100% { opacity: 0.35; }
    50%      { opacity: 1; }
}
@keyframes flock-glide {
    0%   { transform: translateX(-4px) translateY(1px); }
    100% { transform: translateX(4px)  translateY(-1px); }
}

.chat-toolbar {
    margin-top: 10px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
    font-size: 12px; color: var(--text-muted);
}
.chat-toolbar-toggle { flex-direction: row !important; gap: 6px !important; align-items: center; }
.chat-toolbar-toggle input { margin: 0; }
.chat-toolbar-toggle span { color: var(--text-muted); }
.chat-voice-error { color: var(--danger); font-size: 12px; }

.chat-followups {
    margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border);
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.chat-followups-label { font-size: 11px; color: var(--text-muted); font-weight: 600; margin-right: 4px; }
.chat-followup-chip {
    background: #f1f5f9; border: 1px solid #cbd5e1; color: #1e293b;
    padding: 6px 12px; border-radius: 18px; font-size: 12px; cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}
.chat-followup-chip:hover:not(:disabled) { background: #dbeafe; border-color: #93c5fd; }
.chat-followup-chip:active:not(:disabled) { transform: translateY(1px); }
.chat-followup-chip:disabled { opacity: 0.55; cursor: not-allowed; }

.chat-composer { flex-shrink: 0; display: flex; gap: 6px; align-items: center; }
.chat-composer-sticky {
    position: sticky; bottom: 0; padding: 6px 0; background: var(--bg);
    border-top: 1px solid var(--border);
}

/* ---- Chat filter typeahead (under composer) ----
   Shown when the last typed word matches a Primary dimension value.
   Click a hint to replace the partial word with the canonical label. */
.chat-filter-hints {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    padding: 6px 8px; background: #f0f9ff; border: 1px solid #bae6fd;
    border-radius: 6px; margin-top: 4px; font-size: 12px;
}
.chat-filter-hints-label { color: #0c4a6e; font-weight: 600; font-size: 11px; }
.chat-filter-hint {
    background: white; border: 1px solid #7dd3fc; color: #0c4a6e;
    padding: 4px 10px; border-radius: 14px; cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px; line-height: 1.2;
    transition: background 0.12s ease;
}
.chat-filter-hint:hover { background: #e0f2fe; }
.chat-filter-hint-dim { font-size: 10px; opacity: 0.75; text-transform: uppercase; letter-spacing: 0.04em; }
.chat-filter-hint-val { font-weight: 600; }
.chat-filter-hint-dismiss {
    margin-left: auto; background: transparent; border: none; color: #64748b;
    font-size: 16px; line-height: 1; cursor: pointer; padding: 2px 6px;
}
.chat-filter-hint-dismiss:hover { color: #0f172a; }
.chat-mic {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--surface); border: 1px solid var(--border);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; position: relative; flex-shrink: 0;
    color: #4b5563;
}
.chat-mic-svg { display: block; width: 18px; height: 18px; }
.chat-mic-active .chat-mic-svg { color: var(--danger); }
.chat-mic:hover:not(:disabled) { background: #fbe4e0; }
.chat-mic:disabled { opacity: 0.4; cursor: not-allowed; }
.chat-mic-active {
    background: #fee2e2; border-color: var(--danger); color: var(--danger);
    animation: chat-mic-pulse 1.2s infinite;
}
.chat-mic-pulse {
    position: absolute; inset: -3px; border: 2px solid var(--danger);
    border-radius: 50%; opacity: 0.45; pointer-events: none;
}
@keyframes chat-mic-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
    70%  { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* ---- Mobile: tighten the chat surface, stretch composer to bottom ---- */
@media (max-width: 700px) {
    .chat-page-responsive { height: calc(100vh - 80px); gap: 8px; }
    .chat-header h1 { font-size: 20px; }
    .chat-header p { font-size: 12px; }
    .chat-bubble { max-width: 95%; padding: 10px 12px; }
    .chat-thread { padding: 8px; gap: 10px; }
    .chat-table { font-size: 11px; }
    .chat-table th, .chat-table td { padding: 3px 5px; }
    .chat-followup-chip { padding: 8px 12px; font-size: 13px; } /* bigger touch target */
    .chat-composer { flex-wrap: wrap; }
    .chat-composer .chat-input {
        flex: 1 1 100%; order: 0; font-size: 16px; /* 16px = no iOS auto-zoom */
    }
    .chat-composer .chat-mic { order: 1; }
    .chat-composer .btn { order: 2; flex: 1; }
    .chat-composer .btn-link { order: 3; }
    .chat-page .chat-toolbar { font-size: 13px; }
}

.chat-composer-legacy { flex-shrink: 0; display: flex; gap: 8px; align-items: center; }
.chat-input {
    flex: 1; padding: 12px 16px; border: 1px solid var(--border);
    border-radius: 6px; font-size: 14px;
}
.chat-input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.btn-link { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 8px; }
.btn-link:hover { color: var(--text); }

.logout-form { margin-top: auto; }

/* ------------------ Buttons & forms ------------------ */
.btn { display: inline-block; padding: 8px 16px; border-radius: 6px; border: none; cursor: pointer; font-size: 14px; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--primary); border: 1px solid var(--primary); }
.btn-link { background: none; border: none; color: var(--primary); padding: 0; cursor: pointer; text-decoration: underline; }

label { display: flex; flex-direction: column; gap: 4px; }
label span { font-size: 12px; color: var(--text-muted); font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=date], select {
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 14px;
    background: var(--surface);
}
input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

.alert { padding: 10px 14px; border-radius: 4px; margin-bottom: 12px; }
.alert-error { background: #fee2e2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #d1fae5; color: var(--success); border: 1px solid #a7f3d0; }

.form-stack { display: flex; flex-direction: column; gap: 14px; max-width: 480px; background: var(--surface); padding: 24px; border-radius: 6px; border: 1px solid var(--border); }
.form-stack small { font-size: 11px; }
.form-actions { display: flex; gap: 10px; align-items: center; }

/* ------------------ Detail-download CTA blocks ------------------ */
.allreports-detail-cta, .spend-detail-cta { background: #f8fafc; }
.allreports-detail-actions, .spend-detail-actions {
    display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px;
}

/* ------------------ Login (split-screen, CrewSync-pattern) ------------------ */
.login-split-page {
    display: grid;
    grid-template-columns: minmax(320px, 36%) 1fr;
    min-height: 100vh;
    background: #fff;
    color: #0f172a;
    font-family: inherit;
}

/* ---- Left brand panel ---- */
.login-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 36px 44px;
    color: #fff;
    background:
        radial-gradient(120% 80% at 15% 0%, rgba(221, 76, 63, 0.30) 0%, rgba(221, 76, 63, 0) 55%),
        linear-gradient(150deg, #0b1730 0%, #0a1226 45%, #060b1a 100%);
    overflow: hidden;
}
.login-brand::after {
    /* Subtle V-formation echo behind the hero. Decorative only. */
    content: '';
    position: absolute;
    right: -60px; bottom: 24%;
    width: 280px; height: 280px;
    background:
        radial-gradient(closest-side, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 70%);
    pointer-events: none;
}
.login-brand-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px;
}
.login-brand-mark {
    display: flex; align-items: center; gap: 12px;
}
.login-brand-mark-square {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, #DD4C3F 0%, #b9362b 100%);
    color: #fff;
    box-shadow: 0 8px 18px rgba(221, 76, 63, 0.35);
}
.login-brand-wordmark { display: flex; flex-direction: column; line-height: 1.05; }
.login-brand-wordmark strong { font-size: 18px; font-weight: 700; letter-spacing: 0.2px; }
.login-brand-wordmark span {
    font-size: 10px; letter-spacing: 1.4px; color: rgba(255,255,255,0.55);
    margin-top: 4px; text-transform: uppercase;
}
.login-brand-itl {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 38px; height: 38px; padding: 0 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
    border: 1px solid rgba(255,255,255,0.12);
}
.login-brand-hero { max-width: 320px; }
.login-brand-rule {
    display: block; width: 36px; height: 3px;
    background: #f59e0b;
    border-radius: 2px;
    margin-bottom: 18px;
}
.login-brand-hero h2 {
    font-size: 30px; line-height: 1.15; font-weight: 700;
    color: #fff; margin: 0 0 14px 0; letter-spacing: -0.3px;
}
.login-brand-hero p {
    font-size: 13.5px; line-height: 1.55;
    color: rgba(255,255,255,0.72); margin: 0;
}
.login-brand-foot {
    display: flex; align-items: center; gap: 8px;
    color: rgba(255,255,255,0.55); font-size: 12px;
}
.login-brand-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #f59e0b;
}

/* ---- Right form panel ---- */
.login-form-wrap {
    display: grid; place-items: center;
    padding: 32px;
    background: #fff;
}
.login-form-card {
    width: 100%; max-width: 380px;
    padding: 36px 36px 28px;
    background: #fff;
    border-radius: 14px;
    border: 1px solid #eef2f7;
    box-shadow: 0 30px 60px -30px rgba(15, 23, 42, 0.08);
}
.login-form-title {
    margin: 0 0 6px 0;
    font-size: 28px; font-weight: 800;
    color: #7c2820; /* indigo-900 — high contrast against the white card */
    letter-spacing: -0.01em;
}
.login-form-sub {
    margin: 0 0 22px 0;
    font-size: 13.5px; color: #475569; /* slate-600, was slate-500 (#64748b) — readable on white */
}
.login-form-alert { margin-bottom: 16px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form-field { display: flex; flex-direction: column; gap: 6px; }
.login-form-field > span {
    font-size: 12.5px; font-weight: 600; color: #334155;
    letter-spacing: 0.1px;
}
.login-form-field input {
    padding: 11px 13px;
    border-radius: 10px;
    border: 1px solid #cbd5e1; /* slate-300, was slate-200 — more visible edge */
    background: #ffffff;       /* solid white beats the autofill grey */
    font-size: 14px; color: #0f172a;
    transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}
/* Stop browsers (Chrome / Edge) from tinting autofilled inputs grey-purple. */
.login-form-field input:-webkit-autofill,
.login-form-field input:-webkit-autofill:hover,
.login-form-field input:-webkit-autofill:focus {
    -webkit-text-fill-color: #0f172a;
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset;
    box-shadow: 0 0 0 1000px #ffffff inset;
    caret-color: #0f172a;
    transition: background-color 5000s ease-in-out 0s;
}
.login-form-field input:focus {
    outline: none;
    border-color: #2563eb;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.login-form-field input::placeholder { color: #94a3b8; }
.login-form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 6px 0 4px;
    line-height: 1.2;
    white-space: nowrap;
}
.login-form-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    user-select: none;
}
.login-form-check input { margin: 0; cursor: pointer; }
.login-form-check > span { line-height: 1; }
.login-form-link {
    font-size: 13px;
    font-weight: 600;
    color: #b13a30; /* indigo-700 — stronger than blue-600 for the link */
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}
.login-form-link:hover { text-decoration: underline; }
.login-form-muted { font-size: 12px; color: #94a3b8; }
.login-form-submit {
    margin-top: 8px;
    padding: 12px 14px;
    background: #b13a30;
    border: 0;
    border-radius: 10px;
    color: #fff;
    font-size: 15px; font-weight: 600;
    cursor: pointer;
    transition: background 120ms ease, transform 80ms ease;
}
.login-form-submit:hover { background: #b13a30; }
.login-form-submit:active { transform: translateY(1px); }
.login-form-foot {
    margin: 24px 0 0;
    text-align: center;
    font-size: 12px; color: #94a3b8;
}
.login-form-foot a { color: #64748b; text-decoration: none; }
.login-form-foot a:hover { text-decoration: underline; }

/* ---- Mobile: collapse to single column, hide brand panel ---- */
@media (max-width: 720px) {
    .login-split-page { grid-template-columns: 1fr; }
    .login-brand { display: none; }
    .login-form-card {
        box-shadow: none;
        border: 0;
        padding: 28px 18px;
    }
}

/* ------------------ Dashboard cards ------------------ */
.lead { color: var(--text-muted); margin-bottom: 24px; max-width: 700px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 20px; text-decoration: none; color: inherit; display: block; }
.card:hover { border-color: var(--primary); }
.card-disabled { opacity: 0.55; pointer-events: none; }
.card h3 { display: flex; align-items: center; justify-content: space-between; }
.tag { font-size: 10px; background: var(--border); padding: 2px 6px; border-radius: 3px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.card p { color: var(--text-muted); margin: 0; font-size: 13px; }

/* ------------------ Report page ------------------ */
.report-scope { color: var(--text-muted); margin-bottom: 16px; }
.filter-bar { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; background: var(--surface); padding: 16px; border-radius: 6px; border: 1px solid var(--border); margin-bottom: 20px; }
.filter-bar label { min-width: 140px; }

/* Phase 4 (2026-05-26) — unified top filter bar.
   2026-05-26 follow-up: aligned more precisely with the mockup card.
   White card, soft slate border, 1px shadow, generous internal padding.
   Labels are uppercase + tracked so they read as section captions, not
   form-builder labels. Inputs are 38px tall to match the Run button. */
.report-top-filter-bar {
    display: flex; align-items: flex-end; flex-wrap: wrap;
    gap: 14px;
    padding: 16px 18px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.report-top-filter-bar > label,
.report-top-filter-bar > .report-top-filter-inline {
    display: flex; flex-direction: column; gap: 5px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    min-width: 140px;
}
.report-top-filter-bar > label > span,
.report-top-filter-bar > .report-top-filter-inline > span { line-height: 1.2; }
.report-top-filter-bar input,
.report-top-filter-bar select {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    background: #fff;
    color: #0f172a;
    min-height: 38px;
}
.report-top-filter-bar input:hover,
.report-top-filter-bar select:hover { border-color: #94a3b8; }
.report-top-filter-bar input:focus,
.report-top-filter-bar select:focus {
    outline: 2px solid #e15d4e;
    outline-offset: 1px;
    border-color: #e15d4e;
}
.report-top-filter-run {
    min-height: 38px;
    padding: 0 22px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: 8px;
}
.report-top-filter-actions {
    margin-left: auto;
    display: inline-flex; gap: 8px; align-items: center;
}
/* Dark-mode adapts: dark card + slate fields with light text */
html[data-theme="dark"] .report-top-filter-bar {
    background: #1e293b; border-color: #334155;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.30);
}
html[data-theme="dark"] .report-top-filter-bar > label,
html[data-theme="dark"] .report-top-filter-bar > .report-top-filter-inline { color: #94a3b8; }
html[data-theme="dark"] .report-top-filter-bar input,
html[data-theme="dark"] .report-top-filter-bar select {
    background: #0f172a; color: #e2e8f0; border-color: #334155;
}
html[data-theme="dark"] .report-top-filter-bar input:hover,
html[data-theme="dark"] .report-top-filter-bar select:hover { border-color: #475569; }
/* Inline label inside the Actions slot (Top N, Axis, etc). Same shape
   as a standalone .report-top-filter-bar label but compact and centred
   with the buttons next to it. */
.report-top-filter-inline {
    display: flex; flex-direction: column; gap: 4px;
    font-size: 12px; color: #475569;
    min-width: 90px;
}
.report-top-filter-inline input,
.report-top-filter-inline select {
    border: 1px solid #cbd5e1; border-radius: 6px;
    padding: 6px 10px; font-size: 13px;
    background: #fff; color: #0f172a; min-height: 34px;
}
.report-top-filter-checkbox {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; color: #1f2937; cursor: pointer;
    padding: 0 8px;
}
.report-top-filter-checkbox input { accent-color: #b13a30; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--surface); padding: 16px; border-radius: 6px; border: 1px solid var(--border); }
.kpi-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.kpi-value { font-size: 22px; font-weight: 600; }

.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 16px; }
.panel-wide { grid-column: 1 / -1; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-muted); text-transform: uppercase; font-size: 11px; letter-spacing: 0.04em; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover { background: var(--bg); }

.muted { color: var(--text-muted); }

/* Impersonation banner — sticky red bar across the top of every page
   when a SystemAdmin is acting as another user. The colour is deliberate;
   admins must never lose sight of the fact that their cookie is not theirs. */
.impersonation-banner {
    position: sticky;
    top: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    background: linear-gradient(90deg, #b91c1c, #dc2626);
    color: #fff;
    box-shadow: 0 2px 8px rgba(185,28,28,0.35);
    font-size: 13px;
}
.impersonation-banner-text { flex: 1; line-height: 1.4; }
.impersonation-banner-form { margin: 0; }
.impersonation-banner .btn-warn {
    background: #fff;
    color: #b91c1c;
    border: 0;
    border-radius: 4px;
    padding: 6px 12px;
    font-weight: 600;
    cursor: pointer;
}
.impersonation-banner .btn-warn:hover { background: #fef2f2; }
.btn-sm { padding: 4px 8px; font-size: 12px; }

/* Back to Dashboard link — sits above the page content on every
   non-home authenticated page. Subtle so it's there when needed but
   doesn't compete with the page title. */
.back-to-dashboard {
    margin: 0 0 12px 0;
}
.back-link {
    display: inline-block;
    padding: 4px 10px;
    background: #fdf3f1;
    color: #b13a30;
    border-radius: 14px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
}
.back-link:hover { background: #fbe4e0; color: #7c2820; }

/* Soothing multi-tone palette for charts + KPI accents. Used by chart
   components and CSS chart fallbacks via var(--chart-N). Picked from a
   muted teal-violet-amber spectrum that reads well on light grey. */
:root {
    --chart-1: #dd4c3f;   /* indigo */
    --chart-2: #0ea5e9;   /* sky */
    --chart-3: #14b8a6;   /* teal */
    --chart-4: #22c55e;   /* emerald */
    --chart-5: #f59e0b;   /* amber */
    --chart-6: #ef4444;   /* rose */
    --chart-7: #8b5cf6;   /* violet */
    --chart-8: #06b6d4;   /* cyan */
    --chart-9: #84cc16;   /* lime */
    --chart-10: #ec4899;  /* pink */
    --chart-spend: linear-gradient(180deg, #e15d4e 0%, #b13a30 100%);
    --chart-count: linear-gradient(180deg, #14b8a6 0%, #0d9488 100%);
    --chart-profit: linear-gradient(180deg, #22c55e 0%, #15803d 100%);
    --chart-refund: linear-gradient(180deg, #f97316 0%, #c2410c 100%);
    --chart-cancel: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
}

/* Inter-chart spacing — give each <section class="panel"> some room
   so dashboards feel less cramped. */
.report-grid, .home-section { gap: 24px; }
.panel { margin-bottom: 24px; }
.panel + .panel { margin-top: 8px; }
.panel-wide { padding: 18px 20px; }

/* Apply the multi-tone palette to the existing bicolumn chart so
   spend / count bars pick up the soothing gradient automatically. */
.bicolumn-bar-spend { background: var(--chart-spend) !important; }
.bicolumn-bar-count { background: var(--chart-count) !important; }
.bicolumn-swatch-spend { background: var(--chart-spend); }
.bicolumn-swatch-count { background: var(--chart-count); }

/* ------------------ Universal Filter Sidebar ------------------ */
/* Filter sidebar - mobile-first.
   On mobile (< 768px): renders as a bottom-sheet modal that slides up
   from the viewport floor. body.has-filter-open shows it; tap backdrop
   or grab the drag-handle to dismiss. Pages should include a
   data-flock-filter-toggle button to open it (sidebar-toggle.js wires).
   On tablet+ (>= 768px): the existing sticky right-rail behavior. */
.filter-sidebar {
    background: var(--slate-50);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: var(--space-4) var(--space-3);
    font-size: var(--fs-sm);

    /* Mobile baseline: bottom-sheet, slide-up */
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 1000;
    max-height: 82vh;
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform var(--t-medium);
    box-shadow: var(--shadow-xl);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
body.has-filter-open .filter-sidebar { transform: translateY(0); }
.filter-sidebar::before {
    /* drag-handle pill at the top of the sheet (mobile only). */
    content: "";
    display: block;
    width: 36px; height: 4px;
    background: var(--slate-300);
    border-radius: 999px;
    margin: 0 auto var(--space-3);
}

@media (min-width: 768px) {
    .filter-sidebar {
        position: sticky;
        /* Sit BELOW the 64px topbar (sticky banner at viewport top:0).
           Earlier rule used top:var(--space-3) which only worked when
           the topbar wasn't sticky — the filter rail then drew over
           the indigo banner. */
        top: calc(64px + var(--space-3));
        left: auto; right: auto; bottom: auto;
        transform: none;
        width: 280px;
        flex: 0 0 280px;
        /* Account for the topbar offset so the rail never grows past
           the bottom of the viewport. */
        max-height: calc(100vh - 64px - 24px);
        border-radius: var(--radius);
        padding: var(--space-3);
        box-shadow: none;
        /* Mobile baseline set z-index:1000 (bottom-sheet over content).
           On desktop the rail is in-flow and must stay UNDER the
           topbar (z-index 950) so open pickers don't bleed over the
           banner / avatar dropdown. */
        z-index: 1;
    }
    .filter-sidebar::before { display: none; }
    body.has-filter-open { /* no-op on tablet+ */ }
}
.fs-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.fs-head h3 { margin: 0; font-size: 14px; letter-spacing: 0.03em; text-transform: uppercase; color: #475569; }
.fs-head-actions .btn-link {
    padding: 0; border: 0; background: none; cursor: pointer;
    color: #b13a30; font-size: 12px; text-decoration: underline;
}
.fs-section { border-top: 1px solid #e2e8f0; padding: 10px 0; }
.fs-section-title {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
    color: #64748b; margin-bottom: 8px; font-weight: 600;
}
.fs-date { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
.fs-date span { width: 40px; color: #64748b; }
.fs-date input { flex: 1; padding: var(--space-2) var(--space-3); border: 1px solid var(--slate-300); border-radius: var(--radius-sm); font-size: var(--fs-sm); min-height: 36px; }
.fs-foot { position: sticky; bottom: 0; background: #fafbff; padding: 10px 0 4px; margin-top: 8px; border-top: 1px solid #e2e8f0; }
.fs-summary { display: block; margin-top: 6px; font-size: 11px; color: #64748b; }

/* Phase 1 refresh (2026-05-26) — muted "· PRIMARY" subtitle next to the
   FILTERS heading so the rail tells the user which dimensions are pinned.
   Pairs with .fs-head h3 which already sets the uppercase + tracking. */
.fs-head-mute {
    color: #94a3b8; font-weight: 600; letter-spacing: 0.05em;
}
.fs-clear-all {
    border: 0; background: none; cursor: pointer;
    color: #b13a30; font-size: 12px; font-weight: 600;
    padding: 4px 6px; border-radius: 4px;
}
.fs-clear-all:hover { background: #fdf3f1; color: #8f2c23; }
.fs-clear-all:focus-visible { outline: 2px solid #e15d4e; outline-offset: 2px; }

/* Active selection chips. One per (dimension, value); × removes the single
   value without expanding the picker. Wraps freely so the rail never grows
   horizontally — the chip row absorbs the height. */
.fs-chips {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 6px 0 10px;
    border-bottom: 1px dashed #e2e8f0;
    margin-bottom: 6px;
}
.fs-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fdf3f1; border: 1px solid #f5c8c1;
    color: #8f2c23; border-radius: 999px;
    padding: 3px 4px 3px 10px;
    font-size: 11px; font-weight: 600;
    cursor: pointer;
    max-width: 100%;
}
.fs-chip:hover { background: #fbe4e0; border-color: #efa79d; }
.fs-chip:focus-visible { outline: 2px solid #e15d4e; outline-offset: 2px; }
.fs-chip-label {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 220px;
}
.fs-chip-x {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; border-radius: 50%;
    background: rgba(177, 58, 48, 0.10); color: #8f2c23;
    font-size: 13px; line-height: 1;
}
.fs-chip:hover .fs-chip-x { background: rgba(177, 58, 48, 0.20); }

/* Phase 2 (2026-05-26) — collapsible Quick ranges. Native <details> so
   the summary row mirrors the .ms-header look; the body slides in below.
   The summary's right-side hint shows the current From → To window so
   the user can scan it without opening the panel. */
.fs-collapsible { padding: 0; }
.fs-collapsible-summary {
    list-style: none; cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    padding: 10px 4px;
    font-size: 12px; font-weight: 600; color: #1f2937;
}
.fs-collapsible-summary::-webkit-details-marker { display: none; }
.fs-collapsible-summary::before {
    content: "▾";
    font-size: 10px; color: #64748b;
    transform: rotate(-90deg);
    transition: transform 140ms ease;
    display: inline-block;
}
.fs-collapsible[open] > .fs-collapsible-summary::before {
    transform: rotate(0deg); color: #b13a30;
}
.fs-collapsible-title { flex: 0 0 auto; text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; }
.fs-collapsible-hint { margin-left: auto; color: #64748b; font-weight: 500; font-size: 11px; font-variant-numeric: tabular-nums; }
.fs-collapsible-body { padding: 4px 0 8px; }

/* Pinned filter chips on the chat composer. Sits above the input so the user
   sees what will be sent ON TOP of their typed text. */
.chat-pinned-hints {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    margin: 6px 0; padding: 6px 10px;
    background: #ecfdf5; border: 1px solid #86efac; border-radius: 6px;
    font-size: 12px; color: #14532d;
}
.chat-pinned-hints-label { color: #166534; font-weight: 600; }
.chat-pinned-hint {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff; border: 1px solid #86efac; border-radius: 12px;
    padding: 2px 4px 2px 10px; color: #14532d;
}
.chat-pinned-hint-dim { font-weight: 600; color: #166534; }
.chat-pinned-hint-val { color: #14532d; }
.chat-pinned-hint-x {
    background: #fee2e2; border: 0; border-radius: 50%;
    width: 18px; height: 18px; line-height: 16px;
    color: #991b1b; font-weight: 700; cursor: pointer;
}
.chat-pinned-hint-x:hover { background: #fca5a5; }

/* ------------------ World map (Leaflet + OpenStreetMap) ------------------ */
/* Wrap owns the rounded corners + subtle border so the tile canvas itself
   stays a clean rectangle (Leaflet sizes child panes to the parent's
   content box; any border on the canvas div leaks into tile placement). */
.osm-map-wrap { width: 100%; }
.osm-map {
    width: 100%;
    height: 480px;
    border-radius: 8px;
    border: 1px solid var(--slate-200, #e2e8f0);
    background: #eef4fb;
}
.osm-map-hint {
    margin-top: 6px;
    font-size: 11px; color: #64748b;
}
.osm-map-unknown {
    margin-top: 6px; padding: 6px 10px;
    background: #fffbeb; border: 1px solid #fde68a; border-radius: 4px;
    font-size: 11px; color: #7c2d12;
}
/* Leaflet's default attribution box is a bit loud — tone it down so the
   map data tells the story, not the attribution credit. The "© OSM"
   line in the wrap below also reinforces attribution per OSM ToU. */
.leaflet-control-attribution {
    font-size: 10px !important;
    background: rgba(255,255,255,0.85) !important;
    color: #475569 !important;
}
.leaflet-tooltip {
    font-size: 12px;
    font-weight: 600;
}

/* ------------------ Report page header (Scope + Active filters) ------------------ */
/* v89: universal label strip rendered under every <h1> via <ReportPageHeader>.
   Two short rows; chips reuse a neutral pill style. */
.report-page-header {
    border: 1px solid var(--slate-200, #e5e7eb);
    background: linear-gradient(180deg, #fcfdff 0%, #f7f9fc 100%);
    border-radius: var(--radius, 6px);
    padding: 8px 12px;
    margin: 8px 0 12px;
    display: flex; flex-direction: column; gap: 4px;
}
.rph-row {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
    font-size: var(--fs-xs, 12px);
}
.rph-row-filters { color: var(--text-muted, #64748b); }
.rph-label {
    font-weight: 600; color: var(--text-muted, #64748b);
    text-transform: uppercase; letter-spacing: 0.04em;
    font-size: 11px;
}
.rph-divider { color: var(--slate-300, #cbd5e1); }
.rph-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 999px;
    background: #fdf3f1; color: var(--primary-700, #8f2c23);
    border: 1px solid #f5c8c1;
    font-weight: 500;
}
.rph-chip-internal { background: #ecfeff; color: #155e75; border-color: #a5f3fc; }
.rph-chip-tenant   { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.rph-chip-currency { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }
.rph-chip-date     { background: #fefce8; color: #854d0e; border-color: #fef08a; }
.rph-muted { color: var(--text-muted, #64748b); font-style: italic; }
.rph-subtitle { margin: 4px 0 0; font-size: var(--fs-xs, 12px); }

/* ------------------ Chat KPI strip ------------------ */
.chat-kpi-strip {
    display: grid;
    /* v89: widen min so values like "215.03 M" stay on a single line.
       Was 120px which still wrapped "215,027,495 AED" on narrow widths. */
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-2);
    background: linear-gradient(135deg, var(--primary-50) 0%, #ffffff 100%);
    border: 1px solid var(--primary-100);
    border-radius: var(--radius);
    padding: var(--space-3);
    margin: var(--space-2) 0;
}
.chat-kpi {
    display: flex; flex-direction: column; gap: 2px;
    padding: var(--space-2);
    min-width: 0;
}
.chat-kpi-label {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-kpi-value {
    font-size: var(--fs-lg);
    color: var(--slate-900);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-kpi-delta {
    font-size: var(--fs-xs);
    font-weight: 600;
    margin-top: 2px;
}
.chat-kpi-delta.up   { color: var(--success); }
.chat-kpi-delta.down { color: var(--danger); }
.chat-kpi-window {
    grid-column: 1 / -1;
    font-size: var(--fs-xs);
    color: var(--text-muted);
    border-top: 1px dashed var(--slate-200);
    padding-top: var(--space-2);
    text-align: right;
}

/* ------------------ Quick date filter chips ------------------ */
.quick-dates { display: flex; flex-direction: column; gap: var(--space-2); }
.quick-dates-label {
    font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-muted); font-weight: 600;
}
.quick-dates-row {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.quick-date-chip {
    background: var(--surface);
    border: 1px solid var(--slate-300);
    border-radius: 999px;
    padding: var(--space-1) var(--space-3);
    font-size: var(--fs-xs); font-weight: 500;
    color: var(--slate-700);
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
    min-height: 28px;
}
.quick-date-chip:hover {
    background: var(--primary-50);
    border-color: var(--primary-500);
    color: var(--primary-700);
}
.quick-date-chip.is-active {
    background: var(--primary-600);
    border-color: var(--primary-700);
    color: #fff;
    font-weight: 600;
}

/* MultiSelect picker — Phase 3 (2026-05-26): dropped the pill card border
   for a flatter rail. Cards are now delineated by a soft bottom divider
   only; the open state highlights with an indigo left edge instead of an
   all-around border so the rail reads as a list, not a stack of buttons. */
.ms-filter {
    background: transparent;
    border: 0;
    border-bottom: 1px solid #eef2f7;
    border-radius: 0;
    margin: 0;
    padding-left: 0;
    position: relative;
}
.ms-filter.ms-open {
    background: #fafbff;
    box-shadow: none;
}
.ms-filter.ms-open::before {
    content: "";
    position: absolute;
    left: 0; top: 6px; bottom: 6px; width: 2px;
    background: #b13a30;
    border-radius: 2px;
}
.ms-header {
    display: flex; align-items: center; gap: 6px;
    width: 100%; padding: 8px 10px;
    background: none; border: 0; cursor: pointer; text-align: left;
    font-size: 12px; color: #1f2937; font-weight: 600;
}
.ms-header:hover { background: #f1f5f9; }
.ms-title { flex: 1; }
.ms-count {
    background: #b13a30; color: #fff; border-radius: 10px;
    padding: 1px 7px; font-size: 10px; font-weight: 700;
}
/* Phase 3 (2026-05-26) — single chevron icon rotated via CSS so the up /
   down direction is consistent across pickers and animates smoothly on
   open/close. ▾ (down) is the only glyph; .ms-open rotates it 0deg. */
.ms-chev {
    font-size: 10px; color: #64748b;
    display: inline-block;
    transform: rotate(-90deg);
    transition: transform 140ms ease;
}
.ms-filter.ms-open .ms-chev { transform: rotate(0deg); color: #b13a30; }
.ms-body { padding: 6px 10px 10px; border-top: 1px dashed #e2e8f0; }
.ms-search {
    width: 100%; padding: 5px 7px; border: 1px solid #cbd5e1;
    border-radius: 4px; font-size: 12px; margin-bottom: 6px;
}
.ms-actions {
    display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
    font-size: 11px;
}
.ms-link {
    background: none; border: 0; color: #b13a30; cursor: pointer;
    padding: 0; font-size: 11px; text-decoration: underline;
}
.ms-meta { margin-left: auto; color: #94a3b8; font-size: 10px; }
/* Picker list height: 240px was capping every picker to ~12 visible
   rows even when the sidebar (sticky, calc(100vh - 24px)) had unused
   space below. Bumped to a viewport-aware cap so a tall screen shows
   ~25 rows before forcing inner scroll, and short screens still cap
   sensibly. The sidebar itself owns the outer scroll. */
.ms-list { max-height: min(62vh, 540px); overflow-y: auto; }
/* When only the open picker fills the rail, let it grow further so the
   user doesn't double-scroll (rail + list). Applies whenever the list
   sits at the bottom of an .ms-open card. */
.ms-filter.ms-open .ms-list { max-height: min(70vh, 640px); }
/* Checkbox + label on ONE row, side by side. flex-direction:row +
   flex-wrap:nowrap is explicit so no parent style can collapse them
   onto separate lines. `min-width: 0` on the label lets ellipsis kick
   in when the value is longer than the rail — without it, the label
   pushes the checkbox off and the row wraps. */
.ms-item {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    font-size: 12px;
    color: #1f2937;
    cursor: pointer;
    border-radius: 4px;
    line-height: 1.3;
}
.ms-item:hover { background: #fdf3f1; }
.ms-item input[type="checkbox"] {
    flex: 0 0 auto;
    width: 14px; height: 14px;
    margin: 0;
    accent-color: #b45309;   /* brand-tinted check */
    cursor: pointer;
}
.ms-item-label {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ms-empty { color: #94a3b8; font-size: 11px; padding: 8px 0; }
/* Smart-filter ordering: values that no longer match the other filters
   fall to the bottom and render greyed-out. Selectable so the user can
   still pick them — they just become a hint that the picker would be a
   "swap" rather than an "and". */
.ms-item-irrelevant { opacity: 0.45; }
.ms-item-irrelevant:hover { opacity: 0.7; }
.ms-item-irrelevant .ms-item-label { color: #6b7280; }

/* ---- NL filter bar (sidebar top) ---- */
.nl-filter { font-size: 12px; }
.nl-filter-row {
    display: flex; align-items: center; gap: 6px;
    background: #fff; border: 1px solid #f5c8c1; border-radius: 6px;
    padding: 4px 6px;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.nl-filter-row:focus-within {
    border-color: #b13a30;
    box-shadow: 0 0 0 3px rgba(177, 58, 48, 0.08);
}
.nl-filter-icon {
    color: #e15d4e; display: inline-flex; align-items: center;
    flex: 0 0 auto;
}
.nl-filter-input {
    flex: 1; min-width: 0;
    border: 0; outline: 0; background: transparent; font-size: 12px;
    color: #1f2937;
}
.nl-filter-input::placeholder { color: #94a3b8; font-style: italic; }
.nl-filter-go { padding: 3px 9px; font-size: 11px; }
.nl-filter-feedback {
    display: flex; flex-direction: column; gap: 2px;
    margin-top: 6px; font-size: 11px;
}
.nl-filter-ok { color: #047857; }
.nl-filter-warn { color: #b45309; }
.nl-filter-unknown { color: #be123c; }
.nl-filter-note { color: #64748b; font-style: italic; }

/* Page layout when a sidebar is present.
   Sidebar lives on the RIGHT — main report area takes the full primary
   column on the left so charts/tables get maximum horizontal space. */
.with-sidebar { display: flex; flex-direction: row-reverse; gap: 16px; align-items: flex-start; }
.with-sidebar > .with-sidebar-main { flex: 1; min-width: 0; }
@media (max-width: 1100px) {
    /* Stack vertically with the REPORT first; the filter rail drops below it.
       FilterSidebar comes first in the DOM, so without order control a stacked
       layout shows "Filters · PRIMARY" on top of the report. order:-1 on main
       keeps the report on top. */
    .with-sidebar { display: flex; flex-direction: column; }
    .with-sidebar > .with-sidebar-main { order: -1; }
    .filter-sidebar { width: 100%; position: static; max-height: none; margin-bottom: 16px; }
}

/* ---- Explain this chart button ----
   Tiny inline button that lives next to a chart heading. Click pops
   an inline panel with the LLM-narrated 3-bullet summary. */
.explain-chart {
    display: inline-block; position: relative; margin-left: 8px;
}
.explain-chart-btn {
    color: #b13a30; font-size: 12px; padding: 2px 8px;
    border: 1px solid #f5c8c1; background: #fdf3f1; border-radius: 12px;
    cursor: pointer; line-height: 1.6;
}
.explain-chart-btn:hover:not(:disabled) { background: #fbe4e0; }
.explain-chart-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.explain-chart-panel {
    margin-top: 8px; padding: 12px 36px 12px 14px;
    background: #fafbff; border: 1px solid #f5c8c1; border-radius: 6px;
    font-size: 13px; line-height: 1.55; color: #1e1b4b;
    position: relative; max-width: 560px;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.06);
}
.explain-chart-narration { white-space: pre-line; }
.explain-chart-close {
    position: absolute; top: 4px; right: 6px;
    font-size: 18px; line-height: 1; padding: 0 6px;
    color: #64748b; background: transparent; border: none; cursor: pointer;
}
.explain-chart-close:hover { color: #0f172a; }

/* Auto-apply pending indicator on top filter bars (HotelBi, AllReports). */
.hbi-applying {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; background: #fdf3f1; border: 1px solid #f5c8c1;
    border-radius: 14px; font-size: 12px; color: #b13a30;
}
.hbi-applying-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #e15d4e; animation: fs-pulse 1s infinite;
}

/* Auto-apply pending indicator (debounce window). Small dot + label,
   sits inside .filter-sidebar so it never overlaps report content. */
.fs-foot-pending {
    margin-top: 12px; padding: 8px 12px;
    background: #fdf3f1; border: 1px solid #f5c8c1;
    border-radius: 4px; font-size: 12px; color: #b13a30;
    display: flex; align-items: center; gap: 6px;
}
.fs-pending-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #e15d4e; animation: fs-pulse 1s infinite;
}
@keyframes fs-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ------------------ Transaction Analysis (Sale / Reissue / Refund / Cancellation) ------------------ */
.kpi-grid-wide { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.kpi-tone-sale     { border-left: 4px solid #dd4c3f; }
.kpi-tone-reissue  { border-left: 4px solid #0ea5e9; }
.kpi-tone-refund   { border-left: 4px solid #f97316; }
.kpi-tone-cancel   { border-left: 4px solid #ef4444; }
.kpi-tone-net      { border-left: 4px solid #14b8a6; background: #f0fdfa; }
.kpi-tone-rate     { border-left: 4px solid #8b5cf6; }

/* Action-kind tags in the drill-down line list */
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.tag-original     { background: #fbe4e0; color: #b13a30; }
.tag-reissue      { background: #e0f2fe; color: #0369a1; }
.tag-refund       { background: #ffedd5; color: #c2410c; }
.tag-cancellation { background: #fee2e2; color: #b91c1c; }

/* Drill-down sub-row inside a dimension table */
.drilldown-row { background: #f8fafc; }
.drilldown-row > td { padding: 8px 12px; }
.drilldown-row table { background: #fff; box-shadow: 0 1px 4px rgba(15,23,42,0.06); }

/* High refund / cancel rate alert highlight */
.row-warn { background: #fef3c7; }
.row-warn:hover { background: #fde68a; }

/* ------------------ Warehouse loading overlay ------------------ */
.warehouse-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    animation: warehouse-fade-in 0.18s ease-out;
}
.warehouse-overlay-card {
    background: var(--surface);
    border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(15,23,42,0.25);
    padding: 24px 28px;
    width: min(560px, 100%);
    color: var(--text);
}
.warehouse-overlay-header {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 16px;
}
.warehouse-overlay-cup {
    font-size: 32px;
    animation: warehouse-steam 2.4s ease-in-out infinite;
}
.warehouse-overlay-title {
    font-size: 17px; font-weight: 600;
}
.warehouse-overlay-subtitle {
    font-size: 12px; color: var(--text-muted); margin-top: 2px;
}
.warehouse-progress {
    height: 10px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin: 8px 0 14px 0;
}
.warehouse-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #e15d4e 0%, #b13a30 100%);
    border-radius: 999px;
    transition: width 0.35s ease;
}
.warehouse-progress-bar-indeterminate {
    width: 40%;
    animation: warehouse-indeterminate 1.4s ease-in-out infinite;
}
.warehouse-message-strip {
    font-size: 13px;
    color: var(--text);
    background: var(--bg);
    border-radius: 6px;
    padding: 10px 12px;
    min-height: 38px;
    display: flex; align-items: center;
    animation: warehouse-strip-fade 0.4s ease-out;
}
.warehouse-stats {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-top: 12px;
    font-size: 12px; color: var(--text-muted);
}
.warehouse-stat strong { color: var(--text); font-variant-numeric: tabular-nums; }
.warehouse-stat-sep { color: var(--border); }
.warehouse-overlay-error {
    margin-top: 14px;
    padding: 10px 12px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 6px;
    font-size: 12px;
}
.warehouse-overlay-error-detail {
    margin-top: 4px;
    font-family: ui-monospace, monospace;
    font-size: 11px;
    opacity: 0.85;
}
.warehouse-overlay-actions {
    margin-top: 12px;
    display: flex; gap: 8px; align-items: center;
}
@keyframes warehouse-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes warehouse-indeterminate {
    0%   { transform: translateX(-100%); }
    50%  { transform: translateX(150%); }
    100% { transform: translateX(250%); }
}
@keyframes warehouse-strip-fade {
    from { opacity: 0; transform: translateY(2px); }
    to   { opacity: 1; transform: translateY(0);  }
}
@keyframes warehouse-steam {
    0%, 100% { transform: translateY(0)   rotate(-2deg); }
    50%      { transform: translateY(-2px) rotate(2deg); }
}

/* ------------------ Toast stack ------------------ */
.toast-stack {
    position: fixed;
    right: 16px; bottom: 16px;
    z-index: 9000;
    display: flex; flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    appearance: none;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 8px;
    padding: 10px 14px;
    min-width: 220px;
    max-width: 360px;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: var(--text);
    box-shadow: 0 10px 25px rgba(15,23,42,0.18);
    display: flex; align-items: center; gap: 10px;
    animation: toast-in 0.18s ease-out;
}
.toast:hover { background: var(--bg); }
.toast-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--primary);
    flex: 0 0 auto;
}
.toast-message { font-size: 13px; line-height: 1.35; }
.toast-info    .toast-dot { background: var(--primary); }
.toast-success .toast-dot { background: var(--success); }
.toast-success { border-color: #a7f3d0; }
.toast-warning .toast-dot { background: #d97706; }
.toast-warning { border-color: #fcd34d; }
.toast-error   .toast-dot { background: var(--danger); }
.toast-error   { border-color: #fecaca; }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0);  }
}

.warehouse-sql-details { margin-top: 12px; }
.warehouse-sql-details summary {
    cursor: pointer; color: var(--primary); font-weight: 600; font-size: 13px;
}
.warehouse-sql {
    background: #0f172a; color: #e2e8f0;
    padding: 12px 14px; border-radius: 6px;
    font-family: ui-monospace, monospace; font-size: 12px;
    overflow-x: auto; margin: 8px 0;
    white-space: pre-wrap;
}

/* ------------------ Role banner (Phase J.6) ------------------ */
.role-banner {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 6px; margin: 0 0 18px 0;
    background: #fdf3f1; border: 1px solid #f5c8c1;
    font-size: 13px;
}
.role-banner-label {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--text-muted);
}
.role-banner-name { font-size: 14px; color: var(--primary); }
.role-banner-desc { color: var(--text-muted); }
.role-banner-clientself { background: #ede9fe; border-color: #ddd6fe; }
.role-banner-clientself .role-banner-name { color: var(--client); }
.role-banner-salespipeline { background: #ecfeff; border-color: #a5f3fc; }
.role-banner-salespipeline .role-banner-name { color: #0e7490; }
.role-banner-operationsinventory { background: #fef9c3; border-color: #fde68a; }
.role-banner-operationsinventory .role-banner-name { color: #a16207; }
.role-banner-financefull { background: #dcfce7; border-color: #86efac; }
.role-banner-financefull .role-banner-name { color: #166534; }
.role-banner-departmentmanager { background: #ffedd5; border-color: #fed7aa; }
.role-banner-departmentmanager .role-banner-name { color: #9a3412; }
.role-banner-itadmin { background: #fee2e2; border-color: #fecaca; }
.role-banner-itadmin .role-banner-name { color: var(--danger); }
.role-banner-executiveall { background: #1e293b; border-color: #0f172a; color: #f1f5f9; }
.role-banner-executiveall .role-banner-label { color: #94a3b8; }
.role-banner-executiveall .role-banner-name { color: #fbbf24; }
.role-banner-executiveall .role-banner-desc { color: #cbd5e1; }

/* -------------------------------------------------------------- */
/* Per-role Home dashboard (Phase J.6)                            */
/* -------------------------------------------------------------- */
.home-section { margin: 24px 0; }
.home-section h2 { font-size: 18px; margin: 0 0 12px; color: var(--text); }
.home-section-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 900px) { .home-section-two-col { grid-template-columns: 1fr; } }

.home-filter-bar {
    display: flex; align-items: center; gap: 16px;
    background: var(--surface); padding: 10px 14px; border-radius: 6px;
    border: 1px solid var(--border); margin: 16px 0;
}
.home-filter-bar label { display: flex; flex-direction: column; font-size: 12px; color: var(--text-muted); }
.home-filter-bar select { padding: var(--space-2) var(--space-3); min-width: 120px; min-height: 36px; }
.home-as-of { margin-left: auto; color: var(--text-muted); font-size: 12px; }

.kpi-strip {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

/* AI Insights block — shared (was page-scoped in NewCustomers; promoted to
   site.css so Expense Mix and any other finance page can use it). 2026-06-01 */
.nc-insights {
    background: linear-gradient(135deg, #fdf3f1 0%, #ffffff 100%);
    border: 1px solid #f5c8c1; border-radius: 10px;
    padding: 14px 18px; margin: 18px 0 22px;
}
.nc-insights-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.nc-insights-head h2 { font-size: 16px; font-weight: 800; color: #8f2c23; margin: 0; border: 0; padding: 0; }
.nc-insights-icon { font-size: 18px; }
.nc-insights-list { margin: 0; padding-left: 18px; color: #1e293b; font-size: 13px; }
.nc-insights-list li { margin: 4px 0; line-height: 1.55; }
.nc-insights-list strong { color: #8f2c23; }
html[data-theme="dark"] .nc-insights { background: #0b1220; border-color: #1e293b; }
html[data-theme="dark"] .nc-insights-head h2,
html[data-theme="dark"] .nc-insights-list strong { color: #efa79d; }
html[data-theme="dark"] .nc-insights-list { color: #cbd5e1; }

/* Compact 8-up KPI strip — used by Consultant Productivity so all eight
   tiles sit on one line instead of wrapping at the 180px auto-fit floor.
   Slimmer padding + fonts; names ellipsis-truncate. Degrades to 4-up then
   2-up on narrow viewports. 2026-06-01 */
.kpi-strip-compact {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 8px;
}
.kpi-strip-compact .kpi { padding: 10px 10px; min-width: 0; }
.kpi-strip-compact .kpi-label { font-size: 10.5px; line-height: 1.2; }
.kpi-strip-compact .kpi-value { font-size: 18px; }
.kpi-strip-compact .kpi-sub { font-size: 10px; }
.kpi-strip-compact .kpi-value-name {
    font-size: 13px; font-weight: 700;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 1200px) {
    .kpi-strip-compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .kpi-strip-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.kpi-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.kpi-value { font-variant-numeric: tabular-nums; }

.data-table {
    width: 100%; border-collapse: collapse; background: var(--surface);
    border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.data-table thead th { background: #f8fafc; padding: 8px 10px; font-size: 12px; text-align: left; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border); }
.data-table tbody td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table.compact tbody td, .data-table.compact thead th { padding: 6px 10px; font-size: 13px; }

.quick-links { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.quick-links li a {
    display: block; padding: 10px 14px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 6px; color: var(--primary);
    text-decoration: none; font-weight: 500;
}
.quick-links li a:hover { background: #f1f5f9; }

.exec-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.exec-tile {
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1e293b, #0f172a); color: #fbbf24;
    padding: 24px; border-radius: 8px; font-weight: 600; text-decoration: none;
    border: 1px solid #0f172a; transition: transform 0.1s ease;
}
.exec-tile:hover { transform: translateY(-2px); color: #fde68a; }

.data-table .row-warn { background: #fee2e2; }
.data-table .row-warn td { color: #991b1b; }
.filter-bar-checkbox { display: flex; align-items: center; gap: 6px; font-size: 13px; }

.export-bar { display: inline-flex; gap: 6px; margin-left: auto; }
.export-bar .btn { white-space: nowrap; }


/* ------------------ Scatter chart ------------------ */
.scatter-chart { width: 100%; max-width: 900px; height: auto; display: block; }

/* ------------------ Horizontal bar chart ------------------ */
.hbar-chart { display: flex; flex-direction: column; gap: 6px; }
/* Drillable variant — rows become buttons on click, hover bg pops the
   row so the user knows it's actionable. Added Phase 6 (2026-05-26). */
/* v89 — was `display: flex` which collapsed the middle "track" column to 0
   width (empty flex item with no intrinsic size), so drillable charts on
   /reports/all showed the table numbers but NO bars. Match the grid layout
   from .hbar-row so the track column inherits 1fr. */
.hbar-chart-drillable .hbar-row-btn {
    width: 100%;
    display: grid; grid-template-columns: 160px 1fr 80px;
    align-items: center; gap: 10px;
    border: 0; background: transparent; padding: 4px 6px;
    border-radius: 6px; cursor: pointer; text-align: left;
    font: inherit; color: inherit;
}
.hbar-chart-drillable .hbar-row-btn:hover { background: #fdf3f1; }
.hbar-chart-drillable .hbar-row-btn:focus-visible { outline: 2px solid #e15d4e; outline-offset: 1px; }

/* ------------------ Mini-bar list (Top 5 panels) ------------------ */
/* Phase 6 (2026-05-26) — used on Spend Overview's Top 5 customers /
   Top 5 routes panels, mirroring the redesign mockup. Compact grid:
   name | value | bar — bar fills the remaining space. */
.mini-bars { display: flex; flex-direction: column; gap: 10px; }
.mini-bar-row {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 10px; row-gap: 4px;
    align-items: center;
}
.mini-bar-name {
    grid-column: 1 / 2; grid-row: 1 / 2;
    font-size: 13px; color: #1f2937;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mini-bar-value {
    grid-column: 2 / 3; grid-row: 1 / 2;
    font-size: 13px; font-weight: 700; color: #0f172a;
    font-variant-numeric: tabular-nums;
}
.mini-bar-track {
    grid-column: 1 / -1; grid-row: 2 / 3;
    display: block;
    height: 6px; background: #f1f5f9; border-radius: 3px;
    overflow: hidden;
}
.mini-bar-fill {
    display: block; height: 6px;
    background: linear-gradient(90deg, #e15d4e, #b13a30);
    border-radius: 3px;
}
.hbar-row { display: grid; grid-template-columns: 160px 1fr 80px; align-items: center; gap: 10px; font-size: 13px; }
.hbar-label { color: var(--text); text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.hbar-track { background: var(--bg); height: 22px; border-radius: 4px; overflow: hidden; position: relative; }
.hbar-fill { height: 100%; border-radius: 4px; transition: width 0.3s ease; }
.hbar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }

/* ------------------ Donut (stacked bar) chart ------------------ */
/* True SVG donut (2026-05-26 rewrite). Grid: ring on the left at a
   fixed 180px column so the legend has room to grow on the right. On
   narrow viewports stack vertically. */
.donut-chart {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 18px;
    align-items: center;
}
@media (max-width: 720px) {
    .donut-chart { grid-template-columns: 1fr; }
}
.donut-svg-wrap { display: flex; align-items: center; justify-content: center; }
.donut-svg { width: 100%; max-width: 200px; height: auto; }
.donut-svg-center-total {
    font-size: 22px; font-weight: 800; fill: #0f172a;
    font-variant-numeric: tabular-nums;
}
.donut-svg-center-label {
    font-size: 11px; font-weight: 700; fill: #64748b;
    text-transform: uppercase; letter-spacing: 0.08em;
}
.donut-legend { display: flex; flex-direction: column; gap: 6px; }
.donut-legend-row {
    display: grid;
    grid-template-columns: 12px 1fr 88px 48px;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}
.donut-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.donut-legend-label { color: var(--text); text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.donut-legend-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.donut-legend-pct { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 700; }
.donut-legend-total { padding-top: 6px; border-top: 1px solid var(--border); font-weight: 600; font-size: 13px; }
/* Dark-mode for the donut text — needs explicit fill since SVG ignores
   inherited color on text elements. */
html[data-theme="dark"] .donut-svg-center-total { fill: #f1f5f9; }
html[data-theme="dark"] .donut-svg-center-label { fill: #94a3b8; }

/* ------------------ Bi-column (spend + count) chart ------------------ */
/* Dual-series spend + count chart. Independent axes — left labels show the
   spend max/half/zero scale; right labels show the count max/half/zero. */
.bicolumn-wrap { display: grid; grid-template-columns: 56px 1fr 56px; gap: 8px; align-items: stretch; }
.bicolumn-axis { display: flex; flex-direction: column; justify-content: space-between; font-size: 10px; color: var(--text-muted); text-align: right; padding: 24px 0 36px; }
.bicolumn-axis-right { text-align: left; }
.bicolumn-axis span { font-variant-numeric: tabular-nums; line-height: 1; }
.bicolumn-chart { display: flex; gap: 8px; align-items: flex-end; height: 240px; padding-bottom: 32px; border-bottom: 1px solid var(--border); position: relative; }
.bicolumn-group { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; position: relative; }
.bicolumn-values { display: flex; gap: 8px; font-size: 10px; line-height: 1; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.bicolumn-value-spend { color: #b13a30; font-weight: 600; }
.bicolumn-value-count { color: #b45309; font-weight: 600; }
.bicolumn-bars { flex: 1; width: 100%; display: flex; gap: 6px; align-items: flex-end; justify-content: center; }
.bicolumn-bar { width: 18px; min-height: 2px; border-radius: 3px 3px 0 0; transition: opacity 0.15s ease; }
.bicolumn-bar:hover { opacity: 0.85; }
.bicolumn-bar-spend { background: linear-gradient(180deg, #b13a30, #b13a30); border: 1px solid #8f2c23; }
.bicolumn-bar-count { background: linear-gradient(180deg, #f59e0b, #b45309); border: 1px solid #92400e; }
.bicolumn-label { font-size: 10px; color: var(--text-muted); margin-top: 6px; text-align: center; transform: rotate(-20deg); transform-origin: center; white-space: nowrap; }
.bicolumn-legend { display: flex; gap: 18px; padding-top: 10px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.bicolumn-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.bicolumn-swatch-spend { background-color: #b13a30; }
.bicolumn-swatch-count { background-color: #b45309; }

/* ------------------ Unified analytics dashboard (Phase D+F+G) ------------------ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.chart-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.chart-panel-head { display: flex; align-items: center; gap: 12px; }
.chart-panel-head h3 { margin: 0; font-size: 15px; flex: 1; }
.chart-panel-tools { display: inline-flex; align-items: center; gap: 8px; }
.chart-panel-subtitle { color: var(--text-muted); font-size: 12px; }
.chart-panel-table { margin-top: 6px; }

.chart-explain {
    background: #eff6ff;
    border-left: 3px solid #b13a30;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.5;
    color: #1e293b;
}
.chart-explain strong { color: #b13a30; margin-right: 6px; }

/* ------------------ Filter chip bar ------------------ */
.chip-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 12px;
    align-items: center;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e0f2fe;
    border: 1px solid #7dd3fc;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    color: #075985;
    white-space: nowrap;
}
.chip-key { font-weight: 600; }
.chip-op  { color: #0ea5e9; }
.chip-val { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.chip-x {
    background: transparent; border: none; cursor: pointer;
    color: #0369a1; padding: 0 2px; font-size: 14px; line-height: 1;
}
.chip-x:hover { color: #b91c1c; }
.chip-add {
    background: #fef9c3; border-color: #fde047; color: #854d0e;
    cursor: pointer; font-weight: 500;
}
.chip-add-active { background: #fef9c3; padding: 4px 8px; gap: 6px; }
.chip-add-active select { font-size: 12px; padding: 2px 6px; max-width: 200px; }
.chip-add-confirm {
    background: #16a34a; color: #fff; border: none; border-radius: 4px;
    padding: 3px 10px; font-size: 12px; cursor: pointer;
}
.chip-add-confirm:disabled { background: #94a3b8; cursor: not-allowed; }

/* ------------------ NL filter input ------------------ */
.nl-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0 8px;
    flex-wrap: wrap;
}
.nl-filter-input {
    flex: 1;
    min-width: 240px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
}
.nl-filter-hint { color: var(--text-muted); font-size: 12px; }

.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: #f1f5f9; }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 4px; }

/* ------------------ Pivot Sales Analysis (full-pivot grid) ------------------ */
.pivot-table-wrap { overflow-x: auto; max-width: 100%; }
.pivot-table { min-width: 720px; }
.pivot-table th, .pivot-table td { white-space: nowrap; }
.pivot-grand td { background: #f1f5f9; }
.pivot-grand td:first-child { border-right: 2px solid #cbd5e1; }

/* Pivot row drill-in (2026-05-30) */
.pivot-row:hover td { background: #f8fafc; }
.pivot-row.expanded td { background: #fdf3f1; font-weight: 600; }
.pivot-disclosure {
    display: inline-block; width: 14px;
    color: #e15d4e; font-size: 12px; margin-right: 4px;
}
.pivot-row-detail > td {
    background: #f8fafc;
    border-top: 0; padding: 14px 18px;
}
.pivot-drill {
    display: flex; flex-direction: column; gap: 10px;
    border-left: 3px solid #b13a30; padding-left: 14px;
}
.pivot-drill-spark {
    background: #fff; border: 1px solid #e2e8f0;
    border-radius: 6px; padding: 6px 8px;
}
.pivot-drill-table { background: #fff; max-width: 720px; }
.pivot-drill-table thead th { background: #fdf3f1; color: #8f2c23; }

.chat-context-badge {
    background: #fef3c7; border: 1px solid #fde68a; color: #78350f;
    padding: 4px 10px; border-radius: 4px; font-size: 12px; display: inline-block;
    margin-bottom: 8px;
}
.chat-context-badge strong { color: #92400e; }

/* ------------------ Scope editor + error log ------------------ */
.scope-fieldset {
    margin: 0 0 14px 0;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
}
.scope-fieldset legend { padding: 0 6px; font-weight: 600; color: var(--text); }
.scope-multiselect { width: 100%; max-width: 480px; font-family: Calibri, 'Segoe UI', sans-serif; }
pre.error-log {
    background: #0f172a; color: #e5e7eb;
    padding: 12px 14px; border-radius: 6px;
    overflow-x: auto; font-size: 12px; line-height: 1.45;
    max-height: 70vh; overflow-y: auto;
}

/* ------------------ Welcome bot card ------------------ */
.welcome-bot {
    display: flex; gap: 12px;
    background: linear-gradient(135deg, #fff5f3, #ffeae6);
    border: 1px solid #fbd7d1;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
}
.welcome-bot-avatar {
    flex: 0 0 40px; height: 40px;
    background: var(--primary); color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
    box-shadow: 0 4px 12px rgba(221, 76, 63, 0.25);
}
.welcome-bot-body { flex: 1; }
.welcome-bot-greeting { font-size: 15px; margin: 0 0 4px; color: var(--text); }
.welcome-bot-line { margin: 0 0 6px; color: var(--text-muted); font-size: 13px; line-height: 1.4; }
.welcome-bot-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.welcome-bot-actions .btn { padding: 4px 12px; font-size: 12px; }
.welcome-bot-options { margin-top: 14px; }
.welcome-options-list {
    margin: 0; padding: 0 0 0 18px;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 6px;
    list-style: decimal;
}
.welcome-options-list li { color: var(--text-muted); padding: 2px 0; }
.welcome-option-chip {
    background: transparent; border: none; padding: 0;
    color: var(--primary); cursor: pointer; text-align: left;
    font-size: 14px; text-decoration: underline;
}
.welcome-option-chip:hover { color: var(--primary-hover); }

/* ------------------ Thinking strip (Claude/Gemini-style) ------------------ */
.thinking-strip {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px; color: var(--text-muted);
    margin-bottom: 8px;
}
.thinking-message { font-style: italic; transition: opacity 0.25s ease; }
.thinking-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--primary);
    animation: thinking-pulse 1.4s infinite ease-in-out;
}
.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinking-pulse {
    0%, 60%, 100% { opacity: 0.25; transform: scale(0.8); }
    30%           { opacity: 1.0;  transform: scale(1.2); }
}

/* =============================================================================
   Flock UI refresh — derived from CrewSync DS v3.2 tokens (2026-05-23)
   Overlays the existing legacy rules without removing them. Pages keep using
   their current class names; we re-skin via the tokens below.
   ============================================================================= */
:root {
  --flk-brand-50:  #EEF3FE;
  --flk-brand-100: #DCE5FC;
  --flk-brand-500: #2E5BD9;
  --flk-brand-600: #1A46C2;
  --flk-brand-700: #163A9F;
  --flk-brand-900: #0B2056;

  --flk-slate-50:  #F8FAFC;
  --flk-slate-100: #F1F5F9;
  --flk-slate-200: #E2E8F0;
  --flk-slate-300: #CBD5E1;
  --flk-slate-400: #94A3B8;
  --flk-slate-500: #64748B;
  --flk-slate-600: #475569;
  --flk-slate-700: #334155;
  --flk-slate-800: #1E293B;
  --flk-slate-900: #0F172A;

  --flk-accent: #DD4C3F;
  --flk-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --flk-shadow-md: 0 4px 8px -2px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --flk-focus: 0 0 0 3px rgba(46, 91, 217, 0.20);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  background: var(--flk-slate-50);
  color: var(--flk-slate-900);
}

/* Sidebar — bright, branded. Deep brand gradient at the top (brand
   header strip), warm cream body with strong amber/brand accents on
   active and hover. The active pill is a saturated brand color with
   a soft shadow, so it pops without being noisy. */
/* Sidebar + brand repainted to indigo 2026-05-25. The earlier indigo
   pass missed this block, so the brand panel was still rendering in the
   legacy amber. */
.sidebar {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 220px);
  border-right: 1px solid #e2e8f0;
  color: #1e293b;
  box-shadow: 4px 0 18px rgba(15, 23, 42, 0.06);
}
.brand {
  padding: 16px 18px;
  background: linear-gradient(135deg, #b13a30 0%, #e15d4e 100%);
  color: #fdf3f1;
  border-bottom: 2px solid #7c2820;
  box-shadow: 0 2px 10px rgba(177, 58, 48, 0.22);
  display: flex; align-items: center; gap: 12px;
}
.brand strong { color: #ffffff; font-size: 16px; letter-spacing: 0.5px; display: block; }
.brand-sub    { color: rgba(238, 242, 255, 0.85); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.brand-logo   {
  color: #ffffff;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 8px;
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 44px;
}
.brand-logo svg { display: block; width: 28px; height: 28px; color: #ffffff; }

/* User card + nav: indigo-on-slate palette (was amber 2026-05-24). The
   sidebar now reads as part of the indigo brand instead of the legacy
   yellow that fought the rest of the chrome. */
.user-card {
  padding: 12px 14px;
  background: linear-gradient(180deg, #f1f5f9 0%, #ffffff 100%);
  border-bottom: 1px solid #e2e8f0;
  border-radius: 0 0 8px 8px;
  margin: 0 8px 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}
.user-name { color: #0f172a; font-weight: 700; font-size: 13px; }
.user-card .badge { background: #ffffff; color: #334155; border: 1px solid #e2e8f0; }
.user-card .badge-client    { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.user-card .badge-internal  { background: #fdf3f1; color: #8f2c23; border-color: #f5c8c1; }
.user-card .badge-role      { background: #fdf3f1; color: #8f2c23; border: 1px solid #f5c8c1; }
.user-parent { color: #475569; font-size: 11px; margin-top: 4px; }

.nav { padding: 8px 0 24px; }
.nav-section {
  font-size: 11px;
  font-weight: 800;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 16px 18px 6px;
  border-top: 1px solid #e2e8f0;
  margin-top: 6px;
}
.nav-section:first-of-type { border-top: 0; margin-top: 0; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  margin: 2px 8px;
  border-radius: 8px;
  color: #1e293b;
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.nav-link:hover {
  background: #fdf3f1;
  color: #8f2c23;
  border-color: #f5c8c1;
  transform: translateX(2px);
}
.nav-link.active {
  background: linear-gradient(135deg, #b13a30 0%, #e15d4e 100%);
  color: #ffffff;
  font-weight: 700;
  border-color: #8f2c23;
  box-shadow: 0 2px 8px rgba(177, 58, 48, 0.30);
}
.nav-link.active .nav-icon { color: #ffffff; }
/* Featured nav-links (Dashboard / Chat / Insights / All Reports) — pill
   backgrounds removed 2026-05-26 per user ask. They now render like the
   rest of the sidebar in the resting state; the colored active gradient
   stays so the current page is still identifiable. Hover keeps the same
   subtle indigo wash the regular .nav-link uses. */
.nav-link-feature {
  background: transparent;
  color: #8f2c23;
  border-color: transparent;
  font-weight: 700;
}
.nav-link-feature:hover {
  background: #fdf3f1;
  border-color: #f5c8c1;
  transform: translateX(2px);
}
.nav-link-feature.active {
  background: linear-gradient(135deg, #b13a30 0%, #e15d4e 100%);
  color: #ffffff;
  border-color: #8f2c23;
}
.nav-link-feature-alt {
  background: transparent;
  color: #8f2c23;
  border-color: transparent;
  font-weight: 700;
}
.nav-link-feature-alt:hover {
  background: #fdf3f1;
  border-color: #f5c8c1;
  color: #8f2c23;
  transform: translateX(2px);
}
.nav-link-feature-alt.active {
  background: linear-gradient(135deg, #b13a30 0%, #e15d4e 100%);
  color: #ffffff;
  border-color: #8f2c23;
}
.nav-icon {
  color: #e15d4e; transition: color 140ms ease;
  flex: 0 0 18px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  font-size: 15px; line-height: 1;
}
.nav-link:hover .nav-icon { color: #8f2c23; }

/* IA v3 (2026-05-26) — divider + mini section header between the
   universal 7 nav items and the role-specific tail. */
.nav-divider {
  border: 0;
  border-top: 1px solid #e2e8f0;
  margin: 12px 12px 4px;
  height: 1px;
}
.nav-section-mini {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  padding: 6px 14px 4px;
  /* Breathing room so the flat IA-v5 sections read as distinct groups, with a
     hairline rule above each (except the first). 2026-06-01 */
  margin-top: 12px;
  border-top: 1px solid #eef2f6;
  padding-top: 10px;
}
.nav-section-mini:first-of-type { margin-top: 4px; border-top: 0; padding-top: 4px; }
html[data-theme="dark"] .nav-section-mini { border-top-color: #1e293b; color: #94a3b8; }
/* Count badge on the right of consolidated nav-links (e.g. Reports · 24). */
.nav-count {
  margin-left: auto;
  background: #e2e8f0;
  color: #475569;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}
.nav-link.active .nav-count { background: rgba(255, 255, 255, 0.22); color: #fff; }

/* Sign-out form / button — visually anchor at the bottom of the rail. */
.logout-form {
  margin: 16px 8px 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%);
  border: 1px solid #fecaca;
  border-radius: 8px;
  text-align: center;
}
.logout-form .btn {
  color: #b91c1c;
  font-weight: 700;
  font-size: 13px;
}
.logout-form .btn:hover { color: #7f1d1d; }

/* Forecast chart — Holt-Winters output rendered as inline SVG with a
   shaded confidence band. Legend chips line up under the chart. */
.forecast-chart { margin: 8px 0 16px; }
.forecast-chart svg { display: block; max-width: 100%; height: auto; background: #fff; border: 1px solid #e5e7eb; border-radius: 6px; }
.forecast-legend { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 12px; color: #475569; margin-top: 6px; }
.forecast-legend .fc-swatch { display: inline-block; width: 14px; height: 8px; vertical-align: middle; margin-right: 4px; border-radius: 2px; }
.forecast-legend .fc-swatch-hist { background: #0f172a; }
.forecast-legend .fc-swatch-fcst { background: #b45309; }
.forecast-legend .fc-swatch-band { background: #fde68a; opacity: 0.75; }
.forecast-legend .fc-method { font-style: italic; color: #78350f; }
.forecast-legend .fc-currency { font-weight: 600; color: #0f172a; }

/* Home-page narrative banner + per-role quick-action tiles. The banner
   is one sentence of role-specific framing above the KPI strip; the
   quick-actions are 2-3 anchor tiles for the most common drills.
   Repainted indigo 2026-05-24 to match the brand. */
.home-narrative {
  background: linear-gradient(90deg, rgba(225, 93, 78, 0.07) 0%, rgba(177, 58, 48, 0.02) 100%);
  border-left: 3px solid #e15d4e;
  padding: 10px 14px;
  margin: 4px 0 18px;
  border-radius: 4px;
  font-size: 13px;
  color: #334155;
}
.home-narrative strong { color: #8f2c23; }
.home-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 18px;
}
.home-quick-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease;
}
.home-quick-action:hover { background: #fdf3f1; border-color: #f5c8c1; }
.home-quick-action .qa-arrow { color: #e15d4e; font-weight: 700; }
/* Late override removed 2026-05-24 — was forcing red on the feature-alt
   active state, fighting the indigo gradient defined earlier. */

.nav-icon {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  opacity: 0.78;
  flex-shrink: 0;
}
.nav-link:hover .nav-icon { opacity: 1; }
.nav-link.active .nav-icon { opacity: 1; }

.nav-tag-pending {
  margin-left: auto;
  font-size: 10px; font-weight: 700;
  color: var(--flk-slate-500);
  background: var(--flk-slate-100);
  padding: 1px 6px;
  border-radius: 999px;
}

.logout-form { padding: 14px 18px; border-top: 1px solid var(--flk-slate-100); }
.logout-form .btn-link { color: var(--flk-slate-600); padding: 0; }
.logout-form .btn-link:hover { color: var(--flk-accent); }

/* Content surface */
.content { background: var(--flk-slate-50); }
.content h1 { color: var(--flk-slate-900); font-weight: 700; letter-spacing: -0.015em; }
.muted { color: var(--flk-slate-500); }

/* Cards / panels */
.panel, .kpi {
  background: #fff;
  border: 1px solid var(--flk-slate-200);
  border-radius: 12px;
  box-shadow: var(--flk-shadow-sm);
}
.kpi-label { color: var(--flk-slate-500); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.kpi-value { color: var(--flk-slate-900); }

/* Buttons */
.btn-primary {
  background: var(--flk-brand-600);
  border-color: var(--flk-brand-600);
  color: #fff;
}
.btn-primary:hover { background: var(--flk-brand-700); border-color: var(--flk-brand-700); }
.btn-primary:focus-visible { box-shadow: var(--flk-focus); }
.btn-secondary {
  background: #fff;
  color: var(--flk-slate-700);
  border-color: var(--flk-slate-300);
}
.btn-secondary:hover { background: var(--flk-slate-100); border-color: var(--flk-slate-400); }

/* Inputs */
.filter-bar input, .filter-bar select {
  border: 1px solid var(--flk-slate-300);
  border-radius: 8px;
  background: #fff;
  color: var(--flk-slate-900);
}
.filter-bar input:focus, .filter-bar select:focus {
  border-color: var(--flk-brand-500);
  box-shadow: var(--flk-focus);
  outline: none;
}

/* Chip row */
.hbi-chip { background: var(--flk-brand-50); color: var(--flk-brand-700); border: 1px solid var(--flk-brand-100); }
.hbi-chip-close { color: var(--flk-brand-700); }
.hbi-chip-close:hover { color: var(--flk-brand-900); }

/* Secondary KPI strip (invoice fare-breakdown) — visually softer than the
   primary tiles so the eye lands on Spend / Bookings / Travellers first. */
.kpi-grid-secondary { margin-top: 8px; }
.kpi-grid-secondary .kpi {
  background: #f8fafc;
  border-color: #eef2f7;
  box-shadow: none;
}
.kpi-grid-secondary .kpi-value { font-size: 18px; color: #334155; }
.kpi-grid-secondary .kpi-label { color: #64748b; }

/* Top filter bar — stacked single-column on phones. The default flex-wrap
   layout was leaving labels at 140px min-width which produces ragged
   2-column stacking on narrow viewports. Below 720px we stack everything. */
@media (max-width: 720px) {
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }
  .filter-bar label { min-width: 0; width: 100%; }
  .filter-bar label > span { display: block; margin-bottom: 4px; }
  .filter-bar input,
  .filter-bar select { width: 100%; box-sizing: border-box; }
  .filter-bar .btn { width: 100%; }
  .filter-bar .hbi-applying { justify-content: flex-start; }
  /* Sidebar collapses to a horizontal scroller on phones so the user
     can still reach every link without consuming the screen vertically. */
  .with-sidebar { grid-template-columns: 1fr; }
}

/* =========================================================================
   Top-right warehouse status chip (mounted in MainLayout via
   WarehouseStatusBadge.razor + warehouse-status-badge.js).
   ========================================================================= */
.content-topbar {
  display: flex;
  justify-content: flex-end;
  padding: 8px 4px 0;
  margin-bottom: -6px;
}
.wh-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #1f2937;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 5px 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.wh-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
  background: #94a3b8;
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.18);
}
.wh-dot-ok      { background: #16a34a; box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18); }
.wh-dot-busy    { background: #f59e0b; box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.22); animation: wh-pulse 1.4s ease-in-out infinite; }
.wh-dot-err     { background: #dc2626; box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.22); }
.wh-dot-unknown { background: #94a3b8; box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.18); }
@keyframes wh-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.3); }
}
.wh-label    { display: inline-flex; gap: 4px; align-items: baseline; }
.wh-range    { color: #475569; font-weight: 500; }
.wh-loaded   { color: #64748b; font-style: italic; }
.wh-refresh {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: 6px; padding: 3px 9px;
  background: #f1f5f9; color: #1e293b;
  border: 1px solid #cbd5e1; border-radius: 6px;
  font-size: 11px; font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.wh-refresh:hover:not(:disabled) { background: #e2e8f0; border-color: #94a3b8; }
.wh-refresh:disabled { opacity: 0.55; cursor: progress; }

/* Sidebar contrast lift block REMOVED 2026-05-24 — the brand-coloured
   rules above the collapsible section now own all sidebar text colours.
   The previous !important overrides were fighting the .active state's
   white text. */

/* ------------------------------------------------------------------
   Natural-language filter input ("Ask: Dubai hotels Q1 2026") hidden
   app-wide 2026-05-24 per user request — keep the markup so the wiring
   stays intact for a future re-enable; just don't paint it.
   ------------------------------------------------------------------ */
.nl-filter { display: none !important; }

/* ------------------------------------------------------------------
   /insights — standing proactive-insight feed. Cards arranged in a
   responsive grid; severity drives the left border + pill colour.
   ------------------------------------------------------------------ */
.insight-meta {
    display: flex; align-items: center; justify-content: space-between;
    margin: 8px 0 14px;
}
.insight-empty {
    background: #f8fafc; border: 1px dashed #cbd5e1;
    border-radius: 10px; padding: 24px;
    max-width: 720px;
}
.insight-empty strong { display: block; font-size: 15px; color: #0f172a; margin-bottom: 4px; }

/* Insights sections (2026-05-26) — group cards by domain area so the
   page reads like a briefing rather than a flat list. Section shows
   icon + label + count + peak-severity pill. */
.insight-section {
    margin: 24px 0 8px;
}
.insight-section + .insight-section { margin-top: 32px; }
.insight-section-tabbed { margin-top: 8px; }
.insight-section-tabbed .insight-section-desc { margin-top: 0; }

/* Section tabs (2026-05-26).
   Sits between the meta row and the cards. Horizontal flex row,
   wraps on narrow viewports. Each tab is a small pill with icon +
   label + count + (optional) peak-severity pill. Active tab carries
   the indigo gradient + white text so the page reads as "you're
   here". The All tab has the ✦ icon. */
.insight-tabs {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin: 16px 0 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border, #e2e8f0);
}
.insight-tab {
    display: inline-flex; align-items: center; gap: 8px;
    background: #fff; border: 1px solid #e2e8f0;
    color: #334155; cursor: pointer;
    padding: 8px 12px; border-radius: 999px;
    font-size: 13px; font-weight: 600;
}
.insight-tab:hover { background: #fdf3f1; border-color: #f5c8c1; color: #8f2c23; }
.insight-tab:focus-visible { outline: 2px solid #e15d4e; outline-offset: 2px; }
.insight-tab-active {
    background: linear-gradient(135deg, #b13a30 0%, #e15d4e 100%);
    border-color: #b13a30; color: #fff;
    box-shadow: 0 2px 6px rgba(177, 58, 48, 0.30);
}
.insight-tab-active:hover { color: #fff; }
.insight-tab-icon { font-size: 15px; line-height: 1; }
.insight-tab-label { white-space: nowrap; }
.insight-tab-count {
    background: rgba(225, 93, 78, 0.10);
    color: #b13a30;
    padding: 1px 8px; border-radius: 999px;
    font-size: 11px; font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.insight-tab-active .insight-tab-count {
    background: rgba(255, 255, 255, 0.18); color: #fff;
}
.insight-tab-peak {
    margin-left: 2px;
    font-size: 10px;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.insight-tab-active .insight-tab-peak { filter: brightness(1.4); }

/* Dark-mode treatment for tabs */
html[data-theme="dark"] .insight-tabs { border-bottom-color: #334155; }
html[data-theme="dark"] .insight-tab { background: #1e293b; border-color: #334155; color: #cbd5e1; }
html[data-theme="dark"] .insight-tab:hover { background: #7c2820; border-color: #b13a30; color: #fbe4e0; }
html[data-theme="dark"] .insight-tab-count { background: rgba(225, 93, 78, 0.20); color: #f5c8c1; }
.insight-section-head {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 4px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--primary-100, #fbe4e0);
}
.insight-section-icon {
    font-size: 20px; line-height: 1;
    width: 32px; height: 32px;
    background: var(--primary-50, #fdf3f1);
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 32px;
}
.insight-section-title {
    font-size: 17px; font-weight: 800;
    color: #0f172a; margin: 0;
    letter-spacing: -0.01em;
}
.insight-section-count {
    background: #f1f5f9; color: #475569;
    padding: 2px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.insight-section-peak {
    margin-left: auto;
}
.insight-section-desc {
    margin: 6px 0 12px;
    font-size: 13px; color: #64748b;
}

.insight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
}
.insight-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #94a3b8;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex; flex-direction: column; gap: 8px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: box-shadow 140ms ease, transform 140ms ease;
}
.insight-card:hover { box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08); transform: translateY(-1px); }
.insight-card-head { display: flex; align-items: center; justify-content: space-between; }
.insight-kind {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: #475569;
}
.insight-sev-pill {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    padding: 2px 8px; border-radius: 999px;
    background: #f1f5f9; color: #334155;
}
.insight-headline { margin: 0; font-size: 15px; color: #0f172a; }
.insight-evidence, .insight-action { margin: 0; font-size: 13px; line-height: 1.5; color: #334155; }
.insight-action { color: #1e293b; }
.insight-drill {
    margin-top: 4px; align-self: flex-start;
    font-size: 12px; font-weight: 600;
    color: #b13a30; text-decoration: none;
    padding: 4px 10px; border-radius: 6px;
    background: #fdf3f1; border: 1px solid #f5c8c1;
    transition: background 120ms ease, border-color 120ms ease;
}
.insight-drill:hover { background: #f5c8c1; border-color: #e8857a; }

.insight-sev-critical { border-left-color: #dc2626; }
.insight-sev-critical .insight-sev-pill { background: #fee2e2; color: #991b1b; }
.insight-sev-warning  { border-left-color: #d97706; }
.insight-sev-warning  .insight-sev-pill { background: #fed7aa; color: #9a3412; }
.insight-sev-watch    { border-left-color: #e15d4e; }
.insight-sev-watch    .insight-sev-pill { background: #fbe4e0; color: #8f2c23; }
.insight-sev-info     { border-left-color: #0ea5e9; }
.insight-sev-info     .insight-sev-pill { background: #e0f2fe; color: #075985; }

/* ------------------------------------------------------------------
   Build-chip on the home page (replaced the multi-paragraph release
   banner 2026-05-24). One-line indicator with a "What's new" link to
   the dedicated /whats-new page.
   ------------------------------------------------------------------ */
.build-chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 12px; margin: 8px 0 4px;
    background: #fdf3f1; border: 1px solid #f5c8c1;
    border-radius: 999px;
    font-size: 12px; color: #1e1b4b;
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(15,23,42,0.06));
}
.build-chip-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #dd4c3f;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.18);
}
.build-chip-label   { font-weight: 700; }
.build-chip-sep     { opacity: 0.4; }
.build-chip-version { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.build-chip-link {
    margin-left: 4px; padding: 2px 8px;
    background: #dd4c3f; color: #fff;
    text-decoration: none; border-radius: 999px;
    font-weight: 600;
    transition: background 120ms ease;
}
.build-chip-link:hover { background: #b13a30; }

/* ------------------------------------------------------------------
   Release-notes layout (/whats-new). Card-per-batch with version pill.
   ------------------------------------------------------------------ */
.release-notes {
    display: flex; flex-direction: column; gap: 16px;
    margin-top: 16px;
    max-width: 920px;
}
.release {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #dd4c3f;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.release header { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.release-version {
    display: inline-block; padding: 2px 8px;
    background: #fdf3f1; color: #b13a30;
    border-radius: 999px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px; font-weight: 600;
}
.release h2 { margin: 0; font-size: 16px; color: #0f172a; }
.release ul { margin: 0; padding-left: 20px; line-height: 1.55; font-size: 13px; color: #334155; }
.release li + li { margin-top: 6px; }
.release code {
    background: #f1f5f9; padding: 1px 5px;
    border-radius: 3px; font-size: 12px; color: #1e293b;
}

/* ------------------------------------------------------------------
   NavProgressBar — slim 3px bar at the very top of the viewport that
   animates while a page navigation is in flight. JS owns the show /
   advance / hide lifecycle so we get instant feedback the moment a
   nav-link is clicked (no SignalR round-trip required).
   ------------------------------------------------------------------ */
.nav-progress {
    position: fixed; top: 0; left: 0; right: 0;
    height: 3px;
    z-index: 9999;
    pointer-events: none;
    transform: translateY(-100%);
    transition: transform 120ms ease;
}
.nav-progress.is-active { transform: translateY(0); }
.nav-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #dd4c3f 0%, #e8857a 50%, #dd4c3f 100%);
    background-size: 200% 100%;
    box-shadow: 0 0 8px rgba(225, 93, 78,0.55);
    transition: width 180ms cubic-bezier(0.4, 0, 0.2, 1);
    animation: nav-progress-shimmer 1.6s linear infinite;
}
.nav-progress.is-done .nav-progress-bar { width: 100% !important; transition: width 200ms ease-out; }
@keyframes nav-progress-shimmer {
    from { background-position:  200% 0; }
    to   { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
    .nav-progress-bar { animation: none; transition: width 60ms linear; }
}

/* Navigation click-blocking scrim (driven by nav-progress.js). Appears the
   instant a menu link is clicked and swallows further clicks until the next
   page paints — stops rapid clicking from stacking concurrent page loads. */
.nav-loading-scrim {
    position: fixed; inset: 0;
    z-index: 9998;                 /* just below the 9999 progress bar */
    display: flex; align-items: center; justify-content: center;
    background: rgba(15, 23, 42, 0.32);
    opacity: 0; visibility: hidden;
    transition: opacity 120ms ease, visibility 0s linear 120ms;
    pointer-events: none;
}
.nav-loading-scrim.is-on {
    opacity: 1; visibility: visible;
    transition: opacity 120ms ease;
    pointer-events: auto;          /* swallow clicks while loading */
    cursor: progress;
}
.nav-loading-card {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.22);
    padding: 22px 28px;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    min-width: 220px;
}
.nav-loading-spinner {
    width: 30px; height: 30px;
    border: 3px solid var(--primary-100, #fbe4e0);
    border-top-color: var(--primary, #dd4c3f);
    border-radius: 50%;
    animation: nav-loading-spin 0.7s linear infinite;
}
.nav-loading-text { font-weight: 700; font-size: 15px; color: var(--text, #0f172a); }
.nav-loading-sub  { font-size: 12px; color: var(--text-muted, #64748b); }
/* "Taking longer than usual" escape — hidden until the scrim flips to .is-slow
   (after ~6s) so a normal fast nav never shows it, but a stuck page always
   offers a way out. */
.nav-loading-slow {
    display: none;
    margin-top: 6px; max-width: 280px; text-align: center;
    font-size: 12px; color: var(--text-muted, #64748b); line-height: 1.4;
}
.nav-loading-scrim.is-slow .nav-loading-slow { display: block; }
.nav-loading-dismiss {
    margin-top: 8px;
    background: var(--primary, #dd4c3f); color: #fff;
    border: 0; border-radius: 8px; padding: 6px 14px;
    font-size: 12px; font-weight: 600; cursor: pointer;
}
.nav-loading-dismiss:hover { filter: brightness(1.08); }
@keyframes nav-loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .nav-loading-spinner { animation-duration: 1.4s; }
}
html[data-theme="dark"] .nav-loading-card { background: #0b1220; border-color: #1e293b; }

/* =========================================================================
   Desktop top banner — ITL World corporate header (2026-05-26).
   Sits ABOVE the .page grid; sticky to viewport top while you scroll.
   Hidden on mobile (the existing .mobile-topbar takes over under 1024px).
   Sidebar's `top: 0` is overridden to start at the topbar's bottom so
   nothing visually overlaps.
   ========================================================================= */
/* Phase 5+ refresh (2026-05-26) — 3-section topbar.
   Grid: Left (corporate logo + name) | Center (Flock system identity) | Right (avatar).
   Each side gets 1fr so the center stays optically centred even with
   different content widths on either flank. */
.app-topbar { display: none; }
@media (min-width: 1024px) {
    .app-topbar {
        position: sticky;
        top: 0;
        z-index: 950;
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: var(--space-4);
        min-height: 64px;
        padding: 0 var(--space-5);
        background: linear-gradient(90deg, #1e1b4b 0%, #b13a30 50%, #e15d4e 100%);
        color: #fff;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.10);
    }
    /* Push the desktop sidebar down so it doesn't overlap the banner.
       !important is load-bearing here — a later .sidebar rule at line ~3559
       sets position:relative (for the collapsible-rail transition) and
       the mobile default at line ~201 set z-index:1000. Without the
       overrides the sidebar drew ABOVE the topbar (covering the left
       brand block) and crept up to viewport y=0. */
    .sidebar {
        position: sticky !important;
        top: 64px !important;
        height: calc(100vh - 64px) !important;
        z-index: 1 !important;
        transform: none !important;
        box-shadow: none;
    }
}
.app-topbar-left  { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.app-topbar-center { display: flex; align-items: center; justify-content: center; min-width: 0; }
.app-topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-3); min-width: 0; }
.app-topbar-hamburger {
    background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.18);
    color: #fff; width: 36px; height: 36px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.app-topbar-hamburger:hover { background: rgba(255,255,255,0.18); }
.app-topbar-hamburger:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (min-width: 1024px) {
    /* On desktop the hamburger is decorative-only — the sidebar is always
       visible. Keep it for symmetry with the CrewSync layout. */
    .app-topbar-hamburger { display: none; }
}
.app-topbar-sys {
    display: inline-flex; align-items: center; gap: 10px;
    color: #fff; text-decoration: none;
    padding: 4px 12px; border-radius: 10px;
}
.app-topbar-sys:hover { background: rgba(255,255,255,0.10); }
.app-topbar-sys-logo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,0.14);
    flex: 0 0 32px;
}
.app-topbar-sys-text { display: flex; flex-direction: column; line-height: 1.15; }
.app-topbar-sys-name {
    font-weight: 800; font-size: 17px; letter-spacing: 0.04em; color: #fff;
}
.app-topbar-sys-sub {
    font-size: 11.5px; color: rgba(255, 255, 255, 0.82); letter-spacing: 0.02em;
}
.app-topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    color: #fff;
    text-decoration: none;
    min-width: 0;
    padding: 4px 8px;
    border-radius: 10px;
}
.app-topbar-brand:hover { background: rgba(255,255,255,0.10); }
.app-topbar-logo {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    flex: 0 0 36px;
}
.app-topbar-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}
.app-topbar-name {
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.02em;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

/* Theme switcher inside the avatar dropdown (2026-05-26). Three-button
   segmented control: Light / Dark / System. Active button highlighted
   via [data-theme-mode] attribute on <html>, set by theme-switcher.js. */
.app-topbar-theme {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 8px 14px;
}
.app-topbar-theme-label {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: #475569;
}
.app-topbar-theme-seg {
    display: inline-flex;
    background: #f1f5f9; border-radius: 999px; padding: 2px;
    border: 1px solid #e2e8f0;
}
.app-topbar-theme-btn {
    background: transparent; border: 0; cursor: pointer;
    color: #475569; font-size: 11px; font-weight: 600;
    padding: 4px 10px; border-radius: 999px;
}
.app-topbar-theme-btn:hover { color: #1e293b; }
html[data-theme-mode="light"]  .app-topbar-theme-btn[data-theme-set="light"]  { background: #fff; color: #1e293b; box-shadow: 0 1px 2px rgba(15,23,42,0.10); }
html[data-theme-mode="dark"]   .app-topbar-theme-btn[data-theme-set="dark"]   { background: #fff; color: #1e293b; box-shadow: 0 1px 2px rgba(15,23,42,0.10); }
html[data-theme-mode="system"] .app-topbar-theme-btn[data-theme-set="system"] { background: #fff; color: #1e293b; box-shadow: 0 1px 2px rgba(15,23,42,0.10); }
.app-topbar-tag {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.82);
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.app-topbar-user {
    display: flex;
    flex-direction: column;
    text-align: right;
    line-height: 1.25;
    color: #fff;
    font-size: 12px;
    max-width: 220px;
    overflow: hidden;
}
.app-topbar-user-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-topbar-user-role {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.82);
}
.app-topbar-logout { margin: 0; padding: 0; }
.app-topbar-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.app-topbar-logout-btn:hover,
.app-topbar-logout-btn:focus-visible {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.45);
}

/* Right-side ITL World corporate mark (2026-05-26 — brand inversion).
   Flock is primary on the left; ITL World is the "operator" credit on
   the right, with a small globe + lettermark. */
.app-topbar-corporate {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
}
.app-topbar-corporate-text {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #fff;
}
.app-topbar-sep {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.18);
    margin: 0 2px;
}

/* Bell icon — placeholder for user notifications. Always renders the
   dot indicator; future: hide when there are zero unread. */
.app-topbar-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.88);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    text-decoration: none;
    transition: background 0.15s ease;
}
.app-topbar-bell:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}
.app-topbar-bell-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 8px; height: 8px;
    background: #f59e0b;
    border: 1.5px solid #b13a30;
    border-radius: 50%;
}

/* Avatar dropdown (2026-05-26 — consolidated identity anchor).
   Click the avatar circle to drop a panel with profile + powered-by +
   sign-out. Uses native <details>/<summary> so no JS is required; click
   anywhere off the panel closes it (browser default). */
.app-topbar-avatar-menu {
    position: relative;
}
.app-topbar-avatar-menu summary {
    list-style: none;
    cursor: pointer;
}
.app-topbar-avatar-menu summary::-webkit-details-marker { display: none; }
.app-topbar-avatar-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 4px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    color: #fff;
    transition: background 0.15s ease;
}
.app-topbar-avatar-trigger:hover {
    background: rgba(255, 255, 255, 0.16);
}
.app-topbar-avatar-caret {
    color: rgba(255, 255, 255, 0.7);
    transition: transform 0.15s ease;
}
.app-topbar-avatar-menu[open] .app-topbar-avatar-caret {
    transform: rotate(180deg);
}
.app-topbar-avatar-panel {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    right: 0 !important;
    left: auto !important;
    width: 300px !important;
    max-width: 90vw;
    background: #ffffff !important;
    color: #1e293b !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22),
                0 2px 6px rgba(15, 23, 42, 0.10) !important;
    padding: 16px 18px !important;
    z-index: 1200 !important;
    /* Defensive: cancel any inherited flex/grid layout from the topbar
       parents — the panel must be a normal block, not a flex item. */
    display: block !important;
    margin: 0 !important;
    line-height: 1.45 !important;
    text-align: left !important;
    font-size: 13px !important;
    font-weight: 400 !important;
}
/* The panel triangles into the topbar at its top edge — adds a small
   arrow so it visually connects to the avatar. */
.app-topbar-avatar-panel::before {
    content: "";
    position: absolute;
    top: -7px;
    right: 16px;
    width: 14px; height: 14px;
    background: #ffffff;
    border-left: 1px solid #e2e8f0;
    border-top: 1px solid #e2e8f0;
    transform: rotate(45deg);
}
.app-topbar-avatar-head {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin-bottom: 14px !important;
    padding-bottom: 12px !important;
    border-bottom: 1px solid #e2e8f0 !important;
}
.app-topbar-avatar-lg {
    width: 44px !important;
    height: 44px !important;
    font-size: 14px !important;
}
.app-topbar-avatar-id { min-width: 0; }
.app-topbar-avatar-name {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-topbar-avatar-email {
    font-size: 12px;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-topbar-avatar-kv {
    display: grid !important;
    grid-template-columns: 70px 1fr !important;
    gap: 6px 14px !important;
    margin: 0 0 8px !important;
    font-size: 12px !important;
    align-items: baseline !important;
}
.app-topbar-avatar-kv dt {
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 10px;
    align-self: center;
}
.app-topbar-avatar-kv dd {
    color: #334155;
    font-weight: 600;
    margin: 0;
}
.app-topbar-avatar-sep {
    border-top: 1px solid #e2e8f0;
    margin: 10px 0;
}
.app-topbar-avatar-poweredby {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 11px !important;
    color: #64748b !important;
    letter-spacing: 0.02em !important;
    padding: 4px 0 !important;
}
.app-topbar-avatar-poweredby strong {
    color: #1e293b;
    font-weight: 700;
    letter-spacing: 0.06em;
}
.app-topbar-avatar-signout {
    width: 100% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    background: #fee2e2 !important;
    color: #991b1b !important;
    border: 1px solid #fecaca !important;
    padding: 9px 12px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    text-transform: none !important;
    margin-top: 4px !important;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.app-topbar-avatar-signout:hover {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}

.app-topbar-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fbbf24 0%, #f97316 100%);
    color: #1e1b4b;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 0.04em;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12) inset;
}

/* ============================================================
   "Other reports · jump anywhere" tile grid (2026-05-26).
   Used on /reports/all to give users a one-click jump to any
   other report from the same page. Same look-and-feel as the
   redesign mockup in docs/flock-redesign-mockup-2026-05-26.html.
   ============================================================ */
.report-tiles-section { margin: 20px 0 24px; }
.report-tiles-head {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 12px; gap: 16px;
}
.report-tiles-head h2 {
    font-size: 16px; font-weight: 700; color: #1e293b; margin: 0;
}
.report-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.report-tile {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    text-decoration: none;
    color: inherit;
    display: flex; flex-direction: column; gap: 6px;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    min-height: 100px;
}
.report-tile:hover {
    border-color: #efa79d;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(177, 58, 48, 0.10);
}
.report-tile.active {
    border-color: #e15d4e;
    box-shadow: 0 0 0 2px rgba(225, 93, 78, 0.18);
}
.report-tile-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px;
    background: #fdf3f1; color: #8f2c23;
    flex: 0 0 36px;
}
.report-tile-title { font-size: 13px; font-weight: 700; color: #0f172a; }
.report-tile-desc {
    font-size: 11px; color: #64748b; line-height: 1.4; flex: 1;
}
.report-tile-meta {
    margin-top: auto;
    padding-top: 4px;
    font-size: 10px;
    display: flex; gap: 6px; align-items: center;
}
.report-tile-category {
    background: #f1f5f9; color: #334155;
    padding: 2px 8px; border-radius: 999px;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.report-tile-category.cat-core      { background: #fdf3f1; color: #8f2c23; }
.report-tile-category.cat-air       { background: #dbeafe; color: #b13a30; }
.report-tile-category.cat-hotel     { background: #fef3c7; color: #92400e; }
.report-tile-category.cat-finance   { background: #dcfce7; color: #166534; }
.report-tile-category.cat-sales     { background: #fce7f3; color: #9d174d; }
.report-tile-category.cat-ops       { background: #cffafe; color: #0e7490; }
.report-tile-category.cat-exec      { background: #ede9fe; color: #5b21b6; }
.report-tile-category.cat-insurance { background: #ffe4e6; color: #9f1239; }
.report-tile-category.cat-ai        { background: #f3e8ff; color: #6b21a8; }

/* =========================================================================
   Collapsible sidebars — main nav + per-page filter panel — v2.
   Default state = EXPANDED on both rails. Collapse is opt-in via the
   chevron button in each rail's header (injected by sidebar-toggle.js).
   Collapsed state is persisted per rail in localStorage.
   ========================================================================= */

/* The chevron toggle that goes into the brand row + fs-head. Two variants:
   - Default (filter sidebar header / collapsed brand rail): subtle grey
     border on white background.
   - Inside the brand row (indigo gradient): translucent-white pill so it
     stays visible without fighting the brand colour. */
.rail-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  margin-left: auto;
  background: transparent;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  color: #475569;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
  flex: 0 0 auto;
}
.rail-toggle:hover { background: #f1f5f9; color: #0f172a; border-color: #cbd5e1; }
.brand .rail-toggle {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.36);
  color: #ffffff;
}
.brand .rail-toggle:hover { background: rgba(255,255,255,0.28); border-color: rgba(255,255,255,0.55); color: #ffffff; }

/* Logo is always visible — in both expanded and collapsed states. Never
   hidden by anything in the collapsed cascade. Bumped in the collapsed
   rail so it stays the visual anchor when the wordmark is gone. */
.sidebar .brand .brand-logo {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.sidebar .brand .brand-logo svg { display: block; }
.sidebar.is-collapsed .brand .brand-logo {
  width: 40px; height: 40px;
  background: #fff7ed;
  border: 1px solid #fde68a;
  border-radius: 10px;
  color: #b45309;
  box-shadow: 0 1px 3px rgba(180, 83, 9, 0.10);
}
.sidebar.is-collapsed .brand .brand-logo svg { width: 24px; height: 24px; }

/* --- Main nav rail (.sidebar) --- */
.sidebar {
  position: relative;
  transition: width 160ms ease, min-width 160ms ease;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; }

/* Collapsed: 64px rail, icons-only nav, brand logo only, no text noise. */
.sidebar.is-collapsed { width: 64px !important; min-width: 64px !important; padding: 12px 6px; }
.sidebar.is-collapsed .brand {
  flex-direction: column;
  gap: 6px;
  padding: 6px 0 10px;
  border-bottom: 1px solid #f1f5f9;
}
.sidebar.is-collapsed .brand > div { display: none; }            /* hides the wordmark column */
.sidebar.is-collapsed .brand-sub  { display: none; }
.sidebar.is-collapsed .user-card  { display: none; }
.sidebar.is-collapsed .nav-section{ display: none; }
.sidebar.is-collapsed .logout-form{ text-align: center; }
.sidebar.is-collapsed .logout-form .btn { font-size: 0; padding: 6px; }
.sidebar.is-collapsed .logout-form .btn::before {
  content: "⎋";
  font-size: 16px;
  line-height: 1;
  color: #64748b;
}

/* font-size:0 hides the text node child while the .nav-icon span keeps
   its own explicit font size. Cleaner than wrapping every label in a span. */
.sidebar.is-collapsed .nav-link {
  display: flex; justify-content: center; align-items: center;
  font-size: 0;
  padding: 9px 0;
  margin: 2px 4px;
  border-radius: 8px;
  position: relative;
}
.sidebar.is-collapsed .nav-link .nav-icon {
  font-size: 16px;
  margin: 0;
}

/* Hover popout label (works on the collapsed rail). */
.sidebar.is-collapsed .nav-link::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #0f172a;
  color: #fff;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
  z-index: 50;
}
.sidebar.is-collapsed .nav-link:hover::after { opacity: 1; }

/* --- Filter panel rail (.filter-sidebar) --- */
.filter-sidebar {
  position: relative;
  transition: width 160ms ease, min-width 160ms ease, flex-basis 160ms ease, padding 160ms ease;
}
.filter-sidebar .fs-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}

/* Collapsed: 44px strip with vertical "Filters" label + the chevron. */
.filter-sidebar.is-collapsed {
  width: 44px !important;
  min-width: 44px !important;
  flex: 0 0 44px !important;
  padding: 10px 4px;
  overflow: hidden;
}
.filter-sidebar.is-collapsed .fs-head {
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}
.filter-sidebar.is-collapsed .fs-head h3 {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #b45309;
  margin: 6px 0 0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
}
.filter-sidebar.is-collapsed .fs-head-actions,
.filter-sidebar.is-collapsed .nl-filter,
.filter-sidebar.is-collapsed .fs-section,
.filter-sidebar.is-collapsed .fs-foot { display: none !important; }
.filter-sidebar.is-collapsed .rail-toggle { margin: 0 auto; }

/* =========================================================================
   Dark mode (2026-05-26).
   Applied when <html> carries data-theme="dark". The theme-switcher.js
   sets that attribute from localStorage + prefers-color-scheme.

   This overrides the *core* surface tokens — body, surface, border,
   text, slate-* — and the most-visible page chrome (sidebar, panels,
   tables, KPI tiles, filter cards, top filter bar). Pages that
   hard-coded hex colors for one-off effects will still render in their
   original colors; sweep those into tokens as they show up.
   ========================================================================= */
html[data-theme="dark"] {
    --bg:         #0f172a;
    --surface:    #1e293b;
    --text:       #e2e8f0;
    --text-muted: #94a3b8;
    --border:     #334155;
    --slate-50:   #0f172a;
    --slate-100:  #1e293b;
    --slate-200:  #334155;
    --slate-300:  #475569;
    --slate-500:  #94a3b8;
    --slate-700:  #cbd5e1;
    --slate-900:  #f1f5f9;
    color-scheme: dark;
}
html[data-theme="dark"] body { background: var(--bg); color: var(--text); }
html[data-theme="dark"] .panel,
html[data-theme="dark"] .kpi,
html[data-theme="dark"] .filter-bar,
html[data-theme="dark"] .report-top-filter-bar,
html[data-theme="dark"] .report-tile,
html[data-theme="dark"] .ms-filter.ms-open,
html[data-theme="dark"] .fs-foot {
    background: #1e293b; border-color: #334155; color: #e2e8f0;
}
html[data-theme="dark"] .filter-sidebar { background: #0b1220; border-color: #1e293b; }
html[data-theme="dark"] .sidebar { background: #0b1220; border-right-color: #1e293b; }
html[data-theme="dark"] .content { background: #0f172a; }
html[data-theme="dark"] .nav-link { color: #cbd5e1; }
html[data-theme="dark"] .nav-link:hover { background: #1e293b; color: #fbe4e0; }
html[data-theme="dark"] .nav-link.active,
html[data-theme="dark"] .nav-link[aria-current="page"] {
    background: linear-gradient(135deg, #b13a30 0%, #e15d4e 100%); color: #fff;
}
html[data-theme="dark"] table th { background: #1e293b; color: #94a3b8; border-bottom-color: #334155; }
html[data-theme="dark"] table td { border-bottom-color: #1e293b; }
html[data-theme="dark"] .data-table tr:hover td { background: #1e293b; }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .ms-search {
    background: #0f172a; color: #e2e8f0; border-color: #334155;
}
html[data-theme="dark"] .ms-filter { border-bottom-color: #1e293b; }
html[data-theme="dark"] .fs-section { border-top-color: #1e293b; }
html[data-theme="dark"] .fs-chip { background: #1e1b4b; border-color: #7c2820; color: #f5c8c1; }
html[data-theme="dark"] .fs-chip:hover { background: #7c2820; }
html[data-theme="dark"] .mini-bar-track { background: #1e293b; }
html[data-theme="dark"] .hbar-track { background: #1e293b; }
html[data-theme="dark"] .alert-error { background: #450a0a; color: #fca5a5; border-color: #7f1d1d; }
html[data-theme="dark"] .alert-info  { background: #082f49; color: #bae6fd; border-color: #0c4a6e; }
html[data-theme="dark"] .muted { color: #94a3b8; }
html[data-theme="dark"] h1, html[data-theme="dark"] h2, html[data-theme="dark"] h3 { color: #f1f5f9; }
html[data-theme="dark"] .kpi-label { color: #94a3b8; }
html[data-theme="dark"] .kpi-value { color: #f1f5f9; }
/* OSM map keeps its light tiles; subtle border so it doesn't blend into the page bg. */
html[data-theme="dark"] .osm-map { border-color: #334155; }
/* Theme-switcher segment: invert the active-state highlight on dark. */
html[data-theme="dark"] .app-topbar-theme-seg { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .app-topbar-theme-btn { color: #94a3b8; }
html[data-theme="dark"] html[data-theme-mode="light"]  .app-topbar-theme-btn[data-theme-set="light"],
html[data-theme="dark"][data-theme-mode="light"]  .app-topbar-theme-btn[data-theme-set="light"],
html[data-theme="dark"][data-theme-mode="dark"]   .app-topbar-theme-btn[data-theme-set="dark"],
html[data-theme="dark"][data-theme-mode="system"] .app-topbar-theme-btn[data-theme-set="system"] {
    background: #0f172a; color: #e2e8f0;
}

/* ---- Dark-mode polish (2026-05-26 follow-up) ----
   Pages that hard-coded one-off pastel surfaces (chat scope chips,
   suggestion chips, snapshot banners, executive panels) need explicit
   dark equivalents — the global token overrides only catch elements
   that use vars. Strategy: darken the surface, light up the text. */

/* Chat surfaces */
html[data-theme="dark"] .chat-snapshot-banner { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html[data-theme="dark"] .chat-snapshot-banner-warn { background: #422006; border-color: #92400e; color: #fde68a; }
html[data-theme="dark"] .chat-scope-card { background: #0f172a; border-color: #334155; }
html[data-theme="dark"] .chat-scope-chip { background: #1e293b; border-color: #334155; color: #cbd5e1; }
html[data-theme="dark"] .chat-scope-chip strong { color: #fde68a; }
html[data-theme="dark"] .chat-scope-chip-role     { background: #422006; border-color: #92400e; color: #fde68a; }
html[data-theme="dark"] .chat-scope-chip-role strong { color: #fef3c7; }
html[data-theme="dark"] .chat-scope-chip-tenant   { background: #064e3b; border-color: #047857; color: #d1fae5; }
html[data-theme="dark"] .chat-scope-chip-tenant strong { color: #6ee7b7; }
html[data-theme="dark"] .chat-scope-chip-internal { background: #8f2c23; border-color: #b13a30; color: #dbeafe; }
html[data-theme="dark"] .chat-scope-chip-internal strong { color: #93c5fd; }
html[data-theme="dark"] .chat-scope-chip-currency { background: #4c1d95; border-color: #6d28d9; color: #ede9fe; }
html[data-theme="dark"] .chat-scope-chip-currency strong { color: #c4b5fd; }
html[data-theme="dark"] .chat-scope-chip-date     { background: #7f1d1d; border-color: #991b1b; color: #fecaca; }
html[data-theme="dark"] .chat-scope-chip-date strong { color: #fca5a5; }
html[data-theme="dark"] .chat-chip { background: #1e293b; border-color: #334155; color: #cbd5e1; }
html[data-theme="dark"] .chat-chip:hover:not(:disabled) { background: #8f2c23; }
html[data-theme="dark"] .chat-bubble { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html[data-theme="dark"] .chat-thread { background: transparent; }
html[data-theme="dark"] .chat-pinned-hints { background: #064e3b; border-color: #065f46; color: #d1fae5; }
html[data-theme="dark"] .chat-pinned-hint { background: #022c22; border-color: #047857; color: #d1fae5; }

/* Executive / CEO Travel Advisor panels — pages set their own theme via
   the page's theme dropdown (Midnight/Slate/Aurora/Carbon/Boardroom) so
   we DON'T override .ceo-* here. Only normalise the chrome below the
   page's own theme — sidebar, scrollbars, OSM map borders. */

/* OSM map — Leaflet tiles are raster PNGs in light style; we can't
   recolour them, but we CAN fade them subtly + darken the surrounding
   chrome so the map doesn't look like a blinding light box on dark. */
html[data-theme="dark"] .osm-map { filter: brightness(0.85) saturate(0.85); border-color: #334155; }
html[data-theme="dark"] .leaflet-control-attribution {
    background: rgba(15, 23, 42, 0.80) !important;
    color: #94a3b8 !important;
}

/* Build chip on Home + role banner */
html[data-theme="dark"] .build-chip { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html[data-theme="dark"] .role-banner { background: #1e293b; border-color: #334155; color: #e2e8f0; }

/* Insights cards + section heads */
html[data-theme="dark"] .insight-section-head { background: #1e293b; border-color: #334155; }
html[data-theme="dark"] .insight-section-title { color: #f1f5f9; }
html[data-theme="dark"] .insight-section-desc { color: #94a3b8; }

/* Report tiles (Other reports · jump anywhere) */
html[data-theme="dark"] .report-tile { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html[data-theme="dark"] .report-tile:hover { background: #243044; border-color: #475569; }
html[data-theme="dark"] .report-tile-desc { color: #94a3b8; }
html[data-theme="dark"] .report-tile-category { background: #0f172a; color: #cbd5e1; }

/* Buttons that hard-code .btn-secondary white background */
html[data-theme="dark"] .btn-secondary { background: #1e293b; color: #fbe4e0; border-color: #334155; }
html[data-theme="dark"] .btn-secondary:hover { background: #243044; border-color: #475569; }

/* ---- More dark-mode polish (Phase-7 follow-up, 2026-05-26) ----
   Targeting the surfaces I previously called "rough" — mobile bottom bar,
   Hotel BI tabs, table zebra stripes, fare-component tiles, and a few
   hard-coded #f9fafb / white panels. */

/* Mobile bottom bar */
html[data-theme="dark"] .mobile-bottom-bar {
    background: #0b1220; border-top-color: #1e293b; color: #e2e8f0;
}
html[data-theme="dark"] .mobile-bottom-bar a { color: #cbd5e1; }
html[data-theme="dark"] .mobile-bottom-bar a.active { color: #efa79d; }

/* Hotel BI tab strip (rounded pills) */
html[data-theme="dark"] .hbi-tab { background: #0b1220; border-color: #1e293b; color: #cbd5e1; }
html[data-theme="dark"] .hbi-tab:hover { background: #1e293b; color: #fbe4e0; }
html[data-theme="dark"] .hbi-tab.active { background: #b13a30; color: #fff; border-color: transparent; }
html[data-theme="dark"] .hbi-tab-num { background: #1e293b; color: #cbd5e1; }
html[data-theme="dark"] .hbi-tab.active .hbi-tab-num { background: rgba(255, 255, 255, 0.22); color: #fff; }
html[data-theme="dark"] .hbi-field-panel { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html[data-theme="dark"] .hbi-field { background: #0f172a; border-color: #334155; color: #e2e8f0; }
html[data-theme="dark"] .hbi-field:hover:not(:disabled) { background: #1e293b; border-color: #475569; }
html[data-theme="dark"] .hbi-tab-chat { background: #064e3b; color: #d1fae5; border-color: #065f46; }
html[data-theme="dark"] .hbi-tab-chat:hover { background: #022c22; }

/* Generic table zebra (most pages use #f9fafb on alternating rows) */
html[data-theme="dark"] table.data-table tbody tr:nth-child(odd)  td { background: #1a2230; }
html[data-theme="dark"] table.data-table tbody tr:nth-child(even) td { background: #131a26; }
html[data-theme="dark"] table.data-table tbody tr:hover td { background: #243044; }
html[data-theme="dark"] table.data-table thead th { background: #1e293b; color: #cbd5e1; }
html[data-theme="dark"] table.data-table { border-color: #334155; }

/* CSS variables that downstream stylesheets reference for muted bg */
html[data-theme="dark"] {
    --primary-50: #1e1b4b;
    --primary-100: #7c2820;
    --primary-200: #b13a30;
    --primary-700: #f5c8c1;
    --primary-900: #fdf3f1;
}

/* Quick ranges chips on the rail */
html[data-theme="dark"] .quick-date-chip {
    background: #1e293b; border-color: #334155; color: #cbd5e1;
}
html[data-theme="dark"] .quick-date-chip:hover { background: #7c2820; color: #fbe4e0; }
html[data-theme="dark"] .quick-date-chip.is-active {
    background: #b13a30; border-color: #e15d4e; color: #fff;
}

/* MultiSelect picker - sub-elements that hard-code white/grey */
html[data-theme="dark"] .ms-list { background: transparent; }
html[data-theme="dark"] .ms-item:hover { background: #243044; }
html[data-theme="dark"] .ms-link { color: #efa79d; }
html[data-theme="dark"] .ms-meta { color: #64748b; }

/* Skeletons fade */
html[data-theme="dark"] .skeleton,
html[data-theme="dark"] .skeleton-row,
html[data-theme="dark"] .skeleton-grid,
html[data-theme="dark"] .skeleton-chart {
    background: linear-gradient(90deg, #1e293b 0%, #243044 50%, #1e293b 100%);
}

/* Anchor links + nav-progress bar */
html[data-theme="dark"] a { color: #efa79d; }
html[data-theme="dark"] a:hover { color: #f5c8c1; }
html[data-theme="dark"] .nav-progress-bar { background: linear-gradient(90deg, #b13a30, #e15d4e); }

/* ---- Dark-mode hover sweep (2026-05-26) — values + text were going
   invisible on hover because base hover rules set a light background
   without an explicit text color, and our --bg token in dark mode is
   slate-900. Force light text on every common hover surface. ---- */
html[data-theme="dark"] tr:hover,
html[data-theme="dark"] tr:hover td,
html[data-theme="dark"] tr:hover th { background: #243044 !important; color: #f1f5f9 !important; }
html[data-theme="dark"] .back-link:hover { background: #7c2820 !important; color: #f5c8c1 !important; }
html[data-theme="dark"] .row-warn:hover,
html[data-theme="dark"] .row-warn:hover td { background: #422006 !important; color: #fde68a !important; }
html[data-theme="dark"] .quick-links li a:hover { background: #1e293b; color: #fbe4e0; }
html[data-theme="dark"] .toast:hover { background: #0f172a; color: #e2e8f0; }
html[data-theme="dark"] .welcome-option-chip:hover { color: #f5c8c1; }
html[data-theme="dark"] .ms-item:hover { background: #243044; color: #f1f5f9; }
html[data-theme="dark"] .ms-header:hover { background: #243044; color: #f1f5f9; }
html[data-theme="dark"] .home-quick-action:hover { background: #1e293b; border-color: #b13a30; color: #fbe4e0; }
html[data-theme="dark"] .exec-tile:hover { color: #fde68a; }
html[data-theme="dark"] .btn-ghost:hover { background: #243044; color: #e2e8f0; }
html[data-theme="dark"] .chip-x:hover { color: #fca5a5; }
html[data-theme="dark"] .hbar-chart-drillable .hbar-row-btn:hover { background: #1e293b; color: #fbe4e0; }
html[data-theme="dark"] .card:hover { border-color: #e15d4e; }
html[data-theme="dark"] .ms-link { color: #efa79d; }
html[data-theme="dark"] .login-form-submit:hover { background: #1e1b4b; }

/* ============================================================
   Filter rail — vertical right-column layout (2026-05-30 revert).
   User feedback after the horizontal-strip attempt: "filter is
   covering whole page, sidebar is behind, should look like the
   side menu bar". Reverting to a clean VERTICAL rail that sits
   beside the main content. Sections are <details> so each
   category collapses with one click. Pickers stack inside their
   section and open in-place (no absolute floating — vertical
   space is plentiful here, unlike the strip).
   ============================================================ */
.filter-sidebar {
    /* Anchored rail on the right (the .with-sidebar wrapper uses
       row-reverse so this `right` semantic is the sidebar slot). */
    position: sticky;
    top: 16px;
    z-index: 5;

    flex: 0 0 280px;
    width: 280px;
    max-width: 280px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    overflow-x: hidden;

    margin: 0 0 var(--space-4);
    padding: 14px 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transform: none !important;
}
/* Mobile-only drag handle pill — we don't use the bottom-sheet, hide. */
.filter-sidebar::before { display: none !important; }

/* Head row — "FILTERS · PRIMARY" left, clear-all right. */
.filter-sidebar .fs-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-2);
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.filter-sidebar .fs-head h3 {
    margin: 0; font-size: 13px; font-weight: 700;
    color: var(--text); letter-spacing: 0.02em;
}
.filter-sidebar .fs-head-mute {
    color: var(--text-muted); font-weight: 500; font-size: 11px;
}
.filter-sidebar .fs-clear-all {
    background: transparent; border: 0; cursor: pointer;
    color: var(--primary-600); font-size: 12px; font-weight: 600;
}
.filter-sidebar .fs-clear-all:hover { text-decoration: underline; }

/* Active selection chips — stack vertically inside the rail. */
.filter-sidebar .fs-chips {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin: 8px 0 12px;
}

/* Sections — each one a collapsible <details> so the rail stays scannable. */
.filter-sidebar details.fs-section {
    display: block;
    margin-top: 8px;
}
.filter-sidebar details.fs-section + details.fs-section {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--surface-2);
}
.filter-sidebar details.fs-section > summary {
    list-style: none; cursor: pointer;
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--text-muted);
    padding: 6px 0;
}
.filter-sidebar details.fs-section > summary::-webkit-details-marker { display: none; }
.filter-sidebar details.fs-section > summary::before {
    content: "▸"; color: var(--primary-500);
    display: inline-block; transition: transform 120ms ease;
    font-size: 10px;
}
.filter-sidebar details.fs-section[open] > summary::before { transform: rotate(90deg); }

/* Inside each section: pickers stack vertically (no flex-wrap horizontal). */
.filter-sidebar details.fs-section > .fs-section-body {
    display: flex; flex-direction: column; gap: 4px;
    margin-top: 4px;
}

/* Picker pills: full-width inside the rail; open expands inline below. */
.filter-sidebar .ms-filter {
    width: 100%;
    max-width: none;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    overflow: hidden;
}
.filter-sidebar .ms-filter.ms-open {
    border-color: var(--primary-200);
    background: var(--primary-50);
}
.filter-sidebar .ms-filter .ms-header {
    width: 100%;
    background: transparent;
    border: 0;
    padding: 6px 10px;
    display: flex; align-items: center; gap: 6px;
    font-size: 13px;
    cursor: pointer;
}
.filter-sidebar .ms-filter .ms-title { flex: 1; text-align: left; color: var(--text); }
.filter-sidebar .ms-filter .ms-count {
    background: var(--primary-100); color: var(--primary-700);
    border-radius: 999px;
    font-size: 11px; font-weight: 700;
    padding: 0 6px;
}
.filter-sidebar .ms-filter .ms-chev { color: var(--text-muted); font-size: 11px; }

/* Open body sits IN-PLACE below the header — no absolute floating. */
.filter-sidebar .ms-filter .ms-body {
    position: static;
    padding: 8px 10px 10px;
    background: var(--surface);
    border-top: 1px dashed var(--border);
    box-shadow: none;
    border-radius: 0;
    max-width: none;
    min-width: 0;
}
.filter-sidebar .ms-filter .ms-list { max-height: 220px; overflow-y: auto; }
.filter-sidebar .ms-filter .ms-search {
    width: 100%; box-sizing: border-box;
    padding: 4px 8px; font-size: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
}
.filter-sidebar .ms-filter .ms-actions {
    display: flex; align-items: center; gap: 8px;
    font-size: 11px; color: var(--text-muted);
    margin-bottom: 4px;
}
.filter-sidebar .ms-filter .ms-link {
    background: transparent; border: 0; cursor: pointer;
    color: var(--primary-600); font-size: 11px; padding: 0;
}
.filter-sidebar .ms-filter .ms-meta { margin-left: auto; }
.filter-sidebar .ms-filter .ms-item {
    display: flex; align-items: center; gap: 6px;
    padding: 3px 2px; font-size: 12px; cursor: pointer;
    color: var(--text);
}
.filter-sidebar .ms-filter .ms-item:hover { background: var(--primary-50); }

/* NlFilterBar full width inside the rail. */
.filter-sidebar .nl-filter { width: 100%; }

/* Footer / applying spinner. */
.filter-sidebar .fs-foot {
    margin-top: 10px; padding-top: 10px;
    border-top: 1px solid var(--surface-2);
    font-size: 11px; color: var(--text-muted);
}

/* Dark theme — the surface variable already adapts; just tighten borders. */
html[data-theme="dark"] .filter-sidebar {
    background: var(--surface);
    border-color: var(--border);
}
html[data-theme="dark"] .filter-sidebar .ms-filter.ms-open {
    background: rgba(225, 93, 78, 0.10);
    border-color: var(--primary-500);
}

/* Mobile — collapse rail to top of stack, full width. */
@media (max-width: 900px) {
    .filter-sidebar {
        position: static;
        flex: 0 0 auto;
        width: 100%;
        max-width: none;
        max-height: none;
    }
}

/* The Quick-ranges <details> sits compactly at the start. */
.filter-sidebar details.fs-collapsible {
    width: 100%;
}

/* NlFilterBar (free-text bar) — full width inside the strip. */
.filter-sidebar .nl-filter { width: 100%; }

/* Apply spinner pill — flows after the strip. */
.filter-sidebar .fs-foot { margin-top: var(--space-2); }

/* Tablet+ width behaviour. NOTE: `top: 0` was REMOVED here (2026-06-01) —
   it stuck the rail flush to the viewport top, sliding it UNDER the sticky
   64px .app-topbar (z-index 950) on scroll, so the rail's header overlapped
   the banner. At 768-1023px there's no .app-topbar, so the 16px offset above
   is fine; the >=1024px query below clears the real topbar. */
@media (min-width: 768px) {
    .filter-sidebar {
        width: auto;
        flex: 0 0 auto;
    }
}

/* Desktop: the .app-topbar (sticky, 64px, z-index 950) only renders at
   >=1024px. Push the sticky filter rail below it so it never slides under
   the banner. This is the last `top` rule for .filter-sidebar, so it wins. */
@media (min-width: 1024px) {
    .filter-sidebar {
        top: calc(64px + var(--space-3));
        max-height: calc(100vh - 64px - var(--space-4));
    }
}

/* Dark theme — the surface variable already adapts; just ensure the
   border tracks too. */
html[data-theme="dark"] .filter-sidebar {
    background: var(--surface);
    border-color: var(--border);
}

/* ============================================================
   Mockup-alignment polish (2026-05-30 redesign contract).
   These classes match docs/flock-redesign-mockup-2026-05-26.html
   so engineering can adopt them per-page without re-styling.
   ============================================================ */

/* Breadcrumb above every report h1 — small grey trail with indigo links. */
.breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
    letter-spacing: 0.01em;
}
.breadcrumb a {
    color: var(--primary-600);
    text-decoration: none;
    font-weight: 600;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep {
    margin: 0 var(--space-2);
    color: var(--slate-300);
}

/* ---- Mockup KPI tile — replaces the legacy .kpi/.kpi-value pair.
       Use <div class="kpi-tile">, with .kpi-label / .kpi-value / .kpi-delta
       child elements. The delta arrow + colour comes from .up / .down. */
.kpi-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    display: flex; flex-direction: column; gap: 4px;
}
.kpi-tile .kpi-label {
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-muted);
}
.kpi-tile .kpi-value {
    font-size: 26px; font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.kpi-tile .kpi-delta {
    font-size: 12px; font-weight: 600;
    margin-top: 2px;
    display: inline-flex; align-items: center; gap: 4px;
}
.kpi-tile .kpi-delta.up   { color: var(--success); }
.kpi-tile .kpi-delta.down { color: var(--danger);  }
.kpi-tile .kpi-delta.flat { color: var(--text-muted); }
.kpi-tile .kpi-delta::before {
    /* Inline triangle arrow so the page works without an icon font.
       The element gets one of .up / .down / .flat from the page. */
    display: inline-block; line-height: 1; font-size: 10px;
}
.kpi-tile .kpi-delta.up::before   { content: "\25B2"; }   /* ▲ */
.kpi-tile .kpi-delta.down::before { content: "\25BC"; }   /* ▼ */
.kpi-tile .kpi-delta.flat::before { content: "\2014"; }   /* — */

/* Dark-mode adapter — the variables already flip, but the shadow
   needs softening so the tile doesn't look like a hard cut-out. */
html[data-theme="dark"] .kpi-tile {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.30);
}

/* ---- Mockup fare-grid — 5 equal tiles for the InvoiceFareBreakdown
       panel (BasicFare / NetPay / TotalFare / CardCharges / Cancellation). */
.fare-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}
@media (max-width: 900px) {
    .fare-grid { grid-template-columns: repeat(2, 1fr); }
}
.fare-tile {
    background: var(--slate-50);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
}
.fare-tile .fare-label {
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-muted);
}
.fare-tile .fare-value {
    font-size: 16px; font-weight: 700;
    color: var(--text);
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}

/* ---- Mockup hero panel — the chart container with chips + Explain in
       the header row. Existing pages use ad-hoc <section class="panel">;
       the hero variant gives the chart panel a more deliberate header. */
.panel-hero {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: var(--space-4);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.panel-hero-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}
.panel-hero-title {
    font-weight: 700; font-size: 15px;
    color: var(--text);
}
.panel-hero-actions {
    display: flex; align-items: center; gap: 6px;
}

/* ---- KPI strip wrapper — mockup uses a fixed 4-column grid; we keep
       auto-fit as the responsive default but allow the explicit cols. */
.kpi-strip-mockup {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: var(--space-4);
}
@media (max-width: 900px) {
    .kpi-strip-mockup { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
    .kpi-strip-mockup { grid-template-columns: 1fr; }
}
/* Force text color on cells in case the table doesn't carry .data-table.
   Without this, any "plain" <table> on a page shows dark-text invisible
   on the dark cell background. */
html[data-theme="dark"] table td,
html[data-theme="dark"] table th { color: #e2e8f0; }
html[data-theme="dark"] table tbody tr:nth-child(odd)  td { background: #1a2230; }
html[data-theme="dark"] table tbody tr:nth-child(even) td { background: #131a26; }

/* === Home trend "By organisation" overlay toggle (2026-05-31).
   Used by Executive / Sales / Finance / Manager / ItAdmin home tiles
   above the 12-month trend table; swatches are coloured from
   Flock.Application.Ui.ChartPalette.ForOrg(). */
.home-trend-toggle { margin-bottom: 8px; }
.btn-pill {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #fff;
    cursor: pointer;
}
.btn-pill-on {
    background: #DD4C3F;
    color: #fff;
    border-color: #DD4C3F;
}
.org-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 6px;
    vertical-align: middle;
}
.org-swatch-faint { opacity: 0.55; }

/* ===== MIS Report page (2026-05-31) =====
   Used by Components/Pages/MisReport.razor. Grids use auto-fit so they
   reflow for any number of months/purposes without column-count math. */
.mis-shell { padding: 16px; }
.mis-header { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; margin-bottom:16px; padding:12px 16px; background:#fff; border-radius:8px; border:1px solid #e5e7eb; gap:12px; }
.mis-header-brand { display:flex; align-items:center; gap:12px; font-weight:600; color:#DD4C3F; font-size:18px; }
.mis-header-title { font-size:22px; font-weight:700; color:#111827; }
.mis-period-row { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.mis-period-pill { padding:4px 10px; border-radius:999px; border:1px solid #e5e7eb; background:#fff; cursor:pointer; font-size:12px; }
.mis-period-pill-on { background:#DD4C3F; color:#fff; border-color:#DD4C3F; }
.mis-export-row { display:flex; gap:8px; }
.mis-export-btn { background:#DD4C3F; color:#fff; padding:6px 14px; border-radius:6px; text-decoration:none; font-weight:500; font-size:13px; }
.mis-export-btn:hover { background:#b73a30; }
/* Service tiles: 8 fixed but reflows for narrow */
.mis-tiles { display:grid; grid-template-columns:repeat(auto-fit, minmax(140px, 1fr)); gap:8px; margin-bottom:16px; }
.mis-tile { background:#fff; padding:12px; border-radius:6px; border-top:3px solid #DD4C3F; box-shadow:0 1px 2px rgba(0,0,0,.04); text-align:center; }
.mis-tile-name { font-size:12px; color:#6b7280; margin-bottom:6px; }
.mis-tile-amount { font-size:22px; font-weight:700; color:#111827; }
.mis-tile-count { font-size:11px; color:#9ca3af; margin-top:4px; }
/* Per-month responsive grid - works for 1..12+ months */
.mis-per-month-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(220px, 1fr)); gap:12px; margin-bottom:16px; }
/* Per-purpose trend grid */
.mis-per-purpose-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(160px, 1fr)); gap:12px; margin-bottom:16px; }
/* Generic 2/3-col layout */
.mis-row { display:grid; gap:12px; margin-bottom:16px; }
.mis-row-2 { grid-template-columns:repeat(auto-fit, minmax(280px, 1fr)); }
.mis-row-3 { grid-template-columns:repeat(auto-fit, minmax(240px, 1fr)); }
.mis-card { background:#fff; padding:12px; border-radius:6px; border:1px solid #e5e7eb; min-width:0; }
.mis-card-title { font-size:13px; font-weight:600; color:#DD4C3F; margin-bottom:8px; padding-bottom:6px; border-bottom:1px solid #f3f4f6; }
.mis-table { width:100%; border-collapse:collapse; font-size:12px; }
.mis-table th { background:#DD4C3F; color:#fff; padding:6px 8px; text-align:left; font-weight:500; }
.mis-table td { padding:6px 8px; border-bottom:1px solid #f3f4f6; }
.mis-table td.num { text-align:right; font-variant-numeric:tabular-nums; }
.mis-table tr.total td { background:#fef2f2; font-weight:600; }
.mis-pivot-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(320px, 1fr)); gap:12px; margin-bottom:16px; }
