/* ──────────────────────────────────────────────────────────────────────
   device-detail.css — chrome for the device-detail redesign.
   Loaded only by frontend/server_web/templates/devices/device_detail.html.
   PR-3 of the device-detail refactor — see
   memory-bank/tasks/feature-v0.8.0-stage-1/analysis/phase-1/
   DEVICE-DETAIL-PLAN.md.

   Token hygiene:
   - Brand + status colours use --color-* tokens already defined in
     frontend/server_web/static/css/design-system.css (loaded globally).
   - Grayscale uses --device-gray-*, scoped to .device-detail-page so it
     can't leak into other pages. Values match the design-token grays
     (--fg-*, --border-*, --bg-page) — when design-system.css grows a global
     gray scale, this block can be deleted and the var() refs will fall
     through to the global definition.
   ────────────────────────────────────────────────────────────────────── */

.device-detail-page,
.devices-page,
.gateways-page,
.gateway-detail-page,
.tenants-page,
.positioning-page,
.network-health-page {
    /* SINGLE source of truth for v0.8.0 analyze-section page chrome
       (device-detail, devices list, gateways list, gateway-detail,
       standalone positioning).
       All pages share:
         - the same --device-gray-* scale (matches the design-token grays)
         - the same 88rem max-width (matches compliance .fw-page +
           .compliance-landing)
         - the same left-aligned padding
       The .dd-* component rules (.dd-hero, .dd-kpi*, .dd-stage, .dd-rail*)
       below are not scoped to the wrapper — they apply wherever the
       markup appears. Add new analyze-section pages to this selector
       to inherit the wrapper styling. */
    /* ⚠️ --device-gray-800 has no consumer (audited 2026-10-05) and is kept: this is a
       declared scale, and a hole in it reads as corruption. Retire the scale as a unit
       or not at all. */
    --device-gray-50: var(--bg-page);
    --device-gray-100: var(--status-neutral-bg);
    --device-gray-200: var(--border-base);
    --device-gray-300: var(--border-medium);
    --device-gray-400: var(--border-strong);
    --device-gray-500: var(--fg-4);
    /* Scoped to .network-health-page, NOT :root — every consumer outside
       that scope MUST keep a fallback or the declaration is dropped. */
    --device-gray-600: var(--fg-3);
    --device-gray-700: var(--fg-body-strong);
    --device-gray-800: var(--fg-heading);
    --device-gray-900: var(--fg-1);

    /* Width + padding come from the design-tokens.css page-shell tokens so
       a single edit there updates every page (compliance + analyze). */
    max-width: var(--page-max-width);
    margin: 0;
    padding: var(--page-padding);
    color: var(--device-gray-900);
    font-family: var(--font-base);
    font-size: var(--fs-base);
    line-height: var(--lh-normal);
}

.device-detail-page h1,
.device-detail-page h2,
.device-detail-page h3,
.devices-page h1,
.devices-page h2,
.devices-page h3,
.gateways-page h1,
.gateways-page h2,
.gateways-page h3,
.gateway-detail-page h1,
.gateway-detail-page h2,
.gateway-detail-page h3,
.tenants-page h1,
.tenants-page h2,
.tenants-page h3,
.positioning-page h1,
.positioning-page h2,
.positioning-page h3,
.network-health-page h1,
.network-health-page h2,
.network-health-page h3 {
    font-family: var(--font-display);
    margin: 0;
}

/* ── Hero header: MOVED to design-system/page-hero.css (2026-10-30). The
   --device-gray-* scale above is scoped to the wrappers listed at the top of
   this file, so the hero's border resolved on those pages only and silently
   vanished on every other page that rendered one (alerts, measured 0px). ── */

/* Slideout / detail-panel header (product-model panel, application devices
   slideout). One shared class replacing the identical ``text-2xl font-bold
   text-[var(--fg-1)]`` string that was hand-rolled in two templates — the
   title/header consolidation (v0.11.0 Finding 1). Keeps the current size/weight
   (24px bold near-black) so the migration is visually a no-op; pair it with the
   ``truncate`` utility on the element for the ellipsis. */
.dd-slideout-title {
    font-family: var(--font-display);
    font-weight: var(--fw-bold);
    font-size: var(--fs-xl);
    line-height: var(--lh-snug);
    color: var(--fg-1);
    margin: 0;
}

/* ── Action chip (matches device-detail mockup chip pattern) ────────── */
.dd-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: var(--fs-sm);
    font-weight: 500;
    border: 1px solid var(--device-gray-300);
    color: var(--device-gray-700);
    background: var(--bg-card);
    cursor: pointer;
    font-family: inherit;
    transition:
        background-color 0.12s,
        border-color 0.12s;
}
.dd-chip:hover {
    background: var(--device-gray-50);
    border-color: var(--device-gray-400);
}
.dd-chip svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

/* ── Pills (re-uses the production --status-*-bg / --status-*-fg token pairs) */
.dd-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    padding: 0.1875rem 0.625rem;
    border-radius: 9999px;
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
}
/* Modifier — slightly de-emphasized weight for status/window pills
   layered next to a panel title (Signal-tab window count, Map-tab
   gateways-heard tag). Replaces the inline ``style="font-weight: 500;"``
   pattern that used to live on those call sites. */
.dd-pill-medium {
    font-weight: 500;
}
.dd-pill-online {
    background: var(--status-online-bg);
    color: var(--status-online-fg);
}
.dd-pill-offline {
    background: var(--status-danger-bg);
    color: var(--status-danger-fg);
}
/* The danger tone by its own name, for a pill that is not about connectivity:
   the gateway hero's condition pills (an open HIGH or CRITICAL condition
   alert, 2026-11-11). Same tokens as `.dd-pill-offline`, which stays for the
   state it names. */
.dd-pill-danger {
    background: var(--status-danger-bg);
    color: var(--status-danger-fg);
}
.dd-pill-warning {
    background: var(--status-warning-bg);
    color: var(--status-warning-fg);
}
.dd-pill-info {
    background: var(--status-info-bg);
    color: var(--status-info-fg);
}
.dd-pill-neutral {
    background: var(--status-neutral-bg);
    color: var(--fg-4);
}
/* Fallback for any importance value without a dedicated rule (e.g. the
   `Unknown` enum member, or a future importance level). Without this, an
   unmapped `dd-pill-importance-*` renders as a shapeless, colorless pill
   because base `.dd-pill` sets no background/color. The specific
   -low/-medium/-high/-critical rules below override this by source order. */
[class*="dd-pill-importance-"] {
    background: var(--status-neutral-bg);
    color: var(--fg-4);
}
.dd-pill-importance-low {
    background: var(--status-info-bg);
    color: var(--status-info-fg);
}
.dd-pill-importance-medium {
    background: var(--status-warning-bg);
    color: var(--status-warning-fg);
}
.dd-pill-importance-high {
    background: var(--status-warning-bg);
    color: var(--status-warning-fg);
}
.dd-pill-importance-critical {
    background: var(--status-danger-bg);
    color: var(--status-danger-fg);
}
/* v0.9.2 device State — lifecycle pill (operational / pending) + reason chip
   (warn / error / benign). Reuses the status-pill colour tokens. Orthogonal to
   the connectivity badge; raw enum values never rendered (mapped in
   constants/devices.py via DeviceStateView). */
.dd-pill-state-operational {
    background: var(--status-online-bg);
    color: var(--status-online-fg);
}
.dd-pill-state-pending {
    background: var(--status-warning-bg);
    color: var(--status-warning-fg);
}
.dd-chip-reason {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.4375rem;
    border-radius: 0.375rem;
    font-size: var(--fs-2xs);
    font-weight: 600;
    letter-spacing: 0.02em;
}
.dd-chip-reason-warn {
    background: var(--status-warning-bg);
    color: var(--status-warning-fg);
}
.dd-chip-reason-error {
    background: var(--status-danger-bg);
    color: var(--status-danger-fg);
}
.dd-chip-reason-benign {
    background: var(--status-info-bg);
    color: var(--status-info-fg);
}
.dd-pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}
.dd-pill-dot.online {
    background: var(--chart-status-online);
}
.dd-pill-dot.offline {
    background: var(--chart-status-offline);
}
.dd-pill-dot.warning {
    background: var(--chart-importance-medium);
}
.dd-pill-dot.acked {
    background: var(--chart-importance-low);
}
.dd-pill-dot.resolved {
    background: var(--chart-status-online);
}

/* ── KPI strip ──────────────────────────────────────────────────────
   Default is 6 tiles (device-detail). Add ``.dd-kpi-strip-5`` for the
   devices/gateways list pages; ``.dd-kpi-strip-4`` for tighter strips
   (gateways list per PR-8 §3.2). The breakpoint behaviour is shared. */
.dd-kpi-strip {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.dd-kpi-strip.dd-kpi-strip-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}
.dd-kpi-strip.dd-kpi-strip-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.dd-kpi-strip.dd-kpi-strip-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 1100px) {
    .dd-kpi-strip,
    .dd-kpi-strip.dd-kpi-strip-5,
    .dd-kpi-strip.dd-kpi-strip-4 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
@media (max-width: 700px) {
    .dd-kpi-strip,
    .dd-kpi-strip.dd-kpi-strip-5,
    .dd-kpi-strip.dd-kpi-strip-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* The tile is the dashboard's metric card (Figma): sentence-case label,
   muted sub-line, then a 30px figure; an optional tinted glyph top-right.
   The dashboard used to hand-write it as .summary-card while every list page
   used this class in a smaller, uppercase style, so the same "Total devices"
   looked different one click apart. One look now, here; .dd-kpi--sm keeps the
   compact form below. */
.dd-kpi {
    background: var(--bg-card);
    border: 1px solid var(--border-base);
    border-radius: var(--radius-lg);
    /* No shadow (2026-11-11): flat fills only. The --shadow-xs that sat here
       and the --shadow-md hover on link tiles read as a bevel. */
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}
.dd-kpi-label {
    font-size: var(--fs-base);
    font-weight: 500;
    color: var(--fg-4);
    line-height: 1.4;
}
.dd-kpi-value {
    font-weight: 700;
    font-size: var(--fs-2xl);
    color: var(--fg-heading);
    line-height: 1;
    margin-top: 0.25rem;
}
.dd-kpi-value-unit {
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--fg-4);
    margin-left: 0.1875rem;
}
.dd-kpi-sub {
    font-size: var(--fs-sm);
    color: var(--fg-5);
    line-height: var(--lh-snug);
    margin-top: -0.25rem;
}
.dd-kpi-sub-empty {
    color: var(--fg-5);
    font-style: italic;
}
/* The 6-column strip (device detail; no -4/-5 modifier) keeps the 24px
   figure and the tighter padding: at 1280px a 30px "12 min ago" wraps. */
.dd-kpi-strip:not(.dd-kpi-strip-4):not(.dd-kpi-strip-5) > .dd-kpi {
    padding: 0.875rem 1rem;
}
.dd-kpi-strip:not(.dd-kpi-strip-4):not(.dd-kpi-strip-5) .dd-kpi-value {
    font-size: var(--fs-xl);
}
/* glyph: label/sub/figure on the left, a 40px tinted icon square right. */
.dd-kpi--glyph {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}
.dd-kpi-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}
.dd-kpi-glyph {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.625rem;
    flex-shrink: 0;
    background-color: var(--color-metric-icon-bg);
    color: var(--color-metric-icon);
}
/* href: the whole tile is the link. Hover paints the frame brand green, flat;
   it was a drop shadow until 2026-11-11. */
