html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
    color: #000000;
}

.btn-primary {
    color: #ffffff;
    background-color: #000000;
    border-color: #000000;
}

.btn-primary:hover {
    color: #000000;
    background-color: #ffffff;
    border-color: #000000;
}

.btn-success {
    color: #ffffff;
    background-color: #000000;
    border-color: #000000;
}

.btn-success:hover {
    color: #000000;
    background-color: #ffffff;
    border-color: #000000;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA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1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

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

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.chart-drag-handle {
    cursor: grab;
}

.chart-drag-handle:active {
    cursor: grabbing;
}

.chart-ghost {
    opacity: 0.4;
}

.chart-dragging {
    opacity: 0.8;
}

.leaflet-map-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.leaflet-map-container .leaflet-container {
    width: 100%;
    height: 100%;
    background: #f8f9fa;
}

.map-opacity-control {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 12px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.map-opacity-control input[type="range"] {
    width: 100px;
    height: 4px;
    accent-color: #000000;
}

.map-opacity-control label {
    margin: 0;
    white-space: nowrap;
    color: #333;
}

/* Track-map title block: small overlay pill stating what the map is showing.
   Top-centred so it clears the Leaflet zoom control (top-left) and the Plotly
   modebar (top-right); the max-width keeps long compare labels off both.
   pointer-events:none so map pan/zoom/hover work straight through it. */
.map-title-block {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;   /* above Leaflet controls (1000) and playback dots */
    background: rgba(255, 255, 255, 0.88);
    padding: 2px 10px;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    font-size: 0.75rem;
    color: #333;
    pointer-events: none;
    max-width: calc(100% - 110px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-title-block .map-title-dot {
    display: inline-block;
    width: 0.6em;
    height: 0.6em;
    border-radius: 50%;
    margin-right: 3px;
}

/* On phones Plotly's modebar is always visible along the top of the map, so
   drop the title pill below it (desktop only shows the modebar on hover). */
@media (max-width: 640.98px) {
    .map-title-block {
        top: 38px;
    }
}

/* Left navigation scrollbar.
   The native scrollbar is HIDDEN in all browsers, because Safari cannot
   restyle its native/overlay scrollbar via CSS (no scrollbar-color support,
   and overlay scrollbars ignore ::-webkit-scrollbar styling). Instead,
   js/nav-scroll.js draws a custom overlay thumb that appears while scrolling,
   fades ~1s after, and sits over the black sidebar with a transparent track
   (so the "track" is just the menu background). These rules are NON-scoped on
   purpose: the overlay element is created by JS and never receives Blazor's
   [b-xxxxx] scope attribute. */

/* Hide the native scrollbar everywhere (content still scrolls via wheel/trackpad). */
.nav-scrollable {
    scrollbar-width: none;          /* Firefox */
    -ms-overflow-style: none;       /* legacy Edge */
}

.nav-scrollable::-webkit-scrollbar {
    display: none;                  /* Chrome, Edge, Safari (incl. overlay mode) */
}

/* Custom overlay thumb, positioned over the sidebar's right edge by nav-scroll.js. */
.nav-scrollbar {
    position: absolute;
    right: 2px;
    width: 6px;
    display: none;                  /* shown by JS only when the nav overflows */
    opacity: 0;                     /* hidden when idle */
    transition: opacity 0.4s ease;
    pointer-events: none;           /* purely visual; scrolling stays native */
    z-index: 1100;
}

.nav-scrollbar.visible {
    opacity: 1;                     /* faded in while scrolling */
}

.nav-scrollbar-thumb {
    position: absolute;
    left: 0;
    width: 6px;
    border-radius: 3px;
    background-color: rgba(255, 255, 255, 0.4);  /* subtle light thumb on black */
}

/* ============================================================================
   Collapsible sidebar: always-visible handle + collapse/drawer states.
   Driven by js/sidebar-toggle.js, which mirrors its state as classes on the
   <html> element (Blazor re-renders/reconnects replace the layout DOM but
   never touch <html>, so the classes survive):
     html.sidebar-collapsed   -> desktop: sidebar width animates to 0;
                                 mobile: the in-flow sidebar block is hidden.
     html.sidebar-drawer-open -> mobile only: the sidebar becomes a fixed
                                 full-height drawer overlay.
   These rules are NON-scoped on purpose (same convention as the nav
   scrollbar rules above): Blazor's CSS isolation cannot target classes on
   the <html> element, so they must live in this global stylesheet.
   Z-order: handle 950, drawer 940 - above the sticky .top-row (z-index 1),
   below #blazor-error-ui (1000) and .nav-scrollbar (1100). */

.sidebar-handle {
    position: fixed;          /* reachable at any page scroll position */
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 19px;
    height: 56px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-left: none;
    border-radius: 0 8px 8px 0;
    background-color: #000000;  /* dark, to match the sidebar */
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    z-index: 950;
    transition: left 0.25s ease;
}

.sidebar-handle:focus-visible {
    outline: 2px solid #258cfb;
    outline-offset: 1px;
}

/* CSS-drawn chevron (no icon-font dependency); flips with the state. */
.sidebar-handle::before {
    content: "";
    display: block;
    width: 8px;
    height: 8px;
    margin: 0 auto;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateX(2px) rotate(45deg);      /* points left ("hide") */
    transition: transform 0.25s ease;
}

@media (min-width: 641px) {
    /* The handle rides the sidebar's outer edge and animates in sync with it. */
    .sidebar-handle {
        left: 250px;
    }

    html.sidebar-collapsed .sidebar-handle {
        left: 0;
    }

    html.sidebar-collapsed .sidebar-handle::before {
        transform: translateX(-1px) rotate(225deg);  /* points right ("show") */
    }

    /* Collapse by animating the real width - a genuine layout change, so the
       charts' ResizeObservers reflow (never collapse via transform). Content
       is clipped while the width animates; the main column is a flex sibling
       and reflows to full width on its own. */
    .page > .sidebar {
        overflow: hidden;
        transition: width 0.25s ease;
    }

    /* Keep the sidebar's blocks at full width during the animation so the
       menu slides out of view instead of squishing/wrapping. */
    .page > .sidebar > .top-row,
    .page > .sidebar > .nav-scrollable {
        min-width: 250px;
    }

    html.sidebar-collapsed .page > .sidebar {
        width: 0;
    }
}

@media (max-width: 640.98px) {
    /* Give the sidebar a positioned default so js/nav-scroll.js sees a
       non-static position and never pins an inline "position: relative" on
       it (an inline style would override the drawer's position: fixed). */
    .page > .sidebar {
        position: relative;
    }

    /* Drawer closed: the chevron points right ("open"). */
    .sidebar-handle::before {
        transform: translateX(-1px) rotate(225deg);
    }

    /* Drawer open: the handle rides the drawer's edge, chevron points left. */
    html.sidebar-drawer-open .sidebar-handle {
        left: min(80vw, 320px);
    }

    html.sidebar-drawer-open .sidebar-handle::before {
        transform: translateX(2px) rotate(45deg);
    }

    /* Collapsed (manual preference or Overview auto-hide): hide the
       in-flow sidebar block entirely; the handle remains as the way in. */
    html.sidebar-collapsed .page > .sidebar {
        display: none;
    }

    /* Drawer: a fixed full-height overlay reachable from any scroll depth.
       Declared after the collapsed rule so it wins when both classes are set. */
    html.sidebar-drawer-open .page > .sidebar {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(80vw, 320px);
        height: 100vh;       /* fallback for browsers without dvh */
        height: 100dvh;
        overflow-y: auto;
        background-color: #000000;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.5);
        z-index: 940;
    }

    /* Inside the drawer the menu is always expanded, regardless of the
       hamburger checkbox that drives the in-flow mobile menu. */
    html.sidebar-drawer-open .page > .sidebar .nav-scrollable {
        display: block;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar-handle,
    .sidebar-handle::before,
    .page > .sidebar {
        transition: none;
    }
}