/* ==========================================================================
   TotalSwim2000 — MicroApp
   Hoja de estilos única · diseño premium, minimalista, responsive
   ========================================================================== */

/* ---------- 1. Reset básico ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p, figure { margin: 0; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---------- 2. Tokens de diseño ---------- */
:root {
  color-scheme: light;
  --bg: #F5F7FB;
  --surface: #FFFFFF;
  --surface-2: #EEF2F8;
  --surface-3: #E4E9F1;
  --border: rgba(11, 31, 58, .09);

  --ink-1: #101A2E;
  --ink-2: #54607A;
  --ink-3: #8D97AC;

  --brand: #0B1F3A;
  --brand-2: #14335C;
  --accent: #2E7DE1;
  --accent-2: #63A6FF;
  --accent-soft: #E7F0FE;
  --danger: #E0313F;
  --danger-soft: #FCEAEC;
  --success: #12925F;
  --success-soft: #E5F6EE;
  --warning: #B87706;
  --warning-soft: #FCF0DA;

  --cta: #C6F84C;
  --cta-2: #A9E62E;
  --cta-ink: #12123C;

  --sidebar-bg: linear-gradient(190deg, #0C2142 0%, #081527 100%);
  --sidebar-ink: rgba(255, 255, 255, .68);
  --sidebar-ink-active: #FFFFFF;
  --sidebar-active-bg: rgba(255, 255, 255, .09);
  --sidebar-border: rgba(255, 255, 255, .08);

  --shadow-sm: 0 1px 2px rgba(16, 25, 43, .05), 0 1px 1px rgba(16, 25, 43, .04);
  --shadow-md: 0 10px 28px rgba(16, 25, 43, .09);
  --shadow-lg: 0 24px 56px rgba(16, 25, 43, .16);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --sidebar-w: 264px;
  --topbar-h: 68px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E1030;
  --surface: #171A46;
  --surface-2: #1E2354;
  --surface-3: #272C62;
  --border: rgba(255, 255, 255, .09);

  --ink-1: #F5F6FF;
  --ink-2: #AEB4D8;
  --ink-3: #7C82AC;

  --brand: #0B1F3A;
  --brand-2: #14335C;
  --accent: #4C7BFF;
  --accent-2: #7FA6FF;
  --accent-soft: rgba(76, 123, 255, .16);
  --danger: #FF6B76;
  --danger-soft: rgba(255, 107, 118, .14);
  --success: #37C98D;
  --success-soft: rgba(55, 201, 141, .14);
  --warning: #F0B429;
  --warning-soft: rgba(240, 180, 41, .14);

  --sidebar-bg: linear-gradient(190deg, #14173E 0%, #090B22 100%);
  --sidebar-ink: rgba(255, 255, 255, .62);
  --sidebar-ink-active: #FFFFFF;
  --sidebar-active-bg: rgba(255, 255, 255, .07);
  --sidebar-border: rgba(255, 255, 255, .07);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, .38);
  --shadow-lg: 0 24px 56px rgba(0, 0, 0, .5);
}

body {
  background: var(--bg);
  color: var(--ink-1);
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s var(--ease), color .35s var(--ease);
}

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.01em; font-weight: 700; color: var(--ink-1); }

.icon { flex-shrink: 0; }

