/* ==========================================================================
   Daacter — "Clinical Clarity"
   Variable-based vanilla CSS. No frameworks.

   Contents
   01 Tokens
   02 Reset & base
   03 Typography
   04 Layout primitives
   05 Buttons & controls
   06 Badges, pills, dots
   07 Cards & surfaces
   08 Voice note (waveform)
   09 Case spine
   10 Site header & footer
   11 Home page sections
   12 App shell (dashboards)
   13 Tables, forms, chart blocks
   14 Micro-feedback states
   15 Responsive
   16 Motion preferences
   ========================================================================== */

/* 01 Tokens ============================================================== */

:root {
  /* --- Core palette (brand) --- */
  --healing-teal:      #0D9488;
  --pristine-white:    #FFFFFF;
  --clinical-slate:    #F1F5F9;
  --charcoal-ink:      #0F172A;
  --secure-gold:       #D97706;

  /* --- Teal ramp --- */
  --teal-900: #134E4A;
  --teal-800: #115E59;
  --teal-700: #0F766E;
  --teal-600: #0D9488;
  --teal-300: #5EEAD4;
  --teal-100: #CCFBF1;
  --teal-050: #F0FDFA;

  /* --- Neutral ramp --- */
  --ink-900: #0F172A;
  --ink-700: #334155;
  --ink-600: #475569;
  --ink-500: #64748B;
  --ink-400: #94A3B8;
  --ink-300: #CBD5E1;
  --ink-200: #E2E8F0;
  --ink-100: #F1F5F9;
  --ink-050: #F8FAFC;

  /* --- Gold ramp (money only) --- */
  --gold-700: #B45309;
  --gold-600: #D97706;
  --gold-200: #FDE68A;
  --gold-050: #FFFBEB;

  /* --- Triage rose (clinical urgency only, used sparingly) --- */
  --rose-700: #9F1239;
  --rose-600: #BE123C;
  --rose-100: #FFE4E6;
  --rose-050: #FFF1F2;

  /* --- Semantic --- */
  --bg:            var(--clinical-slate);
  --surface:       var(--pristine-white);
  --surface-sunk:  var(--ink-050);
  --line:          var(--ink-200);
  --line-soft:     #EDF1F6;
  --text:          var(--charcoal-ink);
  --text-muted:    var(--ink-500);
  --text-dim:      var(--ink-400);
  --accent:        var(--healing-teal);
  --accent-ink:    var(--teal-800);
  --money:         var(--secure-gold);
  --urgent:        var(--rose-600);

  /* --- Type --- */
  --font-display: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-data:    "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  --fs-display: clamp(2.5rem, 5.4vw, 4.25rem);
  --fs-h2:      clamp(1.7rem, 3.1vw, 2.5rem);
  --fs-h3:      clamp(1.15rem, 1.6vw, 1.375rem);
  --fs-lede:    clamp(1.0625rem, 1.35vw, 1.1875rem);
  --fs-body:    1rem;
  --fs-sm:      0.875rem;
  --fs-xs:      0.8125rem;
  --fs-micro:   0.6875rem;

  /* --- Space --- */
  --sp-1: 0.25rem;  --sp-2: 0.5rem;   --sp-3: 0.75rem;
  --sp-4: 1rem;     --sp-5: 1.5rem;   --sp-6: 2rem;
  --sp-7: 3rem;     --sp-8: 4rem;     --sp-9: 6rem;

  /* --- Radius: soft-cornered containers --- */
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   22px;
  --r-pill: 999px;

  /* --- Ambient separation: multi-layered shadows, no heavy borders --- */
  --shadow-1: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.05);
  --shadow-2: 0 1px 2px rgba(15,23,42,.03), 0 4px 10px -2px rgba(15,23,42,.06),
              0 12px 24px -8px rgba(15,23,42,.07);
  --shadow-3: 0 1px 2px rgba(15,23,42,.04), 0 10px 22px -6px rgba(15,23,42,.09),
              0 30px 60px -22px rgba(15,23,42,.16);
  --shadow-teal: 0 1px 2px rgba(13,148,136,.18), 0 8px 20px -6px rgba(13,148,136,.28);
  --shadow-gold: 0 1px 2px rgba(217,119,6,.18), 0 8px 20px -6px rgba(217,119,6,.26);

  --ring: 0 0 0 3px rgba(13,148,136,.28);

  /* --- Motion --- */
  --ease: cubic-bezier(.2,.7,.3,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
  --t-fast: 140ms;
  --t-mid:  240ms;
  --t-slow: 480ms;

  --shell-max: 1220px;
  --rail-w: 248px;
}

/* 02 Reset & base ======================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-data);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

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

ul, ol { margin: 0; padding: 0; list-style: none; }
p { margin: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.skip-link {
  position: absolute; left: var(--sp-4); top: -100px; z-index: 200;
  background: var(--surface); color: var(--accent-ink);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  box-shadow: var(--shadow-2); font-weight: 600;
  transition: top var(--t-fast) var(--ease);
}
.skip-link:focus { top: var(--sp-4); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 03 Typography ========================================================== */

h1, h2, h3, h4, .display, .brand-name, .nav-link, .btn, .eyebrow, .tab {
  font-family: var(--font-display);
}

h1, h2, h3, h4 { margin: 0; color: var(--text); letter-spacing: -0.02em; }

h1, .display {
  font-size: var(--fs-display);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.038em;
}

h2 { font-size: var(--fs-h2); font-weight: 700; line-height: 1.1; letter-spacing: -0.03em; }
h3 { font-size: var(--fs-h3); font-weight: 700; line-height: 1.25; }
h4 { font-size: var(--fs-body); font-weight: 700; line-height: 1.35; }

