/* Day palette by default; dark is opt-in from Settings. */
:root {
  --bg: #f7f5f0;
  --bg-grad: radial-gradient(1200px 500px at 85% -10%, #fff1d6 0%, rgba(255, 241, 214, 0) 60%),
             radial-gradient(900px 420px at -10% 0%, #e3f1ff 0%, rgba(227, 241, 255, 0) 55%);
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --text: #1c1917;
  --muted: #6b645c;
  --border: #e8e3da;
  --accent: #0b6bcb;
  --accent-soft: #e5f1fd;
  --good: #15803d;
  --good-soft: #e6f6eb;
  --warn: #a15c07;
  --warn-soft: #fff4dc;
  --bad: #c2410c;
  --bad-soft: #fff0e8;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(28, 25, 23, .04), 0 4px 16px rgba(28, 25, 23, .06);
  --shadow-lg: 0 2px 4px rgba(28, 25, 23, .04), 0 12px 32px rgba(28, 25, 23, .08);
  --pc: #0b6bcb;
  --pc-ink: #0b6bcb;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #121417;
  --bg-grad: radial-gradient(1000px 420px at 85% -10%, rgba(245, 158, 11, .10) 0%, rgba(0, 0, 0, 0) 60%),
             radial-gradient(800px 380px at -10% 0%, rgba(14, 165, 233, .10) 0%, rgba(0, 0, 0, 0) 55%);
  --surface: #1a1d22;
  --surface-2: #22262c;
  --text: #ece9e4;
  --muted: #a39d94;
  --border: #2d3138;
  --accent: #6cb4ff;
  --accent-soft: #1b2b40;
  --good: #4ade80;
  --good-soft: #15291c;
  --warn: #fbbf24;
  --warn-soft: #33270e;
  --bad: #fb923c;
  --bad-soft: #36200f;
  --shadow: none;
  --shadow-lg: none;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #121417;
    --bg-grad: radial-gradient(1000px 420px at 85% -10%, rgba(245, 158, 11, .10) 0%, rgba(0, 0, 0, 0) 60%),
               radial-gradient(800px 380px at -10% 0%, rgba(14, 165, 233, .10) 0%, rgba(0, 0, 0, 0) 55%);
    --surface: #1a1d22;
    --surface-2: #22262c;
    --text: #ece9e4;
    --muted: #a39d94;
    --border: #2d3138;
    --accent: #6cb4ff;
    --accent-soft: #1b2b40;
    --good: #4ade80;
    --good-soft: #15291c;
    --warn: #fbbf24;
    --warn-soft: #33270e;
    --bad: #fb923c;
    --bad-soft: #36200f;
    --shadow: none;
    --shadow-lg: none;
    color-scheme: dark;
  }
}

/* Phase colour tints work in both themes. */
[style*="--pc"] {
  --pc-soft: color-mix(in srgb, var(--pc) 13%, var(--surface));
  --pc-line: color-mix(in srgb, var(--pc) 35%, var(--border));
}
:root[data-theme="dark"] [style*="--pc"] { --pc-ink: color-mix(in srgb, var(--pc) 70%, white); }
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] [style*="--pc"] { --pc-ink: color-mix(in srgb, var(--pc) 70%, white); }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.6 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv11", "ss01";
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, .button-like {
  font: inherit;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s, border-color .15s;
}
button:hover, .button-like:hover { background: var(--surface-2); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button.danger { color: var(--bad); }

.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ── Top bar ─────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); }
.brand:hover { text-decoration: none; }
.logo {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-size: 18px;
  background: linear-gradient(135deg, #fbbf24, #f97316 55%, #ec4899);
  box-shadow: 0 4px 12px rgba(249, 115, 22, .3);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.brand-title { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a, .topnav button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 10px; color: var(--muted); font-weight: 500;
  border: 0; background: transparent;
}
.topnav a:hover, .topnav button:hover { text-decoration: none; background: var(--surface-2); color: var(--text); }
.topnav a.active { color: var(--accent); background: var(--accent-soft); }
.topnav .ico { font-size: 15px; }

/* ── Layout ─────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 28px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 24px 72px;
}
main { min-width: 0; outline: none; }

.sidebar { position: sticky; top: 84px; align-self: start; display: flex; flex-direction: column; gap: 4px; }
.sidebar-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px 12px; }
.phase-link {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--text);
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.phase-link:hover { text-decoration: none; background: var(--surface); border-color: var(--border); }
.phase-link.active { background: var(--surface); border-color: var(--pc-line); box-shadow: var(--shadow); }
.phase-link .dotc { width: 10px; height: 10px; border-radius: 50%; background: var(--pc); }
.phase-link .pl-name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.phase-link .pl-pct { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.phase-link .pl-sub { grid-column: 2 / -1; font-size: 12px; color: var(--muted); }
.phase-link .bar { grid-column: 2 / -1; }

/* ── Progress primitives ─────────────────────────── */
.bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--pc, var(--accent)); border-radius: 99px; transition: width .3s ease; }
.bar.good > span { background: var(--good); }