a.dd-kpi,
a.dd-kpi:hover {
    text-decoration: none;
    color: inherit;
}
a.dd-kpi {
    transition: border-color var(--t-fast);
}
a.dd-kpi:hover,
a.dd-kpi:focus-visible {
    border-color: var(--color-brand-green);
    outline: none;
}

/* ── A tile that filters the list it sits above (kpi(..., hx=)) ──────────
   At rest it carries "View list" in the internal-link idiom under the figure,
   so it reads as clickable before anything is hovered; static tiles carry no
   line. Selected: the whole frame and the label brand green and the glyph
   square filled, flat — never one edge, never a shadow (2026-11-11). */
.dd-kpi-cta {
    font-size: var(--fs-sm);
    margin-top: 0.25rem;
}
.dd-kpi-cta--clear {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--fg-4);
}
.dd-kpi--active {
    border-color: var(--color-brand-green);
}
.dd-kpi--active .dd-kpi-label {
    color: var(--color-brand-green);
}
.dd-kpi--active .dd-kpi-glyph {
    background: var(--color-brand-green);
    color: var(--fg-on-dark);
}

/* ── Stage: tab content + always-on rail ──────────────────────────── */
.dd-stage {
    display: grid;
    /* Rail width comes from --page-rail-width in design-tokens.css —
       single source of truth shared with future analyze pages. PR-7
       had 320px; PR-8 slimmed to 240px to free horizontal space for
       wide tables. Bump the var to revisit. */
    grid-template-columns: minmax(0, 1fr) var(--page-rail-width);
    gap: 1.125rem;
    /* Rail collapse (plan 03): animate the rail column when
       .rail-collapsed toggles. Expanded template is unchanged. */
    transition: grid-template-columns 0.2s ease;
}
/* Modifier — pages that don't ship a right rail (currently /tenants per
   LIST-PAGES-REDESIGN.md §"Tab structure per page"). Collapses the
   stage to a single full-width column instead of leaving an empty
   rail gutter. */
.dd-stage.dd-stage-no-rail {
    grid-template-columns: minmax(0, 1fr);
}
@media (max-width: 1100px) {
    .dd-stage,
    .dd-stage.rail-collapsed {
        grid-template-columns: 1fr;
    }
}
/* LIST squeeze fix. A list table carries a ~800px min-width; beside the 240px
   rail it drops below that between ~1100-1400px, so its right columns (Last
   Seen / Actions) scroll-clip *under* the rail. Stack the rail below the
   full-width table until the viewport can hold the table's min-width + the rail.
   Scoped to the LIST pages — detail pages keep the 1100px breakpoint, their
   main column is flexible (chart), not min-width-bound.

   ⚠️ Was `.devices-page` only. The gateways list has the same table shape and
   the same 800px floor, and without this rule its Actions column clipped under
   the rail at laptop widths while the devices list's did not — reported as "the
   Actions column is not pinned as in other tables" (2026-10-29). Column shedding
   (table-columns.css) handles the OPEN rail above this breakpoint; this handles
   the widths where even the shed table does not fit beside a rail. */
@media (max-width: 1400px) {
    .devices-page .dd-stage,
    .devices-page .dd-stage.rail-collapsed,
    .gateways-page .dd-stage,
    .gateways-page .dd-stage.rail-collapsed {
        grid-template-columns: 1fr;
    }
}

/* == Right-rail collapse (plan 03 / handoff .generated/handoff-alerts)
   ===================================================================
   Additive only -- the base .dd-stage above keeps its
   minmax(0,1fr) var(--page-rail-width) template and .dd-stage-no-rail
   modifier. One chevron at the top of the rail collapses both cards
   into a ~44px vertical strip, freeing horizontal width for the table.
   Same pattern/glyph as the left-nav + tenant-map gateway-rail
   collapses. NOTE: the handoff snippet redeclared a conflicting base
   .dd-stage in design-system.css; that was intentionally NOT taken
   (the canonical rule lives here) -- see plan 03 sec 2.1. */
.dd-stage.rail-collapsed {
    grid-template-columns: minmax(0, 1fr) 44px;
}

/* Toggle row sits above the cards: right-aligned when expanded,
   centered over the strip when collapsed. */
.dd-rail-toggle-row {
    display: flex;
    justify-content: flex-end;
}
.dd-stage.rail-collapsed > .dd-stage-rail .dd-rail-toggle-row {
    justify-content: center;
}
.dd-rail-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-base);
    background: var(--bg-card);
    border-radius: 6px;
    color: var(--fg-4);
    cursor: pointer;
    padding: 0;
    transition:
        background 0.15s,
        color 0.15s,
        border-color 0.15s;
    flex: none;
}
.dd-rail-toggle:hover {
    background: var(--status-online-bg);
    color: var(--coverage-strong-fg);
    border-color: var(--policy-stricter-bg);
}
.dd-rail-toggle:focus-visible {
    outline: 2px solid var(--color-brand-green);
    outline-offset: 2px;
}
.dd-rail-toggle svg {
    transition: transform 0.2s;
}
.dd-stage.rail-collapsed > .dd-stage-rail .dd-rail-toggle svg {
    transform: rotate(180deg);
}

/* Collapsed: card body hides; header reorients to a vertical text
   strip (same writing-mode trick as the tenant-map gateway rail).
   The titles are wrapped in a <span> in
   _alerts_page_content_generic.html for this rule to match.

   SCOPING, two rules, both learned the hard way.

   1. Qualify by .dd-stage-rail. The Coverage-map
   card on the Map tab reuses .dd-rail-card* but lives in
   .dd-stage-main; an unscoped `.dd-stage.rail-collapsed
   .dd-rail-card-header` matched it too, so collapsing the rail forced
   the "Coverage map" header to flex-column and `> :not(span)` hid the
   Expand button (the "title + Expand on two lines / chrome breaks when
   collapsed" bug). Rail-only keeps the vertical-strip trick where it
   belongs and leaves main-column cards untouched.

   2. Use the CHILD combinator. A .dd-stage can now contain another one
   -- the device Positioning tab's stage nests inside the page stage --
   and a descendant selector let an OUTER collapsed stage collapse the
   INNER rail, which no toggle could then undo: clicking the inner
   chevron flipped the inner stage's class while the ancestor's rule
   kept forcing it shut. `> .dd-stage-rail` binds each rule to its own
   rail. */
.dd-stage.rail-collapsed > .dd-stage-rail .dd-rail-card-body {
    display: none;
}
/* Everything in a card but its header, not just `.dd-rail-card-body`. A card
   may hold more than its body: the positioning Clusters card puts its
   band-filter chips beside the body, and on a page off the page shell (which
   hides the whole rail body instead) those chips stood in the 44px strip next
   to the rotated label (tenant dashboard, 2026-11-14). */
.dd-stage.rail-collapsed
    > .dd-stage-rail
    .dd-rail-card
    > :not(.dd-rail-card-header) {
    display: none;
}
.dd-stage.rail-collapsed > .dd-stage-rail .dd-rail-card-header {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 14px 4px;
    border-bottom: 0;
    min-height: 140px;
}
.dd-stage.rail-collapsed > .dd-stage-rail .dd-rail-card-header > span {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    letter-spacing: 0.04em;
    font-size: var(--fs-sm);
}
/* Collapsed strip shows only the rotated label -- hide any other
   header children (e.g. the gateway-rail "See all" aux link) so the
   44px strip stays clean. */
.dd-stage.rail-collapsed > .dd-stage-rail .dd-rail-card-header > :not(span) {
    display: none;
}
.dd-stage-main {
    min-width: 0;
    /* Wide tables (devices list table has 7 columns including Actions)
       can exceed the 1fr column at narrow viewports — without
       overflow-x:auto they render *under* the 320px rail and clip the
       Actions column. Scoped to direct table descendants so the rest of
       the page chrome stays in normal flow. */
    overflow-x: hidden;
}
.dd-stage-main > div,
.dd-stage-main .table-container,
.dd-stage-main .table-container-box {
    max-width: 100%;
    overflow-x: auto;
}

/* Off-state uses :not(.active) so its specificity beats Tailwind
   single-class utilities like ``flex`` / ``block`` that callers may
   put on the wrapper (the tenant-detail Map sub-tabs do, so the map
   fills the column height when active). The active state has no
   explicit display rule on purpose — the element falls back to its
   natural display (``block`` for sections/divs) or to whatever
   utility class the caller applied (``flex`` for the heat-map
   wrapper that needs the column-height fill). */
.dd-tab-content:not(.active) {
    display: none;
}

