* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    background: #05080d;
    color: #eaf4ff;
    font-family:
        Inter,
        Arial,
        Helvetica,
        sans-serif;
    overflow: hidden;
}

body {
    background:
        radial-gradient(
            circle at top,
            #122138 0,
            #07101c 42%,
            #020509 100%
        );
}

#app {
    height: 100vh;
    display: grid;
    grid-template-rows:
        72px
        112px
        1fr
        32px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    border-bottom: 1px solid #27384d;
    background:
        linear-gradient(
            180deg,
            rgba(18, 30, 48, .97),
            rgba(7, 13, 22, .97)
        );
    z-index: 1000;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-mark {
    font-size: 34px;
    filter:
        drop-shadow(
            0 0 10px rgba(255, 208, 0, .75)
        );
}

.title {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: 1.6px;
}

.subtitle {
    margin-top: 4px;
    font-size: 11px;
    color: #8fa5bd;
    letter-spacing: 1.3px;
}

.system-status {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: #74ff9b;
}

.status-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 7px;
    border-radius: 50%;
    background: #43ff72;
    box-shadow:
        0 0 10px #43ff72;
}

.metrics {
    display: grid;
    grid-template-columns:
        repeat(6, minmax(150px, 1fr));
    gap: 8px;
    padding: 10px;
    background: #050a11;
    border-bottom: 1px solid #25364b;
}

.metric-card {
    border: 1px solid #263a51;
    border-radius: 5px;
    padding: 12px 13px;
    background:
        linear-gradient(
            180deg,
            rgba(20, 34, 53, .96),
            rgba(8, 16, 27, .96)
        );
    box-shadow:
        inset 0 0 25px rgba(65, 125, 180, .06);
}

.metric-title {
    font-size: 10px;
    letter-spacing: 1.1px;
    color: #7f96ad;
}

.metric-value {
    margin-top: 10px;
    font-size: 23px;
    font-weight: 800;
    color: #dff3ff;
}

.metric-value.healthy {
    color: #61eaff;
    font-size: 17px;
}

.metric-foot {
    margin-top: 6px;
    font-size: 10px;
    color: #647b91;
}

.workspace {
    min-height: 0;
    display: grid;
    grid-template-columns:
        260px
        1fr
        285px;
}

.left-panel,
.right-panel {
    min-height: 0;
    overflow-y: auto;
    background:
        linear-gradient(
            180deg,
            rgba(8, 16, 27, .98),
            rgba(3, 8, 14, .98)
        );
}

.left-panel {
    border-right: 1px solid #25364b;
    padding: 18px;
}

.right-panel {
    border-left: 1px solid #25364b;
    padding: 18px;
}

.panel-heading {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.4px;
    color: #73d9ff;
    padding-bottom: 10px;
    border-bottom: 1px solid #203148;
}

.second-heading {
    margin-top: 25px;
}

.layer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(45, 66, 88, .45);
    font-size: 12px;
}

.switch {
    position: relative;
    width: 33px;
    height: 17px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    border-radius: 20px;
    background: #263647;
    transition: .2s;
}

.slider:before {
    content: "";
    position: absolute;
    width: 11px;
    height: 11px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: #9bb0c4;
    transition: .2s;
}

.switch input:checked + .slider {
    background: #087aa5;
    box-shadow:
        0 0 8px rgba(0, 183, 255, .4);
}

.switch input:checked + .slider:before {
    transform: translateX(16px);
    background: white;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 11px;
    font-size: 12px;
    color: #b8c8d6;
}

.legend {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.green {
    background: #37e66b;
}

.yellow {
    background: #ffe34d;
}

.orange {
    background: #ff9e42;
}

.red {
    background: #ff4141;
}

.purple {
    background: #bf68ff;
}

.generation-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 8px;
    margin-top: 13px;
    font-size: 11px;
    color: #aebdca;
}

