/* Lift: iOS-style system colors, inset grouped lists, SF Rounded numerals.
   Sections: tokens, base, navigation, lists, controls, overlays, then screens. */

/* ===================== tokens ===================== */
:root {
  --tint-l: #007AFF; --tint-d: #0A84FF;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --r-cell: 12px;
  --gutter: 16px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 50px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);

  /* light */
  --bg: #F2F2F7;
  --cell: #FFFFFF;
  --cell-2: #F2F2F7;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-2: rgba(120, 120, 128, 0.2);
  --pressed: rgba(0, 0, 0, 0.06);
  --sep: rgba(60, 60, 67, 0.29);
  --label: #000000;
  --label-2: rgba(60, 60, 67, 0.6);
  --label-3: rgba(60, 60, 67, 0.3);
  --bar: rgba(249, 249, 249, 0.86);
  --sheet: #FFFFFF;
  --scrim: rgba(0, 0, 0, 0.3);
  --tint: var(--tint-l);
  --green: #34C759;
  --green-fill: rgba(52, 199, 89, 0.14);
  --red: #FF3B30;
  --orange: #FF9500;
  --yellow: #FFCC00;
  --yellow-ink: #B38F00;
  --indigo: #5856D6;
  --key: #FFFFFF;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  color-scheme: light;
}

