/* Bell Curve Health — clinical longevity platform.
   Material 3 tonal palette, Plus Jakarta Sans for display, Inter for body. */

:root {
  /* primary: deep clinical emerald */
  --primary: #006948;
  --primary-container: #00855d;
  --on-primary-container: #f5fff7;
  --primary-fixed: #85f8c4;
  --primary-fixed-dim: #68dba9;
  --on-primary-fixed: #002114;
  --on-primary-fixed-variant: #005137;
  --on-primary: #ffffff;

  /* secondary: informational blue */
  --secondary: #006398;
  --secondary-fixed: #cce5ff;
  --on-secondary-fixed: #001d31;
  --on-secondary-fixed-variant: #004b73;

  /* tertiary: caution amber */
  --tertiary: #994100;
  --tertiary-fixed: #ffdbca;
  --on-tertiary-fixed: #341100;
  --tertiary-container: #c05400;

  --error: #ba1a1a;
  --error-container: #ffdad6;
  --on-error-container: #93000a;

  /* surfaces carry a faint blue cast — reads clinical rather than grey */
  --surface: #faf8ff;
  --surface-lowest: #ffffff;
  --surface-low: #f2f3ff;
  --surface-container: #eaedff;
  --surface-high: #e2e7ff;
  --surface-highest: #dae2fd;
  --inverse-surface: #283044;
  --inverse-on-surface: #eef0ff;

  --on-surface: #131b2e;
  --on-surface-variant: #3d4a42;
  --outline: #6d7a72;
  --outline-variant: #bccac0;

  --radius: 0.75rem;
  --radius-lg: 0.5rem;
  --shadow-sm: 0 1px 2px rgba(19, 27, 46, .05);
  --shadow: 0 1px 8px rgba(19, 27, 46, .06);
  --shadow-md: 0 2px 4px rgba(19, 27, 46, .05), 0 8px 20px -6px rgba(19, 27, 46, .10);

  --font-display: 'Plus Jakarta Sans', ui-sans-serif, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-body: 'Inter', ui-sans-serif, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  --gutter: 1.5rem;
  --margin: 2rem;
  --maxw: 1440px;
  color-scheme: light;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--surface); color: var(--on-surface);
  font-family: var(--font-body); font-size: 14px; line-height: 20px;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------- type scale */

h1, h2, h3, .display, .headline, .title { font-family: var(--font-display); }
h1 { font-size: 32px; line-height: 40px; letter-spacing: -.015em; font-weight: 700; margin: 0 0 .3em; }
h2 { font-size: 24px; line-height: 32px; letter-spacing: -.01em; font-weight: 600; margin: 0 0 .35em; }
h3 { font-size: 18px; line-height: 26px; font-weight: 600; margin: 0 0 .4em; }
h4 { font-family: var(--font-display); font-size: 15px; line-height: 22px; font-weight: 600; margin: 0 0 .4em; }
p { margin: 0 0 .85em; }
.body-lg { font-size: 16px; line-height: 24px; }
.body-sm, .sub { font-size: 13px; line-height: 18px; color: var(--on-surface-variant); }
.label-md { font-size: 12px; line-height: 16px; letter-spacing: .02em; font-weight: 500; }
.label, .k, th, .control label, .eyebrow {
  font-size: 11px; line-height: 14px; letter-spacing: .04em; font-weight: 600;
  text-transform: uppercase; color: var(--on-surface-variant);
}
.metric { font-family: var(--font-display); font-size: 36px; line-height: 44px; letter-spacing: -.02em; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric.sm { font-size: 26px; line-height: 32px; }
.num, td.num, .v { font-variant-numeric: tabular-nums; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-container); }
.icon { flex: none; vertical-align: -.18em; }

