/* GlowPlan
 * Visual idea: a calm treatment room. Cool mineral surfaces, deep spruce ink,
 * one saffron "glow" accent. The bathroom-mirror arch frames every photo; the
 * face map is the one bold element. Everything else stays quiet.
 */

@font-face {
  font-family: 'Instrument Sans';
  src: url('/fonts/instrument-sans-latin-standard-normal.woff2') format('woff2-variations');
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Sans';
  src: url('/fonts/instrument-sans-latin-ext-standard-normal.woff2') format('woff2-variations');
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --page: #e6ece9;        /* mineral mist */
  --surface: #f6f9f7;
  --surface-2: #edf2ef;
  --surface-3: #dfe7e3;
  --ink: #12302a;         /* spruce */
  --ink-2: #3d554e;
  --muted: #566a63;
  --line: #c9d4cf;
  --line-soft: #dbe3df;
  --accent: #d9a21b;      /* saffron glow: marks only, never text */
  --accent-wash: #f5e7c2;
  --btn: #12302a;
  --btn-ink: #f6f9f7;
  --focus: #1f6f62;
  --good: #0f6a3c;
  --bad: #a3392a;
  --data: #1f7a6c;        /* focus/after */
  --data-soft: #7fbdb0;   /* before */
  --data-muted: #b3c1bc;  /* de-emphasised bars */
  --zone-1: #f3e3b8;      /* 85+  */
  --zone-2: #e8c66f;      /* 70-84 */
  --zone-3: #d6a32c;      /* 55-69 */
  --zone-4: #b07d0c;      /* 40-54 */
  --zone-5: #7d5600;      /* <40 */
  --face-line: #6b7f78;
  --skin-fill: #e9e1d8;

  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 9px;
  --gutter: 16px;
  --font: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --page: #0e1915;
    --surface: #15231f;
    --surface-2: #1b2c27;
    --surface-3: #233731;
    --ink: #e2ebe7;
    --ink-2: #b6c6c0;
    --muted: #93a7a0;
    --line: #2d423b;
    --line-soft: #22352f;
    --accent: #e5b53d;
    --accent-wash: #3a321b;
    --btn: #d3e8e0;
    --btn-ink: #0e1915;
    --focus: #7fd3c1;
    --good: #4cc27a;
    --bad: #f08a78;
    --data: #6fd0bc;
    --data-soft: #2f6f63;
    --data-muted: #3d524b;
    --zone-1: #3a3524;
    --zone-2: #5e4f22;
    --zone-3: #8d7121;
    --zone-4: #c29a2a;
    --zone-5: #e9c25a;
    --face-line: #8aa098;
    --skin-fill: #24332e;
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --page: #0e1915;
  --surface: #15231f;
  --surface-2: #1b2c27;
  --surface-3: #233731;
  --ink: #e2ebe7;
  --ink-2: #b6c6c0;
  --muted: #93a7a0;
  --line: #2d423b;
  --line-soft: #22352f;
  --accent: #e5b53d;
  --accent-wash: #3a321b;
  --btn: #d3e8e0;
  --btn-ink: #0e1915;
  --focus: #7fd3c1;
  --good: #4cc27a;
  --bad: #f08a78;
  --data: #6fd0bc;
  --data-soft: #2f6f63;
  --data-muted: #3d524b;
  --zone-1: #3a3524;
  --zone-2: #5e4f22;
  --zone-3: #8d7121;
  --zone-4: #c29a2a;
  --zone-5: #e9c25a;
  --face-line: #8aa098;
  --skin-fill: #24332e;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  font-variation-settings: normal;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.12; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.quiet { color: var(--muted); font-weight: 400; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--btn); color: var(--btn-ink); padding: 8px 14px; border-radius: 999px; z-index: 50; }
.skip:focus { left: 8px; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px var(--gutter);
  max-width: 1240px; margin: 0 auto;
}
.wordmark { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-weight: 650; font-stretch: 88%; font-size: 1.28rem; letter-spacing: -0.01em; }
.mark { width: 22px; height: 26px; }
.clinic-tag { font-size: 0.86rem; color: var(--ink-2); padding-left: 12px; border-left: 1px solid var(--line); line-height: 1.2; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 0.8rem; color: var(--ink-2); padding: 5px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-soft); white-space: nowrap; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status[data-state='live'] i { background: var(--good); }
.status[data-state='demo'] i { background: var(--accent); }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-soft); background: var(--surface); cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; }
@media (max-width: 560px) {
  #agent-status { display: none; }
  .clinic-tag { display: none; }
}

