/* LV-302 · capa de identidad: profundidad, láminas con ilustración y movimiento suave.
 *
 * Pedido del usuario (2026-10-13): que la aplicación deje de verse «plana y todo
 * cuadrada», más cercana a AeroAcademy, con figuras e imágenes de drones y animaciones.
 *
 * Se carga DESPUÉS de `app.css` y sólo suma: no redefine ningún token ni cambia ningún
 * color de estado. La paleta, los contrastes medidos y el tema oscuro siguen siendo los
 * de `app.css`; esta capa agrega relieve y personalidad encima.
 *
 * Reglas que respeta:
 *   - Los dibujos llevan trazo oscuro, así que van SIEMPRE sobre una lámina clara
 *     (`.illus-tile`), también en el tema oscuro: es la metáfora de «papel de plano» de
 *     AeroAcademy y evita un dibujo ilegible sobre fondo azul noche.
 *   - Toda `animation` vive dentro de `prefers-reduced-motion: no-preference`
 *     (lo vigila `apps/core/test_lv302_illustrations.py`).
 *   - Sin fuentes web ni imágenes externas.
 */

:root {
  --id-paper: #faf8f3;
  --id-paper-edge: #e4dfd1;
  --id-ink: #1f2430;
  --id-lift: 0 1px 2px rgb(16 24 40 / 8%), 0 12px 26px -14px rgb(16 24 40 / 32%);
}

/* ── Tokens de la identidad (LV-315, ola 0) ─────────────────────────────────
 * Escalas para que las olas de rediseño no inventen números: tipografía (razón 1,25 sobre
 * 16 px), espaciado (base 8 px), radios, sombras y movimiento. Sólo prefijo `--id-`: nunca se
 * redefine `--ac-*` ni `--sev-*` (lo vigila `test_lv315_identity_foundation.py`). Ninguna regla
 * los usa todavía; esta ola no cambia nada visible. */
:root {
  --id-fs-sm: 0.8125rem;
  --id-fs-md: 1rem;
  --id-fs-lg: 1.25rem;
  --id-fs-xl: 1.5625rem;
  --id-fs-2xl: 1.9375rem;

  --id-sp-1: 0.5rem;
  --id-sp-2: 1rem;
  --id-sp-3: 1.5rem;
  --id-sp-4: 2.5rem;

  --id-r-control: 8px;
  --id-r-card: 12px;
  --id-r-modal: 20px;
  --id-r-pill: 999px;

  --id-lift-2: 0 2px 4px rgb(16 24 40 / 10%), 0 22px 40px -16px rgb(16 24 40 / 40%);

  /* Visual v3 (LV-367, fase 1). Borde de figuras y tarjetas con >= 3:1 (WCAG 1.4.11) contra `--ac-bg`, `--ac-surface` y `--id-tile`; superficie interna de las tarjetas nuevas. `--ac-border` (1,12:1 contra la tarjeta) sigue siendo el trazo decorativo. */
  --id-edge: #7d8aa0;
  --id-tile: #f7f9fc;

  --id-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --id-t-fast: 120ms;
  --id-t-base: 180ms;

  /* «Correcto» para `.id-chip--ok`: la app no tiene `--sev-ok`, así que se toma la paleta de
     su insignia de éxito (`.badge.bg-success-subtle`, app.css), que ya tiene el contraste medido. */
  --id-ok-bg: #e4f6ea;
  --id-ok-border: #a7d9b8;
  --id-ok-text: #1f7a43;
}

[data-theme="dark"] {
  --id-lift-2: 0 2px 4px rgb(0 0 0 / 45%), 0 24px 44px -16px rgb(0 0 0 / 80%);
  --id-edge: #6c81a3;
  --id-tile: #1f2b3e;
  --id-ok-bg: #14361f;
  --id-ok-border: #2c6b40;
  --id-ok-text: #7fd6a0;
}

/* ── Chip de estado compartido (LV-315) ─────────────────────────────────────
 * Texto + color (nunca sólo color). Lee los tokens `--sev-*` ya medidos; el contraste de cada
 * variante en claro y oscuro lo calcula `test_lv315_identity_foundation.py`. */
.id-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.15em 0.65em;
  border: 1px solid var(--sev-nominal-border);
  border-radius: var(--id-r-pill);
  background: var(--sev-nominal-bg);
  color: var(--sev-nominal-text);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  line-height: 1.4;
  white-space: nowrap;
}

.id-chip--critical {
  background: var(--sev-critical-bg);
  border-color: var(--sev-critical-border);
  color: var(--sev-critical-text);
}

.id-chip--warning {
  background: var(--sev-warning-bg);
  border-color: var(--sev-warning-border);
  color: var(--sev-warning-text);
}

.id-chip--ok {
  background: var(--id-ok-bg);
  border-color: var(--id-ok-border);
  color: var(--id-ok-text);
}

.id-chip--info {
  background: var(--sev-advisory-bg);
  border-color: var(--sev-advisory-border);
  color: var(--sev-advisory-text);
}

.id-chip--neutral {
  background: var(--sev-nominal-bg);
  border-color: var(--sev-nominal-border);
  color: var(--sev-nominal-text);
}
/* ── Lámina con ilustración ─────────────────────────────────────────────── */
.illus-tile {
  display: inline-grid;
  place-items: center;
  padding: 0.75rem;
  background: var(--id-paper);
  color: var(--id-ink);
  border: 1px solid var(--id-paper-edge);
  border-radius: 20px;
  box-shadow: var(--id-lift);
}

.illus-tile img {
  display: block;
  width: 100%;
  height: auto;
}

.empty-art-wrap {
  padding: 1.25rem 0 0.5rem;
  text-align: center;
}

.empty-art {
  width: min(210px, 70%);
  margin: 0 auto 0.75rem;
}

/* ── Ficha de una entidad: su ilustración junto al título ───────────────── */
.entity-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.illus-sm {
  flex: none;
  width: 92px;
  padding: 0.4rem;
  border-radius: 16px;
}

/* ── Ficha de la aeronave: el equipo a lo grande ────────────────────────── */
.fleet-hero {
  display: grid;
  grid-template-columns: minmax(220px, 340px) 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 1.25rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--ac-border);
  border-radius: 20px;
  background:
    radial-gradient(
      420px 220px at 28% 40%,
      color-mix(in srgb, var(--ac-primary) 18%, transparent),
      transparent 70%
    ),
    repeating-linear-gradient(
      0deg,
      color-mix(in srgb, var(--ac-border) 55%, transparent) 0 1px,
      transparent 1px 28px
    ),
    var(--ac-surface);
}

/* LV-457: el mismo marco (4:3) para la foto oficial y para la silueta, así todas las fichas se ven
   iguales y comparables aunque la foto tenga otra proporción. `contain` + padding: la imagen
   nunca se recorta ni se deforma, y queda centrada. Fondo con tokens (vale en claro y oscuro). */
.fleet-hero-art {
  margin: 0;
  min-width: 0;
}

.fleet-hero-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  padding: 0.75rem;
  border: 1px solid var(--ac-border);
  border-radius: 14px;
  background: var(--ac-bg);
  overflow: hidden;
}

.fleet-hero-frame img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.fleet-hero-frame img:not(.is-photo) {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 10px 10px rgb(0 0 0 / 22%));
}

.fleet-hero-credit {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--ac-text-secondary);
}

.fleet-reuse-card {
  width: 11rem;
}

.fleet-hero-action {
  margin-top: 0.5rem;
}

.fleet-hero-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  align-content: start;
  align-self: start;
  gap: 0.9rem 1.25rem;
  margin: 0;
}

.fleet-hero-facts dt {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ac-text-secondary);
}

.fleet-hero-facts dd {
  margin: 0.15rem 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

@media (max-width: 767.98px) {
  .fleet-hero { grid-template-columns: 1fr; }
  .fleet-hero-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Una foto real (si la persona la aporta) llena la lámina en vez de flotar en ella. */
.illus-tile img.is-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
}

/* ── Indicadores del panel con relieve ──────────────────────────────────── */
.summary-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--id-lift);
  border-color: color-mix(in srgb, var(--ac-primary) 45%, var(--ac-border));
}

/* ── Cabecera del panel con fondo aeronáutico atenuado (LV-312) ──────────
   El dibujo es decoración: cielo (degradado con el color primario), tres planos de
   cordillera de 6 a 12 % de opacidad, retícula técnica y la ruta con un avión al final,
   todo en `currentColor`/tokens para que siga al tema. Lo que manda es el título, las
   alertas y los datos; por eso el dibujo vive a la derecha y baja de intensidad. */
.page-header--hero {
  position: relative;
  overflow: hidden;
  padding: 1.15rem 1.35rem;
  border: 1px solid var(--ac-border);
  border-radius: 20px;
  background: linear-gradient(
    100deg,
    color-mix(in srgb, var(--ac-primary) 14%, var(--ac-surface)),
    var(--ac-surface) 78%
  );
  box-shadow: var(--id-lift);
}

.page-header--hero > *:not(.hero-sky) {
  position: relative;
  z-index: 1;
}

.hero-sky {
  position: absolute;
  top: 0;
  right: 0;
  width: min(62%, 760px);
  height: 100%;
  color: var(--ac-text-secondary);
  pointer-events: none;
}

.hero-sky .hero-grid { opacity: 0.55; }
.hero-sky .hero-grid-line { fill: none; stroke: currentColor; stroke-width: 1; opacity: 0.1; }
.hero-sky .hero-grid-line--major { opacity: 0.16; }
.hero-sky .hero-ridge { fill: currentColor; }
.hero-sky .hero-ridge--far { opacity: 0.06; }
.hero-sky .hero-ridge--mid { opacity: 0.09; }
.hero-sky .hero-ridge--near { opacity: 0.12; }

.hero-sky .route-draw {
  fill: none;
  stroke: #fff;
  stroke-width: 8;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.hero-sky .route-line {
  fill: none;
  stroke: var(--ac-primary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 6 7;
  opacity: 0.45;
}

.hero-sky .route-dot { fill: var(--ac-primary); opacity: 0.45; }

.hero-greeting {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ac-text);
}

/* Sobre el fondo con cordillera el gris secundario queda en 4,495:1 en claro (peor caso medido en
   test_lv312_hero); la descripción de la cabecera usa el color de texto principal. */
.page-header--hero .page-description { color: var(--ac-text); }

@media (max-width: 767.98px) {
  .hero-sky { display: none; }
}

/* ── Recorrido del permiso (cabecera de la ficha) ───────────────────────── */
.permit-journey {
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  border-radius: 20px;
  box-shadow: var(--id-lift);
}

.status-step-badge {
  width: 36px;
  height: 36px;
}

.status-step:not(:first-child)::before { top: 17px; }

.status-step.is-done .status-step-badge {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ac-primary) 14%, transparent);
}

/* ── Inicio de sesión: presentación de marca + formulario (LV-307) ───────────
 * Pedido del usuario (2026-10-13, con captura): la portada «se ve igual» y la ilustración quedó
 * como una pegatina suelta. Ahora son dos paneles en pantallas anchas: a la izquierda la marca
 * (cuadrícula técnica, ruta de vuelo con un dron animado, mensaje y puntos clave) y a la derecha
 * el formulario, que no cambia. Bajo 992 px sólo queda el formulario, como antes. */
.login-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding: 0;
  min-height: 100vh;
  align-items: stretch;
}

.login-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-showcase { display: none; }

@media (min-width: 992px) {
  .login-page { grid-template-columns: minmax(0, 1.2fr) minmax(400px, 0.8fr); }

  .login-showcase {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
    padding: 2.75rem 3.5rem;
    overflow: hidden;
    color: #eaf0ff;
    background:
      radial-gradient(720px 440px at 18% 8%, rgb(34 211 197 / 24%), transparent 62%),
      radial-gradient(640px 420px at 92% 92%, rgb(56 189 248 / 20%), transparent 62%),
      linear-gradient(160deg, #0d1c3a, #070f20);
  }

  /* La cuadrícula técnica de AeroAcademy, que se desvanece hacia abajo. */
  .login-showcase::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
      linear-gradient(rgb(255 255 255 / 6%) 1px, transparent 1px),
      linear-gradient(90deg, rgb(255 255 255 / 6%) 1px, transparent 1px);
    background-size: 38px 38px;
    mask-image: linear-gradient(180deg, #000 0%, transparent 88%);
    pointer-events: none;
  }

  .login-showcase > * { position: relative; z-index: 1; }

  .showcase-route {
    position: absolute !important;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0 !important;
    opacity: 0.9;
  }

  .showcase-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.01em;
  }

  .showcase-kicker {
    margin: 0 0 0.9rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #22d3c5;
  }

  .showcase-title {
    margin: 0;
    max-width: 15ch;
    font-size: clamp(2.2rem, 3.6vw, 3.6rem);
    font-weight: 800;
    line-height: 1.04;
    letter-spacing: -0.03em;
  }

  .showcase-points {
    list-style: none;
    margin: 1.75rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.95rem;
    max-width: 30rem;
  }

  .showcase-points li {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    color: #cdd9f3;
    font-size: 1.02rem;
  }

  .pt-ico {
    flex: none;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgb(34 211 197 / 15%);
    color: #22d3c5;
    box-shadow: inset 0 0 0 1px rgb(34 211 197 / 30%);
  }

  .pt-ico .nav-icon { width: 22px; height: 22px; color: inherit; }

  .showcase-art {
    align-self: flex-end;
    width: min(340px, 62%);
    transform: rotate(2.5deg);
    box-shadow: 0 24px 50px -22px rgb(0 0 0 / 70%);
  }
}

