:root {
  --bg: #f4f5f7; --panel: #ffffff; --borde: #d9dde3; --texto: #1b2430; --suave: #647084;
  --acento: #1f4e79; --acento-t: #ffffff; --ok: #1e7b45; --error: #b3261e; --aviso: #9a6200;
  --i1: #cfe2f7; --i2: #d5ecc8; --i3: #ffe9a8; --ap: #f7c9ae; --ot: #dcd3f0; --cambio: #c00000;
  --am: #fff200; --am-t: #000; --pm: #000080; --pm-t: #fff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c; --panel: #1b212a; --borde: #2f3845; --texto: #e6e9ee; --suave: #96a1b3;
    --acento: #5b9bd5; --acento-t: #0c1116; --ok: #5fcf8c; --error: #ff8a80; --aviso: #f2b84b;
    --i1: #254a73; --i2: #2f5a2a; --i3: #6b5613; --ap: #7a4526; --ot: #4a3d73; --cambio: #ff8a80;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--texto); font: 14px/1.4 system-ui, 'Segoe UI', Roboto, sans-serif; }
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--borde); background: var(--panel); border-radius: 6px; padding: 6px 12px; }
button:hover { border-color: var(--acento); }
button.pri { background: var(--acento); color: var(--acento-t); border-color: var(--acento); font-weight: 600; }
button.pel { color: var(--error); }
button:disabled { opacity: .45; cursor: not-allowed; }
select, input, textarea { border: 1px solid var(--borde); background: var(--panel); border-radius: 6px; padding: 6px 8px; }
h1 { font-size: 18px; margin: 0; }
h2 { font-size: 15px; margin: 18px 0 8px; }
.suave { color: var(--suave); }

