﻿/*
 * technificationDev.css — styles for the redesigned Technification (DEV) dashboard.
 *
 * Layout: a full-bleed 3D plant viewer fills the page; glass widgets float in the
 * corners around it (left/right columns + bottom strip), echoing the reference
 * "Integrated Plant Intelligence Dashboard" mock. Scoped under .tdev- prefixes so
 * it cannot collide with the production technification.css.
 */

.tdev-root {
    /* ---- Responsive dock tokens ----------------------------------------------
       Every floating widget is sized from these four numbers instead of from hard
       pixels, so the dock around the 3D map keeps the same proportions on a 4K
       panel and on a 1280x720 laptop: the columns and the bottom strip shrink with
       the viewport, the cards stay inside it, and nothing has to be minimised to
       fit. The clamps stop at the values the layout was designed with (300px
       columns, a 200px strip) so a large screen renders exactly as before, and at
       a floor that still holds the widget content.
       --tdev-dock-h is what the docked side cards (laser, Kestrel, scan register)
       measure their own height against. */
    --tdev-edge: clamp(8px, 1.1vw, 16px);
    --tdev-col-w: clamp(196px, 20.5vw, 300px);
    /* Floor is what the tallest non-list card in the strip (Vehicles: metric, yard
       bar, caption, two more metrics) needs to show everything. */
    --tdev-strip-h: clamp(158px, 21vh, 200px);
    --tdev-gap: clamp(6px, 0.7vh, 8px);
    --tdev-dock-top: 62px;
    /* Lo que baja la columna derecha para no pisar el selector de mapa, que ahora
       vive en la esquina superior derecha: su top (6px) + el lado del cuadrado
       (--tdev-layers-h en .tdev-layers) + aire. */
    --tdev-layers-bottom: calc(6px + clamp(52px, 4.4vw, 64px) + var(--tdev-gap));
    /* Where the admin "+" ends: its own inset plus its size. The right column starts
       below this line for admins, so the two never share the corner. Kept in sync with
       .tdev-modelup / .tdev-modelup-btn — same clamps. */
    --tdev-admin-bottom: calc(clamp(7px, 1.1vh, 14px) + clamp(26px, 2.3vw, 38px) + var(--tdev-gap));
    /* Cards docked over the map (laser, scan register, Kestrel menu): their inset
       from the edge and their width. */
    --tdev-dock-x: clamp(12px, 1.6vw, 24px);
    --tdev-dock-w: clamp(224px, 23vw, 292px);
    /* La columna derecha (estaciones + detectores) es mas ancha que el dock de la
       izquierda: sus cabeceras llevan cuatro controles (chapa, ojo, minimizar, cerrar)
       y el titulo tiene que caber entero en la misma linea que la X. */
    --tdev-wx-w: clamp(268px, 27vw, 348px);
    /* The tallest a docked card may grow before it scrolls inside itself: whatever
       is left between the header and the bottom strip. */
    --tdev-dock-h: calc(100% - var(--tdev-dock-top) - var(--tdev-strip-h) - var(--tdev-edge) * 2 - 12px);

    position: relative;
    width: 100%;
    /* Fill the full height of the layout's content area (.content-inner is a
       flex column with height:100%) so no light layout background ever shows
       below the bottom strip — adapts to any screen size. */
    height: 100%;
    flex: 1 1 auto;
    min-height: 520px;
    /* No border-radius: the panel fills the content box edge-to-edge so the
       light layout background never peeks through rounded corners. */
    border-radius: 0;
    /* Blue-tinted dark navy instead of near-black — softer, never pitch black. */
    background: radial-gradient(circle at 50% 40%, #14304d 0%, #0a1b2e 70%);
    color: #cfe6ee;
    font-family: var(--hseHub-font-sans);
    overflow: hidden;
}

/* The 3D canvas sits behind every widget. */
.tdev-viewport {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.tdev-viewport canvas {
    display: block;
}

/* Vista 2D (Leaflet) para las capas de satélite/KML. Justo encima del visor 3D y
   por debajo del header (z-index 10) y del velo de carga (5), que siguen mandando.
   Se oculta con .hidden en vez de desmontarse: Leaflet mide 0x0 si se construye
   dentro de un contenedor sin caja, y volver al satélite recargaría los tiles. */
.tdev-map {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: #0b1a24;
}

.tdev-map.hidden {
    display: none;
}

/* El header lleva pointer-events:none para no comerse los clics del visor; el mapa
   necesita los suyos (arrastrar, zoom), y los controles de Leaflet también. */
.tdev-map,
.tdev-map .leaflet-control-container {
    pointer-events: auto;
}

/* Etiqueta de zona: texto sobre la ortofoto, sin el globo blanco del tooltip por
   defecto de Leaflet, que sobre imagen satelital tapa justo lo que se quiere ver. */
.tdev-map .tdev-zone-label {
    background: none;
    border: none;
    box-shadow: none;
    color: #eaf7fb;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-shadow: 0 0 3px #04141e, 0 0 6px #04141e;
    padding: 0;
    white-space: nowrap;
}

.tdev-map .tdev-zone-label::before {
    display: none;   /* la flecha del bocadillo */
}

/* Los controles de Leaflet nacen con tipografía de documento: aquí desentonan. */
/* La atribución no se puede quitar: el crédito de los tiles es condición de uso de Esri
   y de Google. Lo que sí se puede es dejar de tratarla como un control —el "Leaflet" del
   prefijo ya no se pinta (setPrefix(false) en dashboardMap.js)— y bajarla a nota al pie:
   sin fondo, pequeña y translúcida, para que deje de leerse como una marca de agua sobre
   el mapa. Recupera contraste al pasar el ratón, que es cuando alguien va a leerla. */
.tdev-map .leaflet-control-attribution {
    background: transparent;
    color: rgba(159, 199, 212, 0.35);
    font-size: 9px;
    padding: 0 4px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
    transition: color 0.15s ease;
}

.tdev-map .leaflet-control-attribution:hover {
    color: rgba(159, 199, 212, 0.9);
}

.tdev-map .leaflet-control-attribution a {
    color: #6fd3e8;
}


/* No scrollbars anywhere inside the dashboard — everything must fit in one view. */
.tdev-root *::-webkit-scrollbar { width: 0; height: 0; display: none; }
.tdev-root * { scrollbar-width: none; -ms-overflow-style: none; }

/* Loading veil shown until Three.js + the scene are ready. */
.tdev-loading {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: #0a1b2e;
    color: var(--hseHub-cyan);
    letter-spacing: 2px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    transition: opacity 0.6s ease;
}

.tdev-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.tdev-spinner {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(0, 229, 255, 0.2);
    border-top-color: var(--hseHub-cyan);
    border-radius: 50%;
    animation: tdev-spin 0.9s linear infinite;
}

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

/* ---- Map layer selector (estilo Google Maps) ----
   Un CUADRADO con la miniatura del mapa activo y su rótulo encima, anclado en la
   esquina superior DERECHA de la cabecera. Al pulsarlo, la tira de cuadrados se
   despliega HACIA LA IZQUIERDA — es el lado por el que hay sitio: a la derecha
   está el borde de la pantalla y debajo arranca la columna de widgets.

   Every user gets it — switching the map is not an admin action.

   The header sets pointer-events:none so it never eats clicks meant for the 3D
   viewport underneath, so this control has to opt back in.

   CUENTAS DE ALTURA — --tdev-layers-h es lo que ocupa el botón, y --tdev-layers-bottom
   lo que la columna derecha tiene que bajar para no pisarlo (ver .tdev-col-right).
   Si se toca el tamaño del cuadrado hay que rehacer esa cuenta. */
.tdev-layers {
    --tdev-layers-h: clamp(52px, 4.4vw, 64px);
    /* Lado del cuadrado de la tira = alto del botón menos el padding y el borde de
       la tarjeta (5px * 2 + 1px * 2), para que ambos midan lo mismo de alto. */
    --tdev-layers-tile: calc(clamp(52px, 4.4vw, 64px) - 12px);
    position: absolute;
    top: 6px;
    right: var(--tdev-edge);
    pointer-events: auto;
    z-index: 40;
    font-family: var(--hseHub-font-sans);
    display: flex;
    flex-direction: row;      /* panel a la izquierda, botón a la derecha */
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
}

/* El botón ES la miniatura del mapa que se está mirando, con el rótulo dentro
   sobre un degradado, igual que el "Satélite" de Google Maps. */
.tdev-layers-toggle {
    position: relative;
    flex: none;
    width: var(--tdev-layers-h);
    height: var(--tdev-layers-h);
    padding: 0;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    /* Mismo cristal azul que .tdev-widget: el selector es un widget más del dock, no
       una pastilla negra pegada encima del mapa. */
    border: 1px solid rgba(0, 229, 255, 0.22);
    background: rgba(16, 38, 61, 0.76);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.02);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.tdev-layers-toggle:hover {
    border-color: var(--hseHub-cyan);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}
.tdev-layers:not(.collapsed) .tdev-layers-toggle { border-color: var(--hseHub-cyan); }

/* La miniatura llena el botón: es un <span>, así que sin esto no tendría alto. */
.tdev-layers-toggle .tdev-layer-thumb {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

/* Rótulo dentro del cuadrado, abajo, sobre un velo oscuro para que se lea encima
   de cualquier miniatura. */
.tdev-layers-toggle-label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 3px 2px 4px;
    background: linear-gradient(180deg, rgba(10, 27, 46, 0) 0%, rgba(10, 27, 46, 0.85) 45%);
    color: #ffffff;
    font-size: clamp(7px, 0.55vw, 9px);
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
    line-height: 1.05;
    text-align: center;
    overflow: hidden;
    /* Mismo motivo que .tdev-layer-name: "Site View" entero en dos líneas antes que
       recortado a "Site Vi…". */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow-wrap: break-word;
}

/* La tira desplegada: tarjeta con un cuadrado por base, en fila y alineada por
   arriba con el botón. Es flex normal (no absolute) porque el contenedor ya crece
   hacia la izquierda; así el botón nunca se mueve de la esquina. */
.tdev-layers-body {
    flex: none;
    display: flex;
    /* UNA SOLA FILA. En columna la tira crecía hacia abajo y se metía por debajo del
       botón, encima de donde arranca la columna derecha (Alerts Log). Ancha y baja:
       hacia la izquierda hay mapa de sobra, hacia abajo hay widgets. */
    flex-direction: row;
    align-items: center;
    gap: clamp(8px, 0.8vw, 14px);
    /* Que no pase de lo que ocupa el botón: así el borde de abajo de la tira nunca
       baja más que él y la columna derecha sigue despejada. */
    max-height: var(--tdev-layers-h);
    padding: 5px clamp(8px, 0.8vw, 12px);
    border-radius: 12px;
    /* Misma paleta que .tdev-widget (ver el botón): un poco más opaca porque la tira
       se posa sobre el mapa y sus cuadrados tienen que leerse. */
    background: rgba(16, 38, 61, 0.82);
    border: 1px solid rgba(0, 229, 255, 0.22);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.02);
    /* Se para antes de comerse el mapa; si no cabe, scrollea en horizontal. */
    max-width: min(66vw, 720px);
    animation: tdev-layers-slide 0.16s ease-out;
    transform-origin: right center;
}

/* Sale del botón hacia la izquierda, no aparece de golpe. */
@keyframes tdev-layers-slide {
    from { opacity: 0; transform: translateX(14px) scaleX(0.92); }
    to   { opacity: 1; transform: translateX(0) scaleX(1); }
}

.tdev-layers-items {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: clamp(6px, 0.7vw, 10px);
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

/* Cada opción: el mismo cuadrado que el botón, con el rótulo DENTRO. */
.tdev-layer-tile {
    flex: none;
    display: block;
    width: var(--tdev-layers-tile);
    height: var(--tdev-layers-tile);
    padding: 0;
    background: none;
    border: 0;
    cursor: pointer;
    color: rgba(205, 234, 254, 0.85);
    font-family: inherit;
}

.tdev-layer-tile .tdev-layer-thumb {
    position: relative;
    width: 100%;
    height: 100%;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.tdev-layer-tile:hover .tdev-layer-thumb { transform: translateY(-1px); border-color: rgba(0, 229, 255, 0.5); }
.tdev-layer-tile.active .tdev-layer-thumb { border-color: var(--hseHub-cyan); }
.tdev-layer-tile.active { color: #ffffff; }

/* Rótulo superpuesto al pie del cuadrado, igual que en el botón.

   PARTE EN DOS LÍNEAS en vez de recortar: el cuadrado mide lo que mide y un rótulo de
   dos palabras —"Site View", "Plot Plan"— no cabe de una. Recortado se leía "Site
   Vi…", que no dice cuál de las vistas es, justo lo que el rótulo está ahí para
   decir. Con dos líneas cabe entero y el alto del cuadrado no cambia. */
.tdev-layer-name {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2px 1px 3px;
    background: linear-gradient(180deg, rgba(10, 27, 46, 0) 0%, rgba(10, 27, 46, 0.85) 35%);
    color: #ffffff;
    font-size: clamp(6.5px, 0.5vw, 8.5px);
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.05;
    text-align: center;
    text-transform: uppercase;
    overflow: hidden;
    /* Dos líneas como mucho; una tercera se comería el cuadrado entero. */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow-wrap: break-word;
}
.tdev-layer-tile.active .tdev-layer-name { font-weight: 800; }

/* ---- Miniaturas ----
   Dibujadas con CSS: no hay ficheros de preview por proyecto y una captura real
   costaría un blob por proyecto y capa. Cada una evoca su vista: el satélite es
   terreno visto desde arriba, el 3D una retícula en perspectiva y el splat una
   nube de puntos. */
.tdev-layer-thumb {
    position: relative;
    display: block;
    flex: none;
    border-radius: 10px;
    overflow: hidden;
    /* Azul del dock (.tdev-widget), no negro. */
    background-color: rgba(16, 38, 61, 0.9);
    background-size: cover;
    background-position: center;
}

/* El icono caracteriza la vista de un vistazo: mapa plegado = Site Layout, cubo =
   modelo 3D, retícula de puntos = splat. Centrado en el cuadrado y algo por encima
   del centro, que abajo está el rótulo. */
.tdev-layer-thumb i {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-58%);
    text-align: center;
    line-height: 1;
    font-size: clamp(15px, 1.5vw, 22px);
    color: #ffffff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.65);
}
.tdev-layer-tile.active .tdev-layer-thumb i,
.tdev-layers:not(.collapsed) .tdev-layers-toggle .tdev-layer-thumb i { color: var(--hseHub-cyan); }

/* Naranja tierra de desierto, no el verde de antes: las obras de estos proyectos
   están en Ghawar, Ras Laffan o Hassi, y el terreno que se ve al abrir el mapa es
   arena. Las manchas y la diagonal hacen de relieve y de pista. */
.tdev-layer-thumb.thumb-satellite {
    background-image:
        radial-gradient(circle at 28% 32%, rgba(214, 152, 96, 0.95) 0 22%, rgba(0, 0, 0, 0) 23%),
        radial-gradient(circle at 72% 66%, rgba(176, 110, 60, 0.9) 0 26%, rgba(0, 0, 0, 0) 27%),
        linear-gradient(122deg, rgba(92, 46, 16, 0.3) 0 12%, rgba(0, 0, 0, 0) 12% 16%, rgba(92, 46, 16, 0.3) 16% 20%, rgba(0, 0, 0, 0) 20%),
        linear-gradient(160deg, #d08c4e 0%, #b06e38 45%, #8a4f26 100%);
}

/* Satellite (Google) — un TERRENO, no un plano: dos crestas de montaña en gris sobre
   un cielo plano. El Layout de al lado es la vista cenital con el dibujo del sitio
   encima (ocre, con sus líneas); esto es el relieve desnudo, que es lo que queda cuando
   se mira solo la foto. En gris, y con silueta en vez de manchas, se distinguen a 40 px
   sin leer el rótulo.

   Cada montaña son DOS capas —su ladera izquierda y su derecha— porque un triángulo en
   CSS es media caja partida por la diagonal: `to bottom right` deja pintada la mitad de
   abajo a la derecha (ladera que sube hacia la derecha) y `to bottom left` su espejo.
   De ahí que background-size y background-position vayan capa a capa, y que el orden
   sea cresta delantera, cresta trasera y cielo al fondo. */
.tdev-layer-thumb.thumb-google {
    background-image:
        linear-gradient(to bottom right, rgba(0, 0, 0, 0) 50%, #6d6d6d 50%),
        linear-gradient(to bottom left, rgba(0, 0, 0, 0) 50%, #6d6d6d 50%),
        linear-gradient(to bottom right, rgba(0, 0, 0, 0) 50%, #9a9a9a 50%),
        linear-gradient(to bottom left, rgba(0, 0, 0, 0) 50%, #9a9a9a 50%),
        linear-gradient(180deg, #d4d4d4 0%, #a9a9a9 100%);
    background-size: 22% 58%, 22% 58%, 18% 44%, 18% 44%, 100% 100%;
    background-position: 10% 100%, 39% 100%, 54% 100%, 76% 100%, center;
    background-repeat: no-repeat;
}

.tdev-layer-thumb.thumb-model3d {
    background-image:
        linear-gradient(60deg, rgba(0, 229, 255, 0.35) 1px, rgba(0, 0, 0, 0) 1px),
        repeating-linear-gradient(60deg, rgba(0, 229, 255, 0.28) 0 1px, rgba(0, 0, 0, 0) 1px 9px),
        repeating-linear-gradient(-60deg, rgba(0, 229, 255, 0.28) 0 1px, rgba(0, 0, 0, 0) 1px 9px),
        linear-gradient(180deg, rgba(24, 56, 88, 0.95) 0%, rgba(16, 38, 61, 0.95) 100%);
}

/* Site View no es un mapa: es estar DENTRO del sitio, a la altura de los ojos. Por eso
   su miniatura es un paisaje —cielo, sol bajo, horizonte y terreno— y no la nube de
   puntos de antes, que describía el formato del fichero (un gaussian splat) en vez de
   lo que se ve al entrar. Capas, de arriba abajo: sol, velo del horizonte, silueta de
   planta, franja de terreno y cielo. */
.tdev-layer-thumb.thumb-splat {
    background-image:
        radial-gradient(circle at 70% 46%, rgba(255, 236, 190, 0.95) 0 8%, rgba(255, 214, 150, 0.45) 9% 16%, rgba(0, 0, 0, 0) 17%),
        linear-gradient(180deg, rgba(255, 198, 132, 0) 40%, rgba(255, 186, 120, 0.35) 52%, rgba(255, 186, 120, 0) 60%),
        linear-gradient(90deg, rgba(28, 26, 32, 0.85) 0 6%, rgba(0, 0, 0, 0) 6% 13%, rgba(28, 26, 32, 0.85) 13% 15%, rgba(0, 0, 0, 0) 15% 22%, rgba(28, 26, 32, 0.7) 22% 30%, rgba(0, 0, 0, 0) 30%),
        linear-gradient(180deg, rgba(0, 0, 0, 0) 0 52%, rgba(28, 26, 32, 0.75) 52% 56%, rgba(0, 0, 0, 0) 56%),
        linear-gradient(180deg, rgba(0, 0, 0, 0) 0 56%, #9a6a3f 56% 70%, #7c5231 70% 100%),
        linear-gradient(180deg, #2b4a72 0%, #6f7f9c 34%, #d59a63 50%, #f0b878 55%);
}

.tdev-layer-thumb.thumb-default {
    background-image: linear-gradient(140deg, rgba(27, 62, 97, 0.95) 0%, rgba(16, 38, 61, 0.95) 100%);
}

/* Nodes no es un mapa y su miniatura no finge serlo: son las ondas de una emisión —los
   anillos concéntricos del icono de Core— sobre el azul del dock. Es el único cuadrado
   de la tira que enciende un panel en vez de cambiar lo que se ve debajo. */
.tdev-layer-thumb.thumb-nodes {
    background-image:
        radial-gradient(circle at 50% 62%, rgba(0, 229, 255, 0.55) 0 8%, rgba(0, 0, 0, 0) 9%),
        radial-gradient(circle at 50% 62%, rgba(0, 0, 0, 0) 0 20%, rgba(0, 229, 255, 0.3) 20% 23%, rgba(0, 0, 0, 0) 24%),
        radial-gradient(circle at 50% 62%, rgba(0, 0, 0, 0) 0 36%, rgba(0, 229, 255, 0.18) 36% 39%, rgba(0, 0, 0, 0) 40%),
        linear-gradient(160deg, rgba(21, 52, 82, 0.95) 0%, rgba(16, 38, 61, 0.95) 100%);
}

/* El cuadrado de Nodes es un INTERRUPTOR, no una base: apagado va atenuado para que no se
   lea como una vista más entre las que se puede elegir, y encendido se marca con el halo
   cian —no basta el borde de .active, porque aquí "activo" convive con la base activa. */
.tdev-layer-tile-toggle:not(.active) .tdev-layer-thumb { opacity: 0.72; }
.tdev-layer-tile-toggle.active .tdev-layer-thumb {
    border-color: var(--hseHub-cyan);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
}

/* ---- Panel de Nodes ----
   Cuelga bajo el selector, como el de áreas: una COLUMNA estrecha con los Nodos del
   proyecto, su salud y sus cifras.

   Aquí NO hay mapa. Las posiciones se pintan sobre el mapa del propio dashboard (la
   ortofoto y las zonas del proyecto, ver showCorePoints en dashboardMap.js): hubo una
   versión con la vista de Core entera incrustada —mapa incluido— y era mirar la misma
   obra en dos sitios a la vez, con el segundo mapa sin las zonas. */
.tdev-nodes-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 41;
    width: min(88vw, 360px);
    max-height: min(76vh, 640px);
    overflow-y: auto;
    padding: 10px 12px 12px;
    border-radius: 12px;
    background: rgba(16, 38, 61, 0.92);
    border: 1px solid rgba(0, 229, 255, 0.22);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.02);
    animation: tdev-layers-slide 0.16s ease-out;
}

/* Deslizador de opacidad del Site Layout: EN LÍNEA, a continuación de los cuadrados
   (no en una fila propia, que subía el alto de la tira), y solo cuando la base
   activa es el raster. */
.tdev-layers-opacity-row {
    flex: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 2px;
    color: rgba(205, 234, 254, 0.7);
    font-size: 12px;
}
.tdev-layers-opacity-row i { line-height: 1; color: var(--hseHub-cyan); }

/* Bloque de áreas del KML: su propia barra de opacidad y una casilla por área. Todo
   EN LÍNEA con lo demás — la tira no puede crecer hacia abajo (ver .tdev-layers-body).
   La lista de casillas es la que se come el ancho sobrante y la que scrollea cuando el
   proyecto trae muchas áreas, de modo que los cuadrados y las barras no se mueven. */
.tdev-layers-areas {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: clamp(6px, 0.7vw, 10px);
    padding-left: clamp(6px, 0.7vw, 10px);
    border-left: 1px solid rgba(0, 229, 255, 0.18);
}

/* Un control de la fila: su rótulo (o su casilla) y su barra, juntos. */
.tdev-layers-control {
    flex: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tdev-layers-control-label {
    display: flex;
    align-items: center;
    gap: 4px;
    color: rgba(205, 234, 254, 0.7);
    font-size: clamp(8.5px, 0.65vw, 10.5px);
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    white-space: nowrap;
}
.tdev-layers-control-label i { color: var(--hseHub-cyan); font-size: 12px; line-height: 1; }

/* Botón que abre el panel de áreas; lleva la cuenta de cuántas se están viendo. */
.tdev-areas-toggle {
    flex: none;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 7px;
    border-radius: 7px;
    background: rgba(10, 27, 46, 0.55);
    border: 1px solid rgba(0, 229, 255, 0.22);
    color: rgba(205, 234, 254, 0.85);
    font-family: inherit;
    font-size: clamp(8.5px, 0.65vw, 10.5px);
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.tdev-areas-toggle:hover { background: rgba(0, 229, 255, 0.12); }
.tdev-areas-toggle.open { border-color: var(--hseHub-cyan); color: #ffffff; }
.tdev-areas-toggle i { line-height: 1; font-size: 12px; color: var(--hseHub-cyan); }
.tdev-areas-toggle.open .ph-caret-down { transform: rotate(180deg); }

/* El panel de áreas cuelga BAJO el selector, alineado a su derecha. Absolute: abrirlo
   no crece la tira ni empuja la columna de widgets. En rejilla de columnas anchas, que
   es lo que evita el arrastre horizontal de la versión anterior; solo si el proyecto
   trae MUCHAS zonas aparece scroll vertical, que es el que sí se maneja con la rueda. */
.tdev-areas-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 41;
    width: min(78vw, 620px);
    max-height: min(52vh, 420px);
    overflow-y: auto;
    padding: 8px 10px 10px;
    border-radius: 12px;
    background: rgba(16, 38, 61, 0.92);
    border: 1px solid rgba(0, 229, 255, 0.22);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.02);
    animation: tdev-layers-slide 0.16s ease-out;
}

.tdev-areas-panel-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 7px;
    color: rgba(205, 234, 254, 0.65);
    font-size: clamp(8.5px, 0.65vw, 10.5px);
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.tdev-areas-panel-head span { margin-right: auto; }
.tdev-areas-panel-head button {
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(0, 229, 255, 0.12);
    border: 1px solid rgba(0, 229, 255, 0.25);
    color: #cdeafe;
    font-family: inherit;
    font-size: inherit;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
}
.tdev-areas-panel-head button:hover { background: rgba(0, 229, 255, 0.24); color: #ffffff; }

/* auto-fill + minmax: tantas columnas como quepan, sin decidir un número a mano que
   se quedaría corto en 4K y ancho en un portátil. */
.tdev-areas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 4px;
}
.tdev-areas-grid .tdev-area-check { max-width: none; }

.tdev-area-check {
    flex: none;
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: clamp(90px, 10vw, 160px);
    padding: 2px 6px;
    border-radius: 7px;
    background: rgba(10, 27, 46, 0.55);
    border: 1px solid rgba(0, 229, 255, 0.14);
    color: rgba(205, 234, 254, 0.6);
    font-size: clamp(8.5px, 0.65vw, 10.5px);
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.tdev-area-check:hover { background: rgba(0, 229, 255, 0.1); }
/* Marcada = el área está en el mapa. Apagada se queda en gris para que se vea que
   sigue ahí, solo que oculta. */
.tdev-area-check.on {
    color: #ffffff;
    border-color: rgba(0, 229, 255, 0.35);
}
.tdev-area-check span {
    overflow: hidden;
    text-overflow: ellipsis;
}
.tdev-area-check input {
    flex: none;
    width: 11px;
    height: 11px;
    margin: 0;
    accent-color: var(--hseHub-cyan);
    cursor: pointer;
}
.tdev-area-check i { line-height: 1; font-size: 12px; color: var(--hseHub-cyan); }

.tdev-layer-opacity {
    flex: none;
    width: clamp(60px, 6vw, 90px);
    height: 16px;
    margin: 0;
    accent-color: var(--hseHub-cyan);
    cursor: pointer;
}

/* El mensaje es el último item de la fila (el más a la izquierda), no una línea
   bajo la tira: acotado en ancho y en alto para no estirarla por ningún lado. */
.tdev-layers-msg {
    flex: none;
    max-width: clamp(140px, 16vw, 260px);
    max-height: calc(var(--tdev-layers-tile) - 2px);
    overflow: hidden;
    padding: clamp(3px, 0.4vh, 5px) clamp(4px, 0.5vh, 6px);
    border-radius: 7px;
    background: rgba(10, 27, 46, 0.55);
    color: #cdeafe;
    font-size: clamp(9px, 0.7vw, 11px);
    font-weight: 600;
    line-height: 1.25;
    word-break: break-word;
}

/* The camera/robot/laser modes take over the screen; the selector would only be in
   the way, and its dropdown would float above their panels. */
.tdev-camera-mode .tdev-layers,
.tdev-robot-mode .tdev-layers,
.tdev-laser-mode .tdev-layers { display: none; }

/* Top header bar. */
.tdev-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 22px;
    background: linear-gradient(180deg, rgba(10, 27, 46, 0.92) 0%, rgba(10, 27, 46, 0) 100%);
    pointer-events: none;
}

.tdev-header .tdev-title {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--hseHub-mist-100);
    text-transform: uppercase;
}

.tdev-header .tdev-sub {
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--hseHub-cyan);
    opacity: 0.85;
}

/* Island context chip: appears under the title when the 3D map (Upper Zakum) is
   zoomed into one island. Clicking it pulls back out to the three-island view. */
.tdev-island-back {
    pointer-events: auto;
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 9px;
    border-radius: 20px;
    border: 1px solid rgba(0, 229, 255, 0.45);
    background: rgba(0, 229, 255, 0.12);
    color: var(--hseHub-mist-100);
    cursor: pointer;
    font: inherit;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.tdev-island-back:hover {
    background: rgba(0, 229, 255, 0.22);
    border-color: rgba(0, 229, 255, 0.8);
}

.tdev-island-back i {
    font-size: 14px;
    color: var(--hseHub-cyan);
}

.tdev-island-back .tdev-island-name {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.tdev-island-back .tdev-island-hint {
    font-size: 10px;
    letter-spacing: 0.5px;
    color: var(--hseHub-mist-400);
    opacity: 0.9;
}

.tdev-badge-dev {
    pointer-events: auto;
    border: 1px solid rgba(0, 229, 255, 0.5);
    color: var(--hseHub-cyan);
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.tdev-clock {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    letter-spacing: 1px;
    color: var(--hseHub-mist-400);
}

/* Environment strip — elongated, icon-only bar centred just under the top bar. */
.tdev-envbar {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(16, 38, 61, 0.76);
    border: 1px solid rgba(0, 229, 255, 0.22);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.02);
    pointer-events: auto;
}

.tdev-env-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 2px 14px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.tdev-env-item:last-child { border-right: none; }
.tdev-env-item i { font-size: 17px; color: var(--hseHub-cyan); }
.tdev-env-item .v {
    font-size: 14px;
    font-weight: 700;
    color: var(--hseHub-mist-100);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.tdev-env-item .v small { font-size: 10px; color: var(--hseHub-mist-600); font-weight: 600; margin-left: 2px; }

/* Floating widget columns. */
.tdev-col {
    position: absolute;
    top: var(--tdev-dock-top);
    /* Sits exactly one gap above the bottom strip — the same gap the cards use
       between themselves and the strip uses between Terminals and Vehicles, so the
       spacing reads as one grid all the way round the map. */
    bottom: calc(var(--tdev-strip-h) + var(--tdev-edge) + var(--tdev-gap));
    width: var(--tdev-col-w);
    /* Packed against the strip: any spare height collects at the TOP, under the
       header, instead of opening a hole between the last card and the strip
       (Virtual Gatekeepers → Terminals, Smart Material System → Cameras). */
    container-type: size;
    container-name: tdevcol;
    z-index: 8;
    display: flex;
    flex-direction: column;
    gap: var(--tdev-gap);
    /* The column itself never scrolls — it is click-through (the map has to stay
       draggable across it), so a scroller here could not be operated. The cards
       inside it do the scrolling, and the height breakpoints at the end of this file
       tighten the type so it rarely comes to that. */
    overflow: visible;
    padding: 2px;
    pointer-events: none;
}

/* Column cards can never be smaller than their content — `min-height: max-content` is
   the floor, which is what stops Virtual Gatekeepers and Smart Material System from
   being squeezed — and they share whatever height is left over equally. So on a large
   screen the column fills top to bottom with no margin collecting above the first card
   (Workers on the left, Alerts Log on the right), and on a small one every card still
   shows all of itself. The gap between them is the same one throughout, and the same
   the bottom strip uses.
   What keeps this fitting on a short screen is the height breakpoints at the end of
   this file: they tighten the type and the training gauge. */
.tdev-col > .tdev-widget {
    flex: 1 1 auto;
    min-height: max-content;
    display: flex;
    flex-direction: column;
    /* The spare height goes between the rows rather than pooling under the last one. */
    justify-content: space-between;
}

/* Pack the cards together with the smallest possible gap (both columns),
   keeping every widget's content fully visible. */
.tdev-col { justify-content: flex-end; gap: var(--tdev-gap); }

/* Bottom pair sits side by side but the row is wider than the column, so the
   outer widget sticks out into the centre — the column + foot form an "L".
   stretch keeps both halves the same height. */
.tdev-row {
    display: flex;
    gap: var(--tdev-gap);
    align-items: stretch;
    min-height: 0;
    height: var(--tdev-strip-h);
    /* Three equal cards (flex:1 1 0 below), scaled off the column width and capped
       at half the viewport so the left and right L-feet can never reach far enough
       into the centre to overlap each other. */
    width: min(calc(var(--tdev-col-w) * 2.51), calc(50vw - var(--tdev-edge) - 24px));
}
.tdev-row > .tdev-widget {
    flex: 1 1 0;
    min-width: 0;          /* allow shrinking so text ellipsises instead of overflowing */
    display: flex;
    flex-direction: column;
}

/* Left column: foot protrudes to the right. Right column: foot protrudes left. */
.tdev-col-left .tdev-row  { align-self: flex-start; }
.tdev-col-right .tdev-row { align-self: flex-end; }

/* Terminals (first left-row card) sits over the column, so it matches the width
   of the stacked column cards (Virtual Gatekeepers); Vehicles + Laser Scan split
   the protruding remainder. */
.tdev-col-left .tdev-row > .tdev-widget:first-child { flex: 0 0 calc(var(--tdev-col-w) - 4px); }

/* Cameras (last right-row card) sits over the right column, so it matches the
   width of the stacked column cards (Smart Material System); Augmented Reality +
   Robots split the protruding remainder. */
.tdev-col-right .tdev-row > .tdev-widget:last-child { flex: 0 0 calc(var(--tdev-col-w) - 4px); }

/* The column is packed against the bottom strip, so the spare height on a tall
   screen lands above the first card. On the right that first card is the Alerts Log,
   whose length is open-ended anyway: it takes that space instead of leaving a margin
   under the header, and the log inside it grows to use it. The gaps between cards are
   untouched — the card grows into the slack, it does not push its neighbours. */
/* Nothing to concentrate the spare height into any more — see .tdev-col > .tdev-widget
   above: every card shares it, so neither column can open a margin at its top.

   The other side of that rule: cards may not shrink below their content, so if the
   stack is taller than the column it has to overflow somewhere — and the columns are
   packed against the bottom strip, which means UPWARDS, over the top bar.

   Lo que impide que eso pase es el TOPE POR ZONA del layout (DashboardWidgetCatalog:
   LeftCapacity / BottomCapacity / RightCapacity): lo que no cabe no se pinta y el editor
   lo dice. Antes no había tope a la derecha y esta regla hacía de único freno —sostenía
   la columna porque su primera tarjeta era SIEMPRE el Alerts Log, que cede altura—; con el
   Alerts Log ya movible, eso dejó de ser cierto y la pila se salía por arriba.

   La regla se queda como colchón, y por POSICIÓN, no por identidad: la primera tarjeta de
   la columna derecha —sea la que sea— puede devolver altura si su contenido aprieta. Lo
   mismo el Training Module, cuyo indicador se redimensiona. */
.tdev-col-right > .tdev-widget:first-child,
.tdev-col-left > .tdev-widget.tdev-training {        /* Training Module */
    min-height: 0;
}

/* Cameras carries a list too, so it scrolls like Terminals and Robots rather than
   being capped at two rows. */
.cam-list { max-height: none; }

.tdev-col-left { left: var(--tdev-edge); }
.tdev-col-right { right: var(--tdev-edge); }

/* For an admin the "+" upload control sits in the top-right corner, exactly where the
   right column starts. The column drops below it — the button stays above Alerts Log
   and the two can never overlap, at any screen size. Non-admins never see the button,
   so their column keeps the full height. */
.tdev-has-admin .tdev-col-right { top: max(var(--tdev-dock-top), var(--tdev-admin-bottom)); }
/* The layer selector now owns the top-right corner for every user, so the right
   column has to start below it — same offset the admin "+" used to force. */
.tdev-has-layers .tdev-col-right {
    top: max(var(--tdev-dock-top), var(--tdev-admin-bottom), var(--tdev-layers-bottom));
}

/* Bottom strip of horizontal cards. */
.tdev-bottom {
    position: absolute;
    left: var(--tdev-edge);
    right: var(--tdev-edge);
    bottom: var(--tdev-edge);
    z-index: 8;
    display: flex;
    align-items: stretch;      /* every card the same height */
    gap: var(--tdev-gap);
    height: var(--tdev-strip-h);
    pointer-events: none;
}

/* The four middle cards (Vehicles, Laser Scan, AR, Robots) share the space
   equally → identical widths and no centre gap. */
.tdev-bottom > .tdev-widget {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* La primera y la última celda de la tira se sientan sobre las columnas, con el ancho de
   una tarjeta de columna. Es una regla de POSICIÓN, no de tarjeta: quién cae ahí lo decide
   el layout del proyecto (HSE_HUB CORE), así que no se puede nombrar a Terminals ni a Cameras.
   Y va sin `.tdev-widget` porque en esa posición puede caer la celda apilada (Laser Scan +
   Augmented Reality), que no es un widget sino su contenedor. */
.tdev-bottom > :first-child,
.tdev-bottom > :last-child {
    flex: 0 0 calc(var(--tdev-col-w) - 4px);
}

/* Each strip card is a query container, so the widgets inside it can react to the
   height the card actually got (see the fleet-list rules further down). */
.tdev-bottom > .tdev-widget,
.tdev-bottom-stack > .tdev-widget {
    container-type: size;
    container-name: tdevcard;
}

/* ---- Two ways of reading a strip card ----
   Stage 1 — the card is a little short: everything keeps its place, one size down.
   The controls (the eye, "View all") shrink with it and stay visible; they are the
   card's utility and are never what gets dropped. */
@container tdevcard (max-height: 170px) {
    .tdev-listcol { --tdev-listrow-h: 14px; gap: 2px 10px; }
    .tdev-listcol .tdev-listrow { font-size: 9.5px; gap: 6px; }
    .tdev-listcol .tdev-battery { height: 7px; }

    .tdev-widget-title { font-size: 9px; letter-spacing: 1px; margin-bottom: 3px; }
    .tdev-eye { width: 18px; height: 18px; margin-left: 4px; border-radius: 5px; }
    .tdev-eye i { font-size: 12px; }
    .tdev-metric { padding: 1.5px 0; }
    .tdev-metric .label { font-size: 9.5px; }
    .tdev-metric .value { font-size: 12px; }
    .tdev-node { margin-top: 4px; padding-top: 4px; }
    .tdev-node-name { font-size: 9.5px; }
    .tdev-cam-viewall { margin-top: 5px; padding: 4px 8px; font-size: 9px; }
    .tdev-cam-viewall i { font-size: 11px; }
}

/* Stage 2 — it genuinely does not fit as a list of rows, so the rows are read TWO
   UP instead: the card becomes a two-column grid, the title, the lists and the
   full-width controls span both, and four metrics take two lines instead of four.
   Same numbers, same buttons, half the height. Above this size the card is exactly
   the single-column card it has always been. */
@container tdevcard (max-height: 142px) {
    /* Cameras is the exception: it keeps its flex column (title / metrics / button)
       so the button can stay pinned below a shrinking metrics block — only the
       metrics inside it go two up. */
    .tdev-bottom > .tdev-widget:not(:has(.cam-metrics)),
    .tdev-bottom-stack > .tdev-widget {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-content: start;
        column-gap: 10px;
        row-gap: 0;
    }
    .cam-metrics {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-content: start;
        column-gap: 10px;
        row-gap: 0;
    }
    .tdev-bottom > .tdev-widget > .tdev-widget-title,
    .tdev-bottom-stack > .tdev-widget > .tdev-widget-title,
    /* La fila del Nodo y los avisos cruzan las dos columnas: son una cabecera y una
       frase, no un par de cifras que se puedan leer una al lado de la otra. */
    .tdev-listcol, .veh-bar, .veh-bar-cap, .tdev-scan-progress, .tdev-cam-viewall,
    .tdev-node, .tdev-widget-note {
        grid-column: 1 / -1;
    }
    /* Side by side, a per-row rule would draw a grid of lines — the columns already
       separate them. */
    .tdev-metric { border-bottom: none; padding: 1px 0; }
    .tdev-metric .label { font-size: 9px; letter-spacing: 0.2px; }
    .tdev-metric .value { font-size: 11.5px; }
    .tdev-metric .value small { font-size: 9px; }
}

/* Robots/Drones stack: takes one middle slot (same width as the other middle
   cards) and splits it into two cards sharing the strip height equally. */
.tdev-bottom > .tdev-bottom-stack {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--tdev-gap);
}
.tdev-bottom-stack > .tdev-widget {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Glassmorphic widget card. */
.tdev-widget {
    pointer-events: auto;
    /* Punto medio entre el 0.62 original —el mapa se leia a traves de la tarjeta y competia
       con sus cifras— y el 0.86, que la dejaba casi opaca y le quitaba el aire de cristal
       flotando sobre la obra. El desenfoque se queda; el fondo solo tapa lo justo.
       Este valor se repite en el boton del selector de mapa y en la tira de entorno, que
       declaran el MISMO cristal: si se cambia aqui, se cambian los tres. */
    background: rgba(16, 38, 61, 0.76);
    border: 1px solid rgba(0, 229, 255, 0.22);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.02);
    /* Padding gives way before the content does, so a shorter viewport tightens the
       cards instead of cropping their rows. */
    padding: clamp(5px, 0.8vh, 9px) clamp(8px, 0.85vw, 12px);
    min-width: 0;
    /* Nothing ever escapes its own card. A widget too tall for its slot used to
       paint straight over its neighbours (Training Module over the column below it,
       Laser Scan over Augmented Reality); it is now contained, and the widgets that
       can genuinely run long scroll inside themselves. */
    overflow: hidden;
}

.tdev-widget-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--hseHub-cyan-muted);
    margin-bottom: 6px;
}

.tdev-widget-title i { color: var(--hseHub-cyan); }
/* Inline drone glyph — matches the Phosphor icon size/colour in widget titles. */
.tdev-drone-ico { width: 13px; height: 13px; color: var(--hseHub-cyan); flex: none; }
.tdev-widget-title .dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--hseHub-cyan); box-shadow: 0 0 8px var(--hseHub-cyan); margin-left: auto;
}

/* Metric rows. */
.tdev-metric {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.tdev-metric:last-child { border-bottom: none; }
.tdev-metric .label { font-size: 10.5px; color: var(--hseHub-mist-500); letter-spacing: 0.4px; }
.tdev-metric .value { font-size: 14px; font-weight: 700; color: var(--hseHub-mist-100); font-variant-numeric: tabular-nums; }
.tdev-metric .value small { font-size: 10px; color: var(--hseHub-mist-600); font-weight: 600; margin-left: 3px; }

.tdev-metric .value.accent { color: var(--hseHub-cyan); }
.tdev-metric .value.warn { color: var(--hseHub-dash-amber); }
.tdev-metric .value.danger { color: var(--hseHub-dash-red); }

/* "Plant scanned" progress bar — sits below the Laser Scan metrics, full width,
   contained inside the widget (never overflows). */
.tdev-scan-progress {
    margin-top: 7px;
    width: 100%;
    height: 6px;
    border-radius: 4px;
    background: rgba(0, 229, 255, 0.12);
    box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.18);
    overflow: hidden;
}
.tdev-scan-progress-fill {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(0, 229, 255, 0.55) 0%, var(--hseHub-cyan) 100%);
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.6);
    transition: width 0.6s ease;
}

/* Augmented Reality card sits in the lower half of the Laser+AR stack, so its
   content height is fixed. Tighten the title and the three metric rows (and clip
   as a last resort) so all the info always fits inside the card. */
.tdev-ar { overflow: hidden; padding: 7px 12px; }
.tdev-ar .tdev-widget-title { margin-bottom: 4px; }
.tdev-ar .tdev-metric { padding: 1px 0; }
.tdev-ar .tdev-metric .label { font-size: 10px; }
.tdev-ar .tdev-metric .value { font-size: 13px; }

/* Mini bar chart (CSS-only sparkline-ish). */
.tdev-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 46px;
    margin-top: 4px;
}
.tdev-bars span {
    flex: 1 1 0;
    background: linear-gradient(180deg, var(--hseHub-cyan) 0%, rgba(0, 229, 255, 0.15) 100%);
    border-radius: 2px 2px 0 0;
    min-height: 3px;
    opacity: 0.85;
}

/* Status pills / log lines. */
/* The log fills whatever height its card was given — all of the spare column height
   on a large screen, and as little as the stack can spare on a small one, where it
   scrolls. Either way the cards below it (Permit Tracker, Smart Material System) keep
   their full size and every row of them stays visible. */
.tdev-log {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1 1 auto;
    min-height: 0;
    /* Vertical only. `overflow-y: auto` alone would make the x axis auto too, and any
       line a pixel too wide would add a sideways scrollbar. */
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}
.tdev-log > .tdev-log-line { flex: none; }
/* A line wraps rather than running off the side: a long alert ("CAM Tank Farm · Tank 04
   high level") used to widen the card and bring up a sideways scrollbar, which put half
   the message out of sight until you dragged for it. */
.tdev-log-line {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    font-size: 10.5px;
    line-height: 1.3;
    color: #aebfc7;
    min-width: 0;
}
/* La hora en blanco: en gris azulado (#5d7681) sobre el fondo oscuro de la tarjeta
   apenas se leia, y es el primer dato que se busca al mirar el log. */
.tdev-log-line .time { flex: none; color: var(--hseHub-mist-100); font-variant-numeric: tabular-nums; }
.tdev-log-line .sev { margin-top: 4px; }
/* The message: the part that gives, wrapping onto a second line when it must. */
.tdev-log-line > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.tdev-log-line .sev { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.tdev-log-line .sev.ok { background: var(--hseHub-dash-green); }
.tdev-log-line .sev.warn { background: var(--hseHub-dash-amber); }
.tdev-log-line .sev.crit { background: var(--hseHub-dash-red); box-shadow: 0 0 7px var(--hseHub-dash-red); }

/* ---- Fleet lists (Terminals · Robots · Drones · Cameras) ----
   These lists are as long as the fleet is, and the card is only as tall as the bottom
   strip — so a plain stack of rows ran out of room and had to be scrolled, hiding
   units that ought to be on screen.
   The list is a grid that fills DOWN and then wraps into a second (and third) column:
   `auto-fill` works out how many rows the card's actual height holds, so as long as
   everything fits it looks exactly like the single stack it always was, and only when
   it doesn't does the list reflow into columns. It adapts to the real number of units
   and the real height, not to a guess about the screen. Scrolling stays as the last
   resort for a fleet too large even for that. */
.tdev-listcol {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(auto-fill, var(--tdev-listrow-h, 16px));
    grid-auto-columns: minmax(0, 1fr);
    align-content: start;
    gap: 3px 12px;
    margin-top: 6px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}
/* In two columns a row has half the width, so every part of it has to be able to give:
   the name and the status ellipsise, the battery bar narrows, the percentage — the
   number the row exists for — never moves. */
.tdev-listcol .tdev-listrow { min-width: 0; overflow: hidden; }
.tdev-listcol .tdev-battery { flex: 0 1 34px; min-width: 14px; }
.tdev-listcol .time { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tdev-listrow {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 10.5px;
    color: var(--hseHub-mist-300);
}
.tdev-listrow .sev { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.tdev-listrow .sev.ok { background: var(--hseHub-dash-green); }
.tdev-listrow .sev.warn { background: var(--hseHub-dash-amber); }
.tdev-listrow .sev.crit { background: var(--hseHub-dash-red); box-shadow: 0 0 6px var(--hseHub-dash-red); }
.tdev-listrow .ln { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tdev-listrow .bt { font-variant-numeric: tabular-nums; color: var(--hseHub-mist-400); width: 34px; text-align: right; }
.tdev-listrow .time { color: #5d7681; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tdev-listrow .cam-tag {
    flex: none;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: var(--hseHub-cyan-muted);
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 9px;
    padding: 1px 7px;
    white-space: nowrap;
}

/* Battery bar. */
.tdev-battery {
    flex: none;
    width: 34px;
    height: 8px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    padding: 1px;
    position: relative;
}
.tdev-battery .bf { display: block; height: 100%; border-radius: 1px; }
.tdev-battery .bf.ok { background: var(--hseHub-dash-green); }
.tdev-battery .bf.warn { background: var(--hseHub-dash-amber); }
.tdev-battery .bf.danger { background: var(--hseHub-dash-red); }

/* Donut gauge. */
.tdev-gauge { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.tdev-gauge svg { transform: rotate(-90deg); }
.tdev-gauge .g-label { font-size: 10px; color: var(--hseHub-mist-500); }
.tdev-gauge .g-value { font-size: 18px; font-weight: 800; color: var(--hseHub-mist-100); }

/* ---- Training Module (enhanced) ---- */
/* Training and Virtual Gatekeepers used to grow (and therefore also shrink) to push
   the stack down. The column is packed against the bottom strip now, so that job is
   done by the packing; leaving the flex here is what kept squeezing those two cards
   below their content. They take their natural height like every other column card. */

.tdev-training {
    display: flex;
    flex-direction: column;
}

/* Big centred donut with the % inside it. */
/* The gauge is the give in this card: it shrinks with the viewport so the ring, the
   completion figure and the three stats below always fit inside the widget. */
.train-gauge {
    position: relative;
    flex: 1 1 auto;
    min-height: clamp(68px, 9.5vh, 110px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4px 0 clamp(5px, 0.9vh, 10px);
}
.train-gauge svg {
    width: 100%;
    height: 100%;
    max-height: clamp(68px, 11vh, 160px);
    transform: rotate(-90deg);
    filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.35));
}
.train-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* El gap NO es la palanca aquí, y subirlo empeora: el bloque de texto está
       centrado, así que separar la etiqueta de la cifra la empuja contra el arco de
       abajo y sube la cifra contra el de arriba. Lo que da aire es que el texto sea
       más pequeño que el hueco — ver .g-label. Se queda en lo justo para que las dos
       líneas no se toquen entre sí. */
    gap: 2px;
    /* Que nada pueda alcanzar el trazo por los lados, sea cual sea el tamaño del anillo. */
    padding: 0 12%;
}
.train-center .g-value {
    font-size: clamp(19px, 2.6vh, 30px);
    font-weight: 800;
    line-height: 1;
    color: var(--hseHub-mist-100);
    font-variant-numeric: tabular-nums;
}
.train-center .g-value small { font-size: clamp(10px, 1.3vh, 14px); font-weight: 700; color: var(--hseHub-cyan-muted); margin-left: 1px; }
/* Por qué "COMPLETION" salía pegada al anillo.
   El hueco interior mide ~74% del diámetro (r=30, trazo 7 sobre un viewBox de 72).
   El anillo se dibuja con `max-height: clamp(68px, 11vh, 160px)`, así que en una
   pantalla corta baja a 68px y el hueco se queda en ~50px — mientras la etiqueta
   medía lo mismo a 9px con 1.4px de tracking: ~53px. Más ancha que el hueco: por eso
   tocaba el trazo, y por eso solo se ve en algunas alturas de ventana.
   La cifra ya escalaba con vh; la etiqueta no. Ahora también, así que la holgura se
   mantiene con el anillo grande y con el anillo pequeño. */
.train-center .g-label {
    font-size: clamp(7px, 0.95vh, 9px);
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--hseHub-mist-500);
    white-space: nowrap;
    line-height: 1;
}

/* ---- Training Module: ring when it fits, row when it doesn't ----
   The ring gauge is the tallest thing in either column, so on a short screen it is
   what pushed the card past the column and cut it off. Rather than cropping it (or
   shrinking the ring until the figure inside is unreadable), the card falls back to
   the same numbers laid out flat: completion as a line with a progress bar, the three
   stat chips unchanged. Nothing is dropped — only the shape changes.

   The switch is a container query on the column itself, so it reacts to the height
   the card actually has, not to a guess about the viewport: at 100% zoom on a screen
   with room the ring stays. */
@container tdevcol (max-height: 520px) {
    .tdev-training .train-gauge {
        flex: none;
        min-height: 0;
        margin: 3px 0 7px;
    }
    .tdev-training .train-gauge svg { display: none; }
    /* The readout leaves the middle of the ring and becomes the card's own line. */
    .tdev-training .train-center {
        position: static;
        flex-direction: row;
        align-items: baseline;
        justify-content: space-between;
        gap: 8px;
        width: 100%;
        /* Sin anillo, el margen lateral que lo esquivaba solo estrecharía la fila. */
        padding: 0;
    }
    .tdev-training .train-center .g-value { font-size: 19px; }
    /* Aquí no hay anillo del que separarse: la etiqueta recupera su cuerpo fijo. */
    .tdev-training .train-center .g-label { font-size: 9px; letter-spacing: 0.8px; }
    /* The bar carries what the ring used to: completion, read at a glance. */
    .tdev-training .train-gauge::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: -4px;
        height: 4px;
        border-radius: 3px;
        background: linear-gradient(90deg, var(--hseHub-cyan) 0%, var(--hseHub-dash-green) 100%);
        /* --train-pct is set inline by the component from the same value the ring
           uses, so the bar and the figure can never disagree. */
        width: var(--train-pct, 100%);
        box-shadow: 0 0 8px rgba(0, 229, 255, 0.5);
    }
    .tdev-training .train-gauge::before {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: -4px;
        height: 4px;
        border-radius: 3px;
        background: rgba(0, 229, 255, 0.12);
    }
}

/* Three stat chips below the gauge. */
.train-stats {
    display: flex;
    gap: 6px;
    flex: none;
}
.train-stats .ts {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    border-radius: 8px;
    background: rgba(0, 229, 255, 0.06);
    border: 1px solid rgba(0, 229, 255, 0.16);
}
.train-stats .v { font-size: 15px; font-weight: 800; color: var(--hseHub-mist-100); font-variant-numeric: tabular-nums; }
.train-stats .v.warn { color: var(--hseHub-dash-amber); }
.train-stats .v.ok { color: var(--hseHub-dash-green); }
.train-stats .k {
    font-size: 8.5px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--hseHub-mist-500);
}

/* ---- Robots list: keep battery bar, % and status in aligned columns ---- */
/* The name flexes/ellipsises; battery, % and status get fixed widths so every
   row lines up vertically. */
/* Robots/drones widget scrolls when it lists many units (all islands at the overview),
   but the scrollbar is hidden — scroll by dragging with the mouse (see enableDragScroll). */
.robot-list {
    overflow-y: auto;
    cursor: grab;
    scrollbar-width: none;        /* Firefox */
    -ms-overflow-style: none;     /* legacy Edge */
    touch-action: pan-y;
}
.robot-list::-webkit-scrollbar { width: 0; height: 0; display: none; }   /* Chromium/WebKit */
.robot-list.drag-scrolling { cursor: grabbing; }
.robot-list .tdev-listrow .ln { flex: 1 1 auto; min-width: 0; }
.robot-list .tdev-listrow .tdev-battery { flex: none; width: 34px; }
.robot-list .tdev-listrow .bt { flex: none; width: 32px; text-align: right; }
.robot-list .tdev-listrow .time {
    flex: none;
    width: 56px;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Vehicles (enhanced) ---- */
/* Yard occupancy bar. */
.veh-bar {
    height: 8px;
    border-radius: 5px;
    background: rgba(0, 229, 255, 0.10);
    overflow: hidden;
    margin: 6px 0 3px;
}
.veh-bar > span {
    display: block;
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, var(--hseHub-cyan) 0%, var(--hseHub-dash-green) 100%);
}
.veh-bar-cap {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--hseHub-mist-500);
    margin-bottom: 8px;
}

/* Vehicle-type breakdown chips. */
.veh-types {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-bottom: 8px;
}
.veh-types .vt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 6px 2px;
    border-radius: 8px;
    background: rgba(0, 229, 255, 0.06);
    border: 1px solid rgba(0, 229, 255, 0.16);
}
.veh-types .vt i { font-size: 15px; color: var(--hseHub-cyan); }
.veh-types .vt .n { font-size: 13px; font-weight: 800; color: var(--hseHub-mist-100); font-variant-numeric: tabular-nums; }
.veh-types .vt .k { font-size: 8px; letter-spacing: 0.4px; text-transform: uppercase; color: var(--hseHub-mist-500); }

/* ---- Clickable widgets (open a detail flyout) ---- */
.tdev-clickable {
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.tdev-clickable:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 229, 255, 0.55);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 229, 255, 0.25);
}
.tdev-clickable .tdev-expand {
    margin-left: 6px;
    color: var(--hseHub-cyan);
    font-size: 12px;
    opacity: 0.55;
    transition: transform 0.18s ease, opacity 0.18s ease;
}
/* When the title has a .dot (margin-left:auto), the chevron follows it on the
   far right; otherwise push it there explicitly. */
