/* ============================================================
   Personal site — quiet, minimalistic design system
   System sans · near-black ink on off-white · one subtle accent
   Hairline rules · generous whitespace · no external fonts
   ============================================================ */

:root {
  --ink:    #1b1b1a;   /* near-black text            */
  --paper:  #fbfbf9;   /* off-white background       */
  --card:   #ffffff;   /* raised surfaces            */
  --muted:  #6c6a64;   /* secondary text             */
  --faint:  #97948c;   /* tertiary / captions        */
  --line:   #e7e5df;   /* hairline borders           */
  --accent: #3a6ea5;   /* the single subtle accent   */
  --accent-soft: #eef3f8;

  --measure: 66ch;     /* comfortable reading width  */
  --gap: 1rem;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
          "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 0 24px; }

/* ---------- Top bar (authenticated chrome) ---------- */
.topbar { border-bottom: 1px solid var(--line); background: var(--card); }
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding-top: 8px; padding-bottom: 8px;
}
.topbar-brand {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink);
  text-decoration: none;
}
.topbar-account { display: flex; align-items: center; gap: 0.75rem; }
.topbar-user { font-size: 0.82rem; color: var(--muted); }
.topbar-account button {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.topbar-account button:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- History sheet (moves × dates) ---------- */
.history { max-width:860px; margin:0 auto; padding:34px 16px 64px; }
.hist-head { margin-bottom:16px; }
.hist-head .back { font-size:.82rem; font-weight:600; text-decoration:none; }
.hist-head h1 { font-size:1.7rem; letter-spacing:-0.02em; margin-top:.6rem; }
.hist-sub { color:var(--faint); font-size:.84rem; margin-top:.4rem; max-width:60ch; }
.hist-empty { color:var(--muted); font-size:.92rem; padding:24px 0; }
.hist-hint { color:var(--faint); font-size:.76rem; margin-top:10px; }

.sheet-scroll {
  overflow-x:auto; -webkit-overflow-scrolling:touch;
  border:1px solid var(--line); border-radius:12px; background:var(--card);
}
table.grid { border-collapse:separate; border-spacing:0; width:max-content; min-width:100%; font-size:.82rem; }
table.grid th, table.grid td { padding:9px 10px; text-align:center; white-space:nowrap; border-bottom:1px solid var(--line); }
table.grid thead th {
  font-weight:600; color:var(--faint); font-size:.7rem; text-transform:uppercase; letter-spacing:.04em;
  background:var(--card); border-bottom:2px solid var(--ink);
}
table.grid thead th .dow { display:block; font-size:.62rem; font-weight:500; letter-spacing:0; }
table.grid tbody tr:last-child td { border-bottom:none; }

/* frozen first column */
.move {
  position:sticky; left:0; z-index:2; background:var(--card);
  text-align:left !important; font-weight:600; color:var(--ink);
  min-width:118px; box-shadow:1px 0 0 var(--line);
}
thead th.move { z-index:3; color:var(--muted); }

td.cell { min-width:74px; }
td.cell.empty { color:var(--faint); }
.cellbtn {
  font:inherit; background:none; border:none; cursor:pointer; color:inherit;
  padding:4px 6px; margin:-4px -6px; border-radius:7px; width:100%;
}
.cellbtn:hover, .cellbtn:focus-visible { background:var(--accent-soft); outline:none; }
.cellbtn .v { display:block; font-weight:650; color:var(--ink); }
.cellbtn .r { display:block; font-size:.72rem; color:var(--muted); margin-top:1px; }
.cellbtn .up { color:#2e7d5b; font-size:.66rem; }

/* empty cell = tap to add; shows a dot, turns into a + on hover/focus */
.addbtn {
  font:inherit; background:none; border:none; cursor:pointer; color:var(--faint);
  padding:4px 6px; margin:-4px -6px; border-radius:7px; width:100%; min-height:34px;
}
.addbtn::before { content:"·"; }
.addbtn:hover, .addbtn:focus-visible { background:var(--accent-soft); color:var(--accent); outline:none; }
.addbtn:hover::before, .addbtn:focus-visible::before { content:"+"; font-weight:700; }

/* numbered pager over date columns (movies reuse it via .pager) */
.hist-pager, .pager {
  display:flex; align-items:center; justify-content:center; flex-wrap:wrap;
  gap:4px; margin-top:12px; font-size:.82rem;
}
/* the date range sits on its own line above the numbers */
.hist-pager .range, .pager .range {
  width:100%; text-align:center; color:var(--faint); font-size:.78rem; margin-bottom:2px;
}
.hist-pager .p, .pager .p {
  min-width:32px; padding:5px 8px; border-radius:8px; text-align:center;
  font-weight:600; text-decoration:none; color:var(--accent);
}
.hist-pager a.p:hover, .pager a.p:hover,
.hist-pager a.p:focus-visible, .pager a.p:focus-visible {
  background:var(--accent-soft); text-decoration:none; outline:none;
}
.hist-pager .cur, .pager .cur { background:var(--accent); color:#fff; }
.hist-pager .gap, .pager .gap { color:var(--faint); padding:5px 2px; }
.pager { margin-top:22px; }

/* ---------- Edit bottom sheet ---------- */
.backdrop { position:fixed; inset:0; background:rgba(20,20,20,.4); z-index:10; }
.esheet {
  position:fixed; left:0; right:0; bottom:0; z-index:11;
  background:var(--card); border-radius:16px 16px 0 0; padding:20px 20px 28px;
  box-shadow:0 -8px 40px rgba(0,0,0,.2); max-width:480px; margin:0 auto;
}
.esheet .grabber { width:38px; height:4px; background:var(--line); border-radius:2px; margin:0 auto 16px; }
.esheet h3 { font-size:1.05rem; margin-bottom:16px; }
.esheet .frow { margin-bottom:12px; }
.esheet .frow label { display:block; font-size:.7rem; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); font-weight:600; margin-bottom:5px; }
.esheet .frow input { width:100%; font:inherit; font-size:1rem; border:1px solid var(--line); border-radius:8px; padding:10px; color:var(--ink); background:var(--card); }
.esheet .frow input:focus-visible { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
.esheet .two { display:flex; gap:10px; }
.esheet .two .frow { flex:1; }
.eactions { display:flex; gap:8px; margin-top:18px; }
.eactions .btn { font:inherit; font-size:.85rem; font-weight:600; border:none; border-radius:9px; padding:11px 16px; cursor:pointer; }
.eactions .btn.save { background:var(--accent); color:#fff; flex:1; }
.eactions .btn.del { background:#fdeceb; color:#b3261e; border:1px solid #f3c9c6; }
.eactions .btn.ghost { background:none; color:var(--muted); border:1px solid var(--line); }

/* link to history from the training page */
.hist-link { display:inline-block; margin-top:1.2rem; font-size:.85rem; font-weight:600; text-decoration:none; }
.hist-link:hover { text-decoration:underline; }

/* ---------- Error page ---------- */
.error-page {
  max-width: 480px;
  margin: 0 auto;
  padding: clamp(64px, 15vh, 140px) 24px;
  text-align: center;
}
.error-code {
  font-size: clamp(3rem, 12vw, 4.5rem);
  font-weight: 650;
  color: var(--accent);
  letter-spacing: -0.03em;
  line-height: 1;
}
.error-page h1 { font-size: 1.25rem; font-weight: 600; margin: 0.75rem 0 1.5rem; }
.error-home { font-size: 0.9rem; font-weight: 600; }

/* ---------- Dashboard ---------- */
.dashboard { max-width: 720px; margin: 0 auto; padding: clamp(48px, 10vh, 96px) 24px 64px; }
.dash-head { margin-bottom: 2rem; }
.dash-head h1 { margin-top: 0.5rem; }
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.app-card {
  display: block;
  text-decoration: none;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.app-card:hover, .app-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}
.app-icon { font-size: 1.8rem; line-height: 1; margin-bottom: 12px; }
.app-name { font-weight: 650; font-size: 1.05rem; letter-spacing: -0.01em; margin-bottom: 4px; }
.app-desc { font-size: 0.85rem; color: var(--muted); line-height: 1.5; }
.dash-empty { color: var(--muted); }

/* ---------- Auth / sign-in ---------- */
.auth {
  max-width: 360px;
  margin: 0 auto;
  padding: clamp(48px, 12vh, 120px) 24px 48px;
}
.auth-card .eyebrow { margin-bottom: 0.8rem; }
.auth-card h1 { font-size: 1.9rem; margin-bottom: 1.5rem; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
.auth-form input {
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  width: 100%;
}
.auth-form input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.auth-form button {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  padding: 12px;
  margin-top: 0.25rem;
  cursor: pointer;
}
.auth-form button:hover { filter: brightness(0.95); }
.auth-error {
  font-size: 0.85rem;
  color: #b3261e;
  background: #fdeceb;
  border: 1px solid #f3c9c6;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 1.1rem;
}

/* ---------- Typography ---------- */
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; font-weight: 650; }
h1 { font-size: clamp(2rem, 5vw, 2.9rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); }
h3 { font-size: 1.02rem; font-weight: 600; margin: 1.75rem 0 0.5rem; }

p { margin-bottom: 0.9rem; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }
.lede { font-size: 1.1rem; color: var(--muted); }
b, strong { font-weight: 650; color: var(--ink); }

a { color: var(--accent); text-underline-offset: 2px; }

/* ---------- Hero ---------- */
.hero { padding: 88px 0 40px; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 1.1rem;
}
.hero h1 { margin-bottom: 1.4rem; }
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.4rem;
  font-size: 0.88rem;
  color: var(--muted);
}
.stats span { white-space: nowrap; }

/* ---------- Sections ---------- */
.section { padding: 40px 0; border-top: 1px solid var(--line); }
.section-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--faint);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.section-label::before {
  content: "";
  width: 18px; height: 1px;
  background: var(--accent);
}
.section > .wrap > h2 { margin-bottom: 1rem; }

/* ---------- Week strip ---------- */
.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 1.25rem;
}
.day {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 6px 10px;
  text-align: center;
}
.day .dow {
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 6px;
}
.day .icon { font-size: 1.2rem; line-height: 1; margin-bottom: 5px; }
.day .what { font-size: 0.7rem; font-weight: 600; color: var(--muted); }
.day--rest { background: transparent; }

/* ---------- Exercise grid ---------- */
.exercises {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
  margin-top: 1.25rem;
}
.exercise {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  color: var(--ink);
}
.exercise svg { width: 100%; height: 80px; display: block; margin-bottom: 10px; }
.exercise-name { font-weight: 600; font-size: 0.86rem; margin-bottom: 2px; }
.exercise-sets { font-size: 0.78rem; color: var(--muted); }
.exercise .demo { padding-top: 0; }

/* ---------- Exercise footer (guide) + shared log inputs ---------- */
.exercise-foot {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.log-input {
  width: 66px;
  font: inherit;
  font-size: 0.85rem;
  text-align: center;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
}
.log-input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.demo a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 11px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.demo a:hover, .demo a:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.demo a::after { content: "\203A"; font-size: 0.85rem; }

/* ---------- Callout ---------- */
.callout {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 8px;
  padding: 16px 18px;
  margin: 1.25rem 0;
}
.callout h3 { margin-top: 0; }
.callout ul { margin: 0.5rem 0 0 1.1rem; }
.callout li { margin-bottom: 0.4rem; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; }
th, td { text-align: left; padding: 10px 12px; font-size: 0.9rem; }
th {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.68rem;
  color: var(--faint);
  border-bottom: 1px solid var(--ink);
}
td { border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: none; }

/* ---------- Macro cards ---------- */
.macros {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 1.25rem 0;
}
.macro {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}
.macro-value { font-size: 1.6rem; font-weight: 650; line-height: 1; letter-spacing: -0.02em; }
.macro-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
  margin-top: 0.4rem;
}

/* ---------- Lists ---------- */
.checklist { list-style: none; margin: 0.5rem 0; }
.checklist li {
  padding: 9px 0 9px 22px;
  position: relative;
  border-bottom: 1px solid var(--line);
  max-width: var(--measure);
}
.checklist li::before {
  content: "";
  position: absolute; left: 0; top: 16px;
  width: 7px; height: 7px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
}
.checklist li:last-child { border-bottom: none; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0.75rem 0; }
.tags span {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ---------- Breathing grid ---------- */
.breathing {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin: 1.25rem 0;
}
.bcard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
}
.bcard h3 { margin: 0 0 0.6rem; font-size: 0.95rem; }
.bcard ul { margin: 0 0 0 1.1rem; }
.bcard li { margin-bottom: 0.5rem; font-size: 0.9rem; }

/* ---------- Footer ---------- */
footer { padding: 40px 0 80px; color: var(--faint); font-size: 0.84rem; border-top: 1px solid var(--line); }

/* ============================================================
   Shared app shell — tasks · movies · grocery
   ============================================================ */

.app-page { max-width: 680px; margin: 0 auto; padding: 34px 24px 72px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head .back { font-size: .82rem; font-weight: 600; text-decoration: none; }
.page-head h1 { font-size: 1.7rem; letter-spacing: -.02em; margin-top: .55rem; }
.page-sub { color: var(--faint); font-size: .82rem; margin-top: .35rem; font-variant-numeric: tabular-nums; }

.btn-ghost {
  font: inherit; font-size: .76rem; font-weight: 600; color: var(--muted);
  background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 13px; cursor: pointer; white-space: nowrap;
  transition: color .15s, border-color .15s, background .15s;
}
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.btn-ghost.danger:hover { color: #b3261e; border-color: #f3c9c6; background: #fdeceb; }
.btn-primary {
  font: inherit; font-size: .76rem; font-weight: 600; color: #fff; background: var(--accent);
  border: none; border-radius: 999px; padding: 6px 14px; cursor: pointer; white-space: nowrap;
}
.btn-primary:hover { filter: brightness(.95); }

/* ---------- Quick-add bar ---------- */
.add-bar { display: flex; gap: 8px; margin-bottom: 18px; }
.add-bar input {
  flex: 1; font: inherit; font-size: .95rem; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px; min-width: 0;
}
.add-bar input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.add-bar button {
  font: inherit; font-size: .85rem; font-weight: 600; color: #fff; background: var(--accent);
  border: none; border-radius: 9px; padding: 0 18px; cursor: pointer;
}
.add-bar button:hover { filter: brightness(.95); }

/* ---------- Row list (tasks + grocery share this component) ---------- */
.rowlist { list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.rowlist:empty { display: none; }
.rowlist li { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.rowlist li:last-child { border-bottom: none; }
.rowlist li:hover { background: #fcfcfb; }

.tick {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 18px; height: 18px; border: 1.5px solid #c9c6bd; border-radius: 6px;
  background: var(--card); cursor: pointer; position: relative;
  transition: background .12s, border-color .12s;
}
.tick:hover { border-color: var(--accent); }
.tick:checked { background: var(--accent); border-color: var(--accent); }
.tick:checked::after {
  content: ""; position: absolute; left: 5px; top: 1px;
  width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.tick:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.row-text { flex: 1; font-size: .94rem; line-height: 1.35; word-break: break-word; }
button.row-text { font: inherit; font-size: .94rem; text-align: left; background: none; border: none; color: inherit; cursor: text; padding: 0; }
li.done .row-text { color: var(--faint); text-decoration: line-through; text-decoration-color: #cfccc4; }
.row-form { flex: 1; display: flex; min-width: 0; }
.row-edit {
  flex: 1; font: inherit; font-size: .94rem; color: var(--ink); background: var(--card);
  border: 1px solid var(--accent); border-radius: 7px; padding: 4px 8px;
  box-shadow: 0 0 0 3px var(--accent-soft); outline: none; min-width: 0;
}
.row-del {
  flex: none; font: inherit; font-size: .95rem; line-height: 1; color: var(--faint);
  background: none; border: none; padding: 5px 7px; border-radius: 6px; cursor: pointer;
  opacity: 0; transition: opacity .12s, color .12s, background .12s;
}
.rowlist li:hover .row-del, .row-del:focus-visible { opacity: 1; }
.row-del:hover { color: #b3261e; background: #fdeceb; }
@media (hover: none) { .row-del { opacity: .55; } }

.list-divider { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 10px; }
.list-divider .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; color: var(--faint); }

.empty-note {
  color: var(--muted); font-size: .9rem; text-align: center; padding: 26px 0;
  background: var(--card); border: 1px dashed var(--line); border-radius: 12px;
}

/* ---------- Grocery ---------- */
.grocery-page, .tasks-page { max-width: 620px; }

.confirm {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--accent-soft); border: 1px solid var(--line); border-left: 2px solid var(--accent);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; font-size: .85rem; color: var(--muted);
}
.confirm .acts { display: flex; gap: 8px; }

/* drag handle — pointer-driven reordering, keyboard via arrow keys */
.grip {
  flex: none; font: inherit; line-height: 1; color: #c9c6bd; background: none; border: none;
  padding: 4px 2px; border-radius: 6px; cursor: grab; touch-action: none;
  transition: color .12s, background .12s;
}
.grip:hover { color: var(--muted); }
.grip:focus-visible { outline: none; color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rowlist li.dragging { opacity: .55; background: var(--accent-soft); cursor: grabbing; }
.rowlist li.lifted { box-shadow: 0 2px 10px rgba(0, 0, 0, .1); }

/* ---------- Movies ---------- */
.movies-page { max-width: 820px; }

.tabs {
  display: inline-flex; background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px; gap: 2px; margin-bottom: 20px;
}
.tabs a {
  font-size: .8rem; font-weight: 600; color: var(--muted); text-decoration: none;
  border-radius: 999px; padding: 6px 16px; transition: background .15s, color .15s;
}
.tabs a:hover { color: var(--accent); }
.tabs a[aria-current="page"] { background: var(--accent); color: #fff; }
.tabs .n { opacity: .7; font-variant-numeric: tabular-nums; margin-left: 6px; }

.addcard { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 26px; }
.addcard .add-bar { margin-bottom: 0; }
.radios { display: flex; gap: 18px; margin-top: 12px; font-size: .84rem; color: var(--muted); }
.radios label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.radios input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.addcard .hint { font-size: .76rem; color: var(--faint); margin-top: 10px; }
.form-error {
  margin-top: 12px; font-size: .82rem; color: #b3261e; background: #fdeceb;
  border: 1px solid #f3c9c6; border-radius: 8px; padding: 9px 11px;
}
.form-error:empty { display: none; }

.film-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 18px 16px; }
.film { position: relative; }
.poster {
  display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line); background: var(--accent-soft);
}
.poster-none { display: grid; place-items: center; color: var(--faint); font-size: .7rem; text-align: center; padding: 8px; }
.film-title { font-size: .85rem; font-weight: 650; line-height: 1.3; margin-top: 9px; }
.film-meta { font-size: .74rem; color: var(--faint); margin-top: 2px; font-variant-numeric: tabular-nums; }
.links { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.links a {
  font-size: .6rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  text-decoration: none; color: var(--muted); background: var(--card);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px;
  transition: color .15s, border-color .15s, background .15s;
}
.links a:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.film-actions { position: absolute; top: 7px; right: 7px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.film:hover .film-actions, .film:focus-within .film-actions { opacity: 1; }
@media (hover: none) { .film-actions { opacity: 1; } }
.film-actions button {
  font: inherit; font-size: .68rem; font-weight: 600; color: var(--ink);
  background: rgba(255, 255, 255, .93); border: none; border-radius: 6px;
  padding: 4px 8px; cursor: pointer; box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
.film-actions button:hover { background: #fff; color: var(--accent); }
.film-actions button.x:hover { color: #b3261e; }

/* ---------- Week strip accents (derived from the programme) ---------- */
.day--lift { border-top: 2px solid var(--accent); }
.day--swim { border-top: 2px solid #5a8fa8; }
.day--swim .what { color: #40708a; }
.day--lift .what { color: var(--accent); }

.hero-links { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.bcard--alt { border-left: 2px solid var(--accent); }

/* ---------- Training: the day view ---------- */
.page-links { display: flex; flex-wrap: wrap; gap: 14px; font-size: .82rem; font-weight: 600; }
.page-links a { text-decoration: none; color: var(--muted); }
.page-links a:hover { color: var(--accent); }

.page-note { font-size: .84rem; color: var(--muted); margin-bottom: 20px; max-width: var(--measure); }

/* Session chips: which workouts you are doing today. Plain links, so they work
   with htmx off — the selection lives in the URL. */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
  font-size: .82rem; font-weight: 600; text-decoration: none; color: var(--muted);
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip--on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip--on:hover { color: #fff; filter: brightness(.95); }
.chip-count { opacity: .65; font-variant-numeric: tabular-nums; margin-left: 5px; }

.progress { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.progress-count {
  font-size: .74rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap;
}
/* A native <progress>: the CSP forbids inline styles, so a width can't be set
   per-render. Needs the vendor pseudo-elements to be styled in both engines. */
.progress-bar { flex: 1; appearance: none; -webkit-appearance: none; height: 4px; border: none; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress-bar::-webkit-progress-bar { background: var(--line); }
.progress-bar::-webkit-progress-value { background: var(--accent); }
.progress-bar::-moz-progress-bar { background: var(--accent); }

.worklist { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.work {
  display: flex; align-items: flex-start; gap: 13px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 15px; transition: border-color .15s, background .15s;
}
.work--done { background: #fbfcfb; border-color: #dfe7e0; }
/* The movement's form diagram, at a glance while you work through the list. */
.work-icon { flex: none; width: 56px; color: var(--faint); }
.work-icon svg { width: 100%; height: 46px; display: block; }
.work--done .work-icon { color: #7ea88b; }
.work-body { flex: 1; min-width: 0; }
.work-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.work-name { font-weight: 600; font-size: .95rem; }
.work--done .work-name::before { content: "✓ "; color: #3f7d4e; font-weight: 700; }
.work-target { font-size: .78rem; color: var(--faint); white-space: nowrap; }
.work-session { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); margin-top: 3px; }
.work-note { font-size: .8rem; color: var(--muted); margin: 5px 0 9px; }
.work--done .work-note { color: #3f7d4e; }
.work-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.work-form { display: flex; align-items: center; gap: 7px; }

/* ---------- Training: the programme editor ---------- */
.psession { margin-bottom: 26px; }
.psession-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.psession-name { font-size: 1.05rem; letter-spacing: -.01em; }
.psession-meta { font-size: .74rem; color: var(--faint); }
.psession .add-bar { margin-top: 8px; margin-bottom: 0; }
.add-bar--session { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 20px; }

.row-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-sub { font-size: .76rem; color: var(--faint); }
.row-icon { flex: none; width: 34px; color: var(--faint); }
.row-icon svg { width: 100%; height: 26px; display: block; }
.rowlist li .btn-ghost { flex: none; font-size: .74rem; padding: 4px 10px; }

.esheet select {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px;
}
.esheet select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sheet-note { font-size: .76rem; color: var(--faint); margin-top: 12px; }
.sheet-note code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .95em; }

/* The diagram field takes raw SVG, so it is monospaced and does not wrap words
   mid-token. Rarely touched on a phone — the endpoint is the usual way in. */
.esheet textarea {
  width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem;
  color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px; resize: vertical; line-height: 1.45;
}
.esheet textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sheet-error {
  font-size: .8rem; color: #b3261e; background: #fdeceb; border: 1px solid #f3c9c6;
  border-radius: 8px; padding: 8px 10px; margin-bottom: 12px;
}

/* ---------- Nutrition: meal slots ---------- */
.meals { display: flex; flex-direction: column; gap: 12px; margin: 1.25rem 0 0.5rem; }
.meal { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; }
.meal-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 10px; padding-bottom: 9px; border-bottom: 1px solid var(--line);
}
.meal-title { font-weight: 650; font-size: 1rem; }
.meal-kind {
  font-size: .64rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: #fff; background: var(--accent); border-radius: 999px; padding: 3px 9px;
}
.meal-kind--snack { background: var(--faint); }
.opt { display: flex; align-items: baseline; gap: 12px; padding: 7px 0; }
.opt .food { flex: 1; font-size: .9rem; }
.opt-macro { font-size: .78rem; font-weight: 600; color: var(--accent); white-space: nowrap; text-align: right; }
.opt-macro span { color: var(--faint); font-weight: 500; }
.orline {
  font-size: .64rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--faint); text-align: center; margin: 1px 0;
}
.daytotal {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  background: var(--accent-soft); border: 1px solid var(--line); border-left: 2px solid var(--accent);
  border-radius: 10px; padding: 13px 18px; margin-top: 12px; font-weight: 600; font-size: .9rem;
}
.daytotal-value { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .week { grid-template-columns: repeat(4, 1fr); }
  .hero { padding: 56px 0 32px; }
  th, td { padding: 8px; font-size: 0.85rem; }
}

/* ---------- Motion ---------- */
/* The diagrams animate with declarative SMIL, so honouring the preference means
   dropping the animation elements wherever a diagram is rendered — the guide
   grid, the day view and the programme editor. */
@media (prefers-reduced-motion: reduce) {
  .exercise svg animate,
  .exercise svg animateTransform,
  .work-icon svg animate,
  .work-icon svg animateTransform,
  .row-icon svg animate,
  .row-icon svg animateTransform { display: none; }
}
