/* Paleta Infotrack: rojo, negro, blanco y grises neutros (inspirada en la consola de Hetzner). El color de marca de un cliente
   reemplaza solo --accent. El estado (verde / ámbar / gris) mantiene colores propios porque tiene significado.
   Apariencia: automática (sigue al sistema), clara u oscura. Se elige con data-theme="light|dark" en <html> (theme.js);
   sin data-theme manda el sistema. Los valores oscuros están dos veces a propósito: una para el modo automático y otra para el forzado. */
:root {
  --bg: #ececec; --panel: #ffffff; --panel-2: #f0f0f0; --text: #111111; --muted: #4a4a4a; --line: #cdcdcd; --sep: #a3a3a3;
  --accent: #d50c2d; --accent-text: #c20a28; --on-accent: #ffffff;
  --frag: #1d4ed8;
  --ok: #15803d; --warn: #b45309; --bad: #c81e1e; --off: #8a8a8a;          /* verde y ámbar más oscuros: legibles como texto sobre fondo blanco (más de 5:1) */
  --top-bg: #ffffff; --top-text: #111111; --top-muted: #4a4a4a; --top-line: #cdcdcd;
  --shadow: 0 1px 2px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --radius: 8px; --top: 56px;
  color-scheme: light dark;
}
:root[data-theme="light"] { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e0e; --panel: #181818; --panel-2: #212121; --text: #f2f2f2; --muted: #9c9c9c; --line: #2c2c2c; --sep: #4a4a4a;
    --accent-text: #ff5169; --frag: #7db0ff; --bad: #ff6b6b; --ok: #22c55e; --warn: #f59e0b; --off: #9a9a9a; --top-bg: #161616; --top-text: #f5f5f5; --top-muted: #a8a8a8; --top-line: #2c2c2c;
    --shadow: 0 1px 2px rgba(0,0,0,.5), 0 4px 16px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e0e; --panel: #181818; --panel-2: #212121; --text: #f2f2f2; --muted: #9c9c9c; --line: #2c2c2c; --sep: #4a4a4a;
  --accent-text: #ff5169; --frag: #7db0ff; --bad: #ff6b6b; --ok: #22c55e; --warn: #f59e0b; --off: #9a9a9a; --top-bg: #161616; --top-text: #f5f5f5; --top-muted: #a8a8a8; --top-line: #2c2c2c;
  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 4px 16px rgba(0,0,0,.4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
a { color: var(--accent-text); }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---- formularios y botones */
label { display: block; font-size: .85rem; color: var(--muted); margin: 0 0 .25rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); min-height: 40px; }
.field input[type=tel], .field input[type=date] { width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); min-height: 40px; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field { margin-bottom: .9rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; } .row > * { flex: 1 1 140px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1rem; min-height: 40px; border-radius: 8px;
       border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 32px; padding: .25rem .6rem; font-size: .85rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.error { color: var(--bad); font-size: .9rem; min-height: 1.2em; margin: .25rem 0 .6rem; }
.hint { font-size: .8rem; color: var(--muted); margin-top: .25rem; }

/* ---- tarjetas y tablas */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; }
.stack > * + * { margin-top: 1rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }
.chip { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; border: 1px solid var(--line); }
.chip.ok { color: var(--ok); border-color: currentColor; } .chip.warn { color: var(--warn); border-color: currentColor; }
.chip.bad { color: var(--bad); border-color: currentColor; } .chip.off { color: var(--off); }

/* ---- pantalla de ingreso */
.auth { --bg: #0e0e0e;          /* la pantalla de ingreso es SIEMPRE oscura: el modo claro / oscuro solo afecta a la plataforma de seguimiento */
        position: relative; overflow: hidden; min-height: 100%; display: grid; place-items: center; padding: 16px;
        background: radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 50%),
                    radial-gradient(circle at 92% 100%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 55%), var(--bg); }
.bg-net { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.auth .card { position: relative; z-index: 1; width: min(420px, 100%); padding: 1.6rem; text-align: center;
  /* La caja de ingreso es SIEMPRE blanca (sobre el fondo oscuro con la red de puntos), en modo claro y oscuro */
  --panel: #ffffff; --panel-2: #f3f3f3; --text: #111111; --muted: #4a4a4a; --line: #cdcdcd; --bad: #c81e1e; --accent-text: var(--accent);
  background: #ffffff; color: #161616; border-color: transparent; box-shadow: 0 10px 40px rgba(0,0,0,.45); }
.auth label { text-align: center; }
.auth input[type=text], .auth input[type=email], .auth input[type=password] { text-align: center; }
.auth input[inputmode=numeric] { font-size: 1.4rem; letter-spacing: .35em; }
.check { display: flex; align-items: center; justify-content: center; gap: .5rem; margin: .2rem 0 .9rem; color: var(--muted); font-size: .9rem; cursor: pointer; }
.check input { width: auto; min-height: 0; margin: 0; accent-color: var(--accent); }
.auth .card h2 { text-align: center; }
.brand-big { display: flex; flex-direction: column; align-items: center; gap: .5rem; margin-bottom: 1.2rem; text-align: center; }
.brand-big img { width: auto; height: auto; max-width: 260px; max-height: 110px; object-fit: contain; border-radius: 10px; }   /* logos rectangulares: ocupan el ancho disponible */
.brand-big .name { font-size: 1.5rem; font-weight: 700; } .brand-big .tag { color: var(--muted); font-size: .9rem; }
.qr { display: grid; place-items: center; padding: 12px; background: #fff; border-radius: 10px; width: fit-content; margin: .5rem auto; }
.qr svg { width: 180px; height: 180px; display: block; }
code.secret { display: block; word-break: break-all; padding: .5rem; background: var(--panel-2); border: 1px dashed var(--line); border-radius: 8px; font-size: .85rem; user-select: all; }

/* ---- estructura de la aplicacion */
.shell { height: 100%; display: flex; flex-direction: column; }
.topbar { height: var(--top); flex: none; display: flex; align-items: center; gap: .75rem; padding: 0 12px; background: var(--top-bg); color: var(--top-text);
          border-bottom: 1px solid var(--top-line); box-shadow: inset 0 -2px 0 var(--accent); }
.topbar .brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; text-decoration: none; color: inherit; min-width: 0; }
.topbar .btn { background: transparent; color: var(--top-text); border-color: var(--top-line); }
.topbar .btn:hover { border-color: var(--accent); }
.topbar .brand img { height: 34px; width: auto; max-width: 160px; object-fit: contain; padding: 3px 6px; background: #f5f5f5; border-radius: 8px; }   /* placa clara: cualquier logo se ve sobre la barra negra */
.topbar .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; gap: .25rem; margin-left: .5rem; overflow: hidden; flex: 0 1 auto; min-width: 0; }        /* lo que no entra pasa al menú de los tres puntos (fitNav) */
.nav a.ovf { display: none; }
.nav a { padding: .45rem .75rem; border-radius: 6px; color: var(--top-muted); text-decoration: none; white-space: nowrap; }
/* al pasar el mouse cada opción del menú se pinta con el color de la seleccionada (que queda sólida) */
.nav a { transition: background-color .15s ease, color .15s ease; }
.nav a:hover, .nav a:focus-visible, .nav a.active { background: var(--accent); color: var(--on-accent); }
.spacer { flex: 1; }
.who { color: var(--top-muted); font-size: .85rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { flex: 1; min-height: 0; overflow: auto; padding: 16px; }
.content.flush { padding: 0; overflow: hidden; }
.page { max-width: 1100px; margin: 0 auto; }
.page.flush-left { max-width: none; margin: 0; }          /* tableros tipo Mantenimiento: pegados al borde izquierdo, no centrados */
.page-head .row.bar { justify-content: flex-end; align-items: center; } .page-head .row.bar > * { flex: 0 0 auto; width: auto; white-space: nowrap; }          /* barra de herramientas: cada control con su tamaño natural */
.date-pick { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); } .date-pick input { width: auto; min-height: 36px; padding: .3rem .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--text); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* ---- mapa */
.mapview { display: grid; grid-template-columns: var(--side-col, 330px) 1fr; height: 100%; }
.mapview .side { background: var(--panel); border-right: 1px solid var(--line); overflow: auto; display: flex; flex-direction: column; }
.mapview .side { cursor: grab; }                                  /* se arrastra con el mouse como una mano (ver dragscroll.js) */
.mapview .side.dragging { cursor: grabbing; user-select: none; }
.mapview .side .filters { padding: 10px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.mapview .map { position: relative; min-height: 300px; isolation: isolate; }   /* las capas internas de Leaflet/Google no pasan por encima de ventanas y avisos */
.mapview .map > .mapbox { position: absolute; inset: 0; }
.vitem { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--sep); padding: 10px 12px; cursor: pointer; }
.vitem:hover, .vitem.sel { background: var(--panel-2); }
.vrow { display: grid; grid-template-columns: 15px minmax(0, 1fr) var(--c-speed, 64px) var(--c-sat, 56px) 102px; align-items: center; border-bottom: 1px solid var(--sep); padding: 0 12px; }
.vrow:hover { background: var(--panel-2); }
.vrow .vitem { min-width: 0; border-bottom: 0; background: none; padding-left: 10px; padding-right: 6px; }
.track-ctl .icon-btn { width: 30px; height: 30px; }
.vitem .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.vitem .nm { font-weight: 600; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: var(--off); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); }
.detail { padding: 10px 12px 12px; border-bottom: 1px solid var(--sep); background: var(--panel-2); }   /* la fila de la unidad elegida, desplegada en la lista */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; font-size: .85rem; margin: .5rem 0; }
.kv:empty { display: none; }
/* Tablero de la unidad: un panel centrado, anclado abajo del mapa, que se ajusta a los relojes: ~1 cm de margen y las esquinas de arriba concéntricas con los
   relojes grandes (radio del reloj 135 + margen 38 = 173), así la curva acompaña a la del reloj. El panel de unidades se comprime hacia la izquierda (ver .mapview.docked). */