.tdev-widget-title .dot + .tdev-expand { margin-left: 6px; }
/* El :not() tiene que excluir TAMBIÉN el caso "ojo justo antes del chevron", que es el
   de Workers. Sin la segunda exclusión esta regla gana por especificidad a la de abajo
   (.tdev-eye + .tdev-expand), el chevron se lleva su margin-left:auto y se va al borde
   derecho — dejando el ojo pegado al punto y un hueco vacío entre ambos. */
.tdev-widget-title > .tdev-expand:not(.dot + .tdev-expand):not(.tdev-eye + .tdev-expand) {
    margin-left: auto;
}
.tdev-clickable:hover .tdev-expand { opacity: 1; transform: translateX(2px); }

/* ---- Map-visibility eye ----
   Splits the two things a widget can do. The eye (and only the eye) decides whether
   that layer is drawn on the 3D map — open eye = on the map, struck-through = off —
   while the card itself is the way into the detail. It sits in the title bar, after
   the live dot, and never triggers the card underneath it (stopPropagation in the
   component). */
.tdev-eye {
    flex: none;
    /* Negative block margins so adding the control did not make every title bar
       taller — and push the rows below it out of the card. */
    margin: -3px 0 -3px 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border-radius: 6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--hseHub-mist-500);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tdev-eye i { display: block; line-height: 1; font-size: 14px; }
.tdev-eye:hover { background: rgba(0, 229, 255, 0.14); color: var(--hseHub-cyan-soft); border-color: rgba(0, 229, 255, 0.4); }
.tdev-eye.on {
    background: rgba(0, 229, 255, 0.18);
    border-color: var(--hseHub-cyan);
    color: var(--hseHub-cyan);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.25);
}
/* The chevron keeps its own spacing when it follows the eye. */
.tdev-widget-title .tdev-eye + .tdev-expand { margin-left: 6px; }

/* Ojo embebido en una fila de KPI (Supervisors), no en la barra de título: más
   pequeño y alineado con el número, para que se lea como "enséñame ESTE dato". */
.tdev-eye-sm {
    width: 17px;
    height: 17px;
    margin: -2px 0 -2px 6px;
    vertical-align: middle;
}
.tdev-eye-sm i { font-size: 12px; }

/* Punto de supervisor sobre la ortofoto: un halo que lo despega del fondo, que
   puede ser tan claro como una losa de hormigón o tan oscuro como una sombra. */
.tdev-supervisor-dot {
    filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.9));
}

/* ---- El Nodo de HSE_HUB Core dentro de su tarjeta ----
   La cabecera de las dos filas reales de una tarjeta de maqueta (Seen now / Seen today):
   quién manda el dato, cómo va y el ojo que lo suelta en el mapa. Se separa con una línea
   de arriba porque lo que va debajo NO es de la misma fuente que lo que va encima, y esa
   frontera tiene que verse sin leer nada. */
.tdev-node {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 7px;
    padding-top: 6px;
    border-top: 1px solid rgba(0, 229, 255, 0.18);
}

.tdev-node .core-dot { font-size: 8px; flex: none; }

/* Cuando el Nodo es lo PRIMERO de la tarjeta (Workers, Vehicles: ya no hay maqueta
   encima de la que separarlo) no hay frontera que marcar, así que no lleva la línea
   ni el hueco de arriba. */
.tdev-node-lead {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.tdev-node-name {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.4px;
    color: var(--hseHub-mist-100);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tdev-node-state {
    margin-left: auto;
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--hseHub-mist-500);
}

/* Sin posiciones que enseñar el ojo se queda, pero apagado: quitarlo movería las filas
   de sitio cada vez que un Nodo se queda mudo. */
.tdev-node .tdev-eye:disabled {
    opacity: 0.35;
    cursor: default;
}

.tdev-node .tdev-eye:disabled:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.14);
    color: var(--hseHub-mist-500);
}

/* Una línea de aviso dentro de una tarjeta: por qué un control no ha hecho lo que
   parecía que iba a hacer (el ojo del heat map fuera del Site Layout, p. ej.). */