/* El dron y la ruta (SVG de fondo del panel de marca). */
.route-line {
  fill: none;
  stroke: rgb(34 211 197 / 55%);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 7 9;
}

.route-dot { fill: #22d3c5; }
.route-dot-end { fill: #38bdf8; }

.drone-fly { transform: translate(420px, 300px); }

/* LV-321: el dron de la portada es el plano técnico (`.bp-*`, ver sección F). */

/* ── Toda la aplicación, por selectores compartidos ─────────────────────────
 * Se engancha a las clases que ya usan las ~150 plantillas (`.card`, `.page-header`,
 * `.btn`, `.nav-item`), no a una pantalla: así el relieve llega a todas a la vez y una
 * pantalla nueva lo hereda sin acordarse de pedirlo. */
[data-theme="dark"] {
  --id-lift: 0 1px 2px rgb(0 0 0 / 40%), 0 14px 30px -14px rgb(0 0 0 / 70%);
}

.card,
.panel {
  border-radius: 16px;
  box-shadow: var(--id-lift);
}

/* Una tarjeta dentro de otra no se eleva dos veces: pesaría como una pila de papeles. */
.card .card,
.panel .card,
.card .panel {
  box-shadow: none;
}

.modal-content { border-radius: 20px; }

.btn { transition: transform 0.12s ease, box-shadow 0.12s ease; }

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px -10px var(--ac-primary);
}

/* ── Panel lateral ──────────────────────────────────────────────────────────
 * Sólo CSS: el marcado, los seis grupos, los colores por sección (`LV-207`, con su contraste
 * medido) y el modo icono (`LV-170`) no se tocan. Aquí van profundidad y movimiento. */
.sidebar {
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--ac-primary) 7%, var(--ac-surface)) 0,
      var(--ac-surface) 240px
    ),
    var(--ac-surface);
  box-shadow: 1px 0 0 var(--ac-border), 14px 0 30px -26px rgb(0 0 0 / 60%);
}

/* LV-309: tres niveles. Título de grupo (pequeño, tenue, en mayúsculas) > enlace (legible, peso
 * medio) > zona de administración (más tenue aún). El color de cada sección sigue siendo el del
 * icono (`LV-207`); aquí sólo se ordena la jerarquía. */
.sidebar a {
  border-radius: 12px;
  transition: background 150ms ease, color 150ms ease;
}

.sidebar a.nav-item {
  font-size: 0.92rem;
  font-weight: 500;
}

.sidebar a.nav-item:hover {
  background: color-mix(in srgb, var(--ac-primary) 8%, transparent);
  color: inherit;
}

.sidebar .nav-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

/* El ítem activo: degradado de la marca hacia el borde, marca lateral de 3 px y una sombra corta
 * que lo despega del fondo. `aria-current="page"` lo anuncia a quien no lo ve. */
.sidebar a.active {
  font-weight: 700;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--ac-primary) 22%, transparent),
    color-mix(in srgb, var(--ac-primary) 6%, transparent)
  );
  box-shadow: inset 3px 0 0 var(--ac-primary), 0 6px 14px -10px var(--ac-primary);
}

.sidebar a:focus-visible {
  outline: 2px solid var(--ac-focus-ring);
  outline-offset: 2px;
}

/* Título de grupo: sin fondo, sin el tramo de color que traía encima (`::before`), con la flecha. */
.sidebar .sidebar-label {
  color: var(--ac-text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  background: none;
}

.sidebar .nav-group-toggle:hover { color: var(--ac-text); }

/* Zona de administración: separada del resto y más tenue; es lo que se usa menos. */
.nav-admin-zone {
  margin-top: 0.75rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--ac-border);
}

.sidebar .nav-admin-label {
  display: block;
  font-size: 0.64rem;
  opacity: 0.8;
}

.nav-admin-zone .nav-item { opacity: 0.82; }
.nav-admin-zone .nav-item:hover,
.nav-admin-zone .nav-item:focus-visible,
.nav-admin-zone .nav-item.active { opacity: 1; }

/* Modo icono: el texto de cada enlace pasa a una burbuja a la derecha del icono, visible al
 * apuntar o al llegar con el teclado. Sustituye al `title` que ponía el JS (duplicaba el texto). */
@media (min-width: 769px) {
  .sidebar.is-collapsed a:hover { transform: none; }

  .sidebar.is-collapsed .nav-label {
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    z-index: 1100;
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--ac-border);
    border-radius: 8px;
    background: var(--ac-surface);
    box-shadow: 0 8px 20px -8px rgb(0 0 0 / 35%);
    color: var(--ac-text);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-50%);
  }

  .sidebar.is-collapsed a:hover .nav-label,
  .sidebar.is-collapsed a:focus-visible .nav-label {
    opacity: 1;
    visibility: visible;
  }

  /* LV-381 F0: la burbuja sale del flujo con `position: fixed`. Como hija
   * absoluta del enlace la recortaban su `overflow: hidden` y el contenedor con
   * scroll de la barra (`.sidebar-scroll`), y el rail no decia a donde llevaba
   * cada icono. `--tip-y` lo escribe app.js al apuntar o enfocar; el borde
   * izquierdo es el ancho del rail (72 px dentro de `.is-collapsed`). */
  .sidebar.is-collapsed .nav-label {
    position: fixed;
    left: calc(var(--ac-sidebar-width) + 8px);
    top: var(--tip-y, 0px);
  }
}


/* ── Tipografía de AeroAcademy (LV-307) ──────────────────────────────────────
 * Archivo, variable (peso 100–900 y ancho 62–125 %), **servida desde este mismo servidor**: sin
 * CDN ni pedido a terceros, licencia SIL OFL 1.1 (`static/fonts/OFL-Archivo.txt`). Sólo para
 * títulos y cifras; el texto corrido sigue en la fuente del sistema. Si el archivo no carga, cae
 * a `system-ui` y la página no se mueve (`font-display: swap`). Decisión del usuario
 * (2026-10-13: «más cercana a AeroAcademy»), que reemplaza a la de `docs/ux-ui-plan.md` §8
 * («no se agrega fuente web»): aquel argumento era el pedido a la red, que aquí no existe. */
@font-face {
  font-family: "Archivo";
  src: url("../fonts/Archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --id-display: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1,
h2,
.page-title,
.login-title,
.showcase-title,
.showcase-brand,
.summary-card strong {
  font-family: var(--id-display);
  font-stretch: 90%;
}

h1,
.page-title,
.showcase-title { font-weight: 800; letter-spacing: -0.03em; }

/* ── Fondo de plano técnico, en toda la aplicación ───────────────────────── */
body {
  background-image:
    linear-gradient(color-mix(in srgb, var(--ac-text) 4%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--ac-text) 4%, transparent) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* ── Indicadores del panel: icono, cifra grande y barra con meta (LV-307) ── */
.summary-card--kpi {
  position: relative;
  gap: 0.4rem;
  padding: 0.95rem 1.1rem 1.05rem 1.3rem;
  overflow: hidden;
}

.summary-card--kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--kpi-accent, var(--ac-primary));
}

.kpi-fleet { --kpi-accent: #22d3c5; }
.kpi-insurance { --kpi-accent: #38bdf8; }
.kpi-credentials { --kpi-accent: #a78bfa; }
.kpi-permits { --kpi-accent: #fbbf24; }

.kpi-head { display: flex; align-items: center; gap: 0.65rem; }

.kpi-ico {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--kpi-accent);
  background: color-mix(in srgb, var(--kpi-accent) 18%, transparent);
}

.kpi-ico .nav-icon { width: 20px; height: 20px; color: inherit; }

.summary-card--kpi strong { font-size: 2.35rem; font-weight: 800; letter-spacing: -0.02em; }

.kpi-meter {
  display: block;
  width: 100%;
  height: 8px;
  margin: 0.15rem 0 0.1rem;
  border: 0;
  background: transparent;
}

.kpi-meter::-webkit-meter-bar {
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ac-text) 11%, transparent);
}

.kpi-meter::-webkit-meter-optimum-value {
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--kpi-accent, var(--ac-primary)),
    color-mix(in srgb, var(--kpi-accent, var(--ac-primary)) 55%, #fff)
  );
}

.kpi-meter::-webkit-meter-suboptimum-value {
  border-radius: 999px;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.kpi-meter::-webkit-meter-even-less-good-value {
  border-radius: 999px;
  background: #ef4444;
}

.kpi-meter::-moz-meter-bar { border-radius: 999px; background: var(--kpi-accent, var(--ac-primary)); }
.kpi-meter:-moz-meter-sub-optimum::-moz-meter-bar { background: #f59e0b; }
.kpi-meter:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: #ef4444; }

/* La fila «sin permiso» sigue siendo crítica, pero deja de ser un bloque de ladrillo: el rojo se
   mezcla con la superficie. El contraste del texto sólo mejora (el fondo se acerca al de la tarjeta). */
tr.row-critical > td {
  background-color: color-mix(in srgb, var(--sev-critical-bg) 58%, var(--ac-surface));
}

/* ── «Requiere atención» del panel (LV-310) ───────────────────────────────
   Chips grandes: cifra, texto y enlace. Los colores salen de los tokens de
   severidad (`--sev-*`), así que siguen al tema claro/oscuro sin otra regla. El
   rojo es sólo `critical` (vencido, faena sin permiso); el resto es ámbar. */
.attention-chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.6rem;
}

.attention-chip {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--sev-nominal-border);
  border-left-width: 5px;
  border-radius: 12px;
  background: var(--sev-nominal-bg);
  color: var(--sev-nominal-text);
  text-decoration: none;
}

.attention-chip.sev-critical {
  background: var(--sev-critical-bg);
  border-color: var(--sev-critical-border);
  color: var(--sev-critical-text);
}

.attention-chip.sev-warning {
  background: var(--sev-warning-bg);
  border-color: var(--sev-warning-border);
  color: var(--sev-warning-text);
}

.attention-chip:hover,
.attention-chip:focus-visible {
  text-decoration: none;
  filter: brightness(0.97);
}

.attention-count {
  font-family: var(--id-display);
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1;
}

.attention-body { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.attention-text { font-weight: 600; line-height: 1.25; }
.attention-action { font-size: 0.82rem; font-weight: 700; }
.attention-chip:hover .attention-action,
.attention-chip:focus-visible .attention-action { text-decoration: underline; }
.attention-text small { font-weight: 400; }

.attention-clear {
  padding: 0.55rem 1rem;
  border: 1px solid var(--sev-nominal-border);
  border-radius: 12px;
  background: var(--sev-nominal-bg);
  color: var(--sev-nominal-text);
}

/* «Vuelos mensuales», más bajo que los gráficos de antes: ahora es el único. */
.chart-container--low canvas { max-height: 150px; }

/* == A: listas, tablas y filtros == */
/* Contiene: listados, tablas de trabajo, barras de filtros, paginación y filas vacías. */

/* LV-316 (ola A). Sólo agrega: ninguna clase existente se renombra ni se redefine su significado.
 * Cabecera fija: NO. `.table-responsive` hace scroll en x (overflow-x: auto), y eso convierte al
 * contenedor en el ancestro de `position: sticky`, así que la cabecera se pegaría a la tarjeta y no
 * a la ventana; hacerla segura exigiría quitar el scroll horizontal, que es otra decisión. */

/* Barra de filtros: una franja, rótulo arriba. Sirve a `.id-filterbar` (list.html) y a las barras
 * `form.row.g-2` que escriben a mano las listas hijas (sus `col-md-*` se acomodan sin tocarlas). */
.id-filterbar,
.id-filters > form.row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--id-sp-1) var(--id-sp-2);
  margin: 0 0 var(--id-sp-2);
  padding: 0;
}

.id-filters > form.row > [class*="col"] {
  flex: 0 1 auto;
  width: auto;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.id-filters > form.row > [class*="col"]:has(input[name="q"]) { flex: 1 1 16rem; min-width: 14rem; }

.id-filter { display: flex; flex-direction: column; gap: 0.25rem; min-width: 10rem; }
.id-filter--grow { flex: 1 1 16rem; min-width: 14rem; }
.id-filter--action { min-width: 0; }

/* El indicador de «Buscando…» flota sobre el campo: en el flujo empujaba el control hacia arriba y
 * dejaba la franja con alturas distintas. */
.id-filter { position: relative; }
.id-filter .htmx-indicator { position: absolute; right: 0.75rem; bottom: 0.5rem; pointer-events: none; }

.id-filter-label {
  margin: 0;
  color: var(--ac-text-secondary);
  font-size: var(--id-fs-sm);
  font-variant-caps: all-small-caps;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.2;
}

.id-filterbar .form-control,
.id-filterbar .form-select,
.id-filters > form.row .form-control,
.id-filters > form.row .form-select { border-radius: var(--id-r-control); }

/* Tabla de trabajo: encabezados como rótulo y filas más fáciles de recorrer. */
.id-worktable thead th {
  font-size: var(--id-fs-sm);
  font-variant-caps: all-small-caps;
  font-weight: 600;
  /* Sin `letter-spacing`: en las columnas del 6 % (`col-icon`) una palabra como «Archivo» ya
   * roza el ancho de la celda, y `LV-177` ya tuvo que arreglar un corte a mitad de palabra. */
  letter-spacing: 0;
  border-bottom: 1px solid var(--ac-border);
}

.id-worktable tbody td { border-color: var(--ac-border); }
.id-worktable tbody tr:last-child td { border-bottom-width: 0; }
.id-worktable tbody td:first-child a { font-weight: 600; text-decoration: none; }
.id-worktable tbody td:first-child a:hover { text-decoration: underline; }

/* Paginación y barra de selección con los mismos radios y rótulos que el resto de la capa. */
#pagination-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--id-sp-1) var(--id-sp-2);
}

