/* ============================================================
   NAYELIA — Panel de administración
   ============================================================ */
:root {
  --bg: #f3f6f5;
  --surface: #ffffff;
  --surface-2: #f5f8f7;
  --surface-3: #eaf0ef;
  --border: #e1e8e7;
  --border-strong: #cdd8d6;
  --overlay: rgba(6, 24, 26, 0.45);

  --heading: #0b2226;
  --text: #1f3336;
  --text-2: #50656a;
  --text-3: #71868a;

  --accent: #0e7c7b;
  --accent-strong: #0a6463;
  --accent-text: #0b6f6e;
  --accent-soft: rgba(14, 124, 123, 0.1);
  --accent-soft-2: rgba(14, 124, 123, 0.18);
  --gold: #e3a63f;
  --gold-soft: rgba(227, 166, 63, 0.16);
  --gold-text: #8f5c0c;

  --danger: #c0352b;
  --danger-soft: rgba(192, 53, 43, 0.1);
  --warn-text: #9a5b00;
  --warn-soft: rgba(245, 166, 35, 0.16);
  --ok-text: #1b7a43;
  --ok-soft: rgba(46, 158, 79, 0.12);

  --side-bg: #082a2c;
  --side-text: #a9c4c1;
  --side-active: rgba(255, 255, 255, 0.1);

  --chart-grid: #e6eceb;
  --chart-bar: #0e7c7b;

  --font-display: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(11, 50, 52, 0.05);
  --shadow: 0 1px 2px rgba(11, 50, 52, 0.04), 0 6px 20px rgba(11, 50, 52, 0.06);
  --shadow-lg: 0 24px 64px rgba(6, 30, 32, 0.22);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #061113;
  --surface: #0d1e21;
  --surface-2: #11272a;
  --surface-3: #163135;
  --border: #1d3639;
  --border-strong: #2a4a4e;
  --overlay: rgba(0, 0, 0, 0.6);

  --heading: #f1f8f7;
  --text: #d9e7e5;
  --text-2: #9fb6b3;
  --text-3: #7c9592;

  --accent: #2bb5ae;
  --accent-strong: #5cd3cc;
  --accent-text: #5cd3cc;
  --accent-soft: rgba(43, 181, 174, 0.12);
  --accent-soft-2: rgba(43, 181, 174, 0.22);
  --gold: #f0b95a;
  --gold-soft: rgba(240, 185, 90, 0.14);
  --gold-text: #f0b95a;

  --danger: #f07167;
  --danger-soft: rgba(240, 113, 103, 0.13);
  --warn-text: #f5b754;
  --warn-soft: rgba(245, 166, 35, 0.15);
  --ok-text: #5fd48f;
  --ok-soft: rgba(76, 207, 133, 0.13);

  --side-bg: #040d0e;
  --side-text: #93aeab;
  --side-active: rgba(255, 255, 255, 0.08);

  --chart-grid: #1c3336;
  --chart-bar: #2bb5ae;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.55);

  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--heading); margin: 0; letter-spacing: -0.015em; line-height: 1.25; }
