/* Azor — estilos base de los prototipos (pasan a ser la base visual del sistema).
   Layout: barra superior con el degradé de marca + área de trabajo sobre neutros con tinte índigo. */
:root {
  /* Marca (manual AZOR) */
  --violeta: #5C047F;
  --indigo: #2E3192;
  --azul: #165F97;
  --celeste: #29ABE2;
  --degrade: linear-gradient(120deg, #5C047F 0%, #2E3192 55%, #29ABE2 100%);

  /* Neutros con tinte índigo */
  --bg: #F3F4F9;
  --surface: #FFFFFF;
  --surface-2: #ECEEF6;
  --ink: #161A33;
  --muted: #5B6185;
  --line: #DFE2EE;
  --accent: #165F97;          /* interacción */
  --accent-ink: #FFFFFF;
  --focus: #29ABE2;

  /* Semánticos */
  --ok: #17855A;    --ok-bg: #E2F4EC;
  --warn: #A86500;  --warn-bg: #FCF0D9;
  --crit: #C2263B;  --crit-bg: #FBE4E7;
  --idle: #6B7194;  --idle-bg: #ECEEF6;

  /* Mapa */
  --map-bg: #E9EDE3; --map-field-a: #DCE5CF; --map-field-b: #E6E9D6; --map-field-c: #D3DEC8;
  --map-road: #FFFFFF; --map-road-edge: #C9CDBE; --map-town: #D9D6E3; --map-water: #BFD8EA; --map-label: #4A4F6B;

  /* Tipografía */
  --f-display: "Saira", "Bai Jamjuree", system-ui, sans-serif;
  --f-body: "Bai Jamjuree", system-ui, -apple-system, "Segoe UI", sans-serif;

  --r-sm: 6px; --r-md: 10px; --r-lg: 16px;
  --shadow: 0 1px 2px rgba(22, 26, 51, .06), 0 8px 24px rgba(22, 26, 51, .08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C0E1D; --surface: #151833; --surface-2: #1D2142; --ink: #E8EAF7; --muted: #9AA0C6; --line: #2A2F57;
    --accent: #29ABE2; --accent-ink: #0C0E1D; --focus: #29ABE2;
    --ok: #4CC994; --ok-bg: #12352A; --warn: #F2B24C; --warn-bg: #3A2B10; --crit: #FF6B7D; --crit-bg: #3D1520; --idle: #9AA0C6; --idle-bg: #1D2142;
    --map-bg: #141A26; --map-field-a: #18202D; --map-field-b: #1B2330; --map-field-c: #161D29; --map-road: #2D3550; --map-road-edge: #222A40; --map-town: #262A45; --map-water: #1B3550; --map-label: #9AA0C6;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C0E1D; --surface: #151833; --surface-2: #1D2142; --ink: #E8EAF7; --muted: #9AA0C6; --line: #2A2F57;
  --accent: #29ABE2; --accent-ink: #0C0E1D; --focus: #29ABE2;
  --ok: #4CC994; --ok-bg: #12352A; --warn: #F2B24C; --warn-bg: #3A2B10; --crit: #FF6B7D; --crit-bg: #3D1520; --idle: #9AA0C6; --idle-bg: #1D2142;
  --map-bg: #141A26; --map-field-a: #18202D; --map-field-b: #1B2330; --map-field-c: #161D29; --map-road: #2D3550; --map-road-edge: #222A40; --map-town: #262A45; --map-water: #1B3550; --map-label: #9AA0C6;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--f-display); line-height: 1.15; margin: 0; text-wrap: balance; letter-spacing: .01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
.label {
  font-family: var(--f-display); font-size: .72rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Logos (recorte del PNG cuadrado del manual) ---------- */
.iso { display: block; width: 30px; height: 30px; overflow: hidden; position: relative; flex: none; }
.iso img { position: absolute; width: 60px; max-width: none; left: -17.4px; top: -15px; }
.wordmark { display: block; width: 220px; height: 90px; overflow: hidden; position: relative; }
.wordmark img { position: absolute; width: 325.5px; max-width: none; left: -52.7px; top: -120.5px; }
/* Logo completo en blanco (con "SEGUIMIENTO SATELITAL") para las barras con degradé. */
.logo-odos { display: block; height: 38px; width: auto; max-width: none; flex: none; }

/* ---------- Barra superior ---------- */
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 50; background: var(--indigo);
}
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--degrade); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand b { font-family: var(--f-display); font-weight: 700; letter-spacing: .18em; font-size: 1.05rem; }
.empresa {
  display: flex; align-items: center; gap: 6px; padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; font-size: .85rem; white-space: nowrap;
}
.nav { display: flex; gap: 2px; margin-left: auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
/* "Más": secciones que no entran en la barra (las mueve el script del layout). */
.nav-mas { position: relative; flex: none; }
.nav-mas summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 4px;
  color: rgba(255, 255, 255, .82); padding: 6px 10px 6px 12px; border-radius: 999px;
  font-family: var(--f-display); font-weight: 500; font-size: .9rem; white-space: nowrap;
}
.nav-mas summary::-webkit-details-marker { display: none; }
.nav-mas summary svg { width: 14px; height: 14px; transition: transform .15s; }
.nav-mas[open] summary svg { transform: rotate(180deg); }
.nav-mas summary:hover, .nav-mas[open] summary { background: rgba(255, 255, 255, .12); color: #fff; }
.nav-mas.actual summary { background: rgba(255, 255, 255, .2); color: #fff; }
.nav-mas-lista {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 200px; display: grid; gap: 2px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: 0 12px 32px rgba(13, 16, 48, .18);
}
.nav-mas-lista a {
  color: var(--ink); text-decoration: none; padding: 8px 12px; border-radius: 8px;
  font-family: var(--f-display); font-weight: 500; font-size: .9rem; white-space: nowrap;
}
.nav-mas-lista a:hover { background: var(--bg); }
.nav-mas-lista a[aria-current="page"] { background: rgba(41, 168, 224, .16); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav a {
  color: rgba(255, 255, 255, .82); text-decoration: none; padding: 6px 12px; border-radius: 999px;
  font-family: var(--f-display); font-weight: 500; font-size: .9rem; white-space: nowrap;
}
.nav a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, .2); color: #fff; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: rgba(255, 255, 255, .2); font-family: var(--f-display); font-weight: 600; font-size: .8rem;
}
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .nav { order: 3; width: 100%; margin-left: 0; }
  .empresa { margin-left: auto; }
}

/* ---------- Contenedores ---------- */
.page {
  max-width: 1240px; margin: 0 auto;
  padding-block: 24px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid; gap: 20px;
}
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.panel-body { padding: 14px 18px 18px; }

/* ---------- Controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--r-md); padding: 9px 16px; cursor: pointer;
  font-family: var(--f-display); font-weight: 600; font-size: .92rem; text-decoration: none;
  background: var(--accent); color: var(--accent-ink);
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--surface-2); filter: none; }
.btn.small { padding: 6px 12px; font-size: .84rem; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 5px 12px; font-size: .84rem; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip .n { font-variant-numeric: tabular-nums; opacity: .75; }
.input {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-md);
  padding: 10px 12px;
}
.input:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }

/* ---------- Estados ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 2px 10px;
  font-size: .78rem; font-weight: 600; white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: var(--ok-bg); }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.crit { color: var(--crit); background: var(--crit-bg); }
.pill.idle { color: var(--idle); background: var(--idle-bg); }

/* Patente estilo Mercosur */
.patente {
  display: inline-flex; flex-direction: column; align-items: stretch; flex: none;
  border: 1.5px solid #1B1F3B; border-radius: 4px; overflow: hidden; background: #fff; color: #111;
  font-family: var(--f-display); font-weight: 700; line-height: 1; min-width: 74px;
}
.patente::before {
  content: "ARGENTINA"; background: #1C3F94; color: #fff; font-size: 6px; letter-spacing: .2em;
  text-align: center; padding: 2px 4px 1px; font-weight: 600;
}
.patente span { padding: 3px 6px 4px; font-size: .86rem; letter-spacing: .06em; text-align: center; }
.patente.lg { min-width: 132px; border-width: 2px; border-radius: 6px; }
.patente.lg::before { font-size: 9px; padding: 3px 6px 2px; }
.patente.lg span { font-size: 1.55rem; padding: 6px 10px 8px; }

/* Íconos de vehículo (sprite en línea, símbolos #ico-*) */
.vico { width: 20px; height: 20px; flex: none; vertical-align: -4px; color: var(--muted); }
.vico.lg { width: 30px; height: 30px; color: var(--ink); }

/* Aviso de prototipo */
.proto-note {
  font-size: .78rem; color: var(--muted); text-align: center;
  padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
