:root {
  color-scheme: dark;
  --bg: #121211;
  --surface-1: #1a1a19;
  --surface-2: #232321;
  --surface-3: #2e2e2b;
  --border: #34342f;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #8d8c84;
  --accent: #d4f53c;          /* volt: botones y estados de la UI */
  --accent-ink: #151a00;
  --done: #3fbf7f;
  --danger: #e66767;
  --series-1: #3987e5;        /* serie de datos (dark) */
  --grid: #2c2c29;
  --seq-1: #184f95;
  --seq-2: #256abf;
  --seq-3: #3987e5;
  --seq-4: #86b6ef;
  --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text-primary); font-family: var(--font); }
body { -webkit-tap-highlight-color: transparent; min-height: 100vh; }
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.error { color: var(--danger); min-height: 1.2em; margin: 0; font-size: .9rem; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: var(--text-primary); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Marca ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; font-size: 1.1rem; }
.brand-mark {
  width: 22px; height: 10px; border-radius: 3px; background: var(--accent); position: relative;
  box-shadow: -7px 0 0 -2px var(--accent), 7px 0 0 -2px var(--accent);
}

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 20px; padding: 28px; display: grid; gap: 14px; }

/* ---------- Layout ---------- */
.app { max-width: 860px; margin: 0 auto; padding: env(safe-area-inset-top) 16px calc(130px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 10px; }
.sync-pill { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; font-size: .8rem; color: var(--text-secondary); }
.sync-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.sync-pill[data-state="ok"] .dot { background: var(--done); }
.sync-pill[data-state="pending"] .dot { background: #e0a400; }
.sync-pill[data-state="error"] .dot { background: var(--danger); }
.sync-pill[data-state="syncing"] .dot { background: var(--series-1); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.tabs { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.tab { background: none; border: 0; border-radius: 9px; padding: 10px 4px; font-weight: 600; color: var(--text-secondary); font-size: .92rem; }
.tab.active { background: var(--surface-3); color: var(--text-primary); }

/* ---------- Botones y campos ---------- */
.btn { border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: 10px 14px; font-weight: 600; }
.btn:hover { background: var(--surface-3); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-primary:hover { background: #e2ff5c; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: .85rem; border-radius: 8px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font-size: 1.1rem; }

.field { display: grid; gap: 6px; font-size: .85rem; color: var(--text-secondary); }
.field input, .field select, select.input, input.input {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Día ---------- */
.day-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.day-nav .date { flex: 1; text-align: center; }
.day-nav .date strong { display: block; font-size: 1.05rem; }
.day-nav .date small { color: var(--text-muted); }
.chip { display: inline-block; font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.chip.today { background: var(--accent); color: var(--accent-ink); }

.day-head { margin: 18px 0 14px; }
.day-head h1 { font-size: 1.9rem; letter-spacing: -.03em; margin: 0 0 10px; }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.progress-text { font-size: .85rem; color: var(--text-secondary); margin-top: 6px; }

.rest-day { text-align: center; padding: 60px 20px; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); }
.rest-day h1 { margin: 0 0 8px; }

/* ---------- Tarjeta de ejercicio ---------- */
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card.complete { border-color: #2f5e45; }
.ex-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ex-head h2 { font-size: 1.15rem; margin: 0; letter-spacing: -.01em; }
.ex-meta { color: var(--text-muted); font-size: .85rem; margin-top: 3px; }
.ex-badge { font-size: .75rem; color: var(--done); font-weight: 700; white-space: nowrap; }
.ex-note { margin: 10px 0 0; font-size: .85rem; color: var(--text-secondary); }
.ex-note summary { cursor: pointer; color: var(--text-muted); }
.ex-note p { margin: 6px 0 0; line-height: 1.45; }
.ex-controls { display: grid; grid-template-columns: 1fr 120px; gap: 10px; margin-top: 12px; }
.ex-controls.single { grid-template-columns: 1fr; }
.ex-last { margin-top: 12px; font-size: .85rem; color: var(--text-secondary); }
.ex-last b { color: var(--text-primary); font-weight: 600; }
.tip { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: #26300a; color: #e6f7a6; font-size: .85rem; line-height: 1.4; }

.sets { margin-top: 12px; display: grid; gap: 8px; }
.set { display: grid; grid-template-columns: 70px minmax(0, 1fr) 44px; align-items: center; gap: 10px; padding: 6px 6px 6px 10px; background: var(--surface-2); border-radius: 12px; border: 1px solid transparent; }
.set.done { border-color: #2f5e45; background: #17251d; }
.set-label { font-size: .8rem; color: var(--text-secondary); line-height: 1.15; }
.set-label small { display: block; color: var(--text-muted); font-size: .72rem; }
.stepper { display: grid; grid-template-columns: 40px 1fr 40px; gap: 6px; align-items: center; }
.stepper button { height: 40px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-3); font-size: 1.15rem; }
.stepper input { text-align: center; height: 40px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-1); width: 100%; font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input::placeholder { color: var(--text-muted); font-weight: 500; }
.check { width: 44px; height: 44px; border-radius: 11px; border: 2px solid var(--border); background: var(--surface-1); display: grid; place-items: center; font-size: 1.2rem; color: transparent; }
.set.done .check { background: var(--done); border-color: var(--done); color: #08130d; }
.hold { display: flex; align-items: center; gap: 8px; }
.hold-btn { height: 40px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-3); font-weight: 700; white-space: nowrap; }
.hold-btn.running { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.hold { min-width: 0; }
.hold-btn { flex: 1; min-width: 0; font-family: var(--mono); overflow: hidden; font-size: 1rem; }
.hold input { width: 64px; flex: none; text-align: center; height: 40px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-1); font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.hold input::placeholder { color: var(--text-muted); font-weight: 500; }

.cardio-grid { display: grid; grid-template-columns: 1fr 1fr 48px; gap: 10px; align-items: end; margin-top: 12px; }
.cardio-grid .check { margin-bottom: 0; }

.finish { margin: 20px 0; }

/* ---------- Temporizador ---------- */
.rest { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); width: min(820px, calc(100% - 24px)); background: var(--surface-3); border: 1px solid #45453f; border-radius: 18px; overflow: hidden; z-index: 20; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.rest-bar { height: 5px; background: #3a3a35; }
.rest-fill { height: 100%; background: var(--accent); width: 100%; }
.rest-body { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.rest-label { font-size: .75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.rest-time { font-family: var(--mono); font-size: 2.2rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.rest-actions { display: flex; gap: 6px; }
.rest.finished { background: #3a4a0c; border-color: var(--accent); }
.rest.finished .rest-label { color: var(--accent); }

/* ---------- Progreso ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.tile-label { font-size: .78rem; color: var(--text-secondary); }
.tile-value { font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.section-title h2 { font-size: 1.05rem; margin: 0; }
.section-sub { color: var(--text-muted); font-size: .82rem; margin: -4px 0 10px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select { width: auto; padding: 7px 10px; font-size: .88rem; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 2px; }
.seg button { border: 0; background: none; padding: 6px 10px; border-radius: 7px; font-size: .85rem; color: var(--text-secondary); }
.seg button.on { background: var(--surface-3); color: var(--text-primary); }
.chart { width: 100%; position: relative; touch-action: pan-y; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart-empty { padding: 40px 10px; text-align: center; color: var(--text-muted); font-size: .9rem; }
.axis text { fill: var(--text-muted); font-size: 11px; font-family: var(--font); }
.heat-wrap { overflow-x: auto; }
.heat-legend { display: flex; align-items: center; gap: 4px; font-size: .75rem; color: var(--text-muted); margin-top: 8px; justify-content: flex-end; }
.heat-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.weight-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; margin-bottom: 12px; }

table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data th { text-align: left; color: var(--text-muted); font-weight: 600; padding: 8px 6px; border-bottom: 1px solid var(--border); }
table.data td { padding: 8px 6px; border-bottom: 1px solid var(--grid); color: var(--text-secondary); vertical-align: top; }
table.data td:first-child { color: var(--text-primary); white-space: nowrap; }
.table-scroll { max-height: 360px; overflow: auto; }
.link-btn { background: none; border: 0; color: var(--text-muted); padding: 0 4px; }
.link-btn:hover { color: var(--danger); }

.tooltip { position: fixed; pointer-events: none; z-index: 30; background: #0b0b0b; color: var(--text-primary); border: 1px solid #45453f; border-radius: 8px; padding: 7px 10px; font-size: .8rem; line-height: 1.35; opacity: 0; transform: translate(-50%, calc(-100% - 10px)); transition: opacity .1s; white-space: nowrap; }
.tooltip.show { opacity: 1; }
.tooltip b { font-variant-numeric: tabular-nums; }

/* ---------- Ajustes ---------- */
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--grid); }
.settings-row:last-child { border-bottom: 0; }
.settings-row p { margin: 2px 0 0; font-size: .82rem; color: var(--text-muted); }
.toggle { position: relative; width: 46px; height: 28px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span { position: absolute; inset: 0; background: var(--surface-3); border-radius: 99px; transition: .2s; }
.toggle span::before { content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; background: var(--text-secondary); border-radius: 50%; transition: .2s; }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::before { transform: translateX(18px); background: var(--accent-ink); }

.toast { position: fixed; left: 50%; top: 18px; transform: translate(-50%, -20px); background: var(--text-primary); color: #111; padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: .9rem; opacity: 0; transition: .2s; z-index: 40; pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .day-head h1 { font-size: 1.6rem; }
  .rest-time { font-size: 1.9rem; }
  .rest-actions .btn { padding: 10px 11px; }
  .weight-form { grid-template-columns: 1fr 1fr; }
  .weight-form .btn { grid-column: span 2; }
}

/* ================= v2 ================= */
.topbar-right { display: flex; align-items: center; gap: 10px; }
.whoami { font-size: .82rem; color: var(--text-muted); }
@media (max-width: 480px) { .whoami { display: none; } .tab { font-size: .8rem; padding: 9px 2px; } }

/* Caja de objetivo */
.target { margin-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: 12px; background: rgba(212, 245, 60, .07); border: 1px solid rgba(212, 245, 60, .38); }
.target-label { font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.target-main { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.target-main small { font-size: .85rem; font-weight: 600; color: var(--text-secondary); letter-spacing: 0; }
.target-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.target-chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 999px; background: rgba(212, 245, 60, .14); color: #e9f9a8; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.opt-chip { background: var(--surface-3); color: var(--text-secondary); }

.day-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.empty-state { text-align: center; padding: 40px 20px; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); }
.empty-state h2 { margin: 0 0 8px; }
.empty-state p { color: var(--text-secondary); margin: 0 0 16px; }
.readonly-banner { background: #1d2a3d; border: 1px solid #2e4a6f; color: #cfe2fb; padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; font-size: .9rem; display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Listas y tarjetas de rutina */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-block; font-size: .7rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; vertical-align: middle; }
.badge-accent { background: var(--accent); color: var(--accent-ink); }
.badge-blue { background: #1c3a63; color: #b7d3f6; }
.badge-muted { background: var(--surface-3); color: var(--text-secondary); }
.badge-danger { background: #4a1f1f; color: #f3b3b3; }
.routine-card h3 { margin: 0; font-size: 1.1rem; }
.routine-card p { margin: 6px 0 0; color: var(--text-secondary); font-size: .88rem; }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 12px; }
.week-strip div { min-width: 0; overflow-wrap: anywhere; hyphens: auto; line-height: 1.25; background: var(--surface-2); border-radius: 8px; padding: 6px 3px; text-align: center; font-size: .66rem; color: var(--text-muted); min-height: 52px; }
.week-strip b { display: block; color: var(--text-secondary); font-size: .72rem; margin-bottom: 3px; }
.week-strip .on { background: #26300a; color: #e6f7a6; }
.list { display: grid; gap: 8px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; }
.list-row > div:first-child { min-width: 0; }
.list-row > .actions { flex-wrap: nowrap; flex-shrink: 0; }
.list-row .title { font-weight: 600; }
.list-row .sub { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }
.icon-sm { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-3); font-size: .95rem; padding: 0; }
.icon-sm:disabled { opacity: .3; cursor: default; }
.type-tag { font-size: .7rem; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-secondary); margin-left: 6px; vertical-align: middle; }

/* Editor */
.editor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.editor-head h1 { margin: 0; font-size: 1.4rem; flex: 1; }
.workout-block { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.workout-block .wname { font-size: 1.05rem; font-weight: 700; }
.sched-grid { display: grid; gap: 8px; }
.sched-row { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 10px; }
.sticky-save { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); display: flex; gap: 10px; justify-content: flex-end; padding: 12px; background: rgba(18,18,17,.92); backdrop-filter: blur(6px); border: 1px solid var(--border); border-radius: 14px; margin-top: 16px; z-index: 6; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.check-line { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--text-secondary); padding: 6px 0; cursor: pointer; }
.check-line input { width: 18px; height: 18px; accent-color: var(--accent); }
textarea.input { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; width: 100%; min-height: 80px; resize: vertical; font: inherit; color: var(--text-primary); }
.hint { font-size: .8rem; color: var(--text-muted); margin: 4px 0 0; line-height: 1.4; }
.label-row { display: grid; grid-template-columns: 1fr 1fr 34px; gap: 8px; align-items: center; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface-1); border: 1px solid var(--border); border-radius: 18px; padding: 20px; display: grid; gap: 14px; }
.modal h2 { margin: 0; font-size: 1.2rem; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@media (max-width: 640px) { .modal-backdrop { place-items: end center; padding: 0; } .modal { border-radius: 18px 18px 0 0; max-height: 92vh; } }
.code-big { font-family: var(--mono); font-size: 2rem; font-weight: 800; letter-spacing: .12em; text-align: center; padding: 16px; background: var(--surface-2); border-radius: 12px; color: var(--accent); }
.preview-box { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; font-size: .88rem; color: var(--text-secondary); }
.preview-box h3 { margin: 0 0 6px; color: var(--text-primary); font-size: 1rem; }
.preview-box ul { margin: 6px 0 0; padding-left: 18px; }
.picker-list { display: grid; gap: 6px; max-height: 300px; overflow: auto; }
.picker-list button { text-align: left; background: var(--surface-2); border: 1px solid transparent; border-radius: 10px; padding: 10px 12px; }
.picker-list button:hover { border-color: var(--accent); }

/* Ranking */
.rank-table { width: 100%; border-collapse: collapse; }
.rank-table td { padding: 12px 8px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.rank-table tr.me td { background: rgba(212, 245, 60, .06); }
.rank-pos { width: 40px; font-weight: 800; font-size: 1.1rem; color: var(--text-muted); text-align: center; }
.rank-pos.top { color: var(--accent); }
.rank-name { font-weight: 600; }
.rank-name small { display: block; font-weight: 400; color: var(--text-muted); font-size: .78rem; }
.rank-val { text-align: right; font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-val small { font-size: .75rem; font-weight: 600; color: var(--text-muted); }
.badges { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.badge-card { background: var(--surface-2); border-radius: 12px; padding: 12px; text-align: center; border: 1px solid transparent; }
.badge-card .ico { font-size: 1.8rem; }
.badge-card .name { font-weight: 700; font-size: .9rem; margin-top: 4px; }
.badge-card .desc { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.badge-card.locked { opacity: .4; filter: grayscale(1); }
.badge-card.unlocked { border-color: rgba(212, 245, 60, .4); }

.user-card .meta { font-size: .82rem; color: var(--text-muted); margin-top: 4px; }
.spinner { padding: 30px; text-align: center; color: var(--text-muted); }

/* ================= Movimiento y diálogos ================= */
:root {
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --danger-solid: #d94848;
}

/* Interacción táctil: respuesta inmediata al presionar */
.btn, .tab, .icon-btn, .icon-sm, .check, .stepper button, .hold-btn, .seg button, .picker-list button, .sync-pill {
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s var(--ease-out), opacity .18s ease, box-shadow .18s ease;
}
.btn:active:not(:disabled), .icon-btn:active, .icon-sm:active:not(:disabled), .stepper button:active, .hold-btn:active, .seg button:active, .picker-list button:active { transform: scale(.96); }
.check:active { transform: scale(.9); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-danger-solid { background: var(--danger-solid); color: #fff; border-color: transparent; }
.btn-danger-solid:hover:not(:disabled) { background: #e65b5b; }

/* Pestañas con indicador deslizante */
.tabs { position: sticky; }
.tab { position: relative; z-index: 1; }
.tab.active { background: transparent; }
.tab-ind { position: absolute; top: 4px; left: 4px; height: calc(100% - 8px); width: 0; background: var(--surface-3); border-radius: 9px; transition: transform .42s var(--ease-out), width .42s var(--ease-out); z-index: 0; }

/* Entrada de vistas: los bloques suben en cascada */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.view.enter > * { animation: rise .5s var(--ease-out) both; }
.view.enter > *:nth-child(2) { animation-delay: 40ms; }
.view.enter > *:nth-child(3) { animation-delay: 80ms; }
.view.enter > *:nth-child(4) { animation-delay: 120ms; }
.view.enter > *:nth-child(5) { animation-delay: 160ms; }
.view.enter > *:nth-child(6) { animation-delay: 200ms; }
.view.enter > *:nth-child(n+7) { animation-delay: 240ms; }
.view.enter .tiles .tile { animation: rise .5s var(--ease-out) both; }
.view.enter .tiles .tile:nth-child(2) { animation-delay: 60ms; }
.view.enter .tiles .tile:nth-child(3) { animation-delay: 120ms; }
.view.enter .tiles .tile:nth-child(4) { animation-delay: 180ms; }
.login-card { animation: rise .6s var(--ease-out) both; }

/* Modales y diálogos */
@keyframes backdropIn { from { opacity: 0; } }
@keyframes backdropOut { to { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes modalOut { to { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes sheetIn { from { transform: translateY(100%); } }
@keyframes sheetOut { to { transform: translateY(100%); } }
.modal-backdrop { animation: backdropIn .25s ease both; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.modal-backdrop .modal { animation: modalIn .38s var(--ease-out) both; box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.modal-backdrop.closing { animation: backdropOut .22s ease both; }
.modal-backdrop.closing .modal { animation: modalOut .22s var(--ease-in) both; }
@media (max-width: 640px) {
  .modal-backdrop .modal { animation: sheetIn .42s var(--ease-out) both; }
  .modal-backdrop.closing .modal { animation: sheetOut .22s var(--ease-in) both; }
  .modal-backdrop.dialog { place-items: center; padding: 16px; }
  .modal-backdrop.dialog .modal { border-radius: 18px; animation: modalIn .38s var(--ease-out) both; }
  .modal-backdrop.dialog.closing .modal { animation: modalOut .22s var(--ease-in) both; }
}
body.modal-open { overflow: hidden; }
.dialog .modal { max-width: 460px; }
.dialog-head { display: flex; align-items: center; gap: 12px; }
.dialog-head h2 { font-size: 1.15rem; line-height: 1.25; }
.dialog-icon { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 900; font-size: 1.15rem; background: rgba(212, 245, 60, .14); color: var(--accent); animation: iconPop .5s var(--ease-spring) .08s both; }
.dialog-icon.danger { background: rgba(230, 103, 103, .16); color: var(--danger); }
@keyframes iconPop { from { transform: scale(.4) rotate(-12deg); opacity: 0; } }
.dialog-msg { color: var(--text-secondary); font-size: .92rem; line-height: 1.5; }
.dialog-msg p { margin: 0 0 8px; }
.dialog-msg p:last-child { margin-bottom: 0; }
.dialog-msg b { color: var(--text-primary); }
.impact { margin: 6px 0 10px; padding: 10px 12px 10px 30px; background: rgba(230, 103, 103, .08); border: 1px solid rgba(230, 103, 103, .25); border-radius: 10px; display: grid; gap: 4px; }
.impact li::marker { color: var(--danger); }
.mono { font-family: var(--mono); }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px; border: 1px solid rgba(230, 103, 103, .35); border-radius: 12px; background: rgba(230, 103, 103, .06); }

/* Toast con resorte */
.toast { transition: opacity .25s ease, transform .45s var(--ease-spring); transform: translate(-50%, -24px) scale(.96); }
.toast.show { transform: translate(-50%, 0) scale(1); }

/* Temporizador: entra y sale deslizando */
.rest { transition: transform .5s var(--ease-out), opacity .3s ease, background-color .3s ease, border-color .3s ease; }
.rest.off { transform: translate(-50%, calc(100% + 40px)); opacity: 0; pointer-events: none; }
.rest-fill { transition: width .25s linear; }
.rest.finished .rest-time { animation: pulseTime .9s ease-in-out infinite; }
@keyframes pulseTime { 50% { transform: scale(1.06); color: var(--accent); } }

/* Series: confirmación con rebote */
.set { transition: background-color .3s ease, border-color .3s ease; }
.check { transition: background-color .25s ease, border-color .25s ease, color .2s ease, transform .18s var(--ease-out); }
.set.pop .check { animation: checkPop .5s var(--ease-spring); }
.set.pop { animation: rowFlash .7s ease; }
.set.unpop .check { animation: checkOut .25s ease; }
@keyframes checkPop { 0% { transform: scale(.6); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes checkOut { 50% { transform: scale(.85); } }
@keyframes rowFlash { 0% { background: #22442f; } 100% { background: #17251d; } }
.card { transition: border-color .4s ease; }
.card.celebrate { animation: celebrate .8s var(--ease-out); }
.card.celebrate .ex-badge { display: inline-block; animation: badgePop .6s var(--ease-spring); }
@keyframes celebrate { 0% { box-shadow: 0 0 0 0 rgba(63, 191, 127, .55); } 100% { box-shadow: 0 0 0 14px rgba(63, 191, 127, 0); } }
@keyframes badgePop { from { transform: scale(.3); opacity: 0; } }
.progress > div { transition: width .7s var(--ease-out); }

/* Detalles desplegables */
details[open] > :not(summary) { animation: rise .35s var(--ease-out); }
summary { transition: color .2s ease; }
summary:hover { color: var(--text-secondary); }

/* Gráficos */
.draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s var(--ease-out) .1s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.dot-in { opacity: 0; animation: dotIn .4s var(--ease-spring) forwards; animation-delay: calc(var(--d, 0ms) + 200ms); transform-box: fill-box; transform-origin: center; }
@keyframes dotIn { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: scale(1); } }
.bar { transition: opacity .2s ease; }
.grow { transform-box: fill-box; transform-origin: bottom; animation: grow .7s var(--ease-out) both; animation-delay: var(--d, 0ms); }
@keyframes grow { from { transform: scaleY(0); } }
.cell-in { animation: cellIn .45s var(--ease-out) both; animation-delay: var(--d, 0ms); transform-box: fill-box; transform-origin: center; }
@keyframes cellIn { from { opacity: 0; transform: scale(.4); } }
.tooltip { transition: opacity .15s ease, transform .2s var(--ease-out); }
.tooltip:not(.show) { transform: translate(-50%, calc(-100% - 4px)); }

/* Pantallas vacías y spinner */
.spinner::before { content: ''; display: block; width: 26px; height: 26px; margin: 0 auto 10px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  .draw { stroke-dashoffset: 0; }
  .dot-in { opacity: 1; }
}
