/* ==========================================================================
   CORRIDOR MAP SERVICE
   Drop-in dual-track geospatial map. Self-contained so any page can adopt it
   with one <link>; inherits the Fluent design tokens from style.css when that
   is also loaded, and falls back to literals when it is not.
   ========================================================================== */

.cmap-shell {
    position: relative;
    isolation: isolate;          /* keeps the Leaflet canvas under page modals */
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    background: var(--bg-surface, #fff);
    overflow: hidden;
}

.cmap-canvas {
    width: 100%;
    height: 440px;
    background: #0f172a;
}

.cmap-canvas.is-tall { height: 530px; }

/* Leaflet paints its own stacking contexts; keep them below app modals. */
.cmap-shell .leaflet-pane,
.cmap-shell .leaflet-top,
.cmap-shell .leaflet-bottom { z-index: 400; }


/* --------------------------------------------------------------------------
   Toolbar: basemap switch, layer toggles, station quick-jump
   -------------------------------------------------------------------------- */

.cmap-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-surface-subtle, #f1f5f9);
}

.cmap-toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cmap-toolbar-sep {
    width: 1px;
    align-self: stretch;
    background: var(--border-medium, #cbd5e1);
    margin: 2px 4px;
}

.cmap-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    font-family: var(--font-main, 'Inter', sans-serif);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary, #334155);
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-xs, 4px);
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    white-space: nowrap;
}