/* ── Right rail card chrome (filled by PR-4 / PR-5) ───────────────── */
.dd-rail-card {
    background: var(--bg-card);
    border: 1px solid var(--device-gray-200);
    border-radius: 0.75rem;
    overflow: hidden;
}
.dd-rail-card + .dd-rail-card {
    margin-top: 0.875rem;
}
.dd-rail-card-header {
    padding: 0.75rem 0.875rem;
    font-size: var(--fs-sm);
    font-weight: 700;
    color: var(--device-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--device-gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
/* Body padding mirrors the header so the rail content has a visible
   12/14 px gutter on every side. Without this rule the body text sat
   flush to the card border (operator feedback: "no spacing"). Cards
   that need a different inner layout (e.g. dd-rail-bar-row with its
   own padded rows) can override on more specific selectors. */
.dd-rail-card-body {
    padding: 0.75rem 0.875rem;
}

/* The signal-band filter in the clusters rail, between the card header and the
   list.

   Borderless and full-width: it is a strip inside a .dd-rail-card, not a
   free-standing control, so the card's own border is the only one needed.

   Filed here rather than with the other .pos-* rules in
   positioning/positioning_map.css, which the prefix would suggest. It modifies
   .dd-rail-card, defined directly above, and consumes --device-gray-100, which
   is declared in this file on the page-level selectors. Moving it would split a
   modifier from its base AND leave it reading a token declared elsewhere; the
   prefix is the weaker claim of the two. */
.pos-band-filter {
    padding: 0.5rem 0.875rem;
    border-bottom: 1px solid var(--device-gray-100);
}

/* Leaflet-managed containers should never grow a UA scrollbar. Same
   pattern as the .patitur-tab-bar fix above: a CORS-blocked third-
   party stylesheet (Flowbite, likely its responsive-table preset)
   applies ``overflow-x: auto`` on map containers and the small extra
   tile/SVG-pane content past the viewport triggers a 2 px scrollbar
   gutter on the bottom edge. Leaflet does its own clipping via
   absolute positioning on the panes; the container itself never
   needs scrollbars. ``!important`` because the third-party rule has
   higher cascade specificity. */
.leaflet-container {
    overflow: hidden !important;
}

/* Configuration-tab card width — the .dd-rail-card / .dd-rail-row
   chrome was designed for the 240 px right-rail (label + value
   tight against each other). On the gateway-detail Configuration
   tab those same cards live in the full-width .dd-stage-main, where
   ``justify-content: space-between`` smears the label and value to
   opposite ends with a huge empty gap between. Pinning the card to a
   readable max-width keeps the operator's eye-track short. Scoped to
   the Configuration tab only — other tabs (Map, Devices, Alerts,
   Positioning) host full-width content that the rule should NOT
   touch. */
#gw-tabpanel-config .dd-rail-card,
#device-tabpanel-config .dd-rail-card {
    max-width: 640px;
}

/* Positioning-toolbar mode buttons — the Method / Clusters / Radial-
   scatter trio. Previously only had Tailwind utilities (px-3 py-1.5
   font-medium), so the inactive Clusters button rendered as plain
   text and read like a label. These rules give the unpressed state a
   hover affordance and the aria-pressed=true state a brand-tinted fill
   so the operator can tell at a glance which mode is active. */
.pos-mode-btn {
    background: var(--bg-card);
    color: var(--device-gray-700, var(--bg-sidebar-hover));
    cursor: pointer;
    transition:
        background 0.12s,
        color 0.12s;
}
.pos-mode-btn:hover:not(:disabled):not([aria-pressed="true"]) {
    background: var(--device-gray-50, var(--bg-page));
    color: var(--device-gray-900, var(--fg-1));
}
.pos-mode-btn[aria-pressed="true"] {
    background: color-mix(in srgb, var(--color-brand-green) 12%, transparent);
    color: var(--color-brand-green);
}
.pos-mode-btn:disabled {
    cursor: not-allowed;
}
.dd-rail-card-header-aux {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--fs-xs);
    color: var(--device-gray-700);
    letter-spacing: 0;
    text-transform: none;
}
.dd-rail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.875rem;
    font-size: var(--fs-sm);
    border-bottom: 1px solid var(--device-gray-50);
}
.dd-rail-row:last-child {
    border-bottom: none;
}
/* ⚠️ **The LABEL truncates; the VALUE never does.** This pair was the other
   way round — `flex-shrink: 0` on the label, `min-width: 0` on the value —
   which reads fine while the label is a word like "Online" and the value is
   the data. The Low battery card breaks that: its label is a 23-character
   device EUI. Measured on /devices 2026-10-27, the label claimed 164px and
   squeezed the reading to **0px wide**, so the name ate the whole row.

   ⚠️ The value is protected rather than merely preferred, because a clipped
   READING is a wrong reading: "3.65%" cut to "3.6…" states a different
   number. A clipped NAME is still recognisable, and keeps its full text in a
   tooltip. When something has to give, it has to be the name. */
.dd-rail-row-label {
    color: var(--device-gray-500);
    /* ⚠️ **Capped, not protected, and not crushable either.** This pair has
       now been wrong in BOTH directions:

         * originally `flex-shrink: 0` here — fine until the label is a
           23-character device EUI (Low battery), which claimed 164px of a
           210px row and squeezed the reading to 0px wide;
         * then the value was protected instead — fine until the VALUE is
           prose ("ZPMETER (Hangzhou Zhongpei…", 272px), which overflowed the
           row and crushed "Manufacturer" to 0px.

       Neither side can win absolutely, because which one is long depends on
       the card. A max-width is what actually holds: a long label takes at
       most this share and truncates, a short one takes only what it needs
       and leaves the rest to the value. */
    /* ⚠️ **Never narrower than a short label's own text** (2026-11-14). With
       `flex: 0 1 auto; min-width: 0` a long VALUE starved the label: device
       207's 60-character application name shrank "Application" to nothing and
       the word drew under the value, unclipped. Not shrinking holds a short
       label whole; the max-width still caps a long one, which now clips with
       an ellipsis instead of spilling. */
    flex: 0 0 auto;
    min-width: 0;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dd-rail-row-name {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dd-rail-row-value {
    color: var(--device-gray-900);
    font-weight: 500;
    text-align: right;
    /* Takes whatever the capped label leaves. `overflow-wrap: anywhere` is
       the ORIGINAL behaviour and is kept deliberately: a long value wraps
       onto a second line rather than being cut, which is right for a
       manufacturer name. It no longer costs the battery reading a wrap,
       because the cap above guarantees that row ~72px — more than the 32px
       "3.65%" needs. */
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}
/* A link inside a truncating name flows as text, so the ellipsis can cut it.
   `.link-internal` is `inline-flex` for its arrow, which makes the whole name
   one atomic box that `text-overflow` can't reach into (2026-11-14: device
   207's Application, "Dragino SE01-LB - Sensor Tª, humedad y conductividad
   (suelo)", now one line with an ellipsis and its full text in the title).
   A two-line `-webkit-line-clamp` was tried first: inside this flex row
   Chrome clipped it at two lines but drew no ellipsis, so a cut name read as
   the whole name. */
.dd-rail-row-name > a {
    display: inline;
}
.dd-rail-row-note {
    display: block;
    /* Its own line, wrapping on its own terms. */
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: var(--fs-xs);
    font-weight: 400;
    color: var(--fg-5);
}
.dd-rail-row-value.mono {
    font-family:
        ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: var(--fs-xs);
}

/* Standalone monospace utility — same stack as .dd-rail-row-value.mono
   but usable on any element that doesn't already carry the rail-row
   value chrome (e.g. inline coordinate strings inside a flex row). */
.dd-mono {
    font-family:
        ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* ── Rail proportion-bar rows (Status / Importance breakdown cards on
   the devices + gateways list rails — PR-8). Two-line row: top has a
   label on the left and ``count · pct`` on the right; below sits a 4 px
   track with a coloured fill. Inline ``style="width: N%"`` drives the
   fill width; class drives the colour. */
/* ⚠️ Root tokens, not the --device-gray-* scale: these rows render on the
   product models page (components/ranked_bars.html), whose wrapper is not in
   the scale's scope list above, so the scoped names resolved to nothing
   there (2026-10-30). Same values the scale maps to. */
.dd-rail-bar-row {
    padding: 0.5rem 0.875rem;
    border-bottom: 1px solid var(--bg-page);
    font-size: var(--fs-sm);
}
.dd-rail-bar-row:last-child {
    border-bottom: none;
}
.dd-rail-bar-row-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}
.dd-rail-bar-row-label {
    color: var(--fg-body-strong);
    font-weight: 500;
}
.dd-rail-bar-row-count {
    color: var(--fg-4);
    font-size: var(--fs-xs);
    font-variant-numeric: tabular-nums;
}
.dd-rail-bar-track {
    height: 4px;
    background: var(--device-gray-100);
    border-radius: 2px;
    overflow: hidden;
}
.dd-rail-bar-fill {
    height: 100%;
    background: var(--device-gray-400);
    transition: width 0.2s ease;
}

.dd-rail-bar-fill-online {
    background: var(--status-online-fg);
}
.dd-rail-bar-fill-offline {
    background: var(--status-danger-fg);
}
.dd-rail-bar-fill-critical {
    background: var(--status-danger-fg);
}
.dd-rail-bar-fill-high {
    background: var(--sev-dot-high);
}
.dd-rail-bar-fill-medium {
    background: var(--status-warning-fg);
}
.dd-rail-bar-fill-low {
    background: var(--status-info-fg);
}
.dd-rail-bar-fill-unknown {
    background: var(--device-gray-400);
}

/* ── Empty-state placeholder (Alerts tab + rail before PR-4 / PR-5) ── */
/* A compact empty state, for a panel too short for the default 2.5rem block.
   Was an inline padding override on 10 of the 45 call sites. */
.dd-empty-state--compact {
    padding: 1rem 0.875rem;
}

/* A pagination chip that cannot be followed. The markup already says so with
   aria-disabled, so the appearance follows the attribute rather than a second
   hand-written style. */
.dd-chip[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
}

.dd-empty-state {
    background: var(--bg-card);
    border: 1px dashed var(--device-gray-300);
    border-radius: 0.75rem;
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--device-gray-500);
    font-size: var(--fs-base);
}
.dd-empty-state .dd-empty-state-title {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--device-gray-700);
    margin-bottom: 0.375rem;
    font-size: 0.9375rem;
}
/* Modifier — compact variant for rail cards and KPI tile sub-areas
   where the full 2.5rem padding feels heavy. Replaces the inline
   ``style="padding:1.25rem 0.875rem;"`` + ``style="font-size:var(--fs-xs);"``
   patterns that used to live on those call sites. */
