/* flow, styled after Apple's iOS patterns (grouped lists, large titles, sheets, Clock-style
   round buttons) in Rosé Pine colours: Dawn for light mode, main for dark.
   Palette: rosepinetheme.com. Page = overlay, cells = surface, separators = highlight-med. */
:root {
  --bg: #f2e9e1;            /* dawn overlay: grouped background */
  --cell: #fffaf3;          /* dawn surface: cells and cards */
  --raised: #fffaf3;
  --label: #575279;         /* dawn text */
  --label-2: #797593;       /* dawn subtle */
  --label-3: #9893a5;       /* dawn muted */
  --sep: #dfdad9;           /* dawn highlight-med */
  --fill: rgba(87, 82, 121, .08);   /* text at low alpha: segmented tracks, steppers, chips */
  --fill-2: rgba(87, 82, 121, .14);
  --tint: #286983;          /* dawn pine: the app tint */
  --ring: #d7827e;          /* dawn rose: focus */
  --ring-2: #b4637a;        /* dawn love: second lap, goal met */
  --rest: #56949f;          /* dawn foam: breaks */
  --destructive: #b4637a;
  --heat: #d7827e;
  --hm1: color-mix(in srgb, var(--heat) 25%, var(--cell));
  --hm2: color-mix(in srgb, var(--heat) 55%, var(--cell));
  --hm3: var(--heat);
  --hm4: var(--ring-2);
  --scrim: rgba(38, 35, 58, .28);
  --t0: #b4637a; --t1: #ea9d34; --t2: #d7827e; --t3: #286983; --t4: #56949f; --t5: #907aa9; /* tag colours: dawn accents */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  --rounded: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif;
  --spring: cubic-bezier(.32, .72, 0, 1);  /* iOS sheet curve */
  --tabbar-h: 50px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191724;          /* main base */
    --cell: #1f1d2e;        /* main surface */
    --raised: #403d52;      /* main highlight-med */
    --label: #e0def4;
    --label-2: #908caa;
    --label-3: #6e6a86;
    --sep: #2a283e;
    --fill: rgba(224, 222, 244, .08);
    --fill-2: rgba(224, 222, 244, .14);
    --tint: #9ccfd8;        /* main foam */
    --ring: #ebbcba;        /* main rose */
    --ring-2: #eb6f92;      /* main love */
    --rest: #9ccfd8;
    --destructive: #eb6f92;
    --heat: #ebbcba;
    --scrim: rgba(0, 0, 0, .5);
    --t0: #eb6f92; --t1: #f6c177; --t2: #ebbcba; --t3: #3e8fb0; --t4: #9ccfd8; --t5: #c4a7e7;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

body {
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.29;
  letter-spacing: -.41px;
  background: var(--bg);
  color: var(--label);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 32px);
}

button, label.cell-button { font: inherit; color: inherit; letter-spacing: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--tint); outline-offset: 2px; border-radius: 8px; }
input { font: inherit; color: inherit; letter-spacing: inherit; }

/* ─── Large title ─── */
.large-title { padding: 18px 4px 14px; }
.large-title h1 { font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: .37px; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: -.08px; text-transform: uppercase; color: var(--label-2); min-height: 17px; }
.with-action { display: flex; align-items: flex-end; justify-content: space-between; }
.nav-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--fill); color: var(--tint); display: grid; place-items: center; margin-bottom: 3px; }
.nav-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }

/* ─── Grouped lists ─── */
.group { list-style: none; background: var(--cell); border-radius: 12px; overflow: hidden; }
.segmented + .group { margin-top: 20px; }
.group-head { font-size: 13px; text-transform: uppercase; color: var(--label-2); padding: 0 16px 7px; margin-top: 30px; letter-spacing: -.08px; }
.large-title + .group-head { margin-top: 6px; }
.group-foot { font-size: 13px; color: var(--label-2); padding: 7px 16px 0; }
.group-foot.warn { color: var(--destructive); }

