:root {
  /* Light by default: soft grey page, white rounded cards, near-black ink,
     one vivid green accent (the orange of the reference kit, swapped). */
  --ink: var(--n-ink);
  --accent: var(--acc-500);
  --accent-ink: #ffffff;
  --accent-dark: var(--acc-600);
  --accent-soft: var(--acc-100);
  --accent-glow: rgba(var(--acc-500-rgb), 0.35);
  --tile-dark: var(--n-hero);
  --tile-blue: #2563eb;
  --tile-grey: #6b7280;
  --tile-lime: #65a30d;
  --bg: var(--n-bg);
  --panel: var(--n-panel);
  --panel-2: #f5f6f8;
  --text: var(--n-ink);
  --muted: var(--n-muted);
  --border: var(--n-border);
  --gold: #e0a526;
  --silver: #9ca3af;
  --bronze: #c2703d;
  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --success: var(--acc-500);
  --success-soft: var(--acc-100);
  --radius: 28px;
  --radius-sm: 16px;
  --shadow: 0 1px 2px rgba(var(--n-ink-rgb), 0.04), 0 10px 30px rgba(var(--n-ink-rgb), 0.06);
  --shadow-lg: 0 24px 60px rgba(var(--n-ink-rgb), 0.18);

  --emphasis: var(--accent);
  --emphasis-contrast: var(--accent-ink);
  --focus-ring: rgba(var(--acc-500-rgb), 0.22);
  --badge-bg: var(--n-badge);
  /* --font and the --acc-*/--n-*/--d-* tokens live in themes.css */
}

/* Dark mode, opt-in via the theme toggle. */
:root[data-theme="dark"] {
  --bg: var(--d-bg);
  --panel: var(--d-panel);
  --panel-2: var(--d-tile);
  --text: #f4f5f6;
  --muted: var(--d-muted);
  --border: var(--d-hair);
  --badge-bg: var(--d-seg);
  --danger-soft: rgba(239, 68, 68, 0.18);
  --success-soft: rgba(var(--acc-500-rgb), 0.18);
  --accent-soft: rgba(var(--acc-500-rgb), 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.app { max-width: 1080px; margin: 0 auto; padding: 0 20px 60px; }

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 0;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; object-fit: cover; flex-shrink: 0; display: block;
}
.brand-title { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-tm { color: var(--accent-dark); font-size: 10px; font-weight: 700; vertical-align: super; margin-left: 1px; }
.brand-sub { font-size: 12px; color: var(--muted); }

/* ---------- nav / tabs ---------- */
.tabs { display: flex; gap: 4px; background: var(--panel); padding: 4px; border-radius: 999px; border: 1px solid var(--border); }
.tab {
  border: none; background: transparent; padding: 8px 16px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--emphasis); color: var(--emphasis-contrast); }
.tab-icon { font-size: 14px; line-height: 1; }
.tab-label { white-space: nowrap; }

/* ---------- status / admin ---------- */
.conn-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot-off { background: var(--n-line); }
.dot-on { background: var(--success); }
.dot-err { background: var(--danger); }

.btn-admin-active { background: var(--success); color: white; border-color: var(--success); }

/* ---------- buttons ---------- */
.btn {
  border: none; border-radius: 999px; padding: 9px 18px; font-size: 13px; font-weight: 700;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  transition: transform 0.08s ease, opacity 0.15s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-strava { background: var(--emphasis); color: var(--emphasis-contrast); }
.btn-strava:hover { opacity: 0.88; }
.btn-primary { background: var(--emphasis); color: var(--emphasis-contrast); }
.btn-primary:hover { opacity: 0.88; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: var(--accent-dark); }

/* ---------- greeting ---------- */
.dash-greeting { padding: 6px 2px 18px; }
.dash-greeting-title { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.dash-greeting-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---------- views ---------- */
.view { display: none; }
.view.active { display: block; }

/* ---------- stat grid / cards ---------- */
.grid-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0 0 18px;
}
.stat-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.stat-label { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.stat-value { font-size: 25px; font-weight: 700; letter-spacing: -0.01em; }
.stat-value-sm { font-size: 14px; font-weight: 700; }

.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.panel h2 { margin: 0 0 6px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }

/* ---------- athletes ---------- */
.athlete-list { display: grid; gap: 8px; margin-top: 12px; }
.athlete-row {
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px;
}
.athlete-row-main { display: flex; align-items: center; gap: 10px; }
.athlete-name { font-size: 13px; font-weight: 700; }
.athlete-meta { font-size: 11px; color: var(--muted); }

.avatar-badge {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--ink);
  background: var(--accent); vertical-align: middle;
  position: relative; overflow: hidden;
}
.avatar-badge.sm { width: 20px; height: 20px; font-size: 9px; }
.avatar-badge.lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-badge img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.athlete-link { cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.athlete-link:hover .athlete-link-name, .athlete-link:focus .athlete-link-name { text-decoration: underline; }
.athlete-link:focus { outline: none; }
.athlete-link:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 2px; border-radius: 4px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, "SF Mono", "Cascadia Code", "Segoe UI Mono", Consolas, monospace; font-variant-numeric: tabular-nums; }

.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.space-between { justify-content: space-between; }
.end { justify-content: flex-end; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-wrap { overflow-x: auto; margin-top: 12px; -webkit-overflow-scrolling: touch; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; }
tr:last-child td { border-bottom: none; }
.rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; font-weight: 700; font-size: 11px; color: white; background: #9ca3af;
}
.rank-1 { background: var(--gold); }
.rank-2 { background: var(--silver); }
.rank-3 { background: var(--bronze); }

.move-badge { font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; white-space: nowrap; }
.move-up { color: var(--success); background: var(--success-soft); }
.move-down { color: var(--danger); background: var(--danger-soft); }
.move-flat { color: var(--muted); }
.move-new { color: var(--ink); background: var(--accent); }

/* ---------- lists / cards ---------- */
.comp-list { display: grid; gap: 10px; margin-top: 14px; }
.comp-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: center; cursor: pointer; gap: 12px;
  transition: border-color 0.15s, background 0.15s;
}
.comp-card:hover { border-color: var(--emphasis); background: var(--bg); }
.comp-card-title { font-weight: 700; font-size: 14px; }
.comp-card-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.badge {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: var(--badge-bg); color: var(--text); white-space: nowrap;
}

.sport-tag {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border); margin-right: 4px; margin-bottom: 4px;
}

.activity-excluded { opacity: 0.45; }

/* ---------- activity feed toolbar ---------- */
.activity-toolbar { margin: 14px 0 4px; flex-wrap: wrap; }
.activity-search-input, #activitySportFilter {
  font-weight: 400; padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  font-size: 13px; background: var(--panel); color: var(--text);
}
.activity-search-input { flex: 1; min-width: 160px; }
.activity-search-input:focus, #activitySportFilter:focus { outline: none; border-color: var(--emphasis); box-shadow: 0 0 0 3px var(--focus-ring); }
.sortable-th { cursor: pointer; user-select: none; }
.sortable-th:hover { color: var(--text); }

