:root {
  /* Colores corporativos iSAD (logotipo «Acompañar») */
  --isad: #0E7490;          /* petróleo: color principal */
  --isad-dark: #155E75;     /* hover / activo */
  --isad-deep: #083344;     /* fondos oscuros */
  --isad-accent: #DB2777;   /* rosa: acento */
  --isad-accent-dark: #BE185D;
  --isad-tint: #ECF7FA;     /* fondos suaves */
  --isad-tint-2: #CFE8EF;
  --bs-primary: #0E7490;
  --bs-primary-rgb: 14, 116, 144;
  --bs-link-color: #0E7490;
  --bs-link-color-rgb: 14, 116, 144;
  --bs-link-hover-color: #155E75;
  --bs-link-hover-color-rgb: 21, 94, 117;
  --bs-focus-ring-color: rgba(14, 116, 144, .25);
  --bs-primary-text-emphasis: #155E75;
  --bs-primary-bg-subtle: #ECF7FA;
  --bs-primary-border-subtle: #A5D8E6;
}
body { background: #f4f6f8; }
.bg-isad { background: var(--isad); }
.text-isad { color: var(--isad); }
.bg-isad-accent { background: var(--isad-accent); }
.text-isad-accent { color: var(--isad-accent); }
.navbar.bg-isad { border-bottom: 3px solid var(--isad-accent); }
.text-bg-primary { background-color: var(--isad) !important; }
.form-control:focus, .form-select:focus { border-color: #7CC3D6; box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.form-check-input:focus { border-color: #7CC3D6; box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--isad); }
.nav-link { --bs-nav-link-color: var(--isad); --bs-nav-link-hover-color: var(--isad-dark); }
.navbar .nav-link { --bs-nav-link-color: rgba(255,255,255,.85); --bs-nav-link-hover-color: #fff; }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--isad); }
.progress { --bs-progress-bar-bg: var(--isad); }
.btn-accent { --bs-btn-color: #fff; --bs-btn-bg: var(--isad-accent); --bs-btn-border-color: var(--isad-accent); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--isad-accent-dark); --bs-btn-hover-border-color: var(--isad-accent-dark); --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--isad-accent-dark); --bs-btn-active-border-color: var(--isad-accent-dark); }
.btn-primary { --bs-btn-bg: var(--isad); --bs-btn-border-color: var(--isad); --bs-btn-hover-bg: var(--isad-dark); --bs-btn-hover-border-color: var(--isad-dark); --bs-btn-active-bg: var(--isad-dark); --bs-btn-active-border-color: var(--isad-dark); --bs-btn-disabled-bg: var(--isad); --bs-btn-disabled-border-color: var(--isad); }
.btn-outline-primary { --bs-btn-color: var(--isad); --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff; --bs-btn-border-color: var(--isad); --bs-btn-hover-bg: var(--isad); --bs-btn-hover-border-color: var(--isad); --bs-btn-active-bg: var(--isad); --bs-btn-active-border-color: var(--isad); }
.pagination { --bs-pagination-active-bg: var(--isad); --bs-pagination-active-border-color: var(--isad); --bs-pagination-color: var(--isad); }
.form-check-input:checked { background-color: var(--isad); border-color: var(--isad); }
.navbar .dropdown-menu { max-height: 80vh; overflow-y: auto; }
.card { border-radius: .6rem; }
.kpi { transition: transform .1s, box-shadow .1s; }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 .25rem .75rem rgba(0,0,0,.08); }
.swatch { display: inline-block; width: 1rem; height: 1rem; border-radius: 3px; vertical-align: middle; border: 1px solid rgba(0,0,0,.2); }
.dl-compact dt { font-weight: 600; color: #6c757d; }
.dl-compact dd { margin-bottom: .25rem; }
.table-scroll { max-height: 420px; overflow-y: auto; }
.dias-picker.is-invalid .btn { border-color: var(--bs-danger); }

/* Mapa de Google */
.mapa-box { padding: 1rem; text-align: center; background: var(--isad-tint); }
.mapa-box.mapa-cargado { padding: 0; }
.mapa-box iframe { display: block; width: 100%; height: 260px; border: 0; border-radius: 0 0 .6rem .6rem; }

/* Login */
.login-wrap { max-width: 420px; margin: 6vh auto 0; }
.login-card { border-top: 4px solid var(--isad-accent); }
.login-logo { width: 100%; max-width: 300px; height: auto; }

/* Gráfico de barras simple */
.bar-chart { display: flex; align-items: flex-end; gap: 3px; height: 160px; overflow-x: auto; }
.bar-col { flex: 1 0 18px; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar-stack { position: relative; width: 100%; flex: 1; }
.bar { position: absolute; bottom: 0; left: 15%; width: 70%; border-radius: 3px 3px 0 0; }
.bar-prog { background: var(--isad-tint-2); }
.bar-real { background: var(--isad); left: 30%; width: 40%; }
.bar-label { font-size: .7rem; color: #6c757d; }
.legend { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: middle; }

/* Vista semanal */
.semana td { vertical-align: top; min-width: 130px; }
.sem-item { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .75rem; padding: 1px 4px; margin-bottom: 2px; border-radius: 3px; background: var(--isad-tint); border-left: 3px solid #adb5bd; }
.sem-item.estado-realizada { border-left-color: var(--bs-success); }
.sem-item.estado-no_realizada { border-left-color: var(--bs-danger); background: #fbecec; }

/* App móvil auxiliar */
.ruta { max-width: 560px; }
.ruta-card { border-left: 5px solid #adb5bd; }
.ruta-card.estado-realizada { border-left-color: var(--bs-success); opacity: .85; }
.ruta-card.estado-no_realizada { border-left-color: var(--bs-danger); opacity: .85; }

/* Hojas de control imprimibles (A4) */
.print-mode { background: #fff; }
.hoja { width: 190mm; min-height: 270mm; margin: 10mm auto; padding: 0; font-family: Arial, Helvetica, sans-serif; color: #000; page-break-after: always; break-after: page; }
.hoja:last-child { page-break-after: auto; break-after: auto; }
.hoja-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6mm; }
.hoja-title { font-size: 15pt; font-weight: bold; letter-spacing: .5px; margin-bottom: 4mm; text-align: center; }
.hoja-line { font-size: 11pt; margin-bottom: 3mm; }
.hoja-line span { display: inline-block; min-width: 70mm; border-bottom: 1px solid #000; padding: 0 2mm; font-size: 12pt; }
.hoja-logo { text-align: center; max-width: 40mm; }
.hoja-logo img { max-width: 36mm; max-height: 22mm; }
.hoja-tabla { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
.hoja-tabla th { border: 1.5px solid #000; padding: 2mm 1mm; font-size: 8pt; text-align: center; background: #f0f0f0; }
.hoja-tabla td { border: 1px solid #000; height: 14mm; padding: 1mm 1.5mm; vertical-align: middle; }
.hoja-tabla td:nth-child(n+2):nth-child(-n+5) { text-align: center; }
.hoja-dir { font-size: 7.5pt; color: #333; }
.hoja-prev { color: #777; font-size: 8pt; }
.hoja-foot { display: flex; justify-content: space-between; margin-top: 5mm; font-size: 10pt; }

@media print {
  body { background: #fff !important; }
  .card { border: none !important; box-shadow: none !important; }
  main.container-fluid { padding: 0 !important; }
  a { text-decoration: none !important; color: #000 !important; }
  .hoja { margin: 0 auto; }
  @page { size: A4; margin: 10mm; }
}
@media (max-width: 576px) {
  .table { font-size: .85rem; }
}

/* Hojas de código QR del domicilio */
.qr-hoja { width: 95mm; margin: 8mm auto; padding: 6mm; border: 1px dashed #999; text-align: center; font-family: Arial, sans-serif; page-break-inside: avoid; break-inside: avoid; }
.qr-titulo { font-weight: bold; font-size: 13pt; }
.qr-sub { font-size: 10pt; margin-bottom: 3mm; }
.qr-codigo svg { width: 60mm; height: 60mm; }
.qr-exp { font-weight: bold; margin-top: 2mm; }
.qr-txt { font-size: 8.5pt; margin: 2mm 0 0; }
@media print { .qr-hoja { display: inline-block; margin: 4mm; vertical-align: top; } }

/* Pliegos del contrato (Configuración › Pliegos) */
.bg-isad-tint { background: var(--isad-tint); }
.border-isad { border-color: var(--isad) !important; border-top-width: 4px !important; }
.table-pliego { font-size: .95rem; width: 100%; }
.table-pliego th[scope=row] { color: #1F2937; }
.table-pliego td, .table-pliego th { vertical-align: top; }
.nav-tabs-pliego .nav-link { font-weight: 600; color: var(--isad); }
.nav-tabs-pliego .nav-link.active { color: var(--isad-deep); border-top: 3px solid var(--isad-accent); }

/* Registro de correos enviados (Configuración › Administración) */
.tabla-correos { font-size: .95rem; width: 100%; }
.tabla-correos th { white-space: nowrap; }
.correo-cuerpo { white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: .95rem; background: var(--isad-tint); padding: .75rem; border-radius: .375rem; }

/* Portal de la Administración pública (rol «administracion») */
.kpi-cam:hover, .tipo-cam:hover { border-color: var(--isad); box-shadow: 0 .25rem .75rem rgba(14,116,144,.15); }
.tabla-cam { font-size: .95rem; width: 100%; }
.tabla-cam th { white-space: nowrap; }
.historial-cam .lado-cam { border-left: 4px solid var(--isad); }
.historial-cam .lado-empresa { border-left: 4px solid var(--isad-accent); }
.pasos-cam { padding-left: 1.25rem; }
.pasos-cam li { margin-bottom: .75rem; }
.pasos-cam li.hecho::marker { color: #198754; }
.pasos-cam li.hecho > strong::after { content: ' ✓'; color: #198754; }
.text-pre { white-space: pre-wrap; }

/* Manual de uso (Usuario › Manual de uso) */
.manual { font-size: 1rem; line-height: 1.6; max-width: 1100px; }
.manual-titulo { color: var(--isad); font-size: 1.5rem; margin-bottom: .25rem; }
.manual h2 { color: var(--isad); font-size: 1.3rem; margin: 2rem 0 .75rem; padding-top: .75rem; border-top: 1px solid #e5e7eb; scroll-margin-top: 80px; }
.manual h3 { font-size: 1.08rem; margin: 1.4rem 0 .5rem; }
.manual .table-manual { font-size: .95rem; }
.manual-indice { background: var(--isad-tint); border-radius: .5rem; padding: .75rem 1.25rem; }
.manual-indice ul { margin: 0; padding-left: 0; list-style: none; columns: 2; }
.manual-indice li { padding: .15rem 0; }
.manual h2.manual-titulo { border-top: 0; margin-top: 0; padding-top: 0; font-size: 1.5rem; }
.manual-indice a { color: var(--isad); text-decoration: none; font-weight: 600; }
@media (max-width: 768px) { .manual-indice ul { columns: 1; } }
@media print { .manual { max-width: none; padding: 0 !important; } .manual h2 { break-after: avoid; } .manual table, .manual tr { break-inside: avoid; } }

/* Configuración › Zonas / barrios: mapa */
.mapa-zonas svg { display: block; width: 100%; height: auto; background: #e5eef2; }
.mapa-zonas .zona-poligono path { fill-opacity: .28; stroke-width: 1.4; transition: fill-opacity .15s; cursor: pointer; }
.mapa-zonas .zona-poligono:hover path, .mapa-zonas .zona-poligono.activa path { fill-opacity: .6; stroke-width: 2.4; }
.mapa-zonas .zona-etiqueta { font: 700 9px system-ui, sans-serif; fill: #111827; text-anchor: middle; pointer-events: none; paint-order: stroke; stroke: #fff; stroke-width: 2.5px; }
.tabla-zonas tr.activa > td { background: var(--isad-tint); }
.tabla-zonas td .badge { font-size: .85rem; white-space: normal; text-align: left; }
.tabla-zonas tbody { border-top: 2px solid #dee2e6; }
.tabla-zonas .fila-zona > td { background: #f8fafc; }
.tabla-zonas tbody.activa .fila-zona > td { background: var(--isad-tint); }
.tabla-zonas .fila-barrio > td { font-size: .95rem; padding-top: .15rem; padding-bottom: .15rem; }
.tabla-zonas .fila-barrio > td:first-child { padding-left: 1.4rem; }

/* Mapa de usuarios (Zonas / barrios › Mapa de usuarios) */
.mapa-usuarios-wrap { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: .75rem; height: calc(100vh - 150px); min-height: 480px; }
.mapa-usuarios-panel { overflow: hidden; }
.mapa-usuarios-panel > .card-body { height: 100%; }
.mapa-usuarios-lista { overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.mapa-usuarios-mapa { position: relative; overflow: hidden; }
#mapa-usuarios.colocando, #mapa-usuarios.colocando .leaflet-interactive { cursor: crosshair; }
.mapa-colocando { position: absolute; z-index: 1000; top: .5rem; left: 50%; transform: translateX(-50%); background: #1a73e8; color: #fff; padding: .35rem .8rem; border-radius: 1rem; font-size: .9rem; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.pin-gmaps { background: none; border: 0; }
.pin-gmaps svg { filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.popup-usuario { min-width: 190px; }
@media (max-width: 768px) { .mapa-usuarios-wrap { grid-template-columns: 1fr; grid-template-rows: 60vh auto; height: auto; } .mapa-usuarios-panel { order: 2; max-height: 70vh; } }

/* Globo rojo de «sin leer» sobre un icono del menú */
.icono-globo { position: relative; display: inline-block; margin-right: .5rem; }
.globo-rojo { position: absolute; top: -.6rem; right: -.8rem; min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; border-radius: 1rem;
  background: #dc3545; color: #fff; font-size: .7rem; font-weight: 700; line-height: 1.15rem; text-align: center; box-shadow: 0 0 0 2px var(--isad, #0e7490); }
.punto-rojo { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: #dc3545; vertical-align: middle; }
.fila-sin-leer > td { background: #fff5f5; }

/* Secciones censales de cada barrio */
.secciones-wrap { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: .75rem; }
.secciones-mapa { height: calc(100vh - 260px); min-height: 420px; position: sticky; top: .5rem; }
.secciones-tabla { max-height: calc(100vh - 260px); min-height: 420px; overflow-y: auto; }
.secciones-tabla .secciones-calles { max-width: 16rem; }
.secciones-tabla tr.fila-activa > td { background: #fff3cd; }
@media (max-width: 991.98px) { .secciones-wrap { grid-template-columns: 1fr; } .secciones-mapa { position: static; height: 50vh; } .secciones-tabla { max-height: none; } }

/* Campo al que lleva un enlace (…#f_campo) */
.campo-destacado { outline: 3px solid #ffc107; outline-offset: 2px; animation: campo-latido 1.2s ease-in-out 3; }
@keyframes campo-latido { 50% { outline-color: rgba(255, 193, 7, .25); } }
[id^="f_"] { scroll-margin-top: 9rem; }

/* Control horario por turno */
.tabla-control { font-size: .74rem; table-layout: auto; }
.tabla-control th, .tabla-control td { padding: .2rem .25rem; vertical-align: middle; }
.tabla-control .ch-nombre { min-width: 11rem; max-width: 15rem; white-space: normal; }
.tabla-control .ch-finde { background: #eef2f7; }
.tabla-control .ch-festivo { background: #fde2e4; }
.tabla-control .ch-libre { background: #f1f3f5; }
.tabla-control .ch-fuera { background: repeating-linear-gradient(45deg, #f8f9fa, #f8f9fa 4px, #e9ecef 4px, #e9ecef 8px); }
.tabla-control .ch-vacio { background: #fffaeb; }
.tabla-control .ch-aus { color: #fff; font-weight: 600; font-size: .66rem; }
@media print { .tabla-control { font-size: .6rem; } body:has(.tabla-control) { page: apaisado; } }

.tabla-control .ch-solicitada { background: #fff; border: 2px dashed !important; font-weight: 700; }
.tabla-control .ch-deficit { background: #f8d7da; font-weight: 600; }

/* Barra de menú compacta: marca pequeña y enlaces en una línea */
.navbar-brand { margin-right: .75rem; padding-top: .15rem; padding-bottom: .15rem; }
.navbar-marca { height: 34px; width: auto; display: block; }
.navbar .nav-link { white-space: nowrap; }
@media (min-width: 992px) and (max-width: 1399.98px) {
  .navbar .navbar-nav .nav-link { padding-left: .4rem; padding-right: .4rem; font-size: .92rem; }
  .navbar .navbar-nav .nav-link .bi { margin-right: .1rem; }
  .navbar form input[type="search"], .navbar .buscar-global { max-width: 10rem; }
}

/* Mi ruta / Rutas: lista y mapa de Google con el recorrido */
.ruta-wrap.con-mapa { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.ruta-mapa iframe { width: 100%; height: calc(100vh - 160px); min-height: 420px; border: 0; border-radius: .5rem; display: block; }
.ruta-mapa { position: sticky; top: .5rem; }
@media (max-width: 991.98px) {
  .ruta-wrap.con-mapa { display: flex; flex-direction: column; }
  .ruta-wrap .ruta-mapa { order: -1; }
  .ruta-wrap .ruta { margin-left: auto; margin-right: auto; }
  .ruta-mapa { position: static; margin-bottom: 1rem; }
  .ruta-mapa iframe { height: 60vh; min-height: 300px; }
}

.ruta-paradas-mapa { width: 100%; height: calc(100vh - 200px); min-height: 420px; border-radius: .5rem; }
@media (max-width: 991.98px) { .ruta-paradas-mapa { height: 60vh; min-height: 300px; } }
.ruta-itinerario { font-size: .78rem; line-height: 1.6; }
.ruta-num, .ruta-marcador { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: #0E7490; color: #fff; font-weight: 700; }
.ruta-num { width: 1.25rem; height: 1.25rem; font-size: .7rem; }
.ruta-marcador { width: 28px; height: 28px; font-size: 13px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.ruta-marcador.hecha { background: #198754; }

/* Ruta en modo consulta: dos tarjetas por fila, más compactas */
.ruta-wrap.con-mapa:has(.ruta.compacta) { grid-template-columns: minmax(0, 720px) minmax(0, 1fr); }
.ruta.compacta { max-width: 720px; }
@media (min-width: 576px) { .ruta.compacta .ruta-cards { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; } .ruta.compacta .ruta-card { margin-bottom: 0 !important; } }
.ruta.compacta .ruta-card .card-body { padding: .6rem .75rem !important; }
.ruta.compacta .ruta-card .fs-5 { font-size: 1.05rem !important; }
.ruta.compacta .ruta-card .btn { padding: .1rem .45rem; font-size: .8rem; }
/* Mapa a pantalla completa */
.ruta-mapa.en-pantalla-completa, .ruta-mapa.ruta-mapa-max { background: #fff; padding: .75rem; overflow: auto; }
.ruta-mapa.ruta-mapa-max { position: fixed !important; inset: 0; z-index: 1080; display: block !important; }
.ruta-mapa.en-pantalla-completa iframe, .ruta-mapa.en-pantalla-completa .ruta-paradas-mapa,
.ruta-mapa.ruta-mapa-max iframe, .ruta-mapa.ruta-mapa-max .ruta-paradas-mapa { height: calc(100vh - 7rem); }

/* Cifras de la ruta */
.ruta-cifra { border-left: 3px solid var(--bs-primary); }
.ruta-cifra .fs-5 { font-variant-numeric: tabular-nums; }

/* Convenio colectivo */
.columnas-festivos { columns: 2; column-gap: 1.5rem; }
.columnas-festivos li { break-inside: avoid; }
.tabla-convenio { font-size: .9rem; }
.tabla-convenio input { min-width: 5.5rem; }

/* Firma del usuario en pantalla */
.firma-pad canvas { display: block; width: 100%; height: 150px; background: #fff; border: 1px dashed #94A3B8; border-radius: .375rem; touch-action: none; }
.firma-pad.firma-falta canvas { border: 2px solid var(--bs-danger); }

/* Escanear QR dentro de Mi ruta */
.qr-escaner { position: fixed; inset: 0; z-index: 2000; background: #000; display: flex; align-items: center; justify-content: center; }
.qr-escaner video { width: 100%; height: 100%; object-fit: cover; }
.qr-marco { position: absolute; width: min(70vw, 300px); aspect-ratio: 1; border: 3px solid #fff; border-radius: 1rem; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
.qr-texto { position: absolute; top: 1.2rem; left: 1rem; right: 1rem; text-align: center; color: #fff; font-size: 1.05rem; text-shadow: 0 1px 3px #000; }
.qr-cerrar { position: absolute; bottom: 1.5rem; left: 50%; transform: translateX(-50%); }

/* Cuadrantes (hoja como el Excel de la empresa) */
.cuad-cab { display: flex; gap: 1rem; align-items: center; margin-bottom: .6rem; }
.cuad-codigo { font-size: 2rem; font-weight: 800; color: #0E7490; border: 3px solid #0E7490; border-radius: .5rem; padding: .1rem .7rem; line-height: 1.2; }
.cuad-hoja { width: 100%; border-collapse: collapse; font-size: .85rem; }
.cuad-hoja th { background: #FFF2CC; border: 1px solid #555; padding: .3rem .35rem; text-align: center; }
.cuad-hoja td { border: 1px solid #555; padding: .3rem .35rem; vertical-align: middle; }
.cuad-hoja td.cuad-dia { background: #FFFF00; text-align: center; white-space: nowrap; font-weight: 600; }
.cuad-hoja tfoot td { background: #F3F4F6; }
tr.cuad-nueva-pareja > td { border-top: 2px solid #94A3B8; }
@media print {
  body:has(.cuad-papel) { page: apaisado; }
  .cuad-papel { border: 0 !important; box-shadow: none !important; }
  .cuad-papel .card-body { padding: 0 !important; }
  .cuad-salto { page-break-after: always; break-after: page; }
  .cuad-hoja { font-size: 9pt; }
  .cuad-hoja td.cuad-dia { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cuad-hoja th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.navbar form[role=search] input { min-width: 6.5rem; }
@media (min-width: 1200px) and (max-width: 1499.98px) { .navbar .nav-link { padding-left: .4rem; padding-right: .4rem; } }
/* Barra de menú: entre 992 y 1599 px el texto «Administración» queda solo con su icono para que quepa todo */
@media (min-width: 992px) and (max-width: 1599.98px) { .navbar .nav-link .d-xxl-inline { display: none !important; } }
/* Imágenes guardadas en la base de datos (logos de empresas) */
.crud-img { max-height: 2rem; max-width: 7.5rem; object-fit: contain; vertical-align: middle; }
.crud-img-prev { width: 12rem; height: 5rem; display: flex; align-items: center; justify-content: center; border: 1px dashed #ced4da; border-radius: .375rem; background: #fff; padding: .35rem; }
.crud-img-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.empresa-logo { max-height: 2.6rem; max-width: 9rem; object-fit: contain; }
/* Visitas domiciliarias de coordinación: calendario, formulario e informe */
.vd-cal { table-layout: fixed; min-width: 760px; }
.vd-cal td { height: 7.2rem; vertical-align: top; padding: .25rem; font-size: .9rem; }
.vd-cal td.vd-fuera { background: #f6f7f9; color: #9aa1aa; }
.vd-cal td.vd-finde { background: #fbfbfd; }
.vd-cal td.vd-hoy { box-shadow: inset 0 0 0 2px var(--isad, #0d6e8a); }
.vd-dia { font-weight: 700; }
.vd-mas { color: var(--isad, #0d6e8a); visibility: hidden; }
.vd-cal td:hover .vd-mas { visibility: visible; }
.vd-item { display: block; margin-top: .2rem; padding: .1rem .3rem; border-radius: .3rem; border-left: 4px solid transparent; text-decoration: none; color: #1f2937; line-height: 1.25;
           white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vd-item:hover { filter: brightness(.95); }
.vd-programada { background: #e7f0ff; } .vd-realizada { background: #e6f4ea; } .vd-no_realizada { background: #fff4d6; } .vd-cancelada { background: #eceef1; text-decoration: line-through; }
.vd-hora { font-variant-numeric: tabular-nums; font-weight: 600; }
.vd-tipo { background: #fff; color: #374151; border: 1px solid #cbd5e1; font-size: .7rem; }
.vd-leyenda { padding: 0 .35rem; border-radius: .25rem; }
.vd-pend .list-group-item { padding: .45rem .6rem; }
.vd-naranja { background-color: #fd7e14 !important; color: #fff !important; }
.vd-ind td, .vd-ind th { font-size: .95rem; }
.vd-ind .vd-radio { width: 1.2rem; height: 1.2rem; cursor: pointer; }
.vd-ind .vd-r1:checked { background-color: #198754; border-color: #198754; }
.vd-ind .vd-r2:checked { background-color: #ffc107; border-color: #ffc107; }
.vd-ind .vd-r3:checked { background-color: #fd7e14; border-color: #fd7e14; }
.vd-ind .vd-r4:checked { background-color: #dc3545; border-color: #dc3545; }
.vd-ind.is-invalid { box-shadow: inset 0 0 0 2px #dc3545; }
.vd-informe { max-width: 210mm; }
.vd-datos th { width: 17%; background: #f6f7f9; font-weight: 600; }
.vd-sec { margin-top: 1rem; padding-bottom: .2rem; border-bottom: 2px solid var(--isad, #0d6e8a); color: var(--isad-deep, #084c61); }
.vd-texto { white-space: normal; }
.vd-firma { border-top: 1px solid #333; padding-top: .3rem; margin-top: 3rem; font-size: .85rem; }
.vd-evol td, .vd-evol th { font-size: .95rem; }
@media print {
  .vd-cal td { height: 5.2rem; font-size: 7.5pt; }
  .vd-item { white-space: normal; }
  .vd-informe, .vd-informe .card-body { padding: 0 !important; max-width: none; }
  .vd-sec, .vd-tabla-ind { break-after: avoid; }
  .vd-firmas { break-inside: avoid; }
}
.vd-sin-alto { min-height: 0 !important; page-break-after: auto; break-after: auto; }
.vd-scroll { max-height: 70vh; overflow-y: auto; }
@media print { .vd-scroll { max-height: none; overflow: visible; } }
/* Que los colores de la escala y del calendario salgan también al imprimir */
.vd-informe .badge, .vd-evol .badge, .vd-cal .vd-item, .vd-cal .badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
/* Informe de visita domiciliaria: formato formal, en blanco y negro */
.vd-doc { max-width: 210mm; margin: 0 auto 2rem; background: #fff; color: #000; padding: 16mm 18mm; border: 1px solid #d0d0d0;
          font-family: Arial, Helvetica, sans-serif; font-size: 10.5pt; line-height: 1.45; }
.vd-doc-cab { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid #000; padding-bottom: 4mm; margin-bottom: 6mm; }
.vd-doc-logo-img { max-height: 16mm; max-width: 55mm; object-fit: contain; }
.vd-doc-ref { text-align: right; font-size: 9pt; }
.vd-doc-titulo { text-align: center; font-size: 14pt; font-weight: bold; letter-spacing: .06em; }
.vd-doc-subtitulo { text-align: center; font-size: 10.5pt; margin-bottom: 6mm; }
.vd-doc-h { font-size: 10.5pt; font-weight: bold; letter-spacing: .03em; margin: 6mm 0 2mm; padding-bottom: 1mm; border-bottom: 1px solid #000; color: #000; }
.vd-doc-h3 { font-size: 10.5pt; font-weight: bold; margin: 3mm 0 1mm; color: #000; }
.vd-doc-p { margin: 0 0 2mm; text-align: justify; }
.vd-doc-tabla { width: 100%; border-collapse: collapse; margin-bottom: 2mm; }
.vd-doc-tabla th, .vd-doc-tabla td { border: 1px solid #000; padding: 1.2mm 2mm; vertical-align: top; font-size: 10pt; }
.vd-doc-ficha th { width: 22%; font-weight: bold; background: none; }
.vd-doc-val thead th { font-weight: bold; text-align: center; font-size: 9.5pt; }
.vd-doc-val td:not(:first-child) { text-align: center; white-space: nowrap; }
.vd-doc-total td { font-weight: bold; }
.vd-doc-cambio { font-weight: normal; font-style: italic; }
.vd-doc-chk td:last-child { width: 22%; text-align: center; }
.vd-doc-nota { font-size: 8.5pt; margin: 0 0 2mm; }
.vd-doc-lugar { margin: 8mm 0 0; }
.vd-doc-firmas { display: flex; gap: 15mm; margin-top: 4mm; break-inside: avoid; }
.vd-doc-firmas > div { flex: 1; font-size: 9.5pt; }
.vd-doc-firma { height: 22mm; border-bottom: 1px solid #000; margin-bottom: 1.5mm; }
.vd-doc-pie { margin-top: 8mm; padding-top: 2mm; border-top: 1px solid #000; font-size: 7.5pt; text-align: justify; }
@media print {
  .vd-doc { border: none; padding: 0; max-width: none; margin: 0; }
  .vd-doc-h, .vd-doc-h3 { break-after: avoid; }
  .vd-doc-tabla tr { break-inside: avoid; }
}

/* Páginas de impresión con nombre: cada pantalla usa la orientación que le corresponde y no afecta a las demás.
   Por defecto A4 vertical; «apaisado» para hojas de control, cuadrantes y el calendario de visitas;
   «informe» para el informe de visita domiciliaria: vertical, márgenes en espejo para encuadernar a doble cara y número de página. */
@page apaisado { size: A4 landscape; margin: 8mm; }
@page informe {
  size: A4 portrait;
  margin: 18mm 15mm 20mm 22mm;
  @bottom-right { content: "Página " counter(page) " de " counter(pages); font: 8pt Arial, Helvetica, sans-serif; }
}
@page informe:left {
  margin: 18mm 22mm 20mm 15mm;
  @bottom-right { content: none; }
  @bottom-left { content: "Página " counter(page) " de " counter(pages); font: 8pt Arial, Helvetica, sans-serif; }
}
@media print {
  body:has(.vd-doc) { page: informe; }
  body:has(.vd-cal) { page: apaisado; }
  main .alert { display: none !important; }
  .vd-doc-cierre { break-inside: avoid; page-break-inside: avoid; }
}

/* Documentos del servicio: ficha de inicio/modificación, conformidad y cuadro de coordinación */
.doc-plan th, .doc-plan td { text-align: center; font-size: 9.5pt; padding: 1mm 1.2mm; }
.doc-plan td:nth-last-child(2), .doc-plan th:nth-last-child(2) { text-align: left; }
.doc-plan .doc-dia { width: 6mm; }
.doc-vacio { text-align: center !important; font-style: italic; color: #555; }
.doc-otros td:not(:first-child) { text-align: center; }
.vd-doc-lista { margin: 0 0 2mm 5mm; padding-left: 4mm; }
.vd-doc-lista li { margin-bottom: 1mm; }
.vd-doc-legal { font-size: 9pt; }
.doc-cuadro { max-width: 297mm; }
.doc-cuadro-tabla th, .doc-cuadro-tabla td { font-size: 8.5pt; padding: 1mm 1.2mm; }
.doc-cuadro-tabla .doc-col { text-align: center; width: 13mm; }
.doc-cuadro-tabla thead th.doc-col { font-size: 7.5pt; }
.doc-dom { font-size: 8pt; }
@media print { body:has(.doc-cuadro) { page: apaisado; } .doc-cuadro-tabla tr { break-inside: avoid; } }

/* Firma electrónica con CSV (documentos firmados y verificación) */
.vd-doc-firma.firma-e { height: auto; min-height: 22mm; border: 1px solid #000; border-radius: 0; padding: 1.5mm 2.5mm; font-size: 8.5pt; line-height: 1.35; }
.firma-e-sello { font-weight: 700; text-transform: uppercase; letter-spacing: .03em; font-size: 7.5pt; }
.firma-e-nombre { font-weight: 700; font-size: 9.5pt; }
.vd-doc-firma.firma-img { display: flex; align-items: flex-end; justify-content: center; }
.vd-doc-firma.firma-img img { max-height: 21mm; max-width: 100%; }
.vd-doc-firma.firma-pend { display: flex; align-items: center; justify-content: center; color: #555; font-style: italic; font-size: 8.5pt; }
.firma-nota { font-size: 7.5pt; color: #333; }
.firma-csv { display: flex; gap: 4mm; align-items: center; margin-top: 5mm; padding: 2.5mm 3mm; border: 1px solid #000; break-inside: avoid; page-break-inside: avoid; font-size: 7.8pt; line-height: 1.4; }
.firma-csv-qr { flex: 0 0 auto; }
.firma-csv-qr .qr-svg { display: block; }
.firma-csv-txt { flex: 1; }
.firma-csv-tit { font-weight: 700; font-size: 8.5pt; letter-spacing: .03em; }
.firma-csv-codigo { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 9.5pt; letter-spacing: .04em; }
.firma-csv-huella { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 7pt; word-break: break-all; }
.firma-csv-legal { font-size: 7pt; color: #333; }
.firma-fila-form > td { background: var(--bs-light); }
.firma-form .firma-pad { max-width: 520px; }
.verif-tabla th { width: 9rem; white-space: nowrap; font-weight: 600; }

/* Informe detallado del canon */
.canon-num th { text-align: center; font-size: 9pt; vertical-align: middle; }
.canon-num td { text-align: right; white-space: nowrap; }
.canon-num td:first-child, .canon-num td.canon-txt { text-align: left; white-space: normal; }
.canon-peq th, .canon-peq td { font-size: 8.5pt; padding: .8mm 1.5mm; }
.canon-usu th, .canon-usu td { font-size: 7.5pt; padding: .6mm 1.2mm; }
.canon-total td { font-size: 11pt; border-top: 2px solid #000; }

/* Franja del entorno de pruebas */
.entorno-pruebas { background: repeating-linear-gradient(45deg, #ffcc00, #ffcc00 14px, #222 14px, #222 28px); color: #fff; text-align: center; font-weight: 700; font-size: .8rem; letter-spacing: .05em; padding: 3px 0; text-shadow: 0 0 3px #000; }

/* Pie de página con el logo de iSAD */
.pie-app { display: flex; align-items: center; justify-content: center; gap: .75rem; flex-wrap: wrap; }
.pie-app .pie-logo { height: 34px; width: auto; }
