/* ===== Fonts (self-hosted, so the PWA stays usable offline - no runtime
   dependency on Google Fonts CDN) ===== */
@font-face {
  font-family: "Poppins";
  src: url("/fonts/Poppins-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/fonts/Poppins-ExtraBold.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* ===== Design tokens (confirmed palette, CLAUDE.md "Visual design") ===== */
:root {
  --bg: #0e1213;
  --card: #1c1f22;              /* flat reference for contexts that can't use the gradient (SVG fills, etc.) - roughly the gradient's midpoint */
  --card-gradient: linear-gradient(135deg, #262a2e 0%, #0e1213 100%);
  --card-flat-dark: #0e1213;    /* the gradient's darkest point (= page background, deliberately) - for contrast checks and SVG ring strokes */
  --text: #f2f2f0;
  --text-dim: #8f8f8a;
  --text-faint: #75756f;
  --accent: #c0ea1e;
  --accent-glow: 0 0 24px rgba(192, 234, 30, 0.25);
  --inactive-fill: #2c2c2c;
  --inactive-fill-strong: #3a3a3a;
  --danger: #e8674a;
  --shadow-card: 0 8px 18px rgba(0, 0, 0, 0.45);
  --shadow-card-lg: 0 10px 24px rgba(0, 0, 0, 0.5);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 14px;
  --tap-min: 52px;
  --font-display: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  /* Subtle depth rather than a flat fill - should read as gentle, not a visible band/vignette. */
  background: radial-gradient(ellipse at top, #191b1c 0%, #0e1213 60%);
  background-attachment: fixed;
}

/* Top safe-area padding so header content never sits under the iPhone
 * notch/Dynamic Island/status bar; bottom padding clears the fixed tab bar
 * (see .tab-bar) plus the home indicator. */
#app {
  padding: calc(14px + var(--safe-top)) 14px calc(84px + var(--safe-bottom));
  max-width: 520px;
  margin: 0 auto;
}

h1, h2, h3, p { margin: 0; }

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
  background: none;
  color: inherit;
}

/* All icons render in the accent green by default (per Burger's direction).
 * A handful of spots put an icon on top of an accent-FILLED background
 * (the inverted CTA's quick-add buttons/status pill, a completed
 * warm-up/cool-down checkmark) - those need the icon to match their dark
 * text instead of disappearing into the green fill, so they explicitly
 * inherit color from their container below rather than taking this
 * default. */
.tabler-icon { display: inline-block; vertical-align: middle; flex-shrink: 0; color: var(--accent); }

/* ===== Cards: no border, shadow-only elevation ===== */
.card {
  position: relative;
  background: var(--card-gradient);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px;
  overflow: hidden;
}

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }

/* ===== Top bar ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px 14px;
}
.topbar-icons { display: flex; gap: 10px; }
.topbar .brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  color: var(--text);
}
.utility-icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--card);
  color: var(--text-dim);
  box-shadow: var(--shadow-card);
}

/* ===== Alerts strip: muted card, not a bright banner ===== */
.alerts-strip {
  display: flex; align-items: center; gap: 10px;
  background: var(--card-gradient);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--text);
  box-shadow: var(--shadow-card);
}
.alerts-strip .tabler-icon { color: var(--accent); }

/* ===== Today's session block: the inverted CTA (the ONE highest-priority
 * action on Home) - solid accent fill, dark text, glow. Used sparingly by
 * design - this is the only inverted card in the app. ===== */
