/* The workout log. Provisional, like the focus tracker's: no identity is chosen yet (RMS-6). The
   tokens repeat src/focus/focus.css until the two share a stylesheet (RMS-22). Built for a bad
   day: large targets, high contrast, generous type. */

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #1b1d20;
  --muted: #5b5f66;
  --line: #d9d7d0;
  --accent: #1f5f8b;
  --accent-ink: #ffffff;
  --done: #1f6b4a;
  --done-soft: #dcefe5;
  --danger: #a3261d;
  --danger-soft: #f7e3e0;
  --warn: #8a5a00;
  --warn-soft: #f6e7c8;
  --radius: 14px;
  --tap: 3.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --surface: #1f2226;
    --ink: #eceae4;
    --muted: #a3a7ad;
    --line: #353a40;
    --accent: #7fb6de;
    --accent-ink: #0d1a24;
    --done: #6fcf9f;
    --done-soft: #1c3a2d;
    --danger: #f08a80;
    --danger-soft: #3a2220;
    --warn: #f0c060;
    --warn-soft: #3a2f16;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1.125rem/1.45 system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
main {
  max-width: 34rem;
  margin: 0 auto;
  padding: max(1.25rem, env(safe-area-inset-top)) 1rem calc(6rem + env(safe-area-inset-bottom));
  display: grid;
  gap: .85rem;
  align-content: start;
}
body.with-bar main { padding-bottom: calc(10rem + env(safe-area-inset-bottom)); }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0; text-wrap: balance; }
h2 { font-size: 1.2rem; margin: .75rem 0 0; }
/* A list opened scrolled to a body part keeps a little room above it. */
h2.part { scroll-margin-top: 1rem; }
p { margin: 0; }
a { color: var(--accent); font-weight: 600; text-decoration: none; }
a:hover { text-decoration: underline; }