/* ---------- 3. Utilidades ---------- */
.hidden { display: none !important; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.text-sm { font-size: .82rem; }
.text-xs { font-size: .74rem; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .4rem; } .gap-2 { gap: .8rem; } .gap-3 { gap: 1.2rem; }
.grow { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ---------- 4. Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  padding: .85rem 1.4rem; border-radius: var(--radius-pill);
  font-weight: 600; font-size: .92rem; white-space: nowrap;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background-color .18s var(--ease), opacity .18s;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-lg { padding: 1rem 1.7rem; font-size: 1rem; width: 100%; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-accent { background: linear-gradient(135deg, var(--cta), var(--cta-2)); color: var(--cta-ink); box-shadow: var(--shadow-sm); }
.btn-accent:hover:not(:disabled) { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-ghost { background: var(--surface-2); color: var(--ink-1); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--ink-1); }
.btn-outline:hover { border-color: var(--ink-3); }
.btn-danger-outline { background: transparent; border: 1.5px solid var(--danger); color: var(--danger); }
.btn-danger-outline:hover { background: var(--danger-soft); }
.btn-sm { padding: .55rem 1rem; font-size: .82rem; }
.btn-icon {
  width: 42px; height: 42px; border-radius: 50%; background: var(--surface-2); color: var(--ink-1);
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  transition: background-color .18s, transform .18s;
}
.btn-icon:hover { background: var(--surface-3); }
.btn-icon:active { transform: scale(.92); }

/* ---------- 5. Layout raíz ---------- */
#app { min-height: 100vh; }

.onboarding-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 1.5rem; position: relative; overflow: hidden;
  background: radial-gradient(circle at 15% 20%, rgba(46,125,225,.16), transparent 55%),
              radial-gradient(circle at 85% 85%, rgba(230,49,63,.12), transparent 45%),
              var(--bg);
}
.onboarding-card {
  width: 100%; max-width: 460px; background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 2.4rem 2rem; position: relative; z-index: 1;
  animation: cardIn .5s var(--ease);
}
@media (min-width: 640px) { .onboarding-card { padding: 3rem 2.6rem; } }

.brand-mark { display: flex; align-items: center; justify-content: center; gap: .65rem; margin-bottom: 1.6rem; }
.logo-chip {
  background: #fff; border-radius: 10px; padding: 5px 7px; display: inline-flex; align-items: center;
  flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.logo-chip-lockup { padding: 8px 12px; border-radius: 12px; }
.brand-mark-img { height: 22px; width: auto; display: block; }
.brand-lockup-img { width: 150px; height: auto; display: block; }

.onb-progress { display: flex; gap: .4rem; margin-bottom: 1.8rem; }
.onb-progress .seg { flex: 1; height: 5px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
.onb-progress .seg i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s var(--ease); border-radius: var(--radius-pill); }
.onb-progress .seg.done i { width: 100%; }
.onb-progress .seg.active i { width: 55%; animation: pulseWidth 1.4s ease-in-out infinite; }

@keyframes pulseWidth { 0%,100% { width: 45%; } 50% { width: 65%; } }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

.onb-step { animation: stepIn .4s var(--ease); }
@keyframes stepIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.onb-step h2 { font-size: 1.5rem; margin-bottom: .4rem; }
.onb-step .step-sub { color: var(--ink-2); margin-bottom: 1.6rem; font-size: .92rem; }

.field { margin-bottom: 1.2rem; }
.field label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-2); margin-bottom: .5rem; }
.field input[type="text"], .field input[type="number"], .field input[type="date"],
.field input[type="time"], .field select, .field textarea {
  width: 100%; padding: .9rem 1rem; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--surface-2); color: var(--ink-1); font-size: 1rem; transition: border-color .18s, background-color .18s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); background: var(--surface); }
.field textarea { resize: vertical; min-height: 84px; }
.field-hint { font-size: .76rem; color: var(--ink-3); margin-top: .4rem; }
.field-error { font-size: .78rem; color: var(--danger); margin-top: .4rem; display: none; }
.field.has-error input, .field.has-error select { border-color: var(--danger); background: var(--danger-soft); }
.field.has-error .field-error { display: block; }

.name-hero-icon { width: 68px; height: 68px; border-radius: 20px; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 1.4rem; }

