/* Frost — plataforma de rastreo de activos (BCM)
   Dos temas: Día (claro, por defecto) y Noche (oscuro), con vidrio esmerilado sutil.
   Tipografías: Fredoka (marca y títulos), Inter (UI), JetBrains Mono (datos) */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  /* ☀️ Día: celeste y blanco, como Frost (#63CDFD fondo, #45BEF6 detalles). Texto oscuro para leer a pleno sol */
  color-scheme: light;
  --bg: #edf8fe;
  --panel: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3fafe;
  --glass: rgba(255, 255, 255, .88);
  --border: rgba(8, 110, 160, .12);
  --border-hi: rgba(8, 110, 160, .26);
  --text: #13303f;
  --muted: #5d7686;
  --accent: #0678b0;
  --accent-2: #45bef6;
  --sky: #63cdfd;
  --grad: linear-gradient(100deg, #63cdfd, #3dbaf5);
  --on-grad: #053049;
  --ok: #12a066;
  --warn: #d48806;
  --bad: #dc3d48;
  --field: rgba(8, 110, 160, .05);
  --topbar: rgba(255, 255, 255, .9);
  --overlay: rgba(255, 255, 255, .94);
  --chip: rgba(69, 190, 246, .13);
  --chip-border: rgba(69, 190, 246, .45);
  --track: rgba(8, 110, 160, .09);
  --off: #a3b1bf;
  --map-bg: #e3f3fb;
  --tab-on: #ffffff;
  --tab-shadow: 0 2px 8px rgba(8, 110, 160, .14);
  --cluster: radial-gradient(circle at 32% 28%, #7fd8ff, #2fb0f0);
  --font-ui: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-brand: 'Fredoka', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --radius: 14px;
  --radius-s: 10px;
  --shadow: 0 10px 30px rgba(8, 110, 160, .13);
  --ease: .18s cubic-bezier(.4, 0, .2, 1);
}
/* 🌙 Noche: grafito (no azul marino) con detalles celestes, para sala de control y turno de noche */
:root[data-theme="noche"] {
  color-scheme: dark;
  --bg: #0b1116;
  --panel: #0b1116;
  --surface: #121a21;
  --surface-2: #18222b;
  --glass: rgba(18, 26, 33, .78);
  --border: rgba(170, 225, 250, .09);
  --border-hi: rgba(170, 225, 250, .18);
  --text: #eef7fc;
  --muted: #94a6b3;
  --accent: #63cdfd;
  --accent-2: #a8e6ff;
  --sky: #63cdfd;
  --grad: linear-gradient(100deg, #63cdfd, #45bef6);
  --on-grad: #053049;
  --ok: #3dd68c;
  --warn: #ffb224;
  --bad: #ff6369;
  --field: rgba(255, 255, 255, .05);
  --topbar: rgba(11, 17, 22, .88);
  --overlay: rgba(14, 20, 26, .86);
  --chip: rgba(99, 205, 253, .12);
  --chip-border: rgba(99, 205, 253, .32);
  --track: rgba(255, 255, 255, .07);
  --off: #4d555e;
  --map-bg: #0b0f12;
  --tab-on: #18222b;
  --tab-shadow: 0 1px 6px rgba(0, 0, 0, .35);
  --cluster: radial-gradient(circle at 32% 28%, #9be2ff, #45bef6);
  --shadow: 0 8px 32px rgba(0, 0, 0, .45);
}
html, body { height: 100%; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { cursor: pointer; font: inherit; transition: all var(--ease); }
h2 { font-family: var(--font-brand); font-weight: 600; letter-spacing: -.01em; }

/* ===== Barra de scroll de marca: delgada, gradiente sutil ===== */
* { scrollbar-width: thin; scrollbar-color: rgba(92, 200, 255, .38) transparent; }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(92, 200, 255, .45), rgba(165, 236, 255, .45));
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(92, 200, 255, .75), rgba(165, 236, 255, .75));
}
::-webkit-scrollbar-corner { background: transparent; }

/* ===== Selects: mismos en toda la app, con chevron propio y menú oscuro ===== */
select {
  appearance: none; -webkit-appearance: none;
  background-color: var(--field);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239da2ae' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
  border: 1px solid var(--border); border-radius: var(--radius-s);
  color: var(--text); font-family: var(--font-ui); font-size: 13px; font-weight: 500;
  padding: 8px 30px 8px 11px; transition: border-color var(--ease);
}
select:hover { border-color: var(--border-hi); }
select:focus { outline: none; border-color: var(--accent); }
select option, select optgroup {
  background: var(--surface-2); color: var(--text); font-weight: 400; padding: 8px;
}

/* Vidrio esmerilado reutilizable */
.glass {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--border);
}

/* Botón primario con gradiente de marca */
button.primary {
  background: var(--grad);
  color: var(--on-grad); border: none; border-radius: var(--radius-s);
  font-weight: 600; padding: 9px 18px;
}
button.primary:hover { filter: brightness(1.12); box-shadow: 0 4px 18px rgba(92, 200, 255, .35); }

