:root {
  --primario: #1f5f8b; --primario-osc: #174a6c; --acento: #2bb3a3;
  --fondo: #f3f5f8; --tarjeta: #fff; --borde: #e1e5ec; --texto: #1c2333; --muted: #667085;
  --verde: #17803d; --verde-bg: #e3f5e9; --ambar: #b45309; --ambar-bg: #fff2d9;
  --rojo: #b42318; --rojo-bg: #fdecec; --gris-bg: #eef1f5; --finde: #f6f7f9;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif; background: var(--fondo); color: var(--texto); font-size: 14.5px; }
[hidden] { display: none !important; }
h1 { font-size: 22px; margin: 0 0 4px; } h2 { font-size: 17px; margin: 0 0 12px; } h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); } .chico { font-size: 12.5px; }
a { color: var(--primario); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(160deg, #e7f0f7 0%, #f3f5f8 60%); }
.login-card { width: 100%; max-width: 380px; background: var(--tarjeta); border: 1px solid var(--borde);
  border-radius: 14px; padding: 30px 26px; box-shadow: 0 10px 30px rgba(20,40,70,.08); text-align: left; }
.logo-marca { margin-bottom: 10px; }
.logo-n { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--primario); color: #fff;
  font-weight: 800; font-size: 24px; letter-spacing: -.5px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.logo-n.chico-logo { width: 28px; height: 28px; border-radius: 8px; font-size: 15px; background: #fff; color: var(--primario); box-shadow: none; vertical-align: middle; margin-right: 4px; }
.login-cliente { color: var(--primario); font-weight: 600; margin: 0 0 4px; min-height: 1em; }
.marca-cliente { font-weight: 400; opacity: .8; margin-left: 10px; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.35); font-size: 14.5px; }
@media (max-width: 600px) { .marca-cliente { display: none; } }
.login-card label { margin-top: 12px; }

/* topbar + menú lateral */
.topbar { background: var(--primario); color: #fff; display: flex; align-items: center; gap: 14px;
  padding: 10px 20px; position: sticky; top: 0; z-index: 30; height: 54px; }
.marca { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usuario-chip { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-left: auto; white-space: nowrap; }
.usuario-chip .rol { background: rgba(255,255,255,.18); border-radius: 10px; padding: 2px 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; }
.usuario-chip .btn.link { color: #fff; }
.menu-toggle { display: none; background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; padding: 0 4px; }
.layout { display: flex; align-items: flex-start; }
#nav { width: 228px; flex: 0 0 228px; background: #fff; border-right: 1px solid var(--borde); position: sticky; top: 54px;
  height: calc(100vh - 54px); overflow-y: auto; padding: 10px 10px 30px; }
#nav .nav-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); font-weight: 700; margin: 14px 10px 4px; }
#nav a { display: flex; align-items: center; gap: 9px; color: var(--texto); text-decoration: none; padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 14px; }
#nav a .ico { width: 18px; text-align: center; color: var(--primario); opacity: .8; font-size: 13px; }
#nav a:hover { background: var(--gris-bg); }
#nav a.activo { background: #e3eef7; color: var(--primario); font-weight: 650; }
#nav .contador { background: #ffb020; color: #3b2600; border-radius: 10px; padding: 0 7px; font-size: 11.5px; margin-left: auto; font-weight: 700; }
@media (max-width: 900px) {
  .menu-toggle { display: block; }
  #nav { position: fixed; left: 0; top: 54px; z-index: 25; transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 20px rgba(0,0,0,.12); }
  #nav.abierto { transform: none; }
  .usuario-chip #usuario-nombre { display: none; }
}

.contenido { flex: 1; min-width: 0; max-width: 1240px; margin: 0 auto; padding: 22px 22px 60px; }
.tarjeta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 12px; padding: 20px; margin-bottom: 18px; }
.encabezado { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 12px; padding: 14px 16px; }
.tile .num { font-size: 28px; font-weight: 750; color: var(--primario); line-height: 1.1; }
.tile .lbl { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.tile.destacado { background: var(--primario); border-color: var(--primario); }
.tile.destacado .num, .tile.destacado .lbl { color: #fff; }

/* formularios */
label { display: block; font-size: 13px; font-weight: 600; color: #344054; }
input, select, textarea { width: 100%; padding: 9px 10px; border: 1px solid #cfd6e0; border-radius: 7px; font: inherit; margin-top: 4px; background: #fff; color: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc3e0; border-color: var(--primario); }
textarea { min-height: 70px; resize: vertical; }
.fila { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 12px; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.btn { border: 0; border-radius: 7px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; background: var(--gris-bg); color: var(--texto); }
.btn:hover { filter: brightness(.96); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primario { background: var(--primario); color: #fff; }
.btn.primario:hover { background: var(--primario-osc); }
.btn.verde { background: var(--verde); color: #fff; }
.btn.rojo { background: var(--rojo); color: #fff; }
.btn.chico { padding: 5px 10px; font-size: 13px; }
.btn.link { background: none; padding: 4px 6px; color: var(--primario); text-decoration: underline; }
.btn.ancho { width: 100%; margin-top: 18px; padding: 11px; }

.alerta { padding: 10px 14px; border-radius: 8px; margin: 10px 0; font-size: 13.5px; }
.alerta.error { background: var(--rojo-bg); color: var(--rojo); }
.alerta.ok { background: var(--verde-bg); color: var(--verde); }
.alerta.aviso { background: var(--ambar-bg); color: var(--ambar); }
.alerta ul { margin: 4px 0 0; padding-left: 18px; }

/* tablas */
.tabla-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--borde); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--borde); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.inactivo td { opacity: .5; }
.vacio { text-align: center; color: var(--muted); padding: 26px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.badge.pendiente { background: var(--ambar-bg); color: var(--ambar); }
.badge.aprobada { background: var(--verde-bg); color: var(--verde); }
.badge.rechazada { background: var(--rojo-bg); color: var(--rojo); }
.badge.cancelada { background: var(--gris-bg); color: var(--muted); }
.badge.rrhh { background: #e8e3fb; color: #5b3fc4; } .badge.supervisor { background: #dff0fb; color: #1f5f8b; } .badge.empleado { background: var(--gris-bg); color: #475467; }

/* aprobaciones */
.solicitud { border: 1px solid var(--borde); border-left: 4px solid #ffb020; border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; background: #fff; }
.solicitud .cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.solicitud .nombre { font-weight: 700; font-size: 15.5px; }

/* calendario */
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav .mes { font-weight: 700; font-size: 16px; min-width: 150px; text-align: center; }
.cal { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.cal th, .cal td { padding: 0; border-bottom: 1px solid var(--borde); text-align: center; }
.cal th { text-transform: none; letter-spacing: 0; font-weight: 600; padding: 4px 0; min-width: 26px; }
.cal th.finde, .cal td.finde { background: var(--finde); }
.cal th.hoy { color: var(--primario); text-decoration: underline; }
.cal .nom { text-align: left; padding: 5px 10px 5px 0; white-space: nowrap; position: sticky; left: 0; background: #fff; z-index: 1; font-size: 13px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.cal td .c { height: 22px; margin: 2px 1px; border-radius: 4px; }
.cal td .c.aprobada { background: #36a96b; }
.cal td .c.pendiente { background: repeating-linear-gradient(45deg, #f4b740, #f4b740 4px, #fbd27a 4px, #fbd27a 8px); }
.cal tr.grupo-fila td { font-weight: 700; font-size: 11.5px; }
.cal tr.grupo-fila .nom { color: var(--primario); }
.cal td.ocup-lleno { background: var(--rojo-bg); color: var(--rojo); }
.cal td.ocup-parcial { background: var(--ambar-bg); color: var(--ambar); }
.cal tr.separador td { border-bottom: 2px solid var(--borde); padding-top: 10px; }
.leyenda { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 12px; }
.leyenda i { display: inline-block; width: 14px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 5px; }

/* matrices */
.matriz { border-collapse: separate; border-spacing: 0; font-size: 13px; width: auto; }
.matriz th, .matriz td { border-bottom: 1px solid var(--borde); border-right: 1px solid var(--borde); text-align: center; padding: 4px; }
.matriz th { background: #fafbfc; text-transform: none; letter-spacing: 0; color: var(--texto); font-size: 12.5px; vertical-align: bottom; }
.matriz th.vert { height: 150px; width: 34px; min-width: 34px; padding: 6px 2px; }
.matriz th.vert span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; display: inline-block; }
.matriz .nom { text-align: left; white-space: nowrap; position: sticky; left: 0; background: #fff; z-index: 1; padding: 4px 12px 4px 6px; font-weight: 600; }
.matriz td.diag { background: #e9ecf1; }
.matriz td.marcado { background: #fde3e3; }
.matriz td.miembro { background: #dff0fb; }
.matriz input[type=checkbox] { width: 17px; height: 17px; margin: 0; cursor: pointer; accent-color: var(--primario); }
.matriz tbody tr:hover td { filter: brightness(.97); }
.matriz .grupo-head { min-width: 120px; vertical-align: top; }
.matriz .grupo-head .gnom { font-weight: 700; margin-bottom: 4px; }
.matriz .grupo-head input { width: 60px; padding: 4px 6px; text-align: center; margin: 0; }
.matriz .grupo-head .cnt { font-size: 11.5px; color: var(--muted); font-weight: 400; }

/* modal / toast */
.modal-fondo { position: fixed; inset: 0; background: rgba(15,25,40,.45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 14px; padding: 24px; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; position: relative; }
.modal-cerrar { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 24px; cursor: pointer; color: var(--muted); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1c2333; color: #fff; padding: 11px 20px; border-radius: 9px; z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 90vw; }
.toast.error { background: var(--rojo); }
.clave-temp { font-family: ui-monospace, Consolas, monospace; font-size: 18px; background: var(--gris-bg); padding: 8px 12px; border-radius: 6px; display: inline-block; user-select: all; }
code { background: var(--gris-bg); padding: 1px 5px; border-radius: 4px; }

/* carga desde Excel */
.pasos { padding-left: 20px; margin: 8px 0 14px; } .pasos li { margin-bottom: 8px; }
.zona-archivo { display: block; border: 2px dashed #b9c4d3; border-radius: 10px; padding: 22px; text-align: center; cursor: pointer; color: var(--primario); font-weight: 600; background: #f8fafc; }
.zona-archivo:hover, .zona-archivo.sobre { background: #eaf3fa; border-color: var(--primario); }

/* asistencia */
.periodo { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.periodo input[type=date] { width: auto; margin: 0; padding: 5px 8px; }
.barra-acciones { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.barra-acciones select, .barra-acciones input:not([type=checkbox]) { width: auto; margin: 0; min-width: 160px; }
.barra-acciones .periodo { margin: 0; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; margin: 6px 0; cursor: pointer; }
.chk input { width: auto; margin: 0; accent-color: var(--primario); }
.cols-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; }
.cols-2 > .tarjeta { margin-bottom: 0; } .cols-2 { margin-bottom: 18px; }
@media (max-width: 520px) { .cols-2 { grid-template-columns: 1fr; } }
.tile-alerta .num { color: var(--rojo); }
.chico-num { font-size: 20px !important; }
.texto-rojo { color: var(--rojo); font-weight: 600; } .texto-aviso { color: var(--ambar); }
tr.clic { cursor: pointer; } tr.clic:hover td { background: #f5f9fc; }
tfoot td { font-weight: 700; border-top: 2px solid var(--borde); }
.borde-aviso { border-left: 4px solid #ffb020; }
.tabla-dias td { padding: 6px 8px; } tr.finde-fila td { background: var(--finde); }
details.reglas { background: #fff; border: 1px solid var(--borde); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
details.reglas summary { cursor: pointer; font-weight: 600; color: var(--primario); }
details.reglas ul { margin: 8px 0 0; padding-left: 18px; } details.reglas li { margin-bottom: 4px; }
table.muestra td, table.muestra th { font-size: 12px; padding: 4px 8px; white-space: nowrap; text-transform: none; letter-spacing: 0; }
.barras { display: flex; flex-direction: column; gap: 6px; }
.barra-fila { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.barra-lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra-pista { height: 14px; background: transparent; }
.barra { display: block; height: 14px; background: var(--primario); border-radius: 0 4px 4px 0; }
.barra-fila:hover .barra { background: var(--primario-osc); }
.barra-val { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* turnos del empleado, cambios y legajo */
h3.sec-form { margin: 16px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--primario); border-bottom: 1px solid var(--borde); padding-bottom: 4px; }
h3.sec-form:first-of-type { margin-top: 4px; }
.opciones-modalidad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
@media (max-width: 560px) { .opciones-modalidad { grid-template-columns: 1fr; } }
.op-mod { display: block; cursor: pointer; margin: 0; }
.op-mod input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.op-mod span { display: block; border: 2px solid var(--borde); border-radius: 10px; padding: 10px 12px; background: #fff; }
.op-mod span strong { display: block; font-size: 15px; color: var(--texto); }
.op-mod span small { color: var(--muted); font-weight: 400; }
.op-mod input:checked + span { border-color: var(--primario); background: #eef5fb; }
.op-mod input:focus-visible + span { outline: 2px solid #9cc3e0; }
tr.fila-hoy td { background: #eef5fb; }
.datos { display: grid; gap: 10px; }
.datos-fila { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.dato { display: flex; flex-direction: column; gap: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--borde); }
.dato:last-child { border-bottom: 0; }
.dato > span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.dato > strong { font-weight: 600; }
@media print { .topbar, #nav, .modal-cerrar, .acciones { display: none !important; } .modal-fondo { position: static; background: none; } .modal { max-height: none; box-shadow: none; } }
@media (max-width: 520px) {
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile { padding: 10px 12px; } .tile .num { font-size: 22px; }
  .tabla-dias td { white-space: nowrap; font-size: 13px; }
  .encabezado .btn.primario { width: 100%; }
}

/* Planificación de guardias */
.plan-wrap { max-height: 70vh; overflow: auto; }
.plan-grid { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.plan-grid th, .plan-grid td { padding: 3px 1px; text-align: center; border-bottom: 1px solid var(--borde); min-width: 31px; }
.plan-grid thead th { position: sticky; top: 0; background: #fff; z-index: 2; font-weight: 600; line-height: 1.15; }
.plan-grid .pg-nom { position: sticky; left: 0; background: #fff; z-index: 1; text-align: left; min-width: 170px; max-width: 220px; padding-right: 8px; }
.plan-grid thead .pg-nom { z-index: 3; }
.plan-grid .pg-finde { background: var(--finde); }
.plan-grid .pg-fer { color: var(--rojo); }
.plan-grid .pg-tot { font-weight: 600; min-width: 46px; }
.pg-falta { color: var(--rojo); background: var(--rojo-bg); } .pg-sobra { color: var(--ambar); background: var(--ambar-bg); } .pg-ok { color: var(--verde); background: var(--verde-bg); }
.pc { line-height: 1.1; white-space: nowrap; }
td.pc[data-u] { cursor: pointer; }
td.pc[data-u]:hover { outline: 2px solid var(--primario); outline-offset: -2px; }
.pc b { display: block; font-size: 11px; font-weight: 700; }
.pc-plan { background: #dcebf7; color: var(--primario-osc); }
.pc-turno { background: #f2f6f9; color: var(--muted); }
.pc-cambio { background: #efe6fa; color: #5b2b94; }
.pc-cont { color: var(--primario); background: #eef5fb; }
.pc-franco { background: var(--gris-bg); color: var(--muted); font-weight: 700; }
.pc-vac { background: var(--verde-bg); color: var(--verde); font-weight: 700; }
.pc-hoy { box-shadow: inset 0 -3px 0 var(--acento); }
.leyenda-plan .pc { display: inline-block; padding: 1px 6px; border-radius: 4px; margin-right: 2px; }
.tabla-bloques td, .tabla-bloques th { padding: 4px; vertical-align: middle; }
.tabla-bloques select, .tabla-bloques input { padding: 5px; }