.eyebrow {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-data);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--sp-4);
}
.eyebrow::before {
  content: ""; width: 18px; height: 2px; border-radius: 2px;
  background: currentColor; opacity: .55;
}
.eyebrow--gold { color: var(--gold-700); }

.lede {
  font-size: var(--fs-lede);
  line-height: 1.62;
  color: var(--ink-600);
  max-width: 54ch;
}

.hl { color: var(--accent); }
.hl-gold { color: var(--gold-600); }

/* Data type: tabular, tight, unmistakable */
.num, .money, .dose, .stamp, .metric {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "cv05" 1;
  letter-spacing: -0.01em;
}
.stamp { font-size: var(--fs-xs); color: var(--text-dim); }
.money { font-weight: 600; }

.muted { color: var(--text-muted); }
.dim   { color: var(--text-dim); }
.small { font-size: var(--fs-sm); }
.micro {
  font-size: var(--fs-micro); font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim);
}

/* 04 Layout primitives =================================================== */

.container { width: 100%; max-width: var(--shell-max); margin-inline: auto; padding-inline: var(--sp-5); }
.container--narrow { max-width: 860px; }

.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }
.section--tight { padding-block: clamp(2.5rem, 5vw, 4rem); }
.section--white { background: var(--surface); }
.section--slate { background: var(--clinical-slate); }
.section--ink { background: var(--ink-900); color: #E2E8F0; }

.section-head { max-width: 62ch; margin-bottom: var(--sp-7); }
.section-head p { margin-top: var(--sp-4); }

.stack > * + * { margin-top: var(--sp-4); }
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* 05 Buttons & controls ================================================== */

.btn {
  --btn-bg: var(--accent);
  --btn-fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 0.72rem 1.15rem;
  border: 0; border-radius: var(--r-md);
  background: var(--btn-bg); color: var(--btn-fg);
  font-size: var(--fs-sm); font-weight: 700; letter-spacing: -0.01em;
  box-shadow: var(--shadow-teal);
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--teal-700); color: #fff; transform: translateY(-1px); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-1); }
.btn[disabled] { opacity: .5; pointer-events: none; }

.btn--lg { padding: 0.9rem 1.5rem; font-size: var(--fs-body); border-radius: var(--r-lg); }
.btn--sm { padding: 0.45rem 0.8rem; font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn--full { width: 100%; }

.btn--ghost {
  --btn-bg: transparent; --btn-fg: var(--ink-700);
  box-shadow: inset 0 0 0 1px var(--line);
}
.btn--ghost:hover { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--ink-300), var(--shadow-1); }

.btn--quiet {
  --btn-bg: var(--ink-100); --btn-fg: var(--ink-700);
  box-shadow: none;
}
.btn--quiet:hover { background: var(--ink-200); color: var(--text); }

.btn--gold { --btn-bg: var(--gold-600); box-shadow: var(--shadow-gold); }
.btn--gold:hover { background: var(--gold-700); }

.btn--onink {
  --btn-bg: var(--pristine-white); --btn-fg: var(--ink-900);
  box-shadow: 0 8px 24px -8px rgba(0,0,0,.6);
}
.btn--onink:hover { background: var(--teal-100); color: var(--teal-900); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; flex: 0 0 36px;
  border: 0; border-radius: var(--r-md);
  background: var(--ink-100); color: var(--ink-600);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.icon-btn:hover { background: var(--teal-100); color: var(--teal-800); }
.icon-btn svg { width: 17px; height: 17px; }

/* 06 Badges, pills, dots ================================================= */

.badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.22rem 0.6rem 0.24rem;
  border-radius: var(--r-pill);
  background: var(--ink-100); color: var(--ink-600);
  font-family: var(--font-data);
  font-size: var(--fs-micro); font-weight: 650; letter-spacing: .04em;
  text-transform: uppercase; white-space: nowrap;
}
.badge--teal  { background: var(--teal-100);  color: var(--teal-800); }
.badge--gold  { background: var(--gold-050);  color: var(--gold-700); box-shadow: inset 0 0 0 1px var(--gold-200); }
.badge--rose  { background: var(--rose-050);  color: var(--rose-700); }
.badge--ink   { background: var(--ink-900);   color: #CBD5E1; }
.badge--outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-600); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-300); flex: 0 0 7px; }
.dot--teal { background: var(--teal-600); }
.dot--gold { background: var(--gold-600); }
.dot--urgent { background: var(--urgent); box-shadow: 0 0 0 3px var(--rose-100); }
.dot--live { background: var(--teal-600); animation: pulse-dot 2.2s var(--ease) infinite; }

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(13,148,136,.34); }
  50%      { box-shadow: 0 0 0 6px rgba(13,148,136,0); }
}

.avatar {
  display: grid; place-items: center;
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: var(--r-md);
  background: var(--teal-100); color: var(--teal-800);
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm);
  letter-spacing: -0.01em;
}
.avatar--sm { width: 30px; height: 30px; flex-basis: 30px; font-size: var(--fs-xs); border-radius: var(--r-sm); }
.avatar--lg { width: 52px; height: 52px; flex-basis: 52px; font-size: var(--fs-body); border-radius: var(--r-lg); }
.avatar--gold { background: var(--gold-050); color: var(--gold-700); }
.avatar--ink  { background: var(--ink-900); color: var(--teal-300); }

/* 07 Cards & surfaces ==================================================== */

