/* ── Tracker ─────────────────────────────────────────────────────────────────
   Layered on top of style.css: --accent (#b45309), --font (Georgia) and the
   box-sizing reset all come from there. Everything below re-tunes the neutral
   ramp to the warm paper palette of the approved mockup. Light mode only —
   the rest of the site is light-only too.
   Every class is prefixed `t-` so nothing collides with the cookbook's own
   rules (style.css already owns .pill, .row, .search-wrap, header, main…).
   ────────────────────────────────────────────────────────────────────────── */

:root {
  --ground:      #faf8f4;
  --surface:     #ffffff;
  --sunk:        #f4efe7;
  --border:      #e8e2d8;
  --border-soft: #f0ebe2;
  --text:        #1c1714;
  --ink-2:       #463d34;
  --muted:       #6f665a;
  --tint:        #fdf4e5;
  --on-accent:   #ffffff;
  --good:        #15803d;
  --good-tint:   #e8f4ec;
  --over:        #b3261e;
  --over-tint:   #fbeceb;
  --c-actual:    var(--accent);
  --c-proj:      #1d4ed8;
  --r:           10px;
  --shadow:      0 1px 2px rgba(40,28,12,.05), 0 8px 24px -12px rgba(40,28,12,.18);
  --serif:       var(--font);
  --sans:        ui-sans-serif, -apple-system, 'Helvetica Neue', sans-serif;
}

body.t-body {
  background: var(--ground);
  color: var(--text);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
}

/* Several tracker blocks set display:flex/grid, which outranks the UA's
   [hidden] rule. Restore it once, here, rather than per-class. */
body.t-body [hidden] { display: none !important; }

