/* =========================================================================
   SOBRECARGA — sistema de diseño
   Paleta de datos validada con el validador de contraste/CVD (dataviz):
   categórica, secuencial y estado pasan banda de luminosidad, piso de croma,
   separación bajo daltonismo y contraste ≥3:1 en claro y oscuro.
   Los colores de los discos son un código FIJO (norma IWF): significan un peso,
   nunca se usan como color de serie.
   ========================================================================= */

/* ---------- tokens ---------- */
:root {
  color-scheme: light;

  /* superficie: hormigón / pared de gimnasio */
  --bg:         #E7E9ED;
  --surface:    #FBFBFC;
  --surface-2:  #F1F3F6;
  --surface-3:  #E5E9EF;
  --line:       #D5D9E0;
  --line-2:     #BEC5D0;

  /* tinta */
  --ink:        #14181F;
  --ink-2:      #545C69;
  --ink-3:      #5F6773;

  /* acción */
  --accent:      #1F4FBF;
  --accent-on:   #FFFFFF;
  --accent-soft: #E7ECFA;
  --accent-line: #B9C8EC;

  /* estado (reservado: nunca como color de serie) */
  --good:      #1F7A4D;
  --good-soft: #E4F1EA;
  --warn:      #8C6A08;
  --warn-soft: #FAF3E3;
  --bad:       #C42B27;
  --bad-soft:  #F9E7E6;

  /* Pasos de TEXTO. Un color que funciona como relleno de una marca no sirve
     necesariamente como texto: en claro coinciden, en oscuro no. */
  --accent-text: var(--accent);
  --good-text:   var(--good);
  --warn-text:   var(--warn);
  --bad-text:    var(--bad);

  /* categórica — identidad (orden fijo, nunca ciclado) */
  --cat-1: #1F4FBF; --cat-2: #C42B27; --cat-3: #B98A0A; --cat-4: #1F7A4D;
  --cat-5: #6D3FB5; --cat-6: #009CAF; --cat-7: #C2551A; --cat-8: #B02A6B;

  /* secuencial — magnitud (un solo tono, claro→oscuro) */
  --seq-1: #9DB1E4; --seq-2: #7290D3; --seq-3: #4767BE; --seq-4: #1F4FBF; --seq-5: #153A8E;

  /* discos IWF: el color ES el peso */
  --pl-25: #C42B27; --pl-20: #1F4FBF; --pl-15: #E0AA1E; --pl-10: #1F7A4D;
  --pl-5:  #F2F3F5; --pl-2:  #C42B27; --pl-1:  #9AA3AF; --pl-bar: #98A0AC;

  /* tipografía */
  --f-display: 'Archivo', system-ui, -apple-system, sans-serif;
  --f-body:    'Public Sans', system-ui, -apple-system, sans-serif;
  --f-mono:    'Spline Sans Mono', ui-monospace, 'Cascadia Mono', monospace;

  --t-1: .6875rem; --t-2: .75rem;  --t-3: .8125rem; --t-4: .875rem;
  --t-5: .9375rem; --t-6: 1.0625rem; --t-7: 1.375rem; --t-8: 1.875rem;
  --t-9: clamp(2.25rem, 6.5vw, 3rem);

  /* espacio y forma */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r-sm: 3px; --r-md: 5px; --r-lg: 8px;
  --shadow: 0 1px 2px rgb(20 24 31 / .06), 0 8px 24px -16px rgb(20 24 31 / .28);
  --rail-w: 216px;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg:         #0E1116;
  --surface:    #171B22;
  --surface-2:  #1E232C;
  --surface-3:  #252B36;
  --line:       #2A3240;
  --line-2:     #3B4554;

  --ink:        #E8ECF2;
  --ink-2:      #9BA5B4;
  --ink-3:      #8B95A4;

  --accent:      #4770C8;
  --accent-on:   #FFFFFF;
  --accent-soft: #1B2740;
  --accent-line: #33456B;

  --good:      #24744B; --good-soft: #12241B;
  --warn:      #B7890D; --warn-soft: #2A2313;
  --bad:       #B9312B; --bad-soft:  #2A1614;

  /* En oscuro el texto necesita su propio paso, más claro que la marca. */
  --accent-text: #89A8EF;
  --good-text:   #4FC48A;
  --warn-text:   #E3B052;
  --bad-text:    #F0817A;

  --cat-1: #4770C8; --cat-2: #B9312B; --cat-3: #B7890D; --cat-4: #24744B;
  --cat-5: #8B57D8; --cat-6: #219AAC; --cat-7: #E9610C; --cat-8: #B1306D;

  --seq-1: #3C5385; --seq-2: #4C6DAE; --seq-3: #5E88D2; --seq-4: #7FA5E6; --seq-5: #A5C0F2;

  --pl-5: #DDE1E6; --pl-bar: #6B7482;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 10px 28px -18px rgb(0 0 0 / .8);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--t-5)/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--f-display); font-weight: 700; line-height: 1.12; letter-spacing: -.012em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
/* Reset de botones: sin esto, cualquier botón al que le falte `background`
   se lleva el gris y el borde "outset" del navegador — se nota sobre todo en
   modo oscuro. Todas las reglas de componentes usan clases y ganan igual. */
button { background: transparent; border: 0; padding: 0; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--accent-soft); }

