/* ════════════════════════════════════════════════════════════════════════════
   GYM TRACKER — cmrabdu // design system v5
   Structuré. Vivant. Signé.
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* ── Tokens ───────────────────────────────────────────────────────────────── */
:root {
  /* Typography */
  --font:      'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono: 'Space Mono', 'SF Mono', 'Consolas', monospace;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-md:   1.25rem;
  --text-lg:   1.5rem;
  --text-xl:   2rem;
  --text-2xl:  2.5rem;

  --weight-normal: 400;
  --weight-medium: 500;
  --weight-bold:   700;

  --leading-tight:  1.15;
  --leading-snug:   1.3;
  --leading-normal: 1.55;

  --tracking-tight: -0.02em;
  --tracking-wide:  0.06em;

  /* Fibonacci spacing */
  --sp-1: 0.3125rem;
  --sp-2: 0.5rem;
  --sp-3: 0.8125rem;
  --sp-4: 1.3125rem;
  --sp-5: 2.125rem;
  --sp-6: 3.4375rem;
  --sp-7: 5.5625rem;

  /* Shape */
  --radius:      8px;
  --radius-full: 9999px;

  /* Motion */
  --duration: 200ms;
  --ease:     cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition: var(--duration) var(--ease);

  /* Density */
  --density: 1;

  /* Measure */
  --measure-narrow: 45ch;
  --measure:        60ch;
  --measure-wide:   75ch;

  /* Light palette */
  --ink:       #0a0a0b;
  --ink-2:     #605f56;
  --ink-3:     #84847a;
  --paper:     #f9f8f4;
  --paper-2:   #f0efea;
  --line:      #dfddd6;

  --accent:       #2535f5;
  --accent-hover: #1020cc;
  --accent-soft:  rgba(37, 53, 245, 0.06);
  --on-accent:    #ffffff;

  --negative:      #b8191b;
  --negative-soft: rgba(184, 25, 27, 0.06);
  --warning:       #b45309;
  --warning-soft:  rgba(180, 83, 9, 0.06);

  --green:   #16a34a;
  --green-s: rgba(22, 163, 74, 0.08);
  --positive:     #16a34a;
  --positive-soft: rgba(22, 163, 74, 0.06);
  --violet:       #7c3aed;
  --violet-soft:  rgba(124, 58, 237, 0.06);

  --shadow:         0 1px 3px rgba(0,0,0,0.04), 0 6px 16px rgba(0,0,0,0.04);
  --shadow-overlay: 0 20px 60px rgba(0,0,0,0.14);

  /* Session type colors */
  --c-push:    #2563eb;
  --c-pull:    #7c3aed;
  --c-legs:    #dc2626;
  --c-epaules: #059669;
  --c-bras:    #ea580c;

  /* Layout */
  --sidebar-w: 240px;
  --nav-h: 56px;
  --safe-bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
}

/* ── Base ─────────────────────────────────────────────────────────────────── */
body {
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--ink);
  background: var(--paper);
  min-height: 100dvh;
  overflow-x: hidden;
}
button { cursor: pointer; font: inherit; }
input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100dvh; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--paper);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: var(--sp-4) var(--sp-3) var(--sp-3);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: var(--sp-2);
}

.sidebar-logo-dot {
  width: 28px; height: 28px;
  border-radius: var(--radius);
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo-dot::after {
  content: '//';
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 700;
  color: var(--on-accent);
  letter-spacing: -0.05em;
}

.sidebar-logo-text {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--ink);
}

.sidebar-nav {
  flex: 1;
  padding: var(--sp-3) var(--sp-2);
  display: flex; flex-direction: column; gap: 2px;
  list-style: none;
}

.sidebar-nav a {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  color: var(--ink-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  transition: background var(--transition), color var(--transition);
}
.sidebar-nav a svg { opacity: .55; flex-shrink: 0; }
.sidebar-nav a:hover { background: var(--paper-2); color: var(--ink-2); }
.sidebar-nav a.active {
  background: var(--accent-soft); color: var(--accent);
  font-weight: var(--weight-medium);
}
.sidebar-nav a.active svg { opacity: 1; }

.sidebar-footer {
  padding: var(--sp-3);
  border-top: 1px solid var(--line);
  font-size: var(--text-xs);
  color: var(--ink-3);
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.sidebar-footer-row {
  display: flex; align-items: center; gap: var(--sp-2);
}
.sidebar-footer-row::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 2px var(--green-s);
  flex-shrink: 0;
}
.sidebar-footer-main {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.sidebar-footer-status,
.sidebar-footer-user {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-footer-user { font-size: 10px; color: var(--ink-2); }
.sidebar-logout-btn {
  border: 1px solid var(--line);
  background: transparent; color: var(--ink-2);
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  transition: all var(--transition);
}
.sidebar-logout-btn:hover { background: var(--paper-2); color: var(--ink); }

/* ── Main ─────────────────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1; min-width: 0;
  padding-bottom: var(--sp-6);
}
.main > .view > .page-content,
.main > .view > .view-settings {
  max-width: 640px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.view { animation: fadeIn var(--duration) var(--ease) both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Page Structure ───────────────────────────────────────────────────────── */
.page-header {
  padding: var(--sp-5) var(--sp-5) 0;
  margin-bottom: var(--sp-4);
}
.page-header h1 {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--ink);
  line-height: var(--leading-tight);
}
.page-header p {
  color: var(--ink-3);
  margin-top: var(--sp-1);
  font-size: var(--text-sm);
}
.page-content { padding: 0 var(--sp-5); }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow); }