.cell {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 46px;
  padding: 0 16px;
}
.cell + .cell::before {   /* inset hairline, like UITableView */
  content: ""; position: absolute; top: 0; left: 16px; right: 0;
  border-top: .5px solid var(--sep);
}
.cell.column { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 16px 10px; }
.cell.tappable { cursor: pointer; transition: background-color .15s; }
.cell.tappable:active { background: var(--fill); }
.cell-label { flex: none; white-space: nowrap; }
.cell-detail { color: var(--label-2); margin-left: 4px; }
.cell-value { color: var(--label-2); font-variant-numeric: tabular-nums; transition: color .2s; }
.cell-value.open { color: var(--tint); }
.cell-input {
  flex: 1; min-width: 0;
  border: 0; background: none; outline: none;
  text-align: right; font-size: 17px; padding: 11px 0;
  color: var(--label);
}
.cell-input.full { text-align: left; }
.cell-input::placeholder { color: var(--label-3); }
.cell-input[type="date"], .cell-input[type="time"] { -webkit-appearance: none; appearance: none; color: var(--tint); display: flex; justify-content: flex-end; }
.group .cell-button { display: block; width: 100%; text-align: left; color: var(--tint); padding: 12px 0; }

/* A whole-row native <select>: iOS shows its own picker; the row shows the value. */
.menu-select { position: absolute; inset: 0; opacity: 0; width: 100%; font-size: 17px; cursor: pointer; }
.updown::after {
  content: ""; display: inline-block; width: 7px; height: 11px; margin-left: 7px; vertical-align: -1px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 11'%3E%3Cpath d='M1 4l2.5-2.5L6 4M1 7l2.5 2.5L6 7' fill='none' stroke='black' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 11'%3E%3Cpath d='M1 4l2.5-2.5L6 4M1 7l2.5 2.5L6 7' fill='none' stroke='black' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ─── Segmented control ─── */
.segmented {
  position: relative;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 2px;
  border-radius: 9px;
  background: var(--fill);
}
.seg-thumb {
  position: absolute; top: 2px; bottom: 2px; left: 2px;
  width: calc(50% - 2px);
  border-radius: 7px;
  background: var(--raised);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04), 0 0 0 .5px rgba(0, 0, 0, .04);
  transition: transform .3s var(--spring);
}
.segmented[data-value="down"] .seg-thumb,
.segmented[data-value="30"] .seg-thumb,
.segmented[data-value="min"] .seg-thumb { transform: translateX(100%); }
.segmented button {
  position: relative;
  height: 32px;
  font-size: 13px; font-weight: 500; letter-spacing: -.08px;
}
.segmented button[aria-checked="true"] { font-weight: 600; }
.segmented.mini button { height: 28px; padding: 0 12px; }

/* ─── Tag chips: one horizontal row that scrolls; the picked chip takes its tag's colour ─── */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 9px 16px; scroll-padding: 0 16px; }
.chips::-webkit-scrollbar { display: none; }
.chips.bleed { margin: -4px -16px 12px; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 13px; border-radius: 16px;
  background: var(--fill); font-size: 15px; letter-spacing: -.24px; white-space: nowrap;
  transition: background-color .2s, box-shadow .2s, transform .12s;
}
.chip:active { transform: scale(.95); }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.chip[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 18%, var(--cell)); box-shadow: inset 0 0 0 1.5px var(--c); }
.chip.all { --c: var(--tint); }
.chip.new { color: var(--tint); }
.chip.new span { font-size: 11px; font-weight: 600; letter-spacing: .2px; text-transform: uppercase; color: var(--label-2); margin-left: 1px; }
.bleed .chip { background: var(--cell); }
.bleed .chip[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 18%, var(--cell)); }

/* Tag field: the input's own text is transparent; a mirror behind it draws the same text with #tags
   coloured. Both share font, padding and line height exactly so the caret lines up. */
.tagfield { position: relative; flex: 1; min-width: 0; }
.tagfield .cell-input, .tagfield-hl { font-size: 17px; line-height: 22px; padding: 12px 0; letter-spacing: -.41px; }
.tagfield .cell-input {
  position: relative; display: block; width: 100%;
  color: transparent; -webkit-text-fill-color: transparent; caret-color: var(--tint);
}
.tagfield .cell-input::placeholder { color: var(--label-3); -webkit-text-fill-color: var(--label-3); }
.tagfield-hl { position: absolute; inset: 0; white-space: pre; overflow: hidden; pointer-events: none; color: var(--label); }
.hl-tag { --c: var(--tint); color: color-mix(in srgb, var(--c) 75%, var(--label)); border-radius: 5px;
  background: color-mix(in srgb, var(--c) 15%, transparent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 15%, transparent); }

