/* DBHG compliance dashboard — internal tool styling.
   System font stack, information-dense, fast to scan. No external assets.
   Palette: The District Behavioral Health Group brand — ocean blue wordmark,
   sunrise orange/yellow. Status colors (open/resolved/missed) are deliberately
   left semantic (amber/green/red) so at-a-glance meaning is never lost. */
:root {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --ink: #1c2530;
  --muted: #5b6775;
  --line: #e4e7e3;
  /* Brand ocean blue (wordmark + waves). Replaces the old cooler accent. */
  --accent: #2b5c92;
  --accent-dark: #1f4e79;
  /* Brand sunrise accents (used on the landing page + subtle chrome touches). */
  --sun-orange: #ef944b;
  --sun-yellow: #f4c95d;
  --amber-bg: #fff4d6; --amber-ink: #8a5a00;
  --green-bg: #def2e0; --green-ink: #1f6b35;
  --grey-bg: #e7eaee;  --grey-ink: #586572;
  --red-bg: #fce0e0;   --red-ink: #9a2230;
  /* "On time / compliant" green for the scorecard donut + legend — distinct
     from the darker resolved green so the two arcs read apart. */
  --ok: #3aa564;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 10px 20px;
  background: var(--panel);
  border-bottom: 2px solid var(--accent);
}
.topbar .brand { font-weight: 700; letter-spacing: .2px; color: var(--accent); }
.topbar .brand-logo {
  height: 26px; width: 26px; vertical-align: middle; margin-right: 8px;
}
.topbar nav { display: flex; gap: 14px; }
.topbar nav a.active { font-weight: 600; color: var(--accent); }
.topbar .section-crumb {
  color: var(--muted); font-weight: 600; font-size: 13px;
  padding: 0 14px 0 2px; border-right: 1px solid var(--line);
  margin-right: 14px; white-space: nowrap;
}
/* Cross-link to the other dashboard surface (Compliance <-> Group Notes). */
.topbar nav a.crosslink { margin-left: 10px; padding-left: 12px;
  border-left: 1px solid var(--border, #d0d5dd); opacity: .85; }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: 13px; }
.topbar form { margin: 0; }
.topbar button {
  font: inherit; cursor: pointer; border: 1px solid var(--line);
  background: #fff; border-radius: 5px; padding: 4px 10px;
}

/* P2 (2026-08-03 UX batch): the DATA container's cap — tables, grids, and
   charts get more of a wide viewport. Prose keeps its own reading measure
   (.note 720px, .action-block .muted 680px); do not widen those here. */
.wrap { max-width: 1360px; margin: 0 auto; padding: 20px; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 10px; text-transform: uppercase;
     letter-spacing: .4px; color: var(--muted); }
.sub { color: var(--muted); margin: 0 0 18px; }

/* ---- panels / grid ---- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 16px; margin-bottom: 16px;
}
.panel.span { grid-column: 1 / -1; }

/* ---- flip impact centerpiece ---- */
.flip-headline { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.flip-number { font-size: 40px; font-weight: 700; line-height: 1; }
.flip-caption { color: var(--muted); }
.recipient-list { list-style: none; margin: 0; padding: 0; }
.recipient-list li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 6px 0; border-bottom: 1px solid var(--line);
}
.recipient-list li:last-child { border-bottom: 0; }
.recipient-list .count { font-variant-numeric: tabular-nums; font-weight: 600; }
.count-pill {
  display: inline-block; min-width: 26px; text-align: center;
  background: var(--grey-bg); color: var(--grey-ink);
  border-radius: 10px; padding: 1px 8px; font-weight: 600;
}

/* ---- badges ---- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-open { background: var(--amber-bg); color: var(--amber-ink); }
.badge-resolved { background: var(--green-bg); color: var(--green-ink); }
.badge-dismissed { background: var(--grey-bg); color: var(--grey-ink); }
.badge-excluded { background: var(--grey-bg); color: var(--grey-ink); }
.badge-on_time { background: var(--green-bg); color: var(--green-ink); }
.badge-missed { background: var(--red-bg); color: var(--red-ink); }
.badge-fallback { background: var(--red-bg); color: var(--red-ink); }
/* "Completed prior to admission" audit tag (2026-07-20): informational, not a
   status — brand-blue so it reads apart from the open/resolved/missed hues. */
.badge-prior-admission { background: #dde9f5; color: var(--accent-dark); }
/* W4: a client with live obligations and no CM — warning family. */
.badge-unassigned { background: var(--amber-bg); color: var(--amber-ink); }
.badge-flat { background: var(--grey-bg); color: var(--grey-ink); }
.badge-weekend { background: var(--amber-bg); color: var(--amber-ink); }

/* ---- note QA: status chips (buttons) + date filter bar ---- */
.chips { display: flex; gap: 8px; margin: 0 0 14px; flex-wrap: wrap; }
.chip {
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel);
  border-radius: 6px; padding: 5px 12px; color: var(--ink);
}
.chip:hover { border-color: var(--accent); text-decoration: none; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
/* W10: thin vertical rule between the outpatient and inpatient chip blocks
   (rendered only when both groups are present on the row). Even spacing:
   the row's flex gap applies on both sides of the rule. */
.facility-chip-sep {
  align-self: stretch; width: 1px; background: var(--line);
  margin: 2px 2px;
}
.filters button {
  font: inherit; cursor: pointer; border: 1px solid var(--line);
  background: #fff; border-radius: 6px; padding: 5px 12px; font-weight: 600;
}
.filters input[type="date"] {
  font: inherit; border: 1px solid var(--line); border-radius: 6px;
  padding: 4px 8px; background: #fff; color: var(--ink);
}
.badge-eod { background: var(--grey-bg); color: var(--grey-ink); }
.alerts-off { background: var(--grey-bg); color: var(--grey-ink); }
.alerts-on { background: var(--green-bg); color: var(--green-ink); }
.stale { background: var(--red-bg); color: var(--red-ink); }

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line);
         vertical-align: top; }
th { color: var(--muted); font-weight: 600; text-transform: uppercase;
     font-size: 11px; letter-spacing: .4px; }
tbody tr:hover { background: #fafbfc; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.dup-note { color: var(--muted); font-size: 11px; display: block; }
.muted { color: var(--muted); }
.notes { color: var(--ink); font-size: 12.5px; }

/* Humanized resolution notes: the friendly sentence is the primary text; the
   raw engine note stays reachable (tooltip in tables, a small line in detail). */
td.why { line-height: 1.5; max-width: 420px; }
.human { color: var(--ink); }
tr.ledger-row td { padding-top: 10px; padding-bottom: 10px; }
.raw-note { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }

/* ---- filters ---- */
.filters { display: flex; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.filters .group { display: flex; gap: 6px; align-items: center; }
.filters a {
  padding: 3px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--ink);
}
.filters a.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.filters a:hover { text-decoration: none; }
.filters .label { color: var(--muted); font-size: 12px; text-transform: uppercase;
                  letter-spacing: .3px; }

/* ---- detail ---- */
dl.kv { display: grid; grid-template-columns: 200px 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.mrn { font-weight: 600; }
.kipu-link {
  display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 600;
  color: var(--accent); white-space: nowrap;
}

/* MRN technical-id disclosure (native <details>, no JS) */
.id-reveal { display: inline-block; margin-left: 10px; }
.id-reveal > summary {
  display: inline; cursor: pointer; color: var(--accent);
  font-size: 12px; list-style: none;
}
.id-reveal > summary::-webkit-details-marker { display: none; }
.id-reveal > summary::before { content: "👁 "; }
.id-reveal[open] > summary::before { content: "× "; }
.id-block {
  margin-top: 6px; padding: 8px 10px; background: #fafbfc;
  border: 1px solid var(--line); border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; color: var(--muted);
}
.empty { color: var(--muted); padding: 14px 0; }
.backlink { display: inline-block; margin-bottom: 12px; }

/* ---- scope-changed notice (Wave 2, F12): the house muted voice ---- */
.scope-notice { color: var(--muted); font-size: 13px; margin: 6px 0 10px; }

/* ---- action banners ---- */
.banner { padding: 10px 14px; border-radius: 8px; margin: 14px 0; font-weight: 600; }
.banner.ok { background: var(--green-bg); color: var(--green-ink); }
.banner.err { background: var(--red-bg); color: var(--red-ink); }
/* A7: the non-error save notice (saved fine, but worth knowing). */
.banner.note { background: var(--amber-bg); color: var(--amber-ink); }

/* ---- write actions (dismiss / exclude) ---- */
.panel.actions h2 { margin-bottom: 14px; }
.action-block { padding: 14px 0; border-top: 1px solid var(--line); }
.action-block:first-of-type { border-top: 0; padding-top: 0; }
.action-block h3 { margin: 0 0 6px; font-size: 15px; }
.action-block.danger h3 { color: var(--red-ink); }
.action-block .muted { margin: 0 0 12px; max-width: 680px; }
.action-form { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.action-form label { display: flex; align-items: center; gap: 6px; }
.action-form input[type="text"] {
  font: inherit; padding: 6px 9px; border: 1px solid var(--line);
  border-radius: 6px; min-width: 320px;
}
.action-form label.ack { flex: 1 1 100%; gap: 8px; color: var(--muted); }
.action-form button {
  font: inherit; cursor: pointer; border: 1px solid var(--line);
  background: #fff; border-radius: 6px; padding: 7px 14px; font-weight: 600;
}
.action-form button.danger-btn { border-color: var(--red-ink); color: var(--red-ink); }
/* Clinical-staff click-to-reveal (A6): with JS, each row's ack checkbox and
   heavy submit hide behind one quiet link-style control; an armed row shows a
   named confirm instead. No-JS keeps the checkbox+button path unchanged. */
form.staff-action.js-reveal .ack,
form.staff-action.js-reveal button[type="submit"] { display: none; }
form.staff-action.armed .staff-reveal { display: none; }
.action-form button.staff-reveal {
  border: 0; background: none; padding: 0;
  color: var(--accent); cursor: pointer; font: inherit; font-weight: 600;
}
.action-form button.staff-reveal.danger { color: var(--red-ink); }
.staff-confirm { display: flex; align-items: center; gap: 10px; font-weight: 600; }
/* A7: facility picker grayed while the admin role is selected. */
.facility-pick.pick-disabled label { color: var(--muted); }
.facility-pick.pick-disabled { opacity: .65; }
.role-note.hidden { display: none; }
/* Per-send notification history list in the alert-routing row. */
.notify-history { list-style: none; margin: 0 0 6px; padding: 0; }
.notify-history li { margin: 0 0 3px; }
/* Inline "Notify case manager now" form in the alert-routing row. */
.inline-notify { display: inline; margin-left: 10px; }
.inline-notify button {
  font: inherit; cursor: pointer; border: 1px solid var(--line);
  background: #fff; border-radius: 6px; padding: 5px 12px; font-weight: 600;
}

/* ---- landing / signed-out page (the branded front door) ---- */
.landing {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 24px;
  background:
    radial-gradient(120% 80% at 50% 0%,
      rgba(244, 201, 93, 0.10) 0%,
      rgba(239, 148, 75, 0.06) 28%,
      rgba(43, 92, 146, 0.00) 60%),
    var(--bg);
}
.landing-logo { width: 96px; height: 96px; margin-bottom: 20px; }
.landing h1 {
  font-size: 30px; letter-spacing: 3px; color: var(--accent);
  margin: 0; text-transform: uppercase; font-weight: 700;
}
.landing .lede {
  color: var(--accent-dark); letter-spacing: 4px; text-transform: uppercase;
  font-size: 12px; margin: 6px 0 4px;
}
.landing .tagline { color: var(--muted); margin: 4px 0 28px; }
.landing .signed-out-note {
  color: var(--muted); margin: 0 0 18px; font-size: 14px;
}
/* Neutral sign-in button, District palette. One rule serves every provider
   (Google + each Microsoft tenant); the per-provider .btn-<name> hook in the
   template is optional styling room and not required to render. .btn-google is
   kept as an alias for any legacy reference. */
.btn-login, .btn-google {
  display: inline-block; font: inherit; font-weight: 600;
  background: var(--accent); color: #fff;
  border: 1px solid var(--accent-dark); border-radius: 8px;
  padding: 11px 22px; cursor: pointer; letter-spacing: .2px;
}
.btn-login:hover, .btn-google:hover { background: var(--accent-dark); text-decoration: none; }
.landing .footnote { color: var(--muted); font-size: 12px; margin-top: 26px; }

/* ---- header avatar menu + facility filter (native <details>, no JS) ---- */
.topbar details { position: relative; }
.topbar details > summary {
  cursor: pointer; list-style: none; user-select: none;
}
.topbar details > summary::-webkit-details-marker { display: none; }

/* Facility view filter */
.facility-filter > summary {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); background: #fff; border-radius: 6px;
  padding: 4px 10px; color: var(--ink); font-size: 13px;
}
.facility-filter > summary::after { content: "▾"; color: var(--muted); font-size: 11px; }
.facility-filter[open] > summary { border-color: var(--accent); }
.filter-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(28, 37, 48, 0.12);
  padding: 10px 12px; min-width: 180px; margin: 0;
}
.filter-list { list-style: none; margin: 0 0 8px; padding: 0; }
.filter-list li { padding: 3px 0; }
.filter-list .filter-all { border-bottom: 1px solid var(--line); margin-bottom: 4px;
  padding-bottom: 6px; font-weight: 600; }
.filter-list label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.filter-actions { display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--line); padding-top: 8px; }
.filter-actions button {
  font: inherit; cursor: pointer; border: 1px solid var(--line);
  background: #fff; border-radius: 6px; padding: 4px 12px; font-weight: 600;
}
.filter-actions .link-btn { border: 0; background: none; color: var(--accent);
  padding: 4px 2px; font-weight: 500; }

/* Avatar dropdown */
.avatar-menu .avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
  letter-spacing: .3px;
}
.avatar-menu[open] .avatar { box-shadow: 0 0 0 2px var(--sun-yellow); }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(28, 37, 48, 0.12);
  padding: 6px; min-width: 190px;
}
.menu-panel .menu-item {
  display: block; width: 100%; padding: 8px 12px; border-radius: 6px; color: var(--ink);
}
.menu-panel a.menu-item:hover { background: #f3f6fa; text-decoration: none; }
.menu-panel a.menu-item.active { color: var(--accent); font-weight: 600; }
.menu-panel .menu-item.disabled { color: var(--muted); cursor: default; }
.menu-panel form { margin: 4px 0 0; border-top: 1px solid var(--line); padding-top: 6px; }
.menu-panel form button { width: 100%; text-align: left; }
.menu-panel .menu-group {
  display: block; font-weight: 700; font-size: 12px; text-transform: uppercase;
  letter-spacing: .4px; color: var(--ink); padding: 8px 14px 4px;
}
.menu-panel .menu-group.active { color: var(--accent); }
.menu-panel .menu-item.sub { padding-left: 28px; font-weight: 500; }

/* Brand dropdown — the brand IS the dashboard switcher (Compliance <-> Group
   Notes). Mirrors .avatar-menu, but its panel opens left-aligned under the brand. */
.brand-menu > summary.brand { display: inline-flex; align-items: center; gap: 5px; }
.brand-menu > summary.brand::after { content: "▾"; color: var(--muted); font-size: 11px; }
.brand-menu .menu-panel { left: 0; right: auto; min-width: 170px; }

/* ---- admin: manage users edit form ---- */
.admin-form .panel h2 { margin-bottom: 8px; }
.admin-form .check-list { list-style: none; margin: 0; padding: 0; }
.admin-form .check-list li { padding: 4px 0; }
.admin-form .check-list label { display: flex; align-items: center; gap: 8px; }
.admin-form select {
  font: inherit; padding: 6px 9px; border: 1px solid var(--line);
  border-radius: 6px; background: #fff;
}
.admin-form .form-actions { margin: 4px 0 24px; }
.admin-form input[type="text"] {
  font: inherit; padding: 6px 9px; border: 1px solid var(--line);
  border-radius: 6px; min-width: 240px;
}
/* District-palette primary button, usable on both <button> and <a>. */
.primary-btn {
  display: inline-block; font: inherit; cursor: pointer; font-weight: 600;
  color: #fff; background: var(--accent); border: 1px solid var(--accent-dark);
  border-radius: 8px; padding: 9px 18px;
}
.primary-btn:hover { background: var(--accent-dark); text-decoration: none; }

/* ---- admin: invite page ---- */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.email-compose { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.email-compose .at { color: var(--muted); font-weight: 600; }

/* ---- admin: supervision two-column picker ---- */
.supervision-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.supervision-col h3 { margin: 0 0 8px; font-size: 14px; }
.supervision-filter {
  width: 100%; font: inherit; padding: 6px 9px; margin: 0 0 6px;
  border: 1px solid var(--line); border-radius: 6px;
}
.supervision-list {
  list-style: none; max-height: 300px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; margin: 0;
}
.supervision-list li.hidden { display: none; }
@media (max-width: 720px) { .supervision-cols { grid-template-columns: 1fr; } }

/* ---- muted helper note (clarifying subtitles, footnotes) ---- */
.note { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; max-width: 720px; }

/* ---- scorecards: list footnote / facility chip ---- */
.fac-tag {
  display: inline-block; vertical-align: middle; margin-left: 8px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--grey-bg); border-radius: 999px; padding: 2px 9px;
}

/* ---- scorecard detail: visual summary (donut + stats + legend) ---- */
.scorecard-visual {
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 18px 20px; margin: 4px 0 22px;
}
.donut-wrap { flex: 0 0 auto; text-align: center; }
.donut { width: 160px; height: 160px; transform: rotate(0deg); }
.donut-ring { stroke: var(--line); }
.donut-seg { stroke-linecap: butt; }
/* Segment + legend-dot hues match the status badges so the donut and the log
   legend agree (compliant uses the dedicated --ok green). */
.seg-compliant { stroke: var(--ok); }
.seg-resolved { stroke: var(--green-ink); }
.seg-open { stroke: var(--amber-ink); }
.seg-missed { stroke: var(--red-ink); }
.donut-center {
  fill: var(--ink); font-size: 7px; font-weight: 700; text-anchor: middle;
  font-variant-numeric: tabular-nums;
}
.donut-sub { fill: var(--muted); font-size: 2.6px; text-anchor: middle;
  text-transform: uppercase; letter-spacing: .3px; }

.stat-cards { display: flex; gap: 14px; flex-wrap: wrap; }
.stat-card {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 16px; min-width: 92px; text-align: center;
}
.stat-n { font-size: 24px; font-weight: 700; line-height: 1.1;
  font-variant-numeric: tabular-nums; }
.stat-l { color: var(--muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: .3px; margin-top: 2px; }

.legend { list-style: none; margin: 0; padding: 0; display: flex;
  flex-direction: column; gap: 5px; font-size: 13px; color: var(--ink); }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend .dot { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }
/* Reuse the seg- stroke colors as legend swatch fills. */
.dot.seg-compliant { background: var(--ok); }
.dot.seg-resolved { background: var(--green-ink); }
.dot.seg-open { background: var(--amber-ink); }
.dot.seg-missed { background: var(--red-ink); }

/* "Email this scorecard" button — right-aligned in the visual summary row, so it
   fills the open space to the right of the legend; vertically centered by the
   row's align-items:center. */
.scorecard-email-action { margin-left: auto; }

/* ---- scorecard detail: compact attributed-misses log ---- */
.log-head { font-size: 13px; margin-bottom: 8px; }
.log-compact table { font-size: 12px; }
.log-compact th, .log-compact td { padding: 5px 8px; }
/* W9: scoped scroll modifier — the ws-grid-wrap convention (70vh cap,
   sticky solid header). NEVER on bare .log-compact: the gn scorecard logs
   share that class and must not be clipped. */
.log-compact--scroll {
  overflow-y: auto; max-height: 70vh;
  border: 1px solid var(--line); border-radius: 8px;
}
.log-compact--scroll thead th {
  position: sticky; top: 0; z-index: 3; background: var(--panel);
  box-shadow: inset 0 -1px 0 var(--line);
}
@media (max-width: 720px) { .scorecard-visual { gap: 18px; } }

/* ---- admin facility-access picker: select-all control ---- */
.facility-pick .select-all { display: block; margin-bottom: 0.4rem; font-weight: 600; }

/* ---- bulk-notify action bar: pinned above the violations table ---- */
.bulk-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--bg); border-bottom: 1px solid var(--line);
  padding: 10px 0; margin-bottom: 10px;
}

