/* ============================================================
   V-Shape Pro — Styles
   Mobile-first, dark default, OLED-friendly
   ============================================================ */

:root {
  --bg:            #0a0a0a;
  --surface:       #1a1a1a;
  --surface-2:     #242428;
  --border:        #2a2a2e;
  --primary:       #4f46e5;
  --primary-2:     #6366f1;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --text:          #fafafa;
  --text-muted:    #a1a1aa;
  --text-dim:      #71717a;
  --radius:        14px;
  --radius-sm:     10px;
  --space:         16px;
  --tap:           48px;
  --safe-bottom:   env(safe-area-inset-bottom, 0px);
  --safe-top:      env(safe-area-inset-top, 0px);
  --nav-height:    64px;
  --header-height: 56px;
}

* { box-sizing: border-box; }

/* Make sure `hidden` wins over display: flex/grid rules below */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: calc(var(--header-height) + var(--safe-top));
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
}

body.session-active {
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }

a { color: var(--primary-2); }

button { font-family: inherit; }

input, select, textarea {
  font-family: inherit;
  font-size: 16px; /* prevents iOS zoom on focus */
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s;
}

input:focus, select:focus, textarea:focus { border-color: var(--primary); }

input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--primary); }

/* ============== Header ============== */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 50;
  padding-top: var(--safe-top);
  height: calc(var(--header-height) + var(--safe-top));
}

body.session-active .app-header { display: none; }

.app-header__inner {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space);
}

.app-header__title {
  font-size: 18px;
  letter-spacing: 0.02em;
}

.logo-v {
  display: inline-block;
  color: var(--primary-2);
  font-weight: 900;
  transform: skewX(-8deg);
}

.icon-btn {
  width: var(--tap); height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text);
  border-radius: 50%;
  cursor: pointer;
}
.icon-btn:active { background: var(--surface-2); }

/* ============== Main / views ============== */
.app-main {
  padding: var(--space);
  max-width: 640px;
  margin: 0 auto;
}

.view {
  display: flex;
  flex-direction: column;
  gap: var(--space);
}

.view__title {
  font-size: 22px;
  margin: 4px 0 4px;
}

/* ============== Cards ============== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

.card--stat { align-items: flex-start; gap: 4px; padding: 14px; }

.quick-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat__label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stat__value { font-size: 26px; font-weight: 800; }
.stat__sub { font-size: 12px; color: var(--text-muted); }

/* ============== Greeting + next session ============== */
.greeting {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding: 4px 2px;
}

.next-session {
  background: linear-gradient(135deg, #1e1b4b 0%, #0a0a0a 100%);
  border-color: #3730a3;
}

.next-session__label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.next-session__name { font-size: 22px; font-weight: 800; }
.next-session__meta { font-size: 13px; color: var(--text-muted); }

/* ============== Buttons ============== */
.btn {
  min-height: var(--tap);
  padding: 0 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .05s, background .15s;
  text-decoration: none;
  color: var(--text);
}
.btn:active { transform: scale(0.98); }

.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-2); }