/* utilidades tipográficas */
.micro {
  font: 500 var(--t-1)/1.2 var(--f-mono);
  text-transform: uppercase;
  letter-spacing: .11em;
  color: var(--ink-3);
}
.num { font-family: var(--f-display); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- estructura ---------- */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "top top" "rail main";
  min-height: 100dvh;
}

.topbar {
  grid-area: top;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s4);
  padding: 0 var(--s4);
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand__mark { width: 34px; height: 21px; flex: none; }
.brand__mark rect { stroke: none; }
.bm-bar { fill: var(--pl-bar); }
.bm-p1 { fill: var(--pl-20); }
.bm-p2 { fill: var(--pl-25); }
.brand__name {
  font-family: var(--f-display);
  font-weight: 800;
  font-stretch: 118%;
  font-size: var(--t-4);
  letter-spacing: .13em;
  text-transform: uppercase;
}
.topbar__right { display: flex; gap: var(--s1); }

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--r-md);
  background: transparent; color: var(--ink-2); cursor: pointer;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 19px; height: 19px; }
.ico-moon { display: none; }
[data-theme="dark"] .ico-sun { display: none; }
[data-theme="dark"] .ico-moon { display: block; }

/* rail */
.rail {
  grid-area: rail;
  padding: var(--s4) var(--s3);
  border-right: 1px solid var(--line);
  background: var(--surface);
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 56px; align-self: start;
  max-height: calc(100dvh - 56px);
}
.rail__item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px;
  border-radius: var(--r-md);
  color: var(--ink-2);
  font-size: var(--t-4); font-weight: 500;
  position: relative;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.rail__item svg { width: 19px; height: 19px; flex: none; }
.rail__item:hover { background: var(--surface-2); color: var(--ink); }
.rail__item.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.rail__item.is-active::before {
  content: ""; position: absolute; left: -12px; top: 50%; translate: 0 -50%;
  width: 3px; height: 20px; background: var(--accent); border-radius: 0 2px 2px 0;
}

.main {
  grid-area: main;
  min-width: 0;
  padding: var(--s5) var(--s5) var(--s7);
}
.wrap { max-width: 1080px; margin: 0 auto; }
.wrap--wide { max-width: 1240px; }

/* ---------- cabecera de vista ---------- */
.view-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s4); flex-wrap: wrap;
  margin-bottom: var(--s4);
}
.view-title { font-size: var(--t-7); font-stretch: 112%; }
.view-sub { font-size: var(--t-3); color: var(--ink-2); margin-top: 2px; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink);
  font-size: var(--t-4); font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .14s var(--ease), border-color .14s var(--ease), color .14s var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-on); }
.btn--primary:hover { background: color-mix(in oklab, var(--accent) 86%, #000); border-color: transparent; }
.btn--ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--ink); border-color: transparent; }
.btn--danger { color: var(--bad-text); border-color: color-mix(in oklab, var(--bad) 34%, var(--line)); }
.btn--danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn--sm { min-height: 30px; padding: 0 10px; font-size: var(--t-3); }
.btn--block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- tarjetas ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: clip;
}
.card__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.card__head > * { min-width: 0; }
.card__title { font-size: var(--t-5); font-stretch: 108%; font-weight: 700; }
.card__body { padding: var(--s4); }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.row--end { justify-content: flex-end; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s4); }
/* Lista + editor. En pantallas chicas se apila; el ancho fijo va en la consulta
   de medios, nunca en un style inline (ahí desbordaba el móvil). */
.split { display: grid; gap: var(--s4); align-items: start; }
@media (min-width: 900px) { .split { grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); } }

/* ---------- resumen de sesión ---------- */
.session-head {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  border-left: 4px solid var(--day-color, var(--line-2));
  padding: var(--s4);
  display: grid; gap: var(--s3);
}
.session-head__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.session-title {
  font-size: var(--t-7); font-stretch: 115%; font-weight: 800;
  letter-spacing: -.015em; text-transform: uppercase;
}
.session-title--empty { color: var(--ink-3); font-weight: 500; text-transform: none; font-stretch: 100%; letter-spacing: 0; font-size: var(--t-6); }