.session-block {
  padding: 22px;
  cursor: pointer;
  background: var(--accent);
  box-shadow: var(--shadow-card-lg), var(--accent-glow);
}
.session-block .label { color: rgba(14, 18, 19, 0.65); font-size: 13px; }
.session-block .title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 30px;
  color: var(--bg);
  margin-top: 6px;
}
.session-block .sub { color: rgba(14, 18, 19, 0.65); font-size: 14px; margin-top: 4px; }
.session-block .status-pill {
  display: inline-block; margin-top: 10px;
  background: rgba(14, 18, 19, 0.14); color: var(--bg);
  border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 700;
}
.status-pill .tabler-icon { color: inherit; } /* dark, matching the pill's own text, not the global green default */
.quick-adds { display: flex; gap: 10px; margin-top: 16px; }
.quick-add-btn {
  flex: 1; min-height: var(--tap-min);
  background: rgba(14, 18, 19, 0.14); border-radius: 999px;
  color: var(--bg); font-size: 14px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.quick-add-btn:active { opacity: 0.8; }
.quick-add-btn .tabler-icon { color: inherit; } /* dark on the accent-filled session block, not the global green default */

/* ===== Half cards (water/food) ===== */
.metric-card { padding: 16px; }
.metric-card.disabled { opacity: 0.6; }
.metric-card .metric-label-row { display: flex; align-items: center; gap: 6px; }
.metric-card .metric-label { font-size: 13px; color: var(--text-dim); }
.metric-card .metric-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  margin-top: 6px;
}
.metric-card .metric-target { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.bar-track { height: 8px; border-radius: 4px; background: var(--bg); margin-top: 10px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.3s ease; }
.coming-soon-note { font-size: 11px; color: var(--text-faint); margin-top: 8px; font-style: italic; }
.chevron-note { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-faint); margin-top: 8px; }
.section-title {
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  color: var(--accent); margin-bottom: 8px;
}
.metric-card.linked { cursor: pointer; }

.water-controls { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.water-btn {
  width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
  background: var(--inactive-fill); color: var(--text);
  display: flex; align-items: center; justify-content: center;
}
.water-btn:active { opacity: 0.75; }
.water-pending { flex: 1; text-align: center; font-size: 12px; color: var(--accent); min-height: 14px; }

/* ===== 7-day strip ===== */
.week-strip { display: flex; justify-content: space-between; padding: 4px 2px; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.week-day .dow { font-size: 11px; color: var(--text-faint); }
.week-dot {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--inactive-fill); color: var(--text-dim);
}
.week-dot.trained { background: var(--accent); color: var(--bg); box-shadow: var(--accent-glow); }
.week-dot.skipped { background: var(--inactive-fill-strong); color: var(--text-dim); }
.week-dot.sport { background: var(--inactive-fill-strong); color: var(--accent); }
.week-dot.today-ring { box-shadow: 0 0 0 2px var(--accent); }
.week-dot .tabler-icon { width: 16px; height: 16px; }

/* ===== Sleep line ===== */
.sleep-line { display: flex; align-items: center; gap: 12px; padding: 14px 18px; }
.sleep-line .tabler-icon { color: var(--accent); }
.sleep-line .text { flex: 1; font-size: 14px; }
.sleep-line .chevron { color: var(--text-faint); }

/* ===== Buttons: all pill-shaped ===== */
.btn {
  min-height: var(--tap-min);
  border-radius: 999px;
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 0 22px;
  width: 100%;
}
/* Glow reserved for this + the inverted CTA + the active tab icon only
 * (per spec) - chips/checkmarks/day-cards stay glow-free so it reads as a
 * highlight, not a general haze over every accent-colored thing. */
.btn-primary { background: var(--accent); color: var(--bg); box-shadow: var(--accent-glow); }
.btn-primary .tabler-icon { color: inherit; } /* dark on the accent fill, not the global green default */
.btn-primary:active { transform: translateY(1px); }
.btn-secondary { background: var(--inactive-fill); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-dim); }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn:disabled { opacity: 0.4; }

/* ===== Screen chrome: every screen gets a consistent way out -
 * a "step back" control (left) and, in the active-session flow, an
 * "exit to overview" control (right). ===== */
.screen-header { display: flex; align-items: center; gap: 10px; padding: 6px 2px 16px; }
.icon-btn {
  width: 40px; height: 40px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--text-dim);
  background: var(--card);
  box-shadow: var(--shadow-card);
}
.icon-btn:active { opacity: 0.75; }
.screen-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  flex: 1;
}
.step-indicator { font-size: 13px; color: var(--text-dim); }

