:root {
    color-scheme: dark;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: #071b22;
    color: #eaf4f3;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    --bg-deep: #071b22;
    --bg-panel: #0b2129;
    --bg-panel-strong: #102a31;
    --bg-panel-soft: rgba(255, 255, 255, 0.025);
    --line-soft: rgba(166, 210, 209, 0.12);
    --text: #eaf4f3;
    --text-soft: #9bb5b7;
    --muted: #8fa9aa;
    --teal: #52d9bd;
    --teal-strong: #19c7a3;
    --accent: #69cdbd;
    --gold: #f5b942;
    --red: #f06464;
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background: #071b22;
    color: var(--text);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.home-page {
    background:
        radial-gradient(circle at top, rgba(82, 217, 189, 0.08), transparent 30%),
        linear-gradient(180deg, #061a1f 0%, #081d23 100%);
}

.home-container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.home-header {
    padding: 24px 0 10px;
    border-bottom: 1px solid var(--line-soft);
    background: rgba(9, 25, 31, 0.72);
    backdrop-filter: blur(12px);
}

.home-nav {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 20px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 18px;
    border: 1px solid rgba(82, 217, 189, 0.24);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(82, 217, 189, 0.45);
    background: rgba(82, 217, 189, 0.09);
}

.nav-link-primary {
    background: linear-gradient(135deg, rgba(82, 217, 189, 0.15), rgba(25, 199, 163, 0.12));
}

.hero-section {
    padding: 42px 0 32px;
}

.hero-copy {
    max-width: 760px;
}

.badge {
    display: inline-flex;
    align-items: center;
    margin: 0 0 16px;
    padding: 8px 12px;
    border: 1px solid rgba(105, 205, 189, 0.24);
    border-radius: 999px;
    background: rgba(82, 217, 189, 0.06);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.home-page h1 {
    margin: 0;
    font-size: clamp(2.8rem, 4vw, 5.3rem);
    line-height: 0.96;
    letter-spacing: -0.06em;
}

.home-page h1 span {
    color: var(--teal);
}

.subtitle {
    margin: 18px 0 8px;
    max-width: 620px;
    color: #d6e7e8;
    font-size: clamp(1.08rem, 2vw, 1.4rem);
    line-height: 1.55;
}

.author-meta {
    margin: 0 0 26px;
    color: var(--muted);
    font-size: 0.92rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 22px;
    border-radius: 12px;
    font-size: 0.96rem;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn:hover,
.btn:focus-visible {
    transform: translateY(-1px);
}

.btn-primary {
    border: 1px solid rgba(82, 217, 189, 0.28);
    background: linear-gradient(135deg, #168675, #116f64);
    color: #f2fffc;
    box-shadow: 0 10px 28px rgba(82, 217, 189, 0.18);
}

.btn-secondary {
    border: 1px solid rgba(166, 210, 209, 0.12);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text);
}

.home-main {
    padding: 26px 0 64px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.metric-box {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-height: 150px;
    padding: 22px 18px 18px;
    border: 1px solid var(--line-soft);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(17, 43, 51, 0.72), rgba(13, 31, 38, 0.75));
    box-shadow: 0 16px 35px rgba(0, 0, 0, 0.08);
}

.metric-val {
    color: var(--text);
    font-size: clamp(1.8rem, 2vw, 2.5rem);
    font-weight: 750;
    letter-spacing: -0.05em;
}

.metric-label {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.metric-box small {
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1.5;
}

.content-card {
    margin-top: 20px;
    padding: 28px 28px 22px;
    border: 1px solid var(--line-soft);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.025);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.06);
}

.content-card h2,
.content-card h3 {
    margin-top: 0;
    color: var(--text);
    letter-spacing: -0.04em;
}

.content-card h2 {
    margin-bottom: 18px;
    font-size: clamp(1.55rem, 2vw, 2rem);
}

.content-card p,
.content-card li {
    color: #d6e6e7;
    font-size: 1rem;
    line-height: 1.8;
}

.content-card strong {
    color: #f2fbfa;
}

.table-wrapper {
    overflow-x: auto;
    margin-top: 8px;
    border: 1px solid rgba(166, 210, 209, 0.12);
    border-radius: 12px;
    background: rgba(5, 22, 27, 0.45);
}

table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text);
}

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(166, 210, 209, 0.08);
    text-align: left;
    font-size: 0.96rem;
}

