/* SABA Today — instrument panel. Dark only by design: read in a gym, at arm's
   length, numbers first. Palette: ground #12141A, on-target #4ADE80,
   over/out-of-range #F0703A, live accent #5B8DEF, ink #EDEAE3. */

:root {
  --bg: #12141A;
  --panel: #191C24;
  --panel-2: #1F232E;
  --line: #2A2F3B;
  --ink: #EDEAE3;
  --ink-2: #A9ADB6;
  --ink-3: #6E7480;
  --good: #4ADE80;
  --over: #F0703A;
  --live: #5B8DEF;
  /* Tracked-lever amber: saturated fat and sugar. Deliberately softer than
     --over, which means "past goal"; this one means "the number being watched". */
  --watch: #E8A33D;
  --num: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--bg); }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}
main { max-width: 560px; margin: 0 auto; padding: 20px 16px 48px; }
.boot { color: var(--ink-3); padding: 40px 0; text-align: center; }

.num { font-family: var(--num); font-variant-numeric: tabular-nums; }

header.day {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 20px;
}
header.day h1 {
  font-size: 13px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-2);
}
header.day .date { color: var(--ink); }
button.refresh {
  background: none; border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink-2); font-family: var(--sans); font-size: 13px;
  min-height: 48px; min-width: 48px; padding: 0 14px; cursor: pointer;
}
button.refresh:active { background: var(--panel-2); }
/* Two header actions side by side (Edit next to Finish on the live screen)
   without header.day's space-between pushing them to opposite ends. */
.hbtns { display: flex; gap: 8px; align-items: baseline; }

section { margin-bottom: 18px; }
/* Section header: an eyebrow label with a trailing hairline, so each section is
   findable at a glance down a long page. */
h2 {
  display: flex; align-items: center; gap: 12px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-2); margin-bottom: 12px;
}
h2::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--line); }
.goal-head h2::after { content: none; }  /* title sits beside the countdown */

/* Zone eyebrow: names a group of sections — the shape of a coaching day
   (Fuel / Move / Recover / Progress). A hairline above sets each group apart. */
.zone {
  font-size: 10px; font-weight: 700; letter-spacing: 0.26em;
  text-transform: uppercase; color: var(--ink-3);
  margin: 30px 0 16px; padding-top: 18px; border-top: 1px solid var(--line);
}
.zone.first { margin-top: 2px; padding-top: 0; border-top: none; }

/* Protein hero */
.hero {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 18px 16px 16px;
}
.hero .label { font-size: 13px; color: var(--ink-2); }
.hero .big { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 12px; }
.hero .big .val { font-size: 52px; font-weight: 700; line-height: 1; }
.hero .big .of { font-size: 16px; color: var(--ink-3); }
.meter {
  height: 14px; background: var(--panel-2); border-radius: 7px; overflow: hidden;
  position: relative;
}
.meter > i {
  display: block; height: 100%; border-radius: 7px 4px 4px 7px;
  background: var(--live); min-width: 4px; width: 0;
  transition: width 200ms ease;
}
.meter > i.zero { min-width: 0; }
.meter > i.done { background: var(--good); }
.meter > i.over { background: var(--over); }
.hero .sub { margin-top: 8px; font-size: 13px; color: var(--ink-3); }

