/* HELM Strong Recovery & Readiness — prototype styles
   Palette and type follow the existing HELM Strong site. */
:root {
  --black: #0d0c0c;
  --ink: #191919;
  --ink-2: #3c3a3a;
  --ink-3: #6a6164;
  --burgundy: #651d32;
  --burgundy-deep: #471324;
  --burgundy-bright: #86294a;
  --cream: #f5f0e6;
  --cream-2: #ebe4d3;
  --cream-3: #d9cfb8;
  --white: #ffffff;
  --gold: #b39a65;
  --gold-light: #d2bf90;
  --alert: #a3171f;
  --alert-bg: #fbeeee;
  --ok: #1f5a45;
  --ok-bg: #e3efe7;
  --warn: #8a5a00;
  --warn-bg: #f7ead0;
  --series-1: #86294a;
  --series-2: #b8892f;
  --radius: 10px;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-label: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --font-body: "Barlow", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --side: 248px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.45; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.12; letter-spacing: -0.01em; margin: 0 0 .4em; text-wrap: balance; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
p { margin: 0 0 .7em; }
a { color: var(--burgundy); }
button, input, select, textarea { font: inherit; color: inherit; }
.label, .eyebrow { font-family: var(--font-label); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; font-size: .8rem; color: var(--ink-3); }
.eyebrow { color: var(--burgundy); margin-bottom: .25rem; }
.muted { color: var(--ink-3); } .small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Splash & login ---------- */
.splash { position: fixed; inset: 0; background: #fff; display: grid; place-items: center; z-index: 50; }
.splash video { width: min(86vw, 560px); max-height: 80vh; object-fit: contain; }
.splash .skip { position: absolute; bottom: max(24px, env(safe-area-inset-bottom)); right: 24px; }
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.login-hero { background: var(--black); color: var(--cream); padding: 40px 24px 32px; text-align: center; border-bottom: 3px solid var(--burgundy); }
.login-hero img { width: 168px; height: 168px; object-fit: contain; }
.login-hero .brand { font-family: var(--font-label); font-weight: 700; letter-spacing: .22em; font-size: 1.7rem; text-transform: uppercase; margin-top: 8px; }
.login-hero .sub { font-family: var(--font-label); letter-spacing: .26em; text-transform: uppercase; color: var(--gold-light); font-size: .9rem; }
.login-hero p { max-width: 34ch; margin: 14px auto 0; color: #cfc8ba; }
.login-body { padding: 24px 16px 40px; max-width: 560px; width: 100%; margin: 0 auto; }
.acct { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--white); border: 1px solid var(--cream-3); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; cursor: pointer; min-height: 64px; }
.acct:hover, .acct:focus-visible { border-color: var(--burgundy); box-shadow: 0 0 0 3px rgba(101,29,50,.14); outline: none; }
.acct .who { flex: 1; min-width: 0; }
.acct .who b { display: block; }
.acct .chev { color: var(--burgundy); font-size: 1.3rem; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--burgundy); color: var(--cream); display: grid; place-items: center; font-family: var(--font-label); font-weight: 700; letter-spacing: .06em; flex: none; }
@media (min-width: 900px) {
  .login { grid-template-columns: 5fr 6fr; }
  .login-hero { display: flex; flex-direction: column; justify-content: center; align-items: center; border-bottom: 0; border-right: 3px solid var(--burgundy); }
  .login-hero img { width: 240px; height: 240px; }
  .login-body { align-self: center; padding: 48px 32px; }
}

/* ---------- Shell ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--black); color: var(--cream); display: flex; align-items: center; gap: 10px; padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top)); border-bottom: 2px solid var(--burgundy); }
.topbar img { width: 42px; height: 42px; object-fit: contain; flex: none; }
.topbar .brand { flex: 1; min-width: 0; line-height: 1.05; }
.topbar .brand b { font-family: var(--font-label); letter-spacing: .18em; font-size: 1.1rem; text-transform: uppercase; display: block; }
.topbar .brand span { font-family: var(--font-label); letter-spacing: .16em; font-size: .68rem; text-transform: uppercase; color: var(--gold-light); white-space: nowrap; }
.sos { background: var(--alert); color: #fff; border: 0; border-radius: 999px; padding: 8px 12px; font-family: var(--font-label); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: .8rem; cursor: pointer; min-height: 40px; white-space: nowrap; }
.userchip { background: none; border: 1px solid #4a4444; color: var(--cream); border-radius: 999px; min-height: 40px; padding: 0 12px; cursor: pointer; font-size: .85rem; white-space: nowrap; }
.userchip .long { display: none; }
.sidenav { display: none; }
main { padding: 16px 16px 96px; max-width: 1080px; margin: 0 auto; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--white); border-top: 1px solid var(--cream-3); display: flex; padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; text-decoration: none; color: var(--ink-3); font-family: var(--font-label); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .7rem; min-height: 56px; }
.tabbar a.on { color: var(--burgundy); box-shadow: inset 0 3px 0 var(--burgundy); }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
@media (min-width: 900px) {
  .tabbar { display: none; }
  .userchip .long { display: inline; }
  .sidenav { display: block; position: fixed; top: 60px; bottom: 0; left: 0; width: var(--side); background: var(--ink); color: var(--cream); padding: 18px 12px; overflow-y: auto; }
  .sidenav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 8px; color: #d8d1c3; text-decoration: none; font-weight: 500; margin-bottom: 2px; }
  .sidenav a:hover { background: #2a2727; }
  .sidenav a.on { background: var(--burgundy); color: #fff; }
  .sidenav .foot { margin-top: 22px; padding: 12px; font-size: .78rem; color: #9d968a; border-top: 1px solid #383434; }
  main { margin-left: var(--side); padding: 28px 32px 56px; max-width: none; }
  main > .wrap { max-width: 1080px; }
  h1 { font-size: 2.1rem; }
}

/* ---------- Components ---------- */
.card { background: var(--white); border: 1px solid var(--cream-3); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card.dark { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.card.dark .label, .card.dark .muted { color: #b5ad9f; }
.card.accent { border-left: 4px solid var(--burgundy); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
.grid > .card { margin-bottom: 0; }
.grid { margin-bottom: 14px; }
@media (min-width: 760px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--white); border: 1px solid var(--cream-3); border-radius: var(--radius); padding: 12px 14px; }
.tile .v { font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .v small { font-family: var(--font-body); font-size: .85rem; font-weight: 500; color: var(--ink-3); }
.tile .d { font-size: .8rem; color: var(--ink-3); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 8px; border: 1.5px solid var(--burgundy); background: var(--burgundy); color: #fff; font-family: var(--font-label); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; font-size: .95rem; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--burgundy-deep); }
.btn.ghost { background: transparent; color: var(--burgundy); }
.btn.ghost:hover { background: rgba(101,29,50,.07); }
.btn.light { background: var(--cream); color: var(--ink); border-color: var(--cream); }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: .82rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--cream-2); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--alert-bg); color: var(--alert); }
.pill.demo { background: #f0d9a8; color: #4a3200; }
.banner { background: var(--warn-bg); border: 1px solid #dcc38a; color: #3d2a00; border-radius: var(--radius); padding: 10px 12px; font-size: .875rem; margin-bottom: 14px; }
.banner.red { background: var(--alert-bg); border-color: #e3b5b8; color: #5c0d12; }
.banner.plain { background: var(--cream-2); border-color: var(--cream-3); color: var(--ink-2); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-top: 1px solid var(--cream-2); display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.list li:first-child { border-top: 0; padding-top: 0; }
.list li > div { min-width: 0; }
.bul { margin: 0; padding-left: 1.1em; } .bul li { margin-bottom: .3em; }
.rowlink { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--white); border: 1px solid var(--cream-3); border-radius: var(--radius); margin-bottom: 10px; text-decoration: none; color: inherit; }
.rowlink:hover { border-color: var(--burgundy); }
.rowlink .grow { flex: 1; min-width: 0; }
.tablewrap { overflow-x: auto; margin: 0 -4px; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th { text-align: left; font-family: var(--font-label); letter-spacing: .1em; text-transform: uppercase; font-size: .74rem; color: var(--ink-3); padding: 6px 8px; border-bottom: 1.5px solid var(--cream-3); white-space: nowrap; }
td { padding: 9px 8px; border-bottom: 1px solid var(--cream-2); vertical-align: top; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }

/* Forms */
.field { margin-bottom: 14px; }
.field > label, .field > .lab { display: block; font-weight: 600; margin-bottom: 5px; font-size: .95rem; }
.field .hint { font-size: .8rem; color: var(--ink-3); font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=datetime-local], select, textarea { width: 100%; min-height: 46px; padding: 9px 12px; border: 1.5px solid var(--cream-3); border-radius: 8px; background: var(--white); }
textarea { min-height: 84px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid rgba(134,41,74,.45); outline-offset: 1px; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .f3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.scale { display: grid; grid-template-columns: repeat(11, 1fr); gap: 3px; }
.scale button { min-height: 44px; border: 1.5px solid var(--cream-3); background: var(--white); border-radius: 6px; cursor: pointer; font-weight: 600; padding: 0; font-variant-numeric: tabular-nums; }
.scale button.on { background: var(--burgundy); border-color: var(--burgundy); color: #fff; }
.scale-ends { display: flex; justify-content: space-between; font-size: .75rem; color: var(--ink-3); margin-top: 3px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; border: 1.5px solid var(--cream-3); border-radius: 8px; overflow: hidden; background: var(--white); }
.seg button { border: 0; background: none; min-height: 40px; cursor: pointer; font-size: .85rem; padding: 0 4px; border-left: 1px solid var(--cream-2); }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--burgundy); color: #fff; font-weight: 600; }
.symrow { display: grid; grid-template-columns: 1fr; gap: 4px; padding: 8px 0; border-top: 1px solid var(--cream-2); }
.symrow:first-child { border-top: 0; }
@media (min-width: 560px) { .symrow { grid-template-columns: 180px 1fr; align-items: center; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--cream-3); background: var(--white); border-radius: 999px; min-height: 40px; padding: 0 14px; cursor: pointer; font-size: .9rem; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--cream); }
details.more { border-top: 1px solid var(--cream-2); padding-top: 10px; margin-top: 6px; }
details.more > summary { cursor: pointer; font-weight: 600; color: var(--burgundy); padding: 6px 0; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--cream-3); border-radius: 999px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--burgundy); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:disabled { cursor: not-allowed; } .switch input:disabled + span { opacity: .5; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 6px; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--cream-3); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--burgundy); border: 2px solid var(--white); }
.timeline li.future::before { background: var(--white); border-color: var(--burgundy); }
.timeline .when { font-family: var(--font-label); letter-spacing: .1em; text-transform: uppercase; font-size: .76rem; color: var(--ink-3); }

/* Charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { font-size: 10px; fill: var(--ink-3); font-family: var(--font-body); }
.chart .gridl { stroke: var(--cream-2); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart-title { font-weight: 600; font-size: .9rem; margin: 10px 0 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .82rem; color: var(--ink-2); margin: 4px 0 6px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--cream); font-size: .78rem; padding: 6px 9px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -110%); z-index: 5; display: none; line-height: 1.35; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.day { flex: 1; min-width: 58px; text-align: center; border: 1px solid var(--cream-3); border-radius: 8px; padding: 6px 4px; font-size: .78rem; }
.day b { display: block; font-size: .7rem; font-family: var(--font-label); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }

/* Timer */
.timer { text-align: center; padding: 8px 0 4px; }
.timer .ring { width: 220px; height: 220px; margin: 0 auto 12px; position: relative; }
.timer .ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.timer .ring .t { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 3rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Modal & toast */
.modal { position: fixed; inset: 0; background: rgba(13,12,12,.6); z-index: 60; display: grid; place-items: end center; }
.modal .sheet { background: var(--white); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 20px 18px 26px; }
@media (min-width: 620px) { .modal { place-items: center; } .modal .sheet { border-radius: 14px; } }
#toast { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); background: var(--ink); color: var(--cream); padding: 10px 16px; border-radius: 999px; font-size: .9rem; z-index: 70; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; }

/* Print (PDF report) */
.print-only { display: none; }
@media print {
  body { background: #fff; }
  .topbar, .sidenav, .tabbar, .no-print, #toast, #modal-root { display: none !important; }
  main { margin: 0 !important; padding: 0 !important; max-width: none; }
  .print-only { display: block; }
  .card { break-inside: avoid; border-color: #bbb; }
  .report-controls { display: none; }
}

/* ---------- Baseline tasks ---------- */
.stage { min-height: 360px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; }
.rt-pad { width: 100%; max-width: 440px; height: 260px; border-radius: 16px; border: 2px solid var(--cream-3); background: var(--cream); color: var(--ink-2); font-family: var(--font-label); font-weight: 600; font-size: 1.25rem; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; padding: 12px; }
.rt-pad.go { background: var(--burgundy); border-color: var(--burgundy); color: #fff; font-size: 2rem; }
.rt-pad.early { background: var(--alert-bg); border-color: #e3b5b8; color: var(--alert); }
.rt-pad.tapped { border-color: var(--burgundy); }
.rt-pad .stim { text-transform: none; }
.stim { font-family: var(--font-display); font-size: 3.2rem; font-weight: 600; min-height: 1.3em; line-height: 1.2; letter-spacing: 0; color: var(--ink); }
.stim.entry { font-size: 2.2rem; letter-spacing: .12em; }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 8px; justify-content: center; }
.keypad button { min-height: 56px; border-radius: 10px; border: 1.5px solid var(--cream-3); background: var(--white); font-size: 1.3rem; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.keypad button.ok { grid-column: span 2; background: var(--burgundy); border-color: var(--burgundy); color: #fff; font-family: var(--font-label); letter-spacing: .12em; text-transform: uppercase; font-size: 1rem; }
.steps { display: flex; gap: 4px; margin: 6px 0 14px; }
.steps i { flex: 1; height: 5px; border-radius: 3px; background: var(--cream-3); }
.steps i.on { background: var(--burgundy); }
ol.inst { margin: 0 0 14px; padding-left: 1.3em; } ol.inst li { margin-bottom: .45em; }

/* ---------- Instruction audio ---------- */
.audiobar { background: var(--cream); border: 1px solid var(--cream-3); border-radius: var(--radius); padding: 12px; margin: 0 0 14px; }
.audiobar .au-opts { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin: 10px 0 8px; font-size: .9rem; }
.audiobar label { display: inline-flex; align-items: center; gap: 8px; }
.audiobar select { width: auto; min-height: 40px; padding: 4px 10px; }
.audiobar input[type=range] { width: 120px; accent-color: var(--burgundy); }
.audiobar input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--burgundy); }
[data-sent].speaking { background: #f3dfae; box-shadow: 0 0 0 5px #f3dfae; border-radius: 3px; }
