/* ============================================================
   Kinetik Sonar — design system

   Every token below is an ALIAS onto @kinetik/ui-kit. The real
   values live in kinetik-tokens.css, generated from the ui-kit
   repo by scripts/extract_tokens.py — so a brand change is one
   regeneration, not a hunt through this file.

   Sonar's own names are kept deliberately: ~300 rules reference
   them, and repointing 57 definitions is a far smaller (and far
   more reviewable) change than rewriting every call site.

   When @kinetik/ui-kit is installable from CodeArtifact, this
   whole indirection is replaced by importing the package's own
   token export. Nothing below has to change for that to happen.
   ============================================================ */

:root {
  /* Brand */
  --purple:       var(--ktk-brand500);
  --purple-dark:  var(--ktk-brand600);
  --purple-light: var(--ktk-surface-base-selected);
  --purple-mid:   var(--ktk-brand100);
  --purple-soft:  var(--ktk-brand400);
  --navy:         var(--ktk-dark-navy);
  --navy-0:       var(--ktk-navy);

  /* Neutrals. ui-kit runs a four-step text ramp, same as Sonar's,
     so these line up one-to-one. */
  --bg:           var(--ktk-background-base);
  --bg-cool:      var(--ktk-surface-subtle-default);
  --white:        var(--ktk-white);
  --border:       var(--ktk-border-default);
  --border-soft:  var(--ktk-border-subtle);
  --text-1:       var(--ktk-text-primary);
  --text-2:       var(--ktk-neutral-tinted800);
  --text-3:       var(--ktk-text-secondary);
  --text-4:       var(--ktk-text-tertiary);

  /* Semantic. These were Tailwind defaults, not Kinetik colours —
     #DC2626 red, #15803D green and so on. Now on the real ramps. */
  --green-bg:     var(--ktk-status-success-soft); --green-text:  var(--ktk-status-success-strong);
  --orange-bg:    var(--ktk-accent-orange-soft);  --orange-text: var(--ktk-orange700);
  --yellow-bg:    var(--ktk-status-warning-soft); --yellow-text: var(--ktk-status-warning-strong);
  --teal-bg:      var(--ktk-accent-aqua-soft);    --teal-text:   var(--ktk-aqua700);
  --red:          var(--ktk-status-danger-base);  --red-bg:      var(--ktk-status-danger-soft);
  --red-text:     var(--ktk-status-danger-strong);

  /* Shape */
  --radius-tiny:  var(--ktk-rounded-4);
  --radius:       var(--ktk-rounded-8);
  --radius-md:    var(--ktk-rounded-12);
  --radius-pill:  var(--ktk-rounded-full);
  --shadow:       var(--ktk-shadow-sm);
  --shadow-md:    var(--ktk-shadow-md);

  /* Layout. Sonar's own chrome — ui-kit has no opinion on these. */
  --sidebar-w:    222px;
  --header-h:     var(--ktk-spacing-56);

  /* Type. ui-kit ships ONE family — DM Sans. There is no Manrope in
     the design system, so the old display face was off-brand. */
  --font:         var(--ktk-font-primary);
  --font-display: var(--ktk-font-primary);
  --focus-ring:   0 0 0 3px var(--ktk-brand-blue-at20-percent);

  /* Clinical category accents, mapped onto ui-kit's accent ramps.
     Dialysis takes coral rather than the danger red, so a condition
     badge never reads as an error state. */
  --clinical-dialysis: var(--ktk-coral500);
  --clinical-sa:       var(--ktk-orange500);
  --clinical-bh:       var(--ktk-violet500);
  --clinical-onc:      var(--ktk-pink500);
  --clinical-wound:    var(--ktk-aqua500);
  --clinical-cardiac:  var(--ktk-purple500);

  /* Legacy aliases (content templates use these var names inline) */
  --off-black:       var(--text-1);
  --text-primary:    var(--text-1);
  --text-secondary:  var(--text-2);
  --text-muted:      var(--text-4);
  --kinetik-purple:  var(--purple);
  --lilac:           var(--purple-mid);
  --card-bg:         var(--white);
  --success-bg: var(--green-bg);  --success-text: var(--green-text);
  --warning-bg: var(--yellow-bg); --warning-text: var(--yellow-text);
  --danger-bg:  var(--red-bg);    --danger-text:  var(--red-text);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -0.01em; color: var(--navy-0); }
a { text-decoration: none; color: inherit; }
button { font-family: var(--font); cursor: pointer; }
input, select { font-family: var(--font); }

/* ─── Shell ──────────────────────────────────────────────── */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ─── Sidebar ────────────────────────────────────────────── */
:root { --sidebar-mini: 66px; }

#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(91,98,231,.16) 0%, transparent 55%),
    var(--navy);
  border-top-right-radius: 18px;
  border-bottom-right-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width .2s cubic-bezier(.4,0,.2,1),
              min-width .2s cubic-bezier(.4,0,.2,1);
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sb-logo {
  display: flex; align-items: center; gap: 8px;
  padding: 19px 20px 17px;
  text-decoration: none; flex: none;
}
.sb-logo-mark { height: 25px; width: auto; flex: none; }
.sb-logo-text {
  color: #fff; font-family: var(--font-display); font-weight: var(--ktk-weight-medium);
  font-size: 19px; letter-spacing: -0.03em; white-space: nowrap;
}

.sb-section { padding: 4px 0 8px; }
.sb-section + .sb-section {
  border-top: 1px solid rgba(255,255,255,0.07);
  margin-top: 6px; padding-top: 10px;
}
.sb-heading {
  padding: 4px 20px 9px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.11em;
  color: rgba(255,255,255,0.32); white-space: nowrap;
}

.sb-item {
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding: 9px 13px; margin: 2px 9px; border-radius: 9px;
  color: rgba(255,255,255,0.62);
  font-size: 13px; font-weight: 500;
  text-decoration: none; cursor: pointer;
  transition: background .13s ease, color .13s ease;
}
.sb-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.sb-item:focus-visible { outline: 2px solid var(--purple-soft); outline-offset: -2px; }

/* Active reads as a lit panel with a rail rather than a solid purple slab —
   the slab fought the logo for attention and flattened the hierarchy. */
.sb-item.active {
  background: linear-gradient(90deg, rgba(91,98,231,.30) 0%, rgba(91,98,231,.10) 100%);
  color: #fff; font-weight: 600;
}
.sb-item.active::before {
  content: ""; position: absolute; left: -9px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 17px; border-radius: 0 3px 3px 0;
  background: var(--purple-soft);
}
.sb-item.active .sb-item-icon { background: var(--purple-soft); }

.sb-item-left { display: flex; align-items: center; gap: 11px; min-width: 0; }
.sb-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-item-icon.k-icon {
  width: 16px; height: 16px; flex-shrink: 0; display: inline-block;
  background: currentColor;
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
}

.sb-tag {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase;
  background: rgba(112,119,255,0.26); color: var(--ktk-brand100);
  padding: 2.5px 6px; border-radius: 5px; flex: none;
}

/* ---------- collapse toggle ---------- */
.sb-toggle {
  margin: auto 9px 12px; padding: 9px 13px;
  display: flex; align-items: center; gap: 11px;
  background: none; border: none; border-radius: 9px;
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  color: rgba(255,255,255,0.42);
  cursor: pointer; flex: none;
  transition: background .13s ease, color .13s ease;
}
.sb-toggle:hover { background: rgba(255,255,255,0.07); color: #fff; }
.sb-toggle:focus-visible { outline: 2px solid var(--purple-soft); outline-offset: -2px; }
.sb-toggle svg { flex: none; transition: transform .2s cubic-bezier(.4,0,.2,1); }

/* ---------- collapsed ---------- */
.sb-mini #sidebar {
  width: var(--sidebar-mini);
  min-width: var(--sidebar-mini);
}
.sb-mini .sb-label,
.sb-mini .sb-heading,
.sb-mini .sb-logo-text,
.sb-mini .sb-tag { display: none; }
.sb-mini .sb-logo { justify-content: center; padding: 19px 0 17px; }
.sb-mini .sb-item,
.sb-mini .sb-toggle { justify-content: center; padding: 10px 0; margin: 2px 9px; }
.sb-mini .sb-item-left { justify-content: center; gap: 0; }
.sb-mini .sb-item.active::before { left: -9px; }
.sb-mini .sb-toggle svg { transform: rotate(180deg); }
.sb-mini .sb-section { padding: 6px 0 8px; }
.sb-mini .sb-heading + .sb-item { margin-top: 2px; }

/* the sidebar's own buttons in page blocks would overflow the rail */
.sb-mini .sidebar-btn { display: none; }

@media (prefers-reduced-motion: reduce) {
  #sidebar, .sb-toggle svg { transition: none; }
}