/* Macro tiles */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 12px 10px;
}
.tile .label { font-size: 12px; color: var(--ink-3); }
.tile .val { font-size: 24px; font-weight: 700; margin: 2px 0 8px; }
.tile .val .unit { font-size: 13px; font-weight: 400; color: var(--ink-3); }
.tile .meter { height: 6px; border-radius: 3px; }
.tile .goal { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.tile .goal.overtxt { color: var(--over); }

.floornote { font-size: 13px; color: var(--over); margin-top: 10px; }

/* Fuel composition — what the fat and carbs are made of.
   Amber marks the two tracked levers (saturated fat against the LDL retest,
   sugar against the CGM). It is a highlight, not a warning colour: it is the
   number being watched, and a low-saturated day should still read as calm. */
.splitsec .splitrow + .splitrow { margin-top: 16px; }
.splithead {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 6px;
}
.splitlabel {
  font-size: 12px; color: var(--ink-2); font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.splittot { font-size: 18px; font-weight: 700; }
.splitof { font-size: 13px; font-weight: 400; color: var(--ink-3); }
.splitbar {
  display: flex; height: 14px; background: var(--panel-2);
  border-radius: 7px; overflow: hidden; gap: 2px;
}
.splitbar > i {
  display: block; height: 100%; width: 0; min-width: 3px;
  transition: width 200ms ease;
}
.splitbar > i:first-child { border-radius: 7px 3px 3px 7px; }
.splitbar > i:last-child { border-radius: 3px 7px 7px 3px; }
.splitbar > i:only-child { border-radius: 7px; }

.seg.sat, .seg.sugar { background: var(--watch); }
.seg.mono, .seg.fiber { background: var(--good); }
.seg.poly { background: var(--live); }
.seg.starch { background: #6B7690; }
.seg.rest { background: var(--ink-3); }

.splitkey {
  display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px;
  font-size: 13px; color: var(--ink-2);
}
.splitkey .k { display: inline-flex; align-items: center; gap: 5px; }
.splitkey .sw {
  width: 9px; height: 9px; border-radius: 2px; display: inline-block;
  flex: 0 0 auto;
}
.sw.sat, .sw.sugar { background: var(--watch); }
.sw.mono, .sw.fiber { background: var(--good); }
.sw.poly { background: var(--live); }
.sw.starch { background: #6B7690; }
.sw.rest { background: var(--ink-3); }
.splitkey b { color: var(--ink); font-weight: 700; }
.splitkey em { color: var(--ink-3); font-style: normal; font-size: 12px; }

.splitnote { font-size: 12px; color: var(--ink-3); margin-top: 8px; }
.splitnote.est { margin-top: 14px; }

/* Readiness strip */
.strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.mini {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px;
}
.mini .label { font-size: 11px; color: var(--ink-3); letter-spacing: 0.04em; }
.mini .val { font-size: 20px; font-weight: 700; }
.mini .val .unit { font-size: 12px; font-weight: 400; color: var(--ink-3); }
.stripnote { font-size: 12px; color: var(--ink-3); margin-top: 8px; }

/* Meal timeline */
.rows { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.row {
  display: flex; gap: 12px; align-items: baseline;
  background: var(--panel); padding: 12px 14px;
  border-bottom: 1px solid var(--line); min-height: 48px;
}
.row:last-child { border-bottom: none; }
.row .t { color: var(--ink-3); font-size: 13px; flex: 0 0 3.2em; }
.row .desc { flex: 1; font-size: 15px; overflow-wrap: anywhere; }
.row .macros { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.row .actbits { color: var(--ink-2); }

/* Suggested eating + journal */
.planrows .t { flex: 0 0 4.6em; }
.plannote a { color: var(--ink-2); }
.mealedit textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); font-family: var(--sans); font-size: 15px;
  padding: 10px; width: 100%; resize: vertical; min-height: 64px;
}
.plantarget { font-size: 15px; font-weight: 700; margin: 2px 0 2px; }
.plannote { font-size: 12px; color: var(--ink-3); margin: 4px 2px 8px; line-height: 1.45; }
.jrnl {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); font-family: var(--sans); font-size: 15px;
  padding: 10px 12px; width: 100%; resize: vertical; min-height: 96px;
}
.jrnlbar { display: flex; align-items: center; gap: 10px; }
.jrnlbar .addmeal { flex: 0 0 auto; }
.jrnlstamp { font-size: 12px; color: var(--ink-3); }
.row.total { background: var(--panel-2); }
.row.total .desc { font-weight: 700; }
.row.total .macros { color: var(--ink-2); }
.row.tappable { cursor: pointer; }
.row.tappable:active { background: var(--panel-2); }

/* date navigation */
.datenav {
  background: none; border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink-2); min-width: 40px; min-height: 40px; font-size: 18px;
  cursor: pointer; vertical-align: middle; margin: 0 2px;
}
.datenav:disabled { opacity: 0.3; cursor: default; }

/* fluid tile */
.fluidsec .tile.fluid { padding: 14px 14px 12px; }
.fluidtop { display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; }
.tile.fluid .val { font-size: 28px; margin: 2px 0 0; }
.fluidbtns { display: flex; gap: 8px; }
.fluidadd {
  min-height: 48px; min-width: 60px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px; color: var(--live);
  font-size: 17px; font-weight: 700; cursor: pointer;
}
.fluidadd:active { background: var(--line); }
.fluidadd:disabled { opacity: 0.4; }

.addmeal {
  display: block; width: 100%; min-height: 48px; margin-top: 10px;
  background: none; border: 1px dashed var(--line); border-radius: 12px;
  color: var(--ink-2); font-size: 15px; cursor: pointer; font-family: var(--sans);
}
.addmeal:active { background: var(--panel); }
#addmealform .mealedit, #addsuppform .mealedit {
  border: 1px solid var(--line); border-radius: 12px; margin-top: 8px; }
.suppchips { display: flex; flex-wrap: wrap; gap: 6px; }
/* Bloodwork entry form. These three rules were inline style="" attributes,
   which the strict CSP (no 'unsafe-inline') dropped on the floor, so the form
   shipped visually broken: chips in one unwrapped row and no spacing. */
.suppchips.bwchips { gap: 4px; margin: 8px 0; }
.bwadd { margin-bottom: 8px; }
.mkrm { margin-left: auto; font-size: 0.75rem; }
.suppchip {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 16px;
  color: var(--ink-2); font-size: 13px; min-height: 40px; padding: 0 12px;
  cursor: pointer; font-family: var(--sans);
}
.suppchip:active { background: var(--line); }
.suppchip.on { border-color: var(--live); color: var(--ink); }
.wkgoal { color: var(--ink-3); font-size: 12px; font-weight: 400;
  text-transform: none; letter-spacing: 0; }
.suppgrid { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px; }
.suppgrid label { display: grid; gap: 4px; font-size: 12px; color: var(--ink-3); }
.suppgrid input, .suppgrid select {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); font-family: var(--sans); font-size: 15px;
  min-height: 44px; padding: 0 8px; width: 100%;
}

