:root {
    --bg: #f5f1e8;
    --panel: #fffdf8;
    --ink: #1f2937;
    --muted: #667085;
    --line: #e7e0d4;
    --accent: #0d7c66;
    --accent2: #ef8354;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Segoe UI, Tahoma, sans-serif;
    color: var(--ink);
    background: linear-gradient(180deg, #faf7f1, var(--bg));
}

.shell {
    width: min(1260px, calc(100% - 24px));
    margin: 0 auto;
    padding: 24px 0 40px;
}

.topbar,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: 0 18px 48px rgba(28, 35, 44, 0.08);
}

.nav-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.topbar-nav {
    display: grid;
    gap: 10px;
}

.topbar-menu-label {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nav-pills a {
    border: 1px solid #d7d0c3;
    border-radius: 999px;
    padding: 10px 14px;
    color: var(--ink);
    text-decoration: none;
    background: #fff;
}

.nav-pills a.active {
    background: #0f766e;
    color: #fff;
    border-color: #0f766e;
    font-weight: 700;
}

.topbar-copy h1 {
    margin: 0 0 6px;
    font: 700 clamp(1.4rem, 3vw, 2rem) / 1.02 Georgia, serif;
}

.topbar-copy p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.topbar-copy p:empty {
    display: none;
}

.filter-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.filter-toolbar-copy {
    display: grid;
    gap: 4px;
}

.filter-toolbar-copy strong {
    font-size: 0.94rem;
}

.filter-toolbar-copy span {
    color: var(--muted);
    font-size: 0.84rem;
}

.filter-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.action-link,
.action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d7d0c3;
    border-radius: 999px;
    padding: 10px 14px;
    color: var(--ink);
    background: #fff;
    text-decoration: none;
    font: inherit;
    cursor: pointer;
}

.action-link.primary,
.action-button.primary {
    background: #0f766e;
    color: #fff;
    border-color: #0f766e;
    font-weight: 700;
}

.panel {
    padding: 20px;
}

.icon-button,
.toggle-button {
    border: 1px solid #d7d0c3;
    background: #fff;
    color: var(--ink);
    border-radius: 999px;
    padding: 9px 13px;
    font: inherit;
    cursor: pointer;
}

.icon-button:hover,
.toggle-button:hover {
    background: #f7f2e9;
}

.hint,
.muted,
.error,
.card-head p {
    color: var(--muted);
}

.error {
    color: #b42318;
    margin-top: 10px;
}

.main {
    display: grid;
    gap: 18px;
}

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

.grid-2 {
    display: grid;
    gap: 18px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.card-head h2 {
    margin: 0;
    font-size: 1rem;
}

.card-head p {
    margin: 4px 0 0;
    font-size: 0.92rem;
}

.stat .label {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat .value {
    margin-top: 8px;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.stat .meta {
    margin-top: 8px;
    font-size: 0.92rem;
    color: var(--muted);
}

.loading-panel {
    position: relative;
    overflow: hidden;
}

.skeleton {
    position: relative;
    overflow: hidden;
    background: #efe7da;
    border-radius: 12px;
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0));
    animation: skeleton-slide 1.2s ease-in-out infinite;
}

.skeleton.line {
    height: 14px;
    margin-top: 10px;
}

.skeleton.line.short {
    width: 38%;
}

.skeleton.line.medium {
    width: 62%;
}

.skeleton.line.long {
    width: 100%;
}

.skeleton.value {
    height: 34px;
    width: 55%;
    margin-top: 12px;
    border-radius: 14px;
}

.skeleton.bar {
    height: 16px;
    width: 100%;
    border-radius: 999px;
}

.skeleton.map {
    height: 100%;
    width: 100%;
}

.loading-copy,
.map-loading-copy {
    color: var(--muted);
    font-size: 0.92rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    background: #def3ed;
    color: var(--accent);
}

.badge.priority {
    background: #ffeadf;
    color: #a14f1e;
}

.list-shell,
.table-shell {
    overflow: hidden;
    transition: max-height 0.32s ease, opacity 0.24s ease;
}

.list {
    display: grid;
    gap: 11px;
}

.list-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-start;
}

.bar-row {
    display: grid;
    gap: 12px;
    align-items: center;
}

.bar-row.active {
    background: rgba(13, 124, 102, 0.08);
    border-radius: 16px;
    padding: 10px 12px;
    margin: 0 -12px;
}

.bar-row button {
    border: 0;
    background: none;
    padding: 0;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font: inherit;
}

.bar-label {
    font-size: 0.94rem;
    font-weight: 600;
}

.bar-label small {
    display: block;
    color: var(--muted);
    font-weight: 400;
}

.track {
    height: 14px;
    background: #eee6d8;
    border-radius: 999px;
    overflow: hidden;
}

.fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #36a488);
    border-radius: 999px;
}

.fill.priority {
    background: linear-gradient(90deg, var(--accent2), #f6b073);
}

.bar-value {
    text-align: right;
    font-size: 0.92rem;
    font-weight: 700;
}

.legend {
    display: grid;
    gap: 10px;
}

.legend-item {
    display: grid;
    grid-template-columns: 14px 1fr auto;
    gap: 10px;
    align-items: center;
    font-size: 0.92rem;
}

.swatch {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}

.swatch.priority {
    background: var(--accent2);
}

.swatch.non-priority {
    background: var(--accent);
}

.map-stage {
    position: relative;
}

.map-loading {
    display: none;
    align-items: stretch;
    justify-content: stretch;
    z-index: 450;
    pointer-events: none;
}

.map-loading.is-active {
    display: flex;
}

.map-loading-card {
    position: relative;
    width: 100%;
}

.leaflet-container {
    font: inherit;
}

.leaflet-control.map-info,
.leaflet-control.map-legend {
    color: var(--ink);
}

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

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 0.93rem;
}

th {
    color: var(--muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table-wrap {
    overflow: auto;
}

@keyframes skeleton-slide {
    100% {
        transform: translateX(100%);
    }
}

@media (max-width: 1080px) {
    .layout,
    .grid-4,
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .shell {
        width: min(100% - 20px, 1260px);
        padding: 16px 0 28px;
    }

    .topbar,
    .panel {
        border-radius: 20px;
    }

    .panel,
    .topbar {
        padding: 16px;
    }

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

    .bar-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .bar-value {
        text-align: left;
        min-width: 0;
    }

    .card-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 560px) {
    .shell {
        width: min(100% - 14px, 1260px);
        padding: 12px 0 22px;
    }

    .topbar,
    .panel {
        border-radius: 18px;
    }

    .panel,
    .topbar {
        padding: 14px;
    }

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

    th,
    td,
    .card-head p,
    .hint,
    .muted,
    .stat .meta {
        font-size: 0.88rem;
    }

    .filter-toolbar-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
    }

    .action-link,
    .action-button {
        width: 100%;
    }
}