/* Sidebar page-specific sections (filters, alert rules, actions) */
.sidebar-section { padding: 14px 16px; }
.sidebar-section + .sidebar-section { border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-label {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: rgba(255,255,255,0.4); margin-bottom: 10px;
}
.sidebar-filter-group form { display: flex; flex-direction: column; gap: 8px; }
.sidebar-filter-group select,
.sidebar-filter-group input[type="text"] {
  width: 100%; height: 34px; padding: 0 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px; color: #fff; font-size: 12.5px; outline: none;
  appearance: none;
  transition: border 0.15s, background 0.15s;
}
.sidebar-filter-group select {
  padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23B8BFCC' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.sidebar-filter-group select option { color: var(--text-1); }
.sidebar-filter-group input::placeholder { color: rgba(255,255,255,0.4); }
.sidebar-filter-group select:focus,
.sidebar-filter-group input:focus { border-color: var(--purple-soft); background: rgba(255,255,255,0.1); }

.sidebar-btn {
  display: block; width: 100%; text-align: center;
  padding: 9px 12px; border-radius: 8px; font-size: 13px; font-weight: 500;
  background: var(--purple); color: #fff; transition: background 0.15s;
}
.sidebar-btn:hover { background: var(--purple-dark); }
.sidebar-btn.secondary { background: rgba(255,255,255,0.08); color: var(--ktk-neutral-tinted300); }
.sidebar-btn.secondary:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* Explanatory text inside sidebar sections (e.g. alert-rules) — light on navy */
.sidebar-section { color: rgba(255,255,255,0.72); }
.sidebar-section p { margin-bottom: 6px; line-height: 1.55; }
.sidebar-section strong { color: #fff; font-weight: 600; }
.sidebar-section ul { padding-left: 16px; margin: 4px 0; }
.sidebar-section li { margin-bottom: 2px; }
.sidebar-section em { color: rgba(255,255,255,0.5); }
.sidebar-section a:not(.sidebar-btn) { color: var(--ktk-purple300); }

/* ─── Main / topbar ──────────────────────────────────────── */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
#topbar {
  height: var(--header-h); background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; flex-shrink: 0; z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 8px; }
.topbar-crumb { color: var(--text-4); font-weight: 400; font-size: 13px; }
.topbar-sep { color: var(--text-4); font-size: 13px; }
.topbar-title { font-size: 14px; font-weight: 600; color: var(--text-1); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--purple); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}

#content { flex: 1; overflow-y: auto; padding: 24px; }
#content::-webkit-scrollbar { width: 6px; }
#content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 16px; }
.page-head h1 { font-size: 22px; font-weight: 800; color: var(--navy-0); }
.page-head p { margin-top: 4px; font-size: 13.5px; color: var(--text-3); }
.page-head-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.plan-badge {
  display: inline-flex; align-items: center; padding: 6px 12px;
  background: var(--purple-light); color: var(--purple);
  border-radius: var(--radius-pill); font-size: 12px; font-weight: 600;
  white-space: nowrap;
}

/* ─── Metric cards ───────────────────────────────────────── */
.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.metric-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.metric-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-4); }
.metric-value { font-family: var(--font-display); font-size: 30px; font-weight: var(--ktk-weight-medium); color: var(--navy-0); margin: 6px 0 2px; line-height: 1.1; }
.metric-sub { font-size: 12px; color: var(--text-3); }

/* ─── Section (card container) ───────────────────────────── */
.section { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 22px; box-shadow: var(--shadow); }
.section-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-family: var(--font-display); font-size: 15px; font-weight: var(--ktk-weight-medium); color: var(--navy-0); }
.section-sub { font-size: 12.5px; color: var(--text-3); margin-top: 3px; line-height: 1.5; }

/* ─── Data table ─────────────────────────────────────────── */
/* Wide tables scroll inside their own card rather than pushing the page
   sideways on narrower windows. */
.section { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data thead th {
  text-align: left; padding: 10px 14px; color: var(--text-3);
  font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data tbody tr { border-bottom: 1px solid var(--border-soft); transition: background 0.1s; }
table.data tbody tr[onclick] { cursor: pointer; }
table.data tbody tr:hover { background: var(--ktk-neutral-tinted100); }
table.data tbody tr:last-child { border-bottom: none; }
table.data td { padding: 12px 14px; vertical-align: middle; color: var(--text-2); }

/* ─── Badges (pills) ─────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.3;
}
.badge-high    { background: var(--red-bg);    color: var(--red-text); }
.badge-med     { background: var(--yellow-bg); color: var(--yellow-text); }
.badge-alert   { background: var(--orange-bg); color: var(--orange-text); }
.badge-purple  { background: var(--purple-light); color: var(--purple); }
.badge-success { background: var(--green-bg);  color: var(--green-text); }
.badge-neutral { background: var(--ktk-neutral-tinted200);          color: var(--text-3); }
.badge-info    { background: var(--teal-bg);   color: var(--teal-text); }
/* Provider not on the Kinetik app — their status data is incomplete. */
.badge-nd {
  background: var(--teal-bg); color: var(--teal-text);
  border: 1px solid var(--ktk-aqua100); font-size: 10.5px; font-weight: 600;
  padding: 2px 8px; cursor: help; white-space: nowrap;
}
.badge-clinical { background: var(--bg-cool); color: var(--text-2); border: 1px solid var(--border); }
.badge-clinical.clinical-dialysis { background: var(--ktk-coral100); color: var(--ktk-coral700); border-color: var(--ktk-coral300); }
.badge-clinical.clinical-sa       { background: var(--ktk-orange100); color: var(--ktk-orange700); border-color: var(--ktk-orange300); }
.badge-clinical.clinical-bh       { background: var(--ktk-violet100); color: var(--ktk-violet700); border-color: var(--ktk-violet300); }
.badge-clinical.clinical-onc      { background: var(--ktk-pink100); color: var(--ktk-pink700); border-color: var(--ktk-pink300); }
.badge-clinical.clinical-wound    { background: var(--ktk-aqua100); color: var(--ktk-aqua700); border-color: var(--ktk-aqua300); }
.badge-clinical.clinical-cardiac  { background: var(--ktk-purple100); color: var(--ktk-purple700); border-color: var(--ktk-purple300); }

/* ─── Member detail header ───────────────────────────────── */
.member-header {
  background: var(--navy); color: #fff;
  border-radius: var(--radius-md); padding: 22px 24px;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 22px;
}
.member-header h1, .member-header .member-id { color: #fff; }
.member-id { font-family: var(--font-display); }
.member-meta { color: rgba(255,255,255,0.65); font-size: 13px; margin-top: 4px; }
.alerts-inline { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.alert-pill {
  background: var(--purple); color: #fff;
  padding: 6px 12px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}

/* ─── Member detail body ─────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
/* Grid children default to min-width:auto, so a wide table would force the
   whole layout open instead of scrolling inside its own card. */
.two-col > * { min-width: 0; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } .metrics-grid { grid-template-columns: repeat(2, 1fr); } }

.signal-grid { display: flex; flex-direction: column; gap: 8px; }
.signal-item {
  display: flex; gap: 12px; align-items: flex-start; padding: 11px 13px;
  background: var(--bg-cool); border-radius: var(--radius);
  border: 1px solid var(--border); opacity: 0.6;
}
.signal-item.signal-active { opacity: 1; background: #fff; border-color: var(--purple); box-shadow: 0 0 0 1px var(--purple); }
.signal-indicator {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--ktk-neutral-tinted200); color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
}
.signal-item.signal-active .signal-indicator { background: var(--purple); color: #fff; }
.signal-title { font-weight: 600; font-size: 0.85rem; color: var(--text-1); margin-bottom: 2px; }
.signal-desc { font-size: 0.8rem; color: var(--text-3); line-height: 1.5; }
.gate-thresh { color: var(--text-4); font-size: 0.72rem; white-space: nowrap; }

/* Disengagement explanation panel */
.diseng-headline {
  font-size: 0.92rem; line-height: 1.55; color: var(--text-1);
  background: var(--bg-cool); border: 1px solid var(--border);
  border-left: 3px solid var(--purple); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 14px;
}
.diseng-headline.diseng-deep     { border-left-color: var(--red-text); }
.diseng-headline.diseng-moderate { border-left-color: var(--yellow-text); }
.diseng-sev-tag {
  display: inline-block; font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 5px; margin-right: 6px;
  background: var(--red-bg); color: var(--red-text); vertical-align: middle;
}
.diseng-moderate .diseng-sev-tag { background: var(--yellow-bg); color: var(--yellow-text); }
.diseng-compare { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.compare-row { display: flex; align-items: center; gap: 10px; }
.compare-label { width: 96px; flex-shrink: 0; font-size: 0.78rem; color: var(--text-3); }
.compare-track { flex: 1; height: 10px; background: var(--ktk-neutral-tinted200); border-radius: 5px; overflow: hidden; }
.compare-fill { height: 100%; border-radius: 5px; }
.compare-fill.baseline { background: var(--purple-mid); }
.compare-fill.recent   { background: var(--purple); }
.compare-val { width: 64px; flex-shrink: 0; text-align: right; font-size: 0.82rem; font-weight: 600; color: var(--text-1); }
.diseng-foot { margin-top: 10px; font-size: 0.74rem; color: var(--text-4); line-height: 1.5; }

.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-box { background: var(--bg-cool); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; height: 240px; }
@media (max-width: 700px) { .charts-grid { grid-template-columns: 1fr; } }
.empty-state { padding: 28px; text-align: center; color: var(--text-4); font-size: 13px; }

/* Outcome strip above the recent-trips table — surfaces misses at a glance */
.outcome-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-bottom: 14px;
}
.outcome-stat {
  background: var(--bg-cool); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; text-align: center;
}
.outcome-value {
  font-family: var(--font-display); font-size: 20px; font-weight: var(--ktk-weight-medium);
  color: var(--navy-0); line-height: 1.1;
}
.outcome-label { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.outcome-stat.outcome-bad  { background: var(--red-bg);    border-color: var(--ktk-coral300); }
.outcome-stat.outcome-bad .outcome-value,
.outcome-stat.outcome-bad .outcome-label  { color: var(--red-text); }
.outcome-stat.outcome-info { background: var(--teal-bg); border-color: var(--ktk-aqua100); }
.outcome-stat.outcome-info .outcome-value,
.outcome-stat.outcome-info .outcome-label { color: var(--teal-text); }
.outcome-stat.outcome-warn { background: var(--yellow-bg); border-color: var(--ktk-gold300); }
.outcome-stat.outcome-warn .outcome-value,
.outcome-stat.outcome-warn .outcome-label { color: var(--yellow-text); }

/* Action panel */
.action-panel select, .action-panel textarea, .action-panel input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13px; color: var(--text-1);
  background: #fff; outline: none; margin-bottom: 10px; font-family: var(--font);
}
.action-panel select:focus, .action-panel textarea:focus { border-color: var(--purple); box-shadow: var(--focus-ring); }
.action-panel label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-4); margin-bottom: 5px; }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 11px 16px; border-radius: var(--radius);
  background: var(--purple); color: #fff; border: none;
  font-size: 14px; font-weight: 600; transition: background 0.15s;
}
.btn-primary:hover { background: var(--purple-dark); }
.action-log { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.action-log-item { padding: 10px 12px; background: var(--bg-cool); border: 1px solid var(--border); border-radius: var(--radius); font-size: 12.5px; color: var(--text-2); }

/* ─── Post-Ride Failure / corrective actions ─────────────── */
.cell-sub { font-size: 11px; color: var(--text-4); margin-top: 2px; }
.action-cell { font-size: 12px; color: var(--text-2); max-width: 220px; line-height: 1.45; }
.reviewed-tick { color: var(--green-text); font-weight: 700; margin-left: 4px; }

/* Sparkline of monthly failure rates */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 26px; }
.spark-bar {
  width: 8px; background: var(--purple-mid); border-radius: 2px 2px 0 0;
  display: block;
}
.spark-bar.spark-breach { background: var(--red); }

/* Inline adjudication form */
details.adjudicate { position: relative; }
details.adjudicate > summary {
  cursor: pointer; list-style: none; white-space: nowrap;
  font-size: 12px; font-weight: 600; color: var(--purple);
  padding: 4px 10px; border: 1px solid var(--purple-mid);
  border-radius: var(--radius-pill); display: inline-block;
}
details.adjudicate > summary::-webkit-details-marker { display: none; }
details.adjudicate > summary:hover { background: var(--purple-light); }
details.adjudicate[open] > summary { background: var(--purple); color: #fff; border-color: var(--purple); }
.adjudicate-form {
  position: absolute; right: 0; top: 32px; z-index: 40;
  width: 290px; padding: 14px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.adjudicate-form label {
  display: block; font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-4); margin: 8px 0 4px;
}
.adjudicate-form label:first-child { margin-top: 0; }
.adjudicate-form select, .adjudicate-form input[type="text"] {
  width: 100%; padding: 7px 9px; font-size: 12.5px; font-family: var(--font);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-1); background: #fff; outline: none;
}
.adjudicate-form select:focus, .adjudicate-form input:focus { border-color: var(--purple); }
.adjudicate-form .btn-primary { margin-top: 12px; padding: 8px 14px; font-size: 13px; }

.nd-callout {
  margin-top: 10px; padding: 10px 12px; border-radius: var(--radius);
  background: var(--teal-bg); border: 1px solid var(--ktk-aqua100);
  color: var(--teal-text); font-size: 12.5px; line-height: 1.55;
}

/* ─── Demo mode toggle ───────────────────────────────────── */
.demo-toggle-form { display: flex; }
.demo-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px 5px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--text-3);
  font-family: var(--font); font-size: 12px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.demo-toggle:hover { background: var(--bg-cool); color: var(--text-1); }