header.barra { position: sticky; top: 0; z-index: 20; background: var(--panel); border-bottom: 1px solid var(--borde); padding: 10px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
header.barra .quien { margin-left: auto; display: flex; gap: 10px; align-items: center; }
nav.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
nav.tabs button { border: none; background: none; padding: 6px 10px; border-radius: 6px; color: var(--suave); }
nav.tabs button.act { background: var(--acento); color: var(--acento-t); font-weight: 600; }
nav.tabs.mod button { font-weight: 600; }
nav.tabs.sub { padding-left: 10px; border-left: 1px solid var(--borde); }
nav.tabs.sub button.act { background: color-mix(in srgb, var(--acento) 22%, transparent); color: var(--texto); }
ol.orden { list-style: none; margin: 0; padding: 0; }
ol.orden li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--borde); }
ol.orden li > b { width: 86px; }
ol.orden li select { min-width: 0; flex: 0 1 240px; }
ol.orden li.cambio select { outline: 2px solid var(--cambio); }
ol.orden li .bots { display: flex; gap: 4px; }
ol.orden li .bots button { padding: 2px 8px; }
main { padding: 16px; max-width: 1500px; margin: 0 auto; }
.fila { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.fila .esp { flex: 1; }
.panel { background: var(--panel); border: 1px solid var(--borde); border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.seg { display: inline-flex; border: 1px solid var(--borde); border-radius: 6px; overflow: hidden; }
.seg button { border: none; border-radius: 0; }
.seg button.act { background: var(--acento); color: var(--acento-t); }
.dias button { position: relative; min-width: 62px; }
.dias button.act { background: var(--acento); color: var(--acento-t); border-color: var(--acento); }
.dias button .pt { position: absolute; top: 2px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--error); }
.dias button.fest { border-style: dashed; }

/* login */
.login { max-width: 340px; margin: 12vh auto; }
.login label { display: block; margin: 12px 0 4px; color: var(--suave); }
.login select, .login input, .login button { width: 100%; }
.login button { margin-top: 16px; }
.err { color: var(--error); min-height: 20px; margin-top: 8px; }

/* tablas genericas */
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid var(--borde); padding: 5px 8px; text-align: left; vertical-align: top; }
th { background: var(--bg); font-weight: 600; font-size: 12px; }
td.num, th.num { text-align: center; }
tr.yo td { outline: 2px solid var(--acento); outline-offset: -2px; font-weight: 600; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.chip.PRESENTE { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.chip.IRREGULARIDAD, .chip.AUSENTE { background: color-mix(in srgb, var(--error) 18%, transparent); color: var(--error); }
.chip.INCOMPLETO { background: color-mix(in srgb, var(--aviso) 22%, transparent); color: var(--aviso); }
.tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 12px; }
.tarjeta { background: var(--panel); border: 1px solid var(--borde); border-radius: 10px; padding: 12px; text-align: center; }
.tarjeta b { display: block; font-size: 24px; }
.tarjeta span { color: var(--suave); font-size: 12px; }

/* editor */
table.grid { width: auto; user-select: none; touch-action: pan-x; }
table.grid th, table.grid td { padding: 0; text-align: center; height: 24px; min-width: 58px; font-size: 12px; position: relative; }
table.grid th.nom { font-size: 11px; line-height: 1.15; padding: 4px 2px; height: 40px; max-width: 70px; white-space: normal; }
table.grid td.hora, table.grid th.hora { min-width: 74px; background: var(--bg); position: sticky; left: 0; z-index: 2; }
table.grid td.cnt { min-width: 30px; color: var(--suave); background: var(--bg); }
table.grid td.cnt.mal { background: var(--error); color: #fff; font-weight: 700; }
table.grid td.cnt.reg { background: color-mix(in srgb, var(--aviso) 35%, transparent); color: var(--texto); }
table.grid tr.sep td { border-top: 2px solid var(--suave); }
td.c { cursor: default; }
td.c.v1 { background: var(--i1); } td.c.v2 { background: var(--i2); } td.c.v3 { background: var(--i3); }
td.c.vap { background: var(--ap); } td.c.vot { background: var(--ot); font-size: 10px; }
td.c.lleno { cursor: grab; font-weight: 600; }
td.c.cam { color: var(--cambio); box-shadow: inset 0 0 0 2px var(--cambio); }
td.c.qui { background: repeating-linear-gradient(45deg, transparent 0 5px, color-mix(in srgb, var(--suave) 30%, transparent) 5px 6px); }
td.c .hd { display: none; position: absolute; left: 50%; transform: translateX(-50%); width: 26px; height: 13px; line-height: 12px; font-size: 10px; border-radius: 7px;
  background: var(--acento); color: var(--acento-t); cursor: ns-resize; z-index: 3; }
td.c .hd.arr { top: -7px; } td.c .hd.aba { bottom: -7px; }
td.c.hov .hd { display: block; }
td.c .qx, td.c .mas { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; line-height: 17px; border-radius: 50%; font-size: 14px; font-weight: 700; z-index: 4; cursor: pointer; color: #fff; }
td.c.fant { background: color-mix(in srgb, var(--ok) 28%, transparent); box-shadow: inset 2px 0 0 var(--ok), inset -2px 0 0 var(--ok); cursor: pointer; }
td.c .qx { background: var(--error); }
td.c .mas { background: var(--ok); right: 50%; transform: translateX(50%); }
table.grid tfoot td { font-weight: 600; background: var(--bg); }
.arrastrando td.c.lleno { cursor: grabbing; }
.leyenda span { display: inline-block; padding: 1px 8px; border-radius: 4px; margin-right: 6px; font-size: 12px; }
ul.val { margin: 0; padding-left: 18px; }
ul.val li.n-error { color: var(--error); } ul.val li.n-aviso { color: var(--aviso); }

/* resumen tipo PDF */
table.tabla td { font-size: 13px; vertical-align: middle; }
table.tabla tr.filtros th { padding: 3px 4px; font-weight: 400; }
table.tabla th.sel, table.tabla td.sel { width: 28px; text-align: center; }
table.tabla td.sel input, table.tabla th.sel input { width: 16px; height: 16px; cursor: pointer; }
table.tabla select.filtro { width: 100%; min-width: 80px; font-size: 12px; padding: 2px 4px; }
.tabla-pen { overflow: visible; }
a.boton { display: inline-block; border: 1px solid var(--borde); background: var(--panel); color: var(--texto); border-radius: 6px; padding: 6px 12px; text-decoration: none; }
a.boton:hover { border-color: var(--suave); }
details.multifiltro { position: relative; font-size: 12px; min-width: 90px; }
details.multifiltro > summary { list-style: none; cursor: pointer; border: 1px solid var(--borde); border-radius: 6px; padding: 3px 18px 3px 6px;
  background: var(--bg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
details.multifiltro > summary::-webkit-details-marker { display: none; }
details.multifiltro > summary::after { content: '▾'; position: absolute; right: 6px; top: 2px; color: var(--suave); }
details.multifiltro.activo > summary { border-color: var(--aviso); color: var(--aviso); font-weight: 600; }
details.multifiltro .lista { position: absolute; z-index: 20; top: 100%; left: 0; margin-top: 2px; background: var(--panel, var(--bg));
  border: 1px solid var(--borde); border-radius: 8px; padding: 6px 8px; max-height: 260px; overflow: auto; min-width: 180px;
  box-shadow: 0 6px 18px rgba(0,0,0,.35); }
details.multifiltro .f-busca { width: 100%; box-sizing: border-box; font-size: 12px; padding: 4px 6px; margin-bottom: 4px; }
details.multifiltro .lista label[hidden] { display: none; }
details.multifiltro .lista label { display: flex; gap: 6px; align-items: center; padding: 3px 0; white-space: nowrap; font-weight: 400; cursor: pointer; }
.desc-linea { flex-basis: 100%; width: 100%; display: block; font-size: 12px; color: var(--suave); margin-top: 2px; }
.desc-linea b { color: var(--texto); }
.desc-linea.mal b { color: var(--error); }
.desc-linea b.sim { color: var(--aviso); }
.desc-linea.cambia { border-left: 3px solid var(--aviso); padding-left: 6px; }
table.tabla tr.desest td { color: var(--suave); background: color-mix(in srgb, var(--i1) 18%, transparent); }
table.res td { text-align: center; font-size: 12px; min-width: 120px; }
table.res td.am { background: var(--am); color: var(--am-t); }
table.res td.pm { background: var(--pm); color: var(--pm-t); }
table.res td.aus { font-weight: 700; color: var(--aviso); }
table.res th.yo, table.res td.yo { outline: 3px solid var(--error); outline-offset: -3px; }

/* menu y modal */
.menu { position: fixed; z-index: 50; background: var(--panel); border: 1px solid var(--borde); border-radius: 10px; padding: 12px; width: 300px; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.menu h3 { margin: 0 0 2px; font-size: 14px; }
.menu .grp { margin-top: 10px; }
.menu .grp > span { display: block; font-size: 11px; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.menu .bots { display: flex; flex-wrap: wrap; gap: 4px; }
.menu .bots button { padding: 4px 8px; font-size: 12px; }
.menu select { width: 100%; }
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden], .menu[hidden], .aviso[hidden] { display: none; }
.modal .caja { background: var(--panel); border-radius: 12px; padding: 18px; width: min(680px, 100%); max-height: 90vh; overflow: auto; }
.modal textarea, .modal select { width: 100%; }
.aviso { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 70; background: var(--texto); color: var(--bg); padding: 10px 16px; border-radius: 8px; max-width: 90vw; }
textarea.msg { width: 100%; min-height: 220px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

@media print {
  header.barra, .noimp, .menu, .modal, .aviso { display: none !important; }
  body { background: #fff; color: #000; }
  main { padding: 0; max-width: none; }
  .panel { border: none; padding: 0; }
  table.res td, table.res th { font-size: 9px; padding: 3px; min-width: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: landscape; margin: 8mm; }
}
