/* Ferrum — industrial gym-iron design system.
   Materials: rubber floor (bg), powder-coated plates (surfaces), chalk (text), safety orange (one accent).
   Type: condensed DIN-family numerals for weights/reps; system sans for prose; mono for data. */
:root {
  --floor: #121314;
  --floor-2: #17191b;
  --plate: #1e2124;
  --plate-2: #262a2e;
  --plate-edge: #33383d;
  --steel: #8c9196;
  --steel-dim: #5c6167;
  --chalk: #f2efe9;
  --chalk-dim: #c9c6bf;
  --orange: #ff6b1a;
  --orange-deep: #d9520c;
  --green: #7bd88f;
  --red: #ff5a5a;
  --amber: #f5b53f;
  --num: "Bahnschrift Condensed", "Bahnschrift SemiCondensed", "Bahnschrift", "DIN Alternate", "DIN Condensed", "Arial Narrow", "Roboto Condensed", "Helvetica Neue", sans-serif;
  --sans: -apple-system, "Segoe UI", "Helvetica Neue", Roboto, Arial, sans-serif;
  --mono: "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --r: 10px;
  --tap: 52px;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--floor) radial-gradient(1200px 400px at 50% -100px, #1f2327 0%, var(--floor) 70%);
  color: var(--chalk);
  font: 16px/1.4 var(--sans);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--chalk-dim); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; color: var(--steel); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.mono { font-family: var(--mono); font-size: 13px; }
.dim { color: var(--steel); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.hidden { display: none !important; }
.sr { position: absolute; left: -9999px; }

/* ---- shell ------------------------------------------------------------- */
#app { min-height: 100%; display: flex; flex-direction: column; }
header.top {
  position: sticky; top: 0; z-index: 20;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: linear-gradient(var(--floor) 70%, transparent);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
header.top .brand { font-family: var(--num); font-size: 20px; letter-spacing: .12em; text-transform: uppercase; }
header.top .brand b { color: var(--orange); }
header.top .status { font-size: 12px; color: var(--steel); display: flex; gap: 8px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--steel-dim); display: inline-block; }
.dot.on { background: var(--green); }
.dot.off { background: var(--amber); }
main { flex: 1; padding: 0 16px calc(var(--tab-h) + var(--safe-b) + 24px); max-width: 560px; width: 100%; margin: 0 auto; }
@media (min-width: 900px) {
  main.wide { max-width: 1100px; }
  .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
}
nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: #0e0f10; border-top: 1px solid var(--plate-edge);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: stretch;
}
nav.tabs button { color: var(--steel); font-size: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; letter-spacing: .04em; text-transform: uppercase; }
nav.tabs button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
nav.tabs button.active { color: var(--chalk); }
nav.tabs button.active svg { stroke: var(--orange); }