.cmap-btn:hover {
    background: var(--bg-surface-hover, #e2e8f0);
    border-color: var(--border-medium, #cbd5e1);
}

.cmap-btn.is-active {
    background: var(--color-primary, #0f2b5c);
    border-color: var(--color-primary, #0f2b5c);
    color: #fff;
}

/* Layer toggles carry their layer's colour as a leading dot. */
.cmap-layer-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
    background: currentColor;
}

.cmap-chip-rail {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-surface, #fff);
    scrollbar-width: thin;
}

.cmap-chip {
    padding: 3px 8px;
    font-family: var(--font-mono, monospace);
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary, #334155);
    background: var(--bg-surface-subtle, #f1f5f9);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
}

.cmap-chip:hover { background: var(--bg-surface-hover, #e2e8f0); }

.cmap-chip.is-active {
    background: var(--color-primary, #0f2b5c);
    border-color: var(--color-primary, #0f2b5c);
    color: #fff;
}


/* --------------------------------------------------------------------------
   Legend
   -------------------------------------------------------------------------- */

.cmap-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 7px 10px;
    border-top: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-surface-subtle, #f1f5f9);
    font-size: 0.68rem;
    color: var(--text-muted, #64748b);
}

.cmap-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.cmap-legend-rail {
    width: 16px;
    height: 3px;
    border-radius: 2px;
    flex: none;
}

.cmap-legend-count {
    margin-left: auto;
    font-family: var(--font-mono, monospace);
    font-size: 0.66rem;
    color: var(--text-subtle, #94a3b8);
}


/* --------------------------------------------------------------------------
   Station beacons (sit on the centreline, bridging both rails)
   -------------------------------------------------------------------------- */

.cmap-station-icon { background: none !important; border: none !important; }

.cmap-station {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.cmap-station-core {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 16px;
    padding: 0 4px;
    font-family: var(--font-mono, monospace);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: .3px;
    color: #fff;
    background: #0f172a;
    border: 1.5px solid #f8fafc;
    border-radius: 3px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .5);
    white-space: nowrap;
    transition: transform .15s ease;
}

/* Stagger adjacent station labels vertically to eliminate overlapping collision blobs */
.cmap-station:nth-child(odd) .cmap-station-core {
    transform: translateY(-9px);
}
.cmap-station:nth-child(even) .cmap-station-core {
    transform: translateY(9px);
}
.cmap-station:hover .cmap-station-core {
    z-index: 999;
    transform: scale(1.15);
}

.cmap-station-tick {
    position: absolute;
    width: 2px;
    background: #f8fafc;
    opacity: .85;
}


/* --------------------------------------------------------------------------
   Feature markers. Severity drives the colour across every layer.
   -------------------------------------------------------------------------- */

.cmap-marker-icon { background: none !important; border: none !important; }

.cmap-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    font-size: 11px;
    line-height: 1;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 1px 5px rgba(0, 0, 0, .45);
    cursor: pointer;
    transition: transform .12s ease;
}

.cmap-marker:hover { transform: scale(1.25); }

.cmap-sev-critical { background: #dc2626; }
.cmap-sev-high     { background: #d97706; }
.cmap-sev-medium   { background: #2563eb; }
.cmap-sev-low      { background: #059669; }

/* A block that is actually running gets a pulsing ring so it reads as live. */
.cmap-marker.is-running { animation: cmap-pulse 1.8s ease-out infinite; }

@keyframes cmap-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(220, 38, 38, .65); }
    70%  { box-shadow: 0 0 0 12px rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}


/* --------------------------------------------------------------------------
   Trains
   -------------------------------------------------------------------------- */

.cmap-train-icon { background: none !important; border: none !important; }

/* Leaflet repositions markers via transform, so transitioning transform is what
   turns a 5-second poll into continuous motion. */
.cmap-train-icon.leaflet-marker-icon {
    transition: transform 1.2s linear;
    will-change: transform;
}

.cmap-train {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 10px;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, .5);
}

.cmap-train.premium   { background: #7c3aed; }
.cmap-train.express   { background: #0891b2; }
.cmap-train.passenger { background: #475569; }
.cmap-train.freight   { background: #78716c; }
.cmap-train.is-halted { opacity: .6; }


/* --------------------------------------------------------------------------
   Hover card + popup
   -------------------------------------------------------------------------- */

.cmap-tooltip {
    padding: 0 !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

.cmap-tooltip::before { display: none !important; }

.cmap-card {
    width: 268px;
    font-family: var(--font-main, 'Inter', sans-serif);
    color: #f8fafc;
    background: rgba(15, 23, 42, .96);
    border: 1px solid rgba(148, 163, 184, .3);
    border-radius: var(--radius-sm, 6px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
    overflow: hidden;
}

.cmap-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(148, 163, 184, .22);
}

.cmap-card-title {
    margin: 0;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.3;
}

.cmap-card-sub {
    display: block;
    margin-top: 2px;
    font-size: 0.66rem;
    color: #94a3b8;
}

.cmap-card-sev {
    flex: none;
    padding: 2px 6px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: .3px;
    color: #fff;
    border-radius: 3px;
}

.cmap-card-body { padding: 8px 10px; }

.cmap-card.is-compact { width: 232px; }

.cmap-card-hint {
    margin-top: 7px;
    padding-top: 6px;
    border-top: 1px solid rgba(148, 163, 184, .18);
    font-size: 0.62rem;
    color: #64748b;
    text-align: center;
}

.cmap-card-rows {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 3px 10px;
    font-size: 0.68rem;
}

.cmap-card-key { color: #94a3b8; }

.cmap-card-val {
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.cmap-card-desc {
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px solid rgba(148, 163, 184, .2);
    font-size: 0.68rem;
    line-height: 1.45;
    color: #cbd5e1;
}

.cmap-card-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 7px;
}

.cmap-flag {
    padding: 2px 6px;
    font-size: 0.6rem;
    font-weight: 600;
    border-radius: 3px;
    background: rgba(148, 163, 184, .18);
    color: #e2e8f0;
}

.cmap-flag.is-power { background: rgba(217, 119, 6, .25); color: #fcd34d; }
.cmap-flag.is-disc  { background: rgba(5, 150, 105, .25); color: #6ee7b7; }

/* Attachment thumbnails inside the popup */
.cmap-card-atts {
    display: flex;
    gap: 5px;
    margin-top: 8px;
}

.cmap-att {
    width: 42px;
    height: 32px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid rgba(148, 163, 184, .35);
    cursor: pointer;
    background: rgba(148, 163, 184, .15);
}

.cmap-att:hover { border-color: #38bdf8; }

.cmap-att-pdf {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.cmap-card-actions {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    border-top: 1px solid rgba(148, 163, 184, .22);
    background: rgba(2, 6, 23, .5);
}

.cmap-action {
    flex: 1;
    padding: 5px 8px;
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    color: #e2e8f0;
    background: rgba(148, 163, 184, .16);
    border: 1px solid rgba(148, 163, 184, .3);
    border-radius: var(--radius-xs, 4px);
    cursor: pointer;
}

.cmap-action:hover { background: rgba(148, 163, 184, .28); }

.cmap-action.is-primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.cmap-action.is-primary:hover { background: #1d4ed8; }

/* Leaflet's own popup chrome, restyled to match the card */
.cmap-popup .leaflet-popup-content-wrapper {
    padding: 0;
    background: none;
    box-shadow: none;
    border-radius: var(--radius-sm, 6px);
}

.cmap-popup .leaflet-popup-content { margin: 0; width: auto !important; }
.cmap-popup .leaflet-popup-tip { background: rgba(15, 23, 42, .96); }
.cmap-popup a.leaflet-popup-close-button { color: #94a3b8; }


/* --------------------------------------------------------------------------
   Per-system health table (SMMS)
   -------------------------------------------------------------------------- */

.cmap-health-table {
    width: 100%;
    margin-top: 7px;
    border-collapse: collapse;
    font-size: 0.66rem;
}

.cmap-health-table th {
    padding: 3px 4px;
    text-align: left;
    font-weight: 600;
    color: #94a3b8;
    border-bottom: 1px solid rgba(148, 163, 184, .22);
}

.cmap-health-table td {
    padding: 3px 4px;
    border-bottom: 1px solid rgba(148, 163, 184, .1);
    font-variant-numeric: tabular-nums;
}

.cmap-health-table td:last-child,
.cmap-health-table th:last-child { text-align: right; }

.cmap-health-pill {
    display: inline-block;
    min-width: 34px;
    padding: 1px 5px;
    text-align: center;
    font-weight: 700;
    border-radius: 3px;
    color: #fff;
}


/* --------------------------------------------------------------------------
   Empty / loading state
   -------------------------------------------------------------------------- */

.cmap-status {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 500;
    padding: 8px 14px;
    font-size: 0.72rem;
    color: #cbd5e1;
    background: rgba(15, 23, 42, .88);
    border: 1px solid rgba(148, 163, 184, .3);
    border-radius: var(--radius-sm, 6px);
    pointer-events: none;
}

.cmap-status[hidden] { display: none !important; }


/* ==========================================================================
   OVERLAY CHROME  (chrome: "overlay")
   One floating command bar over a full-bleed canvas. A layout-animated pill
   slides behind the active trigger, a single viewport morphs to whichever
   panel is open, and panel content slides in from the side it was reached
   from. Nothing here touches the inline chrome above.
   ========================================================================== */

.cmap-shell.is-overlay {
    --cmap-accent:  #2563eb;
    --cmap-surface: rgba(15, 23, 42, .84);
    --cmap-line:    rgba(148, 163, 184, .28);
    --cmap-radius:  9px;
    --cmap-blur:    14px;
    /* Spring 350/32, bounce 0: critically damped, settles in ~420ms. */
    --cmap-spring:  420ms cubic-bezier(.22, 1, .36, 1);
    /* The indicator arrow rides a stiffer spring (400/20). */
    --cmap-snap:    300ms cubic-bezier(.16, 1.2, .3, 1);

    background: #0b1220;
    border: none;
    border-radius: 0;
}

.cmap-shell.is-overlay,
.cmap-shell.is-overlay * { box-sizing: border-box; }

.cmap-shell.is-overlay .cmap-canvas {
    height: 100%;
    background: #0b1220;
}

/* The overlay never eats a map gesture; only its own controls do. */
.cmap-overlay {
    position: absolute;
    inset: 0;
    z-index: 450;
    pointer-events: none;
    font-family: var(--font-main, 'Inter', sans-serif);
}

.cmap-overlay > * { pointer-events: auto; }
.cmap-overlay .cmap-status { pointer-events: none; }


/* --- command bar ---------------------------------------------------------- */

.cmap-bar-wrap {
    position: absolute;
    left: 14px;
    top: 14px;
}

.cmap-bar {
    display: flex;
    align-items: center;
    height: 38px;
    padding: 0 5px;
    background: var(--cmap-surface);
    backdrop-filter: blur(var(--cmap-blur));
    -webkit-backdrop-filter: blur(var(--cmap-blur));
    border: 1px solid var(--cmap-line);
    border-radius: var(--cmap-radius);
    box-shadow: 0 8px 26px rgba(0, 0, 0, .45);
}

.cmap-bar-sep {
    width: 1px;
    height: 20px;
    margin: 0 7px;
    background: rgba(148, 163, 184, .3);
}

.cmap-bar-btn,
.cmap-trig {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 28px;
    padding: 0 11px;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: .01em;
    color: #cbd5e1;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: color .15s ease;
}

.cmap-bar-btn:hover,
.cmap-trig:hover,
.cmap-trig.is-active { color: #ffffff; }

.cmap-trigs {
    position: relative;
    display: flex;
    align-items: center;
    gap: 2px;
}

.cmap-trig { position: relative; z-index: 1; }

.cmap-chev {
    flex: none;
    transition: transform var(--cmap-snap);
}

.cmap-trig.is-active .cmap-chev { transform: rotate(180deg); }

/* The layout-animated pill: one element that slides between triggers. */
.cmap-pill {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 28px;
    border-radius: 6px;
    background: var(--cmap-accent);
    box-shadow: 0 2px 10px color-mix(in srgb, var(--cmap-accent) 40%, transparent);
    opacity: 0;
    transition: left var(--cmap-spring), width var(--cmap-spring), opacity .2s ease;
}

/* The arrow that ties the viewport to its trigger. */
.cmap-arrow {
    position: absolute;
    top: 38px;
    left: 0;
    width: 9px;
    height: 9px;
    transform: rotate(45deg);
    background: rgba(15, 23, 42, .94);
    border-left: 1px solid var(--cmap-line);
    border-top: 1px solid var(--cmap-line);
    opacity: 0;
    z-index: 3;
    transition: left var(--cmap-snap), opacity .16s ease;
}


/* --- morphing viewport ---------------------------------------------------- */

.cmap-viewport {
    margin-top: 9px;
    overflow: hidden;
    background: rgba(15, 23, 42, .93);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--cmap-line);
    border-radius: 10px;
    box-shadow: 0 16px 44px rgba(0, 0, 0, .5);
    transition: width var(--cmap-spring), height var(--cmap-spring), opacity .2s ease;
}

.cmap-viewport[hidden] { display: none !important; }

.cmap-panel {
    padding: 12px 13px;
    color: #e2e8f0;
}

.cmap-panel.is-from-right { animation: cmap-from-right 300ms cubic-bezier(.22, 1, .36, 1) both; }
.cmap-panel.is-from-left  { animation: cmap-from-left  300ms cubic-bezier(.22, 1, .36, 1) both; }

@keyframes cmap-from-right {
    from { opacity: 0; transform: translateX(28px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes cmap-from-left {
    from { opacity: 0; transform: translateX(-28px); }
    to   { opacity: 1; transform: translateX(0); }
}

.cmap-panel-head {
    display: flex;
    align-items: center;
    margin-bottom: 9px;
}

.cmap-panel-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: #94a3b8;
}

.cmap-panel-label + .cmap-tiles,
.cmap-panel-label + .cmap-schips,
.cmap-panel-label + .cmap-toggle,
.cmap-panel-label + .cmap-polls { margin-top: 9px; }

.cmap-toggle + .cmap-panel-label { margin-top: 12px; }

.cmap-panel-meta {
    margin-left: auto;
    font-family: var(--font-mono, monospace);
    font-size: 0.6rem;
    font-weight: 600;
    color: #64748b;
}

/* Basemap tiles */
.cmap-tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.cmap-tile {
    padding: 0;
    overflow: hidden;
    background: #0b1220;
    border: 1.5px solid rgba(148, 163, 184, .22);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: border-color .15s ease;
}

.cmap-tile.is-active { border-color: var(--cmap-accent); }

.cmap-tile-swatch { display: block; height: 54px; }
.cmap-tile-swatch.is-satellite { background: linear-gradient(135deg, #2f3d2a 0%, #4a5236 38%, #6b6a44 62%, #3b4a3a 100%); }
.cmap-tile-swatch.is-dark      { background: linear-gradient(135deg, #0b1220 0%, #16233a 55%, #1e2f4a 100%); }

.cmap-tile-name {
    display: block;
    padding: 6px 9px;
    font-size: 0.68rem;
    font-weight: 600;
    color: #94a3b8;
    background: rgba(148, 163, 184, .1);
}

.cmap-tile.is-active .cmap-tile-name { color: #ffffff; }

/* Layer rows */
.cmap-lgrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
}

.cmap-lrow {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 9px;
    font-family: inherit;
    color: #64748b;
    background: transparent;
    border: 1px solid rgba(148, 163, 184, .14);
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    transition: background .14s ease, border-color .14s ease, color .14s ease;
}

.cmap-lrow:hover { background: rgba(148, 163, 184, .14); }

.cmap-lrow.is-active {
    color: #f1f5f9;
    background: rgba(148, 163, 184, .16);
    border-color: rgba(148, 163, 184, .34);
}

.cmap-lrow-g {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 16px;
    height: 16px;
    font-family: var(--font-mono, monospace);
    font-size: 0.56rem;
    font-weight: 700;
    color: var(--lc);
    background: rgba(148, 163, 184, .14);
    border-radius: 4px;
}

.cmap-lrow.is-active .cmap-lrow-g { background: color-mix(in srgb, var(--lc) 20%, transparent); }

.cmap-lrow-t {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-size: 0.68rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cmap-lrow-n {
    font-family: var(--font-mono, monospace);
    font-size: 0.62rem;
    font-weight: 700;
    color: #475569;
}

.cmap-lrow.is-active .cmap-lrow-n { color: var(--lc); }

/* Station chips */
.cmap-schips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.cmap-schip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 30px;
    padding: 0 11px;
    font-family: var(--font-mono, monospace);
    color: #e2e8f0;
    background: rgba(148, 163, 184, .12);
    border: 1px solid rgba(148, 163, 184, .24);
    border-radius: 6px;
    cursor: pointer;
    transition: background .14s ease, border-color .14s ease;
}

.cmap-schip:hover { background: rgba(148, 163, 184, .2); }

.cmap-schip.is-active {
    color: #ffffff;
    background: var(--cmap-accent);
    border-color: var(--cmap-accent);
}

.cmap-schip-c  { font-size: 0.68rem; font-weight: 700; }
.cmap-schip-km { font-size: 0.6rem; font-weight: 600; color: #64748b; }
.cmap-schip.is-active .cmap-schip-km { color: rgba(255, 255, 255, .75); }

/* Live panel */
.cmap-toggle {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    height: 34px;
    padding: 0 10px;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    color: #e2e8f0;
    background: transparent;
    border: 1px solid rgba(148, 163, 184, .16);
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
}

.cmap-toggle.is-on {
    background: rgba(148, 163, 184, .16);
    border-color: rgba(148, 163, 184, .34);
}

.cmap-switch {
    position: relative;
    display: block;
    flex: none;
    width: 32px;
    height: 18px;
    margin-left: auto;
    border-radius: 999px;
    background: rgba(148, 163, 184, .35);
    transition: background var(--cmap-spring);
}

.cmap-toggle.is-on .cmap-switch { background: var(--cmap-accent); }

.cmap-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    transition: left var(--cmap-spring);
}

.cmap-toggle.is-on .cmap-knob { left: 16px; }

.cmap-polls {
    display: flex;
    gap: 5px;
}

.cmap-poll {
    flex: 1;
    height: 28px;
    font-family: var(--font-mono, monospace);
    font-size: 0.64rem;
    font-weight: 700;
    color: #cbd5e1;
    background: rgba(148, 163, 184, .12);
    border: 1px solid rgba(148, 163, 184, .24);
    border-radius: 6px;
    cursor: pointer;
}

.cmap-poll.is-active {
    color: #ffffff;
    background: var(--cmap-accent);
    border-color: var(--cmap-accent);
}


/* --- legend capsule, zoom ------------------------------------------------- */

.cmap-legend-capsule {
    position: absolute;
    left: 14px;
    bottom: 14px;
    flex-wrap: nowrap;
    height: 32px;
    padding: 0 13px;
    color: #cbd5e1;
    background: var(--cmap-surface);
    backdrop-filter: blur(var(--cmap-blur));
    -webkit-backdrop-filter: blur(var(--cmap-blur));
    border: 1px solid rgba(148, 163, 184, .26);
    border-top: 1px solid rgba(148, 163, 184, .26);
    border-radius: 8px;
    white-space: nowrap;
}

.cmap-legend-capsule .cmap-legend-count {
    margin-left: 2px;
    padding-left: 12px;
    border-left: 1px solid rgba(148, 163, 184, .28);
    color: #94a3b8;
}

.cmap-zoom {
    position: absolute;
    right: 14px;
    bottom: 30px;              /* clears Leaflet's attribution strip */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--cmap-surface);
    backdrop-filter: blur(var(--cmap-blur));
    -webkit-backdrop-filter: blur(var(--cmap-blur));
    border: 1px solid rgba(148, 163, 184, .26);
    border-radius: 8px;
}

.cmap-zoom button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 30px;
    color: #e2e8f0;
    background: transparent;
    border: none;
    cursor: pointer;
}

.cmap-zoom button + button { border-top: 1px solid rgba(148, 163, 184, .22); }
.cmap-zoom button:hover { background: rgba(148, 163, 184, .14); }

.cmap-shell.is-overlay .leaflet-control-attribution {
    background: rgba(15, 23, 42, .7);
    color: #94a3b8;
    font-size: 0.58rem;
}

.cmap-shell.is-overlay .leaflet-control-attribution a { color: #cbd5e1; }


/* --- inspector ------------------------------------------------------------ */

.cmap-inspector {
    position: absolute;
    right: 14px;
    top: 14px;
    width: 306px;
    max-height: calc(100% - 28px);
    overflow-y: auto;
    scrollbar-width: thin;
}

.cmap-inspector[hidden] { display: none !important; }

.cmap-inspector.is-in { animation: cmap-insp-in 380ms cubic-bezier(.22, 1, .36, 1) both; }

@keyframes cmap-insp-in {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* The docked card is the popup card at the inspector's width. */
.cmap-inspector .cmap-card {
    width: 100%;
    background: rgba(15, 23, 42, .93);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 10px;
    box-shadow: 0 16px 44px rgba(0, 0, 0, .5);
}

.cmap-inspector .cmap-card-head { padding-right: 40px; }

.cmap-insp-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: #94a3b8;
    background: transparent;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.cmap-insp-close:hover { color: #ffffff; background: rgba(148, 163, 184, .16); }

.cmap-inspector .cmap-card-actions { padding: 0 10px 10px; }

.cmap-inspector .cmap-action.is-primary {
    width: 100%;
    height: 34px;
    background: var(--cmap-accent);
    border-color: var(--cmap-accent);
    color: #ffffff;
    font-weight: 700;
}


/* --- reduced motion ------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .cmap-pill, .cmap-arrow, .cmap-viewport, .cmap-chev,
    .cmap-switch, .cmap-knob { transition: none !important; }
    .cmap-panel.is-from-right, .cmap-panel.is-from-left,
    .cmap-inspector.is-in { animation: none !important; }
}
