/* =============================================================================
   Time Champ RCM Cloud — Stylesheet
   Enterprise healthcare SaaS aesthetic: dark navy rail, light workspace.
   ========================================================================== */

/* -----------------------------------------------------------------------------
   TOKENS.  One accent (Time Champ brand blue), a status trio whose text pairs
   are AA-measured, a meaning-contract data palette, and a four-step radius
   scale.  Every contrast ratio in a comment below was measured, not eyeballed.
   -------------------------------------------------------------------------- */
:root {
  /* ---- ground & ink (cool, navy-biased neutrals) ---- */
  --bg:          #FAFBFE;
  --card:        #ffffff;
  --ink:         #0B1635;   /* 17.79:1 on card */
  --ink-2:       #1E293B;   /* 14.63:1 on card */
  --muted:       #5b6b85;   /*  5.40:1 on card · 5.22:1 on bg */
  --line:        #E2E8F0;
  --line-2:      #EEF2F8;

  /* ---- the rail: a dark surface, so it gets its own ink ramp ---- */
  --rail:        #0B1635;
  --rail-2:      #0A1A4A;   /* foot of the rail — one tone, not a light show */
  --navy-3:      #16306a;   /* the active nav row */
  --rail-text:   #9fb0cc;   /*  8.10:1 on rail */
  --rail-dim:    #8ea0bf;   /*  6.72:1 on rail — group labels */
  --rail-active: #7DA2FF;   /* the ONE accent, tinted for a dark ground: 7.19:1 */

  /* ---- ONE accent.  Everything interactive is this hue. ---- */
  --brand:       #0030DB;   /*  8.59:1 on card · 8.30:1 on bg */
  --brand-ink:   #0021A0;
  --brand-bg:    #F2F6FF;

  /* ---- status: the vivid value is a FILL, the -ink is its text pair ---- */
  --green:       #10b981;
  --good-ink:    #0e7a55;   /*  4.88:1 worst ground */
  --amber:       #f59e0b;
  --warn-ink:    #96620a;   /*  4.74:1 worst ground */
  --red:         #ef4444;
  --danger-ink:  #c62828;   /*  5.14:1 worst ground */

  /* ---- data palette — a MEANING CONTRACT, not decoration.
         The charts are built in JS and set SVG paint attributes directly, so
         these values live as literals in data.js / reports.js / charts.js.
         The contract they follow, written down once:
           #0030DB  the subject / the primary measure / "our book"
           #3F63E4  the comparison series / the second category
           #7BA4E8  the third share       #A9C4F0  the fourth share
           #94a3b8  a reference line, or "this one is not a problem"
           status:  #10b981 good · #f59e0b watch · #ef4444 bad · #b91c1c worst
         A category never wears a status colour, and a status colour means the
         same state on every chart on the screen. ---- */
  --viz-track:   #EEF2F8;   /* the empty part of any bar or meter */

  --shadow:      0 1px 2px rgba(16,30,51,.05);
  --shadow-lg:   0 1px 2px rgba(16,30,51,.05), 0 8px 26px -10px rgba(16,30,51,.16);

  /* ---- radii: micro · control · card · pill ---- */
  --r-micro:     4px;
  --r-ctl:       8px;
  --r-card:      12px;
  --r-pill:      999px;
}

* { box-sizing: border-box; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--r-micro); }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ---- Layout shell ---------------------------------------------------------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

/* =============================================================================
   OPERATIONS LAYER — buttons, drill-downs, modal, drawer, forms, toasts
   ========================================================================== */

