/* Design tokens — from the Forge design package (design/TOKENS.md) */
:root {
  --bg: #0a0b0f;
  --nav-bg: #0e0f14;
  --surface: #14161c;        /* card */
  --surface-solid: #1d2028;  /* raised / input */
  --surface-hi: #1d2028;
  --inset: #0f1116;
  --border: #22252e;
  --border-2: #2c3039;
  --text: #f2f1ee;
  --text-2: #c9cbd1;
  --muted: #9a9ca5;
  --accent: #ff6a3d;         /* Ember */
  --on-accent: #1a0b05;
  --accent-2: #4f9dff;
  --good: #3ecf8e;
  --warn: #f5c542;
  --danger: #ff7a7e;
  --macro-p: #ff6b8a;
  --macro-c: #5cb8ff;
  --macro-f: #f5c542;
  --radius: 18px;
  --radius-sm: 14px;
  --nav-h: 68px;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  --tap: 46px;
  --font-head: Archivo, system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
}

/* light theme */
:root[data-theme="light"] {
  --bg: #f4f6fb;
  --nav-bg: #ffffff;
  --surface: #ffffff;
  --surface-solid: #f1f4f9;
  --surface-hi: #f1f4f9;
  --inset: #eef1f7;
  --border: #e4e8f0;
  --border-2: #d7dce6;
  --text: #10141c;
  --text-2: #3b4453;
  --muted: #5a6473;
  --shadow: 0 12px 34px rgba(15, 23, 42, 0.10);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font-body);
  font-variant-numeric: tabular-nums;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* content clears the fixed bottom nav + the phone's home indicator (fixes #20) */
#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 20px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom));
}

h1 { margin: 0 0 14px; font-family: var(--font-head); font-size: 34px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
/* card / section headers = small uppercase label (the design's signature) */
h2 { margin: 0 0 12px; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
h3 { margin: 0 0 10px; font-family: var(--font-head); font-size: 15px; font-weight: 700; }
dialog h2 { font-family: var(--font-head); font-size: 19px; font-weight: 700; letter-spacing: -0.01em; text-transform: none; color: var(--text); }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.spacer { height: 14px; }
b, strong { font-family: var(--font-head); font-weight: 700; }

/* cards — solid surfaces, flat with a hairline border (design system) */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}

/* buttons — big tap targets, clear hierarchy */
button, .btn {
  font: inherit; font-weight: 600; color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  min-height: var(--tap); padding: 11px 16px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .08s ease, filter .15s ease, background .15s ease, border-color .15s ease;
}
button:hover, .btn:hover { border-color: color-mix(in srgb, var(--text) 22%, var(--border-2)); }
button:active, .btn:active { transform: scale(0.98); filter: brightness(0.95); }

.btn-accent { background: var(--accent); border-color: transparent; color: var(--on-accent); font-weight: 700; }
.btn-blue { background: var(--accent-2); border-color: transparent; color: #06121f; font-weight: 700; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-solid); }
.btn-danger { color: var(--danger); }
.btn-full { width: 100%; }
.btn-sm { min-height: 36px; padding: 7px 12px; font-size: 14px; border-radius: 11px; }
.pill { border-radius: 999px; }

input, select, textarea {
  font: inherit; color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); padding: 12px 14px; width: 100%; min-height: var(--tap);
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 0; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 25%, transparent);
  scroll-margin-bottom: 140px; /* keep focused field above the keyboard (fixes #20) */
}
::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 12px 0 5px; }

.tag {
  font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--surface-hi);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}

.list-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 13px 2px; border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }

/* set logging rows (flex, adapts to exercise kind) */
.set-row { display: flex; gap: 7px; align-items: flex-start; margin-bottom: 8px; }
.set-row input { text-align: center; padding: 11px 6px; }
.set-num {
  width: 34px; min-width: 34px; height: var(--tap); padding: 0;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  background: var(--surface-solid);
}
.set-num.type-warmup { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, var(--surface-solid)); border-color: transparent; }
.set-num.type-drop { color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 16%, var(--surface-solid)); border-color: transparent; }
.set-num.type-failure { color: var(--danger); background: color-mix(in srgb, var(--danger) 16%, var(--surface-solid)); border-color: transparent; }
.rpe { width: 58px; min-width: 58px; }
.set-row .btn-sm { height: var(--tap); min-height: var(--tap); }
.set-done {
  background: var(--good) !important; border-color: transparent !important; color: #06210f !important;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--good) 40%, transparent);
}
.step-btns { display: flex; gap: 6px; margin: 5px 0 2px; }
.step-btns button { flex: 1; min-height: 32px; padding: 4px 0; font-size: 15px; }
.done-row input { opacity: 0.55; }

/* bottom tab bar — highlighted active chip */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; justify-content: space-around; align-items: center;
  background: var(--nav-bg);
  border-top: 1px solid var(--border);
  z-index: 50;
}
.tabbar a {
  text-decoration: none; color: var(--muted); font-size: 10.5px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; padding-top: 4px;
}
.tabbar a .ico {
  width: 54px; height: 30px; border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.tabbar a.active { color: var(--text); }
.tabbar a.active .ico { background: var(--accent); color: var(--on-accent); }

/* rest timer — floating card (matches design) */
.rest-banner {
  position: fixed; left: 50%; transform: translateX(-50%);
  width: calc(100% - 24px); max-width: 536px;
  bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom));
  background: var(--surface-hi); color: var(--text);
  border: 1px solid var(--border-2); padding: 10px; border-radius: 20px; z-index: 60;
  display: flex; gap: 8px; align-items: center; box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
}
.rest-banner .rest-adj { background: var(--border); border: none; color: var(--text); height: 46px; min-height: 46px; padding: 0 10px; border-radius: 12px; font-size: 14px; font-weight: 600; }
.rest-skip { height: 46px; min-height: 46px; padding: 0 14px; border-radius: 12px; background: var(--accent); border: 0; color: var(--on-accent); font-weight: 700; font-size: 14px; }
.rest-mid { flex: 1; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.rest-top { display: flex; align-items: baseline; gap: 8px; }
.rest-lbl { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.rest-time { font-family: var(--font-head); font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.rest-bar { width: 100%; height: 6px; border-radius: 3px; background: var(--border-2); overflow: hidden; }
.rest-bar-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s linear; }

/* dashboard bits */
.date-strip {
  margin: 6px 0 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 6px;
}
.date-strip .btn-sm { min-height: 34px; border: none; background: transparent; }
.bar { height: 10px; border-radius: 999px; background: var(--surface-hi); overflow: hidden; margin-top: 6px; }
.bar-fill { height: 100%; border-radius: 999px; transition: width .35s ease; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25); }
.water-track { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; font-size: 20px; }
.glass { opacity: .3; transition: opacity .15s ease; }
.glass.full { opacity: 1; }
.over { color: var(--danger); font-weight: 700; }
.good-txt { color: var(--good); font-weight: 700; }

.swatch { width: 32px; height: 32px; min-height: 32px; border-radius: 50%; padding: 0; border: 2px solid transparent; }
.swatch.on { border-color: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 22%, transparent); }
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 13px); grid-auto-columns: 13px; gap: 3px; overflow-x: auto; padding: 4px 0; }
.hm { border-radius: 3px; background: var(--surface-hi); }
.hm.on { background: var(--accent); box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 45%, transparent); }

.chart { width: 100%; height: 92px; display: block; margin: 8px 0 2px; overflow: visible; }
.stat-box {
  flex: 1; min-width: 92px; text-align: center;
  background: var(--surface-hi); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 10px;
}

.empty { text-align: center; color: var(--muted); padding: 44px 16px; }
.fab-note { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 18px; }