.datebar { display: flex; align-items: center; gap: var(--s1); }
.datebar__date {
  min-width: 190px; text-align: center;
  font-family: var(--f-display); font-weight: 700; font-stretch: 106%;
  font-size: var(--t-5); text-transform: capitalize;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); padding: 7px 10px; cursor: pointer;
}
.datebar__date:hover { background: var(--surface-2); }
.datebar__nav {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.datebar__nav:hover { background: var(--surface-2); color: var(--ink); }
.datebar__nav svg { width: 16px; height: 16px; }

/* fichas de músculo */
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  font: 500 var(--t-1)/1 var(--f-mono);
  text-transform: uppercase; letter-spacing: .08em;
  padding: 5px 7px; border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line);
}
.tag--solid { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }

/* barra de progreso de la sesión */
.meter { height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter__fill { height: 100%; background: var(--day-color, var(--accent)); border-radius: 3px; transition: width .3s var(--ease); }

/* métricas en línea */
.inline-stats { display: flex; flex-wrap: wrap; gap: var(--s5) var(--s5); }
.inline-stat { display: grid; gap: 1px; }
.inline-stat__v { font-family: var(--f-display); font-weight: 700; font-size: var(--t-6); font-stretch: 108%; }
.inline-stat__l { font: 500 var(--t-1)/1.2 var(--f-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); }

/* ---------- ejercicio ---------- */
.ex {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition: opacity .18s var(--ease);
}
.ex.is-skipped {
  background: color-mix(in oklab, var(--bad) 7%, var(--surface));
  border-color: color-mix(in oklab, var(--bad) 38%, var(--line));
  border-left: 4px solid var(--bad);
}
.ex.is-skipped .ex__name { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--ink-2); }
.ex.is-skipped .ex__sets { opacity: .38; pointer-events: none; }
.ex.is-done { border-color: color-mix(in oklab, var(--good) 30%, var(--line)); }
/* Ejercicio sumado fuera de la rutina: se distingue del plan del dia. */
.ex.is-extra { border-left: 4px solid var(--accent); }
.ex__note { margin-top: 8px; font-size: var(--t-3); color: var(--ink-2); white-space: pre-wrap; }

.ex__head {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: start; gap: var(--s3);
  padding: var(--s3) var(--s4);
}
.ex__idx {
  font: 500 var(--t-2)/1 var(--f-mono);
  color: var(--ink-3); padding-top: 5px;
}
.ex__name { font-family: var(--f-display); font-weight: 700; font-size: var(--t-6); font-stretch: 106%; letter-spacing: -.01em; }
.ex__meta { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-top: 4px; }
.ex__target { font: 500 var(--t-2)/1 var(--f-mono); color: var(--ink-2); }
.ex__actions { display: flex; gap: var(--s1); }

.ex__sets { padding: 0 var(--s4) var(--s3); }
.ex__foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s2) var(--s4) var(--s3);
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

/* estado del ejercicio */
.status-btns { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-md); overflow: clip; }
.status-btns button {
  border: 0; background: var(--surface); color: var(--ink-2);
  padding: 6px 10px; font-size: var(--t-2); font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  border-right: 1px solid var(--line);
  transition: background .12s var(--ease), color .12s var(--ease);
}
.status-btns button:last-child { border-right: 0; }
.status-btns button:hover { background: var(--surface-2); color: var(--ink); }
.status-btns button svg { width: 13px; height: 13px; }
.status-btns button[aria-pressed="true"][data-status="done"] { background: var(--good-soft); color: var(--good-text); }
.status-btns button[aria-pressed="true"][data-status="skipped"] { background: var(--bad-soft); color: var(--bad-text); }

/* ---------- el libro de series ---------- */
.sets { display: grid; gap: 0; }
.sets__head, .set-row {
  display: grid;
  grid-template-columns: 30px minmax(84px, 1fr) minmax(92px, 1.15fr) 40px 34px;
  align-items: center; gap: var(--s2);
}
.sets__head { padding: 0 0 6px; border-bottom: 1px solid var(--line); }
.sets__head span { font: 500 var(--t-1)/1 var(--f-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); }
.sets__head span:nth-child(4), .sets__head span:nth-child(5) { text-align: center; }

.set-row { padding: 7px 0; border-bottom: 1px solid var(--line); position: relative; }
.set-row:last-child { border-bottom: 0; }
.set-row__n {
  font: 500 var(--t-3)/1 var(--f-mono); color: var(--ink-3);
  display: flex; align-items: center; justify-content: center; gap: 2px;
  height: 26px;
}
.set-row__plus { color: var(--accent-text); font-weight: 600; }
.set-row.is-done .set-row__n { color: var(--good-text); }
.set-row.is-warmup .set-row__n { color: var(--warn-text); }