a { color: var(--accent-text); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.i { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.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; }
.muted { color: var(--text-3); }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .15s;
}
.btn svg.i { width: 16px; height: 16px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: linear-gradient(135deg, #0a6463, #0e7c7b); color: #fff; box-shadow: 0 4px 14px rgba(14, 124, 123, .25); }
.btn--primary:hover:not(:disabled) { box-shadow: 0 6px 20px rgba(14, 124, 123, .35); transform: translateY(-1px); }
.btn--secondary { background: var(--surface); border-color: var(--border-strong); color: var(--heading); }
.btn--secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-text); }
.btn--subtle { background: transparent; color: var(--text-2); }
.btn--subtle:hover:not(:disabled) { background: var(--surface-3); color: var(--heading); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn--danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn--sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn--lg { height: 46px; font-size: 15px; border-radius: 12px; }
.btn--block { width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  transition: color .15s, border-color .15s, background-color .15s;
}
.icon-btn:hover { color: var(--heading); border-color: var(--border-strong); }
.icon-btn--sm { width: 32px; height: 32px; border-radius: 8px; }
.icon-btn--sm svg.i { width: 16px; height: 16px; }
.icon-btn--ghost { border-color: transparent; background: transparent; }
.icon-btn--ghost:hover { background: var(--surface-3); }
.icon-btn--danger:hover { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }

/* ---------- Login ---------- */
.login { display: grid; grid-template-columns: minmax(360px, 0.9fr) 1.1fr; min-height: 100vh; }
.login__aside {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 48px;
  background: linear-gradient(150deg, #062a2c 0%, #0a4a4a 55%, #0e7c7b 110%);
  color: #d4e8e5;
  overflow: hidden;
}
.login__aside::before {
  content: "";
  position: absolute;
  width: 420px; height: 420px;
  right: -160px; bottom: -120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 185, 90, .4), transparent 70%);
}
.login__aside > * { position: relative; }
.login__brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 800; font-size: 22px; color: #fff; }
.login__pitch h2 { color: #fff; font-size: clamp(26px, 3vw, 36px); line-height: 1.15; max-width: 420px; margin-bottom: 26px; }
.login__pitch ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; font-size: 15px; max-width: 400px; }
.login__pitch li { display: flex; gap: 12px; align-items: flex-start; }
.login__dot { flex-shrink: 0; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: #f0b95a; box-shadow: 0 0 0 4px rgba(240, 185, 90, .2); }
.login__foot { color: rgba(255, 255, 255, .55); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.login__main { display: grid; place-items: center; padding: 32px 20px; }
.login__card { width: 100%; max-width: 380px; }
.login__mark { display: none; margin-bottom: 18px; }
.login__card h1 { font-size: 28px; margin-bottom: 6px; }
.login__card > p { color: var(--text-2); margin: 0 0 28px; font-size: 15px; }
.login__card label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--heading); }
.login__err { color: var(--danger); font-size: 13px; min-height: 20px; margin: 8px 0 12px; }
.login__back { display: inline-block; margin-top: 22px; color: var(--text-3); font-size: 13px; }
.login__back:hover { color: var(--accent-text); }

.input-group { position: relative; }
.input-group .input { padding-right: 46px; }
.input-group input { width: 100%; height: 46px; padding: 0 46px 0 14px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 15px; }
.input-group input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input-group__btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--text-3); }
.input-group__btn:hover { color: var(--heading); background: var(--surface-3); }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  background: var(--side-bg);
  color: var(--side-text);
  overflow-y: auto;
}
.side__brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; }
.side__brand b { display: block; font-family: var(--font-display); font-size: 17px; color: #fff; line-height: 1.2; }
.side__brand small { font-size: 11.5px; color: var(--side-text); }

.nav { display: grid; gap: 2px; }
.nav__group { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgba(169, 196, 193, .55); padding: 16px 12px 6px; }
.nav__group:first-child { padding-top: 4px; }
.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--side-text);
  font-weight: 500;
  transition: background-color .15s, color .15s;
}
.nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #f0b95a; }
.nav a.active svg.i { color: #5cd3cc; }
.nav__badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: rgba(92, 211, 204, .18); color: #9be6e0; font-size: 11.5px; font-weight: 700; text-align: center; }

.side__foot { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .08); display: grid; gap: 2px; }
.side__link { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--side-text); font-weight: 500; text-align: left; }
.side__link:hover { background: rgba(255, 255, 255, .05); color: #fff; }

.side-overlay { display: none; }

.shell { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 12px 32px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar__menu { display: none; }
.topbar__title { min-width: 0; flex: 1; }
.topbar__title h1 { font-size: 21px; }
.topbar__title p { margin: 1px 0 0; color: var(--text-3); font-size: 13px; }
.topbar__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.main { padding: 26px 32px 64px; width: 100%; max-width: 1320px; outline: none; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.card__head h2 { font-size: 15px; }
.card__head p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-3); }
.card__body { padding: 16px 20px 20px; }
.card + .card { margin-top: 18px; }

.grid { display: grid; gap: 18px; }
.grid--dash { grid-template-columns: 1.55fr 1fr; }
.grid--2 { grid-template-columns: 1fr 1fr; }
.stack { display: grid; gap: 18px; align-content: start; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.kpi { padding: 18px 20px; }
.kpi__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.kpi__label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.kpi__icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); }
.kpi__icon svg.i { width: 17px; height: 17px; }
.kpi__icon--gold { background: var(--gold-soft); color: var(--gold-text); }
.kpi__icon--ok { background: var(--ok-soft); color: var(--ok-text); }
.kpi__icon--warn { background: var(--warn-soft); color: var(--warn-text); }
.kpi__value { font-family: var(--font-display); font-size: 30px; font-weight: 800; color: var(--heading); line-height: 1.1; letter-spacing: -0.02em; }
.kpi__sub { margin-top: 4px; font-size: 12.5px; color: var(--text-3); }

