/* =============================================================================
   NORTH AMERICAN ENGLISH ACADEMY — HOJA DE ESTILOS
   La estructura es la de los sistemas que ya usa el equipo: menú a la
   izquierda apoyado en el fondo y el área de trabajo flotando como una
   tarjeta. La paleta sale de la marca: rojo North American, azul tinta y
   papel cálido. Poppins para títulos, DM Sans para todo lo demás.
   ============================================================================= */

:root {
  --bg:          #F3F1EC;
  --bg-2:        #EDEAE3;
  --surface:     #FFFFFF;
  --surface-2:   #F8F7F3;
  --surface-3:   #F0EEE8;
  --sunk:        #E8E5DD;
  --text:        #0E1A2F;
  --text-2:      #4A5468;
  --text-3:      #868EA0;
  --line:        #E8E5DE;
  --line-2:      #D8D4CA;

  --accent:      #E31D23;
  --accent-2:    #C3161C;
  --accent-soft: #FCEBEC;
  --on-accent:   #FFFFFF;

  --ink:         #0E1A2F;
  --ink-2:       #14243F;
  --on-ink:      #FFFFFF;
  --sky:         #DCE5F3;

  --alerta:   #C62F2F;
  --atencion: #C9821A;
  --ok:       #2E8B57;
  --info:     #3862B6;

  --display: 'Poppins', 'Segoe UI', system-ui, sans-serif;
  --ui: 'DM Sans', 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --r-xs: 6px;
  --r: 10px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  --sombra:      0 2px 8px rgba(14,26,47,.08), 0 22px 50px rgba(14,26,47,.16);
  --sombra-card: 0 1px 2px rgba(14,26,47,.05), 0 4px 14px rgba(14,26,47,.06);
  --sombra-sm:   0 1px 3px rgba(14,26,47,.08);

  color-scheme: light;
}

/* El tema oscuro es el de las láminas oscuras de la presentación: azul tinta
   profundo, con el rojo intacto. Los colores de estado se quedan porque ahí el
   color es información. */
:root[data-theme="dark"] {
  --bg:          #08101D;
  --bg-2:        #0C1626;
  --surface:     #121F35;
  --surface-2:   #172741;
  --surface-3:   #1E3150;
  --sunk:        #060C17;
  --text:        #EEF2F8;
  --text-2:      #B4BED0;
  --text-3:      #7D89A1;
  --line:        #1F3253;
  --line-2:      #2C4369;

  --accent:      #F0383E;
  --accent-2:    #FF5257;
  --accent-soft: rgba(240,56,62,.14);
  --ink:         #EEF2F8;
  --ink-2:       #FFFFFF;
  --on-ink:      #0E1A2F;
  --sky:         #1E3150;

  --alerta:   #EF7A70;
  --atencion: #E7B45A;
  --ok:       #6FC793;
  --info:     #82A6EA;

  --sombra:      0 2px 6px rgba(0,0,0,.34), 0 18px 44px rgba(0,0,0,.42);
  --sombra-card: 0 1px 2px rgba(0,0,0,.24), 0 6px 18px rgba(0,0,0,.22);
  --sombra-sm:   0 1px 3px rgba(0,0,0,.28);

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: var(--ui); font-size: 14.5px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--info); }
h1, h2, h3 { font-weight: 600; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-3); }

.oculto { display: none !important; }
.texto-suave { color: var(--text-2); }
.texto-tenue { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }
.derecha { text-align: right; }
.rojo-txt { color: var(--alerta); }
.verde-txt { color: var(--ok); }
.ambar-txt { color: var(--atencion); }

.ico {
  width: 1em; height: 1em; flex: none; display: inline-block; vertical-align: -0.14em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- logotipo ---------- */
.marca-img { display: block; width: 100%; height: auto; }
.solo-oscuro { display: none; }
:root[data-theme="dark"] .solo-claro  { display: none; }
:root[data-theme="dark"] .solo-oscuro { display: block; }

/* =============================================================================
   INGRESO
   ============================================================================= */

.login {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 20px;
  background:
    radial-gradient(900px 600px at 92% -8%, rgba(227,29,35,.16), transparent 62%),
    radial-gradient(900px 700px at -8% 108%, rgba(56,98,182,.20), transparent 62%),
    var(--bg);
}
:root[data-theme="dark"] .login {
  background:
    radial-gradient(1000px 700px at 92% -8%, rgba(227,29,35,.22), transparent 62%),
    radial-gradient(1000px 760px at -8% 108%, rgba(56,98,182,.28), transparent 62%),
    #0B1424;
}
.login-caja {
  width: min(420px, 100%); background: var(--surface); border-radius: var(--r-xl);
  box-shadow: var(--sombra); padding: 36px 34px 28px;
}
.login-marca { width: 100%; max-width: 250px; margin: 0 auto 10px; }
.login-sub {
  text-align: center; font-family: var(--display); font-size: 11px; font-weight: 600;
  letter-spacing: .22em; text-transform: uppercase; color: var(--text-3); margin-bottom: 26px;
}
.login-error { color: var(--alerta); font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.login-pie { text-align: center; font-size: 11.5px; color: var(--text-3); margin-top: 22px; line-height: 1.6; }
.login-demo {
  margin-top: 16px; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2);
  font-size: 12px; color: var(--text-2); line-height: 1.6; border: 1px dashed var(--line-2);
}
.login-demo b { color: var(--text); }
.login-demo button {
  border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r-pill);
  padding: 2px 10px; margin: 3px 3px 0 0; cursor: pointer; font-size: 11.5px;
}
.login-demo button:hover { border-color: var(--accent); color: var(--accent); }

/* =============================================================================
   ESTRUCTURA
   ============================================================================= */

.app { display: none; height: 100vh; height: 100dvh; grid-template-columns: 262px 1fr; }
.app.activa { display: grid; }

.lateral { display: flex; flex-direction: column; min-height: 0; }
.lateral-marca { padding: 24px 24px 10px; }
.lateral-logo { width: 100%; max-width: 178px; }
.lateral-tag {
  font-family: var(--display); font-size: 9.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .2em; color: var(--text-3); margin-top: 10px;
}

