:root {
      --bg: #dedfd8;
      --surface: #f4f0e7;
      --surface-muted: #e4e5dd;
      --surface-deep: #d2d8d1;
      --ink-panel: #263b3a;
      --line: #c8cbc1;
      --line-strong: #aeb5ab;
      --text: #26312f;
      --muted: #68736d;
      --accent: #386457;
      --accent-2: #4b6978;
      --amber: #956833;
      --red: #a45148;
      --green: #4b765e;
    }
    * { box-sizing: border-box; }
    body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
    button, input { font: inherit; }
    button { cursor: pointer; }
    .shell { max-width: 1440px; margin: 0 auto; padding: 28px 28px 48px; }
    .topbar { display:flex; align-items:center; justify-content:space-between; gap: 18px; margin-bottom: 24px; }
    .brand { display:flex; gap: 12px; align-items:center; }
    .brand-mark { width: 42px; height: 42px; border-radius: 8px; display:grid; place-items:center; background: var(--accent); color: var(--surface); font-size: 14px; font-weight: 800; letter-spacing: .06em; }
    .eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .16em; font-weight: 750; font-size: 11px; }
    h1, h2, h3, p { margin: 0; }
    h1 { font-size: 20px; letter-spacing: -.02em; }
    .subtle { color: var(--muted); }
    .top-actions { display:flex; align-items:center; gap: 10px; }
    .badge, .pill { border: 1px solid var(--line-strong); background: transparent; border-radius: 4px; padding: 6px 9px; color: var(--muted); font-size: 12px; }
    .badge strong { color: var(--text); }
    .button { border: 1px solid var(--accent); color: var(--surface); background: var(--accent); border-radius: 6px; padding: 9px 13px; font-weight: 700; transition: background .18s ease; }
    .button:hover { background: #244b40; }
    .button.secondary { background: transparent; color: var(--accent); border-color: var(--line-strong); }
    .button.secondary:hover { background: var(--surface-muted); }
    .button.danger { background: transparent; color: var(--red); border-color: var(--red); }
    .hero { display:grid; grid-template-columns: 1.25fr .75fr; gap: 18px; margin-bottom: 18px; }
    .hero-card, .card { border:1px solid var(--line); background: var(--surface); border-radius: 10px; box-shadow: 0 5px 14px rgba(38,49,47,.045); }
    .hero-card { padding: 28px; position: relative; overflow:hidden; background: var(--ink-panel); border-color: var(--ink-panel); color: #f2eee5; }
    .hero-card .eyebrow { color: #b9c9bd; }
    .hero-card .hero-copy { color: #d2dad2; }
    .hero-card .pill { border-color: #72877d; color: #e5ebe3; }
    .hero h2 { font-size: 31px; max-width: 620px; line-height: 1.08; letter-spacing: -.045em; margin: 8px 0 10px; }
    .hero-copy { color: var(--muted); max-width: 680px; }
    .hero-meta { display:flex; gap: 10px; flex-wrap:wrap; margin-top: 18px; }
    .status-card { padding: 20px; background: var(--surface-deep); }
    .status-head { display:flex; align-items:center; justify-content:space-between; margin-bottom: 15px; }
    .status-dot { width: 10px; height:10px; border-radius:50%; background: var(--red); }
    .status-dot.stable { background: var(--green); }
    .patient-profile { display:flex; align-items:center; gap:12px; margin: 4px 0 15px; }
    .patient-avatar { width:42px; height:42px; display:grid; place-items:center; border:1px solid var(--accent); color:var(--accent); border-radius:50%; font-size:12px; font-weight:800; letter-spacing:.06em; }
    .patient-name { font-size: 21px; font-weight: 780; margin-bottom: 2px; }
    .patient-story { padding: 12px 0 14px; border-top:1px solid var(--line); border-bottom:1px solid var(--line); color:var(--muted); }
    .patient-status-row { display:flex; justify-content:space-between; gap:12px; align-items:end; margin:16px 0 4px; }
    .patient-status { font-size:18px; font-weight:780; }
    .patient-case { color:var(--muted); font-size:12px; text-align:right; }
    .progress { height: 8px; border-radius: 4px; background: var(--surface-muted); overflow:hidden; margin: 16px 0 10px; }
    .progress > span { display:block; height:100%; width: 0%; background: var(--accent); border-radius: inherit; transition: width .3s ease; }
    .progress-row { display:flex; justify-content:space-between; color:var(--muted); font-size:12px; }
    .layout { display:grid; grid-template-columns: minmax(0, 1.55fr) minmax(310px, .75fr); gap: 18px; align-items:start; }
    .card { padding: 20px; }
    .card-title { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; margin-bottom: 15px; }
    .card-title h3 { font-size: 16px; }
    .section-label { color: var(--muted); text-transform:uppercase; letter-spacing:.12em; font-size: 10px; font-weight:800; margin-bottom: 7px; }
    .vitals { display:grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
    .vital { padding: 14px; border-radius: 6px; background: var(--surface-deep); border: 0; }
    .vital .value { font-size: 25px; font-weight: 800; letter-spacing:-.04em; }
    .vital .label { color: var(--muted); font-size: 11px; margin-top:3px; }
    .vital.warn .value { color: var(--amber); }
    .vital.good .value { color: var(--green); }
    .issues { display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .issue { text-align:left; color:var(--text); background: var(--surface); border:1px solid var(--line); border-radius: 8px; padding: 14px; transition: border-color .18s ease, background .18s ease; }
    .issue:hover, .issue.active { border-color: var(--accent); background: #eef0e8; }
    .issue.done { border-color: var(--green); }
    .issue-top { display:flex; align-items:center; justify-content:space-between; gap:10px; }
    .issue-icon { color: var(--accent); font-size:11px; font-weight:800; letter-spacing:.08em; }
    .issue-name { font-weight: 750; margin-top: 8px; }
    .issue-count { color: var(--muted); font-size: 12px; margin-top: 2px; }
    .issue-state { font-size: 10px; text-transform:uppercase; letter-spacing:.08em; color: var(--amber); }
    .issue.done .issue-state { color: var(--green); }
    .treatment { margin-top: 18px; min-height: 260px; }
    .treatment-empty { display:grid; place-items:center; min-height: 220px; text-align:center; color:var(--muted); border:1px dashed var(--line-strong); border-radius: 6px; padding:20px; }
    .empty-mark { color: var(--accent); font-size: 22px; line-height: 1; margin-bottom: 10px; }
    .treatment-content { display:grid; grid-template-columns: 1fr; gap: 18px; }
    .diagnostic-box { background:var(--surface-muted); border-radius: 6px; padding: 16px; border:0; border-left: 4px solid var(--accent-2); }
    .diagnostic-box p { color:var(--muted); }
    .question-text { margin: 0 0 14px; font-size: 15px; line-height: 1.45; }
    .chart { display:flex; align-items:end; gap: 7px; height: 72px; margin: 14px 0 4px; }
    .bar { flex: 1; min-width: 8px; border-radius: 3px 3px 0 0; background: var(--accent-2); }
    .treat-options { display:grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
    .treat-option { display:flex; align-items:flex-start; gap: 10px; padding: 13px; border-radius: 6px; border:1px solid var(--line); background: var(--surface); min-height: 52px; }
    .treat-option input { accent-color: var(--accent); margin-top: 3px; }
    .treat-option strong { display:block; font-size: 13px; }
    .treat-option span { display:block; color:var(--muted); font-size:11px; margin-top:2px; }
    .apply-row { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top: 13px; }
    .feedback { color:var(--green); font-weight:700; font-size:12px; min-height:18px; }
    .feedback.bad { color:var(--red); }
    .side-stack { display:grid; gap:18px; }
    .score-panel { display:grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .score { background:var(--surface-deep); border:0; border-radius:6px; padding:14px; }
    .score .number { font-size: 30px; font-weight: 850; letter-spacing:-.05em; }
    .score small { color:var(--muted); }
    .leaderboard { display:grid; gap: 9px; }
    .leader-row { display:grid; grid-template-columns: 25px 1fr auto; gap: 9px; align-items:center; padding: 9px 0; border-bottom:1px solid var(--line); }
    .leader-row:last-child { border-bottom: 0; }
    .rank { color:var(--muted); font-weight:800; }
    .leader-name { font-weight:700; }
    .leader-meta { color:var(--muted); font-size:11px; }
    .leader-score { color:var(--accent); font-weight:800; }
    .leader-empty { padding: 18px 0 4px; color: var(--muted); }
    .leader-empty strong { display:block; color:var(--text); font-size:13px; margin-bottom:4px; }
    .care-log { display:grid; gap:0; }
    .care-entry { display:grid; grid-template-columns: 8px 1fr; gap:10px; padding: 10px 0; border-bottom:1px solid var(--line); }
    .care-entry:last-child { border-bottom:0; }
    .care-marker { width:8px; height:8px; border-radius:50%; background:var(--accent); margin-top:5px; }
    .care-entry strong { display:block; font-size:12px; }
    .care-entry span { color:var(--muted); font-size:11px; }
    .rank-medal { font-size: 15px; }
    .session-box { color:var(--muted); font-size: 12px; }
    .session-box strong { color:var(--text); }
    .footer { display:flex; justify-content:space-between; align-items:center; gap: 12px; color:var(--muted); font-size:12px; margin-top: 18px; }
    dialog { border:1px solid var(--line-strong); border-radius: 10px; background:var(--surface); color:var(--text); padding: 0; width:min(560px, calc(100vw - 32px)); }
    dialog::backdrop { background:rgba(32,42,45,.36); }
    .modal { padding: 24px; }
    .modal h2 { font-size: 25px; margin: 8px 0; }
    .modal p { color:var(--muted); }
    .name-field { width:100%; margin:18px 0; background:var(--surface); border:1px solid var(--line-strong); color:var(--text); border-radius:6px; padding:12px; outline:none; }
    .name-field:focus { border-color:var(--accent); }
    .setup-error { color: var(--red); min-height: 18px; font-size: 12px; }
    .modal-actions { display:flex; justify-content:flex-end; gap:9px; }
    @media (max-width: 960px) { .hero, .layout { grid-template-columns: 1fr; } .side-stack { grid-template-columns: 1fr 1fr; } }
    @media (max-width: 650px) { .shell { padding:18px 14px 35px; } .topbar, .footer { align-items:flex-start; flex-direction:column; } .top-actions { width:100%; justify-content:space-between; } .vitals { grid-template-columns: repeat(2, 1fr); } .issues, .treatment-content, .side-stack, .treat-options { grid-template-columns: 1fr; } .hero h2 { font-size:25px; } }

/* ---------- v2 refinements: clinical-editorial, no gradients/glow (see README design rules) ---------- */
:root { --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace; }
[hidden] { display: none !important; }
body { background: var(--bg); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
h1, h2, h3, .patient-name, .score .number, .vital .value { font-family: var(--serif); }
h1 { font-size: 22px; font-weight: 700; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink-panel); color: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
/* asymmetric, sharper geometry instead of uniform rounded cards */
.brand-mark { border-radius: 2px 10px 2px 10px; font-family: var(--mono); }
.hero-card, .card { border-radius: 2px 14px 2px 14px; box-shadow: none; border-top: 3px solid var(--ink-panel); }
.hero-card { border-top-color: #8fa89a; }
.status-card { border-top-color: var(--accent); }
.hero h2 { font-family: var(--serif); font-size: clamp(27px, 3.4vw, 38px); font-weight: 700; letter-spacing: -.02em; line-height: 1.1; max-width: 17ch; }
.hero-card::after { content: "Rx"; position: absolute; right: 22px; bottom: -14px; font: 700 120px/1 var(--serif); color: rgba(242,238,229,.06); pointer-events: none; }
.eyebrow, .section-label { font-family: var(--mono); letter-spacing: .14em; }
.badge, .pill { border-radius: 2px; font-family: var(--mono); font-size: 11px; }
.button { border-radius: 2px 8px 2px 8px; letter-spacing: .01em; transition: background .18s, transform .12s; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.vital { border-radius: 2px; border-left: 3px solid var(--line-strong); }
.vital.warn { border-left-color: var(--amber); }
.vital.good { border-left-color: var(--green); }
.vital .value { font-size: 28px; }
.issue { border-radius: 2px 8px 2px 8px; border-left: 3px solid var(--amber); position: relative; }
.issue:hover { transform: translateX(2px); }
.issue.active { background: #eaede4; box-shadow: inset 0 0 0 1px var(--accent); }
.issue.done { border-left-color: var(--green); background: #eef1e9; }
.issue.done::after { content: "✓"; position: absolute; right: 12px; bottom: 10px; color: var(--green); font-weight: 800; }
.issue-icon { font-family: var(--mono); background: var(--surface-muted); padding: 2px 6px; border-radius: 2px; }
.issue-state { font-family: var(--mono); }
.treatment-empty { border-radius: 2px; }
.diagnostic-box { border-radius: 2px 10px 2px 2px; }
.chart { border-bottom: 1px solid var(--line-strong); }
.bar { border-radius: 1px 1px 0 0; transform-origin: bottom; animation: grow .5s ease-out both; }
.bar:nth-child(odd) { background: var(--accent-2); } .bar:nth-child(even) { background: #6f8b99; }
@keyframes grow { from { transform: scaleY(0); } }
.treat-option { border-radius: 2px 8px 2px 8px; cursor: pointer; transition: border-color .15s, background .15s; }
.treat-option:hover { border-color: var(--accent); }
.treat-option:has(input:checked) { border-color: var(--accent); background: #e9eee6; box-shadow: inset 3px 0 0 var(--accent); }
.treat-option:has(input:disabled) { opacity: .6; cursor: default; }
.score { border-radius: 2px; }
.score .number.urgent, #timerValue.urgent { color: var(--red); }
#timerValue.warn { color: var(--amber); }
.leader-row:first-child .rank { color: var(--amber); } .leader-row:first-child .leader-name { font-family: var(--serif); font-size: 15px; }
.leader-score { font-family: var(--mono); }
.care-marker { border-radius: 0; transform: rotate(45deg); }
.expired-banner { border: 1px solid var(--red); border-left-width: 4px; background: #f3e4e0; color: #6d2f28; padding: 12px 16px; margin: 0 0 18px; border-radius: 2px; }
dialog { border-radius: 2px 16px 2px 16px; border-top: 4px solid var(--accent); }
dialog[open] { animation: rise .22s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.footer { border-top: 1px solid var(--line-strong); padding-top: 14px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
