/* SistApor 2.0 — estilos */
:root {
  --fondo: #f3f4f1;
  --sup: #ffffff;
  --texto: #1d2329;
  --suave: #5d6873;
  --borde: #dde1e4;
  --prim: #1f3a5f;
  --prim-2: #2c5282;
  --acento: #c8742b;
  --ok: #2f7d4f;
  --ok-bg: #e5f3ea;
  --cerr: #8a2f2f;
  --cerr-bg: #f6e3e1;
  --aviso-bg: #fdf3df;
  --rad: 10px;
  --sombra: 0 1px 2px rgba(20, 30, 40, .06), 0 4px 14px rgba(20, 30, 40, .05);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fondo); color: var(--texto); font-size: 15px; line-height: 1.45; }
a { color: var(--prim-2); }
h1 { font-size: 1.55rem; margin: .2rem 0 .6rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .8rem; color: var(--prim); }
code { font-family: Consolas, "Cascadia Mono", monospace; font-size: .9em; background: #eef0f2; padding: .05em .35em; border-radius: 4px; }

/* Barra superior */
.barra { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1.2rem; padding: .55rem 1.2rem; background: var(--prim); color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.marca { display: flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .02em; }
.marca-ico { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--acento); color: #fff; font-weight: 800; font-size: .85rem; }
.marca-ico.grande { width: 64px; height: 64px; font-size: 1.5rem; border-radius: 16px; }
.nav { display: flex; gap: .2rem; flex: 1; flex-wrap: wrap; }
.nav a { color: #d8e2ef; text-decoration: none; padding: .4rem .7rem; border-radius: 6px; font-size: .92rem; }
.nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav a.activo { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.usuario { display: flex; align-items: center; gap: .8rem; }
.usuario a { color: #fff; text-decoration: none; text-align: right; font-size: .9rem; line-height: 1.15; }
.usuario small { display: block; color: #b9c7d8; font-size: .75rem; }
.btn-link { background: none; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 6px; padding: .3rem .65rem; cursor: pointer; font: inherit; font-size: .85rem; }
.menu-btn { display: none; background: none; border: 0; color: #fff; font-size: 1.4rem; cursor: pointer; margin-left: auto; }

.contenido { max-width: 1400px; margin: 0 auto; padding: 1.4rem 1.2rem 5rem; }
.contenido.solo { max-width: 440px; padding-top: 8vh; }
.sub-titulo { color: var(--suave); margin: -.3rem 0 1.2rem; }
.nota { color: var(--suave); font-size: .85rem; }
.titulo-fila { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; }

/* Tarjetas y columnas */
.tarjeta { background: var(--sup); border: 1px solid var(--borde); border-radius: var(--rad); padding: 1.1rem 1.2rem; box-shadow: var(--sombra); margin-bottom: 1.2rem; }
.tarjeta.angosta { max-width: 460px; }
.dos-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.2rem; align-items: start; }
.dos-col > .tarjeta { margin-bottom: 0; }
.dos-col + * { margin-top: 1.2rem; }

/* Formularios */
label { display: block; font-size: .85rem; font-weight: 600; color: var(--suave); margin-bottom: .75rem; }
label.check { display: flex; align-items: flex-start; gap: .45rem; color: var(--texto); font-weight: 500; }
label.check input { margin-top: .2rem; flex: none; }
input, select { font: inherit; color: var(--texto); }
label > input:not([type=checkbox]):not([type=radio]), label > select { display: block; width: 100%; margin-top: .25rem; padding: .5rem .6rem; border: 1px solid #c9cfd5; border-radius: 7px; background: #fff; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--prim-2); outline-offset: 1px; }
.fila-campos { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.en-linea { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: 0; }
.en-linea input, .en-linea select, .filtros input, .filtros select { padding: .42rem .55rem; border: 1px solid #c9cfd5; border-radius: 7px; background: #fff; }
.en-linea label, .filtros label { margin: 0; }
.filtros { display: flex; flex-wrap: wrap; gap: .7rem; align-items: end; margin-bottom: 1rem; }
.filtros.tarjeta label > input, .filtros.tarjeta label > select { width: auto; }
.agregar { margin-top: .8rem; padding-top: .8rem; border-top: 1px dashed var(--borde); }

.btn { display: inline-block; font: inherit; font-size: .9rem; font-weight: 600; padding: .5rem .95rem; border-radius: 7px; border: 1px solid #c3cad1; background: #fff; color: var(--texto); cursor: pointer; text-decoration: none; }
.btn:hover { background: #f1f3f5; }
.btn-primario { background: var(--prim); border-color: var(--prim); color: #fff; }
.btn-primario:hover { background: var(--prim-2); }
.btn-peligro { color: var(--cerr); border-color: #e2bcbc; }
.btn-chico { padding: .25rem .55rem; font-size: .8rem; }
.btn.ancho { width: 100%; padding: .7rem; }
.acciones { white-space: nowrap; }
.acciones form { display: inline; }

.alerta { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid transparent; }
.alerta-ok { background: var(--ok-bg); border-color: #bfdfca; }
.alerta-error { background: var(--cerr-bg); border-color: #e7c2bd; color: #5e1d1d; }
.alerta-aviso { background: var(--aviso-bg); border-color: #efd9a8; }
.clave { font-size: 1.15rem; padding: .1em .5em; background: #fff; }

.chip { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: #eceff2; color: var(--suave); text-decoration: none; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.cerrado { background: var(--cerr-bg); color: var(--cerr); }

/* Login */
.login-marca { text-align: center; margin-bottom: 1.4rem; }
.login-marca h1 { margin: .6rem 0 .1rem; }
.login-marca p { margin: 0; color: var(--suave); }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.kpi { background: var(--sup); border: 1px solid var(--borde); border-radius: var(--rad); padding: 1rem 1.1rem; box-shadow: var(--sombra); display: flex; flex-direction: column; }
.kpi-et { font-size: .8rem; font-weight: 600; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; }
.kpi-num { font-size: 2.3rem; font-weight: 700; color: var(--prim); line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-num.chico { font-size: 1.35rem; margin: .35rem 0; }
.kpi-pie { font-size: .82rem; color: var(--suave); }
.kpi-acento { border-left: 4px solid var(--acento); }

/* Tablas */
.tabla-scroll { overflow-x: auto; background: var(--sup); border: 1px solid var(--borde); border-radius: var(--rad); box-shadow: var(--sombra); }
.tabla { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tarjeta .tabla { font-size: .88rem; }
.tabla th, .tabla td { padding: .45rem .6rem; border-bottom: 1px solid #eceef0; text-align: left; }
.tabla thead th { background: #f6f7f8; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--suave); }
.tabla-num th:not(:first-child) { text-align: right; }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; }
.tabla .vacio { color: #b6bcc2; }
.tabla tr.inactivo td { color: #9aa2a9; }
.tabla tr.hoy td { background: #fbf6ee; }
.totales th, .totales td { text-align: center; }
.totales td.num { text-align: center; }
.totales .tot { background: #eef2f7; font-weight: 700; }
.nowrap { white-space: nowrap; }
.sep { border-left: 1px solid #d5dade !important; }
.hash { font-size: .78rem; }

/* Grilla de registro */
.aviso-cierre { background: var(--aviso-bg); border: 1px solid #efd9a8; border-radius: 8px; padding: .6rem .9rem; margin-bottom: 1rem; font-size: .92rem; }
.kpi.aviso-cierre { background: var(--sup); border-color: var(--borde); border-left: 4px solid var(--acento); padding: 1rem 1.1rem; margin: 0; }
.cuenta-regresiva { font-weight: 700; color: var(--acento); }
.leyenda { font-size: .82rem; color: var(--suave); display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.grilla { border-collapse: separate; border-spacing: 0; font-size: .85rem; }
.grilla th, .grilla td { border-bottom: 1px solid #eceef0; padding: 0; text-align: center; }
.grilla thead th { position: sticky; top: 0; background: #f6f7f8; z-index: 2; }
.grilla thead tr:nth-child(2) th { top: 46px; }
.grilla th.dia { padding: .4rem .5rem; font-size: .82rem; white-space: nowrap; border-left: 1px solid #d5dade; height: 46px; }
.grilla th.dia small { display: block; font-weight: 500; font-size: .7rem; }
.grilla th.dia.ok small { color: var(--ok); }
.grilla th.dia.cerrado { background: #f3eeee; color: #8d7c7c; }
.grilla th.dia.cerrado small { color: var(--cerr); }
.toggle-col { width: 100%; min-width: 30px; padding: .3rem 0; border: 0; background: none; font: inherit; font-weight: 700; color: var(--prim-2); cursor: pointer; }
.toggle-col:disabled { color: #b9b0b0; cursor: default; }
.toggle-col:not(:disabled):hover { background: #e7edf5; }
.col-persona { position: sticky; left: 0; z-index: 1; background: var(--sup); text-align: left !important; min-width: 210px; max-width: 260px; padding: .3rem .6rem !important; font-weight: 500; border-right: 1px solid #d5dade; }
thead .col-persona { z-index: 3; background: #f6f7f8; }
.col-persona span { vertical-align: middle; }
.toggle-fila { border: 0; background: none; color: var(--suave); cursor: pointer; padding: 0 .3rem 0 0; font-size: .95rem; }
.fila-grupo td { background: #eef2f7; color: var(--prim); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; text-align: left; padding: .35rem 0; }
.fila-grupo span { position: sticky; left: .6rem; padding: 0 .6rem; }
.ocultar-cerrados .cc { display: none; }
.filtros label.check { margin: 0; }
.fila-persona:hover td, .fila-persona:hover th { background: #f8fafc; }
.grilla td input { width: 18px; height: 18px; margin: .45rem .55rem; accent-color: var(--prim); cursor: pointer; }
.grilla td.bloq { background: #faf8f8; }
.grilla td.bloq input { cursor: not-allowed; opacity: .55; }
.grilla tfoot th, .grilla tfoot td { background: #eef2f7; font-weight: 700; padding: .45rem .3rem; position: sticky; bottom: 0; }
.grilla tfoot .col-persona { background: #eef2f7; }
.acciones-fijas { position: sticky; bottom: 0; display: flex; justify-content: flex-end; align-items: center; gap: 1rem; padding: .8rem 0; background: linear-gradient(transparent, var(--fondo) 35%); }
.pasos li, .tarjeta li { margin-bottom: .45rem; }

@media (max-width: 860px) {
  .barra { flex-wrap: wrap; gap: .5rem; }
  .menu-btn { display: block; }
  .nav, .usuario { display: none; width: 100%; }
  .menu-abierto .nav { display: flex; flex-direction: column; }
  .menu-abierto .usuario { display: flex; justify-content: space-between; padding: .4rem 0; }
  .contenido { padding: 1rem 1rem 5rem; }
  .fila-campos { grid-template-columns: 1fr; }
  .col-persona { min-width: 150px; max-width: 170px; font-size: .8rem; }
  .dos-col { grid-template-columns: 1fr; }
}
@media print {
  .barra, .filtros, .acciones-fijas, .btn { display: none !important; }
  body { background: #fff; }
  .tabla-scroll { border: 0; box-shadow: none; overflow: visible; }
}

/* --- v2.1: solicitudes, reportes, auditoría --- */
.badge { display: inline-block; min-width: 1.3em; padding: 0 .35em; margin-left: .2em; border-radius: 999px; background: var(--acento); color: #fff; font-size: .72rem; line-height: 1.35; text-align: center; }
.botonera { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.btn-acento { background: var(--acento); border-color: var(--acento); color: #fff; }
.btn-acento:hover { background: #b0631f; }
.chip.aviso { background: var(--aviso-bg); color: #8a5a12; }
.chip.grande { font-size: .85rem; vertical-align: middle; padding: .2rem .7rem; }
.est-pendiente { background: var(--aviso-bg); color: #8a5a12; }
.est-aprobada { background: var(--ok-bg); color: var(--ok); }
.est-rechazada { background: var(--cerr-bg); color: var(--cerr); }
.est-anulada { background: #eceff2; color: var(--suave); }
.pestanas { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1rem; border-bottom: 1px solid var(--borde); }
.pestanas a { padding: .45rem .85rem; text-decoration: none; color: var(--suave); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; font-size: .9rem; }
.pestanas a.activo { color: var(--prim); border-bottom-color: var(--prim); }
.ficha { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; gap: .45rem 1rem; margin: 0; }
.ficha dt { font-weight: 600; color: var(--suave); font-size: .85rem; }
.ficha dd { margin: 0; overflow-wrap: anywhere; }
.tarjeta.destacada { border-left: 4px solid var(--acento); }
textarea { display: block; width: 100%; margin-top: .25rem; padding: .5rem .6rem; border: 1px solid #c9cfd5; border-radius: 7px; font: inherit; resize: vertical; }
fieldset.atribuciones { border: 1px solid var(--borde); border-radius: 8px; padding: .6rem .9rem .2rem; margin: 0 0 1rem; }
fieldset.atribuciones legend { font-size: .85rem; font-weight: 600; color: var(--suave); padding: 0 .3rem; }
.resumen-cambios { background: #f6f7f8; border-radius: 8px; padding: .6rem .8rem; font-weight: 600; }
.resumen-cambios.hay { background: var(--aviso-bg); }
.grilla-sol td.centro, .grilla-sol th.centro { text-align: center; }
.grilla-sol input { width: 18px; height: 18px; accent-color: var(--prim); }
.grilla-sol td.cambiado { background: var(--aviso-bg); }
.resolver { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--borde); display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
.resolver label { flex-basis: 100%; }
.auditoria td { vertical-align: top; font-size: .84rem; }
.auditoria .detalle { max-width: 420px; }
.auditoria details summary { cursor: pointer; color: var(--suave); font-family: Consolas, monospace; font-size: .78rem; }
.auditoria pre { white-space: pre-wrap; font-size: .76rem; background: #f6f7f8; padding: .5rem; border-radius: 6px; max-height: 320px; overflow: auto; }
.alerta-fila td { background: #fdf0ee; }
.paginas { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0; }
.mt { margin-top: 1.6rem; }

.banda-pruebas { background: repeating-linear-gradient(45deg, #c8742b, #c8742b 14px, #b8661f 14px, #b8661f 28px); color: #fff; text-align: center; font-weight: 700; font-size: .8rem; letter-spacing: .06em; padding: .3rem; }

/* --- v2.2 --- */
.aviso-inactividad { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 50; max-width: min(640px, 92vw); background: #2b2b2b; color: #fff; padding: .8rem 1.1rem; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: .92rem; }
.marca-borrador { display: inline-block; margin-top: .15rem; padding: 0 .35rem; border-radius: 4px; background: var(--aviso-bg); color: #8a5a12 !important; font-weight: 700; letter-spacing: .04em; }
.marca-enviado { color: var(--ok) !important; }
.marca-vacio { color: #a0403a !important; }
.marca-feriado { color: var(--acento) !important; font-weight: 600; }
.pie { text-align: center; font-size: .78rem; color: var(--suave); padding: 0 1rem 1.5rem; }
.pie a { color: var(--suave); }
.texto-legal h2 { margin-top: 0; }
.texto-legal h3 { font-size: .95rem; margin: 1rem 0 .3rem; color: var(--prim); }
.texto-legal li { margin-bottom: .4rem; }
.centro { text-align: center; }
.aviso-datos { font-size: .82rem; color: var(--suave); background: #f6f7f8; border-radius: 8px; padding: .5rem .7rem; margin: .4rem 0 1rem; }
.estado-org { font-size: .78rem; font-weight: 600; }
.estado-org.enviado { color: var(--ok); } .estado-org.borrador { color: #8a5a12; } .estado-org.nada { color: #a0403a; }
.tabla-adicional input[type=number] { width: 5.5em; padding: .35rem; border: 1px solid #c9cfd5; border-radius: 6px; }
.tabla-adicional input[name$='[descripcion]'] { width: 100%; padding: .35rem .5rem; border: 1px solid #c9cfd5; border-radius: 6px; }
.auditoria .equipo { min-width: 150px; }
.auditoria .equipo a { font-family: Consolas, monospace; }
input.rut-malo { border-color: #c0392b !important; background: #fdf0ee; }
input.rut-ok { border-color: var(--ok) !important; }
.aviso-rut { display: block; color: #a0403a; font-size: .78rem; font-weight: 600; min-height: 0; }
