/* "Track day" theme, pared back: flat chalk paper, black rules, tartan-track
   red for actions, turf green for finished work. Square corners and short
   hard shadows; the only decoration is faint lane lines and a red rule. Colors are tokens so a team palette can be swapped in. */
:root {
  --paper: #f2ede2;          /* chalk */
  --card: #fffcf5;
  --ink: #111;
  --muted: #5f584c;
  --track: #d6402a;          /* tartan track */
  --on-track: #fff;
  --turf: #1e6a46;           /* infield green = done */
  --turf-soft: #d5e6da;
  --warn: #9a5b00;
  --warn-soft: #ffd27a;
  --danger: #b3261e;
  --hi: #ffd23f;             /* highlighter for notes and the scoreboard */
  --rule: 2px solid var(--ink);
  --thin: 1.5px solid var(--ink);
  --hair: 1px solid #d9d2c3;
  --shadow: 3px 3px 0 var(--ink);
  --tap: 46px;
  --head: "Anybody", "Arial Narrow", sans-serif;
  --body: "Familjen Grotesk", "Helvetica Neue", sans-serif;
  --mono: "Martian Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; border-radius: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17px/1.45 var(--body);
  font-stretch: 85%; /* narrows Martian Mono; the other faces set their own */
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
  /* faint lane lines */
  background-image: repeating-linear-gradient(180deg, transparent 0 71px, rgb(17 17 17 / 0.05) 71px 72px);
}
a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; text-decoration-color: var(--track); }
h1, h2, h3 { font-family: var(--head); margin: 0; line-height: 0.95; text-transform: uppercase; font-weight: 900; }
h1 { font-size: clamp(2.3rem, 9vw, 3.1rem); font-stretch: 62%; font-weight: 850; }
h2 { font-size: 1.7rem; font-stretch: 65%; }
h3 { font-size: 1.05rem; font-stretch: 100%; margin-bottom: 12px; letter-spacing: 0.02em; }
p { margin: 4px 0; }
small, .small { font-size: 0.82rem; }
.muted { color: var(--muted); }
.warn { color: var(--warn); }
.code { font-family: var(--mono); letter-spacing: 0.1em; color: var(--track); }
.kicker { font-family: var(--mono); font-size: 0.66rem; font-weight: 600; text-transform: uppercase; color: var(--track); }

#view.wrap { max-width: 760px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top)) 16px 16px; }
.page-head { margin: 12px 0 20px; display: flex; flex-direction: column; gap: 8px; }
.page-head h1::after { content: ""; display: block; width: 48px; height: 4px; background: var(--track); margin-top: 12px; }
.page-head > .muted { max-width: 46ch; }
.hero { margin-top: 40px; }
.hero h1 { font-size: clamp(3.2rem, 15vw, 5.2rem); font-stretch: 58%; }
.hero h1::after { width: 96px; height: 6px; margin-top: 16px; }
.back { font-family: var(--mono); font-size: 0.75rem; font-weight: 600; color: var(--ink); }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; gap: 12px; }
.spacer { flex: 1; }
.empty { text-align: center; color: var(--muted); padding: 40px 8px; }
.empty b { color: var(--ink); font-family: var(--head); text-transform: uppercase; font-size: 1.4rem; font-stretch: 65%; font-weight: 900; display: block; }
.empty .btn { margin-top: 16px; }

.card { background: var(--card); border: var(--rule); padding: 16px; margin: 0 0 16px; }
.scroll-x { overflow-x: auto; padding: 0; }