/* ---------- selector de sede ---------- */
.sede-caja { padding: 8px 14px 4px; }
.sede-titulo {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .16em; color: var(--text-3);
  padding: 0 4px 7px;
}
.sede-switch {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px;
  background: var(--surface-3); border-radius: var(--r);
}
.sede-switch button {
  border: 0; background: none; border-radius: 7px; padding: 7px 4px; cursor: pointer;
  font-size: 12px; color: var(--text-2); font-weight: 500; transition: background .14s, color .14s;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.sede-switch button:hover { color: var(--text); }
.sede-switch button.activo { background: var(--surface); color: var(--text); box-shadow: var(--sombra-sm); font-weight: 600; }
.sede-switch i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.sede-fija {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: var(--r);
  background: var(--surface); box-shadow: var(--sombra-sm); font-size: 13px; font-weight: 600;
}
.sede-fija i { width: 9px; height: 9px; border-radius: 50%; }
.sede-fija span { font-weight: 400; color: var(--text-3); font-size: 11.5px; margin-left: auto; }

.nav { padding: 6px 12px; flex: 1; overflow-y: auto; }
.nav-grupo {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .16em;
  color: var(--text-3); padding: 14px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--r); cursor: pointer;
  color: var(--text-2); border: 0; background: none; width: 100%; text-align: left;
  transition: background .14s, color .14s; margin-bottom: 2px; font-size: 13.5px;
  white-space: nowrap; position: relative;
}
.nav-item .ico { font-size: 16px; opacity: .8; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.activo { background: var(--ink); color: var(--on-ink); box-shadow: var(--sombra-card); font-weight: 600; }
.nav-item.activo .ico { opacity: 1; color: var(--accent); }
:root[data-theme="dark"] .nav-item.activo .ico { color: var(--accent); }
.nav-punto { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; margin: 0 4px; }
.nav-conteo {
  margin-left: auto; font-size: 11px; color: var(--text-3);
  background: var(--surface-3); padding: 1px 8px; border-radius: var(--r-pill);
  font-variant-numeric: tabular-nums; font-weight: 500;
}
.nav-item.activo .nav-conteo { background: rgba(255,255,255,.16); color: var(--on-ink); }
:root[data-theme="dark"] .nav-item.activo .nav-conteo { background: rgba(14,26,47,.12); }
.nav-conteo.rojo { background: var(--accent); color: #fff; }

.lateral-pie { padding: 10px 14px 16px; }
.estado-nube {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--text-3); margin-bottom: 10px; padding: 0 4px;
}
.estado-punto { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.estado-nube.sincronizado { color: var(--ok); }
.estado-nube.conectando  { color: var(--atencion); }
.estado-nube.error       { color: var(--alerta); }

.usuario {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  background: var(--surface); border-radius: var(--r); padding: 9px 11px;
  box-shadow: var(--sombra-card); transition: box-shadow .14s;
}
.usuario:hover { box-shadow: var(--sombra); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 34px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; letter-spacing: .03em;
  font-family: var(--display);
}
.usuario-nombre { font-size: 13px; line-height: 1.25; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usuario-rol { font-size: 11px; color: var(--text-3); }
.lateral-acciones { display: flex; gap: 7px; margin-top: 9px; }
.lateral-acciones .btn { flex: 1; padding: 7px 8px; font-size: 12px; }

/* ---------- área principal ---------- */

.principal {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: var(--bg-2); margin: 12px 12px 12px 0;
  border-radius: var(--r-xl); box-shadow: var(--sombra-card); overflow: hidden;
}

.topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 18px 26px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar h1 {
  font-family: var(--display); font-size: 21px; font-weight: 700;
  margin: 0; letter-spacing: -.01em; line-height: 1.2;
}
.topbar-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.topbar-sep { flex: 1; }

.buscador {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 7px 14px;
  min-width: 190px; flex: 1 1 200px; max-width: 320px;
  transition: border-color .14s, box-shadow .14s;
}
.buscador:focus-within { border-color: var(--text-3); box-shadow: 0 0 0 3px color-mix(in srgb, var(--text-3) 16%, transparent); }
.buscador input { border: 0; background: none; outline: none; width: 100%; font-size: 13.5px; }
.buscador .ico { color: var(--text-3); }

.contenido { flex: 1; overflow: auto; min-height: 0; padding: 4px 26px 40px; }
.contenido.sin-padding { padding: 0; }

/* barra de filtros bajo la cabecera */
.filtros {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 26px 12px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.filtros-etiqueta { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--text-3); }
.filtro {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 4px 6px 4px 12px; font-size: 12.5px; color: var(--text-3);
}
.filtro select, .filtro input {
  background: none; border: 0; outline: none; color: var(--text); font-size: 12.5px;
  padding: 2px 4px; cursor: pointer; max-width: 170px;
}
.filtro input[type="date"] { width: 128px; }
.filtro.activo { border-color: var(--text-3); background: var(--surface); }

/* segmentos: Tabla | Embudo, Por nivel | Semana */
.segmento {
  display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-3);
  border-radius: var(--r-pill);
}
.segmento button {
  border: 0; background: none; border-radius: var(--r-pill); padding: 6px 14px; cursor: pointer;
  font-size: 12.5px; color: var(--text-2); font-weight: 500; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.segmento button:hover { color: var(--text); }
.segmento button.activo { background: var(--surface); color: var(--text); box-shadow: var(--sombra-sm); font-weight: 600; }
.segmento .cuenta { font-size: 11px; color: var(--text-3); font-weight: 500; }

/* =============================================================================
   BOTONES, CHIPS Y PIEZAS SUELTAS
   ============================================================================= */

.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  background: var(--accent); color: var(--on-accent); border: 1px solid transparent;
  padding: 9px 18px; border-radius: var(--r-pill); cursor: pointer; font-size: 13.5px;
  font-weight: 600; letter-spacing: .005em; text-decoration: none; white-space: nowrap;
  transition: filter .14s, background .14s, box-shadow .14s, transform .08s;
  box-shadow: 0 1px 2px rgba(227,29,35,.25);
}
.btn:hover { filter: brightness(1.06); box-shadow: 0 4px 14px rgba(227,29,35,.28); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn .ico { font-size: 15px; }
.btn-fantasma {
  background: var(--surface); color: var(--text-2); border-color: var(--line-2); box-shadow: none;
}
.btn-fantasma:hover { background: var(--surface-2); color: var(--text); filter: none; box-shadow: none; }
.btn-oscuro { background: var(--ink); color: var(--on-ink); box-shadow: var(--sombra-sm); }
.btn-oscuro:hover { box-shadow: var(--sombra-card); }
.btn-verde { background: #1FA855; color: #fff; box-shadow: none; }
.btn-verde:hover { box-shadow: 0 4px 14px rgba(31,168,85,.3); }
.btn-peligro { background: var(--alerta); color: #fff; box-shadow: none; }
.btn-sm { padding: 6px 13px; font-size: 12.5px; }
.btn-xs { padding: 3px 10px; font-size: 11.5px; gap: 5px; }
.btn-solo {
  width: 36px; height: 36px; padding: 0; border-radius: 50%; flex: 0 0 36px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); box-shadow: none;
}
.btn-solo:hover { background: var(--surface-3); color: var(--text); filter: none; box-shadow: none; }
.btn-solo .ico { font-size: 16px; }
.btn-texto {
  background: none; border: 0; color: var(--info); cursor: pointer; padding: 0; font-size: 12.5px;
  font-weight: 600; display: inline-flex; align-items: center; gap: 5px; text-decoration: none;
}
.btn-texto:hover { text-decoration: underline; }
.btn-texto.peligro { color: var(--alerta); }

.chip {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: var(--r-pill);
  background: var(--surface-3); color: var(--text-2); line-height: 1.6;
}
.chip-nivel, .chip-sede, .chip-etapa {
  background: color-mix(in srgb, var(--c) 14%, transparent);
  color: color-mix(in srgb, var(--c) 82%, var(--text));
}
.chip-nivel { font-family: var(--display); letter-spacing: .02em; }
.chip-sede::before, .chip-etapa::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c);
}
:root[data-theme="dark"] .chip-nivel, :root[data-theme="dark"] .chip-sede, :root[data-theme="dark"] .chip-etapa {
  background: color-mix(in srgb, var(--c) 24%, transparent);
  color: color-mix(in srgb, var(--c) 45%, #fff);
}

.pastilla {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: var(--r-pill);
  background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.pastilla .ico { font-size: 12px; }
.pastilla.ok    { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.pastilla.aviso { background: color-mix(in srgb, var(--atencion) 16%, transparent); color: var(--atencion); }
.pastilla.mal   { background: color-mix(in srgb, var(--alerta) 13%, transparent); color: var(--alerta); }
.pastilla.info  { background: color-mix(in srgb, var(--info) 13%, transparent); color: var(--info); }
.pastilla.rojo  { background: var(--accent); color: #fff; }

.avatar-est {
  width: 36px; height: 36px; border-radius: 50%; flex: 0 0 36px; overflow: hidden;
  background: var(--sky); color: var(--ink); display: grid; place-items: center;
  font-family: var(--display); font-size: 12.5px; font-weight: 700;
}
:root[data-theme="dark"] .avatar-est { color: var(--text); }
.avatar-est img { width: 100%; height: 100%; object-fit: cover; }
.avatar-est.grande { width: 64px; height: 64px; flex-basis: 64px; font-size: 21px; }
.avatar-est.chico { width: 28px; height: 28px; flex-basis: 28px; font-size: 10.5px; }

/* ---------- campos ---------- */
.campo { display: block; min-width: 0; }
.campo > label {
  display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-3); margin-bottom: 6px;
}
.campo input:not([type=checkbox]):not([type=radio]):not([type=file]), .campo select, .campo textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-2);
  border-radius: var(--r); background: var(--surface); outline: none; min-height: 40px;
  transition: border-color .14s, box-shadow .14s;
}
.campo input:focus, .campo select:focus, .campo textarea:focus {
  border-color: var(--info); box-shadow: 0 0 0 3px color-mix(in srgb, var(--info) 16%, transparent);
}
.campo input:disabled, .campo select:disabled, .campo textarea:disabled { background: var(--surface-2); color: var(--text-2); cursor: not-allowed; }
.campo textarea { resize: vertical; min-height: 76px; line-height: 1.55; }
.campo input[type="date"], .campo input[type="time"] {
  -webkit-appearance: none; appearance: none; display: block; min-width: 0; text-align: left;
}
.campo-ayuda { font-size: 11.5px; color: var(--text-3); margin-top: 5px; line-height: 1.45; }
.campo-con-boton { display: flex; gap: 8px; align-items: stretch; }
.campo-con-boton input { flex: 1; min-width: 0; }
.btn-icono {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); text-decoration: none;
  border: 1px solid var(--line-2); border-radius: var(--r);
  padding: 0 13px; cursor: pointer; font-size: 12.5px; font-weight: 600;
  transition: background .14s, color .14s, border-color .14s;
}
.btn-icono:hover { background: #E7F7EE; color: #1A8048; border-color: #1FA855; }
.btn-icono.apagado { opacity: .4; pointer-events: none; }

/* fichas para elegir opciones */
.fichas-op { display: flex; flex-wrap: wrap; gap: 7px; }
.ficha-op {
  display: inline-flex; align-items: center; cursor: pointer; user-select: none;
  border: 1px solid var(--line-2); border-radius: var(--r-pill); padding: 6px 13px;
  font-size: 13px; background: var(--surface); color: var(--text-2);
  transition: background .14s, border-color .14s, color .14s;
  text-transform: none; letter-spacing: normal; font-weight: 500; margin: 0;
}
.ficha-op input { position: absolute; opacity: 0; pointer-events: none; }
.ficha-op small { display: block; font-size: 10.5px; color: var(--text-3); font-weight: 400; }
.ficha-op:hover { border-color: var(--text-3); color: var(--text); }
.ficha-op.marcada { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.ficha-op.marcada small { color: color-mix(in srgb, var(--on-ink) 70%, transparent); }
.ficha-op:has(input:focus-visible) { box-shadow: 0 0 0 3px color-mix(in srgb, var(--info) 30%, transparent); }

.rejilla { display: grid; gap: 14px; grid-template-columns: 1fr; }
.rejilla.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rejilla.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rejilla.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.col-entera { grid-column: 1 / -1; }
.col-2 { grid-column: span 2; }

.casilla {
  display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px;
  padding: 6px 0; text-transform: none; letter-spacing: 0; color: var(--text); font-weight: 500;
}
.casilla input { width: 17px; height: 17px; accent-color: var(--ink); margin: 0; }

/* ---------- vacío ---------- */
.vacio { text-align: center; padding: 50px 20px; color: var(--text-3); }
.vacio-icono { font-size: 34px; opacity: .45; margin-bottom: 10px; }
.vacio-texto { font-size: 15px; color: var(--text-2); font-weight: 600; }
.vacio-sub { font-size: 13px; margin-top: 6px; }
.vacio-chico { font-size: 12.5px; color: var(--text-3); padding: 14px 4px; text-align: center; }

/* =============================================================================
   PANELES Y CIFRAS
   ============================================================================= */

.panel {
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--sombra-card); padding: 18px 20px; margin-top: 16px; min-width: 0;
}
.panel-cab { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-cab h2 {
  font-family: var(--display); font-size: 14.5px; font-weight: 600; margin: 0; letter-spacing: 0;
  display: flex; align-items: center; gap: 8px;
}
.panel-cab h2 .ico { color: var(--accent); }
.panel-nota { font-size: 12px; color: var(--text-3); margin-left: auto; }
.panel.peligro { border: 1px solid color-mix(in srgb, var(--alerta) 35%, transparent); }
.panel.peligro .panel-cab h2 { color: var(--alerta); }
.panel.sin-pad { padding: 0; overflow: hidden; }
.panel.sin-pad .panel-cab { padding: 16px 20px 0; }

.paneles { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.paneles.p3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.paneles.p21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.paneles.p12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.paneles > .panel { margin-top: 0; }
.paneles + .paneles, .cifras + .paneles, .paneles + .panel { margin-top: 16px; }

.cifras { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-top: 18px; }
.cifra {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sombra-card);
  padding: 16px 18px; position: relative; overflow: hidden; min-width: 0;
}
.cifra::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 0 3px 3px 0; background: var(--c, var(--ink)); }
.cifra-etiqueta {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-3); margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.cifra-valor {
  font-family: var(--display); font-size: 26px; font-weight: 700; line-height: 1.05;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.cifra-pie { font-size: 11.5px; color: var(--text-3); margin-top: 6px; }
.cifra.clic { cursor: pointer; transition: box-shadow .14s, transform .1s; }
.cifra.clic:hover { box-shadow: var(--sombra); transform: translateY(-1px); }
.cifra.rojo   { --c: var(--accent); }
.cifra.verde  { --c: var(--ok); }
.cifra.ambar  { --c: var(--atencion); }
.cifra.azul   { --c: var(--info); }

/* cabecera de bienvenida en los dashboards */
.saludo {
  margin-top: 18px; border-radius: var(--r-lg); padding: 22px 24px; color: #fff; position: relative; overflow: hidden;
  background:
    radial-gradient(600px 300px at 95% -20%, rgba(227,29,35,.55), transparent 60%),
    radial-gradient(600px 400px at -10% 130%, rgba(56,98,182,.55), transparent 60%),
    #0E1A2F;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.saludo::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.08) 1.2px, transparent 1.3px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 70%); mask-image: linear-gradient(90deg, transparent, #000 70%);
}
.saludo h2 { font-family: var(--display); font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.saludo p { margin: 4px 0 0; color: rgba(255,255,255,.72); font-size: 13.5px; }
.saludo .sep { flex: 1; }
.saludo-dato { text-align: right; position: relative; z-index: 1; }
.saludo-dato b { display: block; font-family: var(--display); font-size: 30px; line-height: 1; }
.saludo-dato span { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: rgba(255,255,255,.6); }
.saludo > * { position: relative; z-index: 1; }

/* ---------- barras horizontales ---------- */
.barras { display: flex; flex-direction: column; gap: 6px; }
.barra-fila { display: flex; align-items: center; gap: 12px; padding: 4px 6px; border-radius: var(--r-xs); }
.barra-fila[data-click] { cursor: pointer; }
.barra-fila[data-click]:hover { background: var(--surface-2); }
.barra-nombre { font-size: 12.5px; flex: 0 0 150px; display: flex; align-items: center; gap: 7px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.barra-pista { flex: 1; height: 9px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; min-width: 30px; }
.barra-relleno { display: block; height: 100%; border-radius: var(--r-pill); transition: width .35s; min-width: 2px; }
.barra-valor { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text-2); flex: 0 0 auto; min-width: 34px; text-align: right; font-weight: 600; }

/* ---------- columnas por mes ---------- */
.columnas { display: flex; align-items: flex-end; gap: 8px; height: 170px; padding-top: 8px; }
.col-mes { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.col-barras { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.col-barra { flex: 0 1 18px; border-radius: 4px 4px 1px 1px; min-height: 2px; transition: height .35s; }
.col-etiqueta { font-size: 10.5px; color: var(--text-3); margin-top: 6px; text-transform: capitalize; white-space: nowrap; }
.leyenda { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 11.5px; color: var(--text-2); }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- embudo del pipeline ---------- */
.embudo { display: flex; flex-direction: column; gap: 4px; }
.embudo-fila {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  padding: 7px 8px; border-radius: var(--r); transition: background .14s;
  border: 0; background: none; width: 100%; text-align: left; color: inherit;
}
.embudo-fila:hover { background: var(--surface-2); }
.embudo-num {
  font-family: var(--display); font-size: 10.5px; font-weight: 700; color: #fff;
  border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; flex: 0 0 22px;
}
.embudo-nombre { font-size: 13px; flex: 0 0 168px; }
.embudo-conteo { font-size: 14px; font-variant-numeric: tabular-nums; flex: 0 0 32px; text-align: right; font-weight: 700; font-family: var(--display); }

/* ---------- listas cortas ---------- */
.lista { display: flex; flex-direction: column; }
.lista-fila {
  display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: var(--r);
  cursor: pointer; border: 0; background: none; width: 100%; text-align: left; color: inherit;
  transition: background .14s;
}
.lista-fila + .lista-fila { border-top: 1px solid var(--line); border-radius: 0; }
.lista-fila:hover { background: var(--surface-2); }
.lista-cuerpo { flex: 1; min-width: 0; }
.lista-titulo { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-detalle { display: block; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-fin { flex: 0 0 auto; text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.hora-caja {
  flex: 0 0 58px; text-align: center; border-radius: var(--r-xs); padding: 5px 4px;
  background: var(--surface-3); font-family: var(--display); font-size: 13px; font-weight: 700; line-height: 1.1;
}
.hora-caja small { display: block; font-size: 10px; font-weight: 500; color: var(--text-3); }

/* alertas agrupadas del dashboard */
.grupo-alerta { border-bottom: 1px solid var(--line); }
.grupo-alerta:last-child { border-bottom: 0; }
.grupo-alerta summary {
  cursor: pointer; padding: 10px 6px; font-size: 13.5px; font-weight: 600;
  display: flex; align-items: center; gap: 10px; list-style: none; border-radius: var(--r);
}
.grupo-alerta summary:hover { background: var(--surface-2); }
.grupo-alerta summary::-webkit-details-marker { display: none; }
.grupo-alerta summary::after { content: "›"; margin-left: auto; font-size: 18px; color: var(--text-3); transition: transform .14s; }
.grupo-alerta[open] summary::after { transform: rotate(90deg); }
.grupo-alerta .lista { padding: 0 0 8px 8px; }

/* comparativa de sedes */
.comparativa { width: 100%; border-collapse: collapse; }
.comparativa th, .comparativa td { padding: 10px 12px; text-align: right; font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.comparativa th:first-child, .comparativa td:first-child { text-align: left; color: var(--text-2); }
.comparativa thead th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); font-weight: 600; }
.comparativa thead th i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.comparativa td.total { font-weight: 700; }
.comparativa tr:last-child td { border-bottom: 0; }
.comparativa .mejor { color: var(--ok); font-weight: 700; }

/* =============================================================================
   TABLAS
   ============================================================================= */

.tabla-caja { overflow: auto; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--sombra-card); margin-top: 16px; }
.tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabla th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2);
  text-align: left; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-3); padding: 11px 12px; white-space: nowrap; border-bottom: 1px solid var(--line);
}
.tabla th.ordenable { cursor: pointer; user-select: none; }
.tabla th.ordenable:hover { color: var(--text); }
.tabla td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabla tbody tr { transition: background .12s; }
.tabla tbody tr.clic { cursor: pointer; }
.tabla tbody tr.clic:hover { background: var(--surface-2); }
.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla .num, .tabla .derecha { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla .nombre-celda { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.tabla .nombre-celda b { font-weight: 600; display: block; line-height: 1.3; }
.tabla .nombre-celda small { color: var(--text-3); font-size: 11.5px; }
.tabla tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line-2); }
.tabla select.en-linea {
  border: 1px solid transparent; background: var(--surface-3); border-radius: var(--r-pill);
  padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; outline: none;
  color: var(--c, var(--text)); background: color-mix(in srgb, var(--c, #888) 13%, transparent);
}
.tabla select.en-linea:hover { border-color: color-mix(in srgb, var(--c, #888) 40%, transparent); }
.celda-corta { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.tabla-mini { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabla-mini th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 600; padding: 8px 8px; border-bottom: 1px solid var(--line); }
.tabla-mini td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabla-mini tr:last-child td { border-bottom: 0; }
.tabla-mini .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla-mini input, .tabla-mini select {
  width: 100%; border: 1px solid var(--line-2); border-radius: var(--r-xs); padding: 6px 8px; background: var(--surface); min-width: 0;
}

.mini-barra { display: inline-flex; align-items: center; gap: 8px; min-width: 110px; }
.mini-barra span { flex: 1; height: 6px; background: var(--surface-3); border-radius: 4px; overflow: hidden; min-width: 50px; }
.mini-barra i { display: block; height: 100%; border-radius: 4px; }
.mini-barra b { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }

/* =============================================================================
   PIPELINE (KANBAN)
   ============================================================================= */

.tablero-envoltura { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.tablero {
  display: flex; gap: 14px; padding: 16px 26px 22px;
  overflow-x: auto; overflow-y: hidden; flex: 1; min-height: 0;
}
.col {
  flex: 0 0 290px; display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border: 1px solid transparent; border-radius: var(--r-lg);
  box-shadow: var(--sombra-card); transition: border-color .14s, background .14s;
}
.col.arrastre { border-color: var(--c); background: color-mix(in srgb, var(--c) 6%, var(--surface)); }
.col-cab { padding: 14px 15px 10px; border-top: 3px solid var(--c); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.col-titulo { display: flex; align-items: center; gap: 8px; }
.col-num {
  font-family: var(--display); font-size: 11px; font-weight: 700; color: #fff; background: var(--c);
  border-radius: 50%; width: 21px; height: 21px; display: grid; place-items: center; flex: 0 0 21px;
}
.col-nombre { font-size: 13.5px; font-weight: 700; line-height: 1.25; font-family: var(--display); }
.col-conteo { margin-left: auto; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; font-weight: 600; }
.col-desc { font-size: 11.5px; color: var(--text-3); margin-top: 5px; line-height: 1.4; }
.col-cuerpo {
  padding: 4px 10px 12px; overflow-y: auto; flex: 1; min-height: 60px;
  display: flex; flex-direction: column; gap: 9px;
}
.col-vacia { font-size: 12px; color: var(--text-3); text-align: center; padding: 18px 6px; opacity: .8; }

.tarjeta {
  background: var(--surface-2); border: 1px solid var(--line);
  border-left: 3px solid var(--ok); border-radius: var(--r); padding: 11px 12px 10px; cursor: grab;
  transition: border-color .14s, transform .1s, box-shadow .14s; user-select: none;
}
.tarjeta:hover { box-shadow: var(--sombra-card); transform: translateY(-1px); border-color: var(--line-2); }
.tarjeta:active { cursor: grabbing; }
.tarjeta.arrastrando { opacity: .45; transform: rotate(1.5deg); }
.tarjeta.ambar { border-left-color: var(--atencion); }
.tarjeta.rojo  { border-left-color: var(--alerta); }
.t-cab { display: flex; align-items: center; gap: 9px; }
.t-nombre { font-size: 13.5px; font-weight: 700; line-height: 1.25; flex: 1; min-width: 0; }
.t-nombre small { display: block; font-weight: 500; font-size: 11px; color: var(--text-3); margin-top: 1px; }
.t-linea { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.t-dato { font-size: 11.5px; color: var(--text-2); display: flex; align-items: center; gap: 5px; margin-top: 7px; }
.t-dato .ico { color: var(--text-3); }
.t-avance { margin-top: 9px; display: flex; align-items: center; gap: 8px; }
.t-avance-barra { flex: 1; height: 4px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; }
.t-avance-relleno { display: block; height: 100%; background: var(--c, var(--ink)); transition: width .3s; }
.t-avance-texto { font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.t-alertas { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.t-alertas .pastilla { font-size: 10.5px; padding: 1px 7px; }
.t-pie {
  margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--line-2);
  display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-2);
}
.t-pie .sep { flex: 1; }
.punto { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 8px; }
.punto.ok { background: var(--ok); } .punto.mal { background: var(--alerta); }
.punto.info { background: var(--info); } .punto.aviso { background: var(--atencion); }
.punto.gris { background: var(--line-2); }

/* =============================================================================
   MODALES Y PANEL LATERAL (la ficha)
   ============================================================================= */

.modal-fondo {
  position: fixed; inset: 0; z-index: 200; background: rgba(8,14,26,.48);
  display: grid; place-items: center; padding: 24px;
  animation: aparece .16s ease-out; backdrop-filter: blur(2px);
}
.modal-fondo.sale { animation: desaparece .2s ease-in forwards; }
html.con-modal, html.con-modal body { overflow: hidden; }
@keyframes aparece { from { opacity: 0 } to { opacity: 1 } }
@keyframes desaparece { to { opacity: 0 } }
@keyframes sube { from { opacity: 0; transform: translateY(14px) scale(.985) } to { opacity: 1; transform: none } }
@keyframes entra-der { from { transform: translateX(40px); opacity: .4 } to { transform: none; opacity: 1 } }

.modal {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--sombra);
  width: 100%; min-width: 0; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  display: flex; flex-direction: column; animation: sube .2s cubic-bezier(.2,.8,.3,1);
}
.modal-sm { max-width: 440px; }
.modal-md { max-width: 640px; }
.modal-lg { max-width: 920px; }
.modal-xl { max-width: 1100px; }
.modal-cab, .modal-pie { flex-shrink: 0; }
.modal-cab { padding: 20px 24px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 14px; }
.modal-cab h2 { font-family: var(--display); font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.modal-cab-sub { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.modal-cerrar {
  margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--text-3);
  font-size: 20px; line-height: 1; padding: 6px; border-radius: 50%; display: grid; place-items: center;
}
.modal-cerrar:hover { color: var(--text); background: var(--surface-2); }
.modal-cuerpo { padding: 18px 24px; overflow-y: auto; flex: 1 1 auto; min-height: 0; overscroll-behavior: contain; }
.modal-pie { padding: 14px 24px 18px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.modal-pie .sep { flex: 1; }

/* ---- el panel que entra desde la derecha ---- */
.modal-fondo.con-panel { place-items: stretch end; padding: 0; }
.panel-lateral {
  width: min(1120px, calc(100vw - 70px)); height: 100%; background: var(--surface);
  box-shadow: var(--sombra); display: flex; flex-direction: column; min-width: 0;
  border-radius: var(--r-xl) 0 0 var(--r-xl); overflow: hidden;
  animation: entra-der .26s cubic-bezier(.2,.8,.3,1);
}
.panel-lateral.angosto { width: min(620px, calc(100vw - 40px)); }

.ficha-cab {
  flex-shrink: 0; display: flex; align-items: center; gap: 16px; padding: 18px 22px 16px;
  color: #fff; position: relative; overflow: hidden;
  background:
    radial-gradient(500px 240px at 100% -30%, rgba(227,29,35,.5), transparent 60%),
    radial-gradient(500px 300px at 0% 140%, rgba(56,98,182,.5), transparent 60%),
    #0E1A2F;
}
.ficha-cab .avatar-est { background: rgba(255,255,255,.14); color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.18); }
.ficha-cab-info { flex: 1; min-width: 0; }
.ficha-cab h2 { margin: 0; font-family: var(--display); font-size: 21px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.ficha-cab-sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; color: rgba(255,255,255,.7); }
.ficha-cab .chip { background: rgba(255,255,255,.14); color: #fff; }
.ficha-cab .chip-nivel { background: var(--c); color: #fff; }
.ficha-cab-acciones { display: flex; gap: 8px; align-items: center; }
.ficha-cab .btn-solo { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); color: #fff; }
.ficha-cab .btn-solo:hover { background: rgba(255,255,255,.2); }

.ficha-cuerpo { flex: 1; min-height: 0; display: grid; grid-template-columns: 214px 1fr; }
.ficha-tabs {
  border-right: 1px solid var(--line); background: var(--surface-2); padding: 14px 10px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.ficha-tab {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r);
  border: 0; background: none; cursor: pointer; color: var(--text-2); font-size: 13.5px; text-align: left; width: 100%;
  transition: background .14s, color .14s;
}
.ficha-tab .ico { font-size: 16px; color: var(--text-3); }
.ficha-tab:hover { background: var(--surface); color: var(--text); }
.ficha-tab.activa { background: var(--surface); color: var(--text); font-weight: 700; box-shadow: var(--sombra-sm); }
.ficha-tab.activa .ico { color: var(--accent); }
.ficha-tab .marca-tab { margin-left: auto; }
.ficha-resumen { margin-top: auto; padding: 14px 8px 4px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-2); display: flex; flex-direction: column; gap: 9px; }
.ficha-resumen b { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); font-weight: 600; margin-bottom: 2px; }
.ficha-contenido { overflow-y: auto; padding: 22px 26px 30px; min-width: 0; overscroll-behavior: contain; }
.ficha-pie {
  flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 12px 22px;
  border-top: 1px solid var(--line); background: var(--surface);
}
.ficha-pie .sep { flex: 1; }
.ficha-pie .estado-guardado { font-size: 12px; color: var(--text-3); }
.ficha-pie .estado-guardado.sucio { color: var(--atencion); font-weight: 600; }

.seccion { margin-bottom: 26px; }
.seccion:last-child { margin-bottom: 0; }
.seccion-titulo {
  font-family: var(--display); font-size: 13px; font-weight: 700; color: var(--text);
  margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px;
}
.seccion-titulo .ico { color: var(--accent); }
.seccion-titulo .sep { flex: 1; }
.seccion-titulo .btn-texto, .seccion-titulo .btn { font-family: var(--ui); }

.mini-cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 18px; }
.mini-cifra { background: var(--surface-2); border-radius: var(--r); padding: 11px 13px; border: 1px solid var(--line); }
.mini-cifra span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); font-weight: 600; }
.mini-cifra b { display: block; font-family: var(--display); font-size: 19px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
.mini-cifra.rojo b { color: var(--alerta); } .mini-cifra.verde b { color: var(--ok); }

.nota-caja {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px;
  font-size: 13px; color: var(--text-2); line-height: 1.55;
}
.nota-caja.aviso { background: color-mix(in srgb, var(--atencion) 9%, var(--surface)); border-color: color-mix(in srgb, var(--atencion) 30%, transparent); }
.nota-caja.mal { background: color-mix(in srgb, var(--alerta) 7%, var(--surface)); border-color: color-mix(in srgb, var(--alerta) 28%, transparent); }
.nota-caja.info { background: color-mix(in srgb, var(--info) 7%, var(--surface)); border-color: color-mix(in srgb, var(--info) 25%, transparent); }

/* ---------- tareas de la etapa ---------- */
.etapas-linea { display: flex; gap: 4px; margin-bottom: 18px; overflow-x: auto; padding-bottom: 2px; }
.etapa-paso {
  flex: 1 0 auto; border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r);
  padding: 8px 12px; cursor: pointer; text-align: left; font-size: 12px; color: var(--text-2); min-width: 104px;
  transition: border-color .14s, background .14s;
}
.etapa-paso b { display: block; font-family: var(--display); font-size: 10.5px; color: var(--text-3); }
.etapa-paso:hover { border-color: var(--c); }
.etapa-paso.hecha { background: color-mix(in srgb, var(--c) 8%, var(--surface)); border-color: color-mix(in srgb, var(--c) 30%, transparent); }
.etapa-paso.actual { background: var(--c); border-color: var(--c); color: #fff; font-weight: 700; }
.etapa-paso.actual b { color: rgba(255,255,255,.75); }

.tareas { display: flex; flex-direction: column; gap: 2px; }
.tarea {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--r);
  cursor: pointer; transition: background .14s; font-size: 13.5px; text-transform: none;
  letter-spacing: normal; color: var(--text); margin: 0; font-weight: 500;
}
.tarea:hover { background: var(--surface-2); }
.tarea input[type="checkbox"] { margin: 0; accent-color: var(--ok); width: 17px; height: 17px; cursor: pointer; flex: 0 0 17px; }
.tarea.hecha span { color: var(--text-3); text-decoration: line-through; }

/* ---------- plantillas de mensajes ---------- */
.plantillas { display: flex; flex-direction: column; gap: 10px; }
.plantilla { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; background: var(--surface-2); }
.plantilla-cab { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.plantilla-titulo { flex: 1; font-size: 13px; font-weight: 700; min-width: 140px; }
.plantilla-texto {
  font-size: 13px; color: var(--text-2); white-space: pre-wrap; line-height: 1.55;
  background: var(--surface); border-radius: var(--r-xs); padding: 10px 12px; border: 1px solid var(--line);
  max-height: 180px; overflow-y: auto;
}
.plantilla-texto mark { background: color-mix(in srgb, var(--atencion) 25%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }

/* ---------- historial ---------- */
.bitacora { display: flex; flex-direction: column; gap: 0; }
.bit-fila { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.bit-fila:last-child { border-bottom: 0; }
.bit-cuando { flex: 0 0 132px; color: var(--text-3); font-size: 11.5px; font-variant-numeric: tabular-nums; padding-top: 1px; }
.bit-texto { flex: 1; color: var(--text-2); line-height: 1.5; white-space: pre-wrap; }
.bit-texto b { color: var(--text); font-weight: 600; }
.bit-quien { color: var(--text-3); font-size: 11.5px; }

.nota-seg { border-left: 3px solid var(--info); background: var(--surface-2); border-radius: 0 var(--r) var(--r) 0; padding: 10px 14px; margin-bottom: 10px; }
.nota-seg-cab { display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: var(--text-3); margin-bottom: 4px; }
.nota-seg-cab b { color: var(--text); font-size: 12.5px; }
.nota-seg p { margin: 0; font-size: 13px; white-space: pre-wrap; line-height: 1.55; color: var(--text-2); }

/* ---------- adjuntos ---------- */
.adj-fila { display: flex; flex-wrap: wrap; gap: 10px; }
.adj { position: relative; width: 96px; height: 96px; flex: 0 0 96px; transition: opacity .16s; }
.adj-ver { display: block; width: 100%; height: 100%; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line-2); background: var(--surface-2); }
.adj-ver img { width: 100%; height: 100%; object-fit: cover; display: block; }
.adj-doc { display: grid; place-items: center; align-content: center; gap: 4px; height: 100%; color: var(--alerta); font-size: 26px; }
.adj-doc b { font-size: 11px; font-family: var(--display); letter-spacing: .1em; }
.adj-roto { display: none; }
.adj.roto img { display: none; }
.adj.roto .adj-roto { display: grid; place-items: center; height: 100%; font-size: 11px; color: var(--text-3); text-align: center; padding: 8px; }
.adj-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.adj-cambiar {
  position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font-size: 10.5px; padding: 4px 0;
  background: rgba(14,26,47,.72); color: #fff; border-radius: 0 0 var(--r) var(--r); cursor: pointer;
  opacity: 0; transition: opacity .14s; text-transform: none; letter-spacing: 0; margin: 0;
}
.adj:hover .adj-cambiar { opacity: 1; }
.adj-quitar {
  position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line-2); color: var(--text-2); cursor: pointer;
  display: grid; place-items: center; font-size: 12px; box-shadow: var(--sombra-sm);
}
.adj-quitar:hover { color: #fff; background: var(--alerta); border-color: var(--alerta); }
.adj-agregar {
  width: 96px; height: 96px; border: 1.5px dashed var(--line-2); border-radius: var(--r); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  color: var(--text-3); transition: border-color .14s, color .14s, background .14s; text-transform: none; letter-spacing: 0; margin: 0;
}
.adj-agregar:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.adj-mas { font-size: 20px; line-height: 1; }
.adj-texto { font-size: 11px; font-weight: 600; }
.subiendo, .saliendo { opacity: .45; pointer-events: none; }

/* =============================================================================
   HORARIO SEMANAL
   ============================================================================= */

.semana {
  display: grid; grid-template-columns: 54px repeat(6, minmax(120px, 1fr));
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sombra-card);
  margin-top: 16px; overflow: auto; position: relative;
}
.semana-cab {
  position: sticky; top: 0; z-index: 3; background: var(--surface-2); text-align: center;
  padding: 10px 6px; font-size: 12px; font-weight: 700; border-bottom: 1px solid var(--line);
  font-family: var(--display);
}
.semana-cab small { display: block; font-weight: 500; color: var(--text-3); font-size: 10.5px; font-family: var(--ui); }
.semana-cab.hoy { color: var(--accent); }
.semana-horas { position: relative; border-right: 1px solid var(--line); margin: 14px 0; }
.semana-hora { position: absolute; right: 6px; font-size: 10.5px; color: var(--text-3); transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.semana-dia { position: relative; border-right: 1px solid var(--line); margin: 14px 0; }
.semana-dia:last-child { border-right: 0; }
.semana-dia.hoy { background: color-mix(in srgb, var(--accent) 3%, transparent); }
.semana-linea { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); }
.bloque {
  position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: 6px 8px; cursor: pointer; overflow: hidden;
  background: color-mix(in srgb, var(--c) 14%, var(--surface)); border-left: 3px solid var(--c);
  font-size: 11.5px; line-height: 1.3; transition: box-shadow .14s, transform .1s; color: var(--text);
}
:root[data-theme="dark"] .bloque { background: color-mix(in srgb, var(--c) 26%, var(--surface)); }
.bloque:hover { box-shadow: var(--sombra-card); transform: translateY(-1px); z-index: 2; }
.bloque b { font-family: var(--display); font-size: 12px; display: block; }
.bloque span { display: block; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bloque .cupo { font-weight: 700; color: var(--text); }
.bloque.lleno { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--alerta) 50%, transparent); }

/* tarjetas de clases */
.clases-rejilla { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); margin-top: 16px; }
.clase-tarjeta {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sombra-card); padding: 14px 16px;
  border-top: 3px solid var(--c); cursor: pointer; transition: box-shadow .14s, transform .1s; text-align: left;
  border-left: 0; border-right: 0; border-bottom: 0; width: 100%; color: inherit; font: inherit;
}
.clase-tarjeta:hover { box-shadow: var(--sombra); transform: translateY(-1px); }
.clase-tarjeta h3 { font-family: var(--display); font-size: 14px; margin: 0 0 2px; font-weight: 700; }
.clase-tarjeta .dato { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.clase-tarjeta .dato .ico { color: var(--text-3); }
.cupo-barra { height: 6px; background: var(--surface-3); border-radius: 4px; overflow: hidden; margin-top: 10px; }
.cupo-barra i { display: block; height: 100%; background: var(--c); border-radius: 4px; }
.cupo-texto { font-size: 11.5px; color: var(--text-3); margin-top: 5px; display: flex; justify-content: space-between; }
.clase-tarjeta.tomada { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 40%, transparent), var(--sombra-card); }

/* pestañas de niveles */
.niveles-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.nivel-tab {
  border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r);
  padding: 9px 16px; cursor: pointer; text-align: left; min-width: 104px; transition: border-color .14s, background .14s;
  color: var(--text);
}
.nivel-tab b { display: block; font-family: var(--display); font-size: 17px; color: var(--c); line-height: 1.1; }
.nivel-tab span { font-size: 11.5px; color: var(--text-3); }
.nivel-tab:hover { border-color: var(--c); }
.nivel-tab.activo { background: var(--c); border-color: var(--c); }
.nivel-tab.activo b, .nivel-tab.activo span { color: #fff; }

/* =============================================================================
   ASISTENCIA
   ============================================================================= */

.lista-asis { display: flex; flex-direction: column; }
.asis-fila { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.asis-fila:last-child { border-bottom: 0; }
.asis-nombre { flex: 1; min-width: 0; }
.asis-nombre b { display: block; font-size: 13.5px; }
.asis-nombre small { color: var(--text-3); font-size: 11.5px; }
.asis-botones { display: flex; gap: 4px; }
.asis-btn {
  width: 38px; height: 34px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface);
  cursor: pointer; font-weight: 700; font-family: var(--display); font-size: 12.5px; color: var(--text-3);
  transition: background .12s, color .12s, border-color .12s;
}
.asis-btn:hover { border-color: var(--text-3); color: var(--text); }
.asis-btn.on.P { background: var(--ok); border-color: var(--ok); color: #fff; }
.asis-btn.on.T { background: var(--atencion); border-color: var(--atencion); color: #fff; }
.asis-btn.on.A { background: var(--alerta); border-color: var(--alerta); color: #fff; }
.asis-btn.on.J { background: var(--info); border-color: var(--info); color: #fff; }
.asis-letra { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-size: 11px; font-weight: 700; font-family: var(--display); color: #fff; }
.asis-letra.P { background: var(--ok); } .asis-letra.T { background: var(--atencion); }
.asis-letra.A { background: var(--alerta); } .asis-letra.J { background: var(--info); }
.asis-puntos { display: flex; gap: 3px; flex-wrap: wrap; }
.asis-puntos i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.asis-puntos i.P { background: var(--ok); } .asis-puntos i.T { background: var(--atencion); }
.asis-puntos i.A { background: var(--alerta); } .asis-puntos i.J { background: var(--info); }

/* =============================================================================
   AVISOS
   ============================================================================= */

#avisos { position: fixed; bottom: 20px; right: 20px; z-index: 500; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  background: var(--ink); color: var(--on-ink); padding: 11px 16px; border-radius: var(--r);
  box-shadow: var(--sombra); font-size: 13.5px; max-width: 380px; animation: sube .2s ease-out; pointer-events: auto;
  border-left: 4px solid var(--info);
}
.toast.ok { border-left-color: var(--ok); }
.toast.mal { border-left-color: var(--accent); }
.toast.sale { animation: desaparece .2s forwards; }

/* =============================================================================
   FECHA RÁPIDA, ARCHIVO EN VENTANA, MENSAJES ENVIADOS
   ============================================================================= */

.centro { text-align: center !important; }

.fecha-rapida { position: relative; display: flex; }
.fecha-rapida input[data-fecha-texto] { padding-right: 42px !important; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.fecha-rapida input.invalida { border-color: var(--alerta) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--alerta) 14%, transparent) !important; }
.fecha-cal {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 32px;
  border: 0; background: none; border-radius: var(--r-xs); color: var(--text-3); cursor: pointer;
  display: grid; place-items: center; font-size: 16px; z-index: 1;
}
.fecha-cal:hover { background: var(--surface-2); color: var(--text); }
.fecha-cal-input { position: absolute; right: 0; bottom: 0; width: 34px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }

.archivo-caja {
  display: flex !important; align-items: center; gap: 12px; padding: 10px 12px; margin: 0 !important;
  border: 1.5px dashed var(--line-2); border-radius: var(--r); cursor: pointer;
  text-transform: none !important; letter-spacing: 0 !important; font-weight: 400 !important; color: var(--text) !important;
  transition: border-color .14s, background .14s;
}
.archivo-caja:hover { border-color: var(--accent); background: var(--accent-soft); }
.archivo-caja.con-archivo { border-style: solid; border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 6%, var(--surface)); }
.archivo-vista {
  width: 46px; height: 46px; flex: 0 0 46px; border-radius: var(--r-xs); overflow: hidden; background: var(--surface-2);
  display: grid; place-items: center; color: var(--text-3); font-size: 20px; border: 1px solid var(--line);
}
.archivo-vista img { width: 100%; height: 100%; object-fit: cover; }
.archivo-vista .adj-doc { font-size: 17px; }
.archivo-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.archivo-texto b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archivo-texto small { font-size: 11.5px; color: var(--text-3); }

.plantilla.enviada { border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.plantilla-enviado {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 12.5px; color: var(--text-2); cursor: pointer;
  text-transform: none; letter-spacing: 0; font-weight: 500;
}
.plantilla-enviado input { width: 16px; height: 16px; margin: 0; accent-color: var(--ok); cursor: pointer; }
.plantilla.enviada .plantilla-enviado { color: var(--ok); font-weight: 600; }
.guardando { opacity: .6; pointer-events: none; transition: opacity .1s; }

/* ---------- editor de plantillas ---------- */
.editor-plantillas { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; min-height: 420px; }
.ed-cats { display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line); padding-right: 14px; }
.ed-cat {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 0; background: none; border-radius: var(--r);
  cursor: pointer; text-align: left; color: var(--text-2); font-size: 13px;
}
.ed-cat span:nth-child(2) { flex: 1; }
.ed-cat b { font-size: 11.5px; color: var(--text-3); background: var(--surface-3); border-radius: var(--r-pill); padding: 0 8px; font-variant-numeric: tabular-nums; }
.ed-cat:hover { background: var(--surface-2); color: var(--text); }
.ed-cat.activa { background: color-mix(in srgb, var(--c) 10%, var(--surface)); color: var(--text); font-weight: 700; box-shadow: inset 3px 0 0 var(--c); }
.ed-lista { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ed-comodines { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; font-size: 11.5px; color: var(--text-3); }
.ed-comodines span { width: 100%; }
.ed-comodines .chip { border: 0; cursor: pointer; font-family: var(--ui); }
.ed-comodines .chip:hover { background: var(--sky); color: var(--ink); }
.ed-plantilla .plantilla-cab { margin-bottom: 8px; flex-wrap: nowrap; }
.ed-num {
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%; background: var(--ink); color: var(--on-ink);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; font-family: var(--display);
}
.ed-titulo, .ed-texto {
  width: 100%; padding: 8px 11px; border: 1px solid var(--line-2); border-radius: var(--r-xs); background: var(--surface); outline: none;
}
.ed-titulo { flex: 1; font-weight: 700; min-width: 0; }
.ed-texto { line-height: 1.55; resize: vertical; min-height: 110px; }
.ed-titulo:focus, .ed-texto:focus { border-color: var(--info); box-shadow: 0 0 0 3px color-mix(in srgb, var(--info) 16%, transparent); }

/* ---------- permisos por rol ---------- */
.permisos th { white-space: nowrap; cursor: help; }
.permisos td { padding: 10px 6px; }
.permiso {
  width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; cursor: pointer; margin: 0;
  border: 1.5px solid var(--line-2); background: var(--surface); color: transparent; font-size: 15px; position: relative;
  transition: background .12s, border-color .12s, color .12s; text-transform: none; letter-spacing: 0;
}
.permiso input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.permiso:hover { border-color: var(--ok); }
.permiso.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.permiso.cambiado::after {
  content: ""; position: absolute; top: -4px; right: -4px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--atencion); box-shadow: 0 0 0 2px var(--surface);
}
.permiso:has(input:disabled) { cursor: default; }
.permiso:has(input:disabled):hover { border-color: var(--line-2); }
.permiso:has(input:focus-visible) { box-shadow: 0 0 0 3px color-mix(in srgb, var(--info) 30%, transparent); }
.permiso.fijo { background: var(--surface-3); border-color: var(--surface-3); color: var(--text-3); cursor: default; font-size: 13px; }
.permisos-leyenda {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 18px;
  margin-top: 12px; font-size: 11.5px; color: var(--text-3); line-height: 1.45;
}
.permisos-leyenda b { color: var(--text-2); font-weight: 600; }

/* =============================================================================
   VENTAS: LA HOJA
   ============================================================================= */

.filtros-ventas { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.filtros-sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 2px; }

/* La tarjeta: título del periodo, la hoja y abajo los botones. Cada celda es
   una cajita redondeada y rellena, sin rayas de cuadrícula. */
.vt-panel { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sombra-card); margin-top: 16px; overflow: hidden; }
.vt-cab { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 20px 22px 4px; }
.vt-cab h2 { margin: 0; font-family: var(--display); font-size: 16px; font-weight: 700; letter-spacing: -.005em; }
.vt-cuenta { font-size: 12.5px; color: var(--text-3); }
.vt-caja { overflow: auto; max-height: calc(100vh - 300px); max-height: calc(100dvh - 300px); min-height: 280px; overscroll-behavior: contain; }

.hoja-ventas {
  --celda: color-mix(in srgb, var(--surface-3) 65%, var(--surface));
  border-collapse: separate; border-spacing: 0; font-size: 13.5px; min-width: 100%;
}
.hoja-ventas th {
  position: sticky; top: 0; z-index: 3; background: var(--surface); text-align: left; white-space: nowrap;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; color: var(--text-3);
  padding: 16px 13px 12px; border-bottom: 1px solid var(--line);
}
.hoja-ventas th.ordenable { cursor: pointer; user-select: none; }
.hoja-ventas th.ordenable:hover { color: var(--text); }
.hoja-ventas td { padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; background: var(--surface); }
.hoja-ventas td:first-child + td { padding-left: 2px; }
.hoja-ventas td:last-child, .hoja-ventas th:last-child { padding-right: 22px; }
.hoja-ventas input, .hoja-ventas select, .hoja-ventas textarea {
  width: 100%; height: 44px; border: 1px solid transparent; background: var(--celda); outline: none;
  padding: 0 12px; font-size: 13.5px; color: var(--text); border-radius: var(--r); display: block;
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.hoja-ventas input:hover, .hoja-ventas select:hover, .hoja-ventas textarea:hover { border-color: var(--line-2); }
.hoja-ventas input:focus, .hoja-ventas select:focus, .hoja-ventas textarea:focus {
  background: var(--surface); border-color: var(--info); box-shadow: 0 0 0 3px color-mix(in srgb, var(--info) 15%, transparent);
}
.hoja-ventas select { cursor: pointer; padding-right: 6px; }
.hoja-ventas input::placeholder { color: var(--text-3); opacity: .8; }
.hoja-ventas input[type="date"] { font-variant-numeric: tabular-nums; }
.hoja-ventas input.vencida { color: var(--alerta); font-weight: 700; }
.hoja-ventas input.h-dinero { text-align: right; font-variant-numeric: tabular-nums; }
.hoja-ventas textarea { resize: none; overflow: hidden; line-height: 1.45; padding: 11px 12px; min-height: 44px; max-height: 44px; }
.hoja-ventas textarea:focus { max-height: 220px; overflow-y: auto; }
.hoja-ventas select option { color: var(--text); background: var(--surface); font-weight: 500; }

/* columnas: anchos; el número y el nombre quedan fijos a la izquierda */
.hoja-ventas .h-num {
  position: sticky; left: 0; z-index: 2; width: 46px; min-width: 46px; text-align: center;
  font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; padding-top: 19px;
}
.hoja-ventas th.h-num { z-index: 4; }
.hoja-ventas .h-nombre { position: sticky; left: 46px; z-index: 2; min-width: 230px; }
.hoja-ventas th.h-nombre { z-index: 4; }
.hoja-ventas td.h-nombre input { font-weight: 600; }
.hoja-ventas .h-fecha, .hoja-ventas .h-proximo { min-width: 162px; }
.hoja-ventas .h-sede { min-width: 120px; }
.hoja-ventas .h-telefono { min-width: 160px; }
.hoja-ventas .h-ciudad { min-width: 140px; }
.hoja-ventas .h-correo { min-width: 220px; }
.hoja-ventas .h-programa { min-width: 150px; }
.hoja-ventas .h-canal { min-width: 150px; }
.hoja-ventas .h-campana { min-width: 170px; }
.hoja-ventas .h-valor { min-width: 110px; }
.hoja-ventas .h-asesor { min-width: 170px; }
.hoja-ventas .h-etapa { min-width: 185px; }
.hoja-ventas .h-observaciones { min-width: 300px; width: 100%; }

/* los botones viven dentro de la cajita: abrir la ficha, ver al estudiante, WhatsApp */
.h-con-boton { position: relative; display: flex; align-items: center; }
.h-con-boton input { padding-right: 40px; }
.h-con-boton:has(.h-boton + .h-boton) input { padding-right: 72px; }
.h-boton {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border: 0; border-radius: var(--r-xs); background: none; color: var(--text-3);
  cursor: pointer; display: grid; place-items: center; font-size: 14px; opacity: .6; transition: opacity .12s, background .12s, color .12s;
}
.h-boton + .h-boton { right: 6px; }
.h-boton:first-of-type:not(:last-child) { right: 38px; }
.hoja-ventas tr:hover .h-boton, .h-boton:focus-visible { opacity: 1; }
.h-boton:hover { background: var(--sky); color: var(--ink); }
.h-boton.h-est { color: var(--ok); opacity: 1; }
.h-boton.h-wa { color: #1FA855; opacity: .9; }
.h-boton.h-wa:hover { background: color-mix(in srgb, #1FA855 14%, transparent); color: #1FA855; }

.hoja-ventas select.h-etapa {
  font-weight: 700; font-size: 12.5px; color: color-mix(in srgb, var(--c) 85%, var(--text));
  background: color-mix(in srgb, var(--c) 13%, var(--surface));
}
.hoja-ventas select.h-etapa:focus { background: color-mix(in srgb, var(--c) 8%, var(--surface)); }
:root[data-theme="dark"] .hoja-ventas select.h-etapa { color: color-mix(in srgb, var(--c) 45%, #fff); background: color-mix(in srgb, var(--c) 24%, var(--surface)); }

/* estado de cada fila: guardando, guardado, error */
.h-estado { display: block; width: 6px; height: 6px; border-radius: 50%; margin: -9px auto 3px; background: transparent; transition: background .2s; }
tr.h-guardando .h-estado { background: var(--atencion); }
tr.h-ok .h-estado { background: var(--ok); }
tr.h-mal .h-estado { background: var(--alerta); }
tr.h-ok td { animation: fila-ok 1.4s ease-out; }
@keyframes fila-ok { from { background: color-mix(in srgb, var(--ok) 10%, var(--surface)); } }

/* las filas en blanco, para escribir el siguiente lead */
.h-mas { color: var(--text-3); font-size: 14px; display: inline-grid; }
.hoja-ventas tr.h-nueva td.h-nombre input::placeholder { color: var(--text-3); font-weight: 400; }

.vt-pie { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 22px 18px; border-top: 1px solid var(--line); }
.vt-pie .sep { flex: 1; }
.vt-pie .btn .ico { font-size: 14px; }
.vt-nota { font-size: 12px; color: var(--text-3); max-width: 520px; text-align: right; line-height: 1.45; }

/* =============================================================================
   EQUIPO DE VENTAS: LA AGENDA DE REUNIONES
   El color de cada reunión es el de su estado (--c).
   ============================================================================= */

.pastilla-estado {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: var(--r-pill);
  white-space: nowrap; color: color-mix(in srgb, var(--c) 85%, var(--text)); background: color-mix(in srgb, var(--c) 14%, transparent);
}
:root[data-theme="dark"] .pastilla-estado { color: color-mix(in srgb, var(--c) 45%, #fff); background: color-mix(in srgb, var(--c) 26%, transparent); }

.ag-controles { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.ag-semana { display: flex; align-items: center; gap: 8px; }
.ag-semana b { font-family: var(--display); font-size: 14px; font-weight: 700; min-width: 0; }
.ag-semana .btn-solo { width: 32px; height: 32px; flex-basis: 32px; }

.ag-marcador { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 14px; }
.ag-marca {
  display: flex; align-items: center; gap: 11px; text-align: left; cursor: pointer; padding: 12px 14px; min-width: 0;
  background: var(--surface); border: 1.5px solid transparent; border-radius: var(--r-lg); box-shadow: var(--sombra-card);
  transition: border-color .14s, transform .1s;
}
.ag-marca:hover { transform: translateY(-1px); }
.ag-marca.activa { border-color: var(--info); }
.ag-marca.alerta { border-color: color-mix(in srgb, var(--alerta) 45%, transparent); }
.ag-marca.alerta .avatar-est { background: var(--alerta); color: #fff; }
.ag-marca-cuerpo { min-width: 0; display: flex; flex-direction: column; }
.ag-marca-cuerpo b { font-size: 13.5px; }
.ag-marca-cuerpo span { font-size: 11.5px; color: var(--text-3); }
.ag-marca-cuerpo i { font-style: normal; font-weight: 600; }
.ag-marca-cuerpo i.ok { color: var(--ok); }
.ag-marca-cuerpo i.mal { color: var(--alerta); }
.ag-setters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--text-2); }
.ag-setters .ico { color: var(--text-3); }

/* ---------- lista: un bloque por día ---------- */
.ag-lista { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.ag-dia { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sombra-card); overflow: hidden; }
.ag-dia.hoy { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent), var(--sombra-card); }
.ag-dia-cab { display: flex; align-items: center; gap: 10px; padding: 12px 16px; flex-wrap: wrap; }
.ag-dia-cab b { font-family: var(--display); font-size: 14px; }
.ag-dia-cab > span:not(.pastilla) { font-size: 12px; color: var(--text-3); }
.ag-fila {
  display: grid; grid-template-columns: 74px minmax(180px, 2.2fr) minmax(110px, 1fr) minmax(110px, 1fr) auto 118px 64px;
  align-items: center; gap: 12px; padding: 11px 16px 11px 13px; border-top: 1px solid var(--line);
  border-left: 4px solid var(--c); cursor: pointer; transition: background .12s;
}
.ag-fila:hover { background: var(--surface-2); }
.ag-fila.apagada { opacity: .55; }
.ag-fila.apagada .ag-cliente b { text-decoration: line-through; }
.ag-hora b { display: block; font-family: var(--display); font-size: 15px; font-variant-numeric: tabular-nums; }
.ag-hora span { font-size: 11px; color: var(--text-3); }
.ag-cliente { min-width: 0; }
.ag-cliente b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-cliente span { display: block; font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-quien { min-width: 0; font-size: 12.5px; }
.ag-quien small { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); font-weight: 600; }
.ag-quien span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-quien .falta { color: var(--alerta); font-weight: 700; }
.ag-confs { display: flex; gap: 4px; }
.ag-conf {
  display: inline-flex; align-items: center; gap: 3px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text-3);
  border-radius: var(--r-pill); padding: 3px 8px; font-size: 11px; font-weight: 600; cursor: pointer; transition: all .12s;
}
.ag-conf:hover { border-color: var(--ok); color: var(--ok); }
.ag-conf.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.ag-confs.grande .ag-conf { padding: 7px 14px; font-size: 12.5px; }
.ag-acc { display: flex; gap: 10px; justify-content: flex-end; }
.ag-acc .btn-texto { font-size: 16px; }
.ag-acc a.btn-texto { color: #1FA855; }

/* ---------- calendario de la semana ---------- */
.ag-cal { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sombra-card); margin-top: 16px; overflow: auto; max-height: calc(100dvh - 260px); }
.ag-cal-cab, .ag-cal-cuerpo { display: grid; grid-template-columns: 56px repeat(7, minmax(118px, 1fr)); min-width: 880px; }
.ag-cal-cab { position: sticky; top: 0; z-index: 3; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.ag-cal-cab > div { padding: 9px 6px; text-align: center; position: relative; }
.ag-cal-cab small { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); font-weight: 600; }
.ag-cal-cab b { font-family: var(--display); font-size: 17px; }
.ag-cal-cab i { position: absolute; top: 8px; right: 10px; font-style: normal; font-size: 10.5px; font-weight: 700; background: var(--ink); color: var(--on-ink); border-radius: var(--r-pill); padding: 0 6px; }
.ag-cal-cab .hoy b { background: var(--accent); color: #fff; border-radius: 50%; width: 30px; height: 30px; display: inline-grid; place-items: center; }
.ag-cal-horas > div { font-size: 10.5px; color: var(--text-3); text-align: right; padding: 3px 8px 0 0; font-variant-numeric: tabular-nums; }
.ag-cal-col { position: relative; border-left: 1px solid var(--line); }
.ag-cal-col.hoy { background: color-mix(in srgb, var(--accent) 3%, transparent); }
.ag-cal-franja { border-bottom: 1px dashed var(--line); cursor: pointer; transition: background .1s; }
.ag-cal-franja:hover { background: color-mix(in srgb, var(--info) 8%, transparent); }
.ag-bloque {
  position: absolute; left: 4px; right: 4px; border-radius: var(--r-xs); padding: 4px 7px; cursor: pointer; overflow: hidden; z-index: 1;
  background: color-mix(in srgb, var(--c) 16%, var(--surface)); border-left: 3px solid var(--c); box-shadow: var(--sombra-sm);
  font-size: 11.5px; line-height: 1.3; transition: transform .1s, box-shadow .12s;
}
.ag-bloque:hover { transform: translateY(-1px); box-shadow: var(--sombra-card); z-index: 2; }
.ag-bloque b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.ag-bloque span { display: block; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-bloque.apagada { opacity: .5; }
.ag-bloque.apagada b { text-decoration: line-through; }

/* ---------- agendar y la reunión abierta ---------- */
.ag-elegido { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.ag-elegido > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ag-elegido span:not(.avatar-est) { font-size: 12px; color: var(--text-3); }
.ag-resultados { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.ag-resultado {
  display: flex; align-items: center; gap: 10px; justify-content: space-between; text-align: left; cursor: pointer;
  padding: 9px 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); transition: border-color .12s, background .12s;
}
.ag-resultado:hover { border-color: var(--info); background: color-mix(in srgb, var(--info) 5%, var(--surface)); }
.ag-resultado > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.ag-resultado small { font-size: 11.5px; color: var(--text-3); }
.ag-estados { display: flex; gap: 6px; flex-wrap: wrap; }
.ag-estado-btn {
  border: 1.5px solid color-mix(in srgb, var(--c) 40%, transparent); background: var(--surface); color: color-mix(in srgb, var(--c) 85%, var(--text));
  border-radius: var(--r-pill); padding: 7px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all .12s;
}
.ag-estado-btn:hover { background: color-mix(in srgb, var(--c) 10%, var(--surface)); }
.ag-estado-btn.activo { background: var(--c); border-color: var(--c); color: #fff; }

.ld-reuniones { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.ld-reunion {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; text-align: left; cursor: pointer;
  padding: 9px 12px; border-radius: var(--r); border: 1px solid var(--line); border-left: 4px solid var(--c); background: var(--surface);
}
.ld-reunion:hover { background: var(--surface-2); }
.ld-reunion b { font-size: 13px; }
.ld-reunion span:not(.pastilla-estado) { font-size: 11.5px; color: var(--text-3); grid-column: 1; }
.ld-reunion .pastilla-estado { grid-column: 2; grid-row: 1 / span 2; }
.h-boton.h-cita { color: var(--info); opacity: 1; }
.ag-det-estado .seccion:last-child { margin-bottom: 26px; }

/* =============================================================================
   CELULAR Y TABLET
   ============================================================================= */

.movil-cab { display: none; }
.velo { display: none; }

@media (max-width: 1250px) {
  .paneles.p3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .paneles, .paneles.p3, .paneles.p21, .paneles.p12 { grid-template-columns: 1fr; }
  .rejilla.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rejilla.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ficha-cuerpo { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .ficha-tabs { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; padding: 8px 10px; }
  .ficha-tab { width: auto; white-space: nowrap; padding: 8px 12px; }
  .ficha-resumen { display: none; }
  .panel-lateral { width: 100vw; border-radius: 0; }
}

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .movil-cab {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    padding-top: max(10px, env(safe-area-inset-top));
    background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .movil-marca { width: 130px; }
  .movil-cab .sep { flex: 1; }
  .lateral {
    position: fixed; top: 0; bottom: 0; left: 0; width: 280px; z-index: 150; background: var(--bg);
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--sombra);
  }
  .lateral.abierta { transform: none; }
  .velo { position: fixed; inset: 0; background: rgba(8,14,26,.4); z-index: 140; }
  .velo.visible { display: block; }
  .principal { margin: 0; border-radius: 0; }
  .topbar { padding: 14px 16px 12px; }
  .topbar h1 { font-size: 18px; }
  .contenido { padding: 4px 14px 30px; }
  .filtros { padding: 10px 16px; }
  .tablero { padding: 12px 14px 16px; }
  .col { flex-basis: 270px; }
  .buscador { max-width: none; flex-basis: 100%; }
  .rejilla.c2, .rejilla.c3, .rejilla.c4 { grid-template-columns: 1fr; }
  .col-2 { grid-column: auto; }
  .modal-fondo { padding: 0; place-items: end stretch; }
  .modal { max-height: 94dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .ficha-cab { padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top)); }
  .ficha-cab h2 { font-size: 17px; }
  .ficha-cab .avatar-est.grande { width: 46px; height: 46px; flex-basis: 46px; font-size: 16px; }
  .ficha-contenido { padding: 16px 16px 24px; }
  .ficha-pie { padding: 10px 14px; padding-bottom: max(10px, env(safe-area-inset-bottom)); flex-wrap: wrap; gap: 8px; }
  .ficha-pie .estado-guardado, .ficha-pie .sep { display: none; }
  .ficha-pie [data-guardar] { order: -2; flex: 1 1 auto; }
  .ficha-pie [data-cancelar] { order: -1; }
  .ficha-pie .btn-sm { flex: 1 1 auto; }
  .ficha-cab { align-items: flex-start; }
  .ficha-cab .avatar-est.grande { display: none; }
  .modal-pie { flex-wrap: wrap; }
  .cifras { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cifra { padding: 13px 14px; }
  .cifra-valor { font-size: 21px; }
  .embudo-nombre { flex-basis: 120px; }
  .barra-nombre { flex-basis: 104px; }
  .saludo-dato { text-align: left; }
  .bit-cuando { flex-basis: 96px; }
  .semana { grid-template-columns: 44px repeat(6, minmax(110px, 1fr)); }
  #avisos { left: 14px; right: 14px; bottom: 14px; align-items: stretch; }
  .filtros-sep { display: none; }
  .vt-caja { max-height: 70dvh; }
  .vt-cab { padding: 16px 14px 2px; }
  .vt-pie { padding: 12px 14px 14px; }
  .vt-nota { text-align: left; max-width: none; }
  .hoja-ventas .h-num { width: 34px; min-width: 34px; }
  .hoja-ventas .h-nombre { left: 34px; min-width: 175px; }
  .hoja-ventas .h-fecha, .hoja-ventas .h-proximo { min-width: 140px; }
  .hoja-ventas input[type="date"] { padding: 0 8px; }
  .editor-plantillas { grid-template-columns: 1fr; gap: 12px; }
  .ed-cats { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 8px; }
  .ed-cat { flex: 0 0 auto; white-space: nowrap; }
  .ag-fila { grid-template-columns: 58px minmax(0, 1fr) auto; gap: 6px 10px; }
  .ag-fila .ag-quien, .ag-fila .ag-confs { display: none; }
  .ag-fila .ag-acc { grid-column: 2 / -1; justify-content: flex-start; }
  .ag-semana b { font-size: 12.5px; }
}

/* =============================================================================
   IMPRESIÓN (inscripción y resumen del plan)
   ============================================================================= */

#zona-impresion { display: none; }
@media print {
  html.imprimiendo body > *:not(#zona-impresion) { display: none !important; }
  html.imprimiendo #zona-impresion { display: block; }
  @page { size: A4; margin: 14mm 14mm 16mm; }
  html, body { background: #fff !important; height: auto; }
}
.hoja { font-family: var(--ui); color: #0E1A2F; font-size: 10pt; line-height: 1.4; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.hoja-cab { display: flex; align-items: center; justify-content: space-between; border-bottom: 3px solid #E31D23; padding-bottom: 10px; margin-bottom: 14px; }
.hoja-cab img { height: 48px; width: auto; }
.hoja-cab div { text-align: right; font-size: 9pt; color: #5B6478; }
.hoja-cab b { display: block; font-family: var(--display); font-size: 13pt; color: #0E1A2F; }
.hoja h3 { font-family: var(--display); font-size: 10.5pt; margin: 14px 0 6px; color: #E31D23; text-transform: uppercase; letter-spacing: .08em; }
.hoja table { width: 100%; border-collapse: collapse; }
.hoja td, .hoja th { border: 1px solid #D8D4CA; padding: 5px 8px; text-align: left; vertical-align: top; }
.hoja th { background: #F3F1EC; font-size: 8.5pt; text-transform: uppercase; letter-spacing: .05em; width: 26%; }
.hoja .num { text-align: right; }
.hoja .total td { font-weight: 700; background: #F3F1EC; }
.hoja-firmas { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 54px; }
.hoja-firmas div { border-top: 1px solid #0E1A2F; padding-top: 6px; text-align: center; font-size: 9pt; }
.hoja-pie { margin-top: 24px; font-size: 8pt; color: #5B6478; text-align: center; }
