/* Safety Tech — sistema visual sobre Bootstrap 5
   Inspirado en la señalética vial: placas verdes de ruta, rombos amarillos de
   advertencia y el octágono rojo de PARE. Barlow nació de los letreros de carretera.
   Bootstrap aporta la rejilla, los componentes y el comportamiento; aquí solo se
   ajusta su paleta y se definen las piezas propias (señales, medidores, gráficos). */

:root {
  --asfalto: #1d242b;
  --asfalto-2: #262f38;
  --asfalto-3: #323d48;
  --linea-oscura: #3d4955;
  --texto-claro: #eef1ee;
  --texto-claro-2: #a9b4bd;

  --hormigon: #eef1f3;
  --superficie: #ffffff;
  --linea: #d3d9de;
  --tinta: #1a2229;
  --tinta-2: #56636e;

  --verde: #0b7a4b;
  --verde-claro: #2fb377;
  --amarillo: #f2b705;
  --rojo: #d4202a;
  --azul: #2c6db0;

  --fuente: "Barlow", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --fuente-cond: "Barlow Condensed", "Arial Narrow", "Segoe UI", sans-serif;
  --radio: 8px;

}
:root, [data-bs-theme="light"] {
  /* Bootstrap con la paleta de Safety Tech */
  --bs-heading-color: var(--tinta);
  --bs-emphasis-color: var(--tinta); --bs-emphasis-color-rgb: 26, 34, 41;
  --bs-primary: var(--verde);            --bs-primary-rgb: 11, 122, 75;
  --bs-success: var(--verde);            --bs-success-rgb: 11, 122, 75;
  --bs-warning: var(--amarillo);         --bs-warning-rgb: 242, 183, 5;
  --bs-danger: var(--rojo);              --bs-danger-rgb: 212, 32, 42;
  --bs-info: var(--azul);                --bs-info-rgb: 44, 109, 176;
  --bs-body-font-family: var(--fuente);
  --bs-body-font-size: 1rem;
  --bs-body-color: var(--tinta);
  --bs-body-color-rgb: 26, 34, 41;
  --bs-body-bg: var(--hormigon);
  --bs-body-bg-rgb: 238, 241, 243;
  --bs-secondary-color: var(--tinta-2);
  --bs-border-color: var(--linea);
  --bs-border-radius: var(--radio);
  --bs-link-color: var(--verde);
  --bs-link-color-rgb: 11, 122, 75;
  --bs-link-hover-color: #08603b;
  --bs-link-hover-color-rgb: 8, 96, 59;
  --bs-focus-ring-color: rgba(242, 183, 5, .55);
  --bs-tertiary-bg: #f6f8f9; --bs-secondary-bg: #e6eaed;
}
[data-bs-theme="dark"] {
  --bs-heading-color: var(--texto-claro);
  --bs-emphasis-color: #fff; --bs-emphasis-color-rgb: 255, 255, 255;
  --bs-body-color: var(--texto-claro);
  --bs-body-color-rgb: 238, 241, 238;
  --bs-body-bg: var(--asfalto);
  --bs-body-bg-rgb: 29, 36, 43;
  --bs-secondary-color: var(--texto-claro-2);
  --bs-border-color: var(--linea-oscura);
  --bs-link-color: #6ee0a8; --bs-link-color-rgb: 110, 224, 168;
  --bs-link-hover-color: #9af0c6; --bs-link-hover-color-rgb: 154, 240, 198;
  --bs-tertiary-bg: var(--asfalto-3);
  --bs-secondary-bg: var(--asfalto-3);
}

html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--fuente); line-height: 1.45; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-family: var(--fuente-cond); font-weight: 600; line-height: 1.1; }
h1, .h1 { font-size: 2.1rem; }
h2, .h2 { font-size: 1.4rem; }
h3, .h3 { font-size: 1.1rem; }
.cifra { font-family: var(--fuente-cond); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid var(--amarillo); outline-offset: 2px; }
[hidden] { display: none !important; }
a { text-underline-offset: 3px; }