.eyebrow { color: var(--muted); font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.strong { font-weight: 700; }
.center { text-align: center; justify-self: center; }
.top, .row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.stack { display: grid; gap: .85rem; }
.stack.tight { gap: .5rem; }
.warn-text { color: var(--warn); font-weight: 600; }
.done-text { color: var(--done); font-weight: 600; }

/* ---- controls */

button, input, select { font: inherit; color: inherit; }
button, .button {
  min-height: var(--tap);
  padding: 0 1.25rem;
  border-radius: var(--radius);
  border: 2px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  font-weight: 600;
  text-align: center;
}
.button { color: var(--ink); text-decoration: none; }
.button:hover { text-decoration: none; }
button:disabled { opacity: .35; cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.quiet { background: transparent; }
.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.dashed { border-style: dashed; background: transparent; color: var(--accent); }
.huge { min-height: 4.75rem; font-size: 1.3rem; width: 100%; }
.big { min-height: 4.25rem; width: 100%; }
.big.left { display: grid; justify-items: start; text-align: left; gap: .1rem; padding: .6rem 1.1rem; }
.big small { font-weight: 400; font-size: .9rem; opacity: .85; }
input:not([type="checkbox"]), select {
  min-height: var(--tap);
  padding: 0 1rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  width: 100%;
}
.field { display: grid; gap: .35rem; }
.field span { font-weight: 600; }
.field small { font-weight: 400; color: var(--muted); }
.inline { display: flex; gap: .5rem; }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .75rem 1rem; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.toggle span { display: grid; }
.toggle small { color: var(--muted); font-size: .9rem; }
.toggle input { width: 1.6rem; height: 1.6rem; accent-color: var(--accent); flex: none; }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chips.center { justify-content: center; }
.chip { min-height: 2.75rem; border-radius: 99px; padding: 0 1rem; font-size: 1rem; font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.pill { font-size: .8rem; font-weight: 700; padding: .15rem .65rem; border-radius: 99px; border: 1px solid var(--line); color: var(--accent); white-space: nowrap; background: var(--surface); }
.pill.on, .pill.above, .pill.done { color: var(--done); border-color: var(--done); background: var(--done-soft); }
.pill.below { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.seg.tall button { min-height: 4.75rem; font-size: 1.2rem; }
.seg.two { grid-template-columns: repeat(2, 1fr); }
.tag { display: inline-grid; place-items: center; min-height: 2.25rem; padding: 0 .9rem; border-radius: 99px; border: 1px solid var(--line); font-size: 1rem; background: var(--surface); }

.stepper {
  display: grid; grid-template-columns: 4.5rem 1fr 4.5rem; align-items: center; gap: .5rem;
  background: var(--surface); border: 2px solid var(--line); border-radius: 18px; padding: .5rem;
}
.stepper button { min-height: 4.5rem; padding: 0; font-size: 2rem; border: none; background: var(--bg); color: var(--accent); }
.stepper div { text-align: center; line-height: 1.1; }
.stepper b { font-size: 2.6rem; font-variant-numeric: tabular-nums; }
.stepper small { display: block; color: var(--muted); font-size: .9rem; }

/* ---- Today */

.bar { height: .6rem; border-radius: 1rem; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); width: 0; }
.today-next { text-align: center; padding: 1.5rem 0 .5rem; display: grid; gap: .25rem; }
.today-name { font-size: 3rem; font-weight: 700; line-height: 1; }
.card { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; display: grid; gap: .2rem; }
.card.row { display: flex; }

/* ---- the sheet */

.entry { display: grid; gap: .4rem; padding-top: .35rem; scroll-margin-top: 1rem; }
.entry.skipped b { color: var(--muted); text-decoration: line-through; }
.exhead { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.exhead b { font-size: 1.2rem; }
/* Secondary actions: still buttons, a size down. */
button.small, .button.small { min-height: 2.75rem; padding: 0 .9rem; font-size: .95rem; color: var(--accent); white-space: nowrap; }
button.small.primary, .button.small.primary { color: var(--accent-ink); }
button.small.danger, .button.small.danger { color: var(--danger); }
.set-actions { display: flex; gap: .5rem; }
.set-actions > * { flex: 1; }
.facts { color: var(--muted); font-size: .95rem; font-variant-numeric: tabular-nums; }
.row-set {
  display: grid; grid-template-columns: 1.5rem 1fr 1.6rem; align-items: center; gap: .6rem;
  min-height: 3.4rem; padding: .35rem .9rem; border-radius: 12px;
  background: var(--surface); border: 2px solid var(--line); color: var(--ink); font-weight: 500;
  font-size: 1.15rem; font-variant-numeric: tabular-nums; text-decoration: none;
}
.row-set:hover { text-decoration: none; }
.row-set > span:first-child { color: var(--muted); }
.row-set.ok { background: var(--done-soft); border-color: var(--done); }
.row-set.next { border-color: var(--accent); }
/* The tick only shows; it is never tapped. */
.tick { width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 2px solid var(--line); justify-self: end; display: grid; place-items: center; }
.row-set.next .tick { border-color: var(--accent); }
.row-set.ok .tick { background: var(--done); border-color: var(--done); }
.row-set.ok .tick::after { content: ""; width: .35rem; height: .65rem; margin-top: -.15rem; border: solid var(--accent-ink); border-width: 0 3px 3px 0; transform: rotate(45deg); }

.intervalbar {
  position: fixed; inset: auto 0 calc(var(--tap) + env(safe-area-inset-bottom)) 0; z-index: 2;
  display: flex; justify-content: center; padding: .9rem 1rem;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums;
}
.intervalbar:hover { text-decoration: none; }
.intervalbar.over { background: var(--warn-soft); color: var(--warn); border-top: 3px solid var(--warn); }
body:has(.tabs[hidden]) .intervalbar { bottom: env(safe-area-inset-bottom); }

/* ---- a set */

.back { justify-self: start; }
.big-ex { text-align: center; display: grid; gap: .15rem; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.pair div { display: grid; padding: .5rem .75rem; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-variant-numeric: tabular-nums; }
.pair small { color: var(--muted); font-size: .85rem; }
.pair .target { border-color: var(--accent); }

.ring {
  --p: 0%;
  width: 14rem; height: 14rem; margin: 1rem auto .25rem; border-radius: 50%;
  background: conic-gradient(var(--accent) var(--p), var(--line) 0);
  display: grid; place-items: center;
}
.ring.over { background: var(--warn); }
.ring > div { width: 12rem; height: 12rem; border-radius: 50%; background: var(--bg); display: grid; place-content: center; text-align: center; }
.ring-time { font-size: 3.25rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1; }
.ring.over .ring-time { color: var(--warn); }
.timer { font-size: 4.5rem; font-weight: 700; text-align: center; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1; margin: 1.5rem 0 0; }

/* ---- finish and history */

.fin { display: grid; grid-template-columns: 1fr auto; gap: .25rem .75rem; align-items: center; padding: .75rem 1rem; border-radius: var(--radius); background: var(--surface); border: 2px solid var(--line); }
.fin .sub { grid-column: 1 / -1; color: var(--muted); font-size: .95rem; font-variant-numeric: tabular-nums; }
.fin button.sub { color: var(--accent); justify-self: stretch; }
.note { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; display: grid; gap: .3rem; }
.note ul { margin: 0; padding-left: 1.2rem; display: grid; gap: .15rem; font-variant-numeric: tabular-nums; }
.note.walk { gap: .5rem; }
.note.walk > p { margin: 0; }
.numbers { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem .75rem; margin: .15rem 0; }
.numbers div { display: grid; gap: .05rem; }
.numbers dt { color: var(--muted); font-size: .8rem; }
.numbers dd { margin: 0; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.numbers.two { grid-template-columns: repeat(2, 1fr); }
.numbers dd small { font-size: .85rem; font-weight: 600; color: var(--muted); }
.note.walk > .top { flex-wrap: nowrap; align-items: flex-start; }
.note.walk > .top > b { padding-top: .45rem; }
.walk-foot { justify-content: flex-start; }
.band { display: grid; grid-template-columns: 6rem 1fr; align-items: center; gap: .5rem; }
.band > span { color: var(--muted); font-size: .95rem; }
.band .chip { min-width: 2.75rem; padding: 0 .5rem; }

/* ---- setting up */

/* Plates and dumbbells: one cell a size, tapped once for each pair. */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: .5rem; }
.cell { display: grid; gap: .25rem; }
.cell > button:first-child { min-height: 4.25rem; padding: .25rem; display: grid; gap: 0; line-height: 1.15; font-variant-numeric: tabular-nums; }
.cell b { font-size: 1.35rem; }
.cell small { color: var(--muted); font-weight: 500; font-size: .85rem; }
.cell.on > button:first-child { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.cell.on > button:first-child small { color: inherit; opacity: .85; }
.cell .minus { min-height: 2.5rem; padding: 0; font-size: 1.3rem; color: var(--accent); }
.machine { display: grid; gap: .5rem; }
.card-title { font-size: 1.2rem; margin-bottom: .35rem; }
.inventory { margin: 0; display: grid; grid-template-columns: 6rem 1fr; gap: .55rem .75rem; font-size: 1rem; }
.inventory dt { color: var(--muted); font-weight: 600; }
.inventory dd { margin: 0; display: grid; gap: .35rem; font-variant-numeric: tabular-nums; }
.inventory .item { display: grid; }
.inventory small { color: var(--muted); font-size: .88rem; }
.weigh { display: grid; grid-template-columns: 1fr 9rem; gap: .5rem; align-items: end; }
.machine > button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
a.button.big.left { color: var(--ink); }
a.button.big.left small { color: var(--muted); opacity: 1; }
.chips .chip[aria-pressed="false"] { color: var(--ink); }

/* Development only: the screen's id, for naming it in review. */
.screen-id {
  position: fixed; top: max(.4rem, env(safe-area-inset-top)); right: .4rem; z-index: 9; pointer-events: none;
  font: 700 .75rem/1 ui-monospace, monospace; padding: .3rem .45rem; border-radius: 6px;
  background: var(--ink); color: var(--bg); opacity: .7;
}

/* ---- planning */

.big-name { font-size: 1.6rem; margin: 0; }
.big.left .pill { margin-left: .5rem; vertical-align: middle; }
.slot-list { display: grid; grid-template-columns: 1.1rem 1fr; gap: .4rem .5rem; width: 100%; margin-top: .35rem; }
.slot-list > b { font-size: .85rem; color: var(--muted); padding-top: .15rem; }
.slot-list > span { display: grid; font-weight: 500; font-size: .95rem; }
.card.first { border-color: var(--accent); }
.reorder { display: grid; grid-template-columns: 1fr 3.25rem 3.25rem; gap: .5rem; align-items: center; padding: .4rem .5rem .4rem 1rem; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); font-weight: 600; }
.reorder.two { grid-template-columns: 1fr auto; }
.reorder a { color: inherit; text-decoration: none; min-height: 2.75rem; display: flex; align-items: center; }
.inventory.wide { grid-template-columns: minmax(7rem, 40%) 1fr; }

/* ---- tabs */

.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 3;
  display: flex; justify-content: center;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs[hidden] { display: none; }
.tabs a { flex: 1; max-width: 9rem; min-height: var(--tap); display: grid; place-items: center; color: var(--muted); }
.tabs a:hover { text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }

@media (prefers-reduced-motion: no-preference) {
  button, .button { transition: background-color .12s, border-color .12s; }
}

/* A change that has not reached the server (src/account/server.js). */
.unsaved {
  position: sticky; top: 0; z-index: 10; margin: 0;
  padding: .75rem 1rem; background: var(--danger); color: var(--bg); font-weight: 600;
}