/* campo con steppers */
.field {
  display: flex; align-items: stretch;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); overflow: clip; min-width: 0;
  transition: border-color .12s var(--ease), background .12s var(--ease);
}
.field:focus-within { border-color: var(--accent); }
.field.is-override { border-color: var(--accent-line); background: var(--accent-soft); }
.field__btn {
  width: 30px; border: 0; background: transparent; color: var(--ink-2);
  cursor: pointer; display: grid; place-items: center; flex: none;
  font-family: var(--f-mono); font-size: var(--t-4); line-height: 1;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.field__btn:hover { background: var(--surface-2); color: var(--ink); }
.field__in {
  flex: 1; min-width: 0; border: 0; background: transparent;
  text-align: center; padding: 7px 0;
  font: 500 var(--t-4)/1.2 var(--f-mono); font-variant-numeric: tabular-nums;
  appearance: textfield;
}
.field__in::-webkit-outer-spin-button, .field__in::-webkit-inner-spin-button { appearance: none; margin: 0; }
.field__in:focus { outline: none; }
.field__in::placeholder { color: var(--ink-3); opacity: 1; }
.field__unit { display: grid; place-items: center; padding-right: 8px; font: 500 var(--t-1)/1 var(--f-mono); color: var(--ink-3); }

/* check de serie */
.set-check {
  width: 34px; height: 34px; margin: 0 auto;
  display: grid; place-items: center;
  border: 1px solid var(--line-2); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink-3); cursor: pointer;
  transition: background .14s var(--ease), border-color .14s var(--ease), color .14s var(--ease);
}
.set-check:hover { border-color: var(--good); color: var(--good-text); }
.set-check svg { width: 16px; height: 16px; stroke-width: 2.4; }
.set-check[aria-pressed="true"] { background: var(--good); border-color: var(--good); color: #fff; }
.set-row__del {
  width: 28px; height: 28px; margin: 0 auto; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--ink-3); cursor: pointer; display: grid; place-items: center;
}
.set-row__del:hover { background: var(--bad-soft); color: var(--bad-text); }
.set-row__del svg { width: 14px; height: 14px; }

/* delta contra lo pautado */
.delta { font: 500 var(--t-1)/1 var(--f-mono); letter-spacing: .02em; }
.delta--up { color: var(--good-text); }
.delta--down { color: var(--bad-text); }

/* ---------- discos (elemento firma) ---------- */
.plates { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.plates__svg { height: 34px; flex: none; }
.plates__svg rect { stroke: none; }
.plates__txt { font: 500 var(--t-1)/1.3 var(--f-mono); color: var(--ink-2); letter-spacing: .04em; }
.plates--lg .plates__svg { height: 52px; }
.plate-note { font: 500 var(--t-1)/1 var(--f-mono); color: var(--ink-3); }
.plate-stroke { stroke: var(--line-2); stroke-width: 1; fill: none; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: clip; }
.kpi { background: var(--surface); padding: var(--s3) var(--s4); display: grid; gap: 3px; }
.kpi__l { font: 500 var(--t-1)/1.2 var(--f-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); }
.kpi__v { font-family: var(--f-display); font-weight: 700; font-size: var(--t-7); font-stretch: 110%; letter-spacing: -.02em; }
.kpi__v small { font-size: var(--t-3); font-weight: 500; color: var(--ink-3); margin-left: 2px; letter-spacing: 0; }
.kpi__d { font: 500 var(--t-2)/1.2 var(--f-mono); color: var(--ink-3); }

.hero-figure {
  font-family: var(--f-display); font-weight: 800; font-stretch: 120%;
  font-size: var(--t-9); line-height: .95; letter-spacing: -.035em;
}

/* ---------- gráficos ---------- */
.chart { width: 100%; display: block; overflow: visible; }
.chart-wrap { position: relative; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--ink-3); stroke: none; font: 500 10px var(--f-mono); }
.chart-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { stroke: none; opacity: .1; }
.chart-dot { stroke: var(--surface); stroke-width: 2; }
.chart-bar { stroke: none; }
.chart-label { fill: var(--ink-2); stroke: none; font: 500 10px var(--f-mono); }
.chart-hit { fill: transparent; stroke: none; cursor: pointer; }
.chart-cross { stroke: var(--line-2); stroke-width: 1; }

.tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-md); box-shadow: var(--shadow);
  padding: 7px 9px; font-size: var(--t-2); white-space: nowrap;
  translate: -50% calc(-100% - 10px); opacity: 0;
  transition: opacity .12s var(--ease);
}
.tip.is-on { opacity: 1; }
.tip__t { font: 500 var(--t-1)/1.3 var(--f-mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; }
.tip__r { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.tip__sw { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.tip__v { font-family: var(--f-mono); font-weight: 500; }

.legend { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s2); }
.legend__i { display: flex; align-items: center; gap: 6px; font-size: var(--t-2); color: var(--ink-2); }
.legend__sw { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.legend__sw--line { width: 14px; height: 2px; border-radius: 1px; }

.chart-toggle { display: flex; gap: var(--s1); }
.seg {
  display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-md); overflow: clip; background: var(--surface);
}
.seg button {
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
  padding: 6px 11px; font: 500 var(--t-2)/1 var(--f-mono); text-transform: uppercase; letter-spacing: .07em;
  border-right: 1px solid var(--line);
  transition: background .12s var(--ease), color .12s var(--ease);
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--surface-2); color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); }

