@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('/fonts/inter.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 300 700; font-display: swap; src: url('/fonts/space-grotesk.woff2') format('woff2'); }
:root {
  --bg: #F5F4EF;
  --card: #FFFFFF;
  --ink: #1A1C1E;
  --muted: #5F6368;
  --faint: #8A8D91;
  --disabled: #B8B5AC;
  --line: #ECEAE3;
  --border: #E4E2DA;
  --accent: #0E6B62;
  --accent-dark: #0A524B;
  --accent-soft: #E3F0EE;
  --accent-tint: #F3F8F7;
  --warn: #B54708;
  --warn-ink: #93370D;
  --warn-soft: #FCEBDD;
  --warn-bar: #E8833A;
  --danger: #B42318;
  --track: #EDEBE4;
  --display: 'Space Grotesk', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --body: Inter, -apple-system, 'Segoe UI', system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; -webkit-tap-highlight-color: transparent; transition: transform .08s ease, background-color .15s ease, color .15s ease, box-shadow .15s ease; }
button:active:not(:disabled) { transform: scale(0.96); }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, textarea { font-family: inherit; caret-color: var(--accent); color: var(--ink); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.screen { flex: 1; padding: calc(20px + var(--safe-top)) 20px calc(108px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 18px; }
.screen.sub { padding-bottom: calc(24px + var(--safe-bottom)); padding-top: calc(8px + var(--safe-top)); }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 52px; }
.topbar-title { font-size: 16px; font-weight: 600; }
.back { display: inline-flex; align-items: center; gap: 4px; height: 44px; color: var(--accent); font-size: 16px; font-weight: 600; background: none; border: none; padding: 0; cursor: pointer; min-width: 64px; }
.icon-btn { width: 44px; height: 44px; border-radius: 999px; background: var(--card); border: none; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); cursor: pointer; }
.text-btn { height: 44px; padding: 0 4px; border: none; background: transparent; color: var(--accent); font-size: 15px; font-weight: 600; cursor: pointer; min-width: 64px; display: inline-flex; align-items: center; justify-content: flex-end; }
.text-btn:disabled { color: var(--disabled); }

h1.page { margin: 0; font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: -0.5px; }
h1.sub { margin: 0; font-family: var(--display); font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
h2.section { margin: 0; font-size: 17px; font-weight: 600; }
h2.group { margin: 0; font-family: var(--display); font-size: 20px; font-weight: 700; }
.kicker { font-size: 14px; font-weight: 500; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.stack { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-14 { gap: 14px; }
.pill { font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill.solid { background: var(--accent); color: #fff; }

/* ---------- nav ---------- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,0.96); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-top: 1px solid var(--border); padding-bottom: var(--safe-bottom); z-index: 10; }
.nav-inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); height: 64px; }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 12px; font-weight: 500; }
.nav a.on { color: var(--accent); font-weight: 600; }

/* ---------- cards / lists ---------- */
.card { background: var(--card); border-radius: 20px; }
.card.pad { padding: 16px; }
.hero { background: var(--card); border-radius: 24px; padding: 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 1px 2px rgba(26,28,30,0.06); }
.hero-label { font-size: 13px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.8px; }
.hero-title { margin: 0; font-family: var(--display); font-size: 32px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.1; }
.hero-sub { font-size: 15px; color: var(--muted); line-height: 1.4; }
.list { background: var(--card); border-radius: 20px; display: flex; flex-direction: column; overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 16px; color: var(--ink); border: none; background: transparent; width: 100%; text-align: left; font: inherit; cursor: pointer; }
.list-row + .list-row { border-top: 1px solid var(--line); }
.list-row.today { background: var(--accent-tint); }
.list-row .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-row .t { font-size: 15px; font-weight: 600; }
.list-row .t.rest { color: var(--muted); }
.list-row .s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .s.accent { color: var(--accent); font-weight: 500; }
.datecol { width: 44px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; }
.datecol .dw { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; }
.datecol .dn { font-family: var(--display); font-size: 21px; font-weight: 600; }
.chev { flex-shrink: 0; color: var(--faint); }
.status-dot { width: 30px; height: 30px; border-radius: 999px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border: 2px solid #CFCCC2; }
.status-dot.done { background: var(--accent); border-color: var(--accent); color: #fff; }
.status-dot.adj { background: var(--warn-bar); border-color: var(--warn-bar); color: #fff; }
.status-dot.now { border-color: var(--accent); }
.status-dot.skip { border-style: dashed; }
.status-dot.rest { border: none; background: transparent; color: var(--disabled); }

/* ---------- buttons ---------- */
.btn-primary { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 56px; border-radius: 16px; border: none; background: var(--accent); color: #fff; font-size: 17px; font-weight: 600; cursor: pointer; }
.btn-primary:disabled { background: #7FA9A4; }
.btn-soft { display: flex; align-items: center; justify-content: center; height: 46px; border-radius: 14px; border: none; background: var(--bg); color: var(--ink); font-size: 15px; font-weight: 500; cursor: pointer; padding: 0 12px; }
.on-bg .btn-soft, .btn-soft.white { background: var(--card); }
.btn-soft.danger { color: var(--danger); }
.btn-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-auto-flow: column; gap: 8px; }
.chip { height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--ink); font-size: 15px; font-weight: 600; cursor: pointer; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.sm { height: 32px; padding: 0 10px; font-size: 13px; }
.chip.sm.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.done-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--accent-soft); }
.done-banner .t { font-size: 15px; font-weight: 600; color: var(--accent); }
.done-banner .s { font-size: 13px; color: #33605B; }
.done-banner.adj { background: var(--warn-soft); }
.done-banner.adj .t { color: var(--warn-ink); }
.done-banner.adj .s { color: var(--warn-ink); }

/* ---------- speed tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); gap: 8px; }
.tile { background: var(--bg); border-radius: 14px; padding: 8px 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tile .v { font-family: var(--display); font-size: 22px; font-weight: 600; }
.tile .d { font-size: 12px; font-weight: 500; color: var(--muted); }
.tile.peak { background: var(--accent-soft); color: var(--accent); }
.tile.peak .v { font-weight: 700; }
.tile.peak .d { color: #33605B; }

/* ---------- segmented ---------- */
.seg { display: inline-flex; background: var(--track); border-radius: 999px; padding: 3px; }
.seg button { height: 34px; padding: 0 12px; border-radius: 999px; border: none; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(26,28,30,0.12); }
.seg.full { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
.seg.full button { height: 40px; font-size: 14px; }

/* ---------- stepper ---------- */
.stepper { display: inline-flex; align-items: center; gap: 2px; background: var(--bg); border-radius: 999px; padding: 4px; flex-shrink: 0; }
.stepper button { width: 40px; height: 40px; border-radius: 999px; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(26,28,30,0.10); }
.stepper button:disabled { background: transparent; color: var(--disabled); box-shadow: none; }
.stepper input { height: 40px; border: none; border-radius: 10px; background: transparent; text-align: center; padding: 0 2px; font-family: var(--display); font-size: 17px; font-weight: 600; color: var(--ink); }
.stepper input:focus { outline: none; box-shadow: 0 0 0 2px var(--accent); background: var(--card); }
.stepper input:disabled { color: var(--faint); -webkit-text-fill-color: var(--faint); opacity: 1; }
.stepper.below input { color: var(--warn); }
.set-row { display: flex; align-items: center; gap: 8px; min-height: 60px; }
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row .lbl { flex: 1; font-size: 15px; font-weight: 500; line-height: 1.25; }
.set-card { background: var(--card); border-radius: 20px; padding: 0 12px 0 16px; display: flex; flex-direction: column; }
.set-block { padding: 12px 0; display: flex; flex-direction: column; gap: 10px; }
.set-block + .set-row, .set-row + .set-block { border-top: 1px solid var(--line); }

/* ---------- rep cells ---------- */
.repcells { display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); gap: 6px; }
.repcell { height: 54px; border-radius: 14px; border: 2px solid transparent; background: var(--bg); color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; cursor: pointer; padding: 0; }
.repcell.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.repcell .a { font-size: 11px; font-weight: 600; opacity: 0.8; }
.repcell .b { font-family: var(--display); font-size: 16px; font-weight: 700; }

/* ---------- adjust ---------- */
.rep-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 16px; min-height: 64px; }
.rep-row + .rep-row { border-top: 1px solid var(--line); }
.rep-row.missed { background: #FBFAF7; }
.rep-row .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rep-row .who b { font-size: 14px; font-weight: 600; }
.rep-row .who span { font-size: 12px; color: var(--muted); }
.toggle-round { flex-shrink: 0; width: 44px; height: 44px; border-radius: 999px; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.toggle-round.missed { background: var(--warn-soft); color: var(--warn-ink); }
.feel { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.feel button { height: 44px; border-radius: 12px; border: none; background: var(--card); color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer; }
.feel button.on { background: var(--accent); color: #fff; }
.disclosure { background: var(--card); border-radius: 18px; }
.disclosure > button { width: 100%; height: 52px; padding: 0 16px; border: none; background: transparent; display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 15px; font-weight: 600; color: var(--ink); }
.disclosure > button .grow { flex: 1; text-align: left; }
.disclosure > button svg { transition: transform .2s ease; }
.disclosure.open > button svg { transform: rotate(180deg); }
.disclosure .body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.field-label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field { display: flex; align-items: center; height: 48px; border-radius: 12px; background: var(--bg); padding: 0 12px; gap: 6px; }
.field:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.field input { flex: 1; min-width: 0; border: none; background: transparent; font-family: var(--display); font-size: 18px; font-weight: 600; outline: none; }
.field .unit { font-size: 14px; font-weight: 600; color: var(--muted); }
.text-input { height: 48px; border: none; border-radius: 12px; padding: 0 12px; font-size: 16px; background: var(--card); width: 100%; }
.text-input:focus { outline: none; box-shadow: 0 0 0 2px var(--accent); }
.disclosure .text-input { background: var(--bg); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* ---------- plan ---------- */
.weeks { display: flex; gap: 8px; overflow-x: auto; margin: 0 -20px; padding: 2px 20px; scrollbar-width: none; }
.weeks::-webkit-scrollbar { display: none; }
.weeks button { flex-shrink: 0; width: 44px; height: 44px; border-radius: 999px; border: none; cursor: pointer; font-size: 16px; font-weight: 600; background: var(--card); color: var(--ink); }
.weeks button.past { background: var(--accent-soft); color: var(--accent); }
.weeks button.on { background: var(--accent); color: #fff; }
.weeks button.now { box-shadow: inset 0 0 0 2px var(--accent); }
.weeks button.on.now { box-shadow: none; }
.setup-link { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--card); border-radius: 20px; color: var(--ink); }
.setup-link .ico { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.add-btn { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 16px; border-radius: 999px; background: var(--card); color: var(--accent); font-size: 15px; font-weight: 600; border: none; cursor: pointer; }

/* ---------- edit ---------- */
.daypick { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.daypick button { height: 62px; border-radius: 14px; border: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 0; background: var(--card); color: var(--ink); }
.daypick button.on { background: var(--accent); color: #fff; }
.daypick .dw { font-size: 11px; font-weight: 600; }
.daypick .dn { font-family: var(--display); font-size: 18px; font-weight: 600; }
.daypick .dot { width: 5px; height: 5px; border-radius: 999px; margin-top: 2px; background: transparent; }
.daypick .dot.busy { background: var(--faint); }
.daypick button.on .dot.busy { background: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.note-card { background: var(--card); border-radius: 20px; padding: 16px; font-size: 14px; color: var(--muted); line-height: 1.45; }
.warn-text { font-size: 13px; color: var(--warn-ink); }

/* ---------- progress ---------- */
.stat { background: var(--card); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.stat .k { font-size: 13px; font-weight: 600; color: var(--muted); }
.stat .v { font-family: var(--display); font-size: 32px; font-weight: 700; }
.stat .v small { font-size: 18px; color: var(--muted); font-weight: 600; }
.bars { display: grid; grid-template-columns: repeat(var(--n, 10), minmax(0, 1fr)); gap: 6px; align-items: end; }
.bar { display: flex; flex-direction: column-reverse; gap: 3px; }
.bar i { display: block; height: 22px; border-radius: 4px; background: var(--border); }
.bar i.ok { background: var(--accent); }
.bar i.adj { background: var(--warn-bar); }
.bar-labels { display: grid; grid-template-columns: repeat(var(--n, 10), minmax(0, 1fr)); gap: 6px; }
.bar-labels span { text-align: center; font-size: 12px; font-weight: 500; color: var(--muted); }
.bar-labels span.now { font-weight: 700; color: var(--accent); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---------- toast / banners ---------- */
.toast { position: fixed; left: 50%; bottom: calc(84px + var(--safe-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 14px; font-size: 14px; font-weight: 500; display: flex; gap: 14px; align-items: center; z-index: 20; max-width: calc(100% - 40px); box-shadow: 0 6px 20px rgba(0,0,0,0.18); animation: up .2s ease; }
.toast button { background: none; border: none; color: #9FD8D1; font-weight: 700; font-size: 14px; cursor: pointer; height: 32px; padding: 0 4px; }
@keyframes up { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.sync-line { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.sync-line i { width: 7px; height: 7px; border-radius: 999px; background: var(--accent); display: inline-block; }
.sync-line i.off { background: var(--faint); }
.sync-line i.err { background: var(--warn-bar); }
.loading { min-height: 100dvh; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 15px; }

/* ---------- login ---------- */
.login { max-width: 380px; margin: 0 auto; padding: calc(80px + var(--safe-top)) 24px 40px; display: flex; flex-direction: column; gap: 20px; }
.login h1 { margin: 0; font-family: var(--display); font-size: 32px; font-weight: 700; letter-spacing: -0.5px; }
.login-mark { width: 56px; height: 56px; border-radius: 16px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-error { margin: 0; color: var(--warn-ink); background: var(--warn-soft); border-radius: 12px; padding: 10px 12px; font-size: 14px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- self tests ---------- */
.test-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; min-height: 72px; }
.test-row + .test-row { border-top: 1px solid var(--line); }
.test-row .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.test-row .who b { font-size: 15px; font-weight: 600; }
.test-row .who span { font-size: 12px; color: var(--muted); }
.time-field { width: 120px; flex-shrink: 0; }
.time-field input { text-align: center; }
.delta { font-size: 12px; font-weight: 600; }
.test-row .who .delta.up, .tests .delta.up { color: var(--accent); }
.test-row .who .delta.down, .tests .delta.down { color: var(--warn); }
.scroll { overflow-x: auto; }
table.tests { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tests th, table.tests td { padding: 12px 10px; text-align: right; white-space: nowrap; }
table.tests thead th { font-size: 12px; font-weight: 600; color: var(--muted); vertical-align: bottom; }
table.tests thead th a { display: block; font-size: 14px; color: var(--accent); }
table.tests thead th span { display: block; font-weight: 500; }
table.tests tbody th { text-align: left; font-weight: 600; padding-left: 16px; }
table.tests tbody tr + tr th, table.tests tbody tr + tr td { border-top: 1px solid var(--line); }
table.tests td b { font-family: var(--display); font-size: 17px; display: block; }
table.tests td .delta { display: block; }
table.tests td:last-child, table.tests th:last-child { padding-right: 16px; }