.dd-empty-state-compact {
    padding: 1.25rem 0.875rem;
}
/* Scoped to the component, not to one compact variant: the codebase carries
   BOTH .dd-empty-state-compact and .dd-empty-state--compact, and this rule only
   matched the first, so the same subtitle rendered at 11px in the device rail
   and at the inherited 14px on the devices page — which is why those call sites
   still carried an inline font-size. */
.dd-empty-state .dd-empty-state-aux {
    font-size: var(--fs-xs);
}

/* ── Signal-tab per-gateway chrome (Wave-0) ───────────────────────────
   Field-tab bar / window selector / mode bar / gateway chip bar / per-
   gateway summary cards. All scoped to .dd-signal-panel so they don't
   leak into other panels that use the same dashboard-card chrome.
   See memory-bank/tasks/feature-v0.8.0-stage-1/analysis/phase-2/
   DEVICE-DETAIL-WAVE-0-PLAN.md §3.6 for the design and
   device-detail-redesigned.html lines 271-398 for the visual target. */

.dd-field-bar {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
    padding: 0.875rem 0 0.75rem;
    border-bottom: 1px solid var(--device-gray-100);
    margin-bottom: 0.875rem;
}
.dd-field-bar-label {
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--device-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 0.25rem;
}
.dd-field-bar-divider {
    width: 1px;
    align-self: stretch;
    background: var(--device-gray-200);
    margin: 0 0.375rem;
}
.dd-field-unit {
    font-size: var(--fs-2xs);
    opacity: 0.7;
    font-family:
        ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* A group inside the control bar (Metric's tabs, the Gateways pills): keeps
   its members together and wraps as a unit when the bar runs out of room. */
.dd-field-bar-group {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
}

/* The bar's last group, pinned to its right end (the gateway pills). When
   the bar wraps, it keeps to the right of its own line. */
.dd-field-bar-end {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
}

/* The Signal panel scrolls below its own header (2026-11-24): the title and the
   control bar hold still, and the chart, the day/night table and the gateway
   cards share the panel's one scroll region (page-shell.css pins whatever sits
   beside a region). The chart is a fixed share of the viewport inside the
   region, no longer the space left over, since the table and cards now scroll
   with it. */
.page-shell .dd-signal-panel {
    margin-bottom: 0;
}
.page-shell .dd-signal-panel > .page-scroll > #signal-chart-container {
    height: clamp(260px, 30vh, 380px);
}
/* Zoom bar (signal-zoom.js): the trail on the left, Back / Forward / Whole
   window on the right. Pinned chrome, under the control bar. */
.dd-zoom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
    font-size: var(--fs-xs);
    color: var(--fg-4);
}
.dd-zoom-bar[hidden] {
    display: none;
}
.dd-zoom-trail {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    min-width: 0;
}
.dd-zoom-step {
    border: 0;
    background: none;
    padding: 0;
    color: var(--color-brand-green);
    cursor: pointer;
    font: inherit;
}
.dd-zoom-step:hover {
    text-decoration: underline;
}
.dd-zoom-current {
    color: var(--fg-1);
    font-weight: var(--fw-semibold);
}
.dd-zoom-actions {
    display: inline-flex;
    gap: 0.375rem;
}
/* The alert flag's tooltip (signal-alert-lane.js), inside the chart frame. */
#signal-chart-container {
    position: relative;
}
.dd-alert-tip {
    position: absolute;
    z-index: 5;
    max-width: 18rem;
    padding: 0.375rem 0.5625rem;
    border-radius: var(--radius-sm);
    background: var(--fg-1);
    color: var(--bg-card);
    font-size: var(--fs-xs);
    line-height: 1.4;
    pointer-events: none;
}
.dd-alert-tip[hidden] {
    display: none;
}
.dd-alert-tip b {
    display: block;
    margin-bottom: 0.125rem;
}
.dd-alert-tip-row {
    display: flex;
    gap: 0.375rem;
    align-items: baseline;
}
.dd-alert-tip-note {
    opacity: 0.7;
}
/* A severity dot: in the tooltip, the list and the chips. */
.dd-alert-dot {
    flex: none;
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--sev-c);
    border: 2px solid var(--sev-c);
}
.dd-sev-critical {
    --sev-c: var(--sev-dot-critical);
}
.dd-sev-high {
    --sev-c: var(--sev-dot-high);
}
.dd-sev-medium {
    --sev-c: var(--sev-dot-medium);
}
.dd-sev-low {
    --sev-c: var(--sev-dot-low);
}
.dd-sev-info {
    --sev-c: var(--sev-dot-info);
}
/* The list behind the slate "earlier" circle. */
.dd-alert-pop {
    position: absolute;
    z-index: 6;
    width: min(28rem, 100%);
    max-height: 18rem;
    overflow-y: auto;
    padding: 0.5rem 0;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    font-size: var(--fs-sm);
}
.dd-alert-pop[hidden] {
    display: none;
}
.dd-alert-pop h4 {
    margin: 0;
    padding: 0.125rem 0.75rem 0.375rem;
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    color: var(--fg-4);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.dd-alert-pop-row {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    border: 0;
    background: none;
    text-align: left;
    font: inherit;
    color: var(--fg-2);
    cursor: pointer;
}
.dd-alert-pop-row:hover,
.dd-alert-pop-row:focus-visible {
    background: var(--bg-page);
}
/* The range dropdown: the design system's select, at the control bar's height. */
.dd-field-bar .filter-dropdown.dd-range-select {
    min-width: 0;
    padding: 0.25rem 2rem 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    background-color: var(--bg-card);
}
/* The Alerts button and the severity chips in the control bar. */
.dd-alert-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
}
.dd-alert-controls[hidden],
.dd-alert-chips[hidden],
.dd-signal-panel [data-alert-legend][hidden] {
    display: none;
}
.dd-alert-chips {
    display: inline-flex;
    gap: 0.25rem;
}
.dd-alert-toggle,
.dd-alert-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    padding: 0.125rem 0.625rem;
    border: 1px solid var(--border-base);
    background: var(--bg-card);
    font-size: var(--fs-sm);
    color: var(--fg-2);
    cursor: pointer;
}
.dd-alert-toggle {
    border-radius: var(--radius-sm);
}
.dd-alert-toggle[aria-pressed="true"] {
    background: var(--color-brand-green);
    border-color: var(--color-brand-green);
    color: var(--bg-card);
}
.dd-alert-chip {
    /* A dot and a count, no words (2026-11-25): tighter than the button. */
    padding: 0.125rem 0.4375rem;
    border-radius: 9999px;
}
.dd-alert-chip[aria-pressed="false"] {
    border-style: dashed;
    color: var(--fg-4);
}
.dd-alert-chip[aria-pressed="false"] .dd-alert-dot {
    background: transparent;
}
.dd-alert-count {
    font-variant-numeric: tabular-nums;
    opacity: 0.8;
}
.dd-sky-gw {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
/* A gateway button is its colour dot (2026-11-25, the owner: the names made
   the bar wrap). The name is the button's tooltip and accessible name. A
   hidden gateway is a hollow ring in its colour, not a faded name. */
.dd-gw-chip {
    display: inline-grid;
    place-items: center;
    width: 1.625rem;
    height: 1.625rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    transition: background 0.12s;
}
.dd-gw-chip:hover,
.dd-gw-chip:focus-visible {
    background: var(--device-gray-50);
}
.dd-gw-chip:focus-visible {
    outline: 2px solid var(--color-brand-green);
    outline-offset: 1px;
}
.dd-gw-chip-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    flex-shrink: 0;
    /* The chip carries its gateway colour as --gw-color (set by .series-N). */
    border: 2px solid var(--gw-color, var(--fg-5));
    background: var(--gw-color, var(--fg-5));
}
.dd-gw-chip:not(.on) .dd-gw-chip-dot {
    background: transparent;
}

.dd-gw-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
    padding-top: 0.875rem;
    border-top: 1px solid var(--device-gray-100);
    margin-top: 0.875rem;
}
.dd-gw-summary {
    border: 1px solid var(--device-gray-200);
    border-radius: 0.625rem;
    padding: 0.75rem 0.875rem;
    transition: opacity 0.12s;
}
.dd-gw-summary.off {
    opacity: 0.45;
}
.dd-gw-summary-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.dd-gw-summary-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.8125rem;
    color: var(--device-gray-900);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.dd-gw-summary-dot {
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 50%;
    flex-shrink: 0;
    /* Same omission the chip dot had: .series-N puts the gateway colour on the
       card as --gw-color and this never read it, so the summary named a gateway
       with no way to tie it to its chart line. The two dots are the same idea in
       two places and now paint from the same property. */
    background: var(--gw-color, var(--fg-5));
}
.dd-gw-summary-eui {
    font-family:
        ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: var(--fs-2xs);
    color: var(--device-gray-500);
    margin-top: 0.125rem;
    margin-left: 1.125rem;
}
.dd-gw-summary-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.5rem;
}
/* The gateway-summary stat is the KPI tile at a smaller scale: same label,
   value and unit structure, 15px instead of 24px. It had its own three class
   names (.dd-gw-stat-label / -value / -unit) describing the same three parts,
   so .dd-kpi--sm folds it in and the old names become aliases of these rules
   rather than a fourth vocabulary.

   The 9px label is not on the type scale — 10px is the smallest step — so it
   comes up to --fs-2xs like every other off-scale size did. */