/* ── Shell ─────────────────────────────────────────────────────────────── */
.t-app {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  background: var(--surface);
  font-family: var(--sans);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
@media (min-width: 460px) {
  .t-app { border-left: 1px solid var(--border); border-right: 1px solid var(--border); box-shadow: var(--shadow); }
}

.t-status {
  display: flex; justify-content: space-between; align-items: center;
  padding: .6rem 1.35rem .1rem;
  font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums;
}
.t-back { color: var(--muted); }
.t-back:hover { color: var(--accent); }

.t-daynav { display: flex; align-items: center; gap: .1rem; }
.t-daybtn {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-size: 1.05rem; line-height: 1; padding: .1rem .5rem;
}
.t-daybtn:hover:not(:disabled) { color: var(--accent); }
.t-daybtn:disabled { opacity: .25; cursor: default; }
#t-today.t-away { color: var(--accent); font-weight: 600; }

.t-appbar {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: .6rem; padding: .5rem 1.15rem .7rem;
  border-bottom: 1px solid var(--border-soft);
}
.t-appbar .t-title { font-family: var(--serif); font-size: 1.22rem; letter-spacing: -.01em; }
.t-appbar .t-sub { font-size: .74rem; color: var(--muted); text-align: right; }

.t-screen {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 1rem 1.15rem 1.4rem;
  display: none; flex-direction: column; gap: 1rem;
}
.t-screen.on { display: flex; }
.t-screen::-webkit-scrollbar { width: 0; }

/* ── Tiles ─────────────────────────────────────────────────────────────── */
.t-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.t-tile {
  background: var(--sunk); border: 1px solid var(--border-soft);
  border-radius: var(--r); padding: .7rem .8rem;
  display: flex; flex-direction: column; gap: .12rem;
}
.t-tile .t-lab { font-size: .66rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.t-tile .t-val { font-size: 1.62rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.15; }
.t-tile .t-foot { font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.t-tile.hero { grid-column: 1 / -1; background: var(--tint); border-color: transparent; }
.t-tile.hero .t-val { font-size: 2.1rem; color: var(--accent); }
.t-ahead { color: var(--good); }
.t-behind { color: var(--over); }

/* ── Pills ─────────────────────────────────────────────────────────────── */
.t-pill {
  display: inline-flex; align-items: center; gap: .3rem; align-self: flex-start;
  font-size: .66rem; font-weight: 650; letter-spacing: .04em;
  padding: .16rem .5rem; border-radius: 999px; white-space: nowrap;
}
.t-pill.good { background: var(--good-tint); color: var(--good); }
.t-pill.warn { background: var(--over-tint); color: var(--over); }
.t-pill.soft { background: var(--sunk); color: var(--muted); border: 1px solid var(--border); }
.t-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Macro bars ────────────────────────────────────────────────────────── */
.t-macros { display: flex; flex-direction: column; gap: .55rem; }
.t-macro { display: grid; grid-template-columns: 3.3rem 1fr auto; align-items: center; gap: .6rem; font-size: .76rem; }
.t-macro .t-name { color: var(--muted); font-weight: 600; }
.t-macro .t-track { height: 6px; border-radius: 3px; background: var(--sunk); overflow: hidden; }
.t-macro .t-fill { display: block; height: 100%; border-radius: 3px; background: var(--muted); opacity: .45; }
.t-macro .t-fill.key { background: var(--accent); opacity: 1; }
.t-macro .t-amt { font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* ── Log list ──────────────────────────────────────────────────────────── */
.t-loglist { display: flex; flex-direction: column; }
.t-loglist.t-tight { margin-top: -.2rem; }
.t-meal { font-size: .66rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 650; margin: .55rem 0 .3rem; }
.t-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: .7rem;
  padding: .42rem 0; border-bottom: 1px solid var(--border-soft);
}
.t-row.t-last { border-bottom: 0; }
.t-row .t-nm { font-size: .86rem; line-height: 1.35; }
.t-row .t-nm em { font-style: normal; color: var(--muted); font-size: .75rem; display: block; }
.t-row .t-cal { font-size: .86rem; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.t-row .t-cal.src::before {
  content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); margin-right: .4rem; vertical-align: .12em;
}
.t-row .t-cal.pend { color: var(--muted); }
.t-row .t-cal.t-accent { color: var(--accent); }
.t-row.t-tap { cursor: pointer; }
.t-row.t-tap:hover .t-nm, .t-row.t-tap:focus-visible .t-nm { color: var(--accent); }
.t-row.t-tap.open { border-bottom: 0; }
.t-editpanel {
  display: flex; flex-direction: column; gap: .55rem;
  padding: .55rem .65rem .65rem; margin: 0 0 .42rem;
  background: var(--sunk); border: 1px solid var(--border-soft); border-radius: var(--r);
}
.t-editpanel .t-out {
  display: flex; gap: .9rem; font-size: .78rem; color: var(--muted);
  font-variant-numeric: tabular-nums; align-items: baseline;
}
.t-editpanel .t-out b { color: var(--accent); font-size: 1.15rem; font-weight: 400; }
.t-editpanel .t-note-p { margin: 0; }
.t-btn.t-danger { background: var(--over); align-self: flex-start; }
.t-none { font-size: .8rem; color: var(--muted); padding: .6rem .1rem; }

/* ── Controls ──────────────────────────────────────────────────────────── */
.t-search, .t-input {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--border);
  border-radius: var(--r); background: var(--sunk); color: var(--text);
  font-family: var(--sans); font-size: .88rem; outline: none;
}
.t-search:focus, .t-input:focus { border-color: var(--accent); background: var(--surface); }
.t-area { resize: vertical; line-height: 1.45; }

.t-chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.t-chip {
  font-size: .75rem; padding: .3rem .6rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-2);
  cursor: pointer; font-family: var(--sans);
}
.t-chip:hover, .t-chip:focus-visible { border-color: var(--accent); color: var(--accent); }
.t-chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* The mockup fixed this at 214px for its 390×780 frame. Kept as a cap that
   scales instead, so the "write it as a note" line stays reachable on a phone
   without stranding 700px of white space on a taller screen. */
.t-results { display: flex; flex-direction: column; max-height: 46vh; min-height: 0; overflow-y: auto; }
.t-results::-webkit-scrollbar { width: 0; }
.t-res {
  display: flex; justify-content: space-between; align-items: baseline; gap: .6rem;
  padding: .5rem .1rem; border-bottom: 1px solid var(--border-soft);
  cursor: pointer; text-align: left; background: none;
  border-left: 0; border-right: 0; border-top: 0;
  font-family: var(--sans); color: var(--text); width: 100%;
}
.t-res:hover, .t-res:focus-visible { background: var(--tint); }
.t-res .t-nm { font-size: .85rem; }
.t-res .t-nm em { font-style: normal; display: block; font-size: .71rem; color: var(--muted); }
.t-res .t-cal { font-size: .82rem; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.t-res[aria-selected="true"] { background: var(--tint); }
.t-resgroup { font-size: .66rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 650; margin: .55rem 0 .1rem; }

.t-selcard {
  background: var(--sunk); border: 1px solid var(--border-soft);
  border-radius: var(--r); padding: .85rem .9rem;
  display: flex; flex-direction: column; gap: .7rem;
}
.t-selcard .t-h { font-family: var(--serif); font-size: 1rem; line-height: 1.3; }
.t-note-p { font-size: .75rem; color: var(--muted); margin-top: -.45rem; }

.t-stepper { display: flex; align-items: center; justify-content: space-between; gap: .7rem; flex-wrap: wrap; }
.t-stepper .t-lab { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.t-stepgrp { display: flex; align-items: center; gap: .1rem; }
.t-stepgrp button {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 1rem; cursor: pointer;
  line-height: 1; font-family: var(--sans);
}
.t-stepgrp button:hover { border-color: var(--accent); color: var(--accent); }
.t-stepgrp .t-n { width: 3rem; text-align: center; font-variant-numeric: tabular-nums; font-size: 1rem; }

.t-selcard .t-gap {
  margin: -.2rem 0 0; font-size: .75rem; line-height: 1.45; color: var(--over);
  background: var(--over-tint); border-radius: 8px; padding: .45rem .55rem;
}
.t-selcard .t-gap::before { content: '\26A0  '; }
.t-selcard .t-out { display: flex; gap: .9rem; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; flex-wrap: wrap; align-items: baseline; }
.t-selcard .t-out b { color: var(--accent); font-size: 1.15rem; font-weight: 400; }
.t-out.t-spread { justify-content: space-between; }
.t-small { font-size: .72rem; }

.t-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.t-field { display: flex; flex-direction: column; gap: .2rem; }
.t-field.t-wide { grid-column: 1 / -1; }
.t-field > span { font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.t-field .t-input { padding: .45rem .55rem; font-size: .85rem; }

.t-weighgrp { display: inline-flex; align-items: center; gap: .4rem; }
.t-weighgrp .t-input { width: 5.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.t-unit { font-size: .78rem; color: var(--muted); }

.t-btn {
  width: 100%; padding: .62rem; border-radius: var(--r); border: 0;
  background: var(--accent); color: var(--on-accent); font-family: var(--sans);
  font-size: .86rem; font-weight: 600; cursor: pointer;
}
.t-btn:hover { filter: brightness(1.07); }
.t-btn[disabled] { opacity: .55; cursor: default; filter: none; }
.t-btn-sm { width: auto; padding: .42rem .8rem; font-size: .8rem; }

.t-action {
  font-family: var(--sans); font-size: .78rem; text-align: left;
  padding: .5rem .7rem; border: 1px dashed var(--border); border-radius: var(--r);
  background: var(--surface); color: var(--accent); cursor: pointer;
}
.t-action:hover, .t-action:focus-visible { border-color: var(--accent); background: var(--tint); }
.t-action[disabled] { color: var(--muted); cursor: default; }

.t-ghost {
  font: inherit; font-family: var(--sans); font-size: .78rem; text-align: left;
  padding: .5rem .1rem; margin-top: -.4rem;
  background: none; border: 0; border-top: 1px dashed var(--border);
  color: var(--muted); cursor: pointer;
}
.t-ghost:hover, .t-ghost:focus-visible { color: var(--accent); }

/* ── Tier blocks ───────────────────────────────────────────────────────── */
.t-tier {
  border: 1px solid var(--border-soft); border-radius: var(--r);
  padding: .75rem .85rem; display: flex; flex-direction: column; gap: .35rem;
}
.t-tier .t-th { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.t-tier .t-tn { font-family: var(--serif); font-size: .95rem; }
.t-tier .t-td { font-size: .76rem; color: var(--muted); line-height: 1.45; }
.t-tier .t-td strong { color: var(--text); }
.t-tier.t1 { border-left: 2px solid var(--good); }
.t-tier.t2 { border-left: 2px solid var(--accent); }
.t-tier.t3 { border-left: 2px solid var(--border); }

/* ── Tabs ──────────────────────────────────────────────────────────────── */
nav.t-tabs {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border); background: var(--surface);
  padding-bottom: env(safe-area-inset-bottom);
  flex-shrink: 0;
}
nav.t-tabs button {
  padding: .62rem .2rem .85rem; border: 0; background: none; cursor: pointer;
  font-family: var(--sans); font-size: .7rem; font-weight: 600; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: .22rem;
  border-top: 2px solid transparent; margin-top: -1px;
}
nav.t-tabs button svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.6; }
nav.t-tabs button[aria-selected="true"] { color: var(--accent); border-top-color: var(--accent); }
nav.t-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }

/* ── Chart ─────────────────────────────────────────────────────────────── */
.t-chartcard { display: flex; flex-direction: column; gap: .6rem; }
.t-legend { display: flex; gap: .9rem; font-size: .72rem; color: var(--muted); }
.t-legend span { display: inline-flex; align-items: center; gap: .32rem; }
.t-swatch { width: 14px; height: 2.5px; border-radius: 2px; display: inline-block; }
.t-swatch.dash { background: repeating-linear-gradient(90deg, var(--c-proj) 0 4px, transparent 4px 7px); }

table.t-tbl { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: .74rem; }
table.t-tbl th, table.t-tbl td {
  text-align: right; padding: .24rem .3rem;
  border-bottom: 1px solid var(--border-soft); font-variant-numeric: tabular-nums;
}
table.t-tbl th:first-child, table.t-tbl td:first-child { text-align: left; }
table.t-tbl th { color: var(--muted); font-weight: 600; letter-spacing: .04em; }
details.t-tblwrap summary { font-family: var(--sans); font-size: .74rem; color: var(--muted); cursor: pointer; }
details.t-tblwrap { overflow-x: auto; }

/* ── PIN gate ──────────────────────────────────────────────────────────── */
.t-gate {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.25rem; background: var(--ground);
}
.t-gate[hidden] { display: none; }
.t-gate-card {
  width: 100%; max-width: 22rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
  padding: 1.6rem 1.4rem; display: flex; flex-direction: column; gap: .6rem;
}
.t-gate-logo { font-size: .7rem; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-family: var(--sans); }
.t-gate-h { font-family: var(--serif); font-size: 1.6rem; font-weight: 400; letter-spacing: -.02em; line-height: 1.1; }
.t-gate-p { font-family: var(--sans); font-size: .82rem; color: var(--muted); margin-bottom: .3rem; }
.t-gate-form { display: flex; flex-direction: column; gap: .5rem; }
.t-gate-msg {
  font-family: var(--sans); font-size: .8rem; color: var(--over);
  background: var(--over-tint); border-radius: 8px; padding: .5rem .6rem;
}
.t-gate-msg[hidden] { display: none; }

/* ── Toast ─────────────────────────────────────────────────────────────── */
.t-toast {
  position: fixed; left: 50%; bottom: 5.2rem; transform: translateX(-50%);
  z-index: 40; max-width: min(24rem, calc(100vw - 2rem));
  font-family: var(--sans); font-size: .8rem; line-height: 1.4; text-align: left;
  padding: .6rem .8rem; border-radius: var(--r); cursor: pointer;
  background: var(--over-tint); color: var(--over); border: 1px solid var(--over);
  box-shadow: var(--shadow);
}
.t-toast.ok { background: var(--good-tint); color: var(--good); border-color: var(--good); }
.t-toast[hidden] { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .t-screen.on { animation: t-fade .18s ease-out; }
  @keyframes t-fade { from { opacity: 0 } to { opacity: 1 } }
}
