/* ============================================================
   ClarIo Policía — App web (P1 Personal)
   Sistema de marca por organismo + temas claro/noche + 3 skins
   (basado en el prototipo de diseño aprobado, A13/A14)
   ============================================================ */

:root {
  --brand-primary: #1e5eff;
  --brand-primary-soft: rgba(30, 94, 255, .14);
  --brand-secondary: #0a2a6b;
  --brand-accent: #f0a500;

  --bg: #f2f4f8;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --border: #dde2ea;
  --text: #182133;
  --text-soft: #5a6577;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 4px 14px rgba(16,24,40,.06);
  --shadow-lg: 0 8px 30px rgba(16,24,40,.14);

  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;

  /* Estructura de tablas/hojas (calco Excel). Antes caían siempre al fallback
     claro porque nadie las definía: en modo noche las hojas brillaban. */
  --head: #f2f4f8;
  --chip: #eef1f7;
  --card: #ffffff;
}

[data-theme="dark"] {
  --bg: #0d1420;
  --surface: #151f30;
  --surface-2: #1b2740;
  --border: #263450;
  --text: #e8edf6;
  --text-soft: #93a1b8;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.5);
  --head: #232f4a;
  --chip: #20293f;
  --card: #151f30;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}
button { font: inherit; cursor: pointer; }
h1,h2,h3,h4 { margin: 0; font-weight: 650; }
h3 svg { width: 17px; height: 17px; flex: 0 0 17px; }
a { color: var(--brand-primary); }
.btn svg { width: 15px; height: 15px; vertical-align: -2px; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 14px;
  border-bottom: 1px solid var(--border); margin-bottom: 10px;
}
.brand img {
  width: 40px; height: 40px; border-radius: 10px; object-fit: contain;
  background: #fff; border: 1px solid rgba(0,0,0,.14); padding: 2px;
}
.brand-name { font-weight: 700; font-size: 13.5px; line-height: 1.2; }
.brand-sub { font-size: 11px; color: var(--text-soft); }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 9px;
  color: var(--text-soft); text-decoration: none; font-weight: 550;
  border: 0; background: transparent; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--brand-primary-soft); color: var(--brand-primary); }
.nav-item .ico { width: 18px; height: 18px; flex: 0 0 18px; }
.nav-item .ico svg { width: 100%; height: 100%; }
.nav-item.disabled { opacity: .55; cursor: default; }
.nav-sep { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-soft); padding: 12px 10px 4px; }
/* Grupo plegable del menú lateral: Cuadrantes ▸ Generar cuadrante nuevo.
   Fuera del módulo ocupa una sola línea; dentro se despliega solo. */
.nav-caret { margin-left: auto; font-size: 10px; color: var(--text-soft); transition: transform .15s ease; }
.nav-group.open .nav-caret { transform: rotate(90deg); }
.nav-sub { display: none; padding-left: 15px; }
.nav-group.open .nav-sub { display: block; }
.nav-sub-item { font-size: 13px; padding: 6px 10px; font-weight: 500; }
.nav-dot {
  width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%;
  background: #e8a100; box-shadow: 0 0 0 3px rgba(232, 161, 0, .22);
}
[data-theme="dark"] .nav-dot { background: #f5b73e; }

.main { flex: 1; padding: 20px 24px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.topbar h1 { font-size: 20px; }
.topbar .crumb { color: var(--text-soft); font-size: 12.5px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* Pantallas estrechas: la barra superior se envuelve y el avatar nunca se corta */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 8px; }
  .topbar-right { margin-left: 0; flex-wrap: wrap; row-gap: 6px; }
  .topbar .chip { display: none; }  /* la identidad sigue visible en el avatar */
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }

.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 7px 14px; border-radius: 9px; font-weight: 600; font-size: 13px;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); background: var(--brand-primary); }
.btn-danger { background: var(--danger); border-color: var(--danger); color:#fff; }
.btn-ghost-danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}
.card h3 { font-size: 14.5px; margin-bottom: 10px; display:flex; align-items:center; gap:8px; }
.muted { color: var(--text-soft); }
.small { font-size: 12px; }
.spacer { flex: 1; }

/* ---------- Formularios ---------- */
.field { text-align: left; margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 650; margin-bottom: 4px; color: var(--text-soft); }
.field label .req { color: var(--danger); }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--brand-primary-soft); border-color: var(--brand-primary);
}
.field input[type=checkbox] { width: auto; }
/* Obligatorios sin rellenar: se marcan en rojo al intentar guardar */
.field input.falta, .field select.falta {
  border-color: var(--danger) !important;
  outline: 2px solid rgba(220,38,38,.30);
  background: rgba(220,38,38,.05);
}
.field:has(input.falta) label, .field:has(select.falta) label { color: var(--danger); }
/* Campo de contraseña con ojo para mostrar/ocultar */
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 40px; }
.pass-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-soft);
  display: inline-flex; align-items: center; justify-content: center;
}
.pass-eye:hover { background: var(--surface); color: var(--brand-primary); }
.pass-eye svg { width: 17px; height: 17px; }
.field-check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-weight: 600; font-size: 13px; }
.frow { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
.frow.c3 { grid-template-columns: repeat(3, 1fr); }
.frow.c4 { grid-template-columns: repeat(4, 1fr); }
.frow.c5 { grid-template-columns: repeat(5, 1fr); }

/* ---------- Tablas de datos ---------- */
.data-table { border-collapse: collapse; width: 100%; }
.data-table th, .data-table td {
  border-bottom: 1px solid var(--border);
  padding: 9px 10px; text-align: left; font-size: 13px;
}
.data-table th {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-soft); font-weight: 700; background: var(--surface-2);
  position: sticky; top: 0;
}
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table td.num { font-weight: 700; }
.placa-tag {
  display: inline-block; min-width: 44px; text-align: center;
  font-family: "Courier New", monospace; font-weight: 700; font-size: 12.5px;
  background: var(--brand-primary-soft); color: var(--brand-primary);
  border-radius: 6px; padding: 2px 8px;
}

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .search {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 220px; max-width: 420px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 7px 12px;
}
.toolbar .search input { border: 0; background: transparent; color: var(--text); font: inherit; width: 100%; outline: none; }
.toolbar .search svg { width: 15px; height: 15px; color: var(--text-soft); flex: 0 0 15px; }
.toolbar select {
  padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px;
}

/* ---------- Pestañas del expediente (estilo navegador, tipo Chrome) ---------- */
.tabs {
  display: flex; align-items: flex-end; gap: 2px; flex-wrap: wrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
  padding: 7px 10px 0;
  margin-bottom: 14px;
}
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid transparent; border-bottom: none;
  background: transparent; color: var(--text-soft);
  padding: 8px 14px 10px;
  font-weight: 600; font-size: 12.5px;
  border-radius: 10px 10px 0 0;
  max-width: 215px; min-width: 0;
  white-space: nowrap; overflow: hidden;
  position: relative;
}
.tab .tab-ico { width: 14px; height: 14px; flex: 0 0 14px; display: inline-flex; }
.tab .tab-ico svg { width: 100%; height: 100%; }
.tab .tab-txt { overflow: hidden; text-overflow: ellipsis; }
/* separador fino entre pestañas inactivas, como en Chrome */
.tab + .tab::before {
  content: ""; position: absolute; left: -2px; top: 50%; transform: translateY(-50%);
  width: 1px; height: 16px; background: var(--border);
}
.tab:hover { background: rgba(128,128,128,.14); color: var(--text); }
.tab.active {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
  box-shadow: 0 -3px 8px rgba(0,0,0,.10);
  z-index: 2;
}
.tab.active::before { display: none; }
/* la pestaña activa "se une" al contenido: tapa la línea inferior de la barra */
.tab.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--bg);
}
.tab.locked { opacity: .65; }
.tab .lock-ico { width: 12px; height: 12px; }

/* ---------- Panel de control ---------- */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px;
}
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow); padding: 16px;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-label {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-soft);
}
.kpi-label svg { width: 15px; height: 15px; }
.kpi-num { font-size: 30px; font-weight: 800; margin-top: 8px; line-height: 1.1; }
.kpi-sub { color: var(--text-soft); font-size: 12px; margin-top: 4px; }

.panel-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
.turnos-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.turno {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px; min-height: 74px;
}

/* Trazabilidad: línea de actividad */
.act-row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.act-row:last-child { border-bottom: none; }
.act-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px;
  background: var(--brand-primary); align-self: center;
}
.act-txt { flex: 1; min-width: 0; }
.act-when { font-size: 11.5px; white-space: nowrap; }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .panel-grid { grid-template-columns: 1fr; }
}

/* ---------- Combo municipio (buscador de festivos) ---------- */
.mun-combo { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- Leyenda del cuadrante anual ---------- */
.pa-leyenda { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; padding: 6px 10px; border: 1px dashed var(--border); border-radius: 8px; font-size: 12px; }
.pa-leyenda .pa-tl { display: inline-block; min-width: 14px; text-align: center; font-weight: 700; }

/* ---------- Modo tutorial (interruptor «Ayuda») ---------- */
/* Interruptor tipo palanca */
.switch-wrap {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 11px; padding: 4px 10px; cursor: pointer; user-select: none;
}
.switch-label { font-size: 12px; font-weight: 700; color: var(--text-soft); }
.switch { position: relative; width: 36px; height: 20px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--border); transition: background .18s ease;
}
.switch .slider::before {
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  left: 3px; top: 3px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35);
  transition: transform .18s ease;
}
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::before { transform: translateX(16px); }

/* Banner emergente al entrar en cada pantalla (solo modo tutorial) */
.ayuda-banner {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--brand-primary-soft);
  border: 1px solid var(--brand-primary);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 16px;
}
.ayuda-banner-ico { width: 20px; height: 20px; color: var(--brand-primary); flex: 0 0 20px; margin-top: 2px; }
.ayuda-banner-ico svg { width: 100%; height: 100%; }
.ayuda-banner-txt { flex: 1; min-width: 0; }
.ayuda-banner-txt b { display: block; font-size: 13px; margin-bottom: 3px; color: var(--text); }
.ayuda-banner-txt p { margin: 0; font-size: 12.5px; color: var(--text-soft); line-height: 1.5; }
.ayuda-banner .btn { flex: 0 0 auto; }

/* Globo de explicación que sigue al ratón */
.ayuda-globo {
  position: fixed; z-index: 300; width: 320px; max-width: calc(100vw - 16px);
  background: var(--surface); border: 1px solid var(--brand-primary);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 12px 14px; display: none; pointer-events: none;
}
.ayuda-globo.show { display: block; }
.ayuda-globo b { display: block; font-size: 13px; margin-bottom: 4px; color: var(--text); }
.ayuda-globo p { margin: 0; font-size: 12.5px; color: var(--text-soft); line-height: 1.5; }
.ayuda-globo::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px;
  transform: translateX(-50%) rotate(45deg);
  background: var(--surface); border-right: 1px solid var(--brand-primary);
  border-bottom: 1px solid var(--brand-primary);
}

/* Resaltado de los elementos explicables en modo tutorial */
body.ayuda-on [data-ayuda]:hover {
  outline: 2px dashed var(--brand-primary);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Insignias / estados ---------- */
.badge { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .4px; }
.badge.ok { background: rgba(22,163,74,.15); color: var(--ok); }
.badge.warn { background: rgba(217,119,6,.15); color: var(--warn); }
.badge.info { background: var(--brand-primary-soft); color: var(--brand-primary); }
.badge.danger { background: rgba(220,38,38,.15); color: var(--danger); }
.badge.off { background: var(--surface-2); color: var(--text-soft); }

/* Indicador «cambios sin guardar» de la ficha del agente: etiqueta en la
   cabecera + botón Guardar con halo pulsante ámbar mientras haya ediciones
   pendientes. Visible en todo momento, sin necesidad de intentar salir. */
.ficha-ind-sucia { animation: ficha-ind-latido 1.6s ease-in-out infinite; }
@keyframes ficha-ind-latido { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.btn-pulso { animation: btn-pulso-halo 1.6s ease-in-out infinite; }
@keyframes btn-pulso-halo {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217,119,6,.55); }
  50% { box-shadow: 0 0 0 7px rgba(217,119,6,0); }
}

/* Clave temporal mostrada una sola vez (envío de acceso al agente) */
.acceso-clave {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 26px; font-weight: 800; letter-spacing: 3px;
  text-align: center; padding: 14px; margin: 12px 0;
  background: var(--surface-2); border: 1px dashed var(--warn, #d97706);
  border-radius: 10px; user-select: all;
}

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand-primary); color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: default;
}