.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  padding: var(--sp-5);
}
.card--flat { box-shadow: var(--shadow-1); }
.card--lift { box-shadow: var(--shadow-3); }
.card--sunk { background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line-soft); }
.card--pad-lg { padding: var(--sp-6); }
.card--pad-sm { padding: var(--sp-4); }

.card-head {
  display: flex; align-items: center; gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.card-head h3, .card-head h4 { margin: 0; }

.divider { height: 1px; background: var(--line-soft); border: 0; margin-block: var(--sp-4); }

/* 08 Voice note (waveform) ==============================================
   The signature component. Every case carries a deterministic "voiceprint"
   generated from its case ID, so the same note looks the same everywhere.
   ====================================================================== */

.voicenote {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--teal-050);
  box-shadow: inset 0 0 0 1px rgba(13,148,136,.14);
  transition: box-shadow var(--t-mid) var(--ease), background var(--t-mid) var(--ease);
}
.voicenote.is-playing {
  background: var(--pristine-white);
  box-shadow: inset 0 0 0 1px rgba(13,148,136,.28), var(--shadow-2);
}
.voicenote--bare { background: transparent; box-shadow: none; padding: 0; }
.voicenote--ink {
  background: rgba(255,255,255,.06);
  box-shadow: inset 0 0 0 1px rgba(94,234,212,.22);
}

.vn-play {
  display: grid; place-items: center;
  width: 42px; height: 42px; flex: 0 0 42px;
  border: 0; border-radius: var(--r-md);
  background: var(--accent); color: #fff;
  box-shadow: var(--shadow-teal);
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.vn-play:hover { background: var(--teal-700); transform: scale(1.04); }
.vn-play:active { transform: scale(.97); }
.vn-play svg { width: 15px; height: 15px; }
.vn-play .ico-pause { display: none; }
.voicenote.is-playing .vn-play .ico-play { display: none; }
.voicenote.is-playing .vn-play .ico-pause { display: block; }

.vn-body { flex: 1; min-width: 0; }

.vn-wave {
  display: flex; align-items: center; justify-content: space-between; gap: 3px;
  height: 36px; width: 100%;
  cursor: pointer;
  padding-block: 2px;
}
.vn-bar {
  flex: 1 1 auto; min-width: 3px; max-width: 7px;
  border-radius: 2px;
  background: var(--teal-100);
  transform-origin: center;
  transition: background var(--t-fast) linear, transform var(--t-fast) var(--ease);
}
.vn-bar.is-played { background: var(--accent); }
.vn-bar.is-cursor {
  background: var(--teal-800);
  animation: vn-pulse .62s var(--ease) infinite;
}
.voicenote--ink .vn-bar { background: rgba(94,234,212,.24); }
.voicenote--ink .vn-bar.is-played { background: var(--teal-300); }
.voicenote--ink .vn-bar.is-cursor { background: #fff; }

@keyframes vn-pulse {
  0%, 100% { transform: scaleY(1); }
  50%      { transform: scaleY(1.42); }
}

.vn-meta {
  display: flex; align-items: center; gap: var(--sp-3);
  margin-top: 2px;
  font-size: var(--fs-micro);
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}
.vn-meta .vn-total { margin-left: auto; }
.voicenote--ink .vn-meta { color: rgba(226,232,240,.62); }

.vn-speed {
  border: 0; border-radius: var(--r-pill);
  padding: 0.1rem 0.5rem;
  background: rgba(13,148,136,.1); color: var(--teal-800);
  font-size: var(--fs-micro); font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: background var(--t-fast) var(--ease);
}
.vn-speed:hover { background: rgba(13,148,136,.2); }
.voicenote--ink .vn-speed { background: rgba(94,234,212,.16); color: var(--teal-300); }

/* Recorder variant — patient side */
.recorder {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-2);
}
.rec-btn {
  display: grid; place-items: center;
  width: 56px; height: 56px; flex: 0 0 56px;
  border: 0; border-radius: var(--r-lg);
  background: var(--accent); color: #fff;
  box-shadow: var(--shadow-teal);
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.rec-btn svg { width: 20px; height: 20px; }
.rec-btn:hover { transform: scale(1.03); }
.recorder.is-recording .rec-btn { background: var(--urgent); box-shadow: 0 0 0 0 rgba(190,18,60,.4); animation: rec-glow 1.6s var(--ease) infinite; }
@keyframes rec-glow {
  0%,100% { box-shadow: 0 0 0 0 rgba(190,18,60,.36); }
  50%     { box-shadow: 0 0 0 9px rgba(190,18,60,0); }
}
.rec-live { display: flex; align-items: center; justify-content: space-between; gap: 3px; height: 40px; flex: 1; }
.rec-live span {
  flex: 1; max-width: 7px; border-radius: 2px;
  background: var(--ink-200); height: 10%;
  transition: height 90ms linear, background 200ms linear;
}
.recorder.is-recording .rec-live span { background: var(--teal-300); }

/* 09 Case spine =========================================================
   Stages marked in ELAPSED TIME, not step numbers — an async case is
   measured in minutes, and the timestamps are the information.
   ====================================================================== */

.spine { position: relative; }

.spine-step {
  position: relative;
  display: grid;
  grid-template-columns: 54px 20px 1fr;
  align-items: start;
  gap: var(--sp-3);
  padding-block: var(--sp-3);
}
.spine-step::before {
  content: "";
  position: absolute;
  left: calc(54px + var(--sp-3) + 9px);
  top: calc(var(--sp-3) + 16px);
  bottom: calc(-1 * var(--sp-3));
  width: 2px;
  background: var(--line);
  border-radius: 2px;
}
.spine-step:last-child::before { display: none; }
.spine-step.is-done::before { background: var(--teal-100); }

.spine-t {
  font-family: var(--font-data);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-dim);
  text-align: right;
  padding-top: 1px;
  letter-spacing: -0.01em;
}
.spine-step.is-done .spine-t { color: var(--teal-700); }
.spine-step.is-money .spine-t { color: var(--gold-700); }

.spine-dot {
  position: relative; z-index: 1;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--pristine-white);
  box-shadow: inset 0 0 0 2px var(--line);
  display: grid; place-items: center;
  margin-top: 1px;
}
.spine-dot::after {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-300);
  transition: background var(--t-mid) var(--ease), transform var(--t-mid) var(--ease-out);
}
.spine-step.is-done .spine-dot { box-shadow: inset 0 0 0 2px var(--teal-300); }
.spine-step.is-done .spine-dot::after { background: var(--teal-600); }
.spine-step.is-money.is-done .spine-dot { box-shadow: inset 0 0 0 2px var(--gold-200); }
.spine-step.is-money.is-done .spine-dot::after { background: var(--gold-600); }
.spine-step.is-active .spine-dot::after { transform: scale(1.25); animation: pulse-dot 2s var(--ease) infinite; }

