/* Upheld — all visual decisions live in these tokens; restyle by editing them.
   Colour has meaning: chartreuse = goals hit / the main action, lilac = data and calm,
   apricot heat = training, olive = kept, rust = broken, amber = needs attention. */

@font-face { font-family: 'Instrument Serif'; src: url('../fonts/InstrumentSerif-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url('../fonts/InstrumentSerif-Italic.ttf') format('truetype'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('../fonts/Manrope-Variable.ttf') format('truetype'); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'DM Mono'; src: url('../fonts/DMMono-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'DM Mono'; src: url('../fonts/DMMono-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }

:root {
  color-scheme: light;
  /* ground & ink */
  --bg: #FBFAF6;
  --text: #221D33;
  --text-2: #4A4560;
  --muted: #5C566E;
  /* surfaces: frosted glass over the glow */
  --surface: rgba(255, 255, 255, 0.68);
  --surface-strong: rgba(255, 255, 255, 0.88);
  --surface-2: rgba(34, 29, 51, 0.05);
  --edge: rgba(255, 255, 255, 0.95);
  --border: rgba(34, 29, 51, 0.07);
  --shadow: 0 1px 2px rgba(60, 40, 110, 0.04), 0 14px 34px rgba(110, 82, 224, 0.08);
  /* brand */
  --lime: #E4F070;
  --lime-deep: #C8DB36;
  --violet: #5B41C9;
  --violet-2: #6E52E0;
  --lilac: #DECDFB;
  --lilac-soft: rgba(222, 205, 251, 0.6);
  --accent: var(--violet);
  /* meaning */
  --good: #4C6414;
  --good-bg: rgba(228, 240, 112, 0.5);
  --warning: #8A5A0E;
  --warning-bg: rgba(217, 154, 43, 0.15);
  --critical: #A63E26;
  --critical-bg: rgba(166, 62, 38, 0.09);
  --spark: #9A82EE;
  /* glow colours (screens set --glow 0–1 and data-glow on <html>) */
  --glow: 0.4;
  --glow-lime: #EDF59A;
  --glow-corner: #FFD9C9;
  --glow-lilac: #DECDFB;
  --glow-lilac-low: #E7DCFB;
  /* shape & type */
  --radius: 22px;
  --radius-sm: 16px;
  --serif: 'Instrument Serif', Georgia, serif;
  --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'DM Mono', ui-monospace, SFMono-Regular, monospace;
}
/* training heat: chartreuse + apricot (live workout, finish, Train after a session) */
:root[data-glow='heat'] {
  --glow-corner: #FFC79A;
  --glow-lilac: #FFD3AE;
  --glow-lilac-low: #FFDDBF;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  /* the ground warms toward chartreuse as the glow rises */
  background: color-mix(in oklab, #FAF8FD, #FBFCEB calc(var(--glow) * 100%));
  color: var(--text);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { margin: 0; }
h1 { font-family: var(--serif); font-weight: 400; font-size: 40px; line-height: 1.02; letter-spacing: -0.015em; }
h1 em, .serif em { font-style: italic; }
h2 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; margin-bottom: 10px; }
h3 { font-size: 16px; font-weight: 650; }
p { margin: 0 0 8px; }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; word-break: break-all; }
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; }

/* ---------------------------------------------------------------- glow background */
.glow { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(56px); transition: opacity 1.2s ease, background-color 1.2s ease, transform 1.2s ease; }
.blob-lime      { width: 135vw; height: 78vw; max-width: 760px; max-height: 440px; left: -38vw; top: -24vw; background: var(--glow-lime);
                  opacity: calc(0.3 + 0.7 * var(--glow)); transform: rotate(-24deg) scale(calc(0.75 + 0.5 * var(--glow))); transform-origin: 30% 30%; }
.blob-corner    { width: 66vw; height: 56vw; max-width: 380px; max-height: 320px; right: -18vw; top: -14vw; background: var(--glow-corner); opacity: calc(0.45 + 0.5 * var(--glow)); }
.blob-lilac     { width: 92vw; height: 140vw; max-width: 520px; max-height: 800px; right: -24vw; top: 30vh; background: var(--glow-lilac);
                  opacity: calc(1 - 0.7 * var(--glow)); transform: rotate(28deg); }
.blob-lime-mid  { width: 88vw; height: 66vw; max-width: 500px; max-height: 380px; left: -42vw; top: 44vh; background: var(--glow-lime);
                  opacity: calc(1 * var(--glow)); transform: rotate(-30deg); }
.blob-lilac-low { width: 135vw; height: 66vw; max-width: 760px; max-height: 380px; left: -16vw; bottom: -22vw; background: var(--glow-lilac-low);
                  opacity: calc(1 - 0.7 * var(--glow)); transform: rotate(-12deg); }
.grain {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.12; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-reduced-motion: reduce) { .blob { transition: none; } }

/* ---------------------------------------------------------------- layout */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 20px calc(128px + env(safe-area-inset-bottom));
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 0 18px; }
.page-head .head-actions { display: flex; align-items: center; gap: 8px; }
.eyebrow, .section-title {
  font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
}
.eyebrow { margin: 0 0 6px; }
.section-title { margin: 26px 4px 10px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* round icon button used for the profile / settings entry */
.icon-btn {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.6); border: 1px solid var(--edge); color: var(--text);
  text-decoration: none; cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- cards */
.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 12px;
  color: inherit;
  text-decoration: none;
}
.card.highlight { border: 1.5px solid rgba(110, 82, 224, 0.45); background: var(--surface-strong); }
.card.banner { background: linear-gradient(135deg, rgba(237, 245, 154, 0.75), rgba(255, 255, 255, 0.72)); display: flex; flex-direction: column; gap: 2px; }
.card.banner span { color: var(--text-2); font-size: 14px; }
.card.error { background: var(--critical-bg); color: var(--critical); border-color: transparent; box-shadow: none; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.row + .row { border-top: 1px solid var(--border); }
.card > .row:first-child h2 { margin-bottom: 0; }

/* ---------------------------------------------------------------- buttons */
.btn {
  appearance: none;
  border: 1px solid var(--edge);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font: inherit;
  font-weight: 650;
  font-size: 14px;
  padding: 10px 18px;
  min-height: 44px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}
.btn:focus-visible, .chip:focus-visible, .tabbar a:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--violet-2); outline-offset: 2px; }
.btn:disabled, .btn.disabled { opacity: 0.45; cursor: default; }
.btn.primary {
  background: var(--lime); border-color: rgba(255, 255, 255, 0.9); color: var(--text);
  font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  box-shadow: 0 8px 22px rgba(160, 175, 40, 0.22);
}
.btn.danger { color: var(--critical); }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: 13px; }
.btn.primary.small { font-size: 11px; }
.btn.block { width: 100%; margin-bottom: 12px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-row.end { justify-content: flex-end; }
.link { background: none; border: 0; color: var(--muted); font: inherit; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; margin-left: auto; }
.file-btn { position: relative; }
.sticky-actions {
  position: sticky;
  bottom: calc(104px + env(safe-area-inset-bottom));
  justify-content: flex-end;
  padding: 12px 0;
}

/* ---------------------------------------------------------------- badges */
.badge { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.85); color: var(--text-2); white-space: nowrap; }
.badge.tone-good { background: var(--good-bg); color: var(--good); }
.badge.tone-warning { background: var(--warning-bg); color: var(--warning); }
.badge.tone-critical { background: var(--critical-bg); color: var(--critical); }