.welcome-flash {
  position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(190deg, #14173E, #090B22); color: #fff; text-align: center; padding: 2rem;
  animation: fadeIn .35s var(--ease);
}
.welcome-flash .wf-icon { width: 84px; height: 84px; border-radius: 24px; background: rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center; margin-bottom: 1.4rem; animation: popIn .5s var(--ease); color: var(--accent-2); }
.welcome-flash h1 { font-size: 1.9rem; color: #fff; }
.welcome-flash p { color: rgba(255,255,255,.68); margin-top: .5rem; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }

/* Chips de selección (objetivo, tier, nivel, días, implementos) */
.chip-grid { display: grid; grid-template-columns: 1fr; gap: .7rem; }
@media (min-width: 480px) { .chip-grid.cols-2 { grid-template-columns: 1fr 1fr; } }
.chip-card {
  display: flex; align-items: flex-start; gap: .8rem; padding: 1rem 1.1rem; border-radius: var(--radius-md);
  border: 1.6px solid var(--border); background: var(--surface-2); text-align: left; transition: all .18s var(--ease); width: 100%;
}
.chip-card:hover { border-color: var(--accent-2); transform: translateY(-1px); }
.chip-card.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--shadow-sm); }
.chip-card .chip-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--surface); color: var(--accent);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.chip-card.selected .chip-ic { background: var(--accent); color: #fff; }
.chip-card .chip-title { font-weight: 700; font-size: .95rem; }
.chip-card .chip-desc { font-size: .8rem; color: var(--ink-2); margin-top: .15rem; }

.day-toggle-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .4rem; }
.day-toggle {
  aspect-ratio: 1; border-radius: 12px; border: 1.6px solid var(--border); background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; color: var(--ink-2);
  transition: all .16s var(--ease);
}
.day-toggle.selected { background: var(--brand); color: #fff; border-color: var(--brand); }
.day-toggle:disabled { opacity: .35; }

/* Tabla / tarjetas de tiers */
.tier-list { display: flex; flex-direction: column; gap: .8rem; }
.tier-card {
  border: 1.8px solid var(--border); border-radius: var(--radius-md); padding: 1.1rem 1.2rem;
  display: flex; align-items: center; gap: 1rem; background: var(--surface-2); position: relative; transition: all .18s var(--ease); width: 100%; text-align: left;
}
.tier-card:hover { transform: translateY(-1px); border-color: var(--accent-2); }
.tier-card.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--shadow-sm); }
.tier-card .tier-price { font-size: 1.5rem; font-weight: 800; color: var(--brand); flex-shrink: 0; min-width: 78px; }
:root[data-theme="dark"] .tier-card .tier-price { color: var(--ink-1); }
.tier-card .tier-price small { font-size: .7rem; font-weight: 600; color: var(--ink-3); display: block; }
.tier-card .tier-info { flex: 1; }
.tier-card .tier-info .t-days { font-weight: 700; font-size: .92rem; }
.tier-card .tier-info .t-freq { font-size: .8rem; color: var(--ink-2); }
.tier-tag { position: absolute; top: -10px; right: 14px; background: var(--danger); color: #fff; font-size: .68rem;
  font-weight: 700; padding: .25rem .6rem; border-radius: var(--radius-pill); box-shadow: var(--shadow-sm); }
.price-anchor { background: var(--surface-2); border-radius: var(--radius-md); padding: .9rem 1rem; font-size: .82rem; color: var(--ink-2); margin-top: 1rem; }

.onb-actions { display: flex; gap: .7rem; margin-top: 1.8rem; }
.onb-actions .btn-outline { flex: 0 0 auto; width: auto; padding: 1rem 1.1rem; }
.onb-actions .btn-primary, .onb-actions .btn-accent { flex: 1; }

.subsection-title { font-size: .95rem; font-weight: 700; margin: 1.4rem 0 .7rem; display: flex; align-items: center; gap: .5rem; color: var(--ink-1); }
.subsection-title:first-child { margin-top: 0; }