/* ---------- Buttons & controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 560; cursor: pointer; text-decoration: none; line-height: 1.2;
  transition: background-color .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--ink-2); }
.btn-primary { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }
.btn-primary:hover { border-color: var(--btn); filter: brightness(1.12); }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn svg { width: 19px; height: 19px; }
.btn.small { min-height: 38px; padding: 7px 14px; font-size: .92rem; }
.btn-wide { width: 100%; min-height: 52px; font-size: 1.05rem; }
.link-btn { background: none; border: 0; padding: 6px 2px; color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 4px; cursor: pointer; font-weight: 520; }
.link-btn:hover { text-decoration-color: currentColor; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.file-btn:focus-within { outline: 2.5px solid var(--focus); outline-offset: 2px; }

/* ---------- Layout ---------- */
main { max-width: 1240px; margin: 0 auto; padding: 8px var(--gutter) 64px; }
.view-start { display: grid; gap: 28px; }
@media (min-width: 980px) {
  .view-start { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-rows: auto 1fr; column-gap: 56px; row-gap: 0; align-items: start; padding-top: 24px; }
  .intro-head { grid-column: 1; grid-row: 1; }
  .scan-form { grid-column: 2; grid-row: 1 / span 2; }
  .intro-more { grid-column: 1; grid-row: 2; }
}
.intro-more .how { margin-top: 0; }
@media (min-width: 980px) { .intro-more .how { margin-top: 26px; } }

/* ---------- Intro ---------- */
.intro h1 {
  font-size: clamp(2.3rem, 1.3rem + 4vw, 4.1rem);
  font-stretch: 78%;
  font-weight: 620;
  line-height: 0.98;
  letter-spacing: -0.028em;
  max-width: 12ch;
  text-wrap: balance;
}
.lede { margin-top: 18px; font-size: 1.08rem; color: var(--ink-2); max-width: 52ch; }
.lede.small { font-size: 1rem; margin-top: 8px; }
.how { list-style: none; counter-reset: how; padding: 0; margin: 26px 0 0; display: grid; gap: 12px; max-width: 48ch; }
.how li { counter-increment: how; display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; color: var(--ink-2); }
.how li span { padding-top: 3px; }
.how li::before { content: counter(how); width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--ink); color: var(--ink); display: grid; place-items: center; font-weight: 600; font-size: .9rem; }
.how strong { color: var(--ink); font-weight: 600; }
.privacy { margin-top: 26px; display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; color: var(--ink-2); max-width: 50ch; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); }
.privacy svg { width: 20px; height: 20px; flex: none; margin-top: 1px; color: var(--ink); }
.resume { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; font-size: .95rem; color: var(--ink-2); }