.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .track { stroke: var(--surface-2); }
.ring .fill { stroke: url(#ringGrad); stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.ring .ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .ring-pct { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.ring .ring-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── Cards & headings ─────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
h1 { font-size: 28px; margin: 0 0 6px; line-height: 1.2; letter-spacing: -.02em; }
h2 { font-size: 18px; margin: 32px 0 12px; letter-spacing: -.01em; }
h3 { font-size: 12px; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.lede { color: var(--muted); margin: 0 0 22px; max-width: 760px; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--pc-ink, var(--accent)); margin-bottom: 6px; }

/* ── Dashboard hero ─────────────────────────── */
.hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: center; }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mini { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.mini .label { font-size: 12px; color: var(--muted); }
.mini .value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.hero-text h1 { margin-bottom: 4px; }
.hero-text .lede { margin-bottom: 14px; }

.focus { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; border-left: 5px solid var(--pc); }
.focus .wk-title { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.focus p { margin: 4px 0 12px; color: var(--muted); }
.cta {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--pc); color: #fff; font-weight: 600;
  padding: 10px 16px; border-radius: 12px; white-space: nowrap;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--pc) 30%, transparent);
}
.cta:hover { text-decoration: none; filter: brightness(1.05); }

.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; }
.stack { display: grid; gap: 14px; margin-top: 14px; }

/* Whole-plan timeline */
.timeline { display: grid; grid-template-columns: repeat(26, minmax(0, 1fr)); gap: 5px; }
.tl {
  aspect-ratio: 1;
  border-radius: 5px;
  background: var(--pc-soft);
  border: 1px solid var(--pc-line);
  display: block;
  position: relative;
  transition: transform .12s;
}
.tl:hover { transform: scale(1.18); z-index: 1; text-decoration: none; }
.tl.part { background: linear-gradient(to top, var(--pc) var(--fill), var(--pc-soft) var(--fill)); }
.tl.done { background: var(--pc); border-color: var(--pc); }
.tl.now { outline: 2px solid var(--text); outline-offset: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--pc); display: inline-block; }

.list-links { list-style: none; margin: 0; padding: 0; }
.list-links li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.list-links li:last-child { border-bottom: 0; }
.pillnum { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.phase-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.phase-card { color: var(--text); display: block; position: relative; overflow: hidden; border-top: 4px solid var(--pc); transition: transform .15s, box-shadow .15s; }
.phase-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.phase-card .pc-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.phase-card .pc-num { font-weight: 700; color: var(--pc-ink); text-transform: uppercase; letter-spacing: .06em; }
.phase-card .pc-name { font-weight: 700; font-size: 16px; margin: 6px 0 6px; letter-spacing: -.01em; }
.phase-card p { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); }

/* ── Phase page header ─────────────────────────── */
.phase-head { background: linear-gradient(135deg, var(--pc-soft), var(--surface) 70%); border-color: var(--pc-line); margin-bottom: 18px; }
.phase-head h1 { margin-bottom: 4px; }
.phase-head .lede { margin: 0 0 14px; }
.phase-head .meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }

