@font-face{font-family:'Inter';font-style:normal;font-weight:400;font-display:swap;src:url(/assets/fonts/inter-latin-400.8909904ab6.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
@font-face{font-family:'Inter';font-style:normal;font-weight:400;font-display:swap;src:url(/assets/fonts/inter-latin-ext-400.6744a7f509.woff2) format('woff2');unicode-range:U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}
@font-face{font-family:'Inter';font-style:normal;font-weight:500;font-display:swap;src:url(/assets/fonts/inter-latin-500.f3779f1efc.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
@font-face{font-family:'Inter';font-style:normal;font-weight:500;font-display:swap;src:url(/assets/fonts/inter-latin-ext-500.2c6fbc42d3.woff2) format('woff2');unicode-range:U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}
@font-face{font-family:'Inter';font-style:normal;font-weight:600;font-display:swap;src:url(/assets/fonts/inter-latin-600.f9a06e79cd.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
@font-face{font-family:'Inter';font-style:normal;font-weight:600;font-display:swap;src:url(/assets/fonts/inter-latin-ext-600.e4bdf67b0c.woff2) format('woff2');unicode-range:U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}
@font-face{font-family:'Inter';font-style:normal;font-weight:700;font-display:swap;src:url(/assets/fonts/inter-latin-700.6f56409fd3.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
@font-face{font-family:'Inter';font-style:normal;font-weight:700;font-display:swap;src:url(/assets/fonts/inter-latin-ext-700.143f9504f1.woff2) format('woff2');unicode-range:U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}
@font-face{font-family:'Inter';font-style:normal;font-weight:800;font-display:swap;src:url(/assets/fonts/inter-latin-800.a7d0a50f15.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
@font-face{font-family:'Inter';font-style:normal;font-weight:800;font-display:swap;src:url(/assets/fonts/inter-latin-ext-800.eade555933.woff2) format('woff2');unicode-range:U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:400;font-display:swap;src:url(/assets/fonts/jetbrains-mono-latin-400.14425ba9c6.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:400;font-display:swap;src:url(/assets/fonts/jetbrains-mono-latin-ext-400.505dfba8ec.woff2) format('woff2');unicode-range:U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:500;font-display:swap;src:url(/assets/fonts/jetbrains-mono-latin-500.cb182feeed.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:500;font-display:swap;src:url(/assets/fonts/jetbrains-mono-latin-ext-500.879df9319f.woff2) format('woff2');unicode-range:U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:700;font-display:swap;src:url(/assets/fonts/jetbrains-mono-latin-700.d0d4e81880.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:700;font-display:swap;src:url(/assets/fonts/jetbrains-mono-latin-ext-700.45a606d88f.woff2) format('woff2');unicode-range:U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}

:root {
  --brand: #1F4E79; --brand-dark: #163A5C; --accent: #2E75B6;
  --soft: #D9E7F2; --light: #F5F9FC; --success: #548235; --warn: #C00000;
  --warn-soft: #F8D7DA; --orange: #E87722; --gold: #B8860B;
  --grey: #595959; --mid-grey: #6B6B6B; --border: #E5E5E5; --bg: #F0F5FA;
  --sidebar-bg: #1A2332; --sidebar-text: #D4D9E0;
  /* W17.32 — dashboard presentation tokens. Contrast on white:
     ink 15.0:1 · ink-2 7.4:1 · ink-3 4.1:1 (labels/sub only, ≥AA large)
     · amber 4.8:1. hair is decorative (seams), never text. */
  --dash-ink: #12283D; --dash-ink-2: #4A5A6A; --dash-ink-3: #7B8794;
  --dash-hair: #E8ECEF; --dash-amber: #A66300;
}
/* Inter is the primary UI typeface (loaded from Google Fonts at the
   top of the document). It renders much cleaner than the system-font
   stack at the 13–18px sizes used throughout the app, and supports
   tabular-numeral and contextual-alternates OpenType features which
   we enable on the body so figures align in tables.
   The system stack remains as a fallback while Inter loads. */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
html, body {
  height: 100%; background: var(--bg); color: #222; font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  font-variant-numeric: tabular-nums;
}
/* Monospace contexts (audit diff, account-number cells, code samples)
   use JetBrains Mono — readable at small sizes and dimensioned to
   align with the body font. */
code, pre, .mono, [style*="font-family:monospace"], [style*="font-family: monospace"] { font-family: 'JetBrains Mono', ui-monospace, 'Menlo', 'Consolas', monospace !important; }
/* Type scale aligned to UI-design best practice (WCAG-friendly).
   Body text recommendation is 16–20px depending on device; we pick:
     • Phones (default)        → 16px  — bottom of the recommended range
     • Tablets (≥ 768px)       → 17px
     • Desktop  (≥ 1280px)     → 18px  — primary working environment
     • Large mon. (≥ 1600px)   → 19px  — ideal for laptops & 1080p
     • 4K / wide (≥ 2000px)    → 20px
   Line-height bumped from 1.5 to 1.55 across the board for better
   reading rhythm at the larger sizes. */
@media (min-width:  768px) { html, body { font-size: 17px; } }
@media (min-width: 1280px) { html, body { font-size: 18px; } }
@media (min-width: 1600px) { html, body { font-size: 19px; } }
@media (min-width: 2000px) { html, body { font-size: 20px; } }
button { cursor: pointer; font-family: inherit; font-size: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; background: white; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46,117,182,0.15); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
@media (min-width: 1280px) { table { font-size: 15.5px; } }
@media (min-width: 1600px) { table { font-size: 16.5px; } }
.hidden { display: none !important; }
.right { text-align: right; font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.bold { font-weight: 700; }

/* ===== LOGIN ===== */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
  padding: 20px;
}
.login-card {
  background: white; border-radius: 12px; padding: 40px 36px; width: 100%; max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo .name { font-size: 28px; font-weight: 800; color: var(--brand); letter-spacing: 0.5px; }
.login-logo .sub { font-size: 13px; color: var(--grey); margin-top: 4px; }
.login-card h2 { font-size: 20px; color: var(--brand); margin-bottom: 20px; text-align: center; }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 13px; font-weight: 600; color: var(--grey); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.4px; }
.login-field input { width: 100%; padding: 11px 14px; font-size: 16px; }
.btn-primary { background: var(--brand); color: white; padding: 13px 20px; border-radius: 6px; font-weight: 600; width: 100%; transition: background 0.15s; font-size: 16px; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { background: var(--mid-grey); cursor: not-allowed; }
.login-error { background: var(--warn-soft); color: var(--warn); padding: 10px 14px; border-radius: 6px; font-size: 14px; margin-bottom: 16px; }
.login-hint { font-size: 13px; color: var(--mid-grey); margin-top: 20px; text-align: center; line-height: 1.6; }

/* ===== APP LAYOUT ===== */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar-bg); color: var(--sidebar-text);
  padding: 20px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand {
  padding: 0 20px 16px; margin-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-brand .name { font-size: 20px; font-weight: 800; color: white; }
.sidebar-brand .sub { font-size: 12px; color: var(--sidebar-text); opacity: 0.75; margin-top: 2px; }
.sidebar-section { padding: 14px 20px 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.6px; color: rgba(255,255,255,0.55); font-weight: 700; }
/* W16 — Collapsible sidebar group. Same look as a section header but
   clickable, with a rotating arrow on the right that mirrors the
   open/closed state. */
.sidebar-group-header:hover { background: rgba(255,255,255,0.04); color: rgba(255,255,255,0.85); }
.sidebar-group-header[aria-expanded="false"] #w16GroupArrow { transform: rotate(-90deg); }
/* .nav-item is rendered as a <button> for accessibility (keyboard
   focus + screen-reader announcement). Reset the button defaults so
   it visually looks identical to the prior <div>-based nav. */
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 20px; cursor: pointer;
  font-size: 15px; transition: all 0.1s; color: var(--sidebar-text); border-left: 3px solid transparent;
  background: transparent; border-top: 0; border-right: 0; border-bottom: 0;
  width: 100%; text-align: left; font-family: inherit; line-height: inherit;
}
@media (min-width: 1280px) { .nav-item { font-size: 15.5px; } }
@media (min-width: 1600px) { .nav-item { font-size: 16px; } }
.nav-item:hover { background: rgba(255,255,255,0.05); color: white; }
.nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.nav-item.active, .nav-item[aria-current="page"] { background: rgba(46,117,182,0.2); border-left-color: var(--accent); color: white; font-weight: 600; }
.nav-item .icon { font-size: 17px; width: 20px; text-align: center; }
.sidebar-user { padding: 16px 20px; margin-top: auto; border-top: 1px solid rgba(255,255,255,0.1); font-size: 13px; }
.sidebar-user .who { color: white; font-weight: 600; }
.sidebar-user .role { color: var(--sidebar-text); opacity: 0.8; font-size: 12px; text-transform: capitalize; }
.sidebar-user .logout { margin-top: 8px; color: var(--accent); font-size: 12.5px; }

/* W15.112 — Make .main the explicit y-scroll container so position:
   sticky on .topbar works. Previously body scrolled (with .main having
   overflow-x:auto which implicitly made it a scroll context with no
   height), so the sticky topbar had nothing to stick to. With main
   filling 100vh and scrolling internally, the topbar sticks reliably. */
.main { background: var(--bg); overflow-y: auto; overflow-x: auto; height: 100vh; max-height: 100vh; }
/* W15.111 — Sticky top bar. Keeps the page title + global actions
   visible while scrolling so the user always knows which page they're
   on and can reach Refresh / hamburger without scrolling back up. */
.topbar {
  background: white; padding: 14px 28px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
/* Page heading scales with screen size — 1.4–1.6× body text per WCAG /
   modern UI guidance (headings should be 1.5–2.5× body). */
.topbar .title { font-size: 22px; font-weight: 700; color: var(--brand); }
@media (min-width: 1280px) { .topbar .title { font-size: 24px; } }
@media (min-width: 1600px) { .topbar .title { font-size: 26px; } }
.topbar .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.content { padding: 24px 28px; }

/* ─── Inline font-size lift ───────────────────────────────────────────
   Hundreds of inline styles across the codebase use small px sizes
   (10–13 px) that are below comfortable reading size on modern
   displays. Class-level CSS can't reach them because inline styles
   win specificity. The attribute selectors below match those exact
   inline-styled values and lift them to a comfortable size with
   !important so the inline rule yields. Each breakpoint scales further
   for bigger screens.
   The selectors are scoped to `.content` so we don't accidentally
   restyle unrelated areas (login screen, modals, tooltips). */
.content [style*="font-size:9px"]    { font-size: 12px !important; }
.content [style*="font-size:10px"]   { font-size: 13px !important; }
.content [style*="font-size:11px"]   { font-size: 14px !important; }
.content [style*="font-size:11.5px"] { font-size: 14px !important; }
.content [style*="font-size:12px"]   { font-size: 15px !important; }
.content [style*="font-size:13px"]   { font-size: 15.5px !important; }
.content [style*="font-size:14px"]   { font-size: 15.5px !important; }
.content [style*="font-size: 9px"]   { font-size: 12px !important; }
.content [style*="font-size: 10px"]  { font-size: 13px !important; }
.content [style*="font-size: 11px"]  { font-size: 14px !important; }
.content [style*="font-size: 12px"]  { font-size: 15px !important; }
.content [style*="font-size: 13px"]  { font-size: 15.5px !important; }
.content [style*="font-size: 14px"]  { font-size: 15.5px !important; }
@media (min-width: 1280px) {
  .content [style*="font-size:9px"]    { font-size: 13px !important; }
  .content [style*="font-size:10px"]   { font-size: 14px !important; }
  .content [style*="font-size:11px"]   { font-size: 15px !important; }
  .content [style*="font-size:11.5px"] { font-size: 15px !important; }
  .content [style*="font-size:12px"]   { font-size: 16px !important; }
  .content [style*="font-size:13px"]   { font-size: 16.5px !important; }
  .content [style*="font-size:14px"]   { font-size: 16.5px !important; }
  .content [style*="font-size:15px"]   { font-size: 17px !important; }
  .content [style*="font-size: 9px"]   { font-size: 13px !important; }
  .content [style*="font-size: 10px"]  { font-size: 14px !important; }
  .content [style*="font-size: 11px"]  { font-size: 15px !important; }
  .content [style*="font-size: 12px"]  { font-size: 16px !important; }
  .content [style*="font-size: 13px"]  { font-size: 16.5px !important; }
  .content [style*="font-size: 14px"]  { font-size: 16.5px !important; }
  .content [style*="font-size: 15px"]  { font-size: 17px !important; }
}
@media (min-width: 1600px) {
  .content [style*="font-size:9px"]    { font-size: 14px !important; }
  .content [style*="font-size:10px"]   { font-size: 15px !important; }
  .content [style*="font-size:11px"]   { font-size: 16px !important; }
  .content [style*="font-size:11.5px"] { font-size: 16px !important; }
  .content [style*="font-size:12px"]   { font-size: 17px !important; }
  .content [style*="font-size:13px"]   { font-size: 17.5px !important; }
  .content [style*="font-size:14px"]   { font-size: 17.5px !important; }
  .content [style*="font-size:15px"]   { font-size: 18px !important; }
  .content [style*="font-size:16px"]   { font-size: 18px !important; }
  .content [style*="font-size: 9px"]   { font-size: 14px !important; }
  .content [style*="font-size: 10px"]  { font-size: 15px !important; }
  .content [style*="font-size: 11px"]  { font-size: 16px !important; }
  .content [style*="font-size: 12px"]  { font-size: 17px !important; }
  .content [style*="font-size: 13px"]  { font-size: 17.5px !important; }
  .content [style*="font-size: 14px"]  { font-size: 17.5px !important; }
  .content [style*="font-size: 15px"]  { font-size: 18px !important; }
  .content [style*="font-size: 16px"]  { font-size: 18px !important; }
}

/* ===== BUTTONS ===== */
.btn { padding: 10px 18px; border-radius: 6px; font-weight: 500; font-size: 15px; display: inline-flex; align-items: center; gap: 6px; transition: all 0.15s; }
.btn-small { padding: 7px 13px; font-size: 14px; }
.btn-sm { padding: 8px 13px; font-size: 14px; }
@media (min-width: 1280px) {
  .btn      { font-size: 16px; padding: 11px 20px; }
  .btn-sm   { font-size: 15px; padding: 9px 15px; }
  .btn-small{ font-size: 15px; padding: 8px 15px; }
}
@media (min-width: 1600px) {
  .btn      { font-size: 16.5px; }
  .btn-sm   { font-size: 15.5px; }
  .btn-small{ font-size: 15.5px; }
}
.btn-solid { background: var(--brand); color: white; }
.btn-solid:hover { background: var(--brand-dark); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: #2561a0; }
.btn-outline { background: white; color: var(--brand); border: 1px solid var(--brand); }
.btn-outline:hover { background: var(--light); }
.btn-ghost { color: var(--grey); }
.btn-ghost:hover { background: var(--light); color: var(--brand); }
.btn-danger { background: var(--warn); color: white; }
.btn-danger:hover { background: #A00000; }
.btn-success { background: var(--success); color: white; }

/* ===== CARDS ===== */
/* min-width:0 lets the card shrink to its grid track in two-col / three-col layouts.
   overflow-x:auto prevents wide tables from bleeding into a neighbour card —
   the table gets a horizontal scrollbar inside the card instead of overflowing
   horizontally. overflow-y stays visible so dropdowns / tooltips above the card
   still appear correctly. */
.card { background: white; border-radius: 10px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); margin-bottom: 18px; min-width: 0; overflow-x: auto; }
/* Card-section labels — UPPERCASE tracking-out style. We bump the size
   so they read clearly under the larger body text without losing the
   compact label feel. */
.card-title { font-size: 15px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 2px solid var(--soft); }
@media (min-width: 1280px) { .card-title { font-size: 16px; } }
@media (min-width: 1600px) { .card-title { font-size: 17px; } }

/* ===== KPI GRID =====
   Tiles are now wider (240px minimum, was 200px) so larger figures like
   "₦27,134,900" don't run off the edge. Numbers are sized to comfortably
   fit a 9-digit naira amount inside the tile at every breakpoint, with
   `font-variant-numeric: tabular-nums` so digits line up nicely.
   `overflow-wrap: anywhere` is a safety net so genuinely-long values
   wrap a line instead of clipping. */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 20px; }

/* W17.66 — a KPI row that actually stays a row.
   `auto-fit` + a 240px floor means five tiles wrap to 4 + 1 on a laptop,
   leaving a stranded tile and a band of dead space under it. Here the
   column COUNT is declared instead (via --kpi-n) and steps down at real
   breakpoints, so the row is a row on a laptop and folds sensibly on a
   tablet or phone. minmax(0,1fr) rather than 1fr so a long naira figure
   shrinks its column instead of overflowing the grid. */
.kpi-grid.kpi-fit {
  grid-template-columns: repeat(var(--kpi-n, 4), minmax(0, 1fr));
  gap: 10px; margin-bottom: 14px;
}
@media (max-width: 1240px) { .kpi-grid.kpi-fit { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px)  { .kpi-grid.kpi-fit { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px)  { .kpi-grid.kpi-fit { grid-template-columns: 1fr; } }
/* Tighter tiles to match — the row is denser, so the chrome should be. */
.kpi-grid.kpi-fit .kpi { padding: 11px 13px; }
.kpi-grid.kpi-fit .kpi .label { font-size: 11px; letter-spacing: 0.4px; }
.kpi-grid.kpi-fit .kpi .value { font-size: 21px; margin-top: 3px; }
.kpi-grid.kpi-fit .kpi .sub { font-size: 10.5px; line-height: 1.35; }
.kpi { background: white; border-radius: 10px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); border-left: 4px solid var(--accent); min-width: 0; }
.kpi .label { font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--grey); font-weight: 600; }
.kpi .value { font-size: 24px; font-weight: 700; color: var(--brand); margin-top: 6px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.2; }
.kpi .sub { font-size: 13px; color: var(--mid-grey); margin-top: 4px; }
@media (min-width: 1280px) {
  .kpi .label { font-size: 14px; }
  .kpi .value { font-size: 26px; }
  .kpi .sub   { font-size: 14px; }
}
@media (min-width: 1600px) {
  .kpi .label { font-size: 14.5px; }
  .kpi .value { font-size: 28px; }
  .kpi .sub   { font-size: 15px; }
}
.kpi.success { border-left-color: var(--success); }
.kpi.warn { border-left-color: var(--warn); }
.kpi.orange { border-left-color: var(--orange); }
.kpi.gold { border-left-color: var(--gold); }

/* ═══════════════════════════════════════════════════════════════════
   W17.32 — DASHBOARD PRESENTATION LAYER  (scoped to `.dash-v2`)

   Deliberately CSS-only over the EXISTING .kpi-grid / .kpi / .label /
   .value / .sub markup. bugaApplyKpiMasking() derives each tile's
   storage id from its .label text and rewrites .value / .sub innerHTML,
   so changing that structure would silently reset every operator's
   per-KPI reveal state and break Show all / Hide all / Collapse.
   Nothing below touches the DOM shape or the label strings.

   Scoped to .dash-v2 (Dashboard only) pending review before the same
   treatment rolls out to Analytics, Customer detail, Outlets, etc.
   ═══════════════════════════════════════════════════════════════════ */

/* ── One toolbar instead of three stacked bands ────────────────────── */
.dash-v2 .dash-toolbar { background:white; border:1px solid var(--dash-hair); border-radius:12px;
  padding:6px; margin-bottom:14px; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.dash-v2 .dash-toolbar .range-bar,
.dash-v2 .dash-toolbar .card { background:transparent; box-shadow:none; border:0; padding:0;
  margin:0; border-radius:0; overflow:visible; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.dash-v2 .dash-toolbar .range-label { display:none; }   /* the chips say it themselves */
/* flex-wrap + min-width:0 are load-bearing: the base .range-bar is a
   nowrap horizontal-scroll container, and stripping its card chrome
   above also removed that scroll. Without these the twelve period chips
   push the toolbar wider than the viewport on a phone. */
.dash-v2 .dash-toolbar .range-bar { flex:1 1 auto; min-width:0; }
/* flex-shrink:1 + min-width:0 override the base .range-chips
   `flex-shrink:0`, which otherwise pins the row at its max-content width
   so flex-wrap never gets a chance to fire. */
.dash-v2 .dash-toolbar .range-chips { gap:2px; background:var(--light); border-radius:8px;
  padding:3px; flex-wrap:wrap; flex-shrink:1; min-width:0; }
.dash-v2 .dash-toolbar .range-chip { background:transparent; border:0; border-radius:6px;
  padding:6px 12px; font-size:12.5px; font-weight:500; color:var(--dash-ink-2); }
.dash-v2 .dash-toolbar .range-chip:hover { background:white; color:var(--brand); }
.dash-v2 .dash-toolbar .range-chip.active { background:white; color:var(--brand); font-weight:650;
  box-shadow:0 1px 2px rgba(0,0,0,0.10); }
.dash-v2 .dash-sep { width:1px; height:22px; background:var(--dash-hair); margin:0 4px; flex-shrink:0; }
.dash-v2 .dash-toolbar .range-summary,
.dash-v2 .dash-meta { font-size:12px; color:var(--dash-ink-3); font-style:normal; }

/* ── Second toolbar line: panel chips (left) + KPI actions (right) ──── */
.dash-v2 .dash-toolbar-row { flex-basis:100%; display:flex; align-items:center; gap:10px;
  flex-wrap:wrap; border-top:1px solid var(--dash-hair); margin-top:2px; padding-top:8px; }
.dash-v2 .dash-toolbar-row > #dashPanelMount { flex:1 1 auto; min-width:0; }
.dash-v2 .dash-toolbar-row > #dashKpiActionMount { flex:0 0 auto; margin-left:auto; }
/* Strip the tab bar's own panel chrome — it is inside the toolbar now. */
.dash-v2 .buga-page-tabbar { background:transparent !important; border:0 !important;
  padding:0 !important; margin:0 !important; gap:5px !important; }
/* Chips: match the toolbar's segmented look rather than shouting in
   accent-blue. Selected reads as filled, unselected as a quiet outline. */
.dash-v2 .buga-page-tabbar [data-pt-tab],
.dash-v2 .buga-page-tabbar [data-pt-tab-all] { border-radius:8px !important;
  border-color:var(--dash-hair) !important; font-size:12.5px !important;
  font-weight:550 !important; padding:6px 11px !important; }
.dash-v2 .buga-page-tabbar [data-pt-tab-reset] { margin-left:6px !important; }
.dash-v2 .buga-kpi-controls { margin:0 !important; }

/* ── Tile band: shared hairline seams, not ten floating cards ──────── */
/* The seams are drawn by a 1px box-shadow spread on each cell, bleeding
   into the 1px grid gutter — NOT by colouring the grid's own background.
   With a coloured background, a trailing row that doesn't fill its
   columns (10 tiles into a 5-column track leaves one orphan) exposed a
   large grey void beside the last tile. White background + per-cell
   shadow means unfilled track area is simply blank. */
.dash-v2 .kpi-grid { gap:1px; background:white; border:1px solid var(--dash-hair);
  border-radius:14px; overflow:hidden; margin-bottom:14px;
  grid-template-columns:repeat(auto-fit, minmax(200px, 1fr)); }
.dash-v2 .kpi { border-radius:0; border-left:0; padding:16px 18px;
  box-shadow:0 0 0 1px var(--dash-hair);
  display:flex; flex-direction:column; justify-content:center; }
/* Sentence case: the label STRINGS are unchanged (masking ids depend on
   them) — only the transform is dropped. */
.dash-v2 .kpi .label { text-transform:none; letter-spacing:0; font-size:13px;
  font-weight:600; color:var(--dash-ink-2); }
/* Proportional figures. tabular-nums gives every digit the width of a
   '0', which reads loose at display sizes; it belongs in table columns. */
.dash-v2 .kpi .value { font-variant-numeric:normal; font-feature-settings:"tnum" 0;
  color:var(--dash-ink); letter-spacing:-0.6px; font-weight:650; }
.dash-v2 .kpi .sub { color:var(--dash-ink-3); font-size:12.5px; }

/* ── One hero figure per view ──────────────────────────────────────── */
.dash-v2 .kpi.kpi-hero { grid-column:span 2; padding:20px 22px; }
.dash-v2 .kpi.kpi-hero .value { font-size:46px; letter-spacing:-1.6px; font-weight:680; line-height:1.05; margin-top:8px; }
.dash-v2 .kpi.kpi-hero .sub { font-size:13px; margin-top:8px; }
@media (min-width:1280px){ .dash-v2 .kpi.kpi-hero .value { font-size:52px; } }
@media (max-width:760px){ .dash-v2 .kpi.kpi-hero { grid-column:span 1; }
                          .dash-v2 .kpi.kpi-hero .value { font-size:34px; } }

/* ── Empty tiles recede instead of competing with the hero ─────────── */
.dash-v2 .kpi.kpi-zero .value { color:var(--dash-ink-3); font-weight:550; }
.dash-v2 .kpi.kpi-zero .label { color:var(--dash-ink-3); }

/* ── Status colour only where it means something, always with a label ─ */
/* align-self stops the pill stretching to the full cell width now that
   .kpi is a flex column (inline-flex children stretch by default). */
.dash-v2 .kpi-flag { display:inline-flex; align-self:flex-start; align-items:center; gap:5px;
  font-size:11.5px; font-weight:600; padding:2px 8px; border-radius:999px; margin-top:8px; }
.dash-v2 .kpi-flag.amber { color:var(--dash-amber); background:#FDF3E3; }

/* ── The reveal/hide control bar: compact, right-aligned, no emoji ──── */
.dash-v2 .buga-kpi-controls { justify-content:flex-end !important; margin-bottom:8px !important; }
.dash-v2 .buga-kpi-controls > span:first-child { display:none; }   /* helper text → tooltips */
.dash-v2 .buga-kpi-controls button { border:1px solid var(--dash-hair) !important; background:white !important;
  border-radius:8px !important; padding:5px 11px !important; font-size:12.5px !important;
  font-weight:550 !important; color:var(--dash-ink-2) !important; }
.dash-v2 .buga-kpi-controls button:hover { border-color:var(--soft) !important;
  background:var(--light) !important; color:var(--brand) !important; }

/* ===== GRID (SHEET-LIKE TABLE) ===== */
.grid-wrapper { background: white; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.grid-toolbar { display: flex; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; align-items: center; background: var(--light); }
.grid-toolbar .search { flex: 1; min-width: 200px; padding: 9px 14px; font-size: 15px; }
.grid-toolbar .count { font-size: 14px; color: var(--grey); margin-left: auto; }
.grid-scroll { max-height: 65vh; overflow: auto; }
/* Sheet-style data tables — bumped both header and cell sizes so figures
   read clearly across the dashboard. Body cell text inherits from .card
   context (no explicit size) so it lifts with the body font-size scale. */
.grid-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 15px; }
/* W17.38 — a column with no declared width absorbs every spare pixel,
   which left a wide empty gap between Name and the columns after it.
   Percentage-width columns share the slack instead of one hogging it. */
.grid-table th[style*='%'] { box-sizing: border-box; }
@media (min-width: 1280px) { .grid-table { font-size: 16px; } }
@media (min-width: 1600px) { .grid-table { font-size: 17px; } }
.grid-table th {
  position: sticky; top: 0; z-index: 2; background: var(--soft); color: var(--brand); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.4px;
  text-align: left; padding: 12px 12px; border-bottom: 2px solid var(--accent); cursor: pointer; user-select: none; white-space: nowrap;
}
@media (min-width: 1280px) { .grid-table th { font-size: 14px; } }
@media (min-width: 1600px) { .grid-table th { font-size: 14.5px; } }
.grid-table th:hover { background: #C5D9E8; }
.grid-table th .sort-indicator { opacity: 0.4; margin-left: 4px; }
.grid-table th.sorted .sort-indicator { opacity: 1; color: var(--brand); }
.grid-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
/* W15.15 — sticky TOTAL footer for history tables. The td needs the
   sticky property (tfoot itself doesn't honour sticky in all engines)
   plus an opaque background so the scrolled rows don't show through. */
.sticky-history-tbl tfoot td {
  position: sticky; bottom: 0; z-index: 2;
  background: var(--soft); color: var(--brand);
  font-weight: 700; border-top: 2px solid var(--accent);
}
/* W15.17 — same effect for renderGrid-rendered tables when the page
   asks for it (config.stickyFooter = true). Keeps the TOTAL row
   visible no matter how long the dataset. */
.sticky-grid-footer tfoot td {
  position: sticky; bottom: 0; z-index: 2;
  background: var(--soft); color: var(--brand);
  font-weight: 700; border-top: 2px solid var(--accent);
}
.grid-table tr:hover td { background: var(--light); }
.grid-table .col-actions { min-width: 100px; width: 100px; text-align: center; padding-left: 20px; padding-right: 12px; }
.grid-table td.right, .grid-table th.right { text-align: right !important; padding-right: 18px; }

/* "Frozen first columns" — stick the row-# AND Customer columns to the
   left edge of the bucket so the user always sees who they're looking
   at while panning the numeric columns. Activate by adding the class
   `sticky-first-2-cols` to a .grid-table inside an overflow-x:auto
   wrapper. Column widths in <colgroup> drive the `left:` offset for
   column 2 (here 42px to match the # column). */
.grid-table.sticky-first-2-cols th:nth-child(1),
.grid-table.sticky-first-2-cols td:nth-child(1) {
  position: sticky; left: 0; z-index: 3;
}
.grid-table.sticky-first-2-cols th:nth-child(2),
.grid-table.sticky-first-2-cols td:nth-child(2) {
  position: sticky; left: 42px; z-index: 3;
  box-shadow: 6px 0 6px -4px rgba(0,0,0,0.10);  /* visible "edge" cue */
}
/* Sticky cells must paint over the cells scrolling underneath them, so
   they need an opaque background. Match the header / body palette so
   the freeze-line is invisible until the user actually scrolls. */
.grid-table.sticky-first-2-cols thead th:nth-child(1),
.grid-table.sticky-first-2-cols thead th:nth-child(2) { background: var(--soft); z-index: 4; }
.grid-table.sticky-first-2-cols tbody td:nth-child(1),
.grid-table.sticky-first-2-cols tbody td:nth-child(2) { background: white; }

/* W17.41 — freeze #, ID and Name so the identity of the row stays on
   screen while the figures scroll horizontally underneath.
   `width:max-content` is the other half of the fix: with `width:100%`
   the table stretched to the wrapper and one column had to absorb the
   slack, which is what produced the empty band between Name and
   Behaviour. Sized to content, the row simply ends after the last
   column and the gap has nowhere to appear. */
/* NB: no `min-width:100%`. That forces the table wider than its own
   content, and the browser hands the surplus to whichever column has no
   hard width — which is precisely how the empty band between Name and
   Behaviour appeared. Sized purely by content, there is no surplus to
   give away. */
.grid-table.freeze-id-name,
.grid-table.sticky-first-2-cols { width: max-content; }
.grid-table.freeze-id-name th:nth-child(1),
.grid-table.freeze-id-name td:nth-child(1) { position: sticky; left: 0;     z-index: 3; }
.grid-table.freeze-id-name th:nth-child(2),
.grid-table.freeze-id-name td:nth-child(2) { position: sticky; left: 46px;  z-index: 3; }
.grid-table.freeze-id-name th:nth-child(3),
.grid-table.freeze-id-name td:nth-child(3) {
  position: sticky; left: 166px; z-index: 3;
  box-shadow: 6px 0 6px -4px rgba(0,0,0,0.10);   /* the freeze edge */
}
.grid-table.freeze-id-name thead th:nth-child(1),
.grid-table.freeze-id-name thead th:nth-child(2),
.grid-table.freeze-id-name thead th:nth-child(3) { background: var(--soft); z-index: 4; }
.grid-table.freeze-id-name tbody td:nth-child(1),
.grid-table.freeze-id-name tbody td:nth-child(2),
.grid-table.freeze-id-name tbody td:nth-child(3) { background: white; }
.grid-table.freeze-id-name tbody tr:nth-child(even) td:nth-child(1),
.grid-table.freeze-id-name tbody tr:nth-child(even) td:nth-child(2),
.grid-table.freeze-id-name tbody tr:nth-child(even) td:nth-child(3) { background: #FAFCFE; }
.grid-table.sticky-first-2-cols tbody tr:hover td:nth-child(1),
.grid-table.sticky-first-2-cols tbody tr:hover td:nth-child(2) { background: var(--light); }

/* ===== W17.42 — DRAG-TO-RESIZE COLUMNS =====
   A grab strip on the right edge of every header cell. No extra layout:
   `.grid-table th` is already `position: sticky`, which makes it a
   containing block for an absolutely-positioned child, so the strip
   needs no `position: relative` that would fight the frozen columns.

   The strip sits half outside the cell (right:-4px) so the grab zone
   straddles the border the eye is aiming at, which is where people
   actually click. */
.grid-table .col-resizer {
  position: absolute; top: 0; right: -4px; width: 9px; height: 100%;
  cursor: col-resize; z-index: 6; user-select: none; touch-action: none;
}
.grid-table .col-resizer::after {
  content: ''; position: absolute; top: 22%; bottom: 22%; left: 4px; width: 2px;
  border-radius: 1px; background: transparent; transition: background 0.12s;
}
.grid-table .col-resizer:hover::after,
.grid-table .col-resizer.dragging::after { background: var(--accent); }
/* While dragging, the pointer may leave the strip entirely — keep the
   cursor and kill text selection document-wide until the mouse is up. */
body.buga-col-resizing, body.buga-col-resizing * {
  cursor: col-resize !important; user-select: none !important;
}
.grid-table .cell-edit {
  width: 100%; min-width: 60px; padding: 5px 7px; border: 1px solid var(--accent); border-radius: 4px; font-size: 14px;
}
.pill { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; }
@media (min-width: 1280px) { .pill { font-size: 12.5px; } }
.pill-active { background: #EAF5E4; color: var(--success); }
.pill-inactive { background: #FFE8E1; color: var(--orange); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }

/* ===== COMBO (type-to-filter dropdown) =====
   A native <datalist> cannot be styled at all — the browser draws it, and
   on a long option list it covers half the form. This is the same
   behaviour rendered as ordinary DOM so it can be capped and scrolled. */
.combo-wrap { position: relative; }
.combo-menu {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 60; margin-top: 3px;
  background: white; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
  box-sizing: border-box;
  max-height: 190px;           /* ~5 rows, then it scrolls */
  overflow-y: auto; display: none;
}
.combo-menu.open { display: block; }
.combo-opt { padding: 8px 12px; font-size: 14px; cursor: pointer; line-height: 1.3; }
.combo-opt:hover, .combo-opt.active { background: var(--light); color: var(--brand); }
.combo-opt mark { background: #FDF3E3; color: inherit; font-weight: 700; padding: 0; }
.combo-empty { padding: 9px 12px; font-size: 13px; color: var(--mid-grey); font-style: italic; }
.combo-caret { position: absolute; right: 12px; top: 50%; transform: translateY(-2px);
  pointer-events: none; color: var(--mid-grey); font-size: 11px; }

/* ===== MODAL ===== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal {
  background: white; border-radius: 12px; width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,0.3);
}
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 19px; font-weight: 700; color: var(--brand); }
@media (min-width: 1280px) { .modal-title { font-size: 20px; } }
.modal-close { font-size: 24px; color: var(--grey); width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--light); color: var(--warn); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; color: var(--grey); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.3px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; padding: 10px 13px; font-size: 15px; }
@media (min-width: 1280px) { .form-row input, .form-row select, .form-row textarea { font-size: 16px; } }
.form-row textarea { resize: vertical; min-height: 70px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ===== TOAST ===== */
.toast-holder { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: white; border-left: 4px solid var(--accent); padding: 13px 18px; border-radius: 6px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); font-size: 14.5px; animation: slideIn 0.2s ease; min-width: 280px; }
@media (min-width: 1280px) { .toast { font-size: 15px; } }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--warn); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== STATEMENT ===== */
.statement-row { display: grid; grid-template-columns: 1fr 180px; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 15px; color: #222; }
@media (min-width: 1280px) { .statement-row { font-size: 16px; } }
@media (min-width: 1600px) { .statement-row { font-size: 17px; } }
.statement-row.header { font-weight: 700; color: var(--brand); border-bottom: 2px solid var(--brand); font-size: 16px; text-transform: uppercase; }
@media (min-width: 1280px) { .statement-row.header { font-size: 17px; } }
/* Sub-rows used to be grey (--grey #595959) which read as "faint" on
   monitors. Bumping to solid #222 makes the line items clearly legible
   while still sitting under the bold blue headers and totals. */
.statement-row.sub { padding-left: 20px; color: #222; font-size: 14.5px; }
@media (min-width: 1280px) { .statement-row.sub { font-size: 15.5px; } }
.statement-row.total { font-weight: 700; border-top: 2px solid var(--brand); border-bottom: 3px double var(--brand); padding: 11px 0; color: var(--brand); }
.statement-row.final { font-weight: 700; background: var(--soft); padding: 13px; border-radius: 6px; margin-top: 8px; font-size: 17px; }
@media (min-width: 1280px) { .statement-row.final { font-size: 18px; } }
.positive { color: var(--success); }
.negative { color: var(--warn); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.two-col > * { min-width: 0; }   /* let grid items shrink so inner overflow-x scrollers stay inside the bucket instead of stretching the page */
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.chart-wrap { position: relative; height: 280px; }

/* ===== AUDIT ===== */
.audit-row { display: grid; grid-template-columns: 160px 130px 110px 1fr 1fr 70px; gap: 10px; padding: 11px 14px; font-size: 13.5px; border-bottom: 1px solid var(--border); }
@media (min-width: 1280px) { .audit-row { font-size: 14.5px; } }
@media (min-width: 1600px) { .audit-row { font-size: 15px; } }
.audit-row.header { background: var(--soft); color: var(--brand); font-weight: 700; text-transform: uppercase; font-size: 12.5px; letter-spacing: 0.3px; }
@media (min-width: 1280px) { .audit-row.header { font-size: 13px; } }
.audit-action { font-weight: 600; }
.audit-action.CREATE { color: var(--success); }
.audit-action.UPDATE { color: var(--accent); }
.audit-action.DELETE { color: var(--warn); }
.audit-action.LOGIN { color: var(--gold); }
.audit-diff { font-family: 'Consolas', 'Menlo', monospace; font-size: 12.5px; color: var(--grey); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 1280px) { .audit-diff { font-size: 13px; } }

/* ===== EMPTY ===== */
.empty { text-align: center; padding: 50px 20px; color: var(--mid-grey); }
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }

/* ===== DATE-RANGE BAR (W15.110 — single-row compact) ===== */
.range-bar { display:flex; gap:8px; align-items:center; flex-wrap:nowrap; background:white; padding:8px 12px; border-radius:8px; margin-bottom:12px; box-shadow:0 1px 3px rgba(0,0,0,0.05); overflow-x:auto; }
.range-label { font-size:11.5px; font-weight:700; color:var(--brand); text-transform:uppercase; letter-spacing:0.3px; margin-right:2px; white-space:nowrap; flex-shrink:0; }
.range-chips { display:flex; gap:4px; flex-wrap:nowrap; flex-shrink:0; }
.range-chip { padding:4px 10px; border-radius:14px; background:var(--light); color:#222; font-size:12px; font-weight:500; cursor:pointer; transition: all 0.1s; border:1px solid transparent; white-space:nowrap; }
.range-chip:hover { background:var(--soft); color:var(--brand); }
.range-chip.active { background:var(--brand); color:white; font-weight:600; }
@media (min-width: 1280px) {
  .range-chip { font-size: 12.5px; padding: 5px 12px; }
}
.range-custom { display:flex; gap:6px; align-items:center; font-size:12px; color:#222; flex-shrink:0; white-space:nowrap; }
.range-custom input { padding:4px 8px; font-size:12px; }
.range-summary { margin-left:auto; font-size:11.5px; color:var(--mid-grey); font-style:italic; white-space:nowrap; flex-shrink:0; }
/* Allow wrapping only on very narrow viewports (mobile) */
@media (max-width: 720px) {
  .range-bar { flex-wrap:wrap; overflow-x:visible; }
  .range-chips { flex-wrap:wrap; }
}
@media (min-width: 1280px) { .range-summary { font-size: 15px; } }

/* ===== RECEIPTS GALLERY ===== */
.receipt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.receipt-card { background: white; border-radius: 10px; border: 1px solid var(--border); overflow: hidden; cursor: pointer; transition: all 0.15s; position: relative; }
.receipt-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); border-color: var(--accent); }
.receipt-thumb { width: 100%; height: 160px; object-fit: cover; display: block; background: #F5F5F5; }
.receipt-meta { padding: 10px 12px; }
.receipt-filename { font-size: 13.5px; font-weight: 600; color: var(--brand); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 1280px) { .receipt-filename { font-size: 14.5px; } }
.receipt-sub { font-size: 12.5px; color: var(--grey); margin-top: 3px; }
@media (min-width: 1280px) { .receipt-sub { font-size: 13px; } }
.receipt-badge { position: absolute; top: 8px; right: 8px; font-size: 11.5px; padding: 4px 9px; border-radius: 12px; font-weight: 700; backdrop-filter: blur(4px); }
.receipt-badge.unprocessed { background: rgba(232,119,34,0.92); color: white; }
.receipt-badge.linked { background: rgba(84,130,53,0.92); color: white; }
.receipt-badge.pending { background: rgba(184,134,11,0.92); color: white; }
.receipt-upload-zone { border: 3px dashed var(--accent); border-radius: 12px; padding: 40px 20px; text-align: center; cursor: pointer; transition: all 0.15s; background: var(--light); }
.receipt-upload-zone:hover { background: var(--soft); border-color: var(--brand); }
.receipt-upload-zone.dragover { background: var(--soft); border-color: var(--success); transform: scale(1.01); }
.receipt-preview-img { max-width: 100%; max-height: 500px; border-radius: 8px; display: block; margin: 0 auto; box-shadow: 0 2px 10px rgba(0,0,0,0.08); }
.extracted-field { display: flex; justify-content: space-between; align-items: center; padding: 9px 13px; background: var(--light); border-radius: 6px; margin-bottom: 6px; font-size: 14.5px; }
@media (min-width: 1280px) { .extracted-field { font-size: 15.5px; } }
.extracted-field .label { color: var(--grey); font-weight: 600; }
.extracted-field .value { color: var(--brand); font-weight: 700; font-family: monospace; }
.extracted-field .confidence { font-size: 11.5px; padding: 3px 7px; border-radius: 10px; margin-left: 6px; }
.extracted-field .confidence.high { background: #EAF5E4; color: var(--success); }
.extracted-field .confidence.medium { background: #FFF8E1; color: var(--gold); }
.extracted-field .confidence.low { background: #FFE8E1; color: var(--orange); }
.route-button { display: flex; align-items: center; gap: 10px; padding: 14px 18px; background: white; border: 2px solid var(--border); border-radius: 10px; cursor: pointer; transition: all 0.15s; text-align: left; width: 100%; margin-bottom: 8px; }
.route-button:hover { border-color: var(--accent); background: var(--light); }
.route-button .icon { font-size: 24px; }
.route-button .title { font-weight: 700; color: var(--brand); font-size: 15px; }
@media (min-width: 1280px) { .route-button .title { font-size: 16px; } }
.route-button .desc { font-size: 13px; color: var(--grey); margin-top: 3px; }
@media (min-width: 1280px) { .route-button .desc { font-size: 14px; } }

/* ===== CUSTOMER DETAIL ===== */
.back-link { color:var(--accent); font-size:14px; cursor:pointer; margin-bottom:8px; display:inline-block; }
@media (min-width: 1280px) { .back-link { font-size: 15px; } }
.back-link:hover { text-decoration:underline; }
.cust-header { background: linear-gradient(135deg, var(--brand), var(--accent)); color:white; padding:20px 24px; border-radius:10px; margin-bottom:18px; }
.cust-header h2 { font-size:24px; font-weight:800; margin-bottom:4px; }
@media (min-width: 1280px) { .cust-header h2 { font-size: 26px; } }
.cust-header .meta { opacity:0.9; font-size:14px; }
@media (min-width: 1280px) { .cust-header .meta { font-size: 15px; } }
.cust-badge { background:rgba(255,255,255,0.2); padding:4px 11px; border-radius:12px; font-size:12px; font-weight:600; text-transform:uppercase; letter-spacing:0.3px; margin-right:6px; display:inline-block; }
@media (min-width: 1280px) { .cust-badge { font-size: 12.5px; } }
.cust-name-link { color:var(--brand); font-weight:600; cursor:pointer; }
.cust-name-link:hover { text-decoration:underline; color:var(--accent); }

/* ═════════════════════════════════════════════════════════════════════
   RESPONSIVE LAYOUT — phone & tablet support
   On screens narrower than 900px the sidebar becomes a slide-in drawer
   triggered by a hamburger button in the topbar. Content goes full-width.
═════════════════════════════════════════════════════════════════════ */
.hamburger {
  display: none;
  background: var(--brand); color: white; border: none;
  width: 40px; height: 40px; border-radius: 8px; font-size: 22px;
  cursor: pointer; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999;
}

@media (max-width: 900px) {
  /* Sidebar becomes an off-canvas drawer */
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 260px;
    z-index: 1000; transform: translateX(-100%); transition: transform 0.25s ease;
    box-shadow: 2px 0 12px rgba(0,0,0,0.2);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .hamburger { display: inline-flex; }

  /* Tighter top bar */
  .topbar { padding: 10px 14px; }
  .topbar .title { font-size: 16px; }
  .content { padding: 12px !important; }

  /* KPI tiles stack better on phones — 2 columns instead of squeezed grid */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 10px 12px; }
  .kpi .value { font-size: 19px !important; }
  .kpi .label { font-size: 11px !important; }
  .kpi .sub { font-size: 11px !important; }

  /* Tables stay scrollable horizontally instead of overflowing the page */
  .grid-scroll, .card { overflow-x: auto; }
  .grid-table { min-width: 540px; font-size: 13px; }
  .grid-table th, .grid-table td { padding: 7px 8px; }

  /* Cards: tighter spacing, smaller titles */
  .card { padding: 12px; margin-bottom: 12px; }
  .card-title { font-size: 14.5px; }

  /* Modals: full-screen on phones */
  .modal-backdrop .modal,
  #migrationModal,
  #bugaCloudPanel {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: 92vh;
    margin: 8px !important;
  }
  #bugaCloudPanel { right: 8px !important; left: 8px !important; bottom: 70px; }

  /* Floating button positions adjusted for thumb reach */
  #bugaCloudFab { bottom: 12px; right: 12px; padding: 10px 14px; font-size: 12px; }
  #recMigrateBtn { bottom: 60px; right: 12px; }

  /* Forms: full-width inputs, stack 2-column rows */
  .form-row-2 { grid-template-columns: 1fr !important; }
  .form-row input, .form-row select, .form-row textarea { font-size: 15px; }

  /* Date range chips wrap and shrink */
  .range-chip { font-size: 12.5px; padding: 6px 11px; }

  /* Customer/staff header banner shrinks gracefully */
  .cust-header { padding: 14px 16px; }
  .cust-header h2 { font-size: 19px; }
  .cust-header .meta { font-size: 12.5px; }

  /* Login card on phone */
  .login-card { width: calc(100vw - 32px) !important; max-width: 420px; padding: 24px 20px; margin: 16px; }
}

@media (max-width: 480px) {
  /* Even tighter for narrow phones */
  .kpi-grid { grid-template-columns: 1fr; }
  .topbar .title { font-size: 15px; }
  .pe-toolbar button { font-size: 12px; padding: 6px 9px; }
  .btn-sm { padding: 5px 9px; font-size: 12px; }
}

/* ═════════════════════════════════════════════════════════════════════
   PRINT STYLES — works for the whole app. Ctrl+P on any page produces
   a clean, structured printout: hides chrome, expands to full width,
   keeps tables intact across pages.
═════════════════════════════════════════════════════════════════════ */
.print-only { display: none; }   /* normally hidden, shown when printing */
.no-print { /* no-op — hidden via @media print below */ }

@media print {
  /* Hide every interactive / chrome element */
  .sidebar, .topbar, #toastHolder,
  #bugaCloudFab, #bugaCloudPanel, #recMigrateBtn, #pendingArchiveBanner,
  .login-screen, .modal-backdrop, .modal,
  .grid-toolbar, .nav-item, .actions, .pe-toolbar, .no-print,
  button, input[type="button"], input[type="submit"],
  [data-seed-banner] {
    display: none !important;
  }
  /* Expand main area to full page */
  html, body, .app, .main, .content {
    background: white !important; color: black !important;
    margin: 0 !important; padding: 0 !important; height: auto !important;
    font-size: 11pt !important;
  }
  .main { margin-left: 0 !important; }
  .content { padding: 14mm !important; max-width: 100% !important; }
  /* Cards: drop shadow, make borders printer-friendly */
  .card {
    box-shadow: none !important; border: 1px solid #999 !important;
    background: white !important; padding: 10px !important;
    page-break-inside: avoid;
    margin-bottom: 10px !important;
  }
  /* Tables: keep header on every page, allow rows to break sensibly */
  table { width: 100% !important; border-collapse: collapse !important; page-break-inside: auto; }
  thead { display: table-header-group; background: #eee !important; }
  tr { page-break-inside: avoid; page-break-after: auto; }
  th, td { border: 1px solid #aaa !important; padding: 4px 6px !important; font-size: 10pt !important; color: black !important; }
  th { background: #e8e8e8 !important; font-weight: bold !important; }
  /* Reveal print-only header band on each page */
  .print-only { display: block !important; }
  .print-header {
    border-bottom: 2px solid #1F4E79;
    margin-bottom: 14px;
    padding-bottom: 8px;
  }
  .print-header h1 {
    font-size: 18pt; color: #1F4E79; margin: 0; font-weight: 700;
  }
  .print-header .sub {
    font-size: 10pt; color: #666; margin-top: 4px;
  }
  /* Inputs: render as their displayed value rather than a form control */
  input, select, textarea {
    border: none !important; background: transparent !important;
    color: black !important; font-size: 10pt !important;
  }
  /* Hide column-sort arrows in headers */
  th span { display: none !important; }
  /* Hyperlinks: black, no underline noise */
  a { color: black !important; text-decoration: none !important; }
  /* Page breaks helpers */
  .page-break  { page-break-before: always; }
  .avoid-break { page-break-inside: avoid; }
}

/* Print-export toolbar (visible on screen, hidden in print) */
.pe-toolbar {
  display: inline-flex; gap: 6px; align-items: center;
  flex-wrap: wrap;
}
.pe-toolbar button {
  background: white; border: 1px solid var(--brand); color: var(--brand);
  padding: 7px 13px; border-radius: 6px; font-size: 13.5px; font-weight: 600;
  cursor: pointer;
}
@media (min-width: 1280px) { .pe-toolbar button { font-size: 14.5px; padding: 8px 14px; } }
@media (min-width: 1600px) { .pe-toolbar button { font-size: 15px; } }
.pe-toolbar button:hover { background: var(--brand); color: white; }


  #bugaCloudFab {
    position: fixed; right: 16px; bottom: 16px; z-index: 9000;
    background: var(--brand); color: #fff; border: none;
    padding: 10px 16px; border-radius: 24px; font-weight: 600;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18); cursor: pointer; font-size: 13px;
    display: flex; align-items: center; gap: 6px;
  }
  #bugaCloudFab:hover { background: var(--brand-dark); }
  #bugaCloudFab .dot { width: 8px; height: 8px; border-radius: 50%; background: #C00000; }
  #bugaCloudFab.connected .dot { background: #4CAF50; }
  #bugaCloudFab.signed-in .dot { background: #4CAF50; box-shadow: 0 0 0 3px rgba(76,175,80,0.25); }
  #bugaCloudPanel {
    position: fixed; right: 16px; bottom: 70px; z-index: 9001;
    width: 380px; max-width: calc(100vw - 32px);
    background: #fff; border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,0.22);
    padding: 18px; display: none; max-height: 80vh; overflow-y: auto;
  }
  #bugaCloudPanel h3 { font-size: 15px; margin-bottom: 4px; color: var(--brand); }
  #bugaCloudPanel .small { font-size: 12px; color: var(--grey); }
  #bugaCloudPanel .field { margin-top: 10px; }
  #bugaCloudPanel .field label { display: block; font-size: 11px; color: var(--grey); margin-bottom: 3px; font-weight: 600; }
  #bugaCloudPanel .field input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
  #bugaCloudPanel .actions { display: flex; gap: 6px; margin-top: 12px; }
  #bugaCloudPanel .actions button { flex: 1; padding: 9px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; border: 1px solid var(--brand); background: var(--brand); color: #fff; }
  #bugaCloudPanel .actions button.ghost { background: #fff; color: var(--brand); }
  #bugaCloudPanel .status-badge { display: inline-block; padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
  #bugaCloudPanel .status-badge.ok { background: #E8F5E9; color: #2E7D32; }
  #bugaCloudPanel .status-badge.warn { background: #FFF3E0; color: #E65100; }
  #bugaCloudPanel .status-badge.err { background: #FFEBEE; color: #C00000; }
  #bugaCloudPanel hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
  #bugaCloudPanel .msg { padding: 8px 10px; border-radius: 6px; font-size: 12px; margin-top: 10px; }
  #bugaCloudPanel .msg.err { background: #FFEBEE; color: #C00000; }
  #bugaCloudPanel .msg.ok  { background: #E8F5E9; color: #2E7D32; }
  #bugaCloudPanel .msg.info { background: #E3F2FD; color: #1565C0; }
  .cloud-hidden { display: none !important; }


  #migrationOverlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 9500;
    display: none; align-items: center; justify-content: center;
  }
  #migrationModal {
    background: #fff; width: 720px; max-width: 95vw; max-height: 90vh;
    border-radius: 12px; padding: 22px; overflow-y: auto;
    box-shadow: 0 18px 60px rgba(0,0,0,0.28);
  }
  #migrationModal h2 { color: var(--brand); font-size: 18px; margin-bottom: 4px; }
  #migrationModal .sub { color: var(--grey); font-size: 13px; margin-bottom: 14px; }
  #migrationModal table { width: 100%; border-collapse: collapse; font-size: 13px; }
  #migrationModal th, #migrationModal td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; }
  #migrationModal th { background: var(--light); font-weight: 600; font-size: 11px; text-transform: uppercase; color: var(--grey); }
  #migrationModal td.status-cell { text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; min-width: 130px; }
  #migrationModal .status-pending  { color: var(--mid-grey); }
  #migrationModal .status-running  { color: var(--accent); font-weight: 600; }
  #migrationModal .status-done     { color: var(--success); font-weight: 600; }
  #migrationModal .status-error    { color: var(--warn); font-weight: 600; }
  #migrationModal .status-skip     { color: var(--mid-grey); font-style: italic; }
  #migrationModal .actions-row { display: flex; gap: 8px; margin-top: 14px; }
  #migrationModal .actions-row button { padding: 9px 16px; border-radius: 6px; font-weight: 600; font-size: 13px; cursor: pointer; border: 1px solid var(--brand); }
  #migrationModal .actions-row button.primary { background: var(--brand); color: #fff; }
  #migrationModal .actions-row button.ghost   { background: #fff; color: var(--brand); }
  #migrationModal .actions-row button:disabled { opacity: 0.5; cursor: not-allowed; }
  #migrationModal .preflight { background: var(--light); padding: 10px 12px; border-radius: 6px; font-size: 12px; margin-bottom: 14px; }
  #migrationModal .errors-box { margin-top: 14px; max-height: 180px; overflow-y: auto; background: #FFEBEE; padding: 10px; border-radius: 6px; font-size: 11px; font-family: monospace; }


  #recMigrateBtn {
    position: fixed; right: 16px; bottom: 60px; z-index: 8950;
    background: var(--orange); color: #fff; border: none;
    padding: 9px 14px; border-radius: 18px; font-size: 12px; font-weight: 600;
    box-shadow: 0 3px 10px rgba(0,0,0,0.18); cursor: pointer; display: none;
  }
  #recMigrateBtn:hover { background: #C36214; }


  #bugaAgentFab {
    position: fixed; bottom: 22px; right: 22px; z-index: 9000;
    width: 56px; height: 56px; border-radius: 50%; border: none;
    background: linear-gradient(135deg, #1F4E79, #2E75B6);
    color: white; font-size: 26px; cursor: pointer;
    box-shadow: 0 6px 20px rgba(31,78,121,0.35), 0 2px 6px rgba(0,0,0,0.15);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
  }
  #bugaAgentFab:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(31,78,121,0.4); }
  #bugaAgentFab:focus-visible { outline: 3px solid #FFD700; outline-offset: 2px; }
  #bugaAgentFab .fab-dot { position: absolute; top: 8px; right: 8px; width: 10px; height: 10px; border-radius: 50%; background: #4CAF50; box-shadow: 0 0 0 2px white; display: none; }
  #bugaAgentFab.has-news .fab-dot { display: block; }
  @media print { #bugaAgentFab, #bugaAgentPanel { display: none !important; } }

  #bugaAgentPanel {
    position: fixed; right: 0; top: 0; bottom: 0; z-index: 9100;
    width: min(460px, 100vw); background: #FAFBFC;
    box-shadow: -4px 0 24px rgba(0,0,0,0.18);
    display: none; flex-direction: column;
    border-left: 1px solid #D9E7F2;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  }
  #bugaAgentPanel.open { display: flex; }
  /* When dragged, the panel becomes a free-floating window with rounded
     corners + thicker shadow so it reads as a movable pane, not a dock. */
  #bugaAgentPanel.floating {
    bottom: auto; right: auto;
    height: min(680px, calc(100vh - 40px));
    border-radius: 14px; border: 1px solid #D9E7F2;
    box-shadow: 0 18px 60px rgba(0,0,0,0.28);
    overflow: hidden;
  }
  @media (max-width: 480px) { #bugaAgentPanel { width: 100vw; } }

  #bugaAgentPanel .ag-header {
    padding: 14px 18px; background: linear-gradient(135deg, #1F4E79, #2E75B6);
    color: white; display: flex; justify-content: space-between; align-items: center;
    cursor: grab; user-select: none;
  }
  #bugaAgentPanel .ag-header:active,
  #bugaAgentPanel.dragging .ag-header { cursor: grabbing; }
  /* Subtle "drag me" hint so it's discoverable. */
  #bugaAgentPanel .ag-header::before {
    content: '⋮⋮'; color: rgba(255,255,255,0.45);
    font-size: 14px; letter-spacing: -2px; margin-right: 10px;
  }
  #bugaAgentPanel .ag-header .ag-title { font-weight: 700; font-size: 17px; line-height: 1; }
  #bugaAgentPanel .ag-header .ag-sub { font-size: 12px; opacity: 0.85; margin-top: 2px; line-height: 1; }
  #bugaAgentPanel .ag-close, #bugaAgentPanel .ag-clear {
    background: rgba(255,255,255,0.15); border: none; color: white;
    width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 18px;
    line-height: 1; display: inline-flex; align-items: center; justify-content: center;
  }
  #bugaAgentPanel .ag-close:hover, #bugaAgentPanel .ag-clear:hover { background: rgba(255,255,255,0.25); }

  /* Toggle bar — three pill buttons under the header. Each toggle lights
     up brand-blue when active. State persists in localStorage. */
  #bugaAgentPanel .ag-toolbar {
    display: flex; gap: 6px; padding: 8px 12px;
    background: white; border-bottom: 1px solid #D9E7F2;
    flex-wrap: wrap;
  }
  #bugaAgentPanel .ag-toggle {
    background: #F5F9FC; border: 1px solid #D9E7F2; color: #6B6B6B;
    padding: 6px 12px; border-radius: 14px; font-size: 12.5px; font-weight: 600;
    cursor: pointer; font-family: inherit; transition: all 0.1s; line-height: 1;
  }
  #bugaAgentPanel .ag-toggle:hover { background: #E4EDF4; color: #1F4E79; }
  #bugaAgentPanel .ag-toggle.on    { background: #1F4E79; color: white; border-color: #1F4E79; }
  #bugaAgentPanel .ag-toggle.on:hover { background: #163A5C; color: white; }
  #bugaAgentPanel .ag-thinking-block {
    align-self: flex-start; max-width: 88%;
    background: #FFF8E1; border: 1px dashed #B8860B; color: #5D4037;
    padding: 10px 14px; border-radius: 12px; font-size: 13px;
    font-style: italic; white-space: pre-wrap; line-height: 1.55;
  }
  #bugaAgentPanel .ag-thinking-block::before {
    content: '💭 reasoning  '; font-weight: 700; font-style: normal; color: #8B5A00;
  }

  #bugaAgentMessages {
    flex: 1; overflow-y: auto; padding: 16px; background: #FAFBFC;
    display: flex; flex-direction: column; gap: 12px;
  }
  #bugaAgentMessages .ag-msg {
    max-width: 88%; padding: 10px 14px; border-radius: 14px; line-height: 1.55;
    font-size: 14.5px; word-wrap: break-word; white-space: pre-wrap;
  }
  #bugaAgentMessages .ag-msg.user  { background: #1F4E79; color: white; align-self: flex-end; border-top-right-radius: 4px; }
  #bugaAgentMessages .ag-msg.bot   { background: white; color: #222; align-self: flex-start; border: 1px solid #D9E7F2; border-top-left-radius: 4px; }
  #bugaAgentMessages .ag-msg.error { background: #FFE8E1; color: #C00; border: 1px solid #C00; }
  #bugaAgentMessages .ag-msg strong { font-weight: 700; }
  #bugaAgentMessages .ag-meta {
    align-self: flex-start; font-size: 11px; color: #6B6B6B; margin-top: -6px;
    padding-left: 4px; line-height: 1.4;
  }
  #bugaAgentMessages .ag-meta .ag-tool-chip {
    display: inline-block; background: #FFF8E1; color: #8B5A00;
    padding: 1px 7px; border-radius: 8px; margin-right: 4px; font-size: 10.5px; font-weight: 600;
  }
  #bugaAgentMessages .ag-typing {
    align-self: flex-start; padding: 10px 14px; background: white;
    border: 1px solid #D9E7F2; border-radius: 14px; border-top-left-radius: 4px;
    color: #6B6B6B; font-size: 13.5px;
  }
  #bugaAgentMessages .ag-typing .ag-dot {
    display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #2E75B6;
    margin: 0 2px; animation: bugaAgentBounce 1.2s infinite ease-in-out;
  }
  #bugaAgentMessages .ag-typing .ag-dot:nth-child(2) { animation-delay: 0.15s; }
  #bugaAgentMessages .ag-typing .ag-dot:nth-child(3) { animation-delay: 0.3s; }
  @keyframes bugaAgentBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40%           { transform: scale(1);   opacity: 1;   }
  }
  #bugaAgentMessages .ag-empty {
    text-align: center; color: #6B6B6B; font-size: 13.5px; line-height: 1.6;
    padding: 30px 16px; background: white; border-radius: 12px; border: 1px dashed #D9E7F2;
  }
  #bugaAgentMessages .ag-empty .ag-empty-title { color: #1F4E79; font-weight: 700; font-size: 15px; margin-bottom: 8px; }
  #bugaAgentMessages .ag-empty .ag-suggestions { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
  #bugaAgentMessages .ag-empty .ag-suggest-btn {
    background: #F5F9FC; border: 1px solid #D9E7F2; color: #1F4E79;
    padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; text-align: left;
    font-family: inherit; line-height: 1.4;
  }
  #bugaAgentMessages .ag-empty .ag-suggest-btn:hover { background: #E4EDF4; }

  #bugaAgentForm {
    display: flex; gap: 8px; padding: 12px; background: white;
    border-top: 1px solid #D9E7F2;
  }
  #bugaAgentForm textarea {
    flex: 1; resize: none; min-height: 38px; max-height: 120px;
    padding: 9px 12px; font-size: 14.5px; line-height: 1.4;
    border: 1px solid #D9E7F2; border-radius: 10px; font-family: inherit;
    background: #FAFBFC;
  }
  #bugaAgentForm textarea:focus { outline: 2px solid #2E75B6; outline-offset: -2px; }
  #bugaAgentForm button {
    background: #1F4E79; color: white; border: none;
    padding: 9px 14px; border-radius: 10px; font-weight: 600; cursor: pointer;
    font-size: 14px;
  }
  #bugaAgentForm button:hover { background: #163A5C; }
  #bugaAgentForm button:disabled { background: #8A8A8A; cursor: not-allowed; }
  #bugaAgentForm .ag-attach {
    background: #F5F9FC; color: #1F4E79; border: 1px solid #D9E7F2;
    padding: 9px 11px; font-size: 16px; font-weight: 500;
  }
  #bugaAgentForm .ag-attach:hover { background: #E4EDF4; }
  #bugaAgentFooter {
    padding: 6px 12px; font-size: 11px; color: #6B6B6B; text-align: center;
    background: white; border-top: 1px solid #F0F5FA;
  }