th {
    color: #bfe7e0;
    background: rgba(82, 217, 189, 0.04);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.summary-row td {
    background: rgba(82, 217, 189, 0.04);
}

.table-note {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.6;
}

.content-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.tech-list {
    margin: 0;
    padding-left: 18px;
}

code {
    padding: 2px 6px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.04);
    color: #9feedd;
    font-family: "Consolas", "SFMono-Regular", monospace;
}

.home-footer {
    border-top: 1px solid var(--line-soft);
    background: rgba(9, 25, 31, 0.75);
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    padding: 28px 0 32px;
    color: var(--muted);
    font-size: 0.88rem;
}

.footer-content a {
    color: var(--teal);
}

@media (max-width: 900px) {
    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .content-grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .home-header {
        padding-top: 18px;
    }

    .home-nav {
        justify-content: center;
        flex-wrap: wrap;
    }

    .hero-section {
        padding-top: 20px;
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn,
    .nav-link {
        width: 100%;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .content-card {
        padding: 24px 18px 18px;
    }

    .footer-content {
        flex-direction: column;
    }
}

#dashboard {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

#sidebar {
    position: relative;
    z-index: 500;
    display: flex;
    flex: 0 0 360px;
    flex-direction: column;
    height: 100vh;
    min-height: 0;
    overflow-y: auto;
    padding: 26px 22px 24px;
    border-right: 1px solid rgba(166, 210, 209, 0.12);
    background: linear-gradient(155deg, #102a31 0%, #0a2027 58%, #081b22 100%);
    box-shadow: 8px 0 28px rgba(0, 0, 0, 0.12);
    scrollbar-color: rgba(105, 205, 189, 0.3) transparent;
    scrollbar-width: thin;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid rgba(79, 224, 194, 0.32);
    border-radius: 12px;
    background: rgba(25, 199, 163, 0.1);
    color: #55e0c4;
    font-size: 25px;
}

.sidebar-home-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid rgba(82, 217, 189, 0.2);
    border-radius: 999px;
    background: rgba(82, 217, 189, 0.08);
    color: #dffaf5;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-decoration: none;
    text-transform: uppercase;
    transition: border-color 140ms ease, background 140ms ease;
}

.sidebar-home-link:hover,
.sidebar-home-link:focus-visible {
    border-color: rgba(82, 217, 189, 0.45);
    background: rgba(82, 217, 189, 0.12);
}

.eyebrow {
    margin: 18px 0 5px;
    color: #69cdbd;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
}

h1 {
    margin: 0;
    color: #f3fbf9;
    font-size: 30px;
    font-weight: 650;
    letter-spacing: -1.2px;
}

h1 span { color: #52d9bd; }

.intro {
    margin: 7px 0 22px;
    color: #9bb5b7;
    font-size: 13px;
    line-height: 1.6;
}

.zone-panel, .legend, .data-panel, .contribution-panel {
    padding: 16px;
    border: 1px solid rgba(166, 210, 209, 0.11);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.legend, .data-panel, .contribution-panel { margin-top: 12px; }

.zone-panel h2, .legend h2, .data-panel h2 {
    margin: 0 0 17px;
    color: #dcebea;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.data-panel h2 { margin-bottom: 13px; }

.data-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 14px;
}

.data-summary > div {
    display: grid;
    gap: 4px;
    min-width: 0;
    padding: 9px 8px;
    border: 1px solid rgba(177, 218, 213, 0.09);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.025);
}

.data-summary strong {
    overflow: hidden;
    color: #eaf4f3;
    font-size: 15px;
    font-weight: 650;
    text-overflow: ellipsis;
}

.data-summary span {
    color: #8fa9aa;
    font-size: 9px;
}

.filter-field, .import-field { margin-top: 11px; }

.form-select {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid rgba(177, 218, 213, 0.16);
    border-radius: 8px;
    outline: none;
    background: rgba(3, 16, 21, 0.45);
    color: #eaf4f3;
    font: inherit;
    font-size: 11px;
}

.form-select:focus-visible {
    border-color: #52d9bd;
    box-shadow: 0 0 0 2px rgba(82, 217, 189, 0.15);
}

.form-select option { background: #102c33; }

.export-data {
    width: 100%;
    min-height: 38px;
    margin-top: 12px;
    padding: 8px 10px;
    border: 1px solid rgba(82, 217, 189, 0.28);
    border-radius: 8px;
    background: rgba(82, 217, 189, 0.08);
    color: #a9eee0;
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease;
}

.export-data:hover {
    border-color: rgba(82, 217, 189, 0.5);
    background: rgba(82, 217, 189, 0.15);
}

.data-panel .field-hint:empty { display: none; }

.empty-state {
    margin: 0;
    color: #8fa9aa;
    font-size: 12px;
    line-height: 1.7;
}

.zone-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    color: var(--status-color);
    font-size: 12px;
    font-weight: 650;
}

.status-dot, .live-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--status-color, #19c7a3);
    box-shadow: 0 0 12px var(--status-color, #19c7a3);
}

.metrics { display: grid; gap: 9px; }

.metric-card {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 13px 14px;
    border: 1px solid rgba(177, 218, 213, 0.1);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.03);
    transition: border-color 140ms ease, background 140ms ease;
}

.metric-card:hover {
    border-color: rgba(82, 217, 189, 0.22);
    background: rgba(255, 255, 255, 0.045);
}

.metrics-title {
    color: #8fa9aa;
    font-size: 10px;
    letter-spacing: 0.55px;
    text-transform: uppercase;
}

.metrics-value {
    color: #eef8f6;
    font-size: 24px;
    font-weight: 650;
    line-height: 1.1;
}

.metrics-value small {
    color: #90aaa9;
    font-size: 13px;
    font-weight: 500;
}

.data-count {
    margin: 3px 0 0;
    color: #789394;
    font-size: 11px;
}

.legend > div {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 12px 0;
    color: #c2d4d2;
    font-size: 11px;
}

.legend small {
    margin-left: auto;
    color: #769091;
    font-size: 10px;
}

.contribution-panel {
    margin-top: 0;
}

.contribution-kicker {
    margin: 0 0 6px;
    color: #69cdbd;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.contribution-heading h2 {
    margin: 0;
    color: #eaf4f3;
    font-size: 17px;
    font-weight: 600;
}

.contribution-intro {
    margin: 6px 0 17px;
    color: #8fa9aa;
    font-size: 11px;
    line-height: 1.5;
}

#contribution-form {
    display: grid;
    gap: 14px;
}

