/* Layout: race-bib header, sticky tab bar, one panel per tab. Plan, decisions, fuel and race tools share one card system.
   Palette "Graphite and Cobalt": cool graphite neutrals, cobalt as the one brand accent, vermilion for race, now and slower-than-plan.
   Radius scale: containers 14px, inner tiles 10px, controls 8px, chips 6px, pills full. */
:root {
  --bg: #EDEFF2;
  --surface: #FBFCFD;
  --sunk: #E6E9EE;
  --fg: #12161C;
  --muted: #5A6371;
  --line: #D6DBE2;
  --accent: #2C46C9;
  --accent-soft: #E0E5FA;
  --key: #CC4019;
  --key-soft: #FBE4DA;
  --c-easy: #2F7A55;
  --c-easy-soft: #DCEFE4;
  --c-int: #A3305F;
  --c-int-soft: #F6E0E9;
  --c-rest: #8B93A0;
  --fuel: #875A00;
  --fuel-soft: #FAEFD3;
  --good: #2F7A55;
  --good-soft: #DCEFE4;
  --warn: #8C6000;
  --warn-soft: #FAEFD3;
  --shadow: 0 1px 2px rgb(20 32 70 / .05), 0 6px 20px -10px rgb(20 32 70 / .16);
  --shadow-hi: 0 2px 4px rgb(20 32 70 / .06), 0 12px 28px -12px rgb(20 32 70 / .24);
  --grain-op: .035;
  --display: "Archivo", "Arial Narrow", "Roboto Condensed", sans-serif;
  --display-w: 72%;
  --body: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Consolas, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --z-sticky: 10;
  --z-tip: 20;
  --z-grain: 30;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1015; --surface: #151922; --sunk: #1C212B; --fg: #E7EAF0; --muted: #959EAC; --line: #272D39;
    --accent: #93A6FF; --accent-soft: #1F2752; --key: #FF8A5C; --key-soft: #3B2017;
    --c-easy: #74C79A; --c-easy-soft: #15301F; --c-int: #F08BB8; --c-int-soft: #3A1A2A; --c-rest: #67717F;
    --fuel: #E6B54A; --fuel-soft: #33280E; --good: #74C79A; --good-soft: #15301F; --warn: #E6B54A; --warn-soft: #33280E;
    --shadow: inset 0 1px 0 rgb(255 255 255 / .03), 0 10px 24px -14px rgb(0 0 0 / .7);
    --shadow-hi: inset 0 1px 0 rgb(255 255 255 / .05), 0 14px 30px -14px rgb(0 0 0 / .8);
    --grain-op: .05;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D1015; --surface: #151922; --sunk: #1C212B; --fg: #E7EAF0; --muted: #959EAC; --line: #272D39;
  --accent: #93A6FF; --accent-soft: #1F2752; --key: #FF8A5C; --key-soft: #3B2017;
  --c-easy: #74C79A; --c-easy-soft: #15301F; --c-int: #F08BB8; --c-int-soft: #3A1A2A; --c-rest: #67717F;
  --fuel: #E6B54A; --fuel-soft: #33280E; --good: #74C79A; --good-soft: #15301F; --warn: #E6B54A; --warn-soft: #33280E;
  --shadow: inset 0 1px 0 rgb(255 255 255 / .03), 0 10px 24px -14px rgb(0 0 0 / .7);
  --shadow-hi: inset 0 1px 0 rgb(255 255 255 / .05), 0 14px 30px -14px rgb(0 0 0 / .8);
  --grain-op: .05;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
/* Fixed grain layer. It never scrolls, so it costs no repaints. */
body::after { content: ""; position: fixed; inset: 0; z-index: var(--z-grain); pointer-events: none; opacity: var(--grain-op);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--display); font-stretch: var(--display-w); font-weight: 800; letter-spacing: -0.01em; text-wrap: balance; margin: 0; line-height: 1.02; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--accent); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.eyebrow { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: 12px; top: -48px; z-index: calc(var(--z-sticky) + 1); background: var(--fg); color: var(--surface); padding: 8px 14px; border-radius: 8px; font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }

