:root {
  --bg: #f4f5f2;
  --card: #ffffff;
  --ink: #17232d;
  --muted: #5f6b73;
  --line: #dfe3df;
  --navy: #14324a;
  --accent: #1f7a6d;
  --accent-soft: #e3f1ee;
  --warn: #9a6a00;
  --bad: #a23b2c;
  --ok: #1f7a4d;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 50, 74, .06), 0 2px 8px rgba(20, 50, 74, .05);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11181d; --card: #192229; --ink: #e6ebee; --muted: #9aa7b0; --line: #2a363e;
    --navy: #0d2232; --accent: #4fb3a3; --accent-soft: #1c3431; --warn: #e0b04a; --bad: #e57a6a; --ok: #5cc28d;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.6rem; line-height: 1.25; margin: .2em 0 .4em; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; margin: 0 0 .5em; }
h3 { font-size: 1.05rem; margin: 1em 0 .4em; }
h4 { font-size: .95rem; margin: 1em 0 .3em; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.card h3:first-child, .card h2:first-child { margin-top: 0; }
p { margin: .4em 0 .8em; }
code { font-size: .9em; background: var(--accent-soft); padding: 0 .3em; border-radius: 4px; }

/* Shell */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + var(--safe-t)) 16px 10px; background: var(--navy); color: #fff;
}
.brand { color: #fff; text-decoration: none; font-weight: 650; display: flex; align-items: center; gap: 10px; }
.mark { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, #4fb3a3 0 50%, #ffffff 50% 100%); display: inline-block; }
main { max-width: 760px; margin: 0 auto; padding: 18px 16px calc(96px + var(--safe-b)); outline: none; }
#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around; background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + var(--safe-b));
}
#nav a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; color: var(--muted); text-decoration: none; font-size: .72rem; }
#nav a.active { color: var(--accent); font-weight: 600; }
#nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#nav .badge { position: absolute; top: 0; left: calc(50% + 6px); background: var(--bad); color: #fff; border-radius: 9px; font-size: .65rem; padding: 0 5px; line-height: 16px; }
@media (min-width: 900px) {
  #nav { top: calc(52px + var(--safe-t)); bottom: auto; left: 0; right: auto; width: 180px; flex-direction: column; justify-content: flex-start; gap: 4px; border-top: 0; border-right: 1px solid var(--line); height: calc(100vh - 52px); padding: 16px 10px; background: transparent; }
  #nav a { flex: none; flex-direction: row; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: .92rem; }
  #nav a.active { background: var(--accent-soft); }
  #nav .badge { position: static; margin-left: auto; }
  main { padding-bottom: 48px; }
}

/* Components */
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 14px; box-shadow: var(--shadow); color: inherit; }
a.card { text-decoration: none; }
a.card:hover { border-color: var(--accent); }
.hero { border-left: 4px solid var(--accent); }
.weekcard.current { border-left: 4px solid var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2 .card { margin: 0 0 14px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; gap: 0; } }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.row.gap { justify-content: flex-start; }
.eyebrow { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.lead { font-size: 1.05rem; color: var(--muted); }
.big { font-size: 2.2rem; font-weight: 700; margin: 0; line-height: 1.1; }
.notice { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.callout { background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; margin: 0 0 8px; }
.crumbs { font-size: .85rem; color: var(--muted); }
.crumbs a { text-decoration: none; }
.weeknav { display: flex; justify-content: space-between; margin: 0 0 14px; }
.chip { display: inline-block; font-size: .75rem; padding: 3px 10px; border-radius: 999px; text-decoration: none; background: rgba(255,255,255,.14); color: #fff; white-space: nowrap; }
.chip.ok::before, .chip.warn::before, .chip.bad::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.chip.ok::before { background: #5cc28d; } .chip.warn::before { background: #e0b04a; } .chip.bad::before { background: #e57a6a; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: .92rem; font-weight: 600; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; cursor: pointer; min-height: 38px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { font-size: .85rem; padding: 6px 12px; min-height: 34px; }
.btn.selected.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.selected.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ok { color: var(--ok); }
button.link { background: none; border: 0; color: var(--bad); cursor: pointer; font-size: .8rem; padding: 0 4px; }
.bad { color: var(--bad); }

input, textarea, select { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; margin: 0 0 10px; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[type="checkbox"] { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.row select { width: auto; margin: 0 0 0 6px; }
.lbl { display: block; font-size: .85rem; font-weight: 600; margin: 6px 0 4px; }

ul.checks { list-style: none; padding: 0; margin: 0 0 6px; }
ul.checks li { margin: 0 0 8px; }
ul.checks label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
details { margin: 8px 0; }
details > summary { cursor: pointer; color: var(--accent); font-weight: 600; }
details.card > summary { color: var(--ink); }

.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 10px 0; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.weekdots { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin: 6px 0 10px; }
.weekdots a { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--line); text-decoration: none; color: var(--muted); font-weight: 600; font-size: .85rem; }
.weekdots a.part { background: var(--accent-soft); color: var(--accent); }
.weekdots a.done { background: var(--accent); color: #fff; border-color: var(--accent); }
.weekdots a.cur { outline: 2px solid var(--accent); outline-offset: 1px; }
.comp-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.comp-row:last-of-type { border-bottom: 0; margin-bottom: 8px; }
.levels { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.pip { width: 12px; height: 12px; border-radius: 3px; background: var(--line); display: inline-block; }
.pip.on { background: var(--accent); }
.pip.tgt { outline: 2px solid var(--ink); outline-offset: 1px; }
.levels small { margin-left: 6px; color: var(--muted); font-size: .78rem; }
.comp h3 { margin: 0; }
ol.sessions { padding-left: 0; list-style: none; margin: 0; }
ol.sessions li { padding: 8px 0; border-bottom: 1px solid var(--line); }
ol.sessions li:last-child { border-bottom: 0; }
ol.scale { margin: 10px 0 0; padding-left: 22px; }
ul.hist { padding-left: 18px; font-size: .9rem; }
ul.hist li { margin-bottom: 8px; }

.qa { border-top: 1px solid var(--line); padding: 12px 0 4px; }
.qa .q { margin: 0 0 8px; }
.qa.got { border-left: 3px solid var(--ok); padding-left: 10px; }
.qa.missed { border-left: 3px solid var(--bad); padding-left: 10px; }
.model { background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; margin: 0 0 8px; font-size: .94rem; }
.prompt { font-weight: 600; }
.qa-review .q { font-weight: 600; }