/* ---------- 6. App con sidebar ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--sidebar-bg); color: var(--sidebar-ink);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 60;
  transition: transform .3s var(--ease); border-right: 1px solid var(--sidebar-border);
}
.sidebar .brand-mark { justify-content: flex-start; padding: 1.5rem 1.4rem 1.1rem; margin-bottom: 0; }
.admin-tag { margin: -.4rem 1.4rem .9rem; display: inline-flex; align-items: center; gap: .35rem; font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: var(--accent-2); background: rgba(255,255,255,.08); padding: .3rem .6rem; border-radius: var(--radius-pill); }
.sidebar-user { padding: 0 1.4rem 1.1rem; display: flex; align-items: center; gap: .7rem; border-bottom: 1px solid var(--sidebar-border); margin-bottom: .8rem; padding-bottom: 1.2rem; }
.sidebar-user .avatar-circle { width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; flex-shrink: 0; }
.sidebar-user .su-name { color: #fff; font-weight: 700; font-size: .92rem; }
.sidebar-user .su-tier { font-size: .74rem; color: var(--sidebar-ink); }

.side-nav { flex: 1; overflow-y: auto; padding: .3rem .9rem; }
.side-nav .nav-item {
  display: flex; align-items: center; gap: .8rem; padding: .78rem .9rem; border-radius: var(--radius-sm);
  width: 100%; color: var(--sidebar-ink); font-size: .88rem; font-weight: 600; margin-bottom: .15rem; transition: background-color .16s, color .16s;
}
.side-nav .nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav .nav-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-ink-active); }
.side-nav .nav-item.active .icon { color: var(--accent-2); }
.side-nav .nav-item .nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: .65rem; font-weight: 700;
  border-radius: var(--radius-pill); padding: .1rem .45rem; }

.sidebar-foot { padding: 1rem 1.4rem 1.3rem; border-top: 1px solid var(--sidebar-border); display: flex; flex-direction: column; gap: .6rem; }
.theme-switch-row { display: flex; align-items: center; justify-content: space-between; color: var(--sidebar-ink); font-size: .82rem; font-weight: 600; }
.switch { width: 46px; height: 26px; border-radius: var(--radius-pill); background: rgba(255,255,255,.15); position: relative; flex-shrink: 0; transition: background-color .2s; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.3); display: flex; align-items: center; justify-content: center; color: var(--brand); }
[data-theme="dark"] .switch { background: var(--accent); }
[data-theme="dark"] .switch .knob { transform: translateX(20px); }

.sidebar-backdrop { position: fixed; inset: 0; background: rgba(6,11,20,.55); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .25s; }
.sidebar-backdrop.show { opacity: 1; pointer-events: auto; }

.main-area { flex: 1; margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); flex-shrink: 0; display: flex; align-items: center; gap: .9rem; padding: 0 1.4rem;
  background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40;
}
.topbar .tb-title { font-size: 1.05rem; font-weight: 700; flex: 1; }
.hamburger-btn { display: none; }
.notif-dot { position: absolute; top: 7px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger);
  border: 2px solid var(--surface); animation: pulseDot 1.8s ease-in-out infinite; }
@keyframes pulseDot { 0%,100% { transform: scale(1); } 50% { transform: scale(1.25); } }

.content-scroll { flex: 1; padding: 1.5rem 1.4rem 5rem; max-width: 1080px; width: 100%; margin: 0 auto; }
@media (min-width: 640px) { .content-scroll { padding: 2rem 2rem 4rem; } }

.view { animation: viewIn .4s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 7. Tarjetas / componentes de contenido ---------- */
.card {
  background: var(--surface); border-radius: var(--radius-lg); padding: 1.4rem; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.card-hover { transition: transform .2s var(--ease), box-shadow .2s var(--ease); cursor: pointer; }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.grid-3 { grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.grid-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }


.section-hero {
  height: 190px; border-radius: var(--radius-lg); background-size: cover; background-position: center;
  display: flex; align-items: flex-end; padding: 1.4rem 1.5rem; margin-bottom: 1.4rem; overflow: hidden;
}
.section-hero-text h2 { color: #fff; font-size: 1.35rem; margin-bottom: .25rem; text-shadow: 0 2px 10px rgba(0,0,0,.45); }
.section-hero-text p { color: rgba(255,255,255,.88); font-size: .85rem; text-shadow: 0 1px 6px rgba(0,0,0,.45); margin: 0; }
@media (max-width: 520px) { .section-hero { height: 150px; padding: 1.1rem 1.2rem; } .section-hero-text h2 { font-size: 1.15rem; } }

.stat-tile { background: var(--surface); border-radius: var(--radius-md); padding: 1.1rem 1.2rem; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.stat-tile .st-label { font-size: .78rem; color: var(--ink-2); font-weight: 600; margin-bottom: .4rem; }
.stat-tile .st-value { font-size: 1.6rem; font-weight: 800; }
.stat-tile .st-sub { font-size: .76rem; color: var(--ink-3); margin-top: .25rem; }
.stat-tile .st-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: .7rem; }

.reminder-banner {
  display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.2rem; border-radius: var(--radius-md);
  background: linear-gradient(120deg, var(--accent-soft), var(--surface)); border: 1px solid var(--border); margin-bottom: 1.4rem;
  animation: bannerIn .5s var(--ease);
}
@keyframes bannerIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.reminder-banner .rb-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.reminder-banner .rb-quote { font-size: .82rem; color: var(--ink-2); font-style: italic; margin-top: .15rem; }

.quicklink-card { display: flex; flex-direction: column; gap: .7rem; align-items: flex-start; }
.quicklink-card .ql-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.quicklink-card .ql-title { font-weight: 700; font-size: .92rem; }
.quicklink-card .ql-sub { font-size: .78rem; color: var(--ink-2); }

/* Barra/progreso genérico */
.progress-track { height: 10px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--radius-pill); background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .7s var(--ease); }

/* Avatar copy card (dolor/deseo) */
.avatar-copy-card h3 { font-size: 1.05rem; margin-bottom: .8rem; }
.avatar-copy-card .ac-list { display: flex; flex-direction: column; gap: .5rem; margin-top: .5rem; }
.avatar-copy-card .ac-list li { display: flex; gap: .6rem; font-size: .86rem; color: var(--ink-2); align-items: flex-start; }
.avatar-copy-card .ac-list li .icon { margin-top: .15rem; color: var(--accent); flex-shrink: 0; }

/* Badges de estado */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; border-radius: var(--radius-pill); font-size: .74rem; font-weight: 700; }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-neutral { background: var(--surface-3); color: var(--ink-2); }