/* ---------- Scan form ---------- */
.scan-form { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 20px 16px 22px; display: grid; gap: 22px; }
@media (min-width: 640px) { .scan-form { padding: 28px 30px 30px; } }
.form-head h2 { font-size: 1.35rem; font-stretch: 85%; }
.form-sub { color: var(--muted); font-size: .95rem; margin-top: 2px; }
.photo-step { display: grid; gap: 14px; justify-items: center; }
@media (min-width: 640px) {
  .photo-step { grid-template-columns: 240px 1fr; justify-items: start; align-items: start; column-gap: 26px; }
  .photo-step .arch { grid-row: span 3; }
}
.arch {
  position: relative; width: min(100%, 260px); aspect-ratio: 3 / 4;
  border-radius: 50% 50% 16px 16px / 37.5% 37.5% 16px 16px;
  background: var(--surface-2); border: 1px solid var(--line);
  overflow: hidden; touch-action: none; isolation: isolate;
}
.arch canvas, .arch img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.arch canvas { cursor: grab; }
.arch canvas:active { cursor: grabbing; }
.arch .guide { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--muted); pointer-events: none; z-index: 2; }
.arch.has-photo .guide { color: rgba(255, 255, 255, .85); mix-blend-mode: difference; }
.arch-empty { position: absolute; inset: auto 0 14px; text-align: center; font-size: .85rem; color: var(--muted); padding: 0 24px; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; }
@media (min-width: 640px) { .photo-actions { justify-content: flex-start; align-self: end; } }
.photo-tools { display: grid; gap: 8px; width: 100%; }
.zoom { display: grid; gap: 4px; font-size: .9rem; color: var(--ink-2); }
.zoom input { width: 100%; accent-color: var(--ink); }
.tier-note { font-size: .88rem; color: var(--ink-2); }
.tier-note b { color: var(--ink); font-weight: 600; }
.field-error { color: var(--bad); font-size: .92rem; font-weight: 500; }
.compare summary { cursor: pointer; font-weight: 560; padding: 4px 0; }
.compare .hint { margin: 6px 0 10px; }
.hint { font-size: .88rem; color: var(--muted); }
.field { border: 0; margin: 0; padding: 0; min-width: 0; }
.field legend { font-weight: 600; padding: 0; margin-bottom: 10px; font-size: .98rem; }
.field-row { display: grid; gap: 22px; }
@media (min-width: 640px) { .field-row { grid-template-columns: 1fr 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .93rem; cursor: pointer; }
.chip input:checked + span { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip input:checked + span::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.chip input:focus-visible + span { outline: 2.5px solid var(--focus); outline-offset: 2px; }
.chip input:disabled + span { opacity: .45; cursor: not-allowed; }
.seg { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line); border-radius: 12px; padding: 3px; background: var(--surface-2); }
.seg label { position: relative; flex: 1 1 auto; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; text-align: center; padding: 8px 10px; border-radius: 9px; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.seg span small { display: block; font-size: .74rem; color: var(--muted); }
.seg input:checked + span { background: var(--surface); box-shadow: 0 0 0 1px var(--line); font-weight: 600; }
.seg input:focus-visible + span { outline: 2.5px solid var(--focus); outline-offset: 1px; }
.checks { display: grid; gap: 8px; }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; font-size: .95rem; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); margin: 0; }
.fine { text-align: center; font-size: .82rem; color: var(--muted); margin-top: -10px; }

