/* =====================================================================
   NOVEDADES [EPET-30] — ESTILO MATERIAL (v9)
   Sistema de diseño "Estilo Material": mucho blanco, un azul para actuar,
   letra Roboto, botones y chips en píldora, tarjetas con bordes suaves.
   Los colores están en variables (:root); para cambiar el azul, cambiá --primary.
   ===================================================================== */

:root {
    /* Colores (tokens del sistema de diseño) */
    --surface: #ffffff;            /* fondo de tarjetas, tablas y diálogos */
    --surface-variant: #f1f3f4;    /* campos de búsqueda, filas alternas, fondo de página */
    --fondo: #f8f9fa;              /* fondo general de la página */
    --ink: #202124;                /* texto principal */
    --ink-muted: #5f6368;          /* texto secundario e íconos */
    --outline: #dadce0;            /* bordes y divisores */
    --primary: #1a73e8;            /* acción principal, enlaces, foco, seleccionado */
    --primary-osc: #1765cc;        /* primary al pasar el cursor */
    --on-primary: #ffffff;
    --primary-container: #e8f0fe;  /* chips seleccionados, opción activa del menú, avisos */
    --error: #d93025;   --error-container: #fce8e6;   --on-error-container: #a50e0e;
    --warning: #f9ab00; --warning-container: #fef7e0; --on-warning-container: #7a4f01;
    --success: #1e8e3e; --success-container: #e6f4ea; --on-success-container: #0d652d;
    /* Forma, espacio y profundidad */
    --radius-sm: 8px; --radius-lg: 16px; --radius-full: 9999px;
    --space-1: 4px; --space-2: 8px; --space-4: 16px; --space-6: 24px;
    --elevation-1: 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
    --elevation-2: 0 1px 2px 0 rgba(60,64,67,.3), 0 2px 6px 2px rgba(60,64,67,.15);
    --font: Roboto, "Helvetica Neue", Arial, system-ui, sans-serif, "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji";
    --alto-barra: 64px;
    --ancho-cajon: 264px;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 20px; color: var(--ink); background: var(--fondo); }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 28px; line-height: 36px; font-weight: 400; margin: 0 0 var(--space-4); }