/* Header */
.top { position: relative; overflow: hidden; background: var(--surface); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.top::before { content: ""; position: absolute; inset: -40% -10% auto auto; width: 520px; height: 520px; pointer-events: none;
  background: radial-gradient(closest-side, var(--accent-soft), transparent); opacity: .9; }
.top-in { position: relative; max-width: 1040px; margin: 0 auto; padding-inline: 16px; padding-block: 26px 20px; display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: flex-end; justify-content: space-between; }
.brand { display: grid; gap: 6px; min-width: 0; }
.brand h1 { font-size: clamp(36px, 7vw, 60px); text-transform: uppercase; letter-spacing: -0.015em; line-height: .92; }
.brand .meta { color: var(--muted); font-size: 14px; }
.top-right { display: flex; gap: 22px; align-items: flex-end; }
.count { text-align: right; display: grid; gap: 2px; }
.count b { display: block; font-family: var(--display); font-stretch: var(--display-w); font-weight: 800; font-size: 56px; line-height: .9; letter-spacing: -0.02em; color: var(--key); font-variant-numeric: tabular-nums; }
.theme-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.theme-btn:hover { color: var(--fg); border-color: var(--muted); }

/* Nav. Tablets: sticky top tab bar. Phones and desktop restyle it further down. */
.tabs { position: sticky; top: 0; z-index: var(--z-sticky); background: color-mix(in srgb, var(--surface) 86%, transparent); -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%); border-bottom: 1px solid var(--line); }
.tabs-in { max-width: 1040px; margin: 0 auto; padding-inline: 12px; padding-top: 6px; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs-in::-webkit-scrollbar { display: none; }
.tab { position: relative; border: 0; background: transparent; padding: 10px 12px 12px; font-weight: 500; color: var(--muted); cursor: pointer; white-space: nowrap; border-radius: 8px 8px 0 0; }
.tab::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; border-radius: 2px; background: var(--accent); transform: scaleX(0); }
.tab[aria-selected="true"] { color: var(--fg); font-weight: 600; }
.tab[aria-selected="true"]::after { transform: scaleX(1); }
.tab:hover { color: var(--fg); background: var(--sunk); }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab .ico, .side-brand, .more-btn { display: none; }
.side-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--accent); color: var(--surface); font-family: var(--display); font-stretch: var(--display-w); font-weight: 800; font-size: 19px; letter-spacing: -0.02em; }
.side-brand b { display: block; font-family: var(--display); font-stretch: var(--display-w); font-weight: 800; font-size: 19px; line-height: 1; text-transform: uppercase; }
.side-brand small { font-size: 12px; color: var(--muted); }
.route-bar { flex-basis: 100%; padding-top: 12px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; border-top: 1px solid var(--line); }
.route-bar .lbl { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 600; }
.route-bar .lbl.end { margin-left: auto; }
.route-steps { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#target-read { font-family: var(--mono); font-size: 13.5px; font-weight: 600; }
.step { font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); border: 0; cursor: pointer; }
.step:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.step.last { background: var(--key-soft); color: var(--key); }
.step.last:hover { box-shadow: inset 0 0 0 1px var(--key); }
.arrow { color: var(--muted); }