/* Suggestion bar riding on the keyboard, like QuickType: a # key, then tags to tap */
.tagbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  background: color-mix(in srgb, var(--cell) 80%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--sep);
  opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility 0s .2s;
}
body.tagging main { padding-bottom: 60vh; }
.tagbar.show { opacity: 1; visibility: visible; transition: opacity .2s ease; }
.tagbar .chips { max-width: 560px; margin: 0 auto; padding: 7px 12px; min-height: 46px; align-items: center; }
.tagbar .chip, .tagbar .bar-hash { animation: chip-in .28s var(--spring) both; }
@keyframes chip-in { from { opacity: 0; transform: scale(.85); } }
.bar-hash {
  flex: none; width: 40px; height: 32px; border-radius: 16px;
  background: var(--tint); color: var(--cell); font-family: var(--rounded); font-size: 19px; font-weight: 600;
}
.bar-hash:active { transform: scale(.94); }
.bar-hint { font-size: 15px; color: var(--label-2); padding-left: 2px; white-space: nowrap; }
.tc0 { --c: var(--t0); } .tc1 { --c: var(--t1); } .tc2 { --c: var(--t2); }
.tc3 { --c: var(--t3); } .tc4 { --c: var(--t4); } .tc5 { --c: var(--t5); }
.tag-name { display: inline-flex; align-items: center; gap: 9px; overflow: hidden; text-overflow: ellipsis; }
.tag-name i, .s-tag i { border-radius: 50%; background: var(--c); flex: none; }
.tag-name i { width: 10px; height: 10px; }
.tag-remove { color: var(--destructive); font-size: 15px; padding: 12px 0 12px 12px; }

/* ─── Stepper ─── */
.stepper { flex: none; display: flex; border-radius: 9px; background: var(--fill); overflow: hidden; }
.stepper button { width: 47px; height: 32px; font-size: 22px; font-weight: 300; line-height: 1; position: relative; }
.stepper button + button::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; border-left: 1px solid var(--fill-2); }
.stepper button:active { background: var(--fill-2); }
.stepper button:disabled { color: var(--label-3); }

/* ─── Switch (Safari 17.4+ draws its native one from the `switch` attribute) ─── */
.switch { accent-color: var(--tint); flex: none; }
html:not(.native-switch) .switch {
  -webkit-appearance: none; appearance: none;
  width: 51px; height: 31px; border-radius: 16px;
  background: var(--fill-2); position: relative; cursor: pointer;
  transition: background-color .25s;
}
html:not(.native-switch) .switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 3px 1px rgba(0,0,0,.06);
  transition: transform .3s var(--spring);
}
html:not(.native-switch) .switch:checked { background: var(--tint); }
html:not(.native-switch) .switch:checked::after { transform: translateX(20px); }
.switch:disabled { opacity: .4; }

/* ─── Buttons ─── */
.plain { color: var(--tint); font-size: 17px; padding: 12px 4px; }
.plain.strong { font-weight: 600; }
.plain.centred { display: block; margin: 4px auto 0; }
.plain.destructive { color: var(--destructive); }
.filled {
  display: block; width: 100%;
  height: 50px; border-radius: 14px;
  background: var(--tint); color: var(--cell);
  font-size: 17px; font-weight: 600;
  margin-top: 24px;
  transition: transform .12s, opacity .12s;
}
.filled:active { transform: scale(.98); opacity: .85; }

/* ─── Focus: dial ─── */
.dial-wrap {
  position: relative;
  width: min(76vw, 300px);
  aspect-ratio: 1;
  margin: 4px auto 0;
}
.dial { width: 100%; height: 100%; display: block; overflow: visible; }
.dial circle { fill: none; }
.dial-track { stroke: var(--fill); stroke-width: 16; }
.dial-lap { stroke: var(--ring); stroke-width: 16; opacity: 0; }
.dial-arc {
  stroke: var(--ring); stroke-width: 16; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 150px 150px;
  transition: stroke .4s;
}
.dial-cap { fill: var(--ring-2) !important; opacity: 0; filter: drop-shadow(0 0 3px rgba(0,0,0,.35)); }
body.lapped .dial-lap { opacity: 1; }
body.lapped .dial-arc { stroke: var(--ring-2); }
body.lapped .dial-cap { opacity: 1; }
body[data-mode="break"] .dial-arc { stroke: var(--rest); }
.dial-ticks line { stroke: var(--label-3); stroke-width: 1.2; stroke-linecap: round; opacity: .45; }
.dial-ticks line.major { stroke-width: 2; opacity: .7; }