.card-header {
  padding: var(--sp-3) var(--sp-4) 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-2);
}
.card-header > * { min-width: 0; }
.card-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-normal);
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}
.card-title::before {
  content: '// ';
  color: var(--accent);
}
.card-body { padding: var(--sp-3) var(--sp-4); }

/* ── Stat Cards ───────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.stat-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); }

.stat-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--sp-2);
}
.stat-value {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.stat-unit {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--ink-3);
  margin-left: 2px;
  letter-spacing: 0;
}
.stat-goal {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--ink-3);
  margin-left: 1px;
}
.stat-goal.goal-ok { color: var(--green); }

/* ── Dashboard Hero ───────────────────────────────────────────────────────── */
.dashboard-hero {
  background: var(--accent);
  border-radius: var(--radius);
  padding: var(--sp-5) var(--sp-4);
  color: var(--on-accent);
  margin-bottom: var(--sp-4);
}
.dashboard-hero-content { margin-bottom: var(--sp-4); }
.dashboard-hero-date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  opacity: .7;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}
.dashboard-hero h1 {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  margin: var(--sp-2) 0 var(--sp-1);
  line-height: var(--leading-snug);
}
.dashboard-hero-sub {
  font-size: var(--text-sm);
  opacity: .8;
  line-height: var(--leading-normal);
}
.dashboard-hero-cta {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  background: var(--on-accent);
  color: var(--accent);
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  padding: 0 var(--sp-4);
  height: calc(44px * var(--density));
  border-radius: var(--radius-full);
  transition: transform .15s var(--ease-spring), box-shadow .15s;
}
.dashboard-hero-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
}