/* tabla gemela de cada gráfico */
.tbl { width: 100%; border-collapse: collapse; font-size: var(--t-3); }
.tbl th, .tbl td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: right; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl thead th { font: 500 var(--t-1)/1.2 var(--f-mono); text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); }
.tbl td { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.tbl td:first-child { font-family: var(--f-body); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl-scroll { max-height: 320px; overflow: auto; }

/* ---------- calendario ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal__dow { font: 500 var(--t-1)/1 var(--f-mono); text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); text-align: center; padding-bottom: var(--s1); }
.cal__cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface);
  padding: 5px 6px;
  display: flex; flex-direction: column; justify-content: space-between;
  cursor: pointer; text-align: left; color: inherit;
  transition: border-color .12s var(--ease), background .12s var(--ease);
  overflow: clip;
}
.cal__cell:hover { border-color: var(--ink-3); }
.cal__cell.is-out { opacity: .3; }
.cal__cell.is-today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal__cell.has-session {
  border-left: 3px solid var(--day-color, var(--accent));
  background: color-mix(in oklab, var(--day-color, var(--accent)) 10%, var(--surface));
}
.cal__n { font: 500 var(--t-3)/1 var(--f-mono); color: var(--ink-2); }
.cal__cell.has-session .cal__n { color: var(--ink); font-weight: 600; }
.cal__label {
  font: 700 var(--t-1)/1.15 var(--f-display); font-stretch: 106%;
  text-transform: uppercase; letter-spacing: .02em;
  color: var(--ink);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.cal__vol { font: 500 var(--t-1)/1 var(--f-mono); color: var(--ink-3); }
.cal__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--day-color); position: absolute; top: 6px; right: 6px; }

/* tira anual: 12 filas × 31 columnas */
.yearstrip { display: grid; gap: 3px; }
.yearstrip__row { display: grid; grid-template-columns: 30px repeat(31, minmax(0, 1fr)); gap: 2px; align-items: center; }
.yearstrip__m { font: 500 var(--t-1)/1 var(--f-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.yearstrip__d { aspect-ratio: 1; border-radius: 2px; background: var(--surface-3); min-height: 8px; }
.yearstrip__d.is-off { background: transparent; }
.yearstrip__d.is-on { background: var(--day-color, var(--accent)); }

/* ---------- selector de color ---------- */
.swatches { display: flex; flex-wrap: wrap; gap: var(--s2); }
.swatch {
  width: 30px; height: 30px; border-radius: var(--r-md);
  border: 2px solid transparent; cursor: pointer; padding: 0;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .12);
}
.swatch[aria-pressed="true"] { border-color: var(--ink); }

/* ---------- formularios ---------- */
.f {
  display: grid; gap: 5px; min-width: 0;
  /* `start`: sin esto, en una fila de dos campos donde uno lleva ayuda y el otro
     no, el grid reparte el alto sobrante y el control del campo sin ayuda queda
     más abajo y estirado. */
  align-content: start;
}
.f__l { font: 500 var(--t-1)/1 var(--f-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); }
.f__c {
  width: 100%; min-height: 38px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); font-size: var(--t-4);
  transition: border-color .12s var(--ease);
}
.f__c:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.f__c { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 16px) 51%, calc(100% - 11px) 51%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
textarea.f__c { resize: vertical; min-height: 64px; line-height: 1.45; }
.f__hint { font-size: var(--t-2); color: var(--ink-3); }
.f-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--s3); }
@media (max-width: 560px) { .f-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); } }

.check { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: var(--t-4); }
.check input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }

/* ---------- modal ---------- */
.modal-bg {
  position: fixed; inset: 0; z-index: 60;
  background: color-mix(in oklab, var(--ink) 42%, transparent);
  display: grid; place-items: center; padding: var(--s4);
  animation: fade .16s var(--ease);
}
.modal {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
  width: min(560px, 100%); max-height: min(86dvh, 760px);
  display: flex; flex-direction: column;
  animation: pop .18s var(--ease);
}
.modal--wide { width: min(860px, 100%); }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4); border-bottom: 1px solid var(--line); }
.modal__title { font-size: var(--t-6); font-stretch: 108%; }
.modal__body { padding: var(--s4); overflow: auto; display: grid; gap: var(--s4); }
.modal__foot { display: flex; justify-content: flex-end; gap: var(--s2); padding: var(--s3) var(--s4); border-top: 1px solid var(--line); }

@keyframes fade { from { opacity: 0 } }
@keyframes pop { from { opacity: 0; translate: 0 8px; scale: .985 } }

