/* SIGELAB — Sistema Integrado Gestión Labocenter. Estilos base compartidos por todos los portales.
   Los colores de marca salen del logo (diseno_web/): azul marino del texto, azul, morado y verde del símbolo.
   Para ajustar la identidad basta con cambiar estas variables. */

/* Tipografías alojadas en el sitio (licencia SIL OFL, ver /fonts/*-LICENSE.txt). */
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900; src: url('/fonts/inter.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-style: normal; font-display: swap; font-weight: 100 900; src: url('/fonts/montserrat.woff2') format('woff2'); }

:root {
  /* Marca */
  --brand-navy: #0a2b4e;
  --brand-blue: #0545a4;
  --brand-green: #5e9f0b;
  --brand-purple: #6b1d72;
  --brand-gradient: linear-gradient(90deg, #6b1d72 0%, #0545a4 52%, #5e9f0b 100%);
  /* Paleta de la interfaz (nombres usados en todo el código) */
  --navy: #0a2b4e;
  --blue: #0545a4;
  --blue-dark: #03367f;
  --blue-light: #ebf2fd;
  --teal: #0545a4;
  --teal-accent: #5e9f0b;
  --green: #4d8a08;
  --green-light: #eef7e3;
  --orange: #e08a00;
  --red: #d14343;
  --purple: #6b1d72;
  --purple-light: #f5ecf7;
  --gray-50: #f8fafc;
  --gray-100: #f1f4f8;
  --gray-200: #e3e8ef;
  --gray-300: #cdd5e0;
  --gray-500: #64748b;
  --text: #1b2a3e;
  --bg: #eef3f9;
  --tinte: linear-gradient(90deg, #f3f7fe 0%, #f8f5fb 100%);
  --white: #ffffff;
  --shadow-sm: 0 1px 2px rgba(10, 43, 78, .06);
  --shadow: 0 1px 2px rgba(10, 43, 78, .05), 0 6px 18px rgba(10, 43, 78, .06);
  --shadow-lg: 0 24px 56px rgba(10, 43, 78, .2);
  --ring: 0 0 0 3px rgba(5, 69, 164, .18);
  --radius: 14px;
  --radius-sm: 10px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-titulo: 'Montserrat', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* Fondo con matices suaves de los colores del logo (azul arriba a la izquierda, verde y morado a la derecha). */
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--text); background-color: var(--bg);
  background-image: radial-gradient(900px 520px at 12% -8%, rgba(5, 69, 164, .10), transparent 62%),
    radial-gradient(800px 480px at 100% 0%, rgba(94, 159, 11, .09), transparent 60%),
    radial-gradient(700px 600px at 85% 100%, rgba(107, 29, 114, .06), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
/* Títulos en Montserrat 700 con espaciado abierto: es la tipografía libre más parecida a la palabra SIGELAB del logo. */
h1, h2, h3, h4, h5 { font-family: var(--font-titulo); font-weight: 700; letter-spacing: .015em; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: var(--blue); }
[hidden] { display: none !important; }
::selection { background: rgba(5, 69, 164, .16); }
:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: 2px; }

/* ---------- Botones ---------- */
.btn { border: 1px solid transparent; border-radius: var(--radius-sm); padding: 9px 16px; cursor: pointer; font-weight: 600; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; line-height: 1.25;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease, transform .1s ease; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, #0b55c4 0%, var(--brand-blue) 100%); color: var(--white);
  box-shadow: 0 2px 6px rgba(5, 69, 164, .28), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #0849ac 0%, var(--blue-dark) 100%); }
.btn-secondary { background: var(--white); color: var(--text); border-color: var(--gray-200); font-weight: 500; box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-50); border-color: var(--gray-300); }
.btn-success { background: linear-gradient(180deg, #6db31a 0%, var(--brand-green) 100%); color: var(--white); box-shadow: 0 2px 6px rgba(77, 138, 8, .28); }
.btn-success:hover:not(:disabled) { background: #4f8a08; }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover:not(:disabled) { background: #b93636; }
.btn-warning { background: var(--orange); color: var(--white); }
.btn-link { background: transparent; color: var(--blue); padding: 4px 6px; font-weight: 500; font-size: 12px; border-radius: 6px; }
.btn-link:hover:not(:disabled) { background: var(--blue-light); }
.btn-block { width: 100%; padding: 13px; font-size: 15px; }

/* ---------- Estados ---------- */
.status { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 10px 3px 8px; font-size: 11px; font-weight: 600;
  text-align: center; white-space: nowrap; line-height: 1.5; }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; flex: none; }
.status.active { color: #3f7a07; background: var(--green-light); }
.status.late { color: #b3312f; background: #fdeceb; }
.status.done { color: var(--brand-blue); background: var(--blue-light); }
.status.pending { color: #94600a; background: #fff3d6; }
.status.muted { color: var(--gray-500); background: var(--gray-100); }

/* ---------- Tarjetas y tablas ---------- */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--gray-200); overflow: hidden; }
.card + .card { margin-top: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-200); background: var(--tinte); display: flex; justify-content: space-between;
  align-items: center; gap: 10px; flex-wrap: wrap; }
.card-title { font-family: var(--font-titulo); font-weight: 700; font-size: 15px; color: var(--navy); letter-spacing: .015em;
  display: inline-flex; align-items: center; gap: 9px; }
.card-title::before { content: ''; width: 4px; height: 16px; border-radius: 2px; flex: none;
  background: linear-gradient(180deg, var(--brand-blue), var(--brand-purple)); }
.card-body { padding: 20px; }
/* Tablas: sombra en el borde que tiene más columnas (indica que se puede desplazar de lado), encabezado fijo al
   desplazarse, filas alternadas, columnas numéricas a la derecha y orden por columna (admin.js). */
.table-wrapper { overflow-x: auto; scrollbar-width: thin; scrollbar-color: #c3cede transparent;
  background: linear-gradient(90deg, var(--white) 30%, rgba(255, 255, 255, 0)), linear-gradient(270deg, var(--white) 30%, rgba(255, 255, 255, 0)) 100% 0,
    radial-gradient(farthest-side at 0 50%, rgba(10, 43, 78, .16), transparent), radial-gradient(farthest-side at 100% 50%, rgba(10, 43, 78, .16), transparent) 100% 0;
  background-repeat: no-repeat; background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%; background-attachment: local, local, scroll, scroll; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--gray-100); text-align: left; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
th.num, td.num { text-align: right; }
th { color: #4a5e7c; background: #eef3fb; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  white-space: nowrap; border-bottom: 1px solid #d9e2ef; position: sticky; top: 0; z-index: 2; }
th.ordenable { cursor: pointer; user-select: none; transition: background-color .12s ease, color .12s ease; }
th.ordenable::after { content: ''; display: inline-block; width: 8px; height: 11px; margin-left: 6px; vertical-align: -1px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath d='M5 1l4 5H1z' fill='%234a5e7c' fill-opacity='.45'/%3E%3Cpath d='M5 13L1 8h8z' fill='%234a5e7c' fill-opacity='.45'/%3E%3C/svg%3E") center / contain no-repeat; }
th.ordenable:hover { background: #e2ebf9; color: var(--navy); }
th[aria-sort="ascending"], th[aria-sort="descending"] { color: var(--brand-blue); background: #e2ebf9; }
th[aria-sort="ascending"]::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath d='M5 1l4 5H1z' fill='%230545A4' fill-opacity='1'/%3E%3Cpath d='M5 13L1 8h8z' fill='%230545A4' fill-opacity='.2'/%3E%3C/svg%3E"); }
th[aria-sort="descending"]::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath d='M5 1l4 5H1z' fill='%230545A4' fill-opacity='.2'/%3E%3Cpath d='M5 13L1 8h8z' fill='%230545A4' fill-opacity='1'/%3E%3C/svg%3E"); }
th.ordenable:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: -2px; }
td.nowrap, th.nowrap { white-space: nowrap; }
tbody tr { transition: background-color .12s ease; }
tbody tr:nth-child(even) { background: rgba(238, 243, 251, .45); }
tbody tr:hover { background: #f1f6fe; }
tbody tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
/* Fila que abre un detalle: barra azul a la izquierda y flecha a la derecha al pasar el mouse. */
tr.clickable td:last-child { padding-right: 38px; }
tr.clickable:hover { background: #e9f1fd; }
tr.clickable:hover td:first-child { box-shadow: inset 3px 0 0 var(--brand-blue); }
tr.clickable:hover td:last-child { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230545A4' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6l-6 6'/%3E%3C/svg%3E") right 14px center / 16px no-repeat; }
/* Lista vacía con el hexágono de SIGELAB. */
.empty { padding: 40px 24px; text-align: center; color: var(--gray-500); font-size: 13.5px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty::before { content: ''; width: 44px; height: 50px; background: url('/img/sigelab-icono.png') center / contain no-repeat; opacity: .28; filter: grayscale(.3); }
/* En computador la tabla se desplaza dentro de su tarjeta: el encabezado queda a la vista y la barra para moverse
   de lado está siempre al alcance, sin bajar hasta el final de la lista. */
@media (min-width: 801px) {
  .content .table-wrapper { max-height: calc(100vh - 150px); overflow: auto; }
}
.muted { color: var(--gray-500); }
.small { font-size: 11.5px; }

/* ---------- Formularios ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label, .form-group .etiqueta { font-size: 12.5px; font-weight: 600; color: #475569; transition: color .15s ease; }
.form-group input, .form-group select, .form-group textarea, .input {
  border: 1px solid var(--gray-300); padding: 10px 12px; border-radius: var(--radius-sm); outline: none; background: var(--white); color: var(--text);
  width: 100%; transition: border-color .15s ease, box-shadow .15s ease; }
.form-group input:hover, .form-group select:hover, .form-group textarea:hover, .input:hover { border-color: #b4bfcf; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus, .input:focus { border-color: var(--brand-blue); box-shadow: var(--ring); }
.form-group input:disabled, .form-group select:disabled, .form-group textarea:disabled { background: var(--gray-50); color: var(--gray-500); }
.form-group textarea { min-height: 80px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.form-group:has(> .check) { justify-content: flex-end; }
:is(.form-group, .card-body) > label.check { color: var(--text); font-weight: 500; cursor: pointer; min-height: 40px; }
.form-group .check input { width: 18px; height: 18px; padding: 0; margin: 0; flex: none; accent-color: var(--brand-blue); box-shadow: none; }

/* ---------- Formularios ---------- */
/* Campo obligatorio: asterisco en la etiqueta. La etiqueta del campo activo se pinta azul. */
.form-group:has(> :is(input, select, textarea):required) > label:not(.check)::after { content: ' *'; color: var(--red); font-weight: 700; }
.form-group:focus-within > label:not(.check) { color: var(--brand-blue); }
.form-group input::placeholder, .form-group textarea::placeholder, .input::placeholder, .filters input::placeholder { color: #9aa6b8; }
.form-group input:not([type=checkbox]):not([type=radio]), .form-group select, .input { min-height: 42px; }
/* Listas desplegables con flecha propia (igual en todos los navegadores). */
.form-group select, .filters select, .rep-fila select, select.input { appearance: none; -webkit-appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230545A4' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6l6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; cursor: pointer; }
.form-group select[multiple] { background-image: none; padding-right: 12px; }
/* Error: solo después de que la persona tocó el campo o intentó guardar. */
.form-group :is(input, select, textarea):user-invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(209, 67, 67, .12); }
.form-group:has(> :is(input, select, textarea):user-invalid) > label { color: var(--red); }
form > .alert-box.error { display: flex; align-items: flex-start; gap: 10px; padding-left: 42px; position: relative; border-left: 4px solid var(--red); }
form > .alert-box.error::before { content: ''; position: absolute; left: 14px; top: 12px; width: 18px; height: 18px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a33331' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3Cpath d='M10.3 3.9l-8.1 14a2 2 0 0 0 1.7 3h16.2a2 2 0 0 0 1.7-3l-8.1-14a2 2 0 0 0-3.4 0z'/%3E%3C/svg%3E") center / contain no-repeat; }
/* Sí/No: interruptor en lugar de casilla (opciones de formularios y configuración). */
:is(.form-group, .card-body) > label.check { padding: 8px 12px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); background: var(--gray-50); gap: 12px;
  transition: border-color .15s ease, background-color .15s ease; }
:is(.form-group, .card-body) > label.check:hover { border-color: var(--gray-300); background: var(--white); }
:is(.form-group, .card-body) > label.check:has(input:checked) { border-color: #c9e3a8; background: #f4faec; }
:is(.form-group, .card-body) > label.check input[type=checkbox] { appearance: none; -webkit-appearance: none; width: 40px; height: 23px; border-radius: 999px; background: var(--gray-300);
  position: relative; cursor: pointer; transition: background-color .18s ease; flex: none; margin: 0; min-height: 0; padding: 0; border: none; box-shadow: none; }
:is(.form-group, .card-body) > label.check input[type=checkbox]::before { content: ''; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%;
  background: var(--white); box-shadow: 0 1px 3px rgba(10, 43, 78, .3); transition: transform .18s ease; }
:is(.form-group, .card-body) > label.check input[type=checkbox]:checked { background: linear-gradient(135deg, #6db31a, var(--brand-green)); }
:is(.form-group, .card-body) > label.check input[type=checkbox]:checked::before { transform: translateX(17px); }
:is(.form-group, .card-body) > label.check input[type=checkbox]:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: 2px; }
:is(.form-group, .card-body) > label.check input[type=checkbox]:disabled { opacity: .5; cursor: not-allowed; }
.dias { display: flex; gap: 6px; flex-wrap: wrap; }
.dias label { display: flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 500; color: var(--text); }
.filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { padding: 9px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); background: var(--white); color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease; }
.filters input:focus, .filters select:focus { outline: none; border-color: var(--brand-blue); box-shadow: var(--ring); }
.alert-box { background: #fff7e6; border: 1px solid #f6dca0; color: #7a5410; padding: 12px 16px; border-radius: 12px;
  margin-bottom: 16px; font-size: 13px; }
.alert-box.error { background: #fdeeed; border-color: #f5c2bf; color: #a33331; }
.alert-box.info { background: var(--blue-light); border-color: #c5d8f6; color: var(--blue-dark); }
.alert-box ul { margin: 6px 0 0; padding-left: 20px; }

/* ---------- Modal ---------- */
.modal { display: none; position: fixed; inset: 0; z-index: 50; background: rgba(10, 30, 56, .5); backdrop-filter: blur(3px);
  align-items: flex-start; justify-content: center; padding: 32px 12px; overflow-y: auto; }
.modal.show { display: flex; animation: aparecer .15s ease-out; }
.modal-content { width: min(640px, 100%); background: var(--gray-50); border-radius: 18px; overflow: hidden; overflow: clip; box-shadow: var(--shadow-lg);
  position: relative; animation: subir .18s ease-out; }
.modal-content::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--brand-gradient); z-index: 1; }
.modal-content.wide { width: min(920px, 100%); }
.modal-content.wide.xl { width: min(1120px, 100%); }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; background: var(--white);
  padding: 20px 22px 16px; border-bottom: 1px solid var(--gray-200); background: var(--tinte); }
.modal-titulo { min-width: 0; }
.modal-header h3 { margin: 0; color: var(--navy); font-size: 18px; font-weight: 700; }
.modal-sub { color: var(--gray-500); font-size: 13px; margin-top: 4px; }
.modal-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.modal-body { padding: 18px 22px 22px; }
.modal-panel { background: var(--white); border-radius: var(--radius); border: 1px solid var(--gray-200); box-shadow: var(--shadow-sm); padding: 18px 20px; }
/* Pie del formulario fijo abajo mientras se recorre un formulario largo: Guardar siempre a la vista. */
.modal-panel .modal-footer { position: sticky; bottom: 0; z-index: 3; margin: 20px -20px -18px; padding: 14px 20px;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px); border-top: 1px solid var(--gray-200);
  border-radius: 0 0 var(--radius) var(--radius); box-shadow: 0 -10px 18px -14px rgba(10, 43, 78, .35); }
.modal-panel .modal-footer .btn { min-height: 40px; padding-left: 18px; padding-right: 18px; }
.close { cursor: pointer; border: none; background: transparent; font-size: 22px; line-height: 1; color: var(--gray-500); width: 34px; height: 34px;
  border-radius: 10px; display: grid; place-items: center; flex: none; transition: background-color .15s ease, color .15s ease; }
.close:hover { color: var(--navy); background: var(--gray-100); }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes subir { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }

/* ---------- Toast ---------- */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 8px); z-index: 80; background: var(--navy);
  color: var(--white); padding: 12px 18px; border-radius: 12px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg); max-width: 90vw;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--red); }

/* ---------- Varios ---------- */
.progress { height: 8px; background: var(--gray-100); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progress-bar { height: 100%; background: linear-gradient(90deg, #7bbf24, var(--brand-green)); border-radius: 999px; transition: width .3s ease; }
.brand-logo { width: 39px; height: 39px; border-radius: 12px; background: var(--brand-blue); color: var(--white);
  display: grid; place-items: center; font-weight: bold; font-size: 20px; flex-shrink: 0; }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-purple)); color: var(--white); font-weight: 700; font-size: 13px; flex-shrink: 0;
  font-family: var(--font-titulo); }
.evidencia { max-width: 100%; max-height: 320px; border: 1px solid var(--gray-200); border-radius: 10px; background: var(--white); }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--gray-500); }
.kv dd { margin: 0; }
/* "Cargando…": el hexágono de SIGELAB avanza un tercio de vuelta con un pequeño rebote y se detiene, así los tres colores
   van cambiando de lugar. Sigue girando aunque el dispositivo pida reducir animaciones (regla al final del archivo). */
.spinner { padding: 48px; text-align: center; color: var(--gray-500); display: flex; align-items: center; justify-content: center; gap: 12px; }
.spinner::before { content: ''; width: 34px; height: 34px; flex: none; background: url('/img/sigelab-icono.png') center / contain no-repeat;
  animation: giro-sigelab 2.4s cubic-bezier(.68, -0.35, .32, 1.35) infinite; }
@keyframes giro-sigelab {
  0%, 18% { transform: rotate(0deg); }
  33%, 51% { transform: rotate(120deg); }
  66%, 84% { transform: rotate(240deg); }
  100% { transform: rotate(360deg); }
}

@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: auto; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: 6px; }
}

/* ---------- Notificaciones ---------- */
.notif { position: relative; }
.notif-btn { position: relative; background: transparent; border: none; font-size: 20px; cursor: pointer; padding: 8px; line-height: 1;
  border-radius: 10px; transition: background-color .15s ease; }
.notif-btn:hover { background: var(--gray-100); }
.notif-badge { position: absolute; top: 2px; right: 0; background: var(--red); color: var(--white); border-radius: 10px; font-size: 10px;
  font-weight: 700; padding: 1px 5px; border: 2px solid var(--white); }
.notif-panel { position: absolute; right: 0; top: 44px; width: min(360px, 90vw); max-height: 70vh; overflow-y: auto; background: var(--white);
  color: var(--text); border-radius: var(--radius); border: 1px solid var(--gray-200); box-shadow: var(--shadow-lg); z-index: 60; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--gray-200); font-size: 13px; }
.notif-item { padding: 11px 16px; border-bottom: 1px solid var(--gray-100); font-size: 12.5px; }
.notif-item.nueva { background: var(--blue-light); cursor: pointer; }
.notif-titulo { font-weight: 600; color: var(--navy); }
.notif-msg { margin-top: 3px; }
.notif-fecha { margin-top: 4px; color: var(--gray-500); font-size: 11px; }
.btn-icon { background: var(--white); border: 1px solid var(--gray-200); border-radius: 8px; padding: 4px 8px; cursor: pointer; font-size: 12px; }
.btn-icon:hover:not(:disabled) { background: var(--gray-50); border-color: var(--gray-300); }
.btn-icon:disabled { opacity: .35; cursor: not-allowed; }
.multi-wrap { border: 1px solid var(--gray-300); border-radius: var(--radius-sm); overflow: hidden; background: var(--white); }
.multi-barra { display: flex; align-items: center; gap: 10px; padding: 8px; border-bottom: 1px solid var(--gray-200); background: var(--gray-50); }
.form-group .multi-barra input.multi-buscar { flex: 1; width: auto; padding: 7px 10px; }
.multi-contador { font-size: 11px; color: var(--gray-500); white-space: nowrap; }
.multi { max-height: 240px; overflow-y: auto; }
div.multi:not(.multi-wrap .multi) { border: 1px solid var(--gray-300); border-radius: var(--radius-sm); padding: 10px; }
.form-group .multi label.multi-op { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; margin: 0; cursor: pointer;
  border-bottom: 1px solid var(--gray-100); font-weight: normal; color: var(--text); text-align: left; }
.form-group .multi label.multi-op:hover { background: var(--blue-light); }
.form-group .multi label.multi-op:has(input:checked) { background: #f0f5fd; }
.form-group .multi label.multi-op input[type=checkbox] { width: 16px; height: 16px; min-width: 16px; padding: 0; margin: 2px 0 0; flex: none;
  accent-color: var(--brand-blue); cursor: pointer; box-shadow: none; }
.multi-texto { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.multi-nombre { font-size: 13px; color: var(--navy); font-weight: 600; }
.multi-sub { font-size: 11px; color: var(--gray-500); }
.multi-vacio { padding: 14px; text-align: center; color: var(--gray-500); font-size: 12px; }

/* ---------- Marca ---------- */
.logo { display: block; height: auto; max-width: 100%; }
.franja-marca { height: 3px; background: var(--brand-gradient); }

/* ---------- Mapas ---------- */
.mapa-google { width: 100%; height: 260px; border: 1px solid var(--gray-200); border-radius: 12px; display: block; background: var(--gray-100); }
.mapa-vacio { height: 260px; border: 1px dashed var(--gray-300); border-radius: 12px; display: grid; place-items: center; color: var(--gray-500);
  font-size: 12px; background: var(--gray-50); text-align: center; padding: 10px; }
.mapa-leaflet { width: 100%; height: 340px; border-radius: 12px; border: 1px solid var(--gray-200); background: #eef2f6; z-index: 0; }
.mapa-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.mapa-tabs button { border: 1px solid var(--gray-200); background: var(--white); border-radius: 999px; padding: 5px 12px; font-size: 12px; cursor: pointer; color: var(--text); }
.mapa-tabs button.active { background: var(--blue-light); border-color: var(--brand-blue); color: var(--brand-blue); font-weight: 600; }
.evidencia-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; align-items: start; }
.evidencia-grid h5 { margin: 0 0 8px; font-size: 12px; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; }
.evidencia-imgs { display: grid; gap: 10px; }
.evidencia-imgs img { width: 100%; max-height: 200px; object-fit: contain; border: 1px solid var(--gray-200); border-radius: 12px; background: var(--white); }
@media (max-width: 700px) { .evidencia-grid { grid-template-columns: 1fr; } }

/* Marcadores numerados */
.marcador { width: 28px; height: 28px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: grid; place-items: center;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.marcador span { transform: rotate(45deg); color: #fff; font-size: 11px; font-weight: bold; }
.marcador.hecha { background: var(--brand-green); }
.marcador.encentro { background: var(--orange); }
.marcador.pendiente { background: #9aa6b8; }
.marcador.atrasada { background: var(--red); }
.marcador.ultimo { box-shadow: 0 0 0 6px rgba(5, 69, 164, .25), 0 2px 6px rgba(0,0,0,.3); }

/* Check-ins (línea de tiempo) */
.checkins { list-style: none; margin: 0; padding: 0; }
.checkin { display: grid; grid-template-columns: 26px 1fr auto; gap: 12px; position: relative; padding: 10px 8px 14px; border-radius: 10px; cursor: pointer; }
.checkin:hover, .checkin.sel { background: var(--gray-100); }
.checkin::before { content: ''; position: absolute; left: 20px; top: 34px; bottom: -6px; width: 2px; background: var(--gray-200); }
.checkin:last-child::before { display: none; }
.checkin-ico { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: bold; z-index: 1; }
.checkin.hecha .checkin-ico { background: var(--brand-green); }
.checkin.encentro .checkin-ico { background: var(--orange); }
.checkin.atrasada .checkin-ico { background: var(--red); }
.checkin.pendiente .checkin-ico { background: var(--gray-200); }
.checkin.cerrado .checkin-ico { background: var(--brand-purple); }
.checkin-titulo { font-weight: 600; color: var(--navy); font-size: 14px; }
.checkin-sub { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--gray-500); margin-top: 3px; }
.checkin-sub .atraso { color: var(--red); }
.checkin-gps { font-size: 11px; color: var(--gray-500); align-self: center; }

/* ---------- Íconos (Tabler) ---------- */
.ico { width: 18px; height: 18px; flex: none; vertical-align: -4px; }
.btn .ico { margin-right: 2px; }
.btn-icon { display: inline-grid; place-items: center; }
.btn-icon .ico { width: 15px; height: 15px; }
.notif-ico { width: 22px; height: 22px; color: var(--navy); display: block; }
.evid-icos { display: inline-flex; gap: 6px; color: var(--brand-blue); }
.checkin-gps .ico { color: var(--brand-blue); }

/* Ambiente de desarrollo */
.franja-desarrollo { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; background: #f59e0b; color: #1f2937; text-align: center;
  font-size: 12px; font-weight: bold; padding: 4px 8px; pointer-events: none; }

/* Detalle de un gráfico al tocarlo en pantallas táctiles (common.js). */
.burbuja-tactil { position: fixed; z-index: 90; max-width: min(320px, calc(100vw - 16px)); padding: 7px 10px; border-radius: 10px; background: var(--navy);
  color: var(--white); font-size: 12px; line-height: 1.35; box-shadow: 0 6px 18px rgba(10, 43, 78, .25); pointer-events: none; }

/* ---------- Calendario SIGELAB (common.js) ---------- */
/* Campo de fecha: botón visible; el <input type="date"> real queda oculto pero conserva el valor. */
.fecha-oculta { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important;
  opacity: 0; pointer-events: none; overflow: hidden; clip-path: inset(50%); }
.fecha-campo { display: inline-flex; align-items: center; gap: 9px; min-width: 150px; padding: 9px 12px; border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm); background: var(--white); color: var(--navy); font-weight: 500; font-size: 14px; cursor: pointer; text-align: left;
  font-variant-numeric: tabular-nums; transition: border-color .15s ease, box-shadow .15s ease; }
.fecha-campo .ico { width: 18px; height: 18px; color: var(--brand-blue); flex: none; vertical-align: 0; }
.fecha-campo .vacio { color: #94a3b8; font-weight: 400; }
.fecha-campo:hover:not(:disabled) { border-color: #b4bfcf; }
.fecha-campo:focus-visible, .fecha-campo[aria-expanded="true"] { outline: none; border-color: var(--brand-blue); box-shadow: var(--ring); }
.fecha-campo:disabled { background: var(--gray-50); color: var(--gray-500); cursor: not-allowed; }
.form-group .fecha-campo { width: 100%; }
/* Botón de periodo (filtros "Desde / hasta"). */
.rango-campo { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px 8px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  background: var(--white); color: var(--navy); font-size: 14px; cursor: pointer; text-align: left; box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, box-shadow .15s ease; max-width: 100%; }
.rango-campo > .ico { width: 18px; height: 18px; color: var(--brand-blue); flex: none; vertical-align: 0; }
.rango-campo .rango-texto { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex-wrap: wrap; }
.rango-campo b { font-weight: 600; white-space: nowrap; }
.rango-campo .rango-fechas { color: var(--gray-500); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rango-campo .rango-fechas.solo { color: var(--navy); font-size: 14px; font-weight: 500; }
.rango-campo .rango-flecha { width: 16px; height: 16px; color: var(--gray-500); flex: none; margin-left: 2px; transform: rotate(90deg); }
.rango-campo:hover { border-color: #b4bfcf; }
.rango-campo:focus-visible, .rango-campo[aria-expanded="true"] { outline: none; border-color: var(--brand-blue); box-shadow: var(--ring); }

/* Panel flotante */
.cal { position: fixed; z-index: 95; background: var(--white); border: 1px solid var(--gray-200); border-radius: 16px; overflow: hidden;
  box-shadow: 0 20px 44px rgba(10, 43, 78, .2); animation: subir .14s ease-out; font-size: 14px; color: var(--text); }
.cal-uno { width: 312px; }
.cal-cab { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 12px 12px 10px; }
.cal-uno > .cal-cab { background: var(--tinte); border-bottom: 1px solid var(--gray-200); }
.cal-titulo { font-family: var(--font-titulo); font-weight: 700; color: var(--navy); font-size: 15px; letter-spacing: .015em; text-transform: capitalize;
  background: none; border: none; cursor: pointer; padding: 5px 10px; border-radius: 9px; }
.cal-titulo:hover { background: rgba(5, 69, 164, .08); }
.cal-titulo-fijo { font-family: var(--font-titulo); color: var(--navy); font-size: 14px; letter-spacing: .015em; text-transform: capitalize; flex: 1; text-align: center; }
.cal-nav { width: 32px; height: 32px; flex: none; border-radius: 10px; border: 1px solid var(--gray-200); background: var(--white); cursor: pointer;
  display: grid; place-items: center; color: var(--navy); }
.cal-nav svg { width: 16px; height: 16px; }
.cal-nav:hover { background: var(--blue-light); border-color: #c5d8f6; }
.cal-nav-vacio { width: 32px; flex: none; }
.cal-sem, .cal-dias { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; padding: 0 10px; }
.cal-sem { padding-top: 8px; padding-bottom: 2px; font-size: 10.5px; font-weight: 600; color: var(--gray-500); text-align: center; text-transform: uppercase; letter-spacing: .04em; }
.cal-sem span:nth-child(n+6) { color: var(--brand-purple); }
.cal-dias { padding-top: 4px; padding-bottom: 8px; }
.cal-dia { height: 38px; border-radius: 11px; border: none; background: none; cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--text);
  font-variant-numeric: tabular-nums; }
.cal-dia:hover:not(:disabled) { background: var(--blue-light); color: var(--brand-blue); }
.cal-dia.otro { color: #b6c0ce; }
.cal-dia.finde:not(.otro) { color: var(--brand-purple); }
.cal-dia.hoy { box-shadow: inset 0 0 0 2px var(--brand-green); font-weight: 700; }
.cal-dia.sel { background: linear-gradient(135deg, var(--brand-blue), #2a3f9a 70%, var(--brand-purple)); color: var(--white); font-weight: 700;
  box-shadow: 0 4px 10px rgba(5, 69, 164, .3); }
.cal-dia:disabled { color: #d0d7e1; cursor: not-allowed; text-decoration: line-through; }
.cal-grilla { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 14px 12px; }
.cal-grilla button { height: 46px; border-radius: 11px; border: 1px solid var(--gray-200); background: var(--white); cursor: pointer; text-transform: capitalize;
  font-weight: 500; color: var(--navy); font-size: 14px; }
.cal-grilla button:hover { background: var(--blue-light); border-color: #c5d8f6; }
.cal-grilla button.hoy { border-color: var(--brand-green); }
.cal-grilla button.sel { background: var(--brand-blue); color: var(--white); border-color: var(--brand-blue); font-weight: 600; }
.cal-pie { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px 12px; border-top: 1px solid var(--gray-200); }
.cal-lnk { background: none; border: none; color: var(--brand-blue); font-weight: 600; cursor: pointer; padding: 6px 10px; border-radius: 8px; font-size: 13px; }
.cal-lnk:hover:not(:disabled) { background: var(--blue-light); }
.cal-lnk:disabled { opacity: .4; cursor: not-allowed; }

/* Periodo: accesos rápidos + dos meses */
.cal-rango { display: flex; }
.cal-atajos { width: 158px; flex: none; background: linear-gradient(180deg, #f3f7fe, #f6f1f9); border-right: 1px solid var(--gray-200); padding: 12px 10px;
  display: flex; flex-direction: column; gap: 2px; max-height: 420px; overflow-y: auto; }
.cal-atajos small { font-family: var(--font-titulo); font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--gray-500); font-weight: 700; padding: 4px 8px 6px; }
.cal-atajos button { text-align: left; border: none; background: none; padding: 7px 10px; border-radius: 9px; cursor: pointer; font-size: 13px; color: #33425c; font-weight: 500; }
.cal-atajos button:hover { background: rgba(5, 69, 164, .08); color: var(--navy); }
.cal-atajos button.act { background: var(--brand-blue); color: var(--white); font-weight: 600; }
.cal-rango-cuerpo { display: flex; flex-direction: column; min-width: 0; }
.cal-meses { display: flex; gap: 18px; padding: 4px 12px 6px; }
.cal-mes .cal-sem, .cal-mes .cal-dias { grid-template-columns: repeat(7, 36px); gap: 0; padding: 0; }
.cal-mes .cal-cab { padding: 10px 0 6px; }
.cal-r { height: 34px; border: none; background: none; padding: 0; cursor: pointer; font-size: 13px; color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.cal-r span { display: grid; place-items: center; width: 32px; height: 32px; margin: 1px auto; border-radius: 10px; }
span.cal-r { cursor: default; }
.cal-r:hover span { background: var(--blue-light); color: var(--brand-blue); }
.cal-r.finde span { color: var(--brand-purple); }
.cal-r.en { background: #e6eefc; }
.cal-r.ini { background: linear-gradient(90deg, transparent 50%, #e6eefc 50%); }
.cal-r.fin { background: linear-gradient(90deg, #e6eefc 50%, transparent 50%); }
.cal-r.ini.fin { background: none; }
.cal-r.ini span, .cal-r.fin span { background: linear-gradient(135deg, var(--brand-blue), var(--brand-purple)); color: var(--white); font-weight: 700;
  box-shadow: 0 3px 8px rgba(5, 69, 164, .3); }
.cal-r.hoy span { box-shadow: inset 0 0 0 2px var(--brand-green); }
.cal-rango .cal-pie { justify-content: flex-end; }
.cal-resumen { flex: 1; font-size: 12.5px; color: var(--gray-500); }
.cal-resumen b { color: var(--navy); font-family: var(--font-titulo); }

/* Pantallas angostas: el calendario sale como panel inferior y el periodo muestra un solo mes. */
.cal.cal-hoja { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: 100%; border-radius: 20px 20px 0 0; max-height: 88vh; overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -12px 40px rgba(10, 43, 78, .28); }
.cal-hoja.cal-uno .cal-dia { height: 44px; }
.cal-hoja.cal-rango { flex-direction: column; }
.cal-hoja .cal-atajos { width: auto; flex-direction: row; flex-wrap: wrap; border-right: none; border-bottom: 1px solid var(--gray-200); max-height: none; }
.cal-hoja .cal-atajos small { width: 100%; }
.cal-hoja .cal-atajos button { background: var(--white); border: 1px solid var(--gray-200); }
.cal-hoja .cal-atajos button.act { background: var(--brand-blue); border-color: var(--brand-blue); color: var(--white); }
.cal-hoja .cal-meses { justify-content: center; }
.cal-hoja .cal-mes + .cal-mes { display: none; }
.cal-hoja .cal-mes .cal-cab .cal-nav-vacio { display: none; }
.cal-hoja .cal-mes .cal-sem, .cal-hoja .cal-mes .cal-dias { grid-template-columns: repeat(7, minmax(36px, 1fr)); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  /* El "Cargando…" sigue girando: es pequeño, lento y es la única señal de que la página está trabajando. */
  .spinner::before { animation-duration: 2.4s !important; }
}
