html {
    transition: opacity 0.1s ease;
}

@keyframes halo-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* The bounce animates the pin's inner SVG, NEVER the marker element itself — maplibre positions
   markers via an inline transform on that element (translate(-50%,-100%) translate(x,y)), and any
   animation transform on it would clobber the position (pin snaps to the map's top-left corner). */
.halo-pin.halo-bounce svg {
    animation: halo-bounce 1s ease-in-out infinite;
}

/* MapLibre map container + marker chrome (ADR 0018) */

.halo-map {
    width: 100%;
    height: 100%;
}

.halo-pin {
    cursor: pointer;
    transform-origin: bottom center;
}

.halo-cluster {
    min-width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1a73e8;
    color: #fff;
    font: 600 12px/28px Roboto, Arial, sans-serif;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    cursor: pointer;
}

.halo-vertex {
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.halo-edit-handle {
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    cursor: grab;
}

.halo-edit-handle:active {
    cursor: grabbing;
}

.halo-edit-vertex {
    width: 12px;
    height: 12px;
    background: #ffffff;
    border: 2px solid #479108;
}

.halo-edit-midpoint {
    width: 8px;
    height: 8px;
    background: #ffffff;
    border: 2px solid #1a73e8;
}

.halo-edit-overlay {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100% - 24px);
    background: rgba(33, 37, 41, 0.92);
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font: 500 12px/1.4 Roboto, Arial, sans-serif;
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    /* The bar must never block the map underneath it (vertex handles sit below the bar band) —
       only its interactive children intercept pointer events. */
    pointer-events: none;
}

.halo-edit-instructions,
.halo-edit-overlay button {
    pointer-events: auto;
}

.halo-edit-instructions {
    cursor: pointer;
    user-select: none;
}

.halo-edit-overlay button {
    font: 600 12px/1 Roboto, Arial, sans-serif;
    border: none;
    border-radius: 3px;
    padding: 5px 10px;
    cursor: pointer;
    white-space: nowrap;
}

.halo-edit-save {
    background: #479108;
    color: #fff;
}

.halo-edit-save:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.halo-edit-cancel {
    background: #dc3545;
    color: #fff;
}

.halo-edit-overlay-invalid {
    background: rgba(211, 47, 47, 0.92);
}

/* MapLibre popup content rides the dashboard theme; keep the default close affordance visible. */
.maplibre-popup-content a {
    text-decoration: underline;
}

.rz-body {
    padding: 0 !important;
}

body.theme-switching {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.profileThumbnail {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

html[data-theme="dark"] .rz-link.no-hover .rz-link-text,
html[data-theme="dark"] .rz-notification-close {
    color: var(--rz-text-color) !important;
}

html[data-theme="light"] .rz-link {
    color: var(--rz-primary) !important;
}

.rz-link.no-hover:hover .rz-link-text {
    text-decoration: none;
}

.rz-cell-filter-content input, .auto-complete input {
    height: 2rem;
    font-size: 0.9rem;
}

.rz-text-secondary-color {
    color: var(--rz-text-secondary-color) !important;
}

.rz-notification {
    inset-block-start: 48px;
}

/* Font Awesome 6 Free font CSS */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}


.components-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.components-loading-animation {
    position: relative;
    width: 80px;
    height: 80px;
}

.components-loading-animation div {
    position: absolute;
    border: 3px solid #512BD4;
    opacity: 1;
    border-radius: 50%;
    animation: components-loading-animation 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

.components-loading-animation div:nth-child(2) {
    animation-delay: -0.5s;
}

@keyframes components-loading-animation {
    0% {
        top: 40px;
        left: 40px;
        width: 0;
        height: 0;
        opacity: 0;
    }

    4.9% {
        top: 40px;
        left: 40px;
        width: 0;
        height: 0;
        opacity: 0;
    }

    5% {
        top: 40px;
        left: 40px;
        width: 0;
        height: 0;
        opacity: 1;
    }

    100% {
        top: 0px;
        left: 0px;
        width: 80px;
        height: 80px;
        opacity: 0;
    }
}

.presence-wrap {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin: .45rem;
}

.presence-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.presence-dot.online {
    background: #22c55e; /* green */
    box-shadow: 0 0 0 0 rgba(34, 197, 94, .65);
    animation: pulse 1.5s infinite;
}

.presence-dot.offline {
    background: #f59e0b; /* amber (static) */
}

.presence-dot.degraded {
    background: #f59e0b; /* amber (static) — online but no bracelet enrolled */
    outline: 2px dashed #f59e0b;
    outline-offset: 2px;
}

.presence-dot.awol {
    background: #ef4444; /* red */
    box-shadow: 0 0 0 0 rgba(244, 67, 54, 1);
    animation: pulse-red 1.2s infinite;
}

@keyframes pulse-amber {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, .7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(245, 158, 11, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, .65);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.zone-badge-presence {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, .65);
    animation: pulse 1.5s infinite;
}

.zone-badge-breach {
    box-shadow: 0 0 0 0 rgba(244, 67, 54, 1);
    animation: pulse-red 1.5s infinite;
}

.zone-badge-potential {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, .8);
    animation: pulse-amber 1.2s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 1);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(244, 67, 54, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .presence-dot.online, .presence-dot.awol, .zone-badge-breach {
        animation: none;
    }
}

.cell-link {
    display: block;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.cell-link:hover,
.cell-link:hover .rz-link-text,
.cell-link:hover .rz-link-text .device-meta .device-meta-item,
.cell-link:hover .rz-link-text:hover {
    text-decoration: none !important;
}

.device-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.2rem;
    font-size: 0.8rem;
    color: var(--rz-text-tertiary-color);
}

.device-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

/* Midline-dot (U+00B7) separators between metadata segments. */
.device-meta-item + .device-meta-item::before {
    content: "·";
    margin-right: 0.4rem;
}

.rz-link:hover .device-meta-item {
    text-decoration: none;
}

.device-meta-icon {
    font-size: 1rem;
}

/* Radzen text inside the device-meta strip must inherit the strip's small size (the component's
   own TextStyle classes would otherwise render larger). The info-window header and the grid's
   Last Seen column are not inside .device-meta and are unaffected. */
.device-meta .rz-text-body1,
.device-meta .rz-text-body2 {
    font-size: inherit;
}

/* Device page tabbed shell (DEVICE_SCREEN_REDESIGN_PLAN). The page is a 100vh flex column:
   header (flex-shrink-0) + tab strip + content region that owns the full-bleed map. */
.device-tabs .rz-tabview-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    /* Radzen's tab nav can overflow by a fraction of a pixel, which otherwise draws a stray
       horizontal scrollbar on the tab row — keep the narrow-screen scroll, hide the bar. */
    scrollbar-width: none;
}

.device-tabs .rz-tabview-nav::-webkit-scrollbar {
    display: none;
}

/* The tab strip is used purely as navigation — ALL tab content (map + panels) renders outside the
   RadzenTabs in .device-tab-content. RadzenTabs still emits an empty, visible .rz-tabview-panel for
   the selected tab (the Map one), which would otherwise leave a dead band above the map — suppress
   the whole panels container. */
.device-tabs .rz-tabview-panels {
    display: none;
}

.device-tab-content {
    position: relative;
    display: flex;
    flex-direction: row;
    flex: 1 1 auto;
    min-height: 0;
}

.device-map-region {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
}

/* The map stays MOUNTED across tab switches — hidden with display:none on non-map tabs and
   re-shown on the Map tab (the page triggers halo.mapLibre.resize when it becomes
   visible again). */
.device-map-region .device-map {
    position: absolute;
    inset: 0;
    display: none;
}

.device-map-region .device-map.is-map-tab {
    display: block;
}

.device-map-region .device-panel-scroll {
    position: absolute;
    inset: 0;
    overflow-y: auto;
}

/* Desktop filter panel: an in-flow column on the LEFT of the map — expanding it narrows the map
   rather than overlaying it. Collapses to a thin vertical strip (just the expand button). */
.device-map-controls {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--rz-border-color);
    background: var(--rz-card-background-color);
    z-index: 5;
    overflow: hidden;
}