/* Planilla */
.day-tabs { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .3rem; margin-bottom: 1.2rem; }
.day-tabs::-webkit-scrollbar { display: none; }
.day-tab { flex-shrink: 0; padding: .65rem 1.1rem; border-radius: var(--radius-pill); background: var(--surface-2); font-weight: 700; font-size: .84rem; border: 1.5px solid transparent; }
.day-tab.active { background: var(--brand); color: #fff; }
:root[data-theme="dark"] .day-tab.active { background: var(--accent); }

.plan-section { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.1rem 1.2rem; margin-bottom: .9rem; background: var(--surface); }
.plan-section .ps-head { display: flex; align-items: center; gap: .6rem; font-weight: 700; margin-bottom: .7rem; font-size: .92rem; }
.plan-section .ps-head .ps-num { width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: .78rem; }
.plan-item { display: flex; justify-content: space-between; gap: .8rem; padding: .55rem 0; border-top: 1px dashed var(--border); font-size: .86rem; }
.plan-item:first-child { border-top: none; }
.plan-item .pi-name { font-weight: 600; }
.plan-item .pi-detail { text-align: right; color: var(--ink-2); font-size: .8rem; white-space: nowrap; }
.exercise-video-btn { display: inline-flex; align-items: center; gap: .3rem; background: var(--accent-soft); color: var(--accent); font-size: .76rem; font-weight: 700; padding: .3rem .65rem; border-radius: var(--radius-pill); border: none; cursor: pointer; margin-top: .3rem; }
.exercise-video-btn:hover { background: var(--accent); color: #fff; }
.suggested-exercises { margin-top: .8rem; }
.suggested-ex-label { display: flex; align-items: center; gap: .35rem; font-weight: 700; margin-bottom: .5rem; }
.suggested-ex-chip { display: inline-flex; align-items: center; background: var(--surface-3); color: var(--ink-1); font-size: .78rem; font-weight: 600; padding: .35rem .75rem; border-radius: var(--radius-pill); border: none; cursor: pointer; margin: 0 .4rem .4rem 0; }
.suggested-ex-chip:hover { background: var(--accent-soft); color: var(--accent); }

/* Formulario de registro de sesión */
.section-check-row { display: flex; align-items: center; justify-content: space-between; padding: .8rem 0; border-top: 1px solid var(--border); }
.section-check-row:first-child { border-top: none; }
.section-check-row .scr-name { font-weight: 600; font-size: .88rem; }
.toggle-pair { display: flex; gap: .4rem; }
.toggle-pair button { padding: .45rem .8rem; border-radius: var(--radius-pill); font-size: .76rem; font-weight: 700; background: var(--surface-2); border: 1.5px solid var(--border); }
.toggle-pair button.on-good.active { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.toggle-pair button.on-bad.active { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }

.range-row input[type="range"] { width: 100%; accent-color: var(--accent); }
.range-value { font-size: 1.4rem; font-weight: 800; color: var(--accent); text-align: center; margin-bottom: .4rem; }

.yn-toggle { display: flex; gap: .6rem; }
.yn-toggle button { flex: 1; padding: .7rem; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--surface-2); font-weight: 700; font-size: .86rem; }
.yn-toggle button.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Historial */
.history-item { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1rem 1.1rem; margin-bottom: .8rem; }
.history-item .hi-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; margin-bottom: .5rem; }
.history-item .hi-date { font-weight: 700; font-size: .88rem; }
.history-item .hi-meta { font-size: .78rem; color: var(--ink-2); }
.history-item .coach-note { margin-top: .7rem; padding: .8rem .9rem; background: var(--accent-soft); border-radius: var(--radius-sm); font-size: .84rem; }
.history-item .coach-note .cn-label { font-weight: 700; color: var(--accent); font-size: .74rem; display: block; margin-bottom: .25rem; }

/* Calendario */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .35rem; }
.cal-dow { text-align: center; font-size: .7rem; font-weight: 700; color: var(--ink-3); padding-bottom: .4rem; }
.cal-cell {
  aspect-ratio: 1; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 600; background: var(--surface-2); position: relative; color: var(--ink-2);
}
.cal-cell.empty { background: transparent; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell.programado { background: var(--accent-soft); color: var(--accent); }
.cal-cell.cumplido { background: var(--success); color: #fff; }
.cal-cell.perdido { background: var(--danger-soft); color: var(--danger); }
.cal-legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; font-size: .78rem; color: var(--ink-2); }
.cal-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.cal-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.cal-card-photo { background-size: cover; background-position: center; border-color: transparent; }
.cal-card-photo .cal-head h3 { color: #fff; }
.cal-card-photo .btn-icon { background: rgba(255,255,255,.16); color: #fff; }
.cal-card-photo .btn-icon:hover { background: rgba(255,255,255,.26); }
.cal-card-photo .cal-dow { color: rgba(255,255,255,.7); }
.cal-card-photo .cal-cell { background: rgba(255,255,255,.14); color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.55); }
.cal-card-photo .cal-cell.empty { background: transparent; }
.cal-card-photo .cal-cell.programado { background: rgba(76,123,255,.5); color: #fff; }
.cal-card-photo .cal-cell.cumplido { background: rgba(55,201,141,.9); color: #06301c; text-shadow: none; }
.cal-card-photo .cal-cell.perdido { background: rgba(255,90,100,.55); color: #fff; }
.cal-card-photo .cal-legend { color: rgba(255,255,255,.85); }
.cal-card-photo .cal-legend i { box-shadow: 0 0 0 1px rgba(255,255,255,.35); }

/* Medallas */
.medal-tile { text-align: center; padding: 1.4rem 1rem; }
.medal-tile .medal-ic { width: 62px; height: 62px; border-radius: 50%; margin: 0 auto .8rem; display: flex; align-items: center; justify-content: center; }
.medal-tile.locked { opacity: .45; }
.medal-tile.locked .medal-ic { background: var(--surface-3); color: var(--ink-3); }
.medal-tile.unlocked .medal-ic { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: var(--shadow-sm); }
.medal-tile .medal-name { font-weight: 700; font-size: .86rem; }
.medal-tile .medal-desc { font-size: .74rem; color: var(--ink-3); margin-top: .3rem; }
.medal-tile .medal-count { display: inline-block; margin-top: .4rem; font-size: .7rem; font-weight: 700; color: var(--accent); }

/* Gráfico de barras (progreso semanal) */
.chart-card .chart-wrap { display: flex; align-items: flex-end; gap: 1rem; height: 150px; padding-top: 1.4rem; }
.chart-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: .5rem; }
.chart-bar-col .bar-val { font-size: .72rem; font-weight: 700; color: var(--ink-2); }
.chart-bar-col .bar { width: 100%; max-width: 34px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, var(--accent-2), var(--accent)); transition: height 1s var(--ease); }
.chart-bar-col .bar-label { font-size: .72rem; color: var(--ink-3); }
.chart-bar-col.is-current .bar { background: linear-gradient(180deg, var(--accent-2), var(--brand)); }
:root[data-theme="dark"] .chart-bar-col.is-current .bar { background: linear-gradient(180deg, var(--accent-2), var(--accent)); }

/* Subir video / diagnóstico */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-md); padding: 2.2rem 1.2rem; text-align: center;
  transition: border-color .18s, background-color .18s; cursor: pointer;
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--accent); background: var(--accent-soft); }
.upload-zone .uz-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem; }