.tdev-widget-note {
    margin-top: 6px;
    padding: 5px 7px;
    border-radius: 6px;
    background: rgba(0, 229, 255, 0.08);
    border-left: 2px solid rgba(0, 229, 255, 0.45);
    color: var(--hseHub-mist-300, #cdeafe);
    font-size: 10.5px;
    line-height: 1.35;
}

/* ---- Nube de calor ----
   El canvas vive en el overlayPane de Leaflet (lo inserta dashboardMap.js). No debe
   capturar el ratón: por debajo están los polígonos de zona con sus popups, y la nube
   es dibujo, no un elemento con el que se interactúe. El mix-blend screen es lo que
   deja que la ortofoto se siga leyendo bajo la mancha en vez de quedar tapada. */
.tdev-heat-canvas {
    pointer-events: none;
    mix-blend-mode: screen;
}

/* ---- Leyenda del heat map de workers ----
   Va DENTRO del contenedor del mapa (la inserta dashboardMap.js), abajo a la derecha,
   despejando la esquina de la atribución de Esri, que es obligatoria. Sin los rangos
   reales el degradado no significa nada: son ellos los que impiden leer el rojo como
   "peligro" en lugar de como "la zona más densa ahora mismo". */
.tdev-heat-legend {
    position: absolute;
    right: 10px;
    bottom: 26px;
    z-index: 500;          /* por encima de los paneles de Leaflet (400) */
    pointer-events: none;  /* es un rótulo, no debe robar el pan del mapa */
    padding: 7px 9px;
    border-radius: 8px;
    background: rgba(8, 20, 32, 0.9);
    border: 1px solid rgba(0, 229, 255, 0.3);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
    color: #cdeafe;
    font-family: var(--hseHub-font-sans);
    font-size: 10px;
    line-height: 1.4;
}
.tdev-heat-legend-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 5px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}
.tdev-heat-legend-top span { color: rgba(205, 234, 254, 0.6); }
/* La escala es continua: la leyenda es la misma rampa que pinta la nube, no tramos. */
.tdev-heat-ramp {
    width: 132px;
    height: 8px;
    border-radius: 4px;
    border: 1px solid rgba(0, 229, 255, 0.25);
}
.tdev-heat-ramp-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 2px;
    color: rgba(205, 234, 254, 0.6);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.tdev-heat-foot {
    margin-top: 5px;
    padding-top: 4px;
    border-top: 1px solid rgba(0, 229, 255, 0.15);
    color: rgba(205, 234, 254, 0.6);
}
/* Que el dato es inventado se dice en el propio mapa, no solo en la tarjeta: la
   leyenda es lo que alguien fotografía y enseña fuera de contexto. */
.tdev-heat-sim {
    color: #ffb020;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

/* ---- Capas de widget sobre el Site Layout ----
   Los ojos de Gatekeepers, Vehicles, Robots, AR y Cameras sueltan puntos sobre el
   mapa 2D igual que el de Supervisors. El halo es lo que los despega de la
   ortofoto: sin él, un punto sobre arena clara desaparece. */
.tdev-site-dot {
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.55));
}
.tdev-site-dot-gatekeepers { filter: drop-shadow(0 0 4px rgba(37, 208, 125, 0.85)); }
.tdev-site-dot-vehicles    { filter: drop-shadow(0 0 4px rgba(255, 209, 102, 0.85)); }
.tdev-site-dot-robots      { filter: drop-shadow(0 0 4px rgba(179, 136, 255, 0.85)); }
.tdev-site-dot-ar          { filter: drop-shadow(0 0 4px rgba(124, 156, 255, 0.85)); }

/* Gatekeepers, Robots, AR, Cameras y los permisos abiertos no son un punto sino la
   pastilla de la capa de supervisores (.tdev-gas-marker) con el icono de su tarjeta
   dentro: el círculo pelado decía dónde hay algo pero no qué, y con dos capas
   encendidas a la vez el color era lo único que las separaba. Aquí sólo va lo que
   cambia respecto a la pastilla: el glifo se dibuja al tamaño del operario de
   supervisores (17 px, no los 15 del icono de fuente) y el halo es el de su capa, para
   que no se pierda sobre la ortofoto clara. La pastilla mide siempre 28: ver la nota
   del marcador en dashboardMap.js sobre por qué el badge no la engorda. */
.tdev-site-glyph > span i { font-size: 17px; line-height: 1; }
.tdev-site-glyph-gatekeepers { filter: drop-shadow(0 0 4px rgba(37, 208, 125, 0.85)); }
.tdev-site-glyph-robots      { filter: drop-shadow(0 0 4px rgba(179, 136, 255, 0.85)); }
.tdev-site-glyph-ar          { filter: drop-shadow(0 0 4px rgba(124, 156, 255, 0.85)); }
.tdev-site-glyph-cameras     { filter: drop-shadow(0 0 4px rgba(255, 122, 198, 0.85)); }
/* Permisos: el halo es el color del estado, el mismo con el que la tarjeta escribe su
   cifra y con el que se pinta la bola del cluster de esa capa. */
.tdev-permit-glyph-active   { filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.85)); }
.tdev-permit-glyph-expiring { filter: drop-shadow(0 0 4px rgba(255, 176, 32, 0.85)); }
.tdev-permit-glyph-expired  { filter: drop-shadow(0 0 4px rgba(255, 77, 109, 0.85)); }
.tdev-site-dot-cameras     { filter: drop-shadow(0 0 4px rgba(255, 122, 198, 0.85)); }

/* Área escaneada por el láser: contorno discontinuo, como en el visor 3D. */
.tdev-scan-area {
    filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.45));
}

/* Aviso del panel de estres termico cuando las bandas no han podido pintarse sobre
   las areas del KML. Va sobre el mapa, encima del propio panel. */
