/* Trainingsapp — koel staal, magnesiumwit, elastiekblauw. */

:root {
  --bg: #E8ECEF;
  --surface: #F9FAFA;
  --ink: #1B2125;
  --ink-2: #4A555D;
  --line: #D3D9DE;
  --accent: #2F45C6;
  --accent-ink: #FFFFFF;
  --accent-soft: #C3CBF3;
  --accent-wash: #E2E6FA;
  --done: #2B8556;
  --danger: #B3261E;
  --muscle-idle: #D9DFE3;
  --body-base: #C9D0D5;
  --radius-s: 8px;
  --radius-l: 18px;
  --tab-h: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15191C;
    --surface: #1E2428;
    --ink: #E9EDF0;
    --ink-2: #A9B4BC;
    --line: #2F373D;
    --accent: #7484EC;
    --accent-ink: #0E1230;
    --accent-soft: #3A447E;
    --accent-wash: #232A4A;
    --done: #5DBB8A;
    --danger: #F2827A;
    --muscle-idle: #323A40;
    --body-base: #2A3136;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 24px);
}

a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */

.topbar {
  position: sticky; top: 0; z-index: 10;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -0.01em; }
.brand img { border-radius: 7px; }

main { max-width: 720px; margin: 0 auto; padding: 4px 16px 24px; outline: none; }

h1 { font-size: 2rem; line-height: 1.12; letter-spacing: -0.025em; margin: 8px 0 8px; font-weight: 800; }
h2 { font-size: 1.15rem; line-height: 1.3; margin: 0 0 10px; font-weight: 700; }
h3 { font-size: 1rem; margin: 16px 0 6px; }
p { margin: 0 0 10px; }
.lead { font-size: 1.05rem; color: var(--ink-2); max-width: 60ch; }
label.inline > select { max-width: 62%; text-overflow: ellipsis; }
.muted { color: var(--ink-2); }
.small { font-size: 0.88rem; }
.loading { color: var(--ink-2); padding: 40px 0; }

.block {
  background: var(--surface);
  border-radius: var(--radius-l);
  padding: 18px 16px;
  margin: 16px 0;
}

.two-col { display: grid; gap: 8px 24px; }
@media (min-width: 640px) { .two-col { grid-template-columns: 1fr 1fr; } }

ul, ol { padding-left: 1.25rem; margin: 0 0 10px; }
li + li { margin-top: 4px; }

/* ---------- Tabbar ---------- */

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.logged-out .tabs, .logged-out .topbar { display: none; }
.tab {
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-2); text-decoration: none; font-size: 0.82rem; font-weight: 600;
  position: relative;
}
.tab.active { color: var(--accent); }
.tab.active::before {
  content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px;
  background: var(--accent); border-radius: 0 0 3px 3px;
}
@media (min-width: 900px) {
  .tabs { top: 0; bottom: auto; left: auto; right: 0; width: auto; height: 56px; padding: 0 16px; display: flex; gap: 4px; border-top: 0; background: transparent; }
  .tab { padding: 0 14px; font-size: 0.95rem; }
  .tab.active::before { top: auto; bottom: 8px; }
  body { padding-bottom: 32px; }
}

/* ---------- Knoppen en formulieren ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 10px 18px;
  border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 650; font-size: 0.98rem;
  text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--accent); padding-inline: 8px; }
.btn-block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }

label { display: block; font-weight: 600; font-size: 0.92rem; margin: 10px 0; }
label.inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1.5px solid var(--line); border-radius: var(--radius-s);
  padding: 10px 12px; min-height: 44px;
}
label > input:not([type="checkbox"]), label > textarea, label > select { display: block; width: 100%; margin-top: 4px; }
label.inline > input, label.inline > select { width: auto; margin: 0; }
textarea { resize: vertical; }
.form-error { color: var(--danger); font-weight: 600; min-height: 1.5em; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 700; padding: 0; }

/* ---------- Login ---------- */

.login { max-width: 380px; margin: 12vh auto 0; }
.login h1 { font-size: 2.4rem; }

/* ---------- Vandaag ---------- */