.dial-centre {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 0 20%;
}
.dial-top { font-size: 15px; font-weight: 600; color: var(--label-2); min-height: 20px; }
.dial-time {
  font-size: clamp(52px, 17vw, 68px);
  font-weight: 200;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.dial-time.long { font-size: clamp(40px, 13vw, 54px); letter-spacing: -.5px; }
body.overtime .dial-time { color: var(--ring-2); }
body[data-mode="break"].overtime .dial-time { color: var(--rest); }
.dial-sub {
  font-size: 15px; color: var(--label-2); min-height: 20px; margin-top: 2px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Clock-style round buttons: tinted fill, ring of the same colour outside a gap */
.round-buttons { display: flex; justify-content: space-between; margin-top: 26px; padding: 0 14px; }
body[data-mode="idle"] .round-buttons, body[data-mode="review"] .round-buttons { justify-content: center; }
body[data-mode="idle"] #btn-left, body[data-mode="review"] #btn-left { display: none; }
body[data-mode="focus"] .large-title, body[data-mode="break"] .large-title { display: none; }
body[data-mode="focus"] .dial-wrap, body[data-mode="break"] .dial-wrap { margin-top: max(12vh, 60px); }
.round {
  --c: var(--label);
  position: relative;
  width: 84px; height: 84px; border-radius: 50%;
  font-size: 15px; font-weight: 500; letter-spacing: -.24px;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 17%, var(--bg));
  box-shadow: 0 0 0 2.5px var(--bg), 0 0 0 4px color-mix(in srgb, var(--c) 17%, var(--bg));
  transition: transform .15s var(--spring), opacity .2s;
  display: grid; place-items: center;
  padding: 0 6px; line-height: 1.1;
}
.round:active { transform: scale(.94); }
.round:disabled { opacity: .45; cursor: default; transform: none; }
.round.grey { --c: var(--label-2); }
.round.tint { --c: var(--tint); font-weight: 600; }
.round.primary { background: var(--tint); color: var(--cell); font-size: 17px; font-weight: 600;
  box-shadow: 0 0 0 2.5px var(--bg), 0 0 0 4px color-mix(in srgb, var(--tint) 30%, var(--bg)); }
.round.stop { --c: var(--ring-2); }
.round.rest { --c: var(--rest); }
.badge {
  position: absolute; top: 0; right: 0;
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--ring-2); color: var(--cell);
  font-size: 13px; font-weight: 600; line-height: 22px; text-align: center;
}

.nudge { text-align: center; font-size: 15px; color: var(--label-2); margin: 22px 24px 0; }

.idle-controls { margin-top: 28px; }

/* Smooth inline reveal (grid rows 0fr → 1fr animates height) */
.reveal { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s var(--spring); }
.reveal > div { overflow: hidden; min-height: 0; }
.reveal.open { grid-template-rows: 1fr; }
.wheel-cell { padding: 0; min-height: 0; justify-content: normal; align-items: start; overflow: hidden; }
.wheel-cell:not(.open)::before { display: none; }