.tdev-heat-warn {
    position: absolute;
    left: 50%;
    top: 14px;
    transform: translateX(-50%);
    z-index: 1200;
    max-width: 420px;
    padding: 7px 12px;
    border-radius: 8px;
    background: rgba(8, 20, 32, 0.94);
    border: 1px solid rgba(255, 176, 32, 0.5);
    border-left: 3px solid #ffb020;
    color: #ffe0b0;
    font-family: var(--hseHub-font-sans);
    font-size: 11px;
    line-height: 1.35;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

/* Leyenda de las capas encendidas. Va sobre la del heat map (que ocupa la esquina
   inferior derecha) para que las dos puedan verse a la vez. */
.tdev-site-legend {
    position: absolute;
    right: 10px;
    top: 10px;
    z-index: 500;
    pointer-events: none;
    min-width: 148px;
    padding: 7px 9px;
    border-radius: 8px;
    background: rgba(8, 20, 32, 0.9);
    border: 1px solid rgba(0, 229, 255, 0.3);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
    color: #cdeafe;
    font-family: var(--hseHub-font-sans);
    font-size: 10px;
    line-height: 1.4;
}
.tdev-site-legend-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 5px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

/* Variante montada junto al título del proyecto: una tira horizontal de fichas, no
   un panel. Ahí no compite con el mapa, así que no necesita fondo propio ni tapar
   nada — y el ancho lo pone el contenido, que es lo que hay encendido. */
.tdev-title-row {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.tdev-title-row .tdev-title { white-space: nowrap; }
.tdev-site-legend-host {
    display: flex;
    align-items: center;
    min-width: 0;
}
.tdev-site-legend.tdev-site-legend-inline {
    position: static;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 12px;
    min-width: 0;
    padding: 4px 10px;
    background: rgba(8, 20, 32, 0.55);
}
.tdev-site-legend-inline .tdev-site-legend-top {
    margin-bottom: 0;
    gap: 6px;
}
.tdev-site-legend-inline .tdev-site-legend-row { padding: 0; }
.tdev-site-legend-inline .tdev-site-legend-row b { margin-left: 2px; }
.tdev-site-legend-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 1px 0;
}
.tdev-site-legend-row b { margin-left: auto; color: #eaf7ff; }
.tdev-site-legend-name { color: rgba(205, 234, 254, 0.78); }
.tdev-site-legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 2px solid currentColor;
    background: rgba(255, 255, 255, 0.12);
}
/* ---- Estación meteorológica ----
   El mástil no es un punto más: es una instalación fija y única en la obra, así que
   lleva icono propio (no un círculo de color) y verde, que no compite con ninguna
   severidad — no está diciendo si algo va bien o mal, está diciendo dónde mide. */
.tdev-wx-marker { background: none; border: 0; }
.tdev-wx-marker > span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    box-sizing: border-box;
    border-radius: 50%;
    border: 2px solid var(--tdev-wx-color, #7ee787);
    background: rgba(6, 20, 16, 0.88);
    color: var(--tdev-wx-color, #7ee787);
    box-shadow: 0 0 0 4px rgba(6, 18, 28, 0.4), 0 6px 16px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    transition: transform 0.12s ease;
}
.tdev-wx-marker > span i { font-size: 16px; line-height: 1; }
.tdev-wx-marker:hover > span { transform: scale(1.1); }

/* Ficha del mástil sobre el mapa: es para leerla, no para ojearla, así que va en un
   popup (se queda abierto) y con las cifras alineadas a la derecha. */
.tdev-wx-popup .leaflet-popup-content-wrapper {
    background: rgba(8, 20, 32, 0.96);
    border: 1px solid rgba(126, 231, 135, 0.35);
    border-radius: 10px;
    color: #cdeafe;
}
.tdev-wx-popup .leaflet-popup-tip { background: rgba(8, 20, 32, 0.96); }
.tdev-wx-popup .leaflet-popup-content { margin: 10px 12px; font-family: var(--hseHub-font-sans); }

/* La X de la ficha — vale para las DOS, el mastil y el detector: las dos usan
   .tdev-wx-popup.
   Leaflet la deja pegada a la esquina (top:0/right:0 y una caja de 18x14 px) y ahi se
   lee como un adorno del borde y no como un boton, ademas de quedar a tiro de rozar el
   borde redondeado. Se despega, se le da un area de pulsacion cuadrada de verdad y se
   centra el aspa dentro de ella.

   El COLOR es el del ojo de las cabeceras (.tdev-eye): --hseHub-mist-500 en reposo y el
   cian al pasar por encima. Solo el aspa — sin fondo ni recuadro: la ficha es una lista
   de cifras y meter ahi una cajita compite con ellas. Lo que no se veia era el gris de
   Leaflet, no la falta de boton. */
.tdev-wx-popup .leaflet-popup-close-button {
    top: 6px;
    right: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: none;
    border: 0;
    color: var(--hseHub-mist-500);
    /* Leaflet lo pinta con `font: 16px/14px Tahoma` — ese line-height de 14 es lo que
       descentraba el aspa dentro de su caja aunque la caja estuviera bien puesta. */
    font: 600 15px/1 var(--hseHub-font-sans), Tahoma, sans-serif;
    transition: color 0.15s ease;
}
.tdev-wx-popup .leaflet-popup-close-button:hover {
    background: none;
    color: var(--hseHub-cyan-soft);
}
.tdev-wx-pop { font-size: 11px; }
/* Hueco para la X: sin el, un detector de nombre largo pasaba por debajo del aspa. */
.tdev-wx-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-right: 20px; }
.tdev-wx-top b { color: #eaf7ff; font-size: 12px; }
.tdev-wx-top span { color: rgba(205, 234, 254, 0.55); font-size: 9.5px; }
/* Cuando se recibieron las cifras de la ficha. Va DEBAJO de ellas y no en el pie con la
   bateria: no es un dato del aparato, es lo que dice si lo de arriba vale para decidir
   algo ahora mismo. En ambar cuando el detector esta caido — ahi lo de arriba es
   historico y tiene que verse distinto de un lectura viva. */
.tdev-gas-stamp {
    margin-top: 7px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(205, 234, 254, 0.6);
    font-size: 9px;
    line-height: 1.35;

    /* En UNA linea y sin cortarse. La frase mas larga que puede salir es
       "Last reading received: 31/08/2026, 10:22 CET (3 h ago)" — unos 53 caracteres, que
       a este tamano piden ~250 px. El popup se ensancha a 320 (ver bindPopup en
       dashboardMap.js) para que quepan con holgura.
       `nowrap` a secas partiria la frase en dos lineas si el ancho no diera; con
       `min-width: max-content` es el popup el que se estira hasta el maxWidth antes que
       envolverla. */
    white-space: nowrap;
    min-width: max-content;
}
.tdev-gas-stamp.is-stale { color: rgba(255, 176, 32, 0.85); }

/* ---- Ficha de un punto de HSE_HUB Core ----
   La misma pastilla del detector de gas, con lo que la lista ya sabe de la entidad. El chip de
   estado va arriba, junto al nombre: es lo primero que se mira de un vehiculo. */
.tdev-core-state {
    padding: 1px 7px;
    border: 1px solid rgba(0, 229, 255, 0.35);
    border-radius: 999px;
    color: rgba(205, 234, 254, 0.75);
    font-size: 9px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    white-space: nowrap;
}

/* En marcha se ve distinto de parado sin tener que leerlo: es la unica de las tres
   situaciones en la que el dato de posicion caduca mientras lo miras. */
.tdev-core-state.is-moving {
    border-color: rgba(0, 229, 255, 0.85);
    background: rgba(0, 229, 255, 0.14);
    color: #9fe9ff;
}

/* El acompanante (en FMS, el conductor). Se pinta aunque falte, con su raya. */
.tdev-core-sub {
    margin-top: 3px;
    color: rgba(205, 234, 254, 0.7);
    font-size: 10px;
}

/* Las cifras, en rejilla de dos. Con dos o tres valores una tabla de verdad seria mas
   marco que dato, y con mas de cuatro la ficha dejaria de caber sobre el mapa. */
.tdev-core-figs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 12px;
    margin-top: 8px;
}

.tdev-core-fig { display: flex; flex-direction: column; min-width: 0; }

.tdev-core-fig .l {
    color: rgba(205, 234, 254, 0.5);
    font-size: 8.5px;
    letter-spacing: 0.4px;
    text-transform: uppercase;

    /* Una etiqueta larga del catalogo no puede ensanchar la ficha. */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tdev-core-fig b { color: #eaf7ff; font-size: 12px; line-height: 1.2; }

.tdev-wx-zone {
    margin-bottom: 6px;
    color: rgba(205, 234, 254, 0.7);
    font-size: 10px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}
.tdev-wx-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 2px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.tdev-wx-row span { color: rgba(205, 234, 254, 0.72); }
.tdev-wx-row b { color: #eaf7ff; font-variant-numeric: tabular-nums; }
/* El pie (bateria, y la calibracion cuando se sabe) va a la DERECHA: las cifras de la
   ficha ya estan alineadas ahi (.tdev-wx-row las manda al borde con space-between), asi
   que a la izquierda rompia esa columna. */
.tdev-wx-foot {
    margin-top: 6px;
    text-align: right;
    color: rgba(205, 234, 254, 0.5);
    font-size: 9.5px;
}

.kst-dev.kst-wx { --kst-band: #7ee787; }
.kst-wx-ico {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    color: #7ee787;
}
.kst-wx-ico i { font-size: 13px; line-height: 1; }

/* ---- Bolas de permisos (clusters por área) ----
   Una bola por área con su recuento, del color con el que el widget escribe esa cifra.
   Es un divIcon de Leaflet: el <span> de dentro lleva el tamaño (crece con el número)
   y el color por variable, así que aquí sólo vive la forma. Es clicable —encuadra su
   área—, de modo que necesita cursor y una respuesta al hover. */
.tdev-permit-cluster { background: none; border: 0; }
.tdev-permit-cluster > span {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.85);
    background: var(--tdev-permit-color, #00e5ff);
    /* El halo se hace con currentColor del propio texto no: el relleno ya es el color,
       así que basta un aro oscuro que despegue la bola de la ortofoto. */
    box-shadow: 0 0 0 4px rgba(6, 18, 28, 0.45), 0 6px 16px rgba(0, 0, 0, 0.45);
    color: #06121c;
    font-family: var(--hseHub-font-sans);
    font-size: 12px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.12s ease;
}
.tdev-permit-cluster:hover > span { transform: scale(1.12); }

/* Muestra de la bola en la leyenda "On the map". */
.tdev-site-legend-bubble {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.85);
}

/* Ojos de las tres líneas del Permit Tracker: mismo control que el resto de ojos,
   pero teñido del color de SU cifra — son tres en la misma tarjeta y el color es lo
   único que dice cuál enciende cada uno. */
.tdev-eye.tdev-eye-permit.accent { color: var(--hseHub-cyan); border-color: rgba(0, 229, 255, 0.35); }
.tdev-eye.tdev-eye-permit.warn { color: var(--hseHub-dash-amber); border-color: rgba(255, 176, 32, 0.4); }
.tdev-eye.tdev-eye-permit.danger { color: var(--hseHub-dash-red); border-color: rgba(255, 77, 109, 0.4); }
.tdev-eye.tdev-eye-permit.on { background: rgba(255, 255, 255, 0.1); }

/* Supervisores: la muestra es el punto del mapa, anillo blanco y relleno cian, así
   que el fondo lo pone la propia fila (no el gris de .tdev-site-legend-dot). */
.tdev-site-legend-dot-supervisor { border-width: 2px; }
/* Trabajadores en obra: una tira con la rampa del heat map. No hay punto por
   persona sobre el mapa, y un círculo aquí lo daría a entender. */
.tdev-site-legend-crowd {
    width: 14px;
    height: 7px;
    border-radius: 3px;
    opacity: 0.9;
}
.tdev-site-legend-area {
    width: 11px;
    height: 9px;
    border-radius: 2px;
    border: 1px dashed currentColor;
    background: rgba(0, 229, 255, 0.22);
}

/* ---- Capa de HSE_HUB Core en la leyenda ----
   La muestra es el PROPIO marcador en pequeño —el coche de la flota, el operario de
   HSE—: la fila y el punto del mapa tienen que reconocerse como la misma cosa, y un
   círculo genérico obligaría a adivinar cuál de las capas encendidas es cuál. */
.tdev-site-legend-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 14px;
    width: 14px;
    height: 14px;
    box-sizing: border-box;
    border-radius: 50%;
    border: 1.5px solid #00e5ff;
    background: rgba(6, 20, 28, 0.9);
    color: #00e5ff;
}
.tdev-site-legend-glyph i { font-size: 9px; line-height: 1; }
.tdev-site-legend-glyph svg { width: 10px; height: 10px; }

/* Lo de Core es lo único real del mapa, y la cabecera de la leyenda dice «simulated»
   en cuanto hay una capa de widget encendida. Esta marca es lo que impide que la fila
   quede debajo de ese rótulo: cian —el color de la propia capa— y no ámbar, que en
   este dashboard es el color del aviso. */
.tdev-site-legend-live {
    color: #00e5ff;
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

/* Expired permits: their own block in the register, read as the stop-work list it is. */
.tdev-flyout-sub.tdev-sub-danger { color: var(--hseHub-dash-red); }
.tdev-flyout-sub.tdev-sub-danger i { color: var(--hseHub-dash-red); }
.tdev-flyout-row.tdev-row-danger { background: rgba(255, 77, 109, 0.07); border-radius: 6px; }
.tdev-flyout-row.tdev-row-danger .time { color: var(--hseHub-dash-red); font-weight: 700; }

/* ---- Alarm ring ----
   The widget the alerts log is pointing at. Red, and it keeps pulsing: an alarm that
   has been asked about is still an alarm, so it does not fade into the dashboard after
   the first second. */
.tdev-widget.tdev-alarm-ring {
    border-color: var(--hseHub-dash-red);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(255, 77, 109, 0.55), 0 0 26px rgba(255, 77, 109, 0.35);
    animation: tdev-alarm-pulse 1.6s ease-in-out infinite;
}
@keyframes tdev-alarm-pulse {
    0%, 100% { box-shadow: 0 10px 32px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(255, 77, 109, 0.55), 0 0 26px rgba(255, 77, 109, 0.35); }
    50%      { box-shadow: 0 10px 32px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(255, 77, 109, 0.9),  0 0 34px rgba(255, 77, 109, 0.6); }
}
/* La tira de entorno no es .tdev-widget, pero es la dueña de los peligros de ambiente
   y el log la señala igual que a una tarjeta: mismo anillo, mismo latido. */
.tdev-envbar.tdev-alarm-ring {
    border-color: var(--hseHub-dash-red);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(255, 77, 109, 0.55), 0 0 26px rgba(255, 77, 109, 0.35);
    animation: tdev-alarm-pulse 1.6s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
    .tdev-widget.tdev-alarm-ring,
    .tdev-envbar.tdev-alarm-ring { animation: none; }
}

/* The log lines that point at a widget: only those are clickable. */
.tdev-log-clickable { cursor: pointer; border-radius: 5px; padding: 1px 3px; margin: -1px -3px; transition: background 0.12s ease; }
.tdev-log-clickable:hover { background: rgba(255, 77, 109, 0.12); }
.tdev-log-clickable.focused { background: rgba(255, 77, 109, 0.18); box-shadow: inset 0 0 0 1px rgba(255, 77, 109, 0.45); }

/* Active state — widget whose markers are currently shown on the 3D map. */
.tdev-widget.tdev-active {
    border-color: rgba(0, 229, 255, 0.7);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 229, 255, 0.4), 0 0 22px rgba(0, 229, 255, 0.18);
}
.tdev-widget.tdev-active .tdev-expand { opacity: 1; color: var(--hseHub-cyan); }

/* Robot info card — floats over the 3D map when a marker is clicked. */
.tdev-robot-card {
    position: absolute;
    /* The clicked marker is zoomed to the centre of the viewport, so the card
       pops just to its right, vertically centred. */
    top: 50%;
    left: 52%;
    transform: translateY(-50%);
    z-index: 22;
    width: min(320px, 88%);
    background: linear-gradient(165deg, rgba(17, 41, 66, 0.96) 0%, rgba(9, 24, 40, 0.96) 100%);
    border: 1px solid rgba(0, 229, 255, 0.35);
    border-radius: 14px;
    backdrop-filter: blur(18px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 229, 255, 0.12);
    overflow: hidden;
    animation: tdev-robot-card-in 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;

    /* No floating card may leave the viewport, on any screen: it is capped to what
       is free between the header and the bottom strip and scrolls its own body
       instead of growing past the edge. Cards that set their own max-height (the
       robot sheet, the Kestrel report) still win — this is the floor under them. */
    display: flex;
    flex-direction: column;
    max-width: calc(100% - var(--tdev-dock-x) * 2);
    max-height: var(--tdev-dock-h);
}
.tdev-robot-card > .tdev-robot-card-head { flex: none; }
.tdev-robot-card > .tdev-robot-card-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}
@keyframes tdev-robot-card-in {
    from { opacity: 0; transform: translate(-16px, -50%); }
    to   { opacity: 1; transform: translate(0, -50%); }
}
.tdev-robot-card-head {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.14);
}
.tdev-robot-card-head .sev { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.tdev-robot-card-head .sev.ok { background: var(--hseHub-dash-green); box-shadow: 0 0 8px var(--hseHub-dash-green); }
.tdev-robot-card-head .sev.warn { background: var(--hseHub-dash-amber); box-shadow: 0 0 8px var(--hseHub-dash-amber); }
.tdev-robot-card-head .sev.crit { background: var(--hseHub-dash-red); box-shadow: 0 0 8px var(--hseHub-dash-red); }
.tdev-robot-card-head > i { font-size: 17px; color: var(--hseHub-cyan-muted); }
.tdev-robot-card-head .rname {
    flex: 0 1 auto;
    min-width: 0;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--hseHub-mist-100);
    text-transform: uppercase;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Robot type shown beside the name in the header (e.g. SPOT 01 · Quadruped). */
.tdev-rname-type {
    flex: none;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--hseHub-cyan-muted);
    background: rgba(0, 229, 255, 0.12);
    border: 1px solid rgba(0, 229, 255, 0.28);
    border-radius: 999px;
    padding: 2px 9px;
    white-space: nowrap;
}
/* Manufacturer · model, to the right of the type chip on the title line. */
.tdev-rname-model {
    flex: 0 1 auto;
    min-width: 0;
    font-size: 11px;
    font-weight: 700;
    color: var(--hseHub-cyan-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tdev-robot-card-close {
    flex: none;
    margin-left: auto;
    width: 26px; height: 26px;
    padding: 0;
    border: none;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--hseHub-mist-400);
    cursor: pointer;
    display: grid; place-items: center;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
/* Normalise the glyph box so the X sits dead-centre in the square. */
.tdev-robot-card-close i { display: block; line-height: 1; font-size: 15px; }
.tdev-robot-card-close:hover { background: rgba(255, 77, 109, 0.18); color: var(--hseHub-dash-red); transform: rotate(90deg); }
.tdev-robot-card-body { padding: 10px 14px 14px; }
.tdev-robot-card-body .rc-battery { margin: 2px 0 8px; height: 7px; }

/* ---- Scaffold (Virtual Gatekeepers) status banner ---- */
/* Headline state at the top of the scaffold info card: colour follows the ScaffTag
   status — green safe / amber restricted / red alarm. */
.tdev-scaf-status {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 11px; margin: 2px 0 10px;
    border-radius: 9px;
    border: 1px solid rgba(0, 229, 255, 0.14);
    background: rgba(0, 229, 255, 0.05);
}
.tdev-scaf-status > i { font-size: 22px; flex-shrink: 0; }
.tdev-scaf-status-t { font-size: 13px; font-weight: 700; letter-spacing: 0.2px; }
.tdev-scaf-status-s { font-size: 11px; opacity: 0.8; margin-top: 1px; }
.tdev-scaf-tag {
    margin-left: auto; flex-shrink: 0;
    font-size: 11px; font-weight: 800; letter-spacing: 0.4px;
    padding: 3px 9px; border-radius: 999px;
}
.tdev-scaf-ok    { border-color: rgba(37, 208, 125, 0.4);  background: rgba(37, 208, 125, 0.1); }
.tdev-scaf-ok    > i { color: var(--hseHub-dash-green); }
.tdev-scaf-warn  { border-color: rgba(255, 176, 32, 0.45); background: rgba(255, 176, 32, 0.1); }
.tdev-scaf-warn  > i { color: var(--hseHub-dash-amber); }
.tdev-scaf-crit  { border-color: rgba(255, 77, 109, 0.5);  background: rgba(255, 77, 109, 0.12); }
.tdev-scaf-crit  > i { color: var(--hseHub-dash-red); }
.tdev-tag-ok   { background: var(--hseHub-dash-green); color: #06121e; }
.tdev-tag-warn { background: var(--hseHub-dash-amber); color: #06121e; }
.tdev-tag-crit { background: var(--hseHub-dash-red); color: var(--hseHub-white); box-shadow: 0 0 10px rgba(255, 77, 109, 0.6); }

/* ---- Heat stress (env strip → heat-stress flyout) ---- */
/* The whole environment strip is clickable and opens the heat-stress panel. */
.tdev-envbar.tdev-env-click { cursor: pointer; transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease; }
.tdev-envbar.tdev-env-click:hover { border-color: rgba(0, 229, 255, 0.5); background: rgba(16, 38, 61, 0.78); }
.tdev-envbar.tdev-active { border-color: var(--hseHub-cyan); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(0, 229, 255, 0.5); }
.tdev-env-more { font-size: 14px; color: var(--hseHub-cyan); opacity: 0.7; margin-left: 2px; }
/* 24h temperature curve: orange line (the workers curve is cyan). */
.tdev-heat-curve svg path.line.heat { stroke: #ff7a59; }
/* Work/rest row matching the current WBGT band. */
.tdev-heat-active { background: rgba(255, 122, 89, 0.1); border-radius: 6px; }

/* ---- Laser-scan zones card ---- */
/* Pinned to the left so the centred top-down plant view stays unobstructed. */
.tdev-laser-card {
    top: 50%;
    left: var(--tdev-dock-x);
    width: var(--tdev-dock-w);
}
.tdev-laser-zones { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.tdev-laser-row {
    display: flex; align-items: center; gap: 9px;
    padding: 6px 4px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.07);
    font-size: 12.5px;
    cursor: pointer;
    transition: background 0.12s ease;
}
.tdev-laser-row:hover { background: rgba(0, 229, 255, 0.06); border-radius: 6px; }
.tdev-laser-row:last-child { border-bottom: none; }
.tdev-laser-row .sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.tdev-laser-row .ln { flex: 1 1 auto; color: var(--hseHub-mist-100); font-weight: 600; }
.tdev-laser-row .ar { color: var(--hseHub-mist-400); font-variant-numeric: tabular-nums; }
.tdev-laser-hint {
    display: flex; align-items: flex-start; gap: 7px;
    color: var(--hseHub-mist-400); font-size: 12px; line-height: 1.45;
    margin-bottom: 12px;
}
.tdev-laser-hint i { color: var(--hseHub-cyan); font-size: 15px; flex: none; margin-top: 1px; }
.tdev-laser-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tdev-laser-btn {
    flex: 1 1 auto;
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
    cursor: pointer;
    border: 1px solid rgba(0, 229, 255, 0.3);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tdev-laser-btn.primary { background: rgba(0, 229, 255, 0.16); color: var(--hseHub-cyan-soft); }
.tdev-laser-btn.primary:hover { background: rgba(0, 229, 255, 0.28); }
.tdev-laser-btn.ghost { background: rgba(255, 255, 255, 0.05); color: var(--hseHub-mist-400); border-color: rgba(255, 255, 255, 0.12); }
.tdev-laser-btn.ghost:hover { background: rgba(255, 255, 255, 0.1); color: var(--hseHub-mist-100); }
.tdev-laser-row.active { background: rgba(0, 229, 255, 0.1); border-radius: 6px; }
.tdev-laser-row.active .ln { color: var(--hseHub-cyan-soft); }

/* Per-zone "last scan" detail, shown when a zone row is selected. */
.tdev-laser-scan {
    margin: 2px 0 12px;
    padding: 9px 11px;
    border: 1px solid rgba(0, 229, 255, 0.18);
    border-radius: 9px;
    background: rgba(0, 229, 255, 0.05);
}
.tdev-laser-scan-head {
    display: flex; align-items: center; gap: 6px;
    font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--hseHub-cyan-muted); margin-bottom: 8px;
}
.tdev-laser-scan-head i { color: var(--hseHub-cyan); font-size: 14px; }
.tdev-laser-scan-grid { display: flex; flex-direction: column; gap: 4px; }
.tdev-laser-scan-grid .lsi {
    display: flex; align-items: baseline; justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 3px;
}
.tdev-laser-scan-grid .lsi:last-child { border-bottom: none; padding-bottom: 0; }
.tdev-laser-scan-grid .k { font-size: 10.5px; color: var(--hseHub-mist-500); letter-spacing: 0.4px; }
.tdev-laser-scan-grid .v {
    font-size: 12.5px; font-weight: 700; color: var(--hseHub-mist-100);
    font-variant-numeric: tabular-nums; text-align: right;
}
.tdev-laser-scan-grid .v.accent { color: var(--hseHub-cyan); }

/* Clickable "Total scans" row → opens the scan register panel. */
.tdev-laser-scan-grid .lsi-click { cursor: pointer; border-radius: 5px; transition: background 0.12s ease; }
.tdev-laser-scan-grid .lsi-click:hover { background: rgba(0, 229, 255, 0.08); }
.tdev-laser-scan-grid .lsi-click .v i {
    font-size: 11px; margin-left: 3px; vertical-align: middle;
    transition: transform 0.15s ease; display: inline-block;
}
.tdev-laser-scan-grid .lsi-click.open .v i { transform: rotate(90deg); }

/* Scan register panel — sits just to the right of the laser card. */
.tdev-scanlog-card {
    left: calc(var(--tdev-dock-x) + var(--tdev-dock-w) + 12px);
    /* Never past the right edge: it takes what is left beside the laser card. */
    width: min(var(--tdev-dock-w), calc(100% - var(--tdev-dock-x) * 2 - var(--tdev-dock-w) - 12px));
}
.tdev-scanlog-list { max-height: none; }
.tdev-scanlog-card .tdev-robot-card-head .sw {
    width: 11px; height: 11px; border-radius: 3px; flex: none;
}
.tdev-scanlog-list { display: flex; flex-direction: column; gap: 2px; max-height: 52vh; overflow-y: auto; }
.tdev-scanlog-row {
    display: flex; align-items: baseline; gap: 9px;
    padding: 7px 4px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.07);
    font-size: 12px;
}
.tdev-scanlog-row:last-child { border-bottom: none; }
.tdev-scanlog-row .n { color: var(--hseHub-mist-600); font-weight: 700; font-variant-numeric: tabular-nums; flex: none; width: 30px; }
.tdev-scanlog-row .dt { flex: 1 1 auto; color: var(--hseHub-mist-300); font-variant-numeric: tabular-nums; }
.tdev-scanlog-row .ar { color: var(--hseHub-cyan-soft); font-weight: 700; font-variant-numeric: tabular-nums; }
.tdev-scanlog-row.latest .dt { color: var(--hseHub-mist-100); }
.tdev-scanlog-row.latest .n { color: var(--hseHub-cyan); }

/* Zone-name input shown while a zone is selected. */
.tdev-laser-field { margin: 4px 0 10px; }
.tdev-laser-field label {
    display: flex; align-items: center; gap: 6px;
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
    color: #7fb6c7; margin-bottom: 5px;
}
.tdev-laser-field label i { color: var(--hseHub-cyan); font-size: 13px; }
.tdev-laser-input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(2, 12, 22, 0.6);
    border: 1px solid rgba(0, 229, 255, 0.3);
    color: var(--hseHub-mist-100);
    font-size: 13px; font-weight: 600;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tdev-laser-input:focus { border-color: var(--hseHub-cyan); box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.15); }
.tdev-laser-input::placeholder { color: #5b7e8c; font-weight: 400; }

/* ---- Laser mode: hide every other widget until the view is closed. ---- */
.tdev-laser-mode .tdev-col,
.tdev-laser-mode .tdev-envbar,
.tdev-laser-mode .tdev-bottom {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* ---- Camera / robot mode: while a camera's or robot's detail card is open,
   hide every other widget (columns, env strip, bottom strip) until it's closed. ---- */
.tdev-camera-mode .tdev-col,
.tdev-camera-mode .tdev-envbar,
.tdev-camera-mode .tdev-bottom,
.tdev-robot-mode .tdev-col,
.tdev-robot-mode .tdev-envbar,
.tdev-robot-mode .tdev-bottom {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* The container going pointer-events:none is not enough on its own: .tdev-widget
   opts back INTO pointer events, so every card inside a hidden column/strip stayed
   hittable at opacity 0 — an invisible widget still opened its menu. Kill it on the
   descendants too, for all four hidden modes. */
.tdev-laser-mode .tdev-col *,
.tdev-laser-mode .tdev-envbar *,
.tdev-laser-mode .tdev-bottom *,
.tdev-camera-mode .tdev-col *,
.tdev-camera-mode .tdev-envbar *,
.tdev-camera-mode .tdev-bottom *,
.tdev-robot-mode .tdev-col *,
.tdev-robot-mode .tdev-envbar *,
.tdev-robot-mode .tdev-bottom * {
    pointer-events: none;
}

/* ---- Robot detail: info on the left, model figure on the right ---- */
/* Widen the card only when it holds the two-column robot body. */
/* Wider, shorter card: the info splits into two columns so the technical sheet and
   mission history sit side by side instead of stacking into one tall column. */
.tdev-robot-card:has(.tdev-robot-body) { width: min(860px, calc(100% - var(--tdev-dock-x) * 2)); }
.tdev-robot-body {
    display: flex;
    gap: 14px;
    /* Two equal-height columns: the menu (left) and the type/status/figure side (right).
       Both stretch to the same height so neither leaves dead space. */
    align-items: stretch;
    /* The card body is the scroller now (it is capped to the free height), so this
       must not add a second one inside it. */
    min-height: 0;
}
/* Left column — the section menu fills the available width and height. */
.tdev-robot-body .tdev-robot-info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
/* Right column — type chip, status and the render stacked; the figure grows to take
   whatever height is left so the column always fills the card beside the menu. */
.tdev-rc-side {
    flex: 0 0 220px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.tdev-rc-side .tdev-rc-stats { flex-direction: column; gap: 6px; }

/* Robot type chip — shown first, prominent. */
.tdev-rc-type {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 11px;
    border-radius: 10px;
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.3);
}
.tdev-rc-type i { color: var(--hseHub-cyan); font-size: 18px; }
.tdev-rc-type .t { font-size: 15px; font-weight: 800; color: var(--hseHub-mist-100); letter-spacing: 0.3px; }
.tdev-rc-type .m { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--hseHub-cyan-muted); }

/* Status + battery: two metrics on one row, no per-row divider. */
.tdev-rc-stats { display: flex; gap: 18px; }
.tdev-rc-stats .tdev-metric { flex: 1 1 0; padding: 0; border-bottom: none; }

/* Technical sheet: two compact spec columns that fit the card width. */
.tdev-spec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 18px; }
.tdev-spec-grid .sp {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.tdev-spec-grid .sp-wide { grid-column: 1 / -1; }
.tdev-spec-grid .k { flex: none; font-size: 10px; color: var(--hseHub-mist-500); letter-spacing: 0.3px; }
.tdev-spec-grid .v {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--hseHub-mist-100);
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Incursions + mission history side by side. */
.tdev-rc-logs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tdev-rc-logs .tdev-incursions { margin-top: 0; padding-top: 8px; }

/* Robot-card section menu (tabs). Only the active section's panel is shown, so each
   section gets the full card width and reads bigger instead of three cramped columns. */
.tdev-rc-tabs { display: flex; gap: 8px; margin-top: 4px; }
.tdev-rc-tab {
    /* Grow to share the row but never shrink below the label — the full title
       ("Historical Missions") must always fit, no ellipsis. */
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 11px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: var(--hseHub-mist-400);
    background: rgba(0, 229, 255, 0.06);
    border: 1px solid rgba(0, 229, 255, 0.18);
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.tdev-rc-tab i { font-size: 18px; flex: none; }
.tdev-rc-tab .lbl { white-space: nowrap; }
.tdev-rc-tab .cnt {
    flex: none;
    font-size: 12px;
    font-weight: 800;
    color: var(--hseHub-cyan);
    background: rgba(0, 229, 255, 0.14);
    border-radius: 999px;
    padding: 1px 8px;
}
.tdev-rc-tab:hover { background: rgba(0, 229, 255, 0.12); color: var(--hseHub-mist-100); }
.tdev-rc-tab.active {
    color: #04121b;
    background: linear-gradient(180deg, var(--hseHub-cyan), #1bb8d6);
    border-color: var(--hseHub-cyan);
}
.tdev-rc-tab.active i,
.tdev-rc-tab.active .cnt { color: #04121b; }
.tdev-rc-tab.active .cnt { background: rgba(4, 18, 27, 0.25); }
.tdev-rc-tabpanel {
    margin-top: 6px;
    /* Grows to fill the left column so the active section reads big instead of
       collapsing to its content height. */
    flex: 1 1 auto;
    min-height: 300px;
    display: flex;
    flex-direction: column;
}
.tdev-rc-tabpanel > * { flex: 1 1 auto; }
.tdev-rc-tabpanel .tdev-incursions { margin-top: 0; padding-top: 8px; }

/* Mission detail: a historical timelapse alongside the live camera feed. */
.tdev-mission-feeds {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 8px 0 4px;
}
.tdev-mission-feed { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.tdev-mini-feed { aspect-ratio: 16 / 9; }
.tdev-mission-feed-cap {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: var(--hseHub-mist-400);
}
.tdev-mission-feed-cap i { color: var(--hseHub-cyan); font-size: 13px; }
/* Timelapse badge reads cyan (recorded) vs the red LIVE pip. */
.tdev-mission-feed:first-child .tdev-cam-live { color: var(--hseHub-cyan-soft); }

/* Timelapse feed: fast-forward the scene drift + the scanline flicker so it reads as
   sped-up recorded footage, with a playback scrubber sweeping across the bottom. */
.tdev-feed-timelapse .tdev-cam-svg { animation-duration: 5s; }
.tdev-feed-timelapse .tdev-cam-sim { animation-duration: 1.6s; }
.tdev-feed-timelapse .tdev-cam-stamp { bottom: 16px; }
.tdev-feed-scrub {
    position: absolute;
    left: 8px; right: 8px; bottom: 7px;
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    overflow: hidden;
    pointer-events: none;
}
.tdev-feed-scrub span {
    position: absolute;
    inset: 0;
    transform-origin: left center;
    background: linear-gradient(90deg, var(--hseHub-cyan), var(--hseHub-cyan-soft));
    animation: tdev-feed-scrub 4s linear infinite;
}
@keyframes tdev-feed-scrub { 0% { transform: scaleX(0); } 100% { transform: scaleX(1); } }

@media (max-width: 560px) {
    .tdev-mission-feeds { grid-template-columns: 1fr; }
}

/* Battery bar inline next to the % value. */
.tdev-metric-bat .rc-bat-inline { display: inline-flex; align-items: center; gap: 7px; }
.tdev-metric-bat .tdev-battery { width: 52px; height: 9px; }

/* Mission / incursion status pill — clear "Completed / In progress / ..." chip. */
.tdev-mission-pill {
    flex: none;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 999px;
    white-space: nowrap;
}
.tdev-mission-pill.mp-done     { color: var(--hseHub-dash-green); background: rgba(37, 208, 125, 0.14); border: 1px solid rgba(37, 208, 125, 0.4); }
.tdev-mission-pill.mp-progress { color: var(--hseHub-dash-amber); background: rgba(255, 176, 32, 0.14); border: 1px solid rgba(255, 176, 32, 0.45); }
.tdev-mission-pill.mp-warn     { color: var(--hseHub-dash-amber); background: rgba(255, 176, 32, 0.14); border: 1px solid rgba(255, 176, 32, 0.4); }
.tdev-mission-pill.mp-crit     { color: var(--hseHub-dash-red); background: rgba(255, 77, 109, 0.16); border: 1px solid rgba(255, 77, 109, 0.45); }
/* Not-started (queued) mission reads neutral grey. */
.tdev-mission-pill.mp-idle     { color: #9bb1bd; background: rgba(155, 177, 189, 0.12); border: 1px solid rgba(155, 177, 189, 0.35); }
/* In-progress pill pulses so it reads as live. */
.tdev-mission-pill.mp-progress { animation: tdev-pill-pulse 1.4s ease-in-out infinite; }
@keyframes tdev-pill-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* Mission objective line — what the robot is sent to do in the plant. Shown on every
   mission drill-in (Today + Historical). */
.tdev-mission-objective {
    display: flex; align-items: flex-start; gap: 7px;
    font-size: 11.5px; line-height: 1.4; color: #cfe6ef;
    background: rgba(0, 229, 255, 0.06);
    border: 1px solid rgba(0, 229, 255, 0.18); border-left: 2px solid var(--hseHub-cyan);
    border-radius: 7px; padding: 8px 10px; margin: 8px 0;
}
.tdev-mission-objective i { color: var(--hseHub-cyan); font-size: 14px; margin-top: 1px; flex: none; }

/* A single feed fills the panel width (Today live / Historical timelapse use one feed,
   not the old side-by-side pair). */
.tdev-mission-feed-solo .tdev-mini-feed { aspect-ratio: 16 / 9; }

/* Not-started placeholder: no stream yet, just the schedule. */
.tdev-mission-pending {
    display: flex; align-items: center; gap: 8px;
    font-size: 11.5px; color: #9bb1bd;
    background: rgba(155, 177, 189, 0.07);
    border: 1px dashed rgba(155, 177, 189, 0.3); border-radius: 7px;
    padding: 14px 12px; margin-bottom: 8px;
}
.tdev-mission-pending i { color: #9bb1bd; font-size: 16px; flex: none; }

/* Clickable incursion rows (drill into the detail). */
.tdev-inc-click { cursor: pointer; border-radius: 6px; padding-right: 4px; transition: background 0.12s; }
.tdev-inc-click:hover { background: rgba(0, 229, 255, 0.08); }
.tdev-inc-go { color: #5d7681; font-size: 12px; flex: none; }
.tdev-inc-click:hover .tdev-inc-go { color: var(--hseHub-cyan); }

/* Incursion detail panel (replaces the logs grid; Back returns to the list). */
.tdev-inc-detail-head { display: flex; align-items: center; gap: 8px; }
.tdev-inc-detail-title { font-size: 12px; font-weight: 800; color: var(--hseHub-mist-100); text-transform: none; letter-spacing: 0; }
.tdev-inc-detail-head .tdev-mission-pill { margin-left: auto; }
.tdev-inc-back {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 700;
    color: var(--hseHub-cyan); background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.3); border-radius: 7px;
    padding: 3px 9px; cursor: pointer;
}
.tdev-inc-back:hover { background: rgba(0, 229, 255, 0.2); }

/* Holographic figure panel: grid backdrop + glow, floating model render. Grows to fill
   the leftover height of the side column so the box is large and well-proportioned. */
.tdev-robot-figure {
    flex: 1 1 auto;
    min-height: 150px;
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 12px;
    border-radius: 12px;
    border: 1px solid rgba(0, 229, 255, 0.25);
    background: radial-gradient(circle at 50% 38%, rgba(0, 229, 255, 0.14) 0%, rgba(5, 13, 22, 0.55) 70%);
    overflow: hidden;
}
/* Faint scanning grid behind the model. */
.tdev-robot-figure::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(0deg, rgba(0, 229, 255, 0.08) 0 1px, transparent 1px 14px),
        repeating-linear-gradient(90deg, rgba(0, 229, 255, 0.08) 0 1px, transparent 1px 14px);
    mask-image: radial-gradient(circle at 50% 45%, var(--hseHub-black) 35%, transparent 80%);
    pointer-events: none;
}
.tdev-robot-svg {
    position: relative;
    width: 170px;
    max-width: 100%;
    max-height: 100%;
    height: auto;
    filter: drop-shadow(0 0 9px rgba(0, 229, 255, 0.55));
}
/* Solid panelled figures (e.g. the humanoid): swap the neon glow for a soft,
   product-render drop shadow so they read more professional, less holographic. */
.tdev-robot-svg-pro {
    width: 150px;
    filter: drop-shadow(0 7px 12px rgba(0, 0, 0, 0.5));
}
.tdev-robot-photo {
    position: relative;
    width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    filter: drop-shadow(0 0 9px rgba(0, 229, 255, 0.35));
}
@keyframes tdev-figure-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* Drone rotors spin (each around its own centre). */
.tdev-robot-svg .rotor {
    transform-box: fill-box;
    transform-origin: center;
    animation: tdev-rotor 0.28s linear infinite;
}
@keyframes tdev-rotor { to { transform: rotate(360deg); } }

.tdev-robot-figure-cap {
    position: relative;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--hseHub-cyan-muted);
    text-align: center;
}

@media (prefers-reduced-motion: reduce) {
    .tdev-robot-svg, .tdev-robot-photo { animation: none; }
    .tdev-robot-svg .rotor { animation: none; }
    .tdev-cam-svg, .tdev-feed-scrub span { animation: none; }
}

@media (max-width: 560px) {
    .tdev-robot-body { flex-direction: column-reverse; }
    .tdev-robot-figure { flex: 0 0 auto; }
    .tdev-robot-body .tdev-robot-info { columns: 1; }
}

/* ---- Robot incursions log (inside the robot detail card) ---- */
.tdev-incursions {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 229, 255, 0.14);
}
.tdev-incursions-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--hseHub-cyan-muted);
    margin-bottom: 8px;
}
.tdev-incursions-head i { color: var(--hseHub-cyan); font-size: 13px; }
.tdev-incursions-head .cnt {
    margin-left: auto;
    font-size: 10px;
    font-weight: 800;
    color: var(--hseHub-cyan);
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 9px;
    padding: 1px 8px;
    font-variant-numeric: tabular-nums;
}
.tdev-incursion-empty {
    font-size: 11px;
    color: var(--hseHub-mist-600);
    padding: 4px 0;
}
.tdev-incursion-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 168px;
    overflow-y: auto;
}
.tdev-incursion-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--hseHub-mist-300);
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.tdev-incursion-row:last-child { border-bottom: none; }
.tdev-incursion-row .sev { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.tdev-incursion-row .sev.ok { background: var(--hseHub-dash-green); }
.tdev-incursion-row .sev.warn { background: var(--hseHub-dash-amber); }
.tdev-incursion-row .sev.crit { background: var(--hseHub-dash-red); box-shadow: 0 0 6px var(--hseHub-dash-red); }
.tdev-incursion-row .zone { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--hseHub-mist-100); }
.tdev-incursion-row .dur { flex: none; color: var(--hseHub-mist-400); font-variant-numeric: tabular-nums; }
.tdev-incursion-row .time { flex: none; color: #5d7681; font-variant-numeric: tabular-nums; width: 44px; text-align: right; }
/* In-progress mission: title reads orange, matching its amber dot. */
.tdev-incursion-row.mr-progress .zone { color: var(--hseHub-dash-amber); font-weight: 700; }
/* Not-started mission: white status dot. */
.tdev-incursion-row.mr-idle .sev { background: var(--hseHub-white); }


/* ---- Camera detail card: wider than the robot card so the live feed and the
   status/type/area/position sit side by side. ---- */
.tdev-camera-card { width: min(660px, 94%); }
.tdev-camera-body {
    display: flex;
    gap: 14px;
    align-items: stretch;
}
.tdev-camera-body .tdev-cam-meta {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* The feed pane (16:9). */
.tdev-cam-feed {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    overflow: hidden;
    background: #050d16;
    border: 1px solid rgba(0, 229, 255, 0.25);
}
.tdev-cam-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Simulated CCTV picture: a slowly drifting tinted gradient + scanlines so an
   empty feed still reads as "live video" when no real stream is wired up. */
/* Simulated CCTV scene (industrial site) behind the grain overlay. */
.tdev-cam-scene {
    position: absolute;
    inset: 0;
    overflow: hidden;
}
.tdev-cam-svg {
    width: 100%;
    height: 100%;
    display: block;
    filter: brightness(0.96) contrast(1.08) saturate(0.92);
    /* Slow ken-burns drift so the simulated feed reads as live, moving video. */
    transform-origin: 50% 60%;
    animation: tdev-cam-pan 22s ease-in-out infinite alternate;
}
@keyframes tdev-cam-pan {
    0%   { transform: scale(1.06) translate(-2%, 1%); }
    100% { transform: scale(1.13) translate(2%, -2%); }
}
/* Scanline + vignette + flicker grain laid OVER the scene so it reads like a feed. */
.tdev-cam-sim {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.16) 0px, rgba(0, 0, 0, 0.16) 1px, transparent 1px, transparent 3px),
        radial-gradient(125% 95% at 50% 42%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
    animation: tdev-cam-flicker 4s steps(40) infinite;
}
@keyframes tdev-cam-flicker {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 1; }
}

/* Faint crosshair / framing reticle over the picture. */
.tdev-cam-cross {
    position: absolute;
    inset: 10px;
    border: 1px solid rgba(0, 229, 255, 0.18);
    border-radius: 4px;
    pointer-events: none;
}
.tdev-cam-cross::before,
.tdev-cam-cross::after {
    content: "";
    position: absolute;
    background: rgba(0, 229, 255, 0.14);
}
.tdev-cam-cross::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.tdev-cam-cross::after  { top: 50%; left: 0; right: 0; height: 1px; }

/* Top overlay row: LIVE badge + camera type tag. */
.tdev-cam-overlay {
    position: absolute;
    top: 8px; left: 8px; right: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
}
.tdev-cam-live {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #ff5b6e;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 4px;
    padding: 2px 7px;
}
.tdev-cam-live .rec {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #ff3b50;
    box-shadow: 0 0 8px #ff3b50;
    animation: tdev-cam-rec 1.2s ease-in-out infinite;
}
@keyframes tdev-cam-rec { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.tdev-cam-tag {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--hseHub-cyan-soft);
    background: rgba(0, 229, 255, 0.16);
    border: 1px solid rgba(0, 229, 255, 0.3);
    border-radius: 4px;
    padding: 2px 7px;
}
.tdev-cam-stamp {
    position: absolute;
    bottom: 7px; right: 9px;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    color: #cfe6ee;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

/* Offline state. */
.tdev-cam-feed.offline { background: #0a141d; }
.tdev-cam-nosignal {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--hseHub-dash-red);
    letter-spacing: 2px;
    font-size: 11px;
    font-weight: 800;
    background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.02) 0px, rgba(255, 255, 255, 0.02) 2px, transparent 2px, transparent 4px);
}
.tdev-cam-nosignal i { font-size: 30px; }

@media (max-width: 720px) {
    .tdev-camera-body { flex-direction: column; }
    .tdev-camera-body .tdev-cam-meta { flex: 0 0 auto; }
}

/* ---- "View all" button on the Cameras widget ---- */
/* ---- Camera in alarm ----
   The detection lives on the camera and is shown where the cameras are watched: its
   tile in the wall ("View all"). The widget keeps its counts — the alerts log already
   names the event, and repeating it on the card said the same thing twice.
   Red frame plus a banner naming the detection. */
.tdev-camwall-cell.alarm { outline: 2px solid rgba(255, 77, 109, 0.75); outline-offset: -2px; border-radius: 10px; }
.tdev-cam-alarm {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 24px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 7px;
    border-radius: 6px;
    background: rgba(192, 34, 74, 0.85);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.tdev-cam-alarm i { font-size: 12px; }
.tdev-cam-alarm .at { margin-left: auto; opacity: 0.85; font-variant-numeric: tabular-nums; }

/* The feed the wall was opened on (followed from an alarm): ringed and first. */
.tdev-camwall-cell.focused { outline: 2px solid var(--hseHub-cyan); outline-offset: -2px; box-shadow: 0 0 26px rgba(0, 229, 255, 0.35); }
.tdev-camwall-cell.focused.alarm { outline-color: var(--hseHub-dash-red); box-shadow: 0 0 26px rgba(255, 77, 109, 0.45); }

/* The widget's detection badge: its own control, next to but independent of the eye. */
.tdev-cam-alarmbtn {
    flex: none;
    margin: -3px 0 -3px 6px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 999px;
    cursor: pointer;
    background: rgba(255, 77, 109, 0.16);
    border: 1px solid rgba(255, 77, 109, 0.55);
    color: var(--hseHub-dash-red);
    font-size: 9.5px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    /* Its own pulse: the widget ring's keyframes carry card-sized shadows. */
    animation: tdev-alarm-chip 1.6s ease-in-out infinite;
}
@keyframes tdev-alarm-chip {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0); }
    50%      { box-shadow: 0 0 0 3px rgba(255, 77, 109, 0.22); }
}
.tdev-cam-alarmbtn i { font-size: 12px; }
.tdev-cam-alarmbtn:hover { background: rgba(255, 77, 109, 0.3); }
@media (prefers-reduced-motion: reduce) { .tdev-cam-alarmbtn { animation: none; } }

/* Cameras: the metrics are the part that gives. They live in their own block that can
   shrink (and scroll, at the very end of the road), so the button below them is always
   drawn whole inside the card instead of being clipped off its bottom edge. */
.cam-metrics {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.tdev-cam-viewall {
    flex: none;
    margin-top: 8px;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 10px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #061421;
    background: linear-gradient(90deg, rgba(0, 229, 255, 0.85) 0%, var(--hseHub-cyan) 100%);
    border: none;
    border-radius: 7px;
    cursor: pointer;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
    transition: filter 0.15s ease, transform 0.15s ease;
}
.tdev-cam-viewall:hover { filter: brightness(1.1); transform: translateY(-1px); }
.tdev-cam-viewall i { font-size: 13px; }

/* ---- Camera wall ("View all" → security control room) ---- */
.tdev-camwall-backdrop {
    position: absolute;
    inset: 0;
    z-index: 30;
    background: radial-gradient(circle at 50% 45%, rgba(6, 18, 30, 0.55) 0%, rgba(3, 9, 16, 0.85) 100%);
    backdrop-filter: blur(5px);
    animation: tdev-fade-in 0.22s ease both;
}
.tdev-camwall {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 31;
    width: min(1320px, 96%);
    max-height: 92%;
    display: flex;
    flex-direction: column;
    background: linear-gradient(165deg, rgba(17, 41, 66, 0.97) 0%, rgba(9, 24, 40, 0.97) 100%);
    border: 1px solid rgba(0, 229, 255, 0.3);
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
    animation: tdev-fade-in 0.25s ease both;
    overflow: hidden;
}
.tdev-camwall-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.18);
    background: rgba(8, 22, 36, 0.6);
}
.tdev-camwall-head > i { color: var(--hseHub-cyan); font-size: 18px; }
.tdev-camwall-title {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--hseHub-mist-100);
}
.tdev-camwall-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
    font-size: 11px;
    font-weight: 700;
    color: var(--hseHub-mist-400);
}
.tdev-camwall-count .rec {
    width: 7px; height: 7px; border-radius: 50%;
    background: #ff3b50; box-shadow: 0 0 8px #ff3b50;
    animation: tdev-cam-rec 1.2s ease-in-out infinite;
}
.tdev-camwall-close {
    margin-left: auto;
    width: 30px; height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid rgba(0, 229, 255, 0.25);
    background: rgba(0, 229, 255, 0.08);
    color: #cfe6ee;
    cursor: pointer;
    font-size: 16px;
}
.tdev-camwall-close:hover { background: rgba(0, 229, 255, 0.18); }
.tdev-camwall-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 16px 18px;
    overflow-y: auto;
}
.tdev-camwall-cell {
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    transition: transform 0.15s ease;
}
.tdev-camwall-cell:hover { transform: translateY(-2px); }
.tdev-camwall-cell:hover .tdev-cam-feed { border-color: rgba(0, 229, 255, 0.7); box-shadow: 0 0 16px rgba(0, 229, 255, 0.3); }
.tdev-camwall-cell .tdev-cam-feed { flex: none; width: 100%; }
.tdev-camwall-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
}
.tdev-camwall-label .nm { font-weight: 700; color: var(--hseHub-mist-100); }
.tdev-camwall-label .ar { margin-left: auto; color: #7f9aa6; font-size: 10px; }

@media (max-width: 1100px) { .tdev-camwall-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px)  { .tdev-camwall-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---- Detail flyout (sub-menu) ---- */
/* ---- Modal lock ----
   While a detail flyout or the camera wall is open, the dock behind it is dimmed by
   the backdrop but was still hittable: clicking a "greyed out" widget opened that
   widget's menu instead of just dismissing the panel. Everything that floats over the
   map goes inert for the duration; the backdrop keeps its click-to-close, and the
   panel itself sits above this rule (it is not inside the dock). */
.tdev-root.tdev-modal-open .tdev-col,
.tdev-root.tdev-modal-open .tdev-bottom,
.tdev-root.tdev-modal-open .tdev-envbar,
.tdev-root.tdev-modal-open .tdev-layers,
.tdev-root.tdev-modal-open .tdev-header {
    pointer-events: none;
}
/* ...including the children that opt back into pointer events on their own. */
.tdev-root.tdev-modal-open .tdev-col .tdev-widget,
.tdev-root.tdev-modal-open .tdev-bottom .tdev-widget,
.tdev-root.tdev-modal-open .tdev-header * ,
.tdev-root.tdev-modal-open .tdev-layers * {
    pointer-events: none;
}

.tdev-flyout-backdrop {
    position: absolute;
    inset: 0;
    z-index: 20;
    pointer-events: auto;
    background: radial-gradient(circle at 50% 45%, rgba(6, 18, 30, 0.45) 0%, rgba(3, 9, 16, 0.75) 100%);
    backdrop-filter: blur(4px);
    animation: tdev-fade-in 0.25s ease both;
    /* Give children a perspective so the panel can rotate in 3D on entry. */
    perspective: 1400px;
}

@keyframes tdev-fade-in { from { opacity: 0; } to { opacity: 1; } }

.tdev-flyout {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 21;
    /* Ancho: el que pida el diseño, pero nunca casi toda la ventana. El 96% de antes
       dejaba un canal de aire de unos píxeles a cada lado en portátiles, y el panel se
       leía como una pantalla completa mal encajada en vez de como una ficha encima del
       mapa. El tope de alto deja ver que hay dashboard debajo. */
    width: min(1100px, 92%);
    max-height: 88%;
    display: flex;
    flex-direction: column;
    background: linear-gradient(165deg, rgba(17, 41, 66, 0.96) 0%, rgba(9, 24, 40, 0.96) 100%);
    border: 1px solid rgba(0, 229, 255, 0.35);
    border-radius: 18px;
    backdrop-filter: blur(18px);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.65),
                0 0 0 1px rgba(255, 255, 255, 0.04) inset,
                0 0 60px rgba(0, 229, 255, 0.12);
    /* Hidden start state: pushed back + tilted + lifted. The .show class (added
       a tick after mount) springs it forward into place — the "wow" entry. */
    transform: translate(-50%, -46%) perspective(1400px) rotateX(14deg) scale(0.9);
    transform-origin: center top;
    opacity: 0;
    transition: transform 0.42s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    overflow: hidden;
}
.tdev-flyout.show {
    transform: translate(-50%, -50%) perspective(1400px) rotateX(0deg) scale(1);
    opacity: 1;
}

/* ---- Type scales with the panel, not with the window ----
   A panel can be its normal size, dragged aside, or filling the whole dashboard, so its
   text is sized in `cqi` — a share of the PANEL's own width — instead of in fixed
   pixels. Maximised, the content grows into the space rather than leaving a field of
   empty glass around a small block of text; at the normal size the clamps land on the
   values the panel has always used, so nothing shifts until you resize it.
   Every clamp keeps a floor and a ceiling: readable when narrow, never comic when wide. */
.tdev-flyout {
    container-type: inline-size;
    container-name: tdevpanel;
}
.tdev-flyout .tdev-flyout-title { font-size: clamp(13px, 1.45cqi, 22px); letter-spacing: clamp(1.2px, 0.16cqi, 2.4px); }
.tdev-flyout .tdev-flyout-caption { font-size: clamp(10px, 1cqi, 15px); }
.tdev-flyout .tdev-flyout-sub { font-size: clamp(9.5px, 0.95cqi, 14px); }
.tdev-flyout .tdev-flyout-row { font-size: clamp(11px, 1.1cqi, 16px); }
.tdev-flyout .tdev-flyout-row .ln .muted { font-size: clamp(9.5px, 0.95cqi, 14px); }
.tdev-flyout .tdev-flyout-row .time { font-size: clamp(10px, 1cqi, 15px); }
.tdev-flyout .tdev-flyout-kpis .fk .v { font-size: clamp(20px, 2.3cqi, 38px); }
.tdev-flyout .tdev-flyout-kpis .fk .v small { font-size: clamp(11px, 1.2cqi, 19px); }
.tdev-flyout .tdev-flyout-kpis .fk .k { font-size: clamp(9px, 0.9cqi, 13px); }
.tdev-flyout .tdev-flyout-kpis .fk > i { font-size: clamp(15px, 1.6cqi, 26px); }

/* Full screen: the sections share the height too, so the panel fills top to bottom
   instead of stacking everything against the header. */
.tdev-flyout.tdev-flyout-max .tdev-flyout-grid { align-items: stretch; }
.tdev-flyout.tdev-flyout-max .tdev-flyout-section { display: flex; flex-direction: column; }

/* ---- Panel window controls ----
   Minimise collapses the panel to its header; full screen fills the dashboard. The
   !important on the maximised state is load-bearing twice over: it has to beat the
   entry animation's transform AND the inline left/top a dragged panel carries. */
.tdev-flyout.tdev-flyout-min .tdev-flyout-body { display: none; }
/* Minimizar deja SOLO la cabecera. El body se oculta, pero eso no basta: los paneles
   grandes (.tdev-flyout-lg: Workers, Drones, Training…) llevan min-height:74%, así que
   el panel seguía midiendo tres cuartos de pantalla y quedaba una caja enorme y vacía
   con la cabecera pegada arriba — que es exactamente lo que se veía. Al minimizar, la
   altura la marca el contenido que queda: la cabecera. */
.tdev-flyout.tdev-flyout-min {
    max-height: none;
    min-height: 0;
    height: auto;

    /* ...y se APARTA. Con la altura arreglada seguia midiendo lo ancho que pidiera su
       variante —1.320 px en Vehicles— y seguia clavado en el centro, asi que plegarlo
       dejaba una pancarta enorme justo encima del punto en el que se acababa de centrar
       el mapa, y lo unico que enseñaba era su propio titulo. Se ancla abajo y se encoge
       a su contenido: plegar es apartar, no adelgazar.

       `!important` por el mismo motivo que en -max: la cabecera es el asa de arrastre
       (kestrelDock) y deja `left`/`top` en linea, que si no ganarian a esto. */
    top: auto !important;
    bottom: var(--tdev-edge) !important;
    left: 50% !important;
    right: auto !important;
    width: auto !important;
    max-width: min(520px, 92%) !important;
}

/* La entrada del panel centra en los dos ejes (translate(-50%, -50%)); plegado solo
   centra en horizontal, porque en vertical manda el `bottom`. */
.tdev-flyout.tdev-flyout-min.show {
    transform: translate(-50%, 0) perspective(1400px) rotateX(0deg) scale(1) !important;
}

/* Plegado, el subtitulo sobra: lo unico que hace falta es saber QUE se plego y poder
   volver a abrirlo. */
.tdev-flyout.tdev-flyout-min .tdev-flyout-caption { display: none; }
.tdev-flyout.tdev-flyout-max {
    left: var(--tdev-edge) !important;
    top: var(--tdev-edge) !important;
    right: var(--tdev-edge) !important;
    bottom: var(--tdev-edge) !important;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
    /* Sin !important a propósito: así la animación de abajo puede tomar el control de
       transform (una animación gana a las declaraciones normales, incluso a las inline
       que deja el arrastre, pero NO a un !important). Esta regla va después de
       .tdev-flyout.show y tiene su misma especificidad, así que gana igual. */
    transform: none;
    /* El llenado, ya en su sitio: crece un pelo hasta el borde en vez de aparecer de
       golpe. Es una escala, no un cambio de caja, así que no puede descolocar el panel. */
    animation: tdev-flyout-fill 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes tdev-flyout-fill {
    from { transform: scale(0.97); opacity: 0.75; }
    to   { transform: none; opacity: 1; }
}
/* Cambiar de modo NO se anima: ver _panelSnap en TechnificationDev.razor. La transición
   de transform es la animación de entrada del panel, y aplicarla a un cambio de tamaño
   que no transiciona producía un deslizamiento desde fuera de sitio. */
.tdev-flyout.tdev-flyout-snap { transition: none !important; }
.tdev-flyout.tdev-flyout-max .tdev-flyout-body { max-height: none; flex: 1 1 auto; }
/* The secondary controls sit tight against the close button, which carries the
   margin-left:auto that pushes the group to the right. */
.tdev-flyout-head > .tdev-flyout-ctl ~ .tdev-flyout-close,
.tdev-flyout-head > .tdev-flyout-ctl + .tdev-flyout-ctl { margin-left: 6px; }
.tdev-flyout-ctl:hover { background: rgba(0, 229, 255, 0.18); color: var(--hseHub-cyan); transform: none; }

/* Variante ancha (Workers, Drones, Training, Materials, Vehicles, Heat stress).
   Ancha, no ALTA: llevaba min-height:74%, que reservaba tres cuartos de pantalla
   tuviera o no contenido con que llenarlos. El panel de heat stress se veía bien
   porque su contenido —series, estadísticas, rejilla de canales— llega hasta abajo;
   los demás quedaban como una caja enorme con un bloque de texto arriba y un campo
   de cristal vacío debajo. Ahora la altura la marca el contenido y el tope lo pone
   la pantalla (max-height del panel), que es como se comporta el del tiempo. */
.tdev-flyout-lg {
    width: min(1320px, 94%);
    min-height: 0;
}
/* El body se estira solo cuando hay de sobra: maximizado, o cuando el contenido
   pasa del tope y toca desplazarse dentro. */
.tdev-flyout-lg .tdev-flyout-body {
    flex: 0 1 auto;
}

.tdev-flyout-head {
    display: flex;
    align-items: center;
    gap: clamp(8px, 0.9cqi, 12px);
    padding: clamp(10px, 1.2cqi, 16px) clamp(12px, 1.4cqi, 18px);
    border-bottom: 1px solid rgba(0, 229, 255, 0.15);
    background: linear-gradient(180deg, rgba(0, 229, 255, 0.07) 0%, transparent 100%);
}
.tdev-flyout-icon {
    width: clamp(32px, 3.4cqi, 42px);
    height: clamp(32px, 3.4cqi, 42px);
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(0, 229, 255, 0.12);
    border: 1px solid rgba(0, 229, 255, 0.3);
    color: var(--hseHub-cyan);
    font-size: clamp(16px, 1.8cqi, 22px);
    box-shadow: 0 0 18px rgba(0, 229, 255, 0.25);
}
.tdev-flyout-title {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: var(--hseHub-mist-100);
}
.tdev-flyout-caption {
    font-size: 10.5px;
    letter-spacing: 0.6px;
    color: var(--hseHub-cyan-muted);
    opacity: 0.85;
    margin-top: 2px;
}
.tdev-flyout-close {
    margin-left: auto;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 9px;
    background: rgba(0, 229, 255, 0.06);
    color: var(--hseHub-cyan-muted);
    cursor: pointer;
    font-size: 16px;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.tdev-flyout-close:hover { background: rgba(255, 77, 109, 0.18); color: var(--hseHub-dash-red); transform: rotate(90deg); }

/* El relleno también escala con el panel: 16/18px fijos son cómodos en un panel ancho
   y se comen el sitio del contenido en uno estrecho, que es parte de por qué estos
   menús se veían grandes y con poco dentro. */
.tdev-flyout-body {
    padding: clamp(10px, 1.2cqi, 16px) clamp(12px, 1.4cqi, 18px) clamp(12px, 1.5cqi, 18px);
    overflow-y: auto;
}

/* Hour filter (Workers panel): a row of clickable hour chips. */
.tdev-flyout-hours {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}
.tdev-flyout-hours .lbl {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--hseHub-mist-400);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-right: 4px;
}
.tdev-hour-chip {
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    color: #cdeafe;
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.22);
    border-radius: 8px;
    padding: 4px 10px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.tdev-hour-chip:hover { background: rgba(0, 229, 255, 0.16); }
.tdev-hour-chip.active {
    color: var(--hseHub-navy-900);
    background: var(--hseHub-cyan);
    border-color: var(--hseHub-cyan);
}
/* "All day" (general) chip, set apart from the hour-range selects. */
.tdev-hour-chip.gen {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 6px;
}
.tdev-flyout-hours .lbl.sep { margin: 0 2px; text-transform: none; letter-spacing: 0; }
/* Island scope chip: which island the worker figures belong to. Pushed to the
   right of the hour row; highlighted when a single island is focused. */
.tdev-scope-chip {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--hseHub-mist-400);
    background: rgba(0, 229, 255, 0.06);
    border: 1px solid rgba(0, 229, 255, 0.18);
    border-radius: 999px;
    padding: 4px 12px 4px 10px;
}
.tdev-scope-chip i { font-size: 14px; color: var(--hseHub-cyan-muted); }
.tdev-scope-chip.focused {
    color: var(--hseHub-navy-900);
    background: var(--hseHub-cyan);
    border-color: var(--hseHub-cyan);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.45);
}
.tdev-scope-chip.focused i { color: var(--hseHub-navy-900); }
/* From / To hour dropdowns. */
.tdev-hour-select {
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    color: var(--hseHub-mist-100);
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 8px;
    padding: 4px 8px;
    cursor: pointer;
}
.tdev-hour-select:focus { outline: none; border-color: var(--hseHub-cyan); }
.tdev-hour-select option { color: var(--hseHub-navy-900); background: var(--hseHub-mist-100); }