/* Botones: la paleta de la marca sobre las variables de Bootstrap */
.btn { background-image: none; text-shadow: none; --bs-btn-font-weight: 600; --bs-btn-border-radius: var(--radio); --bs-btn-focus-shadow-rgb: 242, 183, 5; font-family: var(--fuente); }
.btn-success, .btn-primary {
  --bs-btn-bg: var(--verde); --bs-btn-border-color: var(--verde); --bs-btn-color: #fff;
  --bs-btn-hover-bg: #09663f; --bs-btn-hover-border-color: #09663f; --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: #08603b; --bs-btn-active-border-color: #08603b; --bs-btn-active-color: #fff;
  --bs-btn-disabled-bg: var(--verde); --bs-btn-disabled-border-color: var(--verde);
}
.btn-danger {
  --bs-btn-bg: var(--rojo); --bs-btn-border-color: var(--rojo);
  --bs-btn-hover-bg: #b01a23; --bs-btn-hover-border-color: #b01a23;
  --bs-btn-active-bg: #a0171f; --bs-btn-active-border-color: #a0171f;
}
.btn-warning { --bs-btn-bg: var(--amarillo); --bs-btn-border-color: var(--amarillo); --bs-btn-color: #1a2229; --bs-btn-hover-bg: #d9a400; --bs-btn-hover-border-color: #d9a400; --bs-btn-hover-color: #1a2229; }
.btn-outline-light { --bs-btn-color: var(--texto-claro); --bs-btn-border-color: var(--linea-oscura); --bs-btn-hover-bg: var(--asfalto-3); --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: #5a6876; --bs-btn-active-bg: var(--asfalto-3); --bs-btn-active-color: #fff; --bs-btn-disabled-color: var(--texto-claro-2); --bs-btn-disabled-border-color: var(--linea-oscura); }
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: #fff; --bs-btn-color: var(--rojo); --bs-btn-hover-bg: #f1f1f1; --bs-btn-hover-color: #a0171f; }
.btn-outline-secondary { --bs-btn-color: var(--tinta); --bs-btn-border-color: #b9c2c9; --bs-btn-hover-bg: var(--tinta); --bs-btn-hover-border-color: var(--tinta); --bs-btn-hover-color: #fff; }
.form-control, .form-select { border-color: #b9c2c9; }
.form-control:focus, .form-select:focus { border-color: var(--verde); box-shadow: 0 0 0 .22rem rgba(242, 183, 5, .45); }
.card { --bs-card-border-color: var(--linea); --bs-card-border-radius: 12px; --bs-card-bg: var(--superficie); --bs-card-cap-bg: transparent; }
.table { --bs-table-bg: transparent; --bs-table-striped-bg: rgba(26, 34, 41, .03); --bs-table-hover-bg: rgba(11, 122, 75, .06); }
.badge { font-weight: 600; letter-spacing: .01em; }
.toast { --bs-toast-border-radius: 10px; }
.popover { --bs-popover-max-width: 300px; font-family: var(--fuente); }

/* ---------------------------------------------------------------- barra superior */
.st-nav { background: var(--asfalto); border-bottom: 4px solid var(--amarillo); --bs-navbar-padding-y: .55rem; }
body[data-bs-theme="dark"] .st-nav { border-bottom-color: var(--asfalto-3); }
.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--texto-claro); }
.marca:hover { color: #fff; }
.marca svg { width: 34px; height: 34px; }
.marca span { font-family: var(--fuente-cond); font-weight: 700; font-size: 1.6rem; letter-spacing: .03em; line-height: 1; }
.marca span b { color: var(--amarillo); font-weight: 700; }
.st-nav .nav-link { --bs-nav-link-color: var(--texto-claro-2); --bs-nav-link-hover-color: #fff; font-weight: 500; border-radius: var(--radio); padding: .45rem .85rem; }
.st-nav .nav-link.active { color: #fff; background: var(--asfalto-3); }
.st-nav .nav-link i { margin-right: 6px; opacity: .85; }
.st-usuario { display: flex; align-items: center; gap: 10px; color: var(--texto-claro); text-decoration: none; padding: 4px 8px; border-radius: var(--radio); border: 0; background: transparent; text-align: left; line-height: 1.15; }
.st-usuario:hover, .st-usuario[aria-expanded="true"] { background: var(--asfalto-3); color: #fff; }
.st-usuario small { display: block; color: var(--texto-claro-2); font-size: .8rem; }
.st-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--amarillo); color: #1a2229; display: grid; place-items: center; font: 700 1rem var(--fuente-cond); flex: none; }
.dropdown-menu { --bs-dropdown-border-radius: 10px; --bs-dropdown-link-active-bg: var(--verde); }

/* ---------------------------------------------------------------- señales viales */
.senal {
  --tam: 220px;
  width: var(--tam); height: var(--tam);
  display: grid; place-items: center; text-align: center;
  font-family: var(--fuente-cond); font-weight: 700; line-height: 1;
  font-size: calc(var(--tam) * .17);
  position: relative; flex: none;
  transition: transform .25s ease;
}
.senal span { position: relative; z-index: 1; padding: 0 8%; }
/* Normal: placa verde de ruta con filete blanco */
.senal[data-nivel="normal"] {
  height: calc(var(--tam) * .62); border-radius: calc(var(--tam) * .07);
  background: var(--verde); color: #fff;
  box-shadow: inset 0 0 0 calc(var(--tam) * .025) var(--verde), inset 0 0 0 calc(var(--tam) * .04) #fff;
}
/* Atención: rombo amarillo de advertencia */
.senal[data-nivel="atencion"] { color: var(--tinta); }
.senal[data-nivel="atencion"]::before {
  content: ""; position: absolute; inset: 15%;
  background: var(--amarillo); border-radius: calc(var(--tam) * .05);
  transform: rotate(45deg);
  box-shadow: inset 0 0 0 calc(var(--tam) * .025) var(--amarillo), inset 0 0 0 calc(var(--tam) * .04) var(--tinta);
}
.senal[data-nivel="atencion"] span { font-size: .8em; }
/* Alerta: octágono rojo de PARE */
.senal[data-nivel="alerta"] {
  background: #fff; color: #fff;
  clip-path: polygon(29.3% 0, 70.7% 0, 100% 29.3%, 100% 70.7%, 70.7% 100%, 29.3% 100%, 0 70.7%, 0 29.3%);
}
.senal[data-nivel="alerta"]::before {
  content: ""; position: absolute; inset: 4%; background: var(--rojo);
  clip-path: inherit;
}
/* Sin señal / calibrando: placa gris */
.senal[data-nivel="sin_senal"], .senal[data-nivel="espera"], .senal[data-nivel="calibrando"] {
  height: calc(var(--tam) * .62); border-radius: calc(var(--tam) * .07);
  background: var(--asfalto-3); color: var(--texto-claro-2);
  box-shadow: inset 0 0 0 calc(var(--tam) * .04) var(--linea-oscura);
  font-size: calc(var(--tam) * .13);
}
.senal-chica { --tam: 54px; font-size: 13px; }
.senal-chica[data-nivel="sin_senal"] { font-size: 12px; }
.senal-chica[data-nivel="atencion"] span { font-size: .75em; }

/* ---------------------------------------------------------------- pantalla del conductor */
.monitor {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
  grid-template-areas: "video estado" "lecturas lecturas" "evolucion evolucion" "bitacora controles";
  gap: 20px; padding: 20px 24px 32px; max-width: 1440px; margin: 0 auto;
}
.camara {
  grid-area: video; position: relative; overflow: hidden;
  background: #11161b; border-radius: 12px; aspect-ratio: 4 / 3;
  border: 1px solid var(--linea-oscura);
}
.camara video, .camara canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transform: scaleX(-1);
}
.camara-velo {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  padding: 24px; background: rgba(17, 22, 27, .82); z-index: 2; overflow: auto;
}
.camara-velo p { max-width: 42ch; color: var(--texto-claro-2); margin: 10px auto 22px; }
.camara-velo h2 { font-size: 1.8rem; }
.camara-velo .alert { max-width: 46ch; margin: 14px auto 0; text-align: left; }
.calibrando-anillo { width: 120px; height: 120px; margin: 0 auto 14px; }
.calibrando-anillo circle { fill: none; stroke-width: 8; }
.calibrando-anillo .fondo { stroke: var(--asfalto-3); }
.calibrando-anillo .avance { stroke: var(--verde-claro); stroke-linecap: round; transition: stroke-dashoffset .2s linear; }
.camara-info {
  position: absolute; left: 12px; bottom: 12px; z-index: 1;
  display: flex; gap: 8px; font-size: .85rem; flex-wrap: wrap; right: 12px;
}
.camara-info span { background: rgba(17, 22, 27, .75); padding: 4px 10px; border-radius: 4px; color: var(--texto-claro-2); }
.grabando::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--rojo); margin-right: 6px; vertical-align: 1px;
}

.estado {
  grid-area: estado; display: flex; flex-direction: column; align-items: center; gap: 18px;
  background: var(--asfalto-2); border-radius: 12px; padding: 28px 24px;
}
.estado .senal { margin-top: 8px; }
.motivo { font-size: 1.3rem; font-weight: 600; text-align: center; min-height: 2.6em; }
.puntaje { width: 100%; }
.puntaje-cabecera { display: flex; justify-content: space-between; align-items: baseline; color: var(--texto-claro-2); }
.puntaje-cabecera .cifra { font-size: 2.6rem; color: var(--texto-claro); font-weight: 600; }
.escala {
  position: relative; height: 14px; border-radius: 7px; margin-top: 8px;
  background: linear-gradient(90deg, var(--verde) 0 35%, var(--amarillo) 35% 65%, var(--rojo) 65% 100%);
}
.escala-marca {
  position: absolute; top: -6px; width: 4px; height: 26px; border-radius: 2px;
  background: #fff; box-shadow: 0 0 0 2px var(--asfalto-2); transform: translateX(-2px);
  transition: left .3s ease;
}
.escala-leyenda { display: flex; justify-content: space-between; font-size: .8rem; color: var(--texto-claro-2); margin-top: 6px; }
.sesion-tiempo { color: var(--texto-claro-2); font-size: .95rem; }
.sesion-tiempo .cifra { color: var(--texto-claro); font-size: 1.2rem; }
.resumen-viaje {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%;
  margin: auto 0 0; border-top: 1px solid var(--linea-oscura); padding-top: 14px;
}
.resumen-viaje div { text-align: center; }
.resumen-viaje dt { font-size: .8rem; color: var(--texto-claro-2); font-weight: 400; }
.resumen-viaje dd { margin: 0; font-size: 1.7rem; font-weight: 600; }
.resumen-viaje dd[data-critico="si"] { color: #ff6b72; }

.lecturas {
  grid-area: lecturas; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  background: var(--asfalto-2); border-radius: 12px;
}
.lectura { padding: 16px 18px; border-left: 1px solid var(--linea-oscura); }
.lectura:first-child { border-left: 0; }
.lectura h3 { font-family: var(--fuente); font-weight: 500; font-size: .95rem; color: var(--texto-claro-2); display: flex; align-items: center; gap: 6px; }
.lectura .cifra { font-size: 2rem; font-weight: 600; display: block; margin: 2px 0 8px; }
.lectura .cifra small { font-size: .55em; color: var(--texto-claro-2); font-weight: 500; }
.lectura.excede .cifra { color: var(--amarillo); }
.medidor { position: relative; height: 6px; background: var(--asfalto-3); border-radius: 3px; }
.medidor i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--verde-claro); transition: width .2s; }
.lectura.excede .medidor i { background: var(--amarillo); }
.medidor b { position: absolute; top: -4px; width: 2px; height: 14px; background: var(--texto-claro); }
.lectura p { margin: 8px 0 0; font-size: .8rem; color: var(--texto-claro-2); }
.info-lectura { padding: 0; line-height: 1; color: var(--texto-claro-2); border: 0; background: transparent; font-size: .9rem; }
.info-lectura:hover, .info-lectura:focus { color: var(--amarillo); }

.bitacora { grid-area: bitacora; background: var(--asfalto-2); border-radius: 12px; padding: 18px 20px; min-height: 180px; }
.bitacora ol { list-style: none; margin: 12px 0 0; padding: 0; max-height: 260px; overflow: auto; }
.bitacora li { display: grid; grid-template-columns: 54px 12px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--linea-oscura); }
.bitacora li time { color: var(--texto-claro-2); font-variant-numeric: tabular-nums; font-size: .9rem; }
.bitacora .vacio { color: var(--texto-claro-2); border: 0; display: block; }
.punto { width: 10px; height: 10px; border-radius: 50%; }
.punto.critica { background: var(--rojo); }
.punto.moderada { background: var(--amarillo); }
.punto.leve { background: var(--azul); }
.bitacora .detalle { color: var(--texto-claro-2); font-size: .85rem; }