.spine-body { min-width: 0; }
.spine-label {
  display: block;
  font-family: var(--font-display);
  font-weight: 700; font-size: var(--fs-sm);
  color: var(--ink-400);
  letter-spacing: -0.01em;
  transition: color var(--t-slow) var(--ease);
}
.spine-step.is-done .spine-label { color: var(--text); }
.spine-who {
  display: block; margin-top: 1px;
  font-size: var(--fs-xs); color: var(--text-muted);
}

/* Horizontal rail variant — used on the home page */
.spine--rail {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-5);
}
.spine--rail .spine-step {
  display: block;
  padding: 0;
  padding-top: var(--sp-6);
}
.spine--rail .spine-step::before {
  content: "";
  left: 0; right: 0; top: 9px; bottom: auto;
  width: auto; height: 2px;
  background: var(--line);
}
.spine--rail .spine-step:last-child::before {
  display: block;
  background: linear-gradient(90deg, var(--teal-100), rgba(204,251,241,0));
}
.spine--rail .spine-dot { position: absolute; top: 0; left: 0; margin: 0; }
.spine--rail .spine-t { text-align: left; display: block; margin-bottom: var(--sp-3); font-size: var(--fs-sm); }
.spine--rail .spine-label { font-size: var(--fs-h3); font-weight: 700; margin-bottom: var(--sp-2); }
.spine--rail .spine-who {
  font-size: var(--fs-micro); font-weight: 650; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: var(--sp-2);
}
.spine--rail .spine-step.is-money .spine-who { color: var(--gold-700); }
.spine--rail .spine-note { display: block; font-size: var(--fs-sm); color: var(--ink-600); line-height: 1.55; }

/* 10 Site header & footer =============================================== */

.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  box-shadow: 0 1px 0 rgba(15,23,42,.06);
}
.site-header .container {
  display: flex; align-items: center; gap: var(--sp-5);
  height: 68px;
}

.brand { display: inline-flex; align-items: center; gap: var(--sp-3); color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 10px;
  background: var(--accent);
  box-shadow: var(--shadow-teal);
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-name {
  font-weight: 800; font-size: 1.125rem; letter-spacing: -0.035em;
}
.brand-sub {
  font-family: var(--font-data);
  font-size: var(--fs-micro); font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim);
  padding-left: var(--sp-3); margin-left: var(--sp-1);
  border-left: 1px solid var(--line);
}

.site-nav { display: flex; align-items: center; gap: var(--sp-1); margin-left: var(--sp-4); }
.nav-link {
  padding: 0.4rem 0.7rem; border-radius: var(--r-sm);
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink-600);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.nav-link:hover { background: var(--ink-100); color: var(--text); }
.nav-link[aria-current="page"] { color: var(--accent-ink); background: var(--teal-050); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-3); }

.site-footer { background: var(--ink-900); color: var(--ink-400); padding-block: var(--sp-8) var(--sp-6); }
.site-footer a { color: var(--ink-300); }
.site-footer a:hover { color: var(--teal-300); }
.footer-grid {
  display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: var(--sp-6);
  padding-bottom: var(--sp-6);
}
.site-footer .brand-name { color: #fff; }
.footer-col h4 {
  color: #fff; font-size: var(--fs-xs); letter-spacing: .1em;
  text-transform: uppercase; margin-bottom: var(--sp-3); font-family: var(--font-data); font-weight: 650;
}
.footer-col li + li { margin-top: var(--sp-2); }
.footer-col a { font-size: var(--fs-sm); }
.footer-base {
  display: flex; flex-wrap: wrap; gap: var(--sp-4); align-items: center;
  padding-top: var(--sp-5);
  border-top: 1px solid rgba(255,255,255,.09);
  font-size: var(--fs-xs);
}

/* 11 Home page sections ================================================= */

/* --- Hero --- */
.hero {
  position: relative;
  background: var(--surface);
  padding-block: clamp(3rem, 6vw, 5.5rem) clamp(3.5rem, 8vw, 6rem);
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute; inset: auto -10% -60% 40%;
  height: 620px;
  background: radial-gradient(60% 50% at 50% 50%, rgba(13,148,136,.09), rgba(13,148,136,0) 70%);
  pointer-events: none;
}
.hero-grid {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
.hero h1 { margin-bottom: var(--sp-5); }
.hero .lede { margin-bottom: var(--sp-6); }

.hero-cta { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-6); }

.hero-proof { display: grid; gap: var(--sp-3); max-width: 46ch; }
.hero-proof li {
  display: grid; grid-template-columns: 18px 1fr; gap: var(--sp-3);
  align-items: start;
  font-size: var(--fs-sm); color: var(--ink-600);
}
.hero-proof svg { width: 18px; height: 18px; color: var(--accent); margin-top: 2px; }
.hero-proof strong { color: var(--text); font-weight: 650; }

/* --- Hero console: a real case card, mid-flight --- */
.console {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  overflow: hidden;
}
.console-bar {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--ink-900);
  color: #fff;
}
.console-bar .case-id {
  font-family: var(--font-data); font-size: var(--fs-micro);
  font-variant-numeric: tabular-nums; letter-spacing: .08em;
  color: var(--teal-300); font-weight: 650;
}
.console-bar .console-title { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm); }
.console-body { padding: var(--sp-5); }
.console-foot {
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface-sunk);
  box-shadow: inset 0 1px 0 var(--line-soft);
}