/* From / To calendar + time pickers (Workers filter). The popup itself is the
   browser's native calendar/clock — color-scheme: dark renders it on the dark theme. */
.tdev-dt {
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    color: var(--hseHub-mist-100);
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 8px;
    padding: 4px 9px;
    cursor: pointer;
    color-scheme: dark;
    transition: border-color 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}
.tdev-dt:focus { outline: none; border-color: var(--hseHub-cyan); box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.2); }
.tdev-dt.dim { opacity: 0.5; }
.tdev-dt::-webkit-calendar-picker-indicator {
    filter: invert(0.75) sepia(1) saturate(6) hue-rotate(150deg);
    cursor: pointer;
}

/* "Live" chip (replaces "All day"): a recording-style pulsing pip. */
.tdev-hour-chip.live { display: inline-flex; align-items: center; gap: 6px; }
.tdev-hour-chip.live.active {
    color: var(--hseHub-navy-900);
    background: var(--hseHub-dash-green);
    border-color: var(--hseHub-dash-green);
    box-shadow: 0 0 12px rgba(37, 208, 125, 0.45);
}
.tdev-live-pip {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--hseHub-dash-green); box-shadow: 0 0 7px var(--hseHub-dash-green);
    animation: tdrone-pulse 1.1s ease-in-out infinite;
}
.tdev-hour-chip.live.active .tdev-live-pip { background: var(--hseHub-navy-900); box-shadow: none; }
.tdev-sub-time {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--hseHub-cyan);
    background: rgba(0, 229, 255, 0.1);
    border-radius: 7px;
    padding: 1px 7px;
    margin-left: 6px;
}

/* KPI strip at the top of the flyout. */
.tdev-flyout-kpis {
    display: flex;
    gap: clamp(6px, 0.8cqi, 10px);
    margin-bottom: clamp(10px, 1.2cqi, 16px);
}
.tdev-flyout-kpis .fk {
    flex: 1 1 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 12px 6px 11px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(0, 229, 255, 0.10) 0%, rgba(0, 229, 255, 0.03) 100%);
    border: 1px solid rgba(0, 229, 255, 0.18);
    overflow: hidden;
}
.tdev-flyout-kpis .fk > i { font-size: 16px; color: var(--hseHub-cyan-muted); opacity: 0.7; margin-bottom: 2px; }
.tdev-flyout-kpis .fk .v { font-size: 24px; font-weight: 800; color: var(--hseHub-mist-100); font-variant-numeric: tabular-nums; line-height: 1; }
.tdev-flyout-kpis .fk .v small { font-size: 13px; color: var(--hseHub-cyan-muted); }
.tdev-flyout-kpis .fk .v.accent { color: var(--hseHub-cyan); }
.tdev-flyout-kpis .fk .v.warn { color: var(--hseHub-dash-amber); }
.tdev-flyout-kpis .fk .v.danger { color: var(--hseHub-dash-red); }
.tdev-flyout-kpis .fk .v.ok { color: var(--hseHub-dash-green); }
.tdev-flyout-kpis .fk .k {
    font-size: 9px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--hseHub-mist-500);
    text-align: center;
}
/* Plain KPI strip (Workers): no icons, all cards equal, numbers and titles on
   shared baselines. */
.tdev-kpis-plain .fk { justify-content: center; min-height: 62px; gap: 6px; }
.tdev-kpis-plain .fk .v { color: var(--hseHub-mist-100); }

/* ---- Donut charts (Workers flyout): segmented rings with a legend ---- */
.tdev-donuts {
    display: flex;
    gap: 16px;
    margin-bottom: 18px;
}
.tdev-donut-card {
    flex: 1 1 0;
    min-width: 0;
    padding: 14px 16px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(0, 229, 255, 0.07) 0%, rgba(0, 229, 255, 0.02) 100%);
    border: 1px solid rgba(0, 229, 255, 0.16);
}
.tdev-donut-card .tdev-flyout-sub { margin-bottom: 12px; }
.tdev-donut-wrap {
    display: flex;
    align-items: center;
    gap: 18px;
}
.tdev-donut {
    position: relative;
    width: 118px;
    height: 118px;
    flex: none;
}
.tdev-donut svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    filter: drop-shadow(0 0 5px rgba(0, 229, 255, 0.25));
}
.tdev-donut-seg { transition: stroke-dasharray 0.7s cubic-bezier(0.16, 1, 0.3, 1); }
/* El rótulo del centro se mete DENTRO del agujero del anillo, no en toda la caja: con
   `inset: 0` y una cifra de cuatro dígitos, el número y su etiqueta llegaban a tocar el
   trazo. El anillo tiene r=40 sobre un viewBox de 100 y un grosor de 11 (14 en la porción
   resaltada), así que el hueco libre queda en torno al 62% del lado — el inset del 26% se
   queda por dentro de ese hueco y deja aire de sobra por los cuatro costados.
   `gap` sube a 3 px por lo mismo: entre la cifra y su etiqueta faltaba un pelo de aire. */
.tdev-donut-center {
    position: absolute;
    inset: 29%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-align: center;
}
.tdev-donut-center .dv {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    color: var(--hseHub-mist-100);
    font-variant-numeric: tabular-nums;
}
.tdev-donut-center .dk {
    font-size: 8.5px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--hseHub-mist-500);
}
.tdev-donut-legend {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.tdev-legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--hseHub-mist-300);
}
.tdev-legend-row .sw { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.tdev-legend-row .ll { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tdev-legend-row .lv { flex: none; font-weight: 700; color: var(--hseHub-mist-100); font-variant-numeric: tabular-nums; }
.tdev-legend-row .lp { flex: none; min-width: 36px; text-align: right; font-size: 10px; color: var(--hseHub-cyan-muted); font-variant-numeric: tabular-nums; }

/* Clickable contractor rows: focus one to scope shift / 24h to that contractor. */
.tdev-legend-row.clickable {
    cursor: pointer;
    padding: 4px 6px;
    margin: 0 -6px;
    border-radius: 7px;
    transition: background 0.14s ease, opacity 0.14s ease;
}
.tdev-legend-row.clickable:hover { background: rgba(0, 229, 255, 0.08); }
/* When one is selected, dim the others and highlight the picked row. */
.tdev-donut-legend.has-sel .tdev-legend-row { opacity: 0.4; }
.tdev-donut-legend.has-sel .tdev-legend-row.sel { opacity: 1; }
.tdev-legend-row.sel {
    background: rgba(0, 229, 255, 0.12);
    box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.35);
}
.tdev-legend-row.sel .ll { color: var(--hseHub-mist-100); font-weight: 700; }

/* Selected donut segment: rounded ends + soft glow (others are dimmed via opacity). */
.tdev-donut-seg.is-sel { stroke-linecap: round; filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.55)); }

/* "Focused contractor" chip shown in the Shift / Workers-vs-time headers. */
.tdev-focus-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: none;
    color: var(--hseHub-navy-900);
    background: var(--hseHub-cyan);
    border-radius: 999px;
    padding: 2px 9px 2px 7px;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}
.tdev-focus-chip i { font-size: 12px; }

/* Reveal the donut cards in step with the rest of the flyout. */
.tdev-flyout.show .tdev-donut-card {
    animation: tdev-item-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.tdev-flyout.show .tdev-donut-card:nth-child(1) { animation-delay: 0.16s; }
.tdev-flyout.show .tdev-donut-card:nth-child(2) { animation-delay: 0.22s; }

@media (max-width: 760px) {
    .tdev-donuts { flex-direction: column; }
}

/* ---- Workers flyout: 3-column breakdown below the KPI widgets ---- */
.tdev-wgrid {
    display: grid;
    grid-template-columns: 1fr 1fr 1.1fr;
    gap: 16px;
    margin-bottom: 6px;
    align-items: stretch;
}
/* Una tarjeta por reparto del Nodo: cuántos hay lo decide el dato (Wiloc publica cuatro,
   FMS ninguno), así que las columnas se reparten solas en vez de ser tres fijas. */
.tdev-wgrid-auto { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.tdev-wcard {
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 14px 16px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(0, 229, 255, 0.07) 0%, rgba(0, 229, 255, 0.02) 100%);
    border: 1px solid rgba(0, 229, 255, 0.16);
}
.tdev-wcard .tdev-flyout-sub { margin-bottom: 12px; }
/* Donut at the top of the contractors column, above the legend list. */
.tdev-wcard-top {
    display: flex;
    justify-content: center;
    padding-bottom: 16px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.1);
}
/* Total pinned to the top-right corner of the contractors card. */
.tdev-wtotal {
    margin-left: auto;
    font-size: 16px;
    font-weight: 800;
    color: var(--hseHub-cyan);
    letter-spacing: 0;
    text-transform: none;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 12px rgba(0, 229, 255, 0.4);
}
/* Column 2: stack the donut above its legend so it fits a narrow column. */
.tdev-wcard-donut .tdev-donut-wrap { flex-direction: column; align-items: center; gap: 12px; }
.tdev-wcard-donut .tdev-donut-legend { width: 100%; }
/* Extra shift metrics pinned to the foot of the column (fills the stretched card). */
.tdev-shift-stats {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(0, 229, 255, 0.12);
}

/* Column 3: interactive 24h workers-vs-time area chart. */
.tdev-wcurve { position: relative; margin-bottom: 4px; }
.tdev-wcurve svg {
    width: 100%;
    height: 84px;
    display: block;
    overflow: visible;
    border-radius: 9px;
    background:
        linear-gradient(rgba(0, 229, 255, 0.03), rgba(0, 229, 255, 0.03)),
        repeating-linear-gradient(90deg, transparent 0 calc(100% / 4 - 1px), rgba(0, 229, 255, 0.08) calc(100% / 4 - 1px) calc(100% / 4));
}
.tdev-wcurve .line {
    fill: none;
    stroke: var(--hseHub-cyan);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
    filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.6));
}
.tdev-wcurve .nowx {
    stroke: var(--hseHub-dash-green);
    stroke-width: 1.5;
    stroke-dasharray: 3 3;
    opacity: 0.9;
}
.tdev-wcurve .hoverx { stroke: var(--hseHub-mist-100); stroke-width: 1.5; opacity: 0.85; }
.tdev-wcurve .hit { fill: transparent; cursor: pointer; }
.tdev-wcurve .hit:hover { fill: rgba(0, 229, 255, 0.07); }
/* Floating value readout while inspecting an hour. */
.tdev-wcurve-tip {
    position: absolute;
    top: -2px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 3px 8px;
    border-radius: 8px;
    background: rgba(6, 20, 30, 0.92);
    border: 1px solid rgba(0, 229, 255, 0.35);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    white-space: nowrap;
    z-index: 2;
}
.tdev-wcurve-tip .t { font-size: 9px; font-weight: 700; letter-spacing: 0.06em; color: var(--hseHub-cyan-muted); font-variant-numeric: tabular-nums; }
.tdev-wcurve-tip .n { font-size: 15px; font-weight: 800; color: var(--hseHub-cyan); line-height: 1; font-variant-numeric: tabular-nums; }
.tdev-flyout.show .tdev-wcurve .area { animation: tdev-item-in 0.6s ease both; animation-delay: 0.22s; }
.tdev-wcurve-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--hseHub-mist-600);
    font-variant-numeric: tabular-nums;
}

/* Reveal the three cards in step with the rest of the flyout. */
.tdev-flyout.show .tdev-wcard { animation: tdev-item-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
.tdev-flyout.show .tdev-wcard:nth-child(1) { animation-delay: 0.14s; }
.tdev-flyout.show .tdev-wcard:nth-child(2) { animation-delay: 0.20s; }
.tdev-flyout.show .tdev-wcard:nth-child(3) { animation-delay: 0.26s; }

@media (max-width: 900px) {
    .tdev-wgrid { grid-template-columns: 1fr; }
}

/* Two-column body grid (collapses to one column when narrow). */
.tdev-flyout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(10px, 1.4cqi, 18px) clamp(12px, 1.7cqi, 22px);
}
.tdev-flyout-section { min-width: 0; }

/* Dos columnas solo si el PANEL da para dos.
   Ya había un @media a 720px, pero mide la VENTANA, y lo que tiene que caber aquí es
   el contenido dentro del panel: en una pantalla de 1600px un panel al 92% son ~1470px
   y caben dos columnas, mientras que ese mismo panel minimizado o en un portátil no.
   La container query mide el propio panel — que ya se declara como contenedor unas
   líneas más arriba para las fuentes en cqi — así que acierta en los dos casos. */
@container tdevpanel (max-width: 700px) {
    .tdev-flyout-grid { grid-template-columns: 1fr; }
    .tdev-flyout-kpis { flex-wrap: wrap; }
    .tdev-flyout-kpis .fk { flex: 1 1 40%; }
}

.tdev-flyout-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--hseHub-cyan-muted);
    margin-bottom: 9px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.14);
}
.tdev-flyout-sub.mt { margin-top: 16px; }
.tdev-flyout-sub i { font-size: 13px; color: var(--hseHub-cyan); }

/* Rows inside the flyout body (bar chart / list style). */
.tdev-flyout-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 11.5px;
    color: var(--hseHub-mist-300);
}
.tdev-flyout-row:last-child { border-bottom: none; }
.tdev-flyout-row .ln { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tdev-flyout-row .ln .muted { color: var(--hseHub-mist-600); font-size: 10px; }
.tdev-flyout-row .num { flex: none; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--hseHub-mist-100); }
.tdev-flyout-row .num.accent { color: var(--hseHub-cyan); }
.tdev-flyout-row .num.warn { color: var(--hseHub-dash-amber); }
.tdev-flyout-row .num.danger { color: var(--hseHub-dash-red); }
.tdev-flyout-row .num .ok { color: var(--hseHub-dash-green); }
.tdev-flyout-row .time { flex: none; font-size: 10.5px; color: var(--hseHub-mist-400); font-variant-numeric: tabular-nums; }
.tdev-flyout-row .chip {
    flex: none;
    font-size: 11px;
    font-weight: 800;
    color: var(--hseHub-cyan);
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 9px;
    padding: 1px 9px;
    font-variant-numeric: tabular-nums;
}
/* Status pill colour variants (e.g. drone incursion Completed / In progress). */
.tdev-flyout-row .chip.ok { color: var(--hseHub-dash-green); background: rgba(37, 208, 125, 0.12); border-color: rgba(37, 208, 125, 0.3); }
.tdev-flyout-row .chip.warn { color: var(--hseHub-dash-amber); background: rgba(255, 176, 32, 0.12); border-color: rgba(255, 176, 32, 0.3); }
.tdev-flyout-row .sev { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.tdev-flyout-row .sev.ok { background: var(--hseHub-dash-green); }
.tdev-flyout-row .sev.warn { background: var(--hseHub-dash-amber); }
.tdev-flyout-row .sev.crit { background: var(--hseHub-dash-red); box-shadow: 0 0 7px var(--hseHub-dash-red); }
.tdev-flyout-row .tdev-flyout-bar {
    flex: 1 1 90px;
    max-width: 150px;
    height: 8px;
    border-radius: 5px;
    background: rgba(0, 229, 255, 0.10);
    overflow: hidden;
}
.tdev-flyout-row .tdev-flyout-bar > span {
    display: block;
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, var(--hseHub-cyan) 0%, var(--hseHub-dash-green) 100%);
    transform-origin: left center;
}
.tdev-flyout-row .tdev-flyout-bar > span.warn {
    background: linear-gradient(90deg, var(--hseHub-dash-amber) 0%, #ff7a59 100%);
}

/* ---- "Wow" staggered reveal of the content once the panel is shown ---- */
.tdev-flyout.show .tdev-flyout-kpis .fk,
.tdev-flyout.show .tdev-flyout-row {
    animation: tdev-item-in 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.tdev-flyout.show .tdev-flyout-bar > span {
    animation: tdev-bar-grow 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes tdev-item-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes tdev-bar-grow {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}
/* Stagger: KPI cards. */
.tdev-flyout.show .tdev-flyout-kpis .fk:nth-child(1) { animation-delay: 0.05s; }
.tdev-flyout.show .tdev-flyout-kpis .fk:nth-child(2) { animation-delay: 0.10s; }
.tdev-flyout.show .tdev-flyout-kpis .fk:nth-child(3) { animation-delay: 0.15s; }
.tdev-flyout.show .tdev-flyout-kpis .fk:nth-child(4) { animation-delay: 0.20s; }
/* Stagger: rows within each section (nth-child resets per section). */
.tdev-flyout.show .tdev-flyout-row:nth-child(2) { animation-delay: 0.22s; }
.tdev-flyout.show .tdev-flyout-row:nth-child(3) { animation-delay: 0.27s; }
.tdev-flyout.show .tdev-flyout-row:nth-child(4) { animation-delay: 0.32s; }
.tdev-flyout.show .tdev-flyout-row:nth-child(5) { animation-delay: 0.37s; }
.tdev-flyout.show .tdev-flyout-row:nth-child(6) { animation-delay: 0.42s; }
.tdev-flyout.show .tdev-flyout-row:nth-child(7) { animation-delay: 0.47s; }
.tdev-flyout.show .tdev-flyout-bar > span { animation-delay: 0.3s; }

/* ====================================================================
   Drone incursions — clickable "flight card" deck + drill-in detail.
   Deliberately NOT a table: each run is a card with its own route trace,
   status glow and metric tags; tapping one opens the full run detail.
   ==================================================================== */
.tdrone-hint { font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--hseHub-mist-600); }

/* ---- Deck filter bar (by drone unit / by status) ---- */
.tdrone-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.tdrone-filter-lbl {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--hseHub-cyan-muted);
    margin-right: 2px;
}
.tdrone-filter-lbl i { font-size: 13px; color: var(--hseHub-cyan); }
.tdrone-filter-sep {
    width: 1px;
    height: 18px;
    background: rgba(0, 229, 255, 0.18);
    margin: 0 6px;
}
.tdrone-fchip {
    font: inherit;
    font-size: 11.5px;
    font-weight: 700;
    color: #cdeafe;
    background: rgba(0, 229, 255, 0.07);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 999px;
    padding: 3px 12px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.tdrone-fchip:hover { background: rgba(0, 229, 255, 0.15); }
.tdrone-fchip.active {
    color: var(--hseHub-navy-900);
    background: var(--hseHub-cyan);
    border-color: var(--hseHub-cyan);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.4);
}
.tdrone-fchip.ok.active { background: var(--hseHub-dash-green); border-color: var(--hseHub-dash-green); box-shadow: 0 0 12px rgba(37, 208, 125, 0.4); }
.tdrone-fchip.warn.active { background: var(--hseHub-dash-amber); border-color: var(--hseHub-dash-amber); box-shadow: 0 0 12px rgba(255, 176, 32, 0.4); }
.tdrone-filter-count {
    margin-left: auto;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--hseHub-mist-400);
    font-variant-numeric: tabular-nums;
}

.tdrone-empty {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 26px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--hseHub-cyan-muted);
    background: rgba(0, 229, 255, 0.04);
    border: 1px dashed rgba(0, 229, 255, 0.22);
    border-radius: 12px;
}
.tdrone-empty i { font-size: 16px; color: var(--hseHub-cyan); }

.tdrone-deck {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    margin-bottom: 6px;
}

/* ---- Flight card ---- */
.tdrone-card {
    --sev: var(--hseHub-dash-green);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 13px 14px 11px;
    text-align: left;
    font: inherit;
    color: var(--hseHub-mist-300);
    cursor: pointer;
    border: 1px solid rgba(0, 229, 255, 0.16);
    border-radius: 14px;
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(0, 229, 255, 0.06) 0%, transparent 60%),
        linear-gradient(180deg, rgba(8, 26, 38, 0.85) 0%, rgba(7, 19, 31, 0.95) 100%);
    overflow: hidden;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.tdrone-card::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--sev);
    box-shadow: 0 0 12px var(--sev);
    opacity: 0.85;
}
.tdrone-card.sev-warn { --sev: var(--hseHub-dash-amber); }
.tdrone-card.sev-crit { --sev: var(--hseHub-dash-red); }
.tdrone-card:hover {
    transform: translateY(-3px);
    border-color: rgba(0, 229, 255, 0.5);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 229, 255, 0.18);
}
.tdrone-card:hover .tdrone-go { transform: translateX(3px); color: var(--hseHub-cyan); }
.tdrone-card:focus-visible { outline: 2px solid var(--hseHub-cyan); outline-offset: 2px; }
.tdrone-card.live { border-color: rgba(255, 176, 32, 0.45); }

.tdrone-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tdrone-unit {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--hseHub-mist-100);
}
.tdrone-unit svg { width: 18px; height: 18px; color: var(--hseHub-cyan); flex: none; }