.source {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 5px;
    border-radius: 2px;
}

.nuclear {
    background: #eb63ff;
}

.hydro {
    background: #4aa8ff;
}

.gas {
    background: #ff934b;
}

.coal {
    background: #9c9c9c;
}

.solar {
    background: #ffe55e;
}

.wind {
    background: #53e7c7;
}

.map-wrap {
    position: relative;
    min-width: 0;
    min-height: 0;
    background: #000;
}

#map {
    position: absolute;
    inset: 0;
}

.map-banner {
    position: absolute;
    left: 18px;
    bottom: 18px;
    z-index: 500;
    width: 330px;
    padding: 12px 14px;
    border: 1px solid rgba(90, 177, 228, .45);
    border-radius: 5px;
    background: rgba(4, 11, 20, .88);
    backdrop-filter: blur(8px);
    font-size: 11px;
    line-height: 1.45;
    color: #9eb3c6;
}

.banner-title {
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.2px;
    color: #68dcff;
}

.leaflet-control-zoom a {
    background: #0b1725 !important;
    color: #cdeeff !important;
    border-color: #2c4860 !important;
}

.leaflet-control-attribution {
    background: rgba(0, 0, 0, .55) !important;
    color: #7890a4 !important;
}

.leaflet-control-attribution a {
    color: #69bde7 !important;
}

.intel-empty {
    padding: 28px 5px;
    text-align: center;
    color: #8398aa;
}

.intel-icon {
    font-size: 38px;
}

.intel-title {
    margin-top: 12px;
    font-weight: 700;
    color: #c8d9e7;
}

.intel-empty p {
    font-size: 12px;
    line-height: 1.6;
}

.system-row {
    display: flex;
    justify-content: space-between;
    padding: 9px 0;
    font-size: 11px;
    border-bottom: 1px solid rgba(45, 66, 88, .45);
}

.online {
    color: #59ef7f;
}

.pending {
    color: #ffc34b;
}

footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    background: #04080d;
    border-top: 1px solid #1f3043;
    color: #5f7488;
    font-size: 9px;
    letter-spacing: 1px;
}

@media (max-width: 1100px) {
    .metrics {
        grid-template-columns:
            repeat(3, 1fr);
        overflow-y: auto;
    }

    #app {
        grid-template-rows:
            72px
            210px
            1fr
            32px;
    }

    .workspace {
        grid-template-columns:
            220px
            1fr;
    }

    .right-panel {
        display: none;
    }
}


/* =========================================================
   CANADA NUCLEAR LABELS
========================================================= */

.canada-nuclear-tooltip {
    background: rgba(3, 10, 20, .96) !important;
    border: 2px solid #ffffff !important;
    border-left: 5px solid #ff00ff !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    font-size: 11px !important;
    letter-spacing: .35px !important;
    box-shadow:
        0 0 14px rgba(255, 0, 255, .75) !important;
}

.canada-nuclear-tooltip::before {
    border-top-color: #ffffff !important;
}

/* GRID_MOBILE_MAPFIRST_BEGIN */


/*
 * Mobile UI elements are hidden on desktop.
 */

#grid-mobile-layers,
#grid-mobile-info,
#grid-mobile-fullscreen,
#grid-mobile-backdrop {
    display: none;
}


