* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    background: #050a0f;
    color: #dce7ef;
    font-family: Arial, Helvetica, sans-serif;
}

body {
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #07111b;
    border-bottom: 1px solid #173149;
}

h1 {
    margin: 0;
    font-size: 24px;
    letter-spacing: 3px;
    color: #62d4ff;
}

.subtitle {
    margin-top: 3px;
    font-size: 10px;
    letter-spacing: 2px;
    color: #7292a8;
}

.live {
    font-weight: bold;
    color: #ffd24a;
}

.live.connected {
    color: #4cff81;
}

.pulse {
    width: 10px;
    height: 10px;
    display: inline-block;
    margin-right: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 10px currentColor;
}

.stats {
    display: grid;
    grid-template-columns:
        repeat(10, minmax(110px, 1fr));
    background: #08131e;
    border-bottom: 1px solid #173149;
}

.stat {
    padding: 10px 12px;
    border-right: 1px solid #173149;
}

.label {
    font-size: 9px;
    letter-spacing: 1px;
    color: #71889a;
}

.value {
    margin-top: 4px;
    font-size: 21px;
    font-weight: bold;
}

.green {
    color: #42ef7e;
}

.yellow {
    color: #ffd24a;
}

.orange {
    color: #ff9346;
}

.red {
    color: #ff4c57;
}

.toolbar {
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 7px 12px;
    background: #07111b;
    border-bottom: 1px solid #173149;
    font-size: 12px;
}

.toolbar label {
    cursor: pointer;
}

#map-status {
    margin-left: auto;
    color: #7894a7;
}

.layout {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 370px;
}

.map-panel {
    position: relative;
    min-height: 560px;
}

#map {
    position: absolute;
    inset: 0;
    background: #07111b;
}

.incident-panel {
    overflow-y: auto;
    background: #07111b;
    border-left: 1px solid #173149;
}

.panel-title {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 13px;
    background: #07111b;
    border-bottom: 1px solid #173149;
    color: #62d4ff;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
}

.event {
    padding: 11px 13px;
    border-bottom: 1px solid #14283a;
}

.event-title {
    font-size: 13px;
    font-weight: bold;
}

.event-detail {
    margin-top: 5px;
    color: #8ca2b2;
    font-size: 11px;
    line-height: 1.6;
}

footer {
    display: flex;
    justify-content: space-between;
    padding: 7px 12px;
    background: #07111b;
    border-top: 1px solid #173149;
    color: #627b8e;
    font-size: 10px;
}

.leaflet-container {
    background: #03070b;
}

.ix-marker {
    border-radius: 50%;
}

@media (max-width: 1300px) {

    .stats {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 900px) {

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .layout {
        grid-template-columns: 1fr;
    }

    .incident-panel {
        max-height: 400px;
        border-left: none;
        border-top: 1px solid #173149;
    }
}


/* ==========================================================
   INTERNET VITAL - SATELLITE MAP ENHANCEMENTS
   ========================================================== */

#map {
    background: #101820;
}

.leaflet-control-layers {
    background: rgba(5, 15, 25, 0.94);
    color: #e5f3ff;
    border: 1px solid #3c657e;
    border-radius: 6px;
}

.leaflet-control-layers label {
    color: #e5f3ff;
}

.leaflet-popup-content-wrapper {
    background: rgba(6, 18, 28, 0.96);
    color: #f2f7fa;
    border: 1px solid #4b7089;
}

.leaflet-popup-tip {
    background: rgba(6, 18, 28, 0.96);
}

.leaflet-popup-content strong {
    color: #63d8ff;
}

.leaflet-control-zoom a {
    background: rgba(6, 18, 28, 0.94);
    color: white;
    border-color: #46657a;
}

.leaflet-control-zoom a:hover {
    background: rgba(14, 42, 60, 0.97);
}



/* ==========================================================
   INTERNET_VITAL_POP_INTELLIGENCE_STYLES
   ========================================================== */

#iv-pop-intelligence {
    position: fixed;
    top: 0;
    right: -620px;
    width: min(580px, 94vw);
    height: 100vh;
    z-index: 10000;

    background:
        rgba(5, 14, 22, 0.97);

    color: #eef7fb;

    border-left:
        1px solid rgba(82, 180, 225, 0.45);

    box-shadow:
        -10px 0 35px rgba(0, 0, 0, 0.50);

    transition:
        right 0.22s ease;

    display: flex;
    flex-direction: column;

    backdrop-filter:
        blur(10px);
}

