/* EPG Platform — shared styles.

   ===========================================================================
   APPROVED FINAL DESIGN DIRECTION (client sign-off, Sept 2026) — do not
   redesign or reskin without an explicit new client request. This is the
   single source of truth for visual styling across BOTH the internal EPG
   platform and the Practice Portal: black/near-black sidebar & top-nav
   accents, warm cream/off-white page background, white cards, bright
   soft pink-to-lilac (--accent / --accent-ink / --accent-gradient) as the
   brand accent, and pale pink/lilac borders. All of it lives in this one
   file's :root tokens — every screen in the app reads from these same
   tokens, so a future palette tweak (if ever requested) should be made
   HERE, never by hardcoding a color in an individual view/template file.
   Protected functional status colors (--good/--warning/--critical/--react)
   are NOT part of the brand palette and must never be recolored to match
   it: green = success, amber = warning/SLA-at-risk, red = breach/error/
   destructive, purple (--react) = reactivation. These are semantic, not
   decorative, and are deliberately a different hue family from the brand
   accent so the two are never visually confused.
   ===========================================================================

   Manrope isn't reachable from this sandbox (no font CDN access), so we
   fall back to the system font stack — swap in Manrope via @font-face once
   this runs somewhere with internet access. */

:root {
  --ink: #221f1e;
  --ink-secondary: #6b5d5f;
  --muted: #9c8d90;
  --paper: #f5f3ec;
  --surface: #ffffff;
  --border: #ead9f5;
  --sidebar-bg: #0d0b0e;
  --accent: #d37bf6;
  --accent-ink: #8617c2;
  --accent-soft: #f7e3fe;
  --accent-grad-start: #f5cdfb;
  --accent-grad-end: #dda1fc;
  --accent-gradient: linear-gradient(135deg, var(--accent-grad-start), var(--accent-grad-end));
  --good: #0ca30c;
  --good-soft: #e2f3e2;
  --warning: #d98c00;
  --warning-soft: #fdf1d9;
  --critical: #c1401f;
  --critical-soft: #fbe4da;
  --blue: #2a78d6;
  --blue-soft: #e6eefb;
  --neutral-soft: #ece9df;
  --react: #6a4fb0;
  --react-soft: #ece7f8;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: #f3eeef;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar .brand {
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  padding: 0 10px 18px;
  letter-spacing: 0.2px;
}
.sidebar .brand small { display: block; font-weight: 500; font-size: 11px; color: #b7a6aa; margin-top: 2px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar a.nav-item, .sidebar span.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border-radius: 8px;
  color: #d9d0d2;
  font-weight: 600;
  font-size: 13.5px;
}
.sidebar a.nav-item:hover { background: rgba(255,255,255,0.07); text-decoration: none; }
.sidebar a.nav-item.active { background: var(--accent-gradient); color: var(--ink); }
.sidebar span.nav-item.disabled { color: #665c5e; cursor: default; }
.sidebar .phase-tag {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(255,255,255,0.08);
  padding: 2px 6px;
  border-radius: 999px;
  letter-spacing: 0.4px;
}
.nav-badge {
  font-size: 10.5px;
  font-weight: 800;
  background: var(--critical);
  color: #fff;
  padding: 1px 6px;
  border-radius: 999px;
  line-height: 1.5;
}
.sidebar .user-box {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 12.5px;
  color: #d9d0d2;
}
.sidebar .user-box form { margin-top: 6px; }
.sidebar .user-box button {
  background: none; border: 1px solid rgba(255,255,255,0.25); color: #f3eeef;
  padding: 5px 10px; border-radius: 6px; font-size: 12px; cursor: pointer; font-weight: 600;
}

.main { flex: 1; padding: 28px 36px; max-width: 1280px; }
.page-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-header h1 { font-size: 21px; margin: 0; font-weight: 800; }
.page-header p.sub { margin: 4px 0 0; color: var(--ink-secondary); font-size: 13px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 18px; }
.card h2 { font-size: 15px; margin: 0 0 14px; font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-ink); color: #fff; border: none; border-radius: 8px;
  padding: 8px 14px; font-weight: 700; font-size: 13px; cursor: pointer;
}
.btn:hover { background: #6b129b; text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--border); }
.btn.secondary:hover { background: var(--neutral-soft); }
.btn.danger { background: var(--critical); }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 6px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--paper); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.critical { background: var(--critical-soft); color: var(--critical); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.neutral { background: var(--neutral-soft); color: var(--ink-secondary); }
.badge.react { background: var(--react-soft); color: var(--react); }

/* Clickable status badges on the Enquiries table (see enquiryListBody() in
   src/views/enquiries.ts) — a real <a>, so it stays keyboard-reachable and
   works without JS. Resets the global `a` color/underline so it keeps
   looking exactly like the existing (non-clickable) badge everywhere else
   in the app, just with a pointer cursor and a subtle hover/focus cue. */
.badge-link { cursor: pointer; text-decoration: none; color: inherit; transition: filter 0.12s ease, box-shadow 0.12s ease; }
.badge-link:hover { filter: brightness(0.94); text-decoration: none; }
.badge-link:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

/* Sortable table column headers — a real <a> wrapping the header text (see
   sortableHeader() in src/views/enquiries.ts). Inherits the muted uppercase
   `th` styling by default; the active column is picked out in the accent
   ink so it's obvious at a glance which column — and which direction — the
   list is currently sorted by. */
.sortable-th { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 2px; cursor: pointer; }
.sortable-th:hover { color: var(--accent-ink); text-decoration: none; }
.sortable-th:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.sortable-th.active { color: var(--accent-ink); font-weight: 800; }

/* Enquiries quick-filter chip row (item 2) — a small segmented-control-style
   row above the filter panel. Reuses the brand accent for the active state,
   exactly like every other "currently selected" affordance in the app
   (.sidebar a.nav-item.active). */
.quick-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.qf-chip {
  display: inline-flex; align-items: center;
  background: var(--surface); color: var(--ink-secondary); border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  text-decoration: none; cursor: pointer; transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.qf-chip:hover { background: var(--neutral-soft); text-decoration: none; }
.qf-chip:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.qf-chip.active { background: var(--accent-gradient); color: var(--ink); border-color: transparent; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
select, input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=datetime-local], input[type=password], textarea {
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 13px; font-family: var(--font); background: #fff; color: var(--ink);
}
textarea { width: 100%; resize: vertical; }
label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-secondary); margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field-row > .field { flex: 1; min-width: 180px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.stat { font-size: 26px; font-weight: 800; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.stat-card .label { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; font-weight: 600; }
.flash.error { background: var(--critical-soft); color: var(--critical); }
.flash.success { background: var(--good-soft); color: var(--good); }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--paper); }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 34px; width: 360px; }
.login-card h1 { font-size: 18px; margin: 0 0 4px; }
.login-card p { color: var(--ink-secondary); font-size: 13px; margin: 0 0 20px; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; }
.demo-users { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted); }
.demo-users code { background: var(--neutral-soft); padding: 1px 5px; border-radius: 4px; }