.dd-kpi--sm {
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    gap: 0.25rem;
    box-shadow: none;
}
.dd-kpi--sm .dd-kpi-label {
    font-size: var(--fs-2xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dd-kpi--sm .dd-kpi-value {
    font-family: var(--font-display);
    font-size: var(--fs-base);
    line-height: 1.15;
    margin-top: 0.125rem;
}

.dd-kpi--sm .dd-kpi-value-unit {
    font-size: var(--fs-2xs);
    margin-left: 0.125rem;
}

.dd-gw-stat-label {
    font-size: 0.5625rem;
    font-weight: 700;
    color: var(--device-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.dd-gw-stat-value {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--device-gray-900);
    margin-top: 0.125rem;
}
.dd-gw-stat-unit {
    font-size: var(--fs-2xs);
    font-weight: 500;
    color: var(--device-gray-500);
    margin-left: 0.125rem;
}

.dd-gw-status-tag {
    font-size: var(--fs-2xs);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    flex-shrink: 0;
}
/* Signal-band swatches (mirror frontend/kernel/constants/signal_metrics.py
   BAND_COLORS — single source of truth across Python, CSS, and the
   gateway-marker JS which reads ``entry.band_color`` directly).
   Strong/fair share their tints with --status-online-* and
   --status-warning-*; weak intentionally uses a softer red
   (var(--danger-strong-fg)) than the full-danger pill (var(--status-danger-fg)) so a gateway in the
   Weak band reads distinct from a fully offline device. Keep the
   literals — consolidating into shared CSS vars here would couple the
   "weak signal" semantic to "offline device", which they aren't. */
.dd-gw-status-tag-strong {
    background: var(--status-online-bg);
    color: var(--status-online-fg);
}
.dd-gw-status-tag-fair {
    background: var(--status-warning-bg);
    color: var(--status-warning-fg);
}
.dd-gw-status-tag-weak {
    background: var(--status-danger-bg);
    color: var(--danger-strong-fg);
}
.dd-gw-status-tag-unknown {
    background: var(--device-gray-100);
    color: var(--device-gray-500);
}

/* Rail "Gateways heard" card rows — one row per gateway, click-through
   to gateway-detail. Compact two-column stats footer keeps the row
   under 70px so 5 rows fit in the rail without scroll. */
.dd-rail-gateway {
    display: block;
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--device-gray-100);
    text-decoration: none;
    color: inherit;
    transition: background-color 0.12s;
}
.dd-rail-gateway:last-child {
    border-bottom: none;
}
.dd-rail-gateway:hover {
    background: var(--device-gray-50);
}
.dd-rail-gateway-name {
    display: block;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.8125rem;
    color: var(--device-gray-900);
    margin-bottom: 0.125rem;
}
.dd-rail-gateway-eui {
    display: block;
    font-family:
        ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: var(--fs-2xs);
    color: var(--device-gray-500);
    margin-bottom: 0.375rem;
}
.dd-rail-gateway-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.375rem;
    font-size: var(--fs-xs);
}
.dd-rail-gateway-stat-label {
    color: var(--device-gray-500);
    margin-right: 0.25rem;
}
.dd-rail-gateway-stat-value {
    color: var(--device-gray-900);
    font-family: var(--font-display);
    font-weight: 700;
}

/* ── Network Health (stage-1 phase-1 §3.2 Lite) ────────────────────
   Standalone Network Health page chrome. Mirrors the analyze-section
   wrapper rule above; the KPI grid + placeholder pill below are
   page-specific so they don't leak. The phase-2 tiles render in a
   muted state so the operator sees what's coming without confusing
   "0" with "not implemented." */
/* Network Health KPI tiles use the canonical design-system .dd-kpi
   classes verbatim (same look as /gateways + /devices + /alerts) —
   the prior bespoke .nh-kpi-grid / .nh-kpi-tile / .nh-kpi-label /
   .nh-kpi-value / .nh-kpi-fraction / .nh-kpi-sub variants were
   removed in favour of .dd-kpi-strip / .dd-kpi / .dd-kpi-label /
   .dd-kpi-value / .dd-kpi-value-unit / .dd-kpi-sub. Only the
   icon-inline-with-label modifier + accent variants live here. */
.nh-kpi-label-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 0.375rem;
    color: var(--device-gray-400, var(--fg-5));
    vertical-align: -2px;
}
/* Headline-tile colour accents — applied to the 5 .dd-kpi tiles that
   answer health questions (Gateways online, Open alerts, Mean RSSI,
   Resilient positioning, Fragile cells). Two reinforcing channels
   per tile (coloured value text + tinted leading icon). The other
   4 count-context tiles (Active devices, Devices located, Good-
   signal band, Signal clusters) stay neutral so colour means
   something. Hexes mirror SIGNAL_BAND_STRONG/FAIR/WEAK_COLOR in
   constants/signal_metrics.py — same palette the hero verdict and
   the redundancy map cells read against. Flat fills only, no
   asymmetric thick edges or shadows (those read as bevels). */
.dd-kpi.nh-kpi-accent-green .dd-kpi-value,
.dd-kpi.nh-kpi-accent-green .nh-kpi-label-icon,
.dd-kpi.nh-kpi-accent-green .dd-kpi-glyph {
    color: var(--status-online-fg);
}
.dd-kpi.nh-kpi-accent-amber .dd-kpi-value,
.dd-kpi.nh-kpi-accent-amber .nh-kpi-label-icon,
.dd-kpi.nh-kpi-accent-amber .dd-kpi-glyph {
    color: var(--status-warning-fg);
}
.dd-kpi.nh-kpi-accent-red .dd-kpi-value,
.dd-kpi.nh-kpi-accent-red .nh-kpi-label-icon,
.dd-kpi.nh-kpi-accent-red .dd-kpi-glyph {
    color: var(--danger-strong-fg);
}
.nh-kpi-tile--accent-neutral {
    /* Sentinel — applied when the underlying value is None (the
       headline tile literally has nothing to verdict). Same look as
       the base .nh-kpi-tile so the absence reads as "no data yet";
       icon stays in its neutral grey default. */
}

/* Hero verdict banner — single coloured strip above the KPI grid,
   answers "should I worry?" at a glance. Driven by the same
   resilient_positioning_pct the map cells aggregate against.
   Compact one-line layout: bold label + trailing summary on the
   same row, no stacked eyebrow row. Flat 1px border — no
   asymmetric thick edge (read as a bevel); the verdict pop comes
   from the bg tint + the label colour. */
.nh-verdict {
    border: 1px solid;
    border-radius: 0.5rem;
    padding: 0.625rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.625rem;
}
.nh-verdict-label {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--fs-md);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    flex-shrink: 0;
}
.nh-verdict-summary {
    font-size: var(--fs-base);
    color: var(--device-gray-700, var(--bg-sidebar-hover));
    margin: 0;
    flex: 1;
    min-width: 0;
}
.nh-verdict--robust {
    background: var(--status-online-bg);
    border-color: var(--status-online-fg);
}
.nh-verdict--robust .nh-verdict-label {
    color: var(--status-online-fg);
}
.nh-verdict--mixed {
    background: var(--banner-warning-bg);
    border-color: var(--status-warning-fg);
}
.nh-verdict--mixed .nh-verdict-label {
    color: var(--status-warning-fg);
}
.nh-verdict--fragile {
    background: var(--sev-high-bg);
    border-color: var(--danger-strong-fg);
}
.nh-verdict--fragile .nh-verdict-label {
    color: var(--danger-strong-fg);
}
.nh-verdict--unknown {
    background: var(--device-gray-50, var(--bg-page));
    border-color: var(--device-gray-300, var(--border-medium));
}
.nh-verdict--unknown .nh-verdict-label {
    color: var(--device-gray-600, var(--fg-3));
}

/* Org-page tenants table: on the shared table macro since 2026-10-31 (its
   sortable headers replaced the .nh-sort-btn buttons and their script).
   Only the per-row verdict pill colour variants live here. */
/* Per-row verdict pill — same palette the hero banner + map cells
   use, just shrunk for the table cell. */
.nh-org-tenants-pill {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: var(--fs-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.nh-org-tenants-pill--robust {
    background: var(--status-online-bg);
    color: var(--status-online-fg);
}
.nh-org-tenants-pill--mixed {
    background: var(--banner-warning-bg);
    color: var(--status-warning-fg);
}
.nh-org-tenants-pill--fragile {
    background: var(--sev-high-bg);
    color: var(--danger-strong-fg);
}
.nh-org-tenants-pill--unknown {
    background: var(--device-gray-100, var(--status-neutral-bg));
    color: var(--device-gray-600, var(--fg-3));
}

/* Phase-2 pill — mirrors the alert-map "Per-device disabled" affordance:
   visible-but-not-faked. Operator reads "we know this exists, it's not
   yet wired" without seeing a zero that could be misread as a real
   value. */
.nh-phase-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    background: var(--device-gray-100, var(--status-neutral-bg));
    color: var(--device-gray-600, var(--fg-3));
    font-size: var(--fs-2xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Map-area placeholder card — same dashed-border / muted-bg posture
   as the phase-2 KPI tiles. */
.nh-map-placeholder {
    background: var(--device-gray-50, var(--bg-page));
    border: 1px dashed var(--device-gray-300, var(--border-medium));
    border-radius: 0.75rem;
    padding: 2.5rem 1.25rem;
    text-align: center;
}
.nh-map-placeholder-inner {
    max-width: 38rem;
    margin: 0 auto;
}
.nh-map-placeholder-icon {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--device-gray-300, var(--border-medium));
    margin: 0 auto 0.75rem;
    display: block;
}
.nh-map-placeholder-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--fs-md);
    color: var(--device-gray-700, var(--bg-sidebar-hover));
    margin: 0 0 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.nh-map-placeholder-body {
    font-size: 0.8125rem;
    color: var(--device-gray-500, var(--fg-4));
    margin: 0;
    line-height: var(--lh-normal);
}
.nh-map-placeholder-actions {
    margin: 1rem 0 0;
    font-size: 0.8125rem;
}
.nh-redundancy-container {
    min-height: 540px;
    border: 1px solid var(--device-gray-200, var(--border-base));
    border-radius: 0.75rem;
    background: var(--bg-card);
    overflow: hidden;
}
/* Tenant Network Health: the map panel is exactly one scroll region tall,
   beside the summary rail, so the legend, the map and its footnote fill the
   view and the map takes whatever the legend leaves; nothing scrolls. A map
   must never sit in a box taller than its region: the wheel zooms the map, so
   a box scrolled from over it cannot be scrolled at all (the owner,
   2026-11-14). `height: 100%` resolves against the region, a flexed item of
   the page shell. The floor keeps a short window's map usable; below it the
   region scrolls, from its edge. */
.network-health-page .page-scroll > .nh-map-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.nh-map-panel > #networkRedundancySwapTarget {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.nh-map-panel #networkRedundancyControls,
.nh-map-panel .nh-heatmap-footnote {
    flex: 0 0 auto;
}
.nh-map-panel .nh-redundancy-container {
    flex: 1 1 auto;
    min-height: 360px;
}

/* Network Health History (FEAT-14). A chart box needs a height for Chart.js
   with maintainAspectRatio off; nh-history.js sets the same value inline. */
.nh-history-chart {
    position: relative;
    height: 200px;
}

/* The positioning map fills its scroll region, by the same rule (the owner,
   2026-11-14). It was a fixed 780px card in a region of 320-510px on the tenant
   dashboard, the gateway Map tab and the Positioning page, so the region
   scrolled and the wheel, zooming the map, could not scroll it. Every page that
   hosts the map is on the page shell, where the region is a bounded flex item.
   The 300px floor keeps a short window's map usable and lets the two hosts
   with the tallest chrome (the gateway Map tab, the device Positioning tab)
   fit a 1000px window; below it the region scrolls from its edge. The id
   outranks the template's 780px utility, the fallback for a host off the
   shell. */
.page-shell .page-scroll > #positioning-map {
    height: 100%;
    min-height: 300px;
}
.nh-heatmap-footnote {
    margin: 0.5rem 0 0;
    font-size: var(--fs-sm);
    color: var(--device-gray-500, var(--fg-4));
    text-align: right;
}