/* ---------------------------------------------------------------- Today */
.today-head { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin-top: 6px; }
.today-head > div:first-child { display: flex; flex-direction: column; gap: 3px; }
.dateline { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.wordmark { font-family: var(--serif); font-size: 22px; line-height: 1; letter-spacing: -0.01em; }
.wordmark em { font-style: italic; }
.headline { margin: 28px 0 0; font-size: 42px; line-height: 1; letter-spacing: -0.015em; }
.headline-sub { margin: 12px 0 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.today-actions:empty { display: none; }
.today-actions { margin: 18px 0 0; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.btn.go { min-height: 46px; padding: 0 20px 0 18px; gap: 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.btn.go.white { background: #fff; box-shadow: 0 8px 22px rgba(140, 150, 30, 0.18); }
.btn .arrow { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.quiet-link { background: none; border: 0; padding: 10px 0; font: inherit; font-size: 14px; font-weight: 650; color: var(--violet); text-decoration: none; cursor: pointer; }
.goal-dots { display: flex; align-items: center; gap: 5px; }
.goal-dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.7); border: 1px solid rgba(34, 29, 51, 0.18); }
.goal-dots i.on { background: var(--lime); }
.goal-dots span { margin-left: 4px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; color: var(--muted); }

.steps-card { margin: 26px 0 12px; padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.steps-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.steps-num { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.steps-num .big { font-size: 46px; font-weight: 300; letter-spacing: -0.035em; line-height: 1; font-variant-numeric: tabular-nums; }
.steps-num .of { font-size: 14px; color: var(--muted); }
.pace-chip { margin-top: 2px; padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.85); font-size: 12px; font-weight: 700; color: var(--text-2); white-space: nowrap; }
button.pace-chip { border: 0; font: inherit; font-size: 12px; font-weight: 700; color: var(--violet); cursor: pointer; }
.pace-chip.good { background: var(--lime); color: #3E5A12; }
.pace-chip.behind { color: var(--critical); }
.pace-track { position: relative; height: 26px; }
.pace-track .rail, .pace-track .fill { position: absolute; left: 0; top: 0; height: 8px; border-radius: 4px; }
.pace-track .rail { right: 0; background: rgba(34, 29, 51, 0.07); }
.pace-track .fill { background: linear-gradient(90deg, #C9B5F7 0%, #D9E86A 100%); }
.pace-track .fill.done { background: linear-gradient(90deg, #D9E86A 0%, var(--lime-deep) 100%); }
.pace-track .marker { position: absolute; top: -4px; width: 2px; height: 16px; margin-left: -1px; border-radius: 1px; background: var(--text); }
.pace-track .marker-label { position: absolute; top: 15px; transform: translateX(-50%); font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { min-height: 104px; padding: 14px 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--edge); display: flex; flex-direction: column; justify-content: space-between; gap: 6px; min-width: 0; }
.stat-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.stat-row { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.stat-value { font-size: 28px; font-weight: 400; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-value .unit { margin-left: 4px; font-size: 13px; color: var(--muted); letter-spacing: 0; }
.stat-side { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.stat-side.up { color: var(--violet); }
.stat-side.muted { font-weight: 500; }
.stat-foot { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.stat-foot svg { flex: none; width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.stat.stale .stat-value { opacity: 0.45; }
.stat .spark { width: 100%; height: 22px; }

.notice { width: 100%; font: inherit; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 12px; margin: 18px 0 0; padding: 12px 14px; border-radius: 18px; background: var(--surface-strong); border: 1px solid var(--edge); color: inherit; text-decoration: none; box-shadow: var(--shadow); }
.notice > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 1px; font-size: 13px; color: var(--text-2); min-width: 0; }
.notice strong { font-size: 14px; color: var(--text); }
.notice .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--violet-2); }
.notice .dot.lime { background: var(--lime-deep); }
.notice.warn .dot { background: #D99A2B; }
.notice-cta { flex: none; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--violet); }
.notice + .notice { margin-top: 8px; }

.week-link { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding: 14px 18px; border-radius: 999px; background: var(--surface); border: 1px solid var(--edge); color: var(--text); text-decoration: none; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---------------------------------------------------------------- tiles */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--edge); border-radius: 20px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-value { font-size: 28px; font-weight: 400; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile .spark { margin-top: 6px; width: 100%; }
.delta { font-size: 12px; font-weight: 600; color: var(--muted); }
.up-good { color: var(--violet); }
.up-bad { color: var(--critical); }

/* ---------------------------------------------------------------- meters */
.progress-item { padding: 4px 0 10px; }
.progress-item .row { padding: 0 0 6px; border: 0; }
.meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #C9B5F7 0%, #D9E86A 100%); }
.meter-fill.tone-good { background: var(--lime-deep); }
.meter-fill.tone-warning { background: #D99A2B; }

/* ---------------------------------------------------------------- review */
.verdict { display: flex; align-items: center; gap: 16px; }
.verdict h2 { margin: 0 0 2px; }
.verdict p { margin: 0; color: var(--text-2); }
.verdict-score { font-family: var(--serif); font-size: 52px; line-height: 1; letter-spacing: -0.02em; }
.verdict-score span { font-size: 24px; color: var(--muted); }
.verdict.tone-good { background: linear-gradient(135deg, rgba(237, 245, 154, 0.8), rgba(255, 255, 255, 0.7)); }
.verdict.tone-good h2 { color: var(--good); }
.verdict.tone-warning h2 { color: var(--warning); }
.verdict.tone-critical h2 { color: var(--critical); }

.statements { list-style: none; margin: 0; padding: 0; }
.statements li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; }
.statements li + li { border-top: 1px solid var(--border); }
.statements .icon {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; margin-top: 1px;
  background: var(--surface-2); color: var(--text-2);
}
.statements .tone-good .icon { background: var(--lime); color: var(--text); }
.statements .tone-warning .icon { background: var(--warning-bg); color: var(--warning); }
.statements .tone-critical .icon { background: transparent; color: var(--critical); box-shadow: inset 0 0 0 1.5px var(--critical); }
.coach { white-space: normal; color: var(--text); margin: 0; }
.suggestions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.suggestion { justify-content: flex-start; white-space: normal; text-align: left; border-radius: var(--radius-sm); }
.plan { list-style: none; margin: 0 0 8px; padding: 0; }
.plan li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; }
.plan li + li { border-top: 1px solid var(--border); }

.table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: right; padding: 8px 4px; border-top: 1px solid var(--border); }
.table thead th { border-top: 0; font-family: var(--mono); font-weight: 400; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.table th[scope='row'] { text-align: left; font-weight: 600; }

/* ---------------------------------------------------------------- training */
.ex-list { margin: 8px 0 0; padding-left: 18px; color: var(--text-2); font-size: 14px; }
.history-item { padding: 8px 0; }
.history-item + .history-item { border-top: 1px solid var(--border); }
.history-item summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
.history-item summary::-webkit-details-marker { display: none; }
.history-item[open] { padding-bottom: 12px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  appearance: none; border: 1px solid rgba(34, 29, 51, 0.14); background: rgba(255, 255, 255, 0.5); color: var(--muted);
  border-radius: 999px; min-width: 44px; min-height: 44px; font-family: var(--mono); font-size: 12px; cursor: pointer;
}
.chip.on { background: var(--lime); border-color: transparent; color: var(--text); font-weight: 500; }

input, select, textarea {
  font: inherit; font-size: 16px; color: var(--text); background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(34, 29, 51, 0.12); border-radius: 14px; padding: 10px 14px; width: 100%; min-height: 44px;
}
input::placeholder, textarea::placeholder { color: #8A8499; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--violet-2); outline-offset: 1px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > span { font-size: 13px; font-weight: 650; color: var(--text-2); }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.field.inline input, .field.inline select { width: 140px; flex: none; }
details summary { cursor: pointer; color: var(--text-2); font-weight: 650; font-size: 14px; margin: 12px 0 8px; }

.ex-edit .ex-name { font-weight: 650; margin-bottom: 10px; }
.ex-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.ex-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 650; }

.set-head, .set-row { display: grid; grid-template-columns: 28px 1fr 1fr 48px; gap: 8px; align-items: center; }
.set-head { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 8px 0 4px; }
.set-row { margin-bottom: 8px; }
.set-row input { text-align: center; font-weight: 650; }
.set-row.done input { background: rgba(228, 240, 112, 0.45); border-color: transparent; }
.check { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid rgba(34, 29, 51, 0.25); background: transparent; color: var(--muted); font-size: 16px; font-weight: 800; cursor: pointer; }
.check.on { background: var(--lime); border-color: transparent; color: var(--text); }

.steps { padding-left: 20px; margin: 0 0 12px; }
.steps li { margin-bottom: 6px; }

/* ---------------------------------------------------------------- chrome */
.tabbar {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 10;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  height: 64px; padding: 0 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.72); border: 1px solid var(--edge);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 1px 2px rgba(60, 40, 110, 0.05), 0 16px 40px rgba(110, 82, 224, 0.14);
}
.tabbar a {
  width: 56px; height: 48px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); text-decoration: none;
  transition: background-color 0.2s ease;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { background: var(--lime); color: var(--text); }
.tabbar a.active svg { stroke-width: 2.1; }
body.no-tabbar .tabbar { display: none; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(104px + env(safe-area-inset-bottom)); z-index: 20;
  background: var(--surface-strong); color: var(--text); border: 1px solid var(--edge);
  padding: 12px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 650; max-width: calc(100% - 32px);
  box-shadow: 0 12px 30px rgba(60, 40, 110, 0.18);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}

@media (min-width: 560px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------------------------------------------------------------- Train */
.head-actions { display: flex; align-items: center; gap: 8px; }
.page-title { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.icon-btn svg, .list-row svg, .btn svg, .search svg, .st-done svg, .tick svg {
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.btn svg { width: 16px; height: 16px; }
.block-btn { width: 100%; min-height: 50px; }

.hero { margin-top: 22px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.hero-top { display: flex; align-items: center; justify-content: space-between; }
.hero-top .eyebrow { margin: 0; }
.hero-title { font-family: var(--serif); font-weight: 400; font-size: 38px; line-height: 1.02; letter-spacing: -0.015em; }
.hero-title em { font-style: italic; }
.hero-sub { margin: 0; font-size: 14px; color: var(--muted); }
.hero-actions { display: flex; gap: 10px; }
.hero-actions .btn.go { flex: 1; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { padding: 5px 9px; border-radius: 999px; background: rgba(34, 29, 51, 0.05); font-size: 12px; font-weight: 600; color: var(--text); }
.pill.lilac { padding: 6px 10px; background: rgba(222, 205, 251, 0.55); color: #3F2E8C; }
.pill.lime { background: #F1F6C4; font-weight: 700; }

.st-chip { padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.85); font-size: 12px; font-weight: 700; color: var(--text-2); white-space: nowrap; }
.st-chip.lime { background: var(--lime); color: var(--text); }
.st-chip.rust { background: var(--critical-bg); color: var(--critical); }
.st-done { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--good); white-space: nowrap; }
.st-done i { width: 18px; height: 18px; border-radius: 50%; background: var(--lime); display: inline-flex; align-items: center; justify-content: center; color: var(--text); }
.st-done svg { width: 12px; height: 12px; stroke-width: 2.4; }

.section-row { display: flex; align-items: baseline; justify-content: space-between; }
.section-row .quiet-link { padding: 0; margin: 26px 4px 10px; font-size: 13px; }
.pad { padding: 14px 0; margin: 0; }
.pad-x { margin: 0 4px 12px; }
.list-card { padding: 4px 18px; }
.list-card .program-head { padding-top: 14px; }
.rows { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 0;
  background: none; border: 0; border-bottom: 1px solid var(--border); font: inherit; text-align: left;
  color: var(--text); text-decoration: none; cursor: pointer;
}
.rows > .list-row:last-child, .rows > :last-child { border-bottom: 0; }
.row-day { width: 34px; flex: none; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); line-height: 1.4; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-main strong { font-size: 15px; font-weight: 600; }
.row-main span { font-size: 12px; color: var(--muted); }
.row-icon { flex: none; width: 36px; height: 36px; border-radius: 12px; background: rgba(222, 205, 251, 0.6); display: flex; align-items: center; justify-content: center; color: var(--violet); }
.row-icon svg { width: 18px; height: 18px; }
.chev { flex: none; width: 16px; height: 16px; color: #8A8499; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.next-up { border: 0; padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.6); }

.program-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 12px; font-weight: 700; }
.program-head a { display: inline-flex; align-items: center; gap: 2px; font-size: 19px; font-weight: 600; letter-spacing: -0.02em; color: var(--text); text-decoration: none; }
.week-strip { display: flex; gap: 4px; margin: 12px 0 4px; }
.week-strip i { flex: 1; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #D3E25A var(--fill), rgba(34, 29, 51, 0.1) var(--fill)); }
.week-strip i.short { background: linear-gradient(90deg, #E8B9A9 var(--fill), rgba(34, 29, 51, 0.1) var(--fill)); }
.week-cells { display: grid; grid-template-columns: repeat(auto-fit, minmax(40px, 1fr)); gap: 6px; margin-top: 12px; }
.week-cells div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; border-radius: 12px; background: rgba(34, 29, 51, 0.05); }
.week-cells span { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; color: var(--muted); }
.week-cells strong { font-size: 13px; min-height: 1.2em; }
.week-cells .full { background: var(--lime); }
.week-cells .now { background: #F1F6C4; outline: 1.5px solid var(--lime-deep); }
.week-cells .short { background: var(--critical-bg); }

.soft-card { margin-top: 22px; }
.soft-card .quiet-link { padding: 0 0 4px; }
.soft-card p, .dashed p { margin: 4px 0 0; }
.card.dashed { background: rgba(255, 255, 255, 0.45); border: 1.5px dashed rgba(110, 82, 224, 0.35); box-shadow: none; }
.card.center { text-align: center; padding: 28px 20px; }
.serif-line { margin: 0; font-family: var(--serif); font-size: 26px; line-height: 1.05; }
.serif-line em { font-style: italic; }
.danger-link { display: block; margin: 18px auto 0; color: var(--critical); }

/* sub-pages: back · eyebrow · action */
.sub-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin-top: 6px; }
.sub-head .eyebrow { margin: 0; text-align: center; flex: 1; }
.head-spacer { width: 44px; flex: none; }
.sub-head + .headline { margin-top: 22px; }
.field-label { display: block; margin: 26px 0 8px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.name-input { width: 100%; height: 64px; padding: 0 16px; border-radius: 14px; border: 1px solid rgba(34, 29, 51, 0.12); background: rgba(255, 255, 255, 0.85); font-family: var(--serif); font-size: 34px; letter-spacing: -0.01em; color: var(--text); }
.name-input.small { height: 52px; font-size: 24px; }
.name-input + .card, .name-input + p + .card { margin-top: 18px; }
.day-dots { display: flex; justify-content: space-between; gap: 6px; }
.day-dots button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(34, 29, 51, 0.14); background: rgba(255, 255, 255, 0.5); color: var(--muted); font-family: var(--mono); font-size: 12px; cursor: pointer; }
.day-dots button.on { border-color: transparent; background: var(--lime); color: var(--text); font-weight: 500; }
.day-dots + p { margin: 10px 4px 0; }

.ex-card { padding: 14px 16px; }
.ex-head { display: flex; align-items: flex-start; gap: 10px; width: 100%; background: none; border: 0; padding: 0; font: inherit; text-align: left; color: inherit; cursor: pointer; }
.ex-num { font-family: var(--mono); font-size: 11px; color: var(--muted); padding-top: 3px; }
.ex-main { flex: 1; display: flex; flex-direction: column; gap: 9px; }
.ex-main strong { font-size: 16px; font-weight: 600; }
.ex-toggle { font-size: 12px; font-weight: 700; color: var(--violet); padding-top: 3px; }
.ex-fields { display: grid; grid-template-columns: 0.8fr 1fr 1.2fr; gap: 8px; margin-top: 14px; }
.ex-fields label span { display: block; margin-bottom: 4px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.ex-fields input { width: 100%; }
.ex-tools { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* ---------------------------------------------------------------- bottom sheets */
body.sheet-open { overflow: hidden; }
body.sheet-open .tabbar { display: none; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(34, 29, 51, 0.28); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31;
  max-width: 640px; margin: 0 auto; max-height: 88svh; overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 20px calc(20px + env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0; background: #FBFAF6;
  box-shadow: 0 -20px 50px rgba(60, 40, 110, 0.18);
  display: flex; flex-direction: column; gap: 14px;
}
.sheet.tall { height: 88svh; }
.sheet::before { content: ''; align-self: center; width: 40px; height: 5px; border-radius: 3px; background: rgba(34, 29, 51, 0.15); margin-bottom: -4px; }
.sheet > p { margin: 0; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet-head .eyebrow { margin: 0 0 4px; display: block; }
.sheet-head h2 { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1; }
.radio-list { display: flex; flex-direction: column; gap: 8px; }
.radio-row, .switch-row, .pick-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px;
  border-radius: 16px; border: 1px solid var(--edge); background: var(--surface);
  font: inherit; text-align: left; color: var(--text); cursor: pointer;
}
.radio-row.on { border-color: var(--violet-2); background: var(--surface-strong); }
.radio { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid rgba(34, 29, 51, 0.3); }
.radio-row.on .radio { border: 6px solid var(--violet-2); }
.new-folder { display: flex; flex-direction: column; gap: 10px; }
.stepper-row { display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button, .rest-dial button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--edge); background: rgba(255, 255, 255, 0.85); font: inherit; font-size: 18px; color: var(--text); cursor: pointer; }
.switch { flex: none; width: 46px; height: 28px; border-radius: 999px; background: rgba(34, 29, 51, 0.14); position: relative; transition: background-color 0.2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.2s; }
.switch-row[aria-checked='true'] .switch { background: var(--lime-deep); }
.switch-row[aria-checked='true'] .switch::after { transform: translateX(18px); }
.rest-dial { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; }
.rest-dial button { width: 56px; height: 44px; border-radius: 999px; font-size: 14px; font-weight: 700; }
.rest-dial div { display: flex; flex-direction: column; align-items: center; }
.rest-dial strong { font-size: 54px; font-weight: 300; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.rest-dial span { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.preset-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.preset-row button { height: 40px; border-radius: 999px; border: 1px solid var(--edge); background: var(--surface); font: inherit; font-family: var(--mono); font-size: 13px; color: var(--text); cursor: pointer; }
.preset-row button.on { background: var(--lime); border-color: transparent; }
.ref-box { padding: 12px 14px; border-radius: 16px; background: rgba(222, 205, 251, 0.3); display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.ref-box .eyebrow { margin: 0 0 2px; }
.ref-box div { display: flex; justify-content: space-between; gap: 8px; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 46px; border-radius: 14px; background: rgba(255, 255, 255, 0.85); border: 1px solid rgba(34, 29, 51, 0.12); }
.search svg { width: 18px; height: 18px; color: var(--muted); }
.search input { flex: 1; border: 0; background: none; padding: 0; height: 100%; outline: none; }
.chip-scroll { display: flex; gap: 6px; overflow-x: auto; margin: 0 -20px; padding: 0 20px; scrollbar-width: none; }
.chip-scroll::-webkit-scrollbar { display: none; }
.chip-scroll .chip { flex: none; }
.pick-list { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.list-label { margin: 8px 4px 2px; font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.pick-row.on { border-color: var(--lime-deep); background: #F7FAD9; }
.tick { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid rgba(34, 29, 51, 0.2); display: flex; align-items: center; justify-content: center; color: transparent; }
.tick svg { width: 14px; height: 14px; stroke-width: 2.4; }
.pick-row.on .tick { background: var(--lime); border-color: transparent; color: var(--text); }
.sheet-foot { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)); margin: 0 -20px calc(-20px - env(safe-area-inset-bottom)); padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); background: rgba(251, 250, 246, 0.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border); font-size: 14px; color: var(--muted); }
