/* ============================================================
   Gestión Academia — Design System
   Modern SaaS premium · soft UI · tokens de diseno_ui.md
   ============================================================ */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Coolvetica";
  src: url("/static/fonts/Coolvetica.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #F5F7FB;
  --surface: #FFFFFF;
  --primary: #4361EE;
  --primary-light: #8FA4F5;
  --primary-btn: #4361EE;
  --secondary: #7CC8FF;
  --accent: #38BDF8;
  --text: #1F2937;
  --text-2: #5B6472;
  --border: #E9EEF5;
  --border-input: #8A94A8;
  --divider: #EDF1F7;
  --sidebar-bg: #0A1330;
  --sidebar-hover: #16214A;
  --sidebar-active-bg: #EDF1FE;
  --sidebar-active: #3450D8;
  --sidebar-inactive: #A9B4D9;
  --ok: #15803D;   --ok-bg: #EAF7EF;   --ok-vivo: #22C55E;
  --warn: #B45309; --warn-bg: #FDF3E4; --warn-vivo: #F59E0B;
  --bad: #B91C1C;  --bad-bg: #FDECEC;  --bad-vivo: #EF4444;
  --muted-bg: #F0F3F9;
  --shadow-card: 0 12px 30px rgba(15,23,42,.08);
  --shadow-floating: 0 18px 44px rgba(15,23,42,.12);
  --shadow-btn: 0 8px 18px rgba(61,90,254,.35);
  --grad: linear-gradient(135deg, #4361EE 0%, #1D4ED8 100%);
  --hero-texto: #FFFFFF;
  --r-lg: 14px; --r-md: 12px; --r-card: 12px; --r-sm: 8px; --r-input: 8px;
}

/* ---------- Modo oscuro (activado con data-theme="dark" en <html>) ---------- */
:root[data-theme="dark"] {
  --bg: #0C1120;
  --surface: #141B30;
  --primary: #7C93F7;
  --primary-btn: #4361EE;
  --primary-light: #9FB0F9;
  --text: #EAF0F8;
  --text-2: #93A0BC;
  --border: #263252;
  --border-input: #56648A;
  --divider: #1D2740;
  --muted-bg: #1B2440;
  --sidebar-bg: #060F35;
  --sidebar-hover: #101C52;
  --sidebar-active-bg: #1B2A66;
  --sidebar-active: #FFFFFF;
  --sidebar-inactive: #8B97C4;
  --ok: #4ADE80;   --ok-bg: #142E1E;   --ok-vivo: #4ADE80;
  --warn: #F5B84C; --warn-bg: #32270F; --warn-vivo: #F5B84C;
  --bad: #F87171;  --bad-bg: #371B1B;  --bad-vivo: #F87171;
  --shadow-card: 0 12px 30px rgba(0,0,0,.45);
  --shadow-floating: 0 18px 44px rgba(0,0,0,.55);
  --shadow-btn: 0 8px 18px rgba(35,55,180,.45);
  --grad: linear-gradient(135deg, #3D55E0 0%, #1D4ED8 100%);
  --hero-texto: #FFFFFF;
}
:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
[data-theme="dark"] tbody tr:hover { background: #1A1F2C; }
[data-theme="dark"] .hero, [data-theme="dark"] .total-vivo,
[data-theme="dark"] .login-izq { color: #EAEDFF; }
[data-theme="dark"] .hero::after { background: radial-gradient(circle, rgba(255,255,255,.12), rgba(255,255,255,0) 65%); }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea {
  background: #12151F; border-color: var(--border-input); color: var(--text);
}
[data-theme="dark"] input[type="file"] { background: var(--muted-bg); }
[data-theme="dark"] .btn.secundario { background: var(--surface); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .btn.secundario:hover { background: var(--muted-bg); }
[data-theme="dark"] .login-fondo { background: var(--bg); }
[data-theme="dark"] .login-panel {
  background: rgba(22,26,36,.72); border-color: rgba(255,255,255,.06);
}
[data-theme="dark"] .login-der { background: var(--surface); }
[data-theme="dark"] .blob { opacity: .22; }
[data-theme="dark"] dialog { background: var(--surface); color: var(--text); }
[data-theme="dark"] .sugerencias { background: var(--surface); }
[data-theme="dark"] .consentimiento { background: #2A230F; border-color: #4A3A14; }
[data-theme="dark"] .check-politica span { color: #D9BC72; }
[data-theme="dark"] .check-politica span b { color: #EFCF87; }
[data-theme="dark"] .foto-preview { background: var(--muted-bg); border-color: var(--border); }
[data-theme="dark"] .foto-preview svg { stroke: #5B6478; }

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

h1, h2, h3 { font-weight: 700; letter-spacing: -0.03em; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ---------- Sidebar: barra completa pegada a la izq, puntas derechas redondeadas ---------- */
.sidebar {
  width: 246px; flex-shrink: 0;
  background: var(--sidebar-bg);
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0;
  height: 100vh;
  border-radius: 0 22px 22px 0;                 /* solo puntas del lado derecho */
  box-shadow: 0 14px 40px rgba(15, 23, 42, .14);/* sombra suave a la derecha */
  overflow-y: auto;
}
/* Sobre fondo azul marino, el logo siempre va en blanco */
.sidebar .logo-azul { display: none; }
.sidebar .logo-blanco { display: block; }
.sidebar .marca {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 14px;
}
.sidebar .nav { display: flex; flex-direction: column; gap: 2px; }
/* Títulos de grupo: pequeños, mayúscula, con aire entre grupos */
.nav-grupo {
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: rgba(255, 255, 255, .62);
  padding: 0 14px; margin: 20px 0 7px;
}
.sidebar .nav .nav-grupo:first-child { margin-top: 6px; }
.logo-marca { width: 100%; height: auto; display: block; }
.logo-blanco { display: none; }
[data-theme="dark"] .logo-azul { display: none; }
[data-theme="dark"] .logo-blanco { display: block; }
.marca-logo {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--grad);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 6px 16px rgba(23,102,224,.28);
}
.marca-nombre { font-weight: 700; font-size: 14.5px; line-height: 1.25; }
.marca-nombre small { display: block; font-weight: 400; font-size: 11.5px; color: var(--text-2); }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 12px;      /* pill redondeado */
  color: var(--sidebar-inactive); font-weight: 500; font-size: 14px;
  transition: background .18s ease, color .18s ease;
}
.nav-item svg { width: 19px; height: 19px; stroke: var(--sidebar-inactive);
  transition: stroke .18s; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #E7ECFF; text-decoration: none; }
.nav-item:hover svg { stroke: #E7ECFF; }
.nav-item.activo {
  background: var(--primary-btn); color: #FFFFFF; font-weight: 600;
  box-shadow: 0 8px 20px rgba(61,90,254,.42);
}
.nav-item.activo svg { stroke: #FFFFFF; }

/* Pie: bloque del usuario (avatar + nombre + tema + salir) */
.sidebar .abajo { margin-top: auto; padding-top: 14px; }
.usuario-box {
  display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap;
  padding: 9px 10px; border-radius: 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.06);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  background: rgba(255,255,255,.14); color: #FFFFFF;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
/* Avatar + nombre ocupan la primera fila; ojito, tema y salir bajan a la segunda */
.abajo .quien { flex: 1 1 calc(100% - 50px); min-width: 0; }
.abajo .quien .mi-clave { display: block; white-space: nowrap; }
.usuario-box .tema-btn:first-of-type { margin-left: 46px; }
.usuario-box .form-salir { margin-left: auto; }
.abajo .quien b { display: block; font-size: 13.5px; color: #F2F5FF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.abajo .quien span, .abajo .quien .mi-clave { font-size: 11.5px; color: var(--sidebar-inactive); }
.abajo .quien .mi-clave:hover { color: #FFFFFF; text-decoration: underline; }
.form-salir { margin: 0; }
.salir { color: var(--sidebar-inactive); font-size: 12.5px; background: none; border: 0; font: inherit;
         font-size: 12.5px; cursor: pointer; min-height: 44px; min-width: 44px; padding: 0 6px; }
.salir:hover { color: #FFFFFF; }
form.en-linea { display: inline; margin: 0; }

/* Botón de tema claro/oscuro */
.tema-btn {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.10);
  display: grid; place-items: center; cursor: pointer;
  transition: transform .18s, background .18s;
}
.tema-btn:hover { transform: scale(1.08); background: rgba(255,255,255,.18); }
.tema-btn svg { width: 17px; height: 17px; stroke: #DCE3FA; }
.tema-btn.flotante { border-color: var(--border); background: var(--muted-bg); }
.tema-btn.flotante svg { stroke: var(--text-2); }
.tema-btn .luna { display: block; }
.tema-btn .sol { display: none; }
[data-theme="dark"] .tema-btn .luna { display: none; }
[data-theme="dark"] .tema-btn .sol { display: block; }
.tema-btn.flotante { position: fixed; top: 20px; right: 20px; z-index: 50; }

/* ---------- Contenido ---------- */
.contenido { flex: 1; min-width: 0; padding: 32px 36px 64px; }
/* Lienzo centrado: el contenido nunca se estira de más; márgenes iguales a ambos lados */
.lienzo { max-width: 1560px; margin: 0 auto; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.topbar .titulo small { display: block; color: var(--text-2); font-size: 13.5px; font-weight: 400; margin-top: 3px; }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  padding: 24px;
  transition: transform .25s ease, box-shadow .25s ease;
}
.card.hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-floating); }

.grid { display: grid; gap: 24px; }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }

/* Hero del dashboard */
.hero {
  border-radius: var(--r-lg);
  background: var(--grad);
  padding: 26px 30px;
  color: var(--hero-texto);
  box-shadow: var(--shadow-floating);
  position: relative; overflow: hidden;
  margin-bottom: 24px;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -80px;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.5), rgba(255,255,255,0) 65%);
}
.hero .hero-titulo { font-size: 12.5px; font-weight: 700; letter-spacing: .08em; opacity: .75; margin-bottom: 12px; }

/* Hero en dos zonas: TENEMOS (plata real) vs NOS DEBEN (por llegar) */
.hero-zonas { display: flex; gap: 24px; align-items: stretch; position: relative; z-index: 1; }
.zona-tenemos { flex: 1; min-width: 0; }
.zona-tenemos .hero-titulo {
  display: inline-block;
  background: #0C1550;
  color: #FFFFFF; opacity: 1;
  padding: 5px 12px; border-radius: 7px;
}
.tenemos-fila { display: flex; gap: 36px; align-items: center; flex-wrap: wrap; }
.mini-cuentas { display: flex; gap: 12px; flex-wrap: wrap; }
.mini-cuenta {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 10px; padding: 10px 18px; min-width: 120px;
  backdrop-filter: blur(6px);
}
.mini-cuenta span {
  display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; opacity: .78; margin-bottom: 3px;
}
.mini-cuenta b { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
.zona-deben {
  /* Franja oscura angosta y discreta: NOS DEBEN es secundario frente a TENEMOS */
  background: linear-gradient(135deg, #16227A 0%, #0C1550 100%);
  border-left: 1px solid rgba(255,255,255,.18);
  margin: -26px -30px -26px 0;
  border-radius: 0 var(--r-lg) var(--r-lg) 0;
  padding: 26px 28px; min-width: 220px; max-width: 250px;
  display: flex; flex-direction: column; justify-content: center;
}
.zona-deben .hero-titulo { margin-bottom: 8px; font-size: 12px; color: #A9C0FF; opacity: .95; }
.zona-deben b { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; color: #FFFFFF; }
.zona-deben span { font-size: 12px; font-weight: 500; color: #A9C0FF; opacity: .85; margin-top: 3px; }
.hero .metricas { display: flex; gap: 44px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .metrica b { display: block; font-size: 42px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; }
.hero .metrica span { font-size: 13px; font-weight: 600; opacity: .72; }
.hero .metrica.chica b { font-size: 24px; }

/* ---------- Hero financiero (tarjeta AZUL: Contamos con · Cuentas · Nos deben) ----------
   Va en azul para resaltar sobre las tarjetas blancas de abajo. */
.hero-fin {
  display: flex; align-items: center; gap: 26px;
  background: linear-gradient(125deg, #4A63F2 0%, #3448D6 52%, #2A38A8 100%);
  color: #fff;
  border-radius: 20px; box-shadow: var(--shadow-floating);
  padding: 26px 28px; margin-bottom: 24px;
  position: relative; overflow: hidden;
}
.hero-fin::before {
  content: ""; position: absolute; top: -90px; right: -30px;
  width: 360px; height: 360px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.16), rgba(255,255,255,0) 68%);
  pointer-events: none;
}
.hero-fin > * { position: relative; z-index: 1; }
.hf-div { width: 1px; background: rgba(255,255,255,.20); flex-shrink: 0; align-self: stretch; }
.hf-label { font-size: 12px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: rgba(255,255,255,.88); margin-bottom: 6px; }
/* Balance */
.hf-balance { display: flex; gap: 16px; align-items: flex-start; flex-shrink: 0; }
.hf-ico-balance {
  width: 52px; height: 52px; border-radius: 15px; flex-shrink: 0;
  background: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 16px rgba(6,12,40,.20);
}
.hf-ico-balance svg { width: 26px; height: 26px; stroke: var(--primary); }
.hf-valor { font-size: clamp(30px, 3.6vw, 44px); font-weight: 800;
  letter-spacing: -.03em; color: #fff; line-height: 1.04; font-variant-numeric: tabular-nums; }
.hf-trend { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; margin-top: 9px; }
.hf-trend svg { width: 16px; height: 16px; }
.hf-trend.up { color: #86EFAC; } .hf-trend.up svg { stroke: #86EFAC; }
.hf-trend.down { color: #FCA5A5; } .hf-trend.down svg { stroke: #FCA5A5; }
.hf-trend span { color: rgba(255,255,255,.85); font-weight: 500; }
/* Cuentas */
.hf-cuentas { flex: 1; min-width: 0; }
.hf-titulo { font-size: 11.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: rgba(255,255,255,.82); margin-bottom: 14px; }
.hf-cuentas-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.hf-cuenta {
  flex: 1 0 130px; min-width: 130px;
  border: 1px solid rgba(255,255,255,.16); border-radius: 14px; padding: 12px 14px;
  background: rgba(255,255,255,.09);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.10);
}
.hf-cuenta-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  margin-bottom: 10px; background: #fff; }
.hf-cuenta-ico svg { width: 19px; height: 19px; stroke: currentColor; }
.hf-cuenta-nom { font-size: 13px; color: rgba(255,255,255,.92); font-weight: 500; margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hf-cuenta-val { font-size: 16.5px; font-weight: 800; letter-spacing: -.02em; color: #fff;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.hf-cuenta-pct { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  color: rgba(255,255,255,.92); margin-top: 8px; }
.pdot { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
/* Nos deben (ícono alineado arriba, igual que "Contamos con") */
.hf-deben { display: flex; gap: 14px; align-items: flex-start; flex-shrink: 0; min-width: 148px; }
.hf-ico-deben { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(6,12,40,.20); }
.hf-ico-deben svg { width: 22px; height: 22px; stroke: #EF4444; }
.hf-deben-val { font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: #fff;
  font-variant-numeric: tabular-nums; }
.hf-cap { font-size: 12.5px; color: rgba(255,255,255,.85); margin-top: 2px; }
/* Solo PC: números menos "bold" (más limpios) y textos de cada caja de cuenta
   un poco más grandes, incluido el dinero. El % se deja igual. En móvil no cambia. */
@media (min-width: 1081px) {
  .hf-valor { font-weight: 600; }
  .hf-deben-val { font-weight: 600; }
  .hf-cuenta-nom { font-size: 15px; }
  .hf-cuenta-val { font-size: 20px; font-weight: 600; }
}
/* Tablet: cuentas en scroll horizontal (single-row-scroll) */
@media (max-width: 1080px) {
  .hf-cuenta { flex: 0 0 128px; }
}
/* Celular: apilar las tres zonas (stack) */
@media (max-width: 760px) {
  .hero-fin { flex-direction: column; align-items: stretch; gap: 18px; padding: 20px; }
  .hf-div { width: auto; height: 1px; align-self: auto; }
  .hf-deben { min-width: 0; }
}

.stat { display: flex; flex-direction: column; gap: 6px; }
.stat span { color: var(--text-2); font-size: 13px; font-weight: 500; }
.stat b { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.stat b.ok { color: var(--ok); }
.stat b.bad { color: var(--bad); }

/* Tarjetas de estadística con ícono de color */
.stat-iconos .card { display: flex; align-items: center; gap: 16px; }
.stat-icono {
  width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
  display: grid; place-items: center;
}
.stat-icono svg { width: 26px; height: 26px; }
.stat-icono.verde   { background: var(--ok-bg); }
.stat-icono.verde svg   { stroke: var(--ok); }
.stat-icono.rojo    { background: var(--bad-bg); }
.stat-icono.rojo svg    { stroke: var(--bad); }
.stat-icono.azul    { background: var(--sidebar-active-bg); }
.stat-icono.azul svg    { stroke: var(--primary); }
.stat-icono.celeste { background: #E4F5FE; }
.stat-icono.celeste svg { stroke: #0EA5E9; }
[data-theme="dark"] .stat-icono.celeste { background: #10344A; }

/* Barras de progreso (cupos, recaudado) */
.progreso-fila { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.progreso-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.progreso-top span { font-size: 11.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--text-2); }
.progreso-top b { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.barra { height: 7px; border-radius: 999px; background: var(--muted-bg); overflow: hidden; }
.barra-fill { height: 100%; border-radius: 999px; transition: width .5s ease; }

/* Resumen compacto de la tarjeta de curso */
.curso-resumen {
  display: flex; align-items: center; gap: 18px;
  padding-top: 14px; border-top: 1px solid var(--divider);
}
.curso-resumen > div { display: flex; flex-direction: column; gap: 2px; }
.curso-resumen span { font-size: 11px; color: var(--text-2); font-weight: 600; }
.curso-resumen b { font-size: 15px; font-variant-numeric: tabular-nums; }
.curso-resumen .btn { margin-left: auto; }

/* Préstamos entre cursos (le deben / debe) bajo el disponible */
.prestamos-curso { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
.prestamo-fila { font-size: 12.5px; padding: 6px 10px; border-radius: 8px; line-height: 1.35; }
.prestamo-fila b { font-variant-numeric: tabular-nums; }
.prestamo-fila small { color: var(--text-2); }
.prestamo-fila.le-deben { background: rgba(34, 197, 94, .10); color: #15803d; }
.prestamo-fila.debe { background: rgba(239, 68, 68, .10); color: #b91c1c; }
:root[data-theme="dark"] .prestamo-fila.le-deben { color: #4ade80; }
:root[data-theme="dark"] .prestamo-fila.debe { color: #f87171; }

/* Tarjeta de estadística con barra de color (estilo referencia) */
.stat-acento { position: relative; }
.stat-acento::before {
  content: ""; position: absolute; left: 0; top: 20px; bottom: 20px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--acento, var(--primary));
}

/* ---------- Tablas ---------- */
.tabla-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-2); font-weight: 600; padding: 10px 12px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 12px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #FAFBFE; }
tfoot td { font-weight: 700; border-top: 2px solid var(--border); border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.chip {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip.ok    { background: var(--ok-bg);   color: var(--ok); }
.chip.warn  { background: var(--warn-bg); color: var(--warn); }
.chip.bad   { background: var(--bad-bg);  color: var(--bad); }
.chip.gris  { background: var(--muted-bg); color: var(--text-2); }
.chip.azul  { background: var(--sidebar-active-bg); color: var(--sidebar-active); }

/* Chip de fecha (resalta la fecha del curso, estilo badge azul) */
.chip-fecha {
  display: inline-block; white-space: nowrap;
  background: var(--sidebar-active-bg); color: var(--sidebar-active);
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .01em;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 22px;
  border-radius: var(--r-sm); border: none; cursor: pointer;
  font-family: inherit; font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em;
  transition: transform .18s ease, box-shadow .18s ease, background .18s;
  text-decoration: none !important;
}
.btn.primario {
  background: var(--primary-btn); color: #fff;
  box-shadow: var(--shadow-btn);
}
.btn.primario:hover { transform: scale(1.02); filter: brightness(1.06); }
.btn.grande { height: 52px; width: 100%; font-size: 15.5px; }
.btn.secundario {
  background: var(--surface); color: #222; border: 1px solid var(--border);
}
.btn.secundario:hover { background: var(--muted-bg); }
.btn.peligro { background: var(--bad-bg); color: var(--bad); }
.btn.chico { height: 36px; padding: 0 14px; font-size: 13px; border-radius: 12px; }

/* ---------- Formularios ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
input, select, textarea {
  width: 100%; height: 54px;
  padding: 0 16px;
  border: 1.5px solid var(--border-input); border-radius: var(--r-input);
  font-family: inherit; font-size: 15px; letter-spacing: -0.01em;
  background: var(--surface); color: var(--text);
  transition: border-color .18s, box-shadow .18s;
}
textarea { height: auto; min-height: 90px; padding: 14px 16px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(23,102,224,.14);
}
input[type="file"] { padding: 13px 16px; height: auto; background: var(--muted-bg); border-style: dashed; }
input[type="date"] { font-variant-numeric: tabular-nums; }
.campo { margin-bottom: 18px; }
.fila-campos { display: grid; gap: 18px; }
.fila-campos.c2 { grid-template-columns: 1fr 1fr; }
.fila-campos.c3 { grid-template-columns: 1fr 1fr 1fr; }
.ayuda { font-size: 12.5px; color: var(--text-2); margin-top: 6px; }

/* Interruptor sí/no (alimentación, hospedaje) */
.sino { display: flex; gap: 10px; }
.sino input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.sino label {
  flex: 1; margin: 0; height: 48px; display: grid; place-items: center;
  border: 1.5px solid var(--border); border-radius: var(--r-input);
  font-size: 14px; font-weight: 600; color: var(--text-2); cursor: pointer;
  transition: border-color .18s, background-color .18s, color .18s;
}
.sino input:focus-visible + label { outline: 3px solid var(--primary); outline-offset: 2px; }
.sino input:checked + label {
  border-color: var(--primary); background: var(--sidebar-active-bg);
  color: var(--sidebar-active);
}

/* Formulario estilo carrito: campos a la izquierda, resumen fijo a la derecha */
.form-carrito {
  display: grid; grid-template-columns: minmax(0, 1fr) 400px;
  gap: 24px; align-items: start;
}
.resumen { position: sticky; top: 24px; }
.resumen h3 { margin-bottom: 12px; }
.resumen .linea {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 9px 0; font-size: 14.5px; color: var(--text-2);
}
.resumen .linea[hidden] { display: none; }
.resumen .linea b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }
.resumen .linea b.desc { color: var(--bad); }
.resumen .divisor { border-top: 1.5px solid var(--border); margin: 8px 0; }
.resumen .linea.total span {
  font-size: 11.5px; font-weight: 700; letter-spacing: .07em; color: var(--text-2);
}
.resumen .linea.total b { font-size: 28px; font-weight: 800; color: var(--primary); letter-spacing: -0.03em; }
.resumen .btn { margin-top: 16px; }
.resumen .ayuda { margin: 4px 0 2px; }

/* Tarjeta de total en vivo */
.total-vivo {
  border-radius: var(--r-md);
  background: var(--grad);
  padding: 20px 24px;
  color: var(--hero-texto);
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 10px 26px rgba(77,141,247,.30);
}
.total-vivo span { font-weight: 600; font-size: 13.5px; opacity: .75; }
.total-vivo b { font-size: 27px; font-weight: 800; letter-spacing: -0.04em; }

/* ---------- Foto de alumno ---------- */
.foto-subida { display: flex; gap: 18px; align-items: center; }
.foto-preview {
  width: 84px; height: 84px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--muted-bg);
  border: 2px dashed var(--border);
  display: grid; place-items: center;
  overflow: hidden;
  transition: border-color .18s;
}
.foto-preview svg { width: 30px; height: 30px; stroke: #A9B2C6; }
.foto-preview img { width: 100%; height: 100%; object-fit: cover; }
.foto-preview.con-foto { border-style: solid; border-color: var(--primary-light); }

.avatar-alumno {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--surface);
  box-shadow: 0 2px 8px rgba(25,40,80,.15);
  vertical-align: middle;
}
.avatar-alumno.iniciales {
  display: inline-grid; place-items: center;
  background: var(--sidebar-active-bg); color: var(--sidebar-active);
  font-weight: 700; font-size: 13px;
}
.celda-alumno { display: flex; align-items: center; gap: 11px; }
.foto-grande {
  width: 92px; height: 92px; border-radius: 26px; object-fit: cover;
  box-shadow: var(--shadow-card);
}
.foto-grande.iniciales {
  display: grid; place-items: center;
  background: var(--grad); color: var(--hero-texto);
  font-weight: 800; font-size: 30px;
}
.foto-marco { position: relative; width: 92px; height: 92px; flex-shrink: 0; }
.foto-marco .foto-grande { display: block; width: 100%; height: 100%; }
.foto-cambiar {
  position: absolute; right: -6px; bottom: -6px;
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--surface); cursor: pointer;
  background: var(--primary-btn);
  display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(15,98,217,.35);
  transition: transform .18s;
}
.foto-cambiar:hover { transform: scale(1.08); }
.foto-cambiar svg { width: 16px; height: 16px; stroke: #fff; }

/* ---------- Egreso por líneas (curso + cuenta + valor) ---------- */
.resumen-cursos {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 14px; padding: 10px 12px;
  background: var(--muted-bg); border-radius: var(--r-input);
}
.resumen-cursos .rc-titulo { font-size: 12.5px; font-weight: 600; color: var(--text-2); }

.linea-egreso {
  padding: 10px; margin-bottom: 10px;
  border: 1.5px solid var(--border); border-radius: var(--r-input);
  background: var(--muted-bg);
}
.le-campos { display: flex; gap: 10px; align-items: center; }
.le-campos .l-edicion { flex: 1.6; min-width: 0; }
.le-campos .l-cuenta  { flex: 1;   min-width: 0; }
.le-campos .l-valor   { flex: 1;   min-width: 0; }
.le-campos .l-quitar {
  width: 40px; height: 54px; flex-shrink: 0;
  border: 1.5px solid var(--border); border-radius: var(--r-input);
  background: #fff; color: var(--bad); font-size: 15px; cursor: pointer;
  transition: background .18s;
}
.le-campos .l-quitar:hover { background: var(--bad-bg); }
.linea-abono { margin-bottom: 8px; }
.le-campos .la-cuenta { flex: 1.4; min-width: 0; }
.le-campos .la-valor  { flex: 1;   min-width: 0; }
.l-disp { font-size: 12px; margin-top: 6px; min-height: 15px; color: var(--text-2); }
.l-disp.bien { color: var(--ok); font-weight: 600; }
.l-disp.mal  { color: var(--bad); font-weight: 600; }
.l-disp.aviso { color: #b45309; font-weight: 600; }
:root[data-theme="dark"] .l-disp.aviso { color: #fbbf24; }
.l-prestamo {
  margin-top: 8px; padding: 10px 12px; border-radius: 8px;
  background: rgba(245, 158, 11, .10); border: 1px solid rgba(245, 158, 11, .35);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.l-prestamo-txt { font-size: 12.5px; font-weight: 600; color: #b45309; }
:root[data-theme="dark"] .l-prestamo-txt { color: #fbbf24; }
.l-prestamo .l-prestar { flex: 1; min-width: 160px; }
#total-egreso { color: var(--primary); }
.ayuda.conv-mal { color: var(--bad); font-weight: 600; }
.conv-lado { border: 1.5px solid var(--border); border-radius: var(--r-input);
  padding: 12px 14px 4px; margin: 12px 0; background: var(--muted-bg); }
.conv-lado-tit { font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-2); margin-bottom: 8px; }

@media (max-width: 560px) {
  .le-campos { flex-wrap: wrap; }
  .le-campos .l-edicion { flex: 1 1 100%; }
  .le-campos .l-cuenta  { flex: 1 1 55%; }
  .le-campos .l-valor   { flex: 1 1 30%; }
}

/* ---------- Consentimiento (política de no reembolso) ---------- */
.consentimiento {
  margin-top: 6px;
  border: 1.5px solid #F4D9A6;
  background: #FDF8EC;
  border-radius: var(--r-md);
  padding: 16px 18px;
}
.consentimiento.oculto { display: none; }
.check-politica { display: flex; gap: 12px; align-items: flex-start; margin: 0; cursor: pointer; }
.check-politica input {
  width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0;
  accent-color: var(--primary);
}
.check-politica span {
  font-size: 13px; line-height: 1.55; color: #7A5A17; font-weight: 400;
}
.check-politica span b { color: #8A6512; }

/* ---------- Búsqueda ---------- */
.buscador { position: relative; max-width: 380px; flex: 1; }
.buscador input { height: 46px; border-radius: var(--r-sm); padding-left: 42px; }
.buscador svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; stroke: var(--text-2);
}
.sugerencias {
  position: absolute; top: 52px; left: 0; right: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); box-shadow: var(--shadow-floating);
  overflow: hidden; display: none;
}
.sugerencias.abierta { display: block; }
.sugerencias button {
  display: block; width: 100%; text-align: left; padding: 12px 16px;
  background: none; border: none; font-family: inherit; font-size: 14px; cursor: pointer;
  border-bottom: 1px solid var(--divider);
}
.sugerencias button:hover { background: var(--sidebar-active-bg); }
.sugerencias small { color: var(--text-2); }

/* ---------- Flash ---------- */
.flash {
  padding: 14px 20px; border-radius: var(--r-sm); margin-bottom: 22px;
  font-weight: 600; font-size: 14px;
  animation: bajar .35s ease;
}
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--bad-bg); color: var(--bad); }
@keyframes bajar { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; } }

/* ---------- Login (glassmorphism premium) ---------- */
.login-fondo {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  position: relative; overflow: hidden;
  /* Modo claro: azul suave */
  background: radial-gradient(circle at 28% 18%, #D6E6FF 0%, #E6EEFF 42%, #F1F5FC 100%);
}
[data-theme="dark"] .login-fondo {
  background: radial-gradient(circle at 28% 18%, #163A8A 0%, #0E1738 45%, #070411 100%);
}
/* Glow superior izquierdo */
.login-glow {
  position: absolute; top: -120px; left: 8%;
  width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, rgba(102,179,255,.55), rgba(102,179,255,0) 68%);
  filter: blur(80px); pointer-events: none; z-index: 0;
}
[data-theme="dark"] .login-glow { background: radial-gradient(circle, rgba(102,179,255,.42), rgba(102,179,255,0) 68%); }

.login-panel {
  position: relative; z-index: 1;
  width: min(880px, 100%);
  background: rgba(255,255,255,.55);
  backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 28px;
  box-shadow: 0 30px 80px rgba(20,45,85,.22), 0 0 120px rgba(60,120,255,.06);
  display: grid; grid-template-columns: 40% 60%;
  overflow: hidden;
  transition: transform .25s ease;
}
.login-panel:hover { transform: translateY(-4px); }
[data-theme="dark"] .login-panel {
  background: rgba(18,20,45,.55);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 30px 80px rgba(0,0,0,.45), 0 0 120px rgba(60,120,255,.10);
}

.login-izq {
  padding: 52px 44px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 24px;
  border-right: 1px solid rgba(120,140,190,.22);
  text-align: left;
}
[data-theme="dark"] .login-izq { border-right: 1px solid rgba(255,255,255,.10); }
.login-izq .logo-marca { max-width: 190px; }
.login-lema {
  font-family: "Coolvetica", sans-serif; font-weight: 400;
  font-size: clamp(38px, 11vw, 58px); line-height: .92; letter-spacing: 0;
  text-align: left; margin: 2px 0;
}
.login-lema span { display: block; }
.login-lema .l1, .login-lema .l2 { color: #16295C; }
.login-lema .l3 { color: #4361EE; opacity: 1; }
[data-theme="dark"] .login-lema .l1, [data-theme="dark"] .login-lema .l2 { color: #FFFFFF; }
[data-theme="dark"] .login-lema .l3 { color: #5C82F5; opacity: 1; }
.login-sub-etiqueta {
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
  color: var(--text-2);
  padding: 7px 16px; border-radius: 999px;
  border: 1px solid rgba(120,140,190,.3);
}
[data-theme="dark"] .login-sub-etiqueta { color: #98A2C7; border-color: rgba(255,255,255,.16); }

.login-der { padding: 52px 48px; }
.login-der h2 { margin-bottom: 4px; font-size: 30px; letter-spacing: -0.03em; }
.login-der .sub { color: var(--text-2); font-size: 13.5px; margin-bottom: 28px; }
[data-theme="dark"] .login-der h2 { color: #FFFFFF; }
[data-theme="dark"] .login-der .sub { color: #98A2C7; }
[data-theme="dark"] .login-der label { color: #B8C2DF; }
[data-theme="dark"] .login-der input {
  background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.10); color: #FFFFFF;
}
[data-theme="dark"] .login-der input:focus {
  border-color: #3AA2FF; box-shadow: 0 0 0 4px rgba(58,162,255,.14);
}
.login-pie { margin-top: 24px; font-size: 11.5px; color: var(--text-2); text-align: center; }
[data-theme="dark"] .login-pie { color: #6E7695; }
/* Campo de clave con botón de ojo */
.campo-clave { position: relative; }
.ojo-clave {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 4px;
  color: var(--text-2);
}
.ojo-clave svg { width: 19px; height: 19px; stroke: currentColor; }

.compromiso-banner { display: flex; align-items: center; gap: 18px; }
[data-theme="dark"] .compromiso-banner .stat-icono { background: #3A2A0F !important; }

/* Logística */
.resumen-tallas { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.oculto-copia { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Neto de la academia (compromisos) */
.neto-fila { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; font-size: 14.5px; }
.neto-fila span { color: var(--text-2); }
.neto-fila b { font-variant-numeric: tabular-nums; font-weight: 600; }
.neto-divisor { border-top: 1.5px solid var(--border); margin: 6px 0; }
.neto-fila.total span { font-weight: 700; color: var(--text); }
.neto-fila.total b { font-size: 22px; font-weight: 800; }

/* Neto por curso (tarjeta del dashboard) — estado de resultados tipo ledger */
.neto-curso { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); }
.neto-curso-tit { display: flex; align-items: center; justify-content: space-between;
  gap: 8px; font-weight: 700; font-size: 13.5px; color: var(--text); margin-bottom: 10px; }

.ledger { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.ledger-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 9px 12px; font-size: 13.5px; border-top: 1px solid var(--divider); }
.ledger-row:first-child { border-top: none; }
.ledger-row span { color: var(--text); }
.ledger-row b { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); }
.ledger-row small { font-size: 11px; color: var(--text-2); font-weight: 400; }
.ledger-row.resta span { color: var(--text-2); }
.ledger-row.neto { background: var(--muted-bg); border-top: 1.5px solid var(--border); }
.ledger-row.neto span { font-weight: 800; }
.ledger-row.neto b { font-size: 19px; font-weight: 800; }
.ledger-row.caja { background: var(--muted-bg); }
.ledger-row.caja span { font-weight: 700; }

/* Tabla de compromisos dentro del ledger (nombre · estado · valor, con líneas) */
/* Desglose de compromisos plegable (para que la tarjeta no se alargue tanto) */
.comp-detalle > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-top: 1px solid var(--divider);
  font-size: 12px; font-weight: 600; color: var(--primary);
}
.comp-detalle > summary::-webkit-details-marker { display: none; }
.comp-detalle > summary:hover { background: var(--muted-bg); }
.comp-detalle .comp-chevron { width: 14px; height: 14px; stroke: var(--primary); transition: transform .18s; }
.comp-detalle[open] .comp-chevron { transform: rotate(180deg); }
.comp-detalle .txt-ocultar { display: none; }
.comp-detalle[open] .txt-ver { display: none; }
.comp-detalle[open] .txt-ocultar { display: inline; }
.comp-pagado { font-size: 12px; color: var(--text-2); padding: 2px 2px 8px; }
.comp-pagado b { font-variant-numeric: tabular-nums; }
.comp-pagado span { color: var(--text-2); }

.tabla-comp { width: 100%; border-collapse: collapse; background: var(--muted-bg); }
.tabla-comp td { padding: 7px 12px; border-top: 1px solid var(--divider); font-size: 12.5px; vertical-align: middle; }
.tabla-comp tr:first-child td { border-top: 1px solid var(--border); }
.tc-nombre { color: var(--text); font-weight: 600; white-space: nowrap; }
.tc-nombre .cmp-punto { display: inline-block; width: 7px; height: 7px; border-radius: 999px;
  margin-right: 8px; vertical-align: middle; }
.tc-estado { text-align: center; white-space: nowrap; width: 1%; }
.tc-valor { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700;
  color: var(--text); white-space: nowrap; width: 1%; }
.cmp-punto { background: var(--warn-vivo); }
.cmp-punto.cmp-cubierto { background: var(--ok-vivo); }
.cmp-punto.cmp-parcial { background: var(--warn-vivo); }
.cmp-punto.cmp-pendiente { background: var(--text-2); opacity: .5; }
.estado-pill { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 9px;
  border-radius: 999px; letter-spacing: .02em; }
.est-cubierto { background: var(--ok-bg); color: var(--ok); }
.est-parcial { background: var(--warn-bg); color: var(--warn); }
.est-pendiente { background: var(--surface); color: var(--text-2); border: 1px solid var(--border); }

/* Botón / modo privado: ocultar cifras en público */
.ojo-privado { display: inline-flex; align-items: center; gap: 8px; }
.ojo-privado svg { width: 18px; height: 18px; stroke: currentColor; }
.ojo-privado .ojo-ocultar { display: none; }
[data-privado="1"] .ojo-privado .ojo-ver { display: none; }
[data-privado="1"] .ojo-privado .ojo-ocultar { display: inline; }
/* La cifra real se vuelve invisible pero conserva su espacio; encima van los puntos */
[data-privado="1"] .cifra { color: transparent !important; position: relative; }
[data-privado="1"] .cifra::after {
  content: "••••••"; position: absolute; left: 0; right: 0; text-align: inherit;
  color: var(--text); letter-spacing: 1px; pointer-events: none;
}
[data-privado="1"] .num .cifra::after,
[data-privado="1"] .ledger-row .cifra::after,
[data-privado="1"] .curso-resumen .cifra::after,
[data-privado="1"] .tabla-comp .tc-valor.cifra::after { text-align: right; }
[data-privado="1"] .hero .cifra::after,
[data-privado="1"] .hero-fin .cifra::after { color: #fff; }
[data-privado="1"] .compromiso-banner .cifra::after,
[data-privado="1"] .compromiso-banner b.cifra::after { color: var(--text); }

/* ---------- Detalle / definiciones ---------- */
.definiciones { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px 24px; }
.definiciones div span { display: block; font-size: 12px; color: var(--text-2); font-weight: 600; margin-bottom: 3px; }
.definiciones div b { font-size: 14.5px; font-weight: 600; }

/* ---------- Panel de ajustes: filas (descripción izq · control der) ----------
   Principio reutilizable: en pantallas de configuración, los ajustes compactos
   van como filas dentro de UNA tarjeta, separadas por líneas — nunca en rejillas
   de varias columnas con tarjetas de alturas dispares. */
.ajustes-lista .ajuste-fila {
  display: flex; justify-content: space-between; align-items: center; gap: 32px;
  padding: 20px 2px; border-top: 1px solid var(--divider);
}
.ajustes-lista .ajuste-fila:first-child { border-top: none; padding-top: 4px; }
.ajustes-lista .ajuste-fila:last-child { padding-bottom: 4px; }
.ajuste-info { min-width: 0; }
.ajuste-info h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ajuste-info p { font-size: 13px; color: var(--text-2); line-height: 1.55; max-width: 560px; }
.ajuste-info p b { color: var(--text); }
.ajuste-accion { flex-shrink: 0; display: flex; gap: 10px; align-items: center; }
/* Descripción introductoria dentro de las tarjetas-formulario de ajustes */
.ajuste-desc { color: var(--text-2); font-size: 13.5px; line-height: 1.55;
  margin-bottom: 18px; max-width: 660px; }
.ajuste-desc b { color: var(--text); }
@media (max-width: 760px) {
  .ajustes-lista .ajuste-fila { flex-direction: column; align-items: stretch; gap: 12px; }
  .ajuste-accion { justify-content: flex-start; }
  .ajuste-accion .btn { flex: 1; }
}

/* Utilidad: en una rejilla de 2 columnas, iguala la altura de las tarjetas
   para que los bordes inferiores queden alineados (evita el aspecto disparejo). */
.grid.igual > .seccion { display: flex; flex-direction: column; }
.grid.igual > .seccion > .card { flex: 1; }

.seccion { margin-bottom: 24px; }
.seccion-titulo { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }

dialog {
  border: none; border-radius: var(--r-md); box-shadow: var(--shadow-floating);
  padding: 28px; width: min(440px, 92vw);
  margin: auto;  /* re-centrar: el reset global (* margin:0) anula el centrado nativo */
  max-height: 92vh; overflow-y: auto;
}
dialog.grande { width: min(680px, 94vw); }
dialog::backdrop { background: rgba(23,23,23,.35); backdrop-filter: blur(3px); }

/* Animación de entrada escalonada */
.anim { animation: aparecer .5s ease backwards; }
.anim:nth-child(2) { animation-delay: .06s; }
.anim:nth-child(3) { animation-delay: .12s; }
.anim:nth-child(4) { animation-delay: .18s; }
@keyframes aparecer { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid.c4 { grid-template-columns: repeat(2, 1fr); }
  .grid.c3 { grid-template-columns: repeat(2, 1fr); }
}
/* Barra superior móvil (con hamburguesa) — oculta en escritorio */
.movil-top { display: none; }
.menu-backdrop { display: none; }

/* ===== Celular y tablet en vertical: menú lateral tipo cajón (drawer) ===== */
@media (max-width: 900px) {
  .shell { display: block; }

  /* Barra superior flotante (navy, redondeada) con hamburguesa a la izq + logo centrado */
  .movil-top {
    display: flex; align-items: center; justify-content: center; position: relative;
    position: sticky; top: 12px; z-index: 90;
    margin: 0 0 16px; padding: 13px 16px;
    background: var(--sidebar-bg);
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 18px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .16);
  }
  .movil-top .logo-azul { display: none; }
  .movil-top .logo-blanco { display: block; }
  .movil-top .movil-logo { height: 40px; width: auto; }
  .hamburguesa {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, .20); background: rgba(255, 255, 255, .12);
    display: grid; place-items: center; cursor: pointer;
  }
  .hamburguesa svg { width: 22px; height: 22px; stroke: #fff; }

  /* El sidebar se convierte en cajón deslizante desde la izquierda */
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100dvh; width: 264px;
    margin: 0; border-radius: 0 20px 20px 0; z-index: 200;
    transform: translateX(-100%); transition: transform .26s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
  }
  body.menu-abierto .sidebar { transform: translateX(0); }
  body.menu-abierto .menu-backdrop {
    display: block; position: fixed; inset: 0; z-index: 150;
    background: rgba(6, 12, 30, .5); backdrop-filter: blur(2px);
  }
  .contenido { padding: 12px 12px 48px; }
  .lienzo { max-width: 100%; }
}

/* ===== Ajustes de contenido para pantallas angostas ===== */
@media (max-width: 860px) {
  .grid.c2, .fila-campos.c2, .fila-campos.c3,
  .form-carrito, .grid-dona { grid-template-columns: 1fr !important; }
  .grid.igual > .seccion > .card { flex: none; }
  .resumen { position: static; }
  .login-panel { grid-template-columns: 1fr; }
  .login-izq { padding: 34px 30px 28px; gap: 18px; border-right: none; border-bottom: 1px solid rgba(120,140,190,.22); }
  .login-izq .logo-marca { max-width: 160px; }
  .login-der { padding: 30px 30px 34px; }
  .login-der h2 { font-size: 25px; }
  .topbar { flex-direction: column; align-items: stretch; gap: 14px; }
  .topbar .buscador { max-width: none; }
  /* En móvil, los campos van a 16px para que iOS/Safari NO haga zoom al tocarlos
     (por debajo de 16px, Safari amplía la página y se puede arrastrar de lado). */
  input, select, textarea { font-size: 16px; }
}

/* Celular angosto: las tarjetas de resumen (4/3) sí pasan a una sola columna */
@media (max-width: 620px) {
  .grid.c3 { grid-template-columns: 1fr !important; }
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px; }
}
@media (max-width: 440px) {
  .grid.c4 { grid-template-columns: 1fr !important; }
}

/* ============================================================
   Plan de mejoras 2026-09-14 — accesibilidad (WCAG 2.2 AA), móvil y listas
   ============================================================ */

/* Los hijos de una rejilla pueden encogerse: evita el desborde horizontal a 375 px (U-10) */
.grid > *, .fila-campos > *, .form-carrito > * { min-width: 0; }

/* Foco visible en todo lo interactivo (2.4.7 / 2.4.11) */
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

/* Solo para lectores de pantalla */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Saltar al contenido (2.4.1) */
.saltar { position: absolute; left: 12px; top: -60px; z-index: 1000; background: var(--surface); color: var(--text);
  padding: 10px 16px; border-radius: var(--r-sm); box-shadow: var(--shadow-floating); font-weight: 600; }
.saltar:focus { top: 12px; }

/* Registros anulados: tachado + chip, sin opacidad que rompa el contraste (U-07) */
tr.fila-anulada td { color: var(--text-2); }
tr.fila-anulada td.num b, tr.fila-anulada td b { text-decoration: line-through; }

/* Mensajes */
.flash { position: relative; }
.dialogo-error { margin: 0 0 14px; }

/* Filtros de listas */
.filtros { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end; margin-bottom: 18px; padding: 16px 18px; }
.filtros .filtro { flex: 1 1 150px; min-width: 0; }
.filtros .filtro-buscar { flex: 2 1 240px; }
.filtros label { margin-bottom: 5px; font-size: 12px; }
.filtros input, .filtros select { height: 44px; font-size: 14px; }
.filtro-acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.filtro-acciones .btn { height: 44px; }
.total-filtro { margin: 0 0 12px; color: var(--text-2); font-size: 14px; }
.total-filtro b { color: var(--text); font-variant-numeric: tabular-nums; }
td.vacio { text-align: center; color: var(--text-2); padding: 36px; }

/* Paginación */
.paginacion { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-top: 14px; margin-top: 4px; border-top: 1px solid var(--divider); font-size: 13.5px; color: var(--text-2); }
.pag-controles { display: flex; gap: 10px; align-items: center; }

/* Listas como tarjetas en el celular: nombre, saldo y acción siempre a la vista (U-11) */
@media (max-width: 620px) {
  table.tabla-tarjetas thead { display: none; }
  table.tabla-tarjetas, table.tabla-tarjetas tbody, table.tabla-tarjetas tr, table.tabla-tarjetas td { display: block; width: 100%; }
  table.tabla-tarjetas tbody tr { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px;
    margin-bottom: 12px; background: var(--surface); }
  table.tabla-tarjetas td { border: 0; padding: 5px 0; display: flex; justify-content: space-between; gap: 12px;
    text-align: right; white-space: normal; }
  table.tabla-tarjetas td[data-label]::before { content: attr(data-label); color: var(--text-2); font-size: 12.5px;
    font-weight: 600; text-align: left; flex-shrink: 0; }
  table.tabla-tarjetas td.celda-titulo { display: block; text-align: left; }
  table.tabla-tarjetas td.celda-titulo::before { display: none; }
  table.tabla-tarjetas td.celda-destacada b { font-size: 16px; }
  table.tabla-tarjetas td.acciones { justify-content: flex-end; flex-wrap: wrap; padding-top: 8px; }
  table.tabla-tarjetas td.acciones:empty { display: none; }
  table.tabla-tarjetas td.vacio { display: block; text-align: center; }
  table.tabla-tarjetas tfoot { display: block; }
  table.tabla-tarjetas tfoot tr { display: block; border: 0; padding: 8px 0; }
  table.tabla-tarjetas tfoot td { display: flex; justify-content: space-between; border: 0; padding: 4px 0; }
  table.tabla-tarjetas tfoot td:empty { display: none; }
  table.tabla-tarjetas tfoot td[data-label]::before { content: attr(data-label); }
}

/* Botón "ojito" disponible en todas las pantallas (U-16) */
.privado-btn { display: inline-flex; align-items: center; gap: 6px; }

/* Respeta "reducir movimiento" del sistema (2.3.3) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .btn.primario:hover { transform: none; }
}
/* Encabezados con jerarquía correcta y el aspecto de siempre */
.h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; }
.h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.03em; }
.bloque-desc { display: block; color: var(--text); margin-bottom: 6px; }
/* Etiqueta de un grupo de controles (mismo aspecto que label) */
.etiqueta { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }

/* ===================== Funcionalidades nuevas (M5) ===================== */

/* Búsqueda global en la parte superior (F-01) */
.busqueda-global { position: relative; max-width: 560px; margin: 0 0 18px; }
.busqueda-global svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px;
  stroke: var(--text-2); pointer-events: none; }
.busqueda-global input { height: 46px; padding-left: 42px; border-radius: var(--r-sm); font-size: 14.5px; }

.lista-simple { list-style: none; margin: 0; padding: 0; }
.lista-simple li { padding: 8px 0; border-bottom: 1px solid var(--divider); font-size: 14px; line-height: 1.5; }
.lista-simple li:last-child { border-bottom: 0; }

/* Actividad: acciones delicadas resaltadas con texto, no solo color */
td.celda-alerta b { color: var(--bad); }
.detalles-ajuste summary { cursor: pointer; }

/* Cierre de caja (F-05) */
.tabla-cierre .input-contado { height: 44px; max-width: 180px; margin-left: auto; text-align: right; }
.dif.ok { color: var(--ok); }
.dif.bad { color: var(--bad); }
.cierre { padding: 12px 0; border-bottom: 1px solid var(--divider); }
.cierre:last-child { border-bottom: 0; }
.cierre-cab { font-size: 14px; margin-bottom: 4px; }

/* Reporte: gráfica de barras agrupadas (F-09). Paleta validada: azul/naranja, contraste ≥ 3:1. */
:root { --serie-1: #2a78d6; --serie-2: #eb6834; --grafica-grid: #E6EAF1; --grafica-eje: var(--text-2); }
:root[data-theme="dark"] { --serie-1: #3987e5; --serie-2: #d95926; --grafica-grid: #24304D; }
.leyenda { display: flex; gap: 18px; list-style: none; margin: 0 0 10px; padding: 0; font-size: 13px; color: var(--text-2); }
.leyenda li { display: flex; align-items: center; gap: 6px; }
.muestra { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.muestra.serie-1 { background: var(--serie-1); }
.muestra.serie-2 { background: var(--serie-2); }
.grafica-wrap { position: relative; overflow-x: auto; }
.grafica-barras { width: 100%; min-width: 620px; height: auto; display: block; }
.grafica-barras path.serie-1 { fill: var(--serie-1); }
.grafica-barras path.serie-2 { fill: var(--serie-2); }
.grafica-barras .grid-linea { stroke: var(--grafica-grid); stroke-width: 1; }
.grafica-barras .base { stroke: var(--border-input); stroke-width: 1; }
.grafica-barras .eje { fill: var(--grafica-eje); font-size: 12px; font-family: inherit; }
.grafica-barras .zona { fill: transparent; }
.grafica-barras g.mes { outline: none; cursor: default; }
.grafica-barras g.mes:focus .zona { fill: var(--muted-bg); }
.grafica-barras g.mes.atenuado path { opacity: .35; }
.tooltip-grafica { position: absolute; z-index: 5; min-width: 170px; padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-floating); border: 1px solid var(--border);
  font-size: 13px; display: flex; flex-direction: column; gap: 3px; pointer-events: none; }
.tooltip-grafica .fila-tip { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
[data-privado="1"] .grafica-barras, [data-privado="1"] .tooltip-grafica { filter: blur(7px); }

/* Impresión del reporte (y de cualquier pantalla): sin menú ni controles */
@media print {
  .sidebar, .movil-top, .busqueda-global, .saltar, .no-imprimir, .filtros, .paginacion, .acciones, .flash { display: none !important; }
  .shell { display: block; }
  .contenido { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  body { background: #fff; }
}

/* Un importe con modo privado dentro de un indicador conserva el tamaño y color del indicador
   (no el estilo de etiqueta de ".stat span"). */
.stat .cifra, .definiciones .cifra, .neto-fila .cifra, .total-filtro .cifra { font: inherit; color: inherit; letter-spacing: inherit; margin: 0; display: inline; }