/* ── Week ─────────────────────────── */
.week {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
  scroll-margin-top: 84px;
  transition: box-shadow .15s, border-color .15s;
}
.week:hover { border-color: var(--pc-line); }
.week[open] { box-shadow: var(--shadow-lg); border-color: var(--pc-line); }
.week.current { border-color: var(--pc); box-shadow: 0 0 0 3px var(--pc-soft), var(--shadow-lg); }
.week > summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
}
.week > summary::-webkit-details-marker { display: none; }
.wk-num {
  width: 46px; height: 46px; border-radius: 13px;
  display: grid; place-items: center;
  background: var(--pc-soft); color: var(--pc-ink);
  font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums;
}
.week.done .wk-num { background: var(--good); color: #fff; }
.week.done .wk-num::after { content: "✓"; font-size: 18px; }
.week.done .wk-num span { display: none; }
.wk-title { font-weight: 650; font-size: 15.5px; letter-spacing: -.005em; }
.wk-meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 2px; }
.wk-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; min-width: 104px; }
.wk-right .bar { width: 104px; }
.chev { color: var(--muted); transition: transform .2s; font-size: 12px; }
.week[open] .chev { transform: rotate(180deg); }

.badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.badge.done { background: var(--good-soft); color: var(--good); }
.badge.current { background: var(--pc); color: #fff; }
.badge.behind { background: var(--warn-soft); color: var(--warn); }
.badge.upcoming { background: var(--surface-2); color: var(--muted); }

.wk-body { padding: 4px 22px 22px; border-top: 1px solid var(--border); }
.wk-goal {
  margin: 18px 0 4px; padding: 14px 16px; border-radius: 12px;
  background: var(--pc-soft); border: 1px solid var(--pc-line);
  display: flex; gap: 12px; align-items: flex-start; font-weight: 500;
}
.wk-goal .ico { font-size: 20px; line-height: 1.2; }
.wk-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 26px; }
.block { margin-top: 20px; }
.block-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 10px; }
.block-title .ico { font-size: 15px; filter: saturate(1.1); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; padding: 4px 11px; border-radius: 99px; background: var(--pc-soft); color: var(--pc-ink); font-weight: 500; }

ol.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 10px; }
ol.steps li { counter-increment: step; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; }
ol.steps li::before {
  content: counter(step);
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border);
}

.dont-box { background: var(--bad-soft); border-radius: 12px; padding: 12px 14px; }
.dont-box ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dont-box li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; }
.dont-box li::before { content: "✕"; color: var(--bad); font-weight: 700; }

.res-cards { display: grid; gap: 8px; }
.res-card {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); color: var(--text);
  transition: border-color .15s, background .15s;
}
.res-card:hover { text-decoration: none; border-color: var(--pc-line); background: var(--pc-soft); }
.res-card .rc-title { font-weight: 550; font-size: 14px; }
.res-card .rc-arrow { color: var(--muted); }
.kind { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); margin-top: 3px; }
.kind.paid { background: var(--warn-soft); color: var(--warn); }