/* Panels */
.wrap { max-width: 1040px; margin: 0 auto; padding-inline: 16px; padding-block: 28px 72px; }
.panel { display: grid; gap: 36px; }
.block { display: grid; gap: 14px; }
.sec-head { display: grid; gap: 6px; }
.sec-head h2 { font-size: 34px; }
.sec-head .focus { color: var(--muted); max-width: 68ch; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
/* Grid children default to min-width: auto, which lets wide charts push the page past the screen. */
.panel > *, .block > *, .grid2 > *, .race-cols > *, .notes > *, .today-card > *, .pad > * { min-width: 0; }
.swipe-hint { display: none; font-size: 12px; color: var(--muted); }
.pad { padding: 18px 20px; display: grid; gap: 10px; align-content: start; }
.pad h3 { font-size: 22px; }
.pad ul, .pad ol { margin: 0; padding-left: 20px; display: grid; gap: 7px; }
.pad li { color: var(--muted); }
.pad li::marker { color: var(--c-rest); }
.pad li b { color: var(--fg); font-weight: 600; }

/* Overview */
.today-card { padding: 20px; display: grid; gap: 10px; }
.today-card:first-child { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); box-shadow: var(--shadow-hi); }
.today-card.next { background: var(--sunk); box-shadow: none; border-color: transparent; }
.today-card h3 { font-size: 30px; }
.today-card .d-detail { font-size: 14px; }
.link-btn { justify-self: start; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); background: transparent; border-radius: 8px; padding: 7px 13px; font-weight: 600; font-size: 14px; cursor: pointer; }
.link-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.vol { padding: 18px 20px; display: grid; gap: 12px; }
.vol-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 64px; gap: 12px; align-items: center; }
.vol-track { position: relative; height: 14px; background: var(--sunk); border-radius: 4px; }
/* Planned vs run: the planned bar is the light target, the run bar sits inside it. */
.vol-bar { position: absolute; inset: 0 auto 0 0; background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent); border-radius: 4px; }
.vol-row.cur .vol-bar { background: var(--key-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--key) 60%, transparent); }
.vol-mark { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 2px dashed var(--muted); }
.vol-legend { font-size: 13px; color: var(--muted); max-width: 80ch; }
.vol-act { position: absolute; left: 0; top: 4px; bottom: 4px; background: var(--accent); border-radius: 0 3px 3px 0; }
.vol-row.cur .vol-act { background: var(--key); }
.vol-key { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.vol-key span { display: inline-flex; align-items: center; gap: 6px; }
.vol-key i { display: inline-block; width: 16px; height: 10px; border-radius: 3px; }
.vol-key .sw-plan { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.vol-key .sw-act { background: var(--accent); height: 6px; }
.vol-key .sw-peak { width: 0; height: 14px; border-left: 2px dashed var(--muted); border-radius: 0; }
.drift-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 92px; gap: 12px; align-items: center; }
.drift-bar { position: absolute; inset: 0 auto 0 0; border-radius: 0 4px 4px 0; background: var(--good); }
.drift-bar.meh { background: var(--warn); }
.drift-bar.off { background: var(--key); }

/* Strava actuals and status pills. Each pill also carries its grade as text. */
.d-actual { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.d-actual-l { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; color: var(--muted); }
.pill { display: inline-block; border-radius: 999px; padding: 1px 8px; background: var(--sunk); border: 1px solid var(--line); font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 600; }
.pill.ok { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 55%, transparent); }
.pill.meh { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.pill.off { background: var(--key-soft); border-color: color-mix(in srgb, var(--key) 55%, transparent); }
.pill.ok::before { content: "✓ "; color: var(--good); }
.pill.meh::before { content: "~ "; color: var(--warn); }
.pill.off::before { content: "! "; color: var(--key); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.strava-fill { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; }
/* Stats tab scatter charts. Recessive grid and axes, 2px trend line, dots with a surface ring. */
.chart-card { padding: 18px 20px; display: grid; gap: 12px; }
.vol-row.beats-row { grid-template-columns: 190px minmax(0, 1fr) 48px; }
.chart-card h3 { font-size: 20px; }
.chart-note { font-size: 13px; margin: 0; max-width: 80ch; }
.scatter { width: 100%; height: auto; display: block; }
.sc-grid { stroke: var(--line); stroke-width: 1; }
.sc-ax { fill: var(--muted); font: 500 11px var(--body); }
.sc-title { font-weight: 600; }
.sc-band { fill: var(--accent-soft); }
.sc-ref { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; }
.sc-ref-l { fill: var(--muted); font: 600 11px var(--body); }
.sc-fit { fill: none; stroke: var(--fg); stroke-width: 2; stroke-linecap: round; }
.sc-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.sc-dot.hot { fill: var(--key); }
.sc-hit { fill: transparent; cursor: crosshair; }
.sc-hit:hover { fill: var(--fg); fill-opacity: 0.08; }
.vol-key .sw-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.vol-key .sw-dot.hot { background: var(--key); }
.vol-key .sw-fit { height: 0; border-top: 2px solid var(--fg); border-radius: 0; }
.vol-key .sw-band { background: var(--accent-soft); }
/* Threshold finder */
#st-th-head { display: grid; gap: 12px; }
.th-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.th-pick .link-btn { padding: 5px 11px; font-size: 13px; }
.th-pick .link-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.sc-dot.faint { fill: var(--muted); fill-opacity: 0.35; stroke: none; }
.vol-key .sw-dot.faint { background: var(--muted); opacity: 0.45; }
.sc-fit.th-above, .vol-key .sw-fit.th-above { stroke: var(--key); border-top-color: var(--key); }
.sc-fit.th-ext { stroke-dasharray: 5 5; opacity: 0.45; }
.vol-key .sw-fit.th-ext { border-top-style: dashed; opacity: 0.6; }
.sc-ref.th-mark { stroke: var(--key); stroke-dasharray: none; }
.sc-ref-l.th-mark { fill: var(--key); }
/* Does HR settle: one hue, faint for slow paces to full strength for fast ones (6:30/km is se-0, 4:00 is se-10). */
#st-se-head { display: grid; gap: 12px; }
.se-0 { --se: color-mix(in oklab, var(--key) 30%, var(--surface)); }
.se-1 { --se: color-mix(in oklab, var(--key) 37%, var(--surface)); }
.se-2 { --se: color-mix(in oklab, var(--key) 44%, var(--surface)); }
.se-3 { --se: color-mix(in oklab, var(--key) 51%, var(--surface)); }
.se-4 { --se: color-mix(in oklab, var(--key) 58%, var(--surface)); }
.se-5 { --se: color-mix(in oklab, var(--key) 65%, var(--surface)); }
.se-6 { --se: color-mix(in oklab, var(--key) 72%, var(--surface)); }
.se-7 { --se: color-mix(in oklab, var(--key) 79%, var(--surface)); }
.se-8 { --se: color-mix(in oklab, var(--key) 86%, var(--surface)); }
.se-9 { --se: color-mix(in oklab, var(--key) 93%, var(--surface)); }
.se-10 { --se: var(--key); }
.se-run { fill: none; stroke: var(--se); stroke-width: 1; opacity: 0.4; }
.se-line { fill: none; stroke: var(--se); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sc-dot.se-dot { fill: var(--se); }
.se-sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--se); margin-right: 8px; }
.vol-key .sw-ln.se-k-run { border-color: var(--key); opacity: 0.4; border-top-width: 1px; }
.vol-key .sw-ln.se-k-line { border-color: var(--key); }
/* Charts over time: fitness and freshness on Stats, and the 5k page. */
.chart-sub { font-size: 15px !important; margin: 4px 0 -6px; }
.sc-grid.zero { stroke: var(--muted); }
.sc-col { fill: transparent; cursor: crosshair; }
.sc-col:hover { fill: var(--fg); fill-opacity: 0.06; }
.tl-mark { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tl-lab { fill: var(--fg); font: 600 11px var(--body); }
.ln { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ln.proj { stroke-dasharray: 5 4; }
.ln-fit { stroke: var(--accent); }
.ln-fat { stroke: var(--c-int); }
.ln-pb.tue { stroke: var(--accent); }
.ln-pb.sat { stroke: var(--c-int); }
.ln-trend { stroke: var(--fg); }
.fr-bar.pos { fill: var(--good); }
.fr-bar.neg { fill: var(--key); }
.fr-bar.proj { fill-opacity: 0.45; }
.sc-dot.sat { fill: var(--c-int); }
.sc-dot.easy { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.sc-dot.sat.easy { stroke: var(--c-int); }
.vol-key .sw-dot.sat { background: var(--c-int); }
.vol-key .sw-dot.ring { background: transparent; box-shadow: inset 0 0 0 2px var(--muted); }
.vol-key .sw-ln { height: 0; border-top: 2px solid; border-radius: 0; }
.vol-key .sw-ln.fit { border-color: var(--accent); }
.vol-key .sw-ln.fat { border-color: var(--c-int); }
.vol-key .sw-ln.proj { border-top-style: dashed; border-color: var(--muted); }
.vol-key .sw-fr.pos { background: var(--good); }
.vol-key .sw-fr.neg { background: var(--key); }
.sc-dot.key { fill: var(--key); }
.ln-faint { stroke: var(--muted); stroke-width: 1.2; opacity: 0.45; }
.ln-avg { stroke: var(--fg); stroke-width: 3; }
.ln-last { stroke: var(--c-int); }
.vol-key .sw-dot.key { background: var(--key); }
.vol-key .sw-ln.tue { border-color: var(--accent); }
.vol-key .sw-ln.avg { border-top-width: 3px; border-color: var(--fg); }
.vol-key .sw-ln.last { border-color: var(--c-int); }
.vol-key .sw-ln.faint { border-color: var(--muted); opacity: 0.6; }
/* Stats tab: contents buttons and group headings. */
.st-jump { display: flex; flex-wrap: wrap; gap: 8px; }
.st-group { scroll-margin-top: 90px; margin-top: 18px; padding-top: 14px; border-top: 2px solid var(--line); font-size: 26px; }
.records { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.rec { padding: 14px 16px; display: grid; gap: 4px; }
.rec b { font-family: var(--mono); font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.rec .muted { font-size: 12px; overflow-wrap: anywhere; }
.mo-bar { fill: var(--accent); }
.mo-bar.pm, .sc-dot.pm { fill: var(--c-int); }
.mo-bar.proj { fill-opacity: 0.45; }
#st-hill { padding: 0; }
/* Attendance grid: one square per Tuesday and Saturday. */
.grid-scroll { overflow-x: auto; }
.gc-svg { width: auto; max-width: none; }
.gc { stroke: var(--surface); stroke-width: 1; }
.gc-none { fill: var(--sunk); }
.gc-future { fill: none; stroke: var(--line); stroke-dasharray: 2 2; }
.gc-tue { fill: var(--accent); }
.gc-sat { fill: var(--c-int); }
.gc-easy { fill-opacity: 0.35; }
.vol-key .sw-gc { width: 12px; height: 12px; border-radius: 3px; }
.vol-key .sw-gc.gc-tue { background: var(--accent); }
.vol-key .sw-gc.gc-sat { background: var(--c-int); }
.vol-key .sw-gc.gc-easy { opacity: 0.35; }
.vol-key .sw-gc.gc-none { background: var(--sunk); box-shadow: inset 0 0 0 1px var(--line); }
/* Long-run fade rows: bars grow either way from the middle line. */
.drift-row.fade-row { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 92px; }
.drift-bar.fade { inset: 0 auto 0 auto; border-radius: 4px; }
.fade-chart { display: grid; gap: 8px; padding-top: 6px; }
.fk-all summary { padding: 14px 18px; font-weight: 600; cursor: pointer; }
.chart-tip { position: fixed; z-index: var(--z-tip); pointer-events: none; background: var(--fg); color: var(--surface); font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 8px; white-space: nowrap; box-shadow: var(--shadow-hi); }
.recipe ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
.dates { display: grid; gap: 0; }
.date-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 12px; padding: 13px 20px; border-top: 1px solid var(--line); align-items: baseline; }
.date-row:first-child { border-top: 0; }
.date-row b { font-family: var(--display); font-stretch: var(--display-w); font-weight: 700; font-size: 19px; }
.cal { padding: 18px 20px; display: grid; gap: 12px; font-size: 14px; }
.cal-links { display: flex; flex-wrap: wrap; gap: 8px; }
a.link-btn { text-decoration: none; }
.cal-url { overflow-wrap: anywhere; background: var(--sunk); border-radius: 8px; padding: 8px 12px; user-select: all; font-family: var(--mono); font-size: 12.5px; }

/* Decision map */
.tree-box { overflow-x: auto; padding: 16px 14px 10px; }
.tree-box svg { display: block; width: 100%; min-width: 760px; height: auto; }
.col-h { fill: var(--muted); font: 600 11px var(--body); letter-spacing: 0.1em; text-transform: uppercase; }
.edge { fill: none; stroke: var(--line); stroke-width: 1.5; }
.edge.on { stroke: var(--accent); stroke-width: 2.5; }
.node { cursor: pointer; }
.node rect { fill: var(--surface); stroke: var(--line); stroke-width: 1.2; }
.node:hover rect { stroke: var(--muted); }
.node .n-t { fill: var(--fg); font: 600 13px var(--body); }
.node .n-s { fill: var(--muted); font: 400 11.5px var(--body); }
.node.on rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.node.target.on rect { fill: var(--key-soft); stroke: var(--key); }
.node.root { cursor: default; }
.node.root:hover rect { stroke: var(--line); }
.node:focus { outline: none; }
.node:focus-visible rect { stroke: var(--fg); stroke-width: 2.5; }

/* Zones: one row, a colour bar on the left of each, pace in mono. */
.zones { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.zone { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 12px 16px; display: grid; gap: 2px; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.zone::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--zc); }
.zone .z-pace { font-family: var(--mono); font-weight: 600; font-size: 21px; line-height: 1.2; letter-spacing: -0.02em; }
.zone .z-sub { color: var(--muted); font-size: 13px; }

/* Week picker + days */
.week-pick { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: thin; }
.wk-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 13px; cursor: pointer; display: grid; text-align: left; min-width: 112px; box-shadow: var(--shadow); }
.wk-btn:hover { border-color: var(--muted); }
.wk-btn b { font-family: var(--display); font-stretch: var(--display-w); font-weight: 800; font-size: 20px; }
.wk-btn span { font-size: 12px; color: var(--muted); }
.wk-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.wk-btn .now { color: var(--key); font-weight: 700; }
.week-km { font-family: var(--mono); font-weight: 600; font-size: 20px; letter-spacing: -0.02em; }
.week-km small { font-family: var(--body); font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.days { overflow: hidden; }
.day { display: grid; grid-template-columns: 74px 96px minmax(0, 1fr) 64px 34px; gap: 12px; align-items: start; padding: 15px 18px; border-top: 1px solid var(--line); }
.day:first-child { border-top: 0; }
.day.rest { padding-block: 10px; color: var(--muted); background: color-mix(in srgb, var(--sunk) 45%, transparent); }
.day.today { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.d-date { display: grid; line-height: 1.15; }
.d-date b { font-family: var(--display); font-stretch: var(--display-w); font-weight: 800; font-size: 19px; text-transform: uppercase; }
.d-date span { font-size: 12px; color: var(--muted); }
.chip { justify-self: start; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; padding: 3px 8px; border-radius: 6px; color: var(--cc); background: var(--cs); white-space: nowrap; }
.t-easy { --cc: var(--c-easy); --cs: var(--c-easy-soft); }
.t-int { --cc: var(--c-int); --cs: var(--c-int-soft); }
.t-long { --cc: var(--accent); --cs: var(--accent-soft); }
.t-race, .t-test { --cc: var(--key); --cs: var(--key-soft); }
.t-rest { --cc: var(--c-rest); --cs: transparent; padding-inline: 0; }
.t-shoes { --cc: var(--fg); --cs: var(--sunk); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.d-body { display: grid; gap: 5px; min-width: 0; }
.d-title { font-weight: 600; }
.day.rest .d-title { font-weight: 500; }
.d-detail { color: var(--muted); font-size: 14px; }
.d-detail ul { margin: 2px 0 0; padding-left: 18px; display: grid; gap: 2px; }
.d-result { font-size: 13px; font-weight: 600; color: var(--key); }
.d-note { font-size: 13px; color: var(--muted); }
.d-note b { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg); margin-right: 6px; }
.d-note.fuel { background: var(--fuel-soft); border-radius: 8px; padding: 6px 10px; color: var(--fg); }
.d-note.fuel b { color: var(--fuel); }
.guide-btn { justify-self: start; border: 1px solid var(--line); background: var(--surface); color: var(--accent); border-radius: 8px; padding: 5px 10px; cursor: pointer; font: inherit; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.guide-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.guide { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--fg); box-shadow: var(--shadow-hi); overflow: auto; }
.guide::backdrop { background: rgb(10 14 22 / .5); }
.guide-in { position: relative; padding: 22px 22px 18px; display: grid; gap: 14px; }
.guide-x { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border: 0; border-radius: 8px; background: var(--sunk); color: var(--fg); font-size: 20px; line-height: 1; cursor: pointer; }
.guide-x:hover { background: var(--line); }
#guide-body { display: grid; gap: 14px; }
#guide-body h3 { margin: 2px 40px 0 0; font-size: 28px; }
#guide-body section { display: grid; gap: 4px; font-size: 14px; }
#guide-body h4 { margin: 0; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
#guide-body p { margin: 0; }
#guide-body ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
#guide-body .g-stop { background: var(--key-soft); border-radius: 10px; padding: 10px 12px; }
#guide-body .g-stop h4 { color: var(--key); }
#guide-body .g-foot { font-size: 12px; }
#guide-body .g-fuel { background: var(--fuel-soft); border-radius: 10px; padding: 10px 12px; }
#guide-body .g-fuel h4 { color: var(--fuel); }
.d-km { text-align: right; font-family: var(--mono); font-size: 14px; font-weight: 600; white-space: nowrap; }
.nw { white-space: nowrap; }
.d-km.opt { color: var(--muted); font-weight: 500; }
.check { display: flex; justify-content: flex-end; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; margin: 2px 0 0; }
.day.done .d-title { text-decoration: line-through; text-decoration-color: var(--muted); }
.week-nav { display: flex; justify-content: space-between; gap: 10px; }
.nav-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 9px 15px; cursor: pointer; font-weight: 600; box-shadow: var(--shadow); }
.nav-btn:hover:not(:disabled) { border-color: var(--muted); }
.nav-btn:disabled { opacity: 0.4; cursor: default; box-shadow: none; }

/* Decisions */
.decide { border: 1px solid color-mix(in srgb, var(--key) 45%, transparent); background: var(--key-soft); border-radius: 14px; padding: 18px 20px; display: grid; gap: 12px; }
.decide.off { border-color: var(--line); background: var(--surface); }
.decide.off h3 { color: var(--muted); }
.decide h3 { font-size: 24px; color: var(--key); }
.d-when { font-size: 13px; color: var(--muted); }
.decide-grid { display: grid; gap: 10px; }
.opt-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; display: grid; gap: 4px; align-content: start; text-align: left; cursor: pointer; box-shadow: var(--shadow); }
.opt-card:hover { border-color: var(--muted); box-shadow: var(--shadow-hi); }
.opt-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), var(--shadow); }
.opt-card b { font-family: var(--display); font-stretch: var(--display-w); font-weight: 800; font-size: 24px; }
.opt-card span { color: var(--muted); font-size: 13px; }
.picked { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-style: normal; }
.checker { background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; padding: 16px 18px; display: grid; gap: 12px; }
.checker h4 { margin: 0; font-size: 14px; font-weight: 600; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select { border: 1px solid var(--line); background: var(--sunk); border-radius: 8px; padding: 9px 11px; width: 100%; min-width: 0; }
.field input:hover, .field select:hover { border-color: var(--muted); }
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.field input[type="range"] { padding: 0; accent-color: var(--accent); background: transparent; border: 0; box-shadow: none; }
.verdict { border-radius: 10px; padding: 12px 14px; display: grid; gap: 6px; }
.verdict.good { background: var(--good-soft); }
.verdict.warn { background: var(--warn-soft); }
.verdict.bad { background: var(--key-soft); }
.verdict b { font-size: 15px; font-weight: 600; }
.verdict ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.use-btn { justify-self: start; border: 0; background: var(--accent); color: var(--surface); border-radius: 8px; padding: 8px 14px; font-weight: 600; cursor: pointer; }
.use-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 86%, var(--fg)); }
.use-btn:disabled { background: var(--sunk); color: var(--muted); cursor: default; }

/* Tables: one hairline between rows, header in small caps. */
.table-box { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 16px; text-align: left; border-top: 1px solid var(--line); vertical-align: top; }
thead th { border-top: 0; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; background: color-mix(in srgb, var(--sunk) 55%, transparent); }
tbody tr:hover td { background: color-mix(in srgb, var(--sunk) 45%, transparent); }
td.r, th.r { text-align: right; }
td.r { font-family: var(--mono); font-size: 14px; }
tr.hl td { font-weight: 700; color: var(--accent); }
td.muted { color: var(--muted); }
.caf { font-weight: 500; color: var(--fuel); font-size: 12px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--sunk); border-radius: 10px; padding: 12px 14px; display: grid; gap: 3px; }
/* Stat tiles that sit straight on the page get a raised surface instead of a sunk one. */
.panel > .stats .stat { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.stat b { font-family: var(--mono); font-weight: 600; font-size: 22px; line-height: 1.2; letter-spacing: -0.03em; }
.stat span { font-size: 12.5px; color: var(--muted); }

/* Race */
.race-cols { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.notes { display: grid; gap: 12px; }
.notes section { padding: 16px 18px; display: grid; gap: 6px; }
.notes section:first-child { border-color: color-mix(in srgb, var(--key) 40%, var(--line)); }
.notes h3 { font-size: 20px; }
.notes p { color: var(--muted); font-size: 14px; }
.notes p b { color: var(--fg); font-weight: 600; }
.timeline { display: grid; }
.tl-row { display: grid; grid-template-columns: 70px 80px minmax(0, 1fr); gap: 12px; padding: 11px 20px; border-top: 1px solid var(--line); align-items: baseline; }
.tl-row:first-child { border-top: 0; }
.tl-row b { font-family: var(--mono); font-weight: 600; font-size: 17px; letter-spacing: -0.02em; }
.tl-row .rel { font-size: 12px; color: var(--muted); }
.tl-row.go { background: var(--key-soft); }
.tl-row.go b { color: var(--key); }

/* Course */
.prof-card { padding: 14px 14px 12px; }
#profile { display: block; width: 100%; height: auto; touch-action: pan-y; cursor: crosshair; }
.prof-read { font-size: 13px; color: var(--muted); padding: 6px 6px 0; min-height: 1.5em; }
.prof-read b { color: var(--fg); }
.p-area { fill: var(--accent-soft); }
.p-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.p-grid { stroke: var(--line); stroke-width: 1; }
.p-axis { fill: var(--muted); font: 500 11px var(--body); }
.p-bridge { fill: var(--key-soft); }
.p-bridge-l { fill: var(--key); font: 700 11px var(--body); }
.p-mark { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.p-mark-l { fill: var(--fg); font: 600 11px var(--body); }
.p-hover-line { stroke: var(--fg); stroke-width: 1; }
.p-pace { fill: none; stroke: var(--key); stroke-width: 2.5; stroke-linejoin: round; }
.p-avg { stroke: var(--fg); stroke-width: 1.2; stroke-dasharray: 6 4; opacity: 0.6; }
.p-avg-l { fill: var(--fg); font: 600 11px var(--body); }
.p-axis-r { fill: var(--key); font: 600 11px var(--body); }
.p-axis-t { fill: var(--muted); font: 600 11px var(--body); letter-spacing: 0.06em; text-transform: uppercase; }
.p-pdot { fill: var(--key); stroke: var(--surface); stroke-width: 2; }
.p-edot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 2px 6px 10px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 18px; height: 10px; border-radius: 2px; }
.sw-ele { background: var(--accent-soft); border: 1.5px solid var(--accent); }
.sw-pace { height: 0; border-top: 3px solid var(--key); border-radius: 0; }
.sw-avg { height: 0; border-top: 2px dashed var(--fg); opacity: 0.6; border-radius: 0; }
.sw-bridge { background: var(--key-soft); }
.sw-last { height: 0; border-top: 2px dotted var(--muted); border-radius: 0; }
#kk-profile, #kk-map { display: block; width: 100%; height: auto; }
.p-last { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-dasharray: 2 3; stroke-linejoin: round; }
.kmgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.kmc { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; display: grid; gap: 0; box-shadow: inset 3px 0 0 var(--kc, var(--line)); font-variant-numeric: tabular-nums; }
.kmc.slow { --kc: var(--key); }
.kmc.fast { --kc: var(--accent); }
.kmc span { font-size: 11px; color: var(--muted); }
.kmc b { font-family: var(--mono); font-weight: 600; font-size: 17px; line-height: 1.3; letter-spacing: -0.02em; }
.kmc.hl { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.p-dot, .m-dot { fill: var(--key); stroke: var(--surface); stroke-width: 2; }
.map-card { overflow: hidden; }
#map { display: block; width: 100%; height: auto; }
.m-bg { fill: var(--sunk); }
.m-halo { fill: none; stroke: var(--surface); stroke-width: 6; stroke-linejoin: round; stroke-linecap: round; opacity: 0.85; }
.m-credit { font-size: 11px; color: var(--muted); padding: 0 16px 14px; margin: -8px 0 0; }
.m-credit a { color: inherit; }
.m-route { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.m-bridge { fill: none; stroke: var(--key); stroke-width: 5; stroke-linecap: round; }
.m-km { fill: var(--surface); stroke: var(--accent); stroke-width: 1.5; }
.m-km-l { fill: var(--muted); font: 600 10px var(--body); }
.m-flag { fill: var(--fg); }
.m-flag-l { fill: var(--fg); font: 700 11px var(--body); }
.sect { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 12px; padding: 13px 18px; border-top: 1px solid var(--line); }
.sect:first-child { border-top: 0; }
.sect b.km { font-family: var(--mono); font-weight: 600; font-size: 13.5px; }
.sect p { font-size: 13px; color: var(--muted); }
.sect.hot b.km { color: var(--key); }
tr.cur td { background: var(--accent-soft); }

.fine { color: var(--muted); font-size: 13px; display: grid; gap: 8px; max-width: 75ch; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); }

@media screen and (max-width: 760px) {
  .grid2, .race-cols { grid-template-columns: minmax(0, 1fr); }
  .zones { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .decide-grid { grid-template-columns: minmax(0, 1fr) !important; }
  /* Day rows: date, type, km and tick on one line, then the session at full width. "Why" lives in the Run guide. */
  .day { grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px 10px; padding: 14px 16px; align-items: center; }
  .day .d-date { display: flex; align-items: baseline; gap: 6px; }
  .day > .chip { grid-column: 2; grid-row: 1; }
  .day .d-km { grid-column: 3; grid-row: 1; font-size: 13px; }
  .day .check { grid-column: 4; grid-row: 1; }
  .day .check input { width: 24px; height: 24px; margin: 0; }
  .day .d-body { grid-column: 1 / -1; grid-row: 2; }
  .day > span:empty, .day.rest .d-km { display: none; }
  .day .d-note:not(.fuel) { display: none; }
  .day.rest { padding-block: 11px; }
  .guide-btn { padding: 8px 12px; }
  .vol-row { grid-template-columns: 64px minmax(0, 1fr) 58px; gap: 10px; }
  .drift-row { grid-template-columns: 78px minmax(0, 1fr) 84px; gap: 10px; }
  .vol-row.beats-row { grid-template-columns: 112px minmax(0, 1fr) 40px; }
  .date-row { grid-template-columns: 78px minmax(0, 1fr); padding: 12px 16px; }
  .date-row .muted:last-child { grid-column: 2; }
  .top-in { padding-block: 16px 12px; gap: 12px; }
  .brand .meta { font-size: 13px; }
  .top-right { width: 100%; justify-content: space-between; align-items: center; }
  .count { display: flex; align-items: baseline; gap: 8px; text-align: left; }
  .count b { font-size: 34px; }
  .sec-head h2 { font-size: 28px; }
  .panel { gap: 30px; }
  .route-bar { padding-block: 8px; }
  .route-bar .lbl.end { margin-left: 0; }
  .swipe-hint { display: block; }
  .pad, .today-card { padding: 16px; }
  .decide { padding: 16px; }
  .tl-row { grid-template-columns: 54px minmax(0, 1fr); padding: 10px 16px; }
  .tl-row .rel { grid-column: 1; grid-row: 2; }
  .tl-row > span:last-child { grid-column: 2; grid-row: 1 / span 2; }
  th, td { padding: 9px 12px; }
  .kmgrid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
  #profile .p-axis, #profile .p-axis-r, #profile .p-axis-t, #profile .p-mark-l, #profile .p-bridge-l { font-size: 17px; }
  .vol-row > span:last-child { white-space: nowrap; }
  .top::before { width: 340px; height: 340px; }
  .route-bar { padding-top: 10px; gap: 6px 8px; }

  /* Bottom bar: four main tabs and More. More opens the other four as a row above the bar. */
  body { padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
  .tabs { position: fixed; top: auto; bottom: 0; left: 0; right: 0; display: flex; align-items: flex-end; gap: 2px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); border-bottom: 0; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 92%, transparent); }
  .tabs.open { box-shadow: 0 0 0 100vmax rgb(8 12 20 / .45); border-radius: 18px 18px 0 0; padding-top: 10px; }
  .tabs-in { flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 2px; padding: 0; margin: 0; overflow: visible; }
  .tab { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 2px 5px; border-radius: 12px; font-size: 11px; font-weight: 600; min-width: 0; }
  .tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .tab::after { display: none; }
  .tab:hover { background: transparent; }
  .tab .ico { display: block; width: 52px; height: 28px; padding: 4px 16px; border-radius: 999px; }
  .tab[aria-selected="true"], .more-btn.on { color: var(--accent); }
  .tab[aria-selected="true"] .ico, .more-btn.on .ico { background: var(--accent-soft); }
  .more-item { display: none; }
  .tabs.open .more-item { display: flex; order: -1; }
  .more-btn { display: flex; flex: 0 0 22%; }
  .tabs.open .more-btn .ico { background: var(--sunk); }

  /* Run guide as a bottom sheet. */
  .guide { width: 100%; max-width: none; margin: auto 0 0; border-radius: 20px 20px 0 0; border-bottom: 0; max-height: 90dvh; }
  .guide-in { padding: 26px 18px calc(20px + env(safe-area-inset-bottom, 0px)); }
  .guide-in::before { content: ""; position: absolute; top: 9px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--line); }
}

/* Desktop: header across the top, then the nav as a sticky glass card beside the content. */
@media screen and (min-width: 1100px) {
  body { display: grid; grid-template-columns: minmax(24px, 1fr) 228px 32px minmax(0, 1000px) minmax(24px, 1fr); align-items: start; }
  .top { grid-column: 1 / -1; }
  .wrap { grid-column: 4; width: 100%; max-width: none; margin: 0; padding-inline: 0; }
  .tabs { grid-column: 2; position: sticky; top: 20px; margin-top: 28px; width: auto; max-height: calc(100dvh - 40px); overflow-y: auto; display: flex; flex-direction: column; gap: 18px; padding: 18px 12px 14px; border: 1px solid var(--line); border-radius: 18px; background: color-mix(in srgb, var(--surface) 78%, transparent); box-shadow: var(--shadow-hi), inset 0 1px 0 rgb(255 255 255 / .06); }
  .tabs-in { flex-direction: column; gap: 2px; padding: 0; margin: 0; max-width: none; overflow: visible; }
  .tab { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px; border-radius: 10px; text-align: left; }
  .tab .ico { display: block; }
  .tab::after { display: none; }
  .tab.more-btn { display: none; }
  .tab[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
  .tab[aria-selected="true"]::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
  .tab:hover:not([aria-selected="true"]) { background: var(--sunk); }
  /* Header content lines up with the sidebar's left edge and the content's right edge. */
  .top-in { max-width: calc(228px + 32px + 1000px + 48px); padding-inline: 24px; }
}
@media (prefers-reduced-motion: no-preference) {
  .opt-card, .node rect, .edge, .tab, .wk-btn, .link-btn, .nav-btn, .use-btn, .step, .theme-btn, .field input, .field select, tbody td, .pill {
    transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease), fill .2s var(--ease), stroke .2s var(--ease), transform .2s var(--ease);
  }
  .tab::after { transition: transform .3s var(--ease); }
  .opt-card:active, .wk-btn:active, .link-btn:active, .nav-btn:active:not(:disabled), .use-btn:active:not(:disabled), .step:active, .theme-btn:active { transform: scale(.98); }
  /* A short rise when a tab's panel appears, staggered over its first few blocks. */
  .panel:not([hidden]) > * { animation: rise .45s var(--ease) both; }
  .panel:not([hidden]) > :nth-child(2) { animation-delay: .04s; }
  .panel:not([hidden]) > :nth-child(3) { animation-delay: .08s; }
  .panel:not([hidden]) > :nth-child(n+4) { animation-delay: .12s; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  .guide[open] { animation: pop .28s var(--ease) both; }
  .guide-btn, .tab .ico { transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease); }
  @keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
  @media screen and (max-width: 760px) {
    .guide[open] { animation: sheet .34s var(--ease) both; }
    .tabs.open .more-item { animation: rise .25s var(--ease) both; }
  }
  @keyframes sheet { from { transform: translateY(100%); } }
}
@media print {
  body::after { display: none; }
  .tabs, .theme-btn, .check, .checker, .week-pick, .week-nav, .link-btn, .skip { display: none !important; }
  .panel[hidden] { display: grid !important; }
  .panel { break-before: page; }
  .panel:first-of-type { break-before: auto; }
  .day, .decide, .card { break-inside: avoid; }
  .card, .zone, .stat { box-shadow: none !important; }
}
