/* iOS-style presentation layer. Tokens first; dark mode swaps the tokens only. */
:root {
  color-scheme: light dark;
  --tint: #004d98;            /* project blue: links, selection, text actions */
  --tint-fill: #004d98;       /* filled primary buttons (white label) */
  --tint-soft: rgba(0, 77, 152, .12);
  --garnet: #a50044;          /* reserved: running set */
  --bg: #f2f2f7;              /* grouped background */
  --row: #ffffff;             /* grouped row surface */
  --row-pressed: #e5e5ea;
  --label: #000000;
  --label-2: rgba(60, 60, 67, .62);
  --label-3: rgba(60, 60, 67, .32);
  --sep: rgba(60, 60, 67, .22);
  --fill: rgba(118, 118, 128, .12);   /* segmented track, round buttons */
  --fill-soft: rgba(118, 118, 128, .08);
  --thumb: #ffffff;
  --danger: #d70015;
  --danger-fill: #c9251b;
  --success: #248a3d;
  --warn: #a35200;
  --gray-bar: rgba(120, 120, 128, .45);
  --bar: rgba(249, 249, 249, .86);
  --bar-solid: #f9f9f9;
  --toast-bg: rgba(44, 44, 46, .96);
  --toast-label: #ffffff;
  --toast-action: #8cc2ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .06);
  --radius: 12px;
  --radius-btn: 14px;
  --side: 16px;
  --tab-h: 49px;
  --nav-h: 44px;
  --content-width: 640px;
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --tint: #5aa2f0;
    --tint-fill: #1f6fd1;
    --tint-soft: rgba(90, 162, 240, .18);
    --garnet: #b3124f;
    --bg: #000000;
    --row: #1c1c1e;
    --row-pressed: #2c2c2e;
    --label: #ffffff;
    --label-2: rgba(235, 235, 245, .62);
    --label-3: rgba(235, 235, 245, .32);
    --sep: rgba(84, 84, 88, .6);
    --fill: rgba(118, 118, 128, .32);
    --fill-soft: rgba(118, 118, 128, .18);
    --thumb: #636366;
    --danger: #ff6961;
    --danger-fill: #d9372d;
    --success: #32d74b;
    --warn: #ff9f0a;
    --gray-bar: rgba(160, 160, 170, .5);
    --bar: rgba(29, 29, 31, .84);
    --bar-solid: #1d1d1f;
    --toast-bg: rgba(58, 58, 60, .97);
    --toast-action: #8cc2ff;
    --shadow: 0 0 0 .5px rgba(255, 255, 255, .06), 0 6px 18px rgba(0, 0, 0, .5);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); overscroll-behavior-x: none; }
body {
  margin: 0; background: var(--bg); color: var(--label);
  font: 400 17px/1.35 var(--font); letter-spacing: -.01em;
  overflow-wrap: anywhere; font-variant-numeric: tabular-nums;
  padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--tint); text-decoration: none; }
button, input, select, textarea { font: inherit; letter-spacing: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--tint); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---- type scale ---- */
h1, h2, h3, p { margin: 0; }
.large-title { font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: .01em; margin: 12px var(--side) 4px; }
h3 { font-size: 15px; font-weight: 600; }
.subhead { font-size: 15px; color: var(--label-2); margin: 0 var(--side) 8px; }
.section-title { font-size: 13px; line-height: 18px; font-weight: 400; color: var(--label-2); margin: 24px calc(var(--side) + 16px) 7px; text-transform: none; }
.footnote, .help { font-size: 13px; line-height: 18px; color: var(--label-2); }
.footnote { margin: 7px calc(var(--side) + 16px) 0; }
.help { margin: 8px 0 0; }
.meta { font-size: 13px; line-height: 18px; color: var(--label-2); }
.muted, .empty { color: var(--label-2); }
.empty { font-size: 15px; }