@media (max-width: 700px) {

    html,
    body {
        width: 100% !important;
        height: 100% !important;

        margin: 0 !important;
        padding: 0 !important;

        overflow: hidden !important;

        background: #03070c !important;
    }


    /*
     * APP BECOMES A COMPACT HEADER + FULL MAP.
     */

    #app {
        display: block !important;

        position: fixed !important;

        inset: 0 !important;

        width: 100vw !important;
        height: 100dvh !important;

        overflow: hidden !important;
    }


    /*
     * COMPACT HEADER
     */

    .topbar {
        position: fixed !important;

        top: 0 !important;
        left: 0 !important;
        right: 0 !important;

        height: 58px !important;
        min-height: 58px !important;

        padding: 6px 10px !important;

        box-sizing: border-box !important;

        z-index: 40000 !important;

        background:
            rgba(4,10,17,.97) !important;

        backdrop-filter:
            blur(8px);
    }


    .topbar h1,
    .topbar .title {
        font-size: 15px !important;
        line-height: 1.05 !important;
    }


    .topbar p,
    .topbar .subtitle,
    .topbar .tagline {
        display: none !important;
    }


    /*
     * THE SIX LARGE METRIC CARDS DO NOT CONSUME
     * HALF OF THE PHONE BEFORE THE MAP.
     */

    .metrics {
        display: none !important;
    }


    /*
     * MAP WORKSPACE IS THE PHONE SCREEN.
     */

    .workspace {
        display: block !important;

        position: fixed !important;

        top: 58px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;

        width: 100vw !important;
        height: calc(100dvh - 58px) !important;

        min-width: 0 !important;
        min-height: 0 !important;

        overflow: hidden !important;
    }


    .map-wrap {
        display: block !important;

        position: absolute !important;

        inset: 0 !important;

        width: 100% !important;
        height: 100% !important;

        min-width: 0 !important;
        min-height: 0 !important;

        z-index: 1 !important;
    }


    #map {
        position: absolute !important;

        inset: 0 !important;

        width: 100% !important;
        height: 100% !important;

        min-width: 0 !important;
        min-height: 0 !important;
    }


    /*
     * THE BIG DESKTOP BANNER COVERS TOO MUCH MAP.
     */

    .map-banner {
        display: none !important;
    }


    /*
     * LEFT AND RIGHT DESKTOP COLUMNS BECOME DRAWERS.
     */

    .left-panel,
    .right-panel {
        display: none !important;

        position: fixed !important;

        top: 58px !important;
        bottom: 0 !important;

        width: min(90vw, 390px) !important;
        max-width: 390px !important;

        height: calc(100dvh - 58px) !important;

        box-sizing: border-box !important;

        overflow-x: hidden !important;
        overflow-y: auto !important;

        padding: 16px !important;

        z-index: 50000 !important;

        -webkit-overflow-scrolling: touch;
    }


    .left-panel {
        left: 0 !important;
        right: auto !important;

        border-right:
            1px solid #25364b !important;

        border-left: 0 !important;

        box-shadow:
            12px 0 34px
            rgba(0,0,0,.78) !important;
    }


    .right-panel {
        right: 0 !important;
        left: auto !important;

        border-left:
            1px solid #25364b !important;

        border-right: 0 !important;

        box-shadow:
            -12px 0 34px
            rgba(0,0,0,.78) !important;
    }


    .left-panel.grid-mobile-open,
    .right-panel.grid-mobile-open {
        display: block !important;
    }


    /*
     * MOBILE BUTTONS
     */

    #grid-mobile-layers,
    #grid-mobile-info,
    #grid-mobile-fullscreen {
        display: flex !important;

        position: fixed !important;

        align-items: center !important;
        justify-content: center !important;

        min-height: 42px !important;

        padding: 7px 12px !important;

        border:
            1px solid
            rgba(95,215,255,.85) !important;

        border-radius: 22px !important;

        background:
            rgba(3,13,23,.94) !important;

        color: #ffffff !important;

        font-size: 10px !important;
        font-weight: 900 !important;

        letter-spacing: .7px !important;

        box-shadow:
            0 5px 18px
            rgba(0,0,0,.70) !important;

        cursor: pointer !important;

        touch-action: manipulation !important;
    }


    #grid-mobile-layers {
        top: 68px !important;
        left: 10px !important;

        z-index: 45000 !important;
    }


    #grid-mobile-info {
        top: 68px !important;
        right: 10px !important;

        z-index: 45000 !important;
    }


    #grid-mobile-fullscreen {
        left: 50% !important;

        bottom:
            calc(
                14px
                + env(safe-area-inset-bottom)
            ) !important;

        transform:
            translateX(-50%) !important;

        z-index: 45000 !important;
    }


    #grid-mobile-layers.grid-mobile-open,
    #grid-mobile-info.grid-mobile-open {
        z-index: 51000 !important;
    }


    /*
     * TAP OUTSIDE DRAWER TO CLOSE.
     */

    #grid-mobile-backdrop {
        display: none !important;

        position: fixed !important;

        inset: 58px 0 0 0 !important;

        z-index: 49000 !important;

        background:
            rgba(0,0,0,.48) !important;
    }


    #grid-mobile-backdrop.grid-mobile-open {
        display: block !important;
    }


    /*
     * BIGGER TOUCH TARGETS.
     */

    .left-panel label,
    .right-panel label {
        min-height: 38px !important;
    }


    .switch {
        width: 44px !important;
        height: 24px !important;
    }


    .slider:before {
        width: 18px !important;
        height: 18px !important;

        left: 3px !important;
        top: 3px !important;
    }


    .switch input:checked + .slider:before {
        transform:
            translateX(20px) !important;
    }


    .legend-row {
        min-height: 32px !important;

        font-size: 13px !important;
    }


    .generation-grid {
        font-size: 12px !important;
    }


    /*
     * LEAFLET PHONE CONTROLS
     */

    .leaflet-control-zoom a {
        width: 42px !important;
        height: 42px !important;

        line-height: 42px !important;

        font-size: 23px !important;
    }


    .leaflet-control-scale {
        margin-bottom:
            calc(
                62px
                + env(safe-area-inset-bottom)
            ) !important;
    }


    .leaflet-control-attribution {
        max-width: 74vw !important;

        font-size: 7px !important;
        line-height: 1.1 !important;
    }


    /*
     * IMMERSIVE FULL SCREEN MODE
     */

    body.grid-immersive .topbar {
        display: none !important;
    }


    body.grid-immersive .workspace {
        top: 0 !important;

        width: 100vw !important;
        height: 100dvh !important;
    }


    body.grid-immersive .left-panel,
    body.grid-immersive .right-panel {
        top: 0 !important;

        height: 100dvh !important;

        padding-top:
            calc(
                62px
                + env(safe-area-inset-top)
            ) !important;
    }


    body.grid-immersive
    #grid-mobile-backdrop {
        inset: 0 !important;
    }


    body.grid-immersive
    #grid-mobile-layers,

    body.grid-immersive
    #grid-mobile-info {

        top:
            calc(
                10px
                + env(safe-area-inset-top)
            ) !important;
    }


    body.grid-immersive
    #grid-mobile-fullscreen {

        bottom:
            calc(
                10px
                + env(safe-area-inset-bottom)
            ) !important;
    }

}


/*
 * SHORT LANDSCAPE PHONES
 */

@media
    (max-width: 900px)
    and (max-height: 520px)
    and (orientation: landscape) {

    .topbar {
        height: 48px !important;
        min-height: 48px !important;
    }


    .workspace {
        top: 48px !important;

        height:
            calc(100dvh - 48px) !important;
    }


    .left-panel,
    .right-panel {
        top: 48px !important;

        height:
            calc(100dvh - 48px) !important;

        width:
            min(72vw, 390px) !important;
    }


    #grid-mobile-backdrop {
        inset: 48px 0 0 0 !important;
    }


    #grid-mobile-layers,
    #grid-mobile-info {
        top: 56px !important;
    }


    body.grid-immersive .workspace {
        top: 0 !important;

        height: 100dvh !important;
    }


    body.grid-immersive
    .left-panel,

    body.grid-immersive
    .right-panel {

        top: 0 !important;
        height: 100dvh !important;
    }

}


/* GRID_MOBILE_MAPFIRST_END */