/* meal action bar + inline editor */
.mealactions {
  display: flex; gap: 8px; padding: 10px 14px; background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.mealactions button {
  flex: 1; min-height: 48px; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; font-size: 14px;
  cursor: pointer; font-family: var(--sans);
}
.mealactions button.danger { color: var(--over); border-color: var(--over); }
.mealedit {
  padding: 12px 14px; background: var(--panel-2);
  border-bottom: 1px solid var(--line); display: grid; gap: 10px;
}
.mealedit input {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); font-family: var(--num); font-size: 16px;
  min-height: 44px; padding: 0 10px; width: 100%;
}
.megrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.megrid label { display: grid; gap: 4px; font-size: 12px; color: var(--ink-3); }
/* Composition row: three fields under the four macro fields, so the split is
   editable by hand without crowding the primary numbers. */
.megrid.sub { grid-template-columns: repeat(3, 1fr); margin-top: 8px; }
.meactions { display: flex; gap: 8px; }
.meactions button {
  flex: 1; min-height: 48px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font-size: 15px; cursor: pointer;
}
.meactions button[data-act="save"] { background: var(--live); color: #0B0D12;
  border: none; font-weight: 700; }
.row .cal { color: var(--ink-2); font-size: 14px; white-space: nowrap; }
.row .cal.missing { color: var(--over); font-size: 12px; }