.panel { background: var(--surface-2); border-radius: 14px; padding: 4px 16px 16px; }
.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.task {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 12px; border-radius: 12px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  transition: border-color .15s, background .15s;
}
.task:hover { border-color: var(--pc-line); }
.task input {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px; margin: 1px 0 0; flex: none; cursor: pointer;
  border: 2px solid var(--pc-line); border-radius: 6px; background: var(--surface);
  display: grid; place-items: center; transition: background .15s, border-color .15s;
}
.task input::after { content: ""; width: 10px; height: 6px; border: solid #fff; border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.task input:checked { background: var(--good); border-color: var(--good); }
.task input:checked::after { opacity: 1; }
.task.checked { background: var(--good-soft); border-color: transparent; }
.task.checked span { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }

.checkpoint {
  margin-top: 18px; padding: 12px 14px; border-radius: 12px;
  background: var(--warn-soft); color: var(--text);
  display: flex; gap: 10px; align-items: flex-start;
}
.checkpoint .ico { font-size: 18px; line-height: 1.3; }

textarea {
  width: 100%;
  min-height: 92px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  resize: vertical;
}

/* Interview questions */
.qa { margin-top: 24px; padding: 16px 18px 18px; border-radius: 14px; border: 1px dashed var(--pc-line); background: linear-gradient(180deg, var(--pc-soft), var(--surface) 140px); }
.qa .block-title { margin: 0; }
.qa-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.qa-count { font-size: 12px; font-weight: 700; color: var(--pc-ink); background: var(--surface); border: 1px solid var(--pc-line); padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.qa-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.qa-item { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: border-color .15s, background .15s; height: 100%; }
.qa-item:hover { border-color: var(--pc-line); }
.qa-item input { width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--good); cursor: pointer; }
.qa-n { font-size: 12px; font-weight: 700; color: var(--pc-ink); min-width: 18px; line-height: 1.9; }
.qa-item.on { background: var(--good-soft); border-color: transparent; }
.qa-item.on .qa-n { color: var(--good); }

/* ── Resources page ─────────────────────────── */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 18px; }
.search {
  flex: 1 1 260px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0 12px;
  box-shadow: var(--shadow);
}
.search input { flex: 1; font: inherit; padding: 11px 0; border: 0; background: transparent; color: var(--text); outline: none; }
.res-group { margin-bottom: 16px; }
.res-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.res-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.res-weeks { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── Dialog & toast ─────────────────────────── */
dialog {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  width: min(520px, calc(100vw - 32px));
  box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(28, 25, 23, .35); backdrop-filter: blur(2px); }
.settings-body { padding: 22px 24px; }
.settings-body h2 { margin-top: 0; }
.settings-body section { margin: 20px 0; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; margin-bottom: 10px; }
.field input { font: inherit; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.seg { display: inline-flex; background: var(--surface-2); padding: 4px; border-radius: 12px; gap: 2px; }
.seg label { display: inline-flex; align-items: center; padding: 6px 14px; border-radius: 9px; cursor: pointer; font-weight: 500; color: var(--muted); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px;
  font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: all .2s; z-index: 50;
  box-shadow: var(--shadow-lg);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Responsive ─────────────────────────── */
@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 18px 16px 96px; gap: 16px; }
  .sidebar { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 6px; gap: 8px; scrollbar-width: none; }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar-title { display: none; }
  .phase-link { flex: 0 0 210px; background: var(--surface); border-color: var(--border); }
  .wk-cols { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .hero { grid-template-columns: minmax(0, 1fr); justify-items: start; }
}

@media (max-width: 720px) {
  /* backdrop-filter would make the fixed tab bar position relative to the header */
  .topbar { padding: 10px 16px; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--surface); }
  /* Navigation moves to a bottom tab bar on phones. */
  .topnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    justify-content: space-around; gap: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
  }
  .topnav a, .topnav button { flex: 1; flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 4px; justify-content: center; }
  .topnav .ico { font-size: 19px; }
  #toast { bottom: 84px; }
  h1 { font-size: 23px; }
  .hero-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .mini { padding: 10px; }
  .mini .value { font-size: 17px; }
  .two, .phase-grid, .res-grid, .qa-list { grid-template-columns: minmax(0, 1fr); }
  .qa { padding: 14px; }
  .qa-head { flex-wrap: wrap; }
  .focus { grid-template-columns: minmax(0, 1fr); }
  .timeline { grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 4px; }
  .card { padding: 16px; }
  .week > summary { grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 12px 14px; }
  .wk-right { grid-column: 1 / -1; flex-direction: row; align-items: center; min-width: 0; }
  .wk-right .bar { flex: 1; width: auto; }
  .chev { display: none; }
  .wk-body { padding: 4px 14px 16px; }
}