/* ---------- Ordenación por cabeceras de columna (Personal) ---------- */
th[data-ord] { cursor: pointer; user-select: none; white-space: nowrap; }
th[data-ord]:hover { color: var(--accent, #2f6bff); }
th[data-ord] .sort-flecha { display: inline-block; margin-left: 4px; font-size: 10px; opacity: .85; }

/* ---------- Barra de acciones en lote (selección múltiple) ---------- */
.sel-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; padding: 8px 12px; border: 1px solid var(--accent, #2f6bff); border-radius: 10px; background: var(--surface-2); }
.sel-bar b { color: var(--accent, #2f6bff); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 30px; }
.login-card { width: 420px; max-width: 100%; padding: 34px; text-align: center; }
.login-card .big-logo { width: 92px; height: 92px; margin: 0 auto 12px; }
.login-card .big-logo img { width: 100%; height: 100%; border-radius: 20px; background:#fff; border: 1px solid rgba(0,0,0,.14); padding: 4px; object-fit: contain; }
.login-card h1 { font-size: 20px; margin-bottom: 2px; }
.login-card .sub { color: var(--text-soft); font-size: 13px; margin-bottom: 22px; }
.login-error {
  background: rgba(220,38,38,.12); color: var(--danger);
  border: 1px solid rgba(220,38,38,.35); border-radius: 9px;
  padding: 8px 12px; font-size: 12.5px; font-weight: 600; margin-bottom: 12px;
}
.login-ok {
  background: rgba(34,150,80,.12); color: #2ea36b;
  border: 1px solid rgba(34,150,80,.4); border-radius: 9px;
  padding: 10px 14px; font-size: 13px; font-weight: 600; margin-bottom: 14px; line-height: 1.5;
}
.login-links { text-align: center; margin-top: 14px; font-size: 13px; }
.login-links a { color: var(--brand-primary); font-weight: 650; text-decoration: none; }
.login-links a:hover { text-decoration: underline; }
.skin-picker-login { display: flex; gap: 8px; justify-content: center; margin: 14px 0 4px; flex-wrap: wrap; }
.muni-pick { border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: 7px 12px; font-size: 12px; font-weight: 650; color: var(--text-soft); }
.muni-pick.active { border-color: var(--brand-primary); color: var(--brand-primary); background: var(--brand-primary-soft); }

/* ---------- Modal de confirmación ---------- */
.overlay { position: fixed; inset: 0; background: rgba(8,12,20,.5); z-index: 90; display: none; align-items: center; justify-content: center; }
.overlay.show { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 22px; width: 440px; max-width: calc(100vw - 40px);
  /* r116 — ningún aviso se sale de pantalla: alto máximo y scroll interno */
  max-height: calc(100vh - 60px); overflow-y: auto;
}
.modal h3 { margin-bottom: 8px; font-size: 16px; }
.modal p { color: var(--text-soft); margin: 0 0 18px; font-size: 13.5px; white-space: pre-line; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: 13px;
  box-shadow: var(--shadow-lg); z-index: 120; display: none;
}
.toast.show { display: block; }
.toast.ok { background: var(--ok); color: #fff; }
.toast.err { background: var(--danger); color: #fff; }
.toast.warn { background: var(--warn); color: #fff; }

/* ---------- Cabecera del expediente ---------- */
.exp-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.exp-head .avatar.big { width: 54px; height: 54px; font-size: 18px; }
.exp-head .who h2 { font-size: 18px; }
.exp-head .who .meta { color: var(--text-soft); font-size: 12.5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.exp-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.kv { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; gap: 12px; }
.kv b { text-align: right; }

/* ---------- Subtablas editables ---------- */
.subtable { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.subtable th, .subtable td { border-bottom: 1px solid var(--border); padding: 6px 8px; font-size: 12.5px; text-align: left; }
.subtable th { color: var(--text-soft); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.subtable input, .subtable select {
  width: 100%; padding: 6px 8px; border-radius: 7px; font: inherit; font-size: 12.5px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.row-del {
  border: 0; background: transparent; color: var(--danger); font-weight: 700; font-size: 15px;
  width: 26px; height: 26px; border-radius: 7px;
}
.row-del:hover { background: rgba(220,38,38,.12); }

.footer-note { margin-top: 26px; color: var(--text-soft); font-size: 11.5px; text-align: center; }

/* ---------- Selector de tema/estilo ---------- */
.theme-btn {
  width: 38px; height: 38px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-soft); display: inline-flex; align-items: center; justify-content: center;
}
.theme-btn:hover { color: var(--brand-primary); border-color: var(--brand-primary); }
.theme-btn svg { width: 18px; height: 18px; }
.skin-wrap { position: relative; }
.skin-menu {
  position: absolute; right: 0; top: 44px; z-index: 100;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; display: none; min-width: 190px;
}
.skin-menu.open { display: block; }
.skin-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  border: 0; background: transparent; color: var(--text-soft);
  padding: 8px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 650; text-align: left;
}
.skin-menu button:hover { background: var(--surface-2); color: var(--text); }
.skin-menu button.active { color: var(--brand-primary); background: var(--brand-primary-soft); }
.skin-swatch { width: 16px; height: 16px; border-radius: 5px; flex: 0 0 16px; }
.user-menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.user-menu-head .small { font-size: 11px; }
.skin-menu .skin-swatch svg { width: 15px; height: 15px; display: block; color: var(--text-soft); }
/* Medidor de fortaleza de la nueva contraseña */
.cc-fuerza { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.cc-fuerza .cc-barra { display: block; height: 6px; width: 0; border-radius: 4px; background: var(--border); transition: width .2s, background .2s; }
.cc-fuerza .cc-texto { font-size: 11px; }
.sw-estandar { background: linear-gradient(135deg, #1e5eff 0 50%, #0a2a6b 50% 100%); }
.sw-mando    { background: linear-gradient(135deg, #f97316 0 50%, #0a0f1a 50% 100%); }
.sw-consola  { background: linear-gradient(135deg, #14b8a6 0 50%, #08111a 50% 100%); }

/* ============================================================
   SKINS — tres estilos de interfaz (mismo contenido, distinta piel)
   ============================================================ */
[data-skin="mando"][data-theme="dark"] {
  --bg: #030509; --surface: #0a0f1a; --surface-2: #0f1624; --border: #1b2438;
  --text: #eef2fa; --text-soft: #93a0b8;
  --brand-primary: #f97316; --brand-secondary: #7c2d12; --brand-accent: #f97316;
  --brand-primary-soft: rgba(249,115,22,.14);
  --shadow: 0 1px 3px rgba(0,0,0,.55); --shadow-lg: 0 12px 36px rgba(0,0,0,.7);
}
[data-skin="mando"][data-theme="light"] {
  --bg: #f4f5f9; --surface: #ffffff; --surface-2: #eceef5; --border: #d9dee9;
  --text: #0f1728; --text-soft: #3d4a63;
  --brand-primary: #ea580c; --brand-secondary: #7c2d12; --brand-accent: #f97316;
  --brand-primary-soft: rgba(234,88,12,.12);
}
[data-skin="mando"] h1#page-title {
  font-family: "Arial Black","Segoe UI",system-ui,sans-serif;
  font-style: italic; text-transform: uppercase; letter-spacing: .4px; font-size: 19px;
}
[data-skin="mando"] .brand-name {
  font-family: "Arial Black","Segoe UI",sans-serif; font-style: italic;
  text-transform: uppercase; font-size: 11.5px; letter-spacing: .4px;
}
[data-skin="mando"] .sidebar { background: transparent; }
[data-skin="mando"] .card { border-radius: 18px; transition: border-color .15s ease; }
[data-skin="mando"] .card:hover { border-color: var(--brand-primary); }
[data-skin="mando"] .btn { border-radius: 10px; letter-spacing: .2px; }

[data-skin="consola"] { --brand-accent: #22d3ee; --shadow: none; --shadow-lg: 0 10px 30px rgba(0,0,0,.25); }
[data-skin="consola"][data-theme="dark"] {
  --bg: #0a0f14; --surface: #101820; --surface-2: #15202b; --border: #22303f;
  --text: #e6edf4; --text-soft: #8fa3b8;
  --brand-primary: #22d3ee; --brand-secondary: #155e75;
  --brand-primary-soft: rgba(34,211,238,.12);
}
[data-skin="consola"][data-theme="light"] {
  --bg: #eef2f5; --surface: #ffffff; --surface-2: #e6ecf1; --border: #cfdae4;
  --text: #0e1a24; --text-soft: #41566b;
  --brand-primary: #0e7490; --brand-secondary: #155e75;
  --brand-primary-soft: rgba(14,116,144,.12);
}
[data-skin="consola"] body, [data-skin="consola"] { font-size: 13.5px; }
[data-skin="consola"] .sidebar { width: 200px; flex-basis: 200px; padding: 10px 8px; }
[data-skin="consola"] .card { border-radius: 8px; padding: 12px 14px; }
[data-skin="consola"] .main { padding: 14px 18px 50px; }
[data-skin="consola"] .topbar { margin-bottom: 12px; }
[data-skin="consola"] h1#page-title { font-size: 17px; letter-spacing: .2px; }
[data-skin="consola"] .nav-item { padding: 6px 9px; border-radius: 6px; font-size: 13px; }
[data-skin="consola"] .btn { border-radius: 6px; }

@media (max-width: 1100px) {
  .frow.c4 { grid-template-columns: repeat(2, 1fr); }
  .frow.c5 { grid-template-columns: repeat(2, 1fr); }
  .frow.c3 { grid-template-columns: repeat(2, 1fr); }
  .sidebar { width: 66px; flex-basis: 66px; }
  .brand-name, .brand-sub, .nav-item span.txt, .nav-sep { display: none; }
  .nav-item { justify-content: center; }
  /* Con la barra reducida a iconos, la flecha del grupo y el punto quedan fuera */
  .nav-caret, .nav-dot { display: none !important; }
  .nav-sub { padding-left: 0; }
}

@media (max-width: 900px) {
  .pa-t { font-size: 8px; height: 14px; }
  .pa-meses { gap: 10px; }
  .cuad-autor { display: none; }
  .pa-anio { font-size: 18px; }
}

@media (max-width: 640px) {
  .pa-meses { grid-template-columns: 1fr; }
  .frow { grid-template-columns: 1fr !important; }
  .pa-anio { font-size: 17px; }
  .pa-barra { gap: 8px; }
  .seg-btn { padding: 7px 8px; font-size: 12px; }
  .pa-drawer { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 78vh; }
  .pa-det-turno, .pa-det-aus-tipo { min-width: 100%; }
}

/* ============================================================
   CARNET DE SERVICIO (impresión provisional)
   ============================================================ */
#carnet-print { display: none; }
@media print {
  body.printing-carnet > * { display: none !important; }
  body.printing-carnet #carnet-print { display: block !important; }
}
#carnet-print .carnet {
  width: 86mm; height: 54mm; border: 1.2mm solid #0a2a6b; border-radius: 4mm;
  padding: 4mm; font-family: "Segoe UI", sans-serif; color: #111; background: #fff;
  display: flex; gap: 4mm;
}
#carnet-print .carnet .c-foto {
  width: 22mm; height: 28mm; border: .4mm solid #999; border-radius: 2mm;
  display: flex; align-items: center; justify-content: center;
  font-size: 8pt; color: #777; text-align: center; flex: 0 0 22mm;
}
#carnet-print .carnet .c-dat { flex: 1; font-size: 7.5pt; line-height: 1.35; }
#carnet-print .carnet .c-dat b { font-size: 9pt; }
#carnet-print .carnet .c-org {
  font-size: 7pt; text-transform: uppercase; letter-spacing: .4px; color: #0a2a6b;
  border-bottom: .3mm solid #0a2a6b; margin-bottom: 1.5mm; padding-bottom: 1mm; font-weight: 700;
}
#carnet-print .carnet .c-placa {
  display: inline-block; margin-top: 1.5mm; padding: .8mm 2.5mm;
  background: #0a2a6b; color: #fff; font-weight: 800; border-radius: 1.5mm; letter-spacing: .5px;
}

/* ---------- Cuadrante: grid del servicio ---------- */
.quad-scroll { overflow: auto; max-height: 72vh; border-radius: 8px; }
table.quad { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 900px; font-size: 12.5px; }
table.quad th, table.quad td { border: 0; box-shadow: 1px 0 0 var(--border, rgba(128,140,170,.25)), 0 1px 0 var(--border, rgba(128,140,170,.25)); padding: 5px 6px; vertical-align: top; text-align: left; }
table.quad thead th { background: var(--surface-2); text-align: center; white-space: nowrap; position: sticky; top: 0; z-index: 4; }
table.quad thead th.quad-turno { z-index: 5; }
table.quad thead th .quad-fecha { font-size: 11px; opacity: .75; }
table.quad th.quad-festivo { color: var(--accent-warn, #e8a13c); }
table.quad th.quad-turno, table.quad td.quad-turno { font-weight: 700; white-space: nowrap; background: var(--surface-2); width: 120px; position: sticky; left: 0; z-index: 3; }
table.quad td.quad-turno { z-index: 2; }
td.quad-celda { min-width: 86px; }
td.quad-celda[data-turno] { cursor: pointer; }
td.quad-celda[data-turno]:hover { background: var(--surface-2); }
td.quad-celda.quad-celda-sel { outline: 2px solid var(--accent-warn, #e8a13c); outline-offset: -2px; }
.qc { display: flex; flex-wrap: wrap; gap: 2px; align-content: flex-start; position: relative; }
.qc-con-n { padding-top: 18px; }
.qc-libres { max-height: none; overflow: visible; }
td.quad-libres { opacity: .85; }
.quad-n { position: absolute; top: 2px; right: 2px; font-size: 10px; font-weight: 800; color: var(--text-soft); background: var(--surface-2, rgba(128,140,170,.18)); border: 1px solid var(--border, rgba(128,140,170,.3)); border-radius: 8px; padding: 0 5px; line-height: 15px; height: 16px; }
.fila-sel { outline: 2px solid var(--accent, #2f6bff); outline-offset: -2px; cursor: pointer; }
tr[data-vid] { cursor: pointer; }
.chip-turno { display: inline-block; padding: 1px 6px; margin: 1px 2px 1px 0; border-radius: 4px;
  background: var(--bg-soft, rgba(128,140,170,.15)); border: 1px solid var(--border, rgba(128,140,170,.3));
  font-weight: 600; font-size: 11.5px; white-space: nowrap; max-width: 100%; }
.chip-turno.chip-m { background: rgba(255,217,102,.14); border-color: rgba(255,217,102,.5); }
.chip-turno.chip-t { background: rgba(255,159,90,.13); border-color: rgba(255,159,90,.5); }
.chip-turno.chip-n { background: rgba(123,143,212,.16); border-color: rgba(123,143,212,.55); }
.chip-turno.chip-ex { background: rgba(46,160,90,.18); border-color: rgba(46,160,90,.5); }
.chip-turno.chip-manual { border-style: dashed; }
.chip-turno.chip-libre { opacity: .7; font-weight: 500; }
.chip-turno.chip-ausente { background: rgba(200,70,70,.15); border-color: rgba(200,70,70,.45); }
.chip-vacante { display: inline-block; margin-top: 3px; padding: 1px 6px; border-radius: 4px;
  background: rgba(220,120,30,.18); border: 1px solid rgba(220,120,30,.55); color: var(--accent-warn, #e8a13c);
  font-weight: 700; font-size: 11px; white-space: nowrap; }
.chip-vacante svg { width: 11px; height: 11px; vertical-align: -1px; }
.cuad-autor { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Nomenclaturas del día: marcas manuales en el cuadrante ---------- */
.marca-btn { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  margin-left: 4px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-soft); cursor: pointer; font-size: 11px; vertical-align: middle; flex: none; }
.marca-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--accent, #2f6bff); }
.marca-btn.on { background: var(--accent, #2f6bff); color: #fff; border-color: var(--accent, #2f6bff); }
.chip-nom { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 6px; font-size: 10.5px;
  font-weight: 800; letter-spacing: .4px; vertical-align: middle;
  background: rgba(77,124,254,.16); border: 1px solid rgba(77,124,254,.5); color: var(--accent, #4d7cfe); }
.chip-nom.chip-nom-servicio { background: rgba(46,160,90,.18); border-color: rgba(46,160,90,.55); color: #2ea05a; }
.chip-nom.chip-nom-trabajado { background: rgba(232,161,60,.16); border-color: rgba(232,161,60,.55); color: var(--accent-warn, #e8a13c); }
.chip-nom.chip-nom-extra { background: rgba(155,109,255,.16); border-color: rgba(155,109,255,.55); color: #9b6dff; }
.chip-nom.chip-nom-libre { background: rgba(150,163,187,.16); border-color: rgba(150,163,187,.55); color: #96a3bb; }
.chip-nom.chip-nom-pv { background: rgba(217,119,6,.2); border-color: rgba(217,119,6,.6); color: #d97706; }
.chip-turno.chip-nom-fila { border-style: dashed; }
.marca-menu { margin: 6px 0 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  max-height: min(62vh, 520px); max-width: 100%; white-space: normal;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.marca-menu-top { flex: none; padding: 8px 8px 6px; border-bottom: 1px solid var(--border); background: var(--surface); }
.marca-rango { flex: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); font-size: 11.5px; }
.marca-rango-t { font-weight: 800; color: var(--text); text-transform: uppercase; font-size: 10px; letter-spacing: .4px; }
.marca-rango-op { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: var(--text); }
.marca-rango-op input { accent-color: #d9534f; }
.marca-rango-hasta { display: inline-flex; align-items: center; gap: 5px; color: var(--text); }
.marca-rango-hasta input { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; font-size: 11.5px; font-family: inherit; }
.marca-buscar { width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; font-size: 12.5px; }
.marca-buscar:focus { outline: none; border-color: var(--accent, #4d7cfe); }
.marca-filtros { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.chip-filtro { padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-soft); cursor: pointer; }
.chip-filtro:hover { border-color: var(--accent, #4d7cfe); color: var(--text); }
.chip-filtro.on { background: var(--accent, #4d7cfe); border-color: var(--accent, #4d7cfe); color: #fff; }
.marca-lista { overflow-y: auto; overscroll-behavior: contain; min-height: 0; scrollbar-width: thin; }
.marca-acciones { flex: none; border-top: 1px solid var(--border); background: var(--surface); }
.marca-acciones .marca-grupo { border-top: 0; padding-top: 8px; }
.marca-grupo { padding: 6px 10px 2px; font-size: 10.5px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text-soft); border-top: 1px solid var(--border); }
.marca-grupo:first-child { border-top: 0; }
.marca-opt { display: flex; gap: 8px; align-items: center; width: 100%; min-width: 0; text-align: left; padding: 5px 10px;
  border: 0; background: transparent; color: var(--text); cursor: pointer; font-size: 12.5px; }
.marca-opt:hover { background: var(--surface-2); }
.marca-opt > span:not(.muted) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.marca-opt .muted { margin-left: auto; flex: none; white-space: nowrap; }
.marca-menu input[type="number"] { background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; font-size: 12px; }
.pa-bloque-marca { border-left: 3px solid var(--accent, #4d7cfe); }
.pa-bloque-puesto { border-left: 3px solid #2ea05a; }
.pa-puesto-tag { display: inline-block; min-width: 118px; padding: 1px 8px; border-radius: 6px; font-size: 11px; font-weight: 800;
  background: rgba(46,160,90,.15); border: 1px solid rgba(46,160,90,.5); color: #2ea05a; }
.pa-puesto-fila { display: flex; gap: 6px; align-items: center; margin: 4px 0; }
.pa-puesto-fila input { flex: 1; min-width: 0; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px; font-size: 12.5px; }
.pa-puesto-fila input:focus { outline: none; border-color: var(--accent, #4d7cfe); }
.pa-puesto-fila .pa-puesto-codigo { flex: 0 0 110px; text-transform: uppercase; }
.pa-puesto-lista { max-height: 40vh; overflow-y: auto; }
.totales-mes .subtable th, .totales-mes .subtable td { white-space: nowrap; }

/* ---------- Vista anual del cuadrante ---------- */
.seg { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; max-width: 100%; }
.seg-btn { background: transparent; border: 0; padding: 7px 14px; cursor: pointer; color: var(--text-soft); font-weight: 600; font-size: 13px; flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg-btn.on { background: var(--accent, #2f6bff); color: #fff; }

/* Layout de la pestaña Cuadrantes: tabla de versiones + grid */
.cuad-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 14px; margin-top: 14px; align-items: start; }
.cuad-versions { overflow-x: auto; min-width: 0; }
@media (max-width: 1100px) { .cuad-layout { grid-template-columns: 1fr; } }

.pa-barra { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.pa-nav { display: flex; align-items: center; gap: 8px; }
.pa-nav button { min-width: 34px; height: 34px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; cursor: pointer; font-size: 16px; }
.pa-nav button:hover { background: var(--surface-2); }
.pa-anio { font-size: 20px; font-weight: 800; color: var(--text); min-width: 64px; text-align: center; }
.pa-filtros { display: flex; flex-wrap: wrap; gap: 6px; }
.pa-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 999px; padding: 4px 11px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 12.5px; font-weight: 600; opacity: .55; }
.pa-chip.on { opacity: 1; border-color: var(--gc, var(--border)); box-shadow: 0 0 0 1px var(--gc, transparent) inset; }
.pa-punto { width: 10px; height: 10px; border-radius: 50%; background: var(--gc, #999); display: inline-block; }

.pa-meses { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 14px; }
.pa-mes { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px; min-width: 0; overflow: hidden; }
.pa-mes-titulo { font-weight: 700; font-size: 14px; margin-bottom: 8px; color: var(--text); }
.pa-tabla { width: 100%; border-collapse: collapse; table-layout: fixed; }
.pa-tabla th { font-size: 11px; color: var(--text-soft); font-weight: 700; padding: 3px 0; text-align: center; }
.pa-dia { border: 1px solid var(--border); border-radius: 6px; padding: 3px; height: auto; min-height: 66px; vertical-align: top; cursor: pointer; background: var(--surface); overflow: hidden; position: relative; }
.pa-dia:hover { background: var(--surface-2); }
.pa-dia.pa-fuera { background: transparent; border-color: transparent; cursor: default; min-height: 0; }
/* días del mes vecino visibles en la primera/última semana (QA A-MEN-2): se
   ven atenuados para distinguirlos del mes en curso, con sus letras M/T/N */
.pa-dia.pa-fuera .pa-num { color: var(--muted, #9aa3b2); opacity: .75; }
.pa-dia.pa-fuera .pa-t, .pa-dia.pa-fuera .pa-tl { opacity: .55; }
.pa-dia.pa-hoy { box-shadow: 0 0 0 2px var(--accent, #2f6bff) inset; }
.pa-dia.pa-sel { box-shadow: 0 0 0 2px var(--accent-warn, #e8a13c) inset; }
.pa-dia.pa-festivo { background: rgba(220,120,30,.10); }
/* aviso de días con marcas/cambios: borde suave + pastilla con el nº de cambios */
.pa-dia.pa-dia-cambios { border-color: rgba(220,80,80,.65); }
.pa-cambios-n { position: absolute; top: 2px; left: 3px; min-width: 14px; height: 14px; padding: 0 3px;
  border-radius: 7px; background: #d9534f; color: #fff; font-size: 8.5px; font-weight: 800; line-height: 14px;
  text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.35); pointer-events: none; }
.pa-num { font-size: 11px; font-weight: 700; color: var(--text-soft); text-align: right; line-height: 1; }
.pa-festivo .pa-num { color: var(--accent-warn, #e8a13c); }
.pa-trow { display: flex; align-items: center; gap: 2px; margin-top: 2px; }
.pa-tl { flex: 0 0 auto; width: 10px; font-size: 7.5px; font-weight: 800; color: var(--text-soft); line-height: 1; }
.pa-t { display: inline-flex; align-items: center; justify-content: center; flex: 1 1 0; min-width: 0; height: 15px; border-radius: 4px; font-size: 8.5px; font-weight: 800; color: #1a1a1a; letter-spacing: 0; padding: 0 1px; }
.pa-t.mini-off { opacity: .18; }
.pa-t.mini-vacio { background: transparent; color: var(--text-soft); flex: 0 0 auto; }

/* Detalle del día: panel lateral fijo (drawer) */
#pa-backdrop { position: fixed; inset: 0; background: rgba(8, 12, 24, .45); z-index: 70; }
.pa-drawer { position: fixed; top: 70px; right: 18px; bottom: 18px; width: min(430px, calc(100vw - 36px)); z-index: 71; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .45); display: flex; flex-direction: column; overflow: hidden; animation: pa-drawer-in .18s ease-out; }
@keyframes pa-drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.pa-drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 14px 16px 12px; border-bottom: 1px solid var(--border); }
.pa-drawer-fecha { font-weight: 800; font-size: 16.5px; color: var(--text); }
.pa-drawer-x { flex: 0 0 auto; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 14px; line-height: 1; }
.pa-drawer-x:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.pa-drawer-body { overflow-y: auto; padding: 8px 16px 16px; }
.pa-det-fila { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); flex-wrap: wrap; }
.pa-det-fila:last-child { border-bottom: 0; }
.pa-det-turno { min-width: 92px; font-weight: 700; font-size: 12.5px; color: var(--text-soft); }
.pa-det-nombres { display: flex; flex-wrap: wrap; gap: 5px; flex: 1 1 100%; min-width: 0; }
.chip-placa { font-weight: 800; opacity: .85; }

/* Bloques del drawer de día: cabecera con color del turno y total de agentes */
.pa-bloque { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.pa-bloque-tit { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; font-weight: 800; font-size: 13px; color: var(--text); }
.pa-bloque-n { font-size: 11.5px; font-weight: 700; color: var(--text-soft); background: rgba(128,140,170,.16); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.pa-bloque-body { padding: 4px 10px 8px; }
.pa-bloque-m .pa-bloque-tit { background: rgba(255,217,102,.14); box-shadow: 4px 0 0 #FFD966 inset; }
.pa-bloque-t .pa-bloque-tit { background: rgba(255,159,90,.13); box-shadow: 4px 0 0 #FF9F5A inset; }
/* OJO: el modificador del bloque de NOCHE no puede llamarse pa-bloque-n:
   ese nombre ya lo usa la píldora del contador y su white-space:nowrap
   cortaba todo el bloque. */
.pa-bloque-noche .pa-bloque-tit { background: rgba(123,143,212,.15); box-shadow: 4px 0 0 #7B8FD4 inset; }
.pa-bloque-libre .pa-bloque-tit { background: var(--bg-soft, rgba(128,140,170,.10)); box-shadow: 4px 0 0 #9aa7bd inset; }
.pa-bloque-reserva .pa-bloque-tit { background: var(--bg-soft, rgba(128,140,170,.10)); box-shadow: 4px 0 0 #6b7280 inset; }
.pa-bloque-warn .pa-bloque-tit { background: rgba(220,120,30,.14); box-shadow: 4px 0 0 #e8a13c inset; }
/* Sub-filas de ausentes dentro de un bloque (vacaciones, bajas…):
   van sangradas y etiquetadas por tipo, nunca mezcladas con los libres. */
.pa-det-aus { padding: 2px 0 8px 18px; border-bottom: 1px dashed var(--border); }
.pa-det-aus:last-child { border-bottom: 0; }
.pa-det-aus-tipo { min-width: 92px; font-weight: 700; font-size: 11.5px; color: var(--text-soft); }
.pa-tag-aus { display: inline-block; font-size: 10px; font-weight: 800; color: #fff; background: var(--accent-warn, #e8a13c); border-radius: 999px; padding: 1px 7px; margin: 1px 0 1px 4px; white-space: nowrap; }

/* Título de mes clicable (vista año) */
button.pa-mes-titulo { display: flex; align-items: center; justify-content: space-between; width: 100%; background: transparent; border: 0; padding: 0 0 2px; font: inherit; font-weight: 700; font-size: 14px; margin-bottom: 8px; color: var(--text); cursor: pointer; }
button.pa-mes-titulo:hover { color: var(--accent, #2f6bff); }
.pa-ampliar { font-size: 11px; opacity: .5; }
/* al pasar el cursor, el mes se agranda ligeramente como aviso de que es interactivo */
.pa-mes { transition: transform .18s ease; position: relative; }
.pa-mes:hover { transform: scale(1.045); z-index: 6; }
button.pa-mes-titulo .pa-ampliar { transition: opacity .15s ease, transform .15s ease; display: inline-block; }
.pa-mes:hover button.pa-mes-titulo .pa-ampliar { opacity: 1; transform: scale(1.25); }

/* ---------- Vista de mes ampliada con formato de hoja de cálculo (Excel) ---------- */
.pa-excel-wrap { max-height: 72vh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.pa-excel { width: 100%; border-collapse: collapse; font-size: 12px; }
.pa-excel thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--text);
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  padding: 7px 8px; text-align: left; border-bottom: 2px solid var(--border); z-index: 2; }
.pa-excel tbody td { border-bottom: 1px solid var(--border); border-right: 1px dashed var(--border);
  padding: 5px 8px; vertical-align: top; }
.pa-excel tbody td:last-child { border-right: 0; }
.pa-excel tbody tr:nth-child(even) { background: var(--bg-soft, rgba(128,140,170,.07)); }
.pa-excel tbody tr:hover { background: var(--surface-2); }
.pa-excel tr.pa-x-fest td { background: rgba(220,120,30,.08); }
.pa-excel tr.pa-x-cambios td.pa-x-dia { box-shadow: inset 3px 0 0 #d9534f; }
.pa-excel tr.pa-x-fin td.pa-x-dia { color: var(--text-soft); }
.pa-x-dia { width: 86px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pa-x-dia b { font-size: 14px; }
.pa-x-dia span { font-size: 10.5px; }
.pa-x-festivo { display: inline-block; background: rgba(220,120,30,.85); color: #fff; border-radius: 4px;
  font-size: 9px; font-weight: 800; padding: 0 4px; line-height: 13px; }
.pa-cambios-flot { display: inline-block; min-width: 14px; height: 14px; padding: 0 3px; border-radius: 7px;
  background: #d9534f; color: #fff; font-size: 8.5px; font-weight: 800; line-height: 14px; text-align: center; }
.pa-xag { display: inline-flex; align-items: center; gap: 3px; margin: 1px 4px 1px 0; padding: 1px 6px 1px 5px;
  border: 1px solid var(--border); border-left: 3px solid var(--gc, #888); border-radius: 5px;
  background: var(--surface); font-family: Consolas, "Courier New", monospace; font-size: 11px; font-weight: 700; }
.pa-xaus { margin: 1px 0; font-size: 11.5px; }
.pa-xaus-tipo { display: inline-block; min-width: 88px; font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .3px; color: var(--accent-warn, #e8a13c); }
.pa-xaus-ag { font-family: Consolas, "Courier New", monospace; font-size: 11px; margin-right: 4px; }

/* Vista de mes ampliada */
.pa-mes-amplio-barra { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.pa-mes-amplio-titulo { font-size: 20px; font-weight: 800; color: var(--text); text-transform: capitalize; }
.pa-mes-amplio-caja { padding: 14px; }
.pa-mes-amplio-caja .pa-tabla th { font-size: 12px; padding: 5px 0; }
.pa-dia-grande { min-height: 120px; cursor: pointer; }
.pa-g { display: inline-flex; align-items: center; justify-content: center; height: 17px; padding: 0 4px; border-radius: 5px; font-size: 9px; font-weight: 800; color: #1a1a1a; letter-spacing: 0; }
.pa-aus-marc { margin-top: 3px; font-size: 9.5px; font-weight: 700; color: var(--accent-warn, #e8a13c); }

/* ---------- Configuración: campos dentro de tablas ---------- */
#cfg-contenido { min-width: 0; }
#cfg-contenido .card { min-width: 0; }
#cfg-contenido .quad input[type="text"],
#cfg-contenido .quad input[type="time"],
#cfg-contenido .quad input[type="number"],
#cfg-contenido .quad select {
  background: var(--surface-2, rgba(128,140,170,.10));
  color: var(--text);
  border: 1px solid var(--border, rgba(128,140,170,.3));
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
  min-width: 0;
}
#cfg-contenido .quad input[type="color"] { padding: 0; border: 1px solid var(--border); border-radius: 6px; background: none; cursor: pointer; }
#cfg-contenido .quad input[type="checkbox"] { width: auto; transform: scale(1.25); }
#cfg-contenido .field input[type="number"] { max-width: 120px; }

/* ---------- Valoración por estrellas (ficha del agente) ---------- */
.stars { display: inline-flex; gap: 2px; margin-top: 2px; }
.star-btn { background: none; border: none; cursor: pointer; padding: 2px; color: var(--muted, #9aa7bd); line-height: 0; border-radius: 4px; }
.star-btn:hover { transform: scale(1.15); }
.star-btn:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 1px; }
.star-btn.on { color: #f0a500; }
.star-btn svg { width: 24px; height: 24px; }


/* ============================================================
   TUTORIALES — academia de la aplicación (lector + editor)
   ============================================================ */
.tut-layout { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 14px; align-items: start; }
@media (max-width: 900px) { .tut-layout { grid-template-columns: 1fr; } }
.tut-lista { display: flex; flex-direction: column; gap: 8px; }
.tut-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; text-align: left; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); cursor: pointer; }
.tut-item:hover { border-color: var(--accent, #2f6bff); }
.tut-item.on { border-color: var(--accent, #2f6bff); box-shadow: 3px 0 0 var(--accent, #2f6bff) inset; }
.tut-item-txt { flex: 1 1 160px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tut-item-txt b { overflow-wrap: break-word; }
.tut-item-acciones { display: flex; gap: 4px; flex: 0 0 auto; }
.tut-item-acciones .btn svg { width: 14px; height: 14px; }
.tut-det-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.tut-objetivo { margin: 10px 0 0; padding: 10px 12px; border-left: 3px solid var(--accent, #2f6bff); background: var(--surface-2); border-radius: 8px; }
.tut-pasos { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.tut-paso { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.tut-paso-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.tut-num { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px; background: var(--accent, #2f6bff); color: #fff; font-weight: 800; font-size: 13px; }
.tut-paso p { margin: 4px 0 8px; color: var(--text-soft); white-space: pre-line; }
.tut-img { display: block; max-width: 100%; border-radius: 10px; border: 1px solid var(--border); margin-top: 6px; }
.tut-video { margin: 12px 0 4px; padding: 10px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.tut-video video { display: block; width: 100%; max-height: 420px; border-radius: 10px; background: #000; }
.tut-paso-edit { border: 1px dashed var(--border); border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.tut-paso-edit-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tut-paso-edit textarea { width: 100%; margin: 6px 0; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px; font: inherit; resize: vertical; }
.tut-paso-edit-img { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.te-p-prev { max-width: 220px; border-radius: 8px; border: 1px solid var(--border); }

/* Área del agente — filas de actividades del parte de servicio */
.ag-act { display: grid; grid-template-columns: 190px 1fr 74px 34px; gap: 8px; margin-bottom: 8px; align-items: center; }
.ag-act select, .ag-act input { width: 100%; }
@media (max-width: 760px) {
  .ag-act { grid-template-columns: 1fr 1fr; }
  .ag-act .ag-act-txt { grid-column: 1 / -1; order: -1; }
  .ag-act .ag-del-act { justify-self: end; }
}

/* ---------- Fase 1 · app del agente: «Mi semana» y «Mi año» ---------- */
.ag-semana {
  display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; padding-bottom: 6px;
}
.ag-dia-card {
  flex: 1 0 104px; min-width: 104px; text-align: center;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 6px;
  background: var(--bg-soft);
}
.ag-dia-card.hoy { border-color: var(--brand-primary); box-shadow: 0 0 0 1px var(--brand-primary); }
.ag-dia-nombre { font-weight: 700; font-size: 12.5px; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-soft); }
.ag-dia-hora { margin-top: 6px; font-size: 12px; color: var(--text); }
.ag-dia-puesto { margin-top: 4px; font-size: 11.5px; color: var(--text-soft); }
.ag-dia-veh { margin-top: 4px; font-size: 11.5px; font-weight: 600; color: var(--brand-primary); }
.ag-dia-libre { margin-top: 4px; font-size: 12px; color: var(--text-soft); font-style: italic; }
.ag-aus { font-size: 11.5px; font-weight: 700; color: var(--danger); text-transform: capitalize; }
.ag-leyenda { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 11.5px; color: var(--text-soft); }
.ag-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.ag-solo-movil { display: none; }

.ag-anio-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-top: 12px;
}
.ag-mes { border: 1px solid var(--border); border-radius: 10px; padding: 8px; background: var(--bg-soft); }
.ag-mes-nombre { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-soft); margin-bottom: 6px; text-align: center; }
.ag-mes-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.ag-cel {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 10px; border-radius: 4px; color: var(--text);
}
.ag-cel.vacia { background: transparent; }
.ag-cel.libre { background: transparent; border: 1px dashed var(--border); color: var(--text-soft); }
.ag-cel.m { background: rgba(56,145,220,.4); color: #fff; font-weight: 700; }
.ag-cel.t { background: rgba(232,163,61,.45); color: #2b1d05; font-weight: 700; }
.ag-cel.n { background: rgba(150,110,220,.45); color: #fff; font-weight: 700; }
.ag-cel.vac { background: rgba(46,158,91,.5); color: #fff; font-weight: 700; }
.ag-cel.baja { background: rgba(214,69,65,.55); color: #fff; font-weight: 700; }
.ag-cel.permiso { background: rgba(214,69,65,.28); color: #fff; }
.ag-cel.hoy { outline: 2px solid var(--brand-primary); outline-offset: 1px; }

/* ---------- Fase 2 · solicitudes (formularios del agente) ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.fld { display: block; margin: 8px 0; }
.fld > span { display: block; font-size: 12.5px; color: var(--text-soft); margin-bottom: 4px; }
.fld input, .fld select {
  width: 100%; padding: 9px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--text); font: inherit;
}
.fld input:focus, .fld select:focus { outline: none; border-color: var(--brand-primary); }

@media (max-width: 760px) {
  .ag-solo-movil { display: inline; }
  .ag-dia-card { flex-basis: 92px; min-width: 92px; }
  .ag-anio-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}

/* ---------- Fase 1 · bloqueo del dispositivo ---------- */
#bloqueo-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(6, 12, 24, .82);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.bloqueo-caja {
  width: 100%; max-width: 360px; text-align: center;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
  padding: 26px 22px; box-shadow: 0 18px 60px rgba(0,0,0,.5);
}
.bloqueo-caja input {
  width: 100%; padding: 13px; text-align: center; font-size: 22px; letter-spacing: 8px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--bg-soft); color: var(--text);
}
.bloqueo-err { display: none; color: var(--danger); font-size: 12.5px; margin: 8px 0; }

/* ---------- FASE 3 — Chat + SOS ---------- */
.chat-fila {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 8px; background: none; border: none; border-bottom: 1px solid var(--border);
  cursor: pointer; text-align: left; color: var(--text); font-size: inherit;
}
.chat-fila:last-child { border-bottom: none; }
.chat-fila:hover { background: var(--bg-soft, rgba(127,127,127,.08)); }
.chat-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent, #2e5c8a); color: #fff; font-weight: 700;
}
.chat-fila-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-fila-txt .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-msjs {
  display: flex; flex-direction: column; gap: 8px; padding: 10px 4px;
  max-height: 50vh; overflow-y: auto; margin-top: 8px;
}
.chat-burbuja {
  max-width: 78%; padding: 8px 12px; border-radius: 14px;
  background: var(--bg-soft, rgba(127,127,127,.12));
  border: 1px solid var(--border); align-self: flex-start;
  position: relative; word-break: break-word;
}
.chat-burbuja.mio { align-self: flex-end; background: rgba(46,94,138,.25); border-color: rgba(46,94,138,.5); }
.chat-emisor { display: block; font-size: .75em; font-weight: 700; opacity: .75; margin-bottom: 2px; }
.chat-hora { display: block; font-size: .68em; opacity: .55; text-align: right; margin-top: 3px; }
.chat-foto { max-width: 100%; border-radius: 10px; display: block; margin: 4px 0; }
.chat-composer { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.chat-composer #chat-txt { flex: 1; }
.chat-pend-foto { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.chat-pend-foto img { max-height: 70px; border-radius: 8px; border: 1px solid var(--border); }

/* Botón SOS flotante del agente (móvil) */
.ag-sos-fab {
  position: fixed; right: 18px; bottom: 22px; z-index: 900;
  width: 74px; height: 74px; border-radius: 50%;
  border: 3px solid #fff; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #ff6b5e, #c81e1e);
  color: #fff; font-weight: 800; font-size: 15px; line-height: 1.1;
  box-shadow: 0 6px 22px rgba(200,30,30,.5);
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.ag-sos-fab .ag-sos-txt { position: relative; z-index: 2; }
.ag-sos-fab .ag-sos-pulso {
  position: absolute; inset: -3px; border-radius: 50%;
  border: 3px solid rgba(255,80,70,.7); opacity: 0;
}
.ag-sos-fab.activo { animation: sos-latido 1.2s infinite; }
.ag-sos-fab.activo .ag-sos-pulso { animation: sos-pulso 1.2s infinite; }
@keyframes sos-latido {
  0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); }
}
@keyframes sos-pulso {
  0% { transform: scale(1); opacity: .8; }
  100% { transform: scale(1.55); opacity: 0; }
}

/* Banner de alarma SOS del panel (mando) */
#sos-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 2000;
  background: #7a0f0f; color: #fff;
  border-bottom: 3px solid #ff5046;
  padding: 10px 16px 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
  animation: sos-fondo 1.2s infinite;
  max-height: 60vh; overflow-y: auto;
}
@keyframes sos-fondo {
  0%, 100% { background: #7a0f0f; } 50% { background: #a01313; }
}
.sos-banner-cab { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sos-banner-titulo { font-weight: 800; font-size: 1.05em; letter-spacing: .03em; }
.sos-tarjeta {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.35);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; flex-wrap: wrap;
}
.sos-tarjeta-info { flex: 1; min-width: 220px; }
.sos-tarjeta-acc { display: flex; gap: 8px; }
.sos-mapa { display: inline-block; margin-left: 8px; color: #ffd7d4; text-decoration: underline; }
#sos-banner .placa-tag { background: rgba(255,255,255,.2); color: #fff; }
#sos-banner .muted { color: rgba(255,255,255,.75); }
/* compensa el hueco del banner fijo para que no tape la cabecera */
body.con-sos #app { margin-top: 150px; }
@media (max-width: 700px) {
  .ag-sos-fab { width: 66px; height: 66px; font-size: 13px; right: 12px; bottom: 14px; }
  body.con-sos #app { margin-top: 190px; }
}

/* Buscador de agentes (asignar puesto, grúa…): campo que filtra por placa,
   apellidos o nombre y fija el elegido como etiqueta con ✕ para cambiar. */
.ba-caja { position: relative; }
.ba-input { width: 100%; }
.ba-lista { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 26px rgba(0,0,0,.28); max-height: 240px; overflow-y: auto; }
.ba-op { display: flex; gap: 8px; align-items: center; width: 100%; text-align: left;
  padding: 8px 10px; background: none; border: 0; color: var(--text); font: inherit; cursor: pointer; }
.ba-op:hover { background: var(--surface-2); }
.ba-elegido { display: flex; gap: 6px; align-items: center; }

/* ---------- Cuadrante mensual (tablas de semana estilo Excel del jefe) ---------- */
#cuad-mensual { --qm-ex: #ffd23f; }
.qm-barra { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 8px; }
.qm-nav { display: flex; align-items: center; gap: 10px; }
.qm-mes { font-size: 16px; letter-spacing: .5px; }
.qm-leyenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.qm-leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.qm-sw { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--border); display: inline-block; }
.qm-scroll { overflow-x: auto; }
.qm-semana-tit { font-weight: 700; font-size: 12px; letter-spacing: .5px; margin: 10px 0 4px; color: var(--text); }
table.qm { border-collapse: collapse; width: 100%; min-width: 860px; table-layout: fixed; margin-bottom: 14px; background: #f7f8fb; color: #1a2333; }
table.qm th, table.qm td { border: 1.5px solid #20304d; padding: 3px 4px; text-align: center; font-size: 11.5px; vertical-align: top; word-wrap: break-word; }
table.qm thead th { background: #20304d; color: #fff; font-size: 11px; letter-spacing: .4px; line-height: 1.5; }
table.qm .qm-turno { width: 106px; background: #e3e9f4; font-weight: 700; font-size: 10.5px; vertical-align: middle; line-height: 1.5; }
table.qm .qm-puesto { width: 106px; background: #eef1f7; font-weight: 700; font-size: 10.5px; text-align: left; padding-left: 6px; line-height: 1.5; }
table.qm .qm-festivo-h { background: #6d5a1e; }
table.qm td.qm-festivo { background: #fff7dd; }

/* Icono de festivo profesional (calendario con estrella) junto al día */
.qm-fest-ico { display: inline-flex; width: 14px; height: 14px; color: #b45309; vertical-align: -2px; margin: 0 2px; }
.qm-fest-ico svg { width: 100%; height: 100%; }
th.qm-festivo-h .qm-fest-ico, .cl-festivo .qm-fest-ico { color: #ffd966; }
.pa-num .qm-fest-ico { width: 12px; height: 12px; vertical-align: 0; }

/* Botón ⋯ de opciones del día (servicio y mensual, solo jefatura) */
.qm-menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; padding: 0; margin-left: 3px; border: 0; border-radius: 4px; background: transparent; color: #7c8aa5; cursor: pointer; vertical-align: -3px; opacity: .65; }
.qm-menu-btn svg { width: 13px; height: 13px; }
.qm-menu-btn:hover { opacity: 1; background: rgba(32, 48, 77, .12); color: #20304d; }
th.qm-festivo-h .qm-menu-btn, .cl-festivo .qm-menu-btn { color: #ffe9b3; }
th.qm-festivo-h .qm-menu-btn:hover, .cl-festivo .qm-menu-btn:hover { background: rgba(255,255,255,.18); color: #fff; }
.cl-headwrap { position: relative; display: flex; align-items: flex-start; gap: 0; }
.cl-headwrap .qm-menu-btn { margin-top: 6px; flex: none; }

/* Menú emergente del día (festivo / servicio extraordinario) */
.dia-menu-pop { width: auto; min-width: 240px; max-width: 300px; height: auto; max-height: none; z-index: 9999; }
.dia-menu-ops { display: flex; flex-direction: column; padding: 6px; gap: 2px; }
.dia-menu-op { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 10px; border-radius: 7px; font-size: 13px; font-weight: 600; color: #20304d; cursor: pointer; font-family: inherit; }
.dia-menu-op svg { width: 16px; height: 16px; flex: none; color: #b45309; }
.dia-menu-op:hover { background: #eef1f7; }
.dia-menu-op[data-dm-evento] svg { color: #b3341f; }
table.qm th.qm-fuera-h, table.qm td.qm-fuera { opacity: .45; background: #e9edf4; }
.qm-n { display: inline-block; padding: 0 4px; border-radius: 3px; font-weight: 600; line-height: 1.6; margin: 1px; position: relative; cursor: pointer; }
.qm-marca-pop { position: fixed; z-index: 120; width: 350px; height: min(640px, 82vh); display: flex; flex-direction: column; overflow: hidden; background: #fff; border: 1px solid #20304d; border-radius: 12px; box-shadow: 0 14px 40px rgba(0,0,0,.45); }
.qm-marca-pop > .marca-menu { flex: 1 1 auto; min-height: 0; margin: 8px; max-height: none; box-shadow: none; }
.qm-marca-pop-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid #20304d; font-size: 13.5px; background: #20304d; color: #fff; }
.qm-marca-x { background: none; border: 0; color: #c8d4e8; font-size: 15px; cursor: pointer; padding: 2px 6px; border-radius: 5px; }
.qm-marca-x:hover { color: #fff; background: rgba(255,255,255,.15); }
.qm-pop-tabs { flex: none; display: flex; background: #eef1f7; border-bottom: 1px solid #c6cede; }
.qm-tab { flex: 1; border: 0; padding: 7px 8px; font-size: 11.5px; font-weight: 700; cursor: pointer; background: transparent; color: #3a4a63; border-top: 3px solid transparent; font-family: inherit; letter-spacing: .3px; }
.qm-tab.on[data-qm-tab="marca"] { background: #fff; color: #1a2333; }
.qm-tab[data-qm-tab="grupo"] { color: #fff; }
.qm-tab[data-qm-tab="grupo"]:not(.on) { filter: saturate(.3) brightness(1.3); opacity: .8; }
.qm-pop-grupo-wrap { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.qm-pop-grupo-head { flex: none; padding: 8px 10px; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .5px; }
.qm-pop-grupo { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 3px; background: #fff; }
.qm-fila-agente { display: flex; align-items: center; gap: 7px; width: 100%; text-align: left; border: 1px solid #dde3ee; border-radius: 7px; background: #fbfcfe; padding: 5px 7px; cursor: pointer; font-family: inherit; font-size: 11.5px; color: #1a2333; }
.qm-fila-agente:hover { border-color: #20304d; background: #fff; }
.qm-fila-agente.yo { border-color: #20304d; box-shadow: inset 0 0 0 1px #20304d; }
.qm-fila-placa { font-weight: 800; color: #20304d; flex: none; }
.qm-fila-nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qm-fila-est { flex: none; font-size: 9.5px; font-weight: 700; padding: 2px 6px; border-radius: 8px; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qm-est-trabaja { background: #d9f2df; color: #176b32; }
.qm-est-libre { background: #e2e7f0; color: #4a5a75; }
.qm-est-aus { background: #fde2cf; color: #a34a00; }
.qm-est-marca { background: #e8defc; color: #5b2ea6; }
.qm-est-puesto { background: #d7e6fb; color: #1a4d8f; }
/* Tooltip flotante de chips (único, gestionado por initChipTip en app.js).
   En document.body con position:fixed: ningún contenedor con overflow lo recorta. */
.chip-tip { position: fixed; z-index: 9999; background: #20304d; color: #fff; font-size: 10.5px; font-weight: 500; padding: 4px 9px; border-radius: 5px; white-space: nowrap; pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.qm-grupo { margin: 2px 0; border: 1px solid #c6cede; border-radius: 5px; background: #fff; }
.qm-g-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; width: 100%; border: 0; color: #fff; font-size: 9.5px; font-weight: 700; letter-spacing: .4px; padding: 1px 6px; border-radius: 4px 4px 0 0; cursor: pointer; line-height: 1.8; font-family: inherit; }
.qm-g-head:hover { filter: brightness(1.15); }
.qm-g-n { background: rgba(255,255,255,.3); border-radius: 8px; padding: 0 5px; font-size: 9px; }
.qm-g-chips { padding: 2px 3px 3px; }
.qm-grupo.qm-cerrado .qm-g-chips { display: none; }
.qm-n.qm-ex { background: var(--qm-ex); color: #5a4500; }
.qm-n.qm-lib { background: #c9d2e0; color: #333; }
.qm-n.qm-atest { text-decoration: underline dotted; }
.qm-cod { font-size: 9.5px; font-weight: 700; color: #7c3aed; }
.qm-turno-i { font-size: 9px; font-style: normal; color: #20304d; background: #dbe3f0; border-radius: 3px; padding: 0 3px; font-weight: 700; }
/* Fase r33: fila ATESTADO destacada en gris + botón «+» para sumar agentes a un turno */
table.qm tr.qm-atest-row > td { background: #e8ecf1; }
table.qm tr.qm-atest-row > td.qm-puesto { background: #dde3ec; }
.qm-add { display: block; margin: 3px auto 1px; width: 22px; height: 18px; line-height: 15px; border: 1.5px dashed #b6c0d4; border-radius: 5px; background: rgba(255,255,255,.65); color: #5b6b8c; font-size: 12px; font-weight: 700; cursor: pointer; padding: 0; }
.qm-add:hover { border-style: solid; border-color: #4a6fa5; color: #2e4a75; background: #fff; }
/* Fase A: día de HOY resaltado, resumen del día e impresión del mes */
th.qm-dia { cursor: pointer; }
/* barra de navegación por semanas del cuadrante del servicio (clon del mensual) */
.qm-serv-barra { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; flex-wrap: wrap; }
.qm-serv-barra .qm-serv-rango { font-weight: 800; letter-spacing: .4px; color: var(--text); }
.qm-serv-barra .btn[disabled] { opacity: .45; cursor: not-allowed; }
th.qm-hoy { background: #d9534f !important; color: #fff !important; box-shadow: inset 0 0 0 2px #a52a25; }
td.qm-hoycol { box-shadow: inset 2.5px 0 0 #d9534f, inset -2.5px 0 0 #d9534f; }
.qm-marca-top-btns { display: flex; gap: 4px; flex: none; }
.qm-resumen-pop { width: 420px; }
.qm-resumen-cuerpo { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 8px; background: #fff; }
.qm-resumen-fila { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; border-bottom: 1px dashed #e3e8f2; padding-bottom: 6px; }
.qm-resumen-fila:last-child { border-bottom: 0; padding-bottom: 0; }
.qm-resumen-etq { flex: none; width: 74px; font-size: 10.5px; font-weight: 700; color: #20304d; text-transform: uppercase; letter-spacing: .3px; }
.qm-resumen-n { flex: none; min-width: 22px; text-align: center; font-size: 11px; font-weight: 800; color: #fff; background: #20304d; border-radius: 9px; padding: 1px 6px; }
.qm-resumen-chips { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 3px; }
.qm-resumen-pie { flex: none; padding: 8px 10px; border-top: 1px solid #dde3ee; display: flex; justify-content: flex-end; gap: 6px; background: #f6f8fc; }
/* marca PERSISTENTE del día elegido en el cuadrante del servicio */
.quad-celda-marcada { background: #fdeceb !important; box-shadow: inset 2.5px 0 0 #d9534f, inset -2.5px 0 0 #d9534f; }
th.quad-th-marcada, th.quad-th-marcada .quad-fecha { background: #d9534f !important; color: #fff !important; }
th.quad-th-marcada .badge { background: #fff !important; color: #a52a25 !important; }
/* ficha «Generación y versiones»: versiones y evento lado a lado */
.ctab-gestion-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; margin-top: 14px; }
@media (max-width: 1100px) { .ctab-gestion-grid { grid-template-columns: 1fr; } }
/* cards plegables (Generar cuadrante / Evento extraordinario) */
.card-plegar { float: right; border: 1px solid #4a5a75; background: transparent; color: inherit; border-radius: 6px; width: 26px; height: 24px; cursor: pointer; font-size: 12px; line-height: 1; font-family: inherit; }
.card-plegar:hover { background: rgba(255,255,255,.12); }
/* icono ⓘ de resumen en la cabecera de cada día */
.qm-th-i { display: inline-block; width: 13px; height: 13px; border-radius: 50%; background: #20304d; color: #fff; font-size: 9px; font-weight: 800; font-style: italic; line-height: 13px; text-align: center; vertical-align: middle; margin-left: 2px; }
th.qm-hoy .qm-th-i { background: #fff; color: #d9534f; }
/* botón con texto en la barra superior del editor del mensual */
.qm-marca-x { flex: none; }
.qm-marca-wide { width: auto !important; padding: 0 8px !important; font-size: 11px !important; font-weight: 600; white-space: nowrap; }
@media print {
  body.printing-qm * { visibility: hidden; }
  body.printing-qm #cuad-mensual, body.printing-qm #cuad-mensual * { visibility: visible; }
  body.printing-qm #cuad-mensual { position: absolute; inset: 0; width: 100%; }
  body.printing-qm .qm-scroll { overflow: visible !important; }
  body.printing-qm .qm-barra .qm-leyenda { display: none !important; }
  body.printing-qm .qm-resumen-pop, body.printing-qm .qm-marca-pop { display: none !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}


/* ---------- Fase C: formato ClarIo, agentes en columna y mini-totales ---------- */
.seg-sep { flex: none; width: 1px; align-self: stretch; background: var(--border); margin: 4px 2px; }
.qm-th-tot { display: inline-block; font-size: 9px; font-weight: 800; letter-spacing: .5px; background: rgba(255,255,255,.22); border-radius: 8px; padding: 0 5px; margin-left: 2px; vertical-align: middle; }
th.qm-hoy .qm-th-tot { background: rgba(255,255,255,.38); }

/* Modo columna (formato Excel del mensual): agentes apilados verticalmente */
.qm-col table.qm td { vertical-align: top; }
.qm-col .qm-g-chips { display: flex; flex-direction: column; align-items: stretch; gap: 1px; max-height: 300px; overflow-y: auto; padding: 2px; }
.qm-col .qm-n { display: flex; justify-content: space-between; align-items: center; gap: 4px; width: 100%; box-sizing: border-box; margin: 0; padding: 1px 5px; text-align: left; }
.qm-col .qm-n .chip-nom, .qm-col .qm-n .qm-turno-i, .qm-col .qm-n .qm-cod { flex: none; }
.qm-n-ap { font-weight: 600; font-size: 10px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Formato ClarIo: tarjetas de día con secciones por turno */
.clario-scroll { overflow-x: auto; padding-bottom: 6px; }
.cl-semana { display: grid; grid-template-columns: repeat(7, minmax(168px, 1fr)); gap: 8px; margin-bottom: 14px; min-width: 1240px; }
.cl-dia { background: #fff; border: 1px solid #c6cede; border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 1px 3px rgba(16,24,40,.08); }
.cl-dia.cl-vacia { background: transparent; border: 0; box-shadow: none; }
.cl-dia.cl-fuera { opacity: .5; }
.cl-dia.cl-festivo .cl-head { background: #6d5a1e; }
.cl-dia.cl-hoy { border: 2px solid #d9534f; box-shadow: 0 0 0 3px rgba(217,83,79,.18); }
.cl-head { display: flex; align-items: baseline; gap: 6px; width: 100%; border: 0; background: #20304d; color: #fff; padding: 6px 8px; cursor: pointer; font-family: inherit; text-align: left; }
.cl-head:hover { filter: brightness(1.15); }
.cl-dnom { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; opacity: .85; }
.cl-dnum { font-size: 17px; font-weight: 800; }
.cl-tot { margin-left: auto; font-size: 9.5px; font-weight: 800; background: rgba(255,255,255,.22); border-radius: 8px; padding: 1px 6px; }
.cl-sec { border-bottom: 1px dashed #e6eaf2; padding: 4px 6px 5px; }
.cl-sec-h { display: flex; align-items: center; gap: 5px; margin-bottom: 3px; }
.cl-sec-h b { font-size: 10px; color: #20304d; background: #e8edf6; border-radius: 8px; padding: 0 6px; }
.cl-hor { margin-left: auto; font-size: 9px; color: var(--muted); }
.cl-t { display: inline-block; width: 16px; height: 16px; border-radius: 4px; color: #fff; font-size: 10px; font-weight: 800; text-align: center; line-height: 16px; }
.cl-t-M { background: #2f7d4f; }
.cl-t-T { background: #b3641c; }
.cl-t-N { background: #3a4a75; }
.cl-t-lib { background: #8a97ab; }
.cl-chips { display: flex; flex-direction: column; gap: 2px; }
.cl-chips .qm-grupo { margin: 0; }
.cl-chips .qm-g-chips { display: flex; flex-direction: column; gap: 1px; }
.cl-chips .qm-n { display: flex; justify-content: space-between; align-items: center; margin: 0; }
/* ClarIo + agentes en línea: cabecera del grupo ARRIBA y sus agentes
   en chips horizontales DEBAJO. En columna se mantiene lo de arriba. */
.cl-chips.cl-chips-linea { flex-direction: row; flex-wrap: wrap; gap: 5px; align-items: flex-start; }
.cl-chips.cl-chips-linea .qm-grupo { display: inline-flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 2px 3px 3px; }
.cl-chips.cl-chips-linea .qm-g-head { width: auto; align-self: flex-start; border-radius: 4px; padding: 0 5px; line-height: 1.7; }
.cl-chips.cl-chips-linea .qm-g-chips { display: flex; flex-direction: row; flex-wrap: wrap; gap: 2px; padding: 0; }
.cl-chips.cl-chips-linea .qm-n { display: inline-flex; justify-content: flex-start; margin: 0; white-space: nowrap; }
.cl-vacio { color: var(--muted); font-size: 10.5px; }
.cl-sec-lib { background: #f4f6fa; }
.cl-extra { padding: 4px 6px 5px; border-top: 1px solid #eef1f7; }
.cl-extra-t { display: block; font-size: 8.5px; font-weight: 800; letter-spacing: .6px; color: #8a97ab; margin-bottom: 2px; }
.cl-extra .qm-n { display: flex; justify-content: space-between; }

@media print {
  body.printing-qm .clario-scroll { overflow: visible !important; }
}

/* ---------- MODO NOCHE: cuadrante mensual, servicio (tablas qm) y formato ClarIo ----------
   Estas vistas nacieron con colores claros fijos (calco del Excel del jefe);
   aquí se adaptan al tema oscuro manteniendo el código de color profesional. */
[data-theme="dark"] table.qm { background: var(--surface); color: var(--text); }
[data-theme="dark"] table.qm th, [data-theme="dark"] table.qm td { border-color: #3a4a63; }
[data-theme="dark"] table.qm .qm-turno { background: #26334d; color: var(--text); }
[data-theme="dark"] table.qm .qm-puesto { background: #2b3a55; color: var(--text); }
[data-theme="dark"] table.qm td.qm-festivo { background: #4a3d15; color: #f5e3b3; }
[data-theme="dark"] table.qm th.qm-fuera-h, [data-theme="dark"] table.qm td.qm-fuera { background: #1b2436; color: var(--text-soft); }
[data-theme="dark"] .qm-n.qm-lib { background: #39485f; color: #dbe3f0; }
[data-theme="dark"] .qm-turno-i { color: #c8d4e8; background: #2b3a55; }
[data-theme="dark"] table.qm tr.qm-atest-row > td { background: #232f47; }
[data-theme="dark"] table.qm tr.qm-atest-row > td.qm-puesto { background: #2b3a55; }
[data-theme="dark"] .qm-add { border-color: #4a5a75; background: rgba(255,255,255,.06); color: #93a1b8; }
[data-theme="dark"] .qm-add:hover { border-color: #6f8fc9; color: #c8d8f5; background: var(--surface-2); }
/* popups de marca, pestañas y listas de agentes */
[data-theme="dark"] .qm-marca-pop { background: var(--surface); border-color: #3a4a63; }
[data-theme="dark"] .qm-pop-tabs { background: #20293f; border-color: var(--border); }
[data-theme="dark"] .qm-tab { color: #b6c2d6; }
[data-theme="dark"] .qm-tab.on[data-qm-tab="marca"] { background: var(--surface); color: var(--text); }
[data-theme="dark"] .qm-pop-grupo { background: var(--surface); }
[data-theme="dark"] .qm-fila-agente { background: #1b2740; border-color: var(--border); color: var(--text); }
[data-theme="dark"] .qm-fila-agente:hover { border-color: #6f8fc9; background: var(--surface); }
[data-theme="dark"] .qm-fila-agente.yo { border-color: #6f8fc9; box-shadow: inset 0 0 0 1px #6f8fc9; }
[data-theme="dark"] .qm-fila-placa { color: #c8d4e8; }
[data-theme="dark"] .qm-est-trabaja { background: #14532d; color: #86efac; }
[data-theme="dark"] .qm-est-libre { background: #2b3648; color: #b6c2d6; }
[data-theme="dark"] .qm-est-aus { background: #5c3a14; color: #fdba74; }
[data-theme="dark"] .qm-est-marca { background: #3b2a63; color: #c4b5fd; }
[data-theme="dark"] .qm-est-puesto { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .qm-grupo { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .dia-menu-op { color: var(--text); }
[data-theme="dark"] .dia-menu-op:hover { background: var(--surface-2); }
[data-theme="dark"] .dia-menu-op svg { color: #e8a13c; }
[data-theme="dark"] .dia-menu-op[data-dm-evento] svg { color: #f87171; }
/* resumen del día */
[data-theme="dark"] .qm-resumen-cuerpo { background: var(--surface); }
[data-theme="dark"] .qm-resumen-fila { border-color: var(--border); }
[data-theme="dark"] .qm-resumen-etq { color: #c8d4e8; }
[data-theme="dark"] .qm-resumen-pie { border-color: var(--border); background: var(--surface-2); }
/* marca persistente del día */
[data-theme="dark"] .quad-celda-marcada { background: #4a2624 !important; }
[data-theme="dark"] .cl-serv-dia.quad-celda-marcada { background: #4a2624; }
/* formato ClarIo: tarjetas de día */
[data-theme="dark"] .cl-dia { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .cl-sec { border-color: var(--border); }
[data-theme="dark"] .cl-sec-h b { color: var(--text); background: var(--surface-2); }
[data-theme="dark"] .cl-sec-lib { background: var(--surface-2); }
[data-theme="dark"] .cl-extra { border-color: var(--border); }
[data-theme="dark"] .cl-extra-t { color: var(--text-soft); }

/* ---------- C2.2 · Servicio en formato ClarIo: celdas como tarjetas de día ---------- */
.cl-serv-semana { grid-template-columns: repeat(7, minmax(152px, 1fr)); min-width: 1200px; }
.cl-serv-dia .cl-serv-head { cursor: default; }
.cl-serv-dia .cl-serv-fecha { margin-left: auto; font-size: 9px; opacity: .8; }
.cl-serv-dia div.quad-celda { display: block; min-height: 20px; padding: 1px 2px; border-radius: 6px; cursor: pointer; }
.cl-serv-dia div.quad-celda[data-turno]:hover { background: var(--surface-2); }
.cl-serv-dia div.quad-celda.quad-celda-sel { outline: 2px solid var(--accent-warn, #e8a13c); outline-offset: -2px; }
.cl-serv-dia.quad-celda-marcada { background: #fdeceb; box-shadow: inset 0 0 0 2px #d9534f; }
.cl-t-aus { background: #c9a227; }
.cl-serv-dia .cl-sec-aus { border-bottom: 0; }

/* Unificación de formatos: el servicio en Excel usa los mismos bloques de grupo
   que el mensual; las celdas necesitan algo más de anchura */
#cuad-grid table.quad td.quad-celda { min-width: 118px; vertical-align: top; }
#cuad-grid .qm-grupo { min-width: 96px; }

/* ---------- C2.3 · Vista anual en formato ClarIo ---------- */
.pa-meses.pa-clario .pa-mes { border-radius: 14px; box-shadow: 0 1px 3px rgba(16,24,40,.08); }
.pa-meses.pa-clario .pa-t { border-radius: 7px; height: 16px; font-size: 9px; }
.pa-meses.pa-clario .pa-dia { border-radius: 8px; }
.pa-mes-amplio-caja .cl-chips { min-height: 18px; }

/* ---------- VERSIONADO ANUAL: banda histórica, botón dorado y listado ---------- */
.hist-banda {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin: 0 0 10px; padding: 9px 12px;
  background: #fff8e1; border: 1.5px solid #d9b64f; border-left: 5px solid #d9a400;
  border-radius: 8px; color: #6b5200; font-size: 13px; font-weight: 600;
}
.hist-banda .btn { margin-left: auto; white-space: nowrap; }
.btn-hist {
  background: linear-gradient(180deg, #ffe9a8, #f5d063) !important;
  border-color: #c9a227 !important; color: #5c4400 !important; font-weight: 700;
}
.ver-lista { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto; }
.ver-fila {
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
}
.ver-fila-txt { display: flex; flex-direction: column; gap: 2px; }
.ver-principal {
  border: 1.5px solid #d9b64f; border-left: 5px solid #d9a400;
  background: linear-gradient(180deg, #fff8e1, #fdf3cf);
}
.ver-fila-principal td { background: #fff8e1; }
/* Modo noche: el dorado histórico pasa a tonos tostados oscuros */
[data-theme="dark"] .hist-banda { background: #3a2f10; border-color: #8a6d1f; border-left-color: #d9a400; color: #f5d063; }
[data-theme="dark"] .btn-hist { background: linear-gradient(180deg, #8a6d1f, #6b5410) !important; border-color: #d9a400 !important; color: #ffe9a8 !important; }
[data-theme="dark"] .ver-principal { background: linear-gradient(180deg, #3a2f10, #2e2610); border-color: #8a6d1f; border-left-color: #d9a400; }
[data-theme="dark"] .ver-fila-principal td { background: #3a2f10; }
/* r109 §3.5 — Banda roja de altas/bajas de agente en el mes */
.hj-anot-banda {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  margin: 0 0 10px; padding: 8px 12px;
  background: #fdecec; border: 1.5px solid #e3a4a4; border-left: 5px solid #c92a2a;
  border-radius: 8px; color: #8a1f1f; font-size: 13px; font-weight: 600;
}
.hj-anot-dot { font-size: 9px; }
[data-theme="dark"] .hj-anot-banda { background: #3a1515; border-color: #7a2e2e; border-left-color: #e03131; color: #ffb3b3; }
/* Filas del panel: altura uniforme y pastilla discreta de «viéndose ahora» */
.ver-fila { min-height: 58px; }
.ver-ahora { flex: none; font-size: 10.5px; font-weight: 800; letter-spacing: .3px; padding: 3px 9px; border-radius: 999px;
  background: var(--brand-primary-soft, rgba(30,94,255,.14)); color: var(--brand-primary, #1e5eff); border: 1px solid color-mix(in srgb, var(--brand-primary, #1e5eff) 35%, transparent); }
.ver-resumen-linea { margin: 0 0 8px; font-size: 12.5px; font-weight: 700; color: var(--text-soft, #5a6577); }
.ver-resumen-linea b { color: var(--text, #182133); }
.ver-fila-abierta { border-color: var(--brand-primary, #1e5eff); border-left: 5px solid var(--brand-primary, #1e5eff); }

/* ============ Puesto de escritorio del agente (Fases A/B) ============ */
/* Resaltado de los chips propios del agente autenticado: anillo azul corporativo
   con pulso de luz que respira. Así destaca de un vistazo en todo el cuadrante
   sin recurrir a parpadeos rojos (reservados para alarmas reales). */
.ag-propio {
  outline: 2.5px solid var(--brand-primary, #2f6fed);
  outline-offset: 1px;
  border-radius: 6px;
  animation: ag-propio-pulso 1.8s ease-in-out infinite;
}
@keyframes ag-propio-pulso {
  0%, 100% { box-shadow: 0 0 4px rgba(47, 111, 237, .45); }
  50% { box-shadow: 0 0 16px 3px rgba(47, 111, 237, .85); }
}
@media (prefers-reduced-motion: reduce) {
  .ag-propio { animation: none; box-shadow: 0 0 6px rgba(47, 111, 237, .55); }
}

/* Home del puesto: píldora de estado, hero con escudo y tarjetas. */
.ag-home { max-width: 1080px; margin: 0 auto; }
.ag-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .4px;
  color: var(--text-soft, #5b6b83);
  background: var(--surface-2);
  border: 1px solid var(--border, #dde3ec);
  border-radius: 999px; padding: 6px 14px; margin-bottom: 22px;
}
.ag-pill-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .25);
  animation: ag-pulse 2s ease-in-out infinite;
}
@keyframes ag-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, .25); }
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, .12); }
}
.ag-hero {
  display: flex; align-items: center; gap: 22px;
  margin-bottom: 28px; padding: 6px 2px;
}
.ag-hero-logo {
  width: 84px; height: 84px; object-fit: contain; flex: none;
  filter: drop-shadow(0 4px 10px rgba(15, 40, 90, .18));
}
.ag-hero-tit {
  margin: 0; font-size: 30px; line-height: 1.18; font-weight: 800;
  color: var(--text, #17233c); letter-spacing: -.3px;
}
.ag-hero-tit em {
  font-style: normal;
  color: var(--brand-primary, #2f6fed);
}
.ag-hero-lema {
  margin-top: 6px; font-size: 13.5px; font-weight: 600;
  color: var(--text-soft, #5b6b83); letter-spacing: .3px;
}
/* Hero centrado del puesto del agente: escudo en medio y nombre de la corporación debajo. */
.ag-hero-centro {
  flex-direction: column; justify-content: center; text-align: center;
  gap: 12px; padding: 14px 2px 20px;
}
.ag-hero-centro .ag-hero-logo {
  width: auto; height: 170px; max-width: 220px; object-fit: contain;
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, .35));
}
.ag-hero-org {
  font-family: "Arial Black", "Archivo Black", "Segoe UI", Arial, sans-serif;
  font-style: italic; font-weight: 900; font-size: 32px; letter-spacing: .5px;
  line-height: 1; white-space: nowrap;
}
.ag-hero-org .ag-t-a { color: var(--text, #17233c); }
.ag-hero-org .ag-t-b { color: var(--brand-primary, #2f6fed); }
.ag-hero-motto {
  font-size: 11.5px; font-weight: 600; letter-spacing: 5px;
  color: var(--text-soft, #5b6b83); text-transform: uppercase;
}
/* Halo de luz azul que respira detrás del escudo (efecto estilo escudo Protección Civil, en azules). */
.ag-logo-glow {
  position: relative; display: grid; place-items: center; padding: 20px;
}
.ag-logo-glow::before, .ag-logo-glow::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(56, 120, 255, .8), rgba(56, 120, 255, 0) 70%);
  filter: blur(10px); animation: ag-pulso 4s ease-in-out infinite;
}
.ag-logo-glow::after {
  inset: 10px;
  background: radial-gradient(closest-side, rgba(150, 200, 255, .65), rgba(150, 200, 255, 0) 68%);
  animation-duration: 5.5s; animation-delay: -2.2s;
}
.ag-logo-glow img { position: relative; z-index: 1; }
/* Luz azul fija pegada a la silueta de la placa: garantiza que el resplandor se
   aprecie siempre, incluso en fondos claros, mientras los halos respiran. */
.ag-hero-centro .ag-hero-logo {
  filter: drop-shadow(0 0 26px rgba(70, 130, 255, .6)) drop-shadow(0 8px 22px rgba(0, 0, 0, .35));
}
@keyframes ag-pulso {
  0%, 100% { transform: scale(.85); opacity: .55; }
  50% { transform: scale(1.18); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .ag-logo-glow::before, .ag-logo-glow::after { animation: none; opacity: .7; }
}
/* Píldora de operador integrada en la barra de cabecera (misma línea que el título). */
.topbar .ag-pill { margin: 0; white-space: nowrap; }
/* Contador de inactividad del puesto del agente. */
#ag-inact-contador {
  display: inline-block; min-width: 3.2ch; text-align: center;
  font-variant-numeric: tabular-nums; font-weight: 700;
  padding: 1px 7px; border-radius: 8px; background: rgba(100, 116, 139, .12);
}
#ag-inact-contador.ag-inact-alerta { background: rgba(220, 38, 38, .12); color: #dc2626; }
/* Últimos 5 segundos de la cuenta atrás: número grande y rojo. */
#inact-cuenta.inact-final { color: #dc2626; font-size: 30px; font-weight: 800; }

/* ---------- Filtros y resaltados del «Mi cuadrante» del agente ---------- */
/* Fila de herramientas: conmutadores de formato a la izquierda, filtros a la derecha. */
.ag-cuad-herram { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.ag-cuad-herram > .seg { flex: 1; min-width: 460px; }
/* Botón con insignia (nº de filtros fuera de lo habitual). */
.ag-filtros-wrap { position: relative; }
.agf-insignia {
  display: inline-block; min-width: 17px; text-align: center;
  background: var(--brand-primary, #2f6fed); color: #fff;
  border-radius: 999px; font-size: 10.5px; font-weight: 800; padding: 1px 5px;
}
/* Panel desplegable: secciones ordenadas, interruptores pequeños. */
.agf-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60;
  width: 300px; background: var(--surface); border: 1px solid var(--border, #dde3ec);
  border-radius: 14px; box-shadow: 0 14px 40px rgba(10, 25, 60, .28);
  padding: 12px 14px;
}
.agf-tit { font-size: 12.5px; font-weight: 800; letter-spacing: .4px; margin-bottom: 6px; }
.agf-sec {
  font-size: 10px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--text-soft, #5b6b83); margin: 10px 0 4px;
  padding-top: 8px; border-top: 1px solid var(--border, #dde3ec);
}
.agf-sec:first-of-type { border-top: 0; padding-top: 0; margin-top: 4px; }
.agf-op {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 2px; border-radius: 8px; cursor: pointer;
}
.agf-op:hover { background: rgba(100, 116, 139, .08); }
.agf-op input { position: absolute; opacity: 0; pointer-events: none; }
.agf-sw {
  flex: none; width: 30px; height: 17px; border-radius: 999px;
  background: rgba(100, 116, 139, .35); position: relative; transition: background .2s;
}
.agf-sw::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px;
  border-radius: 50%; background: #fff; transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.agf-op input:checked + .agf-sw { background: var(--brand-primary, #2f6fed); }
.agf-op input:checked + .agf-sw::after { transform: translateX(13px); }
.agf-txt { display: flex; flex-direction: column; line-height: 1.25; }
.agf-txt b { font-size: 12.5px; font-weight: 700; }
.agf-txt small { font-size: 11px; color: var(--text-soft, #5b6b83); }
.agf-pie { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border, #dde3ec); text-align: right; }

/* Barra resumen «Mi semana». */
.ag-misemana {
  display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 12px;
}
.ag-ms-bloque {
  flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border, #dde3ec);
  border-radius: 12px; padding: 9px 14px;
}
.ag-ms-yo {
  background: rgba(47, 111, 237, .09);
  border-color: rgba(47, 111, 237, .45);
  box-shadow: inset 3px 0 0 var(--brand-primary, #2f6fed);
}
.ag-ms-etq {
  font-size: 9.5px; font-weight: 800; letter-spacing: 1.4px;
  color: var(--text-soft, #5b6b83);
}
.ag-ms-yo .ag-ms-etq { color: var(--brand-primary, #2f6fed); }
.ag-ms-bloque b { font-size: 13px; }

/* Modo foco: el resto de la plantilla se apaga muy tenue; yo sigo a color.
   Transición suave para que el cambio no sea brusco. */
.qm-n { transition: opacity .45s ease, filter .45s ease; }
#cuad-grid-card.agf-foco .qm-n:not(.ag-propio) { opacity: .16; filter: saturate(.25); }
/* Chapa «TÚ» sobre mi chip en modo foco. */
#cuad-grid-card.agf-foco .ag-propio { position: relative; }
#cuad-grid-card.agf-foco .ag-propio::after {
  content: "TÚ"; position: absolute; top: -9px; right: -7px;
  background: var(--brand-primary, #2f6fed); color: #fff;
  font-size: 8px; font-weight: 800; letter-spacing: .5px;
  border-radius: 999px; padding: 1px 5px; box-shadow: 0 2px 6px rgba(15, 40, 90, .4);
}
/* Día de hoy: chip con subrayado azul y celdas/cabeceras con fondo suave. */
.ag-hoy {
  box-shadow: inset 0 -3px 0 var(--brand-primary, #2f6fed);
  background: rgba(47, 111, 237, .10);
}
td.ag-hoy-col, th.ag-hoy-col { background: rgba(47, 111, 237, .07); }
/* Días pasados: se ven al 55 %, sin color; el ojo va al presente. */
.ag-pasado { opacity: .5; filter: saturate(.4); }
/* Filtro «Marcar mis casillas»: borde y fondo azul donde trabajo. En el
   servicio y en el anual se marca la casilla completa; en el mensual, donde
   cada fila es un agente, la fila entera lleva filete azul. */
#cuad-grid .quad-celda.ag-celda-propio,
#cuad-anual .quad-celda.ag-celda-propio {
  outline: 2px solid var(--brand-primary, #2f6fed);
  outline-offset: -2px;
  background: rgba(47, 111, 237, .10);
  border-radius: 4px;
}
#cuad-mensual tr.ag-fila-propio td {
  background: rgba(47, 111, 237, .08);
  box-shadow: inset 0 2px 0 var(--brand-primary, #2f6fed), inset 0 -2px 0 var(--brand-primary, #2f6fed);
}
#cuad-mensual tr.ag-fila-propio td:first-child {
  box-shadow: inset 2px 0 0 var(--brand-primary, #2f6fed), inset 0 2px 0 var(--brand-primary, #2f6fed), inset 0 -2px 0 var(--brand-primary, #2f6fed);
}
#cuad-mensual tr.ag-fila-propio td:last-child {
  box-shadow: inset -2px 0 0 var(--brand-primary, #2f6fed), inset 0 2px 0 var(--brand-primary, #2f6fed), inset 0 -2px 0 var(--brand-primary, #2f6fed);
}
#cuad-mensual tr.ag-fila-propio td:only-child { box-shadow: inset 0 0 0 2px var(--brand-primary, #2f6fed); }
@media (prefers-reduced-motion: reduce) {
  .qm-n { transition: none; }
}
.ag-cards {
  display: grid; gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 1080px) { .ag-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .ag-cards { grid-template-columns: 1fr; } }
.ag-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border, #dde3ec);
  border-radius: 14px; padding: 20px 20px 14px;
  text-decoration: none; color: inherit;
  box-shadow: 0 2px 10px rgba(15, 40, 90, .06);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
a.ag-card:hover {
  transform: translateY(-3px);
  border-color: var(--brand-primary, #2f6fed);
  box-shadow: 0 10px 26px rgba(47, 111, 237, .16);
}
.ag-card.off { opacity: .62; cursor: default; }
.ag-card-ico {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand-primary, #2f6fed), #16407c);
  color: #fff; margin-bottom: 4px;
}
.ag-card-ico svg { width: 24px; height: 24px; }
.ag-card.off .ag-card-ico { background: linear-gradient(135deg, #8b98ad, #6b7789); }
.ag-card-tit { font-size: 15.5px; font-weight: 800; letter-spacing: .3px; color: var(--text, #17233c); }
.ag-card-sub { font-size: 13px; color: var(--text-soft, #5b6b83); line-height: 1.45; min-height: 36px; }
.ag-card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 8px; padding-top: 10px;
  border-top: 1px solid var(--border, #dde3ec);
  font-size: 12.5px; font-weight: 600; color: var(--brand-primary, #2f6fed);
}
.ag-card.off .ag-card-foot { color: var(--text-soft, #5b6b83); }
.ag-card-flecha { font-size: 16px; transition: transform .15s ease; }
a.ag-card:hover .ag-card-flecha { transform: translateX(4px); }
.ag-card-tag {
  font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  background: var(--surface-2); border: 1px dashed var(--border, #c6cfdd);
  border-radius: 999px; padding: 3px 10px;
}
.ag-home-pie {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 26px; padding-top: 16px;
  border-top: 1px solid var(--border, #dde3ec);
}

/* ---------- Fase C4 — expedientes (candado, fases, bandeja, historial) ---------- */
.exp-candado {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: repeating-linear-gradient(45deg, rgba(214, 69, 65, .10), rgba(214, 69, 65, .10) 12px, rgba(214, 69, 65, .05) 12px, rgba(214, 69, 65, .05) 24px);
  border: 1.5px solid #d64541; border-radius: 10px; padding: 12px 14px; margin-bottom: 12px;
  color: var(--text, #1c2b45);
}
.exp-fase-bloque {
  border: 1.5px solid var(--border, #d6dce8); border-left: 4px solid #3891dc;
  border-radius: 10px; padding: 12px 14px; margin-top: 12px; background: var(--card, #fff);
}
.exp-bandeja { background: var(--card, #fff); }
.exp-sol-fila {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 8px 0; border-top: 1px dashed var(--border, #d6dce8);
}
.exp-sol-fila:first-of-type { border-top: 0; }
table.exp-historial { width: 100%; border-collapse: collapse; font-size: .85em; }
table.exp-historial th, table.exp-historial td {
  text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border, #d6dce8); vertical-align: top;
}
table.exp-historial th { position: sticky; top: 0; background: var(--card, #fff); z-index: 1; }
table.exp-historial td { word-break: break-word; }

/* ---------- Fase 4 (D5): vista anual «12 hojas» (estilo Excel) ---------- */
/* r123 — pestañas reforzadas: inactivas gris con borde visible, activa AZUL
   con texto blanco (el mismo azul de los iconos de paso del asistente). */
.hj-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 3px solid var(--accent, #1e3a8a); margin-bottom: 10px; }
.hj-tab { background: var(--chip, #eef1f7); border: 1px solid var(--border, #c6cede); border-bottom: 0; border-radius: 8px 8px 0 0; padding: 8px 14px; font-size: 13px; font-weight: 700; letter-spacing: .4px; color: var(--text, #101828); cursor: pointer; }
.hj-tab:hover { background: var(--surface-2, #e4e9f2); }
.hj-tab.on { background: var(--accent, #1e3a8a); border-color: var(--accent, #1e3a8a); color: #fff; box-shadow: none; }
.hj-candado { font-size: 10px; }
.hj-hoy-marca { display: inline-block; font-size: 8.5px; font-weight: 800; background: var(--accent, #1e3a8a); color: #fff; border-radius: 7px; padding: 0 5px; margin-left: 3px; vertical-align: middle; }
.hj-barra { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.hj-titulo-hoja { margin: 4px 0 8px; font-size: 15px; text-transform: capitalize; }
.hj-scroll { overflow: auto; max-height: 72vh; border: 1px solid var(--border, #c6cede); border-radius: 10px; }
.hj-tabla { border-collapse: separate; border-spacing: 0; font-size: 11px; min-width: 100%; }
.hj-tabla th, .hj-tabla td { border-bottom: 1px solid var(--border, #e4e7ec); border-right: 1px solid var(--border, #eef1f4); padding: 0; text-align: center; }
.hj-th { background: var(--head, #f2f4f8); font-weight: 800; padding: 4px 2px !important; min-width: 22px; position: sticky; top: 0; z-index: 3; }
.hj-th .hj-th-n { display: block; font-size: 11px; line-height: 1.1; }
.hj-th .hj-th-d { display: block; font-size: 8.5px; font-weight: 700; opacity: .7; line-height: 1.2; }
.hj-th-sab { background: #fde68a !important; color: #713f12; }
.hj-th-dom { background: #f87171 !important; color: #fff; }
.hj-th-fest { background: #dc2626 !important; color: #fff; }
/* En noche se suavizan los semáforos para que no deslumbren, manteniendo el código de color */
[data-theme="dark"] .hj-th-sab { background: #7a6a2a !important; color: #fde68a; }
[data-theme="dark"] .hj-th-dom { background: #7f2f2f !important; color: #ffd9d9; }
[data-theme="dark"] .hj-th-fest { background: #8f2a2a !important; color: #ffd9d9; }
.hj-th-hoy { box-shadow: inset 0 -3px 0 var(--accent, #1e3a8a); }
.hj-th-ag { position: sticky; top: 0; left: 0; z-index: 4; min-width: 190px; text-align: left !important; padding: 4px 10px !important; background: var(--head, #f2f4f8); }
.hj-th-res { position: sticky; right: 0; z-index: 4; }
.hj-banda td { text-align: left !important; padding: 5px 10px !important; font-size: 11.5px; background: var(--chip, #eef1f7); cursor: pointer; position: sticky; left: 0; }
.hj-banda-punto { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.hj-agente { text-align: left !important; padding: 3px 8px !important; white-space: nowrap; position: sticky; left: 0; background: var(--card, #fff); z-index: 2; font-size: 11px; }
.hj-c { height: 22px; min-width: 22px; font-weight: 700; font-size: 10.5px; }
.hj-hoy { outline: 2px solid var(--accent, #1e3a8a); outline-offset: -2px; }
.hj-res { font-weight: 800; background: var(--chip, #f6f8fb); position: sticky; right: 0; min-width: 34px; }
/* r132 — totales de la hoja mensual: mismo aspecto que .hj-res pero SIN
   sticky derecho (con el bloque de nomenclaturas el scroll horizontal es real
   y dos sticky right:0 se solaparían). TOTALES conserva .hj-th-res/.hj-res. */
.hj-tot { background: var(--head, #f2f4f8); font-weight: 800; min-width: 40px; }
.hj-totc { font-weight: 800; background: var(--chip, #f6f8fb); min-width: 40px; }
.hj-nomc { min-width: 34px; font-size: 10.5px; font-weight: 700; color: var(--muted, #667085); }
.hj-th-nom { font-size: 10px; min-width: 34px; white-space: nowrap; padding: 4px 3px !important; }
/* Icono ⓘ de las cabeceras de nomenclatura y del editor de configuración */
.hj-info { display: inline-block; margin-left: 3px; cursor: pointer; color: var(--muted, #667085); font-size: 10px; vertical-align: super; line-height: 1; }
.hj-info:hover { color: var(--accent, #2f6bff); }
/* Cuadro flotante del ⓘ: qué hace el código y referencia del convenio */
.nom-pop { position: fixed; z-index: 70; max-width: 340px; background: var(--card, #fff); border: 1px solid var(--border, #c6cede); border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, .25); padding: 12px 14px; font-size: 12.5px; line-height: 1.45; }
.nom-pop-cod { font-size: 15px; margin-bottom: 4px; }
.nom-pop-desc { margin: 2px 0 6px; font-weight: 600; }
.nom-pop-ayuda { margin: 0 0 6px; color: var(--ink, #1f2937); }
.nom-pop-val { margin: 6px 0 0; padding: 6px 8px; border-radius: 8px; background: color-mix(in srgb, var(--warn, #b45309) 12%, transparent); color: var(--warn, #b45309); font-size: 11.5px; }
.nom-pop-x { position: absolute; top: 6px; right: 8px; border: none; background: transparent; cursor: pointer; font-size: 13px; color: var(--muted, #667085); }
/* r133 — la hoja mensual (12 hojas) pasa a tamaño de lectura cómodo: ya no
   busca caber en pantalla; la columna AGENTE queda fija a la izquierda y el
   resto de columnas se descubre con el scroll horizontal que se oculta bajo
   los agentes. TOTALES (.hj-tabla-resumen) MANTIENE su escala compacta: su
   filosofía es «verlo todo de una pasada». El alcance :not() lo garantiza. */
.hj-tabla:not(.hj-tabla-resumen) { font-size: 13px; }
.hj-tabla:not(.hj-tabla-resumen) .hj-c { height: 30px; min-width: 32px; font-size: 13px; }
.hj-tabla:not(.hj-tabla-resumen) .hj-th { min-width: 32px; padding: 6px 3px !important; }
.hj-tabla:not(.hj-tabla-resumen) .hj-th .hj-th-n { font-size: 13px; }
.hj-tabla:not(.hj-tabla-resumen) .hj-th .hj-th-d { font-size: 10px; }
.hj-tabla:not(.hj-tabla-resumen) .hj-th-ag { min-width: 240px; font-size: 13px; padding: 6px 10px !important; }
.hj-tabla:not(.hj-tabla-resumen) .hj-agente { font-size: 13px; padding: 4px 8px !important; }
.hj-tabla:not(.hj-tabla-resumen) .hj-banda td { font-size: 13px; padding: 7px 10px !important; }
.hj-tabla:not(.hj-tabla-resumen) .hj-nomc { min-width: 46px; font-size: 12.5px; }
.hj-tabla:not(.hj-tabla-resumen) .hj-th-nom { min-width: 46px; font-size: 11.5px; }
.hj-tabla:not(.hj-tabla-resumen) .hj-tot, .hj-tabla:not(.hj-tabla-resumen) .hj-totc { min-width: 52px; font-size: 13px; }
.hj-tabla:not(.hj-tabla-resumen) .hj-info { font-size: 11px; }
/* r134 — control de zoom de la hoja (solo pantalla) */
.hj-zoom-grupo { display: inline-flex; align-items: center; gap: 2px; padding: 0 4px; border: 1px solid var(--border, #c6cede); border-radius: 8px; background: color-mix(in srgb, var(--chip, #f2f4f8) 55%, transparent); }
.hj-zoom-val { min-width: 42px; text-align: center; font-size: 12.5px; font-weight: 800; color: var(--accent, #2f6bff); }
.hj-zoom-grupo .btn { border: none; background: transparent; font-weight: 800; }
.hj-zoom-grupo .btn:hover { background: var(--chip, #eef1f7); }
.hj-vacio { max-width: 640px; margin: 20px auto; }

/* Marca de agua de la simulación del asistente.
   r119: el sello es CSS PURO sobre el contenedor (::before = borde discontinuo,
   ::after = texto). Así es idempotente: por muchos re-pintados JS que haya,
   no puede duplicarse (el div .hj-marca-agua anterior sí podía quedar doble
   con pintados encadenados). Las reglas .hj-marca-agua se conservan por si
   alguna vista antigua aún las usa, pero el asistente ya no pinta ese div. */
.hj-sim-wrap { position: relative; }
.hj-sim-wrap::after { content: "SIMULACIÓN — NO APROBADA"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: rgba(220, 38, 38, .5); font-size: 34px; font-weight: 900; letter-spacing: 5px; transform: rotate(-6deg); pointer-events: none; z-index: 5; }
.hj-marca-agua { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 5; }
.hj-marca-agua::before { content: ""; position: absolute; inset: 30px 10px; border: 3px dashed rgba(220, 38, 38, .45); border-radius: 12px; }
.hj-marca-agua { color: rgba(220, 38, 38, .55); font-size: 26px; font-weight: 900; letter-spacing: 3px; transform: rotate(-8deg); }

/* r119 — paso 4 del asistente: semáforo, filtros y alertas de la simulación */
.as-sim-checks { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.as-sim-check { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border, #c6cede); background: var(--chip, #f2f4f8); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--muted, #667085); }
.as-sim-check:hover { filter: brightness(.97); }
.as-sim-check.ok { border-color: color-mix(in srgb, var(--ok, #15803d) 45%, transparent); color: var(--ok, #15803d); }
.as-sim-check.warn { border-color: color-mix(in srgb, var(--warn, #b45309) 55%, transparent); color: var(--warn, #b45309); }
.as-sim-check.bad { border-color: color-mix(in srgb, var(--danger, #b91c1c) 55%, transparent); color: var(--danger, #b91c1c); }
.as-sim-check.info { border-color: var(--border, #c6cede); }
.as-sim-barra { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; padding: 8px 10px; border: 1px solid var(--line, #e2e8f0); border-radius: 8px; background: color-mix(in srgb, var(--chip, #f2f4f8) 60%, transparent); }
.as-sim-barra input[type="search"] { min-width: 220px; }
.hj-res-alert { position: relative; }
.hj-res-alert::after { content: ""; position: absolute; top: 2px; right: 2px; width: 6px; height: 6px; border-radius: 50%; background: var(--warn, #b45309); }
.hj-fila-dim { opacity: .28; }
tr.hj-fila-oculta, tr.hj-banda-oculta { display: none; }
.as-sim-delta { color: var(--warn, #b45309); font-size: 11px; font-weight: 700; }
/* r120d — al pasar el cursor sobre un agente se resalta TODA su fila: la fila es
   la unidad que se lee (no la celda) y evita confusiones entre líneas de la tabla. */
.hj-sim-wrap .hj-tabla tbody tr.hj-fila:hover td { background: color-mix(in srgb, var(--accent, #2f6bff) 10%, transparent); }

/* Wizard del asistente */
.asis-progreso { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 14px; }
.asis-paso-chip { display: flex; align-items: center; gap: 7px; border: 1px solid var(--border, #c6cede); background: var(--chip, #f2f4f8); border-radius: 999px; padding: 6px 13px 6px 7px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted, #667085); }
.asis-paso-chip:hover { border-color: var(--accent, #1e3a8a); }
.asis-paso-chip.on { background: var(--accent, #1e3a8a); border-color: var(--accent, #1e3a8a); color: #fff; }
.asis-paso-chip.ok .asis-paso-n { background: var(--ok, #15803d); color: #fff; }
.asis-paso-n { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--card, #fff); border: 1px solid var(--border, #c6cede); font-size: 11.5px; font-weight: 800; color: inherit; flex: none; }
/* Paso 1 (informe) resaltado en ámbar mientras esté pendiente: se ve de un vistazo */
.asis-paso-chip.pend-hl { border: 2px solid var(--warn, #b45309); background: rgba(217, 119, 6, .10); color: var(--warn, #b45309); box-shadow: 0 0 0 3px rgba(217, 119, 6, .12); }
.asis-paso-chip.pend-hl .asis-paso-n { border-color: var(--warn, #b45309); background: var(--warn, #b45309); color: #fff; animation: asis-pulso 2s ease-in-out infinite; }
@keyframes asis-pulso { 0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, .45); } 50% { box-shadow: 0 0 0 5px rgba(217, 119, 6, 0); } }
/* Punto ámbar junto al ✓ verde: paso confirmado pero con cambios sin consolidar */
.asis-punto-ambre { width: 9px; height: 9px; border-radius: 50%; background: var(--warn, #d97706); flex: none; box-shadow: 0 0 0 3px rgba(217, 119, 6, .18); }
/* r144 — píldora «Aprobación» ámbar mientras no exista la V1: la confirmación
   del paso 6 (cierre del periodo saliente revisado) no significa que el
   cuadrante esté aprobado; el check verde solo aparece tras «Aprobar V1». */
.asis-paso-chip.pend-aprob { border: 2px solid var(--warn, #b45309); background: rgba(217, 119, 6, .10); color: var(--warn, #b45309); }
.asis-paso-chip.pend-aprob .asis-paso-n { border-color: var(--warn, #b45309); background: var(--warn, #b45309); color: #fff; font-size: 10.5px; }
.asis-cambios-aviso { border: 1px solid rgba(217, 119, 6, .45); background: rgba(217, 119, 6, .08); color: var(--warn, #92400e); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
/* r115 — deudas en la tabla de «horas que arrastran» del asistente */
.asis-sal-neg { color: var(--danger, #b91c1c); font-weight: 700; }
#asis-paso h4 { margin: 4px 0 8px; }

/* Imprimir la hoja del mes visible (vista 12 hojas) */
@media print {
  body.printing-hj * { visibility: hidden; }
  body.printing-hj #cuad-anual, body.printing-hj #cuad-anual * { visibility: visible; }
  body.printing-hj #cuad-anual { position: absolute; inset: 0; width: 100%; }
  body.printing-hj .hj-scroll { overflow: visible !important; max-height: none; zoom: 1 !important; } /* r134: en papel siempre a escala normal */
  /* la barra se reduce al sello «APROBADO»: los botones y filtros no se imprimen */
  body.printing-hj .hj-barra { display: flex !important; justify-content: flex-end; border: none; background: transparent; padding: 0 0 6px; }
  body.printing-hj .hj-barra .btn, body.printing-hj .hj-barra .hj-res-filtro,
  body.printing-hj .hj-barra input, body.printing-hj .hj-barra > .muted { display: none !important; }
  body.printing-hj .sello-aprobado { position: static; transform: none; margin: 0 0 6px; }
  body.printing-hj .hj-jornada-in { border: none; background: transparent; appearance: textfield; -moz-appearance: textfield; width: auto; padding: 0; }

  /* Imprimir la SIMULACIÓN del asistente y el INFORME (r112, I-12/I-15) */
  body.printing-sim > *:not(.print-sim) { display: none !important; }
  body.printing-sim .print-sim { display: block !important; position: absolute; inset: 0; width: 100%; background: #fff; color: #111; }
  body.printing-sim .print-sim .hj-scroll { overflow: visible !important; max-height: none !important; zoom: 1 !important; }
  body.printing-sim .print-sim .hj-tabla { color: #111; }
  body.printing-sim .print-sim .hj-banda { page-break-inside: avoid; }
  body.printing-sim .print-sim .hj-fila { page-break-inside: avoid; }
  /* la hoja TOTALES se imprime limpia: sin iconos de orden, filtros ni campos de jornada */
  body.printing-sim .print-sim .hj-orden-ico, body.printing-sim .print-sim .hj-res-filtro { display: none !important; }
  body.printing-sim .print-sim .hj-jornada-in { border: none; background: transparent; appearance: none; width: auto; padding: 0; }
  body.printing-sim .print-sim .hj-res-vac { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.printing-sim .print-sim-mes { page-break-before: always; }
  body.printing-sim .print-sim-mes:first-of-type { page-break-before: auto; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* En pantalla el contenedor de impresión no se ve (solo existe al imprimir) */
.print-sim { display: none; }
.marca-proyecto { display: inline-block; border: 3px dashed rgba(220, 38, 38, .6); color: rgba(220, 38, 38, .75); font-weight: 900; letter-spacing: 2px; font-size: 15px; padding: 4px 12px; border-radius: 8px; margin: 0 0 6px; transform: rotate(-2deg); }
.print-sim-titulo { margin: 4px 0 8px; font-size: 15px; }

/* ---------- Pestaña TOTALES (r103b → r123): misma familia que las demás,
   con el Σ en negrita para marcarla como la hoja de cómputo anual ---------- */
.hj-tab-resumen { font-weight: 800; }
.hj-tab-resumen.on { font-weight: 800; }
.hj-res-cargando { padding: 40px 20px; text-align: center; color: var(--muted, #667085); font-size: 13px; }
/* I-42 (r131) — la cabecera completa de TOTALES se queda fija al hacer scroll
   vertical (solo las filas de agentes suben). Antes estas celdas eran static
   (solo los meses tenían sticky top) y AÑOS SERV./TOTAL/LIBRES/DV… se perdían
   al bajar. Se mantiene right:auto para no fijarlas al borde derecho. */
.hj-tabla-resumen .hj-th-res { position: sticky; top: 0; right: auto; min-width: 74px; padding: 6px 8px !important; font-size: 10.5px; }
.hj-tabla-resumen .hj-res { position: static; padding: 4px 8px !important; font-size: 11.5px; }
.hj-tabla-resumen .hj-agente { position: static; }
.hj-tabla-resumen .hj-banda td { position: static; }
.hj-res-saldo-pos { color: #157347; background: #e7f6ec !important; }
.hj-res-saldo-neg { color: #b42318; background: #fdecea !important; }
.hj-fila-total td { border-top: 2px solid var(--border, #98a2b3); font-size: 12px; }
.hj-res-horas { cursor: help; }
.hj-proy-badge { display: inline-block; background: #b54708; color: #fff; border-radius: 8px; padding: 1px 8px; font-size: 10px; letter-spacing: .5px; }

/* ---------- Pestaña TOTALES (r103c): calco del Excel anual ---------- */
.hj-th-mes { min-width: 34px; font-size: 10px; letter-spacing: .3px; }
.hj-res-mes { font-weight: 700; color: var(--text, #101828); min-width: 34px; background: var(--card, #fff); }
.hj-res-num { min-width: 56px; }
.hj-res-dias35 { background: #fff4e5 !important; color: #b54708; }
.hj-res-fijada { color: var(--accent, #1e3a8a); font-weight: 900; cursor: help; }
.hj-res-vac { background: #e7f6ec !important; color: #157347; font-weight: 800; }
/* r121 — mes parcial (trabaja + vacaciones): número con «v» verde, mismo lenguaje
   que la celda «V» pero distinguishable a simple vista. */
.hj-res-vacpar { background: color-mix(in srgb, #e7f6ec 55%, transparent); }
.hj-vac-mini { display: inline-block; margin-left: 2px; color: #157347; font-weight: 800; font-size: 10px; vertical-align: super; line-height: 1; }
/* r122 — columna DV (días de vacaciones del año): mismo lenguaje verde que la «V»
   de los meses, para que el jefe lo lea como «vacaciones» de un vistazo. */
.hj-res-dv { background: color-mix(in srgb, #e7f6ec 45%, transparent); color: #157347; font-weight: 800; }
/* r124 — celda DV pulsable: señal de que hay desglose tras el número */
.hj-res-dv-btn { cursor: pointer; }
.hj-res-dv-btn:hover { background: #157347 !important; color: #fff !important; }
/* r144 — celda SALDO pulsable: mantiene su color (rojo/verde del saldo) y
   solo añade cursor y subrayado al pasar el ratón. */
.hj-res-saldo-btn { cursor: pointer; font-weight: 800; }
.hj-res-saldo-btn:hover { text-decoration: underline; }
/* r125 — columna DV CONVENIO: azul institucional (cifra legal, distinta del
   verde de calendario) y línea del panel de desglose. */
.hj-res-dvc { background: color-mix(in srgb, var(--accent, #1e3a8a) 10%, transparent); color: var(--accent, #1e3a8a); font-weight: 800; }
.hj-dvconv-line { padding: 6px 10px; background: color-mix(in srgb, var(--accent, #1e3a8a) 8%, transparent); border-left: 3px solid var(--accent, #1e3a8a); border-radius: 0 6px 6px 0; }
.hj-res-filtro { width: 220px; padding: 4px 8px; border: 1px solid var(--line, #d0d5dd); border-radius: 6px; font: inherit; background: var(--card, #fff); color: var(--text, #101828); }
.hj-res-filtro:focus { outline: 2px solid var(--accent, #1e3a8a); }
.hj-th-orden { cursor: pointer; user-select: none; white-space: nowrap; }
.hj-th-orden:hover { background: var(--accent, #1e3a8a); color: #fff; }
.hj-orden-ico { font-size: 9px; margin-left: 2px; }
.hj-orden-off { opacity: .45; }
.hj-res-grupo { font-weight: 600; color: var(--muted, #667085); white-space: nowrap; }
.hj-th-grupo { min-width: 64px; }
.hj-jornada-in { width: 54px; text-align: center; padding: 1px 2px; font: inherit; border: 1px solid var(--line, #d0d5dd); border-radius: 4px; background: var(--card, #fff); color: var(--text, #101828); }
.hj-jornada-in::placeholder { color: var(--text-soft, #667085); opacity: 1; }
.hj-jornada-in:focus { outline: 2px solid var(--accent, #1e3a8a); }
.hj-jornada-in:disabled { opacity: .6; }

/* ============================================================
   r108 — REDISEÑO DEL MÓDULO CUADRANTES
   Barra de contexto, menú ⋯, caminos de creación, sello
   «APROBADO», cintas de versión y panel del libro del año.
   ============================================================ */
/* Barra de contexto: una línea con año · vistas · acciones */
.cuad-ctx { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 10px; padding: 8px 10px; background: var(--surface-2, #f2f5fa); border: 1px solid var(--border, #c6cede); border-radius: 10px; }
.cuad-anio-sel { font-size: 15px; font-weight: 700; padding: 6px 10px; border-radius: 8px; }
.cuad-seg-modo { margin: 0; }
.cuad-ctx-spacer { flex: 1; }
.ctx-wrap { position: relative; }
.ctx-menu { display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 250px; background: var(--surface, #fff); border: 1px solid var(--border, #c6cede); border-radius: 10px; box-shadow: 0 10px 28px rgba(15, 23, 42, .18); padding: 6px; }
.ctx-menu.open { display: block; }
.ctx-menu button { display: block; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 7px; padding: 8px 10px; font-size: 13.5px; color: var(--text, #1c2433); cursor: pointer; }
.ctx-menu button:hover { background: var(--surface-2, #f2f5fa); }
.ctx-sep { margin: 6px 4px 4px; padding-top: 6px; border-top: 1px solid var(--border, #c6cede); font-size: 10.5px; font-weight: 800; letter-spacing: .08em; color: var(--muted, #667085); }

/* Estado vacío: dos caminos de creación del año */
.camino-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; max-width: 760px; margin: 0 auto 22px; }
.camino-card { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; text-align: left; background: var(--surface, #fff); border: 2px solid var(--border, #c6cede); border-radius: 14px; padding: 18px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .1s; font-family: inherit; }
.camino-card:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(15, 23, 42, .10); }
.camino-card.on { border-color: var(--brand-primary, #2456a6); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary, #2456a6) 18%, transparent); }
.camino-ico { font-size: 30px; line-height: 1; }
.camino-titulo { font-size: 15.5px; font-weight: 800; color: var(--text, #1c2433); }
.camino-card.on .camino-titulo { color: var(--brand-primary, #2456a6); }
.camino-txt { font-size: 12.8px; line-height: 1.5; color: var(--muted, #667085); }

/* Cinta de estado de la versión vista (vista anual) */
.hj-cinta { margin: 0 0 8px; padding: 7px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; }
.hj-cinta-viva { background: color-mix(in srgb, var(--brand-primary, #2456a6) 10%, var(--surface, #fff)); border: 1px solid color-mix(in srgb, var(--brand-primary, #2456a6) 35%, var(--surface, #fff)); color: var(--brand-primary, #2456a6); }
/* I-38 (r127) — candado del cuadrante aprobado: banda informativa (cerrado) y
   banda ámbar de aviso (abierto). Los botones quedan a la derecha. */
.hj-candado { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 8px 0; padding: 9px 12px; border-radius: 8px; font-size: 13px; background: color-mix(in srgb, var(--accent, #1e3a8a) 7%, var(--surface, #fff)); border: 1px solid color-mix(in srgb, var(--accent, #1e3a8a) 30%, var(--surface, #fff)); color: var(--text, #101828); }
.hj-candado b { color: var(--accent, #1e3a8a); }
.hj-candado-acc { display: flex; gap: 6px; margin-left: auto; }
.hj-candado-on { background: color-mix(in srgb, #d97706 12%, var(--surface, #fff)); border: 1px solid rgba(217, 119, 6, .55); box-shadow: 0 0 0 1px rgba(217, 119, 6, .12); }
.hj-candado-on b { color: var(--warn, #92400e); }
/* Acta de modificación sustancial (impresión): solo #acta-print sale en papel */
@media print {
  body.printing-acta * { visibility: hidden; }
  body.printing-acta #acta-print, body.printing-acta #acta-print * { visibility: visible; }
  body.printing-acta #acta-print { position: absolute; inset: 0; width: 100%; padding: 24px; background: #fff; color: #000; }
}
/* Letras de servicio de la vista «12 hojas»: clases (antes inline claras que
   deslumbraban en modo noche). Claro = pastel sobre tinta oscura; noche =
   tinta clara sobre fondo saturado oscuro. Mismo alfabeto M/T/N/L/V/LF. */
.hj-l-M { background: #d7e6ff; color: #1b3a75; }
.hj-l-T { background: #ffe3d4; color: #8a3a12; }
.hj-l-N { background: #39415c; color: #f4f6ff; }
.hj-l-L { background: #fff1b8; color: #7a5d00; }
.hj-l-V { background: #d2f5d8; color: #1f6b2f; }
.hj-l-LF { background: #e9f7c9; color: #4f6b12; }
.hj-l-x { background: var(--chip, #e9edf5); color: var(--muted, #667); }
[data-theme="dark"] .hj-l-M { background: #1b3a75; color: #d7e6ff; }
[data-theme="dark"] .hj-l-T { background: #7a3410; color: #ffd9c4; }
[data-theme="dark"] .hj-l-N { background: #8ea0d6; color: #10131f; }
[data-theme="dark"] .hj-l-L { background: #6b5a17; color: #ffe9a8; }
[data-theme="dark"] .hj-l-V { background: #1f6b2f; color: #d2f5d8; }
[data-theme="dark"] .hj-l-LF { background: #4f6b12; color: #e9f7c9; }
.hj-cinta-cong { background: #f2f4f7; border: 1px solid var(--border, #c6cede); color: var(--muted, #667085); }

/* Sello «APROBADO» — gráfica del documento oficial */
.sello-aprobado { display: flex; flex-direction: column; align-items: center; gap: 3px; transform: rotate(-5deg); margin-left: 10px; flex: none; }
.sello-circulo { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; width: 108px; height: 108px; border: 3px double #15803d; border-radius: 50%; color: #15803d; background: color-mix(in srgb, #15803d 6%, transparent); text-align: center; padding: 8px; }
.sello-check { font-size: 22px; font-weight: 900; line-height: 1; }
.sello-txt { font-size: 13px; font-weight: 900; letter-spacing: .12em; }
.sello-fecha { font-size: 10.5px; font-weight: 700; }
.sello-exp { font-size: 9.5px; font-weight: 600; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sello-firma { font-size: 9.5px; color: var(--muted, #667085); max-width: 120px; text-align: center; }
.sello-mini { transform: rotate(-4deg) scale(.72); transform-origin: center right; margin-left: 2px; }
.sello-mini .sello-circulo { width: 96px; height: 96px; }

/* Panel «Versiones del año»: fila de la versión de trabajo */
.ver-fila-trabajo { border-left: 4px solid var(--brand-primary, #2456a6); }
.ver-fila-trabajo.ver-activa { background: color-mix(in srgb, var(--brand-primary, #2456a6) 7%, transparent); }

/* La barra anual compacta acomoda el sello junto a los filtros */
.pa-barra { align-items: flex-start; }
@media (max-width: 900px) {
  .sello-aprobado { transform: rotate(0) scale(.85); }
  .camino-grid { grid-template-columns: 1fr; }
}

/* ---------- I-04: banner «Continuar con el asistente» ---------- */
.asis-ret-banner {
  position: sticky;
  top: 8px;
  z-index: 40;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  border: 1.5px solid var(--brand-primary, #2456a6);
  background: color-mix(in srgb, var(--brand-primary, #2456a6) 8%, var(--card, #fff));
  box-shadow: 0 4px 14px rgba(20, 40, 80, .12);
}
.asis-ret-txt { flex: 1; min-width: 260px; font-size: 13.5px; }
.asis-ret-extra { font-size: 13px; color: var(--muted, #64748b); }
.asis-ret-extra b { color: var(--text, #1e293b); }
@media (max-width: 900px) {
  .asis-ret-banner { position: static; }
}

.asis-ret-pie {
  margin-top: 14px;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  border: 1.5px dashed var(--brand-primary, #2456a6);
  background: color-mix(in srgb, var(--brand-primary, #2456a6) 5%, var(--card, #fff));
}

/* ---------- Bolsas de horas (módulo bolsas, Anexo arts. 6, 12-15) ---------- */
.bol-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 1100px) { .bol-grid { grid-template-columns: 1fr; } }
.bol-temp h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bol-resumen { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 4px 0 10px; font-size: 14px; }
.bol-lista { display: flex; flex-direction: column; gap: 8px; }
.bol-sub { border: 1px solid var(--border, #d8dee9); border-radius: 10px; overflow: hidden; }
.bol-sub-cab { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; background: color-mix(in srgb, var(--brand-primary, #2456a6) 4%, var(--card, #fff)); }
.bol-sub-cab:hover { background: color-mix(in srgb, var(--brand-primary, #2456a6) 9%, var(--card, #fff)); }
.bol-sub-nombre { font-weight: 600; flex: 1; }
.bol-sub-horas { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bol-flecha { color: var(--muted, #889); font-size: 12px; }
.bol-sub-cuerpo { padding: 10px 12px; border-top: 1px solid var(--border, #d8dee9); }
.bol-exc .bol-sub-cab { display: none; }
.bol-hist-fila { display: grid; grid-template-columns: 60px 1fr 1fr; gap: 10px; align-items: center; margin: 6px 0; }
.bol-hist-anio { font-weight: 700; text-align: right; }
.bol-hist-barra { position: relative; height: 22px; background: color-mix(in srgb, var(--brand-primary, #2456a6) 8%, var(--card, #fff)); border-radius: 6px; overflow: hidden; min-width: 60px; }
.bol-hist-barra > span { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, #4d8fd1 55%, var(--brand-primary, #2456a6)); }
.bol-hist-barra.bol-hist-ver > span { background: color-mix(in srgb, #e8a33d 60%, var(--warn, #d97706)); }
.bol-hist-barra em { position: relative; font-style: normal; font-size: 12px; padding-left: 8px; line-height: 22px; white-space: nowrap; }

/* ---------- Bolsas: vista gráfica (selector de modo, línea de tiempo, dona) ---------- */
.bol-modo { display: inline-flex; border: 1px solid var(--border, #d8dee9); border-radius: 10px; overflow: hidden; }
.bol-modo-btn { border: 0; background: transparent; padding: 7px 14px; cursor: pointer; font-size: 13px; color: var(--muted, #667); }
.bol-modo-btn.active { background: var(--brand-primary, #2456a6); color: #fff; font-weight: 600; }
.bol-graf-cuerpo { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 6px; }
@media (max-width: 900px) { .bol-graf-cuerpo { grid-template-columns: 1fr; } }
.bol-graf-cuerpo h4 { margin: 4px 0 8px; color: var(--muted, #667); font-weight: 600; }
/* línea de tiempo de la temporada */
.bol-tl { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; flex-wrap: wrap; }
.bol-tl-fecha { font-size: 12px; color: var(--muted, #667); font-variant-numeric: tabular-nums; }
.bol-tl-pista { position: relative; flex: 1; min-width: 140px; height: 12px; border-radius: 7px; background: color-mix(in srgb, var(--muted, #889) 18%, transparent); overflow: visible; }
.bol-tl-fill { position: absolute; inset: 0 auto 0 0; border-radius: 7px; opacity: .85; }
.bol-tl-hoy { position: absolute; top: -3px; bottom: -3px; width: 3px; background: var(--text, #222); border-radius: 2px; transform: translateX(-1px); }
.bol-tl-pct { font-size: 13px; }
/* comparativa de consumo (barras dobles año vs año anterior) */
.bol-comp-fila { display: grid; grid-template-columns: 52px 1fr 84px; gap: 10px; align-items: center; margin: 7px 0; }
.bol-comp-fila label { font-size: 12px; color: var(--muted, #667); text-align: right; font-variant-numeric: tabular-nums; }
.bol-comp-pista { height: 20px; border-radius: 6px; background: color-mix(in srgb, var(--muted, #889) 14%, transparent); overflow: hidden; }
.bol-comp-fill { height: 100%; border-radius: 6px; min-width: 0; transition: width .5s ease; }
.bol-comp-fila b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bol-comp-ant .bol-comp-fill { opacity: .55; }
.bol-comp-delta { margin-top: 4px; }
/* dona de composición + leyenda */
.bol-donut-fila { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.bol-donut { width: 132px; height: 132px; border-radius: 50%; flex: none; position: relative; }
.bol-donut-vacio { background: color-mix(in srgb, var(--muted, #889) 16%, transparent); }
.bol-donut-hoyo { position: absolute; inset: 24px; border-radius: 50%; background: var(--card, #fff); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.bol-donut-hoyo b { font-size: 16px; font-variant-numeric: tabular-nums; }
.bol-donut-hoyo span { font-size: 11px; color: var(--muted, #667); }
.bol-ley { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 5px; }
.bol-ley-fila { display: grid; grid-template-columns: 14px 1fr auto auto auto; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.bol-ley-fila:hover { background: color-mix(in srgb, var(--brand-primary, #2456a6) 8%, transparent); }
.bol-ley-punto { width: 11px; height: 11px; border-radius: 3px; }
.bol-ley-nom { font-weight: 600; }
.bol-ley-fila b { font-variant-numeric: tabular-nums; }
/* excedente en vista gráfica: cifras grandes + barras por agente */
.bol-exc-cifras { display: flex; gap: 28px; margin: 6px 0 12px; flex-wrap: wrap; }
.bol-cifra { display: flex; flex-direction: column; }
.bol-cifra b { font-size: 26px; font-variant-numeric: tabular-nums; }
.bol-cifra span { font-size: 12px; color: var(--muted, #667); }
.bol-bar-fila { display: grid; grid-template-columns: minmax(150px, 240px) 1fr 90px; gap: 10px; align-items: center; margin: 5px 0; cursor: pointer; padding: 3px 6px; border-radius: 8px; }
.bol-bar-fila:hover { background: color-mix(in srgb, var(--brand-primary, #2456a6) 8%, transparent); }
.bol-bar-nom { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bol-bar-pista { height: 16px; border-radius: 5px; background: color-mix(in srgb, var(--muted, #889) 14%, transparent); overflow: hidden; }
.bol-bar-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--brand-primary, #2456a6), color-mix(in srgb, var(--brand-primary, #2456a6) 60%, #4d8fd1)); }
.bol-bar-num { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }

/* ---------- «Mis horas» del agente (r147): semáforo de saldo y euros ---------- */
.ag-saldo { border-radius: 10px; padding: 18px 20px; text-align: center; }
.ag-saldo.ok { background: color-mix(in srgb, #1a7a3a 12%, transparent); border: 1px solid color-mix(in srgb, #1a7a3a 40%, transparent); }
.ag-saldo.ko { background: color-mix(in srgb, #b00020 10%, transparent); border: 1px solid color-mix(in srgb, #b00020 40%, transparent); }
.ag-saldo.ok .ag-saldo-cifra, .ag-saldo.ok .ag-saldo-txt { color: #1a7a3a; }
.ag-saldo.ko .ag-saldo-cifra, .ag-saldo.ko .ag-saldo-txt { color: #b00020; }
.ag-saldo-cifra { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ag-saldo-unidad { font-size: 14px; font-weight: 600; opacity: .75; }
.ag-saldo-txt { font-size: 14px; font-weight: 600; margin-top: 2px; }
.ag-saldo-aviso { margin-top: 8px; font-size: 13px; font-weight: 600; color: #8a5a00; }
.ag-euros-fila { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px dashed color-mix(in srgb, var(--muted, #889) 35%, transparent); }
.ag-euros-fila .switch-wrap { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 600; }
.ag-precio-caja { display: inline-flex; gap: 8px; align-items: center; }