/* Workout */
.sets .row .desc { font-weight: 600; }
.sets .row .cal { color: var(--ink); }
.setchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.setchip {
  padding: 4px 9px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; color: var(--ink-2); font-size: 13px; font-weight: 400;
  cursor: pointer;
}
.setchip.ro { cursor: default; }
.setchip.armed { border-color: var(--over); color: var(--over); }
.sets .delset {
  flex: 0 0 auto; min-width: 34px; min-height: 34px; align-self: center;
  background: none; border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink-3); font-size: 16px; line-height: 1; cursor: pointer;
}
.sets .delset.armed { border-color: var(--over); color: var(--over); font-size: 12px; }
.sets .delset.ghost { border: none; }
.totalline { font-size: 13px; color: var(--ink-2); margin-top: 8px; }
.lastwo { font-size: 12px; color: var(--ink-3); text-transform: uppercase;
  letter-spacing: 0.06em; margin-bottom: 8px; }

.empty {
  background: var(--panel); border: 1px dashed var(--line); border-radius: 12px;
  color: var(--ink-3); font-size: 14px; padding: 18px 16px;
}

/* Signed out */
.gate { text-align: center; padding: 56px 12px; }
.gate .mark { font-size: 40px; margin-bottom: 12px; }
.gate h1 { font-size: 20px; margin-bottom: 10px; }
.gate p { color: var(--ink-2); font-size: 15px; max-width: 34ch; margin: 0 auto 6px; }
.gate .cmd {
  font-family: var(--num); background: var(--panel-2); border-radius: 6px;
  padding: 2px 8px; color: var(--live);
}
.codeform { display: grid; gap: 10px; max-width: 280px; margin: 18px auto 8px; }
.codeform input {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  color: var(--ink); font-family: var(--num); font-size: 22px; letter-spacing: 0.12em;
  text-align: center; text-transform: uppercase; min-height: 56px; width: 100%;
}
.codeform .cta { margin-top: 0; }
.gatehint { color: var(--ink-3); font-size: 13px; }

/* CTA buttons */
.cta {
  display: block; width: 100%; min-height: 56px; margin-top: 4px;
  background: var(--live); color: #0B0D12; border: none; border-radius: 12px;
  font-family: var(--sans); font-size: 17px; font-weight: 700; cursor: pointer;
}
.cta:active { filter: brightness(1.1); }
.cta.live { background: var(--good); }
.cta.log { margin-top: 14px; }

/* Discard session: quiet destructive action, visually far from Finish/Log. */
.discard {
  display: block; width: 100%; min-height: 44px; margin: 28px 0 8px;
  background: none; border: 1px solid var(--line); border-radius: 12px;
  color: var(--ink-3); font-family: var(--sans); font-size: 14px; cursor: pointer;
}
.discard.armed { border-color: var(--over); color: var(--over); }

/* Template picker */
.picker { display: grid; gap: 10px; }
.pick {
  text-align: left; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px; cursor: pointer; color: var(--ink);
  display: grid; gap: 4px; min-height: 72px; font-family: var(--sans);
}
.pick:active { background: var(--panel-2); }
.pick .pname { font-size: 17px; font-weight: 700; }
.pick .pnotes { font-size: 13px; color: var(--ink-2); }
.pick .pitems { font-size: 12px; color: var(--ink-3); }
.pick.blank { border-style: dashed; }
.pick { position: relative; }
/* Leave room for the Start button parked on the right of a workout card. */
.pick[data-open] { padding-right: 104px; }
.pick .pdone {
  margin-left: 8px; font-size: 12px; font-weight: 600; color: var(--good);
  white-space: nowrap;
}
.pick .pdone.old { color: var(--ink-3); font-weight: 400; }
.pstart {
  position: absolute; top: 50%; right: 14px; transform: translateY(-50%);
  min-height: 44px; padding: 0 18px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; color: var(--ink);
  font-family: var(--sans); font-size: 15px; font-weight: 600; cursor: pointer;
}
.pstart:active { background: var(--panel-2); }