/* ── Session Items ────────────────────────────────────────────────────────── */
.session-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  transition: background var(--transition);
}
.session-item > div { min-width: 0; }
.session-item:not(:last-child) { border-bottom: 1px solid var(--line); }
.session-item:hover { background: var(--paper-2); }
.session-item-date {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--ink);
}
.session-item-meta {
  font-size: var(--text-xs);
  color: var(--ink-3);
  margin-top: 2px;
}
.session-row svg { color: var(--ink-3); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: calc(44px * var(--density));
  padding: 0 var(--sp-4);
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { color: var(--ink); border-color: var(--ink-3); background: var(--paper-2); }

.btn-negative { background: var(--negative); color: #fff; border-color: transparent; }
.btn-negative:hover:not(:disabled) { background: var(--negative); opacity: .85; }

.btn-secondary { background: transparent; border: 1px solid var(--ink-3); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { background: var(--paper-2); border-color: var(--ink-2); }

.btn-lg { height: calc(48px * var(--density)); padding: 0 var(--sp-5); font-size: var(--text-base); }
.btn-sm { height: calc(34px * var(--density)); padding: 0 var(--sp-3); font-size: var(--text-xs); }
.btn-full { width: 100%; }

/* ── Type Pills ───────────────────────────────────────────────────────────── */
.type-pill {
  display: inline-flex; align-items: center;
  padding: 3px var(--sp-3);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 11px; font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wide);
}
.type-push    { background: color-mix(in srgb, var(--c-push)    12%, transparent); color: var(--c-push); }
.type-pull    { background: color-mix(in srgb, var(--c-pull)    12%, transparent); color: var(--c-pull); }
.type-legs    { background: color-mix(in srgb, var(--c-legs)    12%, transparent); color: var(--c-legs); }
.type-epaules { background: color-mix(in srgb, var(--c-epaules) 12%, transparent); color: var(--c-epaules); }
.type-bras    { background: color-mix(in srgb, var(--c-bras)    12%, transparent); color: var(--c-bras); }

/* ── Filter Chips ─────────────────────────────────────────────────────────── */
.filter-chips {
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.filter-chip {
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  background: var(--paper-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all .15s;
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* ── Heatmap — Monthly Calendar Slider ────────────────────────────────────── */
.hm-slider {
  display: flex; gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: var(--sp-3);
  scrollbar-width: none;
}
.hm-slider::-webkit-scrollbar { display: none; }
.hm-card {
  min-width: calc(100% - 8px); scroll-snap-align: center;
  background: var(--paper-2); border-radius: 10px;
  padding: 14px; flex-shrink: 0;
}
.hm-card-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 10px;
}
.hm-card-title {
  font-size: 15px; font-weight: var(--weight-bold);
  text-transform: capitalize;
}
.hm-card-stats { font-size: 11px; color: var(--ink-3); }
.hm-card-stats strong { color: var(--accent); font-size: 14px; }
.hm-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 6px; margin-bottom: 4px;
}
.hm-weekdays span {
  font-size: 9px; color: var(--ink-3);
  text-align: center; font-family: var(--font-mono);
}
.hm-days {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
}
.hm-day {
  aspect-ratio: 1; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-family: var(--font-mono);
  color: var(--ink-3); background: var(--paper);
}
.hm-day.empty { background: transparent; }
.hm-day.today { box-shadow: 0 0 0 2px var(--ink-2); }
.hm-n0 { background: var(--paper); }
.hm-n1 { background: color-mix(in srgb, var(--accent) 30%, var(--paper-2)); color: var(--ink); }
.hm-n2 { background: color-mix(in srgb, var(--accent) 60%, var(--paper-2)); color: #fff; }
.hm-n3 { background: var(--accent); color: #fff; }
.hm-nav {
  font-size: 10px; color: var(--ink-3);
  text-align: center; padding: var(--sp-2) 0 var(--sp-1);
  opacity: .6;
}

/* ── Tables ───────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: var(--weight-normal);
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
}
td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink);
}
tr:last-child td { border-bottom: none; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-4);
  animation: fadeIn 150ms var(--ease);
}
.modal-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-overlay);
  max-width: 400px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  animation: scaleIn 200ms var(--ease);
}
@keyframes scaleIn { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4); border-bottom: 1px solid var(--line);
}
.modal-header h3 {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
}
.modal-body { padding: var(--sp-4); }

/* Session Detail */
.detail-exercise { margin-bottom: var(--sp-4); }
.detail-exercise:last-child { margin-bottom: 0; }
.detail-exercise-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--ink);
  margin-bottom: var(--sp-2);
  padding-bottom: var(--sp-1);
  border-bottom: 1px solid var(--line);
}
.detail-sets { display: flex; flex-direction: column; gap: var(--sp-1); }
.detail-set-row {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.detail-set-num {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-3);
  min-width: 24px;
}
.detail-set-weight { font-weight: var(--weight-bold); color: var(--ink); }
.detail-set-sep { color: var(--ink-3); font-size: var(--text-xs); }
.detail-set-reps { color: var(--ink-2); }
.detail-set-note {
  font-size: var(--text-xs);
  color: var(--ink-3);
  font-style: italic;
  margin-left: var(--sp-2);
}
.session-detail-delete-row {
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line);
}
.btn-delete-session {
  display: flex; align-items: center; justify-content: center;
  width: 100%;
  height: calc(44px * var(--density));
  background: var(--negative-soft);
  color: var(--negative);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-delete-session:hover { background: rgba(184, 25, 27, 0.12); }

/* ── Empty / Loading ──────────────────────────────────────────────────────── */
.empty-state {
  padding: var(--sp-6) var(--sp-4);
  text-align: center;
  color: var(--ink-3);
  font-size: var(--text-sm);
}
.loading-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-3);
  min-height: 200px;
  color: var(--ink-3);
  font-size: var(--text-sm);
}
.slash-pulse {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--accent);
  letter-spacing: -0.05em;
  animation: slashPulse 1.2s ease-in-out infinite;
}
@keyframes slashPulse {
  0%, 100% { opacity: 0.3; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.05); }
}

.error-banner {
  padding: var(--sp-3) var(--sp-4);
  background: var(--negative-soft);
  color: var(--negative);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  border: 1px solid rgba(184, 25, 27, 0.12);
}

/* ── Separator (// signature) ─────────────────────────────────────────────── */
.separator {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  color: var(--ink-3); font-size: var(--text-sm);
}
.separator::before {
  content: '//';
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: var(--weight-normal);
  letter-spacing: -0.05em;
}