/* ------------------------------------------------------------- app chrome */

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface-lowest); box-shadow: 0 1px 8px rgba(19, 27, 46, .05);
}
.topbar-inner {
  height: 72px; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--margin);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--primary), var(--primary-fixed-dim));
  color: #fff; box-shadow: 0 2px 6px rgba(0, 105, 72, .3);
}
.wordmark { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.wordmark span { color: var(--primary); }
.version-chip {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px;
  background: var(--surface-container); color: var(--on-surface-variant);
  font-size: 11px; letter-spacing: .04em; font-weight: 600; text-transform: uppercase;
}
nav { display: flex; gap: 4px; background: var(--surface-low); padding: 5px; border-radius: var(--radius); }
nav button {
  border: 0; background: transparent; color: var(--on-surface-variant); white-space: nowrap;
  padding: 7px 14px; border-radius: var(--radius-lg); cursor: pointer;
  font-family: var(--font-body); font-size: 12px; line-height: 16px; letter-spacing: .02em; font-weight: 500;
  transition: background .12s ease, color .12s ease;
}
nav button:hover { background: var(--surface-high); color: var(--on-surface); }
nav button.active { background: var(--primary-container); color: var(--on-primary-container); font-weight: 600; box-shadow: var(--shadow-sm); }

.chips { display: flex; align-items: center; gap: 10px; }
@media (max-width: 1360px) { #chip-cohort { display: none; } }
@media (max-width: 1180px) { .identity .who { display: none; } .version-chip { display: none; } }
@media (max-width: 1040px) { #chip-score { display: none; } }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px;
  background: var(--surface-container); color: var(--on-surface); font-size: 11px; font-weight: 500;
  letter-spacing: .02em; white-space: nowrap;
}
.chip.live { background: var(--primary-fixed); color: var(--on-primary-fixed); }
.chip.live b { font-weight: 700; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.identity { display: flex; align-items: center; gap: 9px; padding-left: 4px; }
/* One avatar element everywhere: photo if present, initials if not. */
.avatar {
  border-radius: 50%; display: inline-grid; place-items: center; overflow: hidden;
  background: var(--primary-fixed); color: var(--on-primary-fixed);
  font-family: var(--font-display); font-weight: 700; flex: none;
  border: 2px solid var(--surface-lowest); box-shadow: 0 0 0 1px var(--outline-variant);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.plain { border: 0; box-shadow: none; }
.avatar.big { box-shadow: 0 0 0 1px var(--outline-variant), var(--shadow-md); }
.identity { cursor: pointer; border-radius: 99px; padding: 3px 6px 3px 3px; }
.identity:hover { background: var(--surface-low); }

.avatar-edit { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.avatar-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* onboarding */
.stepper { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }

.step-body { max-width: 720px; }

.choice-grid { display: grid; gap: 12px; margin: 16px 0; }
@media (min-width: 700px) { .choice-grid { grid-template-columns: 1fr 1fr; } }
.choice {
  text-align: left; background: var(--surface-lowest); border: 1.5px solid var(--outline-variant);
  border-radius: var(--radius); padding: 15px 17px; cursor: pointer; font: inherit; color: inherit;
  display: flex; gap: 12px; align-items: flex-start;
}
.choice:hover { border-color: var(--primary); background: var(--surface-low); }
.choice.selected { border-color: var(--primary); background: var(--primary-fixed); }
.choice .ico { color: var(--primary); }
.choice b { display: block; font-family: var(--font-display); font-size: 14px; }
.identity .who { display: flex; flex-direction: column; line-height: 1.25; }
.identity .who b { font-size: 12px; font-weight: 600; }
.identity .who span { font-size: 11px; color: var(--on-surface-variant); }

.contextbar { background: var(--surface-low); box-shadow: 0 1px 8px rgba(19, 27, 46, .04); }
.contextbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 9px var(--margin);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: 11px; line-height: 14px; letter-spacing: .02em; color: var(--on-surface-variant);
}
.contextbar b { color: var(--on-surface); font-weight: 600; }
.crumb { display: flex; align-items: center; gap: 6px; }
.crumb .lead { color: var(--primary); font-weight: 600; }
.contextbar .sep { width: 4px; height: 4px; border-radius: 50%; background: var(--outline-variant); display: inline-block; }

main { max-width: var(--maxw); margin: 0 auto; padding: var(--gutter) var(--margin) 48px; }

.banner {
  background: var(--tertiary-fixed); color: var(--on-tertiary-fixed);
  padding: 9px var(--margin); font-size: 12px;
}
.banner-inner { max-width: var(--maxw); margin: 0 auto; display: flex; align-items: center; gap: 8px; }

/* ------------------------------------------------------------- surfaces */

.card {
  background: var(--surface-lowest); border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: var(--gutter); box-shadow: var(--shadow);
}
.card > :last-child { margin-bottom: 0; }
.card.tonal { background: var(--surface-low); box-shadow: none; }
.callout { border-left: 3px solid var(--tertiary); }
.empty { background: var(--surface-low); box-shadow: none; border: 1px dashed var(--outline-variant); }
.grid { display: grid; gap: var(--gutter); }
@media (min-width: 900px) { .grid.two { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .grid.four { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 700px) and (max-width: 1099px) { .grid.four { grid-template-columns: 1fr 1fr; } }

/* hero */
.hero { position: relative; overflow: hidden; background: var(--surface-lowest); border-radius: var(--radius); padding: 26px 28px; margin-bottom: var(--gutter); box-shadow: var(--shadow-md); }
.hero::after {
  content: ''; position: absolute; right: -70px; top: -110px; width: 340px; height: 340px;
  border-radius: 50%; background: var(--primary-fixed-dim); opacity: .16; filter: blur(48px); pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; display: flex; gap: 28px; justify-content: space-between; flex-wrap: wrap; align-items: center; }
.hero-copy { max-width: 640px; }
.hero p { color: var(--on-surface-variant); }
.eyebrow-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.hero-stats { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-stat { min-width: 206px; border-radius: var(--radius); padding: 16px 18px; background: var(--surface-low); box-shadow: var(--shadow-sm); }
.hero-stat.solid { background: var(--primary); color: var(--on-primary); }
.hero-stat.solid .k, .hero-stat.solid .sub { color: rgba(255, 255, 255, .78); }
.hero-stat .metric { color: var(--primary); }
.hero-stat.solid .metric { color: #fff; }
.hero-stat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }

/* ------------------------------------------------------------- pills */

.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  background: var(--surface-container); color: var(--on-surface-variant);
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.good { background: var(--primary-fixed); color: var(--on-primary-fixed); }
.pill.solid { background: var(--primary); color: #fff; }
.pill.info { background: var(--secondary-fixed); color: var(--on-secondary-fixed); }
.pill.fair, .pill.warnpill { background: var(--tertiary-fixed); color: var(--on-tertiary-fixed); }
.pill.poor { background: var(--error-container); color: var(--on-error-container); }

/* ------------------------------------------------------------- controls */

.controls { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-end; margin-bottom: var(--gutter); }
.control { display: flex; flex-direction: column; gap: 6px; }
.control[hidden] { display: none; }
select, input[type="number"], input[type="text"], input[type="date"] {
  font-family: var(--font-body); font-size: 13px; color: var(--on-surface);
  background: var(--surface-lowest); border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg); padding: 9px 12px; min-width: 168px;
}
select:focus, input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 105, 72, .12); }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--primary); color: #fff; border: 0; border-radius: var(--radius-lg);
  padding: 10px 17px; font-family: var(--font-body); font-size: 13px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--primary-container); }
.btn.ghost { background: var(--surface-container); color: var(--on-surface); }
.btn.ghost:hover { background: var(--surface-high); }
.linkbtn { background: none; border: 0; color: var(--on-surface-variant); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font: inherit; padding: 0; }
.linkbtn:hover { color: var(--error); }
.arrow-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--primary); text-decoration: none; }
.arrow-link:hover { gap: 9px; transition: gap .12s ease; }