.patient-line { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.patient-line .who { min-width: 0; }
.patient-line .who strong { display: block; font-family: var(--font-display); font-weight: 700; letter-spacing: -0.015em; }
.patient-line .who span { font-size: var(--fs-xs); color: var(--text-muted); }

.note-quote {
  margin: var(--sp-4) 0;
  padding-left: var(--sp-4);
  border-left: 2px solid var(--teal-100);
  font-size: var(--fs-sm);
  color: var(--ink-600);
  line-height: 1.6;
}
.note-quote em { color: var(--ink-700); font-style: normal; background: var(--teal-050); padding: 0 3px; border-radius: 3px; }

/* --- Rail section (how a case moves) --- */
.rail-wrap { position: relative; }

/* --- Three views --- */
.views-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5);
  align-items: stretch;
}
.view-card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  transition: transform var(--t-mid) var(--ease-out), box-shadow var(--t-mid) var(--ease-out);
}
.view-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-3); }
.view-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4);
  box-shadow: inset 0 -1px 0 var(--line-soft);
}
.view-head .role {
  font-family: var(--font-data); font-size: var(--fs-micro); font-weight: 650;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim);
}
.view-head h3 { font-size: var(--fs-body); }
.view-body {
  padding: var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-3);
  flex: 1;
}
/* Pin each card's action to the bottom so the three CTAs line up */
.view-body > .btn:last-child { margin-top: auto; }

.mini-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--surface-sunk);
  font-size: var(--fs-sm);
}
.mini-row .grow { flex: 1; min-width: 0; }
.mini-row strong { font-weight: 650; }

.rx-strip {
  display: grid; gap: var(--sp-1);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--teal-050);
  box-shadow: inset 0 0 0 1px rgba(13,148,136,.14);
}
.rx-drug { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm); letter-spacing: -0.01em; }
.rx-dose {
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-xs); color: var(--teal-800); font-weight: 550;
}

/* --- Payments (Secure Gold) --- */
.pay-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(2rem, 4vw, 3.5rem); align-items: center;
}
.payout-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  overflow: hidden;
}
.payout-hero {
  padding: var(--sp-5);
  background: linear-gradient(180deg, var(--gold-050), var(--pristine-white));
  box-shadow: inset 0 -1px 0 var(--line-soft);
}
.payout-amount {
  font-family: var(--font-data);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700; letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  color: var(--text); line-height: 1.1;
  margin-block: var(--sp-2) var(--sp-1);
}
.payout-amount .cur { font-size: .5em; font-weight: 650; color: var(--gold-700); vertical-align: 0.42em; margin-right: .18em; letter-spacing: 0; }

.ledger { width: 100%; border-collapse: collapse; }
.ledger th {
  text-align: left; padding: var(--sp-3) var(--sp-4);
  font-family: var(--font-data);
  font-size: var(--fs-micro); font-weight: 650; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-dim);
  box-shadow: inset 0 -1px 0 var(--line-soft);
}
.ledger td {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-sm);
  box-shadow: inset 0 -1px 0 var(--line-soft);
  vertical-align: middle;
}
.ledger tr:last-child td { box-shadow: none; }
.ledger .t-right { text-align: right; }
.ledger .case-ref { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: var(--fs-xs); }
.ledger tbody tr { transition: background var(--t-fast) var(--ease); }
.ledger tbody tr:hover { background: var(--surface-sunk); }

.fee-note {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-4);
  border-radius: var(--r-md);
  background: var(--gold-050);
  box-shadow: inset 0 0 0 1px var(--gold-200);
  font-size: var(--fs-sm); color: var(--gold-700);
}
.fee-note svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 2px; }

/* Clinical alert — rose, never gold. Gold means money on this platform. */
.alert {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-4);
  border-radius: var(--r-md);
  background: var(--rose-050);
  box-shadow: inset 0 0 0 1px var(--rose-100);
  font-size: var(--fs-sm); color: var(--rose-700); line-height: 1.55;
}
.alert svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 2px; }
.alert b { font-weight: 700; }