.controles { grid-area: controles; display: flex; flex-direction: column; gap: 12px; background: var(--asfalto-2); border-radius: 12px; padding: 18px 20px; }
.controles > p { margin: 4px 0 0; font-size: .85rem; color: var(--texto-claro-2); }
.controles .accordion { --bs-accordion-bg: transparent; --bs-accordion-border-color: var(--linea-oscura); --bs-accordion-btn-bg: transparent; --bs-accordion-active-bg: var(--asfalto-3); --bs-accordion-active-color: var(--texto-claro); --bs-accordion-btn-focus-box-shadow: 0 0 0 .2rem rgba(242,183,5,.4); --bs-accordion-btn-padding-y: .65rem; font-size: .92rem; }
.controles .accordion-button { font-weight: 600; }
.controles .accordion-body { color: var(--texto-claro-2); padding-top: .5rem; }
.controles .accordion-body li + li { margin-top: 4px; }

/* Alarma crítica: toda la pantalla destella en rojo */
.alarma-critica {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; text-align: center;
  background: rgba(212, 32, 42, .92); color: #fff; padding: 24px;
  animation: destello .8s steps(2, jump-none) infinite;
}
.alarma-critica .senal { --tam: min(56vw, 300px); margin: 0 auto 18px; }
.alarma-critica h2 { font-size: clamp(2.2rem, 7vw, 4rem); }
.alarma-critica p { font-size: 1.3rem; margin: 10px 0 26px; }
@keyframes destello { 0% { background: rgba(212, 32, 42, .94); } 100% { background: rgba(120, 10, 16, .94); } }
body.advertencia .camara { box-shadow: 0 0 0 4px var(--amarillo); }

