body {
    margin: 0;
    background: #e7eef4;
    color: #1f2937;
    font-family: Arial, Helvetica, sans-serif;
}

a {
    color: #0f4c81;
}

.page {
    max-width: 1380px;
    margin: 0 auto;
    padding: 14px 18px;
}

.site-header {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(260px, 380px) minmax(220px, auto);
    gap: 18px;
    align-items: end;
    background: #f8fbfd;
    border-top: 5px solid #0f4c81;
    border-bottom: 1px solid #cbd8e4;
    padding: 14px 16px 13px;
}

.site-header a {
    color: #0f4c81;
}

.site-kicker {
    color: #0f4c81;
    display: inline-block;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 4px;
    text-decoration: none;
}

.site-kicker:hover,
.site-kicker:focus {
    color: #145994;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.site-header h1 {
    margin: 0 0 4px;
    color: #0f2740;
    font-size: 28px;
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.site-title-link {
    color: inherit;
    text-decoration: none;
}

.site-title-link:hover,
.site-title-link:focus {
    color: #145994;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.site-header p {
    margin: 0;
    max-width: 780px;
    color: #475569;
    font-size: 14px;
    line-height: 1.35;
}

.blacknight-logo {
    justify-self: center;
    align-self: center;
    display: block;
    max-width: 360px;
    width: 100%;
    text-decoration: none;
}

.blacknight-logo img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 82px;
    object-fit: contain;
    border-radius: 4px;
}

.header-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 9px;
    flex: 0 0 auto;
}

.partner-credit {
    color: #475569;
    font-size: 14px;
    line-height: 1.35;
    text-align: right;
}

.partner-credit a {
    color: #0f4c81;
    font-weight: bold;
    text-decoration: none;
}

.top-links {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
    font-size: 13px;
}

.top-links a {
    color: #0f4c81;
    background: #e8f0f7;
    border: 1px solid #c7d7e6;
    border-radius: 999px;
    padding: 6px 10px;
    font-weight: bold;
    text-decoration: none;
}

.top-links a:hover {
    background: #dbeaf6;
}

.notice {
    margin: 18px 0;
    background: #fff8df;
    border: 1px solid #eab308;
    border-radius: 12px;
    padding: 14px 16px;
    color: #7a4b00;
}

.notice.warning {
    background: #fff1f2;
    color: #9f1239;
    border-color: #fda4af;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.info-card,
.toolbar,
.table-card {
    background: #fff;
    border: 1px solid #d7e2ec;
    box-shadow: none;
}

.info-card {
    border-radius: 8px;
    padding: 10px 12px;
}

.label {
    color: #64748b;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.value {
    color: #0f172a;
    font-size: 18px;
    font-weight: bold;
}

.small-value {
    font-size: 15px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    border-radius: 8px;
    margin-top: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
}

.toolbar-left {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    flex: 1 1 320px;
}

.toolbar-right {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    flex: 0 0 auto;
}

.road-control-cluster {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    margin-left: auto;
}

.search-wrap {
    flex: 1 1 320px;
}

#roadSearch {
    width: 320px;
    max-width: 100%;
    padding: 9px 12px;
    border: 1px solid #c8d3df;
    border-radius: 10px;
    font-size: 14px;
    box-sizing: border-box;
}

.metric-group,
.view-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #edf2f7;
    border-radius: 999px;
    padding: 4px;
}

.view-group.hidden-view-option {
    visibility: hidden;
    pointer-events: none;
}

.metric-group button,
.view-group button {
    border: 0;
    background: transparent;
    color: #27496d;
    font-weight: bold;
    padding: 7px 12px;
    border-radius: 999px;
    cursor: pointer;
    min-height: 36px;
}

.metric-group button.active,
.view-group button.active {
    background: #145994;
    color: #fff;
}

.map-card {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
}

#roadsMap {
    height: 730px;
    background: #a9d6df;
}

.roads-legend {
    position: absolute;
    left: 14px;
    bottom: 14px;
    z-index: 500;
    background: rgba(255,255,255,0.92);
    border-radius: 10px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
    padding: 10px 12px;
    font-weight: bold;
}

.roads-legend-title {
    margin-bottom: 6px;
}

.risk-legend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    font-weight: normal;
}

.risk-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.risk-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    display: inline-block;
}

.road-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 2px solid #fff;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.26);
}

.road-popup h3 {
    margin: 0 0 6px;
}

.road-popup table {
    border-collapse: collapse;
    width: 100%;
}

.road-popup th,
.road-popup td {
    text-align: left;
    padding: 3px 8px 3px 0;
    white-space: nowrap;
}

.table-card {
    margin-top: 16px;
    padding: 16px;
}

.table-card h2 {
    margin: 0 0 12px;
    color: #0f4c81;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #0f4c81;
    color: #fff;
    text-align: left;
    padding: 9px 10px;
}

td {
    border-bottom: 1px solid #d9e3ee;
    padding: 9px 10px;
}

.hidden-row {
    display: none;
}

.site-footer {
    margin: 20px 0 8px;
    text-align: center;
    color: #64748b;
    font-size: 13px;
    line-height: 1.6;
}

@media (max-width: 820px) {
    .page {
        padding: 6px;
    }

    .site-header {
        display: block;
        padding: 10px;
        border-top-width: 4px;
    }

    .site-kicker {
        font-size: 10px;
        margin-bottom: 3px;
    }

    .site-header h1 {
        font-size: 19px;
        margin-bottom: 3px;
    }

    .site-header p {
        font-size: 11px;
        line-height: 1.3;
    }

    .blacknight-logo {
        max-width: 260px;
        margin: 9px 0 0;
        justify-self: start;
    }

    .blacknight-logo img {
        max-height: 58px;
    }

    .header-side {
        align-items: flex-start;
        gap: 7px;
        margin-top: 8px;
    }

    .partner-credit {
        text-align: left;
        font-size: 12px;
    }

    .top-links {
        justify-content: flex-start;
        font-size: 12px;
    }

    .top-links a {
        padding: 5px 8px;
    }

    .info-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
        margin-top: 8px;
    }

    .info-card {
        padding: 7px 6px;
        border-radius: 10px;
    }

    .label {
        font-size: 8px;
        letter-spacing: 0.02em;
        margin-bottom: 3px;
    }

    .value {
        font-size: 15px;
    }

    .toolbar {
        display: block;
        padding: 8px;
        gap: 8px;
        margin-top: 8px;
        border-radius: 8px;
    }

    .toolbar-left,
    .toolbar-right {
        width: 100%;
        flex: none;
    }

    .road-control-cluster {
        display: block;
        margin-left: 0;
    }

    #roadSearch {
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 10px;
    }

    .metric-group,
    .view-group {
        display: flex;
        border-radius: 14px;
        margin-top: 8px;
        width: 100%;
        box-sizing: border-box;
    }

    .view-group.hidden-view-option {
        display: none;
    }

    .metric-group button,
    .view-group button {
        flex: 1 1 auto;
    }

    #roadsMap {
        height: 74vh;
        min-height: 560px;
        max-height: 760px;
    }

    .roads-legend {
        right: 10px;
        left: 10px;
        bottom: 10px;
    }
}