.demo-toggle .demo-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-4); flex-shrink: 0;
  transition: background 0.15s;
}
.demo-toggle.on {
  background: var(--purple); border-color: var(--purple); color: #fff;
}
.demo-toggle.on:hover { background: var(--purple-dark); color: #fff; }
.demo-toggle.on .demo-dot { background: #fff; }
.demo-toggle:focus-visible { outline: none; box-shadow: var(--focus-ring); }


/* ─── Definition tooltips ────────────────────────────────── */
.info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-4); color: #fff;
  font-size: 9.5px; font-weight: 700; font-style: normal;
  line-height: 1; cursor: help; margin-left: 5px;
  vertical-align: middle; flex-shrink: 0;
  text-transform: none; letter-spacing: 0;
  transition: background 0.12s;
}
.info:hover, .info:focus { background: var(--purple); outline: none; }

#tip {
  position: fixed; z-index: 9999; max-width: 270px;
  padding: 10px 12px; border-radius: var(--radius);
  background: var(--navy); color: #fff;
  font-family: var(--font); font-size: 11.5px; font-weight: 400;
  line-height: 1.55; text-align: left; text-transform: none; letter-spacing: 0;
  box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.12s;
  top: -999px; left: -999px;
}
#tip.on { opacity: 1; visibility: visible; }
@media print { #tip, .info { display: none !important; } }

/* ─── Corrective action drill-down ───────────────────────── */
.reason-bars { display: flex; flex-direction: column; gap: 9px; }
.reason-bar-row { display: flex; align-items: center; gap: 10px; }
.reason-bar-label { width: 96px; flex-shrink: 0; font-size: 12px; color: var(--text-2); }
.reason-bar-track { flex: 1; height: 10px; background: var(--ktk-neutral-tinted200); border-radius: 5px; overflow: hidden; }
.reason-bar-fill { height: 100%; border-radius: 5px; background: var(--purple-mid); }
.reason-bar-fill.rb-bad  { background: var(--red); }
.reason-bar-fill.rb-info { background: var(--ktk-aqua300); }
.reason-bar-val { width: 38px; text-align: right; font-size: 12.5px; font-weight: 600; color: var(--text-1); }

.next-step {
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--bg-cool); border: 1px solid var(--border);
  border-left: 3px solid var(--purple);
  font-size: 13px; line-height: 1.55; color: var(--text-1);
}
.next-step-severe { border-left-color: var(--red); background: var(--red-bg); color: var(--red-text); }

/* Service-gap rows. A 4-column table doesn't fit the narrow right column —
   "Headroom" fell off the edge — so each service area stacks instead. */
.gap-list { display: flex; flex-direction: column; gap: 11px; margin-top: 13px; }
.gap-row-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin-bottom: 5px;
}
.gap-county { font-size: 13px; font-weight: 600; color: var(--text-1); }
.gap-cover { font-size: 12px; font-weight: 600; white-space: nowrap; }
.gap-cover-lbl { font-weight: 400; color: var(--text-4); }
.gap-track {
  height: 6px; background: var(--ktk-neutral-tinted200); border-radius: 999px; overflow: hidden;
}
.gap-fill { height: 100%; border-radius: 999px; }
.gap-fill.gap-f-clear   { background: var(--green-text); }
.gap-fill.gap-f-partial { background: var(--ktk-status-warning-base); }
.gap-fill.gap-f-gap     { background: var(--red); }
.gap-meta {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  margin-top: 5px; font-size: 11.5px; color: var(--text-3);
}
.gap-meta span { cursor: help; }

/* Service-gap verdict */
.gap-verdict { padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); }
.gap-verdict-head { font-family: var(--font-display); font-size: 15px; font-weight: var(--ktk-weight-medium); }
.gap-verdict-sub { font-size: 12.5px; line-height: 1.55; margin-top: 3px; }
.gap-clear   { background: var(--green-bg);  border-color: var(--ktk-grass-green100); }
.gap-clear   .gap-verdict-head, .gap-clear .gap-verdict-sub   { color: var(--green-text); }
.gap-partial { background: var(--yellow-bg); border-color: var(--ktk-gold300); }
.gap-partial .gap-verdict-head, .gap-partial .gap-verdict-sub { color: var(--yellow-text); }
.gap-gap     { background: var(--red-bg);    border-color: var(--ktk-coral300); }
.gap-gap     .gap-verdict-head, .gap-gap .gap-verdict-sub     { color: var(--red-text); }
.gap-unknown { background: var(--bg-cool); }