/* ---------- Working ---------- */
.view-working { display: grid; place-items: start center; padding-top: 4vh; }
.working-card { width: min(100%, 560px); background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 24px 20px; }
@media (min-width: 640px) { .working-card { padding: 30px 32px; } }
.working-card h2 { font-size: 1.6rem; font-stretch: 82%; }
.steps { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 2px; }
.steps li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-soft); align-items: start; font-size: .95rem; }
.steps li:first-child { border-top: 0; }
.steps .st-icon { width: 18px; height: 18px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--line); }
.steps li[data-status='running'] .st-icon { border-color: var(--line); border-top-color: var(--ink); animation: spin .8s linear infinite; }
.steps .st-icon { display: grid; place-items: center; font-size: 11px; font-weight: 700; line-height: 1; }
.steps li[data-status='done'] .st-icon { border-color: var(--data); background: var(--data); color: var(--surface); }
.steps li[data-status='done'] .st-icon::after { content: '\2713'; }
.steps li[data-status='error'] .st-icon { border-color: var(--bad); background: var(--bad); color: var(--surface); }
.steps li[data-status='error'] .st-icon::after { content: '!'; }
.steps li[data-status='skipped'] .st-icon { border-color: var(--data-soft); color: var(--data); }
.steps li[data-status='skipped'] .st-icon::after { content: '\2713'; }
.steps .st-title { font-weight: 540; }
.steps .st-detail { display: block; color: var(--muted); font-size: .86rem; }
.steps .st-by { font-size: .78rem; color: var(--muted); white-space: nowrap; }
@keyframes spin { to { transform: rotate(360deg); } }
.retake { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.retake h3 { font-size: 1.2rem; }
.retake ul { margin: 10px 0 16px; padding-left: 20px; color: var(--ink-2); }

/* ---------- Results ---------- */
.results-head { display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: end; justify-content: space-between; padding: 12px 0 26px; border-bottom: 1px solid var(--line); }
.results-head h2 { font-size: clamp(1.9rem, 1.2rem + 2.8vw, 3.1rem); font-stretch: 80%; font-weight: 620; letter-spacing: -0.025em; line-height: 1.02; max-width: 22ch; text-wrap: balance; margin-top: 6px; }
.meta { color: var(--ink-2); font-size: .95rem; }
.demo-flag { margin-top: 10px; display: inline-flex; gap: 8px; align-items: center; font-size: .88rem; color: var(--ink); background: var(--accent-wash); padding: 6px 12px; border-radius: 999px; }
.demo-flag::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.results-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.results-grid { display: grid; gap: 30px; margin-top: 28px; }
@media (min-width: 980px) {
  .results-grid { grid-template-columns: 340px minmax(0, 1fr); gap: 56px; align-items: start; }
  .face-panel { position: sticky; top: 16px; }
}
.face-panel { display: grid; gap: 14px; justify-items: center; }
@media (min-width: 640px) and (max-width: 979px) {
  .face-panel { grid-template-columns: 240px 1fr; justify-items: start; align-items: start; column-gap: 28px; }
  .face-panel .zone-card { grid-column: 2; grid-row: 1 / span 3; }
}
.arch-result { width: min(100%, 300px); }
@media (max-width: 639px) {
  .photo-step .arch { width: min(68%, 220px); }
  .arch-result { width: min(78%, 280px); }
}
.overlay-switch { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.overlay-switch button { font-size: .82rem; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.overlay-switch button[aria-pressed='true'] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.overall { font-size: .95rem; color: var(--ink-2); text-align: center; }
.overall strong { display: block; font-size: 3.2rem; line-height: 1; color: var(--ink); font-weight: 600; letter-spacing: -0.03em; }
.zone-card { width: 100%; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: 16px; }
.zone-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; }
.zone-head h3 { font-size: 1.05rem; }
.tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--surface-2); }
.tabs button { border: 0; background: none; padding: 5px 12px; border-radius: 999px; font-size: .84rem; cursor: pointer; color: var(--ink-2); }
.tabs button[aria-selected='true'] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.zone-map { margin: 8px auto 0; max-width: 280px; }
.zone-map svg { width: 100%; height: auto; display: block; }
.zone-map .face-outline { fill: var(--skin-fill); stroke: var(--face-line); stroke-width: 2.5; }
.zone-map .feature { fill: none; stroke: var(--face-line); stroke-width: 2.5; stroke-linecap: round; }
.zone-map .zone { stroke: var(--ink-2); stroke-opacity: .35; stroke-width: 1.5; }
.zone-map .zone:hover, .zone-map .zone:focus { stroke-opacity: 1; stroke-width: 2.5; outline: none; }
.zone-map text { font-family: var(--font); font-size: 21px; font-weight: 650; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 5px; stroke-linejoin: round; }
.zone-map text.zl { font-size: 15px; font-weight: 500; fill: var(--ink-2); }
.zone-legend { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .78rem; color: var(--ink-2); justify-content: center; }
.zone-legend li { display: inline-flex; align-items: center; gap: 5px; }
.zone-legend i { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line); }
.zone-card .hint { margin-top: 8px; text-align: center; }