.form-group { min-width: 0; margin: 0; }

.form-fieldset {
    padding: 0;
    border: 0;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: #c9dcda;
    font-size: 11px;
    font-weight: 600;
}

.form-label > span {
    margin-left: 5px;
    color: #789394;
    font-size: 9px;
    font-weight: 400;
}

.input-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.form-field {
    display: grid;
    min-width: 0;
    gap: 6px;
    color: #8fa9aa;
    font-size: 10px;
}

.form-field input,
.form-input-file {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid rgba(177, 218, 213, 0.16);
    border-radius: 8px;
    outline: none;
    background: rgba(3, 16, 21, 0.45);
    color: #eaf4f3;
    font: inherit;
    font-size: 11px;
    transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.form-field input:focus,
.form-input-file:focus-visible {
    border-color: #52d9bd;
    background: rgba(3, 16, 21, 0.7);
    box-shadow: 0 0 0 2px rgba(82, 217, 189, 0.15);
}

.form-field input::placeholder { color: #5e797b; }

.form-field input:hover,
.form-input-file:hover {
    border-color: rgba(177, 218, 213, 0.3);
}

.form-input-file {
    padding: 6px;
    color: #8fa9aa;
}

.form-input-file::file-selector-button {
    margin-right: 9px;
    padding: 6px 8px;
    border: 0;
    border-radius: 5px;
    background: rgba(82, 217, 189, 0.13);
    color: #8de6d4;
    font: inherit;
    cursor: pointer;
}

.score-field { margin-top: 12px; }

.image-preview {
    display: block;
    width: 100%;
    max-height: 130px;
    margin-top: 9px;
    border: 1px solid rgba(177, 218, 213, 0.14);
    border-radius: 7px;
    object-fit: cover;
}

.image-preview[hidden] { display: none; }

.field-hint {
    margin: 6px 0 0;
    color: #6f8c8e;
    font-size: 9px;
    line-height: 1.5;
}

.submit-report {
    min-height: 40px;
    padding: 9px 13px;
    border: 1px solid rgba(82, 217, 189, 0.38);
    border-radius: 8px;
    background: linear-gradient(135deg, #168675, #116f64);
    color: #f2fffc;
    font: inherit;
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
    transition: background 140ms ease, transform 140ms ease;
}

.submit-report:hover { background: linear-gradient(135deg, #1a9a84, #147d70); }
.submit-report:active { transform: translateY(1px); }
.submit-report:focus-visible { outline: 2px solid #8de6d4; outline-offset: 2px; }

.contribution-status {
    min-height: 0;
    margin: -5px 0 0;
    color: #f5b942;
    font-size: 10px;
    line-height: 1.5;
}

.contribution-status.is-success { color: #69cdbd; }
#data-status.is-success { color: #69cdbd; }
.contribution-status:empty { display: none; }
.storage-note { margin-top: -9px; }

.legend-swatch {
    width: 9px;
    height: 9px;
    border-radius: 3px;
}

.healthy { background: #19c7a3; }
.risk { background: #f5b942; }
.severe { background: #f06464; }

.sample-note {
    margin: auto 0 0;
    padding-top: 18px;
    color: #6e898b;
    font-size: 10px;
}

.map-panel {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    height: 100vh;
    min-height: 420px;
    background: #10282f;
}

#map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #10282f;
}

.map-label {
    position: absolute;
    z-index: 400;
    top: 22px;
    left: 22px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 11px 14px;
    border: 1px solid rgba(189, 221, 219, 0.15);
    border-radius: 10px;
    background: rgba(8, 28, 34, 0.88);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    color: #e5f1ef;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.1px;
    pointer-events: none;
}

.live-dot { width: 7px; height: 7px; }

.map-credit {
    position: absolute;
    z-index: 400;
    right: 10px;
    bottom: 0;
    margin: 0;
    padding: 4px 7px;
    border-radius: 4px 4px 0 0;
    background: rgba(8, 28, 34, 0.82);
    color: #d3e1df;
    font-size: 9px;
    pointer-events: none;
}

.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: #102c33;
    color: #eaf4f3;
}

.leaflet-popup-content { line-height: 1.7; }
.leaflet-popup-content strong { color: #55d9bd; }

.leaflet-control-zoom a,
.leaflet-control-layers {
    border-color: rgba(166, 210, 209, 0.2) !important;
    background: rgba(8, 28, 34, 0.92) !important;
    color: #eaf4f3 !important;
}

.leaflet-control-zoom a:hover,
.leaflet-control-layers-toggle:hover {
    background: #153a40 !important;
    color: #55d9bd !important;
}

@media (max-width: 700px) {
    #dashboard { flex-direction: column; }
    #sidebar {
        flex: 0 0 auto;
        height: auto;
        min-height: auto;
        overflow: visible;
        padding: 22px 20px 18px;
    }
    .eyebrow { margin-top: 14px; }
    .intro { margin-bottom: 18px; }
    .zone-panel { padding: 14px; }
    .legend { display: none; }
    .sample-note { display: none; }
    .map-panel { flex: 1 1 auto; height: 55vh; min-height: 360px; }
    .map-label { top: 12px; left: 12px; }
}

.draft-pin {
    border: 0;
    background: transparent;
}

.draft-pin span {
    display: block;
    width: 14px;
    height: 14px;
    border: 2px solid #f3fbf9;
    border-radius: 50%;
    background: #52d9bd;
    box-shadow: 0 0 12px rgba(82, 217, 189, 0.9);
}