/* ===== Session picker chips ===== */
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; }
.chip {
  flex: 0 0 auto;
  padding: 10px 16px; border-radius: 999px;
  background: var(--inactive-fill);
  color: var(--text-dim); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.chip.active { background: var(--accent); color: var(--bg); }

/* ===== Exercise list preview ===== */
.exercise-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 4px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.exercise-row:last-child { border-bottom: none; }
.exercise-row .name { font-size: 15px; font-weight: 600; }
.exercise-row .meta { font-size: 13px; color: var(--text-dim); }

/* ===== Warm-up / Cool-down items ===== */
.protocol-item { display: flex; align-items: center; gap: 12px; padding: 14px 4px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.protocol-item:last-child { border-bottom: none; }
.protocol-item .info { flex: 1; }
.protocol-item .name { font-size: 15px; font-weight: 600; }
.protocol-item .detail { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.protocol-item .check {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--inactive-fill); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  color: transparent;
}
.protocol-item .check .tabler-icon { color: inherit; } /* hidden until .done, not the global green default */
.protocol-item .check.done { background: var(--accent); color: var(--bg); }
.timer-btn {
  flex: 0 0 auto; min-height: 40px; padding: 0 16px;
  background: var(--inactive-fill);
  border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--accent);
  display: flex; align-items: center; gap: 6px;
}

/* ===== Exercise (one-at-a-time) screen ===== */
.exercise-screen .name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
}
.exercise-screen .cue { font-size: 14px; color: var(--text-dim); margin-top: 8px; line-height: 1.4; }
.set-progress { font-size: 13px; color: var(--text-dim); margin-top: 14px; }
.based-on-tag { font-size: 11px; color: var(--accent); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.goal-line { font-size: 13px; color: var(--text-dim); margin-top: 8px; }
.set-nav-row { display: flex; gap: 10px; margin-top: 16px; }
.set-nav-row .btn { min-height: 44px; font-size: 14px; }

.picker-row { display: flex; gap: 16px; margin: 20px 0; }
.picker-col { flex: 1; text-align: center; }
.picker-col .picker-label { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.wheel {
  height: 176px;                                  /* 3 rows of 44px + 2 x 22px half rows */
  overflow-y: scroll;
  overflow-x: hidden;                             /* the scaled centre row must never create a sideways scroll */
  touch-action: none;                             /* touches are handled in createWheel (detents + fling) */
  overscroll-behavior: contain;
  scroll-snap-type: none;                         /* snapping is done by the handler, not the browser */
  scroll-snap-type: y mandatory;
  border-radius: var(--radius-md);
  background: var(--inactive-fill);
  -webkit-overflow-scrolling: touch;
  position: relative;
  scrollbar-width: none;
  /* Fade the rows out towards the edges, like a real drum. */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22%, #000 78%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 22%, #000 78%, transparent 100%);
}
.wheel::-webkit-scrollbar { display: none; }
.wheel-pad { height: 66px; }
.wheel-option {
  height: 44px;
  display: flex; align-items: center; justify-content: center;
  white-space: nowrap; overflow: hidden;
  font-size: 19px; color: var(--text);
  font-variant-numeric: tabular-nums;
  will-change: transform, opacity;
  cursor: pointer;
}
.wheel-option.center {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--accent);
}
.wheel-frame {
  position: absolute; left: 10px; right: 10px; top: 66px; height: 44px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  pointer-events: none;
}

/* ===== Rest timer full-screen overlay ===== */
.rest-overlay {
  position: fixed; inset: 0; background: rgba(14,18,19,0.94);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 200;
  padding-top: var(--safe-top); padding-bottom: var(--safe-bottom);
}
.rest-overlay .label { color: var(--text-dim); font-size: 15px; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; }
.rest-overlay .digits {
  font-family: var(--font-display); font-weight: 800;
  font-size: 92px; color: var(--accent); font-variant-numeric: tabular-nums;
}
.rest-next {
  margin-top: 18px; padding: 0 24px; text-align: center; max-width: 360px;
  font-size: 15px; color: var(--text); line-height: 1.45;
}
.rest-next .label { display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 6px; }
.rest-next .big { font-family: var(--font-display); font-weight: 800; font-size: 22px; color: var(--accent); display: block; }
.rest-next .set-dots { justify-content: center; margin-top: 10px; }
.rest-next .set-dots .dot { width: 12px; height: 12px; }
.set-chip.skipped { background: transparent; box-shadow: 0 0 0 1px var(--inactive-fill-strong) inset; color: var(--text-dim); text-decoration: line-through; }
.skip-link {
  margin-top: 30px; color: var(--text-faint); font-size: 14px;
  display: flex; align-items: center; gap: 6px;
  background: var(--inactive-fill); padding: 10px 20px; border-radius: 999px;
}

/* ===== Countdown (warm-up/cool-down item) overlay ===== */
.countdown-overlay {
  position: fixed; inset: 0; background: rgba(14,18,19,0.97);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 200; text-align: center; padding: 20px;
  padding-top: var(--safe-top); padding-bottom: var(--safe-bottom);
}
.countdown-overlay .name { font-family: var(--font-display); font-weight: 700; font-size: 20px; margin-bottom: 18px; }
.countdown-overlay .digits {
  font-family: var(--font-display); font-weight: 800;
  font-size: 80px; color: var(--text); font-variant-numeric: tabular-nums;
}

/* ===== "How" video overlay ===== */
.video-overlay {
  position: fixed; inset: 0; background: rgba(14,18,19,0.97);
  z-index: 210; display: flex; flex-direction: column;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
}
.video-overlay-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.video-overlay-title { flex: 1; font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.video-frame-wrap {
  position: relative; width: 100%; padding-top: 56.25%; /* 16:9 */
  background: #000; border-radius: var(--radius-md); overflow: hidden;
}
.video-frame-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }
.how-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--inactive-fill); color: var(--accent);
  border-radius: 999px; padding: 8px 16px; font-size: 13px; font-weight: 700;
  margin-top: 10px;
}

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + var(--safe-bottom)); transform: translateX(-50%);
  background: var(--card); color: var(--text);
  padding: 12px 18px; border-radius: 999px; font-size: 13px;
  box-shadow: var(--shadow-card-lg); z-index: 300;
}

