    /* ---- Fonts ---- */
    @font-face { font-family: 'Source Sans 3'; font-style: normal; font-weight: 300 600; font-display: swap; src: url('fonts/source-sans-3-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
    @font-face { font-family: 'Source Sans 3'; font-style: normal; font-weight: 300 600; font-display: swap; src: url('fonts/source-sans-3-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

    * { margin: 0; padding: 0; box-sizing: border-box; }

    html { scrollbar-gutter: stable; }
    body {
        background-color: #1A1E21;
        color: #C5CDD1;
        font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        height: 100vh;
        overflow: hidden;
    }

    /* ---- Shell ---- */
    .shell-header { position: fixed; top: 0; left: 0; right: 0; z-index: 100; display: flex; align-items: center; justify-content: center; gap: 40px; height: 74px; padding: 0 48px; line-height: 1.6; background-color: #0A0C0E; border-bottom: 1px solid #2D3539; }
    .shell-header .name { font-size: 13px; font-weight: 600; color: #C5CDD1; letter-spacing: 0.14em; text-transform: uppercase; flex-shrink: 0; }
    .shell-header .header-sep { width: 1px; height: 28px; background-color: #2D3539; flex-shrink: 0; }
    .shell-header .nav { display: flex; gap: 4px; }
    .shell-header .nav-link { padding: 8px 12px; color: #8FA8B0; text-decoration: none; font-size: 14px; font-weight: 400; border-radius: 4px; transition: color 0.15s; position: relative; display: inline-flex; align-items: center; }
    .shell-header .nav-link:hover { color: #C2DCA3; }
    .shell-header .nav-link.active { color: #C5CDD1; }
    .shell-header .nav-link.active::after { content: ''; position: absolute; bottom: 0; left: 12px; right: 12px; height: 2px; background-color: #7A9483; border-radius: 1px; }
    .shell-footer { position: fixed; bottom: 0; left: 0; right: 0; line-height: 1.6; background-color: #1A1E21; border-top: 1px solid #2D3539; z-index: 100; }
    .shell-footer .footer-inner { max-width: 660px; margin: 0 auto; height: 56px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; }
    .shell-footer .footer-copy { font-size: 12px; color: #8FA8B0; }
    .shell-footer .footer-icons { display: flex; gap: 4px; }
    .shell-footer .footer-icons a { color: #8FA8B0; transition: color 0.15s; display: flex; padding: 8px; text-decoration: none; }
    .shell-footer .footer-icons a:hover { color: #C5CDD1; }
    .shell-footer .footer-icons a[data-tooltip] { position: relative; }
    .shell-footer .footer-icons a[data-tooltip]::after {
        content: attr(data-tooltip);
        position: absolute;
        bottom: calc(100% + 6px);
        right: 0;
        padding: 4px 8px;
        background: #242A2E;
        border: 1px solid #2D3539;
        border-radius: 4px;
        color: #B8C5CA;
        font-family: ui-monospace, 'SF Mono', Menlo, monospace;
        font-size: 12px;
        line-height: 1.4;
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.15s;
        pointer-events: none;
    }
    .shell-footer .footer-icons a[data-tooltip]:hover::after,
    .shell-footer .footer-icons a[data-tooltip]:focus-visible::after { opacity: 1; visibility: visible; }
    .framing-line {
        position: fixed;
        top: 74px;
        left: 0;
        right: 0;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 99;
        background-color: #0A0C0E;
        border-bottom: 1px solid #2D3539;
        font-size: 12px;
        color: #8FA8B0;
    }
    @media (max-width: 600px) {
        .shell-header { height: 58px; padding: 0 20px; gap: 20px; }
        .shell-header .name { font-size: 14px; }
        .shell-header .nav-link { padding: 8px 8px; font-size: 13px; }
        .shell-footer .footer-inner { height: 52px; padding: 0 20px; }
        .shell-footer .footer-copy { font-size: 11px; }
        .framing-line { top: 58px; height: auto; min-height: 28px; font-size: 11px; line-height: 1.3; padding: 4px 12px; text-align: center; }
    }
    /* Narrow phones — the centered header clips off both edges once the name
       plus four nav links overflow. Tighten spacing rather than drop the name. */
    @media (max-width: 380px) {
        .shell-header { gap: 10px; }
        .shell-header .name { font-size: 13px; }
        .shell-header .nav { gap: 2px; }
        .shell-header .nav-link { padding: 8px 4px; }
    }

    #bg-layer {
        position: fixed;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 100%;
        max-width: 85vw;
        height: 100%;
        pointer-events: none;
        z-index: 0;
    }

    #chart-wrapper {
        position: fixed;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 100%;
        max-width: 85vw;
        z-index: 1;
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-width: none;
    }

    #chart-wrapper::-webkit-scrollbar {
        display: none;
    }

    #chart {
        width: 100%;
    }

    #top-labels {
        position: fixed;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 100%;
        max-width: 85vw;
        pointer-events: none;
        z-index: 2;
        background: #1A1E21;
    }

    .satellite-group {
        cursor: grab;
    }

    /* Touch reorders from the handle only; a swipe anywhere else scrolls */
    .satellite-group .handle {
        touch-action: none;
    }

    .handle-hit {
        fill: transparent;
    }

    .satellite-group:active {
        cursor: grabbing;
    }

    /* Larger touch targets on mobile */
    @media (pointer: coarse) {
        .satellite-group .group-bg {
            /* Easier to tap */
        }

        .band-rect {
            /* Minimum touch target */
            min-height: 24px;
        }
    }

    .satellite-group .group-bg {
        fill: transparent;
        transition: fill 0.15s ease-out;
    }

    .satellite-group.public:hover .group-bg {
        fill: rgba(138, 175, 184, 0.06);
    }

    .satellite-group.commercial:hover .group-bg {
        fill: rgba(180, 149, 96, 0.06);
    }

    .satellite-group.dragging {
        opacity: 0.95;
        filter: drop-shadow(0 6px 12px rgba(0,0,0,0.5));
    }

    .satellite-group.public.dragging .group-bg {
        fill: rgba(138, 175, 184, 0.12);
    }

    .satellite-group.commercial.dragging .group-bg {
        fill: rgba(180, 149, 96, 0.12);
    }

    .group-accent {
        transition: opacity 0.15s ease-out;
    }

    .satellite-group:hover .group-accent {
        opacity: 0.8;
    }

    .row-label {
        font-size: 10px;
        font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
        fill: #8FA8B0;
        user-select: none;
    }

    .row-label.satellite-name {
        fill: #C5CDD1;
        font-weight: 600;
        font-size: 14px;
        font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
        letter-spacing: 0.01em;
    }

    .row-label.sensor-name {
        fill: #B8C5CA;
        font-weight: 600;
        font-size: 12px;
        font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    }

    .drag-handle {
        fill: transparent;
        cursor: grab;
        transition: fill 0.2s;
    }

    .satellite-group.public:hover .drag-handle {
        fill: rgba(138, 175, 184, 0.7);
    }

    .satellite-group.commercial:hover .drag-handle {
        fill: rgba(180, 149, 96, 0.7);
    }

    /* No hover on touch: the handle is always shown */
    body.touch .satellite-group.public .drag-handle {
        fill: rgba(138, 175, 184, 0.55);
    }

    body.touch .satellite-group.commercial .drag-handle {
        fill: rgba(180, 149, 96, 0.55);
    }

    .satellite-group.dragging .drag-handle {
        fill: #9FBEC6;
    }

    /* Per-sensor remove button */
    .sensor-remove {
        cursor: pointer;
        opacity: 0;
        transition: opacity 0.15s;
    }

    .satellite-group:hover .sensor-remove,
    .satellite-group:focus .sensor-remove {
        opacity: 1;
    }

    body.touch .sensor-remove {
        opacity: 0.55;
    }

    .sensor-remove-bg {
        fill: rgba(45, 53, 57, 0);
        transition: fill 0.15s;
    }

    .sensor-remove:hover .sensor-remove-bg {
        fill: rgba(197, 90, 90, 0.18);
    }

    .sensor-remove:focus {
        outline: none;
    }

    .sensor-remove:focus .sensor-remove-bg {
        fill: rgba(159, 190, 198, 0.18);
    }

    .sensor-remove-x {
        stroke: #8FA8B0;
        stroke-width: 1.4;
        stroke-linecap: round;
        fill: none;
        transition: stroke 0.15s;
    }

    .sensor-remove:hover .sensor-remove-x {
        stroke: #C55A5A;
    }

    .band-rect {
        stroke-width: 0.5;
        transition: filter 0.1s;
    }

    .band-rect:focus {
        outline: none;
    }

    /* Band whose details are open by tap or keyboard */
    .band-rect.active {
        stroke: #C5CDD1;
        stroke-width: 1.5;
    }

    .band-rect:hover {
        stroke-width: 1.5;
        filter: brightness(1.15);
    }

    .axis text {
        fill: #C5CDD1;
        font-size: 11px;
        font-weight: 600;
    }

    .axis path,
    .axis .domain {
        stroke: none;
    }

    .axis line {
        stroke: rgba(45, 53, 57, 0.5);
    }

    .axis-label {
        fill: #8FA8B0;
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0.04em;
    }

    #crosshair-layer {
        position: fixed;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 100%;
        max-width: 85vw;
        height: 100%;
        pointer-events: none;
        z-index: 3;
    }

    .crosshair-line {
        stroke: #8AAFB8;
        stroke-width: 1;
        stroke-dasharray: 4 4;
        opacity: 0.45;
    }

    .crosshair-readout-bg {
        fill: #242A2E;
        stroke: #2D3539;
    }

    .crosshair-readout-text {
        fill: #C5CDD1;
        font-size: 11px;
        font-weight: 600;
    }

    .grid line {
        stroke: rgba(45, 53, 57, 0.4);
        stroke-dasharray: 2, 4;
    }

    .gutter-separator {
        stroke: #2D3539;
        stroke-width: 1;
    }

    .atmosphere {
        fill: rgba(92, 113, 120, 0.08);
    }

    .atmosphere-line {
        fill: none;
        stroke: rgba(111, 138, 145, 0.3);
        stroke-width: 0.8;
    }

    .region-label {
        font-size: 11px;
        font-weight: 500;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        fill: #B8C5CA;
    }

    .absorption-label {
        font-size: 10px;
        fill: #8FA8B0;
    }

    .tooltip {
        position: fixed;
        background: rgba(26, 30, 33, 0.96);
        border: 1px solid #2D3539;
        border-radius: 6px;
        padding: 10px 12px;
        font-size: 11px;
        color: #C5CDD1;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.12s;
        z-index: 1000;
        line-height: 1.5;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        max-width: 220px;
    }

    .tooltip.visible {
        opacity: 1;
    }

    .tooltip .tooltip-note {
        margin-top: 4px;
        font-size: 11px;
        font-style: italic;
        color: #8FA8B0;
    }

    .tooltip strong {
        color: #C5CDD1;
    }

    .hint {
        position: fixed;
        bottom: 80px;
        z-index: 101;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(26, 30, 33, 0.85);
        border: 1px solid #2D3539;
        border-radius: 6px;
        padding: 8px 16px;
        font-size: 11px;
        color: #8FA8B0;
        backdrop-filter: blur(8px);
        opacity: 1;
        transition: opacity 0.5s ease-out;
    }

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

    /* Focus indicators for keyboard navigation */
    .satellite-group:focus {
        outline: none;
    }

    .satellite-group:focus .group-accent {
        fill: rgba(159, 190, 198, 0.7);
    }

    .satellite-group:focus .group-bg {
        fill: rgba(159, 190, 198, 0.10);
    }

    /* Controls bar */
    .controls {
        position: fixed;
        bottom: 52px;
        right: calc((100vw - 85vw) / 2);
        display: flex;
        align-items: center;
        z-index: 100;
        font-size: 10px;
        font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    }

    .controls button {
        background: none;
        border: none;
        padding: 0;
        font: inherit;
        color: #8FA8B0;
        cursor: pointer;
        transition: color 0.15s;
    }

    .controls button:hover {
        color: #C5CDD1;
    }

    .controls .sep {
        color: #2D3539;
        margin: 0 8px;
        user-select: none;
    }

    /* Legend popover */
    .legend-popover {
        position: fixed;
        top: 12px;
        right: 12px;
        background: rgba(26, 30, 33, 0.96);
        border: 1px solid #2D3539;
        border-radius: 6px;
        padding: 12px 16px;
        z-index: 101;
        display: none;
        box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    }

    .legend-popover.visible {
        display: flex;
        gap: 20px;
    }

    .legend-col {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .legend-entry {
        font-size: 11px;
        color: #B8C5CA;
        display: flex;
        align-items: center;
        gap: 6px;
        white-space: nowrap;
    }

    .legend-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .legend-square {
        width: 8px;
        height: 8px;
        flex-shrink: 0;
    }

    /* Add-sensor popover */
    .add-popover {
        position: fixed;
        top: 12px;
        right: 12px;
        background: rgba(26, 30, 33, 0.96);
        border: 1px solid #2D3539;
        border-radius: 6px;
        padding: 12px 14px;
        z-index: 101;
        display: none;
        flex-direction: column;
        gap: 4px;
        max-height: 70vh;
        overflow-y: auto;
        min-width: 190px;
        box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    }

    .add-popover.visible {
        display: flex;
    }

    .add-popover .add-title {
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: #8FA8B0;
        margin-bottom: 4px;
        font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    }

    .add-popover .add-empty {
        font-size: 11px;
        color: #8FA8B0;
    }

    .sensor-chip {
        display: flex;
        align-items: center;
        gap: 7px;
        background: none;
        border: none;
        padding: 4px 2px;
        font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
        font-size: 12px;
        color: #B8C5CA;
        cursor: pointer;
        text-align: left;
        width: 100%;
        transition: color 0.15s;
    }

    .sensor-chip:hover {
        color: #C5CDD1;
    }

    .sensor-chip .chip-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .sensor-chip .chip-plus {
        color: #7A9483;
        font-weight: 600;
    }


    /* Sources Modal */
    .modal-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.7);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        /* visibility flips at once on open (so focus() lands) and after the fade on close */
        transition: opacity 0.2s, visibility 0s linear 0.2s;
    }

    .modal-overlay.visible {
        opacity: 1;
        visibility: visible;
        transition: opacity 0.2s, visibility 0s;
    }

    .modal {
        background: #1A1E21;
        border: 1px solid #2D3539;
        border-radius: 8px;
        max-width: 600px;
        max-height: 80vh;
        overflow-y: auto;
        padding: 24px;
        box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    }

    .modal h2 {
        font-size: 16px;
        font-weight: 600;
        color: #C5CDD1;
        margin-bottom: 16px;
        padding-bottom: 12px;
        border-bottom: 1px solid #2D3539;
    }

    .modal-close {
        position: absolute;
        top: 16px;
        right: 16px;
        background: none;
        border: none;
        color: #8FA8B0;
        font-size: 24px;
        cursor: pointer;
        padding: 4px 8px;
        line-height: 1;
    }

    .modal-close:hover {
        color: #C5CDD1;
    }

    .sources-list {
        list-style: none;
    }

    .sources-list li {
        margin-bottom: 12px;
        padding-bottom: 12px;
        border-bottom: 1px solid #2D3539;
    }

    .sources-list li:last-child {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }

    .source-name {
        font-weight: 600;
        color: #C5CDD1;
        font-size: 13px;
    }

    .source-link {
        display: block;
        color: #A8CD7C;
        font-size: 11px;
        text-decoration: underline;
        text-underline-offset: 2px;
        margin-top: 4px;
        word-break: break-all;
    }

    .source-link:hover {
        color: #C2DCA3;
    }

    .sources-caveat {
        font-size: 12px;
        color: #8FA8B0;
        margin: 0 0 12px;
    }

    .source-note {
        font-size: 11px;
        color: #8FA8B0;
        font-style: italic;
        margin-top: 2px;
    }

    /* Mobile responsive */

    @media (max-width: 900px) {
        /* Names sit on their own line above the rows (CONFIG.headerHeight) */
        .row-label {
            font-size: 10px;
        }

        .row-label.satellite-name {
            font-size: 12px;
        }

        .row-label.sensor-name {
            font-size: 11px;
        }

        .hint {
            font-size: 10px;
            padding: 6px 12px;
        }

        .modal {
            margin: 16px;
            max-width: calc(100vw - 32px);
        }
    }

    @media (max-width: 600px) {
        body {
            overflow-x: auto;
        }

        #bg-layer,
        #chart-wrapper,
        #top-labels,
        #crosshair-layer {
            max-width: calc(100vw - 32px);
        }

        .region-label {
            letter-spacing: 0.04em;
        }

        .hint {
            left: 12px;
            right: 12px;
            transform: none;
            text-align: center;
            font-size: 10px;
        }

        .controls {
            right: 16px;
        }

        .modal {
            margin: 8px;
            padding: 16px;
            max-width: calc(100vw - 16px);
        }

        .modal h2 {
            font-size: 14px;
        }

        .source-name {
            font-size: 12px;
        }

        .source-link {
            font-size: 10px;
        }
    }

    /* Loading and failure state inside #chart (js/app.js) */
    .load-status {
        max-width: 420px;
        margin: 120px auto 0;
        padding: 20px 24px;
        background: #242A2E;
        border: 1px solid #2D3539;
        border-radius: 6px;
        color: #B8C5CA;
        font-size: 15px;
        line-height: 1.6;
        text-align: center;
    }

    .load-status h2 {
        margin: 0 0 8px;
        font-size: 16px;
        font-weight: 600;
        color: #C5CDD1;
    }

    .load-status p { margin: 0 0 8px; }

    .load-status .load-detail {
        color: #8FA8B0;
        font-size: 12px;
        overflow-wrap: anywhere;
    }

    .load-retry {
        margin-top: 8px;
        padding: 6px 16px;
        background: none;
        border: 1px solid #2D3539;
        border-radius: 6px;
        font: inherit;
        color: #A8CD7C;
        cursor: pointer;
    }

    .load-retry:hover { color: #C2DCA3; }
    .load-retry:focus-visible { outline: 2px solid #A8CD7C; outline-offset: 2px; }