/* ---------- modal ---------- */
.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(27, 29, 23, 0.55);
  align-items: flex-start; justify-content: center; overflow-y: auto; padding: 40px 16px; z-index: 2000;
}
.modal-backdrop.active { display: flex; }
.modal {
  background: var(--panel); border-radius: var(--radius); width: 100%; max-width: 560px;
  padding: 22px; box-shadow: var(--shadow-lg);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-header h2 { font-weight: 700; letter-spacing: -0.01em; }
.modal-sm { max-width: 360px; }
.icon-btn { border: none; background: transparent; font-size: 16px; cursor: pointer; color: var(--muted); }

/* ---------- recap card ---------- */
/* Deliberately hardcoded dark/lime, independent of page theme tokens — the
   card should look identical every time regardless of anything else, since
   it's meant to be screenshotted and shared as-is. */
/* Wider than a standard .modal on purpose — the share image is a straight
   render of .recap-card's own rendered pixel size (see shareRecapImage),
   so a bigger card here is a sharper exported PNG, not just a layout choice.
   Still responsive: width:100% below this ceiling means narrow viewports
   are unaffected, and the existing 480px breakpoint below keeps the phone
   layout exactly as it was. */
.recap-modal { max-width: 640px; padding: 0; background: transparent; box-shadow: none; }
.recap-modal-header { padding: 14px 18px 0; margin-bottom: 0; }
.recap-modal-header .muted { color: rgba(245, 246, 239, 0.75); }
.recap-close { color: rgba(245, 246, 239, 0.75); font-size: 18px; }

.recap-card {
  background: linear-gradient(165deg, #1b1d17 0%, #121410 100%);
  color: #f5f6ef;
  border-radius: 24px;
  padding: 36px 32px 30px;
  margin: 18px 22px 22px;
  position: relative;
  overflow: hidden;
}
.recap-card::before {
  content: '';
  position: absolute; top: -70px; right: -70px; width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(var(--acc-500-rgb), 0.22), transparent 70%);
  pointer-events: none;
}

.recap-kicker {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--acc-500); margin-bottom: 8px; position: relative;
}
.recap-title { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; text-wrap: balance; position: relative; }
.recap-subtitle { font-size: 13px; color: rgba(245, 246, 239, 0.6); margin-top: 4px; position: relative; }

.recap-podium { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 22px; position: relative; }
.recap-track-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: rgba(245, 246, 239, 0.55); margin-top: 20px; position: relative;
}
.recap-podium-row {
  display: flex; align-items: center; gap: 10px;
  background: rgba(245, 246, 239, 0.07); border-radius: 14px; padding: 10px 14px;
}
.recap-medal { font-size: 18px; width: 22px; text-align: center; flex-shrink: 0; }
.recap-podium-name { flex: 1; font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.recap-podium-value { font-weight: 700; font-size: 14px; color: var(--acc-500); white-space: nowrap; }
.recap-empty { color: rgba(245, 246, 239, 0.5); font-size: 13px; }

.recap-hero-stat { text-align: center; margin: 20px 0 14px; position: relative; }
.recap-hero-value { font-size: 64px; font-weight: 700; color: var(--acc-500); line-height: 1; }
.recap-hero-label { font-size: 12.5px; color: rgba(245, 246, 239, 0.6); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.06em; }

.recap-stats { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; position: relative; }
.recap-stat-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border-top: 1px solid rgba(245, 246, 239, 0.1); padding-top: 10px; font-size: 13px;
}
.recap-stat-label { color: rgba(245, 246, 239, 0.65); }
.recap-stat-value { font-weight: 700; text-align: right; }

.recap-footer {
  display: flex; align-items: center; gap: 8px; margin-top: 26px; padding-top: 16px;
  border-top: 1px solid rgba(245, 246, 239, 0.12); position: relative;
}
.recap-footer-mark { width: 20px; height: 20px; border-radius: 6px; display: block; }
.recap-footer-word { font-size: 12px; font-weight: 700; color: rgba(245, 246, 239, 0.7); letter-spacing: 0.02em; }

@media (max-width: 480px) {
  .recap-card { margin: 10px 12px 12px; padding: 26px 20px 20px; }
  .recap-hero-value { font-size: 44px; }
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13px; font-weight: 700; flex: 1; min-width: 0; }
.field input[type="text"], .field input[type="date"], .field input[type="number"], .field input[type="password"] {
  font-weight: 400; padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: 13px;
  background: var(--panel); color: var(--text);
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--emphasis); box-shadow: 0 0 0 3px var(--focus-ring);
}

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; font-size: 12px;
  cursor: pointer; user-select: none; font-weight: 600;
}
.chip.selected { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.metric-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.metric-grid label {
  display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted);
}
.metric-grid input {
  padding: 7px 9px; border-radius: 7px; border: 1px solid var(--border); font-size: 13px; font-weight: 400; color: var(--text);
}

.metric-toggle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.metric-toggle {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; display: flex; flex-direction: column; gap: 8px;
}
.metric-toggle-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; cursor: pointer; }
.metric-toggle-head input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--emphasis); }
.metric-toggle-weight { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.metric-toggle-weight input {
  padding: 7px 9px; border-radius: 7px; border: 1px solid var(--border); font-size: 13px; font-weight: 400; color: var(--text);
}
.metric-toggle.off { opacity: 0.5; }
.metric-toggle.off .metric-toggle-weight input { background: var(--bg); }

.field select {
  font-weight: 400; padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: 13px;
  background: var(--panel); color: var(--text);
}

.scoring-note { margin: 10px 0 4px; }

/* ---------- current standings ---------- */
.standings-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 14px;
}
.standing-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.standing-card:hover { border-color: var(--emphasis); }
.standing-card:active { transform: scale(0.99); }
.standing-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.standing-title { font-weight: 700; font-size: 14px; }
.standing-period { margin-top: 2px; margin-bottom: 10px; }
.standing-row { display: grid; grid-template-columns: 22px 1fr 56px auto; align-items: center; gap: 8px; padding: 5px 0; }
.standing-name { font-size: 12.5px; display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.standing-name .athlete-link-name { overflow: hidden; text-overflow: ellipsis; }
.standing-bar-track { height: 6px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.standing-bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.standing-points { font-size: 12.5px; font-weight: 700; text-align: right; white-space: nowrap; }

/* ---------- donut chart ---------- */
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-top: 12px; }
.donut-legend { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 160px; }
.donut-legend-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.donut-swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.donut-legend-label { flex: 1; color: var(--text); }
.donut-legend-value { color: var(--muted); font-weight: 700; }

/* ---------- challenges ---------- */
.challenge-map { height: 300px; border-radius: var(--radius-sm); overflow: hidden; margin: 14px 0; border: 1px solid var(--border); }
.challenge-marker { display: flex; align-items: center; justify-content: center; font-size: 20px; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4)); }

.progress-track { position: relative; height: 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); }
.progress-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.3s; overflow: hidden; }
.progress-pace {
  position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--emphasis);
  transform: translateX(-1px); border-radius: 1px;
}
.progress-pace::after {
  content: ''; position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 4px solid var(--emphasis);
}

.pace-status { font-weight: 700; }
.pace-ahead { color: var(--success); }
.pace-behind { color: var(--danger); }
.pace-on-track { color: var(--muted); }

.challenge-stats { grid-template-columns: repeat(4, 1fr); margin: 14px 0 0; }

#featuredLeaderboard { cursor: pointer; border-radius: var(--radius-sm); }
#featuredLeaderboard:hover { background: var(--bg); }

/* Static link into the 75 Hard view, sitting above the dynamically-rendered
   #challengeList — styled and spaced to read as that list's first row
   rather than a separate block, without needing to touch how the list
   itself renders. */
.hard75-link-card { text-decoration: none; color: inherit; margin-top: 14px; margin-bottom: 10px; }
.hard75-link-card + #challengeList { margin-top: 0; }

.challenge-mini-list { display: grid; gap: 12px; margin-top: 12px; }
.challenge-mini {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; cursor: pointer;
  transition: border-color 0.15s;
}
.challenge-mini:hover { border-color: var(--emphasis); }
.challenge-mini-name { font-weight: 700; font-size: 13px; }