/* ===== Connection banner: stays up for as long as a request is being
 * retried, not a transient toast - deliberately at the TOP so it doesn't
 * fight with the bottom tab bar / rest timers for space. ===== */
.connection-banner {
  position: fixed; left: 50%; top: calc(10px + var(--safe-top)); transform: translateX(-50%);
  background: var(--danger); color: var(--text);
  padding: 10px 18px; border-radius: 999px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-card-lg); z-index: 300;
  max-width: calc(100% - 40px); text-align: center;
}

/* ===== Sleep modal ===== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(14,18,19,0.7);
  display: flex; align-items: flex-end; z-index: 250;
}
.modal-sheet {
  background: var(--card-gradient); width: 100%;
  border-radius: 24px 24px 0 0; padding: 22px 18px calc(28px + var(--safe-bottom));
  box-shadow: var(--shadow-card-lg);
  /* A tall sheet scrolls inside itself instead of pushing its top off screen. */
  max-height: calc(100vh - var(--safe-top) - 24px);
  max-height: calc(100dvh - var(--safe-top) - 24px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.modal-backdrop { overscroll-behavior: contain; }
.modal-sheet .title { font-family: var(--font-display); font-weight: 700; font-size: 17px; margin-bottom: 16px; }

/* ===== Day carousel (Overview date picker) ===== */
.day-carousel-wrap { position: relative; padding: 4px 0; }
.day-carousel {
  display: flex;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 10px;
  padding: 4px 46% 4px;
}
.day-carousel::-webkit-scrollbar { display: none; }
.day-card {
  flex: 0 0 auto;
  width: 92px;
  scroll-snap-align: center;
  background: var(--inactive-fill);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  text-align: center;
  transition: background 0.15s ease, transform 0.15s ease;
}
.day-card .dow { font-size: 11px; color: var(--text-dim); }
.day-card .num { font-family: var(--font-display); font-weight: 800; font-size: 20px; margin-top: 2px; }
.day-card .status { font-size: 11px; color: var(--text-faint); margin-top: 4px; min-height: 14px; }
.day-card.centered { background: var(--card); transform: scale(1.04); }
.day-card.confirmed { background: var(--accent); }
.day-card.confirmed .dow,
.day-card.confirmed .num,
.day-card.confirmed .status { color: var(--bg); }
.day-confirm-hint { text-align: center; font-size: 12px; color: var(--text-faint); margin-top: 8px; }

/* ===== Bottom tab bar (dock) - primary navigation, persistent across
 * every screen. A menu icon (if kept) is secondary to this. ===== */
.tab-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-around;
  background: var(--card-gradient);
  padding: 8px 8px calc(8px + var(--safe-bottom));
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.4);
  z-index: 150;
}
.tab-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text); font-size: 11px; font-weight: 600;
  flex: 1; min-height: 48px; justify-content: center;
}
/* Icon is always green here (from the global .tabler-icon default) even
 * when the tab is inactive - it's the label color that carries the
 * active/inactive distinction, going white -> glowing green, plus a glow
 * added to the icon on top when active, so "active" reads as "the icon
 * lit up" rather than a color change alone. */
.tab-item.active { color: var(--accent); text-shadow: 0 0 6px rgba(192, 234, 30, 0.55); }
.tab-item.active .tabler-icon { filter: drop-shadow(0 0 6px rgba(192, 234, 30, 0.55)); }