/* ---- shell ---- */
#app { max-width: var(--content-width); margin: 0 auto; padding: env(safe-area-inset-top) 0 calc(var(--tab-h) + env(safe-area-inset-bottom) + 36px); outline: none; }
#app > :not(.navbar):not(.timer-bar):not(.large-title):not(.subhead):not(.section-title):not(.footnote):not(.progress) { margin-inline: var(--side); }
/* Save status: hidden when saved (kept in the DOM for assistive tech), tiny while saving, banner on error. */
#save-status { position: fixed; z-index: 9; margin: 0; padding: 0; font-size: 12px; line-height: 16px; pointer-events: none; }
#save-status[data-state=saved] { width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#save-status[data-state=saving] { top: calc(env(safe-area-inset-top) + 4px); right: 10px; padding: 2px 8px; border-radius: 10px; background: var(--fill); color: var(--label-2); }
#save-status[data-state=error] { top: calc(env(safe-area-inset-top) + 8px); left: 12px; right: 12px; max-width: calc(var(--content-width) - 24px); margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--danger-fill); color: #fff; font-size: 15px; line-height: 20px; font-weight: 600; box-shadow: 0 6px 24px rgba(0, 0, 0, .28); pointer-events: auto; }
#save-status[data-state=error]::before { content: ""; flex: none; width: 22px; height: 22px; background: #fff; -webkit-mask: var(--warn-icon) center / contain no-repeat; mask: var(--warn-icon) center / contain no-repeat; }
:root { --warn-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3 22 20H2z' fill='none' stroke='%23000' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M12 10v5M12 17.5v.01' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.navbar { position: sticky; top: 0; z-index: 6; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: var(--nav-h); padding: 0 8px; background: var(--bar-solid); border-bottom: .5px solid var(--sep); }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .navbar, .tabbar, .timer-bar:not(.running) { background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
}
.nav-back { justify-self: start; display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; padding-right: 8px; font-size: 17px; color: var(--tint); }
.nav-back svg { width: 12px; height: 20px; margin: 0 4px 0 2px; flex: none; }
.nav-title { font-size: 17px; line-height: 22px; font-weight: 600; max-width: 56vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.nav-right { justify-self: end; }
.tabbar { position: fixed; z-index: 7; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(3, 1fr); padding: 0 max(8px, env(safe-area-inset-left)) env(safe-area-inset-bottom); background: var(--bar-solid); border-top: .5px solid var(--sep); }
.tabbar a { min-height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding-top: 3px; color: var(--label-2); font-size: 10px; line-height: 12px; font-weight: 500; letter-spacing: .01em; }
.tabbar svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current=page] { color: var(--tint); }
.tabbar a[aria-current=page] svg .fill-sel { fill: currentColor; fill-opacity: .16; }
.tabbar a:active { opacity: .5; }

/* ---- inset grouped lists ---- */
.list, .card { display: block; background: var(--row); border-radius: var(--radius); margin: 0 var(--side); padding: 0; list-style: none; overflow: hidden; }
ul.list, ol.list { padding: 0; }
.card { padding: 16px; margin-top: 12px; overflow: visible; }
.card > :first-child { margin-top: 0; }
.card > h2 { font-size: 17px; line-height: 22px; font-weight: 600; margin-bottom: 4px; }
.list > * { position: relative; }
.list > * + *::before, .set-list > li + li::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--sep); }
.list > details > .set-list { border-top: .5px solid var(--sep); }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 10px 16px; margin: 0; border: 0; border-radius: 0; background: transparent; color: var(--label); text-align: left; font-size: 17px; line-height: 22px; font-weight: 400; cursor: pointer; text-decoration: none; }
.row:active, summary.row:active { background: var(--row-pressed); }
.row .grow { flex: 1; min-width: 0; display: block; }
.row .title { display: block; font-size: 17px; line-height: 22px; }
.row .sub { display: block; font-size: 13px; line-height: 18px; color: var(--label-2); margin-top: 1px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-variant-numeric: tabular-nums; }
.row .trail { flex: none; font-size: 15px; color: var(--label-2); }
.unit-hint { color: var(--label-3); white-space: nowrap; }
.row.chev::after, summary.row::after { content: ""; flex: none; width: 8px; height: 14px; margin-left: 2px; background: var(--label-3); -webkit-mask: var(--chev) center / contain no-repeat; mask: var(--chev) center / contain no-repeat; }
:root { --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14'%3E%3Cpath d='M1 1l6 6-6 6' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.row.add::before { content: ""; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--tint); -webkit-mask: var(--plus) center / contain no-repeat; mask: var(--plus) center / contain no-repeat; }
:root { --plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Cpath fill-rule='evenodd' d='M11 0a11 11 0 100 22 11 11 0 000-22zM10 5.5h2V10h4.5v2H12v4.5h-2V12H5.5v-2H10z'/%3E%3C/svg%3E"); }
.row.add { color: var(--tint); }
.row.center { justify-content: center; text-align: center; }
.row.tint { color: var(--tint); }
.row.destructive { color: var(--danger); justify-content: center; }
.row.kv { justify-content: space-between; min-height: 44px; }
.row.kv .value { text-align: right; font-weight: 600; }
.row.empty { min-height: 44px; cursor: default; }
summary.row { list-style: none; }
summary.row::-webkit-details-marker { display: none; }
details[open] > summary.row::after { transform: rotate(90deg); }
.row-select { justify-content: space-between; cursor: default; }
.row-select > select { flex: 1; min-width: 0; max-width: 62%; width: auto; min-height: 44px; margin: 0 -4px 0 0; padding: 0 22px 0 8px; border: 0; background: transparent; color: var(--tint); font-size: 17px; text-align: right; text-align-last: right; text-overflow: ellipsis; -webkit-appearance: none; appearance: none; background-image: var(--updown); background-repeat: no-repeat; background-position: right 4px center; background-size: 8px 14px; }
:root { --updown: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14'%3E%3Cpath d='M1 5l3-3.2L7 5M1 9l3 3.2L7 9' fill='none' stroke='%23888' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.row-select > select:disabled { opacity: .4; }
.row.field { cursor: text; }
.row.field > span { flex: none; width: 8.5em; }
.row.field > input, .row.field > select { flex: 1; width: auto; min-width: 0; min-height: 44px; margin: 0; padding: 0; border: 0; background: transparent; text-align: right; font-size: 17px; color: var(--label); -webkit-appearance: none; appearance: none; }
.row.field > select { color: var(--tint); text-align-last: right; }
.row.field > input::placeholder, textarea::placeholder { color: var(--label-3); }
.row.field > input[type=number] { -moz-appearance: textfield; }
.note-label { display: block; margin: 0; padding: 0; }
.note-label > .section-title { display: block; }
.note-label textarea { display: block; width: 100%; min-height: 96px; padding: 12px 16px; border: 0; background: transparent; resize: none; font-size: 17px; line-height: 1.4; color: var(--label); }
input[type=file] { width: auto; max-width: 62%; margin: 0; padding: 0; border: 0; font-size: 13px; color: var(--label-2); }
input[type=file]::file-selector-button { min-height: 36px; margin-right: 8px; padding: 0 12px; border: 0; border-radius: 18px; background: var(--tint-soft); color: var(--tint); font: 600 15px var(--font); }
.row.file { cursor: default; justify-content: space-between; }
.exercise-row { display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 16px; min-height: 60px; }
.exercise-row .grow { flex: 1; min-width: 0; }
.exercise-row .title { font-size: 17px; line-height: 22px; display: block; }
.exercise-row .sub { font-size: 13px; line-height: 18px; color: var(--label-2); display: block; }
.exercise-row .txt { flex: none; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 8px; font-size: 15px; font-weight: 500; color: var(--tint); }
.exercise-row .txt:active { opacity: .4; }

/* ---- buttons ---- */
button, .button { display: inline-flex; justify-content: center; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; margin: 0; border: 0; border-radius: var(--radius-btn); background: transparent; color: var(--tint); font-size: 17px; line-height: 22px; font-weight: 500; text-decoration: none; cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button:active, .button:active { opacity: .35; }
button.primary, .button.primary { min-height: 50px; padding: 0 20px; background: var(--tint-fill); color: #fff; font-weight: 600; }
button.primary:active, .button.primary:active { opacity: .78; }
button.danger { color: var(--danger); }
button.quiet { font-size: 15px; font-weight: 500; }
button.wide, .button.wide { width: 100%; }
button.big { width: 100%; min-height: 58px; font-size: 22px; font-weight: 700; letter-spacing: .12em; border-radius: 16px; }
button:disabled { opacity: .35; cursor: default; }
button:disabled:active { opacity: .35; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.actions > * { flex: 1 1 auto; }
.actions.inline { margin: 0; gap: 4px; }
.actions.inline > * { flex: 0 0 auto; min-width: 44px; min-height: 44px; font-size: 15px; padding: 0 10px; }
.actions.secondary { margin: 8px 0 0; }
.actions.secondary > * { flex: 1 1 0; font-size: 15px; }
.actions.stacked { flex-direction: column; gap: 4px; margin: 20px var(--side) 0; }
.actions.stacked .primary { width: 100%; }
.stack { display: grid; gap: 0; }
.stack > .primary { margin-top: 20px; }

/* ---- forms ---- */
input, select, textarea { font-size: 17px; }
label { display: block; }
fieldset { min-width: 0; padding: 0; border: 0; margin: 0; }
legend { padding: 0; }

/* segmented control */
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 2px; background: var(--fill); border-radius: 10px; }
.segmented label { position: relative; margin: 0; }
.segmented input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; opacity: 0; cursor: pointer; }
.segmented span { display: flex; justify-content: center; align-items: center; min-height: 40px; padding: 0 8px; border-radius: 8px; color: var(--label); font-size: 15px; font-weight: 500; -webkit-user-select: none; user-select: none; }
.segmented input:checked + span { background: var(--thumb); font-weight: 600; box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 1px 1px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
.segmented input:active + span { opacity: .6; }
.segmented input:focus-visible + span { outline: 3px solid var(--tint); outline-offset: 1px; }

/* ---- training ---- */
.timer-bar { position: sticky; top: calc(var(--nav-h) + env(safe-area-inset-top)); z-index: 5; margin: 0; padding: 8px var(--side); background: var(--bar-solid); border-bottom: .5px solid var(--sep); text-align: center; }
.timer-bar.running { background: var(--garnet); border-color: transparent; color: #fff; }
.timer { display: flex; justify-content: center; align-items: baseline; gap: 10px; min-height: 46px; font-size: 15px; line-height: 1.2; color: var(--label-2); font-variant-numeric: tabular-nums; }
.timer .t-label { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.timer .t-label .ic { font-size: 16px; }
.timer .t-idle { display: inline-flex; align-items: center; gap: 8px; align-self: center; color: var(--label-3); }
.timer .t-idle .ic { font-size: 22px; }
.timer .t-idle-digits { font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: 0; }
.timer .t-digits { font-size: 40px; line-height: 46px; font-weight: 700; letter-spacing: 0; color: var(--tint); font-variant-numeric: tabular-nums; }
.timer .t-msg { align-self: center; font-size: 15px; font-weight: 500; }
.timer-bar.running .timer, .timer-bar.running .t-digits { color: #fff; }
.timer-bar.running .t-label { opacity: .85; }

.next-card { margin-top: 14px; padding: 16px; border-radius: 18px; box-shadow: var(--shadow); }
.next-card > .card-head { position: relative; display: flex; align-items: center; justify-content: space-between; min-height: 24px; margin: 0 0 12px; }
.next-card h2 { font-size: 15px; line-height: 22px; font-weight: 700; color: var(--tint); margin: 0; letter-spacing: .02em; }
.editor { display: grid; gap: 10px; }
.segment { background: var(--fill-soft); border-radius: 12px; padding: 2px 14px; }
.segment legend:not(.sr-only) { float: left; width: 100%; padding: 10px 0 0; font-size: 13px; font-weight: 600; color: var(--tint); }
.segment legend + * { clear: both; }
.number-fields { display: grid; gap: 0; }
.number-fields > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 64px; }
.number-fields > div + div { border-top: .5px solid var(--sep); }
.number-fields label { flex: none; width: 5.2em; font-size: 15px; font-weight: 500; color: var(--label-2); }
.stepper { display: grid; grid-template-columns: 44px minmax(76px, 1fr) 44px; align-items: center; flex: 1; max-width: 230px; gap: 4px; }
.stepper button { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; background: var(--fill); color: var(--tint); font-size: 24px; line-height: 1; font-weight: 400; }
.stepper button:active { opacity: .5; }
.stepper input { width: 100%; min-height: 52px; padding: 0; border: 0; border-radius: 8px; background: transparent; text-align: center; font-size: 34px; line-height: 40px; font-weight: 700; letter-spacing: 0; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper [data-action="step"] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: pan-y; }
.number-entry { position: relative; min-width: 0; }
.stepper .picker-trigger { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 8px; background: transparent; }
.stepper input[readonly] { cursor: pointer; }

/* Native modal supplies the backdrop, focus trap and Escape handling. */
.picker-sheet { width: min(100%, var(--content-width)); max-width: 100%; max-height: 80vh; max-height: 80dvh; margin: auto auto 0; padding: 0; border: 0; border-radius: 20px 20px 0 0; background: var(--row); color: var(--label); box-shadow: var(--shadow); }
.picker-sheet[open] { display: flex; flex-direction: column; }
.picker-sheet::backdrop { background: rgba(0, 0, 0, .4); }
.picker-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px var(--side) 0; }
.picker-header h2 { font-size: 20px; }
.picker-help { color: var(--label-2); font-size: 13px; padding: 4px var(--side) 12px; }
.picker-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; overflow-y: auto; overscroll-behavior-y: contain; min-height: 0; padding: 8px var(--side); }
.picker-value { position: relative; min-height: 52px; padding: 8px 4px 14px; background: var(--fill); color: var(--label); font-size: 22px; border: 2px solid transparent; border-radius: var(--radius); }
.picker-value.selected { border-color: var(--tint); background: var(--tint-soft); color: var(--tint); }
.picker-value.previous::after { content: ''; position: absolute; bottom: 5px; left: calc(50% - 3px); width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.picker-footer { padding: 8px var(--side) max(12px, env(safe-area-inset-bottom)); }
.picker-footer button { width: 100%; }
.segment .quiet { width: 100%; justify-content: flex-start; padding: 0; }
.main-action { margin: 14px 0 0; }

.next-card .editor > .quiet { justify-self: start; }
.queue-row { display: block; }
.queue-row > summary { min-height: 52px; gap: 8px; }
.queue-row > summary::after { margin-left: 0; }
.q-label { flex: none; font-size: 13px; color: var(--label-2); }
.q-sum { flex: 1; min-width: 0; overflow-wrap: normal; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.q-edit { flex: none; font-size: 15px; color: var(--tint); }
.queue-row > .editor { padding: 0 16px 8px; }
.queue-row > button { margin: 0 8px 6px; font-size: 15px; color: var(--danger); }
.done-list { margin-top: 12px; }
.done-list li { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 16px; font-size: 15px; }
.done-list li + li::before { content: none; }
.done-list li > span:last-child { flex: 1; }
.done-list .skipped { color: var(--label-2); }
.badge { display: inline-flex; align-items: center; flex: none; padding: 1px 8px; border-radius: 10px; background: var(--fill); color: var(--label-2); font-size: 12px; line-height: 18px; font-weight: 500; white-space: nowrap; }
.badge.ok { background: transparent; color: var(--success); padding: 0; font-weight: 600; }
.badge.warm { background: var(--tint-soft); color: var(--tint); }
.set-list { margin: 0; padding: 0; list-style: none; }
.set-list > li { position: relative; padding: 12px 16px; }
.set-head { display: flex; align-items: center; gap: 10px; min-height: 24px; }
.set-no { flex: none; display: inline-flex; justify-content: center; align-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--fill); color: var(--label-2); font-size: 13px; font-weight: 600; }
.set-no.check { background: var(--success); color: #fff; font-size: 0; }
.set-no.check::before { content: ""; width: 11px; height: 6px; margin-top: -2px; border-left: 2.4px solid #fff; border-bottom: 2.4px solid #fff; transform: rotate(-45deg); }
.set-values { flex: 1; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.set-list li > :not(.set-head):not(.edit-panel) { margin-left: 34px; }
.set-list li > p.meta { margin-top: 2px; }
.set-list details { margin-top: 2px; }
.set-list summary { display: flex; align-items: center; min-height: 28px; padding: 0; font-size: 13px; color: var(--tint); cursor: pointer; list-style: none; }
.set-list summary::-webkit-details-marker { display: none; }
.set-list details > p { margin-top: 2px; }
.set-list .actions.inline { margin-top: 2px; margin-left: 24px; }
.edit-panel { margin: 10px 0 0; padding: 12px; border-radius: 14px; background: var(--fill-soft); }
.edit-panel .actions { margin: 10px 0 0; }
.edit-panel .help { margin-top: 8px; }
.card.notice { border-radius: 14px; margin-top: 12px; }
.card.notice h2 { margin-top: 0; color: var(--tint); font-size: 13px; line-height: 18px; font-weight: 600; letter-spacing: .02em; }
.card.notice p { font-size: 15px; margin: 2px 0 12px; }
.card.notice .button { width: 100%; }
.card.notice.compact { padding: 12px 16px; }
.card.notice.compact p { margin: 2px 0 0; }
.card.notice > .button:only-child { width: 100%; }
.home-list-gap { height: 0; }

/* ---- charts ---- */
.chart-card { padding: 14px 16px 12px; }
.chart-card > h2 { margin-bottom: 2px; }
.chart-card .row-select { margin: 6px -16px 0; width: calc(100% + 32px); border-top: .5px solid var(--sep); }
.chart { width: 100%; height: auto; display: block; overflow: visible; margin-top: 8px; }
.chart-grid { stroke: var(--sep); stroke-width: .5; }
.chart-tick { stroke: var(--sep); stroke-width: 1; }
.chart-line { stroke: var(--tint); stroke-width: 2.5; stroke-linecap: round; }
.chart-gap { stroke-dasharray: 6 5; stroke-linecap: butt; stroke-width: 2; }
.chart-point { fill: var(--tint); stroke: var(--row); stroke-width: 2; pointer-events: none; }
.chart-hit { fill: transparent; }
.chart-label { font-family: inherit; font-size: 11.5px; fill: var(--label-2); pointer-events: none; font-variant-numeric: tabular-nums; }
.chart-reps { fill: var(--label); font-weight: 600; paint-order: stroke; stroke: var(--row); stroke-width: 3px; stroke-linejoin: round; }
.chart-unit { font-weight: 600; }
.chart a:focus-visible .chart-hit { fill: var(--tint-soft); stroke: var(--tint); }
.chart-legend { display: grid; gap: 2px; margin-top: 8px; }
.legend-key { display: inline-block; width: 28px; height: 8px; vertical-align: middle; margin-right: 8px; overflow: visible; }

/* ---- toast: floating capsule above the tab bar ---- */
.toast { position: fixed; z-index: 10; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 12px); transform: translateX(-50%); width: max-content; max-width: min(calc(100vw - 24px), 420px); display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 18px; border-radius: 26px; background: var(--toast-bg); color: var(--toast-label); box-shadow: 0 6px 24px rgba(0, 0, 0, .28), 0 0 0 .5px rgba(255, 255, 255, .08); font-size: 15px; line-height: 20px; }
.toast-text { flex: 1; min-width: 0; padding: 8px 0; font-weight: 500; }
.toast-actions { display: flex; flex: none; }
.toast button { min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 22px; color: var(--toast-action); font-size: 15px; font-weight: 600; }
.toast.error { background: var(--danger-fill); }
.toast.error button { color: #fff; }
@media (prefers-reduced-motion: no-preference) {
  .toast:not([hidden]) { animation: toast-in .22s ease-out; }
  @keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
  button, .row, .tabbar a, .nav-back { transition: opacity .12s, background-color .12s; }
  .segmented span { transition: background-color .15s, box-shadow .15s; }
}
@media (max-width: 374px) {
  :root { --side: 12px; }
  .large-title { font-size: 31px; }
  .section-title, .footnote { margin-inline: calc(var(--side) + 12px); }
  .stepper { grid-template-columns: 44px minmax(64px, 1fr) 44px; gap: 2px; }
  .stepper input { font-size: 30px; }
}
/* keep the last row reachable while the floating toast is shown */
body:has(#toast:not([hidden])) #app { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 100px); }
.row.file > span { flex: none; white-space: nowrap; }
.row.file > input[type=file] { flex: 1; min-width: 0; max-width: none; text-align: right; }
.row.file > input[type=file]::file-selector-button { float: right; margin: 0 0 0 8px; }
#app > form#exercise-form { margin-inline: 0; }

/* ================= second pass: visual encodings ================= */
.ic { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.14em; }
.sw { display: inline-block; width: 12px; height: 8px; margin-right: 5px; border-radius: 2px; vertical-align: 0; }

/* home / history: mini set-bars */
.row .trail.spark { display: flex; align-items: flex-end; gap: 8px; }
.setbars { display: block; max-width: 96px; height: 28px; overflow: visible; }
.sb-main { fill: var(--tint); }
.sb-warm { fill: none; stroke: var(--tint); stroke-width: 1.5; }
.sb-drop { fill: var(--tint); fill-opacity: .38; stroke: var(--tint); stroke-width: 1; }
.sb-base { stroke: var(--label-3); stroke-width: 1; }
.spark-w { min-width: 38px; font-size: 13px; line-height: 16px; color: var(--label-2); text-align: right; font-weight: 500; }
.row .trail.muted-dash { color: var(--label-3); }
.resume-line { display: flex; align-items: baseline; gap: 8px; margin: 0 0 12px; font-size: 17px; }
.resume-name { font-weight: 600; }
.card.notice.resume > p { margin: 0 0 12px; }

/* progress dots */
.progress { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px; margin: 12px var(--side) 0; min-height: 14px; }
.dot { display: inline-block; flex: none; width: 12px; height: 12px; border-radius: 50%; box-sizing: border-box; }
.dot.warm { width: 8px; height: 8px; }
.dot.done { background: var(--tint); }
.dot.pending { border: 1.5px solid var(--label-3); }
.dot.next { border: 3px solid var(--tint); background: var(--tint-soft); }
.dot.warm.next { border-width: 2px; }
.dot.skipped { position: relative; width: 12px; height: 12px; border: 0; }
.dot.skipped::before, .dot.skipped::after { content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 1.5px; margin: -.75px 0 0 -5px; background: var(--label-3); transform: rotate(45deg); }
.dot.skipped::after { transform: rotate(-45deg); }

/* info disclosure as popover */
.info > summary { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -10px -10px -10px 0; color: var(--label-3); list-style: none; cursor: pointer; font-size: 20px; }
.info > summary::-webkit-details-marker { display: none; }
.info[open] > summary { color: var(--tint); }
.info > p { position: absolute; z-index: 3; right: 0; top: 34px; width: min(280px, 100%); margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--row); box-shadow: var(--shadow), 0 0 0 .5px var(--sep); text-align: left; }
.foot-info > summary { display: flex; align-items: center; gap: 4px; min-height: 28px; list-style: none; cursor: pointer; }
.foot-info > summary::-webkit-details-marker { display: none; }
.foot-info > summary .ic { font-size: 16px; color: var(--tint); }
.foot-info > p { margin-top: 4px; }

/* note chip */
.note-chip { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: var(--row); font-size: 15px; line-height: 21px; }
.note-chip .ic { margin-top: 2px; font-size: 16px; color: var(--tint); }
.note-chip p { min-width: 0; }

/* editor: drop chain */
.drop-chain { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 2px 0 -2px; color: var(--tint); font-size: 22px; line-height: 28px; }
.drop-chain b { font-weight: 700; }
.drop-chain small { font-size: 13px; font-weight: 600; margin-left: 2px; }
.drop-chain .ic { font-size: 18px; }
.segment { position: relative; }
.segment.drop { border-left: 3px solid var(--tint); border-radius: 4px 12px 12px 4px; }
.segment.drop::before { content: ""; position: absolute; left: -3px; top: -11px; width: 3px; height: 11px; background: var(--tint); }
.segment legend:not(.sr-only) { display: flex; align-items: center; gap: 4px; }

/* confirmed sets */
.set-no.warm { background: transparent; box-shadow: inset 0 0 0 1.5px var(--tint); color: var(--tint); border-radius: 6px; }
.set-no.check.warm { background: var(--success); color: transparent; box-shadow: none; border-radius: 50%; }
.set-head .icon-actions { display: flex; flex: none; margin: -10px -10px -10px 0; }
.icon-btn { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; font-size: 20px; color: var(--label-2); }
.icon-btn.danger { color: var(--danger); }
.set-list li > :not(.set-head):not(.edit-panel) { margin-left: 0; }
.set-list details.times { margin-top: 0; }
.set-list details.times > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; padding: 0 0 0 34px; color: var(--label-2); }
.chips { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 5px; }
.chip { display: inline-flex; align-items: center; gap: 4px; min-width: 0; padding: 3px 8px 3px 6px; border-radius: 12px; background: var(--fill-soft); color: var(--label); font-size: 14px; line-height: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }
.chip .ic { font-size: 15px; color: var(--label-2); }
.chip.unknown { color: var(--label-2); background: transparent; box-shadow: inset 0 0 0 1px var(--sep); }
.clock { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin-right: -8px; font-size: 18px; color: var(--tint); }
.set-list details.times[open] > summary .clock { background: var(--tint-soft); border-radius: 50%; }
.set-list details.times > p { margin: 2px 0 4px 34px; }
.badge.ok .ic { font-size: 18px; }
.q-edit { display: inline-flex; font-size: 18px; }
.q-label { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--fill); font-weight: 600; }

/* timeline strip */
.timeline { margin: 12px var(--side) 8px; }
.tl-strip { display: flex; align-items: stretch; gap: 2px; height: 22px; overflow: hidden; border-radius: 6px; }
.tl { flex: 0 0 auto; flex-basis: 0; min-width: 2px; border-radius: 2px; }
.tl-set { background: var(--tint); }
.tl-rest { background: color-mix(in srgb, var(--tint) 28%, transparent); }
.tl-unknown { flex: 0 0 14px; background: repeating-linear-gradient(135deg, var(--label-3) 0 2px, transparent 2px 5px); box-shadow: inset 0 0 0 1px var(--label-3); }
.tl-legend, .cmp-key, .tot-key { display: flex; gap: 14px; margin: 6px 2px 0; font-size: 11px; line-height: 14px; color: var(--label-2); }
.tl-legend .sw-set, .sw-today, .sw-norm { background: var(--tint); }
.sw-rest { background: color-mix(in srgb, var(--tint) 28%, transparent); }
.sw-unknown, .sw-drop { background: repeating-linear-gradient(135deg, var(--tint) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px var(--tint); }
.sw-unknown { background: repeating-linear-gradient(135deg, var(--label-3) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px var(--label-3); }
.sw-prev { background: var(--gray-bar); }

/* horizontal bars (comparison / totals): zero baseline, shared scale */
.cmp-key { margin: 0; padding: 10px 16px 0; }
.cmp-row { display: grid; grid-template-columns: 52px 1fr 44px; align-items: center; gap: 8px; min-height: 56px; padding: 8px 16px; }
.cmp-w { font-size: 17px; font-weight: 600; }
.cmp-w small { font-size: 12px; font-weight: 500; color: var(--label-2); margin-left: 1px; }
.cmp-bars { display: grid; gap: 4px; min-width: 0; }
.hb-row, .hb-area { display: flex; align-items: center; min-width: 0; }
.hb-area { width: 100%; }
.hb { display: block; flex: none; height: 12px; width: calc((100% - 58px) * var(--r, 0)); min-width: 0; border-radius: 0 4px 4px 0; }
.hb-prev { background: var(--gray-bar); }
.hb-today { background: var(--tint); }
.hb-none { width: 28px; border-radius: 4px; border: 1.5px dashed var(--label-3); background: transparent; height: 12px; }
.hb-num { flex: none; margin-left: 6px; font-size: 13px; line-height: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hb-num.none { font-weight: 400; color: var(--label-2); font-size: 11px; }
.hb-num .plus { color: var(--label-2); font-weight: 500; margin-left: 2px; }
.delta { justify-self: end; min-width: 40px; padding: 2px 6px; border-radius: 10px; text-align: center; font-size: 13px; line-height: 18px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--fill); color: var(--label-2); }
.delta.up { color: var(--success); background: color-mix(in srgb, var(--success) 14%, transparent); }
.delta.down { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.delta.none { visibility: hidden; }
.totals { padding: 10px 16px 8px; }
.tot-row { display: grid; grid-template-columns: 36px 1fr; align-items: center; gap: 8px; min-height: 34px; font-size: 13px; }
.tot-l { color: var(--label-2); }
.stack { display: flex; flex: none; width: calc((100% - 100px) * (var(--n) + var(--d))); height: 16px; border-radius: 0 4px 4px 0; overflow: hidden; }
.stack .seg-n { flex: calc(var(--n) * 1000) 1 0; background: var(--tint); min-width: 0; }
.stack.prev .seg-n { background: var(--gray-bar); }
.stack .seg-d { flex: calc(var(--d) * 1000) 1 0; min-width: 0; background: repeating-linear-gradient(135deg, var(--tint) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1.5px var(--tint); }
.stack.prev .seg-d { background: repeating-linear-gradient(135deg, var(--label-2) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1.5px var(--label-2); }
.tot-key { margin: 4px 0 0 44px; }
.sw-norm { background: var(--label-2); }
.sw-drop { background: repeating-linear-gradient(135deg, var(--label-2) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px var(--label-2); }

/* chart additions */
.chart-axis { fill: none; stroke: var(--label-2); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-legend { margin-top: 6px; }

.list > .sr-only { position: absolute; }