#iv-pop-intelligence.iv-pop-open {
    right: 0;
}


.iv-pop-header {
    flex: 0 0 auto;

    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    padding: 20px 20px 16px;

    border-bottom:
        1px solid rgba(105, 184, 220, 0.28);

    background:
        rgba(7, 24, 36, 0.98);
}


.iv-pop-eyebrow {
    color: #54cef7;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.8px;
}


.iv-pop-title {
    margin-top: 5px;

    color: #ffffff;

    font-size: 22px;
    font-weight: 800;

    line-height: 1.2;
}


.iv-pop-location {
    margin-top: 5px;

    color: #9cb3c0;
    font-size: 14px;
}


.iv-pop-close {
    width: 42px;
    height: 42px;

    border:
        1px solid rgba(127, 190, 220, 0.35);

    border-radius: 8px;

    background:
        rgba(20, 52, 70, 0.8);

    color: #ffffff;

    font-size: 28px;
    line-height: 1;

    cursor: pointer;
}


.iv-pop-close:hover {
    background:
        rgba(37, 92, 120, 0.95);
}


.iv-pop-body {
    flex: 1 1 auto;
    overflow-y: auto;

    padding: 16px 18px 40px;
}


.iv-pop-loading,
.iv-pop-error,
.iv-pop-empty {
    padding: 20px;

    border:
        1px solid rgba(124, 178, 203, 0.25);

    border-radius: 8px;

    background:
        rgba(19, 39, 51, 0.65);

    color: #afc3ce;
}


.iv-pop-error {
    color: #ffb2b2;
}


.iv-pop-section {
    margin-bottom: 12px;

    border:
        1px solid rgba(106, 177, 210, 0.25);

    border-radius: 9px;

    overflow: hidden;

    background:
        rgba(10, 30, 42, 0.74);
}


.iv-pop-section summary {
    padding: 13px 15px;

    cursor: pointer;

    font-size: 13px;
    font-weight: 800;

    letter-spacing: 0.6px;

    color: #83dcff;

    background:
        rgba(15, 48, 66, 0.75);
}


.iv-pop-section-body {
    padding: 14px;
}


.iv-pop-stats {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 8px;

    margin-bottom: 15px;
}


.iv-pop-stat {
    padding: 10px 8px;

    text-align: center;

    border:
        1px solid rgba(93, 176, 216, 0.24);

    border-radius: 7px;

    background:
        rgba(18, 53, 70, 0.65);
}


.iv-pop-stat-value {
    color: #ffffff;

    font-size: 20px;
    font-weight: 800;
}


.iv-pop-stat-label {
    margin-top: 2px;

    color: #8ea7b4;

    font-size: 11px;
    text-transform: uppercase;
}


.iv-pop-row {
    display: grid;

    grid-template-columns:
        145px minmax(0, 1fr);

    gap: 10px;

    padding: 8px 0;

    border-bottom:
        1px solid rgba(125, 167, 188, 0.12);
}


.iv-pop-row-label {
    color: #88a4b3;

    font-size: 12px;
    font-weight: 700;
}


.iv-pop-row-value {
    color: #f1f7fa;

    font-size: 13px;

    overflow-wrap: anywhere;
}


.iv-pop-main-link {
    margin-top: 14px;
}


.iv-pop-link {
    color: #61d7ff;
    text-decoration: none;
}


.iv-pop-link:hover {
    text-decoration: underline;
}


.iv-pop-company,
.iv-pop-network {
    padding: 12px 0;

    border-bottom:
        1px solid rgba(121, 170, 193, 0.16);
}


.iv-pop-company:last-child,
.iv-pop-network:last-child {
    border-bottom: 0;
}


.iv-pop-company-name {
    color: #ffffff;

    font-size: 14px;
    font-weight: 800;
}


.iv-pop-company-sub {
    margin-top: 4px;

    color: #9db3bf;

    font-size: 12px;

    overflow-wrap: anywhere;
}


.iv-pop-company-links {
    margin-top: 7px;

    font-size: 12px;
}