/* ===== Circular progress ring (component ready, not yet wired to a
 * screen - see ui.js's buildRing doc comment) ===== */
.ring-wrap { position: relative; margin: 0 auto; }
.ring-wrap svg { width: 100%; height: 100%; }
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring-value { font-family: var(--font-display); font-weight: 800; font-size: 18px; color: var(--text); }
.ring-label { font-size: 10px; color: var(--text-dim); margin-top: 2px; }

/* ===== Stat mini-cards row (component ready, not yet wired to a screen -
 * see ui.js's buildStatRow doc comment) ===== */
.stat-row { display: flex; gap: 10px; }
.stat-card {
  flex: 1; background: var(--card-gradient); border-radius: var(--radius-md);
  padding: 12px; text-align: center; box-shadow: var(--shadow-card);
}
.stat-icon { color: var(--accent); margin-bottom: 4px; }
.stat-value { font-family: var(--font-display); font-weight: 800; font-size: 18px; color: var(--text); }
.stat-label { font-size: 10px; color: var(--text-dim); margin-top: 2px; }

/* ===== Charts ===== */
.chart-wrap { position: relative; touch-action: pan-y; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-empty { padding: 28px 0; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; padding: 0 4px; }
.chart-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.chart-legend-swatch { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-tooltip {
  position: absolute; top: 4px; min-width: 110px;
  background: var(--bg); border-radius: 10px; padding: 8px 10px;
  box-shadow: var(--shadow-card); pointer-events: none;
  transition: opacity 0.1s ease; font-size: 12px;
}
.chart-tooltip-date { color: var(--text-dim); font-size: 11px; margin-bottom: 4px; }
.chart-tooltip-row { display: flex; align-items: center; gap: 6px; padding: 1px 0; }
.chart-tooltip-key { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.chart-tooltip-label { color: var(--text-dim); flex: 1; }
.chart-tooltip-value { font-weight: 700; color: var(--text); }
.range-filter-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; }
.exercise-picker-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; }

/* ===== Check-in photo timeline: one angle scrolled left/right
 * chronologically, each photo with its date (CLAUDE.md item 9) ===== */
.photo-timeline { display: flex; overflow-x: auto; gap: 10px; padding: 4px 2px; -webkit-overflow-scrolling: touch; }
.photo-timeline-item { flex: 0 0 auto; width: 120px; text-align: center; }
.photo-timeline-item img { width: 120px; height: 160px; object-fit: cover; border-radius: var(--radius-sm); display: block; }
.photo-timeline-item .date { font-size: 11px; color: var(--text-faint); margin-top: 6px; }

/* ===== Guides content (generic renderer output) ===== */
.guide-text { font-size: 14px; line-height: 1.5; color: var(--text); }
.guide-list { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.6; color: var(--text); }
.guide-list li { margin-bottom: 4px; }
.guide-card {
  background: var(--inactive-fill); border-radius: var(--radius-sm);
  padding: 12px 14px; margin-bottom: 10px;
}
.guide-card:last-child { margin-bottom: 0; }
.guide-field { margin-bottom: 8px; }
.guide-field:last-child { margin-bottom: 0; }
.guide-field-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); margin-bottom: 2px; }
.guide-field-value { font-size: 14px; color: var(--text); }

/* ===== Editable rows, sheets, quick-log tiles (log-control batch) ===== */
.exercise-row.tappable { cursor: pointer; }
.exercise-row.tappable:active { opacity: 0.7; }
.exercise-row .name .tabler-icon { width: 14px; height: 14px; margin-right: 2px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.section-head .section-title { margin-bottom: 0; display: flex; align-items: center; gap: 6px; }
.date-divider {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); padding: 12px 4px 2px;
}
.date-nav { display: flex; gap: 6px; }
.date-nav .icon-btn:disabled { opacity: 0.35; }