.btn--ghost { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.btn--ghost:hover { background: var(--border); }

.btn--danger  { background: var(--danger); color: #fff; }

.btn--large   { min-height: 56px; font-size: 17px; width: 100%; margin-top: 8px; }

/* ============== Bottom Nav ============== */
.app-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  padding-bottom: var(--safe-bottom);
  z-index: 40;
}

body.session-active .app-nav { display: none; }

.app-nav__btn {
  flex: 1;
  min-height: var(--nav-height);
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  padding: 6px 2px;
}

.app-nav__btn.is-active { color: var(--primary-2); }
.app-nav__btn.is-active svg { stroke: var(--primary-2); }

/* ============== Volume bars ============== */
.volume-bars { display: flex; flex-direction: column; gap: 8px; }
.volume-bar { display: grid; grid-template-columns: 150px 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.volume-bar__track { background: var(--surface-2); height: 10px; border-radius: 5px; overflow: hidden; }
.volume-bar__fill  { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); }
.volume-bar__count { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 12px; }

/* ============== Muted + small ============== */
.muted { color: var(--text-muted); }
.small { font-size: 12px; line-height: 1.5; }

/* ============== Session view — new clean layout ============== */
.view--session {
  padding-top: 8px;
  gap: 14px;
}

/* Topbar */
.session-topbar {
  position: sticky;
  top: var(--safe-top);
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 6px;
  z-index: 10;
}
.session-topbar__center {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.session-topbar__title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.session-topbar__sub {
  display: flex;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Progress bar */
.progress-bar {
  background: var(--surface-2);
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width .4s ease;
  width: 0%;
}

.exercise-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Exercise header — compact and scannable */
.ex-head {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ex-head__muscle {
  font-size: 11px;
  color: var(--primary-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.ex-head__name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0;
}
.ex-head__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.ex-head__meta .dot { color: var(--text-dim); }

.ex-head__prev {
  font-size: 13px;
  color: var(--text-muted);
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: 8px;
  margin-top: 6px;
}
.ex-head__suggestion {
  display: inline-block;
  background: rgba(79, 70, 229, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: var(--primary-2);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  align-self: flex-start;
  margin-top: 4px;
}

/* Technique accordion — compact */
details.technique {
  background: transparent;
  margin-top: 4px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
details.technique summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
details.technique summary::-webkit-details-marker { display: none; }
details.technique .chev { transition: transform .2s; flex-shrink: 0; }
details.technique[open] .chev { transform: rotate(180deg); }
details.technique summary:hover { color: var(--text); }
.technique__body {
  padding: 10px 0 2px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-left: 3px solid var(--primary);
  padding-left: 12px;
  margin-top: 8px;
}
.technique__body p { margin: 0; font-size: 13px; color: var(--text); line-height: 1.55; }

/* Sets list */
.sets-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Set card — base */
.set-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  transition: border-color .15s, background .15s;
}

/* Done set — compact summary */
.set-card--done {
  padding: 10px 14px;
  background: rgba(16, 185, 129, 0.07);
  border-color: rgba(16, 185, 129, 0.25);
}
.set-card__done-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.set-card__check {
  color: var(--success);
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
}
.set-card__num {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  min-width: 64px;
}
.set-card__summary {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.set-card__summary .muted { font-weight: 400; }
.set-card__edit {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}
.set-card__edit:hover { color: var(--primary-2); background: var(--surface-2); }

/* Upcoming set — muted placeholder */
.set-card--upcoming {
  padding: 10px 14px;
  opacity: 0.55;
  cursor: pointer;
  background: transparent;
  border-style: dashed;
}
.set-card--upcoming:hover { opacity: 0.9; border-color: var(--border); }

/* Active set — emphasized, full editor */
.set-card--active {
  background: linear-gradient(160deg, rgba(79,70,229,0.10), rgba(16,185,129,0.04));
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79,70,229,0.15);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}
.set-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.set-card__hint {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Inputs */
.set-card__inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.set-card__inputs--single { grid-template-columns: 1fr; max-width: 220px; margin: 0 auto; }

.field {
  position: relative;
  display: flex;
  flex-direction: column;
}
.field input[type="number"] {
  width: 100%;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 28px;
  padding: 14px 4px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 64px;
  transition: border-color .15s, background .15s;
  /* hide number arrows for cleaner look */
  -moz-appearance: textfield;
}
.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.field input:focus {
  border-color: var(--primary);
  background: var(--surface);
}
.field__label {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  pointer-events: none;
  font-weight: 600;
}

/* RIR row */
.rir-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rir-row__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  min-width: 28px;
}
.rir-row button {
  flex: 1;
  min-height: 42px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.rir-row button:active { transform: scale(0.96); }
.rir-row button.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.25);
}

/* Validate button */
.set-card__validate {
  width: 100%;
  min-height: 52px;
  font-size: 16px;
  font-weight: 700;
}

/* Session nav */
.session-nav {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}
.session-nav .btn { flex: 1; }
.session-nav .btn.is-ready {
  box-shadow: 0 0 0 3px rgba(16,185,129,0.25);
}

/* Additional set button */
.sets-list__add { align-self: center; margin-top: 4px; }

/* Body class: keep bottom nav hidden during session; topbar is inside view */
body.session-active { padding-top: var(--safe-top); padding-bottom: var(--safe-bottom); }

/* ============== Timer overlay ============== */
.timer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.94);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space);
}

.timer-overlay__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
  max-width: 400px;
}

.timer-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.timer-value {
  font-size: 96px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--primary-2);
  transition: color .25s;
}
.timer-value.is-warn { color: var(--warning); }
.timer-value.is-done { color: var(--danger); animation: pulse 0.6s ease 3; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.07); }
}

