/* Food Log · Noir, polished. Fonts are self-hosted; see scripts/build.ts. */
@font-face { font-family: Geist; font-weight: 200; font-display: swap; src: url("/fonts/geist-sans-200.woff2") format("woff2"); }
@font-face { font-family: Geist; font-weight: 300; font-display: swap; src: url("/fonts/geist-sans-300.woff2") format("woff2"); }
@font-face { font-family: Geist; font-weight: 400; font-display: swap; src: url("/fonts/geist-sans-400.woff2") format("woff2"); }
@font-face { font-family: Geist; font-weight: 500; font-display: swap; src: url("/fonts/geist-sans-500.woff2") format("woff2"); }
@font-face { font-family: Geist; font-weight: 600; font-display: swap; src: url("/fonts/geist-sans-600.woff2") format("woff2"); }
@font-face { font-family: "Geist Mono"; font-weight: 400; font-display: swap; src: url("/fonts/geist-mono-400.woff2") format("woff2"); }
@font-face { font-family: "Geist Mono"; font-weight: 500; font-display: swap; src: url("/fonts/geist-mono-500.woff2") format("woff2"); }
@font-face { font-family: Tomorrow; font-weight: 200; font-display: swap; src: url("/fonts/tomorrow-200.woff2") format("woff2"); }
@font-face { font-family: Tomorrow; font-weight: 300; font-display: swap; src: url("/fonts/tomorrow-300.woff2") format("woff2"); }
@font-face { font-family: Tomorrow; font-weight: 400; font-display: swap; src: url("/fonts/tomorrow-400.woff2") format("woff2"); }
@font-face { font-family: Tomorrow; font-weight: 500; font-display: swap; src: url("/fonts/tomorrow-500.woff2") format("woff2"); }
@font-face { font-family: Jura; font-weight: 300; font-display: swap; src: url("/fonts/jura-300.woff2") format("woff2"); }
@font-face { font-family: Jura; font-weight: 400; font-display: swap; src: url("/fonts/jura-400.woff2") format("woff2"); }
@font-face { font-family: Jura; font-weight: 500; font-display: swap; src: url("/fonts/jura-500.woff2") format("woff2"); }
@font-face { font-family: Jura; font-weight: 600; font-display: swap; src: url("/fonts/jura-600.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 300; font-display: swap; src: url("/fonts/jetbrains-mono-300.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url("/fonts/jetbrains-mono-400.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap; src: url("/fonts/jetbrains-mono-500.woff2") format("woff2"); }
@font-face { font-family: "Lexend Exa"; font-weight: 200; font-display: swap; src: url("/fonts/lexend-exa-200.woff2") format("woff2"); }
@font-face { font-family: "Lexend Exa"; font-weight: 300; font-display: swap; src: url("/fonts/lexend-exa-300.woff2") format("woff2"); }
@font-face { font-family: "Lexend Exa"; font-weight: 400; font-display: swap; src: url("/fonts/lexend-exa-400.woff2") format("woff2"); }
@font-face { font-family: "Lexend Exa"; font-weight: 500; font-display: swap; src: url("/fonts/lexend-exa-500.woff2") format("woff2"); }
@font-face { font-family: "Azeret Mono"; font-weight: 200; font-display: swap; src: url("/fonts/azeret-mono-200.woff2") format("woff2"); }
@font-face { font-family: "Azeret Mono"; font-weight: 300; font-display: swap; src: url("/fonts/azeret-mono-300.woff2") format("woff2"); }
@font-face { font-family: "Azeret Mono"; font-weight: 400; font-display: swap; src: url("/fonts/azeret-mono-400.woff2") format("woff2"); }
@font-face { font-family: "Azeret Mono"; font-weight: 500; font-display: swap; src: url("/fonts/azeret-mono-500.woff2") format("woff2"); }
@font-face { font-family: "Saira Semi Condensed"; font-weight: 200; font-display: swap; src: url("/fonts/saira-semi-condensed-200.woff2") format("woff2"); }
@font-face { font-family: "Saira Semi Condensed"; font-weight: 300; font-display: swap; src: url("/fonts/saira-semi-condensed-300.woff2") format("woff2"); }
@font-face { font-family: "Saira Semi Condensed"; font-weight: 400; font-display: swap; src: url("/fonts/saira-semi-condensed-400.woff2") format("woff2"); }
@font-face { font-family: "Saira Semi Condensed"; font-weight: 500; font-display: swap; src: url("/fonts/saira-semi-condensed-500.woff2") format("woff2"); }

/* ─── Tokens ─── */
:root {
  --ac: oklch(0.78 0.02 250);
  --fs: Geist, system-ui, sans-serif;
  --fm: "Geist Mono", ui-monospace, monospace;
  --text-1: #f4f4f5;
  --text-food: #e6e6e9;
  --text-2: #a1a1a8;
  --text-3: #77777d;
  --text-4: #5e5e64;
  --text-4b: #66666c;
  --text-5: #55555b;
  --hair: #141416;
  --line: #1f1f22;
  --inset: #040405;
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  --card:
    linear-gradient(180deg, #0e0e10, #08080a) padding-box,
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.025) 45%, rgba(255, 255, 255, 0.05)) border-box;
  --primary:
    linear-gradient(180deg, color-mix(in oklch, var(--ac) 16%, #060607), #050506) padding-box,
    linear-gradient(180deg, color-mix(in oklch, var(--ac) 70%, transparent), color-mix(in oklch, var(--ac) 15%, transparent)) border-box;
}
[data-accent="steel"] { --ac: oklch(0.78 0.02 250); }
[data-accent="copper"] { --ac: oklch(0.72 0.12 55); }
[data-accent="glacier"] { --ac: oklch(0.78 0.075 228); }
[data-accent="oxblood"] { --ac: oklch(0.58 0.22 25); }
[data-accent="iris"] { --ac: oklch(0.72 0.1 285); }
[data-accent="volt"] { --ac: oklch(0.9 0.2 125); }

[data-font="tomorrow"] { --fs: Tomorrow, sans-serif; --fm: Tomorrow, sans-serif; }
[data-font="jura"] { --fs: Jura, sans-serif; --fm: "JetBrains Mono", monospace; }
[data-font="lexend"] { --fs: "Lexend Exa", sans-serif; --fm: "Azeret Mono", monospace; }
[data-font="azeret"] { --fs: "Azeret Mono", monospace; --fm: "Azeret Mono", monospace; }
[data-font="saira"] { --fs: "Saira Semi Condensed", sans-serif; --fm: "Saira Semi Condensed", sans-serif; }

/* ─── Base ─── */
* { box-sizing: border-box; }
html { color-scheme: dark; background: #000; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(120% 420px at 50% -60px, color-mix(in oklch, var(--ac) 9%, transparent), transparent 70%) no-repeat,
    #000;
  color: var(--text-1);
  font-family: var(--fs);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; margin: 0; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
button:disabled { cursor: default; }
input { outline: none; }
input::placeholder { color: var(--text-5); }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
:focus-visible { outline: 1px solid color-mix(in oklch, var(--ac) 70%, transparent); outline-offset: 2px; }
h1 { margin: 0; font: 400 28px/1 var(--fs); letter-spacing: -0.035em; }
p { margin: 0; }

/* ─── Type helpers ─── */
.label {
  font: 500 10px/1 var(--fm);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}
.label.wide { letter-spacing: 0.2em; }
.accent, .label.accent { color: var(--ac); }
.micro { font: 500 9.5px/1 var(--fm); letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-4); }
.meta { font: 400 10.5px/1 var(--fm); color: var(--text-4); letter-spacing: 0.01em; }
.quiet { font: 400 13px/1.5 var(--fs); color: var(--text-2); }
.lead { padding: 0 4px; }
.dim { color: var(--text-4b); }
.warn { font: 400 13px/1.4 var(--fs); color: oklch(0.72 0.16 25); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pip { width: 5px; height: 5px; border-radius: 50%; flex: none; display: inline-block; box-sizing: border-box; border: 1px solid currentColor; }
.pip.fill { background: currentColor; }
.pip.glow { background: currentColor; box-shadow: 0 0 6px currentColor; }

/* ─── Shell ─── */
.app.phone .main {
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 18px) 16px calc(env(safe-area-inset-bottom) + 112px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
}
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: max(66px, calc(52px + env(safe-area-inset-bottom)));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 10px 18px env(safe-area-inset-bottom);
  border-top: 1px solid #121214;
  background: rgba(0, 0, 0, 0.92);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  z-index: 10;
}
.tabbar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-5);
  font: 500 10px/1 var(--fs);
  letter-spacing: 0.02em;
  text-align: center;
}
.tabbar button.on { color: var(--text-1); }
.tabbar svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.tab-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--ac); box-shadow: 0 0 6px var(--ac); opacity: 0; }
.tabbar .on .tab-dot { opacity: 1; }

