:root {
    --blue-900: #07345b;
    --blue-700: #006da8;
    --blue-100: #e8f4fb;
    --green-700: #1f7a4d;
    --green-100: #e6f4ec;
    --amber-600: #b77912;
    --red-700: #b9161b;
    --teal-700: #087f83;
    --violet-700: #6d5bd0;
    --ink: #172636;
    --muted: #627284;
    --line: #d8e0e8;
    --surface: #ffffff;
    --bg: #f3f7fa;
    --shadow: 0 14px 32px rgba(13, 45, 77, 0.12);
}

* {
    box-sizing: border-box;
    letter-spacing: 0;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
    font: inherit;
}

.topbar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto auto;
    align-items: center;
    gap: 18px;
    min-height: 72px;
    padding: 12px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

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

.brand img {
    width: 118px;
    height: 44px;
    object-fit: contain;
    background: #fff;
}

.brand strong {
    display: block;
    font-size: 20px;
    line-height: 1.1;
}

.brand span,
.panel-title span,
.section-heading span {
    color: var(--muted);
    font-size: 13px;
}

.mode-tabs,
.profile-switch {
    display: inline-grid;
    grid-auto-flow: column;
    background: #edf3f7;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 3px;
}

.mode-tab,
.profile-button {
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    padding: 8px 12px;
    cursor: pointer;
}

.mode-tab.is-active,
.profile-button.is-active {
    background: var(--surface);
    color: var(--blue-900);
    box-shadow: 0 1px 6px rgba(7, 52, 91, 0.12);
}

.export-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 8px;
    color: #fff;
    background: var(--blue-700);
    text-decoration: none;
    white-space: nowrap;
}

.dashboard-shell {
    display: grid;
    grid-template-columns: 286px minmax(420px, 1fr) 374px;
    gap: 14px;
    height: calc(100vh - 72px);
    padding: 14px;
}

.filter-panel,
.map-panel,
.insight-panel {
    min-width: 0;
}

.filter-panel,
.insight-panel {
    overflow: auto;
}

.filter-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.panel-title,
.field,
.layer-toggle,
.access-card,
.chart-panel,
.list-panel,
.detail-panel,
.kpi-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.panel-title {
    padding: 16px;
}

.panel-title h1,
.section-heading h2,
.detail-panel h2 {
    margin: 0;
    font-size: 18px;
}

.field {
    display: grid;
    gap: 8px;
    padding: 12px;
}

.field span {
    color: var(--blue-900);
    font-weight: 700;
}

.field select,
.search-box input {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    padding: 0 10px;
}

.profile-switch {
    width: 100%;
}

.profile-button {
    min-height: 40px;
}

.layer-toggle {
    display: grid;
    gap: 10px;
    padding: 14px;
}

.layer-toggle label {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--ink);
}

.access-panel {
    display: grid;
    gap: 10px;
}

.access-card {
    padding: 12px;
}

.access-card span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.access-card strong {
    display: block;
    margin-top: 4px;
    line-height: 1.3;
}

