:root {
  --bg: #f5f5f4; --surface: #ffffff; --ink: #141414; --muted: #5f5f5c; --line: #e2e0dc;
  --brand: #111111; --accent: #d63000; --accent-bg: #d63000; --accent-ink: #ffffff; --orange: #ff4000; --brand-rgb: 255, 64, 0; --danger: #b3261e; --warn: #b26a00; --ok: #17803d;
  --shadow: 0 6px 24px rgba(20, 20, 20, .14);
  --radius: 14px;
  color-scheme: light;
}
/* Modo oscuro: lo elige el botón sol/luna de la barra de arriba (theme.js pone html[data-theme]). Sin elección propia, oscuro solo en
   el celular que tiene el modo oscuro activado. */
:root[data-theme="dark"] {
  --bg: #101010; --surface: #1a1a1a; --ink: #f2f2f0; --muted: #a3a29e; --line: #2c2c2a;
  --brand: #111111; --accent: #ff5a26; --accent-bg: #ff5a26; --accent-ink: #160600; --orange: #ff4000; --danger: #ff6b5e; --warn: #f0b429; --ok: #4cc27a;
  --shadow: 0 6px 24px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
h2 { margin: 0 0 4px; font-size: 20px; }
.muted { color: var(--muted); margin: 4px 0 10px; }
.error { color: var(--danger); margin: 8px 0 0; }

.brand { display: flex; align-items: center; gap: 12px; }
.brand-lg { justify-content: center; }
.logo { display: block; flex: none; height: 32px; width: auto; max-width: 140px; object-fit: contain; }
.wordmark { font-family: var(--wordmark-font, "Michroma"), "Segoe UI", system-ui, sans-serif; font-size: 20px; letter-spacing: .12em; line-height: 1; display: grid; gap: 5px; }
.wordmark small { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.wordmark { -webkit-text-stroke: .04em currentColor; }
.wordmark small { -webkit-text-stroke: 0; }
.brand-lg { margin-bottom: 4px; }
.brand-lg .logo { height: 48px; max-width: 200px; }
.brand-lg .wordmark { font-size: 30px; color: var(--ink); }
.brand-lg .wordmark small { font-size: 11px; }

.btn { font: inherit; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; min-height: 44px; }
.btn:hover { border-color: var(--accent); }
.btn:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent-bg); color: var(--accent-ink); border-color: var(--accent-bg); font-weight: 600; }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); font-weight: 600; width: 100%; }
.btn.danger.restore { background: var(--ok); border-color: var(--ok); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; min-height: 36px; }
.btn:disabled { opacity: .6; cursor: default; }