/* ── Bottom Nav ───────────────────────────────────────────────────────────── */
.navbar-bottom {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: none;
  align-items: center; justify-content: space-around;
  min-height: var(--nav-h);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: color-mix(in srgb, var(--paper) 85%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  z-index: 50;
}
.navbar-item {
  display: flex; flex: 1; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
  padding: var(--sp-3) 0;
  min-height: 48px;
  font-size: 10px;
  color: var(--ink-3);
  font-weight: var(--weight-medium);
  text-decoration: none;
  position: relative;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.navbar-item svg { width: 20px; height: 20px; }
.navbar-item.active { color: var(--accent); }

/* ── Utilities ────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.mb-4   { margin-bottom: var(--sp-3); }
.mt-4   { margin-top: var(--sp-3); }
.text-muted { color: var(--ink-3); }
.text-mono { font-family: var(--font-mono); }
.text-accent { color: var(--accent); }

::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: var(--radius); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* ═══════════════════════════════════════════════════════════════════════════
   WORKOUT (wo-*) — Mobile-first session UI
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Type Picker ──────────────────────────────────────────────────────────── */
.wo-picker { display: flex; flex-direction: column; gap: var(--sp-2); }

.wo-picker-btn {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; padding: var(--sp-3);
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); cursor: pointer;
  transition: all .15s var(--ease);
  text-align: left; font: inherit; color: inherit;
}
.wo-picker-btn:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.wo-picker-btn.is-suggested { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.wo-picker-initial {
  width: 42px; height: 42px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-md); font-weight: var(--weight-bold); flex-shrink: 0;
}
.type-push    .wo-picker-initial, .wo-picker-initial.type-push    { background: color-mix(in srgb, var(--c-push)    12%, transparent); color: var(--c-push); }
.type-pull    .wo-picker-initial, .wo-picker-initial.type-pull    { background: color-mix(in srgb, var(--c-pull)    12%, transparent); color: var(--c-pull); }
.type-legs    .wo-picker-initial, .wo-picker-initial.type-legs    { background: color-mix(in srgb, var(--c-legs)    12%, transparent); color: var(--c-legs); }
.type-epaules .wo-picker-initial, .wo-picker-initial.type-epaules { background: color-mix(in srgb, var(--c-epaules) 12%, transparent); color: var(--c-epaules); }
.type-bras    .wo-picker-initial, .wo-picker-initial.type-bras    { background: color-mix(in srgb, var(--c-bras)    12%, transparent); color: var(--c-bras); }

.wo-picker-label { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.wo-picker-label strong { font-size: var(--text-sm); font-weight: var(--weight-bold); }
.wo-picker-label small { font-size: var(--text-xs); color: var(--ink-3); font-weight: var(--weight-medium); }

.wo-picker-badge {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: var(--weight-bold);
  text-transform: uppercase; letter-spacing: var(--tracking-wide);
  background: var(--accent-soft); color: var(--accent);
  padding: 3px var(--sp-2); border-radius: var(--radius-full);
}

.wo-picker-btn svg { color: var(--ink-3); flex-shrink: 0; transition: transform .15s; }
.wo-picker-btn:hover svg { transform: translateX(2px); color: var(--accent); }

/* ── Workout Shell ────────────────────────────────────────────────────────── */
.wo {
  display: flex; flex-direction: column;
  min-height: 100dvh;
}

/* Immersive mode */
body.wo-active .navbar-bottom { display: none !important; }
body.wo-active .sidebar { display: none; }
body.wo-active .main { margin-left: 0; padding: 0; padding-bottom: 0; }

/* ── Sticky Header ────────────────────────────────────────────────────────── */
.wo-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: var(--sp-2) var(--sp-3) 0;
}

.wo-header-row {
  display: flex; align-items: center; gap: var(--sp-2);
  padding-bottom: var(--sp-2);
}

.wo-back {
  width: 36px; height: 36px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--ink-2);
  border-radius: var(--radius); cursor: pointer;
  transition: background .1s;
}
.wo-back:hover { background: var(--paper-2); }

.wo-header-type {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.wo-header-progress {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.wo-header-bar {
  height: 3px; background: var(--line); border-radius: 2px;
  overflow: hidden; margin: 0 calc(var(--sp-3) * -1);
}
.wo-header-bar-fill {
  height: 100%; background: var(--accent);
  border-radius: 2px; transition: width .35s var(--ease);
  width: 0;
}

/* ── Session Briefing ─────────────────────────────────────────────────────── */
.wo-briefing {
  padding: var(--sp-3) var(--sp-3) var(--sp-3);
  border-bottom: 1px solid var(--line);
}
.wo-briefing-top {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: var(--sp-2);
}
.wo-briefing-title {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
}
.wo-briefing-date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-3);
  text-transform: capitalize;
}
.wo-briefing-tags {
  display: flex; flex-wrap: wrap; gap: var(--sp-1);
  margin-bottom: var(--sp-3);
}
.wo-briefing-tag {
  font-family: var(--font-mono);
  padding: 2px var(--sp-2);
  border-radius: var(--radius-full);
  font-size: 11px;
  background: var(--paper-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.wo-briefing-note {
  padding: var(--sp-3);
  background: var(--accent-soft);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}
.wo-briefing-note-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: var(--weight-bold);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--sp-1);
}
.wo-briefing-note p {
  font-size: var(--text-sm);
  color: var(--ink);
  line-height: var(--leading-normal);
}

/* ── Exercise List ────────────────────────────────────────────────────────── */
.wo-exercises {
  display: flex; flex-direction: column; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3) 0;
}

/* ── Exercise Card ────────────────────────────────────────────────────────── */
.wo-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.wo-card-head {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3) var(--sp-2);
}

.wo-card-num {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: var(--radius);
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--text-xs); font-weight: var(--weight-bold);
  display: flex; align-items: center; justify-content: center;
}