.map-panel {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.map-toolbar {
    position: absolute;
    z-index: 500;
    top: 14px;
    left: 14px;
    right: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    pointer-events: none;
}

.search-box,
.map-legend {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(13, 45, 77, 0.12);
}

.search-box {
    display: grid;
    grid-template-columns: 34px minmax(170px, 300px);
    align-items: center;
    min-height: 44px;
}

.search-box span {
    color: var(--muted);
    text-align: center;
    font-size: 24px;
}

.search-box input {
    min-height: 42px;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0 8px 8px 0;
}

.map-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 0 12px;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.legend-dot,
.legend-line {
    display: inline-block;
    vertical-align: middle;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.legend-dot.critical {
    background: var(--red-700);
}

.legend-line {
    width: 22px;
    height: 4px;
    margin-right: 5px;
}

.legend-line.high {
    background: #df2f28;
}

.legend-line.medium {
    background: #16854a;
}

#map {
    width: 100%;
    height: 100%;
    min-height: 560px;
}

.leaflet-container {
    font-family: inherit;
    background:
        linear-gradient(90deg, rgba(230, 242, 247, 0.78), rgba(222, 239, 230, 0.78)),
        radial-gradient(circle at 78% 42%, #ccecf7 0, #ccecf7 33%, #f4f8fa 34%, #f4f8fa 100%);
}

.state-label {
    display: grid;
    place-items: center;
    color: #51687a;
    font-size: 11px;
    font-weight: 800;
    text-shadow: 0 1px 0 #fff;
    pointer-events: none;
}

.neighbor-label,
.zone-label,
.city-label,
.hub-label,
.ocean-label,
.map-note-label {
    display: grid;
    place-items: center;
    pointer-events: none;
    text-align: center;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

.neighbor-label {
    color: #9aa9b3;
    font-size: 10px;
    font-weight: 700;
}

.zone-label {
    border: 1px solid rgba(84, 111, 81, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.68);
    color: #556b44;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.city-label {
    justify-items: start;
    color: #425767;
    font-size: 10px;
    font-weight: 650;
    opacity: 0.78;
}

.city-label.capital {
    color: #173a59;
    font-size: 11px;
    font-weight: 800;
    opacity: 0.94;
}

.city-label.port,
.city-label.industrial {
    color: #0d6f7f;
    font-weight: 800;
    opacity: 0.88;
}

.hub-label {
    border: 1px solid rgba(8, 127, 131, 0.24);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.76);
    color: #087f83;
    font-size: 10px;
    font-weight: 800;
}

.ocean-label {
    color: rgba(42, 121, 154, 0.38);
    font-size: 18px;
    font-weight: 800;
    text-transform: uppercase;
}

.map-note-label {
    color: rgba(61, 93, 112, 0.46);
    font-size: 11px;
    font-weight: 800;
}

.map-marker {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 3px solid #fff;
    border-radius: 50%;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 6px 15px rgba(12, 30, 45, 0.28);
}

.map-marker.project {
    border-radius: 7px;
    background: var(--green-700);
}

.insight-panel {
    display: grid;
    grid-auto-rows: max-content;
    gap: 14px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.kpi-card {
    min-height: 118px;
    padding: 14px;
    border-left: 5px solid var(--blue-700);
}

.kpi-card[data-tone="green"] {
    border-left-color: var(--green-700);
}

.kpi-card[data-tone="amber"] {
    border-left-color: var(--amber-600);
}

.kpi-card[data-tone="red"] {
    border-left-color: var(--red-700);
}

.kpi-card[data-tone="teal"] {
    border-left-color: var(--teal-700);
}

.kpi-card[data-tone="violet"] {
    border-left-color: var(--violet-700);
}

.kpi-card span {
    color: var(--muted);
    font-size: 12px;
}

.kpi-value {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 8px 0 5px;
}

.kpi-value strong {
    font-size: 30px;
    line-height: 1;
}

.kpi-value small {
    color: var(--muted);
}

.chart-panel,
.list-panel,
.detail-panel {
    padding: 14px;
}

.section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.donut-wrap {
    display: grid;
    grid-template-columns: 136px 1fr;
    align-items: center;
    gap: 14px;
}

.donut {
    width: 136px;
    height: 136px;
    border-radius: 50%;
    position: relative;
    background: conic-gradient(var(--blue-700) 0deg, var(--blue-700) 360deg);
}

.donut::after {
    content: "";
    position: absolute;
    inset: 28px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line);
}

.legend-list {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.legend-row {
    display: grid;
    grid-template-columns: 12px 1fr auto;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

.legend-row i {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.bars {
    display: grid;
    grid-template-columns: repeat(6, minmax(30px, 1fr));
    align-items: end;
    gap: 10px;
    min-height: 154px;
}

.bar-item {
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 6px;
    min-width: 0;
}

.bar-track {
    display: flex;
    align-items: end;
    justify-content: center;
    height: 118px;
    border-radius: 7px;
    background: #edf3f7;
    overflow: hidden;
}

.bar-fill {
    width: 64%;
    min-height: 10px;
    border-radius: 7px 7px 0 0;
    background: var(--blue-700);
}

.bar-item.is-active .bar-fill {
    background: var(--green-700);
}

.bar-label {
    color: var(--muted);
    text-align: center;
    font-size: 12px;
}

.feature-list {
    display: grid;
    gap: 9px;
    max-height: 290px;
    overflow: auto;
    padding-right: 2px;
}

.feature-button {
    display: grid;
    grid-template-columns: 10px 1fr auto;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 58px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 10px;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.feature-button:hover,
.feature-button.is-active {
    border-color: var(--blue-700);
    box-shadow: 0 8px 20px rgba(0, 109, 168, 0.12);
}

.priority-pill {
    width: 10px;
    height: 36px;
    border-radius: 999px;
}

.feature-title {
    min-width: 0;
}

.feature-title strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.feature-title span,
.feature-meta {
    color: var(--muted);
    font-size: 12px;
}

.feature-meta {
    white-space: nowrap;
}

.detail-panel {
    min-height: 160px;
}

.detail-panel p {
    color: var(--muted);
    line-height: 1.45;
}

.detail-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.metric-chip {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px;
    background: #fbfdfe;
}

.metric-chip span {
    display: block;
    color: var(--muted);
    font-size: 11px;
}

.metric-chip strong {
    display: block;
    margin-top: 3px;
    overflow-wrap: anywhere;
    font-size: 13px;
}

.empty-state {
    color: var(--muted);
    padding: 12px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    text-align: center;
}

@media (max-width: 1260px) {
    .dashboard-shell {
        grid-template-columns: 260px minmax(420px, 1fr);
        height: auto;
    }

    .insight-panel {
        grid-column: 1 / -1;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }

    .kpi-grid,
    .detail-panel {
        grid-column: 1 / -1;
    }

    .map-panel {
        min-height: 620px;
    }
}

@media (max-width: 860px) {
    .topbar {
        grid-template-columns: 1fr;
    }

    .mode-tabs {
        width: 100%;
    }

    .export-link {
        width: 100%;
    }

    .dashboard-shell,
    .insight-panel {
        grid-template-columns: 1fr;
    }

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

    .map-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .map-legend {
        justify-content: center;
        white-space: normal;
    }
}

@media (max-width: 520px) {
    .dashboard-shell {
        padding: 8px;
    }

    .brand img {
        width: 94px;
    }

    .kpi-grid,
    .donut-wrap,
    .detail-metrics {
        grid-template-columns: 1fr;
    }

    .donut {
        justify-self: center;
    }
}