.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: none; }
.timeline .meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.two-col { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

.phase1b-note {
  background: var(--react-soft); color: var(--react); border-radius: 8px; padding: 10px 14px; font-size: 12.5px; font-weight: 600; margin-bottom: 18px;
}

/* ---- Phase 1B: Today / Follow-Up Centre, Reactivation, Scripts, Dashboard ---- */

.stat-chip-row { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.stat-chip { flex: 1; min-width: 130px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 11px 14px; display: flex; flex-direction: column; gap: 4px; }
.stat-chip .n { font-size: 18px; font-weight: 800; }
.stat-chip .l { font-size: 10.6px; font-weight: 700; color: var(--ink-secondary); text-transform: uppercase; letter-spacing: .03em; }
.stat-chip.prime { border-color: var(--accent); background: var(--accent-soft); }
.stat-chip.crit { border-color: #f0c7b6; background: var(--critical-soft); }
.stat-chip.warn { border-color: #f3ddac; background: var(--warning-soft); }

.section { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 4px 18px 8px; margin-bottom: 14px; }
.section.prime { border: 1.5px solid var(--accent); }
.section-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 4px 10px; flex-wrap: wrap; gap: 6px; }
.section-head-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.section-order { width: 20px; height: 20px; border-radius: 6px; background: var(--ink); color: #fff; font-size: 10.5px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.section-title { font-size: 13.5px; font-weight: 800; }
.section-desc { font-size: 11.3px; color: var(--ink-secondary); font-weight: 600; }
.count-pill { background: var(--paper); border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 800; color: var(--ink-secondary); }
.count-pill.crit { background: var(--critical-soft); color: #8f2c14; border-color: transparent; }
.count-pill.warn { background: var(--warning-soft); color: #8a5800; border-color: transparent; }
.link-more { font-size: 12px; font-weight: 700; color: var(--accent-ink); padding: 9px 4px; display: inline-block; }

.queue-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.queue-row:last-child { border-bottom: none; }

/* Notifications Action Centre (Phase 2) — a .queue-row with a priority chip
   + type badge on the left, inline resolve-actions on the right, and a
   quieter, lower-contrast treatment once read so the unread/actionable rows
   stay visually dominant (item 5/8: clearer hierarchy, stronger unread/read
   distinction, no heavy gradients or animations). */
.notif-row { transition: background 0.12s ease; }
.notif-row:hover { background: var(--paper); border-radius: 8px; }
.notif-chips { display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
.notif-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-left: auto; }
.notif-row-read { opacity: 0.58; }
.notif-row-read:hover { opacity: 0.85; }
.notif-row-read .qname { font-weight: 600; }
.avatar-lg { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-weight: 800; font-size: 12.5px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.avatar-lg.react { background: var(--react-soft); color: #4a3785; }
.qname { font-size: 13px; font-weight: 700; }
.qmeta { font-size: 11.2px; color: var(--ink-secondary); font-weight: 600; }
.qtime { font-size: 11px; color: var(--muted); font-weight: 700; flex-shrink: 0; }
.qval { font-size: 11.8px; font-weight: 800; color: var(--ink-secondary); flex-shrink: 0; }

.summary-link { display: flex; align-items: center; justify-content: space-between; background: var(--react-soft); border: 1px solid #d9cff0; border-radius: 12px; padding: 14px 18px; flex-wrap: wrap; gap: 10px; }
.btn.react { background: var(--react); color: #fff; }
.btn.react:hover { background: #59409a; }

.grid-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 4px; }
.grid-stats.five { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .grid-stats, .grid-stats.five { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 13px 15px; }
.stat.accent { background: var(--react-soft); border-color: #d9cff0; }
.stat-label { font-size: 10.3px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-secondary); margin-bottom: 7px; }
.stat-value { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.stat-value.critical { color: var(--critical); }
.stat-meta { margin-top: 7px; font-size: 11.3px; font-weight: 700; }
.stat-meta.up { color: #046b04; }
.stat-meta.flat { color: var(--muted); font-weight: 600; }
.stat-meta.down { color: var(--critical); }

.row-divider { display: flex; align-items: center; gap: 10px; margin: 20px 0 12px; }
.row-divider .line { flex: 1; height: 1px; background: var(--border); }
.row-divider .lbl { font-size: 10.6px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); white-space: nowrap; }

.value-strip { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .value-strip { grid-template-columns: 1fr; } }
.value-card { background: var(--accent-gradient); border-radius: 14px; padding: 18px 20px; color: var(--ink); }
.value-card.alt { background: var(--surface); border: 1px solid var(--border); color: var(--ink); }
.value-card.mid { background: var(--accent-gradient); }
.value-label { font-size: 10.8px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; opacity: .75; margin-bottom: 7px; }
.value-num { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.value-note { font-size: 11px; font-weight: 600; opacity: .7; margin-top: 6px; }

/* Clickable KPI cards (EPG Dashboard only — see buildDashboardLinks() and
   statLink() in src/views/dashboard.ts). Scoped to the .kpi-link modifier
   rather than to .stat/.value-card generally, since those two base classes
   are reused as plain, non-interactive divs all over the app (Intelligence,
   Reactivation, Team, Practice Reports, etc.) — this must not make any of
   those look clickable. */
a.stat.kpi-link, a.value-card.kpi-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
a.stat.kpi-link:hover, a.value-card.kpi-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(134, 23, 194, 0.14);
}
a.stat.kpi-link:hover { border-color: var(--accent); }
a.value-card.kpi-link.alt:hover { border-color: var(--accent); }
a.stat.kpi-link:focus-visible, a.value-card.kpi-link:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 2px;
}

/* Today / Follow-Up Centre's six summary cards, made clickable to jump to
   their matching section further down the same page (see chipLink() in
   src/views/today.ts). .stat-chip already sets display:flex/flex-direction
   via the base class, so this only needs to neutralise link defaults and
   add the same hover/lift + focus treatment as the Dashboard's kpi-link
   cards above, without touching the existing .prime/.crit/.warn colours. */
a.stat-chip.kpi-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
a.stat-chip.kpi-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(134, 23, 194, 0.14);
  border-color: var(--accent);
}
a.stat-chip.kpi-link:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 2px;
}

/* Trend-chart SVG marks (src/views/dashboard.ts's svgTrendChart()) — themed
   via these classes rather than hardcoded fill/stroke attributes so the
   chart follows the central palette like everything else. */
.trend-axis { stroke: var(--border); }
.trend-area { fill: var(--accent); }
.trend-line { stroke: var(--accent); }
.trend-dot { fill: var(--accent); }
.trend-dot-ring { stroke: var(--accent); }
.trend-label { fill: var(--accent-ink); }

.dash-row { display: flex; gap: 18px; margin-top: 18px; flex-wrap: wrap; }
.dash-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; flex: 1; min-width: 260px; }
.dash-card.wide { flex: 1.5; min-width: 340px; }
.card-title { font-size: 13.5px; font-weight: 800; margin: 0 0 2px; }
.card-sub { font-size: 11.3px; color: var(--ink-secondary); font-weight: 600; margin-bottom: 16px; }
.bar-row { display: flex; align-items: center; gap: 11px; margin-bottom: 13px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-label { width: 110px; flex-shrink: 0; font-size: 12px; font-weight: 700; color: var(--ink); }
.bar-track { flex: 1; height: 9px; background: var(--paper); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; }
.bar-value { width: 68px; flex-shrink: 0; text-align: right; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink-secondary); }
.wk-labels { display: flex; justify-content: space-between; margin-top: 6px; padding: 0 2px; }
.wk-labels span { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }

.cohort-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .cohort-grid { grid-template-columns: 1fr; } }
.cohort { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 4px 16px 8px; }
.cohort-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 2px 9px; }
.cohort-head-left { display: flex; align-items: center; gap: 9px; }
.cohort-title { font-size: 12.8px; font-weight: 800; }
.cohort-desc { font-size: 10.8px; color: var(--ink-secondary); font-weight: 600; padding: 0 2px 8px; }

/* Reactivation work queue (redesign) — quick actions, inline outcome/
   follow-up forms, and the bulk-selection bar. */
.lead-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex-shrink: 0; }
.lead-outcome-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 7px; }
.lead-outcome-form select, .lead-outcome-form input[type="text"] { font-size: 12px; padding: 5px 7px; border: 1px solid var(--border); border-radius: 6px; font-family: var(--font); }
.lead-outcome-form input[type="datetime-local"] { font-size: 12px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; font-family: var(--font); }
.bulk-bar { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; background: var(--accent-soft); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; }
.bulk-bar form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.bulk-bar select, .bulk-bar input[type="datetime-local"] { font-size: 12px; padding: 5px 7px; border: 1px solid var(--border); border-radius: 6px; font-family: var(--font); }

.split { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.list-panel { width: 290px; flex-shrink: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.sit-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 12.8px; font-weight: 700; color: var(--ink-secondary); }
.sit-item:last-child { border-bottom: none; }
.sit-item.active, .sit-item.active:visited { background: var(--accent-soft); color: var(--accent-ink); }
.sit-tag { font-size: 9.5px; font-weight: 800; background: #fff; color: var(--ink-secondary); border: 1px solid var(--border); padding: 2px 6px; border-radius: 5px; }
.sit-item.active .sit-tag { background: var(--accent-ink); color: #fff; border-color: transparent; }
.detail-panel { flex: 1; min-width: 320px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.detail-title { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 4px; }
.detail-sub { font-size: 12.5px; color: var(--ink-secondary); font-weight: 600; max-width: 520px; line-height: 1.5; }

.disclaimer { display: flex; gap: 10px; align-items: flex-start; background: var(--warning-soft); border: 1px solid #f3ddac; border-radius: 12px; padding: 11px 16px; margin-bottom: 14px; }
.disclaimer b { color: #8a5800; }
.disclaimer span { font-size: 12px; color: #8a5800; font-weight: 600; line-height: 1.5; }

/* EPG Intelligence's "live snapshot" vs "period performance" distinction
   (see liveSnapshotBanner()/periodBanner() in src/views/intelligence.ts) —
   deliberately a single-line pill, not a box, so labelling every section
   this way never adds real visual weight to the page. */
.scope-banner { display: flex; align-items: center; gap: 7px; margin: 2px 0 14px; }
.scope-pill { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.scope-banner.live .scope-pill { background: var(--blue-soft); color: var(--blue); }
.scope-banner.period .scope-pill { background: var(--accent-soft); color: var(--accent-ink); }
.scope-desc { font-size: 11.5px; font-weight: 600; color: var(--ink-secondary); }

/* "How this is calculated" info glyph next to a metric's own label (see
   infoTip() in src/views/intelligence.ts) — a small, keyboard-focusable
   target whose explanation only surfaces on hover/focus (native title
   tooltip) or to a screen reader (aria-label), so it adds no visual weight
   until someone actually wants the definition. */
.info-tip { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 50%; background: var(--neutral-soft); color: var(--ink-secondary); font-size: 10px; font-weight: 800; font-style: italic; font-family: Georgia, serif; cursor: help; vertical-align: middle; margin-left: 3px; }
.info-tip:hover, .info-tip:focus-visible { background: var(--accent); color: #fff; outline: none; }

.format-tabs { display: flex; gap: 6px; background: var(--paper); border: 1px solid var(--border); border-radius: 10px; padding: 4px; margin-bottom: 16px; width: fit-content; }
.format-tab { display: flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 7px; font-size: 12.3px; font-weight: 700; color: var(--ink-secondary); cursor: pointer; border: none; background: none; font-family: var(--font); }
.format-tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.07); }
.format-panel { display: none; }
.format-panel.active { display: block; }

.section-label { font-size: 11.3px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-secondary); margin: 18px 0 10px; }
.section-label:first-of-type { margin-top: 0; }
.points { display: flex; flex-direction: column; gap: 8px; }
.point { font-size: 12.6px; color: var(--ink); font-weight: 600; line-height: 1.5; padding-left: 20px; position: relative; }
.point::before { content: "✓"; position: absolute; left: 0; color: var(--good); font-weight: 800; }
.quote-box { background: var(--paper); border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; padding: 14px 17px; font-size: 13px; color: var(--ink); line-height: 1.6; font-weight: 600; font-style: italic; white-space: pre-line; }
.dodont { display: flex; gap: 18px; flex-wrap: wrap; }
.dodont-col { flex: 1; min-width: 200px; }
.dodont-title { font-size: 11.3px; font-weight: 800; margin-bottom: 8px; }
.dodont-title.do { color: #0a6b0a; }
.dodont-title.dont { color: #8f2c14; }
.dodont-item { font-size: 12.3px; color: var(--ink-secondary); font-weight: 600; line-height: 1.5; margin-bottom: 7px; padding-left: 18px; position: relative; }
.dodont-item.do::before { content: "✓"; position: absolute; left: 0; color: var(--good); font-weight: 800; }
.dodont-item.dont::before { content: "✕"; position: absolute; left: 0; color: var(--critical); font-weight: 800; }
.custom-row { display: flex; align-items: center; justify-content: space-between; background: var(--paper); border: 1px solid var(--border); border-radius: 10px; padding: 11px 15px; margin-top: 18px; flex-wrap: wrap; gap: 8px; }
.custom-row span { font-size: 12px; font-weight: 700; color: var(--ink-secondary); }

/* ---- Phase 2: Practice Portal — simpler, client-facing shell ---- */

.portal-shell { min-height: 100vh; background: var(--paper); }
.portal-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 14px 32px; flex-wrap: wrap;
}
.portal-brand { display: flex; align-items: center; gap: 12px; }
.portal-brand-mark {
  width: 38px; height: 38px; border-radius: 10px; background: var(--accent-ink); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; letter-spacing: 0.3px;
}
.portal-brand-title { font-weight: 800; font-size: 15px; color: var(--ink); }
.portal-brand-sub { font-size: 11px; color: var(--muted); font-weight: 600; }
.portal-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.portal-nav .p-nav-item {
  padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; color: var(--ink-secondary);
}
.portal-nav .p-nav-item:hover { background: var(--paper); text-decoration: none; }
.portal-nav .p-nav-item.active { background: var(--accent-gradient); color: var(--ink); }
.portal-user { display: flex; align-items: center; gap: 12px; text-align: right; }
.portal-user-name { font-weight: 700; font-size: 13px; }
.portal-user-role { font-size: 11px; color: var(--muted); font-weight: 600; }
.portal-logout { background: none; border: 1px solid var(--border); color: var(--ink-secondary); padding: 5px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; cursor: pointer; }
.portal-logout:hover { background: var(--paper); }
.portal-main { max-width: 1180px; margin: 0 auto; padding: 28px 32px 60px; }

.portal-hero { background: var(--accent-gradient); border-radius: 18px; padding: 26px 30px; color: var(--ink); margin-bottom: 22px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; }
.portal-hero h1 { margin: 0 0 4px; font-size: 20px; font-weight: 800; }
.portal-hero p { margin: 0; opacity: 0.82; font-size: 13px; }

.portal-note { background: var(--accent-soft); color: var(--accent-ink); border-radius: 10px; padding: 11px 16px; font-size: 12.5px; font-weight: 600; margin-bottom: 18px; }

@media print {
  .portal-topbar, .no-print { display: none !important; }
  .portal-main { max-width: none; padding: 0; margin: 0; }
  body { background: #fff; }
}

/* --- Practices hub (Phase 2 client-management hub) -------------------------
   Deliberately restrained: the existing .card/.badge/.stat-chip/.table
   vocabulary carries almost all of this — see the comment on each rule
   below for what it's layered on top of, rather than introducing a parallel
   visual language for one page. */

/* The filter/sort bar above the table — a plain .card with a single wrapping
   row of compact controls, auto-submitting on change (same convention as
   the role <select> on /admin/practice-users). */
.hub-filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 4px; }
.hub-filter-bar .field label { font-size: 10.6px; }
.hub-filter-bar select { font-size: 12.5px; padding: 7px 9px; }

/* Wraps the practices table so a narrow viewport scrolls the table
   horizontally rather than squeezing every column or breaking the page
   layout — the "good responsive behaviour" requirement, without hiding any
   column's data on small screens. */
.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 900px; }

/* A row needing attention gets a single, restrained left accent rather than
   a loud full-row highlight — visible at a glance while scanning, never
   heavy. */
.hub-row-attention td:first-child { box-shadow: inset 3px 0 0 var(--critical); }

/* Two-line cell convention used throughout the practices table: a primary
   value with a smaller, muted line of context underneath (mirrors the
   existing .small.muted convention used elsewhere in this codebase, just
   named for reuse in a tighter table cell). */
.hub-cell-main { font-weight: 700; font-size: 13.5px; }
.hub-cell-sub { font-size: 11px; color: var(--ink-secondary); font-weight: 600; margin-top: 2px; }

/* The compact "Enquiries / Overdue / Dormant" trio inside one cell. */
.hub-mini-stats { display: flex; gap: 12px; }
.hub-mini-stat { display: flex; flex-direction: column; align-items: center; min-width: 34px; }
.hub-mini-stat .n { font-size: 14px; font-weight: 800; line-height: 1.1; }
.hub-mini-stat .n.zero { color: var(--muted); font-weight: 700; }
.hub-mini-stat .n.crit { color: var(--critical); }
.hub-mini-stat .l { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-top: 1px; }

/* Onboarding checklist — small ✓/○ chips, never a synthesized percentage
   (see computeOnboardingChecklist()'s doc comment in
   src/data/practiceHub.ts for why). Shown only under an ONBOARDING row's
   name cell. */
.hub-onboarding-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.hub-onboarding-item { display: inline-flex; align-items: center; gap: 3px; font-size: 10.3px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--neutral-soft); color: var(--ink-secondary); }
.hub-onboarding-item.done { background: var(--good-soft); color: var(--good); }

/* Quick actions — compact secondary-style links, tighter than the standard
   .btn so five of them fit one row without dominating the row. */
.hub-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.hub-actions a { font-size: 11px; font-weight: 700; padding: 5px 9px; border-radius: 7px; border: 1px solid var(--border); color: var(--ink-secondary); background: var(--surface); white-space: nowrap; }
.hub-actions a:hover { background: var(--paper); color: var(--ink); text-decoration: none; border-color: var(--muted); }
/* Team Management Phase 2: some row actions are POST forms (Resend invite,
   Deactivate/Activate), not links — styled identically to .hub-actions a so
   a mixed row of links and form-buttons reads as one consistent set. */
.hub-actions form { display: inline-flex; margin: 0; }
.hub-actions button { font: inherit; font-size: 11px; font-weight: 700; padding: 5px 9px; border-radius: 7px; border: 1px solid var(--border); color: var(--ink-secondary); background: var(--surface); cursor: pointer; white-space: nowrap; }
.hub-actions button:hover { background: var(--paper); color: var(--ink); border-color: var(--muted); }

/* Integration-health chip on the practices table doubles as a link straight
   into that practice's Integrations tab — same hover/focus affordance
   .badge-link already gives every other clickable badge in this app. */
.hub-health-badge.badge-link { cursor: pointer; }

/* Reports Phase 2 — kept deliberately restrained (existing .card/.badge/
   .stat/.hub-actions/.portal-note components, no new visual language): the
   one new thing is a visually-obvious distinction between a live, unsaved
   PREVIEW and a frozen, generated report, per the spec's own instruction
   that the two must never look interchangeable. */
.report-preview-banner { background: var(--warning-soft); color: #7a5400; border: 1px solid var(--warning); border-radius: 10px; padding: 11px 16px; font-size: 12.5px; font-weight: 700; margin-bottom: 18px; display: flex; align-items: center; gap: 8px; }
.report-frozen-banner { background: var(--accent-soft); color: var(--accent-ink); border-radius: 10px; padding: 11px 16px; font-size: 12.5px; font-weight: 600; margin-bottom: 18px; }

.report-type-toggle { display: flex; gap: 6px; margin-bottom: 4px; }
.report-type-toggle label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--ink-secondary); }
.report-type-toggle input { accent-color: var(--accent-ink); }
.report-type-toggle input:checked + span { color: var(--ink); }

/* EPG Intelligence Highlights — a short, deterministic bullet list, styled
   as plainly-factual rather than "AI-generated": no gradients, no icons
   beyond a small flat dot, same ink/muted tokens as the rest of the report. */
.highlight-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.highlight-item { display: flex; align-items: flex-start; gap: 9px; font-size: 12.8px; line-height: 1.5; }
.highlight-item::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-ink); margin-top: 6px; flex-shrink: 0; }
.highlight-empty { font-size: 12.5px; color: var(--muted); }

.report-status-form { display: inline-flex; }

@media print {
  .report-preview-banner, .report-frozen-banner { border: 1px solid #ccc; background: none; color: #333; }
}

@media (max-width: 720px) {
  .hub-filter-bar { flex-direction: column; align-items: stretch; }
  .hub-filter-bar .field, .hub-filter-bar select { width: 100%; }
}

/* Phase 3 Step 6 — App Experience (PWA + app.epgdental.com readiness):
   reflow only, not a redesign. The internal app shell (.app-shell/.sidebar)
   had no small-viewport handling at all — a fixed 220px sidebar plus fixed
   28px/36px main padding left an unusably narrow sliver of content on a
   phone-width screen, which now matters because the app can be installed as
   a standalone window on mobile (item 6 of the Step 6 spec). Same colors,
   fonts, and components as the rest of this file — the sidebar simply
   becomes a wrapping top bar below this width instead of a fixed-width
   column, and the fixed-width login card becomes fluid. */
@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    padding: 12px 16px;
  }
  .sidebar .brand { padding: 0; }
  .sidebar .brand small { display: none; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .sidebar .user-box {
    margin-top: 0;
    margin-left: auto;
    border-top: none;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .sidebar .user-box form { margin-top: 0; }
  .main { padding: 16px; max-width: none; }
  .portal-topbar { padding: 12px 16px; }
  .portal-main { padding: 18px 16px 40px; }
}

@media (max-width: 480px) {
  .login-wrap { padding: 16px; }
  .login-card { width: 100%; max-width: 360px; padding: 24px; }
}

/* Phase 3 Step 4 Pilot Readiness — kept deliberately restrained (existing
   .card/.badge/.btn components, no new visual language): a checklist where
   every row carries its own status badge, a short "why", and an optional
   "Fix" link straight to where an EPG Admin can act on it. */
.pilot-check-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pilot-check { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.pilot-check:first-child { border-top: none; padding-top: 0; }
.pilot-check-body { flex: 1; min-width: 0; }
.pilot-check-label { font-size: 12.8px; font-weight: 700; color: var(--ink); }
.pilot-check-action { flex-shrink: 0; }
.pilot-summary-line { display: flex; gap: 14px; font-size: 11.5px; font-weight: 700; color: var(--ink-secondary); margin: 2px 0 4px; }
.pilot-summary-line .n-blocking { color: var(--critical); }
.pilot-summary-line .n-warning { color: var(--warning); }