.plan-col { display: grid; gap: 0; min-width: 0; }
.block { padding: 26px 0; border-top: 1px solid var(--line); min-width: 0; }
.plan-col > .block:first-child, .plan-col > [hidden] + .block { border-top: 0; padding-top: 0; }
.block > h3, .block-head h3 { font-size: 1.4rem; font-stretch: 84%; letter-spacing: -0.015em; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.block .hint, .block .summary { margin-top: 6px; }
.summary { color: var(--ink-2); max-width: 64ch; }

/* Focus */
.focus-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 14px; counter-reset: focus; }
.focus-list > li { counter-increment: focus; display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; padding: 18px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-soft); }
.focus-score { grid-row: span 3; text-align: center; min-width: 64px; }
.focus-score strong { display: block; font-size: 2.6rem; line-height: 1; font-weight: 600; letter-spacing: -0.03em; }
.focus-score span { font-size: .78rem; color: var(--muted); }
.focus-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.focus-title h4 { font-size: 1.15rem; }
.focus-title .band { font-size: .84rem; color: var(--ink-2); }
.focus-list p { color: var(--ink-2); font-size: .97rem; max-width: 62ch; }
.goal-tag { font-size: .8rem; color: var(--ink); background: var(--accent-wash); border-radius: 999px; padding: 2px 9px; }
@media (max-width: 480px) {
  .focus-list > li { grid-template-columns: 1fr; padding: 16px; }
  .focus-score { grid-row: auto; text-align: left; display: flex; align-items: baseline; gap: 8px; }
}

/* Skin profile */
.profile { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start; margin-top: 16px; }
.tone-swatch { width: 84px; height: 84px; border-radius: 50%; background: var(--skin, var(--surface-3)); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08), 0 0 0 6px var(--surface), 0 0 0 7px var(--line); margin: 7px; display: grid; place-items: center; color: var(--muted); font-size: .78rem; text-align: center; line-height: 1.2; }
.tone-swatch.empty { background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--surface-3) 6px 12px); }
.profile-facts { margin: 0; display: grid; gap: 10px; }
.profile-facts div { display: grid; grid-template-columns: 9.5rem 1fr; gap: 2px 14px; }
.profile-facts dt { color: var(--muted); font-size: .88rem; padding-top: 1px; }
.profile-facts dd { margin: 0; font-size: .97rem; }
.profile-facts dd b { font-weight: 600; }
@media (max-width: 560px) {
  .profile { grid-template-columns: 1fr; justify-items: start; }
  .tone-swatch { width: 64px; height: 64px; }
  .profile-facts div { grid-template-columns: 1fr; }
}
.ita { margin-top: 18px; }
.ita-track { position: relative; height: 12px; border-radius: 6px; display: flex; overflow: visible; }
.ita-track span { flex: 1; height: 100%; }
.ita-track span:first-child { border-radius: 6px 0 0 6px; }
.ita-track span:last-of-type { border-radius: 0 6px 6px 0; }
.ita-track span + span { margin-left: 2px; }
.ita-marker { position: absolute; top: 50%; width: 22px; height: 22px; border-radius: 50%; transform: translate(-50%, -50%); border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--ink); }
.ita-labels { display: flex; margin-top: 8px; font-size: .74rem; color: var(--muted); }
.ita-labels span { flex: 1; text-align: center; line-height: 1.2; }
.ita-labels span.on { color: var(--ink); font-weight: 600; }
.profile-notes { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.profile-notes li { padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-soft); font-size: .95rem; }
.profile-notes .cite { margin-top: 4px; }
.cite .dot { flex: none; width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); margin: 0 10px 0 10px; }
.step-match { font-size: .86rem; color: var(--ink); margin-top: 4px; }
.step-match b { font-weight: 600; }
.pro-tone { margin-top: 10px; font-size: .9rem; color: var(--ink-2); padding-left: 10px; border-left: 2px solid var(--accent); }