.timer-bar {
  width: 100%;
  max-width: 320px;
  background: var(--surface-2);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}
.timer-bar__fill {
  background: var(--primary);
  height: 100%;
  transition: width .3s linear;
  width: 100%;
}

.timer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.timer-actions .btn { min-width: 72px; padding: 0 14px; }

/* ============== History list ============== */
.history-list { display: flex; flex-direction: column; gap: 10px; }

.history-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
}
.history-item__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.history-item__name { font-weight: 700; }
.history-item__date { font-size: 12px; color: var(--text-muted); }
.history-item__body { margin-top: 8px; display: none; }
.history-item.is-open .history-item__body { display: block; }
.history-item__ex { font-size: 13px; color: var(--text-muted); padding: 4px 0; border-top: 1px dashed var(--border); }

/* ============== Charts ============== */
.chart-wrap {
  position: relative;
  width: 100%;
  height: 260px;
  margin-top: 4px;
}

.select {
  width: 100%;
  background: var(--surface-2);
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-top: 8px;
}
.inline-form input { width: 100%; }

/* ============== Heatmap ============== */
.heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fill, 14px);
  gap: 3px;
  padding: 4px 0;
}
.heatmap__cell {
  width: 14px;
  height: 14px;
  background: var(--surface-2);
  border-radius: 2px;
}
.heatmap__cell.is-done { background: var(--primary); }

/* ============== Nutrition ============== */
.protein-tracker { text-align: center; padding: 8px 0; }
.protein-tracker__big { font-size: 42px; font-weight: 800; line-height: 1; }
.protein-tracker__target { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }

progress {
  width: 100%;
  height: 10px;
  -webkit-appearance: none;
  appearance: none;
  border: none;
  background: var(--surface-2);
  border-radius: 5px;
  overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--surface-2); }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--primary), var(--primary-2)); }
progress::-moz-progress-bar { background: var(--primary); }

.protein-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.sleep-input { display: flex; flex-direction: column; gap: 10px; align-items: center; padding: 4px 0; }
.sleep-input input[type="range"] { width: 100%; accent-color: var(--primary); }
.sleep-value { font-size: 28px; font-weight: 800; }

/* ============== Education ============== */
#educationContent h3 { margin-top: 20px; font-size: 18px; color: var(--primary-2); }
#educationContent h4 { margin-top: 14px; font-size: 15px; color: var(--text); }
#educationContent p { color: var(--text-muted); font-size: 14px; line-height: 1.6; }
#educationContent ul { padding-left: 20px; color: var(--text-muted); font-size: 14px; line-height: 1.6; }
#educationContent li { margin-bottom: 4px; }
#educationContent .callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin: 12px 0;
}
#educationContent .citation {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
}

/* ============== Form rows ============== */
.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.form-row:last-child { border-bottom: none; }
.form-row input[type="number"] { max-width: 110px; text-align: right; }
.form-row span { font-size: 14px; }

/* ============== Toast ============== */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 200;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  animation: toast-in .25s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ============== Modal ============== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(8px);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: var(--space);
}
@media (min-width: 520px) { .modal { align-items: center; } }

.modal__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  max-width: 460px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal__title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.modal h4 { font-size: 15px; margin-top: 4px; color: var(--primary-2); }
.modal ol, .modal ul { margin: 0; padding-left: 20px; }
.modal p { margin: 0; color: var(--text-muted); font-size: 14px; line-height: 1.55; }

/* ============== Beginner tip card (in-session) ============== */
.beginner-tip {
  background: linear-gradient(135deg, rgba(79,70,229,0.15), rgba(16,185,129,0.08));
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}
.beginner-tip strong { color: var(--primary-2); }

/* ============== Session helper legend ============== */
.session-legend {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 8px;
  line-height: 1.5;
}
.session-legend strong { color: var(--text); }

/* ============== Empty states ============== */
.empty-state {
  align-items: center;
  text-align: center;
  padding: 28px 18px;
}
.empty-state__icon { font-size: 38px; line-height: 1; margin-bottom: 4px; }
.empty-state__title { font-weight: 700; font-size: 16px; }

/* ============== History: edit button ============== */
.history-item__head {
  cursor: pointer;
}
.history-item__actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.icon-btn--sm {
  width: 36px;
  height: 36px;
  color: var(--text-muted);
}
.icon-btn--sm:hover { color: var(--primary-2); background: var(--surface-2); }
.history-item__head .chev { color: var(--text-muted); transition: transform .2s; }
.history-item.is-open .history-item__head .chev { transform: rotate(180deg); }