.diag-status-card { display: flex; gap: 1rem; align-items: flex-start; }
.diag-status-card .dsc-icon { width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.diag-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Biblioteca de ejercicios */
.exercise-card .exc-thumb { height: 110px; border-radius: var(--radius-md); background: linear-gradient(135deg, var(--brand), var(--accent));
  display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.85); margin-bottom: .8rem; position: relative; }
.exc-video-badge { position: absolute; bottom: .5rem; right: .5rem; }
.exc-video-embed { position: relative; width: 100%; aspect-ratio: 16/9; border-radius: var(--radius-md); overflow: hidden; background: #000; }
.exc-video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.exercise-card .exc-cat { font-size: .7rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .3rem; }
.exercise-card .exc-name { font-weight: 700; font-size: .92rem; margin-bottom: .4rem; }
.exercise-card .exc-desc { font-size: .8rem; color: var(--ink-2); }

.search-bar { position: relative; margin-bottom: 1rem; }
.search-bar-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search-bar input {
  width: 100%; padding: .85rem 1rem .85rem 2.6rem; border-radius: var(--radius-pill); border: 1.5px solid var(--border);
  background: var(--surface-2); color: var(--ink-1); font-size: .92rem; transition: border-color .18s, background-color .18s;
}
.search-bar input:focus { border-color: var(--accent); background: var(--surface); }

.category-filters { display: flex; gap: .5rem; overflow-x: auto; margin-bottom: 1.2rem; padding-bottom: .2rem; }
.category-filters::-webkit-scrollbar { display: none; }
.cat-filter-btn { flex-shrink: 0; padding: .55rem 1rem; border-radius: var(--radius-pill); background: var(--surface-2); font-size: .8rem; font-weight: 700; border: 1.5px solid transparent; }
.cat-filter-btn.active { background: var(--brand); color: #fff; }
:root[data-theme="dark"] .cat-filter-btn.active { background: var(--accent); }

/* Artículos */
.article-card .art-date { font-size: .74rem; color: var(--ink-3); font-weight: 600; }
.article-card .art-title { font-size: 1rem; font-weight: 700; margin: .4rem 0 .5rem; }
.article-card .art-excerpt { font-size: .84rem; color: var(--ink-2); }
.article-detail-body { white-space: pre-line; font-size: .94rem; color: var(--ink-2); line-height: 1.75; }

/* Perfil */
.profile-header { display: flex; align-items: center; gap: 1.1rem; margin-bottom: 1.6rem; }
.profile-header .avatar-circle-lg { width: 68px; height: 68px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 800; flex-shrink: 0; }
.profile-row { display: flex; justify-content: space-between; padding: .8rem 0; border-top: 1px solid var(--border); font-size: .88rem; }
.profile-row:first-child { border-top: none; }
.profile-row .pr-label { color: var(--ink-2); }
.profile-row .pr-value { font-weight: 700; text-align: right; }

/* ---------- 8. Notificaciones ---------- */
.notif-panel {
  position: fixed; top: calc(var(--topbar-h) + 8px); right: 1.2rem; width: 340px; max-width: calc(100vw - 2rem);
  background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  z-index: 100; opacity: 0; transform: translateY(-8px) scale(.98); pointer-events: none; transition: all .2s var(--ease);
  max-height: 70vh; display: flex; flex-direction: column;
}
.notif-panel.show { opacity: 1; transform: none; pointer-events: auto; }
.notif-panel .np-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.1rem; border-bottom: 1px solid var(--border); }
.notif-panel .np-head h4 { font-size: .92rem; }
.notif-panel .np-head button { font-size: .76rem; color: var(--accent); font-weight: 700; }
.notif-list { overflow-y: auto; flex: 1; }
.notif-item { display: flex; gap: .7rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: var(--accent-soft); }
.notif-item .ni-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-item .ni-text { font-size: .82rem; }
.notif-item .ni-time { font-size: .7rem; color: var(--ink-3); margin-top: .2rem; }
.notif-empty { padding: 2rem 1rem; text-align: center; color: var(--ink-3); font-size: .84rem; }

@media (max-width: 640px) {
  .notif-panel { left: 1rem; right: 1rem; width: auto; top: auto; bottom: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 75vh; transform: translateY(100%); }
  .notif-panel.show { transform: none; }
}

/* ---------- 9. Modal / hoja de confirmación ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(6,11,20,.55); z-index: 120; display: flex; align-items: center; justify-content: center;
  padding: 1.2rem; opacity: 0; pointer-events: none; transition: opacity .22s var(--ease); }
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal-box { background: var(--surface); border-radius: var(--radius-lg); padding: 1.8rem; max-width: 400px; width: 100%;
  box-shadow: var(--shadow-lg); transform: translateY(14px) scale(.97); transition: transform .22s var(--ease); text-align: center; }
.modal-overlay.show .modal-box { transform: none; }
.modal-box .mb-icon { width: 58px; height: 58px; border-radius: 16px; margin: 0 auto 1.1rem; display: flex; align-items: center; justify-content: center; }
.modal-box h3 { font-size: 1.15rem; margin-bottom: .5rem; }
.modal-box p { color: var(--ink-2); font-size: .88rem; margin-bottom: 1.5rem; }
.modal-box .mb-actions { display: flex; gap: .7rem; }
.modal-box .mb-actions .btn { flex: 1; }

/* Video modal */
.video-modal-box { max-width: 460px; text-align: left; }
.video-modal-box .exc-thumb { height: 200px; margin-bottom: 1.2rem; }

/* ---------- 10. Toasts ---------- */
.toast-stack { position: fixed; bottom: 1.4rem; left: 50%; transform: translateX(-50%); z-index: 150; display: flex; flex-direction: column; gap: .6rem; width: 100%; max-width: 380px; padding: 0 1rem; align-items: center; }
.toast {
  background: var(--brand); color: #fff; padding: .85rem 1.2rem; border-radius: var(--radius-pill); box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: .6rem; font-size: .84rem; font-weight: 600; animation: toastIn .3s var(--ease); width: 100%; justify-content: center;
}
.toast.leaving { animation: toastOut .25s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

/* ---------- 11. Empty states ---------- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--ink-3); }
.empty-state .es-icon { width: 62px; height: 62px; border-radius: 18px; background: var(--surface-2); color: var(--ink-3);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem; }

/* ---------- 12. Responsive: sidebar -> off-canvas ---------- */
@media (max-width: 959px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .hamburger-btn { display: inline-flex; }
}

@media (min-width: 960px) {
  .sidebar-backdrop { display: none; }
}

@media (max-width: 480px) {
  .onboarding-card { padding: 2rem 1.4rem; border-radius: var(--radius-md); }
  .stat-tile .st-value { font-size: 1.35rem; }
}

/* ---------- 13. Scrollbar discreto ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: var(--radius-pill); }
::-webkit-scrollbar-track { background: transparent; }