/* ---- buttons ------------------------------------------------------------- */
.btn {
  font: inherit; font-size: 13px; font-weight: 600; line-height: 1;
  padding: 10px 16px; border-radius: var(--r-ctl); border: 1px solid var(--line);
  background: var(--card); color: var(--ink-2); cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #0021A0; border-color: #0021A0; color: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn.sm { padding: 7px 11px; font-size: 12px; }
.btn:disabled, .btn.is-busy { opacity: .6; cursor: default; }
.btn:focus-visible, .rowbtn:focus-visible, .drill:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---- in-row action buttons ----------------------------------------------- */
.rowbtn {
  font: inherit; font-size: 11.5px; font-weight: 600; line-height: 1;
  padding: 6px 10px; margin: 2px 4px 2px 0; white-space: nowrap;
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--card); color: var(--ink-2); cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.rowbtn:hover { border-color: var(--brand); color: var(--brand); background: #F5F8FF; }
.rowbtn.primary { border-color: var(--brand); color: var(--brand); background: #F2F6FF; }
.rowbtn.warn:hover { border-color: var(--warn-ink); color: var(--warn-ink); background: #FFF7ED; }
.rowbtn.danger:hover { border-color: var(--red); color: var(--red); background: #FEF2F2; }
td.act-col, th.act-col { white-space: nowrap; width: 1%; }

/* ---- drill-down links ---------------------------------------------------- */
.drill {
  color: var(--brand); text-decoration: none; font-weight: 600;
  border-bottom: 1px dashed rgba(0,48,219,.35); cursor: pointer;
}
.drill:hover { border-bottom-style: solid; }
.drill.plain { border: 0; font-weight: inherit; color: inherit; display: inline-block; }
.drill.plain:hover .strong { color: var(--brand); }

/* ---- operations bar above a grid ----------------------------------------- */
.ops-bar {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  margin: 0 0 16px;
}
.ops-bar-r { display: flex; gap: 8px; margin-left: auto; flex-shrink: 0; }
.ops-sub {
  margin: 0; flex: 1 1 260px; min-width: 0;
  font-size: 13px; color: var(--muted); line-height: 1.5;
}
/* The grid owns the card, so the table meets its edges. */
.ops-card { padding: 0; overflow: hidden; }
.ops-card .tbl-wrap { margin: 0; }
.ops-card .tbl-toolbar { padding: 14px 18px 0; margin-bottom: 12px; }
.ops-card .tbl-pager { padding: 12px 18px; border-top: 1px solid var(--line); margin: 0; }

/* ---- inline SVG icons -----------------------------------------------------
   Charts depend on a global `svg { width:100% }` rule further down this file,
   so icons pin their own box (the renderer also sets it inline). */
.ic { display: block; flex: none; width: 16px; height: 16px; }
.nav a .ico, .cc-ico, .sr-ico { display: inline-flex; align-items: center; justify-content: center; }
.icon-badge { display: inline-flex; align-items: center; gap: 5px; }
.icon-badge .ic { opacity: .75; }
/* ---- stage drill-down ----------------------------------------------------- */
.stage-strip {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px;
}
.stage-chip {
  font: inherit; display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--card); cursor: pointer; text-align: left;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.stage-chip .sc-name { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.stage-chip .sc-count {
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
  min-width: 20px; padding: 2px 6px; border-radius: var(--r-pill);
  background: var(--line-2); color: var(--muted); text-align: center;
}
.stage-chip:hover { border-color: var(--brand); }
.stage-chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.stage-chip.on { border-color: var(--brand); background: #F2F6FF; box-shadow: 0 0 0 3px rgba(0,48,219,.10); }
.stage-chip.on .sc-name { color: var(--brand); }
.stage-chip.on .sc-count { background: var(--brand); color: #fff; }
/* a stage in trouble says so even when it is not selected */
.stage-chip.risk  .sc-name::before { content: "●"; color: var(--danger-ink);   margin-right: 6px; font-size: 9px; vertical-align: 2px; }
.stage-chip.watch .sc-name::before { content: "●"; color: var(--warn-ink); margin-right: 6px; font-size: 9px; vertical-align: 2px; }

.stage-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 13px; color: var(--muted); margin-bottom: 12px;
}
.stage-head b { color: var(--ink); font-size: 14px; }

.tl-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.tl-recorded {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); font-weight: 700; margin: 14px 0 8px;
}

/* ---- slim breadcrumb row (capability pages) ------------------------------ */
.crumb-bar {
  display: flex; justify-content: flex-end; align-items: center;
  margin: 0 0 14px; min-height: 20px;
}
.crumb-bar .back-link { float: none; }

/* ---- pagination ---------------------------------------------------------- */
.tbl-scroll { overflow-x: auto; }
.tbl-pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-top: 12px;
}
.tbl-pager:empty { display: none; }
.pg-info { font-size: 12px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.pg-btns { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.pg-btn {
  font: inherit; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  min-width: 30px; height: 30px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--card);
  color: var(--ink-2); cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.pg-btn:hover:not(:disabled):not(.on) { border-color: var(--brand); color: var(--brand); }
.pg-btn.on { background: var(--brand); border-color: var(--brand); color: #fff; cursor: default; }
.pg-btn:disabled { opacity: .4; cursor: default; }
.pg-gap { padding: 0 2px; color: var(--muted); font-size: 12.5px; }
th.act-col { text-align: right; }
td.act-col { text-align: right; }

/* ---- sidebar footer ------------------------------------------------------ */
.nav-foot { padding: 14px 12px 4px; }
.nav-foot .btn {
  width: 100%; background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14);
  color: var(--rail-text);
}
.nav-foot .btn:hover { background: rgba(255,255,255,.12); border-color: var(--rail-active); color: #fff; }

/* ---- toasts -------------------------------------------------------------- */
.toast-host {
  position: fixed; z-index: 120; right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 500;
  padding: 12px 16px; border-radius: var(--r-ctl); box-shadow: var(--shadow-lg);
  max-width: 380px; animation: toastIn .22s ease both;
}
.toast .t-ico {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; background: var(--green); color: #06281c;
}
.toast.err .t-ico { background: var(--red); color: #fff; }
.toast.warn .t-ico { background: var(--amber); color: #4a2d03; }
.toast.out { animation: toastOut .24s ease both; }
@keyframes toastIn  { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px) scale(.98); } }

/* ---- overlay: modal + drawer --------------------------------------------- */
body.ov-open { overflow: hidden; }
.ov-back {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(11,22,53,.42); backdrop-filter: blur(2px);
  display: flex; opacity: 0; transition: opacity .2s ease;
}
.ov-back.in { opacity: 1; }
.ov-back.out { opacity: 0; }

.ov-modal {
  margin: auto; width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow-lg);
  transform: translateY(8px) scale(.985); transition: transform .2s ease;
}
.ov-modal.wide { width: min(760px, calc(100vw - 32px)); }
.ov-back.in .ov-modal { transform: none; }

.ov-drawer {
  margin-left: auto; height: 100%; width: min(720px, calc(100vw - 32px));
  display: flex; flex-direction: column; background: var(--card);
  box-shadow: var(--shadow-lg); transform: translateX(24px); transition: transform .22s ease;
}
.ov-back.in .ov-drawer { transform: none; }

.ov-head {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 20px 22px 16px; border-bottom: 1px solid var(--line);
}
.ov-head h3 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.ov-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.dw-eyebrow { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); margin-bottom: 3px; }
.ov-x {
  margin-left: auto; flex-shrink: 0; width: 30px; height: 30px; line-height: 1;
  border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--card);
  font-size: 19px; color: var(--muted); cursor: pointer;
}
.ov-x:hover { border-color: var(--danger-ink); color: var(--danger-ink); }
.ov-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.ov-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 22px; border-top: 1px solid var(--line); background: var(--bg);
  border-radius: 0 0 var(--r-card) var(--r-card);
}
.ov-drawer .ov-foot { border-radius: 0; }

/* ---- drill-down drawer internals ------------------------------------------ */
.dw-head-main { min-width: 0; }
.dw-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dw-body { background: var(--bg); }
.dw-body > .tile-row { margin-bottom: 4px; }

.dw-sec { margin-top: 18px; }
.dw-sec-h {
  display: flex; align-items: baseline; gap: 9px; margin-bottom: 9px;
}
.dw-sec-h h4 {
  margin: 0; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; color: var(--ink-2);
}
.dw-count {
  font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--line-2); color: var(--muted); padding: 1px 7px; border-radius: var(--r-pill);
}
.dw-sec-aside {
  margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
/* each section's content sits on its own card so the drawer reads as blocks */
.dw-sec .tbl-wrap, .dw-sec .timeline, .dw-sec .dw-empty {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-ctl);
  padding: 4px 14px; margin: 0;
}
.dw-sec .timeline { padding: 16px 16px 6px; }
.dw-sec .tbl-wrap .tbl { margin: 0; }
.dw-empty {
  padding: 22px 14px; text-align: center; color: var(--muted); font-size: 12.5px;
}

/* ---- drawer alert --------------------------------------------------------- */
.dw-alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; margin-top: 14px; border-radius: var(--r-ctl);
  font-size: 12.5px; line-height: 1.5; border: 1px solid;
}
.dw-alert .ic { margin-top: 1px; }
.dw-alert b { font-weight: 700; }
.dw-alert.bad  { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.dw-alert.warn { background: #FFF7ED; border-color: #FED7AA; color: #9A3412; }
.dw-alert.info { background: var(--brand-bg); border-color: #C7D5FF; color: var(--brand-ink); }

.neg-val { color: var(--danger-ink); font-weight: 600; }
.cf-text { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.55; }
.cf-detail { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* ---- forms --------------------------------------------------------------- */
.fm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fm-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fm-field.span2 { grid-column: 1 / -1; }
.fm-field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.fm-field .req { color: var(--danger-ink); }
.fm-field input, .fm-field select, .fm-field textarea {
  font: inherit; font-size: 13.5px; color: var(--ink);
  padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--card); width: 100%; transition: border-color .15s, box-shadow .15s;
}
.fm-field textarea { resize: vertical; line-height: 1.5; }
.fm-field input:focus, .fm-field select:focus, .fm-field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,48,219,.12);
}
.fm-field input[readonly], .fm-field select:disabled {
  background: var(--line-2); color: var(--muted); cursor: not-allowed;
}
.fm-help { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.fm-err  { font-size: 11.5px; color: var(--danger-ink); font-weight: 600; }
.fm-field.bad input, .fm-field.bad select, .fm-field.bad textarea { border-color: var(--red); }
.fm-field.bad input:focus, .fm-field.bad select:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.14); }

@media (max-width: 620px) {
  .fm-grid { grid-template-columns: 1fr; }
  .ov-foot { flex-direction: column-reverse; }
  .ov-foot .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .ov-back, .ov-modal, .ov-drawer, .toast { transition: none; animation: none; }
}

/* ---- Embedded mode (?embed=1) ----------------------------------------------
   When this demo runs inside the RCM Suite shell (industry-rcm-suite.html), the
   suite already provides the icon rail and the capability sub-menu, so we drop
   our own sidebar and let the reports use the full width. */
body.embed .app { grid-template-columns: 1fr; }
body.embed .rail { display: none; }
body.embed .topbar { padding: 12px 24px; }
body.embed .content { padding: 20px 24px 40px; }
/* The suite header already names the screen — don't print it a second time.
   The crumb stays, because it carries detail the suite header does not. */
body.embed .tb-title h1 { display: none; }
body.embed .tb-title .crumb { margin-top: 0; font-size: 13px; }

.rail {
  /* One tone, not a light show: the two decorative radial washes (cyan + violet)
     are gone, and the ramp is a single hue so every label on it measures AA. */
  background: linear-gradient(180deg, var(--rail) 0%, var(--rail-2) 100%);
  color: var(--rail-text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  /* the hairline the two-tone split was missing */
  box-shadow: inset -1px 0 0 rgba(255,255,255,.07), 1px 0 0 rgba(11,22,53,.10);
}
.brand { padding: 20px 20px 14px; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand .logo { display: flex; align-items: center; gap: 10px; }
.brand .mark {
  width: 34px; height: 34px; border-radius: var(--r-ctl);
  background: var(--brand);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
}
.brand .name { color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.brand .sub { font-size: 11px; color: var(--rail-text); margin-top: 2px; }
.brand .poc {
  margin-top: 12px; font-size: 10.5px; letter-spacing: .4px; text-transform: uppercase;
  color: #cfe0ff; background: rgba(125,162,255,.12); border: 1px solid rgba(125,162,255,.30);
  padding: 5px 9px; border-radius: var(--r-pill); display: inline-flex; align-items: center; gap: 6px;
}

.nav {
  padding: 12px 12px 20px; overflow-y: auto; flex: 1; min-height: 0;
  overscroll-behavior: contain;
  /* The list is longer than the rail.  Fade the last few pixels so the cut
     reads as "there is more below" instead of "this label got sliced off". */
  -webkit-mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - 24px), transparent 100%);
          mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - 24px), transparent 100%);
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.22) transparent;
}
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.20); border-radius: var(--r-pill); }
.nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.34); }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav .group-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--rail-dim); padding: 14px 12px 6px;
}
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--r-ctl); color: var(--rail-text);
  text-decoration: none; font-weight: 500; font-size: 13.5px; cursor: pointer;
  margin-bottom: 2px; transition: background .15s, color .15s;
}
.nav a .ico { width: 18px; text-align: center; opacity: .9; font-size: 15px; }
.nav a:hover { background: rgba(255,255,255,.05); color: #e7eef9; }
.nav a.active { background: var(--navy-3); color: #fff; }
.nav a.active .ico { color: var(--rail-active); }
.nav a .tag {
  margin-left: auto; font-size: 10px; background: rgba(239,68,68,.9); color: #fff;
  padding: 1px 7px; border-radius: var(--r-pill); font-weight: 700;
}

.rail-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.06); font-size: 11.5px; }
.rail-foot .status { display: flex; align-items: center; gap: 8px; color: #c6d3e6; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.live { background: var(--green); box-shadow: 0 0 0 3px rgba(16,185,129,.2); }

/* ---- Workspace ------------------------------------------------------------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 14px 28px; display: flex; align-items: center; gap: 18px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 700; letter-spacing: -.2px; }
.topbar .crumb { font-size: 12px; color: var(--muted); margin-top: 2px; }
.topbar .spacer { flex: 1; }
.topbar .chip {
  font-size: 12px; color: var(--ink-2); background: var(--bg);
  border: 1px solid var(--line); padding: 6px 12px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.topbar .chip b { color: var(--ink); font-weight: 700; }

.content { padding: 24px 28px 48px; }
.view { display: none; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-intro {
  background: var(--card);
  border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: var(--r-ctl); padding: 14px 18px; margin-bottom: 20px;
  color: var(--ink-2); font-size: 13px;
}
.section-intro b { color: var(--ink); }

/* ---- Grid helpers ---------------------------------------------------------- */
.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-2-1 { grid-template-columns: 2fr 1fr; }
.g-1-2 { grid-template-columns: 1fr 2fr; }
@media (max-width: 1200px) { .g-4 { grid-template-columns: repeat(2, 1fr); } .g-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px)  { .g-2, .g-2-1, .g-1-2, .g-3, .g-4 { grid-template-columns: 1fr; } }

/* ---- Cards ----------------------------------------------------------------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--shadow); padding: 18px;
}
.card .card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card .card-head h3 { margin: 0; font-size: 14px; font-weight: 700; }
.card .card-head .sub { font-size: 11.5px; color: var(--muted); }
.card .card-head .right { margin-left: auto; font-size: 12px; color: var(--muted); }

/* ---- KPI tiles ------------------------------------------------------------- */
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 16px 16px 14px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--line);
}
.kpi.good::before { background: var(--green); }
.kpi.warn::before { background: var(--amber); }
.kpi.bad::before  { background: var(--red); }
.kpi .k-label { font-size: 12px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .k-val { font-size: 27px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 6px; color: var(--ink); }
.kpi .k-val small { font-size: 15px; font-weight: 700; color: var(--ink-2); margin-left: 1px; }
.kpi .k-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.kpi .k-target { font-size: 11px; color: var(--muted); }
.trend { font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; }
.trend.up { color: var(--good-ink); }
.trend.down { color: var(--danger-ink); }
.trend.pos { color: var(--good-ink); }
.trend.neg { color: var(--danger-ink); }
.k-bar { height: 5px; background: var(--viz-track); border-radius: var(--r-pill); margin-top: 10px; overflow: hidden; }
.k-bar > i { display: block; height: 100%; border-radius: var(--r-pill); background: var(--brand); }

/* small info tooltip */
.info { cursor: help; color: var(--muted); border: 1px solid var(--line); border-radius: 50%;
  width: 15px; height: 15px; display: inline-grid; place-items: center; font-size: 10px; font-style: normal; }

/* ---- Tables ---------------------------------------------------------------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); font-weight: 700; padding: 9px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: #f8fafc; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.tbl .strong { font-weight: 700; color: var(--ink); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #fff; flex: none;
}
.who { display: flex; align-items: center; gap: 10px; }
.who .meta small { display: block; color: var(--muted); font-size: 11px; }

/* ---- Badges / pills -------------------------------------------------------- */
.badge {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.badge.green  { background: #dcfce7; color: #15803d; }
.badge.teal   { background: #E0E7FF; color: #0030DB; }
.badge.amber  { background: #fef3c7; color: #b45309; }
.badge.orange { background: #ffedd5; color: #c2410c; }
.badge.red    { background: #fee2e2; color: #b91c1c; }
.badge.blue   { background: #dbeafe; color: #1d4ed8; }
.badge.gray   { background: #eef1f6; color: #475569; }
.badge.violet { background: #eef1f6; color: #475569; }  /* purple demoted: an audit tag is not a status */

.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.status-pill .dot { width: 8px; height: 8px; }

/* ---- Progress meters ------------------------------------------------------- */
.meter { height: 8px; background: var(--viz-track); border-radius: var(--r-pill); overflow: hidden; min-width: 90px; }
.meter > i { display: block; height: 100%; border-radius: var(--r-pill); }
.meter-row { display: flex; align-items: center; gap: 10px; }
.meter-row .mv { font-size: 12px; font-weight: 700; width: 40px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Legend ---------------------------------------------------------------- */
.legend { display: flex; flex-direction: column; gap: 9px; }
.legend .li { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.legend .sw { width: 11px; height: 11px; border-radius: var(--r-micro); flex: none; }
.legend .li .val { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- Alerts ---------------------------------------------------------------- */
.alert {
  display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--r-ctl);
  border: 1px solid var(--line); background: var(--card); margin-bottom: 10px;
  border-left-width: 3px;
}
.alert.critical { border-left-color: var(--red); background: #fef6f6; }
.alert.warning  { border-left-color: var(--amber); background: #fffbf2; }
.alert.info     { border-left-color: var(--brand); background: #f4f9ff; }
.alert .a-ico { font-size: 16px; }
.alert .a-body b { display: block; font-size: 13px; margin-bottom: 2px; }
.alert .a-body span { font-size: 12px; color: var(--ink-2); }

/* ---- Funnel ---------------------------------------------------------------- */
.funnel { display: flex; flex-direction: column; gap: 7px; }
.funnel .f-row { display: flex; align-items: center; gap: 12px; }
.funnel .f-label { width: 150px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; flex: none; }
.funnel .f-bar-wrap { flex: 1; }
.funnel .f-bar {
  height: 30px; border-radius: var(--r-ctl); display: flex; align-items: center; padding: 0 10px;
  color: #fff; font-size: 12.5px; font-weight: 700; min-width: 44px; transition: width .6s ease;
}
.funnel .f-count { width: 74px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }

/* ---- Charts (SVG holders) -------------------------------------------------- */
.chart-wrap { width: 100%; }
svg { display: block; width: 100%; height: auto; overflow: visible; }
.axis-lbl { font-size: 10.5px; fill: var(--muted); }
.grid-line { stroke: var(--line-2); stroke-width: 1; }

/* ---- Split stat rows ------------------------------------------------------- */
.stat-strip { display: flex; flex-wrap: wrap; gap: 8px 26px; }
.stat-strip .s { }
.stat-strip .s .l { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.stat-strip .s .v { font-size: 20px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.pod-card {
  border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 14px;
  background: var(--card); transition: box-shadow .15s, transform .15s;
}
.pod-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.pod-card .p-name { font-weight: 700; font-size: 13.5px; }
.pod-card .p-agents { font-size: 11.5px; color: var(--muted); }

.hbar-row { display: grid; grid-template-columns: 130px 1fr 54px; align-items: center; gap: 12px; margin-bottom: 9px; }
.hbar-row .hb-l { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.hbar { height: 22px; background: var(--viz-track); border-radius: var(--r-ctl); overflow: hidden; }
.hbar > i { display: block; height: 100%; border-radius: var(--r-ctl); }
.hbar-row .hb-v { text-align: right; font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; }

.note { font-size: 11.5px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

.pill-toggle { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px; }
.pill-toggle button {
  border: none; background: transparent; font: inherit; font-size: 12px; font-weight: 600;
  padding: 5px 13px; border-radius: var(--r-pill); cursor: pointer; color: var(--muted);
}
.pill-toggle button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

.scatter-dot { transition: r .2s; cursor: pointer; }
.scatter-dot:hover { r: 8; }

.footer-note {
  margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted); text-align: center;
}

/* ============================ CATALOGUE BUILD ============================= */
.muted { color: var(--muted); }

/* sidebar report count pills */
.nav a .count {
  margin-left: auto; font-size: 10.5px; font-weight: 700; color: #9fb0cc;
  background: rgba(255,255,255,.07); padding: 1px 8px; border-radius: var(--r-pill);
}
.nav a.active .count { background: rgba(0,48,219,.25); color: #9cc6ff; }

/* catalogue landing grid */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1200px) { .cat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 800px)  { .cat-grid { grid-template-columns: 1fr; } }
.cat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow); padding: 18px; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s;
  display: flex; flex-direction: column;
}
.cat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: #C7D5FF; }
.cc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cc-ico {
  width: 34px; height: 34px; border-radius: var(--r-ctl); display: grid; place-items: center;
  background: var(--line-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 18px; flex: none;
  transition: color .15s, background .15s, border-color .15s;
}
.cat-card:hover .cc-ico { color: var(--brand); background: var(--brand-bg); border-color: #C7D5FF; }
.cc-name { font-weight: 700; font-size: 14px; line-height: 1.2; }
.cc-count { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.cc-list { list-style: none; margin: 0 0 12px; padding: 0; flex: 1; }
.cc-list li {
  font-size: 12.5px; color: var(--ink-2); padding: 5px 0 5px 16px; position: relative; border-bottom: 1px dashed var(--line-2);
}
.cc-list li:last-child { border-bottom: none; }
.cc-list li::before { content: "›"; position: absolute; left: 2px; color: var(--brand); font-weight: 700; }
.cc-open { font-size: 12px; font-weight: 700; color: var(--brand); }

/* report cards inside a capability */
.report-card { margin-bottom: 18px; }
.report-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.report-head h3 { margin: 4px 0 0; font-size: 16px; font-weight: 700; }
.report-idx { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--brand); font-weight: 700; }
.report-blurb { font-size: 12.5px; color: var(--muted); margin-top: 5px; max-width: 760px; line-height: 1.5; }
.report-head .badge { margin-left: auto; white-space: nowrap; }
.back-link { float: right; color: var(--brand); font-weight: 600; cursor: pointer; font-size: 12.5px; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

/* split layout */
.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 800px) { .split-2 { grid-template-columns: 1fr; } }
.mini-h { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; margin-bottom: 10px; }

/* AI morning brief */
.brief-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.brief-summary { font-size: 14px; line-height: 1.6; color: var(--ink); background: #F4F8FF; border-left: 3px solid var(--brand); padding: 12px 16px; border-radius: var(--r-ctl); margin: 0 0 16px; }
.brief-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 800px) { .brief-grid { grid-template-columns: 1fr; } }
.brief-hl { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.brief-hl span { font-weight: 700; }
.brief-hl.good span { color: var(--good-ink); }
.brief-hl.bad span { color: var(--danger-ink); }
.brief-hl.warn span { color: var(--warn-ink); }
.brief-action { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.ba-rank { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.ba-txt { font-size: 13px; font-weight: 600; }
.ba-meta { margin-top: 5px; display: flex; align-items: center; gap: 8px; font-size: 11.5px; }

/* KPI board */
.kpiboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .kpiboard { grid-template-columns: repeat(2, 1fr); } }
.kpi-cell { border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 14px; background: #fbfdfe; }
.kc-top { display: flex; align-items: center; justify-content: space-between; }
.kc-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.kc-val { font-size: 26px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: 6px 0 8px; }

/* tiles */
.tile-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .tile-row { grid-template-columns: repeat(2, 1fr); } }
.tile { border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 14px; background: #fbfdfe; }
.tile .tl { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.tile .tv { font-size: 24px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: 5px 0 3px; }
.tile .tf { font-size: 11.5px; color: var(--ink-2); }

/* stage scorecard dimension pill */
.dim-pill { display: inline-block; min-width: 34px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 12.5px; padding: 3px 8px; border-radius: var(--r-micro); }

/* timeline */
.timeline { position: relative; margin: 4px 0 4px 6px; padding-left: 18px; border-left: 2px solid var(--line); }
.tl-item { position: relative; padding: 8px 0 8px 4px; }
.tl-item.risk .tl-top b { color: var(--danger-ink); }
.tl-dot { position: absolute; left: -25px; top: 12px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 2px var(--line); }
.tl-top { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.tl-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* AI leakage findings */
.finding { border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: var(--r-ctl); padding: 12px 14px; margin-bottom: 10px; background: #fffbfb; }
.fd-top { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.fd-top b { font-size: 13.5px; }
.fd-body { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }

/* audit-readiness pack */
.pack { display: flex; flex-direction: column; gap: 8px; }
.pack-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: #fbfefc; }
.pk-check { width: 24px; height: 24px; border-radius: 50%; background: #dcfce7; color: #15803d; display: grid; place-items: center; font-weight: 700; flex: none; }
.pk-title { font-size: 13px; font-weight: 600; }
.pk-meta { font-size: 11.5px; }
.pack-item .badge { margin-left: auto; }

.dim-pill + .dim-pill { margin-left: 0; }

/* ===================== ENHANCEMENTS: SEARCH · SUMMARY · DEEP-LINK ========= */

/* topbar search */
.search-box { position: relative; display: flex; align-items: center; }
.search-ico { position: absolute; left: 11px; color: var(--muted); font-size: 15px; pointer-events: none; }
#search {
  width: 320px; max-width: 42vw; font: inherit; font-size: 13px; color: var(--ink);
  padding: 8px 12px 8px 32px; border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--bg); outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
#search:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(0,48,219,.15); }
#search::placeholder { color: var(--muted); }
@media (max-width: 900px) { #search { width: 180px; } }

/* clickable catalogue report items */
.cc-list li { cursor: pointer; transition: color .12s, padding-left .12s; }
.cc-list li:hover { color: var(--brand); padding-left: 20px; }
.cc-list li:hover::before { color: var(--brand); }

/* capability summary strip */
.cap-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 900px) { .cap-summary { grid-template-columns: repeat(2, 1fr); } }
.sum-tile {
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--line);
  border-radius: var(--r-ctl); box-shadow: var(--shadow); padding: 13px 15px;
}
.sum-tile.good { border-left-color: var(--green); }
.sum-tile.warn { border-left-color: var(--amber); }
.sum-tile.bad  { border-left-color: var(--red); }
.sum-tile .st-l { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.sum-tile .st-v { font-size: 23px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: 5px 0 3px; color: var(--ink); }
.sum-tile .st-f { font-size: 11.5px; color: var(--ink-2); }

/* search results */
.search-list { display: flex; flex-direction: column; gap: 9px; }
.search-row {
  display: flex; align-items: center; gap: 14px; padding: 13px 16px; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-ctl);
  box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s, border-color .12s;
}
.search-row:hover { transform: translateX(2px); box-shadow: var(--shadow-lg); border-color: #C7D5FF; }
.sr-ico { width: 32px; height: 32px; border-radius: var(--r-ctl); display: grid; place-items: center; background: var(--line-2); border: 1px solid var(--line); color: var(--muted); font-size: 16px; flex: none; transition: color .12s, background .12s; }
.search-row:hover .sr-ico { color: var(--brand); background: var(--brand-bg); }
.sr-body { flex: 1; min-width: 0; }
.sr-title { font-weight: 700; font-size: 13.5px; }
.sr-blurb { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-cap { font-size: 11.5px; color: var(--ink-2); background: var(--bg); border: 1px solid var(--line); padding: 4px 10px; border-radius: var(--r-pill); white-space: nowrap; flex: none; }
.sr-open { font-size: 12px; font-weight: 700; color: var(--brand); flex: none; }
mark { background: #fde68a; color: inherit; border-radius: var(--r-micro); padding: 0 2px; }
@media (max-width: 800px) { .sr-cap, .sr-blurb { display: none; } }

/* ---- filter bar ---------------------------------------------------------- */
.filter-bar {
  margin-bottom: 18px; background: var(--card); position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r-ctl); box-shadow: var(--shadow);
  transition: border-color .18s;
}
/* an accent edge so an active filter is obvious from across the room */
.filter-bar::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--brand); opacity: 0; transition: opacity .18s;
}
.filter-bar.on { border-color: #C7D5FF; }
.filter-bar.on::before { opacity: 1; }

.fb-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; padding: 12px 16px; }
.fb-label {
  font-size: 12px; font-weight: 700; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 7px; padding-bottom: 8px; white-space: nowrap;
}
.fb-label .ic { color: var(--muted); }
.fb-badge {
  background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 700;
  padding: 1px 7px; border-radius: var(--r-pill); font-variant-numeric: tabular-nums;
}
.fb-field {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700;
}
.fb-field.on { color: var(--brand); }
.fb-field select {
  font: inherit; font-size: 12.5px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--ink);
  padding: 8px 30px 8px 11px; border: 1px solid var(--line); border-radius: var(--r-ctl); min-width: 158px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background: var(--bg) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%236b7d95' stroke-width='1.6'/></svg>") no-repeat right 9px center;
  background-size: 11px; transition: border-color .15s, background-color .15s;
}
.fb-field select:hover { border-color: #B9C7E6; }
/* a set filter reads as set, without having to open it */
.fb-field.on select { border-color: var(--brand); background-color: #F2F6FF; color: var(--brand); font-weight: 700; }
.fb-field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,48,219,.15); background-color: #fff; }

.fb-reset {
  font: inherit; font-size: 12px; font-weight: 700; color: var(--brand); background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 9px 15px; cursor: pointer;
  margin-left: auto; white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
}
.fb-reset:hover:not(:disabled) { background: #F2F6FF; border-color: var(--brand); }
.fb-reset:disabled { color: var(--muted); opacity: .45; cursor: default; }
.fb-reset:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* applied-filter chips — each removable on its own */
.fb-active {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 10px 16px; border-top: 1px dashed var(--line); background: #FAFBFF;
}
.fb-active-l {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); font-weight: 700; margin-right: 2px;
}
.fb-chip {
  font: inherit; display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 9px 5px 11px; border-radius: var(--r-pill); cursor: pointer;
  border: 1px solid #C7D5FF; background: #EEF3FF; color: var(--brand);
  transition: background .15s, border-color .15s;
}
.fb-chip:hover { background: #E2EBFF; border-color: var(--brand); }
.fb-chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.fb-chip .fc-k { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; opacity: .7; }
.fb-chip .fc-v { font-size: 12.5px; font-weight: 700; }
.fb-chip .fc-x { font-size: 15px; line-height: 1; opacity: .55; margin-left: 1px; }
.fb-chip:hover .fc-x { opacity: 1; }

@media (max-width: 620px) {
  .fb-row { gap: 10px; }
  .fb-field, .fb-field select { width: 100%; min-width: 0; }
  .fb-reset { margin-left: 0; width: 100%; }
}

/* ---- sortable / searchable tables --------------------------------------- */
.tbl-wrap { width: 100%; }
.tbl-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.tbl-toolbar .tbl-ico { color: var(--muted); font-size: 14px; }
.tbl-search {
  font: inherit; font-size: 12px; color: var(--ink); padding: 6px 11px; border: 1px solid var(--line);
  border-radius: var(--r-ctl); background: var(--bg); outline: none; min-width: 220px; max-width: 320px;
}
.tbl-search:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(0,48,219,.12); }
.tbl-count { font-size: 11px; color: var(--muted); font-weight: 600; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--ink); }
.sort-caret {
  display: inline-block; width: 0; height: 0; margin-left: 5px; vertical-align: middle; opacity: .3;
  border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor;
}
.tbl th.asc .sort-caret { opacity: .95; border-top: none; border-bottom: 5px solid var(--brand); }
.tbl th.desc .sort-caret { opacity: .95; border-top-color: var(--brand); }

/* ---- empty states -------------------------------------------------------- */
.empty-note { padding: 26px; text-align: center; color: var(--muted); font-size: 13px; border: 1px dashed var(--line); border-radius: var(--r-ctl); background: var(--bg); }
.chart-empty { padding: 34px 24px; text-align: center; color: var(--muted); font-size: 12.5px; border: 1px dashed var(--line); border-radius: var(--r-ctl); background: var(--bg); }

/* deep-link target */
.report-card { scroll-margin-top: 88px; }
.report-card.flash { animation: flashring 1.8s ease; }
@keyframes flashring {
  0% { box-shadow: 0 0 0 3px rgba(0,48,219,.55); border-color: var(--brand); }
  60% { box-shadow: 0 0 0 3px rgba(0,48,219,.25); }
  100% { box-shadow: var(--shadow); }
}