/* ============== Edit session modal ============== */
.modal__card--wide { max-width: 560px; }
.modal__actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  position: sticky;
  bottom: -20px;
  background: var(--surface);
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.modal__actions .btn { flex: 1; }

.edit-session__header { display: flex; flex-direction: column; gap: 4px; }
.edit-session__footer { margin-top: 6px; }

.edit-ex-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.edit-ex-card__name { font-weight: 700; font-size: 14px; }
.edit-ex-card__sets { display: flex; flex-direction: column; gap: 6px; }

.edit-set-row {
  display: grid;
  grid-template-columns: 28px 1fr 1fr 72px 36px;
  gap: 6px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
}
.edit-set-row__num { text-align: center; font-weight: 700; color: var(--text-muted); font-size: 12px; }
.edit-set-row input[type="number"] {
  width: 100%;
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  padding: 8px 4px;
  min-height: 38px;
}
.set-row__remove {
  min-height: 38px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--danger);
  border-radius: 6px;
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
}
.set-row__remove:hover { background: rgba(239,68,68,0.1); }

.btn--small { min-height: 36px; font-size: 13px; padding: 0 14px; align-self: flex-start; }

/* Compact RIR buttons inside the edit modal grid */
.set-row__rir {
  display: flex;
  gap: 2px;
}
.set-row__rir button {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 2px;
}
.set-row__rir button.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ============== Guide card for empty dashboard ============== */
.guide-card ol { margin: 0; padding-left: 22px; color: var(--text-muted); font-size: 14px; line-height: 1.7; }
.guide-card ol li strong { color: var(--text); }

/* ============== Hero card (Quick Start intro) ============== */
.hero-card {
  background: linear-gradient(135deg, rgba(79,70,229,0.20) 0%, rgba(16,185,129,0.10) 100%);
  border-color: rgba(99,102,241,0.35);
}
.hero-card .toc {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}
.hero-card .toc a {
  display: block;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background .12s, border-color .12s;
}
.hero-card .toc a:hover {
  background: rgba(99,102,241,0.15);
  border-color: var(--primary-2);
}

/* ============== Animations / view transition ============== */
.view:not([hidden]) { animation: view-in 0.18s ease; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Button press feedback */
.btn, .icon-btn, .app-nav__btn, .set-row__log, .set-row__remove {
  -webkit-tap-highlight-color: transparent;
}

/* Pending session marker */
.history-item.is-pending {
  border-left: 3px solid var(--warning);
}
.history-item.is-pending .history-item__date::after {
  content: " · en attente de sync";
  color: var(--warning);
  font-weight: 600;
}

/* ============== Auth screen ============== */
.auth {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at top, #1a1828 0%, #0a0a0a 55%);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space);
  overflow-y: auto;
}
.auth__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 22px 22px;
  max-width: 380px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.auth__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.auth__logo {
  width: 44px; height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  border-radius: 10px;
  font-family: 'Impact', 'Arial Black', sans-serif;
  font-size: 28px;
  color: #fff;
  font-weight: 900;
  transform: skewX(-6deg);
}
.auth__title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.auth__tagline {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: -6px;
}
.auth__tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}
.auth__tab {
  min-height: 40px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.auth__tab.is-active {
  background: var(--primary);
  color: #fff;
}
.auth__form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.auth__field > span {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}
.auth__field input {
  min-height: 48px;
  font-size: 16px;
  padding: 0 12px;
}
.auth__field small { font-size: 11px; }
.auth__error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}
.auth__footer {
  text-align: center;
  line-height: 1.5;
  margin-top: 4px;
}

/* Google sign-in section */
.auth__google {
  margin: 4px 0 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.auth__divider {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 12px;
}
.auth__divider::before,
.auth__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Forgot password link */
.auth__forgot {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
  text-align: center;
  width: 100%;
  margin-top: 2px;
  opacity: 0.85;
}
.auth__forgot:hover { opacity: 1; text-decoration: underline; }

/* Success message in auth forms */
.auth__success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #4ade80;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-top: 4px;
}

/* ============== Responsive ============== */
@media (min-width: 720px) {
  .set-row { grid-template-columns: 40px 1fr 1fr 120px 80px; }
  .chart-wrap { height: 300px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
