:root {
    --color-header: #2c3e50;
    --color-page: #f4f7f6;
    --color-surface: #ffffff;
    --color-surface-soft: #eef2f5;
    --color-text: #333333;
    --color-muted: #6c757d;
    --color-line: #cddde6;
    --color-accent: #3498db;
    --color-primary: #007bff;
    --color-health-1: #28a745;
    --color-health-2: #ffc107;
    --color-health-3: #e8590c;
    --color-health-4: #dc3545;
    --color-health-5: #721c24;
    --shadow-panel: 0 2px 10px rgba(15, 23, 42, 0.16);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    background: var(--color-page);
    color: var(--color-text);
    font-family: Tahoma, Geneva, Verdana, sans-serif;
}

.topbar {
    align-items: center;
    background: var(--color-header);
    color: #ecf0f1;
    display: flex;
    gap: 16px;
    height: 76px;
    justify-content: space-between;
    padding: 10px 18px;
}

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

.crest-button {
    background: transparent;
    border: 0;
    cursor: pointer;
    flex: 0 0 44px;
    height: 52px;
    padding: 0;
    width: 44px;
}

.crest-button:focus-visible {
    outline: 3px solid #80bdff;
    outline-offset: 3px;
}

.crest {
    flex: 0 0 44px;
    height: 52px;
    object-fit: contain;
    width: 44px;
}

.municipality {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}

h1 {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.25;
    margin: 0;
}

.admin-link {
    border: 1px solid rgba(236, 240, 241, 0.45);
    color: #ecf0f1;
    padding: 8px 12px;
    text-decoration: none;
    white-space: nowrap;
}

.workspace {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr) 360px;
    height: calc(100vh - 76px);
    min-height: 520px;
}

.filters,
.details {
    background: var(--color-surface);
    border-right: 1px solid var(--color-line);
    overflow: auto;
    padding: 16px;
}

.details {
    border-left: 1px solid var(--color-line);
    border-right: 0;
}

.filter-row,
.filter-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-row {
    margin-bottom: 12px;
}

.filter-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr 1fr;
}

label {
    color: #2c3e50;
    font-size: 13px;
    font-weight: 700;
}

input,
select {
    border: 1px solid #ced4da;
    color: var(--color-text);
    font: inherit;
    min-height: 36px;
    padding: 7px 8px;
}

input:focus,
select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.18);
    outline: none;
}

.map {
    min-width: 0;
}

.stats {
    align-items: baseline;
    background: var(--color-surface-soft);
    border: 1px solid var(--color-line);
    display: flex;
    gap: 8px;
    margin: 14px 0;
    padding: 12px;
}

.problem-toggle {
    align-items: center;
    background: #f8f9fa;
    border: 1px solid var(--color-line);
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin-top: 12px;
    padding: 10px;
}

.problem-toggle input {
    min-height: 0;
}

.export-actions {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr 1fr;
    margin-top: 12px;
}

.export-actions a {
    background: var(--color-header);
    color: #ecf0f1;
    display: block;
    font-weight: 700;
    padding: 9px 10px;
    text-align: center;
    text-decoration: none;
}

.export-actions a:hover {
    background: #2980b9;
}

.stats strong {
    color: var(--color-header);
    font-size: 28px;
}

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

.legend span {
    align-items: center;
    display: flex;
    gap: 8px;
}

.health {
    border: 1px solid rgba(0, 0, 0, 0.18);
    display: inline-block;
    height: 14px;
    width: 14px;
}

.health-1 {
    background: var(--color-health-1);
}

.health-2 {
    background: var(--color-health-2);
}

.health-3 {
    background: var(--color-health-3);
}

.health-4 {
    background: var(--color-health-4);
}

.health-5 {
    background: var(--color-health-5);
}

.tree-marker {
    align-items: center;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: var(--shadow-panel);
    display: flex;
    height: 18px;
    justify-content: center;
    width: 18px;
}

.tree-marker::after {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    content: "";
    height: 5px;
    width: 5px;
}

.marker-health-1 {
    background: var(--color-health-1);
}

.marker-health-2 {
    background: var(--color-health-2);
}

.marker-health-3 {
    background: var(--color-health-3);
}

.marker-health-4 {
    background: var(--color-health-4);
}

.marker-health-5 {
    background: var(--color-health-5);
}

.marker-health-null {
    background: var(--color-muted);
}

.tree-cluster {
    align-items: center;
    border: 3px solid #ffffff;
    border-radius: 50%;
    box-shadow: var(--shadow-panel);
    color: #ffffff;
    display: flex;
    font-weight: 700;
    justify-content: center;
}

.tree-cluster span {
    align-items: center;
    border-radius: 50%;
    display: flex;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.cluster-health-1 {
    background: var(--color-health-1);
}

.cluster-health-2 {
    background: var(--color-health-2);
    color: #212529;
}

.cluster-health-3 {
    background: var(--color-health-3);
}

.cluster-health-4 {
    background: var(--color-health-4);
}

.cluster-health-5 {
    background: var(--color-health-5);
}

.cluster-health-null {
    background: var(--color-muted);
}

.details-title {
    color: var(--color-header);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

.detail-row {
    border-bottom: 1px solid #e9ecef;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(96px, 120px) minmax(0, 1fr);
    padding: 8px 0;
}

.detail-row dt {
    color: var(--color-muted);
    font-weight: 700;
}

.detail-row dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: normal;
}

.detail-row:last-child {
    grid-template-columns: 1fr;
    gap: 4px;
}

.detail-row:last-child dt,
.detail-row:last-child dd {
    grid-column: 1;
}

.photo-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr 1fr;
    margin-top: 12px;
}

.photo-grid img {
    aspect-ratio: 4 / 3;
    object-fit: cover;
    width: 100%;
}

@media (max-width: 1100px) {
    .workspace {
        grid-template-columns: 280px 1fr;
    }

    .details {
        display: none;
    }
}

@media (max-width: 760px) {
    .topbar {
        height: auto;
    }

    .admin-link {
        display: none;
    }

    .workspace {
        grid-template-columns: 1fr;
        height: auto;
    }

    .filters {
        border-right: 0;
    }

    .map {
        height: 68vh;
    }
}