.device-map-controls.is-expanded {
    width: 20rem;
}

.device-map-controls.is-collapsed {
    width: 2.5rem;
}

.device-map-controls.is-collapsed .device-map-controls-header {
    flex-direction: column;
    justify-content: center;
    padding: 0.25rem;
    height: 100%;
    border-bottom: none;
}

.device-map-controls-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 1rem;
    border-bottom: 1px solid var(--rz-border-color);
}

.device-map-controls-header .rz-text-body1 {
    font-weight: 600;
}

/* The expanded panel's scrollable content: date filters first, then the "View Options" section. */
.device-map-controls-body {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.device-map-controls-view-header {
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--rz-border-color);
    border-bottom: 1px solid var(--rz-border-color);
    background: rgba(0, 0, 0, 0.03);
}

.device-map-controls-view-header .rz-text-subtitle2 {
    font-weight: 600;
}

/* Collapsed strip: a full-height clickable button showing the expand chevron + "Filter" rotated
   -90 degrees, both stacked at the TOP of the strip. */
.device-map-controls-collapsed-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    padding: 0.5rem 0.2rem;
    cursor: pointer;
    color: var(--rz-text-secondary-color);
}

.device-map-controls-collapsed-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.device-map-controls-collapsed-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile/tablet: the map-controls drawer toggle floats bottom-right (the drawer opens right). */
.device-map-controls-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1rem;
    z-index: 50;
}

