/* ReConnect, theme B "calm clinical".
   Soft grey-teal ground, white surfaces lifted by teal-tinted shadow (no outline boxes),
   deep teal for actions and success, warm amber reserved for in-game targets.
   One typeface, Atkinson Hyperlegible, designed for low vision. Numbers use tabular figures. */
:root {
  --bg: #eef3f2;
  --surface: #ffffff;
  --sunk: #e3ecea;          /* one tone step below the ground: wells, tracks, inactive chips */
  --ink: #0e2a2b;
  --muted: #4d6a6b;
  --line: #cddcda;          /* only for form controls and table rules */
  --primary: #0f766e;
  --primary-ink: #ffffff;
  --primary-soft: #d9ece9;
  --brain: #5b4bb5;
  --brain-soft: #e7e3f7;
  --accent: #c9821f;        /* game targets: the thing to reach for */
  --accent-ink: #8a5300;
  --go: #0f766e;
  --warn: #b4443a;
  --sky-top: #d4e8e5; --sky-bot: #f3efe6; --hill: #b7d0cc; --stage: #e6efed;
  --paper: var(--bg);
  --shadow: 0 1px 0 rgba(14, 42, 43, .05), 0 10px 28px -16px rgba(14, 42, 43, .28);
  --shadow-lg: 0 2px 0 rgba(14, 42, 43, .04), 0 24px 60px -28px rgba(14, 42, 43, .45);
  --font: "Atkinson Hyperlegible", "Verdana", "Segoe UI", sans-serif;
  --display: var(--font); --body: var(--font); --mono: var(--font);
  --r-lg: 20px; --r: 14px; --r-sm: 10px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1a1b; --surface: #142526; --sunk: #0f1f20; --ink: #e4efee; --muted: #9ab5b4; --line: #2a4142;
    --primary: #2dd4bf; --primary-ink: #052523; --primary-soft: #133b38; --brain: #a99cf0; --brain-soft: #2a2550;
    --accent: #f0a640; --accent-ink: #f0a640; --go: #2dd4bf; --warn: #ff8a7a;
    --sky-top: #10282a; --sky-bot: #1f2a2a; --hill: #183536; --stage: #102223;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 30px -16px rgba(0, 0, 0, .6);
    --shadow-lg: 0 24px 60px -24px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1a1b; --surface: #142526; --sunk: #0f1f20; --ink: #e4efee; --muted: #9ab5b4; --line: #2a4142;
  --primary: #2dd4bf; --primary-ink: #052523; --primary-soft: #133b38; --brain: #a99cf0; --brain-soft: #2a2550;
  --accent: #f0a640; --accent-ink: #f0a640; --go: #2dd4bf; --warn: #ff8a7a;
  --sky-top: #10282a; --sky-bot: #1f2a2a; --hill: #183536; --stage: #102223;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 30px -16px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 60px -24px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 18px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 10px 14px; border-radius: var(--r-sm); z-index: 30; }
.skip:focus { left: 8px; }
h1, h2, h3 { margin: 0; font-weight: 700; text-wrap: balance; }
h1 { font-size: clamp(30px, 3.2vw, 40px); line-height: 1.08; letter-spacing: -0.02em; }
h2 { font-size: 24px; line-height: 1.2; letter-spacing: -0.01em; }
h3 { font-size: 20px; line-height: 1.25; }
p { margin: 0; text-wrap: pretty; }
.muted { color: var(--muted); }
.num, .gauge b, .stat b, .week b, .code { font-variant-numeric: tabular-nums; }
.kicker, .eyebrow { font-size: 15px; color: var(--muted); font-weight: 700; }

.app { max-width: 1240px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 26px; }
main > section { display: flex; flex-direction: column; gap: 20px; }

/* ---------- buttons and controls ---------- */
.btn { border: 0; border-radius: var(--r); padding: 14px 20px; min-height: 52px; font-weight: 700; background: var(--primary); color: var(--primary-ink); transition: transform 160ms var(--ease-out), background-color 160ms var(--ease-out); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn.alt { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.alt:hover:not(:disabled) { box-shadow: inset 0 0 0 1.5px var(--primary); }
.btn.amber { background: var(--primary); color: var(--primary-ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.seg { display: inline-flex; background: var(--sunk); border-radius: 12px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 9px 14px; min-height: 44px; border-radius: 9px; font-weight: 700; color: var(--muted); transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out), transform 150ms var(--ease-out); }
.seg button:active:not(:disabled), .libtabs button:active, .pick:active, .pt:active, .calday:active { transform: scale(0.97); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(14, 42, 43, .12); }
select { padding: 10px 12px; min-height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); }
.toggle { display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 16px; }
.toggle input { width: 22px; height: 22px; accent-color: var(--primary); }
.iconbtn { border: 0; background: var(--sunk); width: 44px; height: 44px; border-radius: 12px; font-size: 24px; line-height: 1; }

/* ---------- header ---------- */
.top { position: relative; display: flex; align-items: center; gap: 16px 20px; flex-wrap: wrap; justify-content: space-between; }
.brand b { font-size: 28px; letter-spacing: -0.03em; }
.brand b span { color: var(--primary); }
nav.tabs { display: flex; gap: 4px; background: var(--surface); border-radius: 999px; padding: 5px; box-shadow: var(--shadow); }
nav.tabs button { border: 0; background: transparent; padding: 10px 18px; min-height: 44px; border-radius: 999px; font-weight: 700; color: var(--muted); }
nav.tabs button[aria-selected="true"] { background: var(--ink); color: var(--surface); }
.topright { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.demo { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); }
.demo-label { font-size: 14px; font-weight: 700; color: var(--brain); }
.demo .seg button { min-height: 40px; padding: 7px 12px; font-size: 16px; }
.demo select { border: 0; background: var(--sunk); min-height: 40px; font-weight: 700; font-size: 16px; }
.conn { display: inline-flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 700; padding: 10px 16px; min-height: 48px; border-radius: 999px; border: 0; background: var(--surface); color: var(--muted); box-shadow: var(--shadow); }
.conn i { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.conn.on { color: var(--go); } .conn.on i { background: var(--go); }
.conn.demo-mode { color: var(--accent-ink); } .conn.demo-mode i { background: var(--accent); }
.drawer { position: absolute; right: 0; top: calc(100% + 10px); z-index: 20; width: min(420px, calc(100vw - 32px)); background: var(--surface); border-radius: var(--r-lg); padding: 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow-lg); transform-origin: top right; animation: pop 180ms var(--ease-out); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
@keyframes pop { from { opacity: 0; transform: scale(0.97) translateY(-4px); } }
#pHosted, #pArtifact { display: flex; flex-direction: column; gap: 10px; }
.qrbox { display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: 16px; align-items: center; }
.qrtext { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 15px; }
.qr { width: 136px; height: 136px; border-radius: 12px; background: #fff; padding: 8px; display: grid; place-items: center; box-shadow: inset 0 0 0 1.5px var(--line); }
.qr svg { width: 100%; height: 100%; display: block; }
.code { font-size: 34px; font-weight: 700; letter-spacing: 0.08em; }
.url { font-size: 13px; line-height: 1.4; color: var(--muted); word-break: break-all; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--muted); font-size: 16px; }
.note { font-size: 15px; color: var(--muted); }
.evidence { border-left: 4px solid var(--primary); padding: 4px 0 4px 14px; font-size: 16px; }

/* ---------- patient home (pre-plan layout; Task 5 replaces) ---------- */
.home { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
@media (max-width: 980px) { .home { grid-template-columns: minmax(0, 1fr); } }
.lib { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.intro { display: flex; flex-direction: column; gap: 10px; max-width: 62ch; }
.settings { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: end; padding: 16px 18px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 15px; font-weight: 700; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card { text-align: left; display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--r-lg); border: 0; background: var(--surface); box-shadow: var(--shadow); min-width: 0; transition: box-shadow 160ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .card:hover { box-shadow: var(--shadow), inset 0 0 0 2px var(--primary-soft); } }
.card .glyph { height: 92px; border-radius: var(--r); background: var(--stage); overflow: hidden; }
.card .glyph canvas { width: 100%; height: 100%; display: block; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 14px; font-weight: 700; padding: 5px 9px; border-radius: 8px; background: var(--sunk); color: var(--muted); }
.chip.brain { background: var(--brain-soft); color: var(--brain); }
.card p { font-size: 16px; color: var(--muted); }
.card .src { font-size: 14px; color: var(--muted); padding-top: 8px; margin-top: auto; }
.side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 14px; }
.panel { background: var(--surface); border-radius: var(--r-lg); padding: 20px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.week { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.week div { display: flex; flex-direction: column; gap: 2px; }
.week b { font-size: 28px; line-height: 1; }
.week span { font-size: 14px; color: var(--muted); }

/* ---------- patient: Today bar ---------- */
.todaybar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 22px; align-items: center; padding: 22px 26px; background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-lg); transition: background-color 250ms var(--ease-out), color 250ms var(--ease-out); }
.ring { position: relative; width: 84px; height: 84px; display: grid; place-items: center; }
.ring svg { width: 84px; height: 84px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring-track { stroke: var(--sunk); }
.ring-fill { stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset 300ms var(--ease-out); }
.ring-num { position: absolute; font-size: 20px; font-weight: 700; }
.ring-done { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); }
.ring-done svg, .tb-steps svg { transform: none; fill: none; stroke: var(--primary); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ring-done svg { width: 44px; height: 44px; }
.tb-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tb-hi { font-size: 16px; font-weight: 700; color: var(--muted); }
.todaybar h2 { font-size: clamp(24px, 2.6vw, 32px); }
.tb-sub { color: var(--muted); max-width: 60ch; }
.tb-steps { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tb-steps li { display: inline-flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 700; padding: 7px 13px; border-radius: 999px; background: var(--sunk); color: var(--muted); }
.tb-steps li svg { width: 16px; height: 16px; }
.tb-steps li[data-done="true"] { background: var(--primary-soft); color: var(--primary); }
.tb-steps li[data-done="true"] span { text-decoration: line-through; text-decoration-thickness: 2px; }
.tb-steps li.next { background: var(--primary); color: var(--primary-ink); }
.tb-steps li.na { font-weight: 400; font-style: italic; }
.tb-go { min-height: 60px; padding: 16px 26px; font-size: 19px; white-space: nowrap; }
.todaybar[data-state="done"] { background: var(--primary); color: var(--primary-ink); }
.todaybar[data-state="done"] .tb-hi, .todaybar[data-state="done"] .tb-sub { color: color-mix(in srgb, var(--primary-ink) 82%, transparent); }
.todaybar[data-state="done"] .tb-steps li { background: color-mix(in srgb, var(--primary-ink) 16%, transparent); color: var(--primary-ink); }
.todaybar[data-state="done"] .tb-steps li svg { stroke: var(--primary-ink); }
.todaybar[data-state="rest"], .todaybar[data-state="none"] { box-shadow: var(--shadow); }
/* A goal that was just finished: a small scale-in while its check draws itself. */
.tb-steps li.just { animation: tick 220ms var(--ease-out); }
.tb-steps li.just svg path, .todaybar.celebrate .ring-done svg path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw 240ms var(--ease-out) 60ms forwards; }
.todaybar.celebrate { animation: settle 250ms var(--ease-out); }
@keyframes tick { from { transform: scale(0.94); opacity: 0.6; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes settle { from { background-color: var(--surface); color: var(--ink); } }
@media (max-width: 760px) {
  .todaybar { grid-template-columns: auto minmax(0, 1fr); padding: 18px; gap: 16px; }
  .tb-go { grid-column: 1 / -1; width: 100%; }
  .ring, .ring svg, .ring-done { width: 64px; height: 64px; }
}

/* ---------- patient: library + my progress ---------- */
.phome { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
@media (max-width: 980px) { .phome { grid-template-columns: minmax(0, 1fr); } .phome .side { position: static; } }
.library { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.libhead { display: flex; flex-direction: column; gap: 12px; }
.libtabs { display: flex; gap: 6px; flex-wrap: wrap; }
.libtabs button { border: 0; background: transparent; min-height: 44px; padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 16px; color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line); }
.libtabs button[aria-pressed="true"] { background: var(--ink); color: var(--surface); box-shadow: none; }
.libsec { display: flex; flex-direction: column; gap: 12px; }
.libsec h3 { font-size: 18px; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
@media (max-width: 480px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .tile-name { font-size: 17px; } .tile-tag { top: 14px; right: 14px; } }
.tile { position: relative; display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 10px 10px 14px; border: 0; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); min-width: 0; transition: box-shadow 160ms var(--ease-out), transform 160ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .tile:hover { box-shadow: var(--shadow), inset 0 0 0 2px var(--primary-soft); } .tile.brain:hover { box-shadow: var(--shadow), inset 0 0 0 2px var(--brain-soft); } }
.tile:active:not([aria-disabled="true"]) { transform: scale(0.98); }
.tile[aria-disabled="true"] { cursor: not-allowed; opacity: .6; }
.tile-art { height: 76px; border-radius: 12px; background: var(--stage); overflow: hidden; display: block; }
.tile.brain .tile-art { background: color-mix(in srgb, var(--brain-soft) 70%, var(--stage)); }
.tile-art canvas, .tile-art svg { width: 100%; height: 100%; display: block; }
.art { --a-ink: var(--ink); --a-mute: var(--muted); --a-go: var(--go); --a-hi: var(--accent); --a-bg: var(--surface); --a-brain: var(--brain); }
.art * { vector-effect: non-scaling-stroke; }
.tile-name { font-size: 18px; font-weight: 700; padding: 0 4px; line-height: 1.2; }
.tile-meta { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); padding: 0 4px; }
.tile-meta svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.tile-tag { position: absolute; top: 16px; right: 16px; font-size: 13px; font-weight: 700; padding: 3px 8px; border-radius: 8px; background: var(--primary); color: var(--primary-ink); }
.tile-tag.done { background: var(--primary-soft); color: var(--primary); }
#myProgress h3 { font-size: 20px; }
.mp-today { display: flex; align-items: baseline; gap: 8px; }
.mp-today b { font-size: 36px; line-height: 1; }
.mp-today span { color: var(--muted); }
.mp-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mp-day { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.mp-day i { width: 26px; height: 26px; border-radius: 8px; background: var(--sunk); }
.mp-day[data-status="done"] i { background: var(--primary); }
.mp-day[data-status="partly"] i { background: color-mix(in srgb, var(--primary) 45%, var(--sunk)); }
.mp-day[data-status="missed"] i { background: color-mix(in srgb, var(--accent) 35%, var(--sunk)); }
.mp-day[data-status="today"] i { box-shadow: inset 0 0 0 2.5px var(--primary); background: var(--surface); }
.mp-recent { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 16px; }
.mp-recent li { display: flex; justify-content: space-between; gap: 8px; }
.setctl { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.note.assigned { color: var(--primary); font-weight: 700; }

/* ---------- provider ---------- */
.pv { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 24px; align-items: start; }
.pv-side { background: var(--ink); color: color-mix(in srgb, var(--surface) 80%, transparent); border-radius: var(--r-lg); padding: 18px 12px; display: flex; flex-direction: column; gap: 8px; position: sticky; top: 14px; }
.pv-label { font-size: 14px; font-weight: 700; padding: 0 10px; opacity: .75; }
.pv-patients { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.pt { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 0; background: transparent; color: inherit; padding: 11px 12px; min-height: 46px; border-radius: 12px; font-weight: 700; text-align: left; }
.pt:hover { background: color-mix(in srgb, var(--surface) 8%, transparent); }
.pt.on { background: color-mix(in srgb, var(--surface) 14%, transparent); color: var(--surface); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: color-mix(in srgb, var(--surface) 30%, transparent); }
.dot.ok { background: #5eead4; } .dot.behind { background: #fbbf24; }
.pv-add, .pv-reset { border: 0; background: transparent; color: inherit; text-align: left; padding: 11px 12px; min-height: 46px; border-radius: 12px; font-weight: 700; opacity: .85; }
.pv-add:hover, .pv-reset:hover { background: color-mix(in srgb, var(--surface) 8%, transparent); opacity: 1; }
.pv-reset { margin-top: 12px; font-weight: 400; font-size: 15px; }
.pv-new { display: flex; flex-direction: column; gap: 6px; padding: 10px; background: color-mix(in srgb, var(--surface) 8%, transparent); border-radius: 12px; font-size: 15px; }
.pv-new input, .pv-new select { min-height: 44px; border-radius: 10px; border: 0; padding: 8px 10px; background: var(--surface); color: var(--ink); }
.pv-new .btn { min-height: 44px; padding: 10px 14px; }
@media (max-width: 900px) {
  .pv { grid-template-columns: minmax(0, 1fr); }
  /* patients become a scrolling row above the plan */
  .pv-side { position: static; flex-direction: row; align-items: center; overflow-x: auto; padding: 8px; gap: 4px; }
  .pv-label { display: none; }
  .pv-patients { flex-direction: row; }
  .pt, .pv-add, .pv-reset { white-space: nowrap; width: auto; margin-top: 0; }
  .pv-new { min-width: 260px; }
}
.pv-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pv-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.pv-flags { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; font-size: 16px; }
.pv-card { background: var(--surface); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.pv-start label, .pv-planhead label { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; }
input[type="date"], input[type="search"] { min-height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); padding: 8px 12px; }
.pv-planhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.calhead, .cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.calhead span { font-size: 14px; font-weight: 700; color: var(--muted); padding: 0 4px; }
.calday { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-height: 84px; padding: 7px; border: 0; border-radius: 12px; background: var(--sunk); text-align: left; min-width: 0; overflow: hidden; transition: background-color 150ms var(--ease-out); }
.calday:hover { background: color-mix(in srgb, var(--primary-soft) 70%, var(--sunk)); }
.calday.sel { background: var(--surface); box-shadow: inset 0 0 0 2.5px var(--primary); }
.calday.today .cal-date b { background: var(--primary); color: var(--primary-ink); border-radius: 6px; padding: 0 5px; }
.cal-date { font-size: 13px; color: var(--muted); white-space: nowrap; }
.cal-date b { color: var(--ink); }
.calday .chip { font-size: 12px; padding: 2px 6px; border-radius: 6px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--primary-soft); color: var(--primary); }
.calday .chip.brain { background: var(--brain-soft); color: var(--brain); }
.cal-rest { font-size: 13px; color: var(--muted); font-style: italic; }
.pv-dayhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 8px 8px 14px; border-radius: 14px; background: var(--sunk); }
.item-name { flex: 1 1 180px; font-weight: 700; }
.item label { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; color: var(--muted); }
.item select { min-height: 40px; padding: 6px 8px; }
.warn-tag { font-size: 12px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent-ink); }
.pv-safety { padding: 14px 16px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); display: flex; flex-direction: column; gap: 10px; }
.pv-pick { display: flex; flex-direction: column; gap: 8px; }
.pv-pick > label { font-weight: 700; }
.pick-list { max-height: 300px; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px; }
.pick-sec { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pick-sec p { width: 100%; font-size: 14px; font-weight: 700; color: var(--muted); }
.pick { border: 0; background: var(--sunk); border-radius: 10px; padding: 7px 11px; min-height: 40px; font-weight: 700; font-size: 15px; }
.pick:hover { background: var(--primary-soft); color: var(--primary); }
.pv-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 640px) { .pv-kpis { grid-template-columns: minmax(0, 1fr); } }
.kpi { gap: 4px; }
.kpi b { font-size: 34px; line-height: 1.05; }
.kpi span { color: var(--muted); font-size: 15px; }
.pv-rowhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.legend { display: inline-flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.lg { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.strip { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 3px; }
.strip span { height: 26px; border-radius: 5px; background: var(--sunk); }
.strip [data-status="done"], .lg.done { background: var(--primary); }
.strip [data-status="partly"], .lg.partly { background: color-mix(in srgb, var(--primary) 45%, var(--sunk)); }
.strip [data-status="missed"], .lg.missed { background: color-mix(in srgb, var(--accent) 45%, var(--sunk)); }
.strip [data-status="rest"], .lg.rest { background: repeating-linear-gradient(135deg, var(--sunk) 0 4px, color-mix(in srgb, var(--muted) 18%, var(--sunk)) 4px 6px); }
.strip [data-status="today"] { box-shadow: inset 0 0 0 2.5px var(--primary); background: var(--surface); }
td.kind { font-weight: 700; color: var(--muted); }
.print-only { display: none; }
.plan-list { margin: 0; padding-left: 0; list-style: none; columns: 2; font-size: 14px; }
@media print {
  body { background: #fff; font-size: 12pt; }
  .top, .pv-side, .pv-flags, .pv-head .seg, #pvExportCsv, #pvPrint, .skip { display: none !important; }
  .pv { display: block; }
  .pv-card { box-shadow: none; border: 1px solid #ccd; break-inside: avoid; }
  .print-only { display: flex; }
}

/* ---------- play ---------- */
.playhead { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.playhead .grow { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 2px; }
.gauges { display: flex; gap: 8px; flex-wrap: wrap; }
.gauge { font-size: 15px; padding: 10px 13px; border-radius: 12px; border: 0; background: var(--surface); box-shadow: var(--shadow); }
.gauge b { font-weight: 700; }
.stagewrap { position: relative; height: clamp(380px, 64vh, 720px); border-radius: var(--r-lg); overflow: hidden; background: var(--stage); box-shadow: var(--shadow); touch-action: none; }
#stage { width: 100%; height: 100%; display: block; }
.banner { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); max-width: calc(100% - 32px); background: var(--surface); border-radius: 16px; padding: 12px 20px; text-align: center; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.banner b { font-size: clamp(19px, 2.2vw, 26px); line-height: 1.15; }
.banner span { color: var(--muted); font-size: 16px; }
.banner.good { box-shadow: var(--shadow), inset 0 -3px 0 var(--go); } .banner.warn { box-shadow: var(--shadow), inset 0 -3px 0 var(--accent); }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--bg) 78%, transparent); overflow: auto; }
.sheet { width: min(640px, 100%); background: var(--surface); border-radius: var(--r-lg); padding: 26px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow-lg); animation: pop 200ms var(--ease-out); }
.sheet .actions, .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.count { font-size: 120px; font-weight: 700; line-height: 1; text-align: center; color: var(--primary); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--sunk); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.stat b { font-size: 26px; line-height: 1.1; }
.stat span { font-size: 14px; color: var(--muted); }
.howto { margin: 0; padding-left: 22px; display: grid; gap: 6px; }

/* ---------- about / log ---------- */
.prose { max-width: 68ch; display: flex; flex-direction: column; gap: 12px; }
.evgrid { display: flex; flex-direction: column; gap: 18px; }
.sys { background: var(--surface); border-radius: var(--r-lg); padding: 20px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.sys header { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline; justify-content: space-between; }
.sys .kind { font-size: 15px; color: var(--muted); }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 16px; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--sunk); vertical-align: top; }
th { font-size: 14px; font-weight: 700; color: var(--muted); }
td.inmend { white-space: nowrap; }
.tag { font-size: 14px; font-weight: 700; padding: 4px 8px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); }
.empty { padding: 40px 20px; text-align: center; background: var(--surface); border-radius: var(--r-lg); color: var(--muted); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.logtop { display: flex; gap: 12px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
#copyFallback { width: 100%; font-size: 14px; padding: 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); }

@media (max-width: 640px) {
  .qrbox { grid-template-columns: minmax(0, 1fr); justify-items: start; }
  .count { font-size: 88px; }
  nav.tabs { order: 3; width: 100%; overflow-x: auto; }
  .topright { width: 100%; justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