.date-line { color: var(--ink-2); font-weight: 600; text-transform: none; margin: 4px 0 10px; }
.week-strip {
  list-style: none; padding: 0; margin: 0 0 14px;
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.week-strip .day {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px 6px; border-radius: 12px; margin: 0;
  background: var(--surface); font-size: 0.78rem; text-align: center;
}
.week-strip .day-name { font-weight: 700; }
.week-strip .day-workout { color: var(--ink-2); line-height: 1.2; min-height: 2.4em; display: flex; align-items: center; }
.week-strip .is-past { opacity: 0.72; }
.week-strip .is-today { background: var(--accent); color: var(--accent-ink); }
.week-strip .is-today .day-workout { color: inherit; }
.day-marks { display: flex; gap: 4px; }
.mark { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid currentColor; opacity: 0.45; }
.mark.on { opacity: 1; background: currentColor; }
.mark-train.on { color: var(--done); }
.is-today .mark-train.on, .is-today .mark-mob.on { color: inherit; }

.today-hero {
  background: var(--surface); border-radius: var(--radius-l);
  padding: 20px 16px 16px;
  border-left: 6px solid var(--accent);
}
.today-hero h1 { font-size: 2.3rem; margin-top: 0; }
.plan-list { list-style: none; padding: 0; margin: 12px 0; }
.plan-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); margin: 0; }
.plan-list a { color: var(--ink); font-weight: 600; text-decoration: none; }
.plan-dose { color: var(--ink-2); white-space: nowrap; }
.done-note { color: var(--done); font-weight: 650; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 8px; }
.stat { margin: 0; }
.stat dd { margin: 0; font-size: 2rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.stat dt { font-size: 0.82rem; color: var(--ink-2); margin-top: 4px; }

.habits { list-style: none; padding: 0; }
.habits li, .habit-edit li { padding: 8px 0; border-top: 1px solid var(--line); margin: 0; }
.if { color: var(--ink-2); }
.then { font-weight: 600; }

/* ---------- Lijsten ---------- */

.link-list { list-style: none; padding: 0; margin: 12px 0; background: var(--surface); border-radius: var(--radius-l); overflow: hidden; }
.block .link-list { background: transparent; margin: 0; }
.link-list li { margin: 0; border-top: 1px solid var(--line); }
.link-list li:first-child { border-top: 0; }
.link-list a { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; color: var(--ink); text-decoration: none; }
.block .link-list a { padding-inline: 0; }
.link-list a .muted { font-size: 0.9rem; }

.crumb { font-size: 0.9rem; color: var(--ink-2); margin: 8px 0 0; }

/* ---------- Loggen ---------- */

.exercise-block { background: var(--surface); border-radius: var(--radius-l); padding: 16px; margin: 14px 0; }
.exercise-block legend { float: left; width: 100%; font-size: 1.15rem; margin-bottom: 4px; }
.exercise-block legend a { color: var(--ink); text-decoration: none; }
.exercise-block legend + * { clear: both; }
.target { color: var(--ink-2); font-size: 0.92rem; }
.hint { font-size: 0.92rem; background: var(--bg); border-radius: var(--radius-s); padding: 8px 10px; }
.hint-up { background: var(--accent-wash); color: var(--ink); font-weight: 600; }
.set-rows { list-style: none; padding: 0; margin: 8px 0; }
.set-row { display: grid; grid-template-columns: 1fr 48px 84px 28px 48px; align-items: center; gap: 6px; margin: 6px 0; }
.set-no { font-weight: 600; color: var(--ink-2); }
.set-input { text-align: center; font-size: 1.35rem; font-weight: 750; padding: 6px; width: 100%; }
.set-unit { color: var(--ink-2); }
.step {
  height: 48px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--bg); color: var(--ink); font-size: 1.5rem; font-weight: 600; cursor: pointer;
}
.step:active { background: var(--accent-wash); }
.sticky-actions {
  position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 8px);
  padding-top: 8px;
}
@media (min-width: 900px) { .sticky-actions { bottom: 16px; } }

/* ---------- Geschiedenis ---------- */