.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(120% 90% at 100% 0%, rgba(var(--brand-rgb), .35), transparent 55%), #111111; }
/* Puerta de entrada BOGI SAT (sat.bogi.com.ar): ingreso siempre oscuro, con el logo grande (el logo ya trae el nombre). */
html[data-brand-id="sat"] .login { background: radial-gradient(110% 80% at 100% 0%, rgba(255, 64, 0, .22), transparent 55%), radial-gradient(90% 70% at 0% 100%, rgba(255, 196, 0, .10), transparent 60%), #000000; }
html[data-brand-id="sat"] .login-card { --surface: #0c0c0c; --ink: #f2f2f0; --muted: #a8a8a4; --line: #2b2b29; --bg: #151515; background: #0c0c0c; color: #f2f2f0; border: 1px solid #262624; }
html[data-brand-id="sat"] .login-card .brand-lg .logo { height: auto; width: min(320px, 74vw); max-width: none; }
html[data-brand-id="sat"] .login-card .btn.primary { background: #ff4000; border-color: #ff4000; color: #fff; }
html[data-brand-id="sat"] .login-card .btn.primary:hover { background: #ff5a26; }
html[data-brand-id="sat"] .brand:not(.brand-lg) .logo { height: 26px; width: auto; max-width: 150px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); padding: 28px 24px; border-radius: 18px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.login-card .muted { text-align: center; margin: -6px 0 4px; }
.login-card label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
input { font: inherit; padding: 11px 12px; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); width: 100%; }

#app { position: fixed; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
.topbar { z-index: 1000; display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.conn { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.conn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.conn.on::before { background: var(--ok); }

.alert { position: absolute; z-index: 1100; top: 62px; left: 50%; transform: translateX(-50%); width: min(94vw, 520px); display: flex; gap: 12px; justify-content: space-between; align-items: center; background: var(--danger); color: #fff; padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow); }
.alert .btn { color: #fff; border-color: rgba(255,255,255,.6); }

.workspace { display: grid; grid-template-columns: 380px minmax(0, 1fr); min-height: 0; }
.panel { grid-column: 1; grid-row: 1; background: var(--surface); border-right: 1px solid var(--line); overflow: auto; padding: 14px; min-height: 0; }
.mapwrap { grid-column: 2; grid-row: 1; position: relative; min-width: 0; min-height: 0; }
#map { position: absolute; inset: 0; z-index: 1; }
.leaflet-container { font: inherit; background: var(--bg); }
.panel-hidden .workspace { grid-template-columns: 0 minmax(0, 1fr); }
.panel-hidden .panel { display: none; }
.topbar-left { display: flex; align-items: center; gap: 12px; }

.mapctl { position: absolute; z-index: 500; top: 12px; right: 12px; display: grid; gap: 8px; justify-items: end; }
.mapbtn { font: inherit; font-size: 14px; font-weight: 600; padding: 8px 14px; min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: var(--shadow); }
.mapbtn:hover, .mapbtn[aria-pressed="true"] { border-color: var(--accent); }
.mapbtn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

@media (max-width: 760px) {
  .topbar { padding-left: 8px; padding-right: 8px; gap: 6px; flex-wrap: wrap; }
  .topbar-left, .topbar-right { gap: 4px; min-width: 0; }
  .topbar-right { flex: 1 1 100%; justify-content: space-between; flex-wrap: wrap; }
  .topbar-right .btn.small { flex: 1 1 auto; padding: 6px 4px; }
  .topbar .btn.small { font-size: 13px; }
  .brand .wordmark { font-size: 17px; }
  .brand .logo { height: 26px; max-width: 90px; }
  .brand-lg .logo { height: 48px; max-width: 200px; }
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 44%); }
  .mapwrap { grid-column: 1; grid-row: 1; }
  .panel { grid-column: 1; grid-row: 2; border-right: 0; border-top: 1px solid var(--line); padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
  .panel-hidden .workspace { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) 0; }
  .brand .wordmark small { display: none; }
  .conn { display: none; }
}

.summary { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.fchip { font: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px; min-height: 36px; border-radius: 99px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.fchip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.fchip:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
#search { margin-bottom: 10px; }

.cards { display: grid; gap: 8px; }
.card { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; text-align: left; width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; cursor: pointer; }
.card:hover, .card.sel { border-color: var(--accent); }
.card .name { font-weight: 700; }
.card .sub { color: var(--muted); font-size: 13px; grid-column: 1 / -1; }
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 99px; background: var(--line); color: var(--muted); }
.chip.online { background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ok); }
.chip.offline { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.chip.warn { background: color-mix(in srgb, var(--warn, #d97706) 22%, transparent); color: var(--warn, #b45309); }
.empty { color: var(--muted); padding: 8px 2px; }

.detail-head { display: flex; justify-content: space-between; align-items: start; gap: 8px; margin-bottom: 12px; position: sticky; top: 0; z-index: 5; background: var(--surface); padding: 2px 0 8px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--bg); border-radius: 12px; padding: 10px 12px; display: grid; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-weight: 700; font-size: 17px; }
.block { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.block-title { font-weight: 700; margin-bottom: 6px; }
details.block summary.block-title {
  cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; margin-bottom: 0;
}
details.block summary.block-title::-webkit-details-marker { display: none; }
details.block summary.block-title::after { content: "›"; font-size: 20px; line-height: 1; color: var(--muted); transform: rotate(90deg); transition: transform .15s; }
details.block[open] summary.block-title::after { transform: rotate(270deg); }
details.block[open] summary.block-title { margin-bottom: 8px; }
details.block > *:not(summary) { margin-top: 8px; }
.row2 { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; align-items: center; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.dates { display: grid; grid-template-columns: 1fr 1fr; }
.dates label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.presets { display: flex; gap: 8px; margin-bottom: 8px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; margin: 0 0 4px; }
.addr { font-weight: 600; margin: 0 0 2px; }
.share-active input[readonly] { font-size: 12px; margin-bottom: 8px; cursor: text; }
.geo-devices { display: grid; gap: 6px; max-height: 160px; overflow: auto; margin-bottom: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
.geo-devices .check { margin-top: 0; }
.geo-vertex span { display: block; width: 18px; height: 18px; box-sizing: border-box; border: 3px solid; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .45); cursor: grab; }
.geo-vertex.leaflet-drag-target span { cursor: grabbing; }
/* Botón de modo claro / oscuro (theme.js lo agrega al lado de «Salir»): luna en claro, sol en oscuro. */
.theme-btn { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z'/%3E%3C/svg%3E");
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 38px; padding: 0; }
html[data-theme="dark"] .theme-btn { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41'/%3E%3C/svg%3E"); }
.theme-btn::before { content: ""; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
body.map-app .topbar .btn.small.theme-btn::before { margin: 0; }
/* Pantalla de geocercas: más compacta (el formulario tiene muchos tildes y entraba en 3 pantallas). */
:is(#geoView, #routerView, #eventsView, #cfgView) { font-size: 13px; }
:is(#geoView, #routerView, #eventsView, #cfgView) h2 { font-size: 17px; }
:is(#geoView, #routerView, #eventsView, #cfgView) .block { margin-top: 8px; padding-top: 8px; }
:is(#geoView, #routerView, #eventsView, #cfgView) .block-title { font-size: 12.5px; margin-bottom: 3px; }
:is(#geoView, #routerView, #eventsView, #cfgView) .muted { font-size: 12px; margin: 3px 0 6px; line-height: 1.35; }
:is(#geoView, #routerView, #eventsView, #cfgView) label { margin-bottom: 4px; font-size: 12.5px; gap: 3px; }
:is(#geoView, #routerView, #eventsView, #cfgView) input:not([type="checkbox"]), :is(#geoView, #routerView, #eventsView, #cfgView) select { min-height: 30px; padding: 3px 9px; font-size: 13px; border-radius: 8px; }
:is(#geoView, #routerView, #eventsView, #cfgView) textarea { padding: 5px 9px; font-size: 13px; border-radius: 8px; }
:is(#geoView, #routerView, #eventsView, #cfgView) .check { min-height: 20px; margin-top: 0; gap: 7px; font-size: 12.5px; font-weight: 400; }
:is(#geoView, #routerView, #eventsView, #cfgView) .check input { width: 14px; height: 14px; flex: none; margin: 0; }
:is(#geoView, #routerView, #eventsView, #cfgView) .geo-devices { gap: 0; max-height: 96px; padding: 3px 8px; margin-bottom: 4px; border-radius: 8px; }
:is(#geoView, #routerView, #eventsView, #cfgView) .btn { min-height: 28px; padding: 2px 9px; font-size: 12px; border-radius: 8px; }
:is(#geoView, #routerView, #eventsView, #cfgView) .btn.primary { padding: 2px 12px; }
:is(#geoView, #routerView, #eventsView, #cfgView) .row2 { gap: 5px; margin: 5px 0; }
:is(#geoView, #routerView, #eventsView, #cfgView) .stat { padding: 6px 9px; border-radius: 10px; }
:is(#geoView, #routerView, #eventsView, #cfgView) .stat .v { font-size: 14px; }
:is(#geoView, #routerView, #eventsView, #cfgView) .stat .k { font-size: 11px; }
#geoAlertFields, #geoAlertEdit { display: grid; gap: 0; }
#geoAlertFields .muted, #geoAlertEdit .muted { margin: 5px 0 1px !important; }
.detail label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; margin-bottom: 10px; }
textarea { font: inherit; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); width: 100%; resize: vertical; }
.detail label.check { display: flex; font-weight: 400; margin-bottom: 0; }
.events li.warn { color: var(--warn); }
.events li.bad { color: var(--danger); }
.events li .row2 { grid-column: 1 / -1; margin: 4px 0 0; }
.events li .sub { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.events li .sub.warn { color: var(--warn); }
.events li .sub.bad { color: var(--danger); }
.events li .sub b { color: var(--ink); }
.events .t { display: inline-flex; gap: 4px; align-items: center; }
.rtpin { width: 28px; height: 28px; border-radius: 50%; background: var(--orange); color: #fff; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.45); display: grid; place-items: center; font: 700 13px/1 system-ui, sans-serif; }
.rtpin.start { background: #111; }
.rtpin.pend { background: #8a97a5; }
select { font: inherit; padding: 11px 12px; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); width: 100%; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 10px; min-height: 36px; cursor: pointer; }
.check input { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--accent); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tab { font: inherit; font-weight: 600; padding: 10px 14px; min-height: 44px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--orange); }
.tab:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
#routeStats { margin-top: 10px; }
.dlg { border: 0; border-radius: 18px; padding: 0; width: min(92vw, 400px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.dlg::backdrop { background: rgba(0, 0, 0, .55); }
.dlg-body { display: grid; gap: 12px; padding: 24px; }
.dlg-body label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.dlg-body .muted { margin: 0; }
#pwMsg { margin: 0; font-weight: 600; }
#pwMsg.err { color: var(--danger); }
#pwMsg.ok { color: var(--ok); }
.events { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.events li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 10px 12px; border-radius: 12px; background: var(--bg); }
.events .t { font-size: 12px; color: var(--muted); }
.events .sos { color: var(--danger); font-weight: 700; }
/* mantenimiento: una sola línea por ítem (nombre · cuánto falta · estado) para que ocupe poco lugar */
#dMaint { gap: 4px; }
#dMaint li { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; padding: 6px 10px; border-radius: 10px; font-size: 13.5px; line-height: 1.25; }
#dMaint li b { flex: 1 1 45%; min-width: 45%; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#dMaint li br { display: none; }
#dMaint li .sub { order: 1; font-size: 12px; text-align: right; }
#dMaint li .chip { order: 2; font-size: 11px; padding: 1px 8px; }
/* ubicación: dirección y botones más chicos */
#dAddress { font-size: 13px; font-weight: 600; line-height: 1.35; margin: 0 0 2px; }
#dCoords { font-size: 11.5px; margin: 0 0 4px; color: var(--muted); }
#copyBtn, #gmapsLink { min-height: 28px; padding: 3px 10px; font-size: 12.5px; border-radius: 8px; }
#copyBtn { margin: 0; }
#copyBtn ~ #gmapsLink { margin: 0; }
#dCoords + .row2 { gap: 6px; margin: 6px 0 2px; }

/* marcador de seguimiento: pin con silueta + patente; verde en movimiento, amarillo con contacto puesto (detenido), naranja detenido y apagado, gris sin señal, rojo SOS */
.pin { --pc: #d97706; position: relative; width: 84px; height: 62px; }
.pin.moving { --pc: #17803d; }
.pin.contact { --pc: #facc15; }
.pin.contact .pg svg { fill: #141414; }  /* el blanco no se lee sobre el amarillo */
.pin.offline { --pc: #6b7078; }
.pin.sos { --pc: #d92d20; }
/* círculo con la silueta del vehículo, borde blanco y un halo suave del color del estado */
.pin .ph { position: absolute; left: 23px; top: 0; width: 38px; height: 38px; border-radius: 50%; box-sizing: border-box;
  background: var(--pc); border: 3px solid #fff; display: grid; place-items: center; transition: transform .15s;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--pc) 28%, transparent), 0 4px 12px rgba(0,0,0,.35); }
.pin .pg { display: grid; place-items: center; }
.pin .pg svg { width: 20px; height: 20px; fill: #fff; }
.pin .pr { position: absolute; left: 19px; top: -4px; width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--pc); opacity: 0; pointer-events: none; }
.pin.sel .ph { transform: scale(1.22); box-shadow: 0 0 0 5px color-mix(in srgb, var(--pc) 35%, transparent), 0 0 0 10px color-mix(in srgb, var(--pc) 18%, transparent), 0 6px 16px rgba(0,0,0,.4); }
.pin.sel .pl { top: 48px; }
.pin.moving .pr, .pin.sos .pr { animation: pulse 2.2s infinite; }
.pin .px { position: absolute; top: -8px; right: 14px; background: #d92d20; color: #fff; font: 700 10px/1 system-ui, sans-serif; border-radius: 8px; padding: 2px 4px; border: 1.5px solid #fff; }
.pin .pl { position: absolute; left: 50%; top: 44px; transform: translateX(-50%); max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: #fff; color: #141414; font: 700 10px/1 system-ui, sans-serif; border-radius: 4px; padding: 2px 4px; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
@keyframes pulse { 0% { transform: scale(.8); opacity: .9; } 100% { transform: scale(1.25); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pin .pr { animation: none; } }

/* ojito para ver la contraseña */
.pw { position: relative; display: block; }
.pw > input { width: 100%; padding-right: 50px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; padding: 0; }
.pw-eye:hover, .pw-eye[aria-pressed="true"] { color: var(--ink); }
.pw-eye svg { width: 22px; height: 22px; }

/* ===== Mapa (opción B): mapa a pantalla completa con paneles flotantes. Todo va bajo body.map-app para no tocar las otras pantallas. ===== */
:root { --glass: rgba(255, 255, 255, .97); --glass-line: rgba(20, 24, 28, .08); --float-shadow: 0 10px 30px rgba(20, 24, 28, .18); }
:root[data-theme="dark"] { --glass: rgba(24, 28, 33, .97); --glass-line: rgba(255, 255, 255, .1); --float-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
body.map-app #app { grid-template-rows: minmax(0, 1fr); }
body.map-app .workspace { display: block; position: relative; min-height: 0; }
body.map-app .mapwrap { position: absolute; inset: 0; }

/* barra superior: pastilla flotante */
body.map-app .topbar { position: absolute; z-index: 1000; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px);
  gap: 14px; padding: 6px 8px; border: 1px solid var(--glass-line); border-radius: 22px; background: var(--glass); backdrop-filter: blur(14px); box-shadow: var(--float-shadow); }
body.map-app .topbar .brand .wordmark { font-size: 16px; }
body.map-app .topbar .btn.small { display: inline-flex; align-items: center; min-height: 40px; border: 0; border-radius: 14px; background: transparent; font-weight: 600; padding: 0 12px; }
body.map-app .topbar .btn.small:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
body.map-app .topbar .btn.small::before { content: ""; width: 18px; height: 18px; margin-right: 7px; background: currentColor; flex: none;
  -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
body.map-app #menuBtn { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12h.01M3 18h.01M3 6h.01M8 12h13M8 18h13M8 6h13'/%3E%3C/svg%3E"); }
body.map-app #routerBtn { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='6' cy='19' r='3'/%3E%3Cpath d='M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15'/%3E%3Ccircle cx='18' cy='5' r='3'/%3E%3C/svg%3E"); }
body.map-app #eventsBtn { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.268 21a2 2 0 0 0 3.464 0'/%3E%3Cpath d='M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326'/%3E%3C/svg%3E"); }
body.map-app #geoBtn { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E"); }
body.map-app #salesLink { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3v16a2 2 0 0 0 2 2h16'/%3E%3Cpath d='M18 17V9M13 17V5M8 17v-3'/%3E%3C/svg%3E"); }
body.map-app #accountBtn { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E"); }
body.map-app #logout { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpath d='m16 17 5-5-5-5'/%3E%3Cpath d='M21 12H9'/%3E%3C/svg%3E"); }

/* quién está conectado: pastilla flotante a la derecha de la barra superior (solo en pantalla grande; en el celular está en «Mi cuenta») */
body.map-app .whoami { position: absolute; z-index: 1000; top: max(14px, env(safe-area-inset-top)); right: 16px; display: flex; align-items: center; gap: 10px; max-width: 280px;
  min-height: 52px; padding: 6px 14px 6px 6px; border: 1px solid var(--glass-line); border-radius: 22px; background: var(--glass); backdrop-filter: blur(14px);
  box-shadow: var(--float-shadow); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
body.map-app .whoami:hover { background: color-mix(in srgb, var(--ink) 5%, var(--glass)); }
body.map-app .who-av { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-bg); color: var(--accent-ink);
  font-weight: 700; font-size: 15px; letter-spacing: .02em; }
body.map-app .who-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
body.map-app .who-txt strong { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.map-app .who-txt small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.map-app .whoami.compact { padding: 6px; gap: 0; }
body.map-app .whoami.compact .who-txt { display: none; }
@media (max-width: 760px) { body.map-app .whoami { display: none; } }

/* panel de la lista: flota a la izquierda */
body.map-app .panel { position: absolute; z-index: 600; left: 16px; top: 84px; bottom: 16px; width: 372px; padding: 16px; border: 1px solid var(--glass-line); border-radius: 22px;
  background: var(--glass); box-shadow: var(--float-shadow); }
body.map-app #search { border-radius: 14px; background: color-mix(in srgb, var(--ink) 4%, var(--surface)); }
body.map-app .cards { gap: 8px; padding: 2px 4px 8px; }  /* el relleno deja ver la sombra de las tarjetas */
/* cada vehículo como una tarjeta con sombra, separada de la siguiente */
body.map-app .card { border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 10px 12px; box-shadow: 0 2px 8px rgba(20, 20, 20, .10); }
body.map-app .card:hover { border-color: var(--line); background: color-mix(in srgb, var(--ink) 4%, var(--surface)); }
body.map-app .group-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; width: 100%; margin: 6px 0 2px; padding: 8px 12px 7px;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--glass); font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; text-align: left; color: var(--ink); cursor: pointer; }
body.map-app .group-head:first-child { margin-top: 0; }
body.map-app .group-head:hover { background: color-mix(in srgb, var(--ink) 5%, var(--glass)); }
body.map-app .group-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
body.map-app .group-head .gname { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.map-app .group-head small { flex: none; font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); white-space: nowrap; }
body.map-app .group-head .chev { flex: none; width: 7px; height: 7px; margin: 0 2px 2px 3px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
body.map-app .group-head.collapsed .chev { transform: rotate(-45deg); margin: 0 3px 0 1px; }
body.map-app .group-head .gsos { flex: none; padding: 1px 7px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; letter-spacing: 0; }
body.map-app .card.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
body.map-app .fchip { border-radius: 12px; }
body.map-app .stat { background: color-mix(in srgb, var(--ink) 5%, var(--surface)); border-radius: 14px; }

/* ficha del vehículo: en pantalla grande flota a la derecha y la lista sigue a la vista */
@media (min-width: 761px) {
  body.map-app #detail:not([hidden]) { position: fixed; z-index: 700; right: 16px; top: 84px; width: 372px; max-height: calc(100vh - 100px); overflow: auto; box-sizing: border-box;
    padding: 16px; border: 1px solid var(--glass-line); border-radius: 22px; background: var(--glass); box-shadow: var(--float-shadow); }
  body.map-app #detail .detail-head { background: var(--glass); }  /* con fondo: al bajar, las pestañas no se montan sobre el título */
  body.map-app.panel-hidden #detail:not([hidden]) { display: none; }
  /* con la ficha abierta, los botones del mapa y el zoom pasan a su izquierda en vez de quedar tapados */
  body.map-app .mapctl, body.map-app .leaflet-right { transition: right .15s; }
  body.map-app:has(#detail:not([hidden])):not(.panel-hidden) .mapctl { right: 404px; }
  body.map-app:has(#detail:not([hidden])):not(.panel-hidden) .leaflet-right { right: 394px; }
}

/* controles y avisos sobre el mapa */
body.map-app .mapctl { top: auto; bottom: 112px; right: 16px; }
body.map-app .alert { top: auto; bottom: 20px; border-radius: 18px; }

/* mapa más suave en claro; en el celular con modo oscuro, mapa oscuro (no sobre el satélite) */
body.map-app:not(.sat-on) .leaflet-tile-pane { filter: saturate(.82) contrast(.96) brightness(1.03); }
html[data-theme="dark"] body.map-app:not(.sat-on) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.9) saturate(.7); }
html[data-theme="dark"] body.map-app .leaflet-container { background: #14171a; }

@media (max-width: 760px) {
  body.map-app .topbar { left: 8px; right: 8px; top: max(8px, env(safe-area-inset-top)); transform: none; width: auto; max-width: none; gap: 6px; flex-wrap: nowrap; overflow-x: auto; border-radius: 20px; }
  body.map-app .topbar-left, body.map-app .topbar-right { flex-wrap: nowrap; flex: 0 0 auto; }
  body.map-app .topbar-right { margin-left: auto; }
  /* en el celular los botones de arriba son solo íconos (el texto sigue ahí para los lectores de pantalla) */
  body.map-app .topbar .btn.small { width: 44px; min-height: 44px; padding: 0; justify-content: center; font-size: 0; }
  body.map-app .topbar .btn.small::before { margin: 0; width: 22px; height: 22px; }
  body.map-app .topbar .wordmark { display: none; }
  body.map-app .topbar-left, body.map-app .topbar-right { gap: 2px; }
  body.map-app .leaflet-bottom { margin-bottom: calc(46vh + 8px); }
  body.map-app .panel { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; height: 46%; border-radius: 26px; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); }
  body.map-app .mapctl { top: 70px; bottom: auto; right: 12px; }
  body.map-app .alert { top: 70px; bottom: auto; }
}

/* ===== Aspecto nuevo de Gestión y del Panel (mismo lenguaje visual que el mapa). Todo va bajo body.ui-nuevo. ===== */
body.ui-nuevo, body.map-app { font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body.ui-nuevo { --card-shadow: 0 1px 2px rgba(20, 24, 28, .04), 0 10px 28px rgba(20, 24, 28, .06); }

/* barras de arriba */
body.ui-nuevo .gx-top, body.ui-nuevo .pn-top { position: sticky; top: 0; z-index: 50; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 6px 20px rgba(20, 24, 28, .05); }

/* botones, campos y etiquetas */
body.ui-nuevo .btn { border-radius: 12px; font-weight: 600; }
body.ui-nuevo .btn.primary { box-shadow: 0 4px 12px color-mix(in srgb, var(--accent-bg) 28%, transparent); }
body.ui-nuevo .btn.ghost { border-color: var(--line); }
body.ui-nuevo input, body.ui-nuevo select, body.ui-nuevo textarea { border-radius: 12px; }
body.ui-nuevo input:focus-visible, body.ui-nuevo select:focus-visible, body.ui-nuevo textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 0; border-color: var(--accent); }
body.ui-nuevo .chip { border-radius: 10px; padding: 3px 10px; }
body.ui-nuevo .dlg { border-radius: 22px; }
body.ui-nuevo .dlg::backdrop { background: rgba(10, 12, 14, .55); backdrop-filter: blur(3px); }

/* tarjetas, tablas y cuadros de números */
body.ui-nuevo .gx-card, body.ui-nuevo .pn-scard, body.ui-nuevo .pn-total, body.ui-nuevo .pn-self, body.ui-nuevo .pn-sched,
body.ui-nuevo .gx-scroll, body.ui-nuevo .pn-scroll { border-radius: 18px; box-shadow: var(--card-shadow); }
body.ui-nuevo .gx-table th, body.ui-nuevo .pn-table th { text-transform: uppercase; letter-spacing: .04em; font-size: 11px; }
body.ui-nuevo .gx-table tbody tr:hover, body.ui-nuevo .pn-table tbody tr:hover { background: color-mix(in srgb, var(--ink) 3.5%, transparent); }
body.ui-nuevo .pn-kpis .stat { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--card-shadow); }
body.ui-nuevo .pn-kpis .stat.big { background: var(--accent-bg); border-color: var(--accent-bg); }
body.ui-nuevo .pn-alerts button { border-radius: 12px; }

/* menú de Gestión: botones con ícono y el activo en oscuro */
body.ui-nuevo .gx-nav { border-radius: 20px; padding: 10px; box-shadow: var(--card-shadow); }
body.ui-nuevo .gx-nav .nav-group { padding-left: 12px; }
body.ui-nuevo .gx-nav .tab { display: flex; align-items: center; gap: 10px; min-height: 44px; border-radius: 12px; font-size: 14.5px; font-weight: 600; }
body.ui-nuevo .gx-nav .tab:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
body.ui-nuevo .gx-nav .tab[aria-selected="true"] { background: var(--ink); color: var(--surface); box-shadow: none; }
body.ui-nuevo .gx-nav .tab::before { content: ""; width: 18px; height: 18px; flex: none; background: currentColor; opacity: .85;
  -webkit-mask: var(--i, none) center / contain no-repeat; mask: var(--i, none) center / contain no-repeat; }
body.ui-nuevo .gx-nav .tab[data-view="companies"] { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='2' width='16' height='20' rx='2'/%3E%3Cpath d='M9 22v-4h6v4M8 6h.01M12 6h.01M16 6h.01M8 10h.01M12 10h.01M16 10h.01M8 14h.01M12 14h.01M16 14h.01'/%3E%3C/svg%3E"); }
body.ui-nuevo .gx-nav .tab[data-view="users"] { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M22 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E"); }
body.ui-nuevo .gx-nav .tab[data-view="devices"] { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='14' height='20' x='5' y='2' rx='2'/%3E%3Cpath d='M12 18h.01'/%3E%3C/svg%3E"); }
body.ui-nuevo .gx-nav .tab[data-view="vehicles"] { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2'/%3E%3Cpath d='M15 18H9'/%3E%3Cpath d='M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14'/%3E%3Ccircle cx='17' cy='18' r='2'/%3E%3Ccircle cx='7' cy='18' r='2'/%3E%3C/svg%3E"); }
body.ui-nuevo .gx-nav .tab[data-view="reports"] { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3v16a2 2 0 0 0 2 2h16'/%3E%3Cpath d='M18 17V9M13 17V5M8 17v-3'/%3E%3C/svg%3E"); }
body.ui-nuevo .gx-nav .tab[data-view="alerts"] { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E"); }
body.ui-nuevo .gx-nav .tab[data-view="audits"] { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E"); }
body.ui-nuevo .gx-nav .tab[data-view="billing"] { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z'/%3E%3Cpath d='M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8M12 17.5v-11'/%3E%3C/svg%3E"); }
body.ui-nuevo .gx-nav .tab[data-view="leads"] { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E"); }
body.ui-nuevo .gx-nav .tab[data-view="assistant"] { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7.9 20A9 9 0 1 0 4 16.1L2 22Z'/%3E%3C/svg%3E"); }
body.ui-nuevo .gx-nav .tab[data-view="usage"] { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 20h.01M7 20v-4M12 20v-8M17 20V8M22 4v16'/%3E%3C/svg%3E"); }
body.ui-nuevo .gx-nav .tab[data-view="tolls"] { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='6' cy='19' r='3'/%3E%3Cpath d='M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15'/%3E%3Ccircle cx='18' cy='5' r='3'/%3E%3C/svg%3E"); }
body.ui-nuevo .gx-nav .tab[data-view="contracts"] { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z'/%3E%3Cpath d='M14 2v4a2 2 0 0 0 2 2h4M10 9H8M16 13H8M16 17H8'/%3E%3C/svg%3E"); }
body.ui-nuevo .gx-nav .tab[data-view="account"] { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E"); }

/* pestañas del Panel: botones en una barra, la activa en oscuro */
body.ui-nuevo.pn .tabs { gap: 6px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--card-shadow); }
body.ui-nuevo.pn .tab { border: 0; border-radius: 12px; min-height: 42px; padding: 0 14px; font-weight: 600; color: var(--muted); }
body.ui-nuevo.pn .tab:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
body.ui-nuevo.pn .tab[aria-selected="true"] { background: var(--ink); color: var(--surface); }

/* ---------- globos de alerta sobre el vehículo ---------- */
.bb-anchor { background: none; border: 0; overflow: visible; }
.bb-stack { position: absolute; left: 0; bottom: 62px; transform: translateX(-50%); width: 300px; display: flex; flex-direction: column; align-items: stretch; gap: 6px; pointer-events: none; }
.bb-card { --bc: #2f6fed; position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 30px 9px 9px; border-radius: 16px; overflow: hidden; pointer-events: auto; cursor: pointer;
  background: var(--glass, rgba(255,255,255,.97)); color: var(--ink, #141414); border: 1px solid var(--glass-line, rgba(20,24,28,.08));
  box-shadow: 0 12px 30px rgba(20,24,28,.22), 0 2px 6px rgba(20,24,28,.10); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  font: 13px/1.25 system-ui, -apple-system, "Segoe UI", sans-serif; opacity: .86; transform-origin: 50% 100%; transition: opacity .2s; }
.bb-card.bb-last { opacity: 1; }
.bb-card.bb-alta { --bc: #d92d20; }
.bb-card.bb-media { --bc: #d97706; }
.bb-card.bb-baja { --bc: #2f6fed; }
.bb-card.bb-info { --bc: #0e9384; }
.bb-card.bb-baja.bb-ok { --bc: #17803d; }
.bb-ico { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: #fff; background: var(--bc);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--bc) 18%, transparent); }
.bb-ico svg { width: 18px; height: 18px; }
.bb-txt { display: flex; flex-direction: column; min-width: 0; }
.bb-txt b { font-weight: 650; font-size: 13px; letter-spacing: -.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-txt b em { font-style: normal; font-weight: 700; color: var(--bc); margin-left: 2px; }
.bb-txt small { color: var(--muted, #5f5f5c); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.bb-x { position: absolute; top: 5px; right: 6px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: var(--muted, #5f5f5c); font: 400 17px/1 system-ui, sans-serif; cursor: pointer; padding: 0; }
.bb-x:hover { background: color-mix(in srgb, var(--ink, #141414) 10%, transparent); color: var(--ink, #141414); }
.bb-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--bc); opacity: .55; transform-origin: 0 50%; animation: bb-life linear forwards; }
/* colita que apunta al vehículo */
.bb-tail { align-self: center; flex: none; width: 18px; height: 9px; margin-top: -7px; background: var(--glass, rgba(255,255,255,.97)); clip-path: polygon(0 0, 100% 0, 50% 100%); filter: drop-shadow(0 3px 3px rgba(20,24,28,.18)); pointer-events: none; }
.bb-more { align-self: center; padding: 2px 10px; border-radius: 999px; background: rgba(20,24,28,.72); color: #fff; font: 600 11px/1.5 system-ui, sans-serif; pointer-events: none; }
.bb-in { animation: bb-pop .42s cubic-bezier(.2,1.25,.4,1) both; }
.bb-out { animation: bb-away .2s ease-in forwards; }
.bb-sos { box-shadow: 0 0 0 2px #d92d20, 0 12px 30px rgba(217,45,32,.35); }
.bb-sos .bb-ico { animation: bb-beat 1.2s ease-in-out infinite; }
@keyframes bb-pop { from { opacity: 0; transform: translateY(14px) scale(.86); } to { opacity: 1; transform: none; } }
@keyframes bb-away { to { opacity: 0; transform: translateY(6px) scale(.94); } }
@keyframes bb-life { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes bb-beat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.14); } }
@media (max-width: 760px) { .bb-stack { width: 260px; } }
@media (prefers-reduced-motion: reduce) { .bb-in, .bb-out, .bb-sos .bb-ico { animation: none; } .bb-bar { animation: none; display: none; } }.bb-screen { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); z-index: 1200; width: 300px; max-width: calc(100vw - 24px); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.bb-stack.bb-fixed { position: static; transform: none; width: 100%; }
@media (max-width: 760px) { .bb-screen { top: 70px; } }
/* Gestión → Equipos: acciones con íconos en una sola línea y grupos por empresa */
.btn.icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; padding: 0; flex: none; }
.btn.icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.icon.del { color: var(--danger); }
.btn.icon.del:hover { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.row-actions { display: flex; flex-wrap: nowrap; gap: 4px; justify-content: flex-end; }
tr.dev-group td { background: color-mix(in srgb, var(--ink) 5%, transparent); cursor: pointer; padding: 10px 12px; user-select: none; }
tr.dev-group:hover td { background: color-mix(in srgb, var(--ink) 9%, transparent); }
tr.dev-group:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
tr.dev-group .chev { display: inline-block; width: 1em; color: var(--muted); }
/* Equipos: cada equipo como una tarjeta con sombra, separada de la siguiente. */
.dev-table { border-collapse: separate; border-spacing: 0 8px; }
.dev-table thead th { border-bottom: 0; }
.dev-table tr.dev-group td { border-bottom: 0; border-radius: 10px; }
.dev-table tr.dev-row { box-shadow: 0 0 0 1px var(--line), 0 2px 8px rgba(20, 20, 20, .10); border-radius: 12px; }
.dev-table tr.dev-row td { background: var(--surface); border-bottom: 0; }
.dev-table tr.dev-row td:first-child { border-radius: 12px 0 0 12px; }
.dev-table tr.dev-row td:last-child { border-radius: 0 12px 12px 0; }
body.ui-nuevo .dev-table tbody tr.dev-row:hover { background: transparent; }
body.ui-nuevo .dev-table tbody tr.dev-row:hover td { background: color-mix(in srgb, var(--ink) 3.5%, var(--surface)); }
/* Gestión → Empresas: dadas de baja */
.gx-card.gx-down { opacity: .82; }
.btn.del-text { color: var(--danger); }
.btn.del-text:hover { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
/* Gestión → Actividad de usuarios */
.ac-people { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.ac-person { display: grid; gap: 1px; text-align: left; font: inherit; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); cursor: pointer; min-width: 170px; }
.ac-person:hover { border-color: var(--accent); }
.ac-person.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.ac-person .sub { font-size: 12px; color: var(--muted); }
.ac-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 10px; }
.ac-filters label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; margin: 0; }
/* paradas y trayectos del recorrido */
.stat.wide { grid-column: 1 / -1; }
/* reanudar el corte por SMS (Gestión → Equipos) */
.sms-row { display: flex; gap: 8px; align-items: center; }
.sms-row code { flex: 1; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--ink) 7%, var(--surface)); font: 600 15px/1.3 ui-monospace, Consolas, monospace; word-break: break-all; }
.sms-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; line-height: 1.45; }
.dlg-body code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; padding: 1px 5px; border-radius: 5px; background: color-mix(in srgb, var(--ink) 7%, var(--surface)); }
.sms-row code { padding: 10px 12px; }
/* ventana de confirmación (corte de motor) */
.ask .dlg-body { gap: 10px; }
.ask h2 { margin: 0; font-size: 19px; }
.ask-vehicle { margin: 0; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--ink) 6%, var(--surface)); font-weight: 700; }
#askLines p { margin: 0 0 6px; line-height: 1.45; }
.ask-question { margin: 4px 0 2px; font-weight: 700; font-size: 16px; }
.ask .row2 { margin-top: 6px; }
/* usuario de seguimiento (Gestión → Usuarios) */
.us-seg { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--ink) 3%, var(--surface)); }
.us-seg .block-title { margin-top: 6px; }
.us-list { display: grid; gap: 4px; max-height: 190px; overflow: auto; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
#usFeatList { max-height: none; }
.us-seg label.check { display: flex; align-items: center; margin-top: 0; min-height: 30px; font-weight: 500; }
.stopmk-wrap { background: none; border: 0; overflow: visible; }
.stopmk { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; padding: 3px 9px; border-radius: 999px; background: #1f2937; color: #fff; font: 600 12px/1.3 system-ui, sans-serif; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); cursor: pointer; }
.routelegs li.leg { cursor: pointer; }
.routelegs li.leg:focus-visible { outline: 2px solid var(--brand, #2563eb); outline-offset: 1px; }
.routelegs li.leg b { display: inline-flex; align-items: center; gap: 8px; }
/* gráfico de velocidad del recorrido */
.speedchart { margin: 12px 0 4px; }
.speedchart .sc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; font-size: 12px; color: var(--muted); }
.speedchart .sc-head b { color: var(--ink); }
.speedchart svg { display: block; width: 100%; height: auto; touch-action: pan-y; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.sc-grid { stroke: var(--line); stroke-width: 1; }
.sc-axis { fill: var(--muted); font: 9px system-ui, sans-serif; }
.sc-area { fill: var(--accent); opacity: .14; }
.sc-line { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; }
.sc-peak { fill: var(--danger); stroke: var(--surface); stroke-width: 1.5; }
.sc-peakline { stroke: var(--danger); stroke-width: 1; stroke-dasharray: 2 3; opacity: .7; }
.sc-peaktext { fill: var(--danger); font: 700 10px system-ui, sans-serif; }
.sc-cursor { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; opacity: .6; }
.sc-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5; }
/* barra para elegir el rango */
.speedchart svg.sc-nav { margin-top: 6px; touch-action: none; cursor: crosshair; }
.sc-navbg { fill: color-mix(in srgb, var(--ink) 5%, var(--surface)); stroke: var(--line); stroke-width: 1; }
.sc-navline { fill: none; stroke: var(--muted); stroke-width: 1; opacity: .8; }
.sc-dim { fill: var(--surface); opacity: .6; }
.sc-win { fill: color-mix(in srgb, var(--accent) 10%, transparent); stroke: var(--accent); stroke-width: 1.2; }
.sc-handle { fill: var(--accent); stroke: var(--surface); stroke-width: 1; }
.sc-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.sc-bar .btn { min-width: 38px; padding: 4px 10px; }
.sc-bar .btn:disabled { opacity: .45; cursor: default; }
.sc-hint { flex: 1 1 140px; font-size: 11px; color: var(--muted); }
.leg-sw { width: 22px; height: 6px; border-radius: 3px; display: inline-block; }
.leg-sw.stop { width: 10px; height: 10px; border-radius: 50%; background: #1f2937; margin: 0 6px; }
/* rueda de configuración de avisos (mapa) */
body.map-app #cfgBtn { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E"); }
body.map-app #cfgBtn::before { margin-right: 0; }
/* panel de avisos: secciones que se pliegan, interruptores y pastillas */
#cfgView .cfg-sec { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); margin-bottom: 10px; overflow: hidden; }
#cfgView .cfg-sec > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; cursor: pointer; list-style: none; font-weight: 700; }
#cfgView .cfg-sec > summary::-webkit-details-marker { display: none; }
#cfgView .cfg-sec > summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .18s; margin: -4px 4px 0 2px; flex: none; }
#cfgView .cfg-sec[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
#cfgView .cfg-sec-title { flex: 1; }
#cfgView .cfg-badge { font-size: 12px; font-weight: 600; color: var(--muted); background: color-mix(in srgb, var(--ink) 7%, var(--surface)); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
#cfgView .cfg-sec-body { padding: 2px 16px 16px; display: grid; gap: 10px; }
#cfgView .cfg-lab { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
#cfgView .cfg-sec-body > .muted, #cfgView .cfg-sub .muted { margin: 0; font-size: 13px; }
/* interruptor */
#cfgView .sw { position: relative; width: 44px; height: 26px; flex: none; display: inline-block; margin: 0; }
#cfgView .sw input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
#cfgView .sw-track { position: absolute; inset: 0; border-radius: 999px; background: color-mix(in srgb, var(--ink) 20%, var(--surface)); transition: background .2s; }
#cfgView .sw-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: transform .2s; }
#cfgView .sw input:checked + .sw-track { background: var(--accent-bg, #ff4000); }
#cfgView .sw input:checked + .sw-track::after { transform: translateX(18px); }
#cfgView .sw input:focus-visible + .sw-track { outline: 2px solid var(--accent, #ff4000); outline-offset: 2px; }
/* pastilla que se marca */
#cfgView .pill { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; margin: 0; border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 600; line-height: 1.2; cursor: pointer; user-select: none; transition: background .15s, border-color .15s, color .15s; }
#cfgView .pill input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
#cfgView .pill:hover { border-color: color-mix(in srgb, var(--ink) 35%, var(--line)); }
#cfgView .pill:has(input:checked) { background: color-mix(in srgb, var(--accent-bg, #ff4000) 12%, var(--surface)); border-color: var(--accent-bg, #ff4000); color: var(--accent, #d63000); }
#cfgView .pill:has(input:checked)::before { content: "✓"; font-weight: 800; }
#cfgView .pill:has(input:disabled) { opacity: .6; cursor: default; }
#cfgView .pill:has(input:focus-visible) { outline: 2px solid var(--accent, #ff4000); outline-offset: 2px; }
#cfgView .pill-s { font-size: 11px; font-weight: 500; color: var(--muted); }
#cfgView .cfg-pills { display: flex; flex-wrap: wrap; gap: 8px; }
/* lista de alarmas */
#cfgView .cfg-list { display: grid; gap: 8px; }
#cfgView .cfg-alarm { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; background: var(--surface); transition: background .15s, border-color .15s; cursor: pointer; }
#cfgView .cfg-alarm:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
#cfgView .cfg-alarm.cfg-off { background: color-mix(in srgb, var(--ink) 3%, var(--surface)); }
#cfgView .cfg-alarm.cfg-off .cfg-name { color: var(--muted); }
#cfgView .cfg-head { display: flex; align-items: center; gap: 12px; }
#cfgView .cfg-info { flex: 1; min-width: 0; }
#cfgView .cfg-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
#cfgView .cfg-sum { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
#cfgView .cfg-more { flex: none; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; position: relative; }
#cfgView .cfg-more::after { content: ""; position: absolute; left: 9px; top: 8px; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .18s; }
#cfgView .cfg-alarm.cfg-open .cfg-more::after { transform: rotate(-135deg); top: 12px; }
#cfgView .cfg-detail { display: grid; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); cursor: default; }
/* velocidad */
#cfgView .cfg-switchrow { display: flex; align-items: center; gap: 12px; font-weight: 600; }
#cfgView .cfg-speedbox, #cfgView .cfg-speedrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; margin: 0; }
#cfgView .cfg-speedrow { font-weight: 400; padding: 4px 0; }
#cfgView .cfg-km { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-weight: 600; }
#cfgView .cfg-num { width: 84px; padding: 8px 10px; border-radius: 10px; text-align: right; }
#cfgView .cfg-sub { border-top: 1px dashed var(--line); padding-top: 8px; }
#cfgView .cfg-sub summary { cursor: pointer; font-weight: 600; font-size: 14px; }
#cfgView .cfg-own { display: grid; gap: 2px; margin-top: 6px; max-height: 240px; overflow: auto; }
#cfgView .cfg-ta { width: 100%; border-radius: 12px; }
#cfgView .cfg-state { margin: 4px 2px 10px; font-size: 13px; }
#cfgView .cfg-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#cfgView .cfg-msg { margin: 10px 2px; font-size: 14px; }#cfgView .cfg-others { margin-top: 2px; }
#cfgView .cfg-others > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 4px; }
#cfgView .cfg-others > .cfg-list { margin-top: 8px; }
#cfgView .cfg-alarm { padding: 9px 12px; }
#cfgView .cfg-sum { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Alarmas del panel de avisos: una línea cada una (opción A) */
#cfgView .cfg-list { gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
#cfgView .cfg-alarm { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 0 10px; background: transparent; min-height: 38px; }
#cfgView .cfg-alarm:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
#cfgView .cfg-alarm.cfg-off { background: transparent; }
#cfgView .cfg-head { gap: 9px; min-height: 38px; }
#cfgView .cfg-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.2; }
#cfgView .cfg-alarm.cfg-off .cfg-name { font-weight: 400; }
#cfgView .cfg-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
#cfgView .cfg-dot.alta { background: var(--danger, #e24b4a); }
#cfgView .cfg-dot.media { background: var(--warn, #d97706); }
#cfgView .cfg-list .sw { width: 34px; height: 20px; }
#cfgView .cfg-list .sw-track::after { top: 2px; left: 2px; width: 16px; height: 16px; }
#cfgView .cfg-list .sw input:checked + .sw-track::after { transform: translateX(14px); }
#cfgView .cfg-more { width: 24px; height: 24px; }
#cfgView .cfg-more::after { left: 8px; top: 6px; }
#cfgView .cfg-alarm.cfg-open .cfg-more::after { top: 10px; }
#cfgView .cfg-detail { margin-top: 0; padding: 8px 0 12px; }
#cfgView .cfg-detail .cfg-sum { margin: 0; white-space: normal; }
#cfgView .cfg-others { margin: 0; }
#cfgView .cfg-others > summary { padding: 9px 10px; border-bottom: 1px solid var(--line); }
#cfgView .cfg-others > .cfg-list { margin-top: 0; border: 0; border-radius: 0; border-top: 1px solid var(--line); }
#cfgView .cfg-list > .cfg-alarm:last-child, #cfgView .cfg-others:last-child > summary { border-bottom: 0; }
#cfgView .cfg-others[open] > summary { border-bottom: 0; }
#cfgView .pill { max-width: 100%; }
#cfgView .pill-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#cfgView .cfg-others > summary { cursor: pointer; font-size: 13px; color: var(--muted); }
#cfgView .cfg-others > summary::after { content: ""; width: 7px; height: 7px; margin: 0 8px 3px auto; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .18s; flex: none; }
#cfgView .cfg-others[open] > summary::after { transform: rotate(-135deg); margin-bottom: -2px; }
#cfgView .cfg-links { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
#cfgView .pill-link { flex: 1; text-align: center; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px; text-decoration: none; }
#cfgView .pill-link:hover { border-color: var(--accent); color: var(--accent); }

/* ruteador: con subir/bajar hay cinco botones por cliente; el nombre ocupa su propia línea y los botones van debajo */
/* cada cliente y cada ruta guardada como una tarjeta, igual que las geocercas */
:is(#rtStops, #rtSaved) { gap: 8px; padding: 2px 4px 8px; }
:is(#rtStops, #rtSaved) li { padding: 8px 11px; gap: 5px 6px; border-radius: 14px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--ink) 20%, var(--surface)); box-shadow: 0 2px 8px rgba(20, 20, 20, .12); }
:is(#rtStops, #rtSaved) li:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--surface)); }
:is(#rtStops, #rtSaved) li > span:first-child { grid-column: 1 / -1; font-size: 13.5px; font-weight: 600; line-height: 1.25; }
:is(#rtStops, #rtSaved) li .t { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 5px; }
:is(#rtStops, #rtSaved) li .t .btn { min-height: 26px; padding: 2px 9px; font-size: 12px; border-radius: 8px; }
#rtStops li .t .btn:disabled { opacity: .35; }
:is(#rtStops, #rtSaved) li .sub { font-size: 11.5px; line-height: 1.3; }

/* ingreso: un nombre de empresa largo no debe agrandar la tarjeta ni correr los campos; el logo y el nombre quedan centrados */
.login-card { grid-template-columns: minmax(0, 1fr); }
.login-card .brand-lg { flex-wrap: wrap; text-align: center; row-gap: 8px; }
.login-card .brand-lg .wordmark { min-width: 0; max-width: 100%; justify-items: center; font-size: 24px; overflow-wrap: anywhere; }

/* ruteador: lista de geocercas para armar la ruta */
#gpList label.check { display: flex; align-items: center; gap: 10px; font-weight: 600; }
#gpList label.check input { flex: none; margin: 0; }

/* geocercas: lista compacta; el nombre y el resumen ocupan toda la línea y los botones van debajo, más chicos */
#geoList { gap: 8px; padding: 2px 4px 8px; }  /* el relleno deja ver la sombra de cada tarjeta */
/* cada geocerca como una tarjeta con borde y sombra, igual que los vehículos de la lista */
#geoList li { padding: 8px 11px; gap: 5px 6px; border-radius: 14px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--ink) 20%, var(--surface)); box-shadow: 0 2px 8px rgba(20, 20, 20, .12); }
#geoList li:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--surface)); }
#geoList li > span:first-child { grid-column: 1 / -1; font-size: 13.5px; font-weight: 600; line-height: 1.25; }
#geoList li > span:first-child .t { display: block; margin-top: 1px; font-size: 11.5px; font-weight: 400; line-height: 1.3; }
#geoList li > .t { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 5px; }
#geoList li > .t .btn { min-height: 26px; padding: 2px 9px; font-size: 12px; border-radius: 8px; }

/* eventos de la flota: cada evento como tarjeta, igual que geocercas y ruteador */
#evList { gap: 8px; padding: 2px 4px 8px; }
#evList li { align-items: center; padding: 7px 11px; gap: 2px 8px; font-size: 13px; line-height: 1.25; border-radius: 14px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--ink) 20%, var(--surface)); box-shadow: 0 2px 8px rgba(20, 20, 20, .12); }
#evList li:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--surface)); }
#evList li { grid-template-columns: auto 1fr; }
#evList li .t { grid-column: 1 / -1; font-size: 11.5px; }
#evList li .chip { min-height: 0; padding: 2px 8px; font-size: 11px; }

/* configuración de avisos: mismas medidas que geocercas y ruteador (secciones como tarjetas, pastillas y letras más chicas) */
#cfgView .cfg-sec { border-radius: 14px; margin-bottom: 8px; border-color: color-mix(in srgb, var(--ink) 20%, var(--surface)); box-shadow: 0 2px 8px rgba(20, 20, 20, .12); }
#cfgView .cfg-sec > summary { padding: 9px 12px; font-size: 13.5px; gap: 8px; }
#cfgView .cfg-sec > summary::after { width: 7px; height: 7px; }
#cfgView .cfg-badge { font-size: 11px; padding: 2px 8px; }
#cfgView .cfg-sec-body { padding: 0 12px 10px; gap: 7px; }
#cfgView .cfg-lab { font-size: 11px; margin-top: 2px; }
#cfgView .cfg-sec-body > .muted, #cfgView .cfg-sub .muted { font-size: 12px; margin: 0; }
#cfgView .sw { width: 34px; height: 20px; }
#cfgView .sw-track::after { top: 2px; left: 2px; width: 16px; height: 16px; }
#cfgView .sw input:checked + .sw-track::after { transform: translateX(14px); }
#cfgView .pill { padding: 4px 10px; font-size: 12px; gap: 5px; }
#cfgView .pill-s { font-size: 10.5px; }
#cfgView .cfg-pills { gap: 6px; }
#cfgView .cfg-switchrow { gap: 9px; font-size: 13px; line-height: 1.25; }
#cfgView .cfg-speedbox, #cfgView .cfg-speedrow { font-size: 13px; gap: 8px; }
#cfgView .cfg-km { font-size: 12.5px; gap: 5px; }
#cfgView .cfg-num { width: 72px; padding: 3px 8px; }
#cfgView .cfg-time { width: auto; min-width: 0; padding: 3px 6px; border-radius: 10px; font-size: 13px; }
#cfgView .cfg-sub summary { font-size: 12.5px; }
#cfgView .cfg-alarm { min-height: 34px; }
#cfgView .cfg-head { min-height: 34px; gap: 8px; }
#cfgView .cfg-name { font-size: 13px; }
#cfgView .cfg-sum { font-size: 11.5px; }
#cfgView .cfg-others > summary { padding: 7px 10px; font-size: 12.5px; }
#cfgView .cfg-list { border-radius: 10px; }
#cfgView .cfg-links { gap: 6px; margin-bottom: 8px; }
#cfgView .pill-link { padding: 6px 10px; font-size: 13px; border-radius: 10px; }
#cfgView .cfg-state { font-size: 12px; margin: 2px 2px 8px; }
#cfgView .cfg-actions { gap: 6px; }
#cfgView .cfg-msg { font-size: 13px; margin: 8px 2px; }