.wo-card-title { flex: 1; min-width: 0; }
.wo-card-title strong {
  display: block;
  font-size: var(--text-sm); font-weight: var(--weight-bold);
  line-height: var(--leading-snug); color: var(--ink);
}
.wo-card-meta {
  display: block; margin-top: 2px;
  font-family: var(--font-mono);
  font-size: var(--text-xs); color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* Previous Performance */
.wo-prev { border-top: 1px solid var(--line); }

.wo-prev-summary {
  display: flex; align-items: flex-start;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-3);
  font-size: 11px; font-weight: var(--weight-medium); color: var(--ink-3);
  cursor: pointer; list-style: none;
  -webkit-user-select: none; user-select: none;
  transition: color .15s, background .15s;
}
.wo-prev-summary::-webkit-details-marker { display: none; }
.wo-prev-summary:hover { background: var(--paper-2); color: var(--ink-2); }

.wo-prev-summary::before {
  content: '▸'; font-size: 9px;
  transition: transform .15s;
  flex-shrink: 0;
  margin-top: 2px;
}
.wo-prev[open] > .wo-prev-summary::before { transform: rotate(90deg); }

.wo-prev-inline {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: normal;
  overflow-wrap: anywhere;
}

.wo-prev-detail {
  padding: var(--sp-1) var(--sp-3) var(--sp-2);
  background: var(--accent-soft);
}
.wo-prev-date {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px; color: var(--ink-3);
  margin-bottom: var(--sp-1);
}
.wo-prev-chips { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.wo-prev-chip {
  font-family: var(--font-mono);
  padding: 3px var(--sp-2); border-radius: var(--radius-full);
  background: var(--paper); border: 1px solid var(--line);
  font-size: 11px; font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums; color: var(--ink);
}

/* Coach tip inline */
.wo-tip-inline {
  display: flex; align-items: flex-start; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-top: 1px solid var(--line);
  background: var(--accent-soft);
}
.wo-tip-icon { flex-shrink: 0; font-size: var(--text-sm); line-height: 1.4; }
.wo-tip-inline p {
  flex: 1; margin: 0;
  font-size: var(--text-xs); color: var(--ink-2); line-height: 1.45;
}

/* ── Sets ─────────────────────────────────────────────────────────────────── */
.wo-sets {
  display: flex; flex-direction: column;
  padding: var(--sp-1) var(--sp-2) 2px;
}

.wo-set {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-1);
  border-radius: var(--radius);
  transition: background .15s, opacity .2s;
}
.wo-set.is-done {
  opacity: .5;
  background: var(--green-s);
}

.wo-set-done {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: var(--radius);
  border: 2px solid var(--line);
  background: var(--paper-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .15s var(--ease-spring);
  color: var(--ink-3); font-size: var(--text-sm); font-weight: var(--weight-bold);
}
.wo-set-done:active { transform: scale(.92); }
.wo-set-done:hover { border-color: var(--green); color: var(--green); }
.wo-set-done.done {
  background: var(--green); border-color: var(--green); color: var(--on-accent);
}
.wo-set-done.done svg { stroke: var(--on-accent); }

.wo-set-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.wo-set-fields { flex: 1; min-width: 0; }
.wo-set-input-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: var(--sp-1);
}

.wo-input {
  flex: 1; min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-2) var(--sp-1);
  font-size: var(--text-base); font-weight: var(--weight-bold);
  text-align: center;
  background: var(--paper); color: var(--ink);
  -moz-appearance: textfield;
  transition: border-color .15s;
}
.wo-input::-webkit-outer-spin-button,
.wo-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.wo-input:focus {
  outline: none; border-color: var(--accent);
}
.wo-input::placeholder { color: var(--ink-3); font-weight: var(--weight-medium); font-size: var(--text-sm); }

.wo-set-x {
  font-family: var(--font-mono);
  font-size: var(--text-xs); color: var(--ink-3); flex-shrink: 0;
}

.wo-set-prev {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 11px; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  padding-left: 2px;
}
.wo-set-prev-label {
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  font-size: 10px;
}
.wo-set-prev-value { color: var(--ink-2); }
.wo-set-prev-sep { opacity: .6; }

.wo-set.is-done .wo-input {
  background: var(--green-s); border-color: transparent; color: var(--ink-2);
}

/* Add set */
.wo-add-set {
  display: block; width: calc(100% - var(--sp-4)); margin: var(--sp-1) var(--sp-2) var(--sp-2);
  padding: var(--sp-2);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: none; color: var(--ink-3);
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  cursor: pointer; transition: all .15s;
}
.wo-add-set:hover {
  border-color: var(--accent); border-style: solid;
  color: var(--accent); background: var(--accent-soft);
}

/* Exercise note */
.wo-note-wrap { padding: var(--sp-1) var(--sp-2) var(--sp-2); }
.wo-note {
  display: block; width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
  font: inherit; font-size: var(--text-sm); line-height: 1.4;
  resize: vertical; min-height: 36px;
  transition: border-color .15s;
}
.wo-note:focus { outline: none; border-color: var(--accent); }
.wo-note::placeholder { color: var(--ink-3); }

/* ── Finish ───────────────────────────────────────────────────────────────── */
.wo-finish {
  position: sticky; bottom: 0;
  padding: var(--sp-3); padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom));
  background: var(--paper);
  border-top: 1px solid var(--line);
}