/* Workout detail (read before starting) */
.tplnotes { color: var(--ink-2); font-size: 14px; margin: 0 0 6px; }
.tpldone { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.tpldone .pdone { margin-left: 0; font-size: 13px; font-weight: 600; color: var(--good); }
.tpldone .pdone.old { color: var(--ink-3); font-weight: 400; }
.tpldone .num { color: var(--ink-3); font-size: 13px; }
.tpllist { display: grid; gap: 8px; list-style: none; margin: 0 0 16px; padding: 0; }
.tpllist li {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px;
}
.tpllist .tlex { font-size: 16px; font-weight: 600; }
.tpllist .tltarget { color: var(--ink-2); font-size: 14px; }
.tpllist .tlnote { grid-column: 1 / -1; color: var(--ink-3); font-size: 13px; }
/* Start/finish frames. Two equal columns so the pair reads as one movement;
   a single frame (rare) still fills only half rather than blowing up. */
.tpllist .tlframes {
  grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px; margin-top: 8px;
}
.tpllist .tlframes img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px;
  background: var(--panel-2); display: block;
}
.tlempty { color: var(--ink-3); margin: 0 0 16px; }

/* Template editor */
.tpledit { display: grid; gap: 10px; }
.tpledit > input {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); font-size: 16px; min-height: 48px; padding: 0 12px;
  width: 100%;
}
.tpledit .mealedit { border: 1px solid var(--line); border-radius: 12px; }
.terow { display: flex; gap: 8px; }
.terow .te_ex { flex: 1; }
.temove {
  flex: 0 0 auto; min-width: 44px; min-height: 44px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; color: var(--ink-2);
  font-size: 16px; cursor: pointer;
}
.temove:disabled { opacity: 0.3; }
.temove.danger { color: var(--over); }
.tetimed {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  color: var(--ink-2); min-height: 24px;
}
.tetimed input { width: 18px; height: 18px; accent-color: var(--live); }
.tpledit .ghost {
  min-height: 48px; background: none; border: 1px dashed var(--line);
  border-radius: 10px; color: var(--ink-2); font-size: 15px; cursor: pointer;
}
#te_save { background: var(--live); color: #0B0D12; border: none; font-weight: 700; }
.tpledit .danger { color: var(--over); border-color: var(--over); }

/* Live session */
.pendbadge { color: var(--over); font-size: 11px; margin-left: 8px; }
.exnav {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px;
  margin-bottom: 14px; -webkit-overflow-scrolling: touch;
}
.exchip {
  flex: 0 0 auto; background: var(--panel); border: 1px solid var(--line);
  color: var(--ink-2); border-radius: 20px; padding: 0 14px; min-height: 48px;
  font-family: var(--sans); font-size: 14px; cursor: pointer; white-space: nowrap;
}
.exchip.cur { border-color: var(--live); color: var(--ink); }
.exchip.has b { color: var(--good); }
.exchip.add { border-style: dashed; }
/* Previous-exercise chip. sticky inside the horizontally scrolling strip pins
   it to the left edge, so stepping back never depends on finding a chip that
   scrolled out of view; the opaque background stops chips showing through. */
.exchip.nav {
  position: sticky; left: 0; z-index: 1; padding: 0 14px;
  font-size: 22px; line-height: 1; background: var(--panel);
}
.exchip.nav:disabled { opacity: 0.3; cursor: default; }
/* Auto-advance moves you off the exercise you just finished; this undoes it. */
.exback {
  margin-top: 10px; min-height: 44px; padding: 0 14px; background: none;
  border: 1px solid var(--line); border-radius: 10px; color: var(--ink-2);
  font-family: var(--sans); font-size: 14px; cursor: pointer;
}
.exback:active { background: var(--panel-2); }