/* ---- group-note on-time weekly trend (server-rendered SVG, CSP-safe) ---- */
/* W7 part A5: let the detail Trend chart breathe — it was ~55% of its
   full-width panel with a void right half. */
.trend-chart { width: 100%; max-width: 760px; height: auto; }
.trend-grid { stroke: var(--line); stroke-width: 0.5; }
.trend-bar { fill: var(--ok); }
.trend-empty { fill: var(--line); }
.trend-axis-label { fill: var(--muted); font-size: 5px; }
.trend-week-label { fill: var(--muted); font-size: 5px; }
.trend-rate-label { fill: var(--ink); font-size: 5px; font-variant-numeric: tabular-nums; }

/* ---- CM Workstream client grid (Phase 3, 2026-07-08) ----
   Rows = clients, columns = workstream items in journey order. Sticky header
   row + sticky first column so 80 rows x 9 items stays scannable at laptop
   widths. Cell states are glyph + color (never color alone). */
.ws-head { display: flex; align-items: center; justify-content: space-between;
           gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ws-head h2 { margin: 0; }
.ws-chips { margin: 0; }
.chip.disabled {
  color: var(--muted); background: var(--bg); cursor: default;
  border-style: dashed; opacity: .45;
}
.chip.disabled:hover { border-color: var(--line); }

/* Grid staleness indicator (2026-07-27): one muted line, reveal inline. */
.ws-stale-note { margin: 0 0 10px; font-size: 13px; }
.ws-stale-note .sub { display: inline; margin: 0; }

.ws-filter-row { display: flex; align-items: center; justify-content: space-between;
                 gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ws-grid-filter {
  font: inherit; font-size: 13px; border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 10px; background: #fff; color: var(--ink);
  width: 260px; max-width: 100%;
}
.ws-grid-filter:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.ws-legend { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted);
             font-size: 11.5px; }
.ws-key { white-space: nowrap; }

.ws-grid-wrap {
  overflow: auto; max-height: 70vh;
  border: 1px solid var(--line); border-radius: 8px;
}
.ws-grid { border-collapse: separate; border-spacing: 0; width: 100%; }
.ws-grid th, .ws-grid td { border-bottom: 1px solid var(--line); }
.ws-grid thead th {
  position: sticky; top: 0; z-index: 3; background: var(--panel);
  box-shadow: inset 0 -1px 0 var(--line);
}
.ws-grid th.ws-name-col, .ws-grid td.ws-name-col {
  position: sticky; left: 0; z-index: 2; background: var(--panel);
  min-width: 170px; max-width: 240px;
  box-shadow: inset -1px 0 0 var(--line);
}
.ws-grid thead th.ws-name-col { z-index: 4; }
.ws-grid tbody tr:hover td { background: #fafbfc; }
.ws-item-col { text-align: center; }
.ws-grid td.ws-cell { text-align: center; min-width: 64px; padding: 6px 8px; }
.ws-mrn { display: block; color: var(--muted); font-size: 11px; }
.ws-glyph { font-size: 16.5px; font-weight: 700; text-decoration: none; }
td.ws-green .ws-glyph, .ws-key.ws-green { color: var(--green-ink); }
td.ws-yellow .ws-glyph, .ws-key.ws-yellow { color: var(--amber-ink); }
/* Completed late (2026-07-14): a CHECK — it IS done — in the due-soon
   (amber) color family; the glyph shape, not color alone, distinguishes
   it from the ■ due-soon cell (accessibility stance). */
td.ws-late .ws-glyph, .ws-key.ws-late { color: var(--amber-ink); }
td.ws-red .ws-glyph, .ws-key.ws-red { color: var(--red-ink); }
td.ws-grey .ws-glyph, .ws-key.ws-grey { color: var(--grey-ink); }
td.ws-dash .ws-glyph, .ws-key.ws-dash { color: var(--muted); }
td.ws-yellow { background: var(--amber-bg); }
td.ws-red { background: var(--red-bg); }
td.ws-red .ws-glyph:hover { text-decoration: underline; }
.ws-grid tbody tr.hidden { display: none; }
/* Nav fix L-9: the hidden-cohort filter hint beside the name filter. */
.ws-filter-hint { font-size: 12.5px; }
.ws-filter-hint.hidden { display: none; }
/* Nav fix L-1 (batch 2): topbar client search + result cards. */
.topbar-search { position: relative; }
.topbar-search input {
  font-size: 12.5px; padding: 4px 8px; border: 1px solid #d0d5db;
  border-radius: 6px; min-width: 170px;
}
/* Issue 3: the typeahead dropdown (built by dashboard.js; hidden = closed).
   Anchored under the search box; rows are anchors so hover/keyboard share
   the .sel highlight. <mark> emphasizes the server-reported match span. */
.suggest-box {
  position: absolute; top: calc(100% + 4px); right: 0; width: 320px;
  max-height: 60vh; overflow-y: auto; background: var(--panel, #fff);
  border: 1px solid #d0d5db; border-radius: 8px;
  box-shadow: 0 6px 18px rgba(20, 28, 40, .14); z-index: 60;
}
.suggest-box.hidden { display: none; }
.suggest-group {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 8px 10px 3px;
  border-top: 1px solid var(--line);
}
.suggest-group:first-child { border-top: 0; }
.suggest-row {
  display: block; padding: 6px 10px; text-decoration: none;
  color: inherit; font-size: 13px;
}
.suggest-row.sel { background: #eef2f7; }
.suggest-row .suggest-label { display: block; }
.suggest-row .suggest-label mark {
  background: none; color: inherit; font-weight: 650;
}
.suggest-row .suggest-sub { display: block; color: var(--muted); font-size: 12px; }
.suggest-row .suggest-sub mark {
  background: none; color: inherit; font-weight: 650;
}
.suggest-row.suggest-more {
  border-top: 1px solid var(--line); font-size: 12.5px; padding: 8px 10px;
}
.client-card .ws-mrn { display: inline; margin-left: 8px; }
.client-strip { display: flex; gap: 10px; align-items: center; }
.client-strip .ws-cell { padding: 0 2px; }
.client-grid-link { margin-left: 10px; font-size: 12.5px; }

.ws-roster { list-style: none; margin: 0; padding: 0; }
.ws-roster li {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line);
}
.ws-roster li:last-child { border-bottom: 0; }
.ws-empty { color: var(--muted); font-size: 13px; padding: 14px 4px; }

/* ---- demo-polish pass (2026-07-08): alignment + overflow fixes ---- */
/* Numerics (counts, durations, timestamps) right-align under their headers. */
td.num, th.num { text-align: right; }
th.num { white-space: nowrap; }
td.nowrap { white-space: nowrap; }
/* Wide tables scroll inside their card instead of clipping at 1280px. */
.table-scroll { overflow-x: auto; }
/* Scorecards unattributed footnote: breathing room below the table. */
p.footnote { margin-top: 12px; }

/* ---- All-tab visual rollup (pass 3, 2026-07-09) ----
   Big-number stat row + obligation-state snapshot + per-item health bars.
   Chart marks reuse the grid's semantic state colors (untouchable). */
.stat-row { grid-column: 1 / -1; display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-row .stat-card { background: var(--panel); text-align: left;
  padding: 14px 18px; }
.stat-row .stat-n { font-size: 30px; }
.stat-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }

.snap-wrap { border-radius: 6px; overflow: hidden; line-height: 0; }
.snap-chart { width: 100%; height: 26px; }
.seg-ws-green { fill: var(--green-ink); }
.seg-ws-yellow { fill: var(--amber-ink); }
.seg-ws-red { fill: var(--red-ink); }
.seg-ws-grey { fill: var(--grey-ink); }
.snap-legend { margin-top: 10px; }

.hbar-chart { width: 100%; max-width: 760px; height: auto; display: block; }
.hbar-label { fill: var(--ink); }
.hbar-value { fill: var(--muted); font-variant-numeric: tabular-nums; }
.hbar-track { fill: var(--bg); stroke: var(--line); stroke-width: 0.5; }
.hbar-bar { fill: var(--accent); }
/* Open-violations bars carry the open-status amber, matching the badges. */
.fac-chart .hbar-bar { fill: var(--amber-ink); }
.fac-chart { max-width: 420px; }

/* Screen-reader-only: keeps chart-replaced tables (and their drill-through
   links) in the accessibility tree. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- W3: client page + Today attention view + drillable trend bars ---- */
/* Every grid cell is a drill now (IA-1): keep the glyph colors, add the
   affordance on hover/focus for all states, not just red. */
.ws-grid a.ws-glyph:hover, .client-strip a.ws-glyph:hover { text-decoration: underline; }
/* SVG anchor focus states (ruling B: drillable weekly bars). */
.trend-chart a:hover .trend-bar, .sparkline a:hover .spark-bar { opacity: 0.75; }
.trend-chart a:focus-visible .trend-bar, .hbar-chart a:focus-visible rect,
.sparkline a:focus-visible .spark-bar {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.client-obligations td.ws-cell { min-width: 36px; }
.ob-sentence { max-width: 420px; }
.chip-mini {
  display: inline-block; font-size: 11.5px; padding: 1px 7px; margin: 1px 3px 1px 0;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
a.chip-mini:hover { border-color: var(--accent); text-decoration: none; }
.attn-drivers { max-width: 460px; }
.attn-arrow { font-size: 14px; }
.attn-list { list-style: none; margin: 0; padding: 0; }
.attn-list li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.attn-list li:last-child { border-bottom: none; }
.attn-clear {
  display: flex; align-items: center; gap: 12px; padding: 18px 6px;
  color: var(--muted);
}
.attn-clear-mark {
  font-size: 26px; font-weight: 700; color: var(--green-ink);
  border: 2px solid var(--green-ink); border-radius: 50%;
  width: 40px; height: 40px; display: inline-flex;
  align-items: center; justify-content: center; flex: none;
}
.sparkline { width: 120px; height: 26px; display: block; }
/* W7 item 14: ONE hue for every weekly on-time visual (the trend chart's
   green) — the sparkline is the same measure at small size. */
.spark-bar { fill: var(--ok); }
a.spark-link { display: inline-block; text-decoration: none; }

/* W7 item 13: semantic trend-arrow color by direction of goodness —
   ▲ = late-rate rising (warning), ▼ = improving, — = flat/no data. */
.arrow-worse { color: var(--amber-ink); }
.arrow-better { color: var(--ok); }
.arrow-flat { color: var(--muted); }

/* W7 item 2/15: a stat card that IS a link keeps the card's own look. */
a.stat-card-link { text-decoration: none; color: inherit; display: block; }
a.stat-card-link:hover { border-color: var(--accent); text-decoration: none; }

/* W7 item 14: pipeline step tables align across stacked cycle panels. */
.pipeline-steps { table-layout: fixed; width: 100%; }
/* Cycle-end sentinel row (2026-07-27): bookkeeping, kept visually quiet. */
.pipeline-steps tr.cycle-sentinel td { border-top: 1px dashed var(--line); }
.cycle-incomplete { margin: 8px 0 0; font-size: 13px; }
.pipeline-steps th:nth-child(1) { width: 22%; }
.pipeline-steps th:nth-child(2) { width: 16%; }
.pipeline-steps th:nth-child(3) { width: 12%; }
.badge-skipped { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }

/* ---- W4: scorecard trend stat row + facility comparison ---- */
.trend-stat-row { margin: 4px 0 16px; }
.fac-cmp { margin: 4px 0 18px; }
.fac-cmp-chart { max-width: 460px; }

/* ---- Home redesign v1 (issue 5, 2026-07-21) ----
   Recomposition of the existing vocabulary only: chip-mini severity tints
   reuse the semantic state families (red = overdue/open, amber = due-soon),
   strip cells are stat-cards, and every chart reuses the shared classes. */
.attn-hero .attn-list li {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  padding: 7px 0;
}
.chip-mini.chip-red { background: var(--red-bg); color: var(--red-ink); }
.chip-mini.chip-amber { background: var(--amber-bg); color: var(--amber-ink); }
a.chip-mini.chip-red:hover { border-color: var(--red-ink); }
a.chip-mini.chip-amber:hover { border-color: var(--amber-ink); }

.snapshot-strip { grid-column: 1 / -1; display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.snapshot-strip .stat-card { background: var(--panel); text-align: left;
  padding: 14px 18px; }
/* Warning tint (amber = the warning family, per badge-unassigned) while the
   audit metric holds open cases; neutral at zero. */
.snapshot-strip .stat-card.warn { background: var(--amber-bg);
  border-color: var(--amber-ink); }
.snapshot-strip .stat-card.warn .stat-l,
.snapshot-strip .stat-card.warn .stat-sub { color: var(--amber-ink); }
.snap-stat { display: flex; align-items: center; gap: 14px; }
.snap-stat .donut { width: 104px; height: 104px; }
.snap-states .stat-l { margin-bottom: 8px; }
a.snap-strip-link { display: block; }
a.snap-strip-link:hover .snap-chart { opacity: 0.85; }
.snap-sync { grid-column: 1 / -1; margin: -6px 0 0; }

/* Per-row open-count magnitude bar in the Clinical Standards table — the
   hbar track+bar pattern inline; open counts wear the open-status amber
   (the fac-chart convention). */
.rule-bar-cell { width: 130px; }
.rule-bar { width: 120px; height: 12px; display: block; }
.rule-bar .hbar-bar { fill: var(--amber-ink); }

/* Group-notes panels: count chips + the mini dupe ratio bar. */
.gn-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.gn-chips .chip-mini { font-size: 12.5px; padding: 3px 10px; }
.gn-dupe { margin: 4px 0 12px; }
.gn-dupe .snap-wrap { max-width: 320px; margin: 6px 0 4px; }
.snap-chart.dupe-chart { height: 14px; }
.seg-dupe { fill: var(--amber-ink); }
.seg-rest { fill: var(--grey-bg); }

/* Narrow widths: the strip and the panel grid stack (nothing overflows). */
@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  .snapshot-strip { grid-template-columns: 1fr; }
}

/* ---- W10: outpatient/inpatient group rule inside the facility menus
   (header facility filter + admin access pickers). Rendered only when both
   groups are present in the list. ---- */
.filter-list li.filter-group-sep,
.check-list li.filter-group-sep { padding: 0; }
.filter-group-sep hr {
  border: 0; border-top: 1px solid var(--line); margin: 4px 0;
}