/* ---------- analytics hub ---------- */
.subtabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 999px; border: 1px solid var(--border); width: fit-content; margin: 14px 0; }
.subtab { border: none; background: transparent; padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: var(--muted); cursor: pointer; }
.subtab:hover { color: var(--text); }
.subtab.active { background: var(--emphasis); color: var(--emphasis-contrast); }
.analytics-controls { margin: 10px 0; flex-wrap: wrap; }
#leadersPeriodSelect {
  font-weight: 400; padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  font-size: 13px; background: var(--panel); color: var(--text);
}

/* ---------- trends chart ---------- */
#trendsChart { position: relative; margin-top: 8px; }
.trend-bar { transition: opacity 0.1s; }
.trend-bar-group:hover .trend-bar, .trend-bar-group:focus .trend-bar { opacity: 0.82; }
.trend-bar-group { outline: none; }
.trend-bar-group:focus .trend-hit { outline: 2px solid var(--emphasis); outline-offset: -2px; }
.chart-tooltip {
  position: absolute; transform: translate(-50%, -100%) translateY(-8px);
  background: var(--emphasis); color: var(--emphasis-contrast); font-size: 12px; padding: 6px 10px; border-radius: 8px;
  pointer-events: none; white-space: nowrap; box-shadow: var(--shadow);
}

/* ---------- athlete profile header ---------- */
.profile-header { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.profile-header-name { font-size: 17px; font-weight: 700; }
.badge-premium { background: var(--accent); color: var(--accent-ink); margin-left: 4px; }

/* ---------- personal bests ---------- */
.section-title { margin: 0 0 8px; font-size: 14px; font-weight: 700; }
.profile-stats { grid-template-columns: repeat(4, 1fr); margin: 0 0 16px; }

.pb-grid { display: grid; gap: 10px; }
.pb-row {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "label value" "meta meta";
  align-items: baseline; gap: 4px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px;
}
.pb-label { color: var(--muted); font-size: 12px; grid-area: label; }
.pb-value { font-weight: 700; font-size: 15px; grid-area: value; }
.pb-meta { color: var(--muted); font-size: 12px; grid-area: meta; text-align: left; }

/* ---------- 75 hard ---------- */
.hard75-head { flex-wrap: wrap; gap: 10px; }
.hard75-who-label { display: flex; align-items: center; gap: 6px; font-weight: 600; }
#hard75WhoSelect {
  font-weight: 600; padding: 7px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  font-size: 12.5px; background: var(--panel); color: var(--text);
}

.hard75-stats { grid-template-columns: repeat(3, 1fr); margin-bottom: 14px; }

.hard75-start-card {
  border: 1px dashed var(--emphasis); border-radius: var(--radius-sm); padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px;
}

.hard75-card-main { flex: 1; min-width: 0; }
.hard75-card-main .progress-track { margin-top: 8px; }

.hard75-badge-active { background: var(--success-soft); color: var(--success); }
.hard75-badge-complete { background: var(--success-soft); color: var(--success); }
.hard75-badge-failed { background: var(--danger-soft); color: var(--danger); }
.hard75-badge-outdoor { background: var(--success-soft); color: var(--success); }
.hard75-badge-indoor { background: var(--badge-bg); color: var(--muted); }

.hard75-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border-radius: var(--radius-sm); padding: 12px 16px; margin: 12px 0; font-size: 13px;
}
.hard75-banner-failed { background: var(--danger-soft); color: var(--danger); }
.hard75-banner-complete { background: var(--success-soft); color: var(--success); }

.hard75-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(26px, 1fr)); gap: 4px; margin: 14px 0;
}
.hard75-cell {
  aspect-ratio: 1; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: var(--muted); background: var(--bg); border: 1px solid var(--border);
  cursor: pointer;
}
.hard75-cell-complete { background: var(--success); color: white; border-color: var(--success); }
.hard75-cell-missed { background: var(--danger); color: white; border-color: var(--danger); }
.hard75-cell-today { border-color: var(--emphasis); border-width: 2px; color: var(--text); }
.hard75-cell-future { opacity: 0.5; cursor: default; }
.hard75-cell-selected { outline: 2px solid var(--emphasis); outline-offset: 1px; }