/* ===== Login · Frost cuida el patio ===== */
.login-wrap {
  --sky: #63cdfd; --gap: #45bef6; --ink: #0b5d88; --ink-soft: #2c93c6; --blue: #0678b0; --mute: #7fbfdf;
  position: relative; min-height: 100vh; min-height: 100dvh; overflow: hidden;
  background: linear-gradient(#63cdfd, #d3f1fe 72%, #fff 72%); /* si no hay WebGL */
  font-family: 'Fredoka', var(--font-ui);
}
/* Sin parpadeo al recargar: la escena aparece cuando la letra y Frost están listos (login.js pone .ready) */
.login-scene, .login-credit { opacity: 0; animation: fz-show .01s 3s forwards; }
.login-wrap.ready .login-scene, .login-wrap.ready .login-credit { opacity: 1; animation: none; transition: opacity .5s ease; }
@keyframes fz-show { to { opacity: 1; } }
#frost-sky { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .6s ease; }
#frost-sky.on { opacity: 1; }

/* Capas con profundidad (las mueve login.js) */
.layer { will-change: transform; }
.mountains, .hills { position: absolute; left: -3%; width: 106%; bottom: 0; }
.mountains { height: 50vh; bottom: 15vh; z-index: 1; fill: #a6dbf3; }
.mountains .caps { fill: #e9f8fe; }
.hills { height: 34vh; z-index: 1; }
.hill-back { fill: #e2f5fd; }
.hill-front { fill: #fff; z-index: 2; }
.login-scene {
  position: relative; z-index: 3; min-height: 100vh; min-height: 100dvh;
  max-width: 1280px; margin: 0 auto; padding: 0 40px;
  display: grid; grid-template-columns: 1.3fr 1fr; align-items: center; column-gap: 32px;
}

/* Frost y su patio */
.guard { position: relative; align-self: end; justify-self: center; width: min(100%, 680px); margin-bottom: 3vh; }
#frosty { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 10px 16px rgba(20, 90, 135, .16)); }
#frost-3d { display: none; width: 100%; aspect-ratio: 460 / 350; }
.guard.has-3d #frost-3d { display: block; }
.guard.has-3d #frosty { display: none; }
.guard:not(.has-3d):not(.no-3d) #frosty { visibility: hidden; }
#frosty[data-state="hide"] #frosty-eyes circle { transform: scaleY(.15); transform-box: fill-box; transform-origin: center; }
.fz-snow { fill: #fff; stroke: var(--gap); stroke-width: 5; paint-order: stroke; stroke-linejoin: round; }
circle.fz-snow { fill: url(#fz-vol); }
.fz-band { fill: var(--gap); }
.fz-ink circle { fill: var(--ink-soft); }
.fz-nose { fill: #fff; stroke: var(--ink-soft); stroke-width: 3.5; stroke-linejoin: round; }
.fz-mouth { fill: none; stroke: var(--ink-soft); stroke-width: 4.5; stroke-linecap: round; }
.fz-arm path { fill: none; stroke: #fff; stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; }
.fz-stick { stroke: #fff; stroke-width: 5; stroke-linecap: round; }
.fz-waves path { fill: none; stroke: #fff; stroke-width: 4.5; stroke-linecap: round; opacity: 0; animation: fz-wave 2.6s ease-out infinite; }
.fz-waves .w2 { animation-delay: .35s; }
.asset-box { fill: #f1faff; stroke: #a9dcf2; stroke-width: 3; }
.asset-lines { stroke: #c9ebf8; stroke-width: 3; stroke-linecap: round; }
.pin-body { fill: var(--blue); }
.pin-dot { fill: #fff; }
.pin-ring { fill: none; stroke: var(--blue); stroke-width: 2.5; transform-box: fill-box; transform-origin: center; animation: fz-ring 2.6s ease-out infinite; }
.pin-ring.r2 { animation-delay: 1.1s; }

.fz { animation: fz-bob 4.2s ease-in-out infinite; }
.fz-arm-l { transform-box: fill-box; transform-origin: 100% 100%; transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.fz-arm-r { transform-box: fill-box; transform-origin: 0% 100%; transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.fz-head { transform-box: fill-box; transform-origin: 50% 100%; transition: transform .35s ease; }
.fz-hat { transition: transform .4s cubic-bezier(.34, 1.56, .64, 1); }
#frosty-eyes { transition: transform .12s linear; }
#frosty[data-state="peek"] .fz-head { transform: rotate(5deg); }
#frosty[data-state="hide"] .fz-hat { transform: translateY(38px); }
#frosty[data-state="hide"] .fz-arm-l { transform: rotate(14deg); }
#frosty[data-state="hide"] .fz-arm-r { transform: rotate(-14deg); }
#frosty[data-state="spy"] .fz-hat { transform: translateY(22px); }
#frosty[data-state="busy"] .fz-head { animation: fz-think 1s ease-in-out infinite; }
#frosty[data-state="busy"] .fz-waves path { animation-duration: .9s; }
#frosty[data-state="no"] .fz-head { animation: fz-no .6s ease-in-out; }
#frosty[data-state="yes"] .fz { animation: fz-jump .75s cubic-bezier(.34, 1.56, .64, 1); }
#frosty[data-state="yes"] .fz-arm-r { animation: fz-hi .75s ease-in-out; }
#frosty[data-state="yes"] .fz-waves path { animation-duration: .8s; }

@keyframes fz-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes fz-wave { 0% { opacity: 0; } 20% { opacity: .95; } 70%, 100% { opacity: 0; } }
@keyframes fz-ring { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(2.4); opacity: 0; } }
@keyframes fz-no { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-8deg); } 45% { transform: rotate(7deg); } 70% { transform: rotate(-5deg); } }
@keyframes fz-think { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes fz-jump { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-22px); } }
@keyframes fz-hi { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-22deg); } 50% { transform: rotate(8deg); } 75% { transform: rotate(-22deg); } }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Globo de diálogo: nombre, texto que se escribe solo, cola curva */
.frosty-says {
  position: absolute; left: 6%; top: 8%; z-index: 2; width: max-content; max-width: 250px;
  display: flex; flex-direction: column; gap: 2px;
  background: linear-gradient(180deg, #fff, #f5fbff); color: var(--ink);
  border-radius: 22px; padding: 11px 18px 13px;
  box-shadow: inset 0 1px 0 #fff, 0 2px 6px rgba(8, 110, 160, .08), 0 18px 40px rgba(8, 110, 160, .2);
  transform-origin: 100% 80%;
}
.says-name { font: 700 11px 'Fredoka', var(--font-ui); letter-spacing: .16em; text-transform: uppercase; color: var(--blue); }
.says-text { font: 600 16.5px/1.3 'Fredoka', var(--font-ui); min-height: 1.3em; }
.says-text.typing::after { content: ''; display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--blue); animation: fz-caret .8s steps(1) infinite; }
@keyframes fz-caret { 50% { opacity: 0; } }
.says-tail { position: absolute; right: -16px; bottom: 10px; width: 22px; height: 26px; fill: #f7fcff; filter: drop-shadow(3px 4px 4px rgba(8, 110, 160, .08)); }
.frosty-says.pop { animation: fz-pop .35s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes fz-pop { from { transform: scale(.88); opacity: .3; } to { transform: scale(1); opacity: 1; } }
/* Con Frost en 3D el globo sigue su cabeza (--hx, --hy los pone frost3d.js) */
.guard.has-3d .frosty-says { left: auto; right: calc(100% - var(--hx, 60%) + 70px); top: calc(var(--hy, 30%) - 70px); }

/* Título */
.login-side { justify-self: start; width: min(100%, 420px); margin-bottom: 6vh; }
.kicker {
  color: rgba(255, 255, 255, .92); font-size: 13px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase;
  margin-bottom: 4px; text-shadow: 0 1px 8px rgba(16, 90, 140, .35);
}
.frost-word { line-height: 0; }
.frost-word svg { display: block; width: clamp(250px, 30vw, 380px); height: auto; overflow: visible; filter: drop-shadow(0 6px 18px rgba(16, 90, 140, .28)); }
.frost-word text {
  font: 700 118px 'Fredoka', var(--font-ui); letter-spacing: 7px;
  fill: #fff; stroke: #fff; stroke-width: 7; stroke-linejoin: round; paint-order: stroke;
}
.login-hello { color: #fff; font-size: 22px; font-weight: 600; margin: 10px 0 30px; text-shadow: 0 2px 12px rgba(16, 90, 140, .35); }

/* Tarjeta de hielo esmerilado, con nieve encima */
.login-panel {
  position: relative; display: flex; flex-direction: column; gap: 14px;
  padding: 30px 26px 24px; border-radius: 28px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .42), rgba(255, 255, 255, .16));
  border: 1.5px solid rgba(255, 255, 255, .7);
  box-shadow: 0 30px 60px rgba(16, 90, 140, .22), inset 0 1px 0 rgba(255, 255, 255, .8);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
}
.card-snow { position: absolute; left: -1px; top: -21px; width: calc(100% + 2px); height: 46px; pointer-events: none; filter: drop-shadow(0 3px 3px rgba(8, 110, 160, .12)); }
.login-panel.shake { animation: fz-card-no .45s ease-in-out; }
@keyframes fz-card-no { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 50% { transform: translateX(7px); } 75% { transform: translateX(-4px); } }

/* Campos: ícono, etiqueta que sube al escribir, ojo para la clave */
.ff { position: relative; }
.ff input {
  width: 100%; height: 60px; padding: 22px 54px 6px 50px;
  font: 500 17px 'Fredoka', var(--font-ui); color: var(--ink); background: #fff;
  border: 2px solid #fff; border-radius: 18px;
  box-shadow: 0 6px 18px rgba(16, 90, 140, .1);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.ff input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 5px rgba(69, 190, 246, .16), 0 8px 22px rgba(16, 90, 140, .14); }
.ff input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px #fff inset; -webkit-text-fill-color: var(--ink); }
.ff label {
  position: absolute; left: 50px; top: 50%; transform: translateY(-50%);
  font: 500 16px 'Fredoka', var(--font-ui); color: var(--mute); pointer-events: none;
  transition: top .18s ease, font-size .18s ease, color .18s ease;
}
.ff input:focus + label, .ff input:not(:placeholder-shown) + label, .ff input:-webkit-autofill + label {
  top: 17px; font-size: 12px; font-weight: 600; letter-spacing: .03em; color: var(--blue);
}
.ff input:not(:focus):not(:placeholder-shown) + label { color: var(--mute); }
.ff-ico { position: absolute; left: 17px; top: 50%; width: 21px; height: 21px; transform: translateY(-50%); fill: none; stroke: var(--mute); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; transition: stroke var(--ease); }
.ff:focus-within .ff-ico { stroke: var(--blue); }
.ff-eye {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; display: grid; place-items: center;
  border: none; border-radius: 12px; background: transparent; color: var(--mute);
}
.ff-eye svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ff-eye .eye-slash { opacity: 0; transition: opacity var(--ease); }
.ff-eye[aria-pressed="true"] .eye-slash { opacity: 1; }
.ff-eye:hover { background: #eef7fc; color: var(--blue); }
.ff-eye:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.ff.bad input { border-color: #e05561; box-shadow: 0 0 0 5px rgba(224, 85, 97, .14); }

/* Botón */
.frost-btn {
  position: relative; overflow: hidden; margin-top: 4px; height: 58px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font: 600 18px 'Fredoka', var(--font-ui); color: #053049;
  background: linear-gradient(180deg, #74d6fe, #3dbaf5); border: none; border-radius: 18px;
  box-shadow: 0 12px 26px rgba(30, 150, 210, .35), inset 0 1px 0 rgba(255, 255, 255, .45);
}
.frost-btn::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .22) 50%, transparent 70%);
  transition: transform .7s ease;
}
.frost-btn:hover { transform: translateY(-2px); box-shadow: 0 16px 30px rgba(8, 110, 160, .4), inset 0 1px 0 rgba(255, 255, 255, .18); }
.frost-btn:hover::after { transform: translateX(120%); }
.frost-btn:active { transform: translateY(0); }
.frost-btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.btn-arrow { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--ease); }
.frost-btn:hover .btn-arrow { transform: translateX(3px); }
.btn-dots { display: none; gap: 6px; }
.btn-dots i { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: fz-dot 1s ease-in-out infinite; }
.btn-dots i:nth-child(2) { animation-delay: .15s; }
.btn-dots i:nth-child(3) { animation-delay: .3s; }
.frost-btn.busy { pointer-events: none; }
.frost-btn.busy .btn-txt, .frost-btn.busy .btn-arrow { display: none; }
.frost-btn.busy .btn-dots { display: flex; }
@keyframes fz-dot { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-5px); opacity: 1; } }
.login-error { align-self: center; color: #c2414b; font-size: 14.5px; font-weight: 600; text-align: center; }
.login-error:empty { display: none; }
.login-error::first-letter { text-transform: uppercase; }

/* Créditos: abajo a la derecha, sobre la nieve */
.login-credit {
  position: absolute; right: 22px; bottom: 14px; z-index: 4;
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
}
.login-credit a { font: 500 13px 'Fredoka', var(--font-ui); color: var(--ink-soft); text-decoration: none; }
.login-credit a b { color: var(--ink); font-weight: 700; }
.login-credit a:hover { text-decoration: underline; }
.login-credit .credit-hw { font-size: 12px; opacity: .9; }

@media (max-width: 860px) {
  .login-scene { display: flex; flex-direction: column; justify-content: space-between; padding: 5vh 20px 0; }
  .login-side { order: 1; justify-self: auto; align-self: center; width: 100%; max-width: 420px; margin: 0; }
  .kicker, .frost-word, .login-hello { text-align: center; }
  .frost-word svg { margin: 0 auto; width: min(58vw, 240px); }
  .kicker { font-size: 11.5px; }
  .login-hello { font-size: 18px; margin: 6px 0 22px; }
  .login-panel { padding: 26px 18px 20px; }
  .guard { order: 2; width: min(86vw, 370px); align-self: center; margin: 0 0 8vh; }
  .frosty-says { left: 0; top: 0; max-width: 190px; padding: 9px 14px 11px; border-radius: 18px; }
  .guard.has-3d .frosty-says { right: calc(100% - var(--hx, 60%) + 46px); top: calc(var(--hy, 30%) - 78px); left: auto; max-width: 190px; padding: 9px 14px 11px; border-radius: 18px; }
  .says-text { font-size: 14.5px; }
  .says-tail { right: -12px; bottom: 6px; width: 18px; height: 22px; }
  .login-credit { left: 0; right: 0; align-items: center; bottom: 10px; }
  .login-credit a { font-size: 12px; }
  .mountains { height: 40vh; bottom: 12vh; }
}
@media (prefers-reduced-motion: reduce) {
  .fz, .fz-waves path, .pin-ring { animation: none !important; }
  .fz-waves path { opacity: .8; }
}

/* ===== Marca ===== */
.brand {
  font-family: 'Fredoka', var(--font-brand); font-size: 21px; font-weight: 600; letter-spacing: 0;
  display: flex; align-items: baseline; gap: 6px; white-space: nowrap;
}
.brand.big { font-size: 30px; justify-content: center; }
.brand-mark {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  font-style: italic; font-weight: 700; letter-spacing: -.12em; margin-right: 2px;
}
.brand-icon { height: 1.2em; width: auto; align-self: center; margin-right: 2px; }

/* ===== Layout ===== */
.app { height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 20px; padding: 11px 20px;
  background: var(--topbar); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.tabs {
  display: flex; gap: 2px; flex: 1;
  background: var(--field); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px; width: fit-content; flex: initial; margin: 0 auto;
}
.tab {
  background: none; border: none; color: var(--muted); padding: 7px 18px;
  border-radius: 999px; font-size: 13.5px; font-weight: 500;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--tab-on); color: var(--text); box-shadow: var(--tab-shadow); }
.badge {
  background: var(--bad); color: #fff; border-radius: 999px; font-size: 10.5px;
  padding: 1px 7px; margin-left: 4px; font-weight: 600;
}
.userbox { display: flex; align-items: center; gap: 14px; }
.clock { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.clock b { color: var(--text); font-weight: 500; }
.user-id { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
.role-chip {
  background: var(--chip); border: 1px solid var(--chip-border); color: var(--accent);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
}
.userbox > button {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: var(--radius-s); padding: 7px 14px; font-size: 13px;
}
.userbox > button:hover { color: var(--bad); border-color: var(--bad); }

/* Selector de empresa (solo admin) */
.org-switch select { font-size: 13.5px; padding: 8px 32px 8px 12px; max-width: 260px; min-width: 190px; }

/* ===== KPIs: tira liviana (sin cajas) y plegable ===== */
.kpi-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0; row-gap: 7px; padding: 9px 20px;
  border-bottom: 1px solid var(--border); background: var(--bg);
}
.kpi {
  display: flex; align-items: baseline; gap: 8px;
  padding: 2px 20px; border-left: 1px solid var(--border);
}
.kpi:first-child { border-left: none; padding-left: 0; }
.kpi-num { font-family: var(--font-brand); font-size: 19px; font-weight: 700; line-height: 1.1; letter-spacing: -.01em; }
.kpi-num.ok { color: var(--ok); }
.kpi-num.warn { color: var(--warn); }
.kpi-label { font-size: 11px; color: var(--muted); font-weight: 500; }
/* Plegada: solo un resumen de una línea */
.kpi-bar.collapsed { padding: 6px 20px; }
.kpi-bar.collapsed .kpi { display: none; }
.kpi-mini { display: none; font-size: 12.5px; color: var(--muted); }
.kpi-mini b { color: var(--text); font-family: var(--font-mono); font-weight: 600; }
.kpi-mini b.ok { color: var(--ok); }
.kpi-mini b.warn { color: var(--warn); }
.kpi-bar.collapsed .kpi-mini { display: block; }
.kpi-toggle {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; width: 26px; height: 26px; margin-left: 12px;
  font-size: 12px; line-height: 1; display: flex; align-items: center; justify-content: center;
  transition: transform var(--ease), color var(--ease);
}
.kpi-toggle:hover { color: var(--accent); border-color: rgba(92, 200, 255, .4); }
.kpi-bar.collapsed .kpi-toggle { transform: rotate(180deg); }
.ws-pill {
  margin-left: auto; font-size: 12px; font-weight: 600; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted);
}
.ws-pill.on { color: var(--ok); border-color: rgba(61, 214, 140, .35); background: rgba(61, 214, 140, .08); }
.ws-pill.on::before { content: '● '; font-size: 9px; vertical-align: 1px; animation: blink 2.2s infinite; }
.ws-pill.off { color: var(--bad); border-color: rgba(255, 99, 105, .35); }
@keyframes blink { 50% { opacity: .3; } }

/* ===== Mapa + sidebar ===== */
.panel { flex: 1; display: flex; min-height: 0; }
.map-wrap { flex: 1; position: relative; }
#map { position: absolute; inset: 0; background: var(--map-bg); }
.map-tools { position: absolute; top: 14px; right: 14px; z-index: 800; display: flex; gap: 8px; }
/* Leyenda: qué significa cada círculo/color del mapa */
.map-legend {
  position: absolute; bottom: 22px; left: 14px; z-index: 800;
  display: flex; flex-direction: column; gap: 5px;
  padding: 9px 12px; border-radius: 12px; font-size: 11px; color: var(--muted);
  background: var(--overlay); backdrop-filter: blur(10px); box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.map-legend .lg { display: inline-block; width: 20px; margin-right: 7px; vertical-align: middle; }
.lg-cov { border-top: 2px dashed #63cdfd; }
.lg-rpt { border-top: 2px dashed #2fae9e; }
.lg-zone { border-top: 2.5px solid #818cf8; }
.lg-alert {
  width: 10px !important; height: 10px; border-radius: 50%;
  background: var(--bad); border: 2px solid #fff; margin-left: 5px; margin-right: 12px;
}
.lg-beacon {
  width: 9px !important; height: 9px; transform: rotate(45deg); border-radius: 2px;
  background: var(--accent-2); border: 1.5px solid #fff; margin-left: 5px; margin-right: 13px;
}
/* Pin de beacon en el mapa: rombo violeta chico (zona techada) */
.bc-dot {
  width: 11px; height: 11px; transform: rotate(45deg); border-radius: 2.5px;
  background: var(--accent-2); border: 2px solid #fff;
  box-shadow: 0 0 8px rgba(165, 236, 255, .6), 0 1px 6px rgba(0, 0, 0, .5);
}
.bc-label {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  background: var(--overlay); backdrop-filter: blur(8px);
  color: var(--accent-2); font-size: 9.5px; font-weight: 600;
  padding: 1px 7px; border-radius: 999px; white-space: nowrap;
  border: 1px solid rgba(165, 236, 255, .3); transition: opacity var(--ease);
}
.labels-hidden .bc-label { opacity: 0; pointer-events: none; }
.labels-hidden .mk:hover .bc-label { opacity: 1; }
.map-btn {
  border-radius: var(--radius-s); padding: 8px 15px; font-size: 13px; font-weight: 500;
  color: var(--text); box-shadow: var(--shadow);
}
.map-btn:hover { border-color: var(--border-hi); }
.map-btn.armed { background: var(--grad); border-color: transparent; color: var(--on-grad); }
.map-btn.on { border-color: rgba(92, 200, 255, .45); color: var(--accent); }
.map-readout {
  position: absolute; bottom: 38px; right: 12px; z-index: 800; /* sobre la atribución de Leaflet, sin taparla */
  border-radius: 999px; font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  padding: 5px 13px; pointer-events: none;
}

.sidebar {
  width: 330px; background: var(--panel); border-right: 1px solid var(--border);
  padding: 16px; overflow-y: auto;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sidebar h2 { font-size: 15px; }
/* Qué significa cada color de estado de un equipo */
.status-legend {
  display: flex; gap: 13px; margin-bottom: 12px; font-size: 11px; color: var(--muted);
}
.status-legend span { display: flex; align-items: center; gap: 5px; }
.status-legend .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.status-legend .dot.on { background: var(--ok); }
.status-legend .dot.warn { background: var(--warn); }
.status-legend .dot.off { background: var(--off); }
.ghost-btn {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: var(--radius-s); padding: 4px 11px; font-size: 12px; font-weight: 500;
}
.ghost-btn:hover { color: var(--accent); border-color: var(--chip-border); }

.dev-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 15px; margin-bottom: 10px; cursor: pointer;
  transition: border-color var(--ease), transform var(--ease);
}
.dev-card:hover { border-color: var(--border-hi); transform: translateY(-1px); }
.dev-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 6px 20px rgba(92, 200, 255, .12); }
.dev-head { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.on { background: var(--ok); box-shadow: 0 0 10px rgba(61, 214, 140, .8); }
.status-dot.warn { background: var(--warn); }
.status-dot.off { background: var(--off); }
.dev-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; margin-top: 9px; font-size: 12px; color: var(--muted); }
.dev-meta b { color: var(--text); font-weight: 500; font-family: var(--font-mono); font-size: 11.5px; }
.batt-bar { height: 4px; border-radius: 3px; background: var(--track); margin-top: 10px; overflow: hidden; }
.batt-fill { height: 100%; border-radius: 3px; background: var(--ok); }
.batt-fill.warn { background: var(--warn); }
.batt-fill.bad { background: var(--bad); }

/* Buscador y filtros de la lista (con 1.000 equipos hacen falta) */
.list-tools { display: flex; flex-direction: column; gap: 9px; margin: 4px 0 14px; }
.dev-search { position: relative; }
.dev-search svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.dev-search input {
  width: 100%; height: 38px; padding: 0 12px 0 36px; font: 500 13.5px var(--font-ui); color: var(--text);
  background: var(--field); border: 1px solid var(--border); border-radius: 12px; transition: border-color var(--ease), box-shadow var(--ease);
}
.dev-search input::placeholder { color: var(--muted); }
.dev-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--chip); }
.dev-filter { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dev-filter button {
  display: flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 10px; white-space: nowrap;
  background: transparent; border: 1px solid var(--border); color: var(--muted); font-size: 12px; font-weight: 600;
}
.dev-filter button b { margin-left: auto; font: 600 11px var(--font-mono); color: var(--text); opacity: .75; }
.dev-filter button:hover { border-color: var(--border-hi); color: var(--text); }
.dev-filter button.on { background: var(--chip); border-color: var(--chip-border); color: var(--accent); }
.dev-filter button.on b { color: var(--accent); opacity: 1; }
.dev-filter .dot { width: 7px; height: 7px; border-radius: 50%; }
.dev-filter .dot.on { background: var(--ok); }
.dev-filter .dot.warn { background: var(--warn); }
.dev-filter .dot.off { background: var(--off); }

/* Lista vacía: Frost espera los equipos */
.empty-frost { text-align: center; padding: 26px 10px 10px; color: var(--muted); }
.empty-frost svg { width: 96px; height: auto; margin: 0 auto 10px; display: block; }
.empty-frost b { display: block; font: 600 16px var(--font-brand); color: var(--text); margin-bottom: 4px; }
.empty-frost p { font-size: 12.5px; line-height: 1.5; }

/* Botón Día/Noche */
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px;
  background: var(--field); border: 1px solid var(--border); color: var(--muted);
}
.icon-btn:hover { color: var(--accent); border-color: var(--chip-border); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .i-sun { display: none; }
:root[data-theme="noche"] .icon-btn .i-sun { display: block; }
:root[data-theme="noche"] .icon-btn .i-moon { display: none; }

/* Tarjetas de equipo: más aire y sombra suave en Día */
.dev-card { box-shadow: 0 1px 2px rgba(8, 110, 160, .05); }
.dev-card:hover { box-shadow: 0 6px 18px rgba(8, 110, 160, .1); }
:root[data-theme="noche"] .dev-card, :root[data-theme="noche"] .dev-card:hover { box-shadow: none; }
.dev-card.selected { box-shadow: 0 0 0 1px var(--accent), 0 8px 22px var(--chip); }
.sidebar h2 { font-size: 17px; font-weight: 600; }
.dev-org { margin: 5px 0 0 17px; }
.dev-org .org-chip { margin-left: 0; }
.brand { font-size: 23px; }
.topbar { box-shadow: 0 1px 0 var(--border); }

/* ===== Marcadores ===== */
.mk { position: relative; }
.mk-dot {
  width: 15px; height: 15px; border-radius: 50%; border: 2.5px solid #fff;
  box-shadow: 0 1px 10px rgba(0, 0, 0, .6);
}
.mk-dot.on { background: var(--ok); box-shadow: 0 0 12px rgba(61, 214, 140, .7), 0 1px 8px rgba(0, 0, 0, .5); }
.mk-dot.warn { background: var(--warn); }
.mk-dot.off { background: #565b66; }
.mk-pulse {
  position: absolute; inset: -8px; border-radius: 50%;
  border: 2px solid var(--ok); opacity: 0; animation: pulse 2.6s infinite;
}
@keyframes pulse { 0% { transform: scale(.5); opacity: .8; } 70% { transform: scale(1.35); opacity: 0; } 100% { opacity: 0; } }
/* Equipo fuera de su zona segura (alerta sin revisar): rojo + anillo urgente */
.mk-alert-ring {
  position: absolute; inset: -8px; border-radius: 50%;
  border: 2.5px solid var(--bad); opacity: 0; animation: pulse 1.3s infinite;
}
.mk-alert .mk-dot { background: var(--bad) !important; box-shadow: 0 0 12px rgba(255, 99, 105, .8), 0 1px 8px rgba(0, 0, 0, .5); }
.mk-alert .mk-label { color: #ff9aa1; border-color: rgba(255, 99, 105, .45); }
/* Equipo mudo: aviso explicativo en ficha y lista (que el gris no asuste) */
.off-note {
  margin: 8px 0 0; padding: 8px 11px; border-radius: 10px;
  font-size: 12px; line-height: 1.5; color: var(--text);
  background: var(--field); border: 1px solid var(--border);
}
.off-note b { color: var(--text); }
.dev-off-hint { margin-top: 6px; font-size: 11px; color: var(--muted); font-style: italic; }
/* Historial de alertas dentro de la ficha del equipo */
.dev-events { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.dev-events li {
  display: flex; justify-content: space-between; gap: 10px; font-size: 12px;
  color: var(--muted); padding: 4px 9px; border-radius: 8px; background: var(--field);
}
.dev-events li.open { color: var(--bad); background: rgba(255, 99, 105, .08); border: 1px solid rgba(255, 99, 105, .25); }
.mk-label {
  position: absolute; top: -30px; left: 50%; transform: translateX(-50%);
  background: var(--overlay); backdrop-filter: blur(8px);
  color: var(--text); font-size: 11px; font-weight: 600; box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  padding: 3px 10px; border-radius: 999px; white-space: nowrap; border: 1px solid var(--border);
  transition: opacity var(--ease);
}
/* Con zoom lejano las etiquetas se ocultan para no encimarse; la seleccionada y el hover siempre se ven */
.labels-hidden .mk-label { opacity: 0; pointer-events: none; }
.labels-hidden .mk:hover .mk-label, .labels-hidden .mk.mk-selected .mk-label { opacity: 1; }
.leaflet-popup-content-wrapper {
  background: var(--glass); backdrop-filter: blur(18px); color: var(--text);
  border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow);
}
.leaflet-popup-content code { font-family: var(--font-mono); font-size: 11px; color: var(--accent); }
/* Estado dentro del popup de antena */
.pop-status { font-weight: 600; font-size: 12px; }
.pop-status.ok { color: var(--ok); }
.pop-status.bad { color: var(--bad); }
.pop-hint { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); line-height: 1.45; }
.leaflet-popup-tip { background: var(--surface); }
.leaflet-container { font-family: var(--font-ui); }
.leaflet-bar a { background: var(--surface) !important; color: var(--text) !important; border-color: var(--border) !important; }

/* Antenas: torre de radio sin placa; cuando está viva, pulso expansivo.
   El halo radial oscuro la despega del satélite sin verse como "placa". */
.gw-icon {
  width: 40px; height: 40px; position: relative;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #63cdfd 0%, #a8e6ff 100%);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .9);
  box-shadow: 0 0 18px rgba(124, 141, 255, .75), 0 2px 10px rgba(0, 0, 0, .55);
}
.gw-icon.rpt {
  background: linear-gradient(135deg, #2fae9e 0%, #3fd9c6 100%);
  box-shadow: 0 0 18px rgba(63, 217, 198, .7), 0 2px 10px rgba(0, 0, 0, .55);
}
.gw-icon svg { display: block; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .45)); }
.gw-icon.off {
  background: linear-gradient(135deg, #4a4f5b 0%, #383c46 100%);
  border-color: rgba(255, 255, 255, .35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .5);
}
.gw-icon::after {
  content: ''; position: absolute; bottom: 0; right: 0; width: 10px; height: 10px;
  border-radius: 50%; background: var(--ok); border: 2px solid var(--surface);
  box-shadow: 0 0 8px rgba(61, 214, 140, 1);
}
.gw-icon.off::after { background: #8a919c; box-shadow: none; }
.gw-pulse {
  position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid rgba(122, 148, 255, .85); opacity: 0; animation: pulse 2.6s infinite .4s;
}
.gw-pulse.p2 { animation-delay: 1.7s; }
.gw-pulse.rpt { border-color: rgba(63, 217, 198, .85); }
/* Ondas de la antena "emitiendo": se encienden en secuencia interior → exterior */
.gw-icon svg .gw-w1 { animation: gwWaves 1.8s ease-out infinite; }
.gw-icon svg .gw-w2 { animation: gwWaves 1.8s ease-out infinite .35s; }
@keyframes gwWaves {
  0% { opacity: .2; }
  30% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: .2; }
}
.gw-icon.off svg .gw-w1, .gw-icon.off svg .gw-w2 { animation: none; opacity: .4; }
.gw-label.rpt { color: #3fd9c6; border-color: rgba(63, 217, 198, .35); }
.gw-label {
  position: absolute; top: 42px; left: 50%; transform: translateX(-50%);
  background: var(--overlay); backdrop-filter: blur(8px);
  color: var(--accent); font-size: 10px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap; border: 1px solid rgba(92, 200, 255, .3);
  transition: opacity var(--ease);
}
.labels-hidden .gw-label { opacity: 0; pointer-events: none; }
.labels-hidden .mk:hover .gw-label { opacity: 1; }

/* Agrupación de marcadores (cientos de equipos no explotan el mapa) */
.cluster { background: none; border: none; }
.cluster-inner {
  width: 100%; height: 100%; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--cluster);
  color: #fff; font-family: var(--font-brand); font-weight: 700; font-size: 13px;
  border: 2.5px solid rgba(255, 255, 255, .85);
  box-shadow: 0 0 0 5px rgba(92, 200, 255, .22), 0 4px 16px rgba(0, 0, 0, .5);
}
.cluster-inner.big { font-size: 14px; }

/* ===== Tarjeta de detalle ===== */
.detail-card {
  position: absolute; left: 14px; bottom: 14px; z-index: 800; width: 332px;
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
}
.detail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.detail-head b { font-size: 15px; font-family: var(--font-brand); letter-spacing: -.01em; }
.detail-close { background: none; border: none; color: var(--muted); font-size: 16px; }
.detail-close:hover { color: var(--bad); }
.detail-sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); }
.detail-meta { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.detail-meta b { color: var(--text); font-weight: 600; }
/* Zona indoor resuelta por beacon BLE */
.detail-meta.place { color: var(--accent-2); }
.detail-meta.place b { color: var(--accent-2); }
.dev-place {
  margin-top: 8px; font-size: 11.5px; font-weight: 600; color: var(--accent-2);
  background: rgba(165, 236, 255, .1); border: 1px solid rgba(165, 236, 255, .3);
  padding: 3px 10px; border-radius: 999px; display: inline-block;
}
/* Hora absoluta junto a la relativa en el historial de alertas de la ficha */
.ev-abs { font-style: normal; opacity: .65; font-size: 11px; }
.spark-block { margin-top: 12px; }
.spark-title { font-size: 11px; color: var(--muted); font-weight: 500; margin-bottom: 3px; display: flex; justify-content: space-between; }
.spark-title b { color: var(--text); font-family: var(--font-mono); font-weight: 500; font-size: 11px; }
.detail-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.detail-actions button {
  background: var(--field); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-s); padding: 6px 12px; font-size: 12.5px; font-weight: 500;
}
.detail-actions select { font-size: 12.5px; padding-top: 6px; padding-bottom: 6px; }
.detail-actions button:hover { border-color: rgba(92, 200, 255, .5); color: var(--accent); }

/* ===== Tablas ===== */
.table-wrap, .admin-grid { flex: 1; overflow-y: auto; padding: 24px; }
.table-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.table-head h2 { font-size: 17px; display: flex; align-items: center; gap: 10px; }
/* Chip que dice de qué empresa es lo que se está mirando */
.scope-chip {
  font-family: var(--font-ui); font-size: 11.5px; font-weight: 600; letter-spacing: 0;
  color: var(--accent-2); background: rgba(165, 236, 255, .1);
  border: 1px solid rgba(165, 236, 255, .3); padding: 3px 11px; border-radius: 999px;
}
.check { color: var(--muted); font-size: 13px; display: flex; gap: 7px; align-items: center; cursor: pointer; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
/* La tabla de alertas va sobre una tarjeta (en Día se despega del fondo) */
.table-wrap > table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); border-collapse: separate; border-spacing: 0; overflow: hidden; box-shadow: 0 4px 18px rgba(8, 110, 160, .06); }
.table-wrap > table th { background: var(--surface-2); }
.table-wrap > table tr:last-child td { border-bottom: none; }
.table-wrap > table tbody tr:hover td { background: var(--field); }
th { text-align: left; color: var(--muted); font-size: 11px; font-weight: 500; padding: 9px 12px; border-bottom: 1px solid var(--border); }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr.unack { background: rgba(255, 99, 105, .05); }
.pill { padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.pill.alert { background: rgba(255, 99, 105, .13); color: var(--bad); }
.pill.zone { background: rgba(165, 236, 255, .14); color: var(--accent-2); }
.pill.ok { background: rgba(61, 214, 140, .12); color: var(--ok); }
/* Severidad de alertas */
.pill.crit { background: rgba(255, 99, 105, .15); color: var(--bad); border: 1px solid rgba(255, 99, 105, .35); }
.pill.warn { background: rgba(255, 178, 36, .13); color: var(--warn); border: 1px solid rgba(255, 178, 36, .3); }
.pill.info { background: rgba(92, 200, 255, .12); color: var(--accent); border: 1px solid rgba(92, 200, 255, .3); }

/* Filtros de la pestaña Alertas */
.alert-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.alert-filters input[type="search"] {
  background: var(--field); border: 1px solid var(--border); border-radius: var(--radius-s);
  padding: 7px 12px; color: var(--text); font-size: 13px; width: 210px;
  transition: border-color var(--ease);
}
.alert-filters input[type="search"]:focus { outline: none; border-color: var(--accent); }
.alert-filters .ghost-btn { padding: 7px 13px; }
td button, .card button:not(.primary) {
  background: var(--field); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-s); padding: 5px 13px; font-size: 12px; font-weight: 500;
}
td button:hover, .card button:not(.primary):hover { border-color: rgba(92, 200, 255, .5); }

/* ===== Admin ===== */
/* Administración: navegación por secciones (una entidad a la vez) */
.admin-wrap { flex: 1; overflow-y: auto; padding: 30px 24px 48px; width: 100%; }
.admin-nav { margin: 0 auto 24px; }
.admin-tab { display: flex; align-items: center; gap: 7px; }
.admin-tab .count-chip { margin-left: 0; padding: 1px 8px; }
.admin-sec { max-width: 960px; margin: 0 auto; width: 100%; padding: 26px 30px 28px; }
.admin-sec.hidden { display: none; }
.sec-head { margin-bottom: 18px; }
.sec-head h2 { font-size: 18px; margin: 0 0 5px; padding: 0; border: none; display: flex; align-items: center; gap: 10px; }
.sec-head h2 .count-chip { margin-left: 0; }
.sec-head .hint { margin: 0; }

/* Nivel 1: tarjetas de empresas */
.org-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px; margin-bottom: 6px;
}
.org-card {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-s);
  padding: 17px 19px; min-width: 0; transition: border-color var(--ease);
}
.org-card:hover { border-color: var(--accent); }
.org-card h3 { font-family: var(--font-brand); font-size: 15.5px; letter-spacing: -.01em; }
.org-card.unassigned h3 { color: var(--muted); }
.org-meta { display: flex; flex-wrap: wrap; gap: 5px 14px; margin-top: 9px; font-size: 12px; color: var(--muted); }
.org-meta b { color: var(--text); font-family: var(--font-mono); font-weight: 600; }
.org-actions { display: flex; gap: 8px; margin-top: 14px; }

/* Nivel 2: cabecera dentro de una empresa */
.org-head {
  max-width: 960px; margin: 0 auto 18px; width: 100%;
  display: flex; align-items: center; gap: 16px;
}
.org-head h2 { font-size: 20px; font-family: var(--font-brand); letter-spacing: -.01em; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; transition: border-color var(--ease); min-width: 0;
}
.card.wide { grid-column: 1 / -1; }
.card:hover { border-color: var(--border-hi); }
.card h2 {
  font-size: 15px; margin: -20px -22px 14px; padding: 14px 22px 12px;
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px;
}
.count-chip {
  margin-left: auto; font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  color: var(--accent); background: rgba(92, 200, 255, .1);
  border: 1px solid rgba(92, 200, 255, .25); padding: 2px 9px; border-radius: 999px;
}
.th-right { text-align: right; }
.td-right { text-align: right; white-space: nowrap; }
.td-sub { display: block; color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 1px; }
.hint { color: var(--muted); font-size: 12.5px; margin-bottom: 12px; line-height: 1.5; }
.inline-form { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.inline-form input, .card input {
  background: var(--field); border: 1px solid var(--border); border-radius: var(--radius-s);
  padding: 8px 11px; color: var(--text); font-size: 13px; font-family: var(--font-ui);
  transition: border-color var(--ease); min-width: 0;
}
.inline-form input:focus, .card input:focus { outline: none; border-color: var(--accent); }

/* Equipos: grilla de mini-tarjetas alineadas */
.admin-dev-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#admin-gateways { display: grid; gap: 10px; }
.admin-dev {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-s);
  padding: 13px 15px; min-width: 0;
}
.admin-dev-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; margin-bottom: 10px; }
.admin-dev-head b { font-size: 13.5px; }
.admin-dev .eui { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); }
.admin-dev .meta { font-size: 11.5px; color: var(--muted); margin-left: auto; }
.admin-dev form {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr) 74px minmax(0, 1fr) auto;
  gap: 8px; align-items: center;
}
.admin-dev input[name="interval"] { font-family: var(--font-mono); }
.admin-dev form.gw-row { grid-template-columns: minmax(0, 1fr) 110px minmax(0, 1fr) auto; }
.admin-dev input, .admin-dev select { width: 100%; }
.admin-dev input[name="cov"] { font-family: var(--font-mono); }
@media (max-width: 1250px) {
  .admin-grid { grid-template-columns: 1fr; }
  .admin-dev-grid { grid-template-columns: 1fr; }
}

/* ===== Toast ===== */
.toast {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 900; border-radius: var(--radius-s); border-color: rgba(92, 200, 255, .4);
  color: var(--text); padding: 10px 20px; font-size: 13.5px;
  font-weight: 500; box-shadow: var(--shadow); max-width: 70%;
}
.toast.warn { border-color: rgba(255, 178, 36, .5); }

/* ===== Recorrido / playback ===== */
.trail-point { background: var(--accent); border: 1.5px solid #fff; border-radius: 50%; }
.play-marker {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--warn); border: 3px solid #fff; box-shadow: 0 0 12px rgba(255, 178, 36, .8);
}
.org-chip {
  background: rgba(165, 236, 255, .12); border: 1px solid rgba(165, 236, 255, .35); color: var(--accent-2);
  font-size: 10px; font-weight: 600; padding: 1px 8px; border-radius: 999px; margin-left: 6px;
  white-space: nowrap; display: inline-block;
}
td .org-chip { margin-left: 0; }

/* Pantallas medianas: el reloj es lo primero que sobra (evita scroll horizontal) */
@media (max-width: 1180px) {
  .clock { display: none; }
  .topbar { gap: 12px; }
}
@media (max-width: 900px) {
  .panel { flex-direction: column; }
  .sidebar { width: 100%; max-height: 38%; }
  .kpi-bar { flex-wrap: wrap; }
  .detail-card { width: calc(100% - 28px); }
  .tabs { margin: 0; }
  .org-switch select { max-width: 160px; }
}

/* =====================================================================
   REDISEÑO 03-10: menú lateral, barra con buscador, Resumen, Equipos,
   búsqueda global (Ctrl+K) y cuenta. Todo con las variables de tema.
   ===================================================================== */
:root { --st-on: #12a066; --st-warn: #c27c00; --st-off: #7c90ab; --bar: #1fa9ec; }
:root[data-theme="noche"] { --st-on: #1f9d60; --st-warn: #c48510; --st-off: #6f84a3; --bar: #63cdfd; }

.app { flex-direction: row; }
.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

/* Menú lateral */
.rail {
  width: 232px; flex-shrink: 0; display: flex; flex-direction: column; gap: 6px;
  background: var(--panel); border-right: 1px solid var(--border); padding: 18px 12px 14px;
}
.rail-brand { display: flex; align-items: center; gap: 9px; padding: 0 10px 14px; font: 600 25px var(--font-brand); letter-spacing: .01em; }
.rail-brand img { width: 30px; height: 30px; }
.rail-nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border: none; border-radius: 12px; background: none;
  color: var(--muted); font: 600 14px var(--font-ui); text-align: left;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { background: var(--field); color: var(--text); }
.nav-item.active { background: var(--chip); color: var(--accent); }
.nav-item.active::before { content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-item .badge { margin-left: auto; }
.nav-item .i-sun { display: none; }
:root[data-theme="noche"] .nav-item .i-sun { display: block; }
:root[data-theme="noche"] .nav-item .i-moon { display: none; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding-top: 10px; border-top: 1px solid var(--border); }
.me { position: relative; }
.me-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 9px; border: none; border-radius: 12px; background: none; color: var(--text); text-align: left; }
.me-btn:hover, .me-btn[aria-expanded="true"] { background: var(--field); }
.avatar { width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: var(--on-grad); font: 600 15px var(--font-brand); }
.me-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.me-txt b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-txt .role-chip { align-self: flex-start; padding: 1px 8px; font-size: 9.5px; }
.me-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 1200; display: flex; flex-direction: column; padding: 6px; border-radius: 14px; box-shadow: var(--shadow); }
.me-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: none; border-radius: 9px; background: none; color: var(--text); font-size: 13px; text-align: left; }
.me-menu button:hover { background: var(--field); }
.me-menu button svg { width: 17px; height: 17px; flex-shrink: 0; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.me-menu #logout-btn:hover { color: var(--bad); }
.me-menu #logout-btn:hover svg { stroke: var(--bad); }

/* Barra superior */
.topbar { gap: 16px; padding: 12px 22px; box-shadow: none; }
.page-title { font: 600 22px var(--font-brand); letter-spacing: .005em; min-width: 140px; white-space: nowrap; }
.search-trigger {
  flex: 0 1 440px; height: 40px; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--field); color: var(--muted); font-size: 13.5px;
}
.search-trigger:hover { border-color: var(--border-hi); color: var(--text); }
.search-trigger svg { width: 17px; height: 17px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
kbd { margin-left: auto; padding: 2px 7px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--muted); font: 600 10.5px var(--font-mono); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.top-right .ws-pill { margin-left: 0; }
/* Los indicadores rápidos solo donde aportan (en Resumen están en grande) */
.app[data-tab="resumen"] .kpi-bar, .app[data-tab="alertas"] .kpi-bar, .app[data-tab="admin"] .kpi-bar { display: none; }
.ghost-btn svg { width: 15px; height: 15px; vertical-align: -3px; margin-right: 5px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Resumen ---------- */
.dash { flex: 1; overflow-y: auto; padding: 26px 28px 44px; }
.dash-inner { max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.dash-hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 4px; }
.dash-hello h2 { font: 600 27px var(--font-brand); }
.dash-hello p { color: var(--muted); font-size: 14px; margin-top: 3px; }
.dash-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-tile {
  display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; color: var(--text);
  box-shadow: 0 2px 10px rgba(8, 110, 160, .05); transition: border-color var(--ease), transform var(--ease);
}
button.stat-tile:hover { border-color: var(--chip-border); transform: translateY(-1px); }
.stat-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-value { font: 600 34px/1.1 var(--font-brand); }
.stat-value small { font-size: 17px; color: var(--muted); font-weight: 500; }
.stat-sub { font-size: 12.5px; color: var(--muted); }
.stat-sub b { color: var(--text); font-weight: 600; }
.stat-sub .bad { color: var(--bad); }
.dash-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; }
.dash-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px 22px; min-width: 0; box-shadow: 0 2px 10px rgba(8, 110, 160, .05); }
.dash-card h3 { font: 600 16.5px var(--font-brand); }
.dash-card .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.dash-card .more { margin-top: 12px; background: none; border: none; color: var(--accent); font-weight: 600; font-size: 13px; padding: 0; }
.dash-card .more:hover { text-decoration: underline; }
/* Estado de la flota: barra apilada con 2px de separación y extremos redondeados */
.fleet-bar { display: flex; gap: 2px; height: 20px; margin: 18px 0 16px; }
.fleet-bar span { min-width: 4px; height: 100%; }
.fleet-bar span:first-child { border-radius: 4px 0 0 4px; }
.fleet-bar span:last-child { border-radius: 0 4px 4px 0; }
.fleet-bar span:only-child { border-radius: 4px; }
.fleet-bar span:hover { filter: brightness(1.08); }
.fleet-bar .empty { flex: 1; background: var(--track); border-radius: 4px; }
.fleet-legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.fleet-legend > * { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--field); border: none; text-align: left; color: var(--text); }
.fleet-legend button:hover { box-shadow: inset 0 0 0 1px var(--chip-border); }
.fleet-legend .k { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.fleet-legend .k i { width: 10px; height: 10px; border-radius: 3px; }
.fleet-legend .v { font: 600 22px var(--font-brand); }
.fleet-legend .v small { font: 500 12.5px var(--font-ui); color: var(--muted); margin-left: 4px; }
/* Columnas por hora */
.cols { position: relative; margin-top: 14px; }
.cols svg { display: block; width: 100%; height: 190px; overflow: visible; }
.cols .grid line { stroke: var(--border); stroke-width: 1; }
.cols text { fill: var(--muted); font: 500 10.5px var(--font-ui); }
.cols .col { fill: var(--bar); }
.cols .hit { fill: transparent; cursor: default; }
.cols .hit:hover + .col, .cols g.on .col { filter: brightness(1.15); }
.dv-tip {
  position: absolute; z-index: 5; pointer-events: none; transform: translate(-50%, -100%); margin-top: -8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 7px 11px;
  box-shadow: var(--shadow); font-size: 12px; color: var(--muted); white-space: nowrap;
}
.dv-tip b { display: block; font: 600 16px var(--font-brand); color: var(--text); }
/* Necesitan atención / actividad */
.att-list, .act-list { list-style: none; margin-top: 12px; display: flex; flex-direction: column; }
.att-list li, .act-list li { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.att-list li:last-child, .act-list li:last-child { border-bottom: none; }
.att-ico { width: 32px; height: 32px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center; font-size: 15px; background: var(--field); }
.att-ico.crit { background: rgba(220, 61, 72, .12); }
.att-ico.warn { background: rgba(212, 136, 6, .13); }
.att-main { flex: 1; min-width: 0; }
.att-main b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-main span { font-size: 12px; color: var(--muted); }
.att-go { background: none; border: 1px solid var(--border); border-radius: 9px; padding: 5px 10px; color: var(--accent); font-size: 12px; font-weight: 600; white-space: nowrap; }
.att-go:hover { border-color: var(--chip-border); background: var(--chip); }
.act-list time { width: 64px; flex-shrink: 0; font: 600 12px var(--font-mono); color: var(--muted); }
.act-list .pill { margin-left: auto; }
.dash-empty { text-align: center; padding: 18px 8px 6px; color: var(--muted); font-size: 13px; }
.dash-empty b { display: block; font: 600 15px var(--font-brand); color: var(--text); margin-bottom: 3px; }
.dash-hero { display: grid; grid-template-columns: 150px 1fr; gap: 22px; align-items: center; }
.dash-hero svg { width: 130px; height: auto; }
.dash-hero h3 { font: 600 22px var(--font-brand); }
.dash-hero p { color: var(--muted); margin-top: 6px; line-height: 1.55; font-size: 14px; }
.dash-hero ol { margin: 12px 0 0 18px; color: var(--text); font-size: 13.5px; line-height: 1.8; }

/* ---------- Equipos (tabla de la flota) ---------- */
.fleet th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
.fleet th[data-sort]:hover { color: var(--text); }
.fleet th.sorted { color: var(--accent); }
.fleet th.sorted::after { content: ' ↓'; }
.fleet th.sorted.asc::after { content: ' ↑'; }
.fleet td { white-space: nowrap; }
.fleet tbody tr { cursor: pointer; }
.fleet .dev-name b { display: block; font-weight: 600; }
.fleet .dev-name code { font: 500 11px var(--font-mono); color: var(--muted); }
.st-label { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; }
.st-label i { width: 8px; height: 8px; border-radius: 50%; }
.st-label.on i { background: var(--ok); } .st-label.warn i { background: var(--warn); } .st-label.off i { background: var(--off); }
.st-label.off { color: var(--muted); }
.batt-cell { display: flex; align-items: center; gap: 9px; font: 500 12px var(--font-mono); }
.batt-cell .meter { width: 56px; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.batt-cell .meter i { display: block; height: 100%; border-radius: 3px; background: var(--ok); }
.batt-cell .meter i.warn { background: var(--warn); }
.batt-cell .meter i.bad { background: var(--bad); }
.fleet .go { background: none; border: 1px solid var(--border); border-radius: 9px; padding: 5px 10px; color: var(--accent); font-size: 12px; font-weight: 600; }
.fleet .go:hover { background: var(--chip); border-color: var(--chip-border); }
.fleet-empty td { text-align: center; padding: 28px; color: var(--muted); }

/* ---------- Búsqueda global y ventanas ---------- */
.overlay { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: flex-start; justify-content: center; padding: 11vh 16px 16px; background: rgba(8, 24, 38, .32); backdrop-filter: blur(3px); }
.cmdk-box { width: min(640px, 100%); border-radius: 18px; overflow: hidden; box-shadow: 0 30px 80px rgba(8, 24, 38, .3); }
.cmdk-input { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.cmdk-input svg { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.cmdk-input input { flex: 1; min-width: 0; border: none; background: transparent; outline: none; color: var(--text); font: 500 17px var(--font-ui); }
.cmdk-input input::placeholder { color: var(--muted); }
.cmdk-list { max-height: min(52vh, 460px); overflow-y: auto; padding: 6px 8px 10px; }
.cmdk-group { padding: 12px 10px 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 11px; cursor: pointer; }
.cmdk-item.on { background: var(--chip); }
.cmdk-ico { width: 32px; height: 32px; flex-shrink: 0; border-radius: 9px; display: grid; place-items: center; background: var(--field); font-size: 15px; }
.cmdk-item b { display: block; font-size: 14px; font-weight: 600; color: var(--text); }
.cmdk-item small { font-size: 12px; color: var(--muted); }
.cmdk-item .go-hint { margin-left: auto; font-size: 11.5px; color: var(--muted); opacity: 0; }
.cmdk-item.on .go-hint { opacity: 1; }
.cmdk-empty { padding: 26px; text-align: center; color: var(--muted); font-size: 13.5px; }
.modal-box { width: min(420px, 100%); margin-top: 4vh; display: flex; flex-direction: column; gap: 12px; padding: 24px 24px 20px; border-radius: 18px; box-shadow: 0 30px 80px rgba(8, 24, 38, .3); }
.modal-box h2 { font-size: 20px; }
.modal-box .hint { margin: -4px 0 4px; }
.modal-box label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.modal-box input { height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: 500 15px var(--font-ui); }
.modal-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--chip); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.modal-actions .ghost-btn { padding: 8px 14px; font-size: 13px; }
.form-error { color: var(--bad); font-size: 13px; font-weight: 600; }
.form-error:empty { display: none; }

@media (max-width: 1100px) {
  .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-row { grid-template-columns: 1fr; }
  .rail { width: 74px; padding: 16px 10px 12px; }
  .rail-brand span, .nav-item span, .me-txt { display: none; }
  .rail-brand { justify-content: center; padding: 0 0 12px; }
  .nav-item { justify-content: center; padding: 11px; }
  .nav-item .badge { position: absolute; top: 4px; right: 4px; margin: 0; }
  .me-btn { justify-content: center; }
  .me-menu { left: 0; right: auto; width: 230px; }
}
/* Celular: el menú pasa abajo, como en las apps */
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .rail {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1500; width: auto; height: 64px;
    flex-direction: row; align-items: center; gap: 0; padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    border-right: none; border-top: 1px solid var(--border); background: var(--topbar); backdrop-filter: blur(14px);
  }
  .rail-brand, .rail-foot #theme-btn { display: none; }
  .rail-nav { flex-direction: row; flex: 1; justify-content: space-around; gap: 0; margin: 0; }
  .nav-item { flex-direction: column; gap: 3px; padding: 6px 4px; font-size: 10.5px; width: auto; flex: 1; }
  .nav-item span { display: block; }
  .nav-item[data-tab="admin"] span { font-size: 0; }
  .nav-item[data-tab="admin"] span::after { content: 'Admin'; font-size: 10.5px; }
  .nav-item.active::before { display: none; }
  .rail-foot { margin: 0; padding: 0 0 0 4px; border-top: none; flex-direction: row; }
  .me-menu { left: auto; right: 0; width: 240px; }
  .main { padding-bottom: 64px; }
  .topbar { padding: 10px 14px; gap: 10px; }
  .page-title { min-width: 0; font-size: 19px; }
  .search-trigger { flex: 0 0 40px; padding: 0; justify-content: center; margin-left: auto; }
  .search-trigger span, .search-trigger kbd, .clock, .top-right .ws-pill { display: none; }
  .top-right { margin-left: 0; }
  .org-switch select { max-width: 130px; min-width: 0; }
  .dash { padding: 16px 14px 28px; }
  .dash-stats { gap: 10px; }
  .stat-tile { padding: 14px 15px; }
  .stat-value { font-size: 28px; }
  .dash-hero { grid-template-columns: 1fr; text-align: center; }
  .dash-hero svg { margin: 0 auto; }
  .fleet .col-org, .fleet .col-place, .fleet .col-iv { display: none; }
  .fleet .td-right, .fleet thead th:last-child { display: none; }
  .fleet .st-label { font-size: 0; gap: 0; }
  .fleet .st-label i { width: 10px; height: 10px; }
  .fleet td, .fleet th { padding-left: 8px; padding-right: 8px; }
  .table-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .table-head .alert-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .table-head .alert-filters input[type="search"] { grid-column: 1 / -1; width: 100%; }
  .table-head .alert-filters .check { grid-column: 1 / -1; }
  /* Cifras en una sola línea */
  .kpi-bar { padding: 7px 14px; }
  .kpi-bar .kpi, .kpi-toggle { display: none; }
  .kpi-bar .kpi-mini { display: block; }
  /* Mapa arriba y grande; la lista abajo */
  #panel-mapa .map-wrap { order: -1; flex: 1 1 58%; min-height: 0; }
  #panel-mapa .sidebar { flex: 0 0 42%; max-height: none; border-right: none; border-top: 1px solid var(--border); }
  .map-legend { display: none; }
  .map-tools { top: 10px; right: 10px; }
  .map-btn { padding: 7px 11px; font-size: 12.5px; }
  .table-wrap { padding: 14px; overflow-x: auto; }
}

/* Ficha del equipo: sólida sobre el satélite, títulos de la marca */
.detail-card { width: 360px; border-radius: 18px; padding: 18px 20px; background: var(--surface); box-shadow: var(--shadow); max-height: calc(100% - 28px); overflow-y: auto; }
.detail-head b { font: 600 18px var(--font-brand); }
.detail-card .off-note { border-radius: 12px; }
.mk-alert .mk-label { color: var(--bad); border-color: rgba(220, 61, 72, .45); }
:root[data-theme="noche"] .mk-alert .mk-label { color: #ff9aa1; }
.gw-mini { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.gw-mini h4 { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.gw-mini ul { list-style: none; }
.gw-mini li { display: flex; align-items: center; gap: 9px; padding: 6px 0; font-size: 13px; }
.gw-mini li i { width: 8px; height: 8px; border-radius: 50%; background: var(--off); flex-shrink: 0; }
.gw-mini li i.on { background: var(--ok); }
.gw-mini li b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gw-mini li span { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }

/* =====================================================================
   MAPA 03-10: ícono por tipo de activo con aro del color del estado,
   zonas con nombre, antenas claras, grupos que avisan y panel de Capas
   ===================================================================== */
.am { position: relative; width: 34px; height: 34px; --st: #12a066; }
.am.warn { --st: #d48806; }
.am.off { --st: #8a9bb0; }
.am.alert { --st: #dc3d48; }
.am-pin {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; border: 3px solid var(--st); box-shadow: 0 2px 9px rgba(0, 0, 0, .38);
  transition: transform .15s ease, box-shadow .15s ease;
}
.am-pin svg { width: 18px; height: 18px; fill: none; stroke: #0b5d88; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.am.off .am-pin { background: #eef2f6; }
.am.off .am-pin svg { stroke: #61758b; }
.am-dot { display: none; }
.am.on .am-dot { display: block; position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; background: var(--st); border: 2px solid #fff; animation: blink 2.2s infinite; }
.am-ring { position: absolute; inset: -8px; border-radius: 50%; border: 3px solid #dc3d48; opacity: 0; animation: pulse 1.3s infinite; }
.mk:hover .am-pin { transform: scale(1.1); }
.mk-selected .am-pin { transform: scale(1.18); box-shadow: 0 0 0 4px rgba(69, 190, 246, .4), 0 4px 14px rgba(0, 0, 0, .4); }
.am .mk-label { top: -31px; }

/* Zonas: el nombre escrito sobre el borde de arriba */
.zone-tag {
  position: absolute; transform: translate(-50%, -100%); margin-top: -3px; white-space: nowrap;
  font: 600 11.5px var(--font-ui); color: #fff; background: var(--zc, #7c6cf0);
  padding: 3px 10px; border-radius: 999px; box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.far .zone-tag, .far .gw-label { display: none; }

/* Antenas: círculo blanco con el glifo de la marca; gris si no reporta */
.gw-icon { width: 38px; height: 38px; background: #fff; color: #0678b0; border: 2.5px solid #45bef6; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
.gw-icon svg { filter: none; }
.gw-icon.off { background: #eef2f6; color: #6f84a3; border-color: #8a9bb0; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.gw-icon::after { border-color: #fff; }
.gw-pulse { border-color: rgba(69, 190, 246, .75); }

/* Grupos de equipos: rojo si adentro hay uno en alerta, gris si están todos mudos */
.cluster-inner.has-alert { background: radial-gradient(circle at 32% 28%, #ff6b74, #dc3d48); box-shadow: 0 0 0 5px rgba(220, 61, 72, .28), 0 4px 16px rgba(0, 0, 0, .45); }
.cluster-inner.all-off { background: radial-gradient(circle at 32% 28%, #a9b8c9, #6f84a3); box-shadow: 0 0 0 5px rgba(111, 132, 163, .28), 0 4px 16px rgba(0, 0, 0, .45); }

/* Controles del mapa y panel de Capas (control y leyenda en uno) */
.map-tools { align-items: flex-start; }
.map-btn { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.map-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.layers { position: relative; }
.layers-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 900; width: 306px;
  padding: 10px 10px 12px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow);
}
.lp-sec { margin: 8px 6px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; border-radius: 11px; background: var(--field); }
.seg button { padding: 7px; border: none; border-radius: 8px; background: none; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.seg button.on { background: var(--tab-on); color: var(--text); box-shadow: var(--tab-shadow); }
.lp-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 6px; border-radius: 10px; cursor: pointer; }
label.lp-row:hover { background: var(--field); }
.lp-row input { margin-top: 3px; accent-color: var(--accent); }
.lp-row b { display: block; font-size: 13px; font-weight: 600; }
.lp-row small { font-size: 11.5px; color: var(--muted); }
.sw { width: 26px; height: 18px; flex-shrink: 0; margin-top: 1px; border-radius: 6px; }
.sw.cov { border: 2px dashed #2f86e0; background: rgba(47, 134, 224, .12); }
.sw.rpt { border: 2px dashed #2fae9e; background: rgba(47, 174, 158, .12); }
.sw.zone { border: 2px solid #7c6cf0; background: rgba(124, 108, 240, .14); border-radius: 50%; }
.sw.beacon { width: 12px; height: 12px; margin: 4px 7px; transform: rotate(45deg); border-radius: 2.5px; background: var(--accent-2); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border-hi); }
.sw.lbl { display: grid; place-items: center; font: 700 11px var(--font-ui); color: var(--text); background: var(--field); border: 1px solid var(--border); }
.lp-key { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 10px; padding: 2px 6px 2px; font-size: 12.5px; }
.lp-key span { display: flex; align-items: center; gap: 8px; }
.lp-key .k { width: 15px; height: 15px; flex-shrink: 0; border-radius: 50%; background: #fff; border: 3px solid #12a066; }
.lp-key .k.warn { border-color: #d48806; }
.lp-key .k.off { border-color: #8a9bb0; background: #eef2f6; }
.lp-key .k.alert { border-color: #dc3d48; box-shadow: 0 0 0 3px rgba(220, 61, 72, .25); }
@media (max-width: 760px) {
  .map-btn span { display: none; }
  .layers-panel { width: min(306px, calc(100vw - 28px)); }
}

/* =====================================================================
   ACTIVOS E INSTALACIÓN 03-10: menos ruido, lista compacta, asistente
   ===================================================================== */
/* Menos ruido: las cifras rápidas ya están en Resumen y en los filtros de la lista */
.kpi-bar { display: none !important; }

/* Botón destacado del menú */
.nav-cta {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 12px;
  padding: 11px 12px; border: none; border-radius: 12px; background: var(--grad); color: var(--on-grad);
  font: 600 14px var(--font-ui); box-shadow: 0 6px 16px rgba(8, 110, 160, .22);
}
.nav-cta svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.nav-cta:hover { filter: brightness(1.08); transform: translateY(-1px); }
.nav-cta.active { box-shadow: 0 0 0 3px var(--chip-border); }
@media (max-width: 1100px) { .nav-cta span { display: none; } .nav-cta { padding: 11px; } }

/* Lista del mapa: una fila por activo, ícono con aro de estado */
.dev-row { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; }
.dev-row:hover { background: var(--field); }
.dev-row.selected { background: var(--chip); border-color: var(--chip-border); }
.dev-row .am, .name-cell .am, .asset-pick .am, .ma-head .am { width: 34px; height: 34px; flex-shrink: 0; }
.dev-row .am-pin { width: 34px; height: 34px; border-width: 2.5px; box-shadow: none; }
.dev-row-main { flex: 1; min-width: 0; }
.dev-row-main b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev-row-main small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev-row .org-chip { margin: 0; max-width: 92px; overflow: hidden; text-overflow: ellipsis; }
.no-asset { display: inline-block; font-size: 10.5px; font-weight: 700; color: var(--warn); background: rgba(212, 136, 6, .12); padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
#device-list { display: flex; flex-direction: column; gap: 2px; }

/* Tabla de activos */
.name-cell { display: flex; align-items: center; gap: 10px; }
.name-cell .am-pin { width: 32px; height: 32px; border-width: 2.5px; box-shadow: none; }
.name-cell .am-pin svg, .dev-row .am-pin svg { width: 17px; height: 17px; }
.fleet code.eui { font: 500 11.5px var(--font-mono); color: var(--muted); }
.st-label.none i { background: transparent; border: 2px dashed var(--off); }
.st-label.none { color: var(--muted); }

/* Ficha del equipo: el activo arriba */
.asset-strip { display: flex; align-items: center; gap: 12px; margin: 6px 0 4px; }
.asset-strip b { font-size: 13px; }
.asset-strip small { display: block; font: 500 11px var(--font-mono); color: var(--muted); margin-top: 2px; }
.asset-thumb { width: 52px; height: 52px; flex-shrink: 0; border-radius: 12px; background: var(--field) center / cover no-repeat; display: grid; place-items: center; border: 1px solid var(--border); }
.asset-thumb svg { width: 24px; height: 24px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.asset-thumb.has-photo svg { display: none; }
.asset-actions { display: flex; gap: 6px; margin: 8px 0 4px; }
.asset-actions button { flex: 1; padding: 7px 8px; border-radius: 9px; border: 1px solid var(--border); background: var(--field); color: var(--text); font-size: 12.5px; font-weight: 600; }
.asset-actions button:hover { border-color: var(--chip-border); color: var(--accent); }
.install-nudge { margin: 10px 0 2px; padding: 10px 12px; border-radius: 12px; background: rgba(212, 136, 6, .1); font-size: 12.5px; display: flex; flex-direction: column; gap: 8px; }
.install-nudge .primary { align-self: flex-start; padding: 7px 14px; }

/* Ficha del activo (ventana) */
.asset-box { width: min(560px, 100%); max-height: 86vh; overflow-y: auto; gap: 14px; }
.ma-head { display: flex; align-items: center; gap: 12px; }
.ma-head h2 { font-size: 20px; }
.ma-head .hint { margin: 2px 0 0; }
.ma-head .detail-close { margin-left: auto; align-self: flex-start; }
.ma-head .am-pin { width: 44px; height: 44px; }
.ma-head .am { width: 44px; height: 44px; }
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gallery .hint { grid-column: span 3; margin: 0; align-self: center; }
.ph { aspect-ratio: 1; border-radius: 12px; background: var(--field) center / cover no-repeat; border: 1px solid var(--border); cursor: pointer; position: relative; }
.ph.add { display: grid; place-items: center; font-size: 26px; color: var(--accent); border-style: dashed; }
.ma-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 10px; }
.ma-grid > div { padding: 11px 13px; border-radius: 12px; background: var(--field); display: flex; flex-direction: column; gap: 2px; }
.ma-grid .k { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.ma-grid b { font-size: 15px; }
.ma-grid code, .links code { font: 600 12.5px var(--font-mono); }
.ma-grid small { font-size: 11.5px; color: var(--muted); }
.sub-h { font: 600 14px var(--font-brand); margin: 6px 0 2px; display: flex; align-items: center; gap: 8px; }
.links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.links li { display: flex; gap: 10px; align-items: flex-start; }
.links li > i { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--off); flex-shrink: 0; }
.links li > i.on { background: var(--ok); }
.links small { display: block; font-size: 12px; color: var(--muted); }
.ma-edit summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--accent); }
.ma-edit[open] { display: flex; flex-direction: column; gap: 10px; }
.ghost-btn.danger:hover { color: var(--bad); border-color: rgba(220, 61, 72, .4); }

/* Instalar equipo */
.inst-wrap { flex: 1; overflow-y: auto; padding: 24px 20px 48px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.inst-mode { width: min(620px, 100%); }
.inst-card { width: min(620px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 22px 24px 24px; box-shadow: 0 4px 22px rgba(8, 110, 160, .07); display: flex; flex-direction: column; gap: 14px; }
.inst-card h2 { font-size: 21px; }
.inst-card .hint { margin: -6px 0 0; }
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 4px; }
.steps li { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 10px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.steps li b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--field); font: 700 12px var(--font-ui); flex-shrink: 0; }
.steps li.on { background: var(--chip); color: var(--accent); }
.steps li.on b { background: var(--accent); color: #fff; }
.steps li.done b { background: var(--ok); color: #fff; font-size: 0; }
.steps li.done b::after { content: '✓'; font-size: 12px; }
.step-body { display: flex; flex-direction: column; gap: 14px; }
.big-btn { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px; border-radius: 14px; border: none; background: var(--grad); color: var(--on-grad); font: 600 16px var(--font-ui); cursor: pointer; box-shadow: 0 8px 20px rgba(8, 110, 160, .22); }
.big-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.big-btn:hover { filter: brightness(1.08); }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.eui-row { display: flex; gap: 8px; }
.eui-row input, .fld input, .fld select, .search-in, .bulk textarea {
  width: 100%; height: 44px; padding: 0 13px; border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface); color: var(--text); font: 500 15px var(--font-ui);
}
.eui-row input { font-family: var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
.eui-row input:focus, .fld input:focus, .fld select:focus, .search-in:focus, .bulk textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--chip); }
.eui-row .primary { padding: 0 18px; }
.fld { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.fld i { font-style: normal; font-weight: 500; opacity: .75; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.type-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.type-grid button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font-size: 11.5px; font-weight: 600; }
.type-grid button svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.type-grid button.on { border-color: var(--accent); background: var(--chip); color: var(--accent); }
.tracker-found { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 13px; background: rgba(18, 160, 102, .09); border: 1px solid rgba(18, 160, 102, .3); }
.tracker-found .ok-ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #fff; font-weight: 700; flex-shrink: 0; }
.tracker-found div { flex: 1; min-width: 0; }
.tracker-found b { font-family: var(--font-mono); font-size: 14px; }
.tracker-found small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.free-list { display: flex; flex-direction: column; gap: 6px; }
.free { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-align: left; }
.free:hover { border-color: var(--chip-border); background: var(--chip); }
.free code { font: 600 13px var(--font-mono); }
.free small { font-size: 12px; color: var(--muted); }
.asset-pick { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; margin-top: 8px; }
.asset-pick button { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 11px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); text-align: left; }
.asset-pick button.on { border-color: var(--accent); background: var(--chip); }
.asset-pick .am-pin { width: 32px; height: 32px; border-width: 2px; box-shadow: none; }
.asset-pick b { display: block; font-size: 13.5px; }
.asset-pick small { font-size: 12px; color: var(--muted); }
.step-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 4px; }
.step-nav.center { justify-content: center; }
.step-nav .primary, .step-nav .ghost-btn { padding: 10px 18px; font-size: 14px; }
.photo-btn { cursor: pointer; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.thumbs:empty { display: none; }
.thumbs .ph button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: none; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; }
.verify { text-align: center; }
.verify-wait svg { width: 110px; margin: 0 auto 6px; display: block; }
.verify h2 { font-size: 20px; margin-bottom: 6px; }
.tips { list-style: none; margin: 12px auto; max-width: 380px; text-align: left; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.tips li::before { content: '•'; color: var(--accent); margin-right: 8px; font-weight: 700; }
.pulse-dots { display: flex; justify-content: center; gap: 7px; margin: 10px 0 14px; }
.pulse-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: fz-dot 1.1s ease-in-out infinite; }
.pulse-dots i:nth-child(2) { animation-delay: .15s; } .pulse-dots i:nth-child(3) { animation-delay: .3s; }
.big-ok { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #fff; font-size: 32px; font-weight: 700; }
.bulk { border-top: 1px solid var(--border); padding-top: 12px; }
.bulk summary { cursor: pointer; font-weight: 600; color: var(--accent); font-size: 14px; }
.bulk[open] { display: flex; flex-direction: column; gap: 10px; }
.bulk textarea { height: auto; padding: 10px 13px; font: 500 12.5px var(--font-mono); resize: vertical; }
.file-btn { cursor: pointer; padding: 10px 16px; }
.bulk-sum { font-size: 14px; }
.bulk-sum .bad { color: var(--bad); }
.bulk-bad { list-style: none; font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; }

/* Escáner */
.scan-ov { padding: 0; align-items: center; background: rgba(4, 14, 24, .88); }
.scan-box { position: relative; width: min(520px, 100%); display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 16px; }
.scan-box video { width: 100%; max-height: 64vh; border-radius: 18px; background: #000; object-fit: cover; }
.scan-frame { position: absolute; top: 50%; left: 50%; width: 56%; aspect-ratio: 1; transform: translate(-50%, -62%); border: 3px solid rgba(255, 255, 255, .9); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .25); pointer-events: none; }
.scan-msg { color: #fff; font-size: 15px; font-weight: 600; text-align: center; }
.scan-close { color: #fff; border-color: rgba(255, 255, 255, .4); padding: 10px 22px; font-size: 14px; }

/* Guía de puesta en marcha */
.guide { border-color: var(--chip-border); }
.guide-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.guide-bar { width: 160px; height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.guide-bar i { display: block; height: 100%; background: var(--ok); border-radius: 4px; }
.guide-steps { list-style: none; margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.guide-steps li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; }
.guide-steps li.now { background: var(--chip); }
.gs-n { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: var(--field); font: 700 13px var(--font-ui); color: var(--muted); }
.guide-steps li.ok .gs-n { background: var(--ok); color: #fff; }
.guide-steps li.now .gs-n { background: var(--accent); color: #fff; }
.gs-main { flex: 1; min-width: 0; }
.gs-main b { display: block; font-size: 14px; }
.guide-steps li.ok .gs-main b { color: var(--muted); font-weight: 500; }
.gs-main small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.guide-steps button { white-space: nowrap; padding: 8px 14px; }

@media (max-width: 760px) {
  .inst-wrap { padding: 12px 12px 28px; }
  .inst-card { padding: 16px 16px 18px; border-radius: 16px; }
  .steps span { display: none; }
  .steps li { justify-content: center; }
  .two { grid-template-columns: 1fr; }
  .type-grid { grid-template-columns: repeat(4, 1fr); }
  .type-grid button span { font-size: 10px; }
  .gallery, .thumbs { grid-template-columns: repeat(3, 1fr); }
  .guide-head { flex-direction: column; align-items: flex-start; }
  .guide-steps li { flex-wrap: wrap; }
  .guide-steps button { margin-left: 40px; }
}
.dev-row-tags { display: flex; gap: 5px; margin-top: 4px; flex-wrap: wrap; }
.dev-row-tags .org-chip { max-width: 100%; }
.ws-pill { white-space: nowrap; }
.ma-who { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.ma-who b { color: var(--text); }
.ma-move { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 12px; background: var(--field); }
.ma-move:empty { display: none; }
.ma-move .mv-ico { font-size: 20px; }
.ma-move b { display: block; font-size: 13.5px; }
.ma-move small { display: block; font-size: 12px; color: var(--muted); }
.activity { list-style: none; display: flex; flex-direction: column; max-height: 260px; overflow-y: auto; }
.activity li { display: flex; align-items: center; gap: 11px; padding: 8px 2px; border-bottom: 1px solid var(--border); }
.activity li:last-child { border-bottom: none; }
.act-ico { width: 30px; height: 30px; flex-shrink: 0; border-radius: 9px; display: grid; place-items: center; background: var(--field); font-size: 14px; }
.act-ico.crit { background: rgba(220, 61, 72, .12); }
.act-ico.warn { background: rgba(212, 136, 6, .13); }
.activity li > div { flex: 1; min-width: 0; }
.activity b { display: block; font-size: 13px; font-weight: 600; }
.activity small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity time { font: 600 11.5px var(--font-mono); color: var(--muted); white-space: nowrap; }
/* Configurador Bluetooth propio (sin la app del fabricante) */
.ble-btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px; font-size: 14px; font-weight: 600; color: var(--accent); }
.ble-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin: 0; }
.ble-panel { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--chip-border); background: var(--chip); }
.ble-head { display: flex; align-items: center; justify-content: space-between; }
.ble-head b { font-size: 15px; }
.ble-facts { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.ble-facts li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 11px; border-radius: 10px; background: var(--surface); font-size: 13px; }
.ble-facts li span { color: var(--muted); }
.ble-facts li b { font: 600 12.5px var(--font-mono); text-align: right; }
.ble-facts li.bad b { color: var(--accent); }
.ble-facts li.ok b { color: var(--ok); }
.ble-opt { font-size: 12.5px; line-height: 1.4; align-items: flex-start; }
.ble-log summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.ble-log pre { margin-top: 6px; max-height: 160px; overflow: auto; padding: 8px; border-radius: 8px; background: var(--surface); font: 11px/1.45 var(--font-mono); color: var(--muted); white-space: pre-wrap; }
.ble-panel .hint.warn { color: var(--text); border-left: 3px solid var(--warn); padding-left: 9px; }

/* ¿Qué vas a instalar? */
.kind-pick { width: min(620px, 100%); display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.kind-pick button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px 10px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.kind-pick button svg { width: 26px; height: 26px; margin-bottom: 4px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.kind-pick button b { font-size: 14px; }
.kind-pick button small { font-size: 11.5px; color: var(--muted); }
.kind-pick button:hover { border-color: var(--chip-border); }
.kind-pick button.on { border-color: var(--accent); background: var(--chip); }
.kind-pick button.on svg, .kind-pick button.on b { color: var(--accent); }

/* Ayuda «?» junto a un campo */
.q-help { width: 18px; height: 18px; margin-left: 4px; padding: 0; border-radius: 50%; border: 1px solid var(--chip-border); background: var(--chip); color: var(--accent); font: 700 11px var(--font-ui); line-height: 1; vertical-align: 1px; cursor: pointer; }
.q-help:hover { background: var(--accent); color: #fff; }

/* Antena / ancla: ubicación, consejos y datos para configurar */
.geo-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 13px; background: var(--chip); border: 1px solid var(--chip-border); }
.geo-box .hint { margin: 0; flex: 1; min-width: 180px; }
.geo-box .ghost-btn { padding: 9px 14px; font-weight: 600; }
.tips.left { margin: 0; max-width: none; }
.cfg-rows { list-style: none; display: flex; flex-direction: column; gap: 6px; margin: 12px 0; text-align: left; }
.cfg-rows li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 11px; background: var(--field); font-size: 13px; }
.cfg-rows li span { color: var(--muted); flex: 0 0 42%; }
.cfg-rows li b { flex: 1; font-weight: 600; word-break: break-all; }
.cfg-rows li b.mono { font-family: var(--font-mono); font-size: 12.5px; }
.cfg-rows .copy { padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer; }
.wait-line { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 13px; }
.wait-line .pulse-dots { margin: 0; }

/* Activos: elegir rastreadores y configurar a distancia */
.fleet .col-sel { width: 34px; padding-right: 0; }
.fleet .col-sel input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.fleet.no-sel .col-sel { display: none; }
.pend-chip { display: block; width: max-content; margin-top: 3px; padding: 1px 7px; border-radius: 999px; background: var(--chip); color: var(--accent); font-size: 11px; font-weight: 600; }
.sel-bar { position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; width: max-content; max-width: 100%; margin: 12px auto 0; padding: 9px 10px 9px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--chip-border); box-shadow: 0 12px 30px rgba(8, 24, 38, .18); font-size: 13.5px; font-weight: 600; }
.sel-bar .primary, .sel-bar .ghost-btn { padding: 8px 14px; font-size: 13px; }
.seg.seg3 { grid-template-columns: repeat(3, 1fr); }
.remote-box, #new-asset-form { width: min(520px, 100%); }
.mr-who { font-size: 13.5px; color: var(--muted); }
.mr-who b, .mr-who code { color: var(--text); }
.mr-how { font-size: 12.5px; color: var(--muted); }
.remote-sec { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.cmd-list { list-style: none; width: 100%; display: flex; flex-direction: column; gap: 6px; }
.cmd-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 11px; border-radius: 10px; background: var(--field); }
.cmd-list li div { flex: 1; min-width: 150px; }
.cmd-list b { font-size: 13px; }
.cmd-list small { display: block; font-size: 11.5px; color: var(--muted); }
.cmd-st { font-size: 12px; font-weight: 600; color: var(--muted); }
.cmd-st.ok { color: var(--ok); }
.cmd-st.wait { color: var(--accent); }
.cmd-st.bad { color: var(--text); border-left: 3px solid var(--warn); padding-left: 7px; }
.link-btn { padding: 0; border: none; background: none; color: var(--accent); font-size: 12px; font-weight: 600; text-decoration: underline; cursor: pointer; }
.sub-note { font: 500 12px var(--font-ui); color: var(--muted); margin-left: 6px; }

/* Administración: activos de la empresa */
.sec-head:has(> button) { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.sec-head > button { padding: 9px 16px; font-size: 13.5px; flex-shrink: 0; }
.org-assets { display: flex; flex-direction: column; gap: 6px; }
.oa-row { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.oa-row:hover { border-color: var(--chip-border); background: var(--chip); }
.oa-row .am-pin { width: 34px; height: 34px; border-width: 2px; box-shadow: none; }
.oa-main { flex: 1; min-width: 0; }
.oa-main b { display: block; font-size: 14px; }
.oa-main small, .oa-tr small { font-size: 12px; color: var(--muted); }
.oa-tr { text-align: right; display: flex; flex-direction: column; gap: 1px; }
.oa-tr code { font: 600 12px var(--font-mono); }

/* Instalar: el rastreador ya está puesto en otro activo */
.tracker-found.warn { background: rgba(212, 136, 6, .1); border-color: rgba(212, 136, 6, .45); }
.tracker-found.warn .ok-ico { background: var(--warn); }
.warn-t { color: var(--text); }

/* Permisos de traslado */
.perm-wrap { flex: 1; overflow-y: auto; padding: 22px 20px 48px; display: flex; flex-direction: column; gap: 14px; max-width: 900px; margin: 0 auto; }
.perm-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.perm-head h2 { font-size: 20px; }
.perm-head .hint { margin: 4px 0 0; max-width: 560px; }
.perm-head .primary { padding: 10px 18px; }
.seg.seg4 { grid-template-columns: repeat(4, 1fr); }
.seg .count-chip:empty { display: none; }
.perm-list { display: flex; flex-direction: column; gap: 10px; }
.perm-empty { padding: 26px; text-align: center; border: 1px dashed var(--border); border-radius: 14px; }
.perm-card { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border); }
.perm-card.ph-pendiente { border-left-color: var(--accent); }
.perm-card.ph-vigente { border-left-color: var(--ok); }
.perm-card header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.perm-when { margin-left: auto; color: var(--muted); font-weight: 600; }
.perm-st { padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--field); color: var(--muted); }
.perm-st.ok { background: rgba(18, 160, 102, .12); color: var(--ok); }
.perm-st.wait { background: var(--chip); color: var(--accent); }
.perm-st.bad { background: rgba(220, 61, 72, .1); color: var(--text); }
.pa-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pa-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px 4px 6px; border-radius: 9px; background: var(--field); font-size: 12.5px; font-weight: 600; }
.pa-chip svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.pa-more { font-size: 12.5px; color: var(--muted); align-self: center; }
.perm-dl { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 13px; }
.perm-dl dt { font-size: 11.5px; color: var(--muted); }
.perm-dl dd { font-weight: 600; }
.perm-meta { font-size: 12px; color: var(--muted); }
.perm-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.perm-actions .primary, .perm-actions .ghost-btn { padding: 8px 14px; font-size: 13px; }
.perm-note { flex: 1; min-width: 160px; height: 36px; padding: 0 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: 500 13px var(--font-ui); }
.perm-chip { display: block; width: max-content; margin-top: 3px; padding: 1px 7px; border-radius: 999px; background: rgba(18, 160, 102, .12); color: var(--ok); font-size: 11px; font-weight: 700; }
.ma-permit { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 11px; background: rgba(18, 160, 102, .08); border: 1px solid rgba(18, 160, 102, .3); font-size: 13px; }
.ma-permit.pendiente { background: var(--chip); border-color: var(--chip-border); }
.ma-permit small { color: var(--muted); font-size: 12px; }
.permit-box { width: min(560px, 100%); }
.pm-count { font-weight: 700; color: var(--accent); margin-left: 6px; }
.pm-assets { display: flex; flex-direction: column; gap: 4px; max-height: 210px; overflow-y: auto; margin-top: 6px; padding: 4px; border: 1px solid var(--border); border-radius: 11px; }
.modal-box label.pm-row { flex-direction: row; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px; cursor: pointer; color: var(--text); font-weight: 500; }
.pm-row:hover { background: var(--chip); }
.pm-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.pm-row .am-pin { width: 28px; height: 28px; border-width: 1.5px; box-shadow: none; }
.pm-row b { display: block; font-size: 13px; }
.pm-row small { font-size: 11.5px; color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--chip-border); background: var(--chip); color: var(--accent); font-size: 12px; font-weight: 600; cursor: pointer; }

/* Inventario */
.inv-tabs { width: min(760px, 100%); }
.inv-sec { width: min(760px, 100%); display: flex; flex-direction: column; gap: 16px; align-items: center; }
.inv-sec > .inst-card { width: 100%; }
.inv-list { display: flex; flex-direction: column; gap: 6px; }
.inv-row { display: grid; grid-template-columns: 1.3fr 1.2fr 1fr minmax(150px, 1fr); gap: 10px; align-items: center; padding: 9px 12px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; }
#inv-list-antenas .inv-row, #inv-list-anclas .inv-row { grid-template-columns: 1.4fr 1.2fr minmax(150px, 1fr); }
.inv-main b, .inv-main code { display: block; font-weight: 600; }
.inv-main code { font: 600 12.5px var(--font-mono); }
.inv-main small, .inv-st small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.inv-st { font-weight: 600; color: var(--muted); }
.inv-st.ok { color: var(--ok); }
.inv-st.bad { color: var(--text); }
.inv-org { width: 100%; height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: 500 12.5px var(--font-ui); }
@media (max-width: 700px) { .inv-row, #inv-list-antenas .inv-row, #inv-list-anclas .inv-row { grid-template-columns: 1fr 1fr; } }

/* Manual */
.man-wrap { flex: 1; overflow-y: auto; padding: 22px 20px 60px; max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.man-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.man-head h2 { font: 700 24px var(--font-brand); }
.man-head .hint { margin: 4px 0 0; }
.man-head .search-in { width: min(280px, 100%); }
.man-toc { display: flex; flex-wrap: wrap; gap: 6px; }
.man-toc a { padding: 5px 11px; border-radius: 999px; background: var(--field); color: var(--text); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.man-toc a:hover { background: var(--chip); color: var(--accent); }
.man-sec { margin-top: 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.man-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 12px; }
@media (max-width: 520px) { .man-grid { grid-template-columns: 1fr; } }
.man-card { display: grid; grid-template-columns: 120px 1fr; gap: 14px; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); scroll-margin-top: 16px; }
@media (max-width: 520px) { .man-card { grid-template-columns: 1fr; } .man-ill { max-width: 160px; } }
.man-ill { align-self: start; padding: 8px; border-radius: 12px; background: var(--chip); color: var(--accent); }
.man-body h4 { font-size: 15.5px; margin-bottom: 8px; }
.man-body ol { padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; line-height: 1.45; }
.man-body li::marker { color: var(--accent); font-weight: 700; }
.man-body code { font: 600 12px var(--font-mono); background: var(--field); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
.man-note { margin-top: 10px; padding: 8px 10px; border-radius: 9px; background: var(--field); font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.ill { width: 100%; height: auto; display: block; }
.ill .ill-bg { fill: var(--surface); stroke: var(--chip-border); stroke-width: 2; }
.ill .ill-stroke { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ill .ill-line { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 5 6; opacity: .7; }
.ill .ill-scan { stroke: var(--bad); stroke-width: 3; }
.ill .ill-fill { fill: currentColor; }
.ill .ill-fill2 { fill: var(--chip); stroke: currentColor; stroke-width: 3; stroke-linejoin: round; }
.ill .ill-okline { fill: none; stroke: var(--ok); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.ill .ill-ok { fill: var(--ok); } .ill .ill-warn { fill: var(--warn); } .ill .ill-off { fill: var(--off, #7c90ab); } .ill .ill-bad { fill: var(--bad); }
.ill .ill-ring { fill: none; stroke: var(--bad); stroke-width: 2.5; opacity: .5; }
.ill .ill-zone { fill: rgba(92, 200, 255, .12); stroke: currentColor; stroke-width: 2.5; stroke-dasharray: 6 5; }
.ill .ill-mag { fill: var(--bad); }
.ill .ill-t { font: 700 15px var(--font-ui); fill: currentColor; }

/* Pantalla de inicio: Frost cae rebotando, las letras saltan una por una y nieva; al salir, se agranda y se desvanece.
   Solo transform y opacity (lo mueve la tarjeta gráfica): fluido aunque la app esté cargando. */
#splash { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 35%, #8ddcfe 0%, #63cdfd 55%, #45bef6 100%); will-change: opacity; }
#splash.out { pointer-events: none; animation: sp-out .6s cubic-bezier(.4, 0, .2, 1) forwards; }
#splash.out .sp-in { animation: sp-leave .55s cubic-bezier(.4, 0, .2, 1) forwards; }
@keyframes sp-out { to { opacity: 0; } }
@keyframes sp-leave { to { transform: scale(1.08); opacity: 0; } }
.sp-in { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; will-change: transform, opacity; }
.sp-in img { position: relative; width: min(250px, 46vw); height: auto; transform-origin: 50% 100%; will-change: transform, opacity;
  animation: sp-drop 1s cubic-bezier(.3, 1.45, .5, 1) both, sp-float 2.8s 1.1s ease-in-out infinite; }
@keyframes sp-drop { 0% { opacity: 0; transform: translateY(-60vh) scale(.9); } 55% { opacity: 1; transform: translateY(0) scale(1.06, .9); } 75% { transform: translateY(-14px) scale(.97, 1.04); } 100% { transform: none; } }
@keyframes sp-float { 50% { transform: translateY(-7px); } }
.sp-in::before { content: ''; position: absolute; top: calc(min(250px, 46vw) * 1.1); left: 50%; width: min(190px, 34vw); height: 26px; margin-left: calc(min(190px, 34vw) / -2);
  border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 80, 130, .25), transparent); animation: sp-shadow 1s cubic-bezier(.3, 1.45, .5, 1) both; }
@keyframes sp-shadow { 0% { opacity: 0; transform: scale(.3); } 55% { opacity: 1; transform: scale(1.1); } 100% { transform: none; } }
.sp-name { display: flex; margin-top: 8px; font: 700 clamp(56px, 14vw, 92px)/1 'Fredoka', var(--font-ui); letter-spacing: .02em; color: #fff;
  text-shadow: 0 4px 0 rgba(0, 110, 170, .16), 0 10px 24px rgba(0, 90, 140, .18); }
.sp-name i { font-style: normal; display: inline-block; will-change: transform, opacity; animation: sp-letter .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.sp-name i:nth-child(1) { animation-delay: .6s; } .sp-name i:nth-child(2) { animation-delay: .67s; } .sp-name i:nth-child(3) { animation-delay: .74s; }
.sp-name i:nth-child(4) { animation-delay: .81s; } .sp-name i:nth-child(5) { animation-delay: .88s; }
@keyframes sp-letter { from { opacity: 0; transform: translateY(30px) scale(.4); } }
.sp-sub { font: 600 15px 'Fredoka', var(--font-ui); color: rgba(5, 48, 73, .7); letter-spacing: .06em; animation: sp-up .5s 1.1s both; }
@keyframes sp-up { from { opacity: 0; transform: translateY(10px); } }
.sp-snow i { position: absolute; top: -12px; left: var(--x); width: var(--s); height: var(--s); border-radius: 50%; background: #fff; opacity: .85; will-change: transform;
  animation: sp-fall var(--t) var(--d) linear infinite; }
@keyframes sp-fall { to { transform: translate3d(30px, 112vh, 0); } }
/* Al recargar: todo ya en su lugar, sin animación de entrada (así nunca se corta a la mitad) */
.sp-quick .sp-in img, .sp-quick .sp-in::before, .sp-quick .sp-name i, .sp-quick .sp-sub { animation: none; }
.sp-quick .sp-in { animation: sp-quick-in .25s ease-out both; }
@keyframes sp-quick-in { from { opacity: 0; transform: scale(.96); } }
@media (prefers-reduced-motion: reduce) { .sp-in img, .sp-in::before, .sp-name i, .sp-sub, .sp-snow i, .sp-in { animation: none !important; } #splash.out { animation: sp-out .3s forwards; } }
.frost-mini { width: 110px; height: auto; display: block; margin: 0 auto 6px; }

/* Celular: barra de abajo con 5 botones (Mapa · Activos · ＋ · Alertas · Más) y hoja «Más» */
.nav-more { display: none; }
@media (max-width: 760px) {
  .rail-nav { display: contents; }
  .rail-foot { display: none; }
  .rail .nav-item { display: none; }
  .rail .nav-item[data-tab="mapa"], .rail .nav-item[data-tab="equipos"], .rail .nav-item[data-tab="alertas"], .rail .nav-more { display: flex; position: relative; }
  .rail .nav-item.hidden { display: none !important; }
  .rail .nav-item[data-tab="mapa"] { order: 1; }
  .rail .nav-item[data-tab="equipos"] { order: 2; }
  .rail .nav-cta { order: 3; flex: 0 0 56px; width: 56px; height: 56px; padding: 0; margin: -22px 6px 0; border-radius: 19px; justify-content: center; box-shadow: 0 10px 22px rgba(30, 150, 210, .35); }
  .rail .nav-cta span { display: none; }
  .rail .nav-cta svg { width: 24px; height: 24px; }
  .rail .nav-item[data-tab="alertas"] { order: 4; }
  .rail .nav-more { order: 5; }
  .rail .nav-item .badge { position: absolute; top: 2px; left: calc(50% + 4px); }
  .guide-steps li { flex-wrap: wrap; }
  .guide-steps .gs-main { flex: 1 1 180px; }
  .guide-steps button { margin-left: 40px; }
}
.sheet-ov { align-items: flex-end; padding: 0; z-index: 2000; }
.sheet { width: min(520px, 100%); max-height: 86dvh; overflow-y: auto; background: var(--panel); border-radius: 22px 22px 0 0; padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -12px 40px rgba(8, 40, 60, .25); animation: sheet-up .22s ease-out; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--border-hi); margin: 4px auto 10px; }
.more-me { display: flex; align-items: center; gap: 12px; padding: 8px 10px 14px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.more-me .avatar { width: 40px; height: 40px; font-size: 17px; }
.more-me b { display: block; font-size: 15px; }
.more-me small { font-size: 12px; color: var(--muted); }
.more-list { display: flex; flex-direction: column; }
.more-item { display: flex; align-items: center; gap: 14px; padding: 13px 10px; border: none; border-radius: 12px; background: none; color: var(--text); font: 600 15px var(--font-ui); text-align: left; }
.more-item svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); flex-shrink: 0; }
.more-item .i-sun { display: none; }
.more-item.on { background: var(--chip); color: var(--accent); }
.more-item.on svg { color: var(--accent); }
.more-item.danger { color: var(--bad); }
.more-item .badge { margin-left: auto; position: static; }
@media (max-width: 760px) {
  /* Activos en el celular: buscar, estado y «＋ Activo»; lo de escritorio (importar, exportar, configurar) se queda en el computador */
  #fleet-import, #fleet-csv, #fleet-remote { display: none !important; }
  #fleet-new { font-weight: 700; color: var(--accent); }
  .fleet .col-batt { display: none; }
  .table-wrap { overflow-x: hidden; }
  /* Instalar: las tres opciones en una fila */
  .kind-pick { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .kind-pick button { padding: 10px 4px 8px; }
  .kind-pick button small { display: none; }
  .inst-wrap { padding: 14px 12px 40px; }
  .inst-card { padding: 16px 14px 18px; }
  .sel-bar { bottom: 74px; }
}
@media (max-width: 760px) {
  /* Activos en el celular: tarjetas (nombre arriba, cuándo reportó abajo, estado a la derecha) */
  .table-wrap { padding: 12px 10px 90px; }
  .fleet thead { display: none; }
  .fleet, .fleet tbody { display: block; width: 100%; }
  .fleet tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "sel name st" "sel seen st"; align-items: center; column-gap: 10px;
    padding: 10px 10px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
  .fleet td { display: block; padding: 0 !important; border: 0 !important; background: none; }
  .fleet td.col-sel { grid-area: sel; }
  .fleet.no-sel td.col-sel { display: none; }
  .fleet td.dev-name { grid-area: name; min-width: 0; }
  .fleet td.col-seen { grid-area: seen; font-size: 12px; color: var(--muted); padding-left: 44px !important; }
  .fleet td.col-seen .td-sub { display: none; }
  .fleet td.col-st { grid-area: st; text-align: right; }
  .fleet .st-label { font-size: 11.5px; gap: 5px; }
  .fleet td.dev-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
  .fleet td.col-place, .fleet td.col-org, .fleet td.col-batt, .fleet td.col-iv, .fleet td.td-right { display: none; }
  .fleet tr.fleet-empty { display: block; }
  .fleet .name-cell > span:last-child { min-width: 0; }
}
/* Diagnóstico de radio de la antena */
.diag { margin: 8px 0 4px; padding: 9px 12px; border-radius: 11px; background: var(--field); font-size: 13px; line-height: 1.45; text-align: left; color: var(--text); }
.diag b { margin-right: 4px; }
.diag.ok { background: rgba(18, 160, 102, .1); }
.diag.ok b { color: var(--ok); }
.diag.warn, .diag.bad { border-left: 3px solid var(--warn); }
.diag.bad { border-left-color: var(--bad); }
.inv-st .link-btn { display: block; margin-top: 3px; }
/* Selector de empresa: en el celular, pastilla corta con ícono (el select nativo queda encima, invisible) */
.org-chip-m { display: none; }
@media (max-width: 760px) {
  .org-switch { position: relative; }
  .org-chip-m { display: flex; align-items: center; gap: 6px; height: 40px; max-width: 150px; padding: 0 9px 0 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font: 600 13px var(--font-ui); color: var(--text); }
  .org-chip-m b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
  .org-chip-m svg { width: 17px; height: 17px; flex-shrink: 0; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .org-chip-m .chev { width: 14px; height: 14px; stroke: var(--muted); }
  .org-switch select { position: absolute; inset: 0; width: 100%; min-width: 0; max-width: none; opacity: 0; cursor: pointer; }
}
/* Instalar como app */
.login-install { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 12px; padding: 11px; border: 1.5px dashed rgba(6, 120, 176, .45); border-radius: 14px; background: rgba(255, 255, 255, .55); color: #0678b0; font: 600 14.5px 'Fredoka', var(--font-ui); cursor: pointer; }
.login-install svg, .more-install svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.login-install.hidden { display: none; }
.more-item.more-install { color: var(--accent); }
.more-item.more-install svg { color: var(--accent); }
.install-box { text-align: center; align-items: center; }
.mi-icon { border-radius: 18px; box-shadow: 0 8px 20px rgba(30, 150, 210, .3); }
.mi-steps { text-align: left; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14.5px; line-height: 1.45; }
.mi-ico { display: inline-block; padding: 0 6px; border-radius: 6px; background: var(--chip); color: var(--accent); }

/* ===== Celular (03-10): alto real de la pantalla, barra de abajo, sin desbordes ===== */
/* 100vh en el celular incluye lo que tapa la barra del navegador: 100dvh es lo que realmente se ve */
.app { height: 100vh; height: 100dvh; }
@media (max-width: 760px) {
  html { touch-action: manipulation; }           /* sin zoom por doble toque */
  body { overflow-x: hidden; }
  /* El iPhone hace zoom al tocar un campo con letra < 16 px y no vuelve: se dejan en 16 px */
  input, select, textarea, .alert-filters input[type="search"], .modal-box input { font-size: 16px; }
  /* Barra de abajo: alto propio + la franja del gesto de inicio (antes la franja se comía los botones) */
  .rail { height: calc(66px + env(safe-area-inset-bottom)); padding: 0 4px env(safe-area-inset-bottom); }
  .main { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .rail .nav-item, .rail .nav-more { flex: 1 1 0; min-width: 0; height: 58px; justify-content: center; gap: 4px; padding: 6px 2px; font-size: 11.5px; border-radius: 14px; }
  .rail .nav-item svg, .rail .nav-more svg { width: 24px; height: 24px; }
  .rail .nav-cta { margin: -24px 10px 0; }
  .sel-bar { bottom: calc(76px + env(safe-area-inset-bottom)); }
  /* Mapa: mitad mapa, mitad lista; los 4 estados en una sola fila de pastillas */
  #panel-mapa .map-wrap { flex: 1 1 52%; }
  #panel-mapa .sidebar { flex: 1 1 48%; padding: 12px 12px 20px; }
  #panel-mapa .sidebar-head { margin-bottom: 4px; }
  #fit-btn { display: none; }                      /* ya está «Centrar» sobre el mapa */
  .list-tools { gap: 8px; margin: 2px 0 10px; }
  .dev-filter { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px; }
  .dev-filter::-webkit-scrollbar { display: none; }
  .dev-filter button { flex: 1 0 auto; justify-content: center; padding: 7px 9px; font-size: 12.5px; border-radius: 999px; gap: 5px; }
  .dev-filter button b { margin-left: 2px; }
  /* Alertas: filtros que caben y cada alerta como tarjeta (la tabla no cabe en el celular) */
  .table-head .alert-filters > * { min-width: 0; width: 100%; }
  .table-head .alert-filters #ack-all { grid-column: 1 / -1; }
  #panel-alertas .table-wrap { padding: 12px 10px 24px; overflow-y: auto; }
  #panel-alertas table, #panel-alertas tbody { display: block; width: 100%; }
  #panel-alertas thead { display: none; }
  #panel-alertas tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 12px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
  #panel-alertas tr.unack { border-left: 3px solid var(--bad); }
  #panel-alertas td { display: block; padding: 0 !important; border: 0 !important; background: none; font-size: 13.5px; }
  #panel-alertas td:nth-child(1) { order: 1; flex: 1 1 100%; font-size: 12px; color: var(--muted); }
  #panel-alertas td:nth-child(1) .td-sub { display: inline; margin-left: 6px; }
  #panel-alertas td:nth-child(2) { order: 0; flex: 1 1 100%; font-size: 15px; }
  #panel-alertas td:last-child { order: 9; margin-left: auto; }
  #panel-alertas td:empty { display: none; }
  #panel-alertas td[colspan] { flex: 1 1 100%; }
  /* Inicio de sesión: los créditos siempre a la vista, sobre la nieve y fuera de la franja del gesto */
  .login-scene { padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
  /* fija abajo: el navegador nunca la tapa, aunque la escena no quepa entera */
  .login-credit { position: fixed; bottom: calc(6px + env(safe-area-inset-bottom)); left: 50%; right: auto; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); padding: 5px 14px; border-radius: 14px; background: rgba(255, 255, 255, .82); backdrop-filter: blur(6px); }
  .guard { margin-bottom: 2vh; }
}
@media (max-width: 760px) and (max-height: 720px) {
  .guard { width: min(70vw, 290px); }
  .login-hello { margin: 4px 0 14px; }
}

/* Motivo de un fallo de posición, bajo la alerta en la ficha del rastreador (05-10) */
.dev-events .ev-why { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; font-weight: 400; }
#ble-gps-warn { margin: 2px 0 10px; }

/* ===== 05-10 tarde: lo que pidió Brandon tras la prueba en terreno ===== */
/* Batería como estado (no %): la pila marca ~3,6 V casi toda su vida */
.batt-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.batt-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.batt-state.bad { color: var(--bad); }
.batt-state.bad i { background: var(--bad); }
.batt-state small { font: 500 11px var(--font-mono); color: var(--muted); }
.spark-title b.bad { color: var(--bad); }
/* Activos: rastreador sin activo, distinto de los activos y con el código legible */
.fleet tr.no-asset-row .am { opacity: .55; }
.fleet tr.no-asset-row b { font-weight: 600; color: var(--muted); }
.fleet code.eui { font-size: 11.5px; letter-spacing: .02em; color: var(--muted); }
.fleet code.eui b { color: var(--text); font-weight: 700; }
/* Una alerta en grande */
.alert-box { width: min(460px, 100%); gap: 10px; }
.al-head { display: flex; align-items: center; justify-content: space-between; }
.al-who { font-size: 14px; line-height: 1.5; }
.al-who span { color: var(--muted); font-size: 12.5px; }
.al-what { font-size: 14px; line-height: 1.55; }
.al-todo { font-size: 13px; line-height: 1.55; padding: 10px 12px; border-radius: 12px; background: var(--field); border: 1px solid var(--border); }
.al-ok { font-size: 13px; color: var(--ok); font-weight: 600; }
tr.ev-row, li.tappable, .dev-events li[data-ev] { cursor: pointer; }
tr.ev-row:hover td { background: var(--chip); }
li.tappable:hover { background: var(--chip); border-radius: 10px; }
.toast.tappable { cursor: pointer; }
.dev-events li.resolved { opacity: .7; }
/* Ficha: qué está pasando ahora + actividad */
.now-note { margin: 8px 0 0; padding: 9px 12px; border-radius: 12px; font-size: 12.5px; line-height: 1.5; background: var(--chip); border: 1px solid var(--chip-border); }
.now-note.warn { background: rgba(212, 136, 6, .1); border-color: rgba(212, 136, 6, .35); }
.now-note.bad { background: rgba(220, 61, 72, .08); border-color: rgba(220, 61, 72, .35); }
.act-tl { list-style: none; margin-top: 6px; display: flex; flex-direction: column; }
.act-tl li { display: flex; align-items: flex-start; gap: 9px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.act-tl li:last-child { border-bottom: none; }
.act-tl i { font-style: normal; width: 20px; text-align: center; flex-shrink: 0; }
.act-tl span { flex: 1; min-width: 0; }
.act-tl b { display: block; font-weight: 600; }
.act-tl small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.act-tl time { font: 500 11px var(--font-mono); color: var(--muted); white-space: nowrap; }
.act-tl li.warn b { color: var(--warn); }
.act-tl li.bad b { color: var(--bad); }
/* Resumen: guía compacta / ocultable y tarjeta de antenas */
.guide-tools { display: flex; align-items: center; gap: 12px; }
.guide.slim { padding: 12px 18px; }
.guide-line { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13.5px; }
.guide-line > span { flex: 1; min-width: 200px; }
.guide-line .guide-bar { width: 90px; }
.guide-line .primary { padding: 8px 14px; font-size: 13px; }
.link-btn { background: none; border: none; color: var(--muted); font-size: 12.5px; text-decoration: underline; padding: 4px; }
.link-btn:hover { color: var(--accent); }
.guide-chip { border: 1px solid var(--chip-border); background: var(--chip); color: var(--accent); border-radius: 999px; padding: 7px 14px; font-size: 12.5px; font-weight: 600; }
.gw-list { list-style: none; margin-top: 10px; display: flex; flex-direction: column; }
.gw-list li { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.gw-list li:last-child { border-bottom: none; }
.gw-list li > i { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); flex-shrink: 0; box-shadow: 0 0 0 4px rgba(220, 61, 72, .14); }
.gw-list li > i.on { background: var(--ok); box-shadow: 0 0 0 4px rgba(18, 160, 102, .14); }
.gw-list .att-main span { white-space: normal; }
.dash-empty .primary { margin-top: 10px; }
/* El + / − del mapa abajo a la derecha, sobre los créditos */
.leaflet-bottom.leaflet-right .leaflet-control-zoom { margin-bottom: 8px; margin-right: 12px; }
@media (max-width: 760px) {
  .guide-line { gap: 10px; }
  .guide-line .guide-bar { display: none; }
}
.fleet .no-asset { font-family: var(--font-ui); }
/* Alcance medido de una antena (Inventario → Antenas) */
.alc-tab { width: 100%; margin: 8px 0 4px; border-collapse: collapse; font-size: 12.5px; }
.alc-tab th { text-align: left; font-weight: 600; color: var(--muted); padding: 4px 6px; border-bottom: 1px solid var(--border); }
.alc-tab td { padding: 4px 6px; border-bottom: 1px solid var(--border); }
.alc-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--st-off); }
.alc-dot.on { background: var(--st-on); } .alc-dot.warn { background: var(--st-warn); } .alc-dot.bad { background: var(--bad); }
.inv-st .link-btn + .link-btn { margin-left: 4px; }