/* Citation: a tiny meter plus the measured score that drove the step */
.cite { display: inline-flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--ink-2); margin-top: 6px; line-height: 1.35; }
.cite .meter { flex: none; width: 34px; height: 6px; border-radius: 3px; background: var(--surface-3); position: relative; overflow: hidden; }
.cite .meter i { position: absolute; inset: 0 auto 0 0; background: var(--data); border-radius: 0 3px 3px 0; }

/* Routine */
.routine { display: grid; gap: 22px; margin-top: 16px; }
@media (min-width: 760px) { .routine { grid-template-columns: 1fr 1fr; gap: 28px; } }
.routine-col h4 { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.routine-col h4 svg { width: 20px; height: 20px; }
.steps-list { list-style: none; counter-reset: step; padding: 0; margin: 0; }
.steps-list > li { counter-increment: step; display: grid; grid-template-columns: 26px 1fr; gap: 0 10px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.steps-list > li::before { content: counter(step); font-weight: 600; color: var(--muted); font-size: .9rem; padding-top: 1px; }
.step-name { font-weight: 600; line-height: 1.3; }
.step-name .kind { font-weight: 450; color: var(--muted); font-size: .82rem; margin-left: 4px; }
.step-cadence { font-size: .86rem; color: var(--ink); margin-top: 2px; }
.step-does { font-size: .9rem; color: var(--ink-2); margin-top: 4px; }
.step-caution { font-size: .84rem; color: var(--ink-2); margin-top: 6px; padding-left: 10px; border-left: 2px solid var(--accent); }
.issues { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 4px; font-size: .88rem; color: var(--ink-2); }
.issues li::before { content: 'Note: '; font-weight: 600; color: var(--ink); }
.ramp { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 0; position: relative; }
.ramp li { display: grid; grid-template-columns: 112px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: .95rem; }
.ramp li b { font-weight: 600; }
.ramp li span { color: var(--ink-2); }
@media (max-width: 480px) { .ramp li { grid-template-columns: 1fr; gap: 2px; } }

/* Professional */
.pro-list { display: grid; gap: 12px; margin-top: 14px; }
.pro-item { padding: 16px 18px; border-radius: var(--r-md); border: 1px solid var(--line-soft); background: var(--surface); }
.pro-item h4 { font-size: 1.05rem; }
.pro-item ul { margin: 8px 0 0; padding-left: 18px; color: var(--ink-2); font-size: .93rem; display: grid; gap: 4px; }
.pro-item ul b { color: var(--ink); font-weight: 600; }
.flags { margin-top: 18px; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-2); }
.flags h4 { font-size: .98rem; }
.flags ul { margin: 8px 0 0; padding-left: 18px; font-size: .9rem; color: var(--ink-2); display: grid; gap: 4px; }

/* Charts */
.chart { margin-top: 14px; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .tick { font-size: 12px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--line-soft); stroke-width: 1; }
.chart .baseline { stroke: var(--line); stroke-width: 1; }
.chart .row-label { font-size: 13.5px; fill: var(--ink); }
.chart .row-label.muted { fill: var(--ink-2); }
.chart .value { font-size: 13px; font-weight: 600; fill: var(--ink); font-variant-numeric: tabular-nums; }
.chart .delta { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .delta.up { fill: var(--good); }
.chart .delta.down { fill: var(--bad); }
.chart .delta.steady { fill: var(--muted); }
.chart .bar-focus { fill: var(--data); }
.chart .bar-other { fill: var(--data-muted); }
.chart .db-link { stroke: var(--data-soft); stroke-width: 2; stroke-linecap: round; }
.chart .db-before { fill: var(--data-soft); stroke: var(--surface); stroke-width: 2; }
.chart .db-after { fill: var(--data); stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:focus { outline: none; }
.chart .row:hover .hit, .chart .row:focus-within .hit { fill: var(--surface-2); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .86rem; color: var(--ink-2); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.table-wrap { margin-top: 14px; overflow-x: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table-wrap th, .table-wrap td { text-align: left; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table-wrap th { font-weight: 600; color: var(--ink-2); font-size: .84rem; }
.table-wrap td.num { font-variant-numeric: tabular-nums; }
.tooltip { position: fixed; z-index: 40; pointer-events: none; background: var(--ink); color: var(--surface); padding: 8px 11px; border-radius: 10px; font-size: .84rem; line-height: 1.35; max-width: 240px; box-shadow: 0 8px 24px -12px rgba(0,0,0,.4); }
.tooltip strong { font-size: 1.05rem; display: block; }

/* Trace */
.trace-block summary { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; cursor: pointer; font-weight: 600; font-size: 1.1rem; list-style: none; }
.trace-block summary::-webkit-details-marker { display: none; }
.trace-block summary::before { content: '+'; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--ink); display: inline-grid; place-items: center; font-size: .95rem; line-height: 1; align-self: center; }
.trace-block[open] summary::before { content: '–'; }
.trace-block summary .quiet { font-size: .88rem; }
.steps-compact li { font-size: .9rem; }
.disclaimer { margin-top: 26px; font-size: .86rem; color: var(--muted); max-width: 70ch; }
.forget { font-size: .86rem; margin-top: 10px; justify-self: start; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------- Print: one-page clinic summary ---------- */
.print-sheet { display: none; }
@media print {
  @page { size: A4; margin: 12mm 13mm; }
  :root, :root[data-theme='dark'] { color-scheme: light; --ink: #111; --ink-2: #333; --muted: #555; --line: #bbb; }
  body { background: #fff !important; color: #111; font-size: 9.2pt; line-height: 1.35; }
  .topbar, main, .tooltip, .skip { display: none !important; }
  .print-sheet { display: block !important; color: #111; }
  .ps-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1.5pt solid #12302a; padding-bottom: 6pt; }
  .ps-head h1 { font-size: 17pt; font-stretch: 82%; letter-spacing: -0.01em; }
  .ps-head p { font-size: 8.5pt; color: #444; text-align: right; }
  .ps-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 12pt; margin-top: 9pt; }
  .print-sheet h2 { font-size: 10.5pt; margin: 9pt 0 4pt; color: #12302a; }
  .ps-grid > section > h2:first-child { margin-top: 0; }
  .print-sheet table { width: 100%; border-collapse: collapse; font-size: 8.4pt; }
  .print-sheet th, .print-sheet td { text-align: left; padding: 2.2pt 4pt 2.2pt 0; border-bottom: .5pt solid #ccc; vertical-align: top; }
  .print-sheet td.num { text-align: right; font-variant-numeric: tabular-nums; }
  .print-sheet tr.focus td { font-weight: 700; }
  .print-sheet td.band { white-space: nowrap; }
  .print-sheet ul, .print-sheet ol { margin: 0; padding-left: 12pt; }
  .print-sheet li { margin: 1.5pt 0; }
  .print-sheet .ps-small { font-size: 8pt; color: #444; }
  .print-sheet .ps-notes { margin-top: 6pt; border: .6pt solid #999; border-radius: 4pt; height: 60pt; padding: 4pt 6pt; font-size: 8pt; color: #666; }
  .print-sheet .ps-foot { margin-top: 8pt; padding-top: 5pt; border-top: .5pt solid #bbb; font-size: 7.6pt; color: #555; }
  .print-sheet .ps-demo { display: inline-block; margin-top: 3pt; padding: 1pt 6pt; border: .6pt solid #b07d0c; border-radius: 8pt; font-size: 7.8pt; }
}
