:root {
    color-scheme: light;
    --background: #f7f5ef;
    --panel: #ffffff;
    --ink: #18201b;
    --muted: #69736c;
    --line: #d9ded5;
    --rain: #2b7fab;
    --rain-dark: #175f82;
    --grass: #4f8a4b;
    --spray: #3f8f83;
    --soil: #8f6749;
    --shadow: 0 16px 45px rgba(28, 39, 31, 0.09);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page-header,
main {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 36px 0 24px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--soil);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(2rem, 7vw, 4.4rem);
    line-height: 1;
}

h2 {
    margin-bottom: 4px;
    font-size: 1.12rem;
}

.admin-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
    box-shadow: var(--shadow);
}

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

.overview-card,
.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.overview-card {
    display: grid;
    align-content: start;
    gap: 12px;
    min-height: 178px;
    padding: 18px;
}

.stat-label,
.metric-list,
.panel-header span,
.chart-label,
.line-labels {
    color: var(--muted);
}

.stat-label {
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.overview-card strong {
    font-size: 2rem;
    line-height: 1;
}

.metric-list {
    display: grid;
    gap: 6px;
    font-size: 0.9rem;
    line-height: 1.35;
}

.chart-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 18px;
    padding-bottom: 32px;
}

.panel {
    min-height: 410px;
    padding: 22px;
}

.panel-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.panel-header span {
    font-size: 0.9rem;
    text-align: right;
}

.bar-chart {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(38px, 1fr));
    align-items: end;
    gap: 10px;
    min-height: 300px;
}

.bar-column {
    display: grid;
    grid-template-rows: 28px 220px 34px;
    gap: 8px;
    min-width: 0;
}

.bar-value {
    color: var(--rain-dark);
    font-size: 0.78rem;
    font-weight: 800;
    text-align: center;
}

.bar-track {
    display: flex;
    align-items: end;
    min-height: 220px;
    border-radius: 6px;
    background: #edf5f8;
    overflow: hidden;
}

.bar {
    width: 100%;
    min-height: 4px;
    border-radius: 6px 6px 0 0;
    background: linear-gradient(180deg, var(--rain), var(--rain-dark));
}

.chart-label {
    overflow-wrap: anywhere;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
}

.line-chart {
    display: block;
    width: 100%;
    height: 260px;
}

.axis {
    stroke: var(--line);
    stroke-width: 1;
}

.height-line {
    fill: none;
    stroke: var(--grass);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3;
    vector-effect: non-scaling-stroke;
}

.height-point {
    fill: var(--panel);
    stroke: var(--grass);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.tank-line {
    fill: none;
    stroke: var(--spray);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3;
    vector-effect: non-scaling-stroke;
}

.tank-point {
    fill: var(--panel);
    stroke: var(--spray);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.tank-chart {
    height: 210px;
}

.line-labels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 10px;
    margin-top: 18px;
    font-size: 0.78rem;
}

.line-labels span {
    display: grid;
    gap: 2px;
}

.line-labels strong {
    color: var(--ink);
}

.spraying-list {
    display: grid;
    gap: 10px;
}

.spraying-record {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 68px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfa;
}

.spraying-record > div,
.spraying-values {
    display: grid;
    gap: 4px;
}

.spraying-record span,
.spraying-values {
    color: var(--muted);
    font-size: 0.9rem;
}

.spraying-values {
    justify-items: end;
    text-align: right;
}

.tank-level {
    color: var(--spray);
    font-weight: 800;
}

.tank-level.muted {
    color: var(--muted);
    font-weight: 700;
}

.empty-state {
    display: grid;
    min-height: 280px;
    place-items: center;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    padding: 24px;
    text-align: center;
}

@media (max-width: 860px) {
    .overview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 560px) {
    .page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-link {
        width: 100%;
    }

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

    .panel {
        padding: 16px;
    }

    .panel-header {
        display: block;
    }

    .spraying-record {
        align-items: stretch;
        flex-direction: column;
    }

    .spraying-values {
        justify-items: start;
        text-align: left;
    }

    .panel-header span {
        display: block;
        text-align: left;
    }
}