/* ---------------------------------------------------------------- vistas claras */
.encabezado { margin-bottom: 1.25rem; }
.encabezado p { margin: 4px 0 0; color: var(--tinta-2); }
.kpi { height: 100%; }
.kpi .card-body { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.kpi-icono { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; flex: none; background: #e3f2ea; color: var(--verde); }
.kpi.rojo .kpi-icono { background: #fdeceb; color: var(--rojo); }
.kpi.azul .kpi-icono { background: #e4eef9; color: var(--azul); }
.kpi.ambar .kpi-icono { background: #fff4cc; color: #8a6500; }
.kpi .cifra { font-size: 2.2rem; font-weight: 600; display: block; line-height: 1; }
.kpi.rojo .cifra { color: var(--rojo); }
.kpi small { color: var(--tinta-2); font-size: .9rem; line-height: 1.2; display: block; margin-top: 3px; }
.card-titulo { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-titulo h2 { margin: 0; }
.card-titulo small { color: var(--tinta-2); }

.flota { list-style: none; margin: 0; padding: 0; }
.flota li {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) 130px 70px; gap: 16px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--linea);
}
.flota li:first-child { border-top: 0; }
.flota .senal-chica { justify-self: center; }
.flota a { font-weight: 600; text-decoration: none; }
.flota a:hover { text-decoration: underline; }
.flota .sub { color: var(--tinta-2); font-size: .9rem; }
.flota li.alerta { background: #fdeceb; margin: 0 -1rem; padding: 12px 1rem; border-top-color: transparent; border-radius: 8px; }
.mini-escala { height: 8px; border-radius: 4px; background: var(--hormigon); position: relative; overflow: hidden; }
.mini-escala i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; }
.flota .cifra { font-size: 1.5rem; font-weight: 600; text-align: right; }
.etiqueta-tiempo { font-size: .85rem; color: var(--tinta-2); }

.feed { list-style: none; margin: 0; padding: 0; max-height: 540px; overflow: auto; }
.feed li { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; padding: 9px 0; border-top: 1px solid var(--linea); align-items: baseline; }
.feed li:first-child { border-top: 0; }
.feed .punto { transform: translateY(1px); }
.feed .sub { color: var(--tinta-2); font-size: .88rem; display: block; }
.feed time { color: var(--tinta-2); font-variant-numeric: tabular-nums; font-size: .9rem; }
.feed li.nuevo { animation: llegada 1.6s ease-out; }
@keyframes llegada { from { background: #fff4cc; } to { background: transparent; } }

.grafico { width: 100%; height: 190px; display: block; }
.grafico text { font: 12px var(--fuente); fill: var(--tinta-2); }
.grafico-alto { height: auto; aspect-ratio: 900 / 200; }
.leyenda { display: flex; gap: 16px; font-size: .88rem; color: var(--tinta-2); flex-wrap: wrap; }
.leyenda span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; background: var(--c); }

.barras-h { list-style: none; margin: 0; padding: 0; }
.barras-h li { display: grid; grid-template-columns: 170px 1fr 36px; gap: 10px; align-items: center; padding: 6px 0; }
.barras-h .pista { height: 12px; background: var(--hormigon); border-radius: 3px; overflow: hidden; }
.barras-h .pista i { display: block; height: 100%; }
.barras-h .cifra { text-align: right; font-size: 1.1rem; font-weight: 600; }

.tabla-scroll { overflow-x: auto; }
.table th { font-weight: 600; color: var(--tinta-2); white-space: nowrap; }
.table td.num, .table th.num { font-variant-numeric: tabular-nums; text-align: right; }
.table small { color: var(--tinta-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; }
.vacio-claro { color: var(--tinta-2); padding: 18px 0; margin: 0; }
.nota-privacidad { margin: 20px 0 0; font-size: .88rem; color: var(--tinta-2); }

/* ---------------------------------------------------------------- acceso */
.acceso-via {
  position: relative; overflow: hidden; background: var(--asfalto); color: var(--texto-claro);
  padding: 48px; display: flex; flex-direction: column; justify-content: space-between; min-height: 100%;
}
.acceso-via::after { /* línea segmentada de calzada */
  content: ""; position: absolute; top: 0; bottom: 0; right: 18%; width: 10px;
  background: repeating-linear-gradient(to bottom, var(--amarillo) 0 46px, transparent 46px 92px);
  opacity: .85;
}
.acceso-via h1 { font-size: clamp(2.4rem, 5vw, 3.6rem); max-width: 12ch; margin-top: 18vh; color: #fff; }
.acceso-via p { color: var(--texto-claro-2); max-width: 40ch; font-size: 1.1rem; }
.acceso-senales { display: flex; align-items: center; gap: 18px; position: relative; z-index: 1; }
.acceso-senales .senal { --tam: 92px; }
.acceso-form { padding: 40px 24px; }
.acceso-form form { width: min(400px, 100%); }
.acceso-form h2 { font-size: 1.9rem; margin-bottom: 6px; }

/* ---------------------------------------------------------------- toasts y detalles */
.toast-container { z-index: 1900; }

/* ---------------------------------------------------------------- monitoreo: extras */
.privacidad { font-size: .85rem; margin-top: -8px; }
.evolucion { grid-area: evolucion; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.evolucion figure { margin: 0; background: var(--asfalto-2); border-radius: 12px; padding: 16px 18px 12px; }
.evolucion figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.evolucion canvas { width: 100%; height: 150px; display: block; }
.evolucion .leyenda { color: var(--texto-claro-2); font-size: .82rem; }
.ajuste { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; color: var(--texto-claro-2); }
.segmentos { display: grid; grid-template-columns: repeat(3, 1fr); }
.segmentos .btn { --bs-btn-padding-y: .4rem; }
.segmentos .btn[aria-checked="true"] { background: var(--verde); border-color: var(--verde); color: #fff; }
.camara-info .chip-modo { color: #11161b; background: #f5c518; font-weight: 600; }
.camara-info .chip-ocupantes { background: rgba(255,255,255,.14); }
.camara-info .chip-ocupantes.exceso { color: #fff; background: #c8202b; font-weight: 600; }
.camara-info .chip-aviso { color: #11161b; background: #f5c518; font-weight: 600; }

/* Preparación previa */
.acciones-inicio { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; align-items: center; }
.chequeo { list-style: none; margin: 0 auto 18px; padding: 0; display: grid; gap: 6px; text-align: left; max-width: 44ch; }
.chequeo li { display: flex; align-items: center; gap: 10px; background: rgba(17, 22, 27, .8); padding: 8px 12px; border-radius: 6px; font-size: .95rem; }
.chequeo .punto { width: 10px; height: 10px; border-radius: 50%; background: #6b7782; flex: none; }
.chequeo li[data-estado="ok"] .punto { background: #2fbf71; }
.chequeo li[data-estado="mal"] .punto { background: #e5484d; }
.chequeo li[data-estado="espera"] .punto { background: #f5c518; }
.camara-velo[data-preparando] { background: rgba(10, 14, 18, .55); }

/* ---------------------------------------------------------------- responsivo */
@media (max-width: 1100px) {
  .lecturas { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lectura:nth-child(4) { border-left: 0; }
  .lectura:nth-child(n+4) { border-top: 1px solid var(--linea-oscura); }
}
@media (max-width: 900px) {
  .monitor { grid-template-columns: 1fr; grid-template-areas: "video" "estado" "lecturas" "evolucion" "controles" "bitacora"; padding: 12px 16px 24px; }
  .estado { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .estado .senal { --tam: 150px; }
  .evolucion { grid-template-columns: 1fr; }
  .acceso-via { padding: 28px 24px; min-height: 0; }
  .acceso-via h1 { margin-top: 24px; }
  .acceso-via::after { right: 8%; }
}
@media (max-width: 600px) {
  .lecturas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lectura:nth-child(n) { border-left: 0; border-top: 1px solid var(--linea-oscura); }
  .lectura:nth-child(even) { border-left: 1px solid var(--linea-oscura); }
  .lectura:nth-child(-n+2) { border-top: 0; }
  .flota li { grid-template-columns: 56px minmax(0, 1fr) 54px; }
  .flota .mini-escala-col { display: none; }
  .barras-h li { grid-template-columns: 120px 1fr 30px; }
  .acceso-senales .senal { --tam: 70px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .alarma-critica { animation: none; }
  .feed li.nuevo { animation: none; }
}
@media print {
  body { background: #fff; }
  .st-nav, .no-imprimir, .toast-container { display: none !important; }
  .container-xl { max-width: none; padding: 0; }
  .card { break-inside: avoid; border-color: #bbb; box-shadow: none !important; }
  .feed, .tabla-scroll { max-height: none; overflow: visible; }
}

/* Ajustes finos */
.text-secondary { color: var(--tinta-2) !important; }
[data-bs-theme="dark"] .text-secondary { color: var(--texto-claro-2) !important; }
.feed a { font-weight: 500; text-decoration: none; }
.feed a:hover { text-decoration: underline; }

/* Medidor de riesgo semicircular */
.medidor-riesgo { position: relative; width: min(100%, 250px); margin: 0 auto; }
.medidor-riesgo svg { width: 100%; display: block; }
.medidor-riesgo path { fill: none; stroke-width: 15; }
.medidor-riesgo .arco-fondo { stroke: var(--asfalto-3); }
.medidor-riesgo .arco-seg { stroke-linecap: butt; }
.medidor-riesgo #aguja { transition: transform .5s cubic-bezier(.3, 1.3, .5, 1); }
.medidor-riesgo #aguja path { stroke-width: 4; }
.medidor-riesgo-texto { text-align: center; line-height: 1; margin-top: -2px; }
.medidor-riesgo-texto .cifra { font-size: 2.4rem; font-weight: 600; color: var(--texto-claro); }
.medidor-riesgo-texto small { color: var(--texto-claro-2); }
#riesgo-etiqueta { font-weight: 600; padding: .45em .9em; margin-top: 8px; background: var(--verde); color: #fff; }
#riesgo-etiqueta[data-nivel="atencion"] { background: var(--amarillo); color: #1a2229; }
#riesgo-etiqueta[data-nivel="alerta"] { background: var(--rojo); }
#riesgo-etiqueta[data-nivel="sin_senal"] { background: var(--asfalto-3); color: var(--texto-claro-2); }
.recomendacion { font-size: .92rem; }

.estado { gap: 12px; }
.estado .senal { --tam: 190px; }

/* Tipo de vehículo */
.chip-tipo { font-size: .85rem; font-weight: 600; padding: .5em .9em; align-self: flex-start; }
.tipo-card { cursor: pointer; }
.btn-check:checked + .tipo-card { border-color: var(--verde); box-shadow: 0 0 0 .2rem rgba(11, 122, 75, .25); background: #eaf6f0; }
.tipo-card .fa-solid { font-size: 1.6rem; color: var(--verde); }
.filtro-tipo .btn { --bs-btn-padding-y: .3rem; }
.insignia-tipo { font-size: .8rem; font-weight: 600; }

/* Panel: buscador */
.buscador { max-width: 320px; flex: 1 1 220px; }

/* Fatiga predictiva */
.tendencia { display: flex; align-items: center; justify-content: center; width: 100%; padding: .45rem .75rem; border-radius: .5rem;
  font-size: .9rem; background: rgba(255,255,255,.06); border: 1px solid var(--linea, rgba(255,255,255,.15)); }
.tendencia[data-estado="subiendo"] { color: #11161b; background: #f5c518; border-color: #f5c518; font-weight: 600; }
.tendencia[data-estado="bajando"] i { color: var(--verde-claro, #2fb377); }

/* Perfil horario */
.franjas { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; align-items: end; height: 140px; margin-top: .5rem; }
.franja { display: flex; flex-direction: column; height: 100%; }
.franja .barra { flex: 1; display: flex; align-items: flex-end; background: var(--bs-tertiary-bg, #eef1f4); border-radius: 3px; overflow: hidden; }
.franja .barra i { display: block; width: 100%; background: var(--rojo); border-radius: 3px 3px 0 0; }
.franja .barra.sin-datos { background: repeating-linear-gradient(45deg, transparent 0 4px, rgba(0,0,0,.05) 4px 8px); }
.franja .etq { font-size: .7rem; text-align: center; color: var(--tinta-2, #5a6670); height: 1rem; }