/* ---------- toasts ---------- */
.toast-host { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; z-index: 80; display: grid; gap: var(--s2); justify-items: center; pointer-events: none; }
.toast {
  background: var(--ink); color: var(--bg);
  padding: 9px 14px; border-radius: var(--r-md); font-size: var(--t-3); font-weight: 500;
  box-shadow: var(--shadow); animation: toastIn .2s var(--ease);
  display: flex; align-items: center; gap: 9px; pointer-events: auto;
}
.toast button { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font-size: var(--t-3); font-weight: 600; }
@keyframes toastIn { from { opacity: 0; translate: 0 10px } }

/* ---------- listas / vacíos ---------- */
.empty { text-align: center; padding: var(--s6) var(--s4); display: grid; gap: var(--s3); justify-items: center; }
.empty__ico { width: 40px; height: 40px; color: var(--ink-3); }
.empty__t { font-family: var(--f-display); font-weight: 700; font-size: var(--t-6); font-stretch: 106%; }
.empty__d { font-size: var(--t-4); color: var(--ink-2); max-width: 44ch; }

.list { display: grid; gap: var(--s2); }
.list__i {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); text-align: left; width: 100%; cursor: pointer; color: inherit;
  transition: border-color .12s var(--ease), background .12s var(--ease);
}
.list__i:hover { border-color: var(--ink-3); background: var(--surface-2); }
.list__i.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.bar-left { border-left: 3px solid var(--day-color, var(--line-2)); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font: 500 var(--t-1)/1 var(--f-mono); text-transform: uppercase; letter-spacing: .08em;
  padding: 4px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2);
}
.pill--good { color: var(--good-text); border-color: color-mix(in oklab, var(--good) 34%, var(--line)); background: var(--good-soft); }
.pill--bad { color: var(--bad-text); border-color: color-mix(in oklab, var(--bad) 34%, var(--line)); background: var(--bad-soft); }
.pill--pr { color: var(--good-text); border-color: var(--good); background: var(--good-soft); }

.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* selector de ejercicio del catálogo */
.picker { display: grid; gap: var(--s2); }
.picker__list { max-height: 46dvh; overflow: auto; display: grid; gap: 2px; padding-right: 2px; }
.picker__i {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: 9px 11px; border: 1px solid transparent; border-radius: var(--r-md);
  background: transparent; cursor: pointer; text-align: left; width: 100%; color: inherit;
}
.picker__i:hover { background: var(--surface-2); border-color: var(--line); }
.picker__grp { font: 500 var(--t-1)/1 var(--f-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); padding: var(--s3) 11px 4px; }