/* --- Security strip (on ink) --- */
.section--ink h2 { color: #fff; }
.section--ink .lede { color: var(--ink-400); }
.trust-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5); margin-top: var(--sp-6); }
.trust-item {
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  background: rgba(255,255,255,.04);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.trust-item h3 { color: #fff; font-size: var(--fs-body); margin-bottom: var(--sp-2); }
.trust-item p { font-size: var(--fs-sm); color: var(--ink-400); line-height: 1.6; }
.trust-item svg { width: 20px; height: 20px; color: var(--teal-300); margin-bottom: var(--sp-3); }

/* --- Closing CTA --- */
.cta-panel {
  position: relative;
  border-radius: var(--r-xl);
  background: var(--accent);
  color: #fff;
  padding: clamp(2.25rem, 5vw, 3.5rem);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  display: grid; grid-template-columns: 1fr auto; gap: var(--sp-6); align-items: center;
}
.cta-panel::before {
  content: ""; position: absolute; inset: -40% -10% auto auto; width: 460px; height: 460px;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.16), rgba(255,255,255,0) 68%);
  pointer-events: none;
}
.cta-panel h2 { color: #fff; position: relative; }
.cta-panel p { color: rgba(255,255,255,.86); margin-top: var(--sp-3); max-width: 48ch; position: relative; }
.cta-actions { position: relative; display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.cta-panel .btn--ghost { --btn-fg: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.4); }
.cta-panel .btn--ghost:hover { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.6); }

/* 12 App shell (dashboards) ============================================= */

.app { min-height: 100vh; display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); }

.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: var(--sp-5);
  padding: var(--sp-5) var(--sp-4);
  background: var(--surface);
  box-shadow: 1px 0 0 rgba(15,23,42,.06);
  z-index: 40;
}
.rail .brand { padding-inline: var(--sp-2); }

.rail-group { display: grid; gap: 2px; }
.rail-group + .rail-group { margin-top: var(--sp-4); }
.rail-title {
  font-size: var(--fs-micro); font-weight: 650; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-dim);
  padding: 0 var(--sp-2) var(--sp-2);
}
.rail-link {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0.55rem var(--sp-3);
  border-radius: var(--r-md);
  font-family: var(--font-display);
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink-600);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.rail-link svg { width: 17px; height: 17px; flex: 0 0 17px; color: var(--ink-400); transition: color var(--t-fast) var(--ease); }
.rail-link:hover { background: var(--ink-100); color: var(--text); }
.rail-link:hover svg { color: var(--ink-600); }
.rail-link[aria-current="page"] { background: var(--teal-050); color: var(--accent-ink); }
.rail-link[aria-current="page"] svg { color: var(--accent); }
.rail-link .count {
  margin-left: auto;
  font-family: var(--font-data); font-variant-numeric: tabular-nums;
  font-size: var(--fs-micro); font-weight: 700;
  background: var(--ink-100); color: var(--ink-600);
  padding: 1px 7px; border-radius: var(--r-pill);
}
.rail-link[aria-current="page"] .count { background: var(--teal-100); color: var(--teal-800); }
.rail-link .count--urgent { background: var(--rose-050); color: var(--rose-700); }

.rail-foot { margin-top: auto; }
.rail-user {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--surface-sunk);
}
.rail-user .who { min-width: 0; flex: 1; }
.rail-user strong { display: block; font-family: var(--font-display); font-size: var(--fs-sm); font-weight: 700; letter-spacing: -0.01em; }
.rail-user span { display: block; font-size: var(--fs-micro); color: var(--text-muted); }

.workspace { display: flex; flex-direction: column; min-width: 0; }

.workbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: rgba(241,245,249,.86);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
}
.workbar h1 { font-size: 1.375rem; letter-spacing: -0.028em; }
.workbar .sub { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 1px; }
.workbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-3); }

.search {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 0.45rem var(--sp-3);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  min-width: 220px;
}
.search svg { width: 15px; height: 15px; color: var(--ink-400); flex: 0 0 15px; }
.search input { border: 0; background: none; outline: none; width: 100%; font-size: var(--fs-sm); }
.search input::placeholder { color: var(--ink-400); }

.work { padding: 0 var(--sp-5) var(--sp-6); flex: 1; }

.work-grid {
  display: grid;
  grid-template-columns: minmax(300px, 336px) minmax(520px, 1fr) minmax(280px, 312px);
  gap: var(--sp-5);
  align-items: start;
}
.work-grid--two { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); }
.work-grid--queue { grid-template-columns: minmax(320px, 380px) minmax(0, 1fr); }

.col-main, .col-aside { display: grid; gap: var(--sp-5); align-content: start; min-width: 0; }

.panel {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
}
.panel-head h2, .panel-head h3 { font-size: var(--fs-body); }
.panel-body { padding: var(--sp-4); }
.panel-body--flush { padding: 0; }
.panel-foot {
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-sunk);
  box-shadow: inset 0 1px 0 var(--line-soft);
}
.panel--sticky { position: sticky; top: 84px; }

/* --- Tabs --- */
.tabs {
  display: flex; gap: var(--sp-1); padding: 0 var(--sp-4);
  box-shadow: inset 0 -1px 0 var(--line-soft);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; }
.tab {
  position: relative;
  padding: var(--sp-3) var(--sp-3) calc(var(--sp-3) + 2px);
  border: 0; background: none;
  font-size: var(--fs-sm); font-weight: 650; color: var(--text-muted);
  transition: color var(--t-fast) var(--ease);
}
.tab::after {
  content: ""; position: absolute; left: var(--sp-2); right: var(--sp-2); bottom: 0;
  height: 2px; border-radius: 2px; background: transparent;
  transition: background var(--t-fast) var(--ease);
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--accent-ink); }
.tab[aria-selected="true"]::after { background: var(--accent); }
.tab .count {
  font-family: var(--font-data); font-variant-numeric: tabular-nums;
  font-size: var(--fs-micro); color: var(--text-dim); margin-left: 4px;
}