.tdrone-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 999px;
    color: var(--hseHub-dash-green);
    background: rgba(37, 208, 125, 0.12);
    border: 1px solid rgba(37, 208, 125, 0.3);
    white-space: nowrap;
}
.tdrone-status.warn { color: var(--hseHub-dash-amber); background: rgba(255, 176, 32, 0.12); border-color: rgba(255, 176, 32, 0.3); }
.tdrone-live-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--hseHub-dash-amber); box-shadow: 0 0 7px var(--hseHub-dash-amber);
    animation: tdrone-pulse 1.1s ease-in-out infinite;
}
@keyframes tdrone-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.tdrone-area {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--hseHub-mist-100);
    line-height: 1.25;
}

/* Mini flight-path trace inside the card. */
.tdrone-route {
    height: 38px;
    margin: 1px 0 2px;
    border-radius: 9px;
    background:
        linear-gradient(rgba(0, 229, 255, 0.05), rgba(0, 229, 255, 0.05)),
        repeating-linear-gradient(90deg, transparent 0 17px, rgba(0, 229, 255, 0.07) 17px 18px),
        repeating-linear-gradient(0deg, transparent 0 17px, rgba(0, 229, 255, 0.07) 17px 18px);
    border: 1px solid rgba(0, 229, 255, 0.1);
    overflow: hidden;
}
.tdrone-route svg { width: 100%; height: 100%; display: block; }
.tdrone-route .trk {
    fill: none;
    stroke: var(--sev, var(--hseHub-cyan));
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 4px var(--sev, var(--hseHub-cyan)));
    stroke-dasharray: 320;
    stroke-dashoffset: 320;
}
.tdev-flyout.show .tdrone-route .trk { animation: tdrone-trace 1.1s cubic-bezier(0.16, 1, 0.3, 1) 0.25s forwards; }
@keyframes tdrone-trace { to { stroke-dashoffset: 0; } }

.tdrone-card-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.tdrone-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--hseHub-mist-400);
    background: rgba(0, 229, 255, 0.07);
    border: 1px solid rgba(0, 229, 255, 0.14);
    border-radius: 7px;
    padding: 2px 7px;
    font-variant-numeric: tabular-nums;
}
.tdrone-tag i { font-size: 12px; color: var(--hseHub-cyan-muted); }
.tdrone-tag.warn { color: var(--hseHub-dash-amber); background: rgba(255, 176, 32, 0.1); border-color: rgba(255, 176, 32, 0.28); }
.tdrone-tag.warn i { color: var(--hseHub-dash-amber); }
.tdrone-tag.ok { color: var(--hseHub-dash-green); background: rgba(37, 208, 125, 0.1); border-color: rgba(37, 208, 125, 0.26); }
.tdrone-tag.ok i { color: var(--hseHub-dash-green); }
.tdrone-go {
    margin-left: auto;
    font-size: 16px;
    color: var(--hseHub-cyan-muted);
    transition: transform 0.16s ease, color 0.16s ease;
}

/* Staggered reveal of the deck once the flyout is shown. */
.tdev-flyout.show .tdrone-card { animation: tdev-item-in 0.45s cubic-bezier(0.16, 1, 0.3, 1) both; }
.tdev-flyout.show .tdrone-card:nth-child(1) { animation-delay: 0.06s; }
.tdev-flyout.show .tdrone-card:nth-child(2) { animation-delay: 0.11s; }
.tdev-flyout.show .tdrone-card:nth-child(3) { animation-delay: 0.16s; }
.tdev-flyout.show .tdrone-card:nth-child(4) { animation-delay: 0.21s; }
.tdev-flyout.show .tdrone-card:nth-child(5) { animation-delay: 0.26s; }
.tdev-flyout.show .tdrone-card:nth-child(6) { animation-delay: 0.31s; }
.tdev-flyout.show .tdrone-card:nth-child(7) { animation-delay: 0.36s; }

/* ---- Drill-in detail ---- */
.tdrone-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--hseHub-cyan-muted);
    background: rgba(0, 229, 255, 0.06);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 9px;
    padding: 5px 12px 5px 9px;
    cursor: pointer;
    margin-bottom: 14px;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.tdrone-back:hover { background: rgba(0, 229, 255, 0.14); color: var(--hseHub-mist-100); transform: translateX(-2px); }
.tdrone-back i { font-size: 15px; }

.tdrone-detail-hero {
    --sev: var(--hseHub-dash-green);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 14px;
    border-radius: 14px;
    border: 1px solid rgba(0, 229, 255, 0.18);
    background:
        radial-gradient(140% 120% at 0% 0%, rgba(0, 229, 255, 0.1) 0%, transparent 55%),
        linear-gradient(180deg, rgba(8, 26, 38, 0.9) 0%, rgba(7, 19, 31, 0.96) 100%);
    overflow: hidden;
}
.tdrone-detail-hero.sev-warn { --sev: var(--hseHub-dash-amber); }
.tdrone-detail-hero.sev-crit { --sev: var(--hseHub-dash-red); }
.tdrone-detail-hero::before {
    content: "";
    position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--sev); box-shadow: 0 0 16px var(--sev);
}
.tdrone-detail-id { display: flex; align-items: center; gap: 13px; min-width: 0; }
.tdrone-mark {
    width: 40px; height: 40px; flex: none; color: var(--hseHub-cyan);
    padding: 7px; border-radius: 11px;
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.28);
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.22);
}
.tdrone-detail-unit { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; color: var(--hseHub-cyan); }
.tdrone-detail-area { font-size: 17px; font-weight: 800; color: var(--hseHub-mist-100); line-height: 1.2; }
.tdrone-detail-badges { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.tdrone-pill {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 700; color: #cdeafe;
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 999px; padding: 3px 11px;
    font-variant-numeric: tabular-nums;
}
.tdrone-pill i { font-size: 13px; color: var(--hseHub-cyan-muted); }

.tdrone-detail-route {
    position: relative;
    height: 96px;
    margin-bottom: 16px;
    border-radius: 12px;
    border: 1px solid rgba(0, 229, 255, 0.14);
    background:
        repeating-linear-gradient(90deg, transparent 0 23px, rgba(0, 229, 255, 0.06) 23px 24px),
        repeating-linear-gradient(0deg, transparent 0 23px, rgba(0, 229, 255, 0.06) 23px 24px),
        linear-gradient(180deg, rgba(0, 229, 255, 0.04), transparent);
    overflow: hidden;
}
.tdrone-detail-route svg { width: 100%; height: 100%; display: block; }
.tdrone-detail-hero.sev-warn ~ .tdrone-detail-route .trk,
.tdrone-detail-hero.sev-warn ~ .tdrone-detail-route .trk-glow { stroke: var(--hseHub-dash-amber); }
.tdrone-detail-hero.sev-crit ~ .tdrone-detail-route .trk,
.tdrone-detail-hero.sev-crit ~ .tdrone-detail-route .trk-glow { stroke: var(--hseHub-dash-red); }
.tdrone-detail-route .trk {
    fill: none; stroke: var(--hseHub-cyan); stroke-width: 2.2;
    stroke-linecap: round; stroke-linejoin: round;
    filter: drop-shadow(0 0 5px currentColor);
}
.tdrone-detail-route .trk-glow {
    fill: none; stroke: var(--hseHub-cyan); stroke-width: 6;
    stroke-linecap: round; stroke-linejoin: round;
    opacity: 0.12;
}
.tdrone-route-cap {
    position: absolute; left: 10px; bottom: 8px;
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--hseHub-cyan-muted);
}
.tdrone-route-cap i { font-size: 12px; color: var(--hseHub-cyan); }

.tdrone-finding {
    display: flex; align-items: center; gap: 9px;
    padding: 9px 11px; margin-bottom: 7px;
    border-radius: 10px;
    font-size: 11.5px; color: #d8e6ec;
    background: rgba(255, 176, 32, 0.06);
    border: 1px solid rgba(255, 176, 32, 0.22);
}
.tdrone-finding.sev-crit { background: rgba(255, 77, 109, 0.08); border-color: rgba(255, 77, 109, 0.3); }
.tdrone-finding .sev { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tdrone-finding .sev.warn { background: var(--hseHub-dash-amber); box-shadow: 0 0 6px var(--hseHub-dash-amber); }
.tdrone-finding .sev.crit { background: var(--hseHub-dash-red); box-shadow: 0 0 7px var(--hseHub-dash-red); }
.tdrone-finding .ln { flex: 1 1 auto; min-width: 0; }
.tdrone-finding .chip {
    flex: none; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--hseHub-dash-amber); background: rgba(255, 176, 32, 0.12);
    border: 1px solid rgba(255, 176, 32, 0.3); border-radius: 8px; padding: 2px 8px;
}
.tdrone-finding.sev-crit .chip { color: var(--hseHub-dash-red); background: rgba(255, 77, 109, 0.14); border-color: rgba(255, 77, 109, 0.34); }
.tdrone-clear {
    display: flex; align-items: center; gap: 8px;
    padding: 11px 12px; border-radius: 10px;
    font-size: 12px; font-weight: 600; color: var(--hseHub-dash-green);
    background: rgba(37, 208, 125, 0.08);
    border: 1px solid rgba(37, 208, 125, 0.24);
}
.tdrone-clear i { font-size: 16px; }

@media (max-width: 720px) {
    .tdrone-deck { grid-template-columns: 1fr; }
}

/* ---- Spool flow (materials flyout): Workshop -> Laydown -> Site -> Installed ----
   Deliberately NOT a row of cards like the 4 KPIs above it: a connected process
   track with circular zone nodes and dashed transit links carrying the count. */
.tdev-flow {
    display: flex;
    align-items: flex-start;
    margin: 2px 0 20px;
    padding: 6px 4px 0;
}
.tdev-flow-node {
    flex: 0 0 auto;
    width: 86px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.tdev-flow-node .fn-ring {
    position: relative;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 36%, rgba(0, 229, 255, 0.16), rgba(0, 229, 255, 0.02));
    border: 2px solid rgba(0, 229, 255, 0.42);
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.14) inset;
}
.tdev-flow-node .fn-ring > i {
    position: absolute;
    top: -9px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    background: #0b2336;
    border: 1px solid rgba(0, 229, 255, 0.42);
    color: var(--hseHub-cyan-muted);
}
.tdev-flow-node .fn-count {
    font-size: 23px;
    font-weight: 800;
    line-height: 1;
    color: var(--hseHub-mist-100);
    font-variant-numeric: tabular-nums;
}
.tdev-flow-node .fn-name { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--hseHub-mist-400); }
.tdev-flow-node .fn-lbl { font-size: 9px; letter-spacing: 0.6px; text-transform: uppercase; color: var(--hseHub-mist-600); }

.tdev-flow-node.done .fn-ring {
    background: radial-gradient(circle at 50% 36%, rgba(37, 208, 125, 0.18), rgba(37, 208, 125, 0.02));
    border-color: rgba(37, 208, 125, 0.46);
    box-shadow: 0 0 16px rgba(37, 208, 125, 0.14) inset;
}
.tdev-flow-node.done .fn-ring > i { color: var(--hseHub-dash-green); border-color: rgba(37, 208, 125, 0.46); }
.tdev-flow-node.done .fn-count { color: var(--hseHub-dash-green); }

/* Dashed link between two zones, with the in-transit count floating on it. */
.tdev-flow-link {
    flex: 1 1 auto;
    min-width: 36px;
    height: 62px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tdev-flow-link::before {
    content: "";
    position: absolute;
    left: -6px;
    right: -6px;
    top: 30px;
    height: 2px;
    background: repeating-linear-gradient(90deg, rgba(0, 229, 255, 0.4) 0 7px, transparent 7px 13px);
}
.tdev-flow-link .fl-pill {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    color: var(--hseHub-mist-600);
    background: #0b2336;
    border: 1px solid rgba(79, 107, 120, 0.55);
    font-variant-numeric: tabular-nums;
}
.tdev-flow-link .fl-pill > i { font-size: 13px; }
.tdev-flow-link.active .fl-pill { color: var(--hseHub-dash-amber); border-color: rgba(255, 176, 32, 0.55); }
.tdev-flow-link.active::before { background: repeating-linear-gradient(90deg, rgba(255, 176, 32, 0.55) 0 7px, transparent 7px 13px); }
.tdev-flow-link.done::before { background: rgba(43, 111, 134, 0.55); }

/* Clickable zone nodes: click to list that zone's spools & packing lists below. */
.tdev-flow-node.clickable { cursor: pointer; }
.tdev-flow-node.clickable .fn-ring { transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease; }
.tdev-flow-node.clickable:hover .fn-ring { transform: translateY(-2px); box-shadow: 0 0 22px rgba(0, 229, 255, 0.3) inset, 0 6px 16px rgba(0, 0, 0, 0.4); }
.tdev-flow-node.clickable:hover .fn-name { color: #cdeafe; }
.tdev-flow-node.selected .fn-ring {
    border-color: var(--hseHub-cyan);
    box-shadow: 0 0 0 4px rgba(0, 229, 255, 0.18), 0 0 22px rgba(0, 229, 255, 0.4) inset;
}
.tdev-flow-node.selected .fn-name { color: var(--hseHub-cyan); }

/* Active-filter banner under the flow when a zone is selected. */
.tdev-flow-filter {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: -8px 0 14px;
    font-size: 11px;
    letter-spacing: 0.4px;
    color: var(--hseHub-mist-400);
}
.tdev-flow-filter > i { color: var(--hseHub-cyan); font-size: 13px; }
.tdev-flow-filter strong { color: var(--hseHub-mist-100); font-weight: 700; }
.tdev-flow-clear {
    margin-left: 4px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--hseHub-cyan-muted);
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.28);
    cursor: pointer;
}
.tdev-flow-clear:hover { background: rgba(255, 77, 109, 0.16); color: var(--hseHub-dash-red); border-color: rgba(255, 77, 109, 0.4); }
.tdev-flow-clear > i { font-size: 11px; }

.tdev-flyout-empty {
    padding: 14px 4px;
    font-size: 11.5px;
    color: var(--hseHub-mist-600);
    font-style: italic;
}

/* Expandable packing-list rows (materials flyout). */
/* Rejilla, no flex.
   Con flex, el chip ("3 spools" / "128 spools") y la hora medían lo que midiera su
   texto, así que cada fila los colocaba en un sitio distinto y la lista se leía como
   un escalón. Las columnas son FIJAS a propósito: es la única forma de que celdas de
   filas hermanas caigan a la misma altura sin subgrid (que no tiene soporte donde
   corre esto). Solo el nombre es elástico —minmax(0,1fr), el 0 es lo que le permite
   encogerse y recortar con puntos suspensivos en vez de empujar a las demás. */
.tdev-pack-row {
    display: grid;
    grid-template-columns: 7px minmax(0, 1fr) 92px 54px 14px;
    align-items: center;
    gap: 8px;
    padding: 9px 0;
    border-bottom: 1px solid rgba(0, 229, 255, 0.07);
    cursor: pointer;
}
.tdev-pack-row .ln { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tdev-pack-row .ln .muted { color: var(--hseHub-mist-600); font-size: 10px; }
.tdev-pack-row .chip {
    /* A la derecha de su columna: los chips varían de ancho con el número, y así lo
       que queda en línea entre filas es su borde derecho, junto a la hora. */
    justify-self: end;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    color: var(--hseHub-cyan);
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.28);
}
/* tabular-nums ya estaba y aquí es lo que hace el trabajo: las cifras miden todas
   igual, así que "2h 10m" y "11h 05m" ocupan lo mismo y la columna no baila. */
.tdev-pack-row .time { text-align: right; font-size: 10.5px; color: var(--hseHub-mist-400); font-variant-numeric: tabular-nums; }
.tdev-pack-row .sev { width: 7px; height: 7px; border-radius: 50%; }
.tdev-pack-row .sev.ok { background: var(--hseHub-dash-green); }
.tdev-pack-row .sev.warn { background: var(--hseHub-dash-amber); }
.tdev-pack-row .sev.crit { background: var(--hseHub-dash-red); box-shadow: 0 0 7px var(--hseHub-dash-red); }
.tdev-pack-caret { flex: none; font-size: 12px; color: var(--hseHub-cyan-muted); transition: transform 0.18s ease; }
.tdev-pack-row.open .tdev-pack-caret { transform: rotate(180deg); }
.tdev-pack-row.open { border-bottom-color: transparent; }
.tdev-pack-spools {
    margin: 0 0 6px 15px;
    padding-left: 11px;
    border-left: 1px solid rgba(0, 229, 255, 0.18);
}
/* Los spools de dentro, con el mismo criterio: su etiqueta de zona ("LAYDOWN",
   "SITE", "WORKSHOP") también cambia de ancho por fila. Tres columnas — no llevan
   hora ni caret — y el chip alineado por su derecha, como arriba. */
.tdev-pack-spools .tdev-flyout-row {
    display: grid;
    grid-template-columns: 7px minmax(0, 1fr) 92px;
    align-items: center;
    gap: 8px;
}
.tdev-pack-spools .tdev-flyout-row .ln { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tdev-pack-spools .tdev-flyout-row .chip { justify-self: end; }
.tdev-pack-spools .tdev-flyout-row .chip.warn { color: var(--hseHub-dash-amber); background: rgba(255, 176, 32, 0.12); border-color: rgba(255, 176, 32, 0.3); }
.tdev-pack-spools .tdev-flyout-row .chip.ok { color: var(--hseHub-dash-green); background: rgba(37, 208, 125, 0.12); border-color: rgba(37, 208, 125, 0.3); }

@media (max-width: 720px) {
    .tdev-flyout-grid { grid-template-columns: 1fr; }
    .tdev-flyout-kpis { flex-wrap: wrap; }
    .tdev-flyout-kpis .fk { flex: 1 1 40%; }
    .tdev-flow { overflow-x: auto; }
    .tdev-flow-link .fl-pill { padding: 2px 6px; }
}
@media (prefers-reduced-motion: reduce) {
    .tdev-flyout,
    .tdev-flyout.show .tdev-flyout-kpis .fk,
    .tdev-flyout.show .tdev-flyout-row,
    .tdev-flyout.show .tdev-flyout-bar > span { animation: none; transition: opacity 0.2s ease; }
}

@media (max-width: 1200px) {
    .tdev-col { width: 240px; }
}
@media (max-width: 900px) {
    .tdev-col, .tdev-bottom { display: none; }
}

/* ============================================================================
   Kestrel 5400 heat-stress panel (env strip → heatstress flyout).
   Mirrors the standalone Kestrel LiNK dashboard: session bar → latest reading →
   session statistics → data quality → time-series → per-channel grid.

   Series hues are the dashboard's own accent/violet/coral; the status trio
   (var(--hseHub-dash-green) / var(--hseHub-dash-amber) / var(--hseHub-dash-red)) stays reserved for alarm state, so a red line is
   always an alarm and never a series.
   ============================================================================ */
.kst-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 32px 4px;
    color: var(--hseHub-mist-400);
    font-size: 12px;
    font-weight: 600;
}

/* The panel is simulated until a real feed lands — say so on screen, not just in
   the source, so no one reads these numbers as measurements. */
.kst-simbanner {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 14px;
    padding: 8px 12px;
    border-radius: 9px;
    background: rgba(255, 176, 32, 0.09);
    border: 1px solid rgba(255, 176, 32, 0.32);
    color: var(--hseHub-dash-amber);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
}
.kst-simbanner i { font-size: 15px; flex: none; }

/* ---- Session bar ---- */
.kst-sessionbar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding: 9px 13px;
    border-radius: 10px;
    background: rgba(0, 229, 255, 0.05);
    border: 1px solid rgba(0, 229, 255, 0.16);
}
.kst-session-id { display: flex; flex-direction: column; gap: 2px; flex: none; }
.kst-device { font-size: 12px; font-weight: 800; color: var(--hseHub-mist-100); letter-spacing: 0.02em; }
.kst-serial { font-size: 9px; font-weight: 700; letter-spacing: 0.08em; color: var(--hseHub-mist-600); }
.kst-session-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 600;
    color: var(--hseHub-mist-400);
    font-variant-numeric: tabular-nums;
}
.kst-session-right { display: flex; align-items: center; gap: 12px; flex: none; }
.kst-live {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 5px;
    background: rgba(37, 208, 125, 0.14);
    border: 1px solid rgba(37, 208, 125, 0.4);
    color: var(--hseHub-dash-green);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.1em;
}
.kst-last { font-size: 10px; font-weight: 600; color: var(--hseHub-mist-600); font-variant-numeric: tabular-nums; }
.kst-batt {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--hseHub-mist-400);
    font-variant-numeric: tabular-nums;
}
.kst-batt i { font-size: 15px; color: var(--hseHub-dash-green); }

/* ---- Report layout: the traces lead, the figures sit beside them ----
   Charts take the width they need to be read as curves; the numbers that qualify
   them (WBGT now / mean / range / trend, air, workers) stack in a narrow column
   alongside instead of pushing the charts below the fold. Under ~1180px of card
   the column drops beneath the charts and runs as a row of tiles. */
.kst-report {
    display: grid;
    /* The figure column is a share of the card, not a fixed 208px: on a narrower card
       it gives width back to the traces instead of crowding them. */
    grid-template-columns: minmax(0, 1fr) clamp(148px, 21%, 208px);
    gap: clamp(12px, 1.8%, 22px);
    /* The two columns end level: the charts side stretches to whatever height the
       figures need, instead of stopping short and leaving a gap under the last one. */
    align-items: stretch;
}
.kst-report-charts {
    min-width: 0;
    display: flex;
    flex-direction: column;
    /* Chart, channel heading and the spark row spread through that height rather than
       bunching at the top. */
    justify-content: space-between;
    gap: clamp(10px, 1.4%, 18px);
}
.kst-report-charts > .kst-chart { margin-bottom: 0; }
/* The channel charts stack one above the other and take the leftover height (full
   screen gives them plenty), so the spare space is shared between them rather than
   left as a band underneath. */
.kst-chart-stack {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: clamp(8px, 1%, 14px);
}
.kst-chart-stack > .kst-chart { margin-bottom: 0; }
.kst-report-nums {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: sticky;
    top: 0;
    /* Starts at the top of the row: when the charts are the taller side it stays put
       instead of being stretched into a ladder of gaps. */
    align-self: start;
    min-width: 0;
    /* A rule down the middle: whatever the width, the figures read as their own
       column rather than as something stuck to the edge of the chart. */
    padding-left: clamp(10px, 1.4%, 16px);
    border-left: 1px solid rgba(0, 229, 255, 0.14);
}
@media (max-width: 1180px) {
    .kst-report { grid-template-columns: minmax(0, 1fr); }
    .kst-report-nums {
        position: static;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        /* Below the charts now, so the rule moves to the top edge. */
        padding-left: 0;
        padding-top: 12px;
        border-left: none;
        border-top: 1px solid rgba(0, 229, 255, 0.14);
    }
}

/* ---- Number tiles ---- */
.kst-num {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px 9px;
    border-radius: 11px;
    background: linear-gradient(180deg, rgba(0, 229, 255, 0.08) 0%, rgba(0, 229, 255, 0.02) 100%);
    border: 1px solid rgba(0, 229, 255, 0.16);
}
/* The lead tile is the reading the band decision is made on, so it wears the band
   colour and outsizes the rest. */