.iv-pop-asn {
    display: inline-block;

    margin-right: 6px;

    padding: 2px 6px;

    border-radius: 4px;

    background:
        rgba(50, 162, 210, 0.22);

    color: #6fdbff;

    font-size: 11px;
    font-weight: 800;
}


.iv-pop-network-name {
    color: #ffffff;

    font-size: 13px;
    font-weight: 700;
}


.iv-pop-network-meta {
    display: flex;
    flex-wrap: wrap;

    gap: 5px 12px;

    margin-top: 6px;

    color: #9cb0bb;

    font-size: 11px;
}


.iv-pop-connections {
    margin-top: 9px;

    padding-left: 10px;

    border-left:
        2px solid rgba(81, 207, 255, 0.35);
}


.iv-pop-connection {
    margin-bottom: 8px;

    color: #b9cbd4;

    font-size: 11px;
}


.iv-pop-connection strong {
    color: #77dcff;
}


.iv-pop-planning-grid {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 8px;
}


.iv-pop-planning-grid > div {
    padding: 12px 8px;

    border:
        1px solid rgba(89, 175, 216, 0.24);

    border-radius: 7px;

    background:
        rgba(16, 48, 65, 0.60);

    color: #9fb4bf;

    text-align: center;

    font-size: 11px;
}


.iv-pop-planning-grid strong {
    display: block;

    color: #ffffff;

    font-size: 18px;
}


.iv-pop-planning-note {
    margin-top: 12px;

    padding: 11px;

    border-left:
        3px solid #56cdef;

    background:
        rgba(31, 83, 105, 0.25);

    color: #aac0cb;

    font-size: 11px;

    line-height: 1.5;
}


.iv-pop-limit-note {
    margin-top: 12px;

    color: #e8bf68;

    font-size: 11px;
}


@media (max-width: 700px) {

    #iv-pop-intelligence {
        width: 100vw;
        right: -100vw;
    }

    .iv-pop-row {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .iv-pop-planning-grid {
        grid-template-columns: 1fr;
    }

}

/* INTERNET_VITAL_MOBILE_BEGIN */

/*
 * Internet Vital phone/tablet layout.
 * Desktop layout remains untouched.
 */