/* --- Case queue --- */
.queue { display: grid; }
.case-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: var(--sp-3);
  align-items: start;
  width: 100%; text-align: left;
  padding: var(--sp-4);
  border: 0; background: none;
  box-shadow: inset 0 -1px 0 var(--line-soft);
  transition: background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  position: relative;
}
.case-item::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: transparent;
  transition: background var(--t-fast) var(--ease);
}
.case-item:hover { background: var(--surface-sunk); }
.case-item[aria-current="true"] { background: var(--teal-050); }
.case-item[aria-current="true"]::before { background: var(--accent); }
.case-item .name {
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm);
  letter-spacing: -0.012em; color: var(--text);
  display: flex; align-items: center; gap: var(--sp-2);
}
.case-item .why {
  font-size: var(--fs-xs); color: var(--ink-600); margin-top: 2px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.case-item .meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2);
  margin-top: var(--sp-2);
  font-size: var(--fs-micro); color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.case-item .meta > span { white-space: nowrap; }
.case-item .meta .sep { width: 3px; height: 3px; flex: 0 0 3px; border-radius: 50%; background: var(--ink-300); }
.case-item .right { text-align: right; display: grid; gap: var(--sp-2); justify-items: end; }

/* --- Case detail --- */
.case-header {
  display: flex; align-items: flex-start; gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
}
.case-header .who { flex: 1 1 0; min-width: 0; }
.case-header .spacer { flex: 0 1 auto; }
.case-header .who h2 { font-size: 1.25rem; letter-spacing: -0.028em; }
.case-header .who .facts {
  display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3);
  margin-top: var(--sp-2);
  font-size: var(--fs-xs); color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.case-header .who .facts b { color: var(--ink-700); font-weight: 600; }

.thread { display: grid; gap: var(--sp-4); padding: var(--sp-5); }
.msg { display: grid; grid-template-columns: 30px 1fr; gap: var(--sp-3); }
.msg-body {
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-sunk);
  font-size: var(--fs-sm); line-height: 1.6; color: var(--ink-700);
}
.msg-body p + p { margin-top: var(--sp-3); }
.msg--doc .msg-body { background: var(--teal-050); box-shadow: inset 0 0 0 1px rgba(13,148,136,.12); }
.msg-meta {
  display: flex; align-items: center; gap: var(--sp-2);
  margin-bottom: var(--sp-2);
  font-size: var(--fs-micro); color: var(--text-dim);
}
.msg-meta b { color: var(--ink-700); font-weight: 650; font-family: var(--font-display); font-size: var(--fs-xs); }
.msg-attach { display: flex; gap: var(--sp-3); margin-top: var(--sp-3); flex-wrap: wrap; }
.thumb {
  width: 76px; height: 76px; border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--ink-200), var(--ink-100));
  box-shadow: var(--shadow-1);
  display: grid; place-items: center;
  color: var(--ink-400); font-size: var(--fs-micro); font-weight: 650;
  text-align: center; padding: var(--sp-2);
}

/* 13 Tables, forms, chart blocks ======================================== */

.field { display: grid; gap: var(--sp-2); }
.field + .field { margin-top: var(--sp-4); }
.label {
  font-family: var(--font-data);
  font-size: var(--fs-xs); font-weight: 650; color: var(--ink-700);
  letter-spacing: -0.005em;
}
.hint { font-size: var(--fs-micro); color: var(--text-dim); }

.input, .select, .textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 0; border-radius: var(--r-md);
  background: var(--surface-sunk);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: var(--fs-sm);
  transition: box-shadow var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--accent), var(--ring);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.input--num { font-variant-numeric: tabular-nums; }

.field-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
.field-row .field + .field { margin-top: 0; }

.chart-list { display: grid; }
.chart-item {
  display: grid; grid-template-columns: 62px 1fr; gap: var(--sp-3);
  padding: var(--sp-3) 0;
  box-shadow: inset 0 -1px 0 var(--line-soft);
  font-size: var(--fs-sm);
}
.chart-item:last-child { box-shadow: none; }
.chart-item .when {
  font-size: var(--fs-micro); color: var(--text-dim);
  font-variant-numeric: tabular-nums; padding-top: 2px;
}
.chart-item .what strong { display: block; font-weight: 650; font-size: var(--fs-sm); }
.chart-item .what span { color: var(--text-muted); font-size: var(--fs-xs); }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
.stat {
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--surface-sunk);
}
.stat .metric {
  display: block; font-size: 1.375rem; font-weight: 700;
  letter-spacing: -0.035em; line-height: 1.15; color: var(--text);
}
.stat .metric .cur { font-size: .58em; color: var(--gold-700); vertical-align: .34em; margin-right: .12em; font-weight: 650; }
.stat .k { font-size: var(--fs-micro); color: var(--text-muted); margin-top: 2px; display: block; }
.stat--gold { background: var(--gold-050); box-shadow: inset 0 0 0 1px var(--gold-200); }
.stat--teal { background: var(--teal-050); box-shadow: inset 0 0 0 1px rgba(13,148,136,.14); }

.rx-list { display: grid; gap: var(--sp-3); }
.rx-card {
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  padding: var(--sp-4);
  display: grid; gap: var(--sp-3);
}
.rx-head { display: flex; align-items: flex-start; gap: var(--sp-3); }
.rx-head .grow { flex: 1; min-width: 0; }
.rx-lines { display: grid; gap: var(--sp-2); }
.rx-line {
  display: grid; grid-template-columns: 1fr auto; gap: var(--sp-3);
  align-items: baseline;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--surface-sunk);
}
.rx-line .drug { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm); letter-spacing: -0.012em; }
.rx-line .sig {
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-xs); color: var(--ink-600); display: block; margin-top: 1px;
}
.rx-line .qty {
  font-variant-numeric: tabular-nums; font-weight: 650; font-size: var(--fs-sm);
  color: var(--ink-700); white-space: nowrap;
}