#pagination-container:not(:empty) { padding: var(--id-sp-1) var(--id-sp-2); }
.id-pager-count { margin: 0; color: var(--ac-text-secondary); font-size: var(--id-fs-sm); }
.id-pager { margin: 0; }
.id-pager .pagination { margin: 0; gap: 0.25rem; }
.id-pager .page-link { border-radius: var(--id-r-control); font-size: var(--id-fs-sm); }

.bulk-bar {
  gap: var(--id-sp-2);
  padding: var(--id-sp-1) var(--id-sp-2);
  border-radius: var(--id-r-card);
  box-shadow: var(--id-lift);
}

.bulk-count {
  font-size: var(--id-fs-sm);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
}

/* Hover de fila: 120 ms, y con `reduce` la regla de abajo la anula. No va dentro de un bloque
 * `no-preference` a propósito: los guardianes de la capa (`test_lv302`, `test_lv309`, `test_lv315`)
 * buscan el PRIMER bloque `no-preference` del archivo y dan por «fuera» todo lo que lo precede. */
.id-worktable.table-hover > tbody > tr > * {
  transition: background-color var(--id-t-fast) var(--id-ease), box-shadow var(--id-t-fast) var(--id-ease);
}

@media (prefers-reduced-motion: reduce) {
  .id-worktable.table-hover > tbody > tr > * { transition: none; }
}

/* A2: Visual v2 (LV-330, ola G). Sólo agrega al final de la sección A. Sin tokens nuevos (los
 * guardianes de la capa los buscan al inicio de línea) y sin animación: la del menú vive en el
 * único bloque `no-preference` del archivo. La densidad ya la resuelve `UX-08` (`html[data-density]`,
 * botón de la barra superior): aquí sólo se respeta, no se duplica. */

/* Cualquier barra `.id-filterbar` cuyos hijos escriban `col-md-*` (Bootstrap los mantenía en
 * porcentaje y la franja saltaba a dos filas): se acomodan como las de `form.row`. */
.id-filterbar > [class*="col"] {
  flex: 0 1 auto;
  width: auto;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.id-filterbar > [class*="col"]:has(input[name="q"]) { flex: 1 1 16rem; min-width: 14rem; }

/* 36 px sólo dentro de la franja: `--ac-control-height` (42) sigue mandando en formularios. */
.id-filterbar .form-control,
.id-filterbar .form-select,
.id-filterbar .btn {
  height: 2.25rem;
  min-height: 2.25rem;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.id-filterbar input[type="date"] { max-width: 9.5rem; }

/* La búsqueda cede ancho: con cinco filtros y los botones, 16 rem de base (1138 px de suma contra
 * 1097 de franja a 1440) empujaba «Filtrar/Limpiar» a una segunda fila. Sigue creciendo con el sobrante. */
.id-filterbar > .id-filter--grow { flex-basis: 12rem; min-width: 12rem; }
.id-filter--date { min-width: 0; }

/* Fila: fondo propio al pasar el cursor y un filete de 2 px a la izquierda. */
.id-worktable.table-hover > tbody > tr:hover { --bs-table-hover-bg: var(--ac-surface-raised); }

.id-worktable.table-hover > tbody > tr:hover > td:first-child {
  box-shadow: inset 2px 0 0 var(--ac-primary), inset 0 0 0 9999px var(--bs-table-bg-state, var(--bs-table-bg-type, var(--bs-table-accent-bg)));
}

/* Acciones de fila: lo de lectura a la vista y lo demás en el menú «⋯» (`generic/_row_menu.html`). */
.id-rowactions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 0.25rem; }
.id-rowmenu { position: relative; }
.id-rowmenu > summary { list-style: none; cursor: pointer; line-height: 1.2; }
.id-rowmenu > summary::-webkit-details-marker { display: none; }

.id-rowmenu-list {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  /* Sobre el contenido y bajo la barra superior (1030): pasando bajo ella no la tapa. */
  z-index: 1025;
  min-width: 12rem;
  padding: 0.25rem;
  border: 1px solid var(--ac-border);
  border-radius: var(--id-r-card);
  background: var(--ac-surface);
  box-shadow: var(--id-lift);
  text-align: left;
}

/* `row-menu.js` lo saca del flujo con `position: fixed` al abrir: dentro de `.table-responsive`
 * y de `.card` (overflow) un menú absoluto se recorta en las últimas filas. */
.id-rowmenu-list.is-floating { position: fixed; top: auto; right: auto; }
.id-rowmenu-list form { margin: 0; }

.id-rowmenu-item {
  display: block;
  width: 100%;
  padding: 0.4rem 0.75rem;
  border: 0;
  border-radius: var(--id-r-control);
  background: transparent;
  color: var(--ac-text);
  font-size: var(--id-fs-sm);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.id-rowmenu-item:hover,
.id-rowmenu-item:focus-visible { background: var(--ac-surface-raised); color: var(--ac-text); }
.id-rowmenu-item--danger { color: var(--sev-critical-text); }
.id-rowmenu-item--danger:hover,
.id-rowmenu-item--danger:focus-visible { color: var(--sev-critical-text); }

[data-density="compact"] .id-rowmenu > summary { padding-top: 0.1rem; padding-bottom: 0.1rem; }

/* == B: fichas de detalle == */
/* Contiene: fichas de aeronave, operador, permiso y demás detalles; pestañas y datos clave. */

/* Cabecera de entidad (LV-317): título grande + chip de estado a la izquierda, acciones a la
 * derecha. La define `generic/_entity_head.html`; la ficha del permiso reutiliza las clases. */
.entity-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--id-sp-2);
  margin-bottom: var(--id-sp-3);
  padding-bottom: var(--id-sp-2);
  border-bottom: 1px solid var(--ac-border);
}

.entity-title { min-width: 0; }

main .entity-title h1[class] {
  font-size: var(--id-fs-2xl);
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.entity-subtitle {
  margin-top: 0.15rem;
  color: var(--ac-text-secondary);
  font-size: var(--id-fs-sm);
}

.entity-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--id-sp-1);
  margin-top: 0.45rem;
}

.entity-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--id-sp-1);
}

/* Pastillas de navegación entre secciones de una ficha larga. */
.entity-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--id-sp-1);
  margin: 0 0 var(--id-sp-3);
}

.entity-nav a {
  padding: 0.25rem 0.8rem;
  border: 1px solid var(--ac-border);
  border-radius: var(--id-r-pill);
  background: var(--ac-surface);
  color: var(--ac-text-secondary);
  font-size: var(--id-fs-sm);
  font-weight: 600;
  text-decoration: none;
  transition: border-color var(--id-t-fast) var(--id-ease), color var(--id-t-fast) var(--id-ease);
}

.entity-nav a:hover,
.entity-nav a:focus-visible {
  border-color: var(--ac-primary);
  color: var(--ac-primary);
}

.entity-section { scroll-margin-top: var(--id-sp-3); }

/* Datos clave: pares rótulo/valor con el rótulo en versalitas. La tabla de campos de toda
 * ficha genérica pasa de rejilla de bordes a lista de pares. */
.card .table-bordered:has(> tbody > tr > th[scope="row"].w-25) {
  border: 0;
}