h2 { font-size: 22px; line-height: 28px; font-weight: 500; margin: 0 0 12px; }
h3 { font-size: 16px; line-height: 24px; font-weight: 500; }
a { color: var(--primary); }
.svg { display: block; flex: 0 0 auto; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Barra superior ---------- */
.app-bar {
    position: sticky; top: 0; z-index: 30; height: var(--alto-barra);
    display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-4);
    background: var(--surface); border-bottom: 1px solid var(--outline);
}
.ib-menu {
    display: none; width: 48px; height: 48px; border: 0; border-radius: var(--radius-full);
    background: transparent; color: var(--ink-muted); cursor: pointer; align-items: center; justify-content: center; margin-left: -8px;
}
.ib-menu:hover { background: var(--surface-variant); }
.marca { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); min-width: 0; }
.marca-logo {
    width: 40px; height: 40px; border-radius: var(--radius-full); background: var(--primary); color: var(--on-primary);
    display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.marca-txt { font-size: 22px; line-height: 28px; font-weight: 400; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.marca-sigla { color: var(--ink); font-weight: 500; }
.app-bar-der { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.usuario-chip { display: flex; align-items: center; gap: var(--space-2); color: var(--ink); font-weight: 500; }
.avatar {
    width: 32px; height: 32px; border-radius: var(--radius-full); background: #1e8e3e; color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 500; font-size: 15px;
}

/* ---------- Estructura: menú lateral + contenido ---------- */
.app-cuerpo { display: flex; align-items: flex-start; }
.cajon {
    position: sticky; top: var(--alto-barra); flex: 0 0 var(--ancho-cajon); width: var(--ancho-cajon);
    height: calc(100vh - var(--alto-barra)); overflow-y: auto; padding: var(--space-2) var(--space-2) var(--space-6) 0;
    background: var(--fondo);
}
.cajon-grupo { padding: var(--space-2) 0; }
.cajon-grupo + .cajon-grupo { border-top: 1px solid var(--outline); margin-left: var(--space-4); }
.cajon-grupo + .cajon-grupo .cajon-titulo { padding-left: 12px; }
.cajon-grupo + .cajon-grupo .cajon-item { margin-left: -16px; }
.cajon-titulo { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-muted); padding: 12px 28px 6px; letter-spacing: .2px; }
.cajon-item {
    display: flex; align-items: center; gap: var(--space-4); height: 44px; padding: 0 var(--space-4) 0 28px;
    border-radius: 0 var(--radius-full) var(--radius-full) 0; color: var(--ink); text-decoration: none; font-weight: 500;
    white-space: nowrap;
}
.cajon-item .svg { color: var(--ink-muted); }
.cajon-item:hover { background: var(--surface-variant); }
.cajon-item.activo { background: var(--primary-container); color: #174ea6; }
.cajon-item.activo .svg { color: var(--primary); }
.cajon-item .externo { margin-left: auto; color: var(--ink-muted); font-weight: 400; }
.velo { position: fixed; inset: 0; background: rgba(32,33,36,.4); z-index: 35; }

.contenido { flex: 1 1 auto; min-width: 0; max-width: 1200px; margin: 0 auto; padding: var(--space-6) var(--space-6) 48px; }
body.sin-menu .contenido { max-width: 1100px; }

@media (max-width: 960px) {
    .ib-menu { display: inline-flex; }
    .cajon {
        position: fixed; z-index: 40; top: 0; left: 0; height: 100vh; width: 300px; max-width: 85vw;
        background: var(--surface); box-shadow: var(--elevation-2); padding-top: var(--space-4);
        border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
        transform: translateX(-105%); transition: transform .2s ease;
    }
    body.menu-abierto .cajon { transform: none; }
    .contenido { padding: var(--space-4) var(--space-4) 40px; }
    .usuario-nombre { display: none; }
}
@media (max-width: 560px) {
    .app-bar { padding: 0 var(--space-2) 0 var(--space-4); gap: 4px; }
    .marca-logo { display: none; }
    .marca-txt { font-size: 18px; }
    .btn-salir span { display: none; }
    .btn.btn-salir { padding: 0; width: 40px; justify-content: center; }
}

/* ---------- Título de cada pantalla ---------- */
.titulo-seccion {
    display: flex; justify-content: space-between; align-items: center; gap: 12px var(--space-4); flex-wrap: wrap;
    margin: 0 0 var(--space-6);
}
.titulo-seccion h1 { display: flex; align-items: center; gap: 12px; margin: 0; }
.titulo-ico {
    width: 44px; height: 44px; border-radius: var(--radius-full); background: var(--primary-container); color: var(--primary);
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.titulo-seccion .subtitulo { color: var(--ink-muted); flex-basis: 100%; margin-left: 56px; margin-top: -8px; }
@media (max-width: 560px) {
    .titulo-seccion h1 { font-size: 22px; line-height: 28px; }
    .titulo-ico { width: 40px; height: 40px; }
    .titulo-seccion .subtitulo { margin-left: 0; margin-top: 0; }
}
.subtitulo-sec { margin-top: 32px; }
h2 .svg { display: inline-block; vertical-align: -4px; color: var(--primary); }

/* ---------- Tarjetas ---------- */
.tarjeta { background: var(--surface); border: 1px solid var(--outline); border-radius: var(--radius-lg); padding: var(--space-6); }
.tarjeta.login { max-width: 400px; margin: 48px auto; padding: 36px 32px 32px; }
.tarjeta.login h1 { font-size: 24px; line-height: 32px; text-align: center; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--ink-muted); margin: 0 0 var(--space-6); }
.tarjeta.login .btn { width: 100%; justify-content: center; margin-top: var(--space-2); }

/* ---------- Formularios (campos contorneados) ---------- */
label { display: block; font-weight: 500; margin-bottom: var(--space-4); color: var(--ink); }
label small { font-weight: 400; color: var(--ink-muted); }
input[type=text], input[type=password], input[type=date], input[type=email], input[type=tel],
input[type=search], input[type=number], input[type=file], select, textarea {
    display: block; width: 100%; margin-top: 6px; min-height: 48px; padding: 12px 14px;
    border: 1px solid #80868b; border-radius: var(--radius-sm); background: var(--surface);
    font-size: 16px; line-height: 22px; font-weight: 400; color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
}
input[type=file] { padding: 10px; }
textarea { min-height: 96px; resize: vertical; }
select { cursor: pointer; }
input:hover, select:hover, textarea:hover { border-color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
input::placeholder, textarea::placeholder { color: #80868b; }
input[type=number] { width: 120px; }
label.check { display: flex; align-items: center; gap: 12px; font-weight: 400; cursor: pointer; }
label.check input, input[type=checkbox], input[type=radio] { accent-color: var(--primary); }
label.check input { width: 18px; height: 18px; margin: 0; flex: 0 0 auto; }
.fila-campos { display: flex; align-items: flex-end; gap: var(--space-6); flex-wrap: wrap; margin-top: var(--space-4); }
.fila-campos label { margin-bottom: 0; min-width: 200px; }
.fila-campos .dato { color: var(--ink-muted); padding-bottom: 12px; }
.grilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 var(--space-4); }
.grilla label { margin-bottom: 12px; }
.dos-columnas { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--space-6); align-items: start; }
.dos-iguales { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); align-items: start; }
.botones { display: flex; gap: var(--space-2); margin-top: var(--space-6); flex-wrap: wrap; }
.ayuda { color: var(--ink-muted); font-size: 13px; margin: 10px 0 0; }
.pasos { padding-left: 20px; line-height: 1.7; }
.pasos code, .ayuda code { background: var(--surface-variant); padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.req { color: var(--error); }
.error-campo { display: none; color: var(--error); font-weight: 400; font-size: 12px; margin-top: 4px; }
input.invalido { border-color: var(--error) !important; box-shadow: inset 0 0 0 1px var(--error) !important; }
.lista-errores { margin: 6px 0 0; padding-left: 20px; }
.trampa { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 860px) {
    .dos-columnas, .dos-iguales { grid-template-columns: minmax(0, 1fr); }
}

/* Grupos de campos (cajas numeradas del editor y de envíos) */
.caja { border: 1px solid var(--outline); border-radius: var(--radius-lg); padding: var(--space-4) 20px 20px; margin: 0 0 var(--space-4); background: var(--surface); min-width: 0; }
.caja legend { font-weight: 500; font-size: 16px; padding: 0 var(--space-2); color: var(--ink); }
.caja legend small { font-weight: 400; color: var(--ink-muted); font-size: 13px; }
.caja legend .svg { display: inline-block; vertical-align: -3px; color: var(--ink-muted); }
.caja .num {
    display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-right: 6px;
    border-radius: var(--radius-full); background: var(--primary); color: var(--on-primary); font-size: 13px; font-weight: 500;
}
.caja-previa { background: var(--fondo); border-style: dashed; }
.caja-previa legend { color: var(--ink-muted); }

/* ---------- Botones (píldora) ---------- */
.btn, a.btn, button.btn {
    display: inline-flex; align-items: center; gap: var(--space-2); height: 40px; padding: 0 var(--space-6);
    border: 1px solid var(--outline); border-radius: var(--radius-full); background: var(--surface); color: var(--primary);
    font-size: 14px; font-weight: 500; letter-spacing: .1px; text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: background .15s, box-shadow .15s, border-color .15s;
}
.btn:hover { background: #f6fafe; border-color: #d2e3fc; }
.btn .svg { display: block; margin: 0 0 0 -6px; }
.btn-primario, a.btn-primario, button.btn-primario { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primario:hover { background: var(--primary-osc); border-color: var(--primary-osc); box-shadow: var(--elevation-1); }
.btn-peligro, a.btn-peligro, button.btn-peligro { color: var(--error); }
.btn-peligro:hover { background: #fef7f6; border-color: #f6aea9; }
.btn-wa { background: var(--success); border-color: var(--success); color: #fff; }
.btn-chico { height: 32px; padding: 0 var(--space-4); font-size: 13px; }
.btn-grande { width: 100%; height: 48px; justify-content: center; font-size: 16px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-salir { color: var(--ink-muted); }
.btn-salir:hover { color: var(--error); background: var(--error-container); border-color: transparent; }

/* Botones de ícono: círculos tonales */
.ib {
    display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0;
    border: 0; border-radius: var(--radius-full); cursor: pointer; vertical-align: middle; text-decoration: none;
    background: var(--surface-variant); color: var(--ink-muted); transition: background .15s, box-shadow .15s;
}
.ib:hover { box-shadow: var(--elevation-1); }
.ib .svg { width: 20px; height: 20px; }
.ib-azul    { background: var(--primary-container); color: var(--primary); }
.ib-verde   { background: var(--success-container); color: var(--success); }
.ib-rojo    { background: var(--error-container); color: var(--error); }
.ib-gris    { background: var(--surface-variant); color: var(--ink-muted); }
.ib-violeta { background: #f3e8fd; color: #8430ce; }
.ib-mini { width: 22px; height: 22px; cursor: default; vertical-align: -6px; }
.ib-mini .svg { width: 14px; height: 14px; }
.ib-texto { display: none; }
a.ib, a.ib:hover { text-decoration: none; }
.acciones { white-space: nowrap; text-align: right; }
.acciones form { display: inline; margin: 0; }
.acciones-caja { display: flex; gap: var(--space-2); justify-content: flex-end; align-items: center; }
.acciones-caja form { margin: 0; }
.botones-titulo { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ---------- Avisos (banners) ---------- */
.aviso { padding: 12px var(--space-4); border-radius: var(--radius-sm); margin-bottom: var(--space-4); border: 0; }
.aviso-ok    { background: var(--success-container); color: var(--on-success-container); }
.aviso-error { background: var(--error-container); color: var(--on-error-container); }
.aviso-info  { background: var(--primary-container); color: #174ea6; }
.aviso-adv   { background: var(--warning-container); color: var(--on-warning-container); }

/* ---------- Chips de filtro (Vigentes / Vencidas / Todas) ---------- */
.filtros { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin: 0 0 var(--space-4); }
.filtros a {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 var(--space-4);
    border: 1px solid var(--outline); border-radius: var(--radius-full); background: var(--surface);
    color: var(--ink); text-decoration: none; font-weight: 500;
}
.filtros a .svg { width: 18px; height: 18px; color: var(--ink-muted); }
.filtros a:hover { background: var(--surface-variant); }
.filtros a.activo { background: var(--primary-container); border-color: transparent; color: #174ea6; }
.filtros a.activo .svg { color: var(--primary); }
.filtros a b { font-weight: 500; background: rgba(60,64,67,.1); padding: 0 7px; border-radius: var(--radius-full); font-size: 12px; }
.filtros a.activo b { background: rgba(26,115,232,.15); }
.filtros .total { margin-left: auto; color: var(--ink-muted); }

/* ---------- Tablas ---------- */
.tabla { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--outline); border-radius: var(--radius-lg); overflow: hidden; }
.tabla th, .tabla td { padding: 14px var(--space-4); border-bottom: 1px solid var(--outline); text-align: left; vertical-align: top; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla th { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-muted); background: var(--surface); letter-spacing: .2px; }
.tabla tbody tr:hover td { background: #f8f9fa; }
.tabla tr.vencida td { color: var(--ink-muted); }
.tabla-chica { font-size: 13px; margin-top: var(--space-2); border-radius: var(--radius-sm); }
.tabla-chica td { padding: 6px 10px; }
.nowrap { white-space: nowrap; }
.vacio { color: var(--ink-muted); background: var(--surface); border: 1px dashed var(--outline); padding: 32px; border-radius: var(--radius-lg); text-align: center; }
.paginado { display: flex; gap: 6px; margin-top: var(--space-4); flex-wrap: wrap; }
.paginado a {
    min-width: 36px; height: 36px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-full); text-decoration: none; color: var(--ink); border: 1px solid var(--outline); background: var(--surface);
}
.paginado a:hover { background: var(--surface-variant); }
.paginado a.activo { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
@media (max-width: 800px) {
    .tabla:not(.tabla-novedades) { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .tabla:not(.tabla-novedades) td:first-child { min-width: 150px; }
}

/* Estados */
.estado, .est { display: inline-block; font-size: 12px; line-height: 16px; font-weight: 500; padding: 3px 10px; border-radius: var(--radius-full); white-space: nowrap; }
.estado.ok, .est-enviado { background: var(--success-container); color: var(--on-success-container); }
.estado.no { background: var(--surface-variant); color: var(--ink-muted); }
.estado.auto, .est-pendiente, .est-procesando { background: var(--warning-container); color: var(--on-warning-container); }
.est-abierto { background: var(--success-container); color: var(--on-success-container); }
.est-error { background: var(--error-container); color: var(--on-error-container); }
.detalle { font-size: 13px; color: var(--ink-muted); max-width: 320px; word-break: break-word; }
.resultado .est { margin-right: 2px; }

/* ---------- Listado de novedades ---------- */
.tabla .texto-nov { max-width: 560px; line-height: 20px; }
.tabla .texto-nov p { margin: 0 0 4px; }
.texto-nov .nov-etiquetas { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.texto-nov .nov-etiquetas .etq { margin: 0; }
.texto-nov .nov-titulo-lista { font-size: 16px; line-height: 24px; font-weight: 500; color: var(--ink); margin-bottom: 2px; }
.texto-nov .cuerpo { color: var(--ink-muted); max-height: 60px; overflow: hidden; }
.texto-nov .cuerpo h5 { font-size: 1em; font-weight: normal; margin: 0; }
.texto-nov .cuerpo :is(h1,h2,h3,h4,h6) { font-size: 1em; margin: 0; }
.area a, .texto-nov a { color: var(--primary); }
.informada, .texto-nov a.informada { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 12px; color: var(--success); text-decoration: none; font-weight: 500; }
.informada:hover { text-decoration: underline; }
.informada .svg { display: inline-block; }

@media (max-width: 800px) {
    /* Cada novedad es una tarjeta; los botones van abajo, grandes y con texto */
    .tabla-novedades, .tabla-novedades tbody, .tabla-novedades tr, .tabla-novedades td { display: block; width: 100%; }
    .tabla-novedades { border: 0; background: transparent; border-radius: 0; overflow: visible; }
    .tabla-novedades thead { display: none; }
    .tabla-novedades tr { background: var(--surface); border: 1px solid var(--outline); border-radius: var(--radius-lg); margin-bottom: 12px; padding: var(--space-4); }
    .tabla-novedades tbody tr:hover td { background: transparent; }
    .tabla-novedades td { border: 0; padding: 2px 0; }
    .tabla-novedades td.col-id, .tabla-novedades td.col-usuario { display: none; }
    .tabla-novedades .texto-nov { max-width: none; margin-bottom: var(--space-2); }
    .tabla-novedades td[data-titulo]::before { content: attr(data-titulo) ": "; color: var(--ink-muted); font-size: 12px; }
    .tabla-novedades .acciones-caja { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--outline); }
    .tabla-novedades .acciones-caja form { display: block; }
    .tabla-novedades .acciones .ib { width: 100%; height: 48px; border-radius: var(--radius-full); gap: 6px; }
    .tabla-novedades .ib-texto { display: inline; font-size: 14px; font-weight: 500; }
    .filtros .total { width: 100%; margin-left: 0; }
}

/* ---------- Editor de novedades ---------- */
.editor { border: 1px solid #80868b; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.editor:focus-within { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.herramientas { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 8px; background: var(--surface-variant); border-bottom: 1px solid var(--outline); align-items: center; }
.herramientas button {
    min-width: 32px; height: 32px; padding: 0 10px; border: 0; border-radius: var(--radius-full);
    background: transparent; color: var(--ink); cursor: pointer; font-size: 14px;
}
.herramientas button:not(.btn-icono):hover { background: rgba(60,64,67,.1); }
.herramientas .btn-icono { color: #fff; font-size: 12px; font-weight: 500; }
.herramientas .btn-icono:hover { opacity: .88; }
.herramientas .sep { width: 1px; height: 20px; background: var(--outline); margin: 0 4px; }
.herramientas select { display: inline-block; width: auto; min-height: 32px; height: 32px; margin: 0; padding: 0 8px; font-size: 14px; border-color: var(--outline); border-radius: var(--radius-full); }
.area { min-height: 180px; padding: 14px; line-height: 22px; outline: none; background: var(--surface); font-size: 15px; }
.area:empty::before { content: "Escribí la novedad…"; color: #80868b; }
.area p { margin: 0 0 6px; }
.area h1 { font-size: 1.8em; } .area h2 { font-size: 1.5em; } .area h3 { font-size: 1.3em; }
.area h4 { font-size: 1.15em; } .area h5 { font-size: 1em; font-weight: normal; margin: 0 0 6px; } .area h6 { font-size: .9em; }
.area :is(h1,h2,h3,h4,h6) { margin: 4px 0 6px; line-height: 1.25; font-weight: 500; }
.campo-titulo { font-size: 20px !important; font-weight: 500; color: var(--ink); }

/* Chips (etiquetas del editor y grupos) */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip { margin: 0; font-weight: 400; cursor: pointer; position: relative; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip .etq { font-size: 13px; padding: 6px 14px; border-radius: var(--radius-full); transition: .15s; }
.chips .chip input:not(:checked) + .etq { background: var(--surface); color: var(--ink-muted); box-shadow: inset 0 0 0 1px var(--outline); }
.chips .chip:hover input:not(:checked) + .etq { background: var(--surface-variant); }
.chips .chip input:checked + .etq { box-shadow: var(--elevation-1); }
.chip input:focus-visible + .etq, .chip input:focus-visible + .rol { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Roles (grupos de personas) */
.rol { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; line-height: 16px; font-weight: 500; padding: 3px 10px; border-radius: var(--radius-full); margin: 1px 2px 1px 0; white-space: nowrap; }
.rol .svg { width: 14px; height: 14px; }
.rol-directivo { background: #f3e8fd; color: #681da8; }
.rol-profesor  { background: var(--primary-container); color: #174ea6; }
.rol-preceptor { background: #feefe3; color: #b06000; }
.rol-auxiliar  { background: var(--surface-variant); color: #3c4043; }
.rol-secretaria { background: #e6f4ea; color: #137333; }
.rol-alumno    { background: var(--success-container); color: var(--on-success-container); }
.rol-tutor     { background: #fde7f3; color: #9c166b; }
.rol-asesor    { background: #e4f7fb; color: #007b83; }
.rol-todos     { background: var(--surface-variant); color: var(--ink); }
.chip-rol .rol { font-size: 14px; line-height: 20px; padding: 8px 16px; }
.chips .chip-rol input:not(:checked) + .rol { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--outline); }
.chips .chip-rol:hover input:not(:checked) + .rol { background: var(--surface-variant); }
.chips .chip-rol input:checked + .rol { box-shadow: inset 0 0 0 1px currentColor; }
.chips .chip-rol input:checked + .rol::before { content: "✓"; font-weight: 700; margin-right: 2px; }

/* ---------- Personas ---------- */
.roles-resumen { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4); }
.roles-resumen a {
    display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
    border-radius: var(--radius-sm); border: 1px solid var(--outline); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 500;
}
.roles-resumen a .svg { width: 16px; height: 16px; color: var(--ink-muted); }
.roles-resumen a b { font-weight: 500; color: var(--ink-muted); }
.roles-resumen a:hover { background: var(--surface-variant); }
.roles-resumen a.activo { background: var(--primary-container); border-color: transparent; color: #174ea6; }
.roles-resumen a.activo .svg, .roles-resumen a.activo b { color: #174ea6; }
.buscador, form.buscador { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-bottom: var(--space-4); }
form.buscador input, form.buscador select { display: inline-block; width: auto; margin: 0; min-height: 40px; padding: 8px 14px; font-size: 14px; }
form.buscador input[type=search] { flex: 1; min-width: 240px; border-radius: var(--radius-full); background: var(--surface-variant); border-color: transparent; padding-left: 18px; }
form.buscador input[type=search]:focus { background: var(--surface); box-shadow: var(--elevation-1); border-color: transparent; }
form.buscador select { border-radius: var(--radius-full); }
form.buscador .corto { width: 110px; }
.buscador .total { margin-left: auto; color: var(--ink-muted); }
.tabla-personas th.col-nombre, .tabla-personas td.col-nombre { width: 30%; min-width: 240px; }
.tabla-personas .col-celular { font-size: 13px; }
.tabla-personas .sin-dato, .col-email .sin-dato { color: #9aa0a6; font-style: normal; }
.tabla-personas .col-curso { max-width: 170px; }
.tabla-personas .col-email { overflow-wrap: break-word; font-size: 13px; }
.tabla-personas .acciones { width: 1%; }
.col-email .cel { color: var(--ink-muted); }
.medio {
    display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; vertical-align: middle;
    border-radius: var(--radius-full); background: var(--surface-variant); color: #9aa0a6; margin-right: 2px;
}
.medio .svg { width: 14px; height: 14px; }
.medio.on { color: #fff; }
.medio-email.on { background: var(--primary); }
.medio-push.on  { background: #1e8e3e; }
.medio-push.off { background: #d93025; color: #fff; }   /* campana roja y tachada: notificaciones desactivadas */
.leido-si { display: inline-flex; align-items: center; gap: 4px; color: #137333; font-weight: 500; }
.leido-no { display: inline-flex; align-items: center; gap: 4px; color: #c5221f; font-weight: 500; }
.leido-si .svg, .leido-no .svg { width: 16px; height: 16px; }
.medio-whatsapp.on { background: var(--success); }
.medio-sms.on { background: #e37400; }
.col-email .medio, .tabla-chica .medio { width: 22px; height: 22px; }
.medios-form { display: flex; flex-direction: column; gap: 10px; }
.medio-fila { display: grid; grid-template-columns: 36px 1fr 220px; gap: 12px; align-items: end; }
.medio-fila > .medio { width: 34px; height: 34px; margin-bottom: 8px; }
.medio-fila label { margin: 0; }
.medio-fila label.check { padding-bottom: 14px; }
@media (max-width: 800px) {
    .medio-fila { grid-template-columns: 36px 1fr; }
    .medio-fila label.check { grid-column: 2; }
}

/* ---------- Cursos ---------- */
.form-curso { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: var(--space-4); }
.form-curso label { margin: 0; }
.form-curso input[type=text] { min-width: 180px; }
.form-curso.en-linea { margin: 0; }
.tabla-cursos { max-width: 760px; }
.tabla-cursos td { vertical-align: middle; }
.tabla-cursos tr.editando td { background: var(--warning-container); }
.curso-nombre { font-size: 16px; font-weight: 500; }

/* ---------- Envíos ---------- */
.informar { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--space-6); align-items: start; }
.nuevo-envio { margin-bottom: var(--space-6); }
.nuevo-envio > h2 { margin-bottom: var(--space-4); }
.curso-filtro, .nuevo-envio .curso-filtro { margin: 0 0 12px; max-width: 300px; }
.conteo { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: 12px; }
.conteo > div { flex: 1; min-width: 96px; background: var(--fondo); border: 1px solid var(--outline); border-radius: var(--radius-sm); padding: 10px 12px; text-align: center; }
.conteo b { display: block; font-size: 28px; line-height: 36px; font-weight: 400; color: var(--ink); }
.conteo span { font-size: 12px; color: var(--ink-muted); }
.conteo .c-email b, .conteo .c-push b { color: var(--primary); }
.conteo .c-sin b, .conteo .c-err b { color: var(--error); }
.conteo .c-ok b { color: var(--success); }
.conteo .c-pend b { color: #b06000; }
.conteo-lote { margin: var(--space-4) 0; }
details { margin-top: var(--space-2); }
details summary { cursor: pointer; color: var(--primary); font-weight: 500; }
.sin-medio summary { color: var(--error); }
.sin-medio ul { margin: 6px 0; padding-left: 20px; line-height: 1.9; }
.grupos-envio { list-style: none; margin: 10px 0 6px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.grupos-envio li { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.previas { position: sticky; top: calc(var(--alto-barra) + 16px); }
.previas h3 { margin: 0 0 10px; color: var(--ink-muted); }
.asunto { font-size: 13px; color: var(--ink-muted); margin-bottom: 6px; }
.previa-email { width: 100%; height: 300px; border: 1px solid var(--outline); border-radius: var(--radius-sm); background: var(--surface-variant); }
.lote-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; padding: var(--space-4) 20px; }
.lote-info small { display: block; color: var(--ink-muted); font-size: 12px; }
.progreso { margin-bottom: var(--space-4); }
.barra-prog { height: 6px; background: var(--primary-container); border-radius: var(--radius-full); overflow: hidden; margin-bottom: var(--space-2); }
.barra-prog div { height: 100%; background: var(--primary); transition: width .3s; }
.reintentar { display: flex; gap: 12px; align-items: center; margin-bottom: var(--space-4); flex-wrap: wrap; }
.reintentar .ayuda { margin: 0; }
.envio-push { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px var(--space-4); border-radius: var(--radius-sm); background: var(--fondo); border: 1px solid var(--outline); margin-top: 12px; }
@media (max-width: 1000px) {
    .informar { grid-template-columns: minmax(0, 1fr); }
    .previas { position: static; }
}

/* ---------- App y notificaciones (admin) ---------- */
.app-resumen { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); align-items: start; }
.app-resumen .tarjeta { padding: 20px; }
.app-resumen b { display: block; font-size: 36px; line-height: 44px; font-weight: 400; }
.app-resumen span { color: var(--ink-muted); }
.enlace-app { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.enlace-app input { flex: 1; min-width: 240px; margin: 0; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; background: var(--surface-variant); }

/* ---------- Páginas públicas (suscripción) ---------- */
body.publica { background: var(--fondo); }
.suscribir { max-width: 600px; margin: 0 auto; padding: var(--space-6) var(--space-4) 48px; }
.sus-cabecera { display: flex; gap: var(--space-4); align-items: center; padding: 0 0 var(--space-6); }
.sus-cabecera h1 { margin: 0 0 4px; font-size: 28px; line-height: 36px; }
.sus-cabecera p { margin: 0; color: var(--ink-muted); }
.sus-icono { width: 56px; height: 56px; border-radius: var(--radius-full); background: var(--primary-container); color: var(--primary); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.sus-icono .svg { width: 28px; height: 28px; }
.form-suscribir label { margin-bottom: 20px; }
.form-suscribir .mayus { text-transform: uppercase; }
.form-suscribir .mayus::placeholder { text-transform: none; }
.form-suscribir .acepto { align-items: flex-start; line-height: 20px; }
.form-suscribir .acepto input { width: 20px; height: 20px; margin-top: 0; }
.sus-listo { background: var(--surface); border-radius: var(--radius-lg); padding: 40px 24px; text-align: center; border: 1px solid var(--outline); }
.sus-listo-icono { width: 72px; height: 72px; margin: 0 auto 12px; border-radius: var(--radius-full); background: var(--success-container); color: var(--success); display: flex; align-items: center; justify-content: center; }
.sus-listo-icono .svg { width: 36px; height: 36px; }
.sus-listo h2 { font-size: 24px; line-height: 32px; font-weight: 400; }
.sus-listo .btn { margin-top: 12px; }
@media (max-width: 560px) {
    .sus-cabecera h1 { font-size: 22px; line-height: 28px; }
}
.est .svg, .rol .svg { display: inline-block; vertical-align: -2px; }

/* Celular: menos relleno en tarjetas y cajas para aprovechar el ancho */
@media (max-width: 560px) {
    .tarjeta { padding: var(--space-4); }
    .caja { padding: 12px 14px 16px; }
    select { max-width: 100%; text-overflow: ellipsis; }
}

/* Envíos: medios (e-mail y notificación) y vista previa de la notificación */
.medios-envio { display: grid; gap: 8px; margin-bottom: 12px; }
.medio-opcion { display: grid; grid-template-columns: 20px 32px 1fr; gap: 12px; align-items: center; margin: 0; padding: 12px 14px;
    border: 1px solid var(--outline); border-radius: var(--radius-sm); font-weight: 400; cursor: pointer; background: var(--surface); }
.medio-opcion:has(input:checked) { border-color: var(--primary); background: #f8fbff; }
.medio-opcion input { width: 18px; height: 18px; margin: 0; }
.medio-opcion .medio { width: 32px; height: 32px; }
.medio-opcion b { display: block; font-weight: 500; }
.medio-opcion small { color: var(--ink-muted); font-size: 13px; }
.medio-opcion.deshabilitado { opacity: .55; cursor: not-allowed; }
.previa-notif { display: flex; gap: 12px; padding: 12px 14px; margin-bottom: 20px; background: var(--surface); border: 1px solid var(--outline);
    border-radius: var(--radius-lg); box-shadow: var(--elevation-1); }
.previa-notif-ico { width: 32px; height: 32px; border-radius: var(--radius-full); background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.previa-notif small { display: block; color: var(--ink-muted); font-size: 12px; }
.previa-notif b { display: block; font-weight: 500; }
.previa-notif p { margin: 2px 0 0; color: var(--ink-muted); font-size: 13px; line-height: 18px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link-app { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; text-decoration: none; color: var(--ink-muted); }
.link-app:hover small { text-decoration: underline; }

/* =====================================================================
   MODO NOCHE — lo elige la persona con el botón de la barra (<html data-tema="noche">,
   ver comun/marco.php). Estos colores valen también para Aulas Virtuales, Calendario y Exámenes,
   que se apoyan en esta hoja. Las páginas sin el marco (app, suscribir, vigentes) siguen en claro.
   ===================================================================== */
html[data-tema="noche"] {
    color-scheme: dark;
    --surface: #202124;
    --surface-variant: #303134;
    --fondo: #17181a;
    --ink: #e8eaed;
    --ink-muted: #9aa0a6;
    --outline: #5f6368;
    --primary: #8ab4f8;
    --primary-osc: #aecbfa;
    --on-primary: #202124;
    --primary-container: #1e3a5f;
    --error: #f28b82;   --error-container: #4a1f1c;   --on-error-container: #f6aea9;
    --warning: #fdd663; --warning-container: #3d3117; --on-warning-container: #fde293;
    --success: #81c995; --success-container: #1d3a26; --on-success-container: #a8dab5;
    --elevation-1: 0 1px 2px 0 rgba(0,0,0,.6), 0 1px 3px 1px rgba(0,0,0,.3);
    --elevation-2: 0 1px 2px 0 rgba(0,0,0,.6), 0 2px 6px 2px rgba(0,0,0,.3);
}
html[data-tema="noche"] .cajon-item.activo,
html[data-tema="noche"] .aviso-info,
html[data-tema="noche"] .filtros a.activo,
html[data-tema="noche"] .rol-profesor,
html[data-tema="noche"] .roles-resumen a.activo,
html[data-tema="noche"] .roles-resumen a.activo .svg,
html[data-tema="noche"] .roles-resumen a.activo b { color: #d2e3fc; }
html[data-tema="noche"] .btn:hover { background: rgba(138,180,248,.12); border-color: #8ab4f8; }
html[data-tema="noche"] .btn-primario:hover { background: var(--primary-osc); border-color: var(--primary-osc); }
html[data-tema="noche"] .btn-peligro:hover { background: rgba(242,139,130,.12); border-color: #f28b82; }
html[data-tema="noche"] .btn-wa, html[data-tema="noche"] .btn-wa:hover { background: #1e8e3e; border-color: #1e8e3e; color: #fff; }
html[data-tema="noche"] .ib-violeta { background: #3b1f57; color: #d7aefb; }
html[data-tema="noche"] .filtros a b { background: rgba(232,234,237,.14); }
html[data-tema="noche"] .filtros a.activo b { background: rgba(138,180,248,.22); }
html[data-tema="noche"] .tabla tbody tr:hover td { background: #292a2d; }
html[data-tema="noche"] .herramientas button:not(.btn-icono):hover { background: rgba(232,234,237,.1); }
html[data-tema="noche"] .rol-directivo  { background: #3b1f57; color: #e9d2fd; }
html[data-tema="noche"] .rol-preceptor  { background: #4a2a00; color: #fdd6b0; }
html[data-tema="noche"] .rol-auxiliar   { color: var(--ink); }
html[data-tema="noche"] .rol-secretaria { background: #0d3b1e; color: #a8dab5; }
html[data-tema="noche"] .rol-tutor      { background: #4a1535; color: #fbc0de; }
html[data-tema="noche"] .rol-asesor     { background: #0b3a40; color: #a1e4f2; }
html[data-tema="noche"] .leido-si { color: #81c995; }
html[data-tema="noche"] .leido-no { color: #f28b82; }
html[data-tema="noche"] .conteo .c-pend b { color: #fcad70; }
html[data-tema="noche"] .medio-opcion:has(input:checked) { background: rgba(138,180,248,.1); }
html[data-tema="noche"] .previa-notif-ico { color: var(--on-primary); }

/* ---------- Recuadro «Suspensión de Clase» de los formularios (Nueva Novedad y Agregar evento del Calendario) ---------- */
.caja-suspension { border: 2px solid #f1aaa5; background: #fff8f7; }
.caja-suspension legend { color: #8c1d18; font-weight: 500; }
.caja-suspension .chips { align-items: center; }
.caja-suspension .chips > b { font-weight: 500; color: #8c1d18; margin-right: 4px; }
.chip-turno .turno { display: inline-block; font-size: 14px; line-height: 20px; padding: 8px 18px; border-radius: 9999px; background: #fff; color: #5f6368;
    box-shadow: inset 0 0 0 1px #dadce0; transition: .15s; user-select: none; }
.chip-turno:hover input:not(:checked) + .turno { background: #fdecea; }
.chip-turno input:checked + .turno { background: #f6bcb7; color: #7a1612; font-weight: 700; box-shadow: none; }
.chip-turno input:checked + .turno::before { content: "✓ "; }
.chip-turno input:focus-visible + .turno { outline: 2px solid #ef9a94; outline-offset: 2px; }
.caja-suspension .fila-campos label { min-width: 170px; }
.caja-suspension .ayuda { margin: 12px 0 0; color: #5f6368; font-size: 13px; }
html[data-tema="noche"] .caja-suspension { background: #2b1b1a; }
html[data-tema="noche"] .caja-suspension legend, html[data-tema="noche"] .caja-suspension .chips > b { color: #f6aea9; }
html[data-tema="noche"] .chip-turno .turno { background: #202124; color: #bdc1c6; box-shadow: inset 0 0 0 1px #5f6368; }
html[data-tema="noche"] .chip-turno input:checked + .turno { background: #f6bcb7; color: #7a1612; }