.hard75-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.hard75-row:last-child { border-bottom: none; }
.hard75-row-icon { font-size: 16px; line-height: 1.3; }
.hard75-row-body { flex: 1; min-width: 0; }
.hard75-row-label { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.hard75-requirement-row { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; font-weight: 700; margin: 10px 0; }
.hard75-req-ok { color: var(--success); }
.hard75-req-pending { color: var(--muted); }

@media (max-width: 480px) {
  .hard75-start-card { flex-direction: column; align-items: flex-start; }
  .hard75-grid { grid-template-columns: repeat(auto-fill, minmax(20px, 1fr)); }
}

/* ---------- workouts ---------- */
/* day strip */
.wo-day-strip { display: flex; gap: 6px; overflow-x: auto; padding: 8px 2px 4px; margin-bottom: 4px; }
.wo-day-chip-wrap { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 0 0 auto; width: 42px; }
.wo-day-today-arrow { color: var(--emphasis); font-size: 9px; line-height: 1; }
.wo-day-letter { font-size: 10px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.wo-day-letter.today { color: var(--emphasis); }
.wo-day-num { font-size: 13px; font-weight: 700; }
.wo-day-num.today { color: var(--emphasis); }
.wo-day-icon {
  width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 15px; border: 1px solid var(--border); background: var(--panel); margin-top: 2px;
}
.wo-day-icon.rest { font-size: 8.5px; font-weight: 700; color: var(--muted); letter-spacing: 0.02em; }
.wo-day-icon.rest.future { border-style: dashed; opacity: 0.7; }
.wo-day-icon.has-activity { background: var(--success-soft); border-color: var(--emphasis); }

/* recent activity card */
.wo-recent-activity {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin: 10px 0; cursor: pointer; transition: border-color 0.15s;
}
.wo-recent-activity:hover { border-color: var(--emphasis); }
.wo-recent-icon { font-size: 22px; flex-shrink: 0; }
.wo-recent-body { flex: 1; min-width: 0; }
.wo-recent-title { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wo-recent-arrow { color: var(--muted); flex-shrink: 0; }

/* routine carousel */
.wo-routine-carousel { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 10px; }
.wo-routine-card {
  flex: 0 0 158px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px;
  cursor: pointer; transition: border-color 0.15s;
}
.wo-routine-card:hover { border-color: var(--emphasis); }
.wo-routine-card-icon { display: block; font-size: 26px; margin-bottom: 22px; }
.wo-routine-card-name { font-weight: 700; font-size: 14px; margin-bottom: 4px; }

.wo-ex-empty { margin: 4px 0 8px; }
.wo-thumb { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; flex-shrink: 0; background: var(--bg); }
.wo-superset-connector { color: var(--emphasis); font-size: 11.5px; font-weight: 700; text-align: center; padding: 6px 0 2px; }
.workout-exercise-block.wo-linked { border-color: var(--emphasis); }

/* routine-builder exercise cards */
.wo-ex-unit {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 12px;
  transition: border-color 0.15s, opacity 0.15s;
}
.wo-ex-unit.wo-linked { border-color: var(--emphasis); }
.wo-ex-unit.dragging { opacity: 0.4; }
.wo-ex-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.wo-ex-grip { cursor: grab; color: var(--muted); font-size: 16px; line-height: 1; touch-action: none; }
.wo-ex-grip:active { cursor: grabbing; }
.wo-ex-card-title { flex: 1; min-width: 0; }
.wo-ex-card-name {
  display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wo-link-icon-btn {
  background: none; border: none; cursor: pointer; font-size: 13px; padding: 2px; color: var(--muted); opacity: 0.4;
}
.wo-link-icon-btn.linked { color: var(--emphasis); opacity: 1; }
.wo-set-row {
  display: grid; grid-template-columns: 28px 1fr 1fr 1fr 28px; gap: 8px; align-items: center; margin-bottom: 6px;
}
.wo-set-row-head {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 8px;
}
.wo-set-num {
  width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); display: flex;
  align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700;
}
.wo-set-remove { font-size: 12px; padding: 2px 4px; }

/* scroll-pick field: a hidden <input> (keeps the existing value/event
   contract) paired with a visible button that opens the shared sheet */
.scroll-pick-field { display: block; width: 100%; }
.scroll-pick-display {
  display: block; width: 100%; font: inherit; font-weight: 400; padding: 8px 9px; border-radius: 7px;
  border: 1px solid var(--border); font-size: 13px; background: var(--panel); color: var(--text); cursor: pointer;
}
.scroll-pick-display:hover, .scroll-pick-display:focus { outline: none; border-color: var(--emphasis); box-shadow: 0 0 0 3px var(--focus-ring); }
.scroll-pick-disabled { display: block; width: 100%; padding: 8px 9px; font-size: 13px; color: var(--muted); text-align: center; }
.scroll-pick-list { max-height: 55vh; overflow-y: auto; margin-top: 8px; }
.scroll-pick-opt { padding: 13px 10px; font-size: 15px; text-align: center; cursor: pointer; border-radius: 7px; }
.scroll-pick-opt:hover { background: var(--panel); }
.scroll-pick-opt.selected { font-weight: 700; color: var(--emphasis); background: var(--success-soft); }

.wo-picker { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.wo-tile-icon { font-size: 22px; line-height: 1; }
.wo-muscle-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.wo-muscle-tile, .wo-exercise-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel);
  padding: 14px 8px; cursor: pointer; text-align: center; font-size: 12.5px; font-weight: 600;
  transition: border-color 0.15s, background 0.15s; position: relative;
}
.wo-muscle-tile:hover, .wo-exercise-tile:hover { border-color: var(--emphasis); }
.wo-muscle-tile.selected, .wo-exercise-tile.selected {
  border-color: var(--emphasis); background: var(--success-soft);
}
.wo-exercise-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px;
  max-height: 320px; overflow-y: auto; padding: 2px;
}
.wo-fav-star {
  position: absolute; top: 2px; right: 2px; background: none; border: none; cursor: pointer;
  font-size: 13px; line-height: 1; padding: 3px; color: var(--muted);
}
.wo-fav-star.faved { color: #e8b923; }
.gen-day-block { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.gen-day-block:last-child { border-bottom: none; }
.gen-day-label { font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.wo-exercise-tile { padding: 10px 6px; font-size: 11.5px; }
.wo-exercise-tile .wo-tile-icon { font-size: 18px; }
.wo-muscle-tile .wo-thumb, .wo-exercise-tile .wo-thumb { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; }
#roPickerFilter { width: 100%; }

.workout-exercise-block { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 12px; }
.workout-exercise-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.workout-exercise-head strong { font-size: 14px; }

.workout-sets-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.workout-sets-table th { text-align: left; color: var(--muted); font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; padding: 4px 6px; }
.workout-sets-table td { padding: 4px 6px; }
.workout-set-done { background: var(--success-soft); }
.workout-sets-table .scroll-pick-display, .workout-sets-table .scroll-pick-disabled { width: 72px; }

.btn-set-done {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg);
  color: var(--muted); font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.btn-set-done.done { background: var(--success); border-color: var(--success); color: white; }

.workout-rest-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--emphasis); color: var(--emphasis-contrast); border-radius: var(--radius-sm);
  padding: 12px 16px; margin: 12px 0; font-weight: 700; font-size: 14px;
}
.workout-rest-banner .btn { background: rgba(0, 0, 0, 0.15); color: inherit; border: none; }

#woStartPicker, #woSessionNewExercise {
  font-weight: 400; padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  font-size: 13px; background: var(--panel); color: var(--text);
}

@media (max-width: 600px) {
  .wo-muscle-grid { grid-template-columns: repeat(2, 1fr); }
  .wo-exercise-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .wo-set-row { grid-template-columns: 24px 1fr 1fr 1fr 24px; gap: 5px; }
}

/* ================= responsive ================= */
@media (min-width: 601px) {
  .pb-row { grid-template-columns: 140px auto 1fr; grid-template-areas: "label value meta"; }
  .pb-meta { text-align: right; }
}

@media (max-width: 720px) {
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .challenge-stats { grid-template-columns: repeat(2, 1fr); }
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-toggle-grid { grid-template-columns: 1fr; }
  .donut-wrap { justify-content: center; }
}

@media (max-width: 600px) {
  .app { padding: 0 14px 96px; }
  .topbar { padding: 14px 0 10px; gap: 10px; }
  .brand-sub { display: none; }
  .conn-status { font-size: 12px; }

  .standing-row { grid-template-columns: 20px 1fr 44px auto; gap: 6px; }
  .donut-wrap { flex-direction: column; align-items: center; text-align: left; }
  .row.gap.end { flex-wrap: wrap; }
  .modal { padding: 18px; }
}

/* ---------- sign-in ---------- */
.signin-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.signin-card { max-width: 380px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.signin-card .brand-mark { border-radius: 18px; }
body.signed-out #appShell { display: none; }
body.signed-out #signInScreen { display: flex !important; }
body:not(.club-on) [data-club-only] { display: none !important; }

/* ================= Green kit look ================= */
/* Big, heavy display type for numbers; quiet grey labels; white cards with
   generous radius and soft shadows; a dark pill nav with a raised green +. */
h1, h2, h3, .brand-title, .stat-value, .dash-greeting-title { letter-spacing: -0.02em; }
.app { max-width: 1120px; }

.topbar { padding: 22px 0 18px; }
.brand-title { font-size: 17px; }
.brand-mark { border-radius: 14px; width: 40px; height: 40px; }

.tabs {
  background: var(--tile-dark); border: none; padding: 6px; gap: 2px;
  box-shadow: 0 10px 30px rgba(var(--n-ink-rgb), 0.18);
}
.tab { color: rgba(255, 255, 255, 0.55); padding: 9px 16px; border-radius: 999px; }
.tab:hover { color: #fff; }
.tab.active { background: var(--accent); color: #fff; box-shadow: 0 6px 18px var(--accent-glow); }
.tab-icon { display: inline-flex; }
.tab-icon svg, .ico { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.conn-status { background: var(--panel); padding: 7px 12px 7px 10px; border-radius: 999px; box-shadow: var(--shadow); color: var(--text); font-weight: 600; }

.btn { padding: 11px 20px; font-size: 13.5px; border-radius: 999px; font-weight: 700; }
.btn-primary, .btn-strava, .btn-accent { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 20px var(--accent-glow); }
.btn-primary:hover, .btn-strava:hover, .btn-accent:hover { background: var(--accent-dark); opacity: 1; }
.btn-ghost { border: 1.5px solid var(--text); color: var(--text); }
.btn-ghost:hover { background: var(--text); color: var(--panel); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
#themeToggleBtn { border-color: var(--border); background: var(--panel); box-shadow: var(--shadow); }
#themeToggleBtn:hover { background: var(--panel-2); color: var(--text); }

.panel { border: none; padding: 26px; margin-bottom: 18px; }
.panel h2 { font-size: 20px; margin-bottom: 8px; }
.stat-card { border: none; padding: 20px; position: relative; overflow: hidden; min-height: 128px; display: flex; flex-direction: column; justify-content: space-between; }
.stat-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.05; }
.stat-value-sm { font-size: 18px; }
.stat-card.tile { color: #fff; }
.stat-card.tile .stat-label { color: rgba(255, 255, 255, 0.82); }
.tile-green { background: var(--accent); box-shadow: 0 14px 30px var(--accent-glow); }
.tile-dark { background: var(--tile-dark); }
.tile-blue { background: var(--tile-blue); }
.tile-grey { background: var(--tile-grey); }
.tile-lime { background: var(--tile-lime); }
.stat-card.tile::after {
  content: ''; position: absolute; right: -30px; bottom: -40px; width: 120px; height: 120px;
  border-radius: 36px; background: rgba(255, 255, 255, 0.1); transform: rotate(20deg);
}

.dash-greeting { padding: 8px 2px 22px; }
.dash-greeting-title { font-size: 34px; font-weight: 700; line-height: 1.1; }
.dash-greeting-sub { font-size: 15px; margin-top: 6px; }

/* This-week hero: one huge number, then icon tiles with value + unit */
.week-hero { text-align: center; padding: 30px 26px 26px; }
.week-hero-value { font-size: 64px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.week-hero-unit { font-size: 26px; font-weight: 700; color: var(--muted); margin-left: 4px; letter-spacing: -0.01em; }
.week-hero-label { font-size: 15px; color: var(--muted); margin-top: 8px; font-weight: 500; }
.week-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 26px; }
.week-stat { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.icon-tile {
  width: 52px; height: 52px; border-radius: 18px; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; margin-bottom: 6px;
}
.icon-tile .ico { width: 22px; height: 22px; }
.icon-tile.green { background: var(--accent); box-shadow: 0 8px 18px var(--accent-glow); }
.icon-tile.grey { background: var(--tile-grey); }
.icon-tile.blue { background: var(--tile-blue); }
.icon-tile.dark { background: var(--tile-dark); }
.week-stat-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.week-stat-label { font-size: 13px; color: var(--muted); }

.subtabs { background: var(--panel-2); border: none; border-radius: 999px; padding: 4px; }
.subtab.active { background: var(--tile-dark); color: #fff; }
:root[data-theme="dark"] .subtab.active { background: var(--accent); }

.comp-card, .athlete-row { border: 1.5px solid var(--border); border-radius: 20px; }
.comp-card:hover { border-color: var(--accent); background: var(--panel); }
.badge { background: var(--badge-bg); border-radius: 999px; }
th { font-size: 11px; }
td { border-bottom-color: var(--border); }
input, select, textarea { font-family: var(--font); }
.activity-search-input, #activitySportFilter, #woStartPicker, #woSessionNewExercise { border-radius: 14px; background: var(--panel-2); border-color: transparent; padding: 11px 14px; }
.modal { border-radius: 28px; padding: 26px; }
.avatar-badge { color: #fff; }

/* Floating + : starts a workout. Desktop sits bottom-right. */
.fab {
  position: fixed; right: 28px; bottom: 28px; z-index: 950;
  width: 60px; height: 60px; border-radius: 22px; border: none; cursor: pointer;
  background: var(--accent); color: #fff; box-shadow: 0 14px 30px var(--accent-glow);
  display: inline-flex; align-items: center; justify-content: center; transition: transform 0.12s ease;
}
.fab:active { transform: scale(0.94); }
.fab .ico { width: 26px; height: 26px; stroke-width: 2.4; }
body.signed-out .fab { display: none; }

.signin-card h1 { font-size: 40px; font-weight: 700; margin: 6px 0 0; letter-spacing: -0.03em; }
.signin-card .brand-mark { width: 72px; height: 72px; border-radius: 24px; }

@media (max-width: 720px) {
  .week-hero-value { font-size: 52px; }
  .dash-greeting-title { font-size: 28px; }
}

@media (max-width: 600px) {
  .app { padding: 0 16px 120px; }
  .stat-value { font-size: 28px; }
  .stat-card { min-height: 110px; padding: 16px; }
  .panel { padding: 20px; border-radius: 24px; }

  /* Dark floating pill nav at the bottom, icon only, with the + raised in the middle */
  .tabs {
    position: fixed; left: 14px; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 900;
    border-radius: 28px; padding: 8px 10px; display: flex; justify-content: space-between; gap: 0;
    box-shadow: 0 16px 40px rgba(var(--n-ink-rgb), 0.35);
  }
  .tab { flex: 1; min-width: 0; justify-content: center; padding: 10px 0; border-radius: 18px; }
  .tab-label { display: none; }
  .tab.active { background: rgba(255, 255, 255, 0.12); color: #fff; box-shadow: none; position: relative; }
  .tab.active::after { content: ''; position: absolute; bottom: 4px; left: 50%; width: 14px; height: 3px; margin-left: -7px; border-radius: 3px; background: var(--accent); }
  .tab-icon svg { width: 22px; height: 22px; }
  .fab { left: 50%; right: auto; margin-left: -30px; bottom: calc(34px + env(safe-area-inset-bottom)); }
  /* leave a gap in the middle of the pill for the raised + */
  .tabs::before { content: ''; order: 3; flex: 1.1; }
  .tab[data-view="dashboard"] { order: 1; }
  .tab[data-view="hard75"] { order: 2; }
  .tab[data-view="workouts"] { order: 4; }
  .tab[data-view="health"] { order: 5; }
  .tab[data-view="members"] { order: 6; }
  .tab[data-club-only] { order: 7; }
}

.panel > .row.space-between { flex-wrap: wrap; gap: 10px; }

/* ================= Personal pages ================= */
.page-head { padding: 6px 2px 18px; }
.page-head h1 { font-size: 34px; font-weight: 700; margin: 0; letter-spacing: -0.03em; line-height: 1.1; }
.page-head p { margin: 6px 0 0; font-size: 15px; }
.dash-greeting-kicker { font-size: 13px; font-weight: 700; color: var(--accent-dark); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }

.home-grid { display: grid; grid-template-columns: 1fr; gap: 0 18px; align-items: start; }
@media (min-width: 900px) { .home-grid { grid-template-columns: 1.35fr 1fr; } }
.two-col { display: grid; grid-template-columns: 1fr; gap: 0 18px; align-items: stretch; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; } }
.two-col > * { margin-bottom: 18px; }
.grid-stats.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-stats.grid-3 { grid-template-columns: repeat(3, 1fr); }
.stat-label { display: flex; align-items: center; gap: 6px; }
.stat-label .ico { width: 15px; height: 15px; }
.stat-unit { font-size: 15px; font-weight: 700; opacity: 0.75; letter-spacing: 0; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: var(--panel-2); color: var(--text); }
.pill .ico { width: 14px; height: 14px; }
.pill-green { background: var(--accent-soft); color: var(--accent-dark); }
.delta { font-size: 12px; font-weight: 700; }
.delta.up { color: var(--accent-dark); }
.delta.down { color: var(--danger); }
.week-hero-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 8px; }
.link { color: var(--accent-dark); font-weight: 700; font-size: 13px; text-decoration: none; }

/* bar chart */
.chart-head { align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.chart-kicker { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.chart-kicker .ico { width: 15px; height: 15px; }
.chart-total { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; }
.chart-total .muted { font-size: 13px; font-weight: 500; letter-spacing: 0; }
.bchart { position: relative; height: calc(var(--h) + 26px); margin: 26px 0 8px; padding-left: 34px; }
.bchart-grid { position: absolute; left: 0; right: 0; top: 0; height: var(--h); display: flex; flex-direction: column; justify-content: space-between; }
.bchart-tick { border-top: 1px dashed var(--border); position: relative; height: 0; }
.bchart-tick span { position: absolute; left: 0; top: -8px; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bchart-bars { position: relative; height: var(--h); display: grid; align-items: end; gap: 6px; }
.bchart-col { height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bchart-bar { width: 100%; max-width: 30px; border-radius: 10px 10px 6px 6px; background: var(--accent-soft); position: relative; transition: height 0.35s ease; }
.bchart-col:hover .bchart-bar { background: var(--acc-200); }
.bchart-col.is-today .bchart-bar { background: var(--acc-300); }
.bchart-col.is-hi .bchart-bar { background: var(--tile-dark); }
:root[data-theme="dark"] .bchart-col.is-hi .bchart-bar { background: var(--accent); }
.bchart-bubble { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--tile-dark); color: #fff; font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 8px; white-space: nowrap; }
.bchart-bubble::after { content: ''; position: absolute; left: 50%; bottom: -4px; margin-left: -4px; border: 4px solid transparent; border-bottom: 0; border-top-color: var(--tile-dark); }
.bchart-labels { display: grid; gap: 6px; margin-top: 8px; }
.bchart-labels span { text-align: center; font-size: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: visible; }
.bchart-labels span.is-today { color: var(--text); font-weight: 700; }

.segmented { display: inline-flex; background: var(--panel-2); border-radius: 999px; padding: 4px; gap: 2px; }
.segmented button { border: none; background: transparent; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.segmented button.active { background: var(--tile-dark); color: #fff; }
:root[data-theme="dark"] .segmented button.active { background: var(--accent); }
#homeChart > .segmented { display: flex; width: 100%; margin-top: 10px; }
#homeChart > .segmented button { flex: 1; }

/* dark hero card */
.hero-dark { background: radial-gradient(circle 260px at 100% 0%, rgba(var(--acc-500-rgb), 0.35), transparent 70%), var(--tile-dark); color: #fff; border-radius: var(--radius); padding: 26px; margin-bottom: 18px; box-shadow: 0 18px 40px rgba(var(--n-ink-rgb), 0.22); position: relative; overflow: hidden; }
.hero-tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; border: 1.5px solid rgba(255, 255, 255, 0.35); border-radius: 8px; padding: 4px 9px; }
.hero-title { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin-top: 14px; line-height: 1.1; }
.hero-sub { color: rgba(255, 255, 255, 0.7); margin-top: 6px; font-size: 14px; }
.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 22px 0 4px; }
.hero-stats > div { display: flex; flex-direction: column; align-items: center; gap: 2px; border-left: 1px solid rgba(255, 255, 255, 0.14); }
.hero-stats > div:first-child { border-left: none; }
.hero-stats b { font-size: 18px; font-weight: 700; }
.hero-stats span { font-size: 12px; color: rgba(255, 255, 255, 0.6); }
.hero-actions { display: flex; gap: 10px; margin-top: 20px; }
.hero-actions .btn { flex: 1; justify-content: center; }
.btn .ico { width: 16px; height: 16px; }
.btn-outline-light { background: transparent; color: #fff; border: 1.5px solid rgba(255, 255, 255, 0.5); }
.btn-outline-light:hover { background: rgba(255, 255, 255, 0.1); }

/* link card */
.card-link { display: flex; align-items: center; gap: 16px; text-decoration: none; color: inherit; padding: 18px 22px; }
.card-link:hover { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.card-link-title { font-weight: 700; font-size: 16px; }
.card-link-arrow { margin-left: auto; color: var(--muted); width: 20px; height: 20px; flex-shrink: 0; }
.icon-tile.sm { width: 40px; height: 40px; border-radius: 14px; margin: 0; flex-shrink: 0; }
.icon-tile.sm .ico { width: 18px; height: 18px; }
.icon-tile { flex-shrink: 0; }

/* ring */
.ring { position: relative; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring-track { stroke: var(--panel-2); }
.ring-fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.ring-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-inner b { font-size: 26px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.ring-inner span { font-size: 11px; color: var(--muted); margin-top: 2px; }
.hard75-hero .ring-inner b { font-size: 46px; }

/* activity rows */
.act-list { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.act-row, .hist-row { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 20px; transition: background 0.15s; }
.act-row:hover, .hist-row:hover { background: var(--panel-2); }
.hist-row { cursor: pointer; }
.act-row .icon-tile { width: 46px; height: 46px; border-radius: 16px; margin: 0; }
.act-row .icon-tile .ico { width: 20px; height: 20px; }
.act-main { min-width: 0; flex: 1; }
.act-title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-stats { display: flex; gap: 18px; }
.act-stats > div { display: flex; flex-direction: column; align-items: flex-end; min-width: 44px; }
.act-stats b { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.act-stats span { font-size: 11px; color: var(--muted); }
.act-actions { display: flex; gap: 6px; align-items: center; }
.icon-round { width: 34px; height: 34px; border-radius: 12px; border: none; background: var(--panel-2); color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-round .ico { width: 16px; height: 16px; }
.month-head { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; font-size: 15px; padding: 18px 12px 6px; }
.show-more { width: 100%; justify-content: center; margin-top: 10px; }
.date-tile { width: 46px; height: 50px; border-radius: 16px; background: var(--panel-2); display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; }
.date-tile b { font-size: 18px; font-weight: 700; line-height: 1; }
.date-tile span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; font-weight: 700; }

/* overview + chips */
.chip-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chip-scroll::-webkit-scrollbar { display: none; }
.chip-scroll .chip { flex-shrink: 0; border: 1.5px solid var(--border); background: var(--panel); color: var(--text); font: inherit; font-size: 13px; font-weight: 700; padding: 8px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.chip-scroll .chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.ov-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.ov-stats > div { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.ov-stats b { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; }
.ov-stats span:last-child { font-size: 12px; color: var(--muted); }
#activitySportFilter { display: none; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid var(--border); padding-top: 14px; margin-top: 6px; }
.mini-stats > div { display: flex; flex-direction: column; }
.mini-stats b { font-size: 18px; font-weight: 700; }
.mini-stats span { font-size: 12px; color: var(--muted); }

/* personal bests */
.pb-list { display: grid; gap: 10px; margin-top: 12px; }
.pb-item { display: flex; gap: 14px; align-items: center; background: var(--panel-2); border-radius: 20px; padding: 12px 14px; }
.pb-text { min-width: 0; }
.pb-value { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 900px) { #view-members .pb-list { grid-template-columns: 1fr 1fr; } }

/* 75 hard */
.hard75-hero { display: flex; align-items: center; gap: 26px; }
.hard75-hero-text { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.hero-big { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.task-list { display: grid; gap: 8px; margin-top: 12px; }
.task { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 14px; padding: 10px 12px; border-radius: 16px; background: var(--panel-2); color: var(--muted); }
.task.ok { color: var(--text); }
.task-check { width: 26px; height: 26px; border-radius: 9px; border: 2px solid var(--border); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--panel); }
.task.ok .task-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.task-check .ico { width: 15px; height: 15px; stroke-width: 3; }
.grid75 { display: grid; grid-template-columns: repeat(15, 1fr); gap: 7px; margin-top: 14px; }
.dot75 { aspect-ratio: 1; border-radius: 30%; background: var(--panel-2); }
.dot75.done { background: var(--accent); }
.dot75.miss { background: var(--danger); }
.dot75.today { box-shadow: 0 0 0 2px var(--tile-dark); background: var(--panel); }
.dot75.done.today { background: var(--accent); }

/* account */
.profile-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 32px; }
.avatar-badge.xl { width: 96px; height: 96px; font-size: 32px; box-shadow: 0 0 0 5px var(--panel), 0 0 0 7px var(--accent); margin-bottom: 8px; }
.profile-name { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.profile-stats { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; max-width: 560px; margin-top: 18px; background: var(--panel-2); border-radius: 22px; padding: 16px 6px; }
.profile-stats > div { display: flex; flex-direction: column; border-left: 1px solid var(--border); }
.profile-stats > div:first-child { border-left: none; }
.profile-stats b { font-size: 20px; font-weight: 700; }
.profile-stats span { font-size: 12px; color: var(--muted); }
.conn-status { cursor: pointer; }

@media (max-width: 600px) {
  .page-head h1 { font-size: 30px; }
  .hero-title { font-size: 26px; }
  .hero-stats b { font-size: 16px; }
  .ov-stats { grid-template-columns: repeat(2, 1fr); row-gap: 16px; }
  .hide-sm { display: none !important; }
  .act-row, .hist-row { padding: 10px 6px; gap: 12px; }
  .act-stats { gap: 12px; }
  .act-actions .btn { display: none; }
  .hard75-hero { flex-direction: column; text-align: center; }
  .hard75-hero-text { align-items: center; }
  .grid75 { grid-template-columns: repeat(10, 1fr); }
  .profile-stats b { font-size: 17px; }
  .bchart { padding-left: 28px; }
  .bchart-bars, .bchart-labels { gap: 4px; }

  /* nav: 4 tabs (Home, 75 Hard | + | Workouts, Health), Account lives on the name chip */
  .tab[data-view="members"] { display: none; }
  .tab[data-view="health"] { order: 5; }
  .tabs::before { flex: 1; }
  .conn-status #connLabel { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* refinements */
.bchart-bar { background: var(--acc-200); }
.bchart-col:hover .bchart-bar { background: var(--acc-300); }
.bchart-col.is-today .bchart-bar { background: var(--acc-300); }
:root[data-theme="dark"] .bchart-bar { background: rgba(var(--acc-500-rgb), 0.28); }
.bchart-labels span { overflow: hidden; text-overflow: clip; font-size: 10.5px; }
#workoutStartArea .hard75-start-card { display: none; }
#hard75ClubList .athlete-link, #hard75ClubList .badge-you { display: none; }
@media (max-width: 600px) {
  .grid-stats.grid-3 .stat-card { padding: 14px; min-height: 96px; }
  .grid-stats.grid-3 .stat-value { font-size: 24px; }
  .grid-stats.grid-3 .stat-label { font-size: 12px; }
  .grid-stats.grid-3 .stat-unit { font-size: 12px; }
  .hard75-stats .stat-unit { display: none; }
  .bchart-bubble { font-size: 10px; padding: 3px 6px; }
}
#connectPanel .row.gap { flex-wrap: wrap; }
#connectPanel .btn { white-space: nowrap; }
@media (max-width: 600px) {
  .act-actions { display: none; }
  #connectPanel .btn { padding: 9px 14px; font-size: 12.5px; }
}

/* ---------- Set types: warm-up / working / failure / drop ---------- */
.set-type {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 9px; font-size: 12px; font-weight: 700; flex: none;
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
}
.set-type b { font-weight: 700; }
.set-type.editable { cursor: pointer; }
.set-type.editable:hover { box-shadow: 0 0 0 3px var(--focus-ring); }
.set-type-warmup { background: #fef3c7; color: #b45309; border-color: #fcd34d; }
.set-type-failure { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
.set-type-drop { background: #dbeafe; color: #2563eb; border-color: #93c5fd; }
.set-type-select {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
  appearance: none; -webkit-appearance: none; border: 0; padding: 0; font-size: 16px;
}
.wo-set-row .set-type.wo-set-num { width: 26px; height: 26px; border-radius: 9px; }
.set-type-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 10px 0 14px; }
.set-type-legend:empty { display: none; }
.set-type-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.set-type-legend .set-type { width: 20px; height: 20px; font-size: 10.5px; border-radius: 7px; }
[data-theme="dark"] .set-type-warmup { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border-color: rgba(245, 158, 11, 0.4); }
[data-theme="dark"] .set-type-failure { background: rgba(239, 68, 68, 0.18); color: #f87171; border-color: rgba(239, 68, 68, 0.4); }
[data-theme="dark"] .set-type-drop { background: rgba(59, 130, 246, 0.18); color: #60a5fa; border-color: rgba(59, 130, 246, 0.4); }

/* ---------- Live workout sheet + minimised pill (workout-sheet.js) ---------- */
.wo-sheet { position: fixed; inset: 0; z-index: 1500; pointer-events: none; }
.wo-sheet-backdrop {
  position: absolute; inset: 0; background: rgba(10, 12, 14, 0.45); opacity: 0;
  transition: opacity 0.28s ease; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.wo-sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(100% - 28px - env(safe-area-inset-top));
  margin: 0 auto; max-width: 780px; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 28px 28px 0 0; box-shadow: 0 -18px 50px rgba(10, 12, 14, 0.28);
  transform: translateY(105%); transition: transform 0.34s cubic-bezier(0.32, 0.72, 0, 1);
}
.wo-sheet-panel.dragging { transition: none; }
.wo-sheet.open { pointer-events: auto; }
.wo-sheet.open .wo-sheet-backdrop { opacity: 1; }
.wo-sheet.open .wo-sheet-panel { transform: translateY(0); }
.wo-sheet-head {
  position: relative; flex: none; height: 34px; display: flex; align-items: center; justify-content: center;
  cursor: grab; touch-action: none;
}
.wo-sheet-grabber { width: 44px; height: 5px; border-radius: 5px; background: var(--border); }
.wo-sheet-min {
  position: absolute; right: 14px; top: 8px; width: 38px; height: 38px; border-radius: 14px; border: none;
  background: var(--panel); color: var(--text); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--shadow, 0 2px 8px rgba(0,0,0,0.06));
}
.wo-sheet-min svg { width: 22px; height: 22px; }
.wo-sheet-body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 6px 16px calc(28px + env(safe-area-inset-bottom));
}
.wo-sheet-body > #workoutSessionDetail { background: transparent; box-shadow: none; border: none; padding: 4px 4px 0; margin: 0; }
body.wo-sheet-open { overflow: hidden; }
body.wo-sheet-open .fab { opacity: 0; pointer-events: none; }

.wo-pill {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 1400;
  display: inline-flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px);
  padding: 10px 14px 10px 14px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--tile-dark, var(--n-hero)); color: #fff; font: inherit; font-size: 14px; font-weight: 700;
  box-shadow: 0 14px 34px rgba(10, 12, 14, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  animation: wo-pill-in 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.wo-pill[hidden] { display: none; }
.wo-pill-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; box-shadow: 0 0 0 0 var(--accent); animation: wo-pulse 1.8s infinite; }
.wo-pill-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 42vw; }
.wo-pill-sep { width: 1px; height: 16px; background: rgba(255, 255, 255, 0.2); flex: none; }
.wo-pill-time { font-variant-numeric: tabular-nums; color: var(--accent); white-space: nowrap; }
.wo-pill.resting .wo-pill-time { color: #fbbf24; }
.wo-pill-sets { color: rgba(255, 255, 255, 0.6); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.wo-pill-chev { width: 18px; height: 18px; flex: none; opacity: 0.7; }
.wo-pill:active { transform: translateX(-50%) scale(0.97); }
/* Desktop: keep the + button clear of the pill */
body.wo-pill-on .fab { bottom: 92px; }
@keyframes wo-pulse { 0% { box-shadow: 0 0 0 0 rgba(var(--acc-500-rgb), 0.6); } 70% { box-shadow: 0 0 0 9px rgba(var(--acc-500-rgb), 0); } 100% { box-shadow: 0 0 0 0 rgba(var(--acc-500-rgb), 0); } }
@keyframes wo-pill-in { from { opacity: 0; transform: translateX(-50%) translateY(14px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

@media (max-width: 600px) {
  /* Phones: pill floats top centre, clear of the bottom nav */
  .wo-pill { top: calc(10px + env(safe-area-inset-top)); bottom: auto; padding: 9px 13px; font-size: 13.5px; }
  @keyframes wo-pill-in { from { opacity: 0; transform: translateX(-50%) translateY(-14px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
  body.wo-pill-on .app { padding-top: 54px; }
  body.wo-pill-on .fab { bottom: calc(34px + env(safe-area-inset-bottom)); }
  .wo-sheet-panel { height: calc(100% - 12px - env(safe-area-inset-top)); border-radius: 24px 24px 0 0; }
  .wo-sheet-body { padding-left: 12px; padding-right: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .wo-sheet-panel, .wo-sheet-backdrop { transition: none; }
  .wo-pill, .wo-pill-dot { animation: none; }
}
.wo-sheet-body #workoutSessionDetail > .row:first-child { padding-right: 50px; }
.wo-sheet-body .wo-live-title { font-size: 26px; letter-spacing: -0.02em; }

/* ---------- History / activity rows: never wider than their card ---------- */
.comp-list { grid-template-columns: minmax(0, 1fr); }
.act-row, .hist-row { min-width: 0; max-width: 100%; }
.act-title, .act-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.act-title .badge { vertical-align: middle; }
@media (max-width: 600px) {
  .act-row, .hist-row { gap: 10px; padding: 9px 4px; }
  .date-tile { width: 40px; height: 44px; border-radius: 14px; }
  .date-tile b { font-size: 16px; }
  .date-tile span { font-size: 9.5px; }
  .act-title { font-size: 14px; }
  .act-meta { font-size: 11.5px; }
  .act-stats { gap: 10px; flex-shrink: 0; }
  .act-stats > div { min-width: 0; }
  .act-stats b { font-size: 14px; }
  .act-stats span { font-size: 10px; }
  .act-title .badge { font-size: 10px; padding: 2px 6px; }
  .card-link-arrow { width: 16px; height: 16px; }
}
.act-abandoned { color: #dc2626; font-weight: 700; }
.wo-sheet-min .ico-close { display: none; }
.wo-sheet.viewing .wo-sheet-min .ico-close { display: block; width: 20px; height: 20px; }
.wo-sheet.viewing .wo-sheet-min .ico-min { display: none; }

/* ---------- Shared slide-up view sheet (sheet.js) ----------
   Same look as the live workout sheet; sits just above it (and its pill),
   below modals so editors opened from a sheet land on top. */
.view-sheet { z-index: 1550; }
.view-sheet.wide .wo-sheet-panel { max-width: 1120px; }
body.vs-open { overflow: hidden; }
body.vs-open .fab, body.vs-open .wo-pill { opacity: 0; pointer-events: none; }
.view-sheet-body > .vs-content.panel { background: transparent; box-shadow: none; border: none; padding: 4px 4px 0; margin: 0; }
/* Keep each view's title row clear of the ✕ button */
.view-sheet-body > .vs-content > :first-child { padding-right: 50px; }
.view-sheet-body > .vs-content > .vs-flush:first-child { padding-right: 0; }
/* Full detail sheets keep their content full width; only the centred title
   row is inset (both sides, so it stays centred) to clear the ✕. */
.view-sheet-body > .vs-content > :is(.st-sheet, .en-sheet, .tl-sheet, .mo-sheet):first-child { padding-right: 0; }
:is(.st-sheet, .en-sheet, .mo-sheet) > .st-head:first-child { padding: 0 46px; }
.tl-sheet > .tl-head:first-child { padding-right: 50px; }
/* Info buttons stay just left of the ✕, where they were. */
:is(.st-sheet, .en-sheet) > .st-head:first-child .st-info-btn, .tl-sheet > .tl-head:first-child .tl-info-btn { right: 50px; }
.vs-title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 2px 0 4px; line-height: 1.15; }
.vs-sub { margin: 0 0 14px; }
.vs-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 6px; }
.vs-actions .btn { flex: 1 1 140px; justify-content: center; }
.vs-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; margin: 14px 0; }
.vs-stat { background: var(--panel); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow, 0 2px 8px rgba(0,0,0,0.05)); }
.vs-stat b { display: block; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.vs-stat span { font-size: 12px; color: var(--muted); }
.vs-list { display: grid; gap: 8px; margin: 8px 0 14px; }
.vs-item { display: flex; align-items: center; gap: 12px; background: var(--panel); border-radius: 18px; padding: 12px 14px; box-shadow: var(--shadow, 0 2px 8px rgba(0,0,0,0.05)); }
.vs-item-main { flex: 1; min-width: 0; }
.vs-item-title { font-weight: 700; }
.vs-item-side { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vs-section { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 18px 2px 6px; }
.act-row[data-act], .wo-recent-activity { cursor: pointer; }
.vs-head { display: flex; align-items: center; gap: 14px; margin: 2px 0 10px; }
.vs-head-text { min-width: 0; }
.vs-head .vs-title { margin: 0 0 2px; }
.vs-head .wo-tile-icon { flex: none; }
.vs-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.vs-num { flex: none; width: 28px; height: 28px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-dark); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.vs-linked { box-shadow: inset 3px 0 0 var(--accent), var(--shadow, 0 2px 8px rgba(0,0,0,0.05)); }

/* ---------- detailed ring (personal.js detailRing) ---------- */
.dr { position: relative; flex-shrink: 0; aspect-ratio: 1; }
.dr svg { width: 100%; height: 100%; display: block; overflow: visible; }
.dr circle { fill: none; }
.dr .dr-halo { stroke: var(--n-badge); stroke-width: 4; }
.dr .dr-target { stroke: #86d9a8; stroke-width: 4; stroke-linecap: round; }
.dr .dr-track { stroke: var(--n-hair); }
.dr .dr-ghost { opacity: 0.35; stroke-linecap: round; }
.dr .dr-fill { stroke-linecap: round; }
.dr .dr-face { fill: var(--panel); filter: drop-shadow(0 3px 7px rgba(var(--n-ink-rgb), 0.08)); }
.dr .dr-knob { fill: var(--panel); filter: drop-shadow(0 1px 3px rgba(var(--n-ink-rgb), 0.28)); }
.dr .dr-goal { fill: var(--text); opacity: 0.75; }
.dr .dr-avg { fill: var(--panel); stroke: #9ca3af; stroke-width: 1.6; }
.dr-in { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1; }
:root[data-theme="dark"] .dr .dr-halo { stroke: var(--d-tile); }
:root[data-theme="dark"] .dr .dr-track { stroke: var(--d-line); }
:root[data-theme="dark"] .dr .dr-target { stroke: var(--acc-dim); }

/* bar chart details: dotted grid, solid baseline, dashed average */
.bchart-tick { border-top-style: dotted; }
.bchart-tick:last-child { border-top-style: solid; }
.bchart-avg { position: absolute; left: 34px; right: 0; height: 0; border-top: 1.5px dashed var(--muted); opacity: 0.55; z-index: 1; pointer-events: none; }
.bchart-avg span { position: absolute; right: 0; top: -17px; font-size: 10.5px; font-weight: 700; color: var(--muted); background: var(--panel); padding: 0 4px; border-radius: 4px; }
.bchart-col.is-today .bchart-bar { box-shadow: 0 4px 10px rgba(var(--acc-500-rgb), 0.25); }
@media (max-width: 600px) { .bchart-avg { left: 28px; } }