/* ============================================================
   Cluster Posterior tab (FE 1.4, v0.9.0) — tier hero, posterior
   bars, factor waterfall. Flat fills only (no bevels). Tokens
   from design-tokens.css.
   ============================================================ */

.dd-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

/* ── Tier hero ─────────────────────────────────────────────── */
.tier-hero {
    border: 1px solid var(--border-base);
    border-radius: 10px;
    padding: 16px 18px;
    background: var(--bg-page);
    margin-bottom: 16px;
}
.tier-hero-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.tier-hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 9999px;
    font-weight: var(--fw-semibold);
    border: 1px solid var(--border-base);
    color: var(--fg-2);
}
.tier-hero-pill .shape-i {
    display: inline-flex;
}
.tier-hero-pill.definitely {
    color: var(--color-brand-green);
    border-color: var(--color-brand-green);
}
.tier-hero-pill.probably {
    color: var(--sev-medium-fg);
    border-color: var(--sev-medium-fg);
}
.tier-hero-pill.weakly {
    color: var(--sev-high-fg);
    border-color: var(--sev-high-fg);
}
.tier-hero-pill.unclustered {
    color: var(--fg-4);
    border-color: var(--border-base);
}
.tier-hero-cluster-link {
    font-weight: var(--fw-semibold);
    color: var(--color-brand-green);
}
.tier-hero-confidence {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: var(--fs-lg, 1.125rem);
    color: var(--fg-1);
    text-align: right;
}
.tier-hero-confidence-sub {
    display: block;
    font-family: var(--font-base, inherit);
    font-size: var(--fs-xs);
    font-weight: 400;
    color: var(--fg-4);
}
.tier-hero-secondary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 22px;
    margin-top: 12px;
    font-size: var(--fs-sm);
    color: var(--fg-3);
}

/* ── Card with head ────────────────────────────────────────── */
.card-with-head {
    border: 1px solid var(--border-base);
    border-radius: 10px;
    margin-bottom: 16px;
    background: var(--bg-card);
}
.card-with-head .head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-base);
}
.card-with-head .head h3 {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--fg-1);
    margin: 0;
}
.card-with-head .head .sub {
    font-size: var(--fs-xs);
    color: var(--fg-4);
}
.card-with-head .body {
    padding: 14px 16px;
}

/* ── Posterior bars ────────────────────────────────────────── */
.posterior-row {
    display: grid;
    grid-template-columns: 22px 1fr 2fr 44px;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    font-size: var(--fs-sm);
}
.posterior-row .icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-page);
    color: var(--fg-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-xs);
    border: 1px solid var(--border-base);
}
.posterior-row.most-likely .icon {
    background: var(--color-brand-green);
    color: var(--fg-on-dark);
    border-color: var(--color-brand-green);
}
.posterior-row .name {
    font-weight: 500;
    color: var(--fg-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.posterior-row .name .muted {
    opacity: 0.7;
    font-style: italic;
}
.posterior-row.most-likely .name {
    color: var(--color-brand-green);
    font-weight: 600;
}
.posterior-row .bar {
    height: 8px;
    background: var(--bg-page);
    border-radius: 9999px;
    overflow: hidden;
}
.posterior-row .fill {
    height: 100%;
    /* Server-sent share, read from a custom property rather than written as a
       declaration in the markup. */
    width: var(--bar-pct, 0%);
    background: var(--sev-medium-fg);
    border-radius: 9999px;
}
.posterior-row.most-likely .fill {
    background: var(--color-brand-green);
}
.posterior-row.background .fill {
    background: var(--fg-5);
}
.posterior-row .pct {
    text-align: right;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: var(--fs-sm);
    color: var(--fg-1);
}
.posterior-entropy {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-base);
    font-size: var(--fs-xs);
    color: var(--fg-4);
}
.posterior-entropy .val {
    font-family: var(--font-mono);
    color: var(--fg-2);
    font-weight: 600;
}

/* ── Factor waterfall ──────────────────────────────────────── */
.waterfall-row {
    display: grid;
    grid-template-columns: 1fr 2fr 56px;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    font-size: var(--fs-sm);
}
.waterfall-row .label {
    color: var(--fg-2);
}
.waterfall-track {
    height: 8px;
    background: var(--bg-page);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}
.waterfall-fill {
    display: block;
    height: 100%;
    border-radius: 4px;
}
.waterfall-fill.pos {
    background: var(--color-brand-green);
}
.waterfall-fill.neg {
    background: var(--sev-high-fg);
}
.waterfall-row .val {
    text-align: right;
    font-family: var(--font-mono);
    font-weight: 700;
}
.waterfall-row .val.pos {
    color: var(--color-brand-green);
}
.waterfall-row .val.neg {
    color: var(--sev-high-fg);
}
.waterfall-total {
    display: grid;
    grid-template-columns: 1fr 56px;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-base);
    font-weight: var(--fw-semibold);
}
.waterfall-total .val {
    text-align: right;
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--fg-1);
}
.waterfall-footer {
    margin-top: 12px;
    font-size: var(--fs-xs);
    color: var(--fg-4);
}

/* ── Position quality (positioning rail) ────────────────────────────────────
   The method's own colour on a dot, the tier name muted beside its rank, and a
   confidence that reads as a figure rather than a boolean. Flat fills only. */
.pos-quality-method {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}
.pos-quality-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
    /* Set by .pos-method--{key} on the same element, the palette the fix trail
       also reads — one method is one colour across the tab. */
    background: var(--pos-tier-c, var(--fg-5));
}
.pos-quality-tier-name {
    display: block;
    font-size: var(--fs-xs);
    font-weight: 400;
    color: var(--fg-5);
}
.pos-quality-conf {
    font-variant-numeric: tabular-nums;
}
.pos-quality-conf.is-low {
    color: var(--status-warning-fg);
    font-weight: 600;
}
.pos-quality-conf.is-none {
    color: var(--fg-5);
}

/* ── Per-method colour (the fix trail) ──────────────────────────────────────
   ``.pos-method--{key}`` carries a method's colour as --pos-tier-c, which the
   Fix-quality trail's bars and its legend swatches read.

   These were defined with the tier chip and outlived it: the chip is gone, the
   trail still colours by method. Deleting them with the rest greyed the trail
   out through the var() fallback, silently — the design-drift gate caught it as
   an undefined token, which is exactly the failure that gate is for. */
.pos-method--none {
    --pos-tier-c: var(--fg-5);
} /* not computed */
.pos-method--radial {
    --pos-tier-c: var(--tier-rad);
} /* 1 gateway — blue */
.pos-method--bilateration {
    --pos-tier-c: var(--tier-bi);
} /* 2 gateways — orange */
.pos-method--trilateration {
    --pos-tier-c: var(--tier-tri);
} /* 3+ gateways — green */
.pos-method--cluster {
    --pos-tier-c: var(--tier-cluster);
} /* cluster prior — violet */
.pos-method--terrain {
    --pos-tier-c: var(--tier-terrain);
} /* terrain + habitat — teal (strongest) */

/* ── Placement caveats (positioning rail) ───────────────────────────────────
   Why a fix is uncertain, in the engine's own customer wording, beside the
   accuracy_m the Inspector reports (never a bare number). Calm, flat tints,
   1px borders, no bevels. Tone is the severity axis: review=red, caution=amber,
   info=neutral — a single-gateway fix is informational, never a warning. */
.pos-caveat {
    display: flex;
    /* Stacked, not side by side. As a row the severity pill took its nowrap
       width out of a narrow rail card and the sentence wrapped in whatever was
       left — one or two words per line, hugging one side. The pill is a label
       for the sentence, so it belongs above it. */
    flex-direction: column;
    /* Required by the column direction: `baseline` (and `stretch`) would pull
       the pill to the card's full width, turning a chip into a banner. */
    align-items: flex-start;
    gap: 6px;
    border: 1px solid var(--border-base);
    border-radius: 8px;
    padding: 7px 10px;
    margin-bottom: 6px;
}
.pos-caveat-sev {
    flex: none;
    font-size: var(--fs-xs); /* was 10.5px -> 11px */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px solid currentColor;
    white-space: nowrap;
}
.pos-caveat-text {
    font-size: var(--fs-sm); /* was 12.5px -> 12px */
    line-height: 1.45;
    color: var(--fg-body-strong);
}
.pos-caveat.is-review {
    border-color: var(--danger-soft-fg);
    background: var(--sev-high-bg);
}
.pos-caveat.is-review .pos-caveat-sev {
    color: var(--danger-strong-fg);
}
.pos-caveat.is-caution {
    border-color: var(--policy-looser-bg);
    background: var(--sev-medium-bg);
}
.pos-caveat.is-caution .pos-caveat-sev {
    color: var(--warning-strong-fg);
}
.pos-caveat.is-info {
    border-color: var(--border-base);
    background: var(--bg-page);
}
.pos-caveat.is-info .pos-caveat-sev {
    color: var(--fg-3);
}
.pos-caveat-more {
    margin-top: 2px;
}
.pos-caveat-more > summary {
    cursor: pointer;
    font-size: var(--fs-sm); /* was 11.5px -> 12px */
    font-weight: 600;
    color: var(--fg-4);
    padding: 2px 0 6px;
    list-style: none;
}
.pos-caveat-more > summary::-webkit-details-marker {
    display: none;
}
.pos-caveat-more > summary::before {
    content: "\25B8";
    display: inline-block;
    margin-right: 6px;
    transition: transform 0.12s ease;
}
.pos-caveat-more[open] > summary::before {
    transform: rotate(90deg);
}