.livecard {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px;
}
.exhead { display: flex; justify-content: space-between; align-items: baseline; }
.exname { font-size: 20px; font-weight: 700; }
.extarget { color: var(--ink-2); font-size: 15px; }
.exnote { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.exnote.hint { color: var(--live); }

.inputrow { display: grid; gap: 12px; margin-top: 16px; }
.stepper {
  display: grid; grid-template-columns: 64px 1fr 64px; gap: 8px; align-items: stretch;
}
.step {
  min-height: 64px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; color: var(--ink); font-family: var(--num);
  font-size: 20px; cursor: pointer;
}
.step:active { background: var(--line); }
/* ±5s is unavailable while the hold clock is running (paintHold owns the
   readout, and stopping the hold overwrites the value anyway). */
.step:disabled { opacity: 0.35; cursor: default; }
.stepval {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
}
.stepval .num { font-size: 34px; font-weight: 700; }
/* The load/reps readout is a real input so an exact value can be typed (an
   18 kg kettlebell is 39.7 lb, unreachable by ±5). Styled to look like the
   number it replaced: no chrome until focused. */
.stepval input.stepin {
  background: none; border: none; color: var(--ink); text-align: center;
  font-size: 34px; font-weight: 700;  /* font-family comes from .num */
  width: 4ch; min-width: 0; padding: 2px 0; border-radius: 8px;
}
.stepval input.stepin:focus {
  outline: none; background: var(--panel-2); box-shadow: 0 0 0 2px var(--line);
}
.stepval input.stepin::placeholder { color: var(--ink-3); font-weight: 700; }
.steplabel { color: var(--ink-3); font-size: 14px; }
.modebtn {
  background: none; border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink-3); font-size: 13px; min-height: 36px; padding: 0 10px;
  cursor: pointer; font-family: var(--sans);
}
/* Hold timer for timed exercises (plank, wall sit): start when the hold
   starts, stop when it breaks; elapsed seconds land in the sec stepper. */