/* ------------------------------------------------------------- tables */

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--surface-high); }
th { border-bottom: 1px solid var(--outline-variant); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr[data-id], tr.clickable { cursor: pointer; }
tbody tr[data-id]:hover, tr.clickable:hover { background: var(--surface-low); }
tbody tr.you { background: var(--primary-fixed); box-shadow: inset 3px 0 0 var(--primary); }
tbody tr.you:hover { background: var(--primary-fixed-dim); }
td.big { font-family: var(--font-display); font-size: 15px; font-weight: 700; }
.rank { width: 46px; color: var(--outline); font-weight: 600; font-variant-numeric: tabular-nums; }
.rank.medal { color: var(--primary); }
.handle { font-weight: 600; }
tr.dim td { color: var(--on-surface-variant); }
.zpill {
  display: inline-block; min-width: 62px; text-align: center; padding: 3px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--primary-fixed); color: var(--on-primary-fixed);
}
.zpill.neg { background: var(--error-container); color: var(--on-error-container); }

/* ------------------------------------------------------------- z bars */

.zbar { position: relative; height: 7px; background: var(--surface-high); border-radius: 99px; min-width: 120px; }
.zbar .mid { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--outline-variant); }
.zbar .fill { position: absolute; top: 0; bottom: 0; border-radius: 99px; }
.zbar .fill.pos { background: linear-gradient(90deg, var(--primary-fixed-dim), var(--primary)); }
.zbar .fill.neg { background: linear-gradient(90deg, #f2a0a0, var(--error)); }

.statrow { display: flex; gap: 32px; flex-wrap: wrap; }
.stat .v { font-family: var(--font-display); font-size: 24px; line-height: 32px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat-strip { display: grid; gap: 1px; background: var(--surface-high); border-radius: var(--radius-lg); overflow: hidden; margin-top: 16px; }
@media (min-width: 760px) { .stat-strip { grid-template-columns: repeat(4, 1fr); } }
.stat-cell { background: var(--surface-low); padding: 13px 16px; }
.stat-cell .v { font-family: var(--font-display); font-size: 19px; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- pillar cards */

.pillar { background: var(--surface-lowest); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.pillar-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.pillar-title { display: flex; align-items: center; gap: 9px; }
.pillar-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-fixed); color: var(--on-primary-fixed); }
.pillar-ico.blue { background: var(--secondary-fixed); color: var(--on-secondary-fixed); }
.pillar-ico.amber { background: var(--tertiary-fixed); color: var(--on-tertiary-fixed); }
.pillar h4 { margin: 0; }
.pillar-metric { display: flex; align-items: baseline; gap: 9px; margin-bottom: 12px; }
.pillar-rows { display: flex; flex-direction: column; gap: 1px; background: var(--surface-high); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 12px; }
.pillar-row { background: var(--surface-low); padding: 9px 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.pillar-row .name { color: var(--on-surface-variant); }
.pillar-row .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.pillar-row .norm { font-size: 11px; color: var(--outline); }
.pillar-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--surface-high); }

/* ------------------------------------------------------------- podium */

.podium { display: grid; gap: var(--gutter); margin-bottom: var(--gutter); }
@media (min-width: 900px) { .podium { grid-template-columns: 1fr 1.12fr 1fr; align-items: center; } }
.pod { background: var(--surface-lowest); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); border-top: 3px solid var(--outline-variant); }
.pod.first { border: 2px solid var(--primary); border-top-width: 3px; box-shadow: var(--shadow-md); }
.pod.second { border-top-color: var(--secondary); }
.pod.third { border-top-color: var(--tertiary); }
.pod-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pod-rank { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-container); color: var(--on-surface-variant); font-family: var(--font-display); font-weight: 700; font-size: 12px; }
.pod.first .pod-rank { background: var(--primary); color: #fff; }
.pod-who { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.pod-avatar { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-container); color: var(--on-surface-variant); font-family: var(--font-display); font-weight: 700; font-size: 14px; }
.pod.first .pod-avatar { background: var(--primary-fixed); color: var(--on-primary-fixed); }
.pod-z { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--surface-high); }
.pod-events { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding-top: 10px; border-top: 1px solid var(--surface-high); }
.pod-events .v { font-family: var(--font-display); font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- drawer */

.drawer[hidden] { display: none; }

.close { float: right; background: var(--surface-container); border: 0; color: var(--on-surface-variant); border-radius: var(--radius-lg); padding: 7px 13px; cursor: pointer; font: inherit; font-size: 12px; }
.close:hover { background: var(--surface-high); color: var(--on-surface); }

/* ------------------------------------------------------------- lines of effort */

.linebar { height: 7px; background: var(--surface-high); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.linebar-fill { height: 100%; background: linear-gradient(90deg, var(--primary-fixed-dim), var(--primary)); }
.linebar.mini { width: 112px; margin-top: 0; }

.ladder-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.ladder-now { text-align: right; }
.ladder-now .v { font-family: var(--font-display); font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ladder.outcome { border-left: 3px solid var(--primary); padding-left: 16px; margin-left: -16px; }

.road { position: relative; height: 3px; background: var(--surface-high); border-radius: 99px; margin: 62px 54px 66px; }
.road-done { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--primary-fixed-dim), var(--primary)); border-radius: 99px; }
.rung { position: absolute; top: 50%; transform: translate(-50%, -50%); background: none; border: 0; padding: 11px; cursor: pointer; font-family: inherit; display: flex; flex-direction: column; align-items: center; }
.rung-dot { width: 13px; height: 13px; border-radius: 50%; background: var(--surface-lowest); border: 2px solid var(--outline-variant); transition: transform .12s ease, border-color .12s ease; }
.rung:hover .rung-dot { transform: scale(1.3); border-color: var(--primary); }
.rung-label { position: absolute; top: 27px; font-size: 11px; color: var(--on-surface-variant); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rung.done .rung-dot { background: var(--primary); border-color: var(--primary); }
.rung.current .rung-dot { width: 20px; height: 20px; background: var(--surface-lowest); border-color: var(--primary); border-width: 3px; box-shadow: 0 0 0 5px rgba(0, 105, 72, .12); }
.rung.current .rung-label { color: var(--on-surface); font-weight: 700; top: 34px; }
.rung.current::before { content: 'you are here'; position: absolute; bottom: 36px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); white-space: nowrap; }
.rung.next .rung-dot { border-color: var(--primary); border-style: dashed; }
.rung.next .rung-label { color: var(--primary); font-weight: 600; }
.rung.next::before { content: 'next'; position: absolute; bottom: 30px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--primary); white-space: nowrap; }
.rung.over .rung-dot { border-color: var(--error); border-style: dotted; }
.rung.over .rung-label { color: var(--error); }
.rung.plateau .rung-dot { border-color: var(--outline-variant); border-style: dotted; }
.rung.plateau .rung-label { color: var(--outline); }
.rung.best .rung-dot { box-shadow: 0 0 0 4px rgba(0, 105, 72, .10); }