.kst-num-lead {
    --kst-band: var(--hseHub-cyan);
    padding: 12px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--kst-band) 20%, transparent) 0%, transparent 100%);
    border-color: color-mix(in srgb, var(--kst-band) 45%, transparent);
}
.kst-num-lead .kst-v { font-size: 30px; color: var(--hseHub-mist-100); }
.kst-num .kst-k {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--hseHub-mist-500);
}
.kst-num .kst-v {
    font-size: 21px;
    font-weight: 800;
    color: var(--hseHub-mist-100);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.kst-num .kst-v small { font-size: 11px; font-weight: 700; color: var(--hseHub-cyan-muted); margin-left: 3px; }
.kst-num .kst-v.accent { color: var(--hseHub-cyan); }
.kst-num .kst-v.ok { color: var(--hseHub-dash-green); }
.kst-num .kst-v.warn { color: var(--hseHub-dash-amber); }
.kst-num .kst-v.danger { color: var(--hseHub-dash-red); }
.kst-num .kst-sub { font-size: 9px; font-weight: 600; color: var(--hseHub-mist-600); font-variant-numeric: tabular-nums; }
.kst-badge {
    align-self: flex-start;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.04em;
}
.kst-badge-ok   { background: rgba(37, 208, 125, 0.14); border: 1px solid rgba(37, 208, 125, 0.4); color: var(--hseHub-dash-green); }
.kst-badge-warn { background: rgba(255, 176, 32, 0.14); border: 1px solid rgba(255, 176, 32, 0.4); color: var(--hseHub-dash-amber); }
.kst-badge-crit { background: rgba(255, 77, 109, 0.14); border: 1px solid rgba(255, 77, 109, 0.4); color: var(--hseHub-dash-red); }
/* Heat-stress band severities (ok · warn · high · danger · stop) */
.kst-badge-high   { background: rgba(255, 176, 32, 0.18); border: 1px solid rgba(255, 176, 32, 0.5); color: var(--hseHub-dash-amber); }
.kst-badge-danger { background: rgba(255, 122, 89, 0.16); border: 1px solid rgba(255, 122, 89, 0.45); color: #ff7a59; }
.kst-badge-stop   { background: rgba(192, 34, 74, 0.22); border: 1px solid rgba(255, 77, 109, 0.6); color: var(--hseHub-dash-red); }

/* ============================================================================
   Heat stress · Kestrel units.

   Rendered as cards DOCKED over the 3D map, not as a flyout: the device menu is
   a narrow left dock (same geometry as the laser card) and the detail opens
   beside it, so the coverage areas painted on the plant stay visible while the
   supervisor switches units. Band colour reaches each control as --kst-band.
   ============================================================================ */
.tdev-kestrel-card {
    top: 50%;
    left: var(--tdev-dock-x);
    width: var(--tdev-dock-w);
    /* The unit list is the one dock card worth extra height: it carries a dozen rows
       and the point of it is seeing the whole deployment at once. It is a card floating
       over the map, so it is allowed the full height of the dashboard rather than
       stopping short of the bottom strip like the other docked cards. */
    max-height: calc(100% - var(--tdev-dock-top) - var(--tdev-edge) * 2);
}
/* Detail sits immediately right of the menu — wide enough for the charts and the
   12-channel grid, and scrolls inside itself so the map is never pushed away. */
.tdev-kestrel-detail {
    top: 50%;
    left: calc(var(--tdev-dock-x) + var(--tdev-dock-w) + 12px);
    /* Wide: the charts are the report, and they get the width — the figure column
       beside them is only ~200px. Bounded by the right edge rather than by a fixed
       width, so it takes the room the screen actually has and never runs off it. */
    width: auto;
    right: var(--tdev-dock-x);
    max-width: 1020px;
}
.tdev-kestrel-detail .kst-detail-body { padding-right: 10px; }
/* Reference table opens on the opposite side so it never covers the detail. */
.tdev-kestrel-info {
    top: 50%;
    left: auto;
    right: var(--tdev-dock-x);
    width: min(560px, calc(100% - var(--tdev-dock-x) * 2 - var(--tdev-dock-w) - 24px));
}

/* ---- Carta de estaciones meteorológicas ----
   Carta propia arriba a la derecha, con el dock de unidades donde siempre estuvo
   (izquierda, centrado): son dos inventarios distintos —unidades portátiles por área ·
   mástiles fijos de obra— y compartir lista los confundía. Las filas se reusan del dock
   —mismo componente visual— pero con icono en vez de punto de banda: un mástil no
   bandea contra la tabla de estrés térmico.

   OJO CON EL ORDEN: estas reglas tienen que ir DESPUÉS de .tdev-robot-card. Estaban
   antes, y como la especificidad es la misma, la carta se quedaba con el top:50% y el
   translate de la base — bajaba al centro por mucho que aquí pusiera arriba. */
/* La pila: es ella la que se posiciona (arriba a la derecha, por debajo del selector
   de capas, que es el dueño de esa esquina) y las cartas van dentro en flujo normal.
   Así la de gas se coloca sola debajo de la de estaciones, esté ésta plegada o no. */
.tdev-wx-dock {
    position: absolute;
    top: max(var(--tdev-dock-top), var(--tdev-admin-bottom), var(--tdev-layers-bottom));
    right: var(--tdev-dock-x);
    z-index: 22;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    /* Separacion entre las dos cartas: son dos listas distintas (el tiempo de la obra y
       la atmosfera), y pegadas se leian como una sola carta partida por una linea. */
    gap: 40px;
    width: var(--tdev-wx-w);
    max-height: var(--tdev-dock-h);
    /* Para que el tope de arriba sea efectivo sobre una carta que puede encoger. */
    min-height: 0;
    pointer-events: none;   /* el hueco entre cartas no puede comerse el mapa */
}
.tdev-wx-dock > .tdev-robot-card {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    transform: none;
    /* La animacion de entrada de .tdev-robot-card acaba en translate(0, -50%) y es
       `both`, asi que ese -50% se queda puesto para siempre y gana al transform de
       arriba: cada carta subia media altura y la de gas se montaba encima de la de
       estaciones. Dentro de la pila entran sin desplazarse, solo con el fundido. */
    animation: tdev-wx-card-in 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
    width: 100%;
    /* Ni se encoge ni se estira: cada carta mantiene su alto y el hueco entre las dos
       es siempre el gap de la pila, no lo que sobre. */
    flex: none;
    pointer-events: auto;
}
@keyframes tdev-wx-card-in {
    from { opacity: 0; transform: translateX(-16px); }
    to   { opacity: 1; transform: none; }
}
/* Plegada, la carta se encoge a su CABECERA (deja de reservar el alto de la lista),
   pero conserva el ancho de la pila: las dos plegadas tienen que medir lo mismo, y a
   ancho automatico cada una salia de un tamano segun lo que dijera su chapa. Ademas ese
   ancho automatico apretaba la cabecera y volvian los "...". */
.tdev-wx-dock > .tdev-robot-card.kst-min { width: 100%; min-width: 0; max-width: 100%; }
.tdev-kestrel-wx {
    border-color: rgba(126, 231, 135, 0.35);
    /* Solo la lista: una o dos filas y la cabecera. El alto lo pone el contenido. */
    max-height: 200px;
}
.tdev-kestrel-wx .tdev-robot-card-body { padding-top: 6px; padding-bottom: 6px; }
/* El icono de la cabecera va en el cian de las cartas (como Kestrel Devices): es
   identidad de la carta, no una lectura. El verde/ambar siguen donde sí dicen algo —
   el borde de la carta, las filas de la lista y los puntos del mapa. */
.tdev-kestrel-wx .tdev-robot-card-head > i { color: var(--hseHub-cyan-muted); }

/* ---- Carta de detectores de gas ----
   Debajo de la de estaciones, en la misma columna derecha: la tercera lista de la
   vista (unidad de área · mástil de obra · atmósfera). Arranca donde acaba la de
   estaciones, así que las dos caben sin pisarse ni cuando ambas están desplegadas. */
.tdev-kestrel-gas {
    border-color: rgba(255, 176, 32, 0.32);

    /* ⚠️ AQUI NO PUEDE HABER PORCENTAJES, y no es una preferencia de estilo.
       Esto decia `min(566px, max(220px, calc(var(--tdev-dock-h) - 240px)))`, y
       --tdev-dock-h es un `calc(100% - ...)`. Ese 100% se resuelve contra el contenedor
       de la carta, que es .tdev-wx-dock: `position:absolute` y de alto AUTOMATICO. Un
       max-height porcentual contra un contenedor de alto indefinido no se aplica — o
       sea que el tope no existia: la lista crecia sin limite, nunca aparecia el scroll y
       lo que sobraba lo recortaba el dock por abajo. Con 76 detectores reales de
       Blackline en vez de los 6 del generador, eso pasa de detalle a pantalla rota.

       El limite ahora lo pone el cuerpo en pixeles (justo debajo) y la pila se encarga
       de las pantallas cortas dejando encoger ESTA carta. */
    min-height: 0;
}

/* El limite de verdad: DIEZ filas y a partir de ahi scrollea el cuerpo.
   Se cuenta sobre la lista y no sobre la carta entera a proposito — asi el numero no
   depende de cuanto mida la cabecera, que cambia con la chapa y los botones. */
.tdev-kestrel-gas > .tdev-robot-card-body {
    --kst-gas-rows: 10;
    --kst-gas-row: 49px;             /* fila de detector, ver .kst-dev */
    --kst-gas-gap: 5px;              /* tope de gap en .kst-devlist */
    max-height: calc(
        var(--kst-gas-rows) * var(--kst-gas-row)
        + (var(--kst-gas-rows) - 1) * var(--kst-gas-gap)
        + 12px                        /* sus propios padding, arriba y abajo */
    );
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Y su barra SE VE, que es la excepcion a la regla de la linea 143.
   Alli se esconden todas las barras del dashboard porque la idea es que todo quepa de
   un vistazo. Esta lista es el caso en que eso no se cumple: con 76 detectores y la
   barra escondida, lo que se ve es una lista que se corta en el decimo y ni un indicio
   de que haya mas. Fina y translucida, para que siga sin parecer una tabla de datos. */
.tdev-kestrel-gas > .tdev-robot-card-body { scrollbar-width: thin; }
.tdev-kestrel-gas > .tdev-robot-card-body::-webkit-scrollbar {
    width: 6px;
    height: 6px;
    display: block;
}
.tdev-kestrel-gas > .tdev-robot-card-body::-webkit-scrollbar-track { background: transparent; }
.tdev-kestrel-gas > .tdev-robot-card-body::-webkit-scrollbar-thumb {
    background: rgba(255, 176, 32, 0.32);   /* el ambar del borde de la carta */
    border-radius: 3px;
}
.tdev-kestrel-gas > .tdev-robot-card-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 176, 32, 0.55);
}

/* Con nueve o menos, la carta mide lo que mide su lista: el tope es un maximo, no un
   alto fijo, y tres detectores no dejan medio panel en blanco. */
.tdev-kestrel-gas .tdev-robot-card-body { padding-top: 6px; padding-bottom: 6px; }

/* En pantallas cortas la que cede es ESTA, no la de estaciones: la de arriba tiene una
   o dos filas y no le sobra nada que dar, y la pila entera esta capada a --tdev-dock-h
   (ahi el porcentaje SI vale: .tdev-root tiene alto definido). Sin esto, `flex: none`
   heredado de la pila hacia que la carta se saliera por abajo en vez de encogerse. */
.tdev-wx-dock > .tdev-kestrel-gas {
    flex: 0 1 auto;
    min-height: 0;
}
.tdev-kestrel-gas .tdev-robot-card-head > i { color: var(--hseHub-cyan-muted); }
/* Chapa de la cabecera: verde mientras todo esté en límites y roja en cuanto haya una
   alarma. En ámbar (el color por defecto de .kst-min-tag) las dos situaciones se veían
   igual, que es justo lo que no puede pasar en una lista de alarmas. */
.kst-min-tag.kst-tag-ok {
    background: rgba(37, 208, 125, 0.14);
    border-color: rgba(37, 208, 125, 0.45);
    color: var(--hseHub-dash-green, #25d07d);
}
.kst-min-tag.kst-tag-alarm {
    background: rgba(255, 77, 109, 0.16);
    border-color: rgba(255, 77, 109, 0.5);
    color: var(--hseHub-dash-red);
}
/* El icono del mástil dentro de su fila toma el color de la lectura, no el verde fijo
   del equipo: la fila entera tiene que decir lo mismo. */
.kst-dev.kst-wx .kst-wx-ico { color: var(--kst-band); }

/* Punto del detector sobre el mapa: coloreado por severidad — con seis repartidos por
   la obra, lo primero que se pregunta es cuál está en alarma. */
.tdev-gas-marker { background: none; border: 0; }
.tdev-gas-marker > span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    box-sizing: border-box;
    border-radius: 50%;
    border: 2px solid var(--tdev-gas-color, #25d07d);
    background: rgba(6, 20, 16, 0.88);
    color: var(--tdev-gas-color, #25d07d);
    box-shadow: 0 0 0 4px rgba(6, 18, 28, 0.4), 0 6px 16px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    transition: transform 0.12s ease;
}
.tdev-gas-marker > span i { font-size: 15px; line-height: 1; }
/* El operario de la capa de HSE usa la misma pastilla, pero su dibujo es un SVG y no
   un icono de fuente: se le da el tamaño aquí, que es lo único que cambia. */
.tdev-worker-marker > span svg { width: 17px; height: 17px; display: block; }
.tdev-gas-marker:hover > span { transform: scale(1.1); }
/* El detector en alarma late: es una lectura sobre la que se actúa ya. */
.tdev-gas-marker.tdev-gas-crit > span,
.tdev-wx-marker.tdev-gas-crit > span { animation: tdev-gas-pulse 1.4s ease-in-out infinite; }
@keyframes tdev-gas-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(255, 77, 109, 0.18), 0 6px 16px rgba(0, 0, 0, 0.45); }
    50% { box-shadow: 0 0 0 9px rgba(255, 77, 109, 0.05), 0 6px 16px rgba(0, 0, 0, 0.45); }
}

/* Titular de la ficha del detector: lo que hay que hacer, antes que las cifras. */
.tdev-gas-status {
    margin: 4px 0 6px;
    padding: 4px 7px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 10px;
}
.tdev-gas-status.tdev-gas-ok { background: rgba(37, 208, 125, 0.14); color: #7ee787; }
.tdev-gas-status.tdev-gas-warn { background: rgba(255, 176, 32, 0.16); color: var(--hseHub-dash-amber); }
.tdev-gas-status.tdev-gas-crit { background: rgba(255, 77, 109, 0.18); color: var(--hseHub-dash-red); }
/* Con la columna de estaciones puesta, el informe de la unidad y la tabla dejan de
   llegar hasta el borde derecho: se paran antes de ella en vez de pasarle por debajo. */
.tdev-kestrel-detail.kst-has-wx,
.tdev-kestrel-info.kst-has-wx {
    right: calc(var(--tdev-dock-x) + var(--tdev-wx-w) + 12px);
}

/* Header controls group at the right end. Both the close button and the info button
   carry `margin-left: auto`, so with three of them in one header the free space was
   split BETWEEN them and they ended up strung across the bar. Only the first of the
   group pushes; the rest sit tight against it. */
.tdev-robot-card-head > button ~ button { margin-left: 6px; }

/* Minimise reads as the close button's twin — same shape and size, sitting right
   beside it — but it is not destructive, so it lights cyan instead of red. */
.kst-min-btn:hover {
    background: rgba(0, 229, 255, 0.18);
    color: var(--hseHub-cyan);
    transform: none;
}

/* ---- Drag handle ----
   The card headers move their card (kestrelDock.js). The controls inside the header
   are not part of the handle — the script ignores anything inside a <button>. */
.tdev-draghandle { cursor: grab; touch-action: none; user-select: none; }
.tdev-draghandle.dragging { cursor: grabbing; }
.tdev-draghandle button { cursor: pointer; }

/* The Kestrel menu is the narrowest card in the dock and its header carries three
   controls, which squeezed "Kestrel Devices" into "Kestrel Devic…". The title is not
   abbreviated: the controls give up a couple of pixels each, and if it still does not
   fit on one line it wraps rather than being cut. */
.tdev-kestrel-card .tdev-robot-card-head {
    flex-wrap: wrap;
    row-gap: 2px;
    padding-left: 11px;
    padding-right: 11px;
    gap: 7px;
}
.tdev-kestrel-card .tdev-robot-card-head .rname {
    flex: 1 1 auto;
    font-size: 12px;
    letter-spacing: 0.02em;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.15;
}
.tdev-kestrel-card .tdev-robot-card-head > i { font-size: 15px; }
.tdev-kestrel-card .tdev-robot-card-close { width: 22px; height: 22px; }
.tdev-kestrel-card .tdev-robot-card-close i { font-size: 13px; }
.tdev-kestrel-card .kst-info-btn { width: 18px; height: 18px; }
.tdev-kestrel-card .kst-info-btn i { font-size: 11px; }

/* Las cartas de estaciones y detectores llevan cuatro controles en la cabecera (chapa,
   ojo, minimizar, cerrar) y "Weather Stations" salia como "Weather Stat…". La columna es
   mas ancha (--tdev-wx-w) para que todo entre en UNA linea: el titulo no se abrevia ni
   envuelve, y la X queda al lado del boton de minimizar. Lo que cede espacio es la
   chapa, no el nombre. */
.tdev-kestrel-wx .tdev-robot-card-head,
.tdev-kestrel-gas .tdev-robot-card-head {
    flex-wrap: nowrap;
    padding-left: 11px;
    padding-right: 9px;
    gap: 6px;
}
.tdev-kestrel-wx .tdev-robot-card-head .rname,
.tdev-kestrel-gas .tdev-robot-card-head .rname {
    /* `1 0 auto`, no `0 0 auto`: CRECE para comerse el hueco libre —y con eso empuja la
       chapa, el ojo, el minimizar y la X contra el borde derecho— pero NO ENCOGE, que es
       lo que protegia el `0` original y por lo que el titulo no se abrevia.
       Antes ningun control llevaba `margin-left: auto` (el primero del grupo es el ojo, y
       no lo tiene), asi que los tres colgaban pegados al titulo, a media cabecera. Al
       quitar la chapa "N ok" de estaciones quedaron aun mas a la izquierda. */
    flex: 1 0 auto;
    min-width: 0;
    font-size: 12px;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}
/* Y el grupo va junto en el extremo: sin esto, el hueco que reparte el `gap` deja la
   chapa despegada de los botones. */
.tdev-kestrel-wx .tdev-robot-card-head > .kst-min-tag,
.tdev-kestrel-gas .tdev-robot-card-head > .kst-min-tag { margin-left: auto; }
/* La chapa tampoco se abrevia: "2 ok" salia como "2..." por el text-overflow, y una
   chapa de dos caracteres no ahorra nada. Se queda entera. */
.tdev-kestrel-wx .tdev-robot-card-head .kst-min-tag,
.tdev-kestrel-gas .tdev-robot-card-head .kst-min-tag {
    flex: none;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}
/* Los controles nunca se encogen: si algo falta de sitio, no puede ser la X. */
.tdev-kestrel-wx .tdev-robot-card-head > button,
.tdev-kestrel-gas .tdev-robot-card-head > button { flex: none; }
.tdev-kestrel-wx .tdev-robot-card-head > button ~ button,
.tdev-kestrel-gas .tdev-robot-card-head > button ~ button { margin-left: 4px; }
.tdev-kestrel-wx .tdev-robot-card-head > i,
.tdev-kestrel-gas .tdev-robot-card-head > i { font-size: 15px; }
.tdev-kestrel-wx .tdev-robot-card-close,
.tdev-kestrel-gas .tdev-robot-card-close { width: 22px; height: 22px; }
.tdev-kestrel-wx .tdev-robot-card-close i,
.tdev-kestrel-gas .tdev-robot-card-close i { font-size: 13px; }

/* ---- Full screen ----
   The report takes the whole dashboard. !important is doing real work here: a card
   that has been dragged carries its position as inline style (kestrelDock.js), and
   full screen has to win over it — and give it back on the way out. */
.tdev-robot-card.kst-full {
    inset: var(--tdev-edge) !important;
    left: var(--tdev-edge) !important;
    top: var(--tdev-edge) !important;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
    transform: none !important;
    animation: none !important;
    z-index: 30;
}

/* ---- Minimised cards ----
   A minimised card is its header and nothing else: it keeps its place on the dock
   (so the map does not jump when it comes back) and stops claiming height. */
.tdev-robot-card.kst-min { width: auto; right: auto; min-width: 232px; max-width: calc(100% - var(--tdev-dock-x) * 2); }
/* ...pero "su sitio" es el que tenía, y estas dos no se anclan por la izquierda:
   · la carta de estaciones vive pegada a la DERECHA, y el `right: auto` de arriba la
     soltaba de esa esquina y la mandaba al otro lado al plegarla;
   · el dock de unidades sigue centrado (top 50 % + translate), que es donde estaba:
     anclarlo arriba lo subía demasiado. Al plegarlo se conserva su CENTRO, así que la
     cabecera se desplaza — es el precio de dejar la lista donde está. */
.tdev-robot-card.kst-min .tdev-robot-card-head { border-bottom: none; }
.kst-detail-body.kst-hide { display: none; }
.kst-min-tag {
    padding: 2px 7px;
    border-radius: 5px;
    background: rgba(255, 176, 32, 0.16);
    border: 1px solid rgba(255, 176, 32, 0.45);
    color: var(--hseHub-dash-amber);
    font-size: 9px;
    font-weight: 800;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ---- Band roll-up above the unit list ---- */
.kst-devsum {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 8px;
}
.kst-sumchip {
    --kst-band: var(--hseHub-cyan);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--kst-band) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--kst-band) 40%, transparent);
    color: var(--hseHub-mist-100);
    font-size: 10px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* "SUSPENDED": the stop-work band's work/rest cell. Red, because it is the one word
   in the panel that means down tools. */
.kst-stop-word {
    color: var(--hseHub-dash-red);
    font-weight: 800;
    letter-spacing: 0.06em;
}

.kst-head-tag {
    padding: 3px 9px;
    border-radius: 6px;
    border: 1px solid;
    /* White plate: the band colour is the text, so even the black stop-work band
       reads against the card's dark header. */
    background: #ffffff;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ---- Device menu rows ---- */
/* One row per unit; the grid can carry a dozen, so the list scrolls inside the card
   instead of growing past the viewport. */
/* The whole deployment at a glance — a dozen units, no scrolling.
   The row gives way instead: on a shorter screen it loses its second line (the device
   tag and the work/rest split move into the row's tooltip) and then its height, and
   below that the list splits into two columns. The zone and its temperature, which is
   what the list is read for, are never dropped. */
.kst-devlist {
    display: grid;
    grid-template-columns: 1fr;
    align-content: start;
    gap: clamp(3px, 0.45vh, 5px);
    padding-right: 4px;
}
@media (max-height: 960px) {
    .kst-dev { padding: 5px 8px; }
    /* The device tag goes before the name does — it is in the row's tooltip. */
    .kst-dev-zone { display: none; }
    .kst-dev-temp { font-size: 15px; }
}
@media (max-height: 800px) {
    .kst-dev { padding: 3px 7px; gap: 6px; }
    .kst-dev-name { font-size: 11px; }
    .kst-dev-temp { font-size: 13px; }
    .kst-devsum { margin-bottom: 5px; }
}
/* Last resort before scrolling: two units to a line. */
@media (max-height: 660px) {
    .kst-devlist { grid-template-columns: 1fr 1fr; }
    .kst-dev-name { font-size: 10px; letter-spacing: 0; }
    .kst-dev-temp { font-size: 12px; }
    .kst-dev-temp small { display: none; }
}
.kst-dev {
    --kst-band: var(--hseHub-cyan);
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    /* Scales with the viewport: on a shorter screen the rows tighten so more of the
       deployment fits without the list having to scroll. */
    padding: clamp(4px, 0.75vh, 8px) 9px;
    border-radius: 9px;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid color-mix(in srgb, var(--kst-band) 38%, transparent);
    border-left: 3px solid var(--kst-band);
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.kst-dev:hover { background: color-mix(in srgb, var(--kst-band) 14%, transparent); transform: translateX(1px); }
.kst-dev.selected {
    background: color-mix(in srgb, var(--kst-band) 20%, transparent);
    box-shadow: 0 0 0 1px var(--kst-band) inset, 0 0 12px color-mix(in srgb, var(--kst-band) 32%, transparent);
}
.kst-dev-dot {
    width: 9px; height: 9px; border-radius: 50%; flex: none;
    background: var(--kst-band);
    box-shadow: 0 0 8px var(--kst-band);
}
/* The stop-work band is black — on this dark UI it needs a light outline to be
   visible at all, and its figures read in white rather than in the band colour. */
.kst-dev-stop { border-color: rgba(255, 255, 255, 0.45); border-left-color: rgba(255, 255, 255, 0.75); }
.kst-dev-stop .kst-dev-dot { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8); }
.kst-dev-stop .kst-dev-temp { color: var(--hseHub-mist-100); }
.kst-dev-stop:hover, .kst-dev-stop.selected { background: rgba(255, 255, 255, 0.1); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset; }
.kst-dev-id { display: flex; flex-direction: column; gap: 1px; flex: 1 1 auto; min-width: 0; }
/* The area is what the supervisor is looking for on the map, so it leads the row;
   the device tag and its work/rest split ride underneath as the second line.
   The name is never abbreviated: "Process Core · North" clipped to "Process Cor…" is
   not a name you can pick a unit by, so it wraps onto a second line instead. */
.kst-dev-name {
    font-size: 12px; font-weight: 800; letter-spacing: 0.02em;
    color: var(--hseHub-mist-100);
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.15;
}
.kst-dev-zone {
    font-size: 10px; font-weight: 600; color: var(--hseHub-mist-500);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kst-dev-right { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; flex: none; }
.kst-dev-temp {
    font-size: 18px; font-weight: 800; line-height: 1.05;
    color: var(--kst-band);
    font-variant-numeric: tabular-nums;
}
.kst-dev-temp small { font-size: 9px; font-weight: 700; margin-left: 1px; opacity: 0.75; }

/* Footer line: what the map is currently showing, and the way back to all areas. */
.kst-devfoot {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin-top: 10px; padding-top: 9px;
    border-top: 1px solid rgba(0, 229, 255, 0.12);
    font-size: 9.5px; font-weight: 600; color: var(--hseHub-mist-500);
}
.kst-devfoot span { display: inline-flex; align-items: center; gap: 5px; }
.kst-devfoot i { font-size: 12px; color: var(--hseHub-cyan); }
.kst-clear {
    flex: none;
    padding: 3px 8px;
    border-radius: 6px;
    cursor: pointer;
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.3);
    color: var(--hseHub-cyan-soft);
    font-size: 9px; font-weight: 800; letter-spacing: 0.04em;
}
.kst-clear:hover { background: rgba(0, 229, 255, 0.2); }

/* (i) toggle in the menu header — opens the heat-stress reference table. */
.kst-info-btn {
    margin-left: auto;
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; padding: 0;
    border-radius: 50%;
    cursor: pointer;
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.32);
    color: var(--hseHub-cyan-soft);
    transition: background 0.15s ease, color 0.15s ease;
}
.kst-info-btn i { font-size: 13px; }
.kst-info-btn:hover { background: rgba(0, 229, 255, 0.18); }
.kst-info-btn.on { background: var(--hseHub-cyan); color: #06121e; border-color: var(--hseHub-cyan); }

.kst-pickhint {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 12px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.14);
    color: var(--hseHub-mist-400);
    font-size: 10.5px; font-weight: 600;
}
.kst-pickhint i { font-size: 15px; color: var(--hseHub-cyan); }

/* ---- The heat-stress table as it is printed in the HSE procedure ---- */
.kst-bandtable {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 18px;
}
.kst-bandrow {
    display: grid;
    grid-template-columns: 104px 96px 124px minmax(150px, 1fr);
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.07);
    font-size: 10px;
    color: var(--hseHub-mist-400);
}
.kst-bandrow.active { background: rgba(0, 229, 255, 0.07); border-color: rgba(0, 229, 255, 0.35); }
.kst-band-range {
    /* Stretched and centred so every range chip has the same box and the figures
       line up down the column instead of ragging left. */
    justify-self: stretch;
    text-align: center;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid;
    font-size: 10px;
    font-weight: 800;
    color: var(--hseHub-mist-100);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.kst-band-split {
    display: flex;
    flex-direction: column;
    gap: 1px;
    font-size: 10px;
    font-weight: 600;
    color: var(--hseHub-mist-400);
    font-variant-numeric: tabular-nums;
}
.kst-band-split .wr strong { font-size: 12px; font-weight: 800; color: var(--hseHub-mist-100); }
.kst-band-split .wr.stop { font-size: 11px; font-weight: 800; letter-spacing: 0.05em; color: var(--hseHub-dash-red); }

/* Column headings for the reference table. */
.kst-bandhead {
    background: none;
    border: none;
    padding-bottom: 2px;
    font-size: 8.5px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--hseHub-mist-600);
}
.kst-bandhead span:first-child { text-align: center; }
.kst-band-water { font-weight: 700; color: var(--hseHub-mist-300); }
.kst-band-controls { line-height: 1.45; }
.kst-band-zones { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.kst-band-chip {
    padding: 2px 7px;
    border-radius: 5px;
    background: rgba(0, 229, 255, 0.12);
    border: 1px solid rgba(0, 229, 255, 0.3);
    color: var(--hseHub-cyan-soft);
    font-size: 9px;
    font-weight: 700;
}

/* The "SUSPENDED" split above 54 °C is the one figure that must read as a stop. */
.kst-band-stop .kst-band-range { background: #141418; color: var(--hseHub-mist-100); border-color: rgba(255, 255, 255, 0.5) !important; }

@media (max-width: 1100px) {
    .kst-bandrow { grid-template-columns: 100px 92px 1fr; }
    .kst-band-controls { grid-column: 1 / -1; }
}

/* ---- Time-series chart ---- */
.kst-chart { margin-bottom: 18px; }
.kst-chart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-bottom: 7px;
}
.kst-chart-title {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--hseHub-mist-100);
}
.kst-swatch { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.kst-chart-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.kst-leg {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 9px;
    font-weight: 700;
    color: var(--hseHub-mist-400);
    font-variant-numeric: tabular-nums;
}
.kst-leg small { color: var(--hseHub-mist-600); font-weight: 600; }
.kst-leg-mark { width: 9px; height: 3px; border-radius: 2px; flex: none; }
.kst-leg-alarm { color: var(--hseHub-dash-red); }
.kst-leg-dash {
    width: 11px;
    height: 0;
    flex: none;
    border-top: 2px dashed var(--hseHub-dash-red);
}

.kst-chart-plot { position: relative; }
.kst-chart-plot svg {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 9px;
    background: rgba(0, 229, 255, 0.03);
}
.kst-chart-empty {
    padding: 24px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--hseHub-mist-600);
    border-radius: 9px;
    background: rgba(0, 229, 255, 0.03);
}
.kst-grid { stroke: rgba(0, 229, 255, 0.10); stroke-width: 1; }
/* Axis captions (unit up the y-axis, "Session time" under the x-axis). */
.kst-axis-name {
    font-size: 8.5px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    fill: var(--hseHub-cyan-muted);
    opacity: 0.75;
}
.kst-ylab, .kst-xlab {
    font-size: 8px;
    font-weight: 700;
    fill: var(--hseHub-mist-600);
    font-variant-numeric: tabular-nums;
}
.kst-alarm { stroke: var(--hseHub-dash-red); stroke-width: 1.2; stroke-dasharray: 5 4; opacity: 0.75; }
.kst-alarm-lab { font-size: 8px; font-weight: 800; fill: var(--hseHub-dash-red); font-variant-numeric: tabular-nums; }
.kst-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.kst-area { stroke: none; }
.kst-dot { transition: r 0.1s ease; }
/* A surface-colored ring keeps overlapping series markers readable. */
.kst-dot.on { stroke: #0d2035; stroke-width: 1.5; }
/* The crosshair is moved by a transform (kestrelChart.js) precisely so it can be
   transitioned: crossing a chart glides between samples instead of snapping. */
.kst-crosshair {
    stroke: var(--hseHub-mist-100);
    stroke-width: 1;
    opacity: 0.5;
    transition: transform 0.13s cubic-bezier(0.22, 0.8, 0.28, 1);
}
/* Pinned by a click: brighter, and it stays when the pointer leaves. */
.kst-crosshair.pinned { stroke: var(--hseHub-cyan); opacity: 0.95; stroke-width: 1.4; }
.kst-dot.pinned { stroke: var(--hseHub-mist-100); stroke-width: 2; }
.kst-hit { fill: transparent; cursor: crosshair; }

.kst-tip {
    position: absolute;
    top: 2px;
    transform: translateX(-50%);
    /* Follows the crosshair at the same pace. */
    transition: left 0.13s cubic-bezier(0.22, 0.8, 0.28, 1);
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 6px 9px;
    border-radius: 7px;
    background: rgba(7, 19, 31, 0.95);
    border: 1px solid rgba(0, 229, 255, 0.3);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    white-space: nowrap;
    z-index: 3;
}
.kst-tip.pinned { border-color: var(--hseHub-cyan); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 229, 255, 0.35); }
.kst-tip-pin { font-size: 10px; margin-right: 4px; vertical-align: -1px; }
.kst-tip .t { font-size: 9px; font-weight: 700; letter-spacing: 0.05em; color: var(--hseHub-cyan-muted); font-variant-numeric: tabular-nums; }
.kst-tip .r { display: flex; align-items: center; gap: 6px; }
.kst-tip .r .n { font-size: 12px; font-weight: 800; color: var(--hseHub-mist-100); font-variant-numeric: tabular-nums; }
.kst-tip .r small { font-size: 9px; font-weight: 600; color: var(--hseHub-mist-600); }

/* ---- All measurements grid ---- */
/* Three channels left, stacked one above the other: each gets the full width of the
   column, so the traces are read at the same scale as the chart above them instead of
   squeezed into a third of it. */