.card .table-bordered > tbody > tr > th[scope="row"].w-25 {
  width: 28% !important;
  border-width: 0 0 1px;
  background: transparent;
  color: var(--ac-text-secondary);
  font-size: var(--id-fs-sm);
  font-variant-caps: all-small-caps;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.card .table-bordered > tbody > tr > th[scope="row"].w-25 + td {
  border-width: 0 0 1px;
}

/* Trazabilidad como línea de tiempo (LV-317). */
.id-timeline {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.id-timeline::before {
  content: "";
  position: absolute;
  top: 0.9rem;
  bottom: 0.9rem;
  left: 0.9rem;
  width: 2px;
  background: var(--ac-border);
}

.id-timeline-item {
  position: relative;
  display: flex;
  gap: var(--id-sp-2);
  padding-bottom: var(--id-sp-2);
}

.id-timeline-item:last-child { padding-bottom: 0; }

.id-timeline-dot {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border: 2px solid var(--ac-primary);
  border-radius: 50%;
  background: var(--ac-surface);
  color: var(--ac-primary);
  font-size: var(--id-fs-sm);
  font-weight: 700;
}

.id-timeline-body { min-width: 0; padding-top: 0.15rem; }

.id-timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem var(--id-sp-1);
}

.id-timeline-date {
  margin-left: auto;
  color: var(--ac-text-secondary);
  font-size: var(--id-fs-sm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.id-timeline-who { color: var(--ac-text-secondary); }

.id-timeline-notes {
  margin-top: 0.25rem;
  padding-left: 0.6rem;
  border-left: 2px solid var(--ac-border);
}

@media (max-width: 767.98px) {
  .entity-actions { width: 100%; }
  .id-timeline-date { margin-left: 0; width: 100%; }
}


/* B2: ficha del permiso con jerarquía (LV-368, fase 1). Cabecera, «Qué falta», secciones
   plegables, menú «⋯» y línea de tiempo de la vigencia. Sólo tokens `--ac-*`, `--sev-*` e `--id-*`;
   sin tokens nuevos y sin animación. La gravedad se lee por símbolo + palabra + color. */
.permit-waiting { display: inline-flex; align-items: center; gap: 0.35em; color: var(--ac-text-secondary); font-size: 0.875rem; font-weight: 600; }
.permit-waiting .id-signal-icon { margin-top: 0; }
.permit-head { overflow: visible; } /* `.card` recorta: el menú «⋯» se saldría de la tarjeta */
.permit-head .entity-subtitle { margin-top: 0.25rem; }
.permit-head .entity-bar { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.permit-head #permission-status-form { margin-top: var(--id-sp-2); padding-top: var(--id-sp-2); border-top: 1px solid var(--ac-border); }
.permit-status-notes { flex: 1 1 14rem; max-width: 24rem; }
.permit-more .dropdown-item { font-size: 0.9375rem; }
.permit-more form { margin: 0; }

.permit-attention { margin: var(--id-sp-2) 0; padding: 0.75rem 1rem; border: 1px solid var(--ac-border); border-radius: var(--id-r-card); background: var(--ac-surface); }
.permit-attention-title { margin: 0 0 0.4rem; color: var(--ac-text); font-size: var(--id-fs-md); font-weight: 700; }
.permit-attention-list { display: grid; gap: 0.35rem; margin: 0; padding: 0; list-style: none; }
.permit-attn { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.4rem 0.7rem; border: 1px solid var(--ac-border); border-left-width: 4px; border-radius: var(--id-r-control); font-size: 0.9375rem; line-height: 1.4; }
.permit-attn-symbol { flex: none; min-width: 1.1em; font-weight: 700; text-align: center; }
.permit-attn--critical { background: var(--sev-critical-bg); border-color: var(--sev-critical-border); color: var(--sev-critical-text); }
.permit-attn--warning { background: var(--sev-warning-bg); border-color: var(--sev-warning-border); color: var(--sev-warning-text); }
.permit-attn--caution { background: var(--sev-caution-bg); border-color: var(--sev-caution-border); color: var(--sev-caution-text); }
.permit-attn--ok { border-color: var(--id-ok-border); background: var(--id-ok-bg); color: var(--id-ok-text); }

.permit-section { margin-top: var(--id-sp-2); }
.permit-section > summary { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 1rem; border: 1px solid var(--ac-border); border-radius: var(--id-r-card); background: var(--ac-surface); cursor: pointer; list-style: none; }
.permit-section > summary::-webkit-details-marker { display: none; }
.permit-section > summary::before { content: "▸"; color: var(--ac-text-secondary); }
.permit-section[open] > summary::before { content: "▾"; }
.permit-section[open] > summary { margin-bottom: var(--id-sp-1); }
.permit-section-title { font-size: var(--id-fs-md); font-weight: 700; }

.permit-derived { margin-top: 0.35rem; }
.permit-why > summary { display: inline; margin-left: 0.4rem; color: var(--ac-primary); font-size: 0.8125rem; cursor: pointer; }
.permit-why-text { max-width: 65ch; margin: 0.35rem 0 0; color: var(--ac-text-secondary); font-size: 0.8125rem; }

.permit-validity { display: grid; gap: 0.35rem; }
.permit-tl { width: 100%; max-width: 20rem; height: auto; }
.permit-tl-track { fill: none; stroke: var(--ac-text-secondary); stroke-width: 1; }
.permit-tl-elapsed--nominal { fill: var(--sev-nominal-text); }
.permit-tl-elapsed--warning { fill: var(--sev-warning-text); }
.permit-tl-elapsed--critical { fill: var(--sev-critical-text); }
.permit-tl-today { stroke: var(--ac-text); stroke-width: 2; }
.permit-validity-text { color: var(--ac-text-secondary); font-size: 0.875rem; }
.permit-validity-dates { font-variant-numeric: tabular-nums; }
.permit-dossier-mark { width: 3rem; }
.permit-form-optional > summary { cursor: pointer; }
@media (max-width: 575.98px) {
  .permit-head .entity-actions { width: 100%; }
}


/* == C: formularios == */
/* Contiene: campos, grupos, ayudas, errores de validación y barras de acciones. */
.form-shell .form-control,
.form-shell .form-select {
  border-radius: var(--id-r-control);
  transition: border-color var(--id-t-fast) var(--id-ease), box-shadow var(--id-t-fast) var(--id-ease);
}

.form-shell .form-control:focus-visible,
.form-shell .form-select:focus-visible,
.form-shell .form-check-input:focus-visible,
.form-shell .btn:focus-visible,
.form-shell .form-error-summary:focus-visible {
  outline: 2px solid var(--ac-focus-ring);
  outline-offset: 2px;
  box-shadow: none;
}

/* LV-333 (legibilidad): las ayudas bajan de 13 a 14 px, sin cursiva y con un icono propio. El
   icono es una máscara (data-URI SVG, sin recursos externos): toma el color del texto. */
.form-shell .form-text {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-style: normal;
  color: var(--ac-text-secondary);
}
.form-shell .form-text::before {
  content: "";
  flex: none;
  width: 1em;
  height: 1em;
  margin-top: 0.2em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5.5M12 8v.01'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5.5M12 8v.01'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* «dd-mm-aaaa» es el texto nativo de `<input type=date>`: sólo el pseudo-elemento lo alcanza. */
input[type="date"]::-webkit-datetime-edit { color: var(--ac-text-secondary); }
input[type="date"]:focus::-webkit-datetime-edit { color: var(--ac-text); }

/* Título de sección del formulario (no el `.section-title` global, que usa también el panel). */
.form-shell { counter-reset: id-section; }
.cc-form-section > legend.section-title {
  counter-increment: id-section;
  float: none;
  width: 100%;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--ac-border);
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: normal;
  color: var(--ac-text);
}
.cc-form-section > legend.section-title::before {
  content: counter(id-section) ". ";
  color: var(--ac-text-secondary);
}

.form-shell .invalid-feedback { display: block; font-size: var(--id-fs-sm); }

.form-error-summary { border-radius: var(--id-r-control); }
.form-error-summary a { color: inherit; font-weight: 600; }

/* Barra de acciones pegajosa: guardar (único primario) y cancelar como enlace. */
.form-actions--sticky {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-inline: calc(var(--id-sp-2) * -1);
  padding: var(--id-sp-1) var(--id-sp-2);
  background: var(--bs-body-bg);
  border-top: 1px solid var(--bs-border-color);
}

/* Envío: el botón se apaga al instante y los puntos suspensivos llegan a los
   300 ms (clase puesta por form-draft.js): un guardado rápido no parpadea. */
form.is-submitting .btn-primary,
.form-shell.htmx-request .btn-primary { cursor: progress; opacity: 0.85; }

form.is-submitting-slow .btn-primary::after {
  content: "…";
  margin-inline-start: 0.25rem;
}

/* == D: informes, documentos y SIGO == */
/* Contiene: informes mensuales, documentos, cierre mensual y pantallas de SIGO. */

/* LV-319: la hoja impresa. Pantalla: el encabezado y el pie de papel no existen; en papel son
 * los que dan identidad al informe (qué es, de qué período, y el contacto que lee
 * `report_contact` de la configuración: nada de datos reales en el código). */
.id-print-head,
.id-print-foot { display: none; }

@media print {
  /* Márgenes de impresora para todo lo que no sea una hoja A4 de informe. El informe mensual y
   * el Dato Ejecutivo cargan `report-a4.css` DESPUÉS de esta hoja y fijan `margin: 0`: la hoja
   * es la página, y ahí manda la suya. */
  @page { size: A4; margin: 16mm 14mm 20mm; }

  /* Siempre claro en papel. Esta capa no redefine `--ac-*` ni `--sev-*` (son de `app.css`): fuerza
   * las propiedades, con `!important` porque tiene que ganar al tema oscuro, que es más específico. */
  html,
  html[data-theme="dark"],
  html[data-bs-theme="dark"] {
    color-scheme: light;
    --id-ok-bg: #e4f6ea;
    --id-ok-border: #a7d9b8;
    --id-ok-text: #1f7a43;
  }
  html[data-theme="dark"] body,
  html[data-theme="dark"] main,
  html[data-theme="dark"] .card,
  html[data-theme="dark"] .table,
  html[data-theme="dark"] .table th,
  html[data-theme="dark"] .table td {
    background: #ffffff !important;
    color: #111827 !important;
  }
  html[data-theme="dark"] .text-muted,
  html[data-theme="dark"] .text-body-secondary { color: #52606d !important; }
  html .id-chip--critical,
  html .badge.sev-critical { background: #fce4e6 !important; border-color: #f0b0b6 !important; color: #a52834 !important; }
  html .id-chip--warning,
  html .badge.sev-warning,
  html .badge.sev-caution { background: #fdf1dc !important; border-color: #ecc98a !important; color: #8a5a12 !important; }
  html .id-chip--neutral,
  html .badge.sev-nominal { background: #eceff4 !important; border-color: #c4ccd8 !important; color: #384252 !important; }
  html body {
    background: #ffffff !important;
    color: #111827;
    font-size: 11pt;
    line-height: 1.4;
  }

  /* Sin sombras ni fondos de tarjeta en papel. */
  .card,
  .summary-card,
  .sigo-field {
    box-shadow: none !important;
    background: #ffffff !important;
    color: #111827 !important;
    border: 1px solid #c8ced8;
  }

  main h1,
  main h2,
  main h3,
  .sigo-section-title { font-family: var(--id-display); color: #111827; break-after: avoid; }

  /* Ninguna fila ni bloque se corta entre dos páginas; el encabezado de tabla se repite. */
  tr,
  .sigo-field,
  .id-chip { break-inside: avoid; }
  thead { display: table-header-group; }

  /* Estados: texto + color, y el color se imprime. */
  .id-chip { print-color-adjust: exact; -webkit-print-color-adjust: exact; }

  /* LV-355 F2: la frase de universo («faenas activas: N · con operación: M») va pegada a la
   * tabla que explica; sin esto, medido con Edge sin cabeza, quedaba sola al tope de la hoja
   * siguiente, separada de su tabla. */
  [data-universe] { break-before: avoid; }

  /* Encabezado y pie de papel: el pie se repite al fondo de cada hoja. */
  .id-print-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding-bottom: 6pt;
    margin-bottom: 10pt;
    border-bottom: 1.5pt solid #124384;
    font-size: 9pt;
    color: #3a4452;
  }
  .id-print-head strong { font-family: var(--id-display); font-size: 12pt; color: #124384; }
  .id-print-foot {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding-top: 4pt;
    border-top: 0.75pt solid #8a94a3;
    font-size: 8pt;
    color: #3a4452;
  }

  /* Hoja SIGO: las casillas son datos, no controles; el botón de copiar no va a papel. */
  .copy-btn,
  #copy-status { display: none !important; }

  /* Documentos: el visor embebido no se imprime (un marco vacío en papel). */
  iframe.document-preview { display: none !important; }
}


/* == E: pulido global == */
/* Contiene: ajustes transversales finales (foco, selección, impresión, detalles de tema). */

/* E1: foco uniforme (LV-328). 2px en `--ac-primary` (claro y oscuro ya medidos) con separación de 2px.
   Especificidad (0,1,1): gana a la regla base `:where(...)` de app.css y NO pisa la de la barra
   (`.sidebar a:focus-visible`, LV-309) ni la del formulario (`.form-shell ...`, LV-318), que son más
   específicas. */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--ac-focus-ring);
  outline-offset: 2px;
}

/* E2: mensajes (`messages` de base.html). Icono + texto + color por gravedad; nunca sólo color. */
.id-message {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.7rem 2.75rem 0.7rem 0.9rem;
  border: 1px solid var(--sev-nominal-border);
  border-left-width: 4px;
  border-radius: var(--id-r-control);
  background: var(--sev-nominal-bg);
  color: var(--sev-nominal-text);
}
.id-message-icon { flex: none; margin-top: 0.15rem; }
.id-message-text { min-width: 0; overflow-wrap: anywhere; }
.id-message--success { background: var(--id-ok-bg); border-color: var(--id-ok-border); color: var(--id-ok-text); }
.id-message--info { background: var(--sev-advisory-bg); border-color: var(--sev-advisory-border); color: var(--sev-advisory-text); }
.id-message--warning { background: var(--sev-warning-bg); border-color: var(--sev-warning-border); color: var(--sev-warning-text); }
.id-message--danger { background: var(--sev-critical-bg); border-color: var(--sev-critical-border); color: var(--sev-critical-text); }
.id-message .btn-close { padding: 0.9rem; }

/* E3: estado vacío unificado (`generic/_empty_art.html` con `title`). */
.empty-state__body { display: grid; justify-items: center; gap: 0.35rem; max-width: 36rem; }
.empty-state__title { margin: 0; color: var(--ac-text); }
.empty-state__help { margin: 0; color: var(--ac-text-secondary); }
.empty-state__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 0.5rem; }

/* E4: responsivo a 375 px (LV-328). Medido en el demo: el panel desbordaba 2 px por una insignia
   de una sola línea, y las cabeceras apilaban título y acciones sin envolver. El modo icono de la
   barra no se toca. */
@media (max-width: 575.98px) {
  .badge:not(.id-chip) { white-space: normal; max-width: 100%; text-align: left; }
  .entity-head { flex-wrap: wrap; }
  .entity-title h1 { overflow-wrap: anywhere; font-size: 1.5rem; }
  .page-header { flex-wrap: wrap; }
  .page-header h1 { overflow-wrap: anywhere; }
  .page-header--module::before { display: none; }
  .empty-state { padding: 1.25rem 0.75rem; }
}

/* E2: asistente (LV-332). Botón flotante y panel lateral. Sin animación: el esqueleto de «pensando»
   es estático (el rótulo para lectores de pantalla dice que se está esperando). Sólo tokens. */
.ai-fab { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 1030; display: inline-flex; align-items: center; gap: 0.4rem; border-radius: 999px; font-weight: 600; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); }
.ai-panel { --bs-offcanvas-width: min(26rem, 100vw); }
.ai-body { display: flex; flex-direction: column; gap: 0.75rem; min-height: 0; }
.ai-note { margin: 0; color: var(--ac-text-secondary); }
.ai-log { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 0.6rem; min-height: 4rem; }
.ai-msg { padding: 0.6rem 0.75rem; border: 1px solid var(--sev-nominal-border); border-radius: var(--id-r-control); background: var(--sev-nominal-bg); color: var(--sev-nominal-text); overflow-wrap: anywhere; }
.ai-msg--user { align-self: flex-end; max-width: 90%; background: var(--sev-advisory-bg); border-color: var(--sev-advisory-border); color: var(--sev-advisory-text); white-space: pre-wrap; }
.ai-msg--limit { background: var(--sev-warning-bg); border-color: var(--sev-warning-border); color: var(--sev-warning-text); }
.ai-msg--error { background: var(--sev-critical-bg); border-color: var(--sev-critical-border); color: var(--sev-critical-text); }
.ai-msg-text { white-space: pre-wrap; }
.ai-cites, .ai-meta { margin-top: 0.5rem; font-size: 0.85rem; }
.ai-cites-title { font-weight: 600; }
.ai-cites-list { margin: 0.2rem 0 0; padding-left: 1.1rem; }
.ai-thinking { display: grid; gap: 0.4rem; }
.ai-bar { display: block; height: 0.6rem; border-radius: 0.3rem; background: var(--ac-border); }
.ai-bar--short { width: 55%; }
.ai-suggest { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ai-form { display: grid; gap: 0.5rem; }
.ai-disclaimer { margin: 0; color: var(--ac-text-secondary); }
.ai-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.5rem; }
.ai-actions .btn { display: inline-flex; align-items: center; gap: 0.3rem; }
.ai-actions-status { color: var(--ac-text-secondary); flex-basis: 100%; }
@media (max-width: 575.98px) { .ai-fab { right: 0.75rem; bottom: 0.75rem; } }

/* E5: señales (LV-333). Siempre icono + texto + color, nunca sólo color. Cada `.id-*` es un
   renglón con un SVG en línea `aria-hidden` y la gravedad dicha con `visually-hidden`
   (`generic/_signal.html`). Sólo leen tokens `--ac-*`, `--sev-*` e `--id-*`. */
.id-hint, .id-note, .id-warn, .id-ok, .id-danger {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.35rem 0;
  font-size: 0.875rem;
  font-style: normal;
  line-height: 1.45;
}
.id-signal-icon { flex: none; margin-top: 0.15rem; }
.id-signal-text { min-width: 0; overflow-wrap: anywhere; }
.id-hint { color: var(--ac-text-secondary); }
.id-note, .id-warn, .id-ok, .id-danger {
  padding: 0.5rem 0.75rem;
  border: 1px solid transparent;
  border-left-width: 3px;
  border-radius: var(--id-r-control);
}
.id-note { background: var(--sev-advisory-bg); border-color: var(--sev-advisory-border); color: var(--sev-advisory-text); }
.id-warn { background: var(--sev-warning-bg); border-color: var(--sev-warning-border); color: var(--sev-warning-text); }
.id-ok { background: var(--id-ok-bg); border-color: var(--id-ok-border); color: var(--id-ok-text); }
.id-danger { background: var(--sev-critical-bg); border-color: var(--sev-critical-border); color: var(--sev-critical-text); }
/* Chips con icono (reloj de «En proceso», guion de «Sin registrar»). */
.id-chip .id-signal-icon { margin-top: 0; }

/* E6: alertas y bandeja (LV-350). La gravedad se lee por símbolo + texto + color: los chips de
   vencimiento y de «Sin asignar», los vacíos con texto y acción (LV-328) y las ayudas en gris pasan
   a las señales de E5. Sólo tokens `--sev-*` y `--ac-*`; el contraste de cada par se calcula en
   `test_lv350_alert_signals`. */
.al-sev, .al-flag { display: inline-flex; align-items: center; gap: 0.3rem; }
.al-sev .id-signal-icon, .al-flag .id-signal-icon, .kanban-due .id-signal-icon { flex: none; margin-top: 0; }
.al-sev { font-weight: 600; white-space: normal; text-align: left; }
.al-flag {
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--sev-warning-border);
  border-radius: var(--id-r-control);
  background: var(--sev-warning-bg);
  color: var(--sev-warning-text);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}
.alert-reason .id-hint { margin: 0; }
.task-meta { color: var(--ac-text-secondary); font-size: 0.875rem; }
.kanban-due { display: flex; align-items: center; gap: 0.3rem; }
.kanban-due.is-overdue::before { content: none; }
.kanban-empty .id-hint { justify-content: center; font-size: 0.875rem; }
@media (max-width: 575.98px) {
  .al-sev, .al-flag { max-width: 100%; }
}

/* E7: sección «Entorno» (LV-358, LV-367 fase 2). Cabecera común, pestañas, niveles ● ▲ ◆, advertencia única y pie de
   fuente. Sólo lee `--id-*`, `--ac-*` y `--sev-*` y define tokens `--id-env-*`. Un nivel se lee por símbolo
   + texto + color, y NINGUNO usa el rojo de «crítico»: la sección informa, no decide. ● Info es cian
   (`--sev-advisory-*`), ▲ Atención ámbar (`--sev-warning-*`) y ◆ Fuerte un naranja propio, más oscuro y con
   borde de 2 px: ámbar y naranja se distinguen también por el símbolo y la palabra. Sin animación ni
   desplazamientos horizontales. El contraste de cada par se calcula en `apps/environment/test_lv358_environment.py`
   y los de LV-367 en `apps/environment/test_lv367_tiles.py`. */
.env-section {
  --id-env-info-bg: var(--sev-advisory-bg);
  --id-env-info-fg: var(--sev-advisory-text);
  --id-env-info-bd: var(--sev-advisory-border);
  --id-env-attention-bg: var(--sev-warning-bg);
  --id-env-attention-fg: var(--sev-warning-text);
  --id-env-attention-bd: var(--sev-warning-border);
  --id-env-strong-bg: #ffedd5;
  --id-env-strong-fg: #9a3412;
  --id-env-strong-bd: #9a3412;
  display: grid;
  gap: var(--id-sp-3);
  min-width: 0;
}
[data-theme="dark"] .env-section,
[data-theme="dark"] .env-strip {
  --id-env-strong-bg: #3b1d0a;
  --id-env-strong-fg: #fdba74;
  --id-env-strong-bd: #fdba74;
}
.env-section > * { min-width: 0; }
.env-tabs ul { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0; padding: 0 0 0 0; list-style: none; border-bottom: 1px solid var(--id-edge); }
.env-tab {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: var(--id-r-control) var(--id-r-control) 0 0;
  color: var(--ac-text-secondary);
  font-weight: 600;
  text-decoration: none;
}
.env-tab:hover { color: var(--ac-text); background: var(--ac-surface); }
.env-tab.is-active { border-color: var(--id-edge); background: var(--ac-surface); color: var(--ac-text); }
.env-header, .env-panel, .env-foot {
  padding: var(--id-sp-2) var(--id-sp-3);
  border: 1px solid var(--id-edge);
  border-radius: var(--id-r-card);
  background: var(--ac-surface);
  color: var(--ac-text);
  box-shadow: var(--id-lift);
}
.env-header { display: grid; gap: var(--id-sp-2) var(--id-sp-3); grid-template-columns: minmax(0, 1fr); }
.env-title { margin: 0 0 0.4rem; font-size: var(--id-fs-lg); font-weight: 700; color: var(--ac-text); }
.env-city { margin: 0 0 0.6rem; font-size: var(--id-fs-lg); font-weight: 700; }
.env-change { margin-left: 0.5rem; font-size: 0.875rem; font-weight: 600; color: var(--ac-text); text-decoration: underline; }
.env-facts { display: flex; flex-wrap: wrap; gap: var(--id-sp-2) var(--id-sp-3); margin: 0; }
.env-facts div { min-width: 5rem; }
.env-facts dt { display: flex; align-items: center; gap: 0.35rem; font-size: 0.875rem; font-weight: 600; color: var(--ac-text-secondary); }
.env-facts dt .nav-icon { width: 1.1rem; height: 1.1rem; flex: 0 0 1.1rem; }
.env-facts dd { margin: 0; font-size: var(--id-fs-lg); font-weight: 700; font-variant-numeric: tabular-nums; }
.env-lvl {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.1rem 0.55rem;
  border: 1px solid var(--id-env-info-bd);
  border-radius: var(--id-r-pill);
  background: var(--id-env-info-bg);
  color: var(--id-env-info-fg);
  font-size: var(--id-fs-sm);
  font-weight: 700;
  white-space: nowrap;
}
.env-lvl--attention { border-color: var(--id-env-attention-bd); background: var(--id-env-attention-bg); color: var(--id-env-attention-fg); }
.env-lvl--strong { border-color: var(--id-env-strong-bd); border-width: 2px; background: var(--id-env-strong-bg); color: var(--id-env-strong-fg); }
.env-referential { grid-column: 1 / -1; margin: 0; padding-top: var(--id-sp-1); border-top: 1px solid var(--ac-border); font-size: 0.875rem; color: var(--ac-text); }
.env-referential-sym { width: 1.1rem; height: 1.1rem; vertical-align: -0.2em; color: var(--ac-text-secondary); }
.env-panel p { max-width: 65ch; margin: 0 0 0.6rem; font-size: 0.875rem; }
.env-assume { color: var(--ac-text-secondary); font-size: var(--id-fs-sm); }
.env-foot p { margin: 0 0 0.3rem; font-size: var(--id-fs-sm); color: var(--ac-text-secondary); }
.env-foot a, .env-source a { color: var(--ac-text); font-weight: 600; text-decoration: underline; }
.env-source--stale { color: var(--sev-warning-text); font-weight: 600; }
.env-legend { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; font-size: var(--id-fs-sm); }

/* E7b: franja «Entorno hoy» del panel (LV-358, E2; tarjetas en LV-367 fase 2). Vive fuera de `.env-section`, así que
   repite los mismos tokens de nivel (una prueba exige que sean idénticos, en claro y oscuro). Tres tarjetas sobre
   `--id-tile`, cada una con un filete izquierdo de 4 px en el color de SU nivel y el borde de 3:1 de `--id-edge`;
   sin animación (la escena del cielo vive en la pestaña Tiempo). */
.env-strip {
  --id-env-info-bg: var(--sev-advisory-bg);
  --id-env-info-fg: var(--sev-advisory-text);
  --id-env-info-bd: var(--sev-advisory-border);
  --id-env-attention-bg: var(--sev-warning-bg);
  --id-env-attention-fg: var(--sev-warning-text);
  --id-env-attention-bd: var(--sev-warning-border);
  --id-env-strong-bg: #ffedd5;
  --id-env-strong-fg: #9a3412;
  --id-env-strong-bd: #9a3412;
  display: grid;
  gap: var(--id-sp-2);
  min-width: 0;
  margin-bottom: var(--id-sp-3);
  padding: var(--id-sp-2) var(--id-sp-3);
  border: 1px solid var(--id-edge);
  border-radius: var(--id-r-card);
  background: var(--ac-surface);
  color: var(--ac-text);
  box-shadow: var(--id-lift);
}
.env-strip--loading { min-height: 96px; }
.env-strip-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem var(--id-sp-3); }
.env-strip .env-title { margin: 0; }
.env-strip-city { font-weight: 700; }
.env-strip-link { color: var(--ac-text); font-size: 0.875rem; font-weight: 600; text-decoration: underline; }
.env-strip-head .env-strip-link { margin-left: auto; }
.env-strip-note { margin: 0; font-size: 0.875rem; }
.env-strip-cells { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--id-sp-2); }
.env-cell {
  display: grid;
  align-content: start;
  gap: 0.4rem;
  min-width: 0;
  padding: var(--id-sp-2);
  border: 1px solid var(--id-edge);
  border-left: 4px solid var(--id-env-info-fg);
  border-radius: var(--id-r-card);
  background: var(--id-tile);
}
.env-cell--attention { border-left-color: var(--id-env-attention-fg); }
.env-cell--strong { border-left-color: var(--id-env-strong-fg); }
.env-cell-head { display: flex; align-items: center; gap: 0.5rem; }
.env-cell-head .nav-icon { width: 1.4rem; height: 1.4rem; flex: 0 0 1.4rem; color: var(--ac-text-secondary); }
.env-cell-title { margin: 0; font-size: 0.875rem; font-weight: 700; color: var(--ac-text-secondary); }
.env-cell-now { display: flex; align-items: center; gap: 0.6rem; margin: 0; }
.env-cell-ico .wx-ico { width: 3rem; height: 3rem; flex: none; }
.env-cell-temp, .env-cell-big { margin: 0; font-size: var(--id-fs-2xl); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.env-cell-cond, .env-cell-when, .env-cell-more { font-size: 0.875rem; color: var(--ac-text-secondary); }
.env-cell-more { margin: 0; }
.env-cell-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.5rem; margin: 0; font-size: 0.875rem; }
.env-cell-calm { align-items: center; }
.env-cell-calm .nav-icon { width: 1.1rem; height: 1.1rem; flex: 0 0 1.1rem; color: var(--id-env-info-fg); }
/* LV-411: los pares zona–permiso de la tarjeta «Espacio aéreo», cada uno con sus dos enlaces. */
.env-air-pairs { display: grid; gap: 0.35rem; margin: 0; padding: 0; list-style: none; font-size: 0.875rem; }
.env-air-pairs li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.15rem 0.5rem; }
@media (min-width: 768px) {
  .env-strip-cells { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
}
@media (min-width: 992px) {
  .env-header { grid-template-columns: minmax(0, 1fr); }
}

/* E7c: banda de 24 h del centelleo GNSS (LV-367, SVG de servidor, sin `style=""`). Pista con borde de 3:1, ventana
   típica con TRAMA ámbar (no sólo color) y «ahora» en el color del texto; el eje y las cifras van aparte, en texto. */
.id-gx-svg { display: block; max-width: 100%; height: auto; }
.id-gx-track { fill: var(--ac-surface); stroke: var(--id-edge); stroke-width: 1; }
.id-gx-win { stroke: var(--sev-warning-text); stroke-width: 1; }
.id-gx-hatch { stroke: var(--sev-warning-text); }
.id-gx-now { stroke: var(--ac-text); }
.id-gx-now-dot { fill: var(--ac-text); }
.id-gx-tick { fill: var(--ac-text-secondary); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
/* Línea completa de la pestaña (fase 3): rótulo sobre cada pista, noche rellena con el borde de 3:1, hora pico punteada. */
.id-gx-svg--full { max-width: 20rem; width: 100%; }
.id-gx-label { fill: var(--ac-text); font-size: 0.8125rem; font-weight: 600; }
.id-gx-label--peak { font-size: 0.75rem; font-weight: 400; fill: var(--ac-text-secondary); }
.id-gx-night { fill: var(--id-edge); }
.id-gx-peak { stroke: var(--ac-text-secondary); }
.id-gx-facts { display: flex; flex-wrap: wrap; gap: var(--id-sp-1) var(--id-sp-3); margin: var(--id-sp-1) 0; }
.id-gx-facts div { min-width: 6rem; }
.id-gx-facts dt, .id-gx-glossary dt { font-size: 0.875rem; font-weight: 600; color: var(--ac-text-secondary); }
.id-gx-facts dd { margin: 0; font-size: var(--id-fs-md); font-weight: 700; font-variant-numeric: tabular-nums; }
/* Calendario de temporada: relleno ámbar (con ● y la palabra) dentro, contorno (○) fuera, anillo y «hoy» en el mes actual. */
.id-gx-months, .id-gx-years { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: var(--id-sp-1) 0; padding: 0; list-style: none; }
.id-gx-month { display: inline-flex; align-items: center; gap: 0.3rem; min-width: 4.2rem; padding: 0.3rem 0.55rem; border: 1px solid var(--id-edge); border-radius: var(--id-r-control); background: var(--id-tile); color: var(--ac-text-secondary); font-size: 0.875rem; font-weight: 600; }
.id-gx-month.is-on { border-color: var(--sev-warning-text); background: var(--sev-warning-bg); color: var(--sev-warning-text); }
.id-gx-month.is-now { outline: 3px solid var(--ac-text); outline-offset: 2px; }
.id-gx-today { font-weight: 800; color: var(--ac-text); }
.id-gx-years { gap: 0.4rem var(--id-sp-3); font-size: 0.875rem; }
.id-gx-year.is-now b { text-decoration: underline; }
.id-gx-glossary { display: grid; gap: var(--id-sp-1); margin: var(--id-sp-1) 0 0; }
.id-gx-glossary dt { display: flex; align-items: center; gap: 0.4rem; }
.id-gx-glossary dt .nav-icon { width: 1.2rem; height: 1.2rem; flex: 0 0 1.2rem; }
.id-gx-glossary dd { max-width: 65ch; margin: 0 0 0 1.6rem; font-size: 0.875rem; }
.env-gnss-noscale { max-width: 65ch; }
.env-gnss-noscale .nav-icon { width: 1.1rem; height: 1.1rem; vertical-align: -0.2em; color: var(--ac-text-secondary); }

/* == F: ilustración y movimiento == */
/* Contiene: F1 plano técnico (cabecera del panel y portada) y F2 entradas (reservada); las animaciones van en el bloque de movimiento de abajo. */

/* F1: plano técnico. Trazos con currentColor: el color lo da el contenedor (`.hero-sky`, `.showcase-route`). */
.bp-line { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0.4; }
.bp-thin { fill: none; stroke: currentColor; stroke-width: 0.8; opacity: 0.3; }
.bp-ring { stroke-dasharray: 2 3; }
.bp-center { stroke-dasharray: 8 3 1 3; opacity: 0.22; }
.bp-text { fill: currentColor; opacity: 0.4; font: 8px ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: 0.04em; }
.bp-blades { transform-box: fill-box; transform-origin: center; }
.route-wp circle { fill: none; stroke: currentColor; stroke-width: 1.2; opacity: 0.45; }
.hero-sky { -webkit-mask-image: linear-gradient(90deg, transparent, #000 28%); mask-image: linear-gradient(90deg, transparent, #000 28%); }
.showcase-route { color: #9fd8f5; }
.showcase-route .bp-line { opacity: 0.85; stroke-width: 2; }
.showcase-route .bp-thin { opacity: 0.55; stroke-width: 1.1; }
.showcase-route .bp-text { opacity: 0.7; font-size: 11px; }

/* Portada: topografía y telemetría. Capas estáticas bajo el texto en <= 0,2 de opacidad para que el
   titular y los tres puntos sigan en >= 4,5:1 (calculado en test_lv321_ambient); las lecturas de
   telemetría y el rumbo van en las esquinas libres, fuera de las cajas de texto. */
.topo { fill: none; stroke: currentColor; stroke-width: 0.8; opacity: 0.16; }
.topo--index { stroke-width: 1.1; opacity: 0.2; }
.topo-label { fill: currentColor; opacity: 0.2; font: 8px ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
.hud-line { fill: none; stroke: currentColor; stroke-width: 1; opacity: 0.35; }
.hud-dash { stroke-dasharray: 3 4; }
.hud-fill { fill: currentColor; opacity: 0.35; }
.hud-text { fill: currentColor; opacity: 0.4; font: 10px ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: 0.06em; }
.radar-wedge { fill: currentColor; opacity: 0.1; }
.radar-sweep { transform-origin: 0 0; }
.route-trail { fill: none; stroke: #7dd3fc; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1 1; stroke-dashoffset: 1; opacity: 0; }
.wp-ring { fill: none; stroke: #22d3c5; stroke-width: 1.6; opacity: 0.25; transform-box: fill-box; transform-origin: center; }

/* Con el panel de marca a la vista, el nombre ya lo lleva su wordmark: la tarjeta conserva isotipo y
   subtítulo, y el `h1` queda sólo para lectores de pantalla. Bajo 992 px el panel no existe y la
   tarjeta vuelve a mostrar el nombre. */
@media (min-width: 992px) {
  .login-title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* F2: cabecera por módulo y fondos. El rótulo (icono + nombre del módulo de la barra) va sobre el
   título y el fondo es una máscara de trazo propia (`static/img/modules/*-bg.svg`) pintada con
   `--ac-text-secondary` a 0,16 (claro) / 0,24 (oscuro) de opacidad, anclado al título: sigue el tema claro y oscuro sin redefinir ningún
   token del tema y el título (`--ac-text`) conserva >= 4,5:1 (calculado en test_lv324_module_header). */
.module-tag {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  color: var(--ac-text-secondary);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.module-tag .nav-icon { width: 16px; height: 16px; flex: none; color: inherit; }

/* Opacidad de reposo del dibujo por tema (la calcula test_lv324 contra el contraste del texto). */
:root { --id-module-bg-opacity: 0.16; }
[data-theme="dark"] { --id-module-bg-opacity: 0.24; }

.page-header--module {
  position: relative;
  isolation: isolate;
  min-height: 92px;
  padding-block: 0.75rem;
}

.page-header--module::before {
  content: "";
  position: absolute;
  /* Termina 280 px antes del borde derecho: el dibujo nunca llega a los botones de acción. */
  inset: 0 280px 0 0;
  z-index: -1;
  pointer-events: none;
  background: var(--ac-text-secondary);
  opacity: var(--id-module-bg-opacity);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  /* Anclado al título: el motivo de cada máscara arranca hacia el 36 % del lienzo, así que se corre
     a la izquierda para que empiece junto al rótulo y no flote a media pantalla. */
  -webkit-mask-position: left -70px center;
  mask-position: left -70px center;
  -webkit-mask-size: auto 100%;
  mask-size: auto 100%;
}

.page-header--module[data-module="flight"]::before { -webkit-mask-image: url("../img/modules/flight-bg.svg"); mask-image: url("../img/modules/flight-bg.svg"); }
.page-header--module[data-module="compliance"]::before { -webkit-mask-image: url("../img/modules/compliance-bg.svg"); mask-image: url("../img/modules/compliance-bg.svg"); }
.page-header--module[data-module="reports"]::before { -webkit-mask-image: url("../img/modules/reports-bg.svg"); mask-image: url("../img/modules/reports-bg.svg"); }
.page-header--module[data-module="maintenance"]::before { -webkit-mask-image: url("../img/modules/maintenance-bg.svg"); mask-image: url("../img/modules/maintenance-bg.svg"); }
.page-header--module[data-module="registry"]::before { -webkit-mask-image: url("../img/modules/registry-bg.svg"); mask-image: url("../img/modules/registry-bg.svg"); }
.page-header--module[data-module="inventory"]::before { -webkit-mask-image: url("../img/modules/inventory-bg.svg"); mask-image: url("../img/modules/inventory-bg.svg"); }

.form-shell .page-header--module::before { inset-inline-end: 0; }

@media (max-width: 767.98px) {
  .page-header--module::before { display: none; }
}

/* Estado vacío: retícula de plano y halo detrás de la lámina, sólo con CSS. */
.empty-art-wrap {
  position: relative;
  isolation: isolate;
}

.empty-art-wrap::before,
.empty-art-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  z-index: -1;
  width: min(320px, 96%);
  aspect-ratio: 1;
  translate: -50% 0;
  pointer-events: none;
}

.empty-art-wrap::before {
  background-image:
    linear-gradient(var(--ac-text-secondary) 1px, transparent 1px),
    linear-gradient(90deg, var(--ac-text-secondary) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.09;
  -webkit-mask-image: radial-gradient(closest-side, #000 35%, transparent);
  mask-image: radial-gradient(closest-side, #000 35%, transparent);
}

.empty-art-wrap::after {
  background: radial-gradient(closest-side, var(--ac-primary), transparent);
  opacity: 0.12;
}

/* F3: tiempo (LV-347). Tarjeta informativa del panel. Sólo usa `--id-*`, `--ac-*` y `--sev-*` (no
   redefine ninguno) y tokens propios `--wx-*`. El texto de la cabecera es `--ac-text` y su contraste
   sobre ambos extremos de cada degradado, claro y oscuro, se calcula en test_lv347_weather_card. */
.wx-card {
  position: relative;
  margin-bottom: var(--id-sp-3);
  border: 1px solid var(--ac-border);
  border-radius: var(--id-r-card);
  background: var(--ac-surface);
  color: var(--ac-text);
  box-shadow: var(--id-lift);
  overflow: hidden;
  min-width: 0;
}

.wx-head {
  --id-wx-a: color-mix(in srgb, var(--sev-advisory-border) 60%, var(--ac-surface));
  --id-wx-b: color-mix(in srgb, var(--sev-nominal-border) 45%, var(--ac-surface));
  position: relative;
  isolation: isolate;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--id-sp-2) var(--id-sp-3);
  padding: var(--id-sp-2) var(--id-sp-3);
  background: linear-gradient(135deg, var(--id-wx-a), var(--id-wx-b));
  color: var(--ac-text);
  overflow: hidden;
}

.wx-head--clear { --id-wx-a: color-mix(in srgb, var(--sev-warning-border) 70%, var(--ac-surface)); --id-wx-b: color-mix(in srgb, var(--sev-advisory-border) 45%, var(--ac-surface)); }
.wx-head--partly { --id-wx-a: color-mix(in srgb, var(--sev-advisory-border) 65%, var(--ac-surface)); --id-wx-b: color-mix(in srgb, var(--sev-warning-border) 35%, var(--ac-surface)); }
.wx-head--cloudy { --id-wx-a: color-mix(in srgb, var(--sev-nominal-border) 70%, var(--ac-surface)); --id-wx-b: color-mix(in srgb, var(--sev-nominal-bg) 60%, var(--ac-surface)); }
.wx-head--fog { --id-wx-a: color-mix(in srgb, var(--sev-nominal-border) 45%, var(--ac-surface)); --id-wx-b: color-mix(in srgb, var(--sev-nominal-bg) 80%, var(--ac-surface)); }
.wx-head--rain { --id-wx-a: color-mix(in srgb, var(--sev-advisory-border) 80%, var(--ac-surface)); --id-wx-b: color-mix(in srgb, var(--sev-nominal-border) 60%, var(--ac-surface)); }
.wx-head--snow { --id-wx-a: color-mix(in srgb, var(--sev-advisory-bg) 90%, var(--ac-surface)); --id-wx-b: color-mix(in srgb, var(--sev-nominal-bg) 80%, var(--ac-surface)); }
.wx-head--storm { --id-wx-a: color-mix(in srgb, var(--sev-critical-border) 55%, var(--ac-surface)); --id-wx-b: color-mix(in srgb, var(--sev-nominal-border) 70%, var(--ac-surface)); }
.wx-head--wind { --id-wx-a: color-mix(in srgb, var(--ac-primary) 30%, var(--ac-surface)); --id-wx-b: color-mix(in srgb, var(--sev-advisory-border) 55%, var(--ac-surface)); }
.wx-head.is-night { --id-wx-a: color-mix(in srgb, var(--ac-text-secondary) 38%, var(--ac-surface)); }

.wx-now { display: flex; align-items: center; gap: var(--id-sp-2); }
.wx-ico { display: block; flex: none; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.wx-ico--lg { width: 88px; height: 88px; }
.wx-ico--sm { width: 26px; height: 26px; stroke-width: 3.4; }
.wx-cloud-shape { fill: var(--ac-surface); }
.wx-cloud-back { fill: var(--sev-nominal-bg); }
.wx-fill-sun { fill: var(--sev-warning-border); }
.wx-fill-moon { fill: var(--sev-advisory-border); }
.wx-bolt { fill: var(--sev-warning-border); }
.wx-flake { fill: var(--ac-surface); }
.wx-spin { transform-box: fill-box; transform-origin: center; }

.wx-temp { margin: 0; font-family: var(--id-display); font-size: 3.4rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.wx-cond { margin: 0.2rem 0 0; font-size: var(--id-fs-sm); font-weight: 600; }
.wx-where { min-width: 0; text-align: right; }
.wx-title { margin: 0; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ac-text); }
.wx-city { margin: 0.1rem 0 0.4rem; font-size: var(--id-fs-lg); font-weight: 700; overflow-wrap: anywhere; }
.wx-change {
  display: inline-block;
  padding: 0.2rem 0.75rem;
  border: 1px solid var(--ac-text);
  border-radius: var(--id-r-pill);
  background: color-mix(in srgb, var(--ac-surface) 55%, transparent);
  color: var(--ac-text);
  font-size: var(--id-fs-sm);
  font-weight: 700;
  text-decoration: none;
}

.wx-change:hover { background: var(--ac-surface); color: var(--ac-text); }

.wx-drift {
  position: absolute;
  z-index: -1;
  width: 180px;
  height: 56px;
  border-radius: var(--id-r-pill);
  background: color-mix(in srgb, var(--ac-surface) 38%, transparent);
  pointer-events: none;
}

.wx-drift--a { top: 14%; left: 8%; }
.wx-drift--b { bottom: 10%; right: 18%; width: 130px; height: 40px; }
.wx-head--clear .wx-drift, .wx-head--snow .wx-drift, .wx-head--wind .wx-drift { display: none; }

.wx-body { display: grid; gap: var(--id-sp-2) var(--id-sp-3); padding: var(--id-sp-2) var(--id-sp-3); }
.wx-col { min-width: 0; }
.wx-h { margin: var(--id-sp-2) 0 0.4rem; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ac-text-secondary); }
.wx-col > .wx-h:first-child { margin-top: 0; }

.wx-strip { overflow-x: auto; padding-bottom: 0.25rem; border-radius: var(--id-r-control); }
.wx-strip-inner { position: relative; }
.wx-line { display: block; color: var(--ac-primary); }
.wx-hours { display: flex; margin: 0; padding: 0; list-style: none; }
.wx-hour { flex: none; width: 34px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 0.72rem; text-align: center; }
.wx-hour-t { font-size: 0.78rem; }
.wx-bars { position: relative; display: block; width: 14px; height: 44px; }
.wx-bars i { position: absolute; bottom: 0; left: 0; display: block; width: 100%; height: max(3px, var(--v)); border-radius: 3px 3px 0 0; }
.wx-gust { background: var(--sev-warning-border); }
.wx-bars .wx-wind { left: 20%; width: 60%; background: var(--ac-primary); }
.wx-hour-w { font-weight: 700; }
.wx-hour-w small { display: block; font-size: 0.68rem; font-weight: 500; color: var(--ac-text-secondary); }
.wx-hour-r { color: var(--sev-advisory-text); font-weight: 700; }
.wx-hour-h { color: var(--ac-text-secondary); }
/* LV-373: la hora actual y el cambio de día de la franja. Se dicen con TEXTO («Ahora» + hh:mm; «mar 27») además del
   resalte: fondo + contorno de `--ac-primary` (el contorno sobrevive al modo de alto contraste, que quita los
   fondos) y un filo `--id-edge` a la izquierda de la primera columna del día nuevo. Sin animación. */
.wx-hour.is-now { background: color-mix(in srgb, var(--ac-primary) 14%, transparent); outline: 2px solid var(--ac-primary); outline-offset: -2px; border-radius: var(--id-r-control); }
.wx-hour.is-newday { border-left: 1px solid var(--id-edge); }
.wx-hour-m { display: flex; flex-direction: column; align-items: center; min-height: 2.1em; font-size: 0.66rem; line-height: 1.05; color: var(--ac-text-secondary); }
.wx-mark-now { font-weight: 800; color: var(--ac-text); }
.wx-mark-day { display: flex; flex-direction: column; align-items: center; font-weight: 700; }
.wx-key { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin: 0.4rem 0 0; font-size: 0.72rem; color: var(--ac-text-secondary); }
.wx-key i { display: inline-block; width: 10px; height: 10px; margin-right: 0.3rem; border-radius: 2px; }
.wx-key-wind { background: var(--ac-primary); }
.wx-key-gust { background: var(--sev-warning-border); }
.wx-key-rain { background: var(--sev-advisory-text); }

.wx-days { margin: 0; padding: 0; list-style: none; }
.wx-day { display: grid; grid-template-columns: 4.6rem 28px 2.4rem 2rem minmax(40px, 1fr) 2rem; align-items: center; gap: 0.4rem; padding: 0.2rem 0 0.2rem 0.3rem; border-top: 1px solid var(--ac-border); border-left: 3px solid transparent; font-size: var(--id-fs-sm); }
.wx-day:first-child { border-top: 0; }
.wx-day-n { font-weight: 700; }
.wx-day-n small { font-weight: 500; color: var(--ac-text-secondary); }
/* LV-373: la fila de hoy, con texto («Hoy») y una barra a la izquierda además del fondo. */
.wx-day.is-today { background: color-mix(in srgb, var(--ac-primary) 12%, transparent); border-left-color: var(--ac-primary); }
.wx-day-r { color: var(--sev-advisory-text); font-weight: 700; }
.wx-day-lo { text-align: right; color: var(--ac-text-secondary); }
.wx-day-hi { font-weight: 700; }
.wx-range { position: relative; height: 6px; border-radius: var(--id-r-pill); background: var(--ac-border); }
.wx-range i { position: absolute; top: 0; bottom: 0; border-radius: var(--id-r-pill); background: linear-gradient(90deg, var(--sev-advisory-border), var(--sev-warning-border)); }

.wx-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: 0.5rem; margin: 0; }
.wx-facts div { padding: 0.4rem 0.6rem; border: 1px solid var(--ac-border); border-radius: var(--id-r-control); }
.wx-facts dt { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ac-text-secondary); }
.wx-facts dd { margin: 0; font-weight: 700; }
.wx-arrow { vertical-align: -2px; transform: rotate(var(--rot, 0deg)); }

.wx-events { display: grid; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.wx-event { display: grid; grid-template-columns: auto 1fr auto; gap: 0.1rem 0.6rem; align-items: baseline; padding: 0.45rem 0.65rem; border: 1px solid var(--ac-border); border-radius: var(--id-r-control); }
.wx-lvl { grid-row: span 2; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.wx-event-t { font-size: var(--id-fs-md); }
.wx-event-v { font-weight: 800; text-align: right; }
.wx-event-w { grid-column: 2 / -1; font-size: var(--id-fs-sm); }
.wx-event--info { background: var(--sev-advisory-bg); border-color: var(--sev-advisory-border); color: var(--sev-advisory-text); }
.wx-event--attention { background: var(--sev-warning-bg); border-color: var(--sev-warning-border); color: var(--sev-warning-text); }
.wx-event--strong { background: var(--sev-critical-bg); border-color: var(--sev-critical-border); color: var(--sev-critical-text); }
.wx-none { margin: 0; padding: 0.55rem 0.65rem; border: 1px dashed var(--ac-border); border-radius: var(--id-r-control); font-size: var(--id-fs-sm); color: var(--ac-text-secondary); }

.wx-foot { padding: 0.6rem var(--id-sp-3); border-top: 1px solid var(--ac-border); font-size: 0.75rem; color: var(--ac-text-secondary); }
.wx-foot p { margin: 0; }
.wx-legend { font-weight: 600; }
.wx-credit a { color: inherit; text-decoration: underline; }

.wx-card--note .wx-note { padding: var(--id-sp-2) var(--id-sp-3); }
.wx-card--note .wx-title { margin-bottom: 0.3rem; color: var(--ac-text-secondary); }
.wx-note .wx-change { border-color: var(--ac-border); background: transparent; }

/* Esqueleto de carga: estático, del tamaño aproximado de la tarjeta. */
.wx-card--loading { min-height: 220px; padding: var(--id-sp-2) var(--id-sp-3); }
.wx-skel { border-radius: var(--id-r-control); background: var(--ac-border); }
.wx-skel--head { height: 88px; margin-bottom: var(--id-sp-2); }
.wx-skel--line { height: 14px; margin-bottom: 0.6rem; }
.wx-skel--short { width: 55%; }

@media (min-width: 992px) {
  .wx-body { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}

@media (max-width: 575.98px) {
  .wx-where { text-align: left; }
  .wx-temp { font-size: 2.8rem; }
  .wx-ico--lg { width: 72px; height: 72px; }
}

/* F3b: banda de centelleo GNSS (LV-352, LV-358 E3). La ventana típica sombreada sobre la franja de 24 h del Tiempo
   (`weather/_panel_card.html`): ámbar de advertencia con TRAMA (no sólo color) y su leyenda con texto. Sólo lee
   `--ac-*` y `--sev-*`; no se anima. Es estadística de la fuente, no una medición. */
.wx-gnss-band {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 0;
  pointer-events: none;
  border-inline: 1px dashed var(--sev-warning-border);
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--sev-warning-border) 26%, transparent) 0 4px, transparent 4px 9px);
}
.wx-line, .wx-hours { position: relative; z-index: 1; }
.wx-key-gnss { background: repeating-linear-gradient(135deg, var(--sev-warning-border) 0 2px, transparent 2px 4px); border: 1px solid var(--sev-warning-border); }

/* F3c: cielo (LV-356). Escena SVG detrás de la cabecera de la tarjeta del tiempo (`weather/_sky.html`),
   decorativa. Sólo define tokens `--id-sky-*` (con prefijo `--id-`, lo único que esta hoja puede
   definir) por fase del día, claro y oscuro, y no redefine ningún `--ac-*` ni `--sev-*`. El texto
   de la cabecera sigue siendo `--ac-text` y va sobre un velo `--id-sky-scrim` del color contrario
   al texto: su contraste sobre cada color de cada fase se calcula en test_lv356_sky_scene. */
@property --id-sky-top { syntax: "<color>"; inherits: true; initial-value: #2f86d6; }
@property --id-sky-bot { syntax: "<color>"; inherits: true; initial-value: #8ccaf2; }
@property --id-sky-sun { syntax: "<color>"; inherits: true; initial-value: #fff3b0; }
@property --id-sky-cloud { syntax: "<color>"; inherits: true; initial-value: #ffffff; }
@property --id-sky-ridge { syntax: "<color>"; inherits: true; initial-value: #36546f; }

.wx-head--sky {
  --id-sky-top: #2f86d6;
  --id-sky-bot: #8ccaf2;
  --id-sky-sun: #fff3b0;
  --id-sky-cloud: #ffffff;
  --id-sky-ridge: #36546f;
  --id-sky-moon: #eef2ff;
  --id-sky-ink: var(--ac-text);
  --id-sky-scrim: #ffffffb3;
  background: linear-gradient(180deg, var(--id-sky-top), var(--id-sky-bot));
  color: var(--id-sky-ink);
}
[data-theme="dark"] .wx-head--sky { --id-sky-scrim: #0b1430b3; }
.wx-head[data-sky="night"] { --id-sky-top: #0b1430; --id-sky-bot: #1d2f5c; --id-sky-sun: #f6d365; --id-sky-cloud: #5a6a94; --id-sky-ridge: #070d1f; }
.wx-head[data-sky="dawn"] { --id-sky-top: #3a3f7a; --id-sky-bot: #f2a07b; --id-sky-sun: #ffd9a0; --id-sky-cloud: #f7c3b3; --id-sky-ridge: #1d2347; }
.wx-head[data-sky="morning"] { --id-sky-top: #5aa8e8; --id-sky-bot: #bfe3f7; --id-sky-sun: #ffe38a; --id-sky-cloud: #ffffff; --id-sky-ridge: #3b5a7a; }
.wx-head[data-sky="midday"] { --id-sky-top: #2f86d6; --id-sky-bot: #8ccaf2; --id-sky-sun: #fff3b0; --id-sky-cloud: #ffffff; --id-sky-ridge: #36546f; }
.wx-head[data-sky="afternoon"] { --id-sky-top: #3f8fdc; --id-sky-bot: #a6d6f2; --id-sky-sun: #ffe08a; --id-sky-cloud: #ffffff; --id-sky-ridge: #3a5670; }
.wx-head[data-sky="sunset"] { --id-sky-top: #4a3b7c; --id-sky-bot: #f58b5b; --id-sky-sun: #ffc36b; --id-sky-cloud: #f7b79a; --id-sky-ridge: #2a2148; }
.wx-head[data-sky="twilight"] { --id-sky-top: #1e2a5e; --id-sky-bot: #8a5a8f; --id-sky-sun: #ff9e6b; --id-sky-cloud: #9a7fa8; --id-sky-ridge: #131a3a; }
[data-theme="dark"] .wx-head[data-sky="night"] { --id-sky-top: #060b1c; --id-sky-bot: #121f40; --id-sky-sun: #f6d365; --id-sky-cloud: #46557d; --id-sky-ridge: #04070f; }
[data-theme="dark"] .wx-head[data-sky="dawn"] { --id-sky-top: #2a2e60; --id-sky-bot: #b5705a; --id-sky-sun: #ffd9a0; --id-sky-cloud: #d9a496; --id-sky-ridge: #121733; }
[data-theme="dark"] .wx-head[data-sky="morning"] { --id-sky-top: #2f6aa8; --id-sky-bot: #7fb0d6; --id-sky-sun: #ffe38a; --id-sky-cloud: #dbe6f2; --id-sky-ridge: #2a4560; }
[data-theme="dark"] .wx-head[data-sky="midday"] { --id-sky-top: #1f5fa0; --id-sky-bot: #5f9fcb; --id-sky-sun: #fff3b0; --id-sky-cloud: #dbe6f2; --id-sky-ridge: #27415a; }
[data-theme="dark"] .wx-head[data-sky="afternoon"] { --id-sky-top: #2a6ba8; --id-sky-bot: #7aaed0; --id-sky-sun: #ffe08a; --id-sky-cloud: #dbe6f2; --id-sky-ridge: #2b4760; }
[data-theme="dark"] .wx-head[data-sky="sunset"] { --id-sky-top: #33295e; --id-sky-bot: #c4673f; --id-sky-sun: #ffc36b; --id-sky-cloud: #c99a86; --id-sky-ridge: #1a1530; }
[data-theme="dark"] .wx-head[data-sky="twilight"] { --id-sky-top: #141d46; --id-sky-bot: #65406e; --id-sky-sun: #ff9e6b; --id-sky-cloud: #7d6690; --id-sky-ridge: #0b1128; }

/* Capas: la escena al fondo, el velo encima y el texto sobre todo (la cabecera aísla su contexto). */
.sky-scene { position: absolute; inset: 0; z-index: -3; display: block; width: 100%; height: 100%; pointer-events: none; }
.wx-head--sky::after { content: ""; position: absolute; inset: 0; z-index: -2; background: var(--id-sky-scrim); pointer-events: none; }
.wx-head--sky .wx-drift { display: none; }
.wx-head--sky:focus-visible { outline: 2px solid var(--ac-focus-ring); outline-offset: -2px; }
@media (min-width: 768px) {
  .wx-head--sky::after {
    background: linear-gradient(90deg, var(--id-sky-scrim) 0, var(--id-sky-scrim) 36%, transparent 54%, transparent 62%, var(--id-sky-scrim) 80%, var(--id-sky-scrim) 100%);
  }
}

.sky-sun-wrap, .sky-moon-wrap { opacity: 0; }
.sky-scene[data-sun="on"] .sky-sun-wrap, .sky-scene[data-moon="on"] .sky-moon-wrap { opacity: 1; }
.sky-sun, .sky-halo { fill: var(--id-sky-sun); }
.sky-halo { opacity: 0.28; }
.sky-halo--moon { fill: var(--id-sky-moon); opacity: 0.16; }
.sky-moon, .sky-moon-dark { fill: var(--id-sky-moon); }
.sky-moon-dark { opacity: 0.18; }
.sky-stars { opacity: 0; }
.wx-head[data-sky="night"] .sky-stars { opacity: 0.95; }
.wx-head[data-sky="dawn"] .sky-stars, .wx-head[data-sky="twilight"] .sky-stars { opacity: 0.45; }
.sky-star { fill: var(--id-sky-moon); stroke: var(--id-sky-moon); stroke-linecap: round; }
.sky-star--s { stroke-width: 2; }
.sky-star--b { stroke-width: 3.2; }
.sky-star--tw { stroke: none; }
.sky-cloud { fill: var(--id-sky-cloud); opacity: 0.9; }
.sky-cloud.is-heavy { fill: color-mix(in srgb, var(--id-sky-cloud) 62%, var(--id-sky-ridge)); }
.sky-fog rect { fill: var(--id-sky-cloud); opacity: 0.32; }
.sky-fog .sky-fog-b { opacity: 0.22; }
.sky-rain { fill: none; stroke: var(--id-sky-cloud); stroke-width: 1.4; stroke-linecap: round; opacity: 0.45; }
.sky-snow { fill: none; stroke: var(--id-sky-cloud); stroke-width: 3; stroke-linecap: round; opacity: 0.8; }
.sky-ridge { fill: var(--id-sky-ridge); }
.sky-city { fill: color-mix(in srgb, var(--id-sky-ridge) 80%, #000000); }
.sky-windows { fill: none; stroke: var(--id-sky-sun); stroke-width: 2; opacity: 0; }
.wx-head[data-sky="night"] .sky-windows, .wx-head[data-sky="twilight"] .sky-windows { opacity: 0.9; }
.wx-head[data-sky="dawn"] .sky-windows, .wx-head[data-sky="sunset"] .sky-windows { opacity: 0.55; }

/* ── Movimiento: sólo si la persona no pidió reducirlo ──────────────────── */
@media (prefers-reduced-motion: no-preference) {
  @keyframes ac-float {
    from { transform: translateY(-3px); }
    to { transform: translateY(4px); }
  }

  @keyframes ac-rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
  }

  /* La ruta de la cabecera se dibuja UNA vez (nada permanente). */
  @keyframes ac-draw {
    from { stroke-dashoffset: 1; }
    to { stroke-dashoffset: 0; }
  }

  /* El dron recorre la ruta (puntos calculados sobre la propia curva) y entra y sale con
     un desvanecido para que el salto de vuelta al inicio no se vea. */
  @keyframes ac-fly {
    0% { transform: translate(60px, 470px); opacity: 0; }
    6% { opacity: 1; }
    10% { transform: translate(140px, 436px); }
    20% { transform: translate(213px, 397px); }
    30% { transform: translate(282px, 358px); }
    40% { transform: translate(350px, 324px); }
    50% { transform: translate(420px, 300px); }
    60% { transform: translate(490px, 276px); }
    70% { transform: translate(557px, 243px); }
    80% { transform: translate(623px, 203px); }
    90% { transform: translate(690px, 158px); opacity: 1; }
    100% { transform: translate(760px, 110px); opacity: 0; }
  }

  @keyframes ac-spin {
    to { transform: rotate(360deg); }
  }

  /* F1: ambiente. Cabecera del panel: ninguna animación es infinita -- las hélices giran, frenan y
     quedan quietas (vuelven a girar al pasar el cursor), la retícula entra con fundido y la ruta se
     dibuja una vez. Lo CONTINUO (lento, ciclo >= 6 s) vive sólo en la portada y sólo bajo
     `[data-ambient]`, que `ambient-motion.js` pausa fuera de pantalla o con la pestaña oculta. */
  @keyframes ac-spin-a { to { transform: rotate(1080deg); } }
  @keyframes ac-spin-b { to { transform: rotate(1080deg); } }
  @keyframes ac-fade { from { opacity: 0; } to { opacity: 1; } }

  /* A2 (LV-330): el menú «⋯» de fila entra con un fundido de 120 ms; con `reduce` aparece de golpe. */
  @keyframes id-menu-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
  .id-rowmenu[open] > .id-rowmenu-list { animation: id-menu-in var(--id-t-fast) var(--id-ease); }

  /* Portada: la estela se dibuja detrás del dron (mismo ciclo que `ac-fly`) y cada waypoint se
     «enciende» al pasar (opacity/transform; sin saltos ni parpadeo). */
  @keyframes ac-trail {
    0% { stroke-dashoffset: 1; opacity: 0.9; }
    92% { stroke-dashoffset: 0; opacity: 0.9; }
    100% { stroke-dashoffset: 0; opacity: 0; }
  }

  @keyframes ac-wp {
    0% { opacity: 0.25; transform: scale(1); }
    4% { opacity: 1; transform: scale(1.7); }
    20%, 100% { opacity: 0.25; transform: scale(1); }
  }

  .hero-sky .bp-blades { animation: ac-spin-a 6s cubic-bezier(0.1, 0.6, 0.3, 1) 1 both; }
  .page-header--hero:hover .bp-blades { animation: ac-spin-b 6s cubic-bezier(0.1, 0.6, 0.3, 1) 1 both; }
  .hero-sky .hero-grid-fade { animation: ac-fade 1.2s ease-out both; }

  [data-ambient] .drone-fly { animation: ac-fly 14s linear infinite; }
  [data-ambient] .bp-float { animation: ac-float 6s ease-in-out infinite alternate; }
  [data-ambient] .bp-blades { animation: ac-spin 6s linear infinite; }
  [data-ambient] .radar-sweep { animation: ac-spin 14s linear infinite; }
  [data-ambient] .route-trail { animation: ac-trail 14s linear infinite; }
  [data-ambient] .wp-ring { animation: ac-wp 14s ease-out infinite; }
  [data-ambient].is-paused * { animation-play-state: paused; }

  /* F3: tiempo. Sólo `transform` y `opacity`, siete nodos como máximo (rayos, nube o gotas del icono
     grande y dos nubes de fondo), ciclos lentos y SIEMPRE bajo `[data-ambient]`, que se pausa fuera de
     pantalla. Las nubes de fondo son del color de la superficie, así que no restan contraste al texto. */
  @keyframes wx-spin { to { transform: rotate(360deg); } }
  @keyframes wx-sway { from { transform: translate(-2px, 0); } to { transform: translate(3px, 0); } }
  @keyframes wx-fall { 0% { transform: translateY(-3px); opacity: 0; } 25% { opacity: 1; } 100% { transform: translateY(7px); opacity: 0; } }
  @keyframes wx-glide { from { transform: translate(-14px, 0); } to { transform: translate(40px, 0); } }
  [data-ambient] .wx-spin { animation: wx-spin 60s linear infinite; }
  [data-ambient] .wx-cloud { animation: wx-sway 8s ease-in-out infinite alternate; }
  [data-ambient] .wx-drop { animation: wx-fall 6s linear infinite; }
  [data-ambient] .wx-drop--b { animation-delay: -2s; }
  [data-ambient] .wx-drop--c { animation-delay: -4s; }
  [data-ambient] .wx-drift--a { animation: wx-glide 26s ease-in-out infinite alternate; }
  [data-ambient] .wx-drift--b { animation: wx-glide 34s ease-in-out infinite alternate-reverse; }

  /* F3c: cielo. Sólo `opacity` y `transform`, a lo sumo ocho nodos a la vez (tres nubes, cuatro
     estrellas que titilan, y una capa de lluvia, nieve o niebla), ciclos de 6 s o más y SIEMPRE
     bajo `[data-ambient]`. Los cambios de fase se suavizan con `transition`. */
  @keyframes sky-drift { from { transform: translate(-14px, 0); } to { transform: translate(22px, 0); } }
  @keyframes sky-twinkle { 0%, 100% { opacity: 0.2; } 50% { opacity: 0.95; } }
  @keyframes sky-fall { from { transform: translate(0, 0); } to { transform: translate(0, 48px); } }
  @keyframes sky-haze { from { transform: translate(-16px, 0); } to { transform: translate(16px, 0); } }
  [data-ambient] .sky-cloud--1 { animation: sky-drift 32s ease-in-out infinite alternate; }
  [data-ambient] .sky-cloud--2 { animation: sky-drift 40s ease-in-out infinite alternate-reverse; }
  [data-ambient] .sky-cloud--3 { animation: sky-drift 48s ease-in-out infinite alternate; }
  [data-ambient] .sky-star--tw { animation: sky-twinkle 9s ease-in-out infinite; }
  [data-ambient] .sky-star--tw2 { animation-delay: -2.5s; }
  [data-ambient] .sky-star--tw3 { animation-delay: -5s; }
  [data-ambient] .sky-star--tw4 { animation-delay: -7s; }
  [data-ambient] .sky-rain { animation: sky-fall 6s linear infinite; }
  [data-ambient] .sky-snow { animation: sky-fall 14s linear infinite; }
  [data-ambient] .sky-fog { animation: sky-haze 20s ease-in-out infinite alternate; }
  .wx-head--sky { transition: --id-sky-top 1.4s ease, --id-sky-bot 1.4s ease, --id-sky-sun 1.4s ease, --id-sky-cloud 1.4s ease, --id-sky-ridge 1.4s ease; }
  .wx-head--sky.is-previewing { transition-duration: 0.4s; }
  .sky-sun-wrap, .sky-moon-wrap, .sky-stars, .sky-windows { transition: opacity 1.4s ease; }

  .kpi-grid .summary-card,
  .readiness-strip .summary-card { animation: ac-rise 0.45s ease-out both; }
  .kpi-grid .summary-card:nth-child(2),
  .readiness-strip .summary-card:nth-child(2) { animation-delay: 0.06s; }
  .kpi-grid .summary-card:nth-child(3),
  .readiness-strip .summary-card:nth-child(3) { animation-delay: 0.12s; }
  .kpi-grid .summary-card:nth-child(4),
  .readiness-strip .summary-card:nth-child(4) { animation-delay: 0.18s; }

  .hero-sky .route-draw { animation: ac-draw 1.2s ease-out forwards; }

  /* Movimiento: sólo si la persona no pidió reducirlo. Con `reduce` el grupo se abre de golpe y la
   * burbuja aparece sin fundido. */

  .nav-group-items.is-animating {
    overflow: hidden;
    transition: height 200ms ease;
  }

  @media (min-width: 769px) {
    .sidebar.is-collapsed .nav-label {
      transition: opacity 150ms ease, visibility 150ms ease;
    }
  }

  /* F2: entradas */
  /* Una sola vez (300 ms), sin repetición: el fondo de la cabecera aparece con fundido (hasta su
     opacidad de reposo) y el halo del estado vacío se asienta. */
  @keyframes ac-module-in { from { opacity: 0; } }
  @keyframes ac-halo-in { from { opacity: 0; scale: 0.92; } }

  .page-header--module::before { animation: ac-module-in 300ms ease-out both; }
  .empty-art-wrap::before,
  .empty-art-wrap::after { animation: ac-halo-in 300ms ease-out both; }
}

@media (prefers-reduced-motion: reduce) {
  .summary-card { transition: none; }
  .summary-card:hover { transform: none; }
  .btn { transition: none; }
  .btn-primary:hover { transform: none; }
  .sidebar a { transition: none; }
}