.history { list-style: none; padding: 0; margin: 0; }
.history li { margin: 0; border-top: 1px solid var(--line); }
.history li:first-child { border-top: 0; }
.history summary { display: flex; gap: 12px; align-items: baseline; padding: 12px 0; cursor: pointer; list-style: none; }
.history summary::-webkit-details-marker { display: none; }
.h-date { color: var(--ink-2); min-width: 9.5em; }
.h-name { font-weight: 650; flex: 1; }
.h-meta { color: var(--ink-2); font-size: 0.9rem; }
.history-body { padding: 0 0 12px; }
.set-summary { padding-left: 1rem; }
.notes { white-space: pre-wrap; background: var(--bg); padding: 8px 10px; border-radius: var(--radius-s); }
.empty { padding: 12px 0; }

.chart { position: relative; }
.chart-title { font-weight: 650; margin: 12px 0 4px; }
.line-chart { width: 100%; height: auto; display: block; touch-action: pan-y; }
.line-chart .grid { stroke: var(--line); stroke-width: 1; }
.line-chart .axis { fill: var(--ink-2); font-size: 12px; font-family: var(--font); }
.line-chart .series-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.line-chart .series-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.line-chart .value-label { fill: var(--ink); font-size: 13px; font-weight: 700; font-family: var(--font); }
.line-chart .crosshair { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip {
  position: absolute; top: 0; transform: translateX(-50%);
  background: var(--ink); color: var(--surface); font-size: 0.85rem;
  padding: 4px 8px; border-radius: 6px; pointer-events: none; white-space: nowrap;
}
.table-view summary { cursor: pointer; color: var(--accent); margin: 8px 0; }

table.simple { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
table.simple th, table.simple td { text-align: left; vertical-align: top; padding: 8px 8px 8px 0; border-top: 1px solid var(--line); }
table.simple thead th { border-top: 0; color: var(--ink-2); font-weight: 650; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.wide { min-width: 720px; }
td.target { font-weight: 650; }

/* ---------- Oefening ---------- */

.map-figure { margin: 8px 0 0; background: var(--surface); border-radius: var(--radius-l); padding: 12px 12px 4px; }

/* Getekende oefenfiguur (zie js/figure.js) */
.move-figure { margin: 16px 0 0; background: var(--surface); border-radius: var(--radius-l); padding: 12px; }
.move-figure .figure { width: 100%; height: min(62vw, 280px); display: block; cursor: pointer; }
.move-figure figcaption { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.9rem; color: var(--ink-2); padding-top: 6px; }
.fig-switch { display: inline-flex; background: var(--bg); border-radius: 999px; padding: 3px; }
.fig-switch button { border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: 0.88rem; padding: 6px 12px; border-radius: 999px; min-height: 36px; }
.fig-switch button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 650; }
.fig-seg { stroke-linecap: round; fill: none; }
.fig-near { stroke: var(--accent); stroke-width: 9; }
.fig-far { stroke: var(--accent-soft); stroke-width: 9; }
.fig-torso { stroke: var(--accent); stroke-width: 14; }
.fig-head { fill: var(--accent); }
.fig-ghost { opacity: .25; }
.fig-floor { stroke: var(--line); stroke-width: 3; stroke-linecap: round; }
.fig-prop { stroke: var(--ink-2); stroke-width: 4; stroke-linecap: round; }
.fig-prop-thin { stroke: var(--ink-2); stroke-width: 2; }
.fig-prop-solid { fill: var(--ink-2); }
.fig-prop-fill { fill: var(--line); stroke: var(--ink-2); stroke-width: 2; }
.fig-prop-ring { fill: none; stroke: var(--ink-2); stroke-width: 3; }
.exercise-list a.has-thumb { flex-direction: row; align-items: center; gap: 12px; }
.exercise-list .thumb { flex: none; width: 56px; height: 56px; background: var(--bg); border-radius: 12px; }
.exercise-list .thumb .figure { width: 100%; height: 100%; display: block; }
.exercise-list .thumb .fig-ghost { display: none; }
.exercise-list .thumb .fig-near, .exercise-list .thumb .fig-far { stroke-width: 11; }
.exercise-list .thumb .fig-torso { stroke-width: 16; }
.exercise-list .item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.muscle-map { width: 100%; max-width: 440px; display: block; margin: 0 auto; }
.mm-base { fill: var(--body-base); }
.mm-muscle { stroke: var(--surface); stroke-width: 2; stroke-linejoin: round; }
.mm-idle { fill: var(--muscle-idle); }
.mm-primary { fill: var(--accent); }
.mm-secondary { fill: var(--accent-soft); }
.mm-label { fill: var(--ink-2); font-size: 13px; font-family: var(--font); }
.mm-legend { font-size: 0.92rem; padding: 6px 4px; }
.mm-legend p { margin: 4px 0; }
.mm-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.mm-swatch.mm-primary { background: var(--accent); }
.mm-swatch.mm-secondary { background: var(--accent-soft); }

.steps li::marker { font-weight: 700; color: var(--accent); }
.ladder { counter-reset: rung; list-style: none; padding: 0; }
.ladder li { counter-increment: rung; display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); margin: 0; }
.ladder li::before {
  content: counter(rung); flex: 0 0 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 0.85rem;
  background: var(--accent-wash); color: var(--accent);
}
.ladder li { flex-wrap: wrap; }
.ladder-toggle {
  flex: 1; display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 44px;
  border: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; padding: 0; cursor: pointer;
}
.ladder-toggle::after { content: ""; flex: none; width: 9px; height: 9px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg); margin: 0 6px 4px; transition: transform .15s; }
.ladder-toggle[aria-expanded="true"]::after { transform: rotate(-135deg); margin-bottom: -4px; }
.ladder-figure { flex: 0 0 100%; }
.move-figure.compact { margin-top: 4px; background: var(--bg); }
.move-figure.compact .figure { height: min(48vw, 200px); }
.log-figure { margin: 6px 0 10px; }
.log-figure summary { color: var(--ink-2); font-size: 0.9rem; cursor: pointer; min-height: 32px; }
.log-figure-holder { background: var(--bg); border-radius: var(--radius-s); }
.log-figure-holder .figure { width: 100%; height: 140px; display: block; }