/* cronómetro de descanso */
.rest {
  position: fixed; left: 50%; bottom: 84px; translate: -50% 0; z-index: 50;
  display: flex; align-items: center; gap: var(--s3);
  background: var(--ink); color: var(--bg);
  padding: 9px 10px 9px 16px; border-radius: 999px; box-shadow: var(--shadow);
}
.rest__t { font-family: var(--f-display); font-weight: 700; font-size: var(--t-6); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.rest__l { font: 500 var(--t-1)/1 var(--f-mono); text-transform: uppercase; letter-spacing: .1em; opacity: .65; }
.rest button { border: 0; background: color-mix(in oklab, var(--bg) 18%, transparent); color: inherit; border-radius: 999px; padding: 6px 11px; font: 500 var(--t-2)/1 var(--f-mono); cursor: pointer; }
.rest button:hover { background: color-mix(in oklab, var(--bg) 30%, transparent); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main" "rail"; }
  .main { padding: var(--s4) var(--s3) calc(72px + env(safe-area-inset-bottom)); }
  .rail {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto;
    flex-direction: row; justify-content: space-around;
    border-right: 0; border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    max-height: none; z-index: 40;
  }
  .rail__item { flex-direction: column; gap: 3px; font-size: var(--t-1); padding: 6px 8px; flex: 1; justify-content: center; }
  .rail__item.is-active::before { left: 50%; top: -6px; translate: -50% 0; width: 22px; height: 3px; border-radius: 0 0 2px 2px; }
  .rest { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .view-title { font-size: var(--t-6); }
  /* Seis rangos no entran en 375 px. En vez de romper el control segmentado,
     la fila de filtros se desplaza sola; el cuerpo nunca scrollea de costado. */
  .view-head > .row {
    flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain;
    scrollbar-width: none; max-width: 100%; padding-bottom: 2px;
  }
  .view-head > .row::-webkit-scrollbar { display: none; }
  .view-head > .row > * { flex: none; }
  .sets__head, .set-row { grid-template-columns: 28px minmax(70px, 1fr) minmax(78px, 1.1fr) 38px 28px; gap: 6px; }
  .field__btn { width: 26px; }
  .ex__head { padding: var(--s3); grid-template-columns: 22px minmax(0, 1fr); }
  .ex__actions { grid-column: 1 / -1; }
  .ex__sets { padding: 0 var(--s3) var(--s3); }
  .ex__foot { padding: var(--s2) var(--s3) var(--s3); }
  .cal { gap: 3px; }
  .cal__cell { padding: 3px 4px; border-radius: var(--r-sm); }
  .cal__label { display: none; }
  .cal__vol { display: none; }
  .datebar__date { min-width: 0; flex: 1; }
  .yearstrip__row { grid-template-columns: 24px repeat(31, minmax(0, 1fr)); gap: 1px; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
  .kpi { padding: var(--s2) var(--s3); }
  .kpi__v { font-size: var(--t-6); }
}

@media (max-width: 420px) {
  .sets__head, .set-row { grid-template-columns: 26px minmax(56px, 1fr) minmax(64px, 1.05fr) 34px 24px; gap: 5px; }
  .inline-stats { gap: var(--s3) var(--s4); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .rail, .topbar__right, .rest { display: none; }
}


/* =========================================================================
   v2 — reps por serie, entrada en calor, extras y biblioteca de ejercicios.
   ========================================================================= */

/* ---------- etiquetas de tipo ---------- */
.tag--reps { border-color: var(--accent-line); color: var(--accent-text); }
.tag--time { border-color: color-mix(in oklab, var(--cat-5) 40%, var(--line)); color: var(--cat-5); }
.tag--pair { border-color: color-mix(in oklab, var(--cat-7) 45%, var(--line)); color: var(--cat-7); }
[data-theme="dark"] .tag--pair { color: #f0873f; border-color: #6b3d18; }
[data-theme="dark"] .tag--time { color: #b18ae8; border-color: #4b3a6b; }
.pill--extra { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-soft); }

/* ---------- editor: reps por serie ---------- */
.plan-top { display: flex; align-items: flex-end; gap: var(--s3); flex-wrap: wrap; }
.plan-reps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: var(--s2);
}
.plan-rep { display: flex; align-items: center; gap: 6px; min-width: 0; }
.plan-rep__n {
  flex: none; width: 18px; text-align: right;
  font: 500 var(--t-1)/1 var(--f-mono); color: var(--ink-3);
}
.plan-rep .field { flex: 1; min-width: 0; }
.field--compact .field__in { padding: 5px 0; font-size: var(--t-3); }
.field--compact .field__btn { width: 26px; }

/* ---------- elegir como se mide un ejercicio ---------- */
.metric-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s2); }
.metric-opt {
  text-align: left; padding: 11px 13px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); display: grid; gap: 3px;
  transition: border-color .12s var(--ease), background .12s var(--ease);
}
.metric-opt:hover { border-color: var(--ink-3); }
.metric-opt strong { font-family: var(--f-display); font-weight: 700; font-size: var(--t-4); font-stretch: 106%; }
.metric-opt span { font-size: var(--t-2); color: var(--ink-2); }
.metric-opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.metric-opt[aria-pressed="true"] strong { color: var(--accent-text); }

/* ---------- extras del dia ---------- */
.flags {
  display: flex; flex-wrap: wrap; gap: var(--s2);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--s3) var(--s4);
}
.flag {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 8px 6px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2);
  font-size: var(--t-3); font-weight: 500; color: var(--ink-2);
  transition: background .12s var(--ease), border-color .12s var(--ease), color .12s var(--ease);
}
.flag:hover { border-color: var(--ink-3); color: var(--ink); }
.flag__lbl { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding: 1px 0; }
.flag input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.flag:has(input:checked) {
  background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); font-weight: 600;
}
/* El campo de minutos aparece dentro de la píldora cuando la marcás. */
.flag__min { display: inline-flex; }
.flag__min .field {
  width: 112px; min-height: 32px;
  border-radius: 999px; background: var(--surface);
  border-color: var(--accent-line);
  /* Chrome no estira los <input> aunque el flex lo pida, así que el número
     quedaba más alto que "min" y que los botones. Centrando cada pieza el
     problema desaparece; los botones vuelven a estirarse aparte para no
     perder superficie de toque. */
  align-items: center;
}
.flag__min .field__btn { align-self: stretch; }
.flag__min .field__in { font-weight: 500; padding: 0; }
.flag__min .field__btn { width: 26px; }
.flag__min .field__unit { padding-right: 9px; }

/* ---------- entrada en calor ---------- */
.card--warmup { border-style: dashed; }
.wu-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(84px, 118px) minmax(96px, 140px) 34px 28px;
  align-items: center; gap: var(--s2);
  padding: 6px 0; border-bottom: 1px solid var(--line);
}
.wu-row:last-of-type { border-bottom: 0; }
.wu-row__n { font-size: var(--t-4); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- ultima vez / copiar pesos ---------- */
.lastrun {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3); flex-wrap: wrap;
  margin-top: 10px; padding: 8px 10px;
  border: 1px dashed var(--line-2); border-radius: var(--r-md);
  background: var(--surface-2);
}
.lastrun__txt { display: grid; gap: 3px; min-width: 0; }
.lastrun__sets { font: 500 var(--t-3)/1.3 var(--f-mono); color: var(--ink); }
.lastrun__sets .dim { font-size: var(--t-1); }