.empty {
  display: grid; place-items: center; gap: var(--sp-3);
  padding: var(--sp-7) var(--sp-5);
  text-align: center;
}
.empty svg { width: 28px; height: 28px; color: var(--ink-300); }
.empty h3 { font-size: var(--fs-body); }
.empty p { font-size: var(--fs-sm); color: var(--text-muted); max-width: 34ch; }

/* 14 Micro-feedback states ==============================================
   Smooth colour transitions instead of interrupting alerts.
   ====================================================================== */

.confirm {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--teal-050);
  box-shadow: inset 0 0 0 1px rgba(13,148,136,.18);
  font-size: var(--fs-sm); font-weight: 600; color: var(--teal-800);
  animation: confirm-in var(--t-slow) var(--ease-out) both;
}
.confirm svg { width: 17px; height: 17px; flex: 0 0 17px; }
.confirm--gold { background: var(--gold-050); box-shadow: inset 0 0 0 1px var(--gold-200); color: var(--gold-700); }

@keyframes confirm-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.btn.is-done { background: var(--teal-800); box-shadow: var(--shadow-1); pointer-events: none; }
.btn.is-done.btn--gold { background: var(--gold-700); }

/* HTMX request state */
.htmx-indicator { opacity: 0; transition: opacity var(--t-fast) var(--ease); }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.htmx-request .btn-label { opacity: .55; }

.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.swap-in { animation: swap-in var(--t-mid) var(--ease-out) both; }
@keyframes swap-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* Page-load reveal for the home page */
.reveal { opacity: 0; transform: translateY(14px); }
.reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity 620ms var(--ease-out), transform 620ms var(--ease-out);
}
.reveal-d1 { transition-delay: 80ms; }
.reveal-d2 { transition-delay: 160ms; }
.reveal-d3 { transition-delay: 240ms; }

/* 15 Responsive ========================================================= */

@media (max-width: 1519px) {
  .work-grid--aside-row { grid-template-columns: minmax(280px, 320px) minmax(0, 1fr); }
  .work-grid--aside-row .col-aside {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .work-grid--two { grid-template-columns: minmax(0, 1fr) minmax(280px, 320px); }
}

@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-console { max-width: 560px; }
  .pay-grid { grid-template-columns: 1fr; }
  .views-grid { grid-template-columns: 1fr; }
  .spine--rail { grid-template-columns: repeat(2, 1fr); row-gap: var(--sp-6); }
  .trust-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .cta-panel { grid-template-columns: 1fr; }
}

/* Give the workspace back ~180px before the columns have to stack */
@media (max-width: 1100px) {
  :root { --rail-w: 68px; }
  .rail { padding-inline: var(--sp-2); align-items: center; }
  .rail .brand-name, .rail .brand-sub, .rail .rail-title,
  .rail-link span:not(.count), .rail-user .who { display: none; }
  .rail-link { justify-content: center; padding: 0.6rem; position: relative; }
  .rail-link .count {
    position: absolute; top: 1px; right: 1px;
    min-width: 15px; padding: 0 4px; line-height: 15px; text-align: center;
    font-size: 9px; background: var(--accent); color: #fff;
  }
  .rail-link .count--urgent { background: var(--urgent); color: #fff; }
  .rail-link[aria-current="page"] .count { background: var(--accent); color: #fff; }
  /* A running total isn't work waiting for you — don't badge it on the icon rail */
  .rail-link .count--total { display: none; }
  .rail-group { justify-items: center; width: 100%; }
  .rail-user { justify-content: center; padding: var(--sp-2); background: none; }
}

@media (max-width: 920px) {
  .work-grid, .work-grid--two, .work-grid--queue, .work-grid--aside-row { grid-template-columns: minmax(0, 1fr); }
  /* Stacked: cap the queue so the case underneath is still reachable */
  .queue { max-height: 62vh; overflow-y: auto; overscroll-behavior: contain; }
  .work-grid--aside-row .col-aside { grid-template-columns: 1fr; }
  .panel--sticky { position: static; }
}

@media (max-width: 720px) {
  .site-nav { display: none; }
  .site-header .container { gap: var(--sp-3); }
  .brand-sub { display: none; }
  .spine--rail { grid-template-columns: 1fr; }
  .spine--rail .spine-step::before { display: none; }
  .field-row { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: var(--sp-5); }
  .workbar { flex-wrap: wrap; }
  .search { min-width: 0; flex: 1; }
  .ledger th:nth-child(2), .ledger td:nth-child(2) { display: none; }
  .console-body, .console-foot, .case-header, .thread { padding: var(--sp-4); }
  .case-header { flex-wrap: wrap; }
  .case-header .spacer { flex: 1 0 100%; height: 0; }
  .workbar-actions { width: 100%; flex-wrap: wrap; }
  .search { flex: 1 1 100%; order: 3; }
  .work { padding-inline: var(--sp-4); }
  .workbar { padding-inline: var(--sp-4); }
  .hero-cta .btn { flex: 1; }
}

@media (max-width: 460px) {
  .header-actions .btn--ghost { display: none; }
  .case-item { grid-template-columns: 32px minmax(0, 1fr); }
  .case-item .right { grid-column: 2; justify-items: start; text-align: left; }
}

/* 16 Motion preferences ================================================= */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .vn-bar.is-cursor { transform: scaleY(1.3); }
}

@media print {
  .rail, .workbar-actions, .site-header, .cta-panel { display: none; }
  body { background: #fff; }
  .panel, .card { box-shadow: none; border: 1px solid var(--line); }
}