/* ─── Provider drill-down ────────────────────────────────── */
.slice-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-4); margin-bottom: 6px;
}
.slice-hint { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-4); }
tr.expandable { cursor: pointer; }
.caret {
  display: inline-block; width: 12px; color: var(--text-4);
  transition: transform 0.15s; margin-right: 2px;
}
.caret.open { transform: rotate(90deg); color: var(--purple); }
tr.reason-row > td { background: var(--bg-cool); padding: 10px 14px 12px 30px; }
table.subtable { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.subtable thead th {
  text-align: left; padding: 5px 10px; color: var(--text-4);
  font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; border-bottom: 1px solid var(--border);
}
table.subtable td { padding: 6px 10px; color: var(--text-2); border-bottom: 1px solid var(--border-soft); }
table.subtable tbody tr:last-child td { border-bottom: none; }
.subtable-note { margin-top: 6px; font-size: 11px; color: var(--text-4); }

.affected-list { display: flex; flex-direction: column; gap: 8px; }
.affected-item {
  display: block; padding: 11px 13px; background: var(--bg-cool);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color 0.15s, background 0.15s;
}
.affected-item:hover { border-color: var(--purple); background: #fff; }
.affected-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.affected-top strong { font-size: 13px; color: var(--text-1); }
.affected-meta { font-size: 11.5px; color: var(--text-3); line-height: 1.5; }

/* ─── Provider performance index ─────────────────────────── */
.idx-cell { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.idx-track {
  position: relative; flex: 1; height: 8px;
  background: var(--ktk-neutral-tinted200); border-radius: 4px; overflow: hidden;
}
/* Tick at index = 1.0 (the "as expected" line) on a 0–2.5 scale */
.idx-marker {
  position: absolute; left: 40%; top: -2px; bottom: -2px;
  width: 2px; background: var(--text-4); opacity: 0.55; z-index: 1;
}
.idx-fill { height: 100%; border-radius: 4px; }
.idx-fill.idx-ok   { background: var(--purple-mid); }
.idx-fill.idx-warn { background: var(--ktk-status-warning-base); }
.idx-fill.idx-bad  { background: var(--red); }
.idx-fill.idx-good { background: var(--ktk-grass-green300); }
.idx-value { font-size: 12.5px; font-weight: 700; width: 46px; text-align: right; }
.idx-t-ok   { color: var(--text-3); }
.idx-t-good { color: var(--green-text); }
.idx-t-warn { color: var(--yellow-text); }
.idx-t-bad  { color: var(--red-text); }

/* ─── Overview: clinical composition ─────────────────────── */
.clinical-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
@media (max-width: 1100px) { .clinical-grid { grid-template-columns: repeat(3, 1fr); } }
.clinical-card { background: var(--bg-cool); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; border-top: 3px solid var(--text-4); }
.clinical-card.clinical-dialysis { border-top-color: var(--clinical-dialysis); }
.clinical-card.clinical-sa       { border-top-color: var(--clinical-sa); }
.clinical-card.clinical-bh       { border-top-color: var(--clinical-bh); }
.clinical-card.clinical-onc      { border-top-color: var(--clinical-onc); }
.clinical-card.clinical-wound    { border-top-color: var(--clinical-wound); }
.clinical-card.clinical-cardiac  { border-top-color: var(--clinical-cardiac); }
.clinical-card-label { font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.clinical-card-value { font-family: var(--font-display); font-size: 24px; font-weight: var(--ktk-weight-medium); color: var(--navy-0); margin: 4px 0 1px; }
.clinical-card-sub { font-size: 11px; color: var(--text-4); }

/* ─── Overview: plan cards ───────────────────────────────── */
.plan-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 1100px) { .plan-grid { grid-template-columns: 1fr; } }
.plan-card {
  display: block; background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 20px; box-shadow: var(--shadow);
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}
.plan-card:hover { box-shadow: var(--shadow-md); border-color: var(--purple-mid); transform: translateY(-2px); }
.plan-card-header { margin-bottom: 14px; }
.plan-card-name { font-family: var(--font-display); font-size: 16px; font-weight: var(--ktk-weight-medium); color: var(--navy-0); }
.plan-card-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.plan-card-headline { display: flex; align-items: baseline; gap: 8px; padding: 12px 0; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }
.plan-card-headline-number { font-family: var(--font-display); font-size: 30px; font-weight: var(--ktk-weight-medium); color: var(--purple); line-height: 1; }
.plan-card-headline-label { font-size: 12.5px; color: var(--text-3); }
.plan-card-pct { color: var(--text-4); font-weight: 600; }
.plan-card-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.plan-card-metric-value { font-family: var(--font-display); font-size: 18px; font-weight: var(--ktk-weight-medium); color: var(--navy-0); }
.plan-card-metric-label { font-size: 10.5px; color: var(--text-4); margin-top: 1px; line-height: 1.3; }
.plan-card-clinical-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.clinical-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; background: var(--bg-cool); border: 1px solid var(--border); border-radius: var(--radius-pill); font-size: 11px; font-weight: 500; color: var(--text-2); }
.chip-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-dialysis { background: var(--clinical-dialysis); }
.dot-sa       { background: var(--clinical-sa); }
.dot-bh       { background: var(--clinical-bh); }
.dot-onc      { background: var(--clinical-onc); }
.dot-wound    { background: var(--clinical-wound); }
.plan-card-footer { border-top: 1px solid var(--border-soft); padding-top: 12px; }
.plan-card-footer-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; padding: 3px 0; }
.plan-card-footer-label { color: var(--text-3); }
.plan-card-footer-value { color: var(--text-1); font-weight: 600; }
.plan-card-cta { margin-top: 12px; color: var(--purple); font-size: 13px; font-weight: 600; }

/* ─── Overview: alert-rule explainer ─────────────────────── */
.alert-rules-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 1100px) { .alert-rules-grid { grid-template-columns: 1fr; } }
.alert-rule-card { background: var(--bg-cool); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.alert-rule-badge { display: inline-flex; align-items: center; padding: 4px 11px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; margin-bottom: 10px; }
.alert-rule-desc { font-size: 12.5px; color: var(--text-3); line-height: 1.55; }

/* ============================================================
   Topbar member search
   ============================================================ */
.tb-find {
    display: flex; align-items: center; gap: 8px;
    margin-left: auto; margin-right: 14px;
    background: var(--bg-cool);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 0 14px;
    height: 34px;
    width: 240px;
    color: var(--text-4);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.tb-find:focus-within {
    background: var(--white);
    border-color: var(--purple);
    box-shadow: var(--focus-ring);
}
.tb-find svg { flex: none; }
.tb-find input[type="search"] {
    flex: 1; min-width: 0;
    border: none; background: none; outline: none;
    font-family: inherit; font-size: 13.5px; color: var(--text-1);
}
.tb-find input::placeholder { color: var(--text-4); }
@media (max-width: 900px) { .tb-find { display: none; } }

/* ============================================================
   Home — a workspace, not a menu. The lists are the page.
   ============================================================ */
.hm { max-width: 1460px; display: flex; flex-direction: column; gap: 20px; }

.hm-top {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
}
.hm-eyebrow { font-size: 12.5px; font-weight: 600; color: var(--text-4); margin: 0 0 2px; }
.hm-h1 {
    font-family: var(--font-display);
    font-size: clamp(24px, 2vw, 31px);
    font-weight: var(--ktk-weight-medium); letter-spacing: -0.03em;
    color: var(--navy-0); margin: 0; line-height: 1.1;
}
.hm-scope { font-size: 12.5px; color: var(--text-4); }

/* ---------- kpi strip ---------- */
.kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.kpi {
    display: flex; flex-direction: column;
    background: var(--white);
    padding: 15px 18px 14px;
    text-decoration: none;
    transition: background .13s ease;
}
.kpi:hover { background: var(--purple-light); }
.kpi:focus-visible { outline: 2px solid var(--purple); outline-offset: -2px; }
.kpi-l {
    font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em;
    color: var(--text-3); margin-bottom: 7px;
}
.kpi-n {
    font-family: var(--font-display);
    font-size: 30px; font-weight: var(--ktk-weight-medium); letter-spacing: -0.035em;
    color: var(--navy-0); line-height: 1;
    font-variant-numeric: tabular-nums;
}
.kpi-s {
    font-size: 11.5px; color: var(--text-4);
    margin-top: 6px; line-height: 1.4; min-height: 16px;
}

/* ---------- two columns ---------- */
.hm-cols {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
@media (max-width: 1080px) { .hm-cols { grid-template-columns: 1fr; } }
.hm-side { display: flex; flex-direction: column; gap: 16px; }

.panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.panel-h {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 14px; padding: 16px 18px 14px;
    border-bottom: 1px solid var(--border-soft);
}
.panel-h h2 {
    font-family: var(--font-display);
    font-size: 14.5px; font-weight: var(--ktk-weight-medium); color: var(--text-1);
    margin: 0 0 2px;
}
.panel-h p { font-size: 12px; color: var(--text-4); margin: 0; }
.panel-all {
    font-family: var(--font-display);
    font-size: 12.5px; font-weight: var(--ktk-weight-medium); color: var(--purple);
    text-decoration: none; white-space: nowrap; flex: none;
}
.panel-all:hover { color: var(--purple-dark); }

/* ---------- rows ---------- */
.rows { display: flex; flex-direction: column; }
.rows-loading {
    padding: 26px 18px; font-size: 13px; color: var(--text-4);
    text-align: center;
}
.row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-soft);
    text-decoration: none;
    transition: background .12s ease;
}
.row:last-child { border-bottom: none; }
.row:not(.row-static):hover { background: var(--bg-cool); }
.row:focus-visible { outline: 2px solid var(--purple); outline-offset: -2px; }
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-name {
    font-family: var(--font-display);
    font-size: 13.5px; font-weight: var(--ktk-weight-medium); color: var(--text-1);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row-why { font-size: 12px; color: var(--text-3); }
.row-why b { color: var(--text-1); font-weight: 700; }
.row-side {
    display: flex; align-items: center; gap: 10px; flex: none;
}
.row-quiet {
    font-size: 11.5px; color: var(--text-4);
    font-variant-numeric: tabular-nums; white-space: nowrap;
}
.row-quiet b {
    font-family: var(--font-display);
    font-size: 13.5px; font-weight: var(--ktk-weight-medium); color: var(--text-1);
}

.cat {
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.03em;
    padding: 3px 8px; border-radius: var(--radius-pill);
    white-space: nowrap;
}
.c-sa { background: var(--ktk-orange100); color: var(--ktk-orange700); }
.c-bh { background: var(--ktk-violet100); color: var(--ktk-violet700); }
.c-di { background: var(--ktk-status-danger-soft); color: var(--ktk-coral700); }
.c-on { background: var(--ktk-pink100); color: var(--ktk-pink700); }
.c-ca { background: var(--ktk-purple100); color: var(--ktk-purple700); }
.c-wo { background: var(--ktk-aqua100); color: var(--ktk-aqua700); }
.c-ma { background: var(--ktk-gold100); color: var(--ktk-gold700); }
.c-ot { background: var(--bg-cool); color: var(--text-3); }

.stage {
    font-size: 10.5px; font-weight: 700;
    padding: 3px 8px; border-radius: var(--radius-pill);
    background: var(--bg-cool); color: var(--text-2);
    white-space: nowrap;
}
.stage-end { background: var(--ktk-status-danger-soft); color: var(--ktk-status-danger-strong); }

/* ---------- promo ---------- */
.promo {
    display: flex; flex-direction: column;
    padding: 20px;
    border-radius: var(--radius-md);
    background:
      radial-gradient(130% 150% at 92% 6%, var(--ktk-brand600) 0%, transparent 60%),
      linear-gradient(140deg, var(--ktk-brand900) 0%, var(--ktk-dark-navy) 66%);
    color: #fff; text-decoration: none;
    box-shadow: 0 1px 3px rgba(12,12,35,.14), 0 16px 32px -18px rgba(12,12,35,.5);
    transition: transform .15s ease, box-shadow .15s ease;
}
.promo:hover {
    transform: translateY(-2px);
    box-shadow: 0 1px 3px rgba(12,12,35,.16), 0 22px 42px -18px rgba(12,12,35,.56);
}
.promo:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.promo-tag {
    align-self: flex-start;
    font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
    background: rgba(255,255,255,0.16); color: #fff;
    padding: 4px 9px; border-radius: var(--radius-pill);
    margin-bottom: 12px;
}
.promo-t {
    font-family: var(--font-display);
    font-size: 16px; font-weight: var(--ktk-weight-medium); letter-spacing: -0.015em;
    margin-bottom: 6px;
}
.promo-s { font-size: 12.5px; color: rgba(255,255,255,0.66); line-height: 1.55; }
.promo-go {
    font-family: var(--font-display);
    font-size: 12.5px; font-weight: var(--ktk-weight-medium); color: #fff;
    margin-top: 14px;
}

.hm-foot { font-size: 11.5px; color: var(--text-4); margin: 0; }

.in { animation: numIn .24s cubic-bezier(.2,.8,.3,1); }
@keyframes numIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .promo, .row, .kpi { transition: none; }
    .promo:hover { transform: none; }
    .in { animation: none; }
}

/* ============================================================
   Missed care
   ============================================================ */
.note-inline {
    background: var(--ktk-status-warning-soft); border: 1px solid var(--ktk-gold300);
    border-left: 3px solid var(--ktk-orange500); border-radius: 0 var(--radius) var(--radius) 0;
    padding: 11px 15px; font-size: 12.5px; color: var(--text-2);
    line-height: 1.55; margin-bottom: 16px;
}
.note-inline strong { color: var(--ktk-status-warning-strong); }

/* recorded / adjusted */
.view-toggle {
    display: inline-flex; background: var(--bg-cool);
    border: 1px solid var(--border); border-radius: var(--radius-pill);
    padding: 3px; gap: 2px; flex: none;
}
.vt-btn {
    font-family: var(--font-display); font-size: 12.5px; font-weight: var(--ktk-weight-medium);
    color: var(--text-3); background: none; border: none;
    border-radius: var(--radius-pill); padding: 5px 14px;
    cursor: pointer; white-space: nowrap;
}
.vt-btn:hover { color: var(--text-1); }
.vt-btn.active { background: var(--white); color: var(--text-1); box-shadow: var(--shadow); }

.adjust-note {
    background: var(--ktk-status-warning-soft); border: 1px solid var(--ktk-gold300);
    border-left: 3px solid var(--ktk-orange500); border-radius: 0 var(--radius) var(--radius) 0;
    padding: 12px 15px; font-size: 12.5px; color: var(--text-2);
    line-height: 1.55; margin-bottom: 14px;
}
.adjust-note strong { color: var(--ktk-status-warning-strong); }
.adjust-note[hidden] { display: none; }

/* the proportion bar */
.attrib-bar {
    display: flex; height: 30px; border-radius: var(--radius);
    overflow: hidden; border: 1px solid var(--border); margin-bottom: 16px;
}
.attrib-seg { min-width: 3px; cursor: pointer; transition: opacity .14s ease; }
.attrib-seg:hover { opacity: .82; }
.attrib-seg.dim { opacity: .26; }
.attrib-seg:focus-visible { outline: 2px solid var(--navy-0); outline-offset: 2px; }

.attrib-member         { background: var(--ktk-neutral-tinted500); }
.attrib-transportation { background: var(--ktk-status-danger-base); }
.attrib-facility       { background: var(--ktk-aqua700); }
.attrib-authorization  { background: var(--ktk-orange500); }
.attrib-unknown        { background: var(--ktk-neutral-tinted400); }
.attrib-misattributed  { background: var(--ktk-status-warning-base); }

.attrib-legend {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
}
.attrib-item {
    display: flex; gap: 9px; align-items: flex-start;
    padding: 9px 11px; border-radius: var(--radius);
    border: 1px solid transparent; cursor: pointer;
    transition: background .12s ease, border-color .12s ease;
}
.attrib-item:hover { background: var(--bg-cool); }
.attrib-item.picked { background: var(--purple-light); border-color: var(--purple-mid); }
.attrib-item:focus-visible { outline: 2px solid var(--purple); outline-offset: 1px; }
.attrib-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; margin-top: 5px; }
.attrib-name {
    font-family: var(--font-display); font-weight: var(--ktk-weight-medium); font-size: 12.5px;
    color: var(--text-1);
}
.attrib-num {
    font-family: var(--font-display); font-weight: var(--ktk-weight-medium); font-size: 17px;
    color: var(--navy-0); line-height: 1.25; font-variant-numeric: tabular-nums;
}
.attrib-num span { font-weight: 500; font-size: 11.5px; color: var(--text-4); }
.attrib-why { font-size: 11.5px; color: var(--text-4); line-height: 1.45; margin-top: 2px; }