.pos-tier-terrain-badge {
    display: inline-block;
    font-size: var(--fs-sm); /* was 11.5px -> 12px */
    font-weight: 600;
    color: var(--color-brand-green-hover);
    border: 1px solid var(--pos-terrain-border);
    border-radius: 8px;
    padding: 4px 9px;
    margin-bottom: 8px;
}
.pos-tier-cluster {
    font-size: var(--fs-sm); /* was 12.5px -> 12px */
    color: var(--fg-body-strong);
    margin-bottom: 8px;
}
.pos-tier-prov {
    font-family: ui-monospace, Menlo, monospace;
    font-size: var(--fs-xs);
    color: var(--fg-5);
}

/* ── Habitat & placement pills (device-class catalog metadata) ──────────────
   Flat fills, 1px borders, no bevels; per-value colour via the .dd-pp--<v>
   modifier. Mirrors design/03-device-habitat-placement-pills.html. */
.dd-pp-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.dd-pp {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: var(--fs-sm);
    font-weight: 500;
    padding: 2px 9px;
    border-radius: 999px;
    border: 1px solid var(--border-base);
    background: var(--bg-card);
    color: var(--fg-3);
    white-space: nowrap;
}
.dd-pp i {
    font-size: var(--fs-xs);
}
.dd-pp--land {
    background: var(--status-resolved-bg);
    color: var(--pos-land-fg);
    border-color: var(--flash-success-bg);
}
.dd-pp--water {
    background: var(--status-info-bg);
    color: var(--pos-water-fg);
    border-color: var(--info-bg);
}
.dd-pp--amph {
    background: var(--status-online-bg);
    color: var(--status-online-fg);
    border-color: var(--banner-soft-end);
}
.dd-pp--indoor {
    background: var(--row-highlight);
    color: var(--pos-indoor-fg);
    border-color: var(--pos-indoor-border);
}
.dd-pp--outdoor {
    background: var(--status-resolved-bg);
    color: var(--pos-land-fg);
    border-color: var(--flash-success-bg);
}
.dd-pp--mixed {
    background: var(--status-warning-bg);
    color: var(--status-warning-fg);
    border-color: var(--sev-medium-border);
}
.dd-pp--fixed {
    background: var(--status-neutral-bg);
    color: var(--fg-3);
    border-color: var(--border-base);
}
.dd-pp--nomadic {
    background: var(--status-warning-bg);
    color: var(--status-warning-fg);
    border-color: var(--sev-medium-border);
}
.dd-pp--mobile {
    background: var(--status-info-bg);
    color: var(--pos-water-fg);
    border-color: var(--info-bg);
}
.dd-pp--unknown {
    background: var(--bg-page);
    color: var(--fg-5);
    border-color: var(--border-base);
    border-style: dashed;
}

/* ── Positioning tier trail (device Positioning tab) ────────────────────────
   Sparkline of recent fixes over time; bar height = tier rank (the climb),
   colour = the pos-tier--<rank> ladder (shared with the chip). */
/* ── Narrowing chain ──────────────────────────────────────────────────────
   The funnel that explains one fix: every candidate cell the engine started
   with and the rule that removed each slice. Sits between the tier chip and
   the map, so it shares the chip's card shape rather than inventing one.

   Each row's two segments are sized by the view model against the STARTING
   count, not the step's own input — otherwise a step halving 40 cells would
   draw wider than the one that removed 3,000. */
.pos-narrowing {
    border: 1px solid var(--border-base);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    padding: 12px 16px 14px;
    margin-bottom: 16px;
}
.pos-narrowing-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.pos-narrowing-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: var(--fs-base);
    color: var(--fg-1);
}
.pos-narrowing-sub {
    font-size: var(--fs-sm);
    color: var(--fg-5);
    font-variant-numeric: tabular-nums;
}
.pos-narrowing-headline {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.pos-narrowing-big {
    font-family: var(--font-display);
    font-size: var(--fs-lg);
    font-variant-numeric: tabular-nums;
    color: var(--fg-1);
}
.pos-narrowing-arrow,
.pos-narrowing-pct {
    font-size: var(--fs-sm);
    color: var(--fg-5);
}
.pos-narrowing-steps {
    list-style: none;
    margin: 0;
    padding: 0;
}
.pos-narrowing-step {
    display: grid;
    grid-template-columns: 26px 1fr;
    gap: 10px;
    padding: 6px 0;
    border-top: 1px solid var(--border-base);
}
.pos-narrowing-step:first-child {
    border-top: 0;
}
.pos-narrowing-ord {
    font-size: var(--fs-xs);
    color: var(--fg-5);
    font-variant-numeric: tabular-nums;
    padding-top: 4px;
}
.pos-narrowing-bar {
    position: relative;
    display: block;
    height: 20px;
    border-radius: var(--radius-xs);
    background: var(--status-neutral-bg);
    overflow: hidden;
}
/* Survivors then removed, left to right: the eye reads the bar as the set
   shrinking rather than as two unrelated quantities. */
.pos-narrowing-kept {
    position: absolute;
    inset: 0;
    width: var(--keep-pct, 0%);
    background: var(--color-brand-green);
}
.pos-narrowing-cut {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--keep-pct, 0%);
    width: var(--cut-pct, 0%);
    background: var(--status-neutral-fg);
}
.pos-narrowing-lbl {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 3px;
    font-size: var(--fs-sm);
}
.pos-narrowing-name {
    font-weight: 600;
    color: var(--fg-1);
}
.pos-narrowing-nums {
    color: var(--fg-5);
    font-variant-numeric: tabular-nums;
}
.pos-narrowing-why {
    color: var(--fg-5);
    font-size: var(--fs-xs);
}
/* A step that declined to empty the set is rare and consequential, so it
   reads at danger weight rather than as another grey note. */
.pos-narrowing-refused {
    color: var(--status-danger-fg);
    font-size: var(--fs-xs);
    font-weight: 600;
}
/* A rule that COULD have excluded ground and found none is still worth seeing —
   dimmed, not hidden. Applies to hard steps only: a ranking step removes nothing
   by design, and dimming those said the chain's strongest lever was inert. */
.pos-narrowing-step--noop .pos-narrowing-name {
    color: var(--fg-5);
    font-weight: 500;
}
.pos-narrowing-foot {
    margin: 10px 0 0;
    font-size: var(--fs-sm);
    color: var(--fg-5);
}

.pos-trail {
    border: 1px solid var(--border-base);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    padding: 12px 16px 14px;
    margin-bottom: 16px;
}
.pos-trail-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}
.pos-trail-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: var(--fs-base);
    color: var(--fg-1);
}
.pos-trail-sub {
    font-size: var(--fs-sm); /* was 11.5px -> 12px */
    color: var(--fg-5);
    font-variant-numeric: tabular-nums;
}
.pos-trail-track {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    /* Half the original 64px. The bars carry one variable — accuracy scaled
       across the series — so halving costs travel, not meaning: 22px of range
       instead of 44px. The overall shape survives; differences between adjacent
       fixes stop being readable, which is the accepted trade for 84px of a
       page whose subject is the map. */
    height: 32px;
    overflow-x: auto;
}
.pos-trail-bar {
    flex: 1 0 4px;
    min-width: 4px;
    border-radius: 2px 2px 0 0;
    background: var(--pos-tier-c, var(--fg-5));
    /* Floor keeps the worst fix visible; a zero-height bar reads as missing
       data rather than as the widest reading in the series. Halved with the
       track so the proportions are unchanged. */
    height: calc(7px + var(--q, 0) * 22px);
}

/* The bar heights are relative to this device's own best and worst fix, so
   the scale is printed under the track. */
.pos-trail-scale {
    margin: 8px 0 0;
    font-size: var(--fs-sm);
    color: var(--fg-5);
    font-variant-numeric: tabular-nums;
}

/* Colour key beneath the trail — reads the same method palette as the bars,
   so the operator never has to hover to learn what a colour means. */
.pos-trail-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    margin-top: 12px;
    font-size: var(--fs-sm); /* was 11.5px -> 12px */
    color: var(--fg-4); /* muted */
}
.pos-trail-key {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.pos-trail-sw {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: var(--pos-tier-c, var(--fg-5));
    flex: 0 0 10px;
}
.pos-trail-legend .link-glossary {
    margin-left: auto;
}

/* ── Per-gateway colour coding (device Activity/Signal) ───────────────────────
   Gateway EUIs differ by one character, so colour is the real differentiator.
   ``--gw`` carries the gateway's chart-palette colour (set inline); the dot +
   pill outline use it so the rail card, receptions table and signal chart stay
   colour-matched for the same gateway. */
.dd-gw-swatch {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--gw, var(--fg-3));
    flex: 0 0 9px;
}
.dd-gw-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 9999px;
    border: 1.5px solid var(--gw, var(--border-base));
    background: var(--bg-card);
    font-size: var(--fs-sm);
    color: var(--bg-sidebar);
    white-space: nowrap;
}
/* The rail gateway name is a green internal link; keep that colour even though
   it sits inside the card-wide anchor, and let the colour dot sit before it. */
.dd-rail-gateway .dd-rail-gateway-name.link-internal {
    color: var(--link-internal-fg);
}

/* Last-activity staleness colour coding. act-fresh keeps the default ink; only
   a stale (>24h, amber) or old (>7d, red) device draws the eye. */