.cockpit-dock { overflow: hidden; display: flex; flex-direction: column; position: relative; z-index: 1200; color: #d6dce8; background: #0b0e13;
                padding: 38px 38px 26px; border: 1px solid #2b3240; border-bottom: 0; border-radius: 173px 173px 0 0; box-shadow: 0 -14px 40px rgba(0, 0, 0, .45);
                visibility: hidden; transform: translateY(105%); transition: transform .55s cubic-bezier(.22, .8, .22, 1), visibility 0s linear .55s; }
.cockpit-dock.open { visibility: visible; transform: none; transition: transform .55s cubic-bezier(.22, .8, .22, 1), visibility 0s; }
.cockpit-dock.stale .cockpit-main > svg, .cockpit-dock.stale .cockpit-center > * { opacity: .5; }
.cockpit-dock.stale .cockpit-display { opacity: 1; }
.cockpit-top { position: absolute; top: 9px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; z-index: 2; }
.cockpit-switch { display: inline-flex; border: 1px solid #2b3240; border-radius: 8px; overflow: hidden; background: #121821; }
.cockpit-switch button { padding: 0 11px; height: 26px; border: 0; background: transparent; color: #8c97ab; font-size: .72rem; cursor: pointer; white-space: nowrap; }
.cockpit-switch button[aria-pressed="true"] { background: #243049; color: #fff; }
.cockpit-switch button:hover { color: #fff; }
.cockpit-x { width: 26px; height: 26px; display: grid; place-items: center; padding: 0; border-radius: 8px; border: 1px solid #2b3240; background: #121821; color: #d6dce8; cursor: pointer; font-size: .8rem; }
.cockpit-x:hover { border-color: #ff7a1a; color: #fff; }
/* Versión digital: arcos de segmentos que se encienden, cifras grandes, barras y un odómetro de pantalla */
.cockpit-dock.digital { background: #070b12; border-color: #1d3a5a; box-shadow: 0 -14px 40px rgba(0, 0, 0, .45), 0 -2px 34px rgba(70, 150, 255, .16); }
.cockpit-seg-p { opacity: .13; transition: opacity .3s ease; }
.cockpit-seg-p.on { opacity: 1; filter: drop-shadow(0 0 3px rgba(130, 190, 255, .4)); }
/* Cifras de siete segmentos: solo se ve lo encendido (con brillo); los apagados no se dibujan, sin fondo gris; el color es el del texto */
.cockpit-sevenseg { display: inline-block; overflow: visible; color: #f3f6fb; vertical-align: middle; }
.cockpit-seg7 { fill: currentColor; opacity: 0; }
.cockpit-seg7.on { opacity: 1; filter: drop-shadow(0 0 2.5px currentColor); }
.cockpit-sbars { width: 100%; display: grid; gap: 9px; padding: 0 6px; }
.cockpit-sbar { display: grid; grid-template-columns: 1fr auto; align-items: baseline; row-gap: 4px; font-size: .64rem; color: #8c97ab; text-transform: uppercase; letter-spacing: .07em; }
.cockpit-sbar strong { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; letter-spacing: 0; color: #f3f6fb; } .cockpit-sbar small { font-size: .66rem; font-weight: 500; color: #8c97ab; }
.cockpit-sbar-t { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(22, 1fr); gap: 2px; height: 9px; }
.cockpit-sbar-t i { display: block; background: #172033; border-radius: 1px; transition: background .35s ease; }
.cockpit-sbar-t i.on { filter: brightness(1.12) drop-shadow(0 0 3px rgba(130, 190, 255, .35)); }
.cockpit-lcd { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; background: #04070c; border: 1px solid #1d3a5a; border-radius: 8px; box-shadow: inset 0 0 12px rgba(70, 150, 255, .12); }
.cockpit-lcd .cockpit-sevenseg { color: #8fd3ff; }
.cockpit-lcd em { font-style: normal; font-size: .7rem; color: #6f8aa6; }
.cockpit-main { display: flex; align-items: center; justify-content: center; gap: 14px; height: 270px; }       /* alto fijo: las dos versiones miden lo mismo */
.cockpit-dial { display: block; flex: none; width: 270px; height: 270px; }
.cockpit-center { flex: none; width: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-width: 0; padding-top: 14px; }
.cockpit-minis { display: flex; gap: 4px; justify-content: center; }
.cockpit-mini { display: block; width: 104px; height: auto; }
.cockpit-needle { transition: transform 1.2s cubic-bezier(.25, .8, .25, 1); }
.cockpit-lamps { display: flex; gap: 18px; justify-content: center; }
.cockpit-lamp { display: grid; justify-items: center; gap: 1px; min-width: 76px; --c: #5b6578; }
.cockpit-lamp.on, .cockpit-lamp.ok { --c: #3fd36b; } .cockpit-lamp.off, .cockpit-lamp.crit { --c: #ff5a5a; } .cockpit-lamp.low { --c: #f5a524; }
.cockpit-bulb { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: var(--c); background: #0f141b;
                border: 2px solid color-mix(in srgb, var(--c) 70%, #0b0e13); box-shadow: 0 0 0 3px #10151d, 0 0 16px color-mix(in srgb, var(--c) 45%, transparent), inset 0 0 12px color-mix(in srgb, var(--c) 25%, transparent); }
.cockpit-lamp.off .cockpit-bulb { box-shadow: 0 0 0 3px #10151d, inset 0 0 10px color-mix(in srgb, var(--c) 18%, transparent); opacity: .85; }
.cockpit-bulb svg { width: 22px; height: 22px; }
.cockpit-lamp-name { font-size: .62rem; text-transform: uppercase; letter-spacing: .06em; color: #8c97ab; }
.cockpit-lamp strong { font-size: .8rem; font-weight: 600; color: var(--c); }
.cockpit-display { width: 100%; display: grid; justify-items: center; gap: 5px; }
.cockpit-odo { display: grid; justify-items: center; gap: 3px; }
.cockpit-odo-label { font-size: .64rem; text-transform: uppercase; letter-spacing: .1em; color: #8c97ab; }
.cockpit-odo-row { display: flex; align-items: flex-end; gap: 6px; padding: 4px 7px; background: #05070a; border: 1px solid #2b3240; border-radius: 6px; box-shadow: inset 0 2px 6px rgba(0, 0, 0, .6); }
.cockpit-odo-digits { display: inline-flex; gap: 2px; }
.cockpit-digit { display: inline-grid; place-items: center; width: 17px; height: 24px; border-radius: 3px; background: #161b24; color: #f3f6fb;
                 font: 600 1rem/1 ui-monospace, "SFMono-Regular", Consolas, monospace; border-top: 1px solid #2c3442; border-bottom: 1px solid #000; }
.cockpit-odo-unit { font-size: .72rem; color: #8c97ab; padding-bottom: 2px; }
.cockpit-bars { display: grid; grid-auto-flow: column; gap: 10px; }
.cockpit-bar { width: 112px; display: grid; grid-template-columns: 1fr auto; align-items: center; row-gap: 3px; font-size: .62rem; color: #8c97ab; text-transform: uppercase; letter-spacing: .04em; }
.cockpit-bar i { grid-column: 1 / -1; grid-row: 2; height: 6px; border-radius: 3px; background: #1d2431; overflow: hidden; display: block; } .cockpit-bar b { display: block; height: 100%; background: #2f6bd6; border-radius: 3px; transition: width 1s ease; }
.cockpit-bar em { font-style: normal; text-align: right; color: #d6dce8; }
.cockpit-note { font-size: .78rem; color: #8c97ab; text-align: center; } .cockpit-note.bad { color: #ff8a8a; }
.ign { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; } .ign.on { color: var(--ok); } .ign.off { color: var(--bad); }
.kv dt { color: var(--muted); white-space: nowrap; } .kv dd { margin: 0; text-align: right; word-break: break-word; font-variant-numeric: tabular-nums; }
.mapnote { position: absolute; left: 10px; bottom: 10px; z-index: 5; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .3rem .6rem; font-size: .8rem; box-shadow: var(--shadow); }
.veh-marker { background: none; border: 0; }
.veh-marker svg { display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,.45)); }
.leaflet-container { font: inherit; }
/* control de capas: un solo botón que despliega la lista */
.layers-ctl { position: absolute; top: 10px; right: 10px; z-index: 1000; }
.layers-btn { width: 42px; height: 42px; display: grid; place-items: center; padding: 0; cursor: pointer; border-radius: 8px;
              background: var(--panel); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow); }
.layers-btn:hover, .layers-btn[aria-expanded=true] { color: var(--accent-text); border-color: var(--accent); }
.layers-panel { position: absolute; top: 48px; right: 0; width: 220px; padding: 8px; background: var(--panel); color: var(--text);
                border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.layers-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 6px 6px 4px; }
.layers-opt { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: .92rem; color: var(--text); margin: 0; }
.layers-opt:hover { background: var(--panel-2); }
.layers-opt input { width: auto; min-height: 0; margin: 0; accent-color: var(--accent); }
.vname { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.vicon { display: inline-flex; flex: none; } .vicon svg { display: block; }
.vicon.has-img { background: #ececec; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }   /* placa clara: se ve un ícono gris u oscuro sobre fondo oscuro */

/* ---- selector de ícono */
.icon-preview { position: relative; overflow: hidden; flex: none; width: 64px; height: 64px; padding: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; }
.icon-preview > svg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }          /* el ícono (con su margen de flecha) queda centrado aunque el lienzo sea más grande que el cuadro */
.icon-grid { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 200px; }
.icon-opt { width: 46px; height: 46px; padding: 0; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.icon-opt:hover { border-color: var(--accent); }
.icon-opt[aria-checked=true] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

/* ---- ventanas */
.overlay { position: fixed; inset: 0; background: rgba(2,6,23,.55); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); width: min(520px, 100%); max-height: 92vh; overflow: auto; padding: 1.2rem; }
.modal.wide { width: min(780px, 100%); }
.modal .actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.state-rows { display: grid; gap: 6px; margin-bottom: 6px; }
.state-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 6px; }
.check.left { justify-content: flex-start; margin: .4rem 0 .6rem; }
tr.row-hidden td { opacity: .6; }
tr.row-hidden td:last-child, tr.row-hidden td:nth-last-child(2) { opacity: 1; }
.drag-handle { white-space: nowrap; width: 1%; cursor: grab; }
.drag-handle .grip { color: var(--muted); margin-right: 6px; font-size: 1.1rem; vertical-align: middle; }
.btn.small.arrow { min-height: 26px; min-width: 26px; padding: 0 6px; font-size: .7rem; margin-right: 2px; }
tr.dragging { opacity: .45; }
tr.drag-over td { box-shadow: inset 0 3px 0 var(--accent); }
.chipbtn { border-radius: 999px; }
.chipbtn.ok { color: var(--ok); border-color: currentColor; }
.chipbtn.off { color: var(--off); }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 .6rem; }
.sensor-preview { margin: .5rem 0; padding: .55rem .7rem; background: var(--panel-2); border: 1px dashed var(--line); border-radius: 8px; font-size: .9rem; }
.sensor-preview code { background: var(--panel); padding: 0 .3rem; border-radius: 4px; }
details > summary { cursor: pointer; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: .6rem 1rem; border-radius: 8px; z-index: 60; box-shadow: var(--shadow); max-width: 90vw; }
.toast.bad { background: var(--bad); color: #fff; }
.logo-prev { height: 56px; max-width: 160px; object-fit: contain; background: #f5f5f5; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
/* logo de Falcon (negro sobre transparente): placa clara para que se vea sobre fondos oscuros */
.brand-big img.logo-falcon { height: 84px; max-height: none; }            /* la caja de ingreso es blanca: el logo de Falcon va sin placa */
.swatch { display: inline-block; width: 18px; height: 18px; border-radius: 4px; vertical-align: middle; border: 1px solid var(--line); }

@media (max-width: 560px) {
  .topbar .brand span { display: none; }           /* solo el logo: así caben las secciones del menú */
  .nav { scrollbar-width: none; } .nav::-webkit-scrollbar { display: none; }
}
@media (max-width: 760px) {
  .mapview { grid-template-columns: 1fr; grid-template-rows: 55% 45%; }
  .mapview .map { order: -1; }
  .mapview .side { border-right: 0; border-top: 1px solid var(--line); }
  .who { display: none; } .content { padding: 12px; }
  th, td { padding: .5rem .4rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

/* Último reporte: etiqueta y valor en UNA línea (fecha, hora y tiempo transcurrido con segundos en vivo) */
.lastline { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: .5rem 0 .25rem; font-size: .85rem; white-space: nowrap; }
.lastline .lbl { color: var(--muted); }
.lastline .val { text-align: right; font-variant-numeric: tabular-nums; }
.sens-head { margin: .6rem 0 .2rem; padding-top: .5rem; border-top: 1px solid var(--line); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.since { display: inline-block; min-width: 9.5ch; text-align: left; }      /* ancho estable: el contador no "baila" al cambiar de dígitos */
@media (min-width: 761px) { .mapview { grid-template-columns: var(--side-col, 360px) 1fr; position: relative; } }

/* Recorrido: un solo botón con el ícono de ruta (marcado / desmarcado) */
.detail-head { display: grid; grid-template-columns: 15px minmax(0, 1fr) var(--c-sat, 56px) 102px; align-items: center; }          /* sin columna de velocidad: ahí van la ignición y la velocidad, dentro de la primera fila */
.track-ctl { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border-radius: 8px; border: 1px solid var(--line);
            background: var(--panel-2); color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.icon-btn.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.period-select { width: auto; min-height: 30px; padding: .15rem .4rem; font-size: .8rem; }

/* Ficha plegable: el ícono y el nombre son un botón que contrae y expande los datos */
.vhead { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; padding-left: 8px; font-weight: 700; font-size: 1rem; }
.vmain { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; padding: 0; background: none; border: 0; color: inherit; font: inherit; font-weight: inherit; text-align: left; cursor: pointer; }
.vmain:hover .vtitle { text-decoration: underline; }
.chev-btn { flex: none; width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--muted); font: inherit; cursor: pointer; }
.chev-btn:hover { background: var(--panel-2); color: var(--text); }
.vhead .vtitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vhead .chev { flex: none; color: var(--muted); transition: transform .15s; margin-left: 2px; }
.chev-btn[aria-expanded=false] .chev { transform: rotate(-90deg); }
.detail.collapsed { padding-top: 8px; padding-bottom: 8px; }

/* Botón de apariencia (barra superior) y selector en "Cuenta" */
.topbar .icon-btn { background: transparent; color: var(--top-text); border-color: var(--top-line); width: 36px; height: 36px; }
.topbar .icon-btn:hover { border-color: var(--accent); }
.theme-opts { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; }
.topbar .brand img { box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); }

/* Panel lateral plegable (Seguimiento) */
.side-toggle { position: absolute; left: 0; top: 50%; transform: translateY(-50%); z-index: 1100; width: 20px; height: 60px; padding: 0;
               display: grid; place-items: center; font-size: 1.3rem; line-height: 1; cursor: pointer; color: var(--text);
               background: var(--panel); border: 1px solid var(--line); border-left: 0; border-radius: 0 8px 8px 0; box-shadow: var(--shadow); }
.side-toggle:hover { color: var(--accent-text); border-color: var(--accent); }
.mapview.collapsed { grid-template-columns: 1fr; }          /* el panel oculto no ocupa celda: el mapa pasa a ser la única columna */
.mapview.collapsed .side { display: none; }
/* Tablero en la computadora: el panel de unidades se comprime hasta desaparecer hacia la izquierda y el tablero (centrado, de ancho fijo) sube sobre el mapa.
   Todo va en la misma celda de la grilla (la última columna): el mapa ocupa todo y el tablero queda encima, abajo, con el mapa visible a los costados. */
@media (min-width: 761px) {
  .mapview { transition: grid-template-columns .5s cubic-bezier(.4, 0, .2, 1); }
  .mapview .side { grid-column: 1; grid-row: 1; min-width: 0; transition: opacity .35s ease; }
  .mapview .side > * { min-width: var(--side-w, 0); }              /* solo mientras se comprime o vuelve: el contenido conserva su ancho (lo fija el tablero) y se recorta, no se reacomoda */
  .mapview.dock-anim .side { overflow-x: hidden; }                 /* y sin barra horizontal durante esa animación */
  .mapview .map { grid-column: -2 / -1; grid-row: 1; }
  .mapview > .cockpit-dock { grid-column: -2 / -1; grid-row: 1; align-self: end; justify-self: center; }          /* ancho y alto: los del contenido (se ajusta a los relojes) */
  .mapview.docked:not(.collapsed) { grid-template-columns: 0px 1fr; }
  .mapview.docked:not(.collapsed) .side { opacity: 0; border-right-width: 0; }
  .mapview.docked .side-toggle { display: none; }
  /* Ocultar o mostrar el panel de unidades (botón ‹ ›): se desliza hacia la izquierda y vuelve igual, en vez de aparecer o desaparecer de golpe.
     La columna del panel baja a 0 (o sube a su ancho) con la misma curva que el tablero, y el panel se desvanece mientras se recorta. */
  .mapview.collapsed { grid-template-columns: 0px 1fr; }
  .mapview.collapsed .side { display: flex; opacity: 0; border-right-width: 0; visibility: hidden; transition: opacity .35s ease, visibility 0s linear .5s; pointer-events: none; }
  .mapview .side { transition: opacity .35s ease, visibility 0s; }
}
@media (min-width: 761px) and (prefers-reduced-motion: reduce) { .mapview, .mapview .side { transition: none !important; } }
/* Tablero en el celular: un panel fijo abajo con las esquinas de arriba redondeadas, sobre el mapa */
@media (max-width: 760px) {
  .cockpit-dock { position: fixed; left: 0; right: 0; bottom: 0; max-height: 78vh; padding: 36px 14px 18px; border-radius: 32px 32px 0 0; }
  .cockpit-main { flex-direction: column; gap: 10px; overflow: auto; height: auto; }
  .cockpit-dial { width: min(100%, 300px); height: auto; }
  .cockpit-center { width: 100%; padding-top: 0; }
}
}
@media (max-width: 760px) {
  .mapview.collapsed { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .side-toggle { left: 50%; top: auto; bottom: 0; transform: translateX(-50%); width: 64px; height: 22px; border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; }
  .side-toggle { font-size: 1.15rem; }
}

/* Informes */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .9rem; box-shadow: var(--shadow); }
.stat-v { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-l { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat-s { font-size: .8rem; }
.tabs { display: flex; gap: .25rem; margin: .5rem 0; border-bottom: 1px solid var(--line); }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: .5rem .9rem; cursor: pointer; color: var(--muted); font: inherit; }
.tab.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.place { max-width: 320px; }
@media print {
  .topbar, .no-print, .side-toggle { display: none !important; }
  body, .content { background: #fff !important; color: #000 !important; overflow: visible !important; }
  .shell, #app { height: auto !important; display: block !important; }
  .card, .stat { box-shadow: none !important; border-color: #bbb !important; background: #fff !important; }
  .table-wrap { overflow: visible !important; }
  a { color: #000; text-decoration: none; }
  .chip { border-color: #888; color: #000 !important; }
}

.detail .kv dd.addr { min-height: 5.5em; }          /* la dirección reserva cuatro líneas: no hay saltos al cambiar de calle ni de largo */

/* Ventana al pasar el puntero sobre una unidad del mapa */
.map-hover { position: absolute; z-index: 1200; width: min(320px, calc(100% - 16px)); pointer-events: none; padding: 10px 12px;
             background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.map-hover .hover-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: .95rem; }
.map-hover .kv { margin: .35rem 0 0; }
.map-hover { width: min(360px, calc(100% - 16px)); }
.map-hover .lastline { flex-wrap: wrap; white-space: normal; row-gap: 0; }   /* en la ventana angosta el "hace X min Y s" baja a otra línea en vez de salirse */

/* Ficha contraída: debajo del nombre, la dirección actual de la unidad */
.vhead .vtext { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.vhead .vaddr { font-weight: 400; font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Fichas desplegadas que no son la elegida: tocarlas las elige */
.detail.other { cursor: pointer; }

/* Recorrido: color fijo o por velocidad, con su leyenda */
.track-style { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: .4rem 0 0; }
.track-style .legend { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; }
.track-style .lg { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.track-style .lg i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.track-style .km { flex-basis: 100%; }          /* el kilometraje va en su propia línea, debajo del color y la leyenda */

/* Recorrido: período personalizado */
.track-custom { flex-basis: 100%; display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; align-items: end; }
.track-custom label { display: grid; gap: 2px; font-size: .75rem; color: var(--muted); min-width: 0; }
.track-custom input.dt { min-height: 30px; padding: .15rem .3rem; font-size: .8rem; min-width: 0; }

.speed-cfg { gap: .6rem; } .speed-cfg .field { margin: 0; display: grid; gap: 4px; align-content: start; } .speed-cfg input[type=number] { width: 100%; }

/* Leyenda de velocidades (también en la tabla de vehículos) */
.legend { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; }
.legend .lg { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.legend .lg i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

/* Selectores de color de las velocidades: color sólido con esquinas redondeadas, sin marco */
.speed-cfg input[type=color] { width: 56px; height: 36px; min-height: 36px; padding: 0; border: 0; background: none; border-radius: 8px; overflow: hidden; cursor: pointer; }
.speed-cfg input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.speed-cfg input[type=color]::-webkit-color-swatch { border: 0; border-radius: 8px; }
.speed-cfg input[type=color]::-moz-color-swatch { border: 0; border-radius: 8px; }
.speed-cfg .static-val { min-height: 43px; box-sizing: border-box; display: flex; align-items: center; color: var(--muted); }

/* Botón "i" del informe y su ventana */
.info-btn { width: 30px; height: 30px; border-radius: 50%; font: italic 700 .95rem Georgia, serif; }
.criteria { margin: 0 0 .5rem; padding-left: 1.1rem; display: grid; gap: .6rem; line-height: 1.45; }

/* Cámaras: video en vivo y clips */
/* El cuadro toma la proporción REAL del video (--ar y --arn los pone views_cameras.js al conocer su tamaño: 5:4 en calidad estándar, 16:9 en alta), así se ve entero, con la fecha y la hora
   que la cámara escribe al pie, y sin barras negras a los lados. El alto se limita a 68 % de la pantalla (el ancho baja en proporción y el cuadro queda centrado). */
.live-frame { position: relative; background: #000; border-radius: 8px; overflow: hidden; aspect-ratio: var(--ar, 16 / 9); width: min(100%, calc(68vh * var(--arn, 1.7778))); margin: 0 auto; }
.live-video, .clip-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.live-status { min-height: 1.4em; margin: .5rem 0; }
.live-status.ok { color: var(--ok, #16a34a); font-weight: 600; } .live-status.error { color: var(--bad, #dc2626); }
.live .row { margin-top: .5rem; }
.modal.wide { width: min(860px, 100%); }

/* Barra superior siempre oscura (opción de Cuenta → Apariencia), también con el resto en modo claro */
:root[data-topbar="dark"] { --top-bg: #161616; --top-text: #f5f5f5; --top-muted: #a8a8a8; --top-line: #2c2c2c; }

:root:has(.auth) body { background: #0e0e0e; }          /* también detrás (al desplazar o en pantallas muy anchas) */

/* ---- panel de control */
.page.dash { max-width: 1580px; }          /* el tablero usa casi todo el ancho de la pantalla */
.dash-tools { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.dash-tools select { width: auto; min-width: 180px; }
.dash-custom { display: flex; gap: .4rem; align-items: center; } .dash-custom input { width: auto; min-height: 34px; padding: .3rem .5rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg-btn { border: 0; background: transparent; padding: .42rem .8rem; cursor: pointer; font-size: .85rem; color: var(--muted); border-right: 1px solid var(--line); }
.seg-btn:last-child { border-right: 0; } .seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.seg.small .seg-btn { padding: .25rem .6rem; font-size: .8rem; }
.dash-out.stack > * + * { margin-top: 1rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .85rem; }
.kpi { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem 1rem 1rem; overflow: hidden; }
.kpi-l { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.kpi-v { font-size: 2rem; font-weight: 750; line-height: 1.15; margin: .2rem 0 .1rem; font-variant-numeric: tabular-nums; }
.kpi-v small { font-size: .9rem; font-weight: 500; color: var(--muted); }
.kpi-s { font-size: .82rem; } .kpi .spark { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 34px; opacity: .3; pointer-events: none; } .kpi:has(.spark) { padding-bottom: 2.3rem; }
.delta { font-size: .82rem; font-weight: 600; } .delta.good { color: var(--ok); } .delta.bad { color: var(--bad); } .delta .muted { font-weight: 400; }
.dash-grid { display: grid; gap: .85rem; } .dash-grid.two { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); } .dash-grid.three { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.dash-grid.compact { grid-template-columns: repeat(auto-fill, minmax(260px, 320px)); }
@media (max-width: 900px) { .dash-grid.two { grid-template-columns: 1fr; } }
.maint-services > * + * { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--line); }
.maint-service { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; border-radius: 6px; transition: background-color .12s; }
.maint-service:hover, .maint-service:focus-visible { background: var(--panel-2); }
.maint-service p { margin: 0; }
.maint-service p + p { margin-top: .2rem; }
.svc-line.ok { color: var(--ok); } .svc-line.warn { color: var(--warn); } .svc-line.bad { color: var(--bad); }
.maint-full { position: fixed; inset: 0; z-index: 40; background: var(--bg); overflow: auto; padding: 1rem; }
.maint-full-bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .85rem; }
.maint-full-bar h1 { margin: 0; font-size: 1.1rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .4rem; } .card-head h3 { margin: 0; }
.chart-host { position: relative; } .ch { width: 100%; height: auto; display: block; }
.ch-grid { stroke: var(--line); stroke-width: 1; } .ch-axis { fill: var(--muted); font-size: 11px; } .ch-hit { fill: transparent; } .ch-hit:hover { fill: rgba(127,127,127,.12); } .ch-track { stroke: var(--panel-2); }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: .5rem .65rem; font-size: .8rem; min-width: 160px; }
.chart-tip div { display: flex; align-items: center; gap: .4rem; margin-top: .2rem; } .chart-tip div span { margin-left: auto; font-weight: 600; padding-left: .8rem; }
.chart-tip i, .legend i, .donut-key i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.legend { display: flex; flex-wrap: wrap; gap: .35rem .5rem; margin-top: .6rem; }
.lg { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); background: var(--panel-2); border-radius: 999px; padding: .2rem .65rem; font-size: .8rem; cursor: pointer; }
.lg b { font-weight: 600; color: var(--muted); } .lg.off { opacity: .45; text-decoration: line-through; }
.donut-wrap { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; justify-content: center; margin: .6rem 0; }
.donut-box { position: relative; width: 190px; height: 190px; } .donut-mid { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-mid b { font-size: 2.2rem; line-height: 1; } .donut-mid span { color: var(--muted); font-size: .8rem; }
.donut-key { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; } .donut-key li { display: flex; align-items: center; gap: .5rem; } .donut-key b { margin-left: auto; padding-left: 1rem; }
.rank { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .65rem; }
.rank-top { display: flex; justify-content: space-between; gap: .6rem; font-size: .88rem; } .rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; margin-top: .25rem; } .rank-bar i { display: block; height: 100%; border-radius: 99px; }
.dash-table .num { text-align: right; font-variant-numeric: tabular-nums; } .dash-table th:not(:first-child) { text-align: right; }
.th-btn { all: unset; cursor: pointer; text-transform: inherit; letter-spacing: inherit; } .th-btn:focus-visible { outline: 2px solid var(--accent); }
.dot-state { display: inline-flex; align-items: center; gap: .4rem; } .dot-state i { width: 9px; height: 9px; border-radius: 50%; }
.dash-skel { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .85rem; } .skel { height: 110px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } } @media (prefers-reduced-motion: reduce) { .skel { animation: none; } }
.arc { cursor: pointer; transition: opacity .15s; } .arc.dim { opacity: .25; }
.key-btn { all: unset; display: flex; align-items: center; gap: .5rem; width: 100%; cursor: pointer; padding: .15rem .4rem; border-radius: 6px; } .key-btn:hover, .key-btn.on { background: var(--panel-2); } .key-btn:focus-visible { outline: 2px solid var(--accent); }
.key-btn b { margin-left: auto; padding-left: 1rem; }
.conn-list { margin-top: .4rem; } .conn-head { display: flex; align-items: center; gap: .5rem; font-weight: 600; margin-bottom: .3rem; } .conn-head i { width: 10px; height: 10px; border-radius: 3px; }
.conn-list ul { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow: auto; } .conn-list li { display: flex; justify-content: space-between; gap: .6rem; padding: .3rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }

/* Dashboard: las tarjetas conservan el tono oscuro y el fondo de la pantalla queda un poco más claro que ellas (en modo claro ya lo es) */
:root { --dash-bg: var(--bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --dash-bg: #262626; } }
:root[data-theme="dark"] { --dash-bg: #262626; }
body:has(.page.dash) { background: var(--dash-bg); }

/* Portada del dashboard (imagen del cliente) */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 1rem; overflow: hidden; padding: 1rem 1.6rem; min-height: 210px; border: 1px solid #2c2c2c; border-radius: var(--radius); box-shadow: var(--shadow);
        color: #f2f2f2; background: linear-gradient(105deg, #181818 35%, color-mix(in srgb, var(--accent) 38%, #181818)); }      /* siempre oscura, también con la aplicación en modo claro */
.hero h2 { font-size: 1.7rem; margin: 0 0 .25rem; } .hero-tag { margin: .2rem 0 0; font-size: 1.1rem; color: #a8a8a8; }
.hero-img { height: 190px; max-width: 55%; object-fit: contain; flex: none; filter: drop-shadow(0 8px 14px rgba(0,0,0,.45)); }
@media (max-width: 700px) { .hero { flex-direction: column-reverse; align-items: flex-start; } .hero-img { height: 130px; max-width: 100%; align-self: center; } }
.cover-prev { display: block; max-height: 120px; max-width: 100%; margin-bottom: .5rem; background: var(--panel-2); border-radius: 6px; padding: .3rem; }
.hero-img.enter { animation: hero-drive 1.3s cubic-bezier(.16, .84, .3, 1) both; }
@keyframes hero-drive { from { transform: translateX(110%); opacity: 0; filter: blur(7px) drop-shadow(0 8px 14px rgba(0,0,0,.45)); } 60% { opacity: 1; } to { transform: none; opacity: 1; filter: blur(0) drop-shadow(0 8px 14px rgba(0,0,0,.45)); } }
@media (prefers-reduced-motion: reduce) { .hero-img.enter { animation: none; } }

/* Animación de entrada de los gráficos del dashboard (solo al abrirlo): columnas que crecen, líneas que se dibujan, anillo que gira y barras que se llenan */
.dash-out.anim .col { transform-box: fill-box; transform-origin: 50% 100%; animation: grow-y .8s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 70ms); }
.dash-out.anim .ch-line { stroke-dasharray: 1; animation: draw-line 1.4s ease-out both; }
.dash-out.anim .ch-dot, .dash-out.anim .spark { animation: fade-in .5s ease-out 1s both; }
.dash-out.anim .donut { transform-origin: 50% 50%; animation: donut-in 1.1s cubic-bezier(.2, .8, .2, 1) both; }
.dash-out.anim .rank-bar i { transform-origin: left center; animation: grow-x .9s cubic-bezier(.2, .8, .2, 1) both; }
.dash-out.anim .rank li:nth-child(2) i { animation-delay: .08s; } .dash-out.anim .rank li:nth-child(3) i { animation-delay: .16s; } .dash-out.anim .rank li:nth-child(4) i { animation-delay: .24s; }
.dash-out.anim .rank li:nth-child(5) i { animation-delay: .32s; } .dash-out.anim .rank li:nth-child(6) i { animation-delay: .4s; } .dash-out.anim .rank li:nth-child(7) i { animation-delay: .48s; } .dash-out.anim .rank li:nth-child(8) i { animation-delay: .56s; }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: none; } }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: none; } }
@keyframes draw-line { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes donut-in { from { transform: rotate(-140deg) scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dash-out.anim .col, .dash-out.anim .ch-line, .dash-out.anim .ch-dot, .dash-out.anim .spark, .dash-out.anim .donut, .dash-out.anim .rank-bar i { animation: none; } }

/* El nombre y el eslogan emergen desde la oscuridad: transparentes y desenfocados al principio, se deslizan un poco y se solidifican */
.hero-text.enter h2 { animation: hero-text-in 1.1s cubic-bezier(.2, .8, .2, 1) .15s both; }
.hero-text.enter .hero-tag { animation: hero-text-in 1.1s cubic-bezier(.2, .8, .2, 1) .55s both; }
@keyframes hero-text-in { from { opacity: 0; transform: translateX(-30px); filter: blur(7px); } to { opacity: 1; transform: none; filter: blur(0); } }
@media (prefers-reduced-motion: reduce) { .hero-text.enter h2, .hero-text.enter .hero-tag { animation: none; } }

/* Fundido entre pantallas: la que sale se desvanece y la que entra aparece suavemente; el fondo del dashboard cambia gradualmente */
body { transition: background-color .75s ease; }
.content { transition: opacity .26s ease-in-out; } .content.leaving { opacity: 0; }
.content > * { animation: view-in .75s cubic-bezier(.25, .1, .25, 1) both; }
.content > .mapview, .content > .dash { animation-name: view-fade; }          /* el dashboard solo aparece (sin subir 10 px): una capa en movimiento con la portada y los gráficos encima se ve como un salto al terminar */
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes view-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .content > *, .content { animation: none; transition: none; } }

/* Pantalla Servidor */
.srv-out.stack > * + * { margin-top: 1rem; }
.srv-banner { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); padding: 1rem 1.3rem; }
.srv-big { display: flex; align-items: center; gap: 1rem; } .srv-big h2 { margin: 0; font-size: 1.6rem; } .srv-big p { margin: .15rem 0 0; }
.srv-big .st-dot { width: 22px; height: 22px; box-shadow: 0 0 0 6px color-mix(in srgb, var(--c) 25%, transparent); }
.st-dot { display: inline-block; flex: none; width: 11px; height: 11px; border-radius: 50%; margin-top: .3rem; }
.srv-checks { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .65rem; } .srv-checks li { display: flex; gap: .65rem; align-items: flex-start; }
.srv-list { list-style: none; margin: .4rem 0; padding: 0; } .srv-list li { display: flex; justify-content: space-between; gap: .6rem; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.srv-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin: .5rem 0; }
.kpi .rank-bar { margin-top: .5rem; }
/* Pantalla Servidor: títulos y nombres de los controles más finos */
.srv-out h3 { font-size: .82rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: .5rem; }
.srv-checks { gap: .5rem; } .srv-checks b { font-weight: 400; font-size: .88rem; } .srv-checks .small { font-size: .78rem; }
.srv-banner h2 { font-size: 1.25rem; font-weight: 500; }
.srv-out .kpi-v { font-weight: 600; }

/* Capas de rutas del mapa */
.layers-swatch { display: inline-block; width: 18px; height: 4px; border-radius: 2px; margin: 0 .1rem; vertical-align: middle; }
.route-info { max-width: 240px; font-size: .85rem; line-height: 1.35; color: #161616; } .route-info b { display: block; margin-bottom: .15rem; }
/* Rutas y zonas: listado compacto en dos columnas */
.layers-panel:has(.layers-routes) { width: 280px; }
.layers-routes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 4px; max-height: 260px; overflow-x: hidden; overflow-y: auto; }
.layers-routes .layers-opt { padding: 5px 6px; font-size: .88rem; white-space: nowrap; min-width: 0; gap: 6px; }
.layers-actions { display: flex; gap: 14px; margin: 0 6px 4px; }
.layers-clear { all: unset; cursor: pointer; font-size: .8rem; color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--muted); } .layers-clear:hover { text-decoration-color: var(--text); } .layers-clear:focus-visible { outline: 2px solid var(--accent); }

/* Recorridos: panel con período, color y casillas de lo que se marca sobre el mapa */
.rec-form { gap: 12px !important; }
.rec-form label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 3px; }
.rec-form .seg { display: flex; }
.rec-form .seg .seg-btn { flex: 1; padding: .42rem .3rem; }
.rec-custom { display: grid; gap: 8px; }
.rec-colorrow { display: flex; align-items: center; gap: 8px; }
.rec-colorrow .seg { flex: 1; }
.rec-color { width: 42px; height: 36px; padding: 2px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; flex: none; }
.rec-icons { display: flex; gap: 8px; }
.rec-ico { width: 54px; height: 54px; display: grid; place-items: center; padding: 0; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; transition: opacity .15s, filter .15s, border-color .15s; }
.rec-ico svg { width: 38px; height: 38px; }
.rec-ico:hover { border-color: var(--accent); }
.rec-ico.off { opacity: .35; filter: grayscale(1); }
.rec-sec { border-bottom: 1px solid var(--line); }
.rec-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px 0 4px; }
.rec-sec-title { flex: 1; display: flex; align-items: center; gap: 6px; text-align: left; background: none; border: 0; padding: 10px 8px; font-weight: 600; color: var(--text); cursor: pointer; }
.rec-sec-title .chev { display: inline-block; transition: transform .15s; font-size: .8rem; color: var(--muted); }
.rec-sec.collapsed .rec-sec-title .chev { transform: rotate(-90deg); }
.rec-sec.collapsed .rec-sec-body { display: none; }
.rec-master { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; flex: none; }
.rec-row { display: flex; align-items: center; gap: 10px; padding: 0 12px; border-top: 1px solid var(--line); }
.rec-row:hover { background: var(--panel-2); }
.rec-row input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); flex: none; margin: 0; min-height: 0; }
.rec-trip-ico { width: 18px; height: 18px; border-radius: 4px; flex: none; }
.rec-row-ico { width: 26px; height: 26px; flex: none; display: grid; place-items: center; }
.rec-row-ico svg { width: 26px; height: 26px; }
.rec-row-text { flex: 1; min-width: 0; display: grid; text-align: left; background: none; border: 0; padding: 8px 0; cursor: pointer; color: var(--text); font-size: .85rem; line-height: 1.3; }
.rec-row-val { font-variant-numeric: tabular-nums; font-size: .85rem; white-space: nowrap; }
.rec-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 4px 10px 12px; }
.rec-summary .stat { padding: .5rem .65rem; box-shadow: none; }
.rec-summary .stat-v { font-size: 1.05rem; }

/* Comandos a los equipos: texto tal cual se envía y se recibe */
.cmd-text { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; white-space: pre-wrap; word-break: break-all; }
textarea.cmd-text { width: 100%; min-height: 3.2rem; resize: vertical; }

/* Color de las etiquetas de las unidades (en el control de capas) */
.layers-colorrow { cursor: default; }
.layers-color { width: 34px !important; height: 26px; padding: 1px; border-radius: 6px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.layers-clear[disabled] { opacity: .4; cursor: default; text-decoration: none; }

/* Biblioteca de íconos */
.icon-lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; max-height: 52vh; overflow: auto; padding: 2px; }
.icon-lib-item { position: relative; }
.icon-lib-pick { all: unset; box-sizing: border-box; width: 100%; display: grid; justify-items: center; gap: 6px; padding: 10px 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); cursor: pointer; color: var(--text); }
.icon-lib-pick:hover { border-color: var(--accent); }
.icon-lib-pick:focus-visible { outline: 2px solid var(--accent); }
.icon-lib-img { width: 64px; height: 64px; object-fit: contain; }
.icon-lib-name { font-size: .78rem; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-lib-del { all: unset; position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; line-height: 18px; text-align: center; border-radius: 50%; background: rgba(0,0,0,.5); color: #fff; cursor: pointer; font-size: 15px; opacity: 0; transition: opacity .12s; }
.icon-lib-item:hover .icon-lib-del, .icon-lib-del:focus-visible { opacity: 1; }
.icon-lib-del:hover { background: var(--bad, #dc2626); }

/* Lupa del mapa: buscar una dirección o un lugar (a la izquierda del botón de capas) */
.msearch-ctl { position: absolute; top: 10px; right: 62px; z-index: 1000; }
.msearch-btn { width: 42px; height: 42px; display: grid; place-items: center; padding: 0; cursor: pointer; border-radius: 8px; background: var(--panel); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow); }
.msearch-btn:hover, .msearch-btn[aria-expanded=true] { color: var(--accent-text); border-color: var(--accent); }
.msearch-panel { position: absolute; top: 48px; right: 0; width: min(330px, calc(100vw - 90px)); padding: 8px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.msearch-row { display: flex; gap: 6px; align-items: center; }
.msearch-row input { flex: 1; min-width: 0; }
.msearch-go { all: unset; box-sizing: border-box; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; background: var(--accent); color: var(--on-accent); cursor: pointer; flex: none; }
.msearch-go:focus-visible { outline: 2px solid var(--text); }
.msearch-results { max-height: 46vh; overflow: auto; margin-top: 6px; }
.msearch-item { all: unset; box-sizing: border-box; width: 100%; display: grid; gap: 1px; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--text); }
.msearch-item:hover, .msearch-item:focus-visible { background: var(--panel-2); }
.msearch-name { font-weight: 600; font-size: .92rem; }
.msearch-addr { font-size: .8rem; color: var(--muted); }
.msearch-src { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.msearch-note { margin: 6px 4px; font-size: .85rem; color: var(--muted); }
.msearch-note.bad { color: var(--bad, #dc2626); }
.msearch-clear { all: unset; cursor: pointer; font-size: .82rem; margin: 6px 4px 2px; text-decoration: underline; text-underline-offset: 3px; color: var(--text); }
.msearch-clear.hidden { display: none; }
.pin-info { display: grid; gap: 6px; max-width: 220px; color: #1f2937; font-size: .9rem; }
.pin-info-sv { all: unset; cursor: pointer; justify-self: start; padding: 5px 10px; border-radius: 6px; background: #2563eb; color: #fff; font-size: .82rem; }
.pin-info-sv:focus-visible { outline: 2px solid #1f2937; outline-offset: 2px; }

/* El ícono de la unidad es un botón: al tocarlo se abre la biblioteca para elegir otro */
button.icon-pick { padding: 0; cursor: pointer; color: inherit; font: inherit; }
button.icon-pick:hover { border-color: var(--accent); }
button.icon-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Mosaico de unidades: una grilla de cuadros, cada uno con un mapa que sigue a su unidad */
.mosaic { position: relative; display: flex; flex-direction: column; height: 100%; min-height: 0; }
.mosaic-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; }
.mosaic-bar select { width: auto; min-width: 150px; }
.mosaic-attrib { flex: none; padding: 0 10px 3px; text-align: right; font-size: .65rem; color: var(--muted); }
.mosaic-attrib:empty { display: none; }
.mosaic-bar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.mosaic-layers-wrap { position: relative; }
.mosaic-layers { top: 40px; right: 0; z-index: 1200; }
.mosaic-bar-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; font: inherit; }
.mosaic-bar-btn:hover, .mosaic-bar-btn[aria-expanded=true] { border-color: var(--accent); }
.mosaic-grid { flex: 1; min-height: 0; display: grid; gap: 6px; padding: 6px; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); grid-template-rows: repeat(var(--rows, 2), minmax(0, 1fr)); }
.mosaic-grid.expanded { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.mosaic-tile { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); }
.mosaic-tile.hidden { display: none; }
/* el renglón de arriba de cada cuadro: asignar unidad (nombre) + velocidad, ignición y último reporte + ampliar */
.mosaic-head { display: flex; align-items: center; gap: 10px; padding: 4px 6px; flex: none; border-bottom: 1px solid var(--line); min-height: 40px; }
.mosaic-pick { flex: 0 1 auto; min-width: 0; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text); cursor: pointer; font: inherit; font-weight: 600; }
.mosaic-pick:hover { border-color: var(--line); background: var(--panel-2); }
.mosaic-pick.empty { color: var(--muted); font-weight: 400; }
.mosaic-pickname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mosaic-caret { color: var(--muted); font-size: .75em; }
.mosaic-addr { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; color: var(--muted); }          /* la dirección cede primero cuando el cuadro es angosto */
.mosaic-stats { flex: 0 1 auto; min-width: 0; display: flex; align-items: baseline; justify-content: flex-end; gap: 4px 12px; flex-wrap: wrap; font-size: .85rem; overflow: hidden; max-height: 30px; }
.mosaic-btn { flex: none; width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; }
.mosaic-btn:hover { border-color: var(--accent); }
.mosaic-map { position: relative; flex: 1; min-height: 0; isolation: isolate; background: var(--panel-2); }
.mosaic-map > .mapbox { position: absolute; inset: 0; }
.mosaic-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .9rem; }
.mosaic-assign { padding: 8px 16px; border-radius: 8px; border: 1px dashed var(--line); background: transparent; color: var(--text); cursor: pointer; font: inherit; }
.mosaic-assign:hover { border-color: var(--accent); }
.mosaic-speed strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; } .mosaic-speed small { color: var(--muted); }
.mosaic-ign { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; } .mosaic-ign svg { width: 15px; height: 15px; } .mosaic-ign.on { color: var(--ok); } .mosaic-ign.off { color: var(--bad); }
.mosaic-ago { color: var(--muted); } .mosaic-ago.bad { color: var(--bad); }
/* lista para elegir unidad (flota sobre todo lo demás) */
.mosaic-picker { position: fixed; z-index: 3000; max-width: 92vw; display: grid; gap: 6px; padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
.mosaic-picksearch { width: 100%; }
.mosaic-picklist { max-height: min(50vh, 360px); overflow: auto; display: grid; gap: 2px; }
.mosaic-pickitem { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; text-align: left; padding: 6px 8px; border-radius: 6px; border: 0; background: transparent; color: inherit; cursor: pointer; font: inherit; }
.mosaic-pickitem:hover { background: var(--panel-2); } .mosaic-pickitem.current { outline: 1px solid var(--accent); } .mosaic-pickitem.none { color: var(--muted); }
.mosaic-pickempty { padding: 8px; }
/* pantalla completa: sin el menú de arriba de la plataforma */
body.mosaic-full .topbar { display: none; }
.mosaic.autohide .mosaic-bar { position: absolute; top: 0; left: 0; right: 0; z-index: 1500; transform: translateY(-100%); transition: transform .2s; box-shadow: 0 4px 16px rgba(0, 0, 0, .25); }
.mosaic.autohide.show-bar .mosaic-bar { transform: none; }
@media (max-width: 760px) {
  .mosaic-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-rows: minmax(240px, 1fr); overflow: auto; }
  .mosaic-bar-btn span { display: none; }
  .mosaic-stats { justify-content: flex-start; }
}

/* Planes: interruptores de módulos */
.plan-modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; }

/* Geocercas: panel de dibujo y lista (usa el diseño de Seguimiento: panel a la izquierda y mapa) */
.geo-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.geo-panel { padding: 10px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; background: var(--panel-2); }
.geo-panel h3 { margin: 0; font-size: .95rem; font-weight: 500; }
.geo-help { margin: 0; font-size: .85rem; color: var(--muted); }
.geo-row { display: flex; gap: 8px; flex-wrap: wrap; }
.geo-colors { display: flex; gap: 8px; }
.geo-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.geo-swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--text); }
.geo-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.geo-item:hover { background: var(--panel-2); } .geo-item.selected { background: var(--panel-2); }
.geo-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; }
.geo-info { flex: 1; min-width: 0; } .geo-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.geo-actions { display: flex; gap: 4px; flex: none; }
.geo-colors { align-items: center; flex-wrap: wrap; }
.geo-custom { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); cursor: pointer; }
.geo-custom input { width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; }
.geo-listhead { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.geo-allbtn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--text); cursor: pointer; font: inherit; font-size: .8rem; }
.geo-allbtn:hover { color: var(--accent-text); }
.geo-item.off .geo-name, .geo-item.off .geo-dot { opacity: .45; }
.geo-item.sub { padding-left: 28px; background: var(--panel-2); } .geo-item.sub.selected { background: var(--line); }
.geo-actions .icon-btn { width: 30px; height: 30px; }
.geo-actions .icon-btn.on { background: transparent; color: var(--accent-text); border-color: var(--accent); }        /* el ojo activo: contorno de color, el ícono se sigue viendo */
/* tiradores de la geocerca que se dibuja o edita */
.geo-handle { border-radius: 50%; border: 2px solid #1a73e8; background: #1a73e8; box-shadow: 0 0 0 1px #fff; box-sizing: border-box; }
.geo-handle.grab { cursor: move; }
.geo-handle-first, .geo-handle-center { background: #fff; }
.geo-handle-radius { background: #f5a623; border-color: #1a73e8; }

/* Capa de calles de Esri (viene en naranja y gruesa): en gris claro y semitransparente se mezcla con la imagen */
.esri-roads { filter: grayscale(1) brightness(1.5); }

/* Grupos de unidades y conductores */
.group-row { display: flex; gap: 8px; align-items: center; } .group-row select, .group-row input[type=search] { flex: 1; min-width: 0; }
.grp-item { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.grp-units { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px 12px; }
.grp-unit { padding: 3px 0; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .85em; }
.view-toggle { flex: none; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); cursor: pointer; }
.view-toggle.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.grp-head { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.grp-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 9px 0; border: 0; background: none; text-align: left; cursor: pointer; font-weight: 600; color: inherit; }
.grp-head:hover { background: var(--line); }
.grp-caret { width: 12px; color: var(--muted); } .grp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .grp-count { flex: none; }

/* Borde del panel de unidades para ajustar su ancho */
.side-resize { display: none; }
@media (min-width: 761px) {
  .mapview .side-resize { display: block; position: absolute; top: 0; bottom: 0; left: calc(var(--side-col, 360px) - 3px); width: 7px; z-index: 1200; cursor: col-resize; touch-action: none; background: transparent; }
  .mapview .side-resize:hover, .mapview.resizing .side-resize { background: color-mix(in srgb, var(--accent) 35%, transparent); }
  .mapview.collapsed .side-resize, .mapview.docked .side-resize { display: none; }
  .mapview.resizing { transition: none; user-select: none; cursor: col-resize; }
}

/* Aviso de sesión como otro usuario (suplantación) */
.imp-bar { flex: none; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 6px 12px; background: #f5b82e; color: #1d1d1d; font-size: .88rem; }
.imp-bar .btn { background: #1d1d1d; border-color: #1d1d1d; color: #fff; }

/* Casilla para mostrar u ocultar unidades en el mapa */
.vcheck { flex: none; width: 15px; height: 15px; margin: 0 0 0 12px; min-height: 0; accent-color: var(--accent); cursor: pointer; }
.grp-head .vcheck, .detail .vcheck { margin-left: 0; } .group-row .vcheck.master { margin-left: 2px; }       /* la ficha, el grupo y la maestra ya tienen 12 px de margen: todas quedan en la misma columna */

/* Barra de herramientas del mapa: columna a la izquierda con búsqueda, capas y medir */
.map-tools { position: absolute; top: 10px; right: 10px; z-index: 1000; display: flex; flex-direction: column; align-items: stretch; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.map-tools .mt-body { display: flex; flex-direction: column; }
.map-tools.collapsed .mt-body { display: none; }
.map-tools .mt-sep { height: 1px; margin: 2px 8px; background: var(--line); }
.map-tools .layers-ctl, .map-tools .msearch-ctl { position: relative; top: auto; right: auto; left: auto; }
.map-tools .layers-btn, .map-tools .msearch-btn, .mt-btn { width: 42px; height: 42px; display: grid; place-items: center; padding: 0; cursor: pointer; border: 0; border-radius: 8px; background: transparent; box-shadow: none; color: var(--text); }
.map-tools .layers-btn:hover, .map-tools .msearch-btn:hover, .mt-btn:hover, .map-tools .layers-btn[aria-expanded=true], .map-tools .msearch-btn[aria-expanded=true] { background: var(--panel-2); color: var(--accent-text); }
.mt-btn.on { background: var(--accent); color: var(--on-accent); }
.mt-fold { height: 30px; border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; color: var(--muted); }
.map-tools.collapsed .mt-fold { border-top: 0; border-radius: 10px; }
.mt-fold svg { transition: transform .2s; transform: rotate(180deg); } .map-tools.collapsed .mt-fold svg { transform: none; }
.map-tools .layers-panel, .map-tools .msearch-panel { right: calc(100% + 8px); left: auto; top: 0; }

/* Cuadro de resultado de medir */
.measure-panel { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 1000; min-width: 230px; max-width: calc(100% - 100px); padding: 10px 14px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); text-align: center; }
.measure-panel.hidden { display: none; }
.measure-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.measure-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.measure-extra { display: block; min-height: 1.1em; font-size: .78rem; color: var(--muted); }
.measure-actions { display: flex; gap: 6px; justify-content: center; margin-top: 6px; flex-wrap: wrap; }

/* Menú superior reordenable */
.nav a[draggable=true] { cursor: grab; }
.topbar .nav-more { flex: none; background: transparent; color: var(--top-text); border-color: var(--top-line); }
.topbar .nav-more:hover { border-color: var(--accent); color: var(--top-text); }
.nav-pop { position: fixed; z-index: 3000; min-width: 220px; max-height: calc(100vh - 80px); overflow-y: auto; padding: 6px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.nav-row { display: flex; align-items: center; gap: .6rem; padding: .35rem .5rem; border-radius: 6px; cursor: pointer; }
.nav-row:hover { background: var(--panel-2); }
.nav-row input { width: auto; min-height: 0; margin: 0; accent-color: var(--accent); }
.nav-row a { flex: 1; color: inherit; text-decoration: none; }
.who-btn { background: none; border: 0; padding: .3rem .5rem; border-radius: 6px; cursor: pointer; font: inherit; font-size: .85rem; }
.who-btn:hover, .who-btn:focus-visible { background: rgba(255,255,255,.1); color: var(--top-text); }
.who-caret { margin-left: .35rem; font-size: .7rem; }
.menu-item { display: block; width: 100%; text-align: left; padding: .5rem .7rem; background: none; border: 0; border-radius: 6px; color: inherit; font: inherit; cursor: pointer; white-space: nowrap; }
.menu-item:hover, .menu-item:focus-visible { background: var(--panel-2); }
.nav-foot { display: flex; flex-direction: column; gap: .4rem; padding: .5rem .5rem .25rem; margin-top: 4px; border-top: 1px solid var(--line); }
.nav a.dragging { opacity: .4; }
.nav a.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }

/* Dirección de cada unidad en la lista, siempre a la vista (una línea, recortada) */
.vitem .vaddr { display: block; margin: 1px 0 2px; font-size: .78rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Dirección de la unidad en la ficha: destacada, justo debajo del último reporte */
.addr-line { margin: .3rem 0 .5rem; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.addr-line .vaddr { display: block; min-height: 2.6em; font-weight: 400; font-size: .9rem; line-height: 1.3; overflow-wrap: anywhere; }        /* reserva dos líneas: no hay saltos al cambiar de calle */
.addr-line .addr-coords { display: block; margin-top: 2px; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Pantalla completa del mapa principal: solo ícono, abajo a la derecha; oculta el menú de arriba (el aviso de suplantación se queda) */
.map-full-btn { position: absolute; right: 10px; bottom: 28px; z-index: 1000; width: 42px; height: 42px; display: grid; place-items: center; padding: 0; cursor: pointer; border-radius: 10px; background: var(--panel); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow); }
.map-full-btn:hover, .map-full-btn[aria-pressed=true] { color: var(--accent-text); border-color: var(--accent); }
body.map-full .topbar { display: none; }

/* Satélites visibles junto a los botones de la unidad */
.sat-badge { display: inline-flex; align-items: center; gap: 3px; flex: none; height: 24px; padding: 0 6px; border-radius: 12px; font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums; cursor: default; }
.sat-badge svg { flex: none; } .sat-badge.ok { color: var(--ok); } .sat-badge.warn { color: var(--warn); } .sat-badge.bad { color: var(--bad); }

/* Columnas de la lista de unidades: velocidad, satélites y botones alineados; rayas punteadas para ajustar el ancho */
.vrow .vcheck { margin-left: 0; }
.vspeed { text-align: right; padding-right: 8px; font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; }
.vsat { display: flex; justify-content: center; min-width: 0; }
.slot { display: inline-block; width: 30px; height: 30px; flex: none; }
.vlist { position: relative; }
.col-grip { position: absolute; top: 0; bottom: 0; width: 9px; margin-right: -4.5px; cursor: col-resize; z-index: 2; touch-action: none; }
.col-grip::after { content: ""; position: absolute; left: 4px; top: 0; bottom: 0; border-left: 1px dashed transparent; }
.col-grip:hover::after, .col-grip.dragging::after { border-left-color: var(--muted); }
.col-grip.sat { right: calc(12px + 102px + var(--c-sat, 56px)); }

/* Listas desplegables con el estilo de la plataforma: la lista, el resaltado y los títulos siguen el color del cliente (--accent) y la tipografía fina,
   en vez del azul y la negrita del sistema. Donde el navegador no lo soporta queda la lista nativa. */
@supports (appearance: base-select) {
  select, select::picker(select) { appearance: base-select; }
  select::picker(select) { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 4px; box-shadow: var(--shadow); max-height: min(380px, 60vh); }
  select option { padding: .4rem .65rem; border-radius: 6px; font-weight: 400; color: var(--text); background: transparent; }
  select option:hover, select option:focus-visible { background: var(--accent); color: var(--on-accent); }
  select option:checked { background: var(--panel-2); }
  select option:checked:hover { background: var(--accent); color: var(--on-accent); }
  select option::checkmark { display: none; }
  select optgroup { font-weight: 400; font-style: normal; }
  select optgroup > :is(legend, label) { font-weight: 400; font-size: .78rem; color: var(--muted); padding: .45rem .65rem .15rem; }
}

/* Primera fila de la ficha: ignición y velocidad a la derecha del nombre */
.vhead .vstats { margin-left: auto; display: flex; align-items: center; gap: 12px; flex: none; padding-left: 8px; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.vhead .vspd { font-variant-numeric: tabular-nums; min-width: 8ch; text-align: right; }          /* ancho fijo: con 1, 2 o 3 cifras la llave no se corre */
.vhead .vign { min-width: 10ch; }                                                                       /* «Encendido» / «Apagado» ocupan lo mismo: la llave queda siempre en el mismo lugar */
.vhead .vign .ign svg { position: relative; top: 3px; }          /* la llave queda a la altura del texto (el dibujo está algo alto dentro de su cuadro) */
.detail { container-type: inline-size; }
@container (max-width: 540px) { .vhead .vign { min-width: 0; } .vhead .vign .ign { font-size: 0; } .vhead .vign .ign svg { width: 18px; height: 18px; } }       /* con el panel angosto (menos de 540 px) la ignición queda solo con la llave (verde o roja) */

/* Video en vivo: estado a la izquierda y pantalla completa a la derecha */
.live-bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.live-bar .live-status { margin: .5rem 0; }

/* Video en vivo con el mapa al lado: el video ocupa lo que sobra y el mapa una columna fija; en pantallas angostas el mapa pasa debajo */
.modal:has(.live-split.with-map) { width: min(1240px, 100%); }
.live-split.with-map { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: stretch; }
.live-map { display: flex; flex-direction: column; gap: 6px; min-height: 280px; }
.live-map[hidden] { display: none; }
.live-map-box { position: relative; flex: 1; min-height: 240px; border-radius: 8px; overflow: hidden; isolation: isolate; background: var(--panel-2); border: 1px solid var(--line); }
.live-map-box > .mapbox { position: absolute; inset: 0; }
.live-map-info { text-align: center; }
@media (max-width: 900px) { .live-split.with-map { grid-template-columns: 1fr; } .live-map-box { min-height: 240px; flex: none; height: 240px; } }

/* Espacio de los clips: barra de llenado (verde, ámbar desde el 80 %, roja al llegar al tope) */
.stor { display: grid; gap: .45rem; }
.stor-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.stor-num { font-variant-numeric: tabular-nums; font-weight: 600; }
.stor-track { height: 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.stor-fill { height: 100%; border-radius: 999px; background: var(--ok); transition: width .5s cubic-bezier(.4, 0, .2, 1); min-width: 2px; }
.stor.warn .stor-fill { background: var(--warn); } .stor.full .stor-fill { background: var(--bad); }
.stor-note.warn { color: var(--warn); } .stor-note.full { color: var(--bad); font-weight: 600; }
.stor.compact .stor-sub { display: none; }
.dash-storage:empty { display: none; }
.dash-storage.pending:empty { display: block; min-height: 70px; }          /* el lugar de la barra mientras llega: sin esto el resto del dashboard salta hacia abajo */
.warn-text { color: var(--warn); font-weight: 600; }

/* Pantalla de carga con el fondo de la pantalla de ingreso (ver holdBackground en app.js): la caja se desvanece y queda solo la red de puntos animada */
.auth .card { transition: opacity .32s ease, transform .32s ease; }
.auth.loading .card { opacity: 0; transform: translateY(8px) scale(.98); pointer-events: none; }
.auth.loadcover { position: fixed; inset: 0; z-index: 99999; min-height: 0; }
.auth.loadcover .bg-net { transition: opacity .3s ease; }
.auth.loadcover.calm .bg-net { opacity: 0; }                  /* al terminar, primero se apagan los puntos, sobre el fondo liso... */
#app { transition: opacity .45s ease; }
html.hold #app { opacity: 0; }                              /* ...mientras la plataforma se arma transparente debajo; al quitar la cubierta aparece desde lo oscuro (nunca hay una capa semitransparente encima) */
html.pre body { background: #0e0e0e; }                       /* antes de que arranque el JavaScript: el mismo oscuro de la pantalla de ingreso */

/* plantillas de informe */
tr.grp-row td { background: var(--panel-2); }
tr.total-row td { border-top: 1px solid var(--line); }
.tpl-cols { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .5rem; }
.tpl-col { display: flex; align-items: center; gap: .35rem; padding: .25rem .5rem; border: 1px solid var(--line); border-radius: 6px; }

/* contraseña con ojo */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 2.8rem !important; }
.pw-eye { position: absolute; right: .25rem; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 8px; }
.pw-eye:hover { color: var(--text); }
.auth .pw-wrap input[type=text], .auth .pw-wrap input[type=password] { text-align: center; }

/* video pedido a la camara (no es un evento): todo el texto de la fila en otro color */
tr.frag-row td, tr.frag-row td .muted, tr.frag-row td .chip { color: var(--frag); }

/* video en vivo con una o varias camaras */
.live-grid { display: grid; grid-template-columns: 1fr; gap: .75rem; }
.live-grid[data-n="2"] { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.live-tile-name { font-size: .8rem; font-weight: 600; margin: 0 0 .25rem; color: var(--muted); }

/* con dos camaras: la ventana se ensancha y las dos camaras y el mapa quedan en la misma fila */
.modal:has(.live-split.with-map.two) { width: min(1760px, 100%); }
.live-split.with-map.two { grid-template-columns: minmax(0, 1fr) 360px; }
.live-split.two .live-map-box { min-height: 260px; }
@media (max-width: 1100px) { .live-split.with-map.two { grid-template-columns: minmax(0, 1fr); } .live-split.two .live-map-box { min-height: 200px; } }          /* en pantallas angostas el mapa pasa debajo */
.live-tile:fullscreen { background: #000; display: flex; flex-direction: column; justify-content: center; padding: 0; }
.live-tile:fullscreen .live-tile-name, .live-tile:fullscreen .live-status { color: #fff; }
.live-tile:fullscreen .live-frame { width: min(100vw, calc(92vh * var(--arn, 1.7778))); border-radius: 0; }
.live-tile:fullscreen .live-bar { justify-content: center; padding: .5rem; }

/* boton de la papelera: en la ultima columna del encabezado de la lista (encima de Eliminar); sin lista, solo arriba */
.trash-bar { display: flex; justify-content: flex-end; margin: .5rem 0 .4rem; }
th.trash-th { padding-top: .35rem; padding-bottom: .35rem; }
th.trash-th .btn { text-transform: none; letter-spacing: normal; font-size: .85rem; font-weight: 500; color: var(--text); }