.app.desk { display: flex; min-height: 100dvh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  width: 212px;
  flex: none;
  padding: 24px 14px;
  border-right: 1px solid #121214;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-kicker { color: var(--text-5); padding: 0 10px 16px; }
.nav {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--text-3);
  font: 400 14px/1 var(--fs);
}
.nav:hover { color: var(--text-2); }
.nav.on { background: #0c0c0e; border-color: #18181b; color: var(--text-1); }
.nav .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ac); box-shadow: 0 0 6px var(--ac); opacity: 0; }
.nav.on .dot { opacity: 1; }
.app.desk .main {
  flex: 1;
  min-width: 0;
  max-width: 1320px;
  padding: 28px 30px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.app.desk h1 { font-size: 32px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 84px);
  transform: translate(-50%, 8px);
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  border-radius: 99px;
  border: 1px solid #2a2a2e;
  background: rgba(12, 12, 14, 0.94);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font: 400 12.5px/1.2 var(--fs);
  color: var(--text-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease-out, transform 0.18s ease-out;
  z-index: 20;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.app.desk + .toast { bottom: 24px; }

/* ─── Header ─── */
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 4px 6px; }
.app.desk .head { align-items: flex-end; padding: 0; }
.titles { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.app.desk .titles { gap: 9px; }
.head-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.app.desk .head-actions { gap: 10px; }

.seg { display: flex; padding: 3px; border-radius: 11px; border: 1px solid #1d1d20; background: #08080a; }
.seg button {
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--text-3);
  font: 500 12px/1 var(--fs);
  white-space: nowrap;
}
.app.desk .seg button { padding: 0 13px; }
.seg button.on { background: #1a1a1d; color: var(--text-1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.seg button:disabled:not(.on) { opacity: 0.4; }

.chip-btn {
  height: 28px;
  padding: 0 11px;
  border-radius: 99px;
  border: 1px solid #2a2a2e;
  color: var(--text-3);
  font: 400 10.5px/1 var(--fm);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.chip-btn:hover { color: var(--text-2); }

/* ─── Cards ─── */
.card { border-radius: 22px; border: 1px solid transparent; background: var(--card); min-width: 0; }
.pad { padding: 16px; }
.empty { display: flex; flex-direction: column; gap: 10px; }

/* Energy gauge */
.gauge {
  position: relative;
  border-radius: 24px;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}
.gauge > .row { align-self: stretch; }
.gauge-glow {
  position: absolute;
  left: 50%;
  top: 60px;
  width: 260px;
  height: 140px;
  margin-left: -130px;
  background: radial-gradient(closest-side, color-mix(in oklch, var(--ac) 12%, transparent), transparent);
  pointer-events: none;
}
.dial { position: relative; width: 280px; height: 150px; margin-top: 14px; }
.dial svg { position: absolute; inset: 0; overflow: visible; }
.dial path { fill: none; }
.g-ticks { stroke: #242428; stroke-width: 5; stroke-dasharray: 0.25 1.75; }
.g-track { stroke: #17171a; stroke-width: 3; stroke-linecap: round; }
.g-plan { stroke: color-mix(in oklch, var(--ac) 28%, transparent); stroke-width: 3; stroke-linecap: round; }
.g-eaten { stroke: var(--ac); stroke-width: 3; stroke-linecap: round; filter: drop-shadow(0 0 6px var(--ac)); }
.g-tip { fill: #000; stroke: var(--ac); stroke-width: 2; filter: drop-shadow(0 0 6px var(--ac)); }
.g-tipwrap { transform-box: view-box; transform-origin: 140px 140px; }
.g-halo { fill: var(--ac); opacity: 0.1; }
.dial-num { position: absolute; left: 0; right: 0; top: 50px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.hero {
  font: 200 68px/1 var(--fs);
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stat-row {
  align-self: stretch;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #151517;
}
.stat-row > div { display: flex; flex-direction: column; gap: 7px; }
.stat-row .mid { align-items: center; }
.stat-row .end { align-items: flex-end; }
.num { font: 400 15px/1 var(--fm); font-variant-numeric: tabular-nums; }
.dim2 { color: var(--text-2); }

/* Protein / weight */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-card { display: flex; flex-direction: column; gap: 12px; text-align: left; width: 100%; }
.weight-card { gap: 10px; }
.weight-card .plus { color: var(--text-5); font: 300 16px/1 var(--fs); letter-spacing: 0; margin: -4px -2px 0 0; }
.weight-card.open .plus, .weight-card:hover .plus { color: var(--ac); }
.stat { display: flex; align-items: baseline; gap: 5px; }
.stat-num { font: 200 40px/1 var(--fs); letter-spacing: -0.045em; font-variant-numeric: tabular-nums; }
.unit { font: 400 11px/1 var(--fm); color: var(--text-3); }
.status { font: 400 12px/1.2 var(--fs); color: var(--text-2); }
.status.dim { color: var(--text-3); }
.status.strong { font-size: 13px; }
.meter { position: relative; height: 3px; border-radius: 99px; background: #1a1a1d; }
.meter span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; }
.meter-plan { background: color-mix(in oklch, var(--ac) 28%, transparent); }
.meter-eaten { background: var(--ac); box-shadow: 0 0 8px var(--ac); }

/* Weight entry */
.weigh {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 6px 0 14px;
  border-radius: 13px;
  background: var(--inset);
  border: 1px solid var(--line);
}
.weigh:focus-within { border-color: color-mix(in oklch, var(--ac) 40%, #222226); }
.weigh .label { white-space: nowrap; }
.weigh-kg {
  flex: 1;
  min-width: 0;
  width: 100%;
  text-align: right;
  background: none;
  border: 0;
  font: 200 26px/1 var(--fs);
  font-variant-numeric: tabular-nums;
}
.weigh-date {
  height: 36px;
  padding: 0 8px;
  border-radius: 9px;
  border: 1px solid #18181b;
  background: #08080a;
  color: var(--text-2);
  font: 400 12px/1 var(--fm);
  color-scheme: dark;
  min-width: 0;
}
.save-btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #2a2a2e;
  background: #0e0e10;
  color: var(--ac);
  font: 500 10.5px/1 var(--fm);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  flex: none;
}
.icon-btn {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--text-3);
  font: 400 14px/1 var(--fs);
  display: grid;
  place-items: center;
}

/* ─── Bar charts ─── */
.bars { padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 14px; }
.aside { display: flex; align-items: center; gap: 6px; }
.dash { width: 12px; border-top: 1px dashed var(--text-5); display: inline-block; }
.plot { position: relative; margin-top: 10px; display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: 100%; }
.guide { position: absolute; left: 0; right: 0; border-top: 1px dashed #3a3a3e; pointer-events: none; }
.b-col { height: 100%; display: flex; align-items: flex-end; justify-content: center; min-width: 0; }
.b-bar {
  position: relative;
  width: 20px;
  border-radius: 7px 7px 3px 3px;
  border: 1px solid transparent;
  background: linear-gradient(180deg, color-mix(in oklch, var(--ac) 46%, #141416), color-mix(in oklch, var(--ac) 6%, #0a0a0b));
}
.b-bar.today { border-color: color-mix(in oklch, var(--ac) 45%, transparent); background: color-mix(in oklch, var(--ac) 9%, transparent); }
.b-val {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 7px;
  font: 400 9.5px/1 var(--fm);
  color: var(--text-4);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.b-bar.today .b-val { color: var(--ac); }
.b-fill {
  position: absolute;
  left: -1px;
  right: -1px;
  bottom: -1px;
  border-radius: 6px 6px 3px 3px;
  background: var(--ac);
  box-shadow: 0 0 14px color-mix(in oklch, var(--ac) 60%, transparent);
}
.b-labels { display: grid; grid-template-columns: repeat(7, 1fr); }
.b-lab { display: flex; flex-direction: column; align-items: center; gap: 7px; font: 400 9.5px/1 var(--fm); letter-spacing: 0.06em; color: var(--text-4); }
.b-lab.today { color: var(--ac); }
.b-lab i { width: 5px; height: 5px; border-radius: 50%; border: 1px solid #3a3a3e; box-sizing: border-box; }
.b-lab i.on { border-color: var(--ac); background: var(--ac); }
.b-lab i.gap { border-color: transparent; background: #1d1d20; width: 3px; height: 3px; margin: 1px 0; }
.caption { font: 400 11px/1 var(--fs); color: var(--text-4); }

/* ─── Line charts ─── */
.l-chart { display: block; width: 100%; height: auto; overflow: visible; color: var(--ac); }
.l-chart.stretch { height: 30px; }
.l-line { fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.l-line.glow { stroke-width: 1.4; filter: drop-shadow(0 0 6px currentColor); }
.l-grid { stroke: #161618; vector-effect: non-scaling-stroke; }
.l-halo { fill: currentColor; opacity: 0.15; }
.l-dot { fill: currentColor; }
.chart-empty { display: grid; place-items: center; min-height: 30px; border-radius: 10px; border: 1px dashed #1d1d20; }
.weight-hist { display: flex; flex-direction: column; gap: 12px; }
.hist-hero { font-size: 54px; }
.weight-hist .l-chart { aspect-ratio: 326 / 120; }
.weight-hist .chart-empty { min-height: 120px; }
.axis { font: 400 10px/1 var(--fm); color: var(--text-4); text-transform: uppercase; }
.weigh.dated { margin-top: 4px; }

/* ─── Meals (phone) ─── */
.meals { overflow: hidden; }
.meal { padding: 16px 16px 10px; border-bottom: 1px solid var(--hair); }
.meal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 8px; }
.meal-titles { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.meal-name { font: 500 16px/1 var(--fs); letter-spacing: -0.01em; color: var(--text-1); }
.meal-head .meta { font-size: 11px; color: #75757b; }
.t-meal.pending .t-row { opacity: 0.5; }

.state-pill {
  height: 28px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  border-radius: 99px;
  border: 1px solid #2a2a2e;
  color: #d8d8dc;
  font: 500 10px/1 var(--fm);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.state-pill.eaten {
  padding: 0 11px 0 9px;
  border-color: color-mix(in oklch, var(--ac) 35%, transparent);
  background: color-mix(in oklch, var(--ac) 8%, transparent);
  color: var(--ac);
}
.state-pill .pip { border: 0; background: currentColor; box-shadow: 0 0 6px currentColor; }

.food-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 0;
  text-align: left;
}
.food-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.food-name { font: 400 14px/1.2 var(--fs); color: var(--text-food); overflow-wrap: anywhere; }
.food-name.dim { color: var(--text-3); }
/* Phone rows are read at arm's length: a size up, brighter names, and meta in the sans at a readable grey. */
.food-row .food-name { font-size: 15.5px; line-height: 1.25; letter-spacing: -0.006em; color: #f0f0f2; }
.food-row .food-name.dim { color: #8a8a90; }
.food-row .meta { font: 400 12.5px/1.2 var(--fs); font-variant-numeric: tabular-nums; letter-spacing: 0; color: #8b8b92; }
.mark { width: 5px; height: 5px; border-radius: 50%; background: var(--ac); box-shadow: 0 0 6px var(--ac); flex: none; opacity: 0; }
.mark.on { opacity: 1; }
.amount { min-width: 58px; display: flex; align-items: baseline; justify-content: flex-end; gap: 4px; }
.grams { font: 400 15.5px/1 var(--fm); font-variant-numeric: tabular-nums; color: var(--text-1); }
.grams.hot { color: var(--ac); }
.grams.none { color: var(--text-5); font-size: 12px; }
.grams-unit { font: 400 11.5px/1 var(--fm); color: #707077; }

.switch { position: relative; width: 34px; height: 20px; flex: none; border-radius: 99px; border: 1px solid #2a2a2e; background: #08080a; transition: background 0.15s, border-color 0.15s; }
.switch span { position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--text-3); transition: transform 0.15s ease-out, background 0.15s; }
.switch.on { border-color: color-mix(in oklch, var(--ac) 45%, transparent); background: color-mix(in oklch, var(--ac) 12%, transparent); }
.switch.on span { transform: translateX(14px); background: var(--ac); box-shadow: 0 0 6px var(--ac); }

.editor-wrap { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 12px; }
.editor { display: flex; gap: 8px; }
.stepper {
  flex: 1;
  min-width: 0;
  display: flex;
  height: 42px;
  border-radius: 12px;
  border: 1px solid color-mix(in oklch, var(--ac) 40%, #222226);
  background: var(--inset);
  overflow: hidden;
}
.stepper button { width: 54px; flex: none; color: var(--text-2); font: 400 12px/1 var(--fm); text-align: center; }
.stepper button:first-child { border-right: 1px solid #18181b; }
.stepper button:last-child { border-left: 1px solid #18181b; }
.stepper input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  text-align: center;
  font: 300 19px/1 var(--fs);
  font-variant-numeric: tabular-nums;
  color: var(--ac);
}
.sq {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #08080a;
  color: var(--text-2);
  font: 400 13px/1 var(--fm);
  text-align: center;
}
.sq.dim { color: var(--text-3); font: 400 15px/1 var(--fs); }
.swap { display: flex; flex-direction: column; gap: 8px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; scroll-padding: 0 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  height: 30px;
  padding: 0 12px;
  flex: none;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: #08080a;
  color: var(--text-2);
  font: 400 12px/1 var(--fs);
  white-space: nowrap;
}
.chip.on { border-color: color-mix(in oklch, var(--ac) 45%, transparent); background: color-mix(in oklch, var(--ac) 10%, transparent); color: var(--ac); }

/* Off-plan */
.off { padding: 16px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--hair); }
.extra { display: flex; align-items: center; gap: 10px; }
.extra-name { flex: 1; min-width: 0; font: 400 15.5px/1.3 var(--fs); color: #f0f0f2; overflow-wrap: anywhere; }
.extra-k { font: 400 12.5px/1 var(--fm); color: var(--ac); font-variant-numeric: tabular-nums; }
.extra-p { font: 400 12.5px/1 var(--fm); color: #8b8b92; font-variant-numeric: tabular-nums; }
.off-entry {
  display: flex;
  align-items: center;
  height: 46px;
  padding: 0 4px 0 14px;
  border-radius: 13px;
  background: var(--inset);
  border: 1px solid var(--line);
}
.off-entry:focus-within { border-color: color-mix(in oklch, var(--ac) 40%, #222226); }
.off-entry input { background: none; border: 0; min-width: 0; height: 100%; }
.off-text { flex: 1; font: 400 15px/1 var(--fs); }
.off-num {
  width: 50px;
  flex: none;
  text-align: center;
  border-left: 1px solid #18181b !important;
  font: 400 12px/1 var(--fm);
  font-variant-numeric: tabular-nums;
}
.add {
  width: 38px;
  height: 38px;
  flex: none;
  margin-left: 4px;
  border-radius: 10px;
  border: 1px solid #2a2a2e;
  background: #0e0e10;
  color: var(--ac);
  font: 300 20px/1 var(--fs);
  text-align: center;
}
.meal-foot { display: flex; align-items: center; gap: 12px; padding: 12px 16px 14px; }
.note {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #18181b;
  background: var(--inset);
  font: 400 13px/1 var(--fs);
  color: var(--text-2);
}
.note:focus { border-color: color-mix(in oklch, var(--ac) 40%, #222226); color: var(--text-1); }
.note-read { font: 400 13px/1.45 var(--fs); color: var(--text-2); }
.text-btn {
  flex: none;
  font: 500 10px/1 var(--fm);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 8px 0;
}
.text-btn:hover { color: var(--text-1); }

/* Close the day */
.close-day {
  height: 56px;
  flex: none;
  border-radius: 18px;
  border: 1px solid transparent;
  background: var(--primary);
  color: var(--text-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font: 500 15px/1 var(--fs);
}
.close-day .meta { letter-spacing: 0.12em; color: var(--text-3); text-transform: uppercase; }
.close-day.compact { height: 38px; padding: 0 16px; border-radius: 11px; font-size: 13px; gap: 6px; justify-content: center; white-space: nowrap; }
.close-day.compact .meta { letter-spacing: 0.04em; }
.closed-card {
  border-radius: 22px;
  background: #08080a;
  border: 1px solid color-mix(in oklch, var(--ac) 40%, transparent);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.closed-card .label { display: flex; align-items: center; gap: 8px; font-size: 10.5px; }
.closed-card .status { font-size: 13px; line-height: 1.45; }
.closed-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 5px 0 14px;
  border-radius: 11px;
  border: 1px solid color-mix(in oklch, var(--ac) 40%, transparent);
}
.closed-pill .label { font-size: 10.5px; letter-spacing: 0.14em; white-space: nowrap; }
.closed-pill input {
  width: 90px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--inset);
  text-align: right;
  font: 400 13px/1 var(--fm);
}
.tiny-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid #2a2a2e;
  color: var(--text-3);
  font: 400 10.5px/1 var(--fm);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  justify-self: end;
}
.tiny-btn:hover { color: var(--text-2); }

/* ─── Desktop today ─── */
.desk-top { display: grid; grid-template-columns: 1.1fr 1fr 1.6fr; gap: 14px; }
.desk-bottom { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; align-items: start; }
.desk-bottom > .stack, .hist-grid .stack, .settings-grid .stack { gap: 14px; }
.big-card { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.big-card .meter { margin-top: 8px; }
.desk-hero { font-size: 66px; margin-top: 4px; }
.hero-unit { font-size: 22px; color: var(--text-3); letter-spacing: -0.02em; }
.weight-card.wide { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.weight-card.wide .l-chart { height: 150px; flex: 1; min-height: 110px; }
.weight-card.wide .chart-empty { flex: 1; min-height: 110px; }
.weight-card.wide .weigh { height: 40px; margin-top: 4px; }
.weight-card.wide .weigh-kg { font-size: 18px; }
.weight-card.wide .save-btn { height: 30px; }

.table { overflow: hidden; }
.t-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px 56px 40px;
  gap: 14px;
  align-items: center;
  padding: 3px 20px;
  min-height: 36px;
}
.t-cols {
  padding: 14px 20px;
  min-height: 0;
  border-bottom: 1px solid var(--hair);
  font: 500 10px/1 var(--fm);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-5);
}
.t-cols span:not(:first-child) { text-align: right; }
.t-meal { border-bottom: 1px solid var(--hair); padding: 10px 0 8px; }
.t-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 20px 6px; }
.t-title { display: flex; align-items: baseline; gap: 10px; }
.t-head .meal-name { font-size: 14px; }
.t-head .state-pill { height: 24px; font-size: 9.5px; }
.t-row .food-name { font-size: 13.5px; line-height: 1.3; }
.t-num { text-align: right; font: 400 12px/1 var(--fm); color: var(--text-3); font-variant-numeric: tabular-nums; }
.t-num.accent { color: var(--ac); }
.amt {
  display: flex;
  align-items: center;
  height: 30px;
  padding: 0 10px 0 6px;
  gap: 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--inset);
  cursor: text;
}
.amt.hot { border-color: color-mix(in oklch, var(--ac) 40%, #1f1f22); }
.amt:focus-within { border-color: color-mix(in oklch, var(--ac) 60%, #1f1f22); }
.amt input { flex: 1; min-width: 0; width: 100%; border: 0; background: none; text-align: right; font: 400 13px/1 var(--fm); font-variant-numeric: tabular-nums; }
.amt.hot input { color: var(--ac); }
.amt span { font: 400 10.5px/1 var(--fm); color: var(--text-5); flex: none; }
.switch-btn { justify-self: end; padding: 4px 0; }
.pick-wrap { position: relative; min-width: 0; display: flex; }
.pick-wrap::after {
  content: "";
  width: 5px;
  height: 5px;
  border-right: 1px solid var(--text-3);
  border-bottom: 1px solid var(--text-3);
  transform: rotate(45deg);
  margin: -3px 0 0 -12px;
  align-self: center;
  pointer-events: none;
}
.pick {
  appearance: none;
  -webkit-appearance: none;
  max-width: 100%;
  min-width: 0;
  padding: 4px 22px 4px 8px;
  margin-left: -8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-food);
  font: 400 13.5px/1.3 var(--fs);
  cursor: pointer;
  text-overflow: ellipsis;
}
.pick:hover { border-color: var(--line); background: #08080a; }
.pick:focus-visible { outline: none; border-color: color-mix(in oklch, var(--ac) 50%, transparent); }
.pick option { background: #0e0e10; color: var(--text-1); }
.t-extras { padding: 12px 0 14px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--hair); }
.t-extras .t-row { min-height: 30px; }
.t-off { padding: 0 20px; }
.t-off .off-entry { height: 38px; border-radius: 10px; padding: 0 3px 0 12px; }
.t-off .off-text { font-size: 13px; }
.t-off .add { width: 30px; height: 30px; border-radius: 8px; font-size: 17px; }
.table .meal-foot { padding: 12px 20px 14px; }

/* ─── History ─── */
.list { overflow: hidden; }
.list-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--hair); gap: 12px; }
.list-head span:last-child { color: var(--text-4); text-align: right; }
.list .pad { padding: 16px; }
.hist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hair);
  text-align: left;
}
.hist-row:last-child { border-bottom: 0; }
.hist-row:hover { background: rgba(255, 255, 255, 0.015); }
.hist-date { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.hist-day { font: 400 15px/1 var(--fs); }
.tag { display: flex; align-items: center; gap: 6px; font: 500 9.5px/1 var(--fm); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-4b); }
.tag.met { color: var(--ac); }
.hist-nums {
  display: grid;
  grid-template-columns: 56px 44px 40px;
  gap: 8px;
  text-align: right;
  font: 400 12.5px/1 var(--fm);
  font-variant-numeric: tabular-nums;
  color: var(--text-food);
}
.hist-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: start; }

/* ─── Plans ─── */
.plans-grid { display: flex; flex-direction: column; gap: 12px; }
.plan-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 18px 16px 4px; }
.plan-title { font: 400 22px/1 var(--fs); letter-spacing: -0.03em; }
.plan-card .meal:last-child { border-bottom: 0; }
.plan-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 48px; gap: 12px; align-items: center; padding: 7px 0; }

/* ─── Settings ─── */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.tile {
  height: 64px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid #1d1d20;
  background: #08080a;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
}
.app.desk .tile { height: 84px; }
.tile.on { border-color: color-mix(in oklch, var(--swatch) 60%, transparent); background: #0f0f11; }
.swatch { width: 12px; height: 12px; border-radius: 50%; background: var(--swatch); box-shadow: 0 0 10px var(--swatch); }
.tile-name { font: 500 10px/1 var(--fm); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); }
.tile.on .tile-name { color: var(--text-1); }
.type-card { overflow: hidden; display: flex; flex-direction: column; }
.type-label { padding: 16px 16px 6px; }
.type-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-top: 1px solid var(--hair); text-align: left; width: 100%; }
.type-row.on { background: #0f0f11; }
.type-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.type-sample { font-weight: 200; font-size: 28px; line-height: 1; letter-spacing: -0.02em; color: var(--text-1); white-space: nowrap; }
.app.desk .type-sample { font-size: 34px; }
.type-desc { font-weight: 500; font-size: 9.5px; line-height: 1; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-3); }
.radio { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 1px solid #2e2e32; box-shadow: inset 0 0 0 4px #0a0a0b; }
.type-row.on .radio { border-color: var(--ac); background: var(--ac); }
.account { overflow: hidden; }
.acct-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--hair); min-width: 0; }
.acct-row:first-child { border-top: 0; }
.acct-val { font: 400 12.5px/1.3 var(--fm); color: var(--text-2); text-align: right; overflow-wrap: anywhere; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }

/* ─── Boot / login ─── */
.boot {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px 16px;
}
.boot-icon, .brand img { width: 52px; height: 52px; border-radius: 13px; display: block; }
.brand { align-self: flex-start; }
.boot-card { width: min(400px, 100%); padding: 22px 20px 20px; display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field input {
  height: 46px;
  padding: 0 14px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--inset);
  font: 400 15px/1 var(--fs);
}
.field input:focus { border-color: color-mix(in oklch, var(--ac) 40%, #222226); }
.primary {
  height: 52px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: var(--primary);
  color: var(--text-1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  font: 500 15px/1 var(--fs);
}
.primary .meta { color: var(--text-3); text-transform: uppercase; letter-spacing: 0.12em; }
.primary.center { justify-content: center; }

@media (min-width: 960px) {
  .plans-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
  .lead { padding: 0; }
}

@media (max-width: 370px) {
  .app.phone .main { padding-left: 12px; padding-right: 12px; }
  .seg button { padding: 0 10px; }
  .stat-num { font-size: 34px; }
  .pair { gap: 10px; }
}

/* ─── Motion ─── values glide, screens settle in, the gauge tip breathes. See src/client/motion.ts. */
.g-plan, .g-eaten { transition: stroke-dasharray 0.7s var(--ease); }
.g-tipwrap { transition: transform 0.7s var(--ease); }
.meter span { transition: width 0.6s var(--ease); }
.b-bar, .b-fill { transition: height 0.6s var(--ease); }
.rows { transition: opacity 0.35s ease-out; }
.g-halo { animation: breathe 4.2s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: 0.06; } 50% { opacity: 0.26; } }

/* A screen settles in. --elapsed lets a re-render mid-way resume instead of restarting. */
.settling > * { animation: rise 0.6s var(--ease) both; animation-delay: calc(var(--k, 0) * 50ms - var(--elapsed, 0ms)); }
.settling > :nth-child(2) { --k: 1; }
.settling > :nth-child(3) { --k: 2; }
.settling > :nth-child(4) { --k: 3; }
.settling > :nth-child(5) { --k: 4; }
.settling > :nth-child(n + 6) { --k: 5; }
.opening .g-plan, .opening .g-eaten, .opening .g-tipwrap { transition-duration: 1.2s; transition-delay: 0.12s; }
.opening .meter span { transition-duration: 1s; transition-delay: 0.2s; }
.opening .b-bar { transition-duration: 0.9s; transition-delay: calc(0.2s + var(--i, 0) * 50ms); }
.opening .b-fill { transition-duration: 0.8s; transition-delay: 0.75s; }
.resuming .g-plan, .resuming .g-eaten, .resuming .g-tipwrap, .resuming .meter span, .resuming .b-bar, .resuming .b-fill { transition-duration: var(--remain, 0.6s); }
.opening .b-val { animation: fade 0.5s ease-out both; animation-delay: calc(0.55s + var(--i, 0) * 50ms); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.appear { animation: unfold 0.28s var(--ease) both; }
@keyframes unfold { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Small, quick press feedback on controls. */
.state-pill, .chip, .seg button, .close-day, .sq, .stepper button, .add, .save-btn, .chip-btn, .tile, .icon-btn, .tiny-btn, .primary, .tabbar button {
  transition: transform 0.14s ease-out, background-color 0.2s, border-color 0.2s, color 0.2s;
}
.state-pill:active, .chip:active, .seg button:active, .sq:active, .add:active, .save-btn:active, .chip-btn:active, .tile:active, .icon-btn:active, .tiny-btn:active, .tabbar button:active { transform: scale(0.94); }
.close-day:active, .primary:active { transform: scale(0.985); }
.weight-card { transition: transform 0.14s ease-out; }
.weight-card:active { transform: scale(0.985); }
.stepper button:active { background: #0c0c0e; }
.food-row:active { opacity: 0.7; }

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