.pill {
  display: inline-block; border-radius: 999px; padding: 2px 9px;
  font-size: 12px; font-weight: 700; line-height: 1.5;
}
.pill-good { background: rgba(192, 234, 30, 0.16); color: var(--accent); }
.pill-warn { background: rgba(240, 180, 41, 0.16); color: #f0b429; }
.pill-muted { background: var(--inactive-fill); color: var(--text-dim); }
.link-danger { color: var(--danger); }

.chip.small { padding: 6px 12px; font-size: 12px; }
.chip-row.wrap { flex-wrap: wrap; overflow: visible; }
.chip-recent { display: inline-flex; align-items: baseline; gap: 6px; }
.chip-recent .chip-meta { font-size: 11px; color: var(--text-faint); font-weight: 500; }

.sheet-subtitle { font-size: 13px; color: var(--text-dim); margin: -10px 0 14px; }
.sheet-fields { display: flex; flex-direction: column; gap: 12px; }
.sheet-fields .picker-row { margin: 4px 0; }
.sheet-field .picker-label { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.sheet-actions { margin-top: 18px; }
.free-text.input { min-height: 48px; padding: 12px; resize: none; }
input.free-text[type="time"], input.free-text[type="date"] {
  -webkit-appearance: none; appearance: none; color-scheme: dark;
  font-variant-numeric: tabular-nums;
}
.btn-danger { background: var(--danger); color: var(--text); }
.btn-compact { min-height: 44px; font-size: 14px; padding: 0 14px; }
.btn-danger-ghost .tabler-icon { color: inherit; }

.toast-undo { display: flex; align-items: center; gap: 14px; padding-right: 10px; }
.toast-undo button {
  color: var(--accent); font-weight: 700; font-size: 13px;
  padding: 6px 12px; border-radius: 999px; background: var(--inactive-fill);
}

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-tile {
  min-height: 72px; border-radius: var(--radius-md);
  background: var(--inactive-fill); color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 600;
}
.quick-tile:active { opacity: 0.75; }

.macro-preview { text-align: center; font-size: 14px; color: var(--text-dim); margin: -6px 0 14px; }
.reading-spinner {
  width: 28px; height: 28px; margin: 18px auto 6px; border-radius: 50%;
  border: 3px solid var(--inactive-fill-strong); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.macro-preview b { color: var(--accent); font-family: var(--font-display); font-weight: 800; font-size: 16px; }
.macro-row { padding: 6px 0; }
.macro-row.secondary { opacity: 0.75; }
.macro-row.secondary .bar-track { height: 5px; }
.macro-head { display: flex; align-items: baseline; justify-content: space-between; }
.macro-label { font-size: 13px; color: var(--text-dim); }
.macro-value { font-size: 14px; }
.macro-value b { font-family: var(--font-display); font-weight: 800; font-size: 17px; }
.bar-fill.warn { background: #f0b429; }

/* ===== Workout overview / history / session detail ===== */
.meta.faint { color: var(--text-faint); }
.big-title { font-family: var(--font-display); font-weight: 800; font-size: 26px; margin-top: 4px; line-height: 1.1; }
.done-card { display: flex; flex-direction: column; gap: 14px; }
.done-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.done-head .label { font-size: 13px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.note-quote {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--inactive-fill); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 14px; line-height: 1.4; color: var(--text);
}
.note-quote .tabler-icon { margin-top: 2px; }
.last-time-card .section-head .meta { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.session-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.session-tile {
  position: relative; text-align: left; padding: 14px 14px 12px;
  border-radius: var(--radius-md); background: var(--inactive-fill); color: var(--text);
  min-height: 64px; display: flex; flex-direction: column; gap: 2px;
}
.session-tile .tile-name { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.session-tile .tile-meta { font-size: 12px; color: var(--text-dim); }
.session-tile .tile-tag {
  position: absolute; top: 10px; right: 10px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent);
}
.session-tile.active { background: var(--accent); color: var(--bg); box-shadow: var(--accent-glow); }
.session-tile.active .tile-meta, .session-tile.active .tile-tag { color: rgba(14, 18, 19, 0.7); }

.ex-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.ex-row:last-child { border-bottom: none; }
.ex-row .ex-main { flex: 1; min-width: 0; }
.ex-row .name { font-size: 15px; font-weight: 600; }
.ex-row .meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.ex-row .ex-weight { text-align: right; flex: 0 0 auto; }
.ex-row .w { font-family: var(--font-display); font-weight: 800; font-size: 20px; line-height: 1; }
.ex-row .w .unit { font-size: 11px; font-weight: 600; color: var(--text-dim); margin-left: 2px; }
.ex-row .bump { font-size: 11px; font-weight: 700; color: var(--accent); margin-top: 3px; }
.ex-row .bump.muted-bump { color: var(--text-faint); font-weight: 500; }
.flare-block { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.flare-block:last-child { border-bottom: none; }
.flare-block .name { font-size: 14px; font-weight: 600; }
.ramp-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.set-dots { display: flex; gap: 6px; margin-top: 8px; }
.set-dots .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--inactive-fill-strong); }
.set-dots .dot.done { background: var(--accent); }
.set-dots .dot.current { box-shadow: 0 0 0 2px var(--accent); }

.day-card .status.planned { color: var(--text-faint); }
.day-card .status.done { color: var(--accent); }
.day-card.skipped .status.done { color: var(--text-dim); }
.day-card.is-today:not(.confirmed) { box-shadow: 0 0 0 1.5px var(--accent) inset; }

.week-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.week-head .section-title { margin-bottom: 0; }
.hist-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.hist-row:last-child { border-bottom: none; }
.hist-row.tappable { cursor: pointer; }
.hist-row .hist-main { flex: 1; min-width: 0; }
.hist-row .name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.hist-row .meta { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.hist-row .note-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-row .hist-side { text-align: right; flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.hist-row.skipped { opacity: 0.55; padding: 6px 2px; }
.hist-row.skipped .name { font-size: 13px; font-weight: 500; }
.hist-row.skipped .tabler-icon { color: var(--text-dim); }
.date-block {
  width: 42px; flex: 0 0 auto; text-align: center;
  background: var(--inactive-fill); border-radius: 12px; padding: 6px 0;
}
.date-block .dow { font-size: 10px; color: var(--text-dim); text-transform: uppercase; }
.date-block .num { font-family: var(--font-display); font-weight: 800; font-size: 17px; line-height: 1.1; }
.hist-row.skipped .date-block { background: transparent; }

.ex-detail .name { font-size: 15px; font-weight: 700; }
.set-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 8px; }
.set-chip {
  min-height: 40px; min-width: 64px; padding: 0 12px;
  border-radius: 12px; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--inactive-fill); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.set-chip .side { font-size: 10px; font-weight: 700; color: var(--text-dim); }
.set-chip.good { background: rgba(192, 234, 30, 0.16); color: var(--accent); }
.set-chip.good .side { color: rgba(192, 234, 30, 0.7); }
.set-chip.warn { background: rgba(240, 180, 41, 0.16); color: #f0b429; }
.set-chip.warn .side { color: rgba(240, 180, 41, 0.7); }
.set-chip.missing { background: transparent; box-shadow: 0 0 0 1px var(--inactive-fill-strong) inset; color: var(--text-faint); }
.card.tappable { cursor: pointer; }
.card.tappable:active { opacity: 0.85; }

/* ===== Alerts (tappable) + Phase screen ===== */
.alerts-strip .text { flex: 1; }
.alerts-strip.tappable { cursor: pointer; }
.alerts-strip.tappable:active { opacity: 0.8; }
.alerts-strip.warn .tabler-icon:first-child { color: #f0b429; }
.check-list { display: flex; flex-direction: column; gap: 6px; }
.check-row {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: var(--inactive-fill); border-radius: var(--radius-sm); padding: 12px 14px;
  color: var(--text); width: 100%;
}
.check-row .name { font-size: 14px; font-weight: 600; }
.check-row .meta { font-size: 12px; color: var(--text-dim); }
.check-row .tabler-icon { color: var(--text-faint); flex: 0 0 auto; }
.check-row.met .tabler-icon { color: var(--accent); }
.check-row.manual { cursor: pointer; }
.check-row.manual:active { opacity: 0.8; }
.delta-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.delta-row:last-of-type { border-bottom: none; }
.delta-row b { color: var(--accent); }

/* ===== Progress: link grid, goal bars, calendar, bars ===== */
.link-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.link-tile {
  background: var(--card-gradient); border-radius: var(--radius-md); box-shadow: var(--shadow-card);
  padding: 12px 6px 10px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text); min-height: 78px;
}
.link-tile span { font-size: 12px; font-weight: 700; }
.link-tile small { font-size: 10px; color: var(--text-faint); text-align: center; line-height: 1.2; }
.link-tile:active { opacity: 0.8; }

.goal-list { display: flex; flex-direction: column; gap: 4px; }
.goal-row { width: 100%; text-align: left; padding: 8px 6px; border-radius: 12px; color: var(--text); }
.goal-row.active { background: var(--inactive-fill); }
.goal-row .goal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; }
.goal-row .goal-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal-row .goal-nums { white-space: nowrap; font-variant-numeric: tabular-nums; }
.goal-row .goal-nums b { color: var(--text); margin-left: 4px; }
.goal-row .goal-nums b.good { color: var(--accent); }
.goal-row .bar-track { margin-top: 6px; height: 6px; }
.chart-legend-swatch.band { background: rgba(192, 234, 30, 0.25); height: 8px; }

.cal-wrap { display: flex; flex-direction: column; gap: 12px; }
.cal-label { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { font-size: 10px; color: var(--text-faint); text-align: center; }
.cal-cell {
  aspect-ratio: 1; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-faint); background: var(--inactive-fill);
}
.cal-cell.empty { background: transparent; }
.cal-cell.future { background: transparent; box-shadow: 0 0 0 1px var(--inactive-fill) inset; }
.cal-cell.trained { background: var(--accent); color: var(--bg); font-weight: 700; }
.cal-cell.sport { background: rgba(192, 234, 30, 0.28); color: var(--text); }
.cal-cell.skipped { background: var(--inactive-fill-strong); color: var(--text-dim); }
.cal-cell.today { box-shadow: 0 0 0 1.5px var(--accent) inset; }
.cal-swatch { width: 12px; height: 12px; border-radius: 4px; display: inline-block; background: var(--inactive-fill); }
.cal-swatch.trained { background: var(--accent); }
.cal-swatch.sport { background: rgba(192, 234, 30, 0.28); }
.cal-swatch.skipped { background: var(--inactive-fill-strong); }

/* ===== Check-in table + compare ===== */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ci-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.ci-table th, .ci-table td { padding: 8px 6px; text-align: right; white-space: nowrap; border-bottom: 1px solid rgba(255,255,255,0.05); }
.ci-table th { font-weight: 600; color: var(--text); }
.ci-table td.ci-label { text-align: left; color: var(--text-dim); }
.ci-col { color: var(--text); font-weight: 700; text-align: right; }
.ci-col .meta { font-size: 10px; font-weight: 500; }
.delta { font-size: 11px; font-weight: 700; margin-left: 2px; }
.delta.up { color: var(--accent); }
.delta.down { color: #f0b429; }
.delta.same { color: var(--text-faint); }
.compare-pick select { min-height: 44px; }
.cmp-img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 10px; display: block; background: var(--inactive-fill); }
.cmp-img.empty { display: flex; align-items: center; justify-content: center; color: var(--text-faint); }
.photo-full { max-width: 100%; max-height: 80vh; margin: 0 auto; border-radius: var(--radius-md); object-fit: contain; }
.modal-sheet.wide { max-height: 88vh; overflow-y: auto; }

/* ===== Sync banner, update bar, search, review, flow clock ===== */
.connection-banner.queued { background: var(--inactive-fill-strong); color: var(--text); }
.connection-banner.ok { background: var(--accent); color: var(--bg); }
.update-banner {
  position: fixed; left: 14px; right: 14px; bottom: calc(96px + var(--safe-bottom));
  background: var(--card); color: var(--text); border-radius: var(--radius-md);
  padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  box-shadow: var(--shadow-card-lg); z-index: 300; font-size: 13px;
}
.update-banner button { background: var(--accent); color: var(--bg); border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 13px; }
.link-grid.three { grid-template-columns: repeat(3, 1fr); }
.search-card { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.search-input {
  flex: 1; background: transparent; border: none; color: var(--text); font-size: 15px; font-family: inherit; min-height: 32px;
}
.search-input::placeholder { color: var(--text-faint); }
.search-input:focus { outline: none; }
.search-hit .snippet { font-size: 13px; color: var(--text); margin-top: 2px; line-height: 1.4; }
mark { background: rgba(192, 234, 30, 0.28); color: var(--text); border-radius: 3px; padding: 0 2px; }
details.decisions summary { font-size: 12px; color: var(--text-dim); cursor: pointer; padding: 4px 0; }
details.decisions .meta { padding: 3px 0 3px 12px; border-left: 2px solid var(--inactive-fill-strong); margin: 2px 0; }
.flow-clock { font-variant-numeric: tabular-nums; }
.protocol-item .check.saving { opacity: 0.6; }

/* ===== Misc ===== */
.muted { color: var(--text-dim); }
.center-text { text-align: center; }
.free-text {
  width: 100%; min-height: 90px;
  background: var(--inactive-fill); border: none;
  border-radius: var(--radius-sm); color: var(--text); font-size: 15px;
  padding: 12px; font-family: inherit; resize: vertical;
}
.free-text::placeholder { color: var(--text-faint); }