.next-step { display: flex; gap: 13px; align-items: flex-start; background: var(--surface-low); border-radius: var(--radius-lg); padding: 14px 16px; }
.next-step.back { background: var(--tertiary-fixed); }
.next-chip { flex: none; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: var(--primary); color: #fff; padding: 4px 10px; border-radius: 99px; }
.next-chip.good { background: var(--primary-container); }
.next-chip.warnchip { background: var(--tertiary); }
.next-chip.plateauchip { background: var(--outline); }
.jnote { border-left: 2px solid var(--tertiary-fixed); padding-left: 13px; margin-top: 14px; }

/* ------------------------------------------------------------- charts */

.curve { max-width: 560px; display: block; margin: 10px 0 4px; }
.curve .ct { fill: var(--on-surface-variant); font-size: 10px; font-family: var(--font-body); }
.curve .ct.good { fill: var(--primary); font-weight: 600; }

.bell { display: block; width: 100%; max-width: 660px; }
.bell .area { fill: var(--primary); opacity: .13; }
.bell .line { fill: none; stroke: var(--primary); stroke-width: 2; }
.bell .axis { stroke: var(--outline-variant); }
.bell .grid { stroke: var(--surface-high); }
.bell .marker { stroke: var(--primary); stroke-width: 1.5; stroke-dasharray: 3 3; }
.bell .marker-dot { fill: var(--surface-lowest); stroke: var(--primary); stroke-width: 3; }
.bell .lbl { fill: var(--on-surface-variant); font-size: 10px; font-family: var(--font-body); font-variant-numeric: tabular-nums; }
.bell .lbl.sig { fill: var(--on-surface); font-weight: 600; font-size: 10.5px; }
.bell .lbl.tiny { fill: var(--outline); font-size: 9px; }
.bell .flagbox { fill: var(--inverse-surface); }
.bell .flagtext { fill: var(--inverse-on-surface); font-size: 10.5px; font-weight: 600; font-family: var(--font-body); }

.explorer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.explorer-read { display: flex; gap: 28px; flex-wrap: wrap; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; max-width: 660px; height: 4px; border-radius: 99px; background: var(--surface-high); outline: none; margin: 16px 0 4px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-lowest); border: 3px solid var(--primary); cursor: grab; box-shadow: var(--shadow-sm); }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--surface-lowest); border: 3px solid var(--primary); cursor: grab; }
.range-ends { display: flex; justify-content: space-between; max-width: 660px; color: var(--outline); font-size: 11px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- prose */

.note { color: var(--on-surface-variant); font-size: 12.5px; line-height: 18px; }
/* Declared before the media queries, or the base rule wins the cascade and the
   mobile-only content never appears. */
.mobile-only { display: none; }
code { background: var(--surface-container); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }
ul.tight, ol.tight { margin: 0 0 .85em; padding-left: 20px; }
ul.tight li, ol.tight li { margin-bottom: .35em; }
details { border-bottom: 1px solid var(--surface-high); }
details summary { cursor: pointer; color: var(--on-surface); font-size: 13.5px; font-weight: 500; padding: 12px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: ''; width: 8px; height: 8px; border-right: 1.8px solid var(--outline); border-bottom: 1.8px solid var(--outline); transform: rotate(45deg); margin-right: 4px; }
details[open] summary::after { transform: rotate(-135deg); }
details summary:hover { color: var(--primary); }
details .body { padding: 0 0 14px; color: var(--on-surface-variant); font-size: 13px; }

.provenance { border-left: 3px solid var(--primary); background: var(--surface-low); border-radius: 0 var(--radius-lg) var(--radius-lg) 0; padding: 15px 19px; margin: 18px 0; }
.provenance.partial { border-left-color: var(--tertiary); }
dl.prov { display: grid; grid-template-columns: 200px 1fr; gap: 7px 18px; margin: 10px 0 0; font-size: 13px; }
dl.prov dt { color: var(--on-surface-variant); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; padding-top: 2px; }
dl.prov dd { margin: 0; }
@media (max-width: 700px) { dl.prov { grid-template-columns: 1fr; gap: 2px 0; } dl.prov dd { margin-bottom: 10px; } }

.faq-table td { vertical-align: top; font-size: 13px; }
.reflist { list-style: none; padding: 0; margin: 0; }
.reflist li { padding: 12px 0; border-top: 1px solid var(--surface-high); font-size: 13px; }

.line-head { display: flex; justify-content: space-between; gap: 22px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 10px; }
.line-goal { max-width: 340px; text-align: right; }
.targets { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.target { background: var(--surface-low); color: var(--on-surface-variant); border-radius: 99px; padding: 6px 14px; font-size: 12px; font-weight: 500; }

/* ------------------------------------------------------------- footer */

.sitefoot { background: var(--surface-low); margin-top: 40px; padding: 32px var(--margin); }
.sitefoot-inner { max-width: var(--maxw); margin: 0 auto; display: grid; gap: 28px; }
@media (min-width: 900px) { .sitefoot-inner { grid-template-columns: 2fr 1fr 1fr; } }
.sitefoot h5 { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--on-surface-variant); margin: 0 0 10px; font-weight: 600; }
.sitefoot ul { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.sitefoot li { margin-bottom: 7px; color: var(--on-surface-variant); }
.foot-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.foot-badge { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--outline-variant); border-radius: var(--radius-lg); padding: 6px 11px; font-size: 11px; color: var(--on-surface-variant); }
.footrule { max-width: var(--maxw); margin: 24px auto 0; padding-top: 16px; border-top: 1px solid var(--surface-high); font-size: 11.5px; color: var(--on-surface-variant); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* =========================================================================
   Narrow screens.

   The site was laid out at desktop width, so this is where it learns what to do
   on a phone. The rule that matters most: nothing may be wider than the screen.
   A single over-wide table stretches the whole page, and then every section
   scrolls sideways — which reads as "the site is broken" rather than "this table
   is wide".
   ========================================================================= */

@media (max-width: 860px) {
  :root { --margin: 1rem; --gutter: 1rem; }

  /* Header stacks: brand on one line, nav scrolls horizontally under it. */
  .topbar-inner { height: auto; padding: 10px var(--margin); flex-wrap: wrap; gap: 10px; }
  .brand { flex: 1 1 auto; }
  nav {
    order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  nav::-webkit-scrollbar { display: none; }
  nav button { flex: 0 0 auto; }
  .chips { order: 2; }
  .version-chip { display: none; }

  .contextbar-inner { padding: 8px var(--margin); gap: 4px 10px; }
  .banner { padding: 8px var(--margin); }
  main { padding: var(--gutter) var(--margin) 36px; }

  /* Type steps down — the scale already exists, it just needed telling. */
  h1 { font-size: 24px; line-height: 32px; }
  h2 { font-size: 19px; line-height: 26px; }
  .metric { font-size: 28px; line-height: 34px; }
  .metric.sm { font-size: 22px; line-height: 28px; }
  .stat .v { font-size: 20px; line-height: 26px; }
  .body-lg { font-size: 15px; line-height: 22px; }

  .card, .hero { padding: 16px; border-radius: 10px; }
  .hero-inner { gap: 18px; }
  .hero-stats { width: 100%; }
  .hero-stat { flex: 1 1 150px; min-width: 150px; padding: 13px 15px; }
  .statrow { gap: 18px; }
  .controls { gap: 12px; }
  .control { flex: 1 1 100%; }
  select, input[type="number"], input[type="text"], input[type="date"] { min-width: 0; width: 100%; }

  /* Tables scroll inside their own card instead of dragging the page wide. */
  .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td { padding: 9px 8px; white-space: nowrap; }
  th { font-size: 10px; }
  .col-opt { display: none; }          /* secondary columns step aside */
  .mobile-only { display: block; }    /* ...and what they carried reappears inline */
  .zbar { min-width: 76px; }

  /* Roads: bigger tap targets, and only the labels that matter. */
  .road { margin: 58px 34px 56px; }
  .rung { padding: 14px; }
  .rung-label { display: none; }
  .rung.current .rung-label, .rung.next .rung-label, .rung.best .rung-label { display: block; }
  /* Adjacent markers put these captions on top of each other at phone width. The card
     header already says "You are here: 90 min/week", so only "next" needs to survive. */
  .rung.current::before { display: none; }
  .ladder-head { gap: 8px; }
  .ladder-now { text-align: left; }

  .line-goal { text-align: left; max-width: 100%; }
  .pod-events { gap: 6px; }

  .sitefoot { padding: 24px var(--margin); }
  .avatar-edit { gap: 14px; }

}

/* Phones proper. */
@media (max-width: 560px) {
  h1 { font-size: 21px; line-height: 28px; }
  .metric { font-size: 25px; line-height: 32px; }
  .hero-stat { flex: 1 1 100%; }
  .identity .who { display: none; }
  #chip-cohort { display: none; }
     /* chevrons between steps */

  .explorer-read { gap: 16px; }
  .range-ends { font-size: 10px; }
}

/* Touch devices: no hover-grow on things you tap. */
@media (hover: none) {
  .rung:hover .rung-dot { transform: none; }
  .btn, .rung, nav button, .choice { touch-action: manipulation; }
}

textarea {
  font-family: var(--font-body); font-size: 13px; color: var(--on-surface); width: 100%;
  background: var(--surface-lowest); border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg); padding: 10px 12px; resize: vertical;
}
textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 105, 72, .12); }