/* ---------- Mobiliteit ---------- */

.routine-steps { padding-left: 1.4rem; }
.routine-steps li { padding: 10px 0; border-top: 1px solid var(--line); margin: 0; }
.rs-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; }
.rs-dose { color: var(--ink-2); white-space: nowrap; }
.routine-steps .ladder-toggle { width: 100%; }
.routine-steps .rs-head { flex: 1; min-width: 0; }
.routine-list li { display: flex; flex-wrap: wrap; align-items: center; }
.routine-list li > a { flex: 1; }
.routine-toggle { flex: 0 0 100%; padding: 0 16px 10px; color: var(--ink-2); font-size: 0.92rem; min-height: 36px; }
.routine-list .dropdown-panel { flex: 0 0 100%; padding: 0 16px 12px; }
.routine-preview { list-style: none; padding: 0; margin: 0; }
.routine-preview li { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.routine-preview li > a { padding: 10px 0; }

/* Figuur onder de timer */
.timer-figure { margin: 0 auto 8px; max-width: 360px; background: var(--surface); border-radius: var(--radius-l); }
.timer-figure .figure { width: 100%; height: min(42vw, 180px); display: block; }

/* Schermvullend aftellen (start 3-2-1 en laatste 5 s per stap) */
.countdown {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; align-content: center;
  color: #fff; transition: background-color .25s; cursor: pointer; -webkit-user-select: none; user-select: none;
}
.countdown[hidden] { display: none; }
.countdown-num { font-size: min(70vw, 60vh); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; animation: count-fade 1s ease-in-out both; }
.countdown-hint { position: absolute; bottom: calc(32px + env(safe-area-inset-bottom)); font-size: 1rem; font-weight: 600; }
.countdown.is-paused .countdown-num { animation-play-state: paused; opacity: .5; }
.cd-blue { background: #2F45C6; }
.cd-purple { background: #6B3FC2; }
.cd-green { background: #1F8A55; }
.cd-orange { background: #D9701A; }
.cd-red { background: #C62B2B; }
@keyframes count-fade {
  0% { opacity: 0; transform: scale(.85); }
  15%, 80% { opacity: 1; transform: scale(1); }
  100% { opacity: .1; transform: scale(1.05); }
}
.qa dt { font-weight: 700; margin-top: 10px; }
.qa dd { margin: 2px 0 0; }
.source { color: var(--ink-2); font-size: 0.9rem; }

.timer { text-align: center; padding: 8px 0 24px; }
.timer-count { color: var(--ink-2); font-weight: 600; }
.timer-step { font-size: 1.5rem; letter-spacing: -0.02em; margin: 4px 0; }
.timer-side { font-weight: 650; color: var(--accent); margin: 0; }
.timer-face { position: relative; width: min(54vw, 30vh, 260px); margin: 12px auto; aspect-ratio: 1; }
.timer-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--line); stroke-width: 6; }
.ring-progress { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 0.95s linear; }
.timer-clock {
  position: absolute; inset: 0; display: grid; place-items: center; margin: 0;
  font-size: clamp(3.5rem, 18vw, 5.5rem); font-weight: 800; letter-spacing: -0.04em;
}
.timer-how { max-width: 36ch; margin: 0 auto 8px; }
.timer-next { font-size: 0.92rem; }
.timer-controls { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 8px; margin: 16px 0 8px; }
.timer-done { text-align: center; padding: 40px 0; }
.timer.is-rest .ring-progress { stroke: var(--ink-2); }
.timer.is-rest .timer-step { color: var(--ink-2); }
.timer.is-rest .timer-figure { opacity: .75; }
.rest-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0; font-weight: 600; }
.rest-field select { width: auto; min-width: 9rem; }

@media (prefers-reduced-motion: reduce) {
  .ring-progress { transition: none; }
  .countdown-num { animation: none; }
  .btn:active { transform: none; }
}

/* ---------- Schema & kennis ---------- */

.week-table { list-style: none; padding: 0; margin: 0; }
.week-table li { display: grid; grid-template-columns: 6.5em 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); margin: 0; }
.week-table li:first-child { border-top: 0; }
.wt-day { font-weight: 700; }
.wt-body { display: flex; flex-direction: column; gap: 2px; }

.notice { background: var(--accent-wash); border-radius: var(--radius-s); padding: 10px 12px; font-size: 0.92rem; }
.layer + .layer { margin-top: 10px; }
.supp dt { font-weight: 700; margin-top: 10px; }
.supp dd { margin: 2px 0 0; display: flex; flex-direction: column; }
.supp .dose { font-weight: 600; }
.supp .why { color: var(--ink-2); font-size: 0.93rem; }
.research + .research { border-top: 1px solid var(--line); padding-top: 4px; }
.world li { margin-bottom: 6px; }

/* ---------- Meldingen ---------- */

.reminders { list-style: none; padding: 0; margin: 0 0 12px; }
.reminder { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); margin: 0; }
.reminder:first-child { border-top: 0; }
.rem-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.rem-time { font-weight: 800; font-size: 1.1rem; }
.switch { position: relative; margin: 0; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-ui { display: block; width: 46px; height: 28px; border-radius: 999px; background: var(--line); position: relative; transition: background 0.15s; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); transition: transform 0.15s; }
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid var(--accent); outline-offset: 2px; }
.days { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.days legend { width: 100%; margin-bottom: 4px; font-size: 0.92rem; }
.day-check { display: inline-flex; align-items: center; gap: 4px; margin: 0; padding: 6px 10px; border: 1.5px solid var(--line); border-radius: 999px; font-weight: 600; }
.day-check input { min-height: 0; }
.reminder-form { border: 1.5px solid var(--accent-soft); }
.habit-edit { list-style: none; padding: 0; }
.habit-edit li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.habit-edit li p { margin: 0; }

/* ---------- Toast ---------- */

.toast-region { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 12px); display: grid; justify-items: center; gap: 8px; pointer-events: none; z-index: 40; }
.toast { background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 0.95rem; transition: opacity 0.3s; }
.toast-success { background: var(--done); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast.leaving { opacity: 0; }

.error-block { padding: 24px 0; }
.noscript { padding: 24px; }

.photos img { display: block; width: 100%; height: auto; border-radius: var(--radius-s); margin: 8px 0; }