/* ─── Wheel picker ─── */
.wheels { position: relative; display: flex; justify-content: center; gap: 4px; padding: 6px 0; }
.wheel-band {
  position: absolute; left: 12px; right: 12px; top: 50%; height: 34px; margin-top: -17px;
  border-radius: 8px; background: var(--fill); pointer-events: none;
}
.wheel-col { position: relative; display: flex; align-items: center; }
.wheel {
  list-style: none;
  height: 238px; width: 64px;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  padding: 102px 0;
  perspective: 600px;
  -webkit-mask: linear-gradient(transparent, #000 30%, #000 70%, transparent);
  mask: linear-gradient(transparent, #000 30%, #000 70%, transparent);
  outline: none;
}
.wheel::-webkit-scrollbar { display: none; }
.wheel li {
  height: 34px; line-height: 34px;
  scroll-snap-align: center;
  text-align: right; padding-right: 6px;
  font-size: 22px; font-variant-numeric: tabular-nums;
  transform-origin: 50% 50% -70px;
  cursor: pointer;
}
.wheel-unit { font-size: 17px; font-weight: 600; width: 56px; padding-left: 4px; position: relative; }

.pickup { margin-top: 20px; background: var(--cell); border-radius: 12px; padding: 12px 16px 14px; }
.pickup-head { font-size: 13px; font-weight: 600; color: var(--tint); }
.pickup-text { margin-top: 3px; }

/* ─── Running: the timer takes the page ─── */
body[data-mode="focus"] .idle-controls,
body[data-mode="break"] .idle-controls { display: none; }
body[data-mode="focus"] #today-date,
body[data-mode="break"] #today-date { visibility: hidden; }

/* ─── Tab bar ─── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--sep);
  transition: transform .35s var(--spring);
}
.tabbar button {
  flex: 0 1 140px;
  height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--label-3);
  font-size: 10px; font-weight: 500; letter-spacing: .1px;
}
.tabbar svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button[aria-selected="true"] { color: var(--tint); }
.tabbar button[aria-selected="true"] svg { stroke-width: 2.3; }
body[data-mode="focus"] .tabbar,
body[data-mode="break"] .tabbar { transform: translateY(110%); }

/* ─── Sheets ─── */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; }
.scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity .35s ease; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-width: 560px; margin: 0 auto;
  max-height: calc(100dvh - env(safe-area-inset-top) - 12px);
  overflow-y: auto;
  background: var(--bg);
  border-radius: 14px 14px 0 0;
  padding: 6px 16px calc(env(safe-area-inset-bottom) + 18px);
  transform: translateY(100%);
  transition: transform .45s var(--spring), bottom .3s var(--spring);
  box-shadow: 0 -2px 20px rgba(0,0,0,.12);
  overscroll-behavior: contain;
}
.sheet-wrap.open .scrim { opacity: 1; }
.sheet-wrap.open .sheet { transform: translateY(0); }
.sheet.dragging { transition: none; }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--label-3); opacity: .5; margin: 0 auto 10px; }
.sheet-title { font-size: 28px; font-weight: 700; letter-spacing: .36px; text-align: center; margin-top: 8px; }
.sheet-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-bottom: 14px; }
.sheet-nav h2 { font-size: 17px; font-weight: 600; }
.sheet-nav .plain:last-child { justify-self: end; }
.sheet-nav .plain:first-child { justify-self: start; }

.rv-summary { display: flex; justify-content: center; align-items: baseline; gap: 6px; margin-top: 8px; }
.rv-min {
  width: 2.4em; border: 0; background: none; outline: none;
  font-family: var(--rounded); font-size: 56px; font-weight: 600; letter-spacing: -.5px;
  text-align: right; color: var(--ring-2); font-variant-numeric: tabular-nums;
  -moz-appearance: textfield; appearance: textfield;
}
.rv-min::-webkit-inner-spin-button { -webkit-appearance: none; }
.rv-unit { font-size: 22px; font-weight: 600; color: var(--label-2); }
.rv-task { text-align: center; color: var(--label-2); margin: 0 0 22px; min-height: 22px; overflow-wrap: anywhere; }

.rating { display: flex; justify-content: space-between; gap: 8px; }
.rating button {
  flex: 1; height: 36px; border-radius: 10px;
  background: var(--fill);
  transition: background-color .2s, transform .15s var(--spring);
}
.rating button:active { transform: scale(.94); }
.rating button.on { background: var(--ring-2); }
.rating-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--label-2); }

/* ─── History ─── */
.card { background: var(--cell); border-radius: 16px; padding: 14px 16px 16px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; min-height: 28px; margin-bottom: 10px; }
.card-title { font-size: 17px; font-weight: 600; letter-spacing: -.41px; }