/* clicking to filter */
.filter-bar {
    display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
    background: var(--purple-light); border: 1px solid var(--purple-mid);
    border-radius: var(--radius); padding: 9px 13px; margin-bottom: 14px;
}
.filter-bar[hidden] { display: none; }
.filter-label {
    font-size: 10.5px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--purple-dark);
}
#filter-chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
    font-family: inherit; font-size: 12px; font-weight: 600;
    background: var(--white); color: var(--text-1);
    border: 1px solid var(--purple-mid); border-radius: var(--radius-tiny);
    padding: 3px 9px; cursor: pointer;
}
.filter-chip span { color: var(--text-4); margin-left: 3px; }
.filter-chip:hover { border-color: var(--purple); }
.filter-clear {
    font-family: inherit; font-size: 12px; font-weight: 600;
    background: none; border: none; color: var(--purple-dark);
    cursor: pointer; text-decoration: underline; margin-left: auto;
}

tr.pickable { cursor: pointer; }
tr.pickable:hover td { background: var(--bg-cool); }
tr.pickable.picked td { background: var(--purple-light); }
td.empty { text-align: center; color: var(--text-4); padding: 22px 0; font-style: italic; }

.row-link {
    display: inline-block; color: var(--text-4); text-decoration: none;
    font-weight: 700; padding: 0 5px; border-radius: var(--radius-tiny);
    transition: color .12s ease, background .12s ease;
}
.row-link:hover { color: var(--purple); background: var(--purple-light); }
.row-link.inline { margin-left: 5px; font-size: .85em; }
.unexp { font-weight: 700; color: var(--ktk-yellow700); }

