/* =============================================================================
   Panel — estilo limpio: espacio en blanco, tipografía del sistema, tarjetas de
   12 px y sombras sutiles. El color de acento llega desde /tema.css (--acento).
   ============================================================================= */

:root {
  --fondo: #f5f5f7;
  --superficie: #ffffff;
  --texto: #1d1d1f;
  --texto-suave: #6e6e73;
  --borde: #e5e5ea;
  --radio: 12px;
  --sombra: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  --alto-barra: 56px;
  --ancho-menu: 248px;
  --bs-body-font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-color: var(--texto);
  --bs-body-bg: var(--fondo);
  --bs-border-radius: 10px;
  --bs-border-color: var(--borde);
}

body {
  background: var(--fondo);
  color: var(--texto);
  -webkit-font-smoothing: antialiased;
}

.saltar {
  position: absolute;
  z-index: 2000;
  top: 8px;
  left: 8px;
  background: var(--superficie);
  padding: 8px 12px;
  border-radius: 8px;
}

html { scroll-padding-top: calc(var(--alto-barra) + 12px); }

/* --- Barra superior -------------------------------------------------------- */
.barra-superior {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--alto-barra);
  padding: 0 16px;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--borde);
}
.barra-superior .marca { font-weight: 700; color: var(--acento, #0a84ff); letter-spacing: -.01em; }
.barra-superior .separador { color: var(--borde); }
.barra-superior .nombre-contexto { font-weight: 600; min-width: 0; }
.boton-menu { font-size: 1.5rem; color: var(--texto); padding: 0 4px; }
.barra-superior .nombre-seccion { font-weight: 600; min-width: 0; }
.barra-superior .nombre-contexto { color: var(--texto-suave); }
@media (max-width: 991.98px) { .barra-superior .nombre-seccion { font-size: 1.05rem; } }
.banners-iconos { display: flex; gap: 2px; flex-shrink: 0; }
.banner-icono { font-size: 1.25rem; padding: 4px 8px; line-height: 1; border: 0; border-radius: 999px; }
.banner-icono-prueba { color: #0a6ebd; }
.banner-icono-gracia { color: #b26a00; }
.banner-icono-suspendida { color: #c62828; }
.banner-icono-soporte { color: #4b2a85; }
.modal-aviso .banner-estado { flex-wrap: wrap; }
.modal-aviso .banner-estado .btn { margin-left: 0 !important; }
.offcanvas-header .marca { font-weight: 700; color: var(--acento, #0a84ff); }
.nombre-contexto-menu { font-size: .9rem; font-weight: 600; color: var(--texto-suave); }
.min-w-0 { min-width: 0; }

/* Botón principal de crear ("Nueva sucursal", "Subir spots"…): en móvil flota abajo a la derecha, solo con icono. */
@media (max-width: 991.98px) {
  .btn-flotante {
    position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 1035;
    width: 56px; height: 56px; padding: 0; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
  }
  .btn-flotante .texto-boton { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  body:has(.btn-flotante) .contenido { padding-bottom: 88px; }
  /* El título de la lista ya está en la barra superior (sección actual): no se repite. Si en el
     encabezado no queda nada más, tampoco deja su espacio. */
  .encabezado-pagina .titulo-seccion { display: none; }
  .encabezado-pagina:not(:has(> :not(.titulo-seccion, .solo-flotante, .btn-flotante))) { margin-bottom: 0; }
  body:has(.btn-flotante) .toast-container { bottom: 80px !important; }
}
.boton-usuario { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; background: transparent; border-color: var(--borde); }

/* --- Menú lateral ---------------------------------------------------------- */
.contenedor-panel { display: flex; min-height: calc(100vh - var(--alto-barra)); }

.menu-lateral { background: var(--superficie); }
@media (min-width: 992px) {
  .menu-lateral {
    width: var(--ancho-menu);
    flex: 0 0 var(--ancho-menu);
    border-right: 1px solid var(--borde);
    position: sticky;
    top: var(--alto-barra);
    height: calc(100vh - var(--alto-barra));
    overflow-y: auto;
    padding: 16px 12px;
  }
}
.menu-lista .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--texto);
  font-weight: 500;
}
.menu-lista .nav-link i { font-size: 1.1rem; color: var(--texto-suave); }
.menu-lista .nav-link:hover { background: var(--fondo); }
.menu-lista .nav-link.active { background: rgba(var(--acento-rgb, 10, 132, 255), .1); color: var(--acento, #0a84ff); }
.menu-lista .nav-link.active i { color: var(--acento, #0a84ff); }

/* --- Contenido ------------------------------------------------------------- */
.contenido { flex: 1; min-width: 0; padding: 24px 16px 48px; }
@media (min-width: 768px) { .contenido { padding: 32px 32px 64px; } }
.contenido:focus { outline: none; }

.encabezado-pagina { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 24px; }
.encabezado-pagina h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.encabezado-pagina .acciones { margin-left: auto; display: flex; gap: 8px; }

.tarjeta {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 20px;
}
.tarjeta + .tarjeta { margin-top: 16px; }
.tarjeta-dato .valor { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.tarjeta-dato .etiqueta { color: var(--texto-suave); font-size: .875rem; }

.banner-estado { display: flex; align-items: center; gap: 8px; border-radius: var(--radio); margin-bottom: 16px; }
.banner-soporte { background: #efe7fb; color: #4b2a85; border: 1px solid #d8c6f5; }

/* --- Tablas ---------------------------------------------------------------- */
.tabla-panel { margin: 0; }
.tabla-panel thead th {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--texto-suave);
  border-bottom-color: var(--borde);
  white-space: nowrap;
}
.tabla-panel td { vertical-align: middle; border-color: var(--borde); }
.tabla-panel th a { color: inherit; text-decoration: none; }
.filtros { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filtros .form-control, .filtros .form-select { max-width: 260px; }

/* Filtros en móvil: tarjeta colapsable (filtros_inicio() en layout.php) */
.filtros-cabecera { display: flex; align-items: center; gap: 8px; width: 100%; padding: 12px 14px; background: none; border: 0; color: var(--texto); font-weight: 600; text-align: left; }
.filtros-cabecera .bi-chevron-down { transition: transform .2s ease; }
.filtros-cabecera[aria-expanded="true"] .bi-chevron-down { transform: rotate(180deg); }
@media (max-width: 991.98px) {
  .filtros-movil { border: 1px solid var(--borde); border-radius: 12px; margin-bottom: 16px; background: var(--superficie); }
  .filtros-movil .filtros { padding: 0 14px 14px; margin-bottom: 0; }
  .filtros-movil .filtros .form-control, .filtros-movil .filtros .form-select { max-width: none; flex: 1 1 100%; }
}

/* Mi cuenta y Cerrar sesión al final del menú lateral (solo móvil) */
.menu-usuario { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--borde); }
.menu-usuario-nombre { display: flex; align-items: center; gap: 10px; padding: 4px 12px 8px; color: var(--texto-suave); font-size: .9rem; min-width: 0; }
.menu-usuario button.nav-link { background: none; border: 0; }

/* Barras de progreso: el ancho lo pone app.js desde data-ancho (sin estilos inline por la CSP) */
.barra-uso { height: 8px; border-radius: 999px; background: var(--fondo); overflow: hidden; }
.barra-uso > span { display: block; height: 100%; width: 0; background: var(--acento, #0a84ff); border-radius: inherit; transition: width .3s ease; }
.barra-uso.alto > span { background: #ff9f0a; }
.barra-uso.lleno > span { background: #ff3b30; }

/* --- Estado vacío ---------------------------------------------------------- */
.estado-vacio { text-align: center; padding: 48px 16px; }
.estado-vacio-ilustracion { width: 120px; height: 80px; margin-bottom: 16px; }
.ev-pantalla { fill: var(--fondo); stroke: var(--borde); stroke-width: 2; }
.ev-base { fill: var(--borde); }
.ev-circulo { fill: rgba(var(--acento-rgb, 10, 132, 255), .2); }

/* --- Formularios ----------------------------------------------------------- */
.form-control, .form-select { border-radius: 10px; }
.form-control:focus, .form-select:focus { border-color: var(--acento, #0a84ff); box-shadow: 0 0 0 .2rem rgba(var(--acento-rgb, 10, 132, 255), .2); }
.btn { border-radius: 10px; font-weight: 500; }
.btn-primary {
  --bs-btn-bg: var(--acento, #0a84ff);
  --bs-btn-border-color: var(--acento, #0a84ff);
  --bs-btn-hover-bg: var(--acento, #0a84ff);
  --bs-btn-hover-border-color: var(--acento, #0a84ff);
  --bs-btn-active-bg: var(--acento, #0a84ff);
  --bs-btn-disabled-bg: var(--acento, #0a84ff);
  --bs-btn-disabled-border-color: var(--acento, #0a84ff);
}
.btn-primary:hover { filter: brightness(1.08); }

/* --- Páginas públicas y de error ------------------------------------------ */
.pagina-publica { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.tarjeta-publica {
  width: 100%;
  max-width: 420px;
  background: var(--superficie);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 32px;
}
.tarjeta-publica.tarjeta-ancha { max-width: 820px; }
.texto-legal h2 { font-size: 1.1rem; font-weight: 700; margin: 24px 0 8px; }
.texto-legal p, .texto-legal li { color: var(--texto); line-height: 1.55; }
.texto-legal .pendiente { color: #b26a00; font-weight: 600; }
/* Términos dentro del panel (bienvenida, contrato): caja con su propio scroll. */
.caja-legal { max-height: 52vh; overflow-y: auto; padding: 4px 16px 12px; border: 1px solid var(--bs-border-color); border-radius: 10px; background: var(--bs-body-bg); }
.caja-legal h2:first-child { margin-top: 12px; }
.lista-plan li { padding: 3px 0; }
.codigo-error { font-size: 3rem; font-weight: 700; color: var(--acento, #0a84ff); margin: 0; }

.toast { border-radius: var(--radio); }

/* --- Acceso (login, código, recuperar, invitación) ------------------------ */
.marca-publica { margin-bottom: 20px; text-align: center; }
.marca-publica img { width: 180px; max-width: 60%; height: auto; }
.tarjeta-publica h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: 8px; }
.tarjeta-publica .subtitulo { color: var(--texto-suave); margin-bottom: 24px; }
.campo-trampa { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.separador-o { display: flex; align-items: center; gap: 12px; color: var(--texto-suave); font-size: .875rem; margin: 20px 0; }
.separador-o::before, .separador-o::after { content: ""; flex: 1; height: 1px; background: var(--borde); }
.casillas-codigo { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; }
.casillas-codigo input {
  width: 48px; height: 56px; text-align: center; font-size: 1.5rem; font-weight: 600;
  border: 1px solid var(--borde); border-radius: 10px; background: var(--fondo);
}
.casillas-codigo input:focus { outline: none; border-color: var(--acento, #0a84ff); box-shadow: 0 0 0 .2rem rgba(var(--acento-rgb, 10, 132, 255), .2); background: #fff; }
@media (max-width: 380px) { .casillas-codigo input { width: 40px; height: 50px; } }
.fuerza { height: 6px; border-radius: 999px; background: var(--fondo); overflow: hidden; margin-top: -8px; margin-bottom: 4px; }
.fuerza > span { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.fuerza[data-nivel="1"] > span { width: 25%; background: #ff3b30; }
.fuerza[data-nivel="2"] > span { width: 50%; background: #ff9f0a; }
.fuerza[data-nivel="3"] > span { width: 75%; background: #30d158; }
.fuerza[data-nivel="4"] > span { width: 100%; background: #248a3d; }
.enlace-discreto { color: var(--texto-suave); font-size: .875rem; }
.qr-totp img { width: 200px; height: 200px; image-rendering: pixelated; }
.lista-simple { list-style: none; padding: 0; margin: 0; }
.lista-simple li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--borde); }
.lista-simple li:last-child { border-bottom: 0; }
.valor-una-vez { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.6rem; font-weight: 600; letter-spacing: .08em; text-align: center; background: var(--fondo); border-radius: 10px; padding: 16px; user-select: all; }
.tabla-acciones { white-space: nowrap; text-align: end; }
.dato-etiqueta { color: var(--texto-suave); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.dato-valor { font-weight: 500; margin-bottom: 14px; overflow-wrap: anywhere; }
.nav-pestanas { border-bottom: 1px solid var(--borde); margin-bottom: 20px; gap: 4px; flex-wrap: nowrap; overflow-x: auto; }
.nav-pestanas .nav-link { color: var(--texto-suave); border: 0; border-bottom: 2px solid transparent; border-radius: 0; white-space: nowrap; }
.nav-pestanas .nav-link.active { color: var(--acento, #0a84ff); border-bottom-color: var(--acento, #0a84ff); background: none; }
.campo-secreto-estado { color: var(--texto-suave); }
/* Los textos .visually-hidden (position: absolute) dentro de una tabla desplazable se escapaban del
   contenedor y ensanchaban toda la página en el celular: el contenedor es su referencia. */
.table-responsive { position: relative; }
.table-responsive.dropdown-abierto, .tarjeta.dropdown-abierto { overflow: visible; }
.text-pre { white-space: pre-wrap; }
.form-angosto { max-width: 640px; }
.lista-pasos li.hecho { color: var(--texto-suave); }
.paso-numero { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .85rem; background: rgba(var(--acento-rgb, 10, 132, 255), .12); color: var(--acento, #0a84ff); flex: 0 0 28px; }
.lista-pasos li.hecho .paso-numero { background: #e8f8ec; color: #248a3d; }

/* --- Spots ---------------------------------------------------------------- */
.rejilla-spots { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.tarjeta-spot { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: box-shadow .15s; }
.tarjeta-spot:hover { box-shadow: var(--sombra); color: inherit; }
.tarjeta-spot .miniatura, .tarjeta-spot .miniatura-vacia { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #111; }
.miniatura-vacia { display: flex; align-items: center; justify-content: center; color: #8e8e93; font-size: 1.6rem; background: var(--fondo); }
.tarjeta-spot .cuerpo { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.tarjeta-spot .nombre { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tarjeta-spot .meta { font-size: .78rem; color: var(--texto-suave); }
.tarjeta-spot .badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: auto; }
.miniatura-lista { width: 72px; height: 40px; object-fit: cover; border-radius: 6px; background: #111; display: inline-flex; }
.zona-soltar { border: 2px dashed var(--borde); border-radius: var(--radio); padding: 36px 16px; text-align: center; background: var(--superficie); transition: border-color .15s, background .15s; cursor: pointer; }
.zona-soltar.encima { border-color: var(--acento, #0a84ff); background: rgba(var(--acento-rgb, 10, 132, 255), .05); }
.zona-soltar i { font-size: 2.2rem; color: var(--acento, #0a84ff); }
.fila-subida { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--borde); }
@media (min-width: 768px) { .fila-subida { grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1.6fr); align-items: center; } }
.fila-subida:last-child { border-bottom: 0; }
.fila-subida .archivo { min-width: 0; }
.fila-subida .archivo .nombre-archivo { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.estado-subida { font-size: .85rem; }
.vista-previa-spot { background: #000; border-radius: var(--radio); overflow: hidden; display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9; }
.vista-previa-spot img, .vista-previa-spot video { max-width: 100%; max-height: 100%; object-fit: contain; }
.atajo { display: inline-block; border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; font-size: .75em; margin-left: 6px; opacity: .8; }

/* --- Playlists (13.4.10–13.4.11) ------------------------------------------------------------- */
.lista-playlist { list-style: none; padding: 0; margin: 0; }
.item-playlist { display: grid; grid-template-columns: auto 72px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 8px; border: 1px solid var(--borde); border-radius: 10px; background: var(--superficie); margin-bottom: 8px; }
.item-playlist.arrastrando { opacity: .4; }
.item-playlist.destino-arriba { box-shadow: inset 0 3px 0 var(--acento, #0a84ff); }
.item-playlist.destino-abajo { box-shadow: inset 0 -3px 0 var(--acento, #0a84ff); }
.item-playlist.atenuado .miniatura-lista, .item-playlist.atenuado .nombre-item { opacity: .5; }
.item-playlist .asa { cursor: grab; color: var(--texto-suave); font-size: 1.2rem; padding: 4px; touch-action: none; }
.item-playlist .numero { font-size: .75rem; color: var(--texto-suave); display: block; text-align: center; }
.item-playlist .nombre-item { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.item-playlist .meta-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .8rem; color: var(--texto-suave); margin-top: 2px; }
.item-playlist .aviso-item { font-size: .78rem; margin-top: 2px; }
.item-playlist .duracion-item { width: 76px; }
.item-playlist .controles { display: flex; gap: 4px; }
.item-playlist .controles .btn { padding: 2px 8px; }
@media (max-width: 575.98px) {
  .item-playlist { grid-template-columns: auto 56px minmax(0, 1fr); }
  .item-playlist .controles { grid-column: 1 / -1; justify-content: flex-end; }
  .item-playlist .miniatura-lista { width: 56px; height: 32px; }
}
.pie-playlist { display: flex; flex-wrap: wrap; gap: 4px 16px; padding-top: 12px; border-top: 1px solid var(--borde); margin-top: 4px; }
.barra-guardar { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 12px 16px; background: rgba(245, 245, 247, .92); backdrop-filter: blur(8px); border-top: 1px solid var(--borde); margin: 0 -4px; }
.rejilla-seleccion .tarjeta-spot { cursor: pointer; position: relative; }
.rejilla-seleccion .tarjeta-spot input[type="checkbox"] { position: absolute; top: 8px; left: 8px; width: 1.2rem; height: 1.2rem; z-index: 1; }
.rejilla-seleccion .tarjeta-spot.seleccionado { border-color: var(--acento, #0a84ff); box-shadow: 0 0 0 2px var(--acento, #0a84ff); }
.modal-oscuro { background: #111; color: #fff; }
.escenario-preview { position: relative; background: #000; overflow: hidden; margin: 0 auto; border-radius: 8px; }
.escenario-preview.horizontal { aspect-ratio: 16 / 9; width: 100%; }
.escenario-preview.vertical { aspect-ratio: 9 / 16; height: min(70vh, 720px); }
.escenario-preview .capa { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: 0; }
.escenario-preview .capa.visible { opacity: 1; }
.escenario-preview.fundido .capa { transition: opacity .5s ease; }
.escenario-preview .capa img, .escenario-preview .capa video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.preview-mensaje { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; color: rgba(255, 255, 255, .7); }
.preview-mensaje:empty { display: none; }
.min-w-0 { min-width: 0; }

/* --- Programación (13.4.13) ------------------------------------------------------------------ */
.chip-dia { width: 42px; padding-left: 0; padding-right: 0; font-weight: 600; border: 1px solid var(--borde); background: var(--superficie); color: var(--texto-suave); }
.chip-dia:hover { border-color: var(--acento, #0a84ff); color: var(--acento, #0a84ff); background: var(--superficie); }
.btn-check:checked + .chip-dia { background: var(--acento, #0a84ff); border-color: var(--acento, #0a84ff); color: #fff; }
.btn-check:focus-visible + .chip-dia { box-shadow: 0 0 0 .2rem rgba(var(--acento-rgb, 10, 132, 255), .3); }
.lista-casillas { max-height: 260px; overflow-y: auto; padding: 8px 12px; border: 1px solid var(--borde); border-radius: 10px; background: var(--fondo); }

/* --- Pantallas (13.4.4–13.4.6, 13.3.8) ------------------------------------------------------- */
.codigo-emparejar { letter-spacing: .4em; font-weight: 700; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.pasos-emparejar { padding-left: 1.2rem; color: var(--texto-suave); }
/* Código con el botón de cámara dentro del campo */
.campo-codigo { position: relative; }
.campo-codigo .codigo-emparejar { padding-left: 3.25rem; padding-right: 3.25rem !important; background-image: none !important; }  /* sin el ícono de validación: ahí va la cámara */
.boton-camara {
  position: absolute; top: 0; right: 4px; font-size: 1.25rem;
  height: calc(1.5em + 1rem + 2px); width: 2.75rem;          /* alto del form-control-lg, aunque abajo aparezca un error */
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 8px; color: var(--acento, #0a84ff);
}
.boton-camara:hover, .boton-camara:focus-visible { background: var(--fondo); }
.boton-camara.d-none { display: none !important; }
/* Lector de QR */
.lector-qr { position: relative; margin-top: 12px; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.lector-qr video { width: 100%; height: 100%; object-fit: cover; display: block; }
.lector-marco { position: absolute; inset: 18% 22%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 16px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); }
.lector-ayuda { position: absolute; left: 0; right: 0; bottom: 44px; margin: 0; text-align: center; color: #fff; font-size: .9rem; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.lector-cerrar { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); }
.linea-dia { position: relative; height: 28px; border-radius: 8px; background: var(--fondo); overflow: hidden; border: 1px solid var(--borde); }
.linea-dia .tramo { position: absolute; top: 0; bottom: 0; border-right: 1px solid var(--superficie); }
.tramo-programacion { background: var(--acento, #0a84ff); }
.tramo-default { background: rgba(var(--acento-rgb, 10, 132, 255), .35); }
.tramo-sin_contenido { background: repeating-linear-gradient(45deg, #e5e5ea, #e5e5ea 4px, #f5f5f7 4px, #f5f5f7 8px); }
.linea-dia .marca-ahora { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #1d1d1f; }
.horas-dia { display: flex; justify-content: space-between; margin-top: 4px; }
.punto { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 12px; }
.disponibilidad { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; text-align: center; }
.barra-vertical { height: 90px; background: var(--fondo); border-radius: 8px; position: relative; overflow: hidden; border: 1px solid var(--borde); }
.barra-vertical span { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: #34c759; }
.datos-lista { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; }
.datos-lista dt { font-weight: 500; color: var(--texto-suave); }
.datos-lista dd { margin: 0; overflow-wrap: anywhere; }
.lista-errores { padding-left: 1rem; max-height: 200px; overflow-y: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .75rem; }

/* Casillas, radios e interruptores con el color de acento (no el azul de Bootstrap). */
.form-check-input:checked { background-color: var(--acento, #0a84ff); border-color: var(--acento, #0a84ff); }
.form-check-input:focus { border-color: var(--acento, #0a84ff); box-shadow: 0 0 0 .2rem rgba(var(--acento-rgb, 10, 132, 255), .2); }

/* Imágenes de sistema (D-009) */
.imagen-sistema { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--borde); }
.imagen-sistema .vista { width: 96px; aspect-ratio: 16 / 9; border-radius: 6px; background: #111; display: flex; align-items: center; justify-content: center; overflow: hidden; flex: 0 0 96px; }
.imagen-sistema .vista img { width: 100%; height: 100%; object-fit: contain; }
.imagen-sistema .vista .text-secondary { color: #8e8e93 !important; }

/* Login con passkey: solo el ícono de huella, sin forma de botón (sí con foco visible por teclado). */
.btn-huella { background: none; border: 0; padding: 4px; line-height: 1; color: var(--acento, #0a84ff); font-size: 2.8rem; cursor: pointer; border-radius: 12px; transition: transform .15s, opacity .15s; }
.btn-huella:hover { transform: scale(1.08); }
.btn-huella:active { transform: scale(.96); }
.btn-huella:disabled { opacity: .5; }
.acceso-biometrico { text-align: center; }
.tarjeta-publica h1.titulo-login { font-size: 1.1rem; font-weight: 600; text-align: center; margin-bottom: 20px; }
.btn-huella-grande { font-size: 4.5rem; }
.btn-huella:focus-visible { outline: 3px solid rgba(var(--acento-rgb, 10, 132, 255), .4); outline-offset: 2px; }

/* Página "Sin conexión" de la app instalada (D-029) */
.icono-sin-conexion { border-radius: 22px; margin-bottom: 16px; box-shadow: 0 2px 10px rgba(0, 0, 0, .08); }

/* --- Reportes (13.4.15, 13.4.16) ------------------------------------------ */
.pestanas-reportes .nav-link { border-radius: 999px; padding: 6px 16px; color: var(--texto); }
.pestanas-reportes .nav-link.active { background: var(--acento, #0a84ff); color: #fff; }
.filtros-reportes { align-items: flex-end; }
.filtros-reportes .campo-fecha { display: flex; flex-direction: column; gap: 2px; }
.filtros-reportes .campo-fecha .form-control { max-width: 170px; }
.resumen-reporte { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding-top: 4px; }
.resumen-reporte > div { background: var(--fondo); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; }
.resumen-reporte .cifra { font-size: 1.45rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.resumen-reporte .etiqueta { font-size: .85rem; color: var(--texto-suave); }
.tabla-panel tfoot th { border-top: 2px solid var(--borde); }
.col-barra { min-width: 180px; }
@media (max-width: 991.98px) {
  .filtros-reportes .campo-fecha { flex: 1 1 45%; }
  .filtros-reportes .campo-fecha .form-control { max-width: none; }
}
@media (max-width: 575.98px) {
  .resumen-reporte { grid-template-columns: repeat(2, 1fr); }
}

/* Tablas que en el celular se apilan como tarjetas: cada <td data-etiqueta="…"> muestra su etiqueta. */
@media (max-width: 575.98px) {
  .tabla-apilada thead { display: none; }
  .tabla-apilada, .tabla-apilada tbody, .tabla-apilada tfoot, .tabla-apilada tr, .tabla-apilada td, .tabla-apilada th { display: block; width: 100%; }
  .tabla-apilada tr { border: 1px solid var(--borde); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--superficie); }
  .tabla-apilada td, .tabla-apilada tfoot th { border: 0; padding: 3px 0; text-align: left !important; background: transparent; box-shadow: none; }
  .tabla-apilada { --bs-table-bg: transparent; --bs-table-hover-bg: transparent; }
  .tabla-apilada [data-etiqueta] { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .tabla-apilada [data-etiqueta]::before { content: attr(data-etiqueta); color: var(--texto-suave); font-size: .85rem; flex-shrink: 0; }
  .tabla-apilada td.col-barra { display: block; }
  .tabla-apilada td.col-barra::before { display: block; margin-bottom: 4px; }
  .tabla-apilada tfoot tr { background: var(--fondo); }
  .tabla-apilada tfoot th[colspan] { font-weight: 700; }
  .table-responsive:has(> .tabla-apilada) { overflow: visible; }
}

/* --- Comandos remotos (detalle de pantalla, bloque 2B) --------------------- */
.botones-comandos { display: flex; flex-wrap: wrap; gap: 6px; }
.historial-comandos { list-style: none; padding: 0; margin: 12px 0 0; border-top: 1px solid var(--borde); }
.historial-comandos li { padding: 8px 0; border-bottom: 1px solid var(--borde); }
.historial-comandos summary { cursor: pointer; color: var(--acento, #0a84ff); }
.diagnostico-remoto dd { word-break: break-word; }

/* --- Sesiones activas (Mi cuenta, bloque 2B) ------------------------------- */
.lista-sesiones { list-style: none; padding: 0; margin: 0 0 12px; }
.lista-sesiones li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--borde); }
.lista-sesiones li > .bi { font-size: 1.4rem; color: var(--texto-suave); }
.lista-sesiones .min-w-0 { min-width: 0; }
.historial-comandos .badge { align-self: flex-start; flex-shrink: 0; }

/* --- Programación: vista semanal (13.4.12, bloque 2C) ---------------------- */
.barra-semana { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.barra-semana .filtros { margin: 0; }
.semana-desplazable { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.semana { display: grid; grid-template-columns: 38px repeat(7, minmax(92px, 1fr)); min-width: 720px; }
.semana-horas { position: relative; margin-top: 34px; height: 720px; }
.semana-horas span { position: absolute; right: 6px; transform: translateY(-50%); font-size: .72rem; color: var(--texto-suave); }
.semana-cabecera { height: 34px; display: flex; flex-direction: column; justify-content: center; text-align: center; font-size: .8rem; font-weight: 600; line-height: 1.15; }
.semana-dia.hoy .semana-cabecera { color: var(--acento, #0a84ff); }
.semana-cuerpo { position: relative; height: 720px; border-left: 1px solid var(--borde);
  background: repeating-linear-gradient(to bottom, var(--borde) 0 1px, transparent 1px 60px); }
.semana-dia:last-child .semana-cuerpo { border-right: 1px solid var(--borde); }
.semana-dia.hoy .semana-cuerpo { background-color: rgba(var(--acento-rgb, 10,132,255), .04); }
.bloque-prog { position: absolute; border-radius: 6px; padding: 2px 5px; overflow: hidden; text-decoration: none; font-size: .72rem; line-height: 1.2;
  border-left: 3px solid; display: flex; flex-direction: column; }
.bloque-prog:hover { filter: brightness(.95); z-index: 2; }
.bloque-prog .bloque-nombre { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bloque-prog .bloque-hora { opacity: .8; white-space: nowrap; }
.bloque-prog.corto .bloque-hora { display: none; }
.prioridad-normal { background: rgba(10, 132, 255, .13); border-color: #0a84ff; color: #0a3d75; }   /* fijo: no depende del acento, para no confundirse con "Urgente" */
.prioridad-alta { background: rgba(255, 159, 10, .2); border-color: #ff9f0a; color: #7a4a00; }
.prioridad-urgente { background: rgba(255, 59, 48, .16); border-color: #ff3b30; color: #8a1c15; }
.linea-ahora { position: absolute; left: 0; right: 0; height: 2px; background: #ff3b30; z-index: 3; pointer-events: none; }
.leyenda-semana { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; align-items: center; }
.leyenda-semana .muestra { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border-left: 3px solid; vertical-align: -1px; margin-right: 4px; }

/* --- Simulador "¿Qué se ve?" (13.4.14, bloque 2C) ---------------------------- */
.form-simulador { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form-simulador > div { flex: 1 1 180px; }
.form-simulador > div:first-child { flex: 2 1 260px; }
.resultado-principal { font-size: 1.15rem; font-weight: 600; margin-bottom: 6px; }
.lista-simulador, .lista-candidatas { padding-left: 1.2rem; margin: 0; }
.lista-simulador li { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.lista-candidatas li { padding: 6px 0; border-bottom: 1px solid var(--borde); }
.lista-candidatas li:last-child { border-bottom: 0; }

/* --- Super admin: auditoría y JSON (bloque 2D) ---------------------------- */
.json-detalle { max-height: 320px; overflow: auto; background: var(--fondo); border-radius: 8px; padding: 8px 10px; font-size: .78rem; margin: 6px 0 0; white-space: pre-wrap; word-break: break-word; }
.banner-estado .btn { white-space: nowrap; }

/* --- Indicador de carga: spinner centrado mientras corre una acción o cambia la página (app.js) --- */
.cargando {
  position: fixed; inset: 0; z-index: 2000; display: none; align-items: center; justify-content: center;
  background: rgba(245, 245, 247, .55); backdrop-filter: blur(1px); cursor: progress;
}
.cargando.visible { display: flex; }
.cargando-caja {
  width: 76px; height: 76px; border-radius: 18px; background: var(--superficie, #fff);
  display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 28px rgba(0, 0, 0, .16);
}
.cargando .spinner-border { width: 2.4rem; height: 2.4rem; border-width: .25em; color: var(--acento, #0a84ff); }

/* --- Cintillos (D-044) ------------------------------------------------------ */
.lista-cintillos { list-style: none; padding: 0; margin: 0; }
.lista-cintillos li { padding: 12px 0; border-bottom: 1px solid var(--borde); }
.lista-cintillos li:last-child { border-bottom: 0; }
.muestra-cintillo { display: block; padding: 10px 14px; border-radius: 8px; font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vista-previa-cintillo { position: relative; border-radius: 10px; overflow: hidden; background: #111; aspect-ratio: 16 / 9; max-height: 260px; width: 100%; }
.vista-previa-cintillo .vp-pantalla { position: absolute; inset: 0; background: linear-gradient(135deg, #2a2f3a, #14171d); }
.vista-previa-cintillo .vp-etiqueta { position: absolute; top: 10px; left: 12px; color: rgba(255, 255, 255, .55); font-size: .8rem; }
.vista-previa-cintillo .vp-cintillo { position: absolute; left: 0; right: 0; bottom: 0; height: 13%; min-height: 26px; overflow: hidden; white-space: nowrap; display: flex; align-items: center; }
.vista-previa-cintillo .vp-cinta { display: inline-block; padding-left: 100%; white-space: nowrap; font-weight: 600; font-size: clamp(.8rem, 3.2vw, 1.15rem); }
.vista-previa-cintillo .vp-cinta.corriendo { animation: cintillo-correr 10s linear infinite; }
.lista-mensajes { list-style: none; padding: 0; margin: 0 0 .5rem; counter-reset: mensaje; }
.mensaje-cintillo { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; counter-increment: mensaje; }
.mensaje-cintillo::before { content: counter(mensaje); flex: 0 0 1.4em; text-align: right; color: var(--bs-secondary-color); font-size: .85rem; }
.mensaje-cintillo .form-control { flex: 1 1 auto; min-width: 0; }
.vista-previa-cintillo .vp-separador { padding: 0 .35em; opacity: .75; }
.lista-mensajes-revision { margin: 6px 0 0; padding-left: 1.4em; font-size: .9rem; }
@keyframes cintillo-correr { from { transform: translateX(0); } to { transform: translateX(-100%); } }
.decidir-cintillo summary { list-style: none; }
.decidir-cintillo summary::-webkit-details-marker { display: none; }
.decidir-cintillo[open] { flex-basis: 100%; }

/* Contrato (D-049): firma en el celular, QR y documento imprimible. */
.pasos-firma { list-style: none; padding-left: 0; }
.pasos-firma > li { margin-bottom: 1.4rem; }
.pasos-firma .caja-legal { max-height: 40vh; }
.foto-ine { display: block; cursor: pointer; }
.foto-ine-vista { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; aspect-ratio: 85.6 / 54;
  border: 2px dashed var(--bs-border-color); border-radius: 10px; color: var(--bs-secondary-color); overflow: hidden; font-size: .9rem; }
.foto-ine-vista .bi { font-size: 1.8rem; }
.foto-ine-vista img { width: 100%; height: 100%; object-fit: cover; }
.lienzo-firma { display: block; width: 100%; height: 180px; border: 1px solid var(--bs-border-color); border-radius: 10px; background: #fff; touch-action: none; }
.qr-firma img { width: 220px; max-width: 100%; height: auto; image-rendering: pixelated; }
.documento-contrato { background: #e9ecef; }
.hoja-contrato { max-width: 820px; margin: 24px auto; padding: 40px 48px; background: #fff; color: #111; border-radius: 6px; box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.hoja-contrato .contrato-titulo { text-align: center; font-size: 1.05rem; }
.firma-contrato { margin-top: 32px; text-align: center; }
.firma-contrato img { max-width: 280px; height: auto; border-bottom: 1px solid #333; }
.evidencia-contrato th { width: 34%; font-weight: 600; }
.evidencia-contrato td { word-break: break-all; }
.ine-contrato { display: flex; flex-wrap: wrap; gap: 12px; }
.ine-contrato img { width: calc(50% - 6px); min-width: 260px; height: auto; border: 1px solid #ccc; border-radius: 6px; }
@media print {
  .documento-contrato { background: #fff; }
  .hoja-contrato { margin: 0; padding: 0; box-shadow: none; max-width: none; }
  .salto-antes { break-before: page; }
}