.btn, .chip, .icon-btn, .link, .pick button, .rpe button, .check, .day {
  font: inherit; cursor: pointer; border: 0; background: none; color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px;
  padding: 12px 22px; background: var(--track); color: var(--on-track); border: var(--rule); box-shadow: var(--shadow);
  font-family: var(--head); font-size: 1.1rem; font-weight: 800; font-stretch: 85%; letter-spacing: 0.03em; text-transform: uppercase; text-decoration: none;
}
.btn { transition: transform 0.1s, box-shadow 0.1s; }
.btn:active { transform: translate(3px, 3px); box-shadow: none; }
.btn.ghost { background: var(--card); color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn.wide { width: 100%; margin-top: 14px; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 4px 12px;
  background: var(--card); color: var(--ink); border: var(--thin); text-decoration: none;
  font-family: var(--mono); font-size: 0.72rem; font-weight: 600; white-space: nowrap;
}
.chip:hover, .chip:active { background: var(--ink); color: var(--paper); }
.icon-btn { min-width: 38px; min-height: 38px; color: var(--ink); font-size: 1.1rem; font-weight: 700; }
.icon-btn:hover { background: var(--ink); color: var(--paper); }
.link { color: var(--track); padding: 8px 0; font-weight: 700; font-size: 0.95rem; text-decoration: none; }
.muted-link { color: var(--muted); }
.pill {
  display: inline-block; padding: 1px 6px; background: var(--card); color: var(--ink); border: var(--thin);
  font-family: var(--mono); font-size: 0.6rem; font-weight: 600; text-transform: uppercase; white-space: nowrap;
}
.pill.warn { background: var(--warn-soft); }
:focus-visible { outline: 3px solid var(--track); outline-offset: 2px; }

input, select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: var(--thin);
  padding: 8px 10px; min-height: 44px; width: 100%;
}
input::placeholder, textarea::placeholder { color: #9b9384; }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: 4px 4px 0 var(--track); }
textarea { resize: vertical; }
.field-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.field-row > span { flex: 0 0 40%; font-family: var(--mono); font-size: 0.7rem; font-weight: 600; text-transform: uppercase; }
.form fieldset { border: 0; padding: 0; margin: 12px 0; }
.form legend { font-family: var(--mono); font-size: 0.7rem; font-weight: 600; text-transform: uppercase; margin-bottom: 6px; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.check-row input, .check-chip input { width: 20px; min-height: 20px; accent-color: var(--ink); }
.check-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: var(--thin); background: #fff; }
.check-chip:has(input:checked) { background: var(--ink); color: var(--paper); }
.checks { display: flex; flex-direction: column; }
.checks.tall { max-height: 220px; overflow-y: auto; }
.search { margin-bottom: 10px; }

/* date strip: one ruled row of boxes */
.date-strip { display: flex; align-items: stretch; margin-bottom: 22px; border: var(--rule); background: var(--card); }
.date-strip .icon-btn { min-width: 30px; }
.day {
  flex: 1; display: flex; flex-direction: column; align-items: center; padding: 6px 0 8px; border-left: var(--thin);
  font-family: var(--mono); font-size: 0.62rem; font-weight: 600; min-height: 64px;
}
.date-strip .day + .icon-btn { border-left: var(--thin); }
.day b { font-family: var(--head); font-weight: 900; font-stretch: 65%; font-size: 1.6rem; line-height: 1.1; }
.day i { width: 8px; height: 8px; margin-top: 2px; }
.day.planned i { border: var(--thin); width: 9px; height: 9px; }
.day.done i { background: var(--turf); }
.day.today b { color: var(--track); }
.day.on { background: var(--ink); color: var(--paper); }
.day.on b { color: var(--paper); }
.day.on.today b { color: var(--hi); }
.day.on i { background: var(--hi); border: 0; }

/* today: the workout card is a solid block */
.workout-card {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--on-track); text-decoration: none;
  background: var(--track); border: var(--rule); box-shadow: var(--shadow); padding: 24px 20px; margin-bottom: 18px;
}
.workout-card:active { transform: translate(3px, 3px); box-shadow: none; }
.workout-card.done { background: var(--turf); }
.workout-card .kicker { color: var(--on-track); }
.workout-card h2 { font-size: clamp(2.3rem, 11vw, 3.2rem); font-stretch: 58%; margin: 8px 0 6px; }
.workout-card .muted { color: var(--on-track); font-family: var(--mono); font-size: 0.72rem; }
.workout-go { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; flex-shrink: 0; }
.status {
  font-family: var(--mono); font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  color: var(--ink); background: var(--card); border: var(--thin); padding: 2px 6px;
}
.status.live { background: var(--hi); }
.arrow { width: 50px; height: 50px; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-size: 1.8rem; font-weight: 700; }

/* workout page */
.entry { background: var(--card); border: var(--rule); padding: 14px 14px 8px; margin: 0 0 16px; }
.entry.complete { border-color: var(--turf); box-shadow: 3px 3px 0 var(--turf); }
.entry header { display: flex; gap: 12px; align-items: flex-start; }
.order {
  flex-shrink: 0; min-width: 40px; height: 40px; padding: 0 6px; background: var(--ink); color: var(--paper);
  display: grid; place-items: center; font-family: var(--head); font-weight: 900; font-stretch: 65%; font-size: 1.4rem;
}
.entry.complete .order { background: var(--turf); }
.entry-title { flex: 1; min-width: 0; }
.entry h3 { margin: 2px 0 4px; font-size: 1.4rem; font-stretch: 65%; }
.tags, .last { color: var(--muted); font-family: var(--mono); font-size: 0.66rem; }
.coach-note { white-space: pre-line; border-left: 4px solid var(--track); background: #f7e3dc; padding: 6px 10px; font-size: 0.95rem; margin: 12px 0 4px; }
.set-head, .set { display: grid; grid-template-columns: 26px 1fr 1fr 0.8fr 48px; gap: 8px; align-items: center; }
.set-head.no-load, .set.no-load { grid-template-columns: 26px 1fr 1fr 48px; }
.set.check-only { grid-template-columns: 26px 1fr 48px; }
.set.check-only.done .target { text-decoration: none; }
.set-head { margin-top: 14px; font-family: var(--mono); font-size: 0.58rem; font-weight: 600; text-transform: uppercase; color: var(--muted); }
.sets { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.set-n { font-family: var(--mono); font-weight: 700; font-size: 0.85rem; text-align: center; }
.target { color: var(--muted); font-size: 0.92rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.field { position: relative; display: block; }
.field input { text-align: center; font-family: var(--mono); font-size: 1.05rem; font-weight: 700; min-height: var(--tap); padding: 6px 4px; }
.field span { display: none; }
.check { height: var(--tap); border: var(--thin); background: #fff; color: #c8c0b0; transition: background 0.15s; font-size: 1.2rem; font-weight: 900; }
.set.done .check { background: var(--turf); color: #fff; }
.set.done input { background: var(--turf-soft); }
.set.done .target { text-decoration: line-through 2px; }
.entry-foot { display: flex; gap: 16px; align-items: center; }
.note-field { display: block; margin-top: 6px; }
.note-field[hidden] { display: none; }
.note-field span { display: block; font-family: var(--mono); font-size: 0.62rem; font-weight: 600; text-transform: uppercase; margin-bottom: 4px; }
.finish { margin-top: 28px; padding-top: 20px; border-top: var(--rule); }
.rpe { display: grid; grid-template-columns: repeat(10, 1fr); margin: 12px 0; border: var(--thin); }
.rpe button { min-height: var(--tap); background: #fff; font-family: var(--mono); font-weight: 700; font-size: 0.85rem; }
.rpe button + button { border-left: var(--thin); }
.rpe button.on { background: var(--track); color: var(--on-track); }

/* analytics: stats are flat black scoreboard boxes */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--ink); color: var(--paper); border: var(--rule); padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-family: var(--mono); font-size: 0.58rem; font-weight: 600; text-transform: uppercase; color: #b9b2a5; }
.stat-value { font-family: var(--mono); font-size: 1.75rem; font-weight: 800; font-stretch: 85%; line-height: 1.15; color: var(--hi); letter-spacing: -0.03em; }
.stat-value small { font-family: var(--body); font-size: 0.8rem; font-weight: 500; color: #b9b2a5; margin-left: 4px; letter-spacing: 0; }
.delta { font-family: var(--mono); font-size: 0.6rem; color: #b9b2a5; }
.delta.big.up { color: #ff7a63; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 70px 1fr auto; gap: 10px; align-items: center; font-size: 0.9rem; }
.bar-track { height: 16px; background: #fff; border: var(--thin); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--track); transform-origin: left; }
.bar-val { font-family: var(--mono); font-size: 0.75rem; min-width: 60px; text-align: right; }

.tbl { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.tbl th, .tbl td { text-align: left; padding: 10px; border-bottom: var(--hair); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl th { background: var(--ink); color: var(--paper); font-family: var(--mono); font-weight: 600; font-size: 0.58rem; text-transform: uppercase; }
.tbl td:not(:first-child) { font-family: var(--mono); font-size: 0.8rem; }
.tbl tbody tr:hover { background: var(--paper); }
.board { min-width: 620px; }
.note-cell { max-width: 220px; font-family: var(--body) !important; font-size: 0.85rem !important; }
.kv { list-style: none; padding: 0; margin: 0; }
.kv li { display: flex; justify-content: space-between; align-items: baseline; padding: 9px 0; border-bottom: var(--hair); }
.kv li:last-child { border-bottom: 0; }
.kv b { font-family: var(--mono); font-size: 0.9rem; }
.log-row { display: flex; justify-content: space-between; gap: 12px; color: inherit; text-decoration: none; }
.log-row:hover { box-shadow: var(--shadow); }
.log-row .right { text-align: right; white-space: nowrap; }
.log-row .right b { font-family: var(--mono); font-size: 0.95rem; }
.note { font-style: italic; }
.log-item { padding: 12px 0; border-bottom: var(--hair); }
.log-item:last-child { border-bottom: 0; }
.max-grid .field-row > span { flex-basis: 60%; }

/* block builder */
.title-input {
  font-family: var(--head); font-size: 1.8rem; font-weight: 900; font-stretch: 60%; text-transform: uppercase;
  background: transparent; border-color: transparent; padding-left: 0;
}
.title-input:focus { padding-left: 10px; background: #fff; border-color: var(--ink); }
.day-name {
  font-family: var(--head); font-size: 1.3rem; font-weight: 900; font-stretch: 65%; text-transform: uppercase; flex: 1;
  background: transparent; border-color: transparent;
}
.day-name:focus { background: #fff; border-color: var(--ink); }
.card.row.between > a { text-decoration: none; }
/* day tabs: one day open at a time, optionally a second beside it */
.day-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 4px 0 10px; padding: 2px 2px 6px; scrollbar-width: thin; }
.day-tab {
  flex: 0 0 auto; min-height: 44px; padding: 8px 14px; border: var(--thin); background: var(--card); color: var(--ink); cursor: pointer;
  font: 800 1rem var(--head); font-stretch: 70%; text-transform: uppercase; white-space: nowrap;
}
.day-tab.on { background: var(--ink); color: var(--paper); box-shadow: 3px 3px 0 var(--track); }
.day-tab.side { background: var(--paper); box-shadow: inset 0 -4px 0 var(--track); }
.day-tab.add { border-style: dashed; color: var(--muted); }
.side-pick { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-family: var(--mono); font-size: 0.66rem; font-weight: 600; text-transform: uppercase; color: var(--muted); }
.side-pick select { width: auto; min-width: 160px; font-family: var(--body); font-size: 0.95rem; text-transform: none; color: var(--ink); }
.day-cols.two { display: grid; gap: 16px; }
@media (min-width: 760px) {
  /* Two days need more room than the usual page column. */
  .day-cols.two { grid-template-columns: 1fr 1fr; align-items: start; width: min(1360px, calc(100vw - 32px)); margin-left: 50%; transform: translateX(-50%); }
}
.seg { display: inline-flex; border: var(--thin); margin-top: 10px; }
.seg button { font: 600 0.62rem var(--mono); text-transform: uppercase; padding: 7px 12px; min-height: 34px; border: 0; background: #fff; color: var(--ink); cursor: pointer; }
.seg button + button { border-left: var(--thin); }
.seg button.on { background: var(--ink); color: var(--paper); }
.unit-seg { margin-top: 0; text-transform: none; }
.unit-seg button { text-transform: none; padding: 6px 10px; min-height: 32px; }
.warm-load { width: auto; min-width: 190px; min-height: 34px; padding: 4px 8px; font: 600 0.72rem var(--mono); }
.item-none { margin: 10px 0 4px; }
.sec { margin-top: 14px; }
.sec h4 {
  margin: 0 0 6px; font: 600 0.66rem var(--mono); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.sec h4::after { content: ""; flex: 1; border-top: var(--hair); }
.warm-sec { padding: 10px; background: var(--paper); border: 1.5px dashed #c9c1b1; }
.warm-sec .item { background: var(--card); }
.warm-sec .item-n { background: var(--muted); }
.sec-head { font-size: 1.3rem; margin: 22px 0 10px; display: flex; align-items: center; gap: 10px; }
.sec-head::after { content: ""; flex: 1; border-top: var(--rule); }
.templates { margin-top: 32px; }
.templates .card small { display: block; max-width: 48ch; margin-top: 2px; }
.day-card { border-top-width: 10px; border-top-color: var(--track); }
.card.row.wrap { column-gap: 16px; }
.card.row.wrap .field-row > span { flex-basis: auto; }
.item { border: var(--thin); background: var(--paper); padding: 10px; margin: 10px 0; }
.item-top { display: flex; align-items: center; gap: 6px; }
.item-top select { font-weight: 700; }
.item-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 8px 0; }
.item-fields label { font-family: var(--mono); font-size: 0.56rem; font-weight: 600; text-transform: uppercase; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.item-fields input { font-family: var(--mono); font-size: 0.85rem; }
.item-note { font-size: 0.92rem; }
.item-n {
  flex-shrink: 0; min-width: 28px; height: 28px; padding: 0 4px; background: var(--ink); color: var(--paper);
  display: grid; place-items: center; font-family: var(--head); font-weight: 900; font-stretch: 65%; font-size: 1rem;
}
.item-name {
  flex: 1 1 auto; min-width: 0; font: inherit; font-weight: 700; font-size: 1.05rem; text-align: left; background: none; border: 0; padding: 4px 2px; cursor: pointer; color: var(--ink);
  text-decoration: underline dotted 1.5px; text-underline-offset: 4px; text-decoration-color: var(--muted);
}
.item-name:hover { text-decoration-color: var(--track); }
.item-main { display: flex; align-items: flex-end; gap: 10px; margin: 12px 0 4px; }
.times { font-family: var(--mono); font-weight: 700; font-size: 1.2rem; padding-bottom: 10px; }
.stepper { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.stepper > span { font-family: var(--mono); font-size: 0.56rem; font-weight: 600; text-transform: uppercase; color: var(--muted); }
.stepper-row { display: flex; border: var(--thin); background: #fff; }
.stepper-row input {
  border: 0; min-width: 0; text-align: center; font-family: var(--mono); font-size: 1.15rem; font-weight: 700; padding: 6px 2px;
  -moz-appearance: textfield;
}
.stepper-row input::-webkit-inner-spin-button, .stepper-row input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-row input:focus { box-shadow: inset 0 0 0 2px var(--track); }
.step-btn {
  flex: 0 0 var(--tap); min-height: var(--tap); border: 0; background: var(--paper); color: var(--ink); cursor: pointer;
  font: 700 1.3rem var(--mono); -webkit-tap-highlight-color: transparent;
}
.step-btn:first-child { border-right: var(--thin); }
.step-btn:last-child { border-left: var(--thin); }
.step-btn:active { background: var(--ink); color: var(--paper); }
.item-notes { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 8px 0; }
.item-notes label { font-family: var(--mono); font-size: 0.56rem; font-weight: 600; text-transform: uppercase; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.item-notes input, .item-notes textarea { font-family: var(--body); font-size: 0.95rem; text-transform: none; color: var(--ink); }
.item-notes input { max-width: 180px; }
.item-extra { margin-top: 4px; }
.item-extra summary, .quick-wrap summary {
  cursor: pointer; font-family: var(--mono); font-size: 0.62rem; font-weight: 600; text-transform: uppercase; color: var(--muted); padding: 6px 0;
}
.add-ex { margin-top: 10px; }
.quick-wrap { margin-top: 10px; }
.pick-new { margin: 0 0 10px; }
.quick { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.quick textarea { font-family: var(--mono); font-size: 0.75rem; }

/* sheets and toast */
.sheet-wrap { position: fixed; inset: 0; background: rgb(17 17 17 / 0.5); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--card); width: 100%; max-width: 560px; max-height: 85vh; border: var(--rule); border-bottom: 0;
  display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); animation: rise 0.18s ease-out;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: var(--rule); margin-bottom: 8px; }
.sheet-body { overflow-y: auto; padding: 0 16px 16px; }
.sheet-body details { margin: 6px 0; border-bottom: var(--hair); }
.sheet-body summary { cursor: pointer; font-weight: 700; padding: 10px 0; }
.pick { list-style: none; padding: 0; margin: 0; }
.pick li + li button { border-top: var(--hair); }
.pick button { width: 100%; text-align: left; padding: 12px 10px; min-height: var(--tap); display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 600; }
.pick button:hover { background: var(--paper); box-shadow: inset 4px 0 0 var(--track); }
.pick small { color: var(--muted); font-family: var(--mono); font-size: 0.62rem; font-weight: 600; text-transform: uppercase; }
#toast {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translate(-50%, 10px);
  background: var(--ink); color: var(--paper); border-left: 4px solid var(--track);
  font-family: var(--mono); font-size: 0.78rem; font-weight: 600; padding: 10px 14px; opacity: 0; pointer-events: none;
  transition: 0.15s ease-out; z-index: 30; max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* tab bar: black strip, active tab is a red block */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex;
  background: var(--ink); border-top: var(--rule); padding: 0 0 env(safe-area-inset-bottom);
}
.tabbar[hidden] { display: none; }
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none;
  font-family: var(--mono); font-size: 0.56rem; font-weight: 600; text-transform: uppercase;
  color: #b9b2a5; padding: 10px 0; min-height: 60px;
}
.tabbar a + a { border-left: 1px solid #333; }
.tabbar a span { font-size: 1.15rem; line-height: 1.2; }
.tabbar a.on { background: var(--track); color: var(--on-track); }

@media (min-width: 900px) {
  .tabbar { left: 50%; transform: translateX(-50%); max-width: 520px; bottom: 16px; border: var(--rule); box-shadow: var(--shadow); padding: 0; }
}
.tbl.compact th, .tbl.compact td { padding: 8px 6px; }
.tbl.compact td:first-child { min-width: 96px; }

/* ---- motion ----
   One entrance per page: app.js adds .enter when you navigate, and the
   page's blocks drop in one after another. In-place redraws (ticking a set,
   typing) don't get the class, so nothing replays while you log. */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.enter > * { animation: rise 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.enter > :nth-child(2) { animation-delay: 0.05s; }
.enter > :nth-child(3) { animation-delay: 0.1s; }
.enter > :nth-child(4) { animation-delay: 0.15s; }
.enter > :nth-child(5) { animation-delay: 0.2s; }
.enter > :nth-child(6) { animation-delay: 0.25s; }
.enter > :nth-child(n+7) { animation-delay: 0.3s; }
.enter .bar-fill { animation: grow 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 0.25s both; }

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

/* Per-set kg/lb tag inside the weight box */
.wfield input { padding-right: 26px; }
.unit-btn { position: absolute; top: 3px; right: 3px; min-width: 24px; min-height: 22px; padding: 2px 4px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); font: 700 0.6rem var(--mono); cursor: pointer; }
.set.done .unit-btn { background: var(--card); }
.unit-field > span { display: block; font: 600 0.56rem var(--mono); text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.unit-field .seg { margin-top: 0; }