@media (max-width: 700px) {

    html,
    body {
        width: 100%;
        max-width: 100%;
        min-height: 100%;
        height: auto;
        overflow-x: hidden;
    }

    body {
        display: block;
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }


    /* ------------------------------------------------------
       HEADER
       ------------------------------------------------------ */

    .topbar {
        width: 100%;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 8px;
        padding: 10px 12px;
    }

    .topbar > * {
        min-width: 0;
    }

    h1 {
        font-size: 19px;
        line-height: 1.15;
        letter-spacing: 1.5px;
        overflow-wrap: anywhere;
    }

    .subtitle {
        margin-top: 4px;
        font-size: 9px;
        line-height: 1.4;
        letter-spacing: 1px;
    }

    .live {
        font-size: 11px;
        white-space: nowrap;
    }


    /* ------------------------------------------------------
       STAT COUNTERS
       ------------------------------------------------------ */

    .stats {
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat {
        min-width: 0;
        padding: 8px 9px;
        border-bottom: 1px solid #173149;
    }

    .label {
        font-size: 8px;
        line-height: 1.25;
        letter-spacing: .7px;
        overflow-wrap: anywhere;
    }

    .value {
        margin-top: 3px;
        font-size: 18px;
        line-height: 1.15;
        overflow-wrap: anywhere;
    }


    /* ------------------------------------------------------
       MAP TOOLBAR / FILTERS
       ------------------------------------------------------ */

    .toolbar {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        align-items: stretch;
        gap: 7px;
        padding: 8px;
        font-size: 11px;
    }

    .toolbar label {
        display: flex;
        align-items: center;
        min-height: 42px;
        padding: 7px 9px;
        border: 1px solid #173149;
        border-radius: 6px;
        background: #0a1824;
        line-height: 1.2;
        touch-action: manipulation;
    }

    .toolbar input[type="checkbox"] {
        width: 20px;
        height: 20px;
        margin-right: 7px;
        flex: 0 0 auto;
    }

    #map-status {
        width: 100%;
        margin-left: 0;
        padding: 4px 2px;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }


    /* ------------------------------------------------------
       MAP + INCIDENTS
       ------------------------------------------------------ */

    .layout {
        width: 100%;
        display: block;
        min-height: 0;
    }

    .map-panel {
        position: relative;
        width: 100%;
        height: 58vh;
        min-height: 390px;
        max-height: 650px;
    }

    #map {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
    }

    .incident-panel {
        width: 100%;
        max-height: none;
        overflow: visible;
        border-left: none;
        border-top: 1px solid #173149;
    }

    .panel-title {
        padding: 12px;
        font-size: 11px;
    }

    .event {
        padding: 12px;
    }

    .event-title {
        font-size: 14px;
        line-height: 1.3;
    }

    .event-detail {
        font-size: 12px;
        line-height: 1.55;
        overflow-wrap: anywhere;
    }


    /* ------------------------------------------------------
       LEAFLET TOUCH CONTROLS
       ------------------------------------------------------ */

    .leaflet-control-zoom a {
        width: 44px !important;
        height: 44px !important;
        line-height: 44px !important;
        font-size: 22px !important;
    }

    .leaflet-control-layers {
        max-width: calc(100vw - 28px);
        font-size: 12px;
    }

    .leaflet-control-layers-expanded {
        padding: 10px;
        max-height: 55vh;
        overflow-y: auto;
    }

    .leaflet-popup {
        max-width: calc(100vw - 44px);
    }

    .leaflet-popup-content {
        width: auto !important;
        max-width: calc(100vw - 80px);
        margin: 12px 14px;
        line-height: 1.4;
        overflow-wrap: anywhere;
    }


    /* ------------------------------------------------------
       POP INTELLIGENCE DRAWER
       ------------------------------------------------------ */

    #iv-pop-intelligence {
        right: -100vw;
        width: 100vw;
        max-width: none;
        height: 100dvh;
        border-left: none;
    }

    #iv-pop-intelligence.iv-pop-open {
        right: 0;
    }

    .iv-pop-header {
        padding:
            calc(12px + env(safe-area-inset-top))
            12px
            12px;
        gap: 8px;
    }

    .iv-pop-eyebrow {
        font-size: 10px;
        letter-spacing: 1.2px;
    }

    .iv-pop-title {
        font-size: 18px;
        line-height: 1.2;
        overflow-wrap: anywhere;
    }

    .iv-pop-location {
        font-size: 12px;
        overflow-wrap: anywhere;
    }

    .iv-pop-close {
        flex: 0 0 46px;
        width: 46px;
        height: 46px;
        font-size: 30px;
        touch-action: manipulation;
    }

    .iv-pop-body {
        padding:
            12px
            10px
            calc(28px + env(safe-area-inset-bottom));
        overflow-x: hidden;
    }

    .iv-pop-section {
        width: 100%;
    }

    .iv-pop-section summary {
        min-height: 44px;
        padding: 13px 12px;
        font-size: 12px;
    }

    .iv-pop-section-body {
        padding: 11px;
        overflow-x: auto;
    }

    .iv-pop-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .iv-pop-stat {
        min-width: 0;
    }

    .iv-pop-stat-value {
        font-size: 18px;
        overflow-wrap: anywhere;
    }

    .iv-pop-stat-label {
        font-size: 9px;
        overflow-wrap: anywhere;
    }

    .iv-pop-row {
        grid-template-columns: 1fr;
        gap: 3px;
        padding: 9px 0;
    }

    .iv-pop-row-label,
    .iv-pop-row-value {
        min-width: 0;
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    #iv-pop-intelligence table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }


    /* ------------------------------------------------------
       FOOTER
       ------------------------------------------------------ */

    footer {
        width: 100%;
        flex-direction: column;
        justify-content: flex-start;
        gap: 4px;
        padding:
            8px
            10px
            calc(8px + env(safe-area-inset-bottom));
        font-size: 9px;
        line-height: 1.4;
    }
}


@media (max-width: 430px) {

    h1 {
        font-size: 17px;
        letter-spacing: 1px;
    }

    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat {
        padding: 7px;
    }

    .value {
        font-size: 16px;
    }

    .toolbar {
        gap: 5px;
        padding: 6px;
    }

    .toolbar label {
        flex: 1 1 calc(50% - 5px);
        min-width: 135px;
        padding: 6px 7px;
    }

    .map-panel {
        height: 55vh;
        min-height: 350px;
    }

    .iv-pop-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* INTERNET_VITAL_MOBILE_END */