.wo-finish-btn {
  display: block; width: 100%;
  height: calc(48px * var(--density));
  background: var(--accent); color: var(--on-accent);
  border: none; border-radius: var(--radius-full);
  font-size: var(--text-sm); font-weight: var(--weight-bold);
  cursor: pointer;
  transition: all .15s var(--ease);
}
.wo-finish-btn:hover { background: var(--accent-hover); }
.wo-finish-btn:active { transform: scale(.98); }
.wo-finish-btn:disabled { opacity: .4; cursor: default; }

/* ── Done Screen ──────────────────────────────────────────────────────────── */
.wo-done {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 60vh;
  padding: var(--sp-5) var(--sp-4); text-align: center; gap: var(--sp-4);
}
.wo-done-icon { font-size: 52px; }
.wo-done h2 {
  font-size: var(--text-lg); font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
}

.wo-done-stats {
  display: flex; gap: var(--sp-2); justify-content: center; flex-wrap: wrap;
}
.wo-done-stat {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); min-width: 80px;
}
.wo-done-stat strong {
  display: block; font-size: var(--text-lg); font-weight: var(--weight-bold);
  color: var(--accent);
}
.wo-done-stat small {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: var(--tracking-wide);
}

.wo-done-note {
  font-size: var(--text-sm); color: var(--ink-3);
  max-width: var(--measure-narrow); line-height: var(--leading-normal);
}
.wo-done-actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-2); }

/* ── Rest Timer ───────────────────────────────────────────────────────────── */
.rest-timer-bar {
  position: fixed; bottom: 80px;
  left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--ink); color: var(--on-accent);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm); font-weight: var(--weight-bold);
  box-shadow: var(--shadow-overlay);
  z-index: 300;
  white-space: normal;
  max-width: min(420px, calc(100vw - (var(--sp-3) * 2)));
  animation: fadeIn 200ms var(--ease);
}
.rest-timer-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  opacity: .7; text-transform: uppercase; letter-spacing: var(--tracking-wide);
}
.rest-timer-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.btn-timer-cancel {
  background: none; border: none; color: var(--on-accent);
  opacity: .5; font-size: var(--text-base); cursor: pointer;
  margin-left: var(--sp-1);
}
.btn-timer-cancel:hover { opacity: 1; }
.rest-timer-bar.timer-done {
  background: var(--green);
  animation: pulse 0.5s ease 2;
}
@keyframes pulse { 50% { transform: translateX(-50%) scale(1.05); } }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .main { padding: var(--sp-4) var(--sp-3); }
  .page-content { max-width: 100%; }
  .stats-grid { gap: var(--sp-2); }
}

@media (max-width: 768px) {
  .sidebar    { display: none; }
  .navbar-bottom { display: flex; }

  .main {
    margin-left: 0;
    padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + var(--sp-3));
  }

  .page-header { padding: var(--sp-4) var(--sp-3) 0; margin-bottom: var(--sp-3); }
  .page-header h1 { font-size: var(--text-lg); }
  .page-content { padding: 0 var(--sp-3); }

  .stats-grid { grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); margin-bottom: var(--sp-3); }
  .stat-card  { padding: var(--sp-3) var(--sp-2); }
  .stat-value { font-size: var(--text-lg); letter-spacing: -1px; }
  .stat-label { font-size: 9px; }

  .dashboard-hero-sub { font-size: var(--text-xs); }
  .dashboard-hero-cta { font-size: var(--text-xs); height: calc(40px * var(--density)); }

  .hm-card { padding: 10px; }
  .hm-days { gap: 4px; }
  .hm-day { font-size: 10px; border-radius: 6px; }

  .wo-card-title strong { font-size: var(--text-xs); }
  .wo-briefing-top { align-items: flex-start; flex-direction: column; gap: 4px; }
  .wo-done-actions { width: 100%; flex-direction: column; }
  .wo-done-actions .btn { width: 100%; }
}

@media (max-width: 380px) {
  .page-header { padding: var(--sp-3) var(--sp-2) 0; }
  .page-content { padding: 0 var(--sp-2); }

  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid .stat-card:last-child { grid-column: 1 / -1; }
  .stat-value { font-size: var(--text-md); }
  .stat-label { font-size: 9px; }

  .card-header { align-items: flex-start; flex-wrap: wrap; }
  .card-header .btn { width: 100%; }

  .hm-card { min-width: calc(100% - 2px); padding: 8px; }
  .hm-days,
  .hm-weekdays { gap: 3px; }
  .hm-day { font-size: 9px; }

  .exercise-card {
    padding: 12px 14px !important;
    align-items: flex-start !important;
  }

  .wo-picker-btn {
    padding: var(--sp-2);
    gap: var(--sp-2);
  }
  .wo-picker-badge { margin-left: auto; }

  .wo-header-row {
    flex-wrap: wrap;
    row-gap: var(--sp-1);
  }
  .wo-header-progress {
    width: 100%;
    margin-left: 0;
  }

  .wo-briefing { padding-inline: var(--sp-2); }
  .wo-exercises { padding-inline: var(--sp-2); }
  .wo-card-head { padding: var(--sp-2); gap: var(--sp-2); }
  .wo-prev-summary { padding-inline: var(--sp-2); }
  .wo-prev-detail { padding-inline: var(--sp-2); }

  .wo-set {
    align-items: flex-start;
    padding-inline: 0;
  }
  .wo-set-done {
    width: 40px;
    height: 40px;
  }
  .wo-input {
    padding-inline: var(--sp-1);
    font-size: var(--text-sm);
  }
  .wo-set-prev { font-size: 10px; }
  .wo-add-set {
    width: calc(100% - var(--sp-3));
    margin-inline: var(--sp-1);
  }
  .wo-note-wrap { padding-inline: var(--sp-1); }
  .wo-finish {
    padding: var(--sp-2);
    padding-bottom: calc(var(--sp-2) + env(safe-area-inset-bottom));
  }

  .rest-timer-bar {
    bottom: 72px;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
  }
}