.summary { display: flex; align-items: center; gap: 20px; padding: 16px; }
.today-ring { width: 104px; flex: none; }
.today-ring svg { display: block; width: 100%; height: auto; }
.summary-stats { flex: 1; display: grid; gap: 8px; }
.stat-label { font-size: 13px; color: var(--label-2); }
.stat { font-family: var(--rounded); font-size: 28px; font-weight: 600; color: var(--ring-2); font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat.small { font-size: 17px; color: var(--label); }

.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font); letter-spacing: 0; }
.ax { font-size: 10px; fill: var(--label-3); }
.ax.strong { fill: var(--label); font-weight: 600; }
.val { font-size: 9px; fill: var(--label-2); font-variant-numeric: tabular-nums; }
.base { stroke: var(--sep); stroke-width: 1; }
.goal { stroke: var(--ring-2); stroke-width: 1.2; stroke-dasharray: 3 3; opacity: .8; }
.goal-l { fill: var(--ring-2); font-weight: 600; }
.ref { stroke: var(--label-3); stroke-width: 1; stroke-dasharray: 2 3; opacity: .8; }
.you { stroke: var(--tint); stroke-width: 2; }
.you-l { fill: var(--tint); font-weight: 600; }
.bar { fill: var(--ring); }
.bar.soft { fill: var(--hm2); }
.bar.hit { fill: var(--ring-2); }
.ring-track { stroke: color-mix(in srgb, var(--ring-2) 16%, transparent); }
.ring-arc { stroke: var(--ring-2); }
.ring-text { fill: var(--label); font-family: var(--rounded); font-weight: 600; }
.ring-sub { fill: var(--label-2); font-size: 11px; }
.hm.l0 { fill: var(--fill); background: var(--fill); }
.hm.l1 { fill: var(--hm1); background: var(--hm1); }
.hm.l2 { fill: var(--hm2); background: var(--hm2); }
.hm.l3 { fill: var(--hm3); background: var(--hm3); }
.hm.l4 { fill: var(--hm4); background: var(--hm4); }
.legend { display: flex; align-items: center; justify-content: flex-end; gap: 3px; font-size: 11px; color: var(--label-2); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.legend span { margin: 0 4px; }

.insight { font-size: 15px; color: var(--label-2); margin: -4px 0 12px; }
.insight:empty { display: none; }
.insight strong { color: var(--label); font-weight: 600; }

.empty { text-align: center; padding: 20vh 24px 0; color: var(--label-2); }
.empty svg { width: 48px; height: 48px; fill: none; stroke: var(--label-3); stroke-width: 1.6; stroke-linecap: round; }
.empty-title { font-size: 22px; font-weight: 700; color: var(--label); margin-top: 12px; }
.empty-sub { margin-top: 4px; }

/* Session rows, with swipe-to-delete */
.day-group { margin-top: 26px; }
.day-head span + span { text-transform: none; }
.day-head { display: flex; justify-content: space-between; padding: 0 16px 7px; font-size: 13px; text-transform: uppercase; color: var(--label-2); letter-spacing: -.08px; }
.srow { position: relative; overflow: hidden; }
.srow + .srow::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); z-index: 1; }
.srow-del {
  position: absolute; top: 0; right: 0; bottom: 0; width: 100%;
  display: flex; align-items: center; justify-content: flex-end; padding-right: 18px;
  background: var(--destructive); color: #fff; font-weight: 500;
}
.srow-main {
  position: relative; background: var(--cell);
  display: flex; align-items: center; gap: 14px;
  padding: 11px 16px;
  touch-action: pan-y;
  transition: transform .3s var(--spring);
}
.srow.dragging .srow-main { transition: none; }
.srow.removing { transition: height .25s ease, opacity .2s ease; }
.s-dur { font-family: var(--rounded); font-weight: 600; font-size: 17px; min-width: 64px; font-variant-numeric: tabular-nums; }
.s-body { flex: 1; min-width: 0; }
.s-task { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-meta { font-size: 13px; color: var(--label-2); margin-top: 1px; }
.s-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--label); }
.s-tag i { width: 6px; height: 6px; }
.s-note { font-size: 13px; color: var(--label-2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-dots { display: flex; gap: 3px; flex: none; }
.s-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--fill-2); }
.s-dots i.on { background: var(--ring-2); }
#more { margin-top: 12px; }

/* ─── Toast: drops from the top, like a system banner ─── */
.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 10px); z-index: 30;
  transform: translate(-50%, -160%);
  background: var(--cell); color: var(--label);
  padding: 12px 20px; border-radius: 999px;
  font-size: 15px; font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,.14), 0 0 0 .5px var(--sep);
  opacity: 0; visibility: hidden;
  transition: transform .45s var(--spring), opacity .3s, visibility 0s .45s;
  max-width: calc(100% - 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; transition: transform .45s var(--spring), opacity .2s; }

.haptic { position: fixed; left: -100px; top: 0; width: 1px; height: 1px; overflow: hidden; opacity: 0; }

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