/* ---------- serie tachada / agregada ---------- */
.set-row.is-skipped { opacity: .62; }
.set-row.is-skipped .set-row__n { color: var(--bad-text); text-decoration: line-through; }
.set-row.is-skipped .field { background: var(--bad-soft); border-color: color-mix(in oklab, var(--bad) 26%, var(--line)); }
.set-row.is-skipped .field__in { text-decoration: line-through; color: var(--ink-2); }
.set-row.is-skipped .set-check { opacity: .5; }
.set-row.is-skipped::after {
  content: ""; position: absolute; left: 30px; right: 0; top: 50%;
  height: 1px; background: color-mix(in oklab, var(--bad) 55%, transparent);
  pointer-events: none;
}
.set-row__del[aria-pressed="true"] { background: var(--bad-soft); color: var(--bad-text); }

/* ---------- biblioteca de ejercicios ---------- */
.filters { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.filters .f__c { flex: 1 1 200px; min-width: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface);
  font-size: var(--t-3); color: var(--ink-2);
  transition: background .12s var(--ease), border-color .12s var(--ease), color .12s var(--ease);
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); font-weight: 600; }
.chip__n { font: 500 var(--t-1)/1 var(--f-mono); color: var(--ink-3); }
.chip[aria-pressed="true"] .chip__n { color: inherit; }

.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s3); }
.ex-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--s3) var(--s4);
  display: grid; gap: 10px; align-content: start;
  transition: border-color .12s var(--ease);
}
.ex-card:hover { border-color: var(--ink-3); }
.ex-card.is-archived { border-style: dashed; background: var(--surface-2); }
.ex-card.is-archived .ex-card__name { color: var(--ink-2); }
.ex-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s2); }
.ex-card__name {
  font-family: var(--f-display); font-weight: 700; font-size: var(--t-5);
  font-stretch: 106%; letter-spacing: -.01em; min-width: 0;
}
.ex-card__foot { border-top: 1px solid var(--line); padding-top: 8px; }
.ex-card .icon-btn { width: 30px; height: 30px; }
.ex-card .icon-btn svg { width: 16px; height: 16px; }

@media (max-width: 900px) {
  .plan-reps { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .ex-grid { grid-template-columns: minmax(0, 1fr); }
  .flags { padding: var(--s2) var(--s3); }
  .flag { flex: 1 1 100%; justify-content: space-between; }
  /* La píldora ocupa la fila entera, así que los +/− pueden ser cómodos. */
  .flag__min .field { width: 136px; min-height: 38px; }
  .flag__min .field__btn { width: 34px; }
  .wu-row {
    grid-template-columns: minmax(0, 1fr) 32px 26px;
    grid-template-areas: "nombre hecha borrar" "series reps reps";
    row-gap: 6px;
  }
  .wu-row__n { grid-area: nombre; }
  .wu-row .field:nth-of-type(1) { grid-area: series; }
  .wu-row .field:nth-of-type(2) { grid-area: reps; }
  .wu-row .set-check { grid-area: hecha; }
  .wu-row .set-row__del { grid-area: borrar; }
}

/* =========================================================================
   Sincronización
   El indicador NO muestra un "todo bien" permanente: un semáforo que dice que
   está OK el 99% del tiempo entrena a no mirarlo. Muestra lo que todavía no
   salió de este dispositivo, y cuando no hay nada pendiente se apaga.
   Los colores salen de los tokens de estado, nunca de los discos: ahí el color
   ES un peso (norma IWF) y reusarlo rompería la lectura de los gráficos.
   ========================================================================= */
.sync {
  display: inline-flex; align-items: center; gap: 5px;
  height: 36px; padding: 0 var(--s2);
  border: 1px solid transparent; border-radius: var(--r-md);
  background: transparent; color: var(--ink-3); cursor: pointer;
  font: 600 var(--t-2)/1 var(--f-body);
  transition: background .14s var(--ease), color .14s var(--ease);
}
.sync:hover { background: var(--surface-2); color: var(--ink); }
.sync__ico { width: 18px; height: 18px; display: block; }
.sync__n {
  font-family: var(--f-mono); font-variant-numeric: tabular-nums;
  font-size: var(--t-1); line-height: 1;
}
.sync__t { font-size: var(--t-2); }

.sync[data-fase="pendiente"] { color: var(--warn-text); }
.sync[data-fase="error"]     { color: var(--bad-text); background: var(--bad-soft); }
.sync[data-fase="al-dia"]    { color: var(--ink-3); }

/* "Yendo" se muestra con opacidad, no con un giro: la nube es una silueta y
   rotarla se lee como un error de dibujo, no como actividad. */
.sync[data-fase="yendo"] .sync__ico { animation: sync-late 1.1s var(--ease) infinite; }
@keyframes sync-late { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

@media (prefers-reduced-motion: reduce) {
  .sync[data-fase="yendo"] .sync__ico { animation: none; opacity: .55; }
}
