/* RecoveryRx prototype styles. Calm teal for actions, gold for "needs your attention", red only for missed or unsafe. */
:root {
  --bg: #f2f6f6; --surface: #ffffff; --surface-2: #e8efef; --ink: #13222a; --muted: #536871; --line: #d3dede;
  --navy: #252d3a; --navy-ink: #ffffff;
  --accent: #0d6c66; --accent-ink: #ffffff; --accent-soft: #dbefec;
  --gold: #d4a843; --gold-ink: #3d2c05; --gold-soft: #fbf1d8;
  --danger: #b42318; --danger-soft: #fde5e1; --ok: #1d7438; --ok-soft: #dff2e5;
  --m1: #0d6c66; --m2: #4054b2; --m3: #a35a00; --m4: #b2365d; --m5: #4d7a2a; --m6: #7a4bb0;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1517; --surface: #142024; --surface-2: #1b2a2f; --ink: #e3ecec; --muted: #9bb0b5; --line: #2a3b40;
    --navy: #1a212b; --accent: #52c3b7; --accent-ink: #052320; --accent-soft: #113936;
    --gold: #e6bd5c; --gold-ink: #2a1f04; --gold-soft: #33280f;
    --danger: #ff8b7f; --danger-soft: #3b1613; --ok: #6ccb8a; --ok-soft: #11301b;
    --m1: #52c3b7; --m2: #8f9ff0; --m3: #f1a54a; --m4: #f08aab; --m5: #9ccf6f; --m6: #c3a0f0;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }
.banner { background: var(--gold-soft); color: var(--ink); font-size: 13px; border-bottom: 1px solid color-mix(in srgb, var(--gold) 50%, transparent); }
.banner .wrap { padding-block: 7px; }
header.top { background: var(--navy); color: var(--navy-ink); }
header.top .wrap { padding-block: 14px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.brand h1 { font-size: 22px; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.brand h1 .rx { color: #6fd3c8; }
.brand .sub { font-size: 13px; opacity: .8; }
.clock { font-size: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; opacity: .95; }
.clock button { background: transparent; color: inherit; border: 1px solid rgba(255,255,255,.35); border-radius: 6px; padding: 1px 8px; cursor: pointer; font-size: 12px; }
.clock .now { font-family: var(--mono); }
nav.tabs { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
nav.tabs .wrap { display: flex; gap: 2px; overflow-x: auto; }
nav.tabs a { padding: 11px 12px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 500; font-size: 15px; }
nav.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
main .wrap { padding-block: 18px 60px; display: grid; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; min-width: 0; }
.card h2 { font-size: 18px; margin: 0; font-weight: 600; }
.card h3 { font-size: 15px; margin: 0; font-weight: 600; }
.card p { margin: 0; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); } .small { font-size: 14px; } .tiny { font-size: 12px; }
.split { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 500; font-size: 15px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.gold { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.btn.big { padding: 13px 18px; font-size: 16px; }
.btn.danger { color: var(--danger); }
.btn.link { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.gold { background: var(--gold-soft); color: var(--gold-ink); border: 1px solid var(--gold); }
.pill.danger { background: var(--danger-soft); color: var(--danger); } .pill.neutral { background: var(--surface-2); color: var(--muted); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
@media (prefers-color-scheme: dark) { .pill.gold { color: var(--gold); } }
.status { border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 6px; border: 1px solid transparent; }
.status.ok { background: var(--ok-soft); } .status.gold { background: var(--gold-soft); border-color: var(--gold); }
.status.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.status .title { font-weight: 600; }
.status.danger .title { color: var(--danger); }
.status ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
/* welcome */
.hero { text-align: left; padding: 22px; gap: 14px; }
.hero h2 { font-size: 24px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.choice { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 8px; background: var(--surface); text-align: left; cursor: pointer; }
.choice:hover { border-color: var(--accent); }
.choice b { font-size: 17px; }
/* wizard */
.steps { display: flex; gap: 6px; flex-wrap: wrap; counter-reset: step; }
.steps button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px 5px 6px; font-size: 13px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.steps button::before { counter-increment: step; content: counter(step); width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); display: inline-grid; place-items: center; font-size: 12px; font-weight: 600; }
.steps button[aria-current="step"] { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.steps button[aria-current="step"]::before { background: var(--accent); color: var(--accent-ink); }
.steps button.done::before { content: "✓"; background: var(--accent-soft); color: var(--accent); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
label.f { display: grid; gap: 4px; font-size: 14px; color: var(--muted); min-width: 0; }
label.f input, label.f select, label.f textarea, .inline select, .inline input { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 9px 10px; width: 100%; min-width: 0; color: var(--ink); font-size: 16px; }
.inline select, .inline input { width: auto; display: inline-block; padding: 6px 8px; }
label.f textarea { min-height: 96px; resize: vertical; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
label.check input { margin-top: 5px; width: 18px; height: 18px; }
.medcard { border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; background: var(--surface); }
.medcard .head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.addbox { background: var(--surface-2); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; }
.rule { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; }
.q { border: 1px solid var(--gold); background: var(--gold-soft); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 8px; }
.q.done { border-color: var(--line); background: var(--surface); }
.q .qt { font-weight: 600; }
.wiznav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
/* today */
.next { border: 2px solid var(--accent); }
.next.due { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
.bigtime { font-size: 44px; font-weight: 600; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.dose { display: grid; grid-template-columns: 12px 1fr auto; gap: 4px 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.dose:first-of-type { border-top: 0; }
.dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; display: inline-block; flex: none; }
.dose .name { font-weight: 600; }
.dose .meta { font-size: 14px; color: var(--muted); }
.dose .full { grid-column: 2 / -1; min-width: 0; }
details.why summary { cursor: pointer; color: var(--accent); font-size: 14px; font-weight: 500; }
details.why ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; display: grid; gap: 3px; }
details.why li.calc { color: var(--muted); }
.checklist { width: 100%; border-collapse: collapse; font-size: 15px; }
.checklist td { padding: 9px 6px; border-top: 1px solid var(--line); vertical-align: middle; }
.checklist tr.dayhead td { border-top: 0; padding-top: 14px; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.checklist td.t { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; width: 88px; }
.checklist td.box { width: 40px; }
.checklist td.box input { width: 22px; height: 22px; accent-color: var(--accent); cursor: pointer; }
.checklist tr.missed td { color: var(--danger); }
.checklist tr.missed td.t { text-decoration: line-through; }
.checklist tr.taken td { color: var(--muted); }
.checklist tr.duenow td { background: var(--gold-soft); }
.checklist tr.over td.m::after { content: " · over acetaminophen limit"; color: var(--danger); font-size: 12px; font-weight: 600; }
.meter { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.meter.warn i { background: var(--gold); } .meter.over i { background: var(--danger); }
.notes { white-space: pre-wrap; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 15px; }
.form { display: grid; gap: 10px; background: var(--surface-2); border-radius: 10px; padding: 12px; }
.empty { padding: 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
/* timeline */
.tl { display: grid; gap: 14px; }
.tl .axis, .tl .track { position: relative; height: 30px; }
.tl .lname { font-size: 14px; font-weight: 600; display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.tl .track { background: var(--surface-2); border-radius: 6px; }
.tl .tick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.tl .lbl { position: absolute; top: 5px; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.tl .mk { position: absolute; top: 50%; width: 15px; height: 15px; border-radius: 50%; transform: translate(-50%, -50%); border: 2px solid var(--surface); }
.tl .mk.taken { opacity: .5; } .tl .mk.missed { background: var(--danger) !important; }
.tl .band { position: absolute; top: 7px; bottom: 7px; background: color-mix(in srgb, var(--ok) 30%, transparent); border-radius: 4px; }
.tl .nowline { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--gold); }
.tl .night { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--navy) 10%, transparent); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
/* tables */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table.data { border-collapse: collapse; width: 100%; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.adjusted td { background: var(--gold-soft); }
.qr { display: grid; place-items: center; padding: 12px; background: #fff; border-radius: 10px; width: max-content; }
.rec { display: inline-flex; align-items: center; gap: 6px; }
.rec.on::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .2; } }
footer .wrap { padding-block: 0 40px; font-size: 12px; color: var(--muted); }
#printsheet { display: none; }
@media (max-width: 560px) {
  .bigtime { font-size: 36px; }
  .dose { grid-template-columns: 12px 1fr; }
  .dose .actions { grid-column: 2; }
}
@media print {
  body { background: #fff; color: #000; font-size: 12pt; }
  .banner, header.top, nav.tabs, main, footer { display: none !important; }
  #printsheet { display: block; padding: 0; }
  #printsheet h1 { font-size: 18pt; margin: 0 0 4pt; }
  #printsheet table { width: 100%; border-collapse: collapse; margin: 8pt 0; }
  #printsheet th, #printsheet td { border: 1px solid #999; padding: 5pt 6pt; text-align: left; vertical-align: top; font-size: 11pt; }
  #printsheet .box { width: 14pt; height: 14pt; border: 1.5px solid #000; display: inline-block; }
  #printsheet .notes { background: none; border: 1px solid #999; }
}

/* full-list search */
.results { display: grid; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; max-height: 360px; overflow-y: auto; background: var(--surface); }
.result { text-align: left; background: var(--surface); border: 0; border-top: 1px solid var(--line); padding: 10px 12px; cursor: pointer; font-size: 15px; }
.result:first-child { border-top: 0; }
.result:hover, .result:focus-visible { background: var(--accent-soft); }