@media (prefers-reduced-motion: reduce) {
    .attrib-seg, .attrib-item, tr.pickable, .row-link { transition: none; }
}

/* ---------- missed care: monthly trend ---------- */
.trend {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    gap: 10px; align-items: end; height: 150px; margin-bottom: 14px;
}
.tr-col { display: flex; flex-direction: column; height: 100%; }
.tr-bars { flex: 1; display: flex; align-items: flex-end; }
.tr-stack {
    width: 100%; background: var(--purple-mid);
    border-radius: var(--radius-tiny) var(--radius-tiny) 0 0;
    display: flex; align-items: flex-end; position: relative;
    transition: opacity .13s ease;
}
.tr-col:hover .tr-stack { opacity: .82; }
.tr-missed {
    width: 100%; background: var(--purple);
    border-radius: var(--radius-tiny) var(--radius-tiny) 0 0;
}
.tr-now .tr-stack { background: var(--ktk-brand100); }
.tr-now .tr-missed { background: var(--navy-0); }
.tr-rate {
    font-family: var(--font-display); font-size: 12px; font-weight: var(--ktk-weight-medium);
    color: var(--text-1); text-align: center; margin-top: 7px;
    font-variant-numeric: tabular-nums;
}
.tr-mth { font-size: 11px; color: var(--text-4); text-align: center; margin-top: 1px; }
.tr-now .tr-mth { color: var(--purple-dark); font-weight: 700; }

.trend-legend {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    font-size: 12px; color: var(--text-3);
}
.trend-legend .sw {
    display: inline-block; width: 10px; height: 10px;
    border-radius: 3px; margin-right: 5px; vertical-align: -1px;
}
.sw-all  { background: var(--purple-mid); }
.sw-miss { background: var(--purple); }
.trend-note {
    margin-left: auto; color: var(--text-4); font-size: 11.5px;
    max-width: 52ch; line-height: 1.5;
}
.trend-note b { color: var(--text-1); font-weight: 700; }

/* ---------- missed care: reason bars ---------- */
.minibar {
    height: 6px; background: var(--bg-cool);
    border-radius: var(--radius-pill); overflow: hidden;
}
.minibar-f {
    height: 100%; background: var(--purple);
    border-radius: var(--radius-pill);
}
@media (prefers-reduced-motion: reduce) { .tr-stack { transition: none; } }

/* ---------- missed care: the numbers that actually moved ---------- */
.movers {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px; margin-top: 18px; padding-top: 16px;
    border-top: 1px solid var(--border-soft);
}
.mv-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 10px; margin-bottom: 8px;
}
.mv-l { font-size: 12px; font-weight: 600; color: var(--text-2); }
.mv-delta {
    font-size: 12px; color: var(--text-4);
    font-variant-numeric: tabular-nums; white-space: nowrap;
}
.mv-delta b { font-family: var(--font-display); font-size: 14px; color: var(--text-1); }
.mv-delta em {
    font-style: normal; font-weight: 700; font-size: 11px;
    margin-left: 5px; padding: 1.5px 6px; border-radius: var(--radius-pill);
    background: var(--bg-cool); color: var(--text-3);
}
.mv-delta.up em { background: var(--ktk-status-danger-soft); color: var(--ktk-coral700); }
.mv-bars {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    gap: 5px; height: 40px; align-items: end;
}
.mv-col { height: 100%; display: flex; align-items: flex-end; }
.mv-f {
    width: 100%; border-radius: 2px 2px 0 0; min-height: 2px;
    transition: opacity .13s ease;
}
.mv-col:hover .mv-f { opacity: .75; }
.mv-red  { background: var(--ktk-status-danger-base); }
.mv-grey { background: var(--ktk-neutral-tinted500); }
@media (prefers-reduced-motion: reduce) { .mv-f { transition: none; } }