@media (max-width: 560px) {

}

/* ------------------------------------------------- add button and empty states */

.add-btn { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; padding: 8px 14px; font-size: 13px; }
@media (max-width: 860px) { .add-btn .add-label { display: none; } .add-btn { padding: 8px 10px; } }

/* A card or pillar with nothing measured in it. Muted enough to read as "not filled in",
   still legible enough to say what is missing — greying out must not mean hiding. */
.unmeasured { background: var(--surface-2, #f7f8fa); border-style: dashed; }
.unmeasured .bell .line { stroke-dasharray: 4 4; opacity: .55; }
.unmeasured .statstrip .v, .unmeasured .statstrip .k { opacity: .6; }
.metric.empty { color: var(--muted, #94a3b8); font-weight: 600; }
.pillar.unmeasured .pillar-rows .pillar-row.empty .name { color: var(--muted, #94a3b8); }
.pillar-row.empty { opacity: .85; }

/* The entry form is the most-used thing on the page; it should look it. */
#entryform { border-left: 3px solid var(--primary); }
#entryform.flash { animation: flashcard 1.1s ease-out; }
@keyframes flashcard {
  0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, .45); }
  100% { box-shadow: 0 0 0 16px rgba(5, 150, 105, 0); }
}

/* The VO2max estimator is optional — you may already have a lab number — so it opens
   on request rather than filling the form by default. */
details.card > summary { cursor: pointer; list-style: none; display: block; text-align: left; }
details.card > summary .sub { display: block; margin-top: 2px; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: '\25B8  '; color: var(--primary); font-weight: 700; }
details.card[open] > summary::before { content: '\25BE  '; }

/* ------------------------------------------------------- iconography */

/* One glyph per measurement, the same glyph on every page. The eye learns the shape
   once and then finds the row without reading. */
.ev-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; flex: 0 0 26px; border-radius: 7px;
  background: var(--surface-container); color: var(--on-surface-variant);
}
td .ev-ico { margin-right: 9px; }
.ev-cell { display: flex; align-items: center; }
.ev-cell .ev-ico { color: var(--primary); background: color-mix(in srgb, var(--primary) 9%, transparent); }
.unmeasured .ev-ico, .pillar-row.empty .ev-ico { opacity: .5; }

/* Line-of-effort identity: an accent, never a fill. Six tinted card backgrounds down a
   page reads as a consumer wellness app and fights the emerald; the same colour on a
   chip and a 3px edge carries the identity and still looks like a clinical instrument. */
.line-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px;
  background: color-mix(in srgb, var(--chip) 11%, transparent);
  color: var(--chip);
}
.line-chip.sm { width: 24px; height: 24px; flex-basis: 24px; border-radius: 6px; }
.line-cell { display: flex; align-items: center; gap: 10px; }
.line-accent { border-left: 3px solid var(--chip, var(--primary)); }
.line-title { display: flex; align-items: center; gap: 11px; }

/* ------------------------------------------------------- getting-started plan */

.startlist { list-style: none; margin: 16px 0 0; padding: 0; }
.startstep { display: flex; gap: 13px; padding: 14px 0; border-top: 1px solid var(--outline-variant); }
.startstep:first-child { border-top: 0; padding-top: 4px; }
.startstep.done .startbody > .starthead strong { color: var(--on-surface-variant); }

.tick {
  flex: 0 0 22px; width: 22px; height: 22px; margin-top: 2px; padding: 0;
  border: 1.8px solid var(--outline); border-radius: 6px; background: var(--surface);
  color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.tick:hover:not(:disabled) { border-color: var(--primary); }
.tick.on { background: var(--primary); border-color: var(--primary); }
.tick.auto { cursor: default; border-style: dashed; }
.tick.auto.on { border-style: solid; }

.startbody { flex: 1; min-width: 0; }
.starthead { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.starthead .ev-ico { width: 22px; height: 22px; flex-basis: 22px; border-radius: 6px; color: var(--primary); background: color-mix(in srgb, var(--primary) 9%, transparent); }
.rankno {
  display: inline-flex; align-items: center; justify-content: center;
  width: 21px; height: 21px; border-radius: 50%; flex: 0 0 21px;
  background: var(--primary); color: #fff; font-size: 11.5px; font-weight: 700;
}
.gearcost {
  font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 99px;
  background: var(--surface-container); color: var(--on-surface-variant);
}

/* A table row for a line with nothing marked. Muted, never dashed — the dashed border
   belongs to cards; on a <tr> it draws a box round every cell. */
.unmarked-row td:first-child strong { color: var(--on-surface-variant); font-weight: 600; }
.unmarked-row .line-chip { opacity: .55; }

/* A road nobody has marked yet: every stop equally available, none claimed. */
.rung.unset .rung-dot { border-style: dashed; opacity: .75; }
.rung.unset:hover .rung-dot { border-color: var(--primary); opacity: 1; }
.rung.unset .rung-label { color: var(--on-surface-variant); }
.ladder-now .v .sub { font-style: italic; }

/* ---------------------------------------------------------------- labs panel */

/* A blood draw is one date and a dozen numbers, so the fields are laid out as a grid
   to be filled top to bottom off a printed report, not as a queue of single entries. */
.labgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 18px; }
.labfield label {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  color: var(--on-surface-variant); margin-bottom: 6px;
}
.labfield .ev-ico { width: 20px; height: 20px; flex-basis: 20px; border-radius: 5px; color: var(--primary); background: color-mix(in srgb, var(--primary) 9%, transparent); }
.labinput { display: flex; gap: 8px; align-items: center; }
.labinput input { flex: 1 1 auto; min-width: 0; }
.labinput select { flex: 0 1 auto; max-width: 56%; font-size: 12px; }
.labunit { flex: 0 0 auto; font-size: 12px; color: var(--on-surface-variant); }

/* --------------------------------------------------------- where you stand */

.standgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; margin-top: 16px; }
.standcard { border: 1px solid var(--outline-variant); border-radius: 14px; padding: 16px; background: var(--surface-lowest); }
.standcard.unmeasured { background: var(--surface-2, #f7f8fa); border-style: dashed; }

.stand-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.stand-value { text-align: right; white-space: nowrap; }
.stand-band { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin: 12px 0 10px; }

/* The spectrum. Each band is a segment; the one you are in is filled and labelled.
   Deliberately flat and unsaturated — a level display is one step from a progress bar
   with a trophy on it, and this is a clinical instrument. */
.spectrum { display: flex; gap: 3px; margin: 10px 0 0; }
.sband {
  flex: 1 1 0; min-width: 0; padding: 7px 6px 8px; border-radius: 7px;
  background: var(--surface-container); text-align: center;
  display: flex; flex-direction: column; gap: 2px;
}
.sband-label { font-size: 10.5px; font-weight: 600; line-height: 1.15; color: var(--on-surface-variant); }
.sband-range { font-size: 9.5px; color: var(--on-surface-variant); opacity: .75; }
.sband.here { background: var(--primary); }
.sband.here .sband-label, .sband.here .sband-range { color: #fff; opacity: 1; }
.sband.here.good { background: var(--primary); }
.sband.here.poor { background: var(--error, #b3261e); }
.sband.unreachable { opacity: .4; }
.sband.unreachable .sband-label { text-decoration: line-through; }

.stand-next {
  display: flex; align-items: flex-start; gap: 9px; margin-top: 12px;
  padding: 10px 12px; border-radius: 9px; background: var(--surface-container);
  font-size: 12.5px; line-height: 1.4;
}
.stand-next.done { color: var(--on-surface-variant); }
.stand-next .next-chip { flex: 0 0 auto; }

@media (max-width: 560px) {
  .sband-range { display: none; }
  .sband-label { font-size: 9.5px; }
}

/* ------------------------------------------------------- the composite card */

/* The bell curve is the most distinctive thing here and it earns the space: it is what
   makes the age-normalisation legible rather than merely asserted. */
.composite-card { padding: var(--gutter); }
.comp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
.comp-score {
  font-family: var(--font-display); font-size: 58px; line-height: 1.02; font-weight: 800;
  letter-spacing: -.02em; color: var(--primary); margin-top: 2px;
}
.comp-score.empty { color: var(--on-surface-variant); font-weight: 600; }
.comp-sigma { font-size: 30px; font-weight: 700; margin-left: 2px; opacity: .72; }
.comp-standing { font-size: 14px; font-weight: 600; color: var(--on-surface); margin-top: 4px; }

.comp-pcts { display: flex; gap: 10px; }
.comp-pct {
  min-width: 92px; padding: 11px 14px; border-radius: 11px;
  background: var(--surface-container); text-align: right;
}
.comp-pct .k { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--on-surface-variant); }
.comp-pct .v { font-family: var(--font-display); font-size: 24px; font-weight: 700; margin-top: 2px; }

.comp-explain { margin-top: 4px; }
.comp-made { margin: 20px 0 10px; }
.comp-domains { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 11px; }
.comp-domain {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 11px; background: var(--surface-container);
}
.comp-domain.empty { background: transparent; border: 1px dashed var(--outline-variant); }
.comp-domain-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.comp-domain-head .ev-ico { color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); }
.comp-domain.empty .ev-ico { opacity: .5; }
.comp-domain-z { flex: 0 0 auto; }

@media (max-width: 560px) {
  .comp-score { font-size: 46px; }
  .comp-pcts { width: 100%; }
  .comp-pct { flex: 1; text-align: left; }
}

/* ----------------------------------------------------------- install prompt */

.installbox {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; margin-top: 10px;
  padding: 13px 15px; border-radius: 11px;
  background: color-mix(in srgb, var(--primary) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
  font-size: 13px; line-height: 1.45;
}
.installbox.manual { display: block; }
.installbox.done {
  display: flex; align-items: flex-start;
  background: var(--surface-container); border-color: transparent;
}
.installbox.done svg { flex: 0 0 auto; color: var(--primary); margin-top: 2px; }
.installbox ol { margin: 0; padding-left: 18px; }
.installbox .btn { flex: 0 0 auto; }

/* --------------------------------------------------------------- group board */

/* The opt-in screen shows the literal payload. A privacy notice nobody reads is not
   consent; four lines of JSON anyone can check in five seconds is. */
.payload {
  margin: 12px 0 0; padding: 13px 15px; border-radius: 10px;
  background: var(--surface-container); color: var(--on-surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; line-height: 1.55; overflow-x: auto; white-space: pre;
}
