/* app.css — Estilos del panel. Mobile-first, con vista de impresión al final. */
:root {
    --fondo: #f4f6f9;
    --superficie: #ffffff;
    --texto: #1c2430;
    --suave: #667085;
    --borde: #dde3ea;
    --primario: #1f5eff;
    --primario-osc: #1747c4;
    --ok: #12805c;
    --ok-bg: #e6f6ef;
    --error: #b42318;
    --error-bg: #fdecea;
    --aviso: #9a6700;
    --aviso-bg: #fff6dd;
    --radio: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 16px; }
body {
    margin: 0; background: var(--fondo); color: var(--texto);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.45;
}
a { color: var(--primario); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
.suave { color: var(--suave); font-size: .9rem; }
.derecha { text-align: right; }
.nowrap { white-space: nowrap; }

/* Barra superior */
.barra { background: #101828; color: #fff; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: .6rem 1rem; position: sticky; top: 0; z-index: 10; }
.marca { color: #fff; font-weight: 700; text-decoration: none; }
.menu-boton { background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; padding: .2rem .5rem; }
.menu { display: none; width: 100%; flex-direction: column; padding-top: .5rem; }
.menu.abierto { display: flex; }
.menu a, .menu .enlace { color: #d0d5dd; text-decoration: none; padding: .6rem .25rem; border-bottom: 1px solid #1d2939; background: none; border-left: 0; border-right: 0; border-top: 0; font: inherit; text-align: left; cursor: pointer; width: 100%; }
.menu a.activo { color: #fff; font-weight: 600; }
.form-salir { margin: 0; }
@media (min-width: 800px) {
    .menu-boton { display: none; }
    .menu { display: flex; flex-direction: row; width: auto; padding: 0; gap: .25rem; align-items: center; }
    .menu a, .menu .enlace { border: 0; padding: .4rem .7rem; border-radius: 6px; width: auto; }
    .menu a:hover, .menu .enlace:hover { background: #1d2939; color: #fff; }
}

.contenedor { max-width: 1100px; margin: 0 auto; padding: 1rem; }

/* Tarjetas y grillas */
.tarjeta { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem; margin-bottom: 1rem; }
.grilla { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-bottom: 1rem; }
.grilla .tarjeta { margin-bottom: 0; }
@media (min-width: 600px) { .grilla.c2, .grilla.c4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grilla.c3 { grid-template-columns: repeat(3, 1fr); } .grilla.c4 { grid-template-columns: repeat(4, 1fr); } }
.dato { font-size: 1.35rem; font-weight: 700; }
.dato small { display: block; font-size: .8rem; font-weight: 500; color: var(--suave); }
.encabezado { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.encabezado h1, .encabezado h2 { margin: 0; }
.acciones { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* Botones */
.btn, button.btn { display: inline-block; background: var(--primario); color: #fff; border: 0; border-radius: 8px; padding: .55rem 1rem; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--primario-osc); }
.btn.sec { background: #fff; color: var(--texto); border: 1px solid var(--borde); }
.btn.sec:hover { background: #f2f4f7; }
.btn.peligro { background: var(--error); }
.btn.chico { padding: .3rem .65rem; font-size: .85rem; }
.en-linea { display: inline; margin: 0; }

/* Formularios */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .8rem; }
input, select, textarea { display: block; width: 100%; margin-top: .25rem; padding: .55rem .65rem; border: 1px solid var(--borde); border-radius: 8px; font: inherit; background: #fff; color: var(--texto); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primario); outline-offset: 1px; }
input[type=checkbox], input[type=radio] { display: inline; width: auto; margin: 0 .4rem 0 0; }
label.check { font-weight: 500; }
.fila-campos { display: grid; gap: 0 1rem; grid-template-columns: 1fr; }
@media (min-width: 600px) { .fila-campos.c2 { grid-template-columns: 1fr 1fr; } .fila-campos.c3 { grid-template-columns: 1fr 1fr 1fr; } }
.filtros { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; align-items: end; }
.filtros label { margin: 0; flex: 1 1 160px; }

/* Tablas */
.tabla-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .5rem .6rem; text-align: left; border-bottom: 1px solid var(--borde); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--suave); }
td.num, th.num { text-align: right; white-space: nowrap; }
tr:hover td { background: #fafbfc; }

/* Etiquetas y alertas */
.etiqueta { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: #eef0f3; color: var(--suave); }
.etiqueta.ok { background: var(--ok-bg); color: var(--ok); }
.etiqueta.mal { background: var(--error-bg); color: var(--error); }
.etiqueta.med { background: var(--aviso-bg); color: var(--aviso); }
.alerta { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid transparent; }
.alerta.ok { background: var(--ok-bg); color: var(--ok); border-color: #b7e4d2; }
.alerta.error { background: var(--error-bg); color: var(--error); border-color: #f5c2bd; }
.alerta.aviso { background: var(--aviso-bg); color: var(--aviso); border-color: #f1dc9c; }
.vacio { color: var(--suave); padding: .5rem 0; }

/* Urgencia de vencimientos */
.urg-vencido { border-left: 4px solid #7a1010; background: #fdecea; }
.urg-alta { border-left: 4px solid var(--error); background: #fff3f1; }
.urg-media { border-left: 4px solid #f79009; background: #fff8eb; }
.urg-baja { border-left: 4px solid #98a2b3; }
.lista-venc { list-style: none; padding: 0; margin: 0; }
.lista-venc li { padding: .5rem .7rem; margin-bottom: .4rem; border-radius: 6px; display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }

/* Login / instalador */
.pagina-login { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 1rem; }
.caja-login { background: #fff; border: 1px solid var(--borde); border-radius: 14px; padding: 1.5rem; width: 100%; max-width: 380px; }
.caja-login .btn { width: 100%; }

/* Impresión (guardar como PDF desde el navegador) */
.solo-impresion { display: none; }
@media print {
    body { background: #fff; }
    .barra, .acciones, .filtros, .no-imprimir, .btn { display: none !important; }
    .solo-impresion { display: block; }
    .contenedor { max-width: none; padding: 0; }
    .tarjeta { border: 0; padding: 0; }
    a { color: inherit; text-decoration: none; }
}

/* Fase 2 */
.alerta { white-space: pre-line; }
.lista-checks { display: grid; gap: .2rem 1rem; grid-template-columns: 1fr; max-height: 18rem; overflow-y: auto; padding: .5rem; border: 1px solid var(--borde); border-radius: 8px; margin: .5rem 0 1rem; }
@media (min-width: 600px) { .lista-checks { grid-template-columns: 1fr 1fr; } }
.lista-checks label { margin: 0; }
code { background: #eef0f3; padding: .05rem .3rem; border-radius: 4px; font-size: .85em; }

/* Fase 3 */
.grafico { position: relative; height: 260px; margin-bottom: 1rem; }
.texto-mal { color: var(--error); }
.campo-link { font-size: .8rem; padding: .3rem .5rem; margin: 0 0 .3rem; }
.hoja-cabecera { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 2px solid var(--texto); padding-bottom: .6rem; margin-bottom: 1rem; }
.hoja-cabecera h1 { margin: 0; }
@media print {
    @page { margin: 14mm; }
    .tarjeta { break-inside: avoid; }
    .grafico { height: 220px; }
    .menu-boton { display: none !important; }
    .hoja { border: 0 !important; }
}