.act-stale {
    color: var(--status-warning-fg);
}
.act-old {
    color: var(--status-danger-fg);
}
.act-never {
    color: var(--fg-5);
}

/* ── Gateway calibration state pill (v0.10.5) ─────────────────────────────
   The calibration-state badge, shared by the gateway list state column and the
   detail Configuration card's "Calibration" row (the card itself is the shared
   info_panel chrome). Flat fills only — bordered tint pills, no
   bevels/shadows/gradients. Icon + label, never colour alone (house rule). */
.cal-state {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: 9999px;
    border: 1px solid transparent;
    font-size: var(--fs-sm);
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}
.cal-state i {
    font-size: var(--fs-xs);
}
.cal-tone-success {
    background: var(--status-online-bg);
    border-color: var(--policy-stricter-bg);
    color: var(--color-brand-green-deep);
}
.cal-tone-warning {
    background: var(--banner-warning-bg);
    border-color: var(--banner-warning-border);
    color: var(--warning-strong-fg);
}
.cal-tone-muted {
    background: var(--status-neutral-bg);
    border-color: var(--border-base);
    color: var(--fg-4);
}
.cal-tone-neutral {
    background: var(--bg-page);
    border-color: var(--border-base);
    border-style: dashed;
    color: var(--fg-5);
}

/* ── Predicted-cell breakdown (positioning-map-breakdown.js) ────────────
   The 49 stored r11 rows inside one drawn r9 hexagon, in the 240 px rail.
   Authored against the 210 px content box (.dd-rail-card-body's padding), so
   every width here is a fraction and nothing assumes a wider column.

   At 49 cells each hex is ~28 px, which is under the 44 px touch target. That
   is accepted rather than solved by paging or zooming: the grid's job is to
   show the WHOLE cell at once — a paged grid would hide exactly the thing it
   exists to reveal. Below 1100 px the stage collapses to one column and the
   rail goes full width, so the touch case gets the larger rendering.

   Colours come from the --device-gray-* scale and --color-brand-green already
   in this sheet. The only new values are the metric ramp, which lives in JS
   (BREAKDOWN_RAMP) because it is data-driven, not chrome. */
/* First block in the inspector, so no top rule or gap — the divider belongs
   BELOW it, separating the grid from the summary it explains. */
.pm-bd {
    margin-bottom: 0.75rem;
    padding-bottom: 0.625rem;
    border-bottom: 1px solid var(--device-gray-100);
}
.pm-bd-h {
    margin: 0;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--device-gray-900);
}
.pm-bd-sub {
    margin: 0.125rem 0 0.5rem;
    font-size: var(--fs-xs);
    line-height: 1.45;
    color: var(--device-gray-500);
}
.pm-bd-metric {
    width: 100%;
    margin-bottom: 0.5rem;
    padding: 0.3125rem 0.4375rem;
    font: inherit;
    font-size: var(--fs-sm);
    color: var(--device-gray-900);
    background: var(--bg-card);
    border: 1px solid var(--device-gray-200);
    border-radius: 0.375rem;
}
.pm-bd-metric:focus-visible {
    outline: 2px solid var(--color-brand-green);
    outline-offset: 1px;
}
.pm-bd-comb {
    display: block;
    width: 100%;
    height: auto;
}
/* Stroke is the card background, so adjacent cells read as separate hexes
   without a border colour competing with the fill. */
.pm-bd-hx {
    stroke: var(--gw-marker-halo);
    stroke-width: 0.5;
    cursor: pointer;
}
/* A cell the read never returned: outline only, so a partial hexagon looks
   partial. Drawing it filled — or omitting it — would both say the read
   covered ground it did not. */
.pm-bd-hx.is-absent {
    fill: none;
    stroke: var(--device-gray-300);
    stroke-width: 0.4;
    stroke-dasharray: 1 1;
    cursor: default;
}
.pm-bd-hx:hover {
    opacity: 0.7;
}
.pm-bd-hx:focus-visible,
.pm-bd-hx.is-selected {
    outline: none;
    stroke: var(--device-gray-900);
    stroke-width: 1.4;
}
/* The row the rollup printed as the whole hexagon's value. */
.pm-bd-crown {
    fill: none;
    stroke: var(--device-gray-900);
    stroke-width: 1;
    pointer-events: none;
}
.pm-bd-legend {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0.375rem 0 0;
    font-size: var(--fs-2xs);
    line-height: 1.45;
    color: var(--device-gray-500);
}
.pm-bd-dot {
    flex: none;
    width: 0.375rem;
    height: 0.375rem;
    border: 1px solid var(--device-gray-900);
    border-radius: 9999px;
}
/* The gradient strip. An earlier revision printed the range as text only, so
   the ramp the cells were painted with was never actually shown. */
.pm-bd-rampbar {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin: 0.375rem 0 0;
}
.pm-bd-strip {
    flex: 1;
    min-width: 3.75rem;
    height: 0.4375rem;
    border-radius: 0.25rem;
}
/* A field whose spread is below its epsilon: greyed, because drawing a live
   gradient over 0.00006 of variation is the map overstating what it knows. */
.pm-bd-strip.is-flat {
    background: var(--device-gray-300);
}
.pm-bd-end {
    font-size: 0.5625rem;
    font-variant-numeric: tabular-nums;
    color: var(--device-gray-500);
    white-space: nowrap;
}
.pm-bd-flat {
    margin: 0.25rem 0 0;
    font-size: 0.5625rem;
    font-style: italic;
    line-height: 1.4;
    color: var(--device-gray-500);
}
.pm-bd-sect {
    margin: 0.5rem 0 0.25rem;
    font-size: 0.5625rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--device-gray-500);
}
/* Range bar: the span across all children, marked where this one falls. Not a
   min/median/max bar — a child here is ONE row, so the question is how it
   compares to its siblings, not how varied it is inside itself. */
.pm-bd-row {
    margin-bottom: 0.4375rem;
}
.pm-bd-row-h {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.125rem;
    font-size: var(--fs-2xs);
    color: var(--device-gray-500);
}
/* The zone a value falls in, beside its label — the colour's meaning in
   words, so the strip is not the only way to read the grid. */
.pm-bd-zone {
    font-style: normal;
    font-size: 0.5625rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--device-gray-400);
}
.pm-bd-row-h b {
    font-size: var(--fs-xs);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--device-gray-900);
}
.pm-bd-row.is-active .pm-bd-row-h {
    color: var(--color-brand-green-deep);
}
.pm-bd-track {
    position: relative;
    height: 0.375rem;
    border-radius: 0.1875rem;
    background: var(--device-gray-100);
}
.pm-bd-fill {
    position: absolute;
    inset: 0;
    border-radius: 0.1875rem;
    background: var(--color-brand-green);
    opacity: 0.28;
}
.pm-bd-mark {
    /* The marker's position is the datum; the renderer hands it over as
       --pm-bd-at rather than writing a left rule from JS. */
    left: calc(var(--pm-bd-at, 0%) - 1px);
    position: absolute;
    top: -0.125rem;
    width: 2px;
    height: 0.625rem;
    border-radius: 1px;
    background: var(--color-brand-green-hover);
}
/* A flat field gets a hatched empty track: there is no position to mark, and a
   marker at an arbitrary point would invent one. */
.pm-bd-row.is-flat .pm-bd-track {
    background: repeating-linear-gradient(
        90deg,
        var(--device-gray-100) 0 3px,
        transparent 3px 6px
    );
}
.pm-bd-ends {
    display: flex;
    justify-content: space-between;
    margin-top: 0.0625rem;
    font-size: 0.5625rem;
    font-variant-numeric: tabular-nums;
    color: var(--device-gray-500);
}
.pm-bd-tag {
    margin-left: 0.3125rem;
    padding: 0.0625rem 0.3125rem;
    font-size: 0.5rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: 0.0625rem;
    color: var(--device-gray-700);
    border: 1px solid var(--device-gray-300);
    border-radius: 9999px;
}
.pm-bd-child {
    margin: 0.625rem 0 0;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--device-gray-900);
}
.pm-bd-id {
    margin: 0.0625rem 0 0.375rem;
    font-size: var(--fs-2xs);
    color: var(--device-gray-500);
    overflow-wrap: anywhere;
}
.pm-bd-hint,
.pm-bd-note {
    margin: 0.25rem 0 0;
    font-size: var(--fs-2xs);
    line-height: 1.45;
    color: var(--device-gray-500);
}
.pm-bd-hint {
    font-style: italic;
}
@media (prefers-reduced-motion: no-preference) {
    .pm-bd-hx {
        transition: opacity 0.12s ease;
    }
}

/* A dot-plus-count run inside a detail header, e.g. "* 3 active". */
.dd-inline-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* The aux figure in a rail card header, at normal weight. The header is bold
   display type; a running total beside it is not a heading. The call site used
   to write font-weight inline and restate text-transform and letter-spacing
   that .dd-rail-card-header-aux already sets. */
.dd-rail-card-header-aux--light {
    font-weight: 500;
}

/* ─── Cell-density strip (gateway Config → Terrain grain) ──────────────────
   One segment per H3 resolution, WIDTH SET BY SHARE OF AREA rather than by
   cell count. The width arrives as a custom property because it is a datum,
   not a style: an R9 cell is 49x an R11, so a count-sized strip would show
   the fine-grained core swallowing a disk it barely covers — the exact
   inverse of the truth this panel exists to state.

   Flat fills, no gradient: the strip is a measurement, and a bevel on a
   measurement implies a precision it does not have. */
.density-seg {
    width: var(--seg-share, 0%);
    background: var(--fg-4);
    /* A hairline so two adjacent segments of similar weight stay countable. */
    box-sizing: border-box;
    border-right: 1px solid var(--bg-card);
}

.density-seg:last-child {
    border-right: 0;
}

/* Coarse → fine reads light → dark, so the eye ranks grain without the
   legend. Only the three resolutions the terrain pipeline emits are named;
   anything else keeps the neutral base fill above rather than borrowing a
   colour that would imply a grain it does not have. */
.density-seg-9 {
    background: var(--color-brand-green-300);
}

.density-seg-10 {
    background: var(--chart-green-deep);
}

.density-seg-11 {
    background: var(--chart-green-darkest);
}