/* ---- surfaces ------------------------------------------------------------ */
.card {
  background: linear-gradient(180deg, var(--plate-2), var(--plate));
  border: 1px solid var(--plate-edge); border-radius: var(--r);
  padding: 14px; margin: 12px 0;
  box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 6px 18px rgba(0,0,0,.35);
}
.card.flat { background: var(--plate); box-shadow: none; }
.card h3 { margin-bottom: 8px; }
.list > * + * { border-top: 1px solid var(--plate-edge); }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; min-height: var(--tap); }
.item .t { font-weight: 600; }
.item .s { color: var(--steel); font-size: 13px; }
.chev { color: var(--steel-dim); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--plate-edge); color: var(--chalk-dim); font-size: 12px; }
.pill.orange { background: var(--orange); color: #111; font-weight: 700; }
.pill.red { background: rgba(255,90,90,.18); color: var(--red); }
.pill.amber { background: rgba(245,181,63,.18); color: var(--amber); }
.pill.green { background: rgba(123,216,143,.15); color: var(--green); }
.badge-pr { font-family: var(--num); font-size: 11px; letter-spacing: .1em; color: #111; background: var(--orange); padding: 1px 6px; border-radius: 3px; }

/* ---- controls -------------------------------------------------------------- */
.btn {
  min-height: var(--tap); padding: 0 18px; border-radius: var(--r);
  background: var(--plate-2); border: 1px solid var(--plate-edge); color: var(--chalk);
  font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .06s ease, background .15s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn.primary { background: var(--orange); border-color: var(--orange-deep); color: #111; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); }
.btn.block { width: 100%; }
.btn.sm { min-height: 40px; padding: 0 12px; font-size: 14px; }
.btn.xs { min-height: 32px; padding: 0 10px; font-size: 12px; }
.btn:disabled { opacity: .45; }
.btnrow { display: flex; gap: 10px; }
.btnrow .btn { flex: 1; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: var(--r);
  background: var(--floor-2); border: 1px solid var(--plate-edge); color: var(--chalk); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--steel); }
label.f { display: block; font-size: 12px; color: var(--steel); text-transform: uppercase; letter-spacing: .06em; margin: 10px 0 4px; }
.seg { display: flex; background: var(--floor-2); border: 1px solid var(--plate-edge); border-radius: var(--r); padding: 3px; }
.seg button { flex: 1; min-height: 38px; border-radius: 7px; color: var(--steel); font-size: 13px; font-weight: 600; }
.seg button.on { background: var(--plate-edge); color: var(--chalk); }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

/* ---- workout: the numerals + stack pin -------------------------------------- */
.exhead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.exhead .name { font-size: 20px; font-weight: 700; line-height: 1.15; }
.exhead .name small { display: block; color: var(--steel); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.laststrip { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 4px; }
.laststrip .chip { font-family: var(--num); font-size: 15px; background: var(--floor-2); border: 1px solid var(--plate-edge); border-radius: 6px; padding: 3px 8px; color: var(--chalk-dim); }
.laststrip .chip.pr { border-color: var(--orange); color: var(--orange); }
.laststrip .lbl { font-size: 11px; color: var(--steel); text-transform: uppercase; letter-spacing: .08em; align-self: center; margin-right: 4px; }
.entry { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.stepper { background: var(--floor-2); border: 1px solid var(--plate-edge); border-radius: 12px; padding: 8px; text-align: center; position: relative; }
.stepper .lbl { font-size: 11px; color: var(--steel); text-transform: uppercase; letter-spacing: .1em; }
.stepper .val { font-family: var(--num); font-size: 56px; line-height: 1; padding: 6px 0 2px; color: var(--chalk); font-variant-numeric: tabular-nums; }
.stepper .val.small { font-size: 44px; }
.stepper .unit { font-size: 12px; color: var(--steel); margin-top: -2px; }
.stepper .pm { display: flex; gap: 8px; margin-top: 8px; }
.stepper .pm button { flex: 1; min-height: 48px; border-radius: 8px; background: var(--plate-2); border: 1px solid var(--plate-edge); font-family: var(--num); font-size: 22px; color: var(--chalk-dim); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.stepper .pm button:active { background: var(--plate-edge); }
.stepper .val.tap { cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
.stepper .unit { min-height: 15px; }
/* keypad sheet (askNum): readout in DIN numerals, keys like gym plates */
.kp-read { font-family: var(--num); font-size: 64px; line-height: 1; text-align: center; padding: 14px 0; color: var(--chalk); background: var(--floor-2); border: 1px solid var(--plate-edge); border-radius: 12px; font-variant-numeric: tabular-nums; }
.kp-read.fresh { color: var(--orange); }
.kpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpad .kp-key { min-height: 58px; border-radius: 10px; background: var(--plate-2); border: 1px solid var(--plate-edge); font-family: var(--num); font-size: 28px; color: var(--chalk); user-select: none; -webkit-user-select: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; cursor: pointer; }
.kpad .kp-key:active { background: var(--plate-edge); }
.kpad .kp-key.fn { color: var(--steel); }
.kpad .kp-key:disabled { visibility: hidden; }
.setopts { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
.setopts button { min-height: 32px; padding: 0 10px; border-radius: 999px; font-size: 12px; background: var(--floor-2); border: 1px solid var(--plate-edge); color: var(--steel); }
.setopts button.on { background: var(--plate-edge); color: var(--chalk); border-color: var(--steel-dim); }
.logrow { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: stretch; }
.btn.log { min-height: 64px; font-family: var(--num); font-size: 24px; letter-spacing: .12em; text-transform: uppercase; background: linear-gradient(180deg, #ff7a2f, var(--orange-deep)); border-color: #b8440a; color: #111; box-shadow: 0 4px 0 #8a3208, 0 8px 18px rgba(255,107,26,.25); }
.btn.log:active { transform: translateY(3px); box-shadow: 0 1px 0 #8a3208; }
/* the stack pin: mic button */
.pin { width: 64px; min-height: 64px; border-radius: 14px; background: linear-gradient(180deg, #3a4046, #23272b); border: 1px solid #454b52; position: relative; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 0 #101214, 0 8px 18px rgba(0,0,0,.45); }
.pin::before { content: ""; position: absolute; top: 8px; width: 22px; height: 22px; border-radius: 50%; border: 3px solid #5c6167; }
.pin svg { width: 24px; height: 24px; margin-top: 18px; stroke: var(--chalk-dim); fill: none; stroke-width: 2; }
.pin.listening { background: linear-gradient(180deg, #ff7a2f, var(--orange-deep)); border-color: #b8440a; animation: pulse 1.1s ease-in-out infinite; }
.pin.listening::before { border-color: #111; }
.pin.listening svg { stroke: #111; }
.pin:disabled { opacity: .4; }
@keyframes pulse { 0%,100% { box-shadow: 0 4px 0 #8a3208, 0 0 0 0 rgba(255,107,26,.5);} 50% { box-shadow: 0 4px 0 #8a3208, 0 0 0 14px rgba(255,107,26,0);} }
/* stacked plates = logged sets */
.plates { margin-top: 12px; }
.plate { display: grid; grid-template-columns: 34px 1fr auto auto auto; gap: 8px; align-items: center; min-height: 46px; padding: 0 10px; margin-top: 4px; border-radius: 6px; background: linear-gradient(180deg, #2c3136, #23272b); border: 1px solid var(--plate-edge); border-bottom-color: #14161a; }
.plate .idx { font-family: var(--num); color: var(--steel); font-size: 14px; }
.plate .wr { font-family: var(--num); font-size: 22px; }
.plate .wr small { font-size: 13px; color: var(--steel); margin: 0 4px; }
.plate .meta { font-size: 11px; color: var(--steel); text-transform: uppercase; letter-spacing: .06em; }
.plate .del { color: var(--steel-dim); font-size: 18px; min-width: 40px; min-height: 40px; }
.plate .formck { width: 40px; min-height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--steel-dim); }
.plate .formck svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.plate.pr { border-color: var(--orange); }
.plate.warmup { opacity: .7; }
.plate.pending { border-style: dashed; }
/* rest timer bar */
.rest { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b)); z-index: 25; background: #0e0f10; border-top: 1px solid var(--plate-edge); padding: 8px 16px; display: flex; align-items: center; gap: 12px; }
.rest .t { font-family: var(--num); font-size: 30px; min-width: 80px; }
.rest .bar { flex: 1; height: 6px; background: var(--plate-edge); border-radius: 3px; overflow: hidden; }
.rest .bar i { display: block; height: 100%; background: var(--orange); width: 0%; transition: width 1s linear; }
.rest.done .t { color: var(--green); }
/* voice confirm card */
.confirm { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tab-h) + var(--safe-b) + 12px); z-index: 40; background: var(--plate-2); border: 1px solid var(--orange); border-radius: 12px; padding: 12px 14px; box-shadow: 0 12px 30px rgba(0,0,0,.6); }
.confirm .heard { font-size: 12px; color: var(--steel); font-style: italic; }
.confirm .parsed { font-family: var(--num); font-size: 30px; margin: 4px 0; }
.confirm .parsed small { font-size: 14px; color: var(--steel); font-family: var(--sans); }
.confirm .prog { height: 3px; background: var(--plate-edge); margin: 8px -14px -12px; border-radius: 0 0 12px 12px; overflow: hidden; }
.confirm .prog i { display: block; height: 100%; background: var(--orange); width: 100%; transform-origin: left; }
@keyframes shrink { from { transform: scaleX(1);} to { transform: scaleX(0);} }
.cands { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.cands button { min-height: 34px; padding: 0 10px; border-radius: 8px; background: var(--floor-2); border: 1px solid var(--plate-edge); font-size: 13px; }
.cands button.on { border-color: var(--orange); color: var(--orange); }
/* quick re-log (Fuel > Today): chips are plate tags, label in chalk, kcal stamped in orange */
.repeat { margin-top: 12px; border-top: 1px solid var(--plate-edge); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.repeat .rhead { display: flex; justify-content: space-between; align-items: center; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--steel); font-weight: 600; }
.repeat .rrow { display: flex; flex-wrap: wrap; gap: 8px; }
.repeat .qchip { display: inline-flex; align-items: baseline; gap: 8px; min-height: 40px; padding: 8px 12px; background: var(--floor-2); color: var(--chalk); border: 1px solid var(--plate-edge); border-radius: 6px; font: 600 14px var(--sans); cursor: pointer; max-width: 100%; text-align: left; }
.repeat .qchip b { font-family: var(--num); color: var(--orange); font-weight: 600; }
.repeat .qchip.qday { border-color: var(--chalk-dim); text-transform: capitalize; }
.repeat .qchip.saved { border-color: var(--orange-deep); }
.repeat .qchip:active { background: var(--plate); }
.repeat.match { margin-top: 0; border: 1px solid var(--orange); border-radius: var(--r); padding: 10px; }
.mealhead { display: flex; justify-content: space-between; align-items: center; padding: 10px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--steel); font-weight: 600; }
.mealhead b { font-family: var(--num); color: var(--chalk-dim); font-weight: 600; }
.toast.undo { display: flex; align-items: center; gap: 14px; }
.toast.undo button { background: #111; color: var(--chalk); border: 0; border-radius: 999px; padding: 4px 12px; font-weight: 700; cursor: pointer; }

/* toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + var(--safe-b) + 16px); z-index: 50; background: var(--chalk); color: #111; padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; box-shadow: 0 8px 20px rgba(0,0,0,.5); animation: fadein .2s; }
.toast.pr { background: var(--orange); }
@keyframes fadein { from { opacity: 0; transform: translate(-50%, 8px);} to { opacity: 1; transform: translate(-50%, 0);} }
/* warnings */
.warn { border-left: 3px solid var(--amber); background: rgba(245,181,63,.08); padding: 8px 10px; border-radius: 6px; font-size: 13px; margin: 8px 0; }
.warn.high { border-color: var(--red); background: rgba(255,90,90,.08); }
/* sheets / modals */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: var(--plate); border-radius: 16px 16px 0 0; border-top: 1px solid var(--plate-edge); padding: 12px 16px calc(16px + var(--safe-b)); }
@media (min-width: 900px) { .sheet-bg { align-items: center; } .sheet { border-radius: 16px; max-height: 85vh; } }
.sheet .handle { width: 40px; height: 4px; border-radius: 2px; background: var(--plate-edge); margin: 0 auto 10px; }
.sheet h2 { margin-bottom: 8px; }
.search { position: sticky; top: 0; background: var(--plate); padding-bottom: 8px; z-index: 2; }
/* exercise picker */
.exlist .item { padding: 10px 0; }
.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--floor-2); border: 1px solid var(--plate-edge); flex: none; }
.thumb.ph { display: flex; align-items: center; justify-content: center; color: var(--steel-dim); font-family: var(--num); font-size: 16px; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.mcard { background: var(--floor-2); border: 1px solid var(--plate-edge); border-radius: 10px; overflow: hidden; text-align: left; }
.mcard img, .mcard .noimg { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--plate-2); }
.mcard .noimg { display: flex; align-items: center; justify-content: center; color: var(--steel-dim); font-family: var(--num); font-size: 28px; }
.mcard .cap { padding: 8px 10px; font-size: 13px; font-weight: 600; }
.mcard .cap small { display: block; color: var(--steel); font-weight: 400; font-size: 11px; }
/* dashboard tiles */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { background: var(--floor-2); border: 1px solid var(--plate-edge); border-radius: 10px; padding: 12px; }
.tile .k { font-size: 11px; color: var(--steel); text-transform: uppercase; letter-spacing: .08em; }
.tile .v { font-family: var(--num); font-size: 32px; line-height: 1.1; margin-top: 2px; }
.tile .v small { font-size: 14px; color: var(--steel); }
/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--plate-edge); stroke-width: 1; }
.chart .lbl { fill: var(--steel); font-size: 10px; font-family: var(--mono); }
.chart .line { fill: none; stroke: var(--orange); stroke-width: 2; }
.chart .line2 { fill: none; stroke: var(--steel); stroke-width: 1.5; stroke-dasharray: 3 3; }
.chart .bar { fill: var(--steel-dim); }
.chart .bar.cur { fill: var(--orange); }
.chart .pt { fill: var(--orange); }
/* body map */
.bodymap { width: 100%; max-width: 360px; margin: 0 auto; display: block; }
.bodymap path, .bodymap ellipse, .bodymap rect { stroke: var(--plate-edge); stroke-width: 1; fill: var(--floor-2); transition: fill .3s; }
.legend { display: flex; gap: 12px; justify-content: center; font-size: 11px; color: var(--steel); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }
/* photos */
.pgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pgrid img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 6px; border: 1px solid var(--plate-edge); }
.pgrid .sel img { outline: 2px solid var(--orange); }
.pgrid figcaption { font-size: 11px; color: var(--steel); text-align: center; margin-top: 2px; }
.pgrid figure, .phwrap { position: relative; }
.pdel { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(10,10,12,.65); color: var(--chalk); border: 1px solid var(--plate-edge);
  font-size: 15px; line-height: 1; display: flex; align-items: center; justify-content: center; z-index: 2; }
.pdel:active { background: var(--red, #b3261e); }
.compare { position: relative; aspect-ratio: 3/4; overflow: hidden; border-radius: 10px; border: 1px solid var(--plate-edge); background: #000; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.compare .after { clip-path: inset(0 0 0 50%); }
.compare input[type=range] { position: absolute; left: 0; right: 0; bottom: 8px; width: 100%; }
.compare .divider { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--orange); left: 50%; pointer-events: none; }
/* camera ghost overlay only - img, never .btn.ghost buttons (v10 bug: full-viewport dark box + phantom text) */
img.ghost { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .35; pointer-events: none; }
.rowx { color: var(--steel-dim); font-size: 18px; line-height: 1; padding: 8px 6px; margin: -8px -6px -8px 0; background: none; border: 0; }
.rowx:active { color: var(--red); }
.camwrap { position: relative; aspect-ratio: 3/4; background: #000; border-radius: 10px; overflow: hidden; }
.camwrap video { width: 100%; height: 100%; object-fit: cover; }
/* review */
.review h4 { margin: 12px 0 4px; font-size: 13px; color: var(--steel); text-transform: uppercase; letter-spacing: .06em; }
.review ul { margin: 0; padding-left: 18px; }
.review li { margin: 3px 0; }
.headline { font-size: 18px; font-weight: 700; line-height: 1.3; }
/* misc */
.empty { text-align: center; color: var(--steel); padding: 28px 12px; }
.empty b { display: block; color: var(--chalk-dim); margin-bottom: 4px; }
hr { border: 0; border-top: 1px solid var(--plate-edge); margin: 12px 0; }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--plate-edge); border-top-color: var(--orange); border-radius: 50%; animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg);} }
.qr svg { width: 180px; height: 180px; background: #fff; padding: 8px; border-radius: 8px; }
table.data { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; }
table.data th, table.data td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--plate-edge); }
table.data th { color: var(--steel); font-weight: 500; }
table.data td.n { text-align: right; font-family: var(--num); font-size: 15px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- stack checklist + caffeine clock ---- */
.chklist { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.chk { display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-radius: 8px; background: var(--floor-2); border: 1px solid var(--plate-edge); cursor: pointer; min-height: var(--tap); }
.chk .box { width: 24px; height: 24px; border-radius: 5px; border: 2px solid var(--steel-dim); display: grid; place-items: center; font-family: var(--num); font-size: 16px; color: var(--floor); flex: none; }
.chk.on { border-color: rgba(58,160,92,.4); }
.chk.on .box { background: var(--green); border-color: var(--green); }
.chk .t { font-weight: 600; font-size: 14px; }
.chk .s { font-size: 12px; color: var(--steel); }
.chk.on .t { color: var(--chalk-dim); text-decoration: line-through; text-decoration-color: var(--steel-dim); }
.chk .due { font-family: var(--num); font-size: 15px; color: var(--orange); letter-spacing: .5px; }
.caff { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: var(--floor-2); border-left: 3px solid var(--green); }
.caff.over { border-left-color: var(--red); }
.caff .lbl { font-family: var(--mono); font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--steel); }
.caff .hl { font-family: var(--num); font-size: 15px; margin: 2px 0; }
.caff.over .hl { color: var(--red); }
.adh { display: inline-flex; gap: 2px; }
.adh i { width: 6px; height: 12px; border-radius: 1px; background: var(--plate-edge); display: block; }
.adh i.taken { background: var(--green); }
.adh i.missed { background: var(--red); opacity: .8; }
.adh i.pending { background: var(--amber); }
.adh i.off { background: var(--plate-edge); opacity: .5; }
/* ---- machine settings memory ---- */
.msettings { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 6px; padding: 6px 10px; border-radius: 6px; background: var(--floor-2); border: 1px dashed var(--plate-edge); cursor: pointer; }
.msettings .lbl { font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--steel); }
.msettings .val { font-family: var(--num); font-size: 16px; color: var(--orange); letter-spacing: .5px; }
.msettings .val.dim { color: var(--steel); font-family: var(--sans); font-size: 13px; }
/* ---- coach chat ---- */
.chat { display: flex; flex-direction: column; height: min(78vh, 720px); }
.chatlog { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 6px 0; }
.bub { max-width: 92%; padding: 9px 12px; border-radius: 12px; font-size: 14px; line-height: 1.4; white-space: pre-wrap; }
.bub.user { align-self: flex-end; background: var(--orange-deep); color: #fff; border-bottom-right-radius: 3px; }
.bub.assistant { align-self: flex-start; background: var(--floor-2); border: 1px solid var(--plate-edge); border-bottom-left-radius: 3px; }
.bub.thinking { color: var(--steel); font-style: italic; }
.sugg { display: flex; gap: 8px; align-items: center; margin-top: 8px; padding: 8px; border-radius: 8px; background: var(--floor); border: 1px solid var(--plate-edge); font-size: 13px; }
.sugg.ok { border-color: rgba(58,160,92,.5); }
.chatin { display: flex; gap: 6px; align-items: flex-end; padding-top: 8px; border-top: 1px solid var(--plate-edge); }
.chatin textarea { flex: 1; resize: none; min-height: 44px; }
/* ---- posing + form check ---- */
.count { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--num); font-size: 120px; color: var(--orange); text-shadow: 0 2px 12px rgba(0,0,0,.7); pointer-events: none; }
.cue { padding: 8px 10px; border-radius: 6px; background: var(--floor-2); border-left: 3px solid var(--orange); font-size: 14px; }
.camwrap video.mirror { transform: scaleX(-1); }
.frames { display: flex; gap: 3px; overflow-x: auto; margin-top: 6px; }
.frames img { height: 56px; border-radius: 4px; border: 1px solid var(--plate-edge); }
.score { font-family: var(--num); font-size: 40px; color: var(--orange); line-height: 1; }
.score small { font-size: 14px; color: var(--steel); }
.stackcard h3 span { font-family: var(--num); }

/* ---------------------------------------------------------------- Diet (views4.js) */
.dt-lbl { font-size: 11px; color: var(--steel); text-transform: uppercase; letter-spacing: .08em; }
.dt-card { cursor: pointer; }
.dt-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 4px; }
.dt-big { font-family: var(--num); font-size: 28px; line-height: 1.1; }
.dt-big.sm { font-size: 22px; }
.dt-big small { font-size: 13px; color: var(--steel); }
.dt-big.over, .dt-huge.over, .dt-red { color: var(--red); }
.dt-green { color: var(--green); }
.dt h4 { margin: 14px 0 6px; font-size: 12px; color: var(--steel); text-transform: uppercase; letter-spacing: .08em; }
.dt-intro ol { padding-left: 18px; line-height: 1.5; }
.dt-intro li { margin-bottom: 6px; }
/* balance-beam scale: machined rail, orange poise at trend weight, steel notch at glide path */
.beam { position: relative; height: 84px; margin: 18px 8px 0; }
.beam .rail { position: absolute; left: 0; right: 0; top: 22px; height: 12px; border-radius: 3px;
  background: linear-gradient(180deg, #4a5056, #2a2e32 55%, #1d2023); border: 1px solid #555b61; box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 3px 8px rgba(0,0,0,.5); }
.beam .rail i { position: absolute; top: 12px; width: 1px; height: 8px; background: var(--steel); }
.beam .rail i span { position: absolute; top: 9px; left: -12px; width: 24px; text-align: center; font-family: var(--num); font-size: 11px; color: var(--steel); }
.beam .glide { position: absolute; top: 60px; margin-left: -6px; width: 0; height: 0; border: 6px solid transparent; border-bottom-color: var(--chalk-dim); border-top: 0; }
.beam .glide::after { content: "PLAN"; position: absolute; top: 7px; left: -14px; width: 28px; text-align: center; font-size: 9px; letter-spacing: .08em; color: var(--chalk-dim); }
.beam .poise { position: absolute; top: 0; margin-left: -26px; width: 52px; height: 42px; border-radius: 5px;
  background: linear-gradient(180deg, #ff8a45, var(--orange) 45%, #c24d0c); border: 1px solid #8a3208; box-shadow: 0 3px 0 #6d2806, 0 6px 14px rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; transition: left .6s ease; }
.beam .poise b { font-family: var(--num); font-size: 17px; color: #111; }
.beam .poise::after { content: ""; position: absolute; bottom: -7px; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: #c24d0c; border-bottom: 0; }
.dt-weigh { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.dt-weigh input { flex: 1; min-width: 0; }
.dt-today { display: flex; align-items: flex-end; gap: 16px; }
.dt-huge { font-family: var(--num); font-size: 64px; line-height: .95; color: var(--chalk); }
.dt-side { display: flex; flex-direction: column; gap: 2px; padding-bottom: 6px; }
.dt-fuel { position: relative; height: 14px; background: var(--floor-2); border: 1px solid var(--plate-edge); border-radius: 4px; overflow: hidden; margin: 12px 0 6px; }
.dt-fuel i { position: absolute; top: 0; bottom: 0; }
.dt-fuel .eaten { left: 0; background: var(--orange); }
.dt-fuel .eaten.over { background: var(--red); }
.dt-fuel .proj { background: repeating-linear-gradient(135deg, rgba(255,107,26,.45) 0 5px, transparent 5px 9px); }
.dt-forecast { font-size: 13px; padding: 6px 0; }
.dt-forecast.hot { color: var(--amber); }
.dt-macro { margin-top: 8px; font-size: 12px; }
.dt-track { height: 6px; background: var(--floor-2); border-radius: 3px; overflow: hidden; margin-top: 3px; }
.dt-track i { display: block; height: 100%; background: var(--steel); }
.dt-track i.over { background: var(--red); }
.dt-conf .dt-track i { background: var(--orange); }
.dt-conf { margin-top: 12px; }
.dt-bank { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 8px; }
.dt-bank .col { text-align: center; }
.dt-bank .stack { position: relative; height: 90px; background: var(--floor-2); border-radius: 4px; }
.dt-bank .stack i { position: absolute; bottom: 0; left: 0; right: 0; }
.dt-bank .stack .budget { border-top: 2px dashed var(--steel); }
.dt-bank .stack .eat { left: 18%; right: 18%; background: var(--orange); border-radius: 2px 2px 0 0; opacity: .9; }
.dt-bank .stack .eat.over { background: var(--red); }
.dt-bank .stack .eat.unlogged { background: transparent; border: 1px dashed var(--plate-edge); }
.dt-bank .col.today .stack { outline: 1px solid var(--orange); }
.dt-bank .d { font-size: 11px; color: var(--steel); margin-top: 3px; }
.dt-bank .col.train .d::after { content: " ▲"; color: var(--orange); font-size: 8px; }
.dt-bank .n { font-family: var(--num); font-size: 12px; }
.dt-bank .col.future .n { color: var(--steel); }
.dt-key { display: inline-block; width: 14px; height: 0; vertical-align: middle; border-top: 2px solid var(--orange); }
.dt-key.s { border-top: 2px dashed var(--steel); }
.dt-actions { display: flex; flex-direction: column; gap: 6px; }
.dt-actions .act { display: flex; gap: 10px; align-items: center; background: var(--floor-2); border: 1px solid var(--plate-edge); border-left: 3px solid var(--steel); border-radius: 6px; padding: 8px 10px; }
.dt-actions .act.gap, .dt-actions .act.swap, .dt-actions .act.weekend, .dt-actions .act.late { border-left-color: var(--orange); }
.dt-actions .act.protein { border-left-color: var(--green); }
.dt-actions .act.under { border-left-color: var(--amber); }
.dt-actions .kc { font-family: var(--num); font-size: 20px; min-width: 58px; text-align: right; line-height: 1; }
.dt-actions .kc small { display: block; font-size: 10px; color: var(--steel); }
.dt-actions .tx { font-size: 13px; flex: 1; }
.dt-meals .m { display: grid; grid-template-columns: 76px 1fr 80px; gap: 8px; align-items: center; font-size: 13px; margin: 5px 0; }
.dt-meals .trk { position: relative; height: 12px; background: var(--floor-2); border-radius: 3px; }
.dt-meals .trk i { position: absolute; top: 0; bottom: 0; left: 0; }
.dt-meals .trk .avg { top: 3px; bottom: 3px; background: var(--steel); border-radius: 2px; }
.dt-meals .trk .avg.over { background: var(--orange); }
.dt-meals .trk .bud { border-right: 2px solid var(--chalk); }
.dt-meals .num { text-align: right; }
.dt-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--steel); vertical-align: middle; flex: none; }
.dt-dot.green { background: var(--green); } .dt-dot.amber { background: var(--amber); } .dt-dot.orange { background: var(--orange); }
.dt-checkins .ci { border-bottom: 1px solid var(--plate-edge); padding: 8px 0; }
.dt-checkins .ci:last-child { border-bottom: 0; }
.dt-review .headline { font-size: 15px; font-weight: 600; }
.dt-rate button { display: flex; flex-direction: column; align-items: center; min-height: 48px; }
.dt-rate button small { font-size: 10px; font-weight: 400; color: var(--steel); }
.dt-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dt-days button { min-height: 36px; border-radius: 6px; background: var(--floor-2); border: 1px solid var(--plate-edge); color: var(--steel); font-size: 12px; }
.dt-days button.on { background: var(--orange); border-color: #b8440a; color: #111; font-weight: 700; }
.dt-preview { background: var(--floor-2); border: 1px solid var(--plate-edge); border-radius: var(--r); padding: 10px; }
.dt-preview .tiles { grid-template-columns: repeat(2, 1fr); gap: 6px; }
.dt-setup .row > div { flex: 1; min-width: 0; }
.dt-setup .row input { width: 100%; }
.dt-preview .tile { padding: 8px; }
.dt-preview .tile .v { font-size: 20px; }

/* ---- cloud: account card, Siri key ------------------------------------- */
details.pw { margin-top: 10px; }
details.pw summary { cursor: pointer; color: var(--chalk-dim); }
.keyline { margin: 8px 0; padding: 10px; border: 1px dashed var(--steel-dim); border-radius: 8px; word-break: break-all; user-select: all; -webkit-user-select: all; }