/* ---------- Gráfica de columnas ---------- */
.colchart { position: relative; height: 220px; margin: 8px 0 0 34px; }
.colchart__grid { position: absolute; inset: 0 0 22px 0; }
.colchart__line { position: absolute; left: 0; right: 0; height: 1px; background: var(--chart-grid); }
.colchart__line span { position: absolute; right: calc(100% + 8px); top: -8px; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.colchart__cols { position: absolute; inset: 0 0 22px 0; display: flex; align-items: stretch; }
.colchart__col { flex: 1; position: relative; display: flex; align-items: flex-end; justify-content: center; cursor: default; }
.colchart__col:hover { background: var(--surface-2); }
.colchart__bar { width: min(62%, 24px); min-height: 0; background: var(--chart-bar); border-radius: 4px 4px 0 0; }
.colchart__col:hover .colchart__bar { filter: brightness(1.1); }
.colchart__x { position: absolute; left: 0; right: 0; bottom: 0; height: 18px; }
.colchart__x span { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--text-3); white-space: nowrap; }

/* ---------- Barra apilada de estados ---------- */
.stackbar { display: flex; gap: 2px; height: 14px; margin: 6px 0 18px; }
.stackbar__seg { min-width: 4px; }
.stackbar__seg:first-child { border-radius: 4px 0 0 4px; }
.stackbar__seg:last-child { border-radius: 0 4px 4px 0; }
.stackbar__seg:only-child { border-radius: 4px; }
.stackbar--empty { background: var(--surface-3); border-radius: 4px; }