/* Hand-rolled right-side drawer (Radzen 11 has no drawer component — the plan's RadzenDrawer
   choice became a plain CSS panel with the same UX: 320px, scrim-dismissable, non-modal). */
.device-map-controls-scrim {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0, 0, 0, 0.35);
}

.device-map-controls-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 61;
    width: 320px;
    max-width: 85vw;
    overflow-y: auto;
    background: var(--rz-card-background-color);
    border-left: 1px solid var(--rz-border-color);
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
}

/* Subject page shell — mirrors Device page flex column so the Map tab can fill remaining viewport. */
.subject-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.subject-header {
    flex-shrink: 0;
}

.subject-tabs .rz-tabview-panels {
    display: none;
}

.subject-tab-content {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.subject-tab-content.is-map-tab {
    overflow: hidden;
}

.subject-tab-content.is-panel-tab {
    overflow-y: auto;
    padding: 1rem; /* rz-p-4 equivalent — header already has its own padding */
}

.subject-map {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.cursor-help {
    cursor: pointer;
    color: var(--rz-text-secondary-color);
    text-decoration: underline dotted transparent;
    text-underline-offset: 2px;
    transition: color 120ms ease, text-decoration-color 120ms ease;
}

.cursor-help:hover,
.cursor-help:focus-visible {
    color: var(--rz-text-color);
    text-decoration-color: var(--rz-primary);
}

.cursor-help:focus-visible {
    outline: 2px solid var(--rz-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* MapLibre popup chrome (ADR 0026) — rounded corners + subtle shadow matching Radzen, light/dark via
   CSS vars, WCAG-compliant contrast. The info-window bubble is clamped to the map container. */
.maplibregl-popup {
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    font: 400 13px/1.45 Roboto, Arial, sans-serif;
}

/* Popup chrome is scoped under .maplibregl-popup on purpose: the vendored
   maplibre-gl.css <link> comes AFTER app.css in App.razor, so same-specificity
   MapLibre rules (white popup background, transparent close button, white tips)
   would otherwise win and break dark mode. The extra class beats them always. */
.maplibregl-popup .maplibregl-popup-content {
    background: var(--rz-card-background-color);
    background-color: var(--rz-card-background-color);
    color: var(--rz-text-color);
    border-radius: 10px;
    padding: 0;
    overflow: hidden;
    /* Tall enough for the expanded <details> telemetry (~580px) so no inner
       scrollbar appears; viewport-relative cap keeps huge popups on-screen. */
    max-height: min(640px, 70vh);
    overflow-y: auto;
    border: 1px solid var(--rz-border-color);
}

.maplibregl-popup-content a:not(.halo-iw-action) {
    color: var(--rz-primary);
}

/* Close button sits INSIDE the popup corner (never outside it): the content box
   clips overflow, so the old -10px offset cut the button off, and the circle only
   renders when every paint property below wins — hence explicit background-color. */
.maplibregl-popup .maplibregl-popup-content > button.maplibregl-popup-close-button {
    color: var(--rz-text-secondary-color);
    font-size: 15px;
    line-height: 1;
    width: 26px;
    height: 26px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    top: 8px;
    right: 8px;
    z-index: 3;
    border-radius: 50%;
    border: 1px solid var(--rz-border-base-300, var(--rz-border-color));
    background: var(--rz-card-background-color);
    background-color: var(--rz-card-background-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.maplibregl-popup .maplibregl-popup-content > button.maplibregl-popup-close-button:hover {
    color: var(--rz-text-title-color);
    background: var(--rz-card-hover-background-color, rgba(0, 0, 0, 0.06));
}

.maplibregl-popup.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.maplibregl-popup.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.maplibregl-popup.maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
    border-bottom-color: var(--rz-card-background-color);
}

.maplibregl-popup.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.maplibregl-popup.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.maplibregl-popup.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
    border-top-color: var(--rz-card-background-color);
}

.maplibregl-popup.maplibregl-popup-anchor-left .maplibregl-popup-tip {
    border-right-color: var(--rz-card-background-color);
}

.maplibregl-popup.maplibregl-popup-anchor-right .maplibregl-popup-tip {
    border-left-color: var(--rz-card-background-color);
}

/* Unified info-window card (ADR 0026, Phase 2) — one layout shared by both maps:
   inset grade accent bar (stops short of the close-button clear space), name/timestamp
   header with relative pill, grade + BLE badges, hero stat band, Device/Network rows,
   native <details> telemetry expander, condensed footnote, Home-only action links. */
.halo-iw {
    min-width: 260px;
    max-width: 340px;
    padding: 12px 14px 13px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 13px;
}

.halo-iw-accent {
    height: 5px;
    border-radius: 3px;
    margin: 2px 30px 0 2px;
}

.halo-iw-accent-gps { background: #34A853; }
.halo-iw-accent-degraded { background: #FB8C00; }
.halo-iw-accent-network { background: #4285F4; }
.halo-iw-accent-invalid { background: #EA4335; }
.halo-iw-accent-unknown { background: var(--rz-text-tertiary-color); }

.halo-iw-header {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-right: 22px;
}

.halo-iw-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.halo-iw-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--rz-text-title-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.halo-iw-title--wrap {
    white-space: normal;
    overflow: visible;
    font-variant-numeric: tabular-nums;
}

.halo-iw-subtitle {
    color: var(--rz-text-secondary-color);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.halo-iw-relative {
    flex: none;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--rz-primary);
    background: color-mix(in srgb, var(--rz-primary) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--rz-primary) 35%, transparent);
    padding: 2px 9px;
    border-radius: 999px;
    cursor: default;
}

.halo-iw-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.halo-iw-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #fff;
}

.halo-iw-badge .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.halo-iw-badge-gps {
    background: #157347;
}

.halo-iw-badge-degraded {
    background: #9a5200;
}

.halo-iw-badge-network {
    background: #2f6edb;
}

.halo-iw-badge-invalid {
    background: #b3261e;
}

.halo-iw-badge-unknown {
    background: #5b6472;
}

.halo-iw-badge-ok {
    background: #157347;
}

.halo-iw-hero {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    background: color-mix(in srgb, var(--rz-primary) 8%, transparent);
    border: 1px solid var(--rz-border-base-300, var(--rz-border-color));
    border-radius: 8px;
    overflow: hidden;
}

.halo-iw-hero > div {
    padding: 8px 6px 7px;
    text-align: center;
    min-width: 0;
}

.halo-iw-hero > div + div {
    border-left: 1px solid var(--rz-border-base-300, var(--rz-border-color));
}

.halo-iw-hero .h {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--rz-text-secondary-color);
    margin-bottom: 2px;
}

.halo-iw-hero .v {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--rz-text-title-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.halo-iw-keyvals {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.halo-iw-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    min-width: 0;
}

.halo-iw-label {
    flex: none;
    font-size: 12px;
    color: var(--rz-text-secondary-color);
}

.halo-iw-value {
    min-width: 0;
    font-size: 13px;
    color: var(--rz-text-color);
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
}

.halo-iw-more {
    border: 1px solid var(--rz-border-base-300, var(--rz-border-color));
    border-radius: 8px;
}

.halo-iw-more summary {
    cursor: pointer;
    list-style: none;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--rz-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.halo-iw-more summary::-webkit-details-marker {
    display: none;
}

.halo-iw-more summary::before {
    content: "\25B8";
    font-size: 11px;
}

.halo-iw-more[open] summary::before {
    content: "\25BE";
}

.halo-iw-more .halo-iw-keyvals {
    padding: 2px 10px 9px;
}

.halo-iw-footnote {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
    color: var(--rz-text-tertiary-color);
}

.halo-iw-footnote-label {
    margin-right: 8px;
}

.halo-iw-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 10.5px;
    color: var(--rz-text-secondary-color);
}

.halo-iw-actions {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.halo-iw-action {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
}

.halo-iw-action-primary {
    background: var(--rz-primary);
    color: var(--rz-on-primary);
}

.halo-iw-action-primary:hover {
    filter: brightness(1.08);
}

.halo-iw-action-secondary {
    background: transparent;
    color: var(--rz-primary);
    border-color: color-mix(in srgb, var(--rz-primary) 45%, transparent);
}

.halo-iw-action-secondary:hover {
    background: color-mix(in srgb, var(--rz-primary) 10%, transparent);
}

/* Info-window icons reuse the dashboard's own icon font: popups render raw HTML strings
   so RadzenIcon components cannot mount inside — instead the Material Symbols ligature
   glyph is inlined with the .rzi class RadzenIcon itself renders (font is document-wide
   via the Radzen material theme, so it applies inside MapLibre popups too). Sized down
   from the 1.5rem .rzi default to sit inline with popup text. */
.halo-iw .rzi {
    font-size: 1rem;
    vertical-align: -0.18em;
}

.halo-iw-action .rzi {
    font-size: 1.15rem;
}

.halo-iw-battery-opt-icon {
    color: var(--rz-warning);
}

/* One-step-smaller Radzen switches (Device page Resolution card): the switch has no size
   variant, so scale the whole track+knob; the layout box keeps its space, the visual shrinks. */
.rz-switch-sm {
    transform: scale(0.8);
    transform-origin: left center;
}

/* Map search (postcodes.io, device page) — floating box top-left beside the filter button,
   theme-aware via Radzen vars. */
.device-map-filter-button {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 900;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--rz-border-color);
    border-radius: 6px;
    background: var(--rz-card-background-color);
    color: var(--rz-text-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    font-size: 0;
}

.device-map-filter-button:hover {
    background: var(--rz-card-hover-background-color, rgba(0, 0, 0, 0.06));
}

/* Hidden on non-map tabs WITHOUT removing it from the DOM — a conditional before the map would
   re-mount the HaloMap on tab switch (blanking the map). */
.device-map-filter-button.is-hidden {
    display: none;
}

.halo-map-search {
    position: absolute;
    top: 12px;
    left: 54px;
    z-index: 900;
    width: 280px;
    max-width: calc(100% - 66px);
    background: var(--rz-card-background-color);
    border: 1px solid var(--rz-border-color);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    font: 400 13px/1.4 Roboto, Arial, sans-serif;
}

.halo-map-search-row {
    position: relative;
}

.halo-map-search-input {
    width: 100%;
    box-sizing: border-box;
    border: none;
    background: transparent;
    color: var(--rz-text-color);
    padding: 7px 30px 7px 10px;
    font: inherit;
    outline: none;
}

.halo-map-search-input::placeholder {
    color: var(--rz-text-secondary-color);
}

.halo-map-search-clear {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    display: none;
    border: none;
    background: transparent;
    color: var(--rz-text-secondary-color);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
}

.halo-map-search-results {
    border-top: 1px solid var(--rz-border-color);
    max-height: 280px;
    overflow-y: auto;
}

.halo-map-search-result {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    color: var(--rz-text-color);
    padding: 7px 10px;
    font: inherit;
    cursor: pointer;
}

.halo-map-search-result:hover {
    background: rgba(26, 115, 232, 0.12);
}

/* Keyboard navigation (Up/Down) highlights the focused result. */
.halo-map-search-result.halo-map-search-result-active {
    background: rgba(26, 115, 232, 0.22);
    outline: none;
}

/* The search result's label rides a Maplibre Popup (a Google-Maps-style info window anchored to
   the point on the ground) — style only the label text inside the popup bubble. */
.halo-search-marker {
    font: 600 13px/1.4 Roboto, Arial, sans-serif;
    white-space: nowrap;
}

/* Basemap layer switcher (Standard / OS Road / ... / Aerial Hybrid) — top-right of the map */
.halo-map-layer-control {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Heading / zoom / tilt readout — sits to the LEFT of the layers button. */
.halo-map-camera-readout {
    background: var(--rz-card-background-color);
    border: 1px solid var(--rz-border-color);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    color: var(--rz-text-color);
    font: 500 12px/34px Roboto, Arial, sans-serif;
    padding: 0 10px;
    white-space: nowrap;
    pointer-events: none;
}

.halo-map-layer-toggle {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--rz-border-color);
    border-radius: 6px;
    background: var(--rz-card-background-color);
    color: var(--rz-text-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    cursor: pointer;
}

.halo-map-layer-toggle:disabled {
    opacity: 0.5;
    cursor: default;
}

.halo-map-layer-menu {
    position: absolute;
    top: 42px;
    right: 0;
    min-width: 150px;
    background: var(--rz-card-background-color);
    border: 1px solid var(--rz-border-color);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.halo-map-layer-divider {
    width: 100%;
    height: 1px;
    background: var(--rz-base-300, rgba(0, 0, 0, 0.12));
    margin: 4px 0;
}

.halo-map-layer-option {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    color: var(--rz-text-color);
    padding: 8px 12px;
    font: 400 13px/1.4 Roboto, Arial, sans-serif;
    cursor: pointer;
}

.halo-map-layer-option:hover {
    background: rgba(26, 115, 232, 0.12);
}

.halo-map-layer-option.is-active {
    background: rgba(26, 115, 232, 0.22);
    font-weight: 600;
}

/* Live draw-time zone area readout — sits directly under the filter/search row (top-left). */
.halo-zone-draw-area {
    position: absolute;
    top: 54px;
    left: 12px;
    z-index: 1001;
    background: rgba(33, 37, 41, 0.92);
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font: 500 12px/1.4 Roboto, Arial, sans-serif;
    pointer-events: none;
    display: none;
}

.halo-zone-draw-area-buffer {
    opacity: 0.8;
}

/* Force fixed (non-floating) labels on every Radzen form field — site-wide, so no per-field
   AllowFloatingLabel="false" is needed. Mirrors Radzen's own :not(.rz-floating-label) label rules;
   app.css loads after the Radzen theme stylesheet, so these win the cascade. Focus/disabled/invalid
   label colors still apply (their selectors have higher specificity). */
.rz-form-field .rz-form-field-label {
    inset-inline-start: var(--rz-form-field-label-inset-inline-start);
    inset-inline-end: auto;
    inset-block-start: var(--rz-form-field-label-floating-top);
    padding-block-start: 0;
    padding-block-end: 0;
    transform: translate(0, 0);
    color: var(--rz-input-placeholder-color);
    background-color: var(--rz-form-field-label-floating-background-color);
    font-size: var(--rz-form-field-label-floating-font-size, 0.75rem);
    line-height: 1rem;
    max-width: calc(100% - 1.5rem);
}

.rz-form-field:not(.rz-variant-outlined) .rz-form-field-label {
    background-color: inherit !important;
}

/* Autocomplete rows that pair a primary label with a trailing info badge (e.g. OS local_type).
   Keeps label + badge on one line; badge wraps gracefully on narrow rows. */
.rz-autocomplete-item .rz-autocomplete-item-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    line-height: 1.4;
}

.rz-autocomplete-item .rz-autocomplete-item-row .rz-badge {
    flex-shrink: 0;
}