:root[data-tint="orange"] { --tint-l: #FF9500; --tint-d: #FF9F0A; }
:root[data-tint="green"] { --tint-l: #34C759; --tint-d: #30D158; }
:root[data-tint="indigo"] { --tint-l: #5856D6; --tint-d: #5E5CE6; }
:root[data-tint="pink"] { --tint-l: #FF2D55; --tint-d: #FF375F; }
:root[data-tint="teal"] { --tint-l: #30B0C7; --tint-d: #40C8E0; }

/* dark, from the system or forced */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --cell: #1C1C1E; --cell-2: #2C2C2E;
    --fill: rgba(118, 118, 128, 0.24); --fill-2: rgba(118, 118, 128, 0.36); --pressed: rgba(255, 255, 255, 0.08);
    --sep: rgba(84, 84, 88, 0.65); --label: #FFFFFF; --label-2: rgba(235, 235, 245, 0.6); --label-3: rgba(235, 235, 245, 0.3);
    --bar: rgba(22, 22, 24, 0.82); --sheet: #1C1C1E; --scrim: rgba(0, 0, 0, 0.5); --tint: var(--tint-d);
    --green: #30D158; --green-fill: rgba(48, 209, 88, 0.16); --red: #FF453A; --orange: #FF9F0A; --yellow: #FFD60A; --yellow-ink: #FFD60A; --indigo: #5E5CE6;
    --key: #3A3A3C; --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --cell: #1C1C1E; --cell-2: #2C2C2E;
  --fill: rgba(118, 118, 128, 0.24); --fill-2: rgba(118, 118, 128, 0.36); --pressed: rgba(255, 255, 255, 0.08);
  --sep: rgba(84, 84, 88, 0.65); --label: #FFFFFF; --label-2: rgba(235, 235, 245, 0.6); --label-3: rgba(235, 235, 245, 0.3);
  --bar: rgba(22, 22, 24, 0.82); --sheet: #1C1C1E; --scrim: rgba(0, 0, 0, 0.5); --tint: var(--tint-d);
  --green: #30D158; --green-fill: rgba(48, 209, 88, 0.16); --red: #FF453A; --orange: #FF9F0A; --yellow: #FFD60A; --yellow-ink: #FFD60A; --indigo: #5E5CE6;
  --key: #3A3A3C; --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* ===================== base ===================== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--label);
  font: 17px/1.29 var(--font); letter-spacing: -0.41px;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
}
body.no-scroll { overflow: hidden; }
input, textarea, select { -webkit-user-select: text; user-select: text; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; margin: 0; touch-action: manipulation; text-align: inherit; }
button:disabled { opacity: 0.35; cursor: default; }
a { color: var(--tint); text-decoration: none; }
h1, h2, h3, p, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--tint); outline-offset: 2px; }
.icon { display: block; flex: none; }
.num { font-family: var(--font-round); font-variant-numeric: tabular-nums; }
.secondary { color: var(--label-2); }
.footnote { font-size: 13px; line-height: 18px; letter-spacing: -0.08px; }
.subhead { font-size: 15px; line-height: 20px; letter-spacing: -0.24px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }

.app { max-width: 640px; margin: 0 auto; padding: 0 var(--gutter) calc(var(--tabbar-h) + var(--safe-b) + 40px); }
.app.bare { padding-bottom: calc(var(--safe-b) + 120px); }
.app.with-pad { padding-bottom: calc(var(--safe-b) + 360px); }
.page { display: flex; flex-direction: column; gap: 28px; }

/* ===================== navigation ===================== */
.nav {
  position: sticky; top: 0; z-index: 30; margin: 0 calc(-1 * var(--gutter)) -16px;
  padding: var(--safe-t) 8px 0; height: calc(44px + var(--safe-t));
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  border-bottom: 0.5px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.nav.solid, .nav.collapsed {
  background: var(--bar); border-bottom-color: var(--sep);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.nav-leading { justify-self: start; display: flex; align-items: center; min-width: 0; }
.nav-trailing { justify-self: end; display: flex; align-items: center; gap: 4px; padding-right: 4px; }
.nav-title { font-weight: 600; font-size: 17px; text-align: center; max-width: 50vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity 0.15s ease; }
.nav.collapsed .nav-title, .nav.solid .nav-title { opacity: 1; }
.nav-title small { display: block; font-size: 12px; font-weight: 500; color: var(--label-2); letter-spacing: 0; }
.nav-back { display: flex; align-items: center; color: var(--tint); height: 44px; padding-right: 8px; font-size: 17px; max-width: 34vw; }
.nav-back span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-button { color: var(--tint); font-size: 17px; height: 44px; padding: 0 8px; white-space: nowrap; }
.nav-button.bold { font-weight: 600; }
.large-title { padding: 0 4px; }
.large-title h1 { font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: 0.37px; }
.large-title p { color: var(--label-2); font-size: 15px; letter-spacing: -0.24px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; justify-content: center;
  padding-bottom: var(--safe-b); height: calc(var(--tabbar-h) + var(--safe-b));
  background: var(--bar); border-top: 0.5px solid var(--sep);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.tabbar a { flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--label-2); font-size: 10px; font-weight: 500; letter-spacing: 0.1px; }
.tabbar a.on { color: var(--tint); }

/* ===================== lists ===================== */
.group { display: flex; flex-direction: column; }
.group-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 16px 7px; color: var(--label-2); font-size: 13px; letter-spacing: -0.08px; text-transform: uppercase; }
.group-header.prominent { text-transform: none; color: var(--label); font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: 0.35px; padding: 0 4px 8px; }
.group-header .accessory { text-transform: none; font-size: 15px; color: var(--label-2); font-weight: 400; letter-spacing: -0.24px; }
.group-header .accessory.link { color: var(--tint); }
.group-body { background: var(--cell); border-radius: var(--r-cell); overflow: hidden; }
.group-footer { padding: 7px 16px 0; color: var(--label-2); font-size: 13px; line-height: 18px; letter-spacing: -0.08px; }

.cell { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 11px 16px; text-align: left; background: var(--cell); color: var(--label); transition: background 0.12s ease; }
.cell + .cell::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; height: 0.5px; background: var(--sep); }
.cell.has-icon + .cell::before, .cell + .cell.has-icon::before { left: 57px; }
button.cell:active:not(:disabled), a.cell:active { background: var(--pressed); }
.cell-icon { width: 29px; height: 29px; border-radius: 7px; display: grid; place-items: center; color: #fff; background: var(--tint); flex: none; }
.cell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cell-title { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-title.bold { font-weight: 600; }
.cell-subtitle { font-size: 15px; color: var(--label-2); letter-spacing: -0.24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-value { color: var(--label-2); font-size: 17px; white-space: nowrap; flex: none; text-align: right; }
.cell-chevron { color: var(--label-3); margin-right: -6px; }
.cell.action .cell-title { color: var(--tint); }
.cell.destructive .cell-title { color: var(--red); }
.cell.centered .cell-title { text-align: center; width: 100%; }
.cell-block { padding: 12px 16px; position: relative; }
.cell + .cell-block::before, .cell-block + .cell::before, .cell-block + .cell-block::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; height: 0.5px; background: var(--sep); }

/* ===================== controls ===================== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 50px; padding: 0 20px; border-radius: 14px; font-size: 17px; font-weight: 600; transition: opacity 0.12s ease; }
.btn:active:not(:disabled) { opacity: 0.6; }
.btn.block { display: flex; width: 100%; }
.btn.small { height: 32px; padding: 0 14px; border-radius: 999px; font-size: 15px; letter-spacing: -0.24px; }
.btn.medium { height: 44px; border-radius: 12px; }
.btn.filled { background: var(--tint); color: #fff; }
.btn.tinted { background: color-mix(in srgb, var(--tint) 15%, transparent); color: var(--tint); }
.btn.gray { background: var(--fill); color: var(--label); }
.btn.plain { color: var(--tint); font-weight: 400; height: 44px; }
.btn.destructive { color: var(--red); font-weight: 400; }

.circle-btn { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); color: var(--label-2); flex: none; }
.circle-btn:active { background: var(--fill-2); }
.circle-btn.tint { color: var(--tint); }

.segmented { display: flex; padding: 2px; border-radius: 9px; background: var(--fill); min-width: 0; }
.segmented button { flex: 1; height: 28px; padding: 0 10px; border-radius: 7px; font-size: 13px; font-weight: 500; letter-spacing: -0.08px; white-space: nowrap; color: var(--label); }
.segmented button.on { background: var(--cell); font-weight: 600; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .segmented button.on { background: #636366; } }
:root[data-theme="dark"] .segmented button.on { background: #636366; }

.switch { position: relative; width: 51px; height: 31px; border-radius: 999px; background: var(--fill-2); flex: none; transition: background 0.25s ease; }
.switch span { position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 3px 1px rgba(0, 0, 0, 0.06); transition: transform 0.25s var(--ease); }
.switch.on { background: var(--green); }
.switch.on span { transform: translateX(20px); }

.stepper { display: inline-flex; align-items: center; height: 32px; border-radius: 8px; background: var(--fill); flex: none; }
.stepper button { width: 44px; height: 32px; display: grid; place-items: center; color: var(--label); }
.stepper i { width: 0.5px; height: 18px; background: var(--sep); }
.stepper-value { min-width: 32px; text-align: right; font-weight: 600; color: var(--label); }

.search { display: flex; align-items: center; height: 36px; border-radius: 10px; background: var(--fill); padding: 0 8px; gap: 6px; color: var(--label-2); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--label); font-size: 17px; height: 36px; -webkit-appearance: none; appearance: none; }
.search input::placeholder { color: var(--label-2); }
.search input::-webkit-search-cancel-button { display: none; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 32px; padding: 0 14px; border-radius: 999px; background: var(--fill); font-size: 15px; letter-spacing: -0.24px; color: var(--label); }
.chip.on { background: var(--tint); color: #fff; font-weight: 600; }
.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.text-field { width: 100%; border: 0; outline: none; background: none; font-size: 17px; color: var(--label); padding: 0; min-width: 0; -webkit-appearance: none; appearance: none; }
.text-field::placeholder { color: var(--label-3); }
textarea.text-field { resize: none; line-height: 22px; }
.text-field.right { text-align: right; color: var(--label-2); }
.cell > .text-field { flex: 2; width: auto; }
input[type="date"].text-field, input[type="time"].text-field { text-align: right; color: var(--tint); width: auto; flex: none; }

.swatches { display: flex; gap: 16px; flex-wrap: wrap; padding: 6px 2px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; background: var(--c); position: relative; }
.swatch.on::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2.5px solid var(--c); }

/* ===================== overlays ===================== */
.sheet-layer { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.sheet-scrim { position: absolute; inset: 0; background: var(--scrim); animation: fade-in 0.3s ease; }
.sheet-layer.closing .sheet-scrim { animation: fade-out 0.28s ease forwards; }
.sheet { position: relative; width: 100%; max-width: 640px; display: flex; flex-direction: column; max-height: calc(100vh - var(--safe-t) - 12px); background: var(--sheet); border-radius: 12px 12px 0 0; padding-bottom: var(--safe-b); animation: sheet-in 0.45s var(--ease); }
.sheet.large { height: calc(100vh - var(--safe-t) - 12px); }
.sheet.grouped { background: var(--bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sheet.grouped { background: #1C1C1E; } :root:not([data-theme="light"]) .sheet.grouped .group-body, :root:not([data-theme="light"]) .sheet.grouped .cell, :root:not([data-theme="light"]) .sheet.grouped .summary, :root:not([data-theme="light"]) .sheet.grouped .chart-card { background: #2C2C2E; } }
:root[data-theme="dark"] .sheet.grouped { background: #1C1C1E; }
:root[data-theme="dark"] .sheet.grouped .group-body, :root[data-theme="dark"] .sheet.grouped .cell, :root[data-theme="dark"] .sheet.grouped .summary, :root[data-theme="dark"] .sheet.grouped .chart-card { background: #2C2C2E; }
.sheet-layer.closing .sheet { animation: sheet-out 0.3s var(--ease) forwards; }
.sheet.dragging { animation: none; }
.sheet-drag { flex: none; touch-action: none; }
.sheet-grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--label-3); margin: 5px auto 0; }
.sheet-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 50px; padding: 0 8px; }
.sheet-header h2 { font-size: 17px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56vw; }
.sheet-header .left { justify-self: start; }
.sheet-header .right { justify-self: end; padding-right: 6px; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 4px var(--gutter) 24px; display: flex; flex-direction: column; gap: 24px; }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

.alert-layer { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; background: var(--scrim); animation: fade-in 0.2s ease; padding: 24px; }
.alert { width: 270px; border-radius: 14px; overflow: hidden; text-align: center; background: color-mix(in srgb, var(--sheet) 92%, transparent); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%); animation: alert-in 0.3s var(--ease); }
@keyframes alert-in { from { transform: scale(1.15); opacity: 0; } }
.alert-text { padding: 19px 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.alert-text h2 { font-size: 17px; font-weight: 600; line-height: 22px; }
.alert-text p { font-size: 13px; line-height: 17px; letter-spacing: -0.08px; white-space: pre-line; }
.alert-actions { display: flex; border-top: 0.5px solid var(--sep); }
.alert-actions.stacked { flex-direction: column; }
.alert-actions button { flex: 1; min-height: 44px; color: var(--tint); font-size: 17px; text-align: center; }
.alert-actions button + button { border-left: 0.5px solid var(--sep); }
.alert-actions.stacked button + button { border-left: 0; border-top: 0.5px solid var(--sep); }
.alert-actions button.primary { font-weight: 600; }
.alert-actions button.danger { color: var(--red); }
.alert-actions button:active { background: var(--pressed); }

.toasts { position: fixed; top: calc(var(--safe-t) + 8px); left: 0; right: 0; z-index: 130; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 999px; font-size: 15px; font-weight: 600; letter-spacing: -0.24px; background: color-mix(in srgb, var(--sheet) 92%, transparent); color: var(--label); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); animation: toast-in 0.45s var(--ease); }
.toast .icon { color: var(--tint); }
.toast.pr .icon { color: var(--yellow-ink); }
@keyframes toast-in { from { transform: translateY(-140%); } }

.unavailable { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 40px 24px; color: var(--label-2); }
.unavailable .icon { color: var(--label-3); margin-bottom: 10px; }
.unavailable h3 { font-size: 22px; font-weight: 700; color: var(--label); letter-spacing: 0.35px; }
.unavailable p { font-size: 15px; max-width: 290px; letter-spacing: -0.24px; }
.unavailable .btn { margin-top: 14px; }

/* ===================== stats & charts ===================== */
.summary { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); background: var(--cell); border-radius: var(--r-cell); padding: 12px 0; }
.summary > div { display: flex; flex-direction: column; gap: 2px; padding: 0 14px; min-width: 0; }
.summary > div + div { border-left: 0.5px solid var(--sep); }
.summary span { font-size: 13px; color: var(--label-2); letter-spacing: -0.08px; white-space: nowrap; }
.summary strong { font-family: var(--font-round); font-variant-numeric: tabular-nums; font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: 0.35px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary small { font-size: 13px; font-weight: 600; color: var(--label-2); margin-left: 2px; font-family: var(--font); letter-spacing: -0.08px; }

.chart-card { background: var(--cell); border-radius: var(--r-cell); padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 12px; }
.chart-readout { display: flex; flex-direction: column; min-height: 58px; }
.chart-readout span { font-size: 13px; color: var(--label-2); font-weight: 600; letter-spacing: -0.08px; text-transform: uppercase; }
.chart-readout strong { font-family: var(--font-round); font-variant-numeric: tabular-nums; font-size: 34px; line-height: 40px; font-weight: 700; letter-spacing: 0.37px; }
.chart-readout small { font-size: 17px; font-weight: 600; color: var(--label-2); margin-left: 3px; font-family: var(--font); letter-spacing: -0.41px; }
.chart-readout em { font-style: normal; font-size: 15px; color: var(--label-2); letter-spacing: -0.24px; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; touch-action: pan-y; }
.chart-grid { stroke: var(--sep); stroke-width: 0.5; }
.chart-tick { fill: var(--label-2); font-size: 11px; font-family: var(--font); }
.chart-line { fill: none; stroke: var(--tint); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-line.faint { stroke: var(--label-3); stroke-width: 1.5; }
.chart-area-a { stop-color: var(--tint); stop-opacity: 0.22; }
.chart-area-b { stop-color: var(--tint); stop-opacity: 0; }
.chart-dot { fill: var(--tint); }
.chart-point { fill: var(--cell); stroke: var(--tint); stroke-width: 2.5; }
.chart-cursor { stroke: var(--label-3); stroke-width: 1; }
.chart-empty { padding: 36px 0; text-align: center; color: var(--label-2); font-size: 15px; }
.spark path { fill: none; stroke: var(--tint); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.trend { display: inline-flex; align-items: center; justify-content: flex-end; gap: 2px; font-size: 15px; font-weight: 600; min-width: 50px; letter-spacing: -0.24px; }
.trend.up { color: var(--green); }
.trend.down { color: var(--red); }
.trend.flat, .trend.new { color: var(--label-2); font-weight: 500; }

/* ===================== today ===================== */
.up-next-head { padding: 14px 16px 10px; display: flex; flex-direction: column; gap: 2px; }
.up-next-head .footnote { color: var(--label-2); }
.up-next-head h2 { font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: 0.36px; }
.plan-line { display: flex; align-items: baseline; gap: 12px; padding: 10px 16px; position: relative; }
.plan-line::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 0.5px; background: var(--sep); }
.plan-line .name { flex: 1; min-width: 0; font-size: 15px; letter-spacing: -0.24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-line .target { font-size: 15px; color: var(--label-2); font-family: var(--font-round); white-space: nowrap; }
.plan-line .last { font-size: 15px; font-family: var(--font-round); min-width: 66px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plan-line.more .name { color: var(--label-2); }
.up-next-actions { padding: 6px 16px 14px; display: flex; flex-direction: column; gap: 2px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }

.muscles { padding: 14px 16px; display: flex; flex-direction: column; gap: 11px; }
.mrow { display: grid; grid-template-columns: 88px 1fr 24px; align-items: center; gap: 10px; font-size: 15px; letter-spacing: -0.24px; }
.mrow > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mtrack { position: relative; height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; }
.mband { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--green) 24%, transparent); }
.mfill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 4px; background: var(--tint); }
.mrow strong { font-family: var(--font-round); font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }

.heat { padding: 14px 16px 12px; display: grid; grid-template-columns: 14px 1fr; column-gap: 8px; row-gap: 6px; }
.heat-days { display: grid; grid-template-rows: repeat(7, 1fr); gap: 3px; font-size: 10px; color: var(--label-2); text-align: center; align-items: center; }
.heat-grid { display: grid; grid-template-columns: repeat(12, 1fr); grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; gap: 3px; }
.heat-cell { aspect-ratio: 1; border-radius: 3px; background: var(--fill); }
.heat-cell.l1 { background: color-mix(in srgb, var(--tint) 35%, transparent); }
.heat-cell.l2 { background: color-mix(in srgb, var(--tint) 58%, transparent); }
.heat-cell.l3 { background: color-mix(in srgb, var(--tint) 80%, transparent); }
.heat-cell.l4 { background: var(--tint); }
.heat-cell.future { background: transparent; }
.heat-cell.today { box-shadow: inset 0 0 0 1.5px var(--label-2); }
.heat-months { grid-column: 2; display: grid; grid-template-columns: repeat(12, 1fr); font-size: 11px; color: var(--label-2); }

/* ===================== workout ===================== */
.workout-head { padding: 0 4px; display: flex; flex-direction: column; gap: 2px; }
.workout-head h1 { font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: 0.36px; text-align: left; }
.workout-head .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--label-2); font-size: 15px; letter-spacing: -0.24px; }
.workout-head .meta strong { color: var(--label); font-weight: 600; }
.timer { font-family: var(--font-round); font-variant-numeric: tabular-nums; }
.exercises { display: flex; flex-direction: column; gap: 16px; }

.ex { position: relative; background: var(--cell); border-radius: var(--r-cell); padding: 12px 12px 4px; display: flex; flex-direction: column; }
.ex.ss { margin-left: 14px; }
.ex.ss::before { content: ""; position: absolute; left: -12px; top: 14px; bottom: 14px; width: 3px; border-radius: 2px; background: var(--tint); }
.ex.ss-joined-below::before { bottom: -16px; }
.ex.ss-joined-above::before { top: -2px; }
.ex-head { display: flex; align-items: flex-start; gap: 8px; padding: 0 2px 0 4px; }
.ex-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; text-align: left; }
.ex-title strong { font-size: 17px; font-weight: 600; color: var(--tint); line-height: 22px; }
.ex-title span { font-size: 13px; color: var(--label-2); letter-spacing: -0.08px; }
.ss-tag { display: inline-block; font-family: var(--font-round); font-size: 12px; font-weight: 700; color: var(--tint); background: color-mix(in srgb, var(--tint) 15%, transparent); padding: 1px 6px; border-radius: 6px; margin-right: 6px; vertical-align: 2px; }
.ex-note { margin: 8px 4px 0; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--yellow) 16%, transparent); font-size: 15px; letter-spacing: -0.24px; line-height: 20px; text-align: left; display: flex; gap: 8px; color: var(--label); width: calc(100% - 8px); }
.ex-note .icon { color: var(--yellow-ink); margin-top: 2px; }
.ex-hint { display: flex; align-items: center; gap: 6px; margin: 8px 4px 0; font-size: 13px; color: var(--label-2); letter-spacing: -0.08px; }
.ex-hint.up { color: var(--green); font-weight: 600; }

.sets-head, .set { display: grid; grid-template-columns: 32px minmax(0, 1fr) 72px 56px 40px; gap: 6px; align-items: center; }
.sets-head { padding: 12px 4px 4px; font-size: 12px; font-weight: 600; color: var(--label-2); letter-spacing: 0; }
.sets-head span:nth-child(n+3) { text-align: center; }
.set { margin: 0 -8px; padding: 3px 12px; border-radius: 10px; transition: background 0.2s ease; }
.set.done { background: var(--green-fill); }
.set-num { height: 32px; border-radius: 8px; display: grid; place-items: center; font-family: var(--font-round); font-weight: 600; font-size: 15px; background: var(--fill); }
.set.done .set-num { background: transparent; }
.set-num.warmup { color: var(--orange); }
.set-num.drop { color: var(--indigo); }
.set-num.failure { color: var(--red); }
.set-prev { font-family: var(--font-round); font-variant-numeric: tabular-nums; font-size: 15px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; height: 34px; padding-left: 4px; }
.set-prev:disabled { opacity: 1; color: var(--label-3); }
.set-field { height: 34px; border-radius: 8px; background: var(--fill); display: grid; place-items: center; font-family: var(--font-round); font-variant-numeric: tabular-nums; font-size: 17px; font-weight: 600; transition: box-shadow 0.12s ease; }
.set-field.placeholder { color: var(--label-3); font-weight: 500; }
.set-field.active { box-shadow: inset 0 0 0 2px var(--tint); background: var(--cell); }
.set.done .set-field { background: transparent; }
.set-check { width: 40px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--fill); color: var(--label-3); transition: transform 0.15s var(--ease), background 0.15s ease; }
.set-check:active { transform: scale(0.88); }
.set-check.on { background: var(--green); color: #fff; }
.set-check.pr { background: var(--yellow); color: #000; }
.add-set { display: flex; align-items: center; justify-content: center; gap: 4px; height: 42px; color: var(--tint); font-size: 15px; font-weight: 500; letter-spacing: -0.24px; }

/* keypad */
.keypad { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: var(--bar); border-top: 0.5px solid var(--sep); padding: 8px 6px calc(var(--safe-b) + 6px); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); animation: sheet-in 0.35s var(--ease); }
.keypad-inner { max-width: 640px; margin: 0 auto; }
.keypad-head { display: flex; align-items: center; gap: 8px; padding: 0 6px 8px; }
.keypad-head .what { flex: 1; min-width: 0; font-size: 13px; color: var(--label-2); letter-spacing: -0.08px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.keypad-head .what strong { color: var(--label); font-weight: 600; }
.keypad-grid { display: grid; grid-template-columns: repeat(3, 1fr) 1.2fr; gap: 6px; }
.key { height: 50px; border-radius: 8px; background: var(--key); display: grid; place-items: center; font-family: var(--font-round); font-size: 25px; font-weight: 500; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }
.key:active { background: var(--fill-2); }
.key.fn { background: var(--fill-2); font-family: var(--font); font-size: 16px; font-weight: 600; box-shadow: none; }
.key.next { background: var(--tint); color: #fff; font-family: var(--font); font-size: 17px; font-weight: 600; box-shadow: none; }

/* rest timer + mini bar */
.dock { position: fixed; left: 0; right: 0; z-index: 45; bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px); padding: 0 12px; pointer-events: none; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.dock.bare { bottom: calc(var(--safe-b) + 12px); }
.dock.over-pad { bottom: calc(var(--safe-b) + 302px); }
.dock > * { pointer-events: auto; width: 100%; max-width: 616px; }
.restbar, .miniplayer { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; border-radius: 16px; background: color-mix(in srgb, var(--sheet) 90%, transparent); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%); border: 0.5px solid var(--sep); animation: rise 0.45s var(--ease); }
@keyframes rise { from { transform: translateY(140%); } }
.ring { width: 40px; height: 40px; flex: none; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; }
.ring .track { stroke: var(--fill); }
.ring .value { stroke: var(--tint); stroke-linecap: round; transition: stroke-dashoffset 0.25s linear; }
.restbar .time { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.restbar .time span { font-size: 12px; color: var(--label-2); font-weight: 500; }
.restbar .time strong { font-family: var(--font-round); font-variant-numeric: tabular-nums; font-size: 24px; line-height: 28px; font-weight: 700; }
.restbar.done .ring .value { stroke: var(--green); }
.restbar .btn.small { padding: 0 12px; }
.miniplayer { padding: 12px 14px; text-align: left; }
.miniplayer strong { font-weight: 600; }
.miniplayer .timer { color: var(--label-2); }

/* plates */
.barbell { width: 100%; height: auto; display: block; }
.plate-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.plate-chip { font-family: var(--font-round); font-weight: 600; font-size: 15px; padding: 4px 10px; border-radius: 8px; background: var(--fill); }

/* ===================== history ===================== */
.cal { padding: 12px 10px 10px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 10px; }
.cal-head strong { font-size: 17px; font-weight: 600; }
.cal-nav { display: flex; gap: 14px; }
.cal-nav button { color: var(--tint); padding: 4px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; text-align: center; }
.cal-dow { font-size: 13px; font-weight: 600; color: var(--label-3); padding-bottom: 6px; letter-spacing: -0.08px; }
.cal-day { height: 42px; display: grid; place-items: center; font-family: var(--font-round); font-size: 19px; }
.cal-day span { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; }
.cal-day.on span { background: color-mix(in srgb, var(--tint) 16%, transparent); color: var(--tint); font-weight: 600; }
.cal-day.today span { color: var(--red); font-weight: 600; }
.cal-day.today.on span { background: var(--red); color: #fff; }

.done-banner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 8px 16px 0; }
.done-badge { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #fff; margin-bottom: 8px; animation: alert-in 0.45s var(--ease); }
.done-badge.pr { background: var(--yellow); color: #000; }
.done-banner h2 { font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: 0.36px; }
.done-banner p { color: var(--label-2); font-size: 15px; letter-spacing: -0.24px; }
.delta-up { color: var(--green); }
.delta-down { color: var(--red); }

.set-line { display: flex; align-items: center; gap: 12px; }
.set-line .set-num { width: 28px; height: 26px; font-size: 13px; border-radius: 7px; }
.pr-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 700; color: var(--yellow-ink); }

/* ===================== split & misc ===================== */
.day-num { width: 28px; height: 28px; border-radius: 8px; background: var(--fill); display: grid; place-items: center; font-family: var(--font-round); font-weight: 600; font-size: 15px; color: var(--label-2); flex: none; }
.day-num.next { background: var(--tint); color: #fff; }
.badge { font-size: 15px; color: var(--tint); font-weight: 500; letter-spacing: -0.24px; }
.reorder { display: flex; gap: 2px; margin-right: -8px; }
.reorder button { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--label-2); }
.reorder button:active:not(:disabled) { background: var(--fill); }
.tint-check { color: var(--tint); }
.inline-icon { display: inline-block; vertical-align: -2px; }
button.workout-head { width: 100%; text-align: left; }
.pick-letter { padding: 16px 16px 6px; font-size: 13px; color: var(--label-2); text-transform: uppercase; letter-spacing: -0.08px; }

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