/* ---------- missed care: when it breaks down ---------- */
.heat {
    display: grid;
    grid-template-columns: 44px repeat(4, 1fr);
    gap: 4px;
}
.heat-corner { }
.heat-ch {
    font-size: 10.5px; font-weight: 600; color: var(--text-4);
    text-align: center; padding-bottom: 3px;
}
.heat-rh {
    font-size: 11.5px; font-weight: 600; color: var(--text-3);
    display: flex; align-items: center;
}
.heat-c {
    height: 34px; border-radius: var(--radius-tiny);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-size: 11.5px; font-weight: var(--ktk-weight-medium);
    color: var(--text-1); font-variant-numeric: tabular-nums;
    cursor: default; transition: transform .12s ease;
}
.heat-c:hover { transform: scale(1.05); }
.heat-c .on-dark { color: #fff; }
.heat-empty { background: var(--bg-cool); }

.sec-note {
    font-size: 12px; color: var(--text-3); line-height: 1.55;
    margin: 13px 0 0; max-width: 60ch;
}
.sec-note strong { color: var(--text-1); font-weight: 600; }

/* ---------- missed care: booking notice ---------- */
.lead-chart { display: flex; flex-direction: column; gap: 9px; }
.ld-row {
    display: grid; grid-template-columns: 82px 1fr 46px 58px;
    align-items: center; gap: 10px;
}
.ld-l { font-size: 12px; color: var(--text-2); }
.ld-track {
    height: 16px; background: var(--bg-cool);
    border-radius: var(--radius-tiny); overflow: hidden;
}
.ld-f {
    display: block; height: 100%; background: var(--purple);
    border-radius: var(--radius-tiny);
}
.ld-v {
    font-family: var(--font-display); font-size: 12.5px; font-weight: var(--ktk-weight-medium);
    color: var(--text-1); text-align: right; font-variant-numeric: tabular-nums;
}
.ld-n {
    font-size: 11px; color: var(--text-4); text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ---------- missed care: concentration ---------- */
.conc {
    display: grid; grid-template-columns: minmax(200px, 300px) 1fr;
    gap: 26px; align-items: center;
}
@media (max-width: 760px) { .conc { grid-template-columns: 1fr; } }
.conc-n {
    font-family: var(--font-display); font-size: 46px; font-weight: var(--ktk-weight-medium);
    letter-spacing: -0.04em; color: var(--navy-0); line-height: 1;
}
.conc-l {
    font-family: var(--font-display); font-size: 13.5px; font-weight: var(--ktk-weight-medium);
    color: var(--text-1); margin-top: 4px;
}
.conc-s { font-size: 12px; color: var(--text-3); line-height: 1.55; margin-top: 6px; }
.conc-s b { color: var(--text-1); font-weight: 700; }
.conc-bars {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    gap: 6px; height: 92px; align-items: end;
}
.cc-col { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.cc-f {
    background: var(--purple-mid); border-radius: 3px 3px 0 0; min-height: 2px;
    transition: opacity .12s ease;
}
.cc-top { background: var(--purple); }
.cc-col:hover .cc-f { opacity: .75; }
.cc-x {
    font-size: 10px; color: var(--text-4); text-align: center; margin-top: 5px;
}
@media (prefers-reduced-motion: reduce) {
    .heat-c:hover { transform: none; }
    .cc-f, .heat-c { transition: none; }
}

/* ---------- page tabs ---------- */
.tabs {
    display: flex; gap: 4px; margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
}
.tab {
    position: relative;
    font-family: var(--font-display); font-size: 13.5px; font-weight: var(--ktk-weight-medium);
    color: var(--text-3); background: none; border: none;
    padding: 9px 15px 11px; cursor: pointer;
    display: inline-flex; align-items: baseline; gap: 8px;
    border-radius: var(--radius) var(--radius) 0 0;
    transition: color .13s ease, background .13s ease;
}
.tab:hover { color: var(--text-1); background: var(--bg-cool); }
.tab:focus-visible { outline: 2px solid var(--purple); outline-offset: -2px; }
.tab.active { color: var(--navy-0); font-weight: 700; }
.tab.active::after {
    content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px;
    height: 2px; background: var(--purple); border-radius: 2px 2px 0 0;
}
.tab-note {
    font-family: var(--font); font-size: 10.5px; font-weight: 500;
    color: var(--text-4); padding: 2px 7px; border-radius: var(--radius-pill);
    background: var(--bg-cool);
}
.tab.active .tab-note { background: var(--purple-light); color: var(--purple-dark); }
.panel-tab[hidden] { display: none; }
.filter-bar.off-tab { opacity: .45; }
@media (prefers-reduced-motion: reduce) { .tab { transition: none; } }

/* headings vanish when the rail is collapsed, so the groups need the rule */
.sb-mini .sb-section + .sb-section { margin-top: 8px; padding-top: 10px; }

/* ---------- missed care: did they come back ---------- */
.rec {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}
.rec-card {
    padding: 18px 20px; border-radius: var(--radius-md);
    border: 1px solid var(--border); background: var(--white);
    border-left-width: 3px;
}
.rec-ok   { border-left-color: var(--ktk-status-success-strong); }
.rec-warn { border-left-color: var(--ktk-orange500); }
.rec-bad  { border-left-color: var(--ktk-status-danger-base); }
.rec-n {
    font-family: var(--font-display); font-size: 34px; font-weight: var(--ktk-weight-medium);
    letter-spacing: -0.035em; line-height: 1; color: var(--navy-0);
    font-variant-numeric: tabular-nums;
}
.rec-ok .rec-n   { color: var(--ktk-status-success-strong); }
.rec-warn .rec-n { color: var(--ktk-yellow700); }
.rec-bad .rec-n  { color: var(--ktk-coral700); }
.rec-l {
    font-family: var(--font-display); font-size: 13.5px; font-weight: var(--ktk-weight-medium);
    color: var(--text-1); margin-top: 6px;
}
.rec-s { font-size: 11.5px; color: var(--text-4); line-height: 1.5; margin-top: 3px; }

.never {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--ktk-coral700);
    background: var(--ktk-status-danger-soft); padding: 2.5px 7px; border-radius: var(--radius-pill);
}

/* ============================================================
   Sign in
   The sunset is built in CSS rather than shipped as an image:
   no extra asset, no request, and it scales to any viewport
   without the banding a stretched JPEG would show.
   ============================================================ */
.lg-body {
    margin: 0; min-height: 100vh;
    font-family: var(--font);
    display: flex; align-items: center; justify-content: center;
    padding: 40px 20px;
    position: relative;
    background: #EEF0F6;
}
.lg-sky {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background-image: url("../kinetik-assets/backgrounds/login-sky.jpg");
    background-size: cover;
    background-position: center 42%;
    background-repeat: no-repeat;
}
/* Painted behind the photo, so a missing or slow asset still reads as the
   same sky rather than a flat grey box. */
.lg-body::before {
    content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background: linear-gradient(174deg,
        #8f88cf 0%, #a29ad9 14%, #bcaedd 30%,
        #e3c3c9 46%, #f6d3b4 58%, #f3d7cd 70%,
        #e6e3f0 84%, #eef1f7 100%);
}

.lg-wrap {
    position: relative; z-index: 1;
    width: 100%; max-width: 560px;
    display: flex; flex-direction: column; align-items: center; gap: 26px;
}

.lg-card {
    width: 100%;
    background: #fff;
    border-radius: 6px;
    padding: 44px 52px 38px;
    box-shadow: 0 2px 5px rgba(40,38,80,.06), 0 26px 60px -20px rgba(40,38,80,.28);
    text-align: center;
}
@media (max-width: 560px) { .lg-card { padding: 34px 26px 30px; } }

.lg-brand {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    margin-bottom: 30px;
}
.lg-mark { height: 34px; width: auto; }
.lg-word {
    font-family: var(--font-display);
    font-size: 34px; font-weight: var(--ktk-weight-medium); letter-spacing: -0.035em;
    color: #111014;
}

.lg-h1 {
    font-family: var(--font-display);
    font-size: 25px; font-weight: var(--ktk-weight-medium); letter-spacing: -0.02em;
    color: #14131a; margin: 0 0 9px; line-height: 1.25;
}
.lg-sub { font-size: 15px; color: #6B6F77; margin: 0 0 28px; }

.lg-err {
    background: #FDECEC; border: 1px solid #F5C2C2;
    color: #9B1C1C; border-radius: 6px;
    padding: 10px 14px; font-size: 13.5px;
    margin-bottom: 18px; text-align: left;
}

/* floating-label field, matching the Atlas outline treatment */
.lg-field { position: relative; margin-bottom: 16px; text-align: left; }
.lg-in {
    width: 100%; height: 62px;
    padding: 20px 50px 6px 18px;
    font-family: inherit; font-size: 16px; color: #14131a;
    background: #fff;
    border: 1px solid #55535E; border-radius: 4px;
    outline: none;
    transition: border-color .13s ease, box-shadow .13s ease;
}
.lg-in:hover { border-color: #2E2C36; }
.lg-in:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(91,98,231,.16); }
.lg-lab {
    position: absolute; left: 19px; top: 21px;
    font-size: 16px; color: #6B6F77;
    pointer-events: none;
    transition: transform .13s ease, font-size .13s ease, color .13s ease;
    transform-origin: left top;
}
.lg-lab span { color: #6B6F77; }
.lg-in:focus + .lg-lab,
.lg-in:not(:placeholder-shown) + .lg-lab {
    transform: translateY(-13px) scale(.72);
    color: #6B6F77;
}
.lg-in:focus + .lg-lab { color: var(--purple); }

.lg-ic {
    position: absolute; right: 15px; top: 50%; transform: translateY(-50%);
    color: #4A4A52; background: none; border: none; padding: 0;
    display: flex; align-items: center;
}
.lg-peek { cursor: pointer; }
.lg-peek:hover { color: #14131a; }
.lg-peek.on { color: var(--purple); }
.lg-peek:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; border-radius: 3px; }

.lg-btn {
    width: 100%; height: 56px; margin-top: 12px;
    font-family: inherit; font-size: 16px; font-weight: 500;
    border: none; border-radius: 4px;
    background: #C9C9CE; color: #5A5A63;
    cursor: not-allowed;
    transition: background .14s ease, color .14s ease;
}
.lg-btn:not(:disabled) {
    background: var(--navy-0); color: #fff; cursor: pointer;
}
.lg-btn:not(:disabled):hover { background: var(--purple); }
.lg-btn:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }

.lg-help { font-size: 14.5px; color: #4A4A52; margin: 26px 0 0; }
.lg-help a { color: var(--purple); font-weight: 500; text-decoration: none; }
.lg-help a:hover { text-decoration: underline; }

.lg-legal { display: flex; align-items: center; gap: 14px; margin: 0; font-size: 14px; }
.lg-legal a { color: #4B52D2; text-decoration: none; }
.lg-legal a:hover { text-decoration: underline; }
.lg-dot { color: #6B6F77; }

@media (prefers-reduced-motion: reduce) {
    .lg-in, .lg-lab, .lg-btn { transition: none; }
}

/* ============================================================
   Access / user management
   ============================================================ */
.issued {
    background: var(--green-bg); border: 1px solid var(--ktk-green300);
    border-left: 3px solid var(--green-text);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 16px 18px; margin-bottom: 18px;
}
.issued-h {
    font-family: var(--font-display); font-size: 12px; font-weight: var(--ktk-weight-medium);
    text-transform: uppercase; letter-spacing: .06em; color: var(--green-text);
    margin-bottom: 8px;
}
.issued-pw {
    display: inline-block; font-family: ui-monospace, Menlo, monospace;
    font-size: 17px; font-weight: 600; color: var(--text-1);
    background: var(--white); border: 1px solid var(--ktk-green300);
    border-radius: var(--radius); padding: 8px 14px; user-select: all;
}
.issued-s { font-size: 12.5px; color: var(--text-2); margin: 10px 0 0; max-width: 62ch; line-height: 1.55; }

.add-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.add-in {
    flex: 1 1 260px; min-width: 0;
    font-family: inherit; font-size: 14px; padding: 9px 13px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--white); color: var(--text-1);
}
.add-in:focus { outline: none; border-color: var(--purple); box-shadow: var(--focus-ring); }
.select-sm { font-size: 12.5px; padding: 4px 8px; }

.btn-primary {
    font-family: var(--font-display); font-size: 13.5px; font-weight: var(--ktk-weight-medium);
    background: var(--navy-0); color: #fff; border: none;
    border-radius: var(--radius); padding: 10px 20px; cursor: pointer;
    text-decoration: none; display: inline-block;
}
.btn-primary:hover { background: var(--purple); }
.btn-quiet {
    font-family: inherit; font-size: 12.5px; font-weight: 500;
    background: none; border: 1px solid var(--border);
    border-radius: var(--radius); padding: 5px 10px;
    color: var(--text-2); cursor: pointer; margin-left: 6px;
}
.btn-quiet:hover { border-color: var(--purple); color: var(--purple); }
.btn-danger:hover { border-color: var(--red); color: var(--red); }

tr.row-off td { opacity: .55; }
.you, .off, .meth {
    font-size: 10px; font-weight: 700; letter-spacing: .05em;
    text-transform: uppercase; padding: 2px 6px;
    border-radius: var(--radius-tiny); margin-left: 6px;
}
.you  { background: var(--purple-light); color: var(--purple-dark); }
.off  { background: var(--red-bg); color: var(--red-text); }
.meth { background: var(--bg-cool); color: var(--text-3); margin-left: 0; }
.meth-sso  { background: var(--teal-bg); color: var(--teal-text); }
.meth-warn { background: var(--yellow-bg); color: var(--yellow-text); margin-left: 5px; }
td.dim { color: var(--text-4); font-size: 12.5px; }
td.nowrap, .nowrap { white-space: nowrap; }
.by { color: var(--text-4); font-size: 11.5px; }

/* topbar identity */
.who { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.who-em { font-size: 12px; color: var(--text-2); font-weight: 500; }
.who-out { font-size: 11.5px; color: var(--purple); text-decoration: none; }
.who-out:hover { text-decoration: underline; }

/* what a role actually grants, shown inline so it isn't a mystery */
.perm-list { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; max-width: 210px; }
.perm {
    font-family: ui-monospace, Menlo, monospace; font-size: 9.5px;
    background: var(--bg-cool); color: var(--text-3);
    border: 1px solid var(--border-soft);
    padding: 1px 5px; border-radius: 3px; white-space: nowrap;
}

/* ==========================================================================
   OUTREACH QUEUE — TRIAGE LANES
   Replaces the priority column, which sorted nothing (90% of the queue came
   back HIGH). Each lane states its rule on the page so a care manager can see
   why somebody is in front of them.
   ========================================================================== */

/* The category keys the warehouse emits, aliased onto the badge palette.
   Only dialysis and cardiac matched before, so SUD / behavioral / oncology /
   wound care were rendering as plain grey badges. */
.badge-clinical.clinical-substance_abuse   { background: var(--ktk-orange100); color: var(--ktk-orange700); border-color: var(--ktk-orange300); }
.badge-clinical.clinical-behavioral_health { background: var(--ktk-violet100); color: var(--ktk-violet700); border-color: var(--ktk-violet300); }
.badge-clinical.clinical-oncology          { background: var(--ktk-pink100); color: var(--ktk-pink700); border-color: var(--ktk-pink300); }
.badge-clinical.clinical-wound_care        { background: var(--ktk-aqua100); color: var(--ktk-aqua700); border-color: var(--ktk-aqua300); }
.badge-clinical.clinical-maternal          { background: var(--ktk-gold100); color: var(--ktk-gold700); border-color: var(--ktk-gold300); }

/* ---------- condition filter bar ---------- */
.lane-filter {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 10px 12px;
    margin-bottom: 16px; box-shadow: var(--shadow);
}
.lane-filter-label {
    display: flex; align-items: center; gap: 6px;
    font-size: .72rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .03em; color: var(--text-4); padding-right: 2px;
}
.lane-chip {
    display: inline-flex; align-items: center; gap: 7px;
    border-radius: var(--radius-pill); padding: 5px 13px;
    font-size: .78rem; font-weight: 600; text-decoration: none;
    background: var(--white); color: var(--text-3);
    border: 1px solid var(--border);
    transition: background .12s, border-color .12s, color .12s;
}
.lane-chip:hover { border-color: var(--purple-mid); color: var(--text-1); }
.lane-chip-n { font-weight: 500; opacity: .65; }
/* An active chip borrows its own condition colour, so the filter and the row
   badges below it read as the same thing. */
.lane-chip.on.clinical-dialysis          { background: var(--ktk-coral100); color: var(--ktk-coral700); border-color: var(--ktk-coral300); }
.lane-chip.on.clinical-substance_abuse   { background: var(--ktk-orange100); color: var(--ktk-orange700); border-color: var(--ktk-orange300); }
.lane-chip.on.clinical-behavioral_health { background: var(--ktk-violet100); color: var(--ktk-violet700); border-color: var(--ktk-violet300); }
.lane-chip.on.clinical-oncology          { background: var(--ktk-pink100); color: var(--ktk-pink700); border-color: var(--ktk-pink300); }
.lane-chip.on.clinical-wound_care        { background: var(--ktk-aqua100); color: var(--ktk-aqua700); border-color: var(--ktk-aqua300); }
.lane-chip.on.clinical-cardiac           { background: var(--ktk-purple100); color: var(--ktk-purple700); border-color: var(--ktk-purple300); }
.lane-chip.on.clinical-maternal          { background: var(--ktk-gold100); color: var(--ktk-gold700); border-color: var(--ktk-gold300); }
.lane-clear {
    margin-left: auto; font-size: .78rem; font-weight: 600;
    color: var(--purple); text-decoration: none;
}
.lane-clear:hover { color: var(--purple-dark); }

.lane-back { margin-bottom: 12px; }
.lane-back a {
    font-size: .82rem; font-weight: 600; color: var(--purple); text-decoration: none;
}
.lane-back a:hover { color: var(--purple-dark); }

/* ---------- a lane ---------- */
.lane {
    background: var(--white); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    overflow: hidden; margin-bottom: 14px;
}
.lane-head {
    display: flex; align-items: center; gap: 11px;
    padding: 13px 16px; border-bottom: 1px solid var(--border);
}
.lane-rail { width: 3px; height: 28px; border-radius: 2px; flex: none; }
.lane-stopped .lane-rail { background: var(--red); }
.lane-falling .lane-rail { background: var(--ktk-orange500); }
.lane-at_risk .lane-rail { background: var(--purple); }
.lane-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lane-title {
    font-family: var(--font-display);
    font-size: .92rem; font-weight: var(--ktk-weight-medium); color: var(--text-1);
}
.lane-rule { font-size: .76rem; color: var(--text-3); }
.lane-count { margin-left: auto; text-align: right; flex: none; }
.lane-count-n {
    font-family: var(--font-display);
    font-size: 1.2rem; font-weight: var(--ktk-weight-medium); line-height: 1;
}
.lane-stopped .lane-count-n { color: var(--red); }
.lane-falling .lane-count-n { color: var(--ktk-orange500); }
.lane-at_risk .lane-count-n { color: var(--purple); }
.lane-count-l { font-size: .68rem; color: var(--text-4); margin-top: 1px; }
.lane-see {
    font-size: .78rem; font-weight: 600; color: var(--purple);
    text-decoration: none; flex: none;
}
.lane-see:hover { color: var(--purple-dark); }

/* ---------- rows ---------- */
.lane-table { border: 0; margin: 0; }
.lane-table tbody tr { cursor: pointer; }
.lane-table td {
    padding: 11px 16px; border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}
.lane-table tbody tr:last-child td { border-bottom: 0; }
.lane-member {
    font-family: var(--font-display);
    font-size: .84rem; font-weight: var(--ktk-weight-medium); color: var(--text-1);
    margin-bottom: 3px;
}
/* The sentence that replaced three columns of badges. */
.lane-why { font-size: .78rem; color: var(--text-2); line-height: 1.45; }
.lane-cond { width: 130px; }
.lane-act  { width: 150px; }
.lane-meta {
    width: 100px; text-align: right;
    font-size: .75rem; color: var(--text-4); white-space: nowrap;
}

.lane-more {
    display: block; padding: 10px 16px; background: var(--bg-cool);
    font-size: .78rem; font-weight: 600; color: var(--text-3); text-decoration: none;
}
.lane-more:hover { color: var(--purple); }
.lane-empty {
    padding: 22px 16px; text-align: center;
    font-size: .82rem; color: var(--text-4); font-style: italic;
}
.lane-foot { font-size: .75rem; color: var(--text-4); margin-top: 14px; }

@media (max-width: 900px) {
    .lane-cond, .lane-act, .lane-meta { display: none; }
    .lane-count-l { display: none; }
}
/* Informational variant of .note-inline. The base style is amber with an
   orange rule, which is right for a warning (users.html uses it for errors)
   but wrong for a note that simply explains how something is counted — in
   front of a client, amber reads as "this page is unreliable". */
.note-inline.note-info {
    background: var(--ktk-status-info-soft);
    border-color: var(--ktk-blue300);
    border-left-color: var(--ktk-blue500);
}
.note-inline.note-info strong { color: var(--ktk-status-info-strong); }