.legend { display: grid; gap: 10px; }
.legend__row { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; font-size: 13px; }
.legend__dot { width: 10px; height: 10px; border-radius: 50%; }
.legend__count { font-weight: 700; color: var(--heading); font-variant-numeric: tabular-nums; }
.legend__pct { width: 42px; text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- Listas ---------- */
.list { display: grid; }
.list__item { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-top: 1px solid var(--border); cursor: pointer; transition: background-color .15s; }
.list__item:first-child { border-top: 0; }
.list__item:hover { background: var(--surface-2); }
.list__main { flex: 1; min-width: 0; }
.list__main strong { display: block; color: var(--heading); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list__main small { display: block; color: var(--text-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.rank { display: grid; gap: 14px; }
.rank__row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 13px; }
.rank__row strong { font-weight: 600; color: var(--heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank__row span { color: var(--text-2); font-variant-numeric: tabular-nums; }
.meter { grid-column: 1 / -1; height: 6px; border-radius: 6px; background: var(--accent-soft); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 6px; background: var(--accent); }

.avatar { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 12.5px; }
.avatar--lg { width: 52px; height: 52px; border-radius: 15px; font-size: 17px; }
.avatar--gold { background: var(--gold-soft); color: var(--gold-text); }

/* ---------- Chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.chip__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip--ok { background: var(--ok-soft); color: var(--ok-text); }
.chip--accent { background: var(--accent-soft); color: var(--accent-text); }
.chip--gold { background: var(--gold-soft); color: var(--gold-text); }
.chip--warn { background: var(--warn-soft); color: var(--warn-text); }
.chip--danger { background: var(--danger-soft); color: var(--danger); }
.chip--plain { padding: 3px 10px; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.toolbar__spacer { flex: 1; }
.search { position: relative; flex: 1 1 240px; max-width: 360px; }
.search svg.i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.search input { width: 100%; height: 38px; padding: 0 12px 0 36px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); }
.search input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select { height: 38px; padding: 0 32px 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2371868a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E") no-repeat right 11px center; appearance: none; -webkit-appearance: none; max-width: 240px; }

.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-3); }
.segmented button { height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-weight: 600; font-size: 13px; }
.segmented button.active { background: var(--surface); color: var(--heading); box-shadow: var(--shadow-sm); }

.count { font-size: 13px; color: var(--text-3); }

/* ---------- Tabla ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); background: var(--surface-2); white-space: nowrap; }
tbody tr { transition: background-color .15s; }
tbody tr.clickable { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td .cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
td strong { color: var(--heading); font-weight: 600; }
td small { display: block; color: var(--text-3); font-size: 12.5px; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .icon-btn { margin-left: 4px; }

/* ---------- Tarjetas de psicometrías ---------- */
.tests { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.test { display: flex; flex-direction: column; padding: 18px; transition: border-color .15s, box-shadow .15s; }
.test:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.test.is-off { background: var(--surface-2); }
.test.is-off .test__title { color: var(--text-2); }
.test__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.test__title { font-size: 15.5px; line-height: 1.3; }
.test__desc { color: var(--text-2); font-size: 13px; margin: 6px 0 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 39px; }
.test__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.test__foot { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.test__foot .btn { margin-right: auto; }

/* ---------- Switch ---------- */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track { position: relative; flex-shrink: 0; width: 36px; height: 20px; border-radius: 999px; background: var(--border-strong); transition: background-color .2s; }
.switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s var(--ease); }
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch__label { font-size: 13px; color: var(--text); }
.switch__label small { display: block; color: var(--text-3); font-size: 12px; }

/* ---------- Formularios ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span, .field-label { display: block; font-size: 13px; font-weight: 600; color: var(--heading); margin-bottom: 6px; }
.field__hint { display: block; margin-top: 5px; font-size: 12px; color: var(--text-3); }
.input, .textarea, .field select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid--3 { grid-template-columns: 90px 1fr 1fr; }
.form-section { padding: 20px; border-top: 1px solid var(--border); }
.form-section:first-child { border-top: 0; }
.form-section h3 { font-size: 14px; margin-bottom: 4px; }
.form-section > p { margin: 0 0 14px; color: var(--text-3); font-size: 12.5px; }

.repeat { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); margin-bottom: 12px; }
.repeat__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.repeat .field:last-child { margin-bottom: 0; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button { position: relative; height: 42px; padding: 0 14px; border: 0; background: transparent; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.tabs button:hover { color: var(--heading); }
.tabs button.active { color: var(--accent-text); }
.tabs button.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }

.editor { display: grid; grid-template-columns: 1fr 360px; gap: 18px; align-items: start; }
.preview { position: sticky; top: 90px; }
.preview__label { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }

.hero-prev { padding: 26px 22px; border-radius: var(--radius-lg); background: linear-gradient(150deg, #f5f8f7, #e3efed); border: 1px solid var(--border); color: #1b2e31; }
[data-theme="dark"] .hero-prev { background: linear-gradient(150deg, #0c1c1f, #0f2a2c); color: #dfeceb; }
.hero-prev__badge { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-text); background: var(--accent-soft); padding: 4px 9px; border-radius: 999px; }
.hero-prev h4 { font-size: 22px; line-height: 1.1; margin: 12px 0 8px; font-weight: 800; }
.hero-prev h4 em { font-style: normal; color: var(--accent-text); }
.hero-prev p { font-size: 12.5px; margin: 0 0 14px; color: var(--text-2); }
.hero-prev__btn { display: inline-block; padding: 7px 14px; border-radius: 999px; background: linear-gradient(135deg, #0a6463, #0e7c7b); color: #fff; font-size: 12px; font-weight: 700; }

.savebar {
  position: sticky;
  bottom: 16px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 10px 10px 10px 18px;
  border-radius: 14px;
  background: var(--heading);
  color: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .25s var(--ease);
}
.savebar.show { transform: none; opacity: 1; pointer-events: auto; }
.savebar span { flex: 1; font-weight: 600; font-size: 13.5px; }
.savebar .btn--subtle { color: var(--surface); opacity: .8; }
.savebar .btn--subtle:hover { background: rgba(255, 255, 255, .12); color: var(--surface); opacity: 1; }
[data-theme="dark"] .savebar .btn--subtle:hover { background: rgba(0, 0, 0, .1); }

/* ---------- Cursos ---------- */
.courses { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.course { overflow: hidden; display: flex; flex-direction: column; }
.course.is-off .course__cover { filter: grayscale(.8); opacity: .75; }
.course__cover { position: relative; aspect-ratio: 16 / 8; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; padding: 14px; color: #fff; background: linear-gradient(135deg, #07383a 0%, #0a5c5b 55%, #0e7c7b 100%); overflow: hidden; }
.course__cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.course__cover b { position: relative; font-family: var(--font-display); font-size: 17px; line-height: 1.2; max-width: 90%; }
.course__cover.has-image b { display: none; }
.course__badge { position: relative; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: rgba(255, 255, 255, .2); }
.course__cover.has-image .course__badge { background: rgba(6, 24, 26, .6); }
.course__body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.course__body h3 { font-size: 15px; margin-bottom: 6px; }
.course__meta { color: var(--text-3); font-size: 12.5px; margin-bottom: 12px; }
.course__price { display: flex; align-items: baseline; gap: 8px; margin-bottom: 14px; }
.course__price b { font-family: var(--font-display); font-size: 18px; color: var(--heading); }
.course__price s { color: var(--text-3); font-size: 12.5px; }
.course__foot { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.course__foot .switch { margin-right: auto; }

/* ---------- Dimensiones ---------- */
.dims-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.dims { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.dim { position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border: 1px solid var(--border-strong); border-radius: 10px; cursor: pointer; transition: border-color .15s, background-color .15s; }
.dim:hover { border-color: var(--accent); }
.dim input { position: absolute; opacity: 0; }
.dim__box { flex-shrink: 0; display: grid; place-items: center; width: 18px; height: 18px; margin-top: 1px; border-radius: 5px; border: 1.5px solid var(--border-strong); color: transparent; background: var(--surface); }
.dim__box svg.i { width: 12px; height: 12px; stroke-width: 3; }
.dim input:checked ~ .dim__box { background: var(--accent); border-color: var(--accent); color: #fff; }
.dim input:focus-visible ~ .dim__box { outline: 2px solid var(--accent); outline-offset: 2px; }
.dim:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.dim strong { display: block; font-size: 13px; color: var(--heading); font-weight: 600; line-height: 1.3; }
.dim small { color: var(--text-3); font-size: 11.5px; }

.summary { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.summary b { color: var(--heading); }

.link-box { display: flex; gap: 8px; align-items: center; padding: 6px 6px 6px 12px; border-radius: 10px; border: 1px dashed var(--border-strong); background: var(--surface-2); font-size: 12.5px; }
.link-box code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; overflow-y: auto; background: var(--overlay); animation: fade .15s ease-out; }
.modal__box { width: 100%; max-width: 560px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); animation: pop .22s var(--ease); }
.modal__box--lg { max-width: 820px; }
.modal__box--sm { max-width: 420px; }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 14px; border-bottom: 1px solid var(--border); }
.modal__head h2 { font-size: 18px; }
.modal__head p { margin: 3px 0 0; color: var(--text-3); font-size: 13px; }
.modal__body { padding: 18px 22px; }
.modal__body--flush { padding: 0; }
.modal__foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 18px 18px; }
.modal__foot .muted { margin-right: auto; font-size: 12.5px; }

.confirm { padding: 24px; text-align: left; }
.confirm__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; margin-bottom: 14px; background: var(--danger-soft); color: var(--danger); }
.confirm h2 { font-size: 17px; margin-bottom: 6px; }
.confirm p { margin: 0; color: var(--text-2); }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* ---------- Drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 90; background: var(--overlay); animation: fade .15s ease-out; }
.drawer__panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100%); display: flex; flex-direction: column; background: var(--surface); box-shadow: var(--shadow-lg); animation: slide .28s var(--ease); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.drawer__head { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer__head h2 { font-size: 18px; }
.drawer__head p { margin: 1px 0 0; font-size: 13px; color: var(--text-3); }
.drawer__head .icon-btn { margin-left: auto; }
.drawer__body { flex: 1; overflow-y: auto; }
.drawer__section { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer__section:last-child { border-bottom: 0; }
.drawer__section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-family: var(--font-body); font-weight: 700; margin-bottom: 12px; }
.drawer__foot { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.drawer__foot .btn--danger-soft { margin-left: auto; }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.facts div small { display: block; font-size: 12px; color: var(--text-3); }
.facts div span { font-weight: 500; color: var(--heading); overflow-wrap: anywhere; }

.verdict { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); }
.verdict p { margin: 10px 0 0; color: var(--text-2); font-size: 13px; }

.scores { display: grid; gap: 14px; }
.score { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; font-size: 13px; }
.score strong { color: var(--heading); font-weight: 600; }
.score__val { font-variant-numeric: tabular-nums; color: var(--text-2); }
.score__val b { color: var(--heading); }
.score__track { grid-column: 1 / -1; position: relative; height: 8px; border-radius: 8px; background: var(--surface-3); }
.score__fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 8px; }
.score__tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--surface); }

.flags { display: grid; gap: 8px; }
.flag { display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--text); font-size: 13px; }
.flag svg.i { color: var(--danger); width: 17px; height: 17px; margin-top: 1px; }
.flag small { display: block; color: var(--text-2); margin-top: 2px; }

.photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

.decision { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.decision button { height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: 13px; }
.decision button:hover { border-color: var(--accent); color: var(--heading); }
.decision button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Toasts / Tooltip ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 380px; padding: 12px 14px; border-radius: 12px; background: var(--heading); color: var(--surface); box-shadow: var(--shadow-lg); font-weight: 500; animation: pop .25s var(--ease); }
.toast svg.i { width: 18px; height: 18px; color: #5cd3cc; }
[data-theme="dark"] .toast svg.i { color: #0a6463; }
.toast--error svg.i { color: #f07167; }
[data-theme="dark"] .toast--error svg.i { color: #c0352b; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .2s; }

.tooltip { position: fixed; z-index: 300; pointer-events: none; padding: 7px 10px; border-radius: 8px; background: var(--heading); color: var(--surface); font-size: 12px; line-height: 1.4; box-shadow: var(--shadow); opacity: 0; transform: translate(-50%, calc(-100% - 10px)); transition: opacity .1s; white-space: nowrap; }
.tooltip.show { opacity: 1; }
.tooltip b { font-weight: 700; }

/* ---------- Vacíos / carga ---------- */
.empty { display: grid; justify-items: center; gap: 8px; padding: 48px 20px; text-align: center; color: var(--text-3); }
.empty__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 4px; }
.empty__icon svg.i { width: 24px; height: 24px; }
.empty h3 { font-size: 15px; }
.empty p { margin: 0 0 8px; max-width: 360px; }

.skeleton { border-radius: var(--radius-lg); background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.editor.editor--course { grid-template-columns: 1fr 260px; }
@media (max-width: 760px) { .editor.editor--course { grid-template-columns: 1fr; } }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid--dash { grid-template-columns: 1fr; }
  .editor { grid-template-columns: 1fr; }
  .preview { position: static; }
}

@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login__aside { display: none; }
  .login__mark { display: block; }

  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-100%); transition: transform .25s var(--ease); }
  .side.open { transform: none; box-shadow: var(--shadow-lg); }
  .side-overlay { position: fixed; inset: 0; z-index: 55; background: var(--overlay); }
  .side.open + .side-overlay { display: block; }
  .topbar { padding: 10px 16px; min-height: 62px; }
  .topbar__menu { display: inline-grid; }
  .topbar__title p { display: none; }
  .topbar__actions .btn span { display: none; }
  .topbar__actions .btn { width: 38px; padding: 0; }
  .main { padding: 18px 16px 56px; }
  .grid--2, .form-grid { grid-template-columns: 1fr; }
  .form-grid--3 { grid-template-columns: 80px 1fr; }
  .form-grid--3 > :last-child { grid-column: 1 / -1; }
  .hide-md { display: none; }
}

@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi__value { font-size: 24px; }
  .search { max-width: none; }
  .photos { grid-template-columns: repeat(2, 1fr); }
  .facts { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .modal { padding: 0; align-items: stretch; }
  .modal__box { border-radius: 0; min-height: 100%; }
  .modal__foot { border-radius: 0; }
}

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