.kst-spark-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(8px, 1%, 12px);
}
.kst-spark {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: clamp(9px, 1.1%, 13px) clamp(10px, 1.2%, 14px);
    border-radius: 10px;
    background: rgba(0, 229, 255, 0.04);
    border: 1px solid rgba(0, 229, 255, 0.13);
}
.kst-spark-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kst-spark-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--hseHub-mist-400);
}
.kst-spark-alarm {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex: none;
    font-size: 9px;
    font-weight: 800;
    color: var(--hseHub-mist-600);
    font-variant-numeric: tabular-nums;
}
.kst-spark-alarm.on { color: var(--hseHub-dash-red); }
.kst-spark-alarm i { font-size: 11px; }
.kst-spark-svg { width: 100%; height: auto; min-height: 52px; display: block; }
.kst-spark-line { fill: none; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.kst-spark-empty {
    padding: 12px 0;
    text-align: center;
    font-size: 9px;
    font-weight: 600;
    color: var(--hseHub-mist-600);
}
.kst-spark-foot {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    font-variant-numeric: tabular-nums;
}
.kst-spark-foot .lo, .kst-spark-foot .hi { font-size: 9px; font-weight: 700; color: var(--hseHub-mist-600); }
.kst-spark-foot .cur { font-size: 12px; font-weight: 800; }
.kst-spark-foot .cur small { font-size: 9px; font-weight: 600; color: var(--hseHub-mist-600); margin-left: 2px; }

/* The spark grid needs no breakpoints — auto-fit already reflows it. */
@media (max-width: 700px) {
    .kst-chart-legend { display: none; }
}

/* ============================================================================
   Responsive dock — everything on screen, at any screen size.

   The dashboard is one view with no page scroll: the 3D map fills it and the
   widgets float around the edges. That only works if the dock gives way as the
   viewport shrinks, so the sizes above are written against the tokens on
   .tdev-root and this section re-tunes those tokens (and the type that rides on
   them) per breakpoint. The order matters — these rules come last so they win.

   Widths shrink the columns and the bottom strip; heights buy room back from the
   chrome (header, env strip, card padding, type) before any widget has to clip.
   ============================================================================ */

/* ---- Short viewports ---- */
@media (max-height: 880px) {
    .tdev-root { --tdev-dock-top: 56px; }
    .tdev-widget-title { font-size: 9.5px; margin-bottom: 4px; }
    .tdev-metric { padding: 2px 0; }
    .tdev-metric .value { font-size: 13px; }
    .tdev-bars { height: 34px; }
}
@media (max-height: 720px) {
    .tdev-root { --tdev-dock-top: 48px; }
    .tdev-header { padding: 8px 16px; }
    .tdev-header .tdev-title { font-size: 13px; letter-spacing: 2px; }
    .tdev-header .tdev-sub { font-size: 10px; }
    .tdev-envbar { top: 32px; padding: 4px 7px; }
    .tdev-env-item { padding: 1px 9px; }
    .tdev-env-item i { font-size: 15px; }
    .tdev-env-item .v { font-size: 12px; }
    .tdev-metric .label { font-size: 9.5px; }
    .tdev-metric .value { font-size: 12px; }
    .tdev-log-line, .tdev-listrow { font-size: 9.5px; }
    .tdev-bars { height: 26px; }
    /* Sized, not transformed: a scale() would leave the card reserving the old
       height and the stats would drift out of it. */
    .train-stats .ts { padding: 4px 3px; }
    .train-stats .v { font-size: 13px; }
    .train-stats .k { font-size: 8px; letter-spacing: 0.5px; }
}

/* ---- The column cards get the same two readings as the strip cards ----
   Stage 1 tightens; stage 2 reads the metrics two up. The eye and any other control
   shrink with the card but never disappear — a hidden button is a lost feature. */
@container tdevcol (max-height: 560px) {
    .tdev-col > .tdev-widget > .tdev-widget-title { font-size: 9px; letter-spacing: 1px; margin-bottom: 3px; }
    .tdev-col .tdev-eye { width: 18px; height: 18px; margin-left: 4px; border-radius: 5px; }
    .tdev-col .tdev-eye i { font-size: 12px; }
    .tdev-col .tdev-metric { padding: 2px 0; }
    .tdev-col .tdev-metric .value { font-size: 12.5px; }
}
/* Stage 2 — the rows no longer fit as rows, so they stop being rows: each metric
   becomes a chip with the figure over its label, two to a line. Read left-to-right
   as label…value they came out ragged (the labels are long and uneven, "ScaffTag
   scaffolds" against "All safe / 12"); stacked and centred in a chip they line up
   into a block, which is the same shape the Training stats already use. */
@container tdevcol (max-height: 440px) {
    .tdev-col > .tdev-widget {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-content: start;
        gap: 5px;
    }
    .tdev-col > .tdev-widget > .tdev-widget-title,
    .tdev-col .train-gauge, .tdev-col .train-stats, .tdev-col .tdev-log {
        grid-column: 1 / -1;
    }
    .tdev-col .tdev-metric {
        /* label then value in the markup — reversed so the figure reads first. */
        flex-direction: column-reverse;
        align-items: center;
        justify-content: center;
        gap: 1px;
        min-width: 0;
        padding: 5px 6px;
        border-bottom: none;
        border: 1px solid rgba(0, 229, 255, 0.16);
        border-radius: 8px;
        background: rgba(0, 229, 255, 0.06);
        text-align: center;
    }
    .tdev-col .tdev-metric .label {
        font-size: 8.5px;
        letter-spacing: 0.4px;
        text-transform: uppercase;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .tdev-col .tdev-metric .value { font-size: 13px; line-height: 1.1; }
    .tdev-col .tdev-metric .value small { font-size: 9px; }
    /* An odd metric out (Workers, Permit Tracker: three of them) takes the full width
       rather than leaving a hole beside it. The title is the card's first child, so an
       odd NUMBER of metrics means the last one sits at an even child index. */
    .tdev-col .tdev-metric:last-child:nth-child(even) { grid-column: 1 / -1; }
}

/* ---- The env strip sits between the two columns, so it is bounded by them
        rather than by the viewport, and wraps instead of pushing past them. ---- */
.tdev-envbar {
    max-width: max(260px, calc(100% - (var(--tdev-col-w) + var(--tdev-edge)) * 2 - 28px));
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 2px;
}

/* ---- Narrow viewports: the columns are what has to give, or the map is gone. ---- */
@media (max-width: 1400px) {
    .tdev-root { --tdev-col-w: clamp(188px, 19vw, 300px); }
}
@media (max-width: 1120px) {
    .tdev-root {
        --tdev-col-w: clamp(172px, 21vw, 300px);
        --tdev-dock-w: clamp(206px, 26vw, 292px);
        --tdev-wx-w: clamp(252px, 30vw, 348px);
    }
    /* The bottom strip runs out of width before anything else: let its cards wrap
       onto a second line and grow the strip to match, rather than squeezing six
       cards into unreadable slivers. */
    .tdev-bottom { flex-wrap: wrap; height: auto; max-height: 46vh; }
    .tdev-bottom > .tdev-widget,
    .tdev-bottom > .tdev-bottom-stack { flex: 1 1 clamp(180px, 30%, 260px); }
    .tdev-bottom > .tdev-widget:first-child,
    .tdev-bottom > .tdev-widget:last-child { flex: 1 1 clamp(180px, 30%, 260px); }
    /* The strip is two rows tall here, so the columns clear its wrapped height —
       still one gap above it, like everywhere else. */
    .tdev-col { bottom: calc(46vh + var(--tdev-edge) + var(--tdev-gap)); }

    /* The wide marker cards are pinned right of centre, which runs them off the
       edge once the viewport is this narrow — centre them instead. The entry
       animation ends on a transform of its own, so it has to go with them. */
    .tdev-camera-card,
    .tdev-robot-card:has(.tdev-robot-body) {
        left: 50%;
        transform: translate(-50%, -50%);
        animation: none;
    }
}

/* ---- Below this the side docks and the map cannot share the width: the docked
        cards take the screen and the columns step aside. ---- */
@media (max-width: 860px) {
    .tdev-root {
        --tdev-dock-w: min(292px, calc(100% - var(--tdev-dock-x) * 2));
        --tdev-wx-w: min(348px, calc(100% - var(--tdev-dock-x) * 2));
    }
    .tdev-scanlog-card,
    .tdev-kestrel-detail,
    .tdev-kestrel-info {
        left: var(--tdev-dock-x);
        right: var(--tdev-dock-x);
        width: auto;
        max-width: none;
    }
    /* Stacked, not side by side — the detail card would otherwise sit on top of
       the menu it was opened from. The entry animation lands on its own
       transform, so it is dropped here too. */
    .tdev-kestrel-detail, .tdev-kestrel-info, .tdev-scanlog-card {
        top: auto;
        bottom: var(--tdev-edge);
        transform: none;
        animation: none;
        max-height: 56%;
    }
    .tdev-kestrel-card, .tdev-laser-card { top: var(--tdev-dock-top); transform: none; animation: none; max-height: 38%; }
}

/* ── El desplegable de un Nodo de Core: tres columnas ───────────────────────────
   Columna 1 el primer reparto en donut, columna 2 la presencia y el estado del
   Nodo, columna 3 los repartos que queden. Cuántas hay lo decide cuántos repartos
   publica el Nodo, así que las reglas de aquí valen igual para una que para tres. */

/* El total del donut es la población PERFILADA y el anillo de al lado es presencia
   de las últimas 3 h. Son dos cosas distintas y se dicen en la propia tarjeta:
   explicarlo cada vez que alguien abre el panel sale más caro. */
.tdev-wcard-note {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 229, 255, 0.1);
    font-size: 10.5px;
    line-height: 1.45;
    color: var(--hseHub-mist-500);
}

/* El rótulo del centro, DENTRO de las tarjetas del desplegable (el donut de repartos de
   la primera columna y el anillo de presencia de la segunda). Ahí la cifra puede tener
   cuatro dígitos y la etiqueta dos palabras —"of 1.312 today"—, así que se baja un punto
   respecto al donut suelto: el inset ya deja el hueco, y esto evita que el texto vuelva a
   comerse ese aire en cuanto el número crece. */
.tdev-wcard .tdev-donut-center .dv { font-size: 22px; }
.tdev-wcard .tdev-donut-center .dk { font-size: 8px; letter-spacing: 0.8px; line-height: 1.2; }

/* La etiqueta de salud, pegada a la derecha del nombre del Nodo. */
.tdev-wcard .tdev-flyout-sub .core-health {
    margin-left: auto;
    flex: none;
}

/* El anillo de presencia manda en su columna, así que va mayor que los donuts de
   reparto. */
/* Un bloque de filas que empieza tema nuevo dentro de la misma tarjeta (los totales
   bajo la leyenda de turnos, el Nodo que firma las cifras al pie). */
.tdev-flyout-row.mt {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 229, 255, 0.1);
}

/* El punto de salud del Nodo, dentro del título de la tarjeta y EN EL SITIO del punto
   decorativo que había (borde derecho, justo antes del ojo): `margin-left: auto` es el
   mismo empujón que llevaba aquel. Sustituirlo en vez de acompañarlo evita dos puntos
   en la misma barra, que se leen como dos estados cuando solo hay uno. */
/* Y con el ASPECTO del punto de las demás tarjetas (Virtual Gatekeepers y compañía):
   un círculo cian de 7 px con su halo, no el glifo verde de /core/nodes. Es el mismo
   punto en la misma barra de título, y que el de Workers se viera distinto solo porque
   detrás hay un Nodo lo convertía en otra cosa a los ojos de quien lo mira.

   Sigue diciendo la salud, que es para lo que está: cian mientras el Nodo va bien, y el
   color de la avería —ámbar, rojo, gris— cuando NO va. El glifo "●" se esconde con
   font-size:0 y el círculo lo pinta el propio recuadro. */
.tdev-node-dot {
    flex: none;
    margin-left: auto;
    font-size: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--hseHub-cyan);
    box-shadow: 0 0 8px var(--hseHub-cyan);
}

/* Lo que NO es "online" conserva su color de severidad: el punto es lo único que avisa
   de un Nodo caído sin abrir el desplegable. */
.tdev-node-dot.core-dot-stale,
.tdev-node-dot.core-dot-error,
.tdev-node-dot.core-dot-down,
.tdev-node-dot.core-dot-off {
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}

/* El ojo de la fila de Supervisors: pinta solo a los de HSE. Va pegado al número, no
   al final de la fila, para que se lea como "enséñame ESTE dato" y no como un control
   de la tarjeta entera. Sin nadie reportando se queda, pero apagado: quitarlo movería
   las filas de sitio cada vez que ninguno de ellos está en obra. */
/* La cifra sigue pegada a la derecha aunque la fila tenga tres hijos: con
   space-between, el ojo la empujaría al centro y esa fila dejaría de alinearse con las
   otras dos de la tarjeta. */
.tdev-metric .value { margin-left: auto; }
.tdev-metric .tdev-eye { flex: none; margin-left: 8px; }

.tdev-metric .tdev-eye:disabled {
    opacity: 0.35;
    cursor: default;
}

.tdev-metric .tdev-eye:disabled:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.14);
    color: var(--hseHub-mist-500);
}

.tdev-core-presence .tdev-donut { width: 134px; height: 134px; }
.tdev-core-presence .tdev-donut-center .dv { font-size: 25px; }
.tdev-core-presence .tdev-donut-center .dv.accent { color: var(--hseHub-cyan); }

/* ── La ventana de tiempo del panel ────────────────────────────────────────────
   Va arriba del todo, antes que ninguna cifra: es el "de cuándo son estos números",
   y leído después de ellos llega tarde. El chip Live y los dos botones ocupan el
   mismo hueco a propósito — la barra no debe cambiar de alto al escribir una fecha. */
.tdev-core-range {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.12);
}

.tdev-range-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--hseHub-mist-500);
}

.tdev-range-label i { font-size: 13px; }

.tdev-range-to { font-size: 10.5px; color: var(--hseHub-mist-500); }

/* color-scheme: dark hace que el navegador pinte SU icono de calendario en claro.
   Sin ella el botón del selector sale negro sobre fondo negro y no se ve. */
.tdev-range-input {
    color-scheme: dark;
    font-family: inherit;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    color: var(--hseHub-mist-100);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 229, 255, 0.22);
    border-radius: 7px;
    padding: 5px 8px;
}

.tdev-range-input:focus {
    outline: none;
    border-color: var(--hseHub-cyan);
    box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.18);
}

.tdev-range-input:disabled { opacity: 0.5; cursor: wait; }

.tdev-range-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.6px;
    color: #25d07d;
    background: rgba(37, 208, 125, 0.14);
    border: 1px solid rgba(37, 208, 125, 0.42);
    border-radius: 999px;
    padding: 4px 10px;
}

.tdev-range-live .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #25d07d;
    box-shadow: 0 0 8px rgba(37, 208, 125, 0.8);
}

.tdev-range-apply,
.tdev-range-clear {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: inherit;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.6px;
    cursor: pointer;
    border-radius: 999px;
    padding: 4px 10px;
    color: var(--hseHub-cyan);
    background: rgba(0, 229, 255, 0.14);
    border: 1px solid rgba(0, 229, 255, 0.42);
}

.tdev-range-clear {
    color: var(--hseHub-mist-500);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.16);
}

.tdev-range-apply:hover { background: rgba(0, 229, 255, 0.24); }
.tdev-range-clear:hover { color: var(--hseHub-mist-100); }
.tdev-range-apply:disabled, .tdev-range-clear:disabled { opacity: 0.45; cursor: wait; }

/* A qué se aplica el rango. Empujada al final de la barra: es una advertencia, no un
   control, y no debe competir con los dos selectores. */
.tdev-range-note {
    margin-left: auto;
    font-size: 10px;
    color: var(--hseHub-mist-600);
}

/* Un reparto completo del Nodo (el grupo de la empresa en Wiloc, encendidos en
   Blackline) en cifras grandes arriba del todo. Reutiliza la tira de KPIs para que
   las dos filas compartan caja y línea base en vez de parecerse casi. */
.tdev-core-tiles { margin-bottom: 14px; }

/* Las cifras de cabecera del panel: son LO primero que se lee, así que van en cajas
   propias y no como una fila más de KPIs sueltos. */
.tdev-kpis-tiles .fk {
    background: rgba(0, 229, 255, 0.05);
    border: 1px solid rgba(0, 229, 255, 0.14);
    border-radius: 10px;
    padding: 12px 10px;
}

.tdev-kpis-tiles .fk .v { font-size: 26px; }
.tdev-core-tiles .tdev-flyout-sub { margin-bottom: 10px; }
.tdev-core-tiles .tdev-flyout-kpis { margin-bottom: 0; }
/* El % va bajo el nombre del valor: el número de arriba dice cuántos y este cuánta
   parte, que en un reparto de dos valores es la mitad de la información. */
.tdev-fk-pct {
    font-size: 10px;
    font-weight: 700;
    color: var(--hseHub-cyan);
    font-variant-numeric: tabular-nums;
}

/* La curva de 24 h del Nodo. Va a todo el ancho del panel: 24 puntos en una columna
   estrecha dejan de leerse mucho antes de quedarse sin sitio. */
.tdev-core-curve { margin-bottom: 14px; }
.tdev-curve { position: relative; }
.tdev-curve svg {
    display: block;
    width: 100%;
    height: 120px;
    overflow: visible;
}
/* vector-effect mantiene el grosor del trazo aunque el viewBox se estire en X, que es
   lo que hace preserveAspectRatio="none". Sin esto la línea sale como una cinta. */
.tdev-curve-line {
    fill: none;
    stroke: var(--hseHub-cyan);
    stroke-width: 1.6;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.35));
}
.tdev-curve-area {
    fill: rgba(0, 229, 255, 0.13);
    stroke: none;
}
.tdev-curve-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    color: var(--hseHub-mist-500);
}

/* Un panel filtrado tiene que decir que lo está: las cifras de cabecera y todos los
   repartos vienen ya acotados del API, y sin esta chapa el panel parece averiado. */
.tdev-core-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 7px 12px;
    border-radius: 10px;
    font-size: 12px;
    color: var(--hseHub-mist-100);
    background: rgba(0, 229, 255, 0.10);
    border: 1px solid rgba(0, 229, 255, 0.28);
}
.tdev-core-filter > i { color: var(--hseHub-cyan); font-size: 14px; }
.tdev-core-filter b { color: var(--hseHub-cyan); }
.tdev-core-filter-clear {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 7px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--hseHub-mist-100);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.16);
    cursor: pointer;
}
.tdev-core-filter-clear:hover { background: rgba(255, 255, 255, 0.14); }
/* Sin `clickable` la fila no debe fingir que se puede pulsar. */
.tdev-donut-legend .tdev-legend-row:not(.clickable) { cursor: default; }

/* ── La lista de entidades de un Nodo (la flota de FMS, los detectores) ─────────
   Una fila por entidad: identidad a la izquierda, qué está haciendo, sus cifras, y
   cuándo se supo. Es la misma retícula para cualquier Nodo — cuántas cifras salen
   lo decide qué publica cada uno, no esta hoja. */
.tdev-fleet-row {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) auto minmax(0, 1.4fr) auto;
    align-items: center;
    gap: 10px;
    padding: 7px 2px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.07);
}
.tdev-fleet-row.clickable { cursor: pointer; }
.tdev-fleet-row.clickable:hover { background: rgba(0, 229, 255, 0.06); }
/* Con un atributo fuera de su umbral la fila se marca por el borde y no por el fondo:
   el fondo ya lo usa el hover, y las dos cosas juntas se pisan. */
.tdev-fleet-row.is-alert { box-shadow: inset 2px 0 0 var(--hseHub-dash-red); }

/* La fila que esta senalada en el mapa ahora mismo. Se marca desde los DOS lados —pulsar
   la fila y pulsar el icono— para que la lista y el plano no cuenten cosas distintas.
   El realce va al fondo y a la barra lateral, no al texto: subrayar o engordar la letra
   movia las columnas de cifras al seleccionar. */
.tdev-fleet-row.is-selected {
    background: rgba(0, 229, 255, 0.10);
    box-shadow: inset 2px 0 0 rgba(0, 229, 255, 0.9);
}

/* Alertando y ademas senalada: manda el rojo de la alerta en la barra, y el cian se queda
   en el fondo. Al reves, seleccionar una fila en alarma la disfrazaria de normal. */
.tdev-fleet-row.is-alert.is-selected { box-shadow: inset 2px 0 0 var(--hseHub-dash-red); }

.tdev-fleet-id { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tdev-fleet-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--hseHub-mist-100);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tdev-fleet-sub {
    font-size: 10.5px;
    color: var(--hseHub-mist-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tdev-fleet-state {
    justify-self: start;
    padding: 2px 8px;
    border-radius: 7px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--hseHub-mist-500);
    background: rgba(255, 255, 255, 0.06);
    white-space: nowrap;
}
/* Solo se resalta lo que se está moviendo. «Idling» y «Stopped» son estados normales
   de un parque: pintarlos de color haría que un aparcamiento pareciera una incidencia. */
.tdev-fleet-state.is-moving {
    color: var(--hseHub-cyan);
    background: rgba(0, 229, 255, 0.14);
}

.tdev-fleet-figures {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 2px 12px;
    font-size: 11px;
    color: var(--hseHub-mist-500);
}
.tdev-fleet-figures b {
    color: var(--hseHub-mist-100);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.tdev-fleet-age {
    justify-self: end;
    font-size: 10px;
    color: var(--hseHub-mist-500);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ── El desglose de la flota, en la tarjeta de Vehicles ─────────────────────────
   No son filas de métrica: es UN dato repartido en tres, y en columnas se lee de un
   vistazo —cuál manda— sin tener que comparar cifras alineadas a la derecha en tres
   renglones distintos. La cifra manda y la palabra la sitúa, que es la misma regla
   que sigue la ficha de un punto en el mapa. */
.tdev-fleet-split {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 8px;
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.tdev-fleet-split-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    min-width: 0;
}
.tdev-fleet-split-cell b {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--hseHub-mist-100);
    font-variant-numeric: tabular-nums;
}
.tdev-fleet-split-cell span {
    font-size: 8.5px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--hseHub-mist-500);
    white-space: nowrap;
}

/* Solo se resalta lo que se está moviendo, igual que el chip de cada fila de la
   lista: «Idling» y «Stopped» son estados normales de un parque. */
.tdev-fleet-split-cell.is-moving b { color: var(--hseHub-cyan); }

/* Los que se ven pero no dicen qué hacen: se cuentan, no se disimulan, y se quedan
   por debajo del resto porque son un hueco del dato, no una situación de la obra. */
.tdev-fleet-split-cell.is-unknown b { color: var(--hseHub-mist-500); }
.tdev-fleet-split-cell.is-unknown span { color: var(--hseHub-mist-600); }

/* ── El panel de un Nodo con lista: la lista manda ──────────────────────────────
   Todo lo que no es la lista baja de tamaño y de contraste. La regla es la misma que
   ya rige el resto del panel: lo que contesta la pregunta va grande, lo que la sitúa
   va pequeño. */
.tdev-roster-panel .tdev-fleet-row { padding: 9px 2px; }
.tdev-roster-panel .tdev-fleet-name { font-size: 13px; }

/* El bloque de contexto: separado por una regla, atenuado, y con la curva a media
   altura. No está escondido — se lee entero — pero no compite con la lista. */
.tdev-roster-aside {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(0, 229, 255, 0.14);
    opacity: 0.82;
}
.tdev-roster-aside .tdev-flyout-sub { font-size: 9.5px; }

/* Las cifras de actividad, que antes eran cuatro cajas grandes, en una sola línea. */
.tdev-roster-figs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    font-size: 11px;
    color: var(--hseHub-mist-500);
}
.tdev-roster-figs b {
    color: var(--hseHub-mist-100);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ---- Entrada de las tarjetas ----
   El dashboard se lee en dos tiempos: primero el mapa —que es lo que se ha venido a ver— y
   un momento después las tarjetas, entrando juntas. Antes aparecían de golpe y a trozos,
   cada zona cuando le llegaba su dato. La animación es corta y sutil a propósito: es una
   pantalla de trabajo, no una presentación. */
@keyframes tdev-appear-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.tdev-appear {
    /* SIN `both`. Con relleno hacia delante, el `opacity: 1` del ultimo fotograma se queda
       puesto COMO ANIMACION, y una animacion gana en la cascada a cualquier regla normal:
       .tdev-heat-mode / .tdev-laser-mode / .tdev-camera-mode ponen `opacity: 0` para
       esconder las tarjetas mientras se mira otra vista, y ese 0 no llegaba a aplicarse
       nunca. Sin relleno, al acabar la entrada el elemento vuelve a su opacidad normal y
       esas reglas mandan otra vez. */
    animation: tdev-appear-in 380ms cubic-bezier(.22, .61, .36, 1);
}

/* Quien pida menos movimiento ve el mismo cambio, sin desplazamiento. */
@media (prefers-reduced-motion: reduce) {
    .tdev-appear { animation: none; }
}

/* ---- Tarjetas con lista larga dentro ----
   Una tarjeta de columna no puede encogerse por debajo de su contenido (ver
   `.tdev-col > .tdev-widget`), asi que una lista larga —los detectores de gas, el Alerts
   Log— empujaba al resto de su columna hasta sacarlas por arriba. Con esta clase la tarjeta
   cede alto, y lo que da de si es la lista, que scrollea dentro. Asi cada tarjeta se queda
   con el sitio que tiene sin eclipsar a las demas.

   ⚠️ El Alerts Log la lleva DESDE QUE SE PUEDE MOVER. Antes su permiso para ceder alto
   se lo daba la posicion —`.tdev-col-right > .tdev-widget:first-child`, mas arriba—, y eso
   valia solo mientras esa tarjeta fuese siempre el. En cuanto se puede colocar en otro
   sitio, el permiso tiene que viajar con la tarjeta y no con el hueco: si no, es la tarjeta
   mas alta del dashboard empujando a sus vecinas fuera de la pantalla, se ponga donde se
   ponga. */
.tdev-widget.tdev-scrollable {
    min-height: 0;
    overflow: hidden;

    /* Y el repintado se queda DENTRO. Las tarjetas son cristal (backdrop-filter: blur), y un
       backdrop se recalcula cuando cambia lo que tiene alrededor: al scrollear esta lista, el
       compositor volvia a resolver el desenfoque de las tarjetas de encima —Workers la
       primera de la columna— y eso es el parpadeo que se veia arriba mientras se scrolleaba
       aqui abajo. Con la contencion, el scroll no invalida nada fuera de esta caja. */
    contain: layout paint;
}

/* El Alerts Log scrollea por `.tdev-log`, que ya nace con flex/min-height/overflow —ver mas
   arriba—; lo que le faltaba es lo de aqui abajo, que es lo que evita el reflow de la columna
   al aparecer la barra. */
.tdev-widget.tdev-scrollable .kst-devlist,
.tdev-widget.tdev-scrollable .tdev-log {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    /* El hueco de la barra se reserva SIEMPRE. Sin esto, la barra aparece y desaparece al
       pasar el raton, el ancho util de la lista cambia, y ese cambio reflowea la columna
       entera: las tarjetas de arriba —Workers la primera— daban un salto de un pixel cada
       vez. Se veia como un parpadeo arriba al hacer scroll aqui abajo. */
    scrollbar-gutter: stable;
    /* El navegador no debe "corregir" la posicion al re-renderizar (el reloj redibuja la
       pagina cada segundo): eso da saltos de un pixel justo mientras se scrollea. */
    overflow-anchor: none;

    /* SIN `will-change: transform` aqui. Promovia la lista a capa propia, y con ella se
       llevaba un contexto de apilamiento nuevo: la lista se pintaba por encima de lo que
       tiene alrededor y se veia un efecto raro FUERA de la tarjeta. La contencion de la
       tarjeta (arriba) ya evita que el scroll repinte a las vecinas. */
    /* Y al llegar al final, la rueda se queda en la lista en vez de pasar al visor 3D, que
       la interpretaba como zoom del mapa. */
    overscroll-behavior: contain;
    /* Barra fina y del color del panel: la ancha de Windows se come el ancho de la ficha. */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 229, 255, 0.35) transparent;
}

.tdev-widget.tdev-scrollable .kst-devlist::-webkit-scrollbar { width: 6px; }
.tdev-widget.tdev-scrollable .kst-devlist::-webkit-scrollbar-track { background: transparent; }
.tdev-widget.tdev-scrollable .kst-devlist::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 255, 0.35);
    border-radius: 3px;
}
.tdev-widget.tdev-scrollable .kst-devlist::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 229, 255, 0.55);
}

/* La tira de entorno se centra con translateX(-50%). La animacion generica anima `transform`
   y, con fill-mode `both`, su estado final (translateY(0)) se QUEDA puesto: la tira perderia
   el centrado para siempre. Por eso tiene sus propios fotogramas, que arrastran el centrado.

   El :not() no es cosmetico: cuando la tira esta en alarma manda `tdev-alarm-pulse`, que se
   declara antes en este fichero y perderia el desempate de `animation-name` contra una regla
   escrita despues. Un aviso de calor que deja de parpadear es peor que una entrada sin
   fundido. */
@keyframes tdev-appear-in-centered {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.tdev-envbar.tdev-appear:not(.tdev-alarm-ring) {
    /* Sin `both`, por lo mismo que la de arriba. Aqui ademas el relleno tenia un segundo
       efecto: dejaba puesto el `transform` del ultimo fotograma, que es lo que mantiene el
       centrado de la tira — por eso sus fotogramas arrastran el translateX(-50%), y al
       terminar la animacion el centrado lo vuelve a poner su propia regla. */
    animation: tdev-appear-in-centered 380ms cubic-bezier(.22, .61, .36, 1);
}

@media (prefers-reduced-motion: reduce) {
    .tdev-envbar.tdev-appear:not(.tdev-alarm-ring) { animation: none; }
}

/* ---- Un solo tamano de ojo en el dock ----
   El ojo del Nodo nacia pequeno (.tdev-eye-sm, 17px) porque vivia en una fila de texto, y
   el de la tarjeta es el normal (20px): en el mismo titulo se veian dos botones distintos
   para el mismo gesto. Dentro de un titulo de widget mandan las medidas del grande. En las
   fichas de estres termico el pequeno se queda como esta — alli si es una fila de texto. */
.tdev-widget-title .tdev-eye-sm {
    width: 20px;
    height: 20px;
    margin: -3px 0 -3px 6px;
}

.tdev-widget-title .tdev-eye-sm i { font-size: 13px; }

/* ---- La lista de detectores, con la letra del dock ----
   Sus medidas venian de la ficha de estres termico, que es un panel grande: dentro de una
   tarjeta del dock, el nombre y sobre todo el %LEL (18px, mas que cualquier cifra de
   cualquier otro widget) cantaban. Aqui se igualan a .tdev-metric, que es la referencia de
   todas las demas tarjetas. */
.tdev-widget .kst-dev { padding: 5px 8px; gap: 7px; }
.tdev-widget .kst-dev-name { font-size: 11px; font-weight: 700; }
.tdev-widget .kst-dev-zone { font-size: 9.5px; letter-spacing: 0.4px; }
.tdev-widget .kst-dev-temp { font-size: 14px; font-weight: 700; }
.tdev-widget .kst-dev-temp small { font-size: 10px; font-weight: 600; margin-left: 3px; }

/* Filas quietas dentro del dock.
   En el panel de estres termico la fila se desplaza un pixel al pasar el raton y lleva una
   transicion. Dentro de una tarjeta del dashboard eso sale caro: al scrollear, las filas van
   entrando y saliendo del cursor una tras otra, cada :hover arranca su transicion y el
   repintado continuo hace parpadear el cristal de la tarjeta de al lado —Workers, la de
   encima—. El realce se queda; el movimiento y la transicion, no: lo que se quiere es ver
   sobre que fila se esta, no una animacion por cada una que pasa. */
.tdev-widget .kst-dev { transition: none; }
.tdev-widget .kst-dev:hover { transform: none; }

/* ---- Las cartas del dock del tiempo, cada una en su caja ----
   .tdev-robot-card lleva un halo de color ademas de la sombra de profundidad
   (`0 0 30px rgba(0,229,255,.12)`). Suelta sobre el mapa ese halo la despega del fondo y
   esta bien, pero en la PILA hay dos cartas separadas por 40px: el halo de la de gas cruza
   ese hueco entero y llega a la de Weather Stations, y se lee como si el color de una carta
   se extendiera hasta la otra en vez de como dos fichas separadas.

   Dentro de la pila se queda solo la sombra de profundidad. Y con la contencion de pintado,
   nada de lo que hay dentro de la carta —el resalte de una fila seleccionada, su glow— puede
   dibujarse fuera de ella. */
.tdev-wx-dock > .tdev-robot-card {
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
    contain: paint;
}

/* ---- Cristal y scroll no se llevan bien ----
   SINTOMA: al scrollear la lista de detectores, el color de la tarjeta parecia
   extenderse fuera de ella —en el dock del tiempo, hasta la ficha de Weather Stations; en
   el dashboard, por debajo de la tarjeta al scrollear la de gas—.

   CAUSA: `backdrop-filter`. Un elemento con backdrop-filter tiene que re-muestrear lo que
   tiene detras cada vez que algo se mueve, y al hacerlo el navegador toma una region MAYOR
   que la caja (necesita margen para el radio del desenfoque). Con un scroll dentro, ese
   sobremuestreo se ve: un halo del color de la tarjeta desbordando su borde, y el cristal
   de las vecinas repintandose a cada fotograma.

   ARREGLO: fondo solido en lugar de cristal, y SOLO en las fichas del dock del tiempo —su
   fondo ya era 96 % opaco, asi que el desenfoque casi no tenia nada que desenfocar y la
   diferencia no se ve.

   La tarjeta de Gas Sensors del DASHBOARD se queda de cristal como el resto de su columna:
   alli lo que se veia no era este artefacto sino las tarjetas asomando por detras del panel
   de estres termico (ver `tdev-heat-mode`), y una sola tarjeta opaca entre cristales cantaba
   mas que el problema que arreglaba. */
.tdev-wx-dock > .tdev-robot-card {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* ---- Heat mode: la vista de estres termico se mira sola ----
   Pulsar la tira de entorno abre unas fichas que se apoyan sobre el mapa, y el resto de
   tarjetas seguian ahi detras: se veian por los huecos entre fichas y por encima y por
   debajo de ellas, y lo que se leia era una mezcla de dos pantallas. Es exactamente lo que
   ya hacen las vistas de laser, camara y robot — esto es la misma regla para esta.

   La tira SI se queda: es lo que se ha pulsado para entrar y lo que marca por donde se
   vuelve, y ademas sigue enseñando las cifras de las que hablan las fichas. */
.tdev-heat-mode .tdev-col,
.tdev-heat-mode .tdev-bottom {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Igual que en los otros modos: .tdev-widget vuelve a activar los eventos por su cuenta,
   asi que una tarjeta invisible seguia siendo pulsable si no se apaga tambien en los hijos. */
.tdev-heat-mode .tdev-col *,
.tdev-heat-mode .tdev-bottom * {
    pointer-events: none;
}