/* bottom-sheet modals */
dialog { border: 0; background: transparent; padding: 0; position: fixed; inset: auto 0 0 0; margin: 0 auto; width: min(560px, 100%); max-width: 560px; }
dialog::backdrop { background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(2px); }
dialog > .card, dialog > form.card { margin: 0; border-radius: 24px 24px 0 0; max-height: 88vh; overflow: auto; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
dialog > .card::before, dialog > form.card::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--border-2); margin: 0 auto 14px; }
dialog[open] { animation: sheet .24s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes sheet { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* undo toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom));
  background: var(--surface-solid); color: var(--text); border: 1px solid var(--border);
  padding: 10px 14px; border-radius: 999px; z-index: 70; display: flex; gap: 12px; align-items: center;
  box-shadow: var(--shadow); max-width: calc(100% - 24px);
}
.toast .btn-sm { background: var(--accent); color: #fff; border: none; min-height: 32px; }

/* progress photos */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.photo { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del { position: absolute; top: 4px; right: 4px; min-height: 26px; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; border: none; }

/* interval timer */
.iv-display { text-align: center; padding: 18px; border-radius: 16px; background: var(--surface-hi); }
.iv-phase { font-size: 14px; font-weight: 700; letter-spacing: .08em; color: var(--muted); }
.iv-phase.work { color: var(--good); }
.iv-phase.rest { color: var(--accent-2); }
.iv-phase.done { color: var(--accent); }
.iv-time { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }

/* print → PDF (report modal only) */
@media print {
  nav, #app, #rest, #toast { display: none !important; }
  dialog { position: static; display: block; padding: 0; }
  dialog::backdrop { display: none; }
  body { background: #fff; color: #000; }
  .report { box-shadow: none; border: none; }
}

/* ===== design-system components (match design/screens/*) ===== */
.scr-head { margin-bottom: 10px; }
.scr-head.between { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.scr-head h1 { margin: 0; }
.scr-head-t { min-width: 0; }
.subtitle { margin: 4px 0 0; font-size: 15px; color: var(--muted); }
.eyebrow-date { margin: 0 0 2px; font-size: 14px; color: var(--muted); }
.daybtn {
  width: 46px; height: 46px; min-height: 46px; padding: 0; border-radius: var(--radius-sm);
  background: var(--surface-solid); border: 1px solid var(--border-2); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.card-hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-hd h2 { margin: 0; }
.cap { font-size: 13px; color: var(--muted); }
.sec-hd.between { display: flex; align-items: center; justify-content: space-between; }
.stack { margin-bottom: 14px; }
.stack > * + * { margin-top: 10px; }

/* calorie card */
.cal-row { display: flex; align-items: center; gap: 20px; }
.ring-wrap { flex-shrink: 0; }
.stat-dl { margin: 0; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.stat-dl > div { display: flex; justify-content: space-between; gap: 8px; }
.stat-dl dt { font-size: 14px; color: var(--muted); }
.stat-dl dd { margin: 0; font-weight: 600; }
.dl-net { padding-top: 10px; border-top: 1px solid var(--border); }
.dl-net dt, .dl-net dd { font-size: 13px; color: var(--muted); }
/* narrow phones: stack the ring above the stats so the numbers never clip */
@media (max-width: 360px) {
  .cal-row { flex-direction: column; gap: 14px; align-items: stretch; }
  .ring-wrap { align-self: center; }
}

/* water */
.water-row { display: flex; align-items: center; gap: 12px; }
.water-track { flex: 1; display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }
.drop { width: 16px; height: 16px; background: var(--border); border-radius: 50% 50% 50% 0; transform: rotate(45deg); }
.drop.full { background: var(--macro-c); }

/* big CTA */
.cta {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: 20px;
  background: var(--accent); color: var(--on-accent); border: none; text-align: left; margin-bottom: 14px; min-height: 0;
}
.cta-ico { width: 48px; height: 48px; border-radius: 14px; background: rgba(0,0,0,0.12); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cta-t { display: flex; flex-direction: column; gap: 2px; }
.cta-title { font-family: var(--font-head); font-size: 19px; font-weight: 800; }
.cta-sub { font-size: 14px; font-weight: 500; }

/* chips + link button */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 46px; padding: 0 16px; border-radius: 23px; background: var(--surface-solid); border: 1px solid var(--border-2); font-weight: 600; font-size: 15px; color: var(--text); }
.link-btn { background: none; border: 0; color: var(--accent); font-weight: 600; font-size: 15px; min-height: 44px; padding: 0 6px; }

/* routine card (Train) */
.rt-card { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 16px; }
.rt-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rt-info h3 { margin: 0; font-family: var(--font-head); font-size: 18px; font-weight: 700; }
.rt-start { height: 46px; min-height: 46px; padding: 0 18px; border-radius: 14px; background: var(--surface-solid); border: 1px solid var(--border-2); font-weight: 700; font-size: 15px; color: var(--text); }
.rt-start.accent { background: var(--accent); border-color: transparent; color: var(--on-accent); }

/* 2-col tiles */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.tile-t { font-weight: 600; font-size: 16px; }

/* stat pair (Today) */
.stat2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.stat-cell { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.stat-cell strong { font-family: var(--font-head); font-size: 26px; font-weight: 800; }
.stat-cell .unit { font-size: 14px; font-weight: 600; color: var(--muted); }
.tip { margin: 6px 0; font-size: 14px; color: var(--muted); }
.tip::before { content: "•  "; color: var(--accent); }

/* Fuel */
.totals { margin: 0 0 14px; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.totals dt { font-size: 12px; color: var(--muted); }
.totals dd { margin: 2px 0 0; font-family: var(--font-head); font-size: 22px; font-weight: 800; }
.wide-btn { width: 100%; height: 46px; min-height: 46px; border-radius: 12px; background: var(--surface-solid); border: 1px solid var(--border-2); color: var(--text); font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.meal-hd { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.meal-title { margin: 0; flex: 1; font-family: var(--font-head); font-size: 18px; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--text); }
.add-btn { width: 46px; height: 46px; min-height: 46px; padding: 0; border-radius: 23px; background: var(--surface-solid); border: 1px solid var(--border-2); color: var(--text); display: inline-flex; align-items: center; justify-content: center; }
.add-btn.accent { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.food-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.food-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.food-name { font-weight: 600; font-size: 15px; }
.food-kcal { font-weight: 600; }
.x-btn { width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; background: none; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.empty-dashed { padding: 16px; border-radius: 14px; border: 1px dashed var(--border-2); display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }

/* More menu */
.menu { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 0 16px; display: flex; flex-direction: column; margin-bottom: 14px; }
.menu-row { display: flex; align-items: center; gap: 14px; min-height: 68px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.menu-row:last-child { border-bottom: none; }
.mrow-ico { width: 42px; height: 42px; border-radius: 12px; background: var(--surface-solid); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mrow-ico.shield { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.mrow-t { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.mrow-title { font-weight: 600; font-size: 16px; }
.chev { color: var(--muted); display: flex; }
.privacy { display: flex; gap: 14px; }
.priv-t { margin: 0; font-size: 16px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--text); }
.version { margin: 4px 0 0; text-align: center; font-size: 13px; color: var(--muted); }

/* Settings */
.back { display: inline-flex; align-items: center; gap: 4px; height: 44px; color: var(--text-2); font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--inset); border: 1px solid var(--border); }
.seg button { min-height: 44px; height: 44px; border-radius: 10px; border: 0; background: transparent; color: var(--text-2); font-weight: 600; font-size: 15px; }
.seg button.on { background: var(--accent); color: var(--on-accent); }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 8px; }
.swatch2 { width: 100%; aspect-ratio: 1; min-height: 0; border-radius: 50%; padding: 0; border: 3px solid transparent; }
.swatch2.on { border-color: var(--text); }
.set-row2 { display: flex; align-items: center; gap: 10px; min-height: 58px; }
.set-row2.bt { border-top: 1px solid var(--border); }
.sr-t { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sr-val { width: 56px; text-align: center; font-family: var(--font-head); font-size: 18px; font-weight: 700; }
.goal-row { display: flex; align-items: center; gap: 10px; min-height: 56px; }
.goal-row + .goal-row { border-top: 1px solid var(--border); }
.goal-name { flex: 1; font-weight: 600; font-size: 15px; }
.goal-row input { width: 96px; height: 46px; min-height: 46px; padding: 0 10px; text-align: right; font-size: 16px; font-weight: 600; background: var(--inset); }
.goal-unit { width: 44px; font-size: 13px; color: var(--muted); }
.goals-cta { width: 100%; height: 50px; margin-top: 8px; }
.grid2b { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid2b button, .wide-btn { font-size: 14px; }
.reset-btn { width: 100%; height: 46px; min-height: 46px; border-radius: 12px; background: none; border: 1px solid var(--border-danger, #4a2326); color: var(--danger); font-weight: 600; font-size: 14px; }
:root[data-theme="light"] .reset-btn { border-color: #f0c9cb; }

/* Workout logger */
.wk-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.wk-title { flex: 1; min-width: 0; }
.wk-name { background: none; border: 0; padding: 0; min-height: 0; color: var(--text); display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-head); font-size: 20px; font-weight: 700; max-width: 100%; }
.wk-name svg { color: var(--muted); flex-shrink: 0; }
.wk-finish { height: 46px; min-height: 46px; padding: 0 16px; border-radius: 14px; background: var(--accent); border: 0; color: var(--on-accent); font-weight: 700; font-size: 15px; flex-shrink: 0; }
.wk-ex { padding: 16px; }
.wk-ex-hd { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.wk-ex-t { flex: 1; min-width: 0; }
.wk-ex-name { margin: 0 0 5px; font-family: var(--font-head); font-size: 20px; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--text); }
.wk-ex-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.orm-pill { padding: 3px 8px; border-radius: 999px; background: var(--border); color: var(--text); font-size: 12px; font-weight: 600; }
.last-chip { margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; background: var(--inset); font-size: 13px; color: var(--muted); }
.last-chip span { color: var(--text); }
.set-list { display: flex; flex-direction: column; gap: 6px; }
.set-badge { width: 44px; height: 44px; min-height: 44px; border-radius: 12px; border: 0; background: var(--surface-solid); color: var(--text); font-family: var(--font-head); font-weight: 700; font-size: 15px; flex-shrink: 0; }
.set-badge.type-warmup { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.set-badge.type-drop { background: color-mix(in srgb, var(--accent-2) 16%, transparent); color: var(--accent-2); }
.set-badge.type-failure { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.cur-set { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface-hi); border: 2px solid var(--accent); }
.cur-hd { display: flex; align-items: center; gap: 10px; }
.cur-title { font-weight: 600; font-size: 15px; }
.stp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stp-col { display: flex; flex-direction: column; gap: 6px; }
.stp-label { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.stp-box { display: flex; align-items: center; justify-content: space-between; height: 54px; border-radius: 14px; background: var(--inset); border: 1px solid var(--border-2); }
.stp-btn { width: 46px; height: 52px; min-height: 0; border: 0; background: none; color: var(--text); padding: 0; }
.stp-val { font-family: var(--font-head); font-size: 22px; font-weight: 700; }
.rpe-row { display: flex; align-items: center; gap: 8px; }
.rpe-label { width: 72px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); line-height: 1.2; }
.rpe-btns { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.rpe-b { height: 44px; min-height: 44px; border-radius: 12px; border: 1px solid var(--border-2); background: var(--border); color: var(--text); font-family: var(--font-head); font-weight: 700; font-size: 15px; }
.rpe-b.on { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.complete-btn { display: flex; align-items: center; justify-content: center; gap: 8px; height: 52px; border-radius: 14px; border: 0; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 16px; }
.sum-set { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 2px; }
.sum-set.pending { opacity: .5; }
.sum-txt { flex: 1; font-family: var(--font-head); font-size: 17px; font-weight: 600; }
.chk { width: 46px; height: 46px; min-height: 46px; border-radius: 23px; border: 2px solid var(--border-2); background: transparent; color: #5a5e69; display: inline-flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0; }
.chk.on { border-color: var(--good); background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.wk-ex-foot { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.wk-ex-foot button { height: 46px; min-height: 46px; font-size: 14px; }
.wk-collapsed { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 16px; }
.wk-col-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.wk-col-name { font-family: var(--font-head); font-size: 17px; font-weight: 700; }
.as-chip { width: 46px; height: 46px; border-radius: 14px; background: var(--surface-solid); border: 1px solid var(--border-2); color: var(--text); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.add-ex-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; height: 52px; border-radius: 14px; background: var(--surface-solid); border: 1px dashed var(--border-2); color: var(--text); font-weight: 600; font-size: 16px; margin-bottom: 14px; }
.ghost-btn { height: 46px; min-height: 46px; background: none; border: 1px solid var(--border-2); font-size: 14px; }

/* Welcome */
.welcome { min-height: calc(100dvh - 60px); display: flex; flex-direction: column; gap: 26px; padding-top: 24px; }
.wbrand { display: flex; align-items: center; gap: 10px; }
.wbrand-ico { width: 48px; height: 48px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border-2); display: flex; }
.wbrand-ico img { width: 48px; height: 48px; display: block; }
.wbrand-name { font-family: var(--font-head); font-size: 20px; font-weight: 800; letter-spacing: 0.12em; }
.wtitle { margin: 0 0 12px; font-family: var(--font-head); font-size: 40px; line-height: 1.05; font-weight: 800; letter-spacing: -0.02em; }
.wlead { margin: 0; font-size: 17px; line-height: 1.5; color: var(--text-2); }
.wlist { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 16px; }
.wf { display: flex; align-items: center; gap: 14px; }
.wf-ico { width: 46px; height: 46px; border-radius: 14px; background: var(--surface-solid); border: 1px solid var(--border-2); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.wf-t { display: flex; flex-direction: column; gap: 2px; }
.wf-title { font-weight: 600; font-size: 16px; }
.wgrow { flex: 1; min-height: 8px; }
.wcta { width: 100%; height: 56px; font-size: 17px; }

/* Portion sheet */
.po-grams { display: flex; align-items: center; gap: 8px; }
.po-step { width: 56px; height: 56px; min-height: 56px; border-radius: 16px; background: var(--surface-solid); border: 1px solid var(--border-2); color: var(--text); display: inline-flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0; }
#port-g { flex: 1; height: 56px; min-height: 56px; border-radius: 16px; background: var(--inset); border: 2px solid var(--accent); color: var(--text); text-align: center; font-family: var(--font-head); font-size: 28px; font-weight: 800; }
.po-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.po-chip { height: 44px; min-height: 44px; border-radius: 22px; border: 1px solid var(--border-2); background: var(--surface-solid); color: var(--text); font-weight: 600; font-size: 14px; }
.po-chip.on { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.po-macros { margin: 14px 0; padding: 16px; border-radius: 16px; background: var(--inset); border: 1px solid var(--border); display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.po-macros dt { font-size: 12px; color: var(--muted); }
.po-macros dd { margin: 2px 0 0; font-family: var(--font-head); font-size: 22px; font-weight: 800; }
.po-add { width: 100%; height: 56px; font-size: 17px; }

/* Progress screen */
.prog-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; margin: -4px 0 10px; }
.prog-val { font-family: var(--font-head); font-size: 34px; font-weight: 800; line-height: 1; }
.delta { font-size: 14px; font-weight: 600; }

.stat-grid { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat-tile { padding: 12px; border-radius: 12px; background: var(--inset); }
.stat-tile dt { font-size: 12px; color: var(--muted); }
.stat-tile dd { margin: 2px 0 0; font-family: var(--font-head); font-size: 18px; font-weight: 800; }

.pr-list { margin: 0; padding: 0; list-style: none; }
.pr-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.pr-row:last-child { border-bottom: 0; }
.pr-rank { width: 32px; height: 32px; border-radius: 10px; background: var(--surface-solid); display: flex; align-items: center; justify-content: center; font-family: var(--font-head); font-weight: 800; }
.pr-rank.top { background: var(--accent); color: var(--on-accent); }
.pr-name { flex: 1; min-width: 0; font-weight: 600; }
.pr-val { font-family: var(--font-head); font-weight: 700; }

.meas-grid { margin: 12px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.meas-tile { padding: 12px; border-radius: 12px; background: var(--inset); }
.meas-tile dt { font-size: 13px; color: var(--muted); }
.meas-tile dd { margin: 4px 0 0; display: flex; align-items: baseline; gap: 6px; }
.meas-v { font-family: var(--font-head); font-size: 20px; font-weight: 800; }
.meas-d { font-size: 13px; font-weight: 600; color: var(--muted); }

.rm-inputs input { font-family: var(--font-head); font-size: 20px; font-weight: 700; }
.rm-out { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 14px; margin-bottom: 12px; border-radius: 14px; background: var(--inset); border: 1px solid var(--accent); }
.rm-max { font-family: var(--font-head); font-size: 28px; font-weight: 800; }
.rm-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.rm-cell { padding: 10px 6px; border-radius: 10px; background: var(--surface-solid); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rm-cell-v { font-family: var(--font-head); font-size: 16px; font-weight: 700; }

/* Add-food sheet */
.af-sheet { display: flex; flex-direction: column; gap: 12px; height: 86vh; max-height: 86vh; overflow: hidden; }
.af-head { display: flex; align-items: flex-start; gap: 10px; }
.af-title { flex: 1; margin: 0; font-size: 24px; font-weight: 800; }
.af-sub { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.af-close { width: 46px; height: 46px; min-height: 46px; padding: 0; border-radius: 50%; background: var(--surface-solid); flex-shrink: 0; }
.af-search-row { display: flex; gap: 8px; }
.af-search { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; margin: 0; height: 52px; padding: 0 14px; border-radius: 14px; background: var(--inset); border: 1px solid var(--border-2); color: var(--muted); }
.af-search input { flex: 1; min-width: 0; height: 48px; min-height: 0; padding: 0; background: none; border: 0; box-shadow: none !important; color: var(--text); font-size: 16px; }
.af-search input:focus { outline: none; }
.af-scan { width: 52px; height: 52px; min-height: 52px; padding: 0; border-radius: 14px; background: var(--accent); border: 0; color: var(--on-accent); flex-shrink: 0; }
.af-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 14px; background: var(--inset); border: 1px solid var(--border); }
.af-tab { min-height: 44px; padding: 0 4px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font-weight: 600; font-size: 13px; }
.af-tab.on { background: var(--surface-solid); color: var(--text); }
.af-newmeal { width: 100%; justify-content: flex-start; gap: 8px; margin: 4px 0 8px; background: transparent; border: 1px dashed var(--border-2); color: var(--accent); font-weight: 600; }
.af-meal { gap: 8px; }
.af-meal-log { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 0; background: none; border: 0; text-align: left; }
.af-meal-del { width: 40px; height: 40px; min-height: 40px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); flex-shrink: 0; }
.af-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -2px; }
.af-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 2px; background: none; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; text-align: left; }
.af-item:last-child { border-bottom: 0; }
.af-item-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.af-item-name { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.af-item-macros { font-size: 13px; color: var(--muted); }
.af-item-add { width: 44px; height: 44px; border-radius: 50%; background: var(--surface-solid); border: 1px solid var(--border-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.af-empty { color: var(--muted); padding: 24px 4px; }
.af-manual { flex-shrink: 0; }
.af-foot { margin: 0; text-align: center; font-size: 12px; color: var(--muted); }

/* routine builder — exercise row with target sets × reps */
.rt-pick { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.rt-pick-l { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; margin: 0; font-size: 14px; color: var(--text); font-weight: 500; }
.rt-pick-l input { width: auto; min-height: 0; }
.rt-tgt { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.rt-tgt input { width: 48px; min-height: 40px; padding: 6px; text-align: center; }

/* medication checklist (Today) */
.med-list { display: flex; flex-direction: column; gap: 8px; }
.med-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 12px; background: var(--inset); border: 1px solid var(--border); text-align: left; }
.med-row.on { background: color-mix(in srgb, var(--good) 14%, var(--inset)); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.med-check { width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--surface-solid); border: 1px solid var(--border-2); color: #06210f; }
.med-row.on .med-check { background: var(--good); border-color: transparent; }
.med-t { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.med-name { font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