/* ── Dark Mode ────────────────────────────────────────────────────────────── */
.dark,
[data-theme="dark"] {
  --ink:       rgba(255,255,255,0.90);
  --ink-2:     rgba(255,255,255,0.58);
  --ink-3:     rgba(255,255,255,0.40);
  --paper:     oklch(0.14 0.012 260);
  --paper-2:   oklch(0.18 0.012 260);
  --line:      oklch(0.24 0.010 260);

  --accent:       #5570ff;
  --accent-hover: #7b8fff;
  --accent-soft:  rgba(85, 112, 255, 0.14);
  --on-accent:    #ffffff;

  --negative:      #f87171;
  --negative-soft: rgba(248, 113, 113, 0.08);
  --warning:       #fbbf24;
  --warning-soft:  rgba(251, 191, 36, 0.10);

  --green:   #22c55e;
  --green-s: rgba(34, 197, 94, 0.10);
  --positive:     #22c55e;
  --positive-soft: rgba(34, 197, 94, 0.10);
  --violet:       #a78bfa;
  --violet-soft:  rgba(167, 139, 250, 0.10);

  --shadow:         0 1px 3px rgba(0,0,0,0.24), 0 6px 16px rgba(0,0,0,0.20);
  --shadow-overlay: 0 20px 60px rgba(0,0,0,0.50);
}
.dark .dashboard-hero,
[data-theme="dark"] .dashboard-hero { background: var(--accent-hover); }
.dark .dashboard-hero-cta,
[data-theme="dark"] .dashboard-hero-cta { background: rgba(255,255,255,.12); color: var(--on-accent); }
.dark .dashboard-hero-cta:hover,
[data-theme="dark"] .dashboard-hero-cta:hover { background: rgba(255,255,255,.18); }
.dark .auth-screen,
[data-theme="dark"] .auth-screen {
  background:
    radial-gradient(circle at top left, rgba(85,112,255,.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(34,197,94,.14), transparent 22%),
    var(--paper);
}
.dark .auth-card,
[data-theme="dark"] .auth-card {
  background: oklch(0.18 0.012 260 / 0.92);
  border-color: oklch(0.24 0.010 260);
}
.dark .auth-brand-dot,
[data-theme="dark"] .auth-brand-dot { box-shadow: 0 10px 24px rgba(85,112,255,.30); }
.dark .input,
[data-theme="dark"] .input {
  background: oklch(0.14 0.012 260 / 0.80);
  border-color: var(--line);
  color: var(--ink);
}
.dark .input:focus,
[data-theme="dark"] .input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(85,112,255,.20);
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --ink:       rgba(255,255,255,0.90);
    --ink-2:     rgba(255,255,255,0.58);
    --ink-3:     rgba(255,255,255,0.40);
    --paper:     oklch(0.14 0.012 260);
    --paper-2:   oklch(0.18 0.012 260);
    --line:      oklch(0.24 0.010 260);

    --accent:       #5570ff;
    --accent-hover: #7b8fff;
    --accent-soft:  rgba(85, 112, 255, 0.14);
    --on-accent:    #ffffff;

    --negative:      #f87171;
    --negative-soft: rgba(248, 113, 113, 0.08);
    --warning:       #fbbf24;
    --warning-soft:  rgba(251, 191, 36, 0.10);

    --green:   #22c55e;
    --green-s: rgba(34, 197, 94, 0.10);
    --positive:     #22c55e;
    --positive-soft: rgba(34, 197, 94, 0.10);
    --violet:       #a78bfa;
    --violet-soft:  rgba(167, 139, 250, 0.10);

    --shadow:         0 1px 3px rgba(0,0,0,0.24), 0 6px 16px rgba(0,0,0,0.20);
    --shadow-overlay: 0 20px 60px rgba(0,0,0,0.50);
  }

  :root:not(.light) .dashboard-hero { background: var(--accent-hover); }
  :root:not(.light) .dashboard-hero-cta { background: rgba(255,255,255,.12); color: var(--on-accent); }
  :root:not(.light) .dashboard-hero-cta:hover { background: rgba(255,255,255,.18); }

  :root:not(.light) .auth-screen {
    background:
      radial-gradient(circle at top left, rgba(85,112,255,.18), transparent 28%),
      radial-gradient(circle at bottom right, rgba(34,197,94,.14), transparent 22%),
      var(--paper);
  }
  :root:not(.light) .auth-card {
    background: oklch(0.18 0.012 260 / 0.92);
    border-color: oklch(0.24 0.010 260);
  }
  :root:not(.light) .auth-brand-dot { box-shadow: 0 10px 24px rgba(85,112,255,.30); }
  :root:not(.light) .input {
    background: oklch(0.14 0.012 260 / 0.80);
    border-color: var(--line);
    color: var(--ink);
  }
  :root:not(.light) .input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(85,112,255,.20);
  }
}
/* ── Auth ──────────────────────────────────────────────────────────────────── */
.auth-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  background:
    radial-gradient(circle at top left, rgba(37,53,245,.10), transparent 28%),
    radial-gradient(circle at bottom right, rgba(22,163,74,.08), transparent 22%),
    var(--paper);
}
.auth-card {
  width: min(100%, 420px);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-overlay);
  padding: var(--sp-5);
  animation: scaleIn var(--duration) var(--ease);
}
.auth-brand {
  display: flex; align-items: center; gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.auth-brand-dot {
  width: 42px; height: 42px;
  border-radius: var(--radius);
  background: var(--accent);
  box-shadow: 0 10px 24px rgba(37,53,245,.25);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.auth-brand-dot::after {
  content: '//';
  font-family: var(--font-mono);
  font-size: 13px; font-weight: 700;
  color: var(--on-accent);
  letter-spacing: -0.05em;
}
.auth-kicker {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--accent);
  margin-bottom: 3px;
}
.auth-card h1 {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--ink);
}
.auth-copy {
  color: var(--ink-2); font-size: var(--text-sm);
  line-height: var(--leading-normal);
  margin-bottom: var(--sp-4);
}
.auth-form {
  display: flex; flex-direction: column;
  gap: var(--sp-3);
}
.auth-note {
  margin-top: var(--sp-3);
  min-height: 1.3em;
  text-align: center;
  color: var(--ink-3);
  font-size: var(--text-sm);
}