.holdbtn {
  min-height: 64px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; color: var(--ink); font-family: var(--num);
  font-size: 20px; font-weight: 700; cursor: pointer;
}
.holdbtn.running { background: var(--live); color: #0B0D12; border-color: var(--live); }
.holdbtn:active { filter: brightness(1.1); }

.warm {
  display: flex; align-items: center; gap: 8px; margin-top: 14px;
  color: var(--ink-2); font-size: 14px; min-height: 32px;
}
.warm input { width: 20px; height: 20px; accent-color: var(--live); }
.row.pending .cal { color: var(--live); }
/* A set the server refused (4xx). It is not on its way anywhere, so it must not
   keep wearing the pending hourglass. */
.row.rejected .cal { color: var(--over); }

/* Rest overlay: the signature element. Full-bleed; the only thing readable
   from arm's length is the countdown and what's next. */
.restov {
  position: fixed; inset: 0; background: var(--bg); z-index: 50;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 18px; cursor: pointer;
  padding: 24px; text-align: center;
}
.resttime { font-size: clamp(96px, 34vw, 200px); font-weight: 700;
  color: var(--live); line-height: 1; letter-spacing: -0.02em; }
.restnext { font-size: clamp(20px, 6vw, 32px); color: var(--ink);
  font-weight: 600; max-width: 22ch; }
.resthint { color: var(--ink-3); font-size: 14px; }
.restpresets { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.restpreset {
  min-width: 56px; min-height: 44px; padding: 10px 12px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink-2); font-size: 16px; cursor: pointer;
}
.restpreset.sel { border-color: var(--live); color: var(--ink); }
/* Fix the set you just logged without giving up the rest you are owed.
   Deliberately quieter than the countdown and the presets: it must not compete
   with them from arm's length. No display property here, so [hidden] works. */
.restfix {
  min-height: 48px; padding: 0 16px; background: none;
  border: 1px solid var(--line); border-radius: 10px; color: var(--ink-2);
  font-family: var(--sans); font-size: 15px; cursor: pointer;
}
.restfix:active { background: var(--panel-2); }
.restfix[hidden] { display: none; }
/* fixLastSet disables it while it waits for the outbox to hand that set a
   server id. The label says so, but the button also has to LOOK unavailable:
   .restfix sets its own color, so the UA's disabled styling never lands. */
.restfix:disabled { opacity: 0.55; cursor: default; }

/* Summary */
.rpe { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.rpebtn {
  min-height: 52px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; color: var(--ink); font-size: 18px; cursor: pointer;
}
.rpebtn.sel { border-color: var(--live); background: var(--panel-2); }

/* Toast */
.toast {
  position: fixed; left: 16px; right: 16px; bottom: 24px; z-index: 60;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 12px; padding: 14px 16px; font-size: 15px; text-align: center;
  opacity: 0; transform: translateY(12px); transition: all 300ms ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.toast.pr { border-color: var(--good); color: var(--good); font-weight: 700; }

/* North Star */
.north .tile { padding: 14px; }
.nsrow { display: flex; justify-content: space-between; gap: 12px; }
.nsright { text-align: right; }
.north .val { font-size: 20px; margin-top: 2px; }
.nspace { font-size: 13px; color: var(--ink-2); margin-top: 12px; }
.nspace .ahead { color: var(--good); }
.nspace .behind { color: var(--over); }
.nsasof { font-size: 12px; color: var(--ink-3); margin-top: 6px; }

footer.disclaimer {
  color: var(--ink-3); font-size: 12px; text-align: center; margin-top: 36px;
}

.err { color: var(--over); text-align: center; padding: 24px 0; }

@media (prefers-reduced-motion: reduce) {
  .meter > i { transition: none; }
}
:focus-visible { outline: 2px solid var(--live); outline-offset: 2px; }

/* Goal card */
.goal-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px; display: grid; gap: 12px;
}
.goal-head {
  display: flex; justify-content: space-between; align-items: baseline;
}
.goal-head h2 { margin-bottom: 0; }
.goal-count { font-size: 15px; font-weight: 700; color: var(--live); }
.goal-empty { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.gm { display: grid; gap: 5px; }
.gm-top { display: flex; justify-content: space-between; align-items: baseline; }
.gm-label { font-size: 13px; color: var(--ink-2); }
.gm-vals { font-size: 15px; font-weight: 600; }
.gm-vals.gm-done { color: var(--good); }
.gm-bar {
  height: 6px; border-radius: 3px; background: var(--panel-2);
  border: 1px solid var(--line); overflow: hidden;
}
.gm-fill { height: 100%; background: var(--live); border-radius: 3px; }
.gm-fill.gm-done { background: var(--good); }
.gm-sub { font-size: 11px; color: var(--ink-3); }
.goal-week {
  font-size: 12px; color: var(--ink-2); border-top: 1px solid var(--line);
  padding-top: 10px;
}

/* Diagnostic build label — temporary, removed after diagnosis */
.build-label {
  text-align: center;
  font-size: 10px;
  color: var(--ink-3, #555);
  opacity: 0.5;
  margin: 8px 0 0;
  padding: 0;
  user-select: none;
}

/* Post-workout celebration */
.wincard {
  background: linear-gradient(135deg, rgba(74,222,128,.14), rgba(91,141,239,.10));
  border: 1px solid var(--good); border-radius: 12px;
  padding: 14px 16px; margin: 4px 0 12px; text-align: center;
}
.wincard .winmsg { font-size: 16px; font-weight: 700; color: var(--ink); }
.wincard .winstats { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
/* "Start another" is optional, so it reads secondary next to the win. */
.cta.again {
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--line);
}

/* Net calories: food in − movement out (no BMR). */
.netstrip {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-top: 12px; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
}
.netstrip .netcell { display: flex; flex-direction: column; align-items: center; }
.netstrip .nlabel {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-3);
}
.netstrip .nval { font-size: 20px; font-weight: 700; color: var(--ink-2); }
.netstrip .netcell.net .nval { color: var(--live); }
.netstrip .netop { font-size: 17px; color: var(--ink-3); font-weight: 700; }

/* Weekly running / walking progress */
.cardiogrid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px;
}
.cardiocard {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px;
}
.cardiocard .cclabel { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.cardiocard .ccbig {
  font-size: 22px; font-weight: 700; color: var(--ink); margin: 4px 0 2px;
}
.cardiocard .ccbig .ccunit {
  font-size: 12px; font-weight: 400; color: var(--ink-3); margin-left: 3px;
}
.cardiocard .ccsub { font-size: 12px; color: var(--ink-3); }
.wknote { font-size: 12px; color: var(--ink-3); margin: 0 0 12px; }

/* Fluid correction: subtract, set-exact, erase */
.fluidbtns { flex-wrap: wrap; justify-content: flex-end; }
.fluidsub {
  min-height: 48px; min-width: 52px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px; color: var(--ink-2);
  font-size: 17px; font-weight: 700; cursor: pointer;
}
.fluidsub:active { background: var(--line); }
.fluidedit {
  min-height: 48px; min-width: 48px; background: none;
  border: 1px dashed var(--line); border-radius: 10px; color: var(--ink-3);
  font-size: 16px; cursor: pointer;
}
.fluidedit:active { background: var(--panel-2); }
.fluidset { margin-top: 12px; }
.fluidset label {
  display: flex; flex-direction: column; gap: 6px; font-size: 13px;
  color: var(--ink-3);
}
.fluidset input {
  min-height: 48px; padding: 0 12px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; color: var(--ink);
  font-family: var(--num); font-size: 18px;
}

/* AI workout coach */
#aicoachform textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); font-family: var(--sans); font-size: 15px;
  padding: 10px; width: 100%; resize: vertical; min-height: 72px;
}
.acsummary { font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.acday {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; display: grid; gap: 4px;
}
.acday-name { font-weight: 700; font-size: 14px; }
.acday-notes { font-weight: 400; font-size: 12px; color: var(--ink-3); }
.acex { font-size: 13px; color: var(--ink-2); }
.acdel { font-size: 12px; color: var(--over); }
.meactions button[data-act="apply"] {
  background: var(--live); color: #0B0D12; border: none; font-weight: 700;
}

/* Bottom tab bar. Today grew long enough that meal prep could not live on it,
   so the app has real top-level sections now. Fixed to the bottom, with the
   page padded so the last content is never trapped underneath it. */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--panel); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tabbar .tab {
  background: none; border: none; color: var(--ink-3); cursor: pointer;
  font-family: var(--sans); display: grid; gap: 2px; justify-items: center;
  padding: 8px 4px 10px; min-height: 56px;
}
.tabbar .tab.on { color: var(--ink); }
.tabbar .tabicon { font-size: 19px; line-height: 1; }
.tabbar .tablabel { font-size: 11px; letter-spacing: 0.02em; }
.tabbar .tab:active { background: var(--panel-2); }
body { padding-bottom: 76px; }

/* Meal prep */
.prepform { display: grid; gap: 10px; margin: 0 0 12px; }
.prepform label {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  color: var(--ink-2); font-size: 14px;
}
.prepform select {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); font-family: var(--sans); font-size: 16px;
  min-height: 44px; padding: 0 10px; min-width: 96px;
}
.prepmeal { margin-bottom: 14px; }
.prepmealhead {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 6px;
}
.prepmealhead .pname { font-size: 15px; font-weight: 700; }
.prepmealhead .tltarget { color: var(--ink-2); font-size: 13px; }
.prepextras { margin: 0 0 12px; }
.prepextra {
  display: flex; align-items: center; gap: 10px; min-height: 44px;
  color: var(--ink-2); font-size: 14px;
}
.prepextra input { width: 20px; height: 20px; accent-color: var(--live); }
.prepextra .prepmeta { color: var(--ink-3); font-size: 12px; font-style: normal; }
.prepextras { max-height: 340px; overflow-y: auto; }

/* Caliper: Jackson-Pollock 7-site skinfolds. Declared after .suppgrid so the
   two-column override for sex/age wins; the inputs keep .suppgrid's styling. */
.sfmeta { grid-template-columns: 1fr 1fr; }
.sfreadout {
  font-size: 13px; color: var(--ink-3); margin: 8px 0 0; min-height: 18px;
}
.sfreadout.ok { color: var(--good); font-weight: 700; }
.sfhelp { margin-top: 8px; font-size: 12px; color: var(--ink-3); }
.sfhelp summary { min-height: 32px; padding: 6px 0; cursor: pointer; }
.sfhelp ul { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 5px; }
.sfhelp b { color: var(--ink); font-weight: 600; }