/* ── Exercise Card (Progrès view) ─────────────────────────────────────────── */
.exercise-card {
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  display: flex; align-items: center;
  justify-content: space-between; gap: var(--sp-3);
  min-width: 0;
}
.exercise-card > div { min-width: 0; }
.exercise-card:hover { box-shadow: var(--shadow); }

.chart-wrap { position: relative; }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + var(--sp-3));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--paper);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  box-shadow: var(--shadow-overlay);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  white-space: normal;
  text-align: center;
  max-width: min(420px, calc(100vw - (var(--sp-3) * 2)));
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.toast-error { background: var(--negative); color: #fff; }
.toast-success { background: var(--positive); color: #fff; }

/* ── Settings ──────────────────────────────────────────────────────────────── */
.view-settings {
  padding: var(--sp-4);
  max-width: 640px;
  margin: 0 auto;
}
.settings-section {
  margin-bottom: var(--sp-4);
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  background: var(--paper-2);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--line);
  border-radius: var(--radius-full);
  cursor: pointer;
  border: none;
  transition: background var(--transition);
}
.toggle.active { background: var(--accent); }
.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform var(--transition);
}
.toggle.active::after { transform: translateX(20px); }

.settings-about {
  text-align: center;
  padding: var(--sp-5) 0;
  color: var(--ink-3);
  font-size: var(--text-sm);
}
.logo-slash { color: var(--accent); }

/* ── Form Elements ────────────────────────────────────────────────────────── */
.label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--ink-2);
  margin-bottom: var(--sp-1);
}

.input {
  display: block;
  width: 100%;
  height: calc(44px * var(--density));
  padding: 0 var(--sp-3);
  font-family: var(--font);
  font-size: var(--text-sm);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition);
}
.input::placeholder { color: var(--ink-3); }
.input:focus { border-color: var(--accent); }
.input:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Page Title ───────────────────────────────────────────────────────────── */
.page-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--ink);
  line-height: var(--leading-tight);
}

/* ── Empty State Label ────────────────────────────────────────────────────── */
.empty-state-label {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}
.empty-state-label::before {
  content: '// ';
  color: var(--accent);
  letter-spacing: -0.05em;
}

/* ── Animation Utilities ──────────────────────────────────────────────────── */
.animate-scale-in { animation: scaleIn 200ms cubic-bezier(0.25, 0.1, 0.25, 1); }
.animate-slash-pulse { animation: slashPulse 2.4s ease-in-out infinite; }
.animate-slide-up { animation: slideUp 200ms cubic-bezier(0.25, 0.1, 0.25, 1); }
.animate-slash-spin { animation: slashSpin 3s linear infinite; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slashSpin {
  to { transform: rotate(360deg); }
}

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