:root {
    color-scheme: light;
    --ink: #17202a;
    --muted: #617080;
    --line: #d7dee6;
    --panel: #ffffff;
    --band: #f2f6f8;
    --accent: #0b6f6a;
    --accent-strong: #084f4c;
    --warn: #b23b30;
}

* {
    box-sizing: border-box;
}

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

.shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 20px 56px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 36px;
    align-items: start;
    padding: 42px 0 34px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 760;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1, h2, h3 {
    margin: 0;
    line-height: 1.08;
}

h1 {
    max-width: 760px;
    font-size: clamp(2.15rem, 5vw, 4.8rem);
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.05rem;
}

.lead {
    max-width: 680px;
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.6;
}

.upload-panel,
.panel,
.kpi-grid article {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.upload-panel {
    display: grid;
    gap: 16px;
    padding: 20px;
    box-shadow: 0 18px 45px rgb(20 34 48 / 10%);
}

label {
    display: grid;
    gap: 7px;
    color: #314050;
    font-size: 0.9rem;
    font-weight: 690;
}

input,
select,
button {
    width: 100%;
    min-height: 44px;
    border-radius: 6px;
    font: inherit;
}

input,
select {
    border: 1px solid var(--line);
    padding: 10px 12px;
    background: #fff;
    color: var(--ink);
}

select {
    appearance: auto;
}

option {
    background: #fff;
    color: var(--ink);
}

button {
    border: 0;
    background: var(--accent);
    color: white;
    font-weight: 760;
    cursor: pointer;
}

button:hover {
    background: var(--accent-strong);
}

.download-button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-weight: 760;
    padding: 0 14px;
    text-decoration: none;
}

.download-button:hover {
    background: var(--accent-strong);
}

.page-links {
    margin: 18px 0 0;
}

.page-links a {
    color: var(--accent);
    font-weight: 760;
    text-decoration: none;
}

.page-links a:hover {
    color: var(--accent-strong);
}

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

.hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.45;
}

.alert {
    margin: 8px 0 24px;
    padding: 14px 16px;
    border: 1px solid color-mix(in srgb, var(--warn), white 70%);
    border-radius: 8px;
    background: #fff4f2;
    color: var(--warn);
    font-weight: 700;
}

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

.section-title {
    margin-top: 18px;
}

.title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

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

.kpi-grid article {
    padding: 18px;
}

.kpi-grid span,
dt {
    display: block;
    color: var(--muted);
    font-size: 0.83rem;
}

.kpi-grid strong {
    display: block;
    margin-top: 8px;
    font-size: 1.45rem;
}

.panel {
    padding: 18px;
}

.storage-recommendation {
    border-color: color-mix(in srgb, var(--accent), white 55%);
}

.recommendation-options {
    display: grid;
    gap: 16px;
    margin-top: 16px;
}

.recommendation-option {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
}

.recommendation-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.recommendation-head span {
    color: var(--ink);
    font-weight: 700;
}

.recommendation-head strong {
    white-space: nowrap;
}

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

.recommendation-grid div {
    display: grid;
    gap: 8px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbfb;
}

.recommendation-grid span {
    color: var(--muted);
    font-size: 0.82rem;
}

.recommendation-grid strong {
    font-size: 1.25rem;
    overflow-wrap: anywhere;
}

.recommendation-period {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.recommendation-line-chart {
    display: grid;
    gap: 8px;
}

.chart-legend.compact {
    margin-bottom: 0;
}

.recommendation-line-chart svg {
    width: 100%;
    height: 180px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfb 100%);
}

.recommendation-line-chart .axis-line {
    marker-end: url(#axis-arrow);
    stroke: #6f7c83;
    stroke-width: 0.8;
}

.recommendation-line-chart marker path {
    fill: #6f7c83;
}

.recommendation-line-chart pattern line {
    stroke: rgba(183, 48, 67, 0.62);
    stroke-width: 1.2;
}

.recommendation-line-chart #target-hatch line {
    stroke: rgba(47, 159, 74, 0.45);
    stroke-width: 1.1;
}

.recommendation-line-chart .area-target {
    fill: url(#target-hatch);
    stroke: rgba(47, 159, 74, 0.24);
    stroke-width: 0.4;
    vector-effect: non-scaling-stroke;
}

.recommendation-line-chart .area-shaved {
    fill: url(#shaved-hatch);
    stroke: rgba(183, 48, 67, 0.52);
    stroke-width: 0.5;
    vector-effect: non-scaling-stroke;
}

.recommendation-line-chart polyline {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    vector-effect: non-scaling-stroke;
}

.line-before {
    stroke: #35424a;
}

.line-after {
    stroke: var(--success);
}

.line-target {
    stroke: #2f9f4a;
    stroke-dasharray: 4 3;
    stroke-width: 1.4;
}

.grid-line {
    stroke: rgba(133, 145, 153, 0.28);
    stroke-width: 0.35;
    vector-effect: non-scaling-stroke;
}

.max-peak-label {
    fill: var(--danger);
    font-size: 2px;
    font-weight: 700;
    letter-spacing: 0;
    text-anchor: middle;
}

.target-peak-label {
    fill: #2f9f4a;
    font-size: 2.45px;
    font-weight: 800;
    letter-spacing: 0;
    paint-order: stroke;
    stroke: #ffffff;
    stroke-linejoin: round;
    stroke-width: 0.55px;
    dominant-baseline: middle;
    text-anchor: end;
}

.storage-level-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.8rem;
}

.storage-level-head strong {
    color: var(--accent-strong);
    font-weight: 760;
    white-space: nowrap;
}

.storage-level-chart {
    width: 100%;
    height: 86px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(180deg, #fbfefd 0%, #f4faf7 100%);
}

.storage-grid-line {
    stroke: rgba(47, 159, 74, 0.26);
    stroke-width: 0.35;
    vector-effect: non-scaling-stroke;
}

.storage-grid-line.faint {
    stroke: rgba(133, 145, 153, 0.18);
    stroke-width: 0.28;
}

.storage-level-area {
    fill: rgba(47, 159, 74, 0.18);
    stroke: none;
}

.storage-level-line {
    fill: none;
    stroke: #16813a;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.storage-level-mark {
    fill: var(--muted);
    font-size: 1.9px;
    font-weight: 700;
    letter-spacing: 0;
    dominant-baseline: middle;
    text-anchor: end;
}

dl {
    display: grid;
    gap: 11px;
    margin: 16px 0 0;
}

dl div {
    display: grid;
    grid-template-columns: minmax(150px, 0.7fr) minmax(0, 1fr);
    gap: 14px;
    align-items: baseline;
}

dd {
    margin: 0;
    font-weight: 720;
    overflow-wrap: anywhere;
}

.table-wrap {
    margin-top: 14px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th,
td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.bars {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.bar-row {
    display: grid;
    grid-template-columns: 78px minmax(120px, 1fr) 92px;
    gap: 10px;
    align-items: center;
    font-size: 0.9rem;
}

meter {
    width: 100%;
    height: 14px;
}

.recommendations {
    margin: 16px 0 0;
    padding-left: 18px;
    color: #2c3a45;
    line-height: 1.55;
}

.recommendations li + li {
    margin-top: 9px;
}

@media (max-width: 900px) {
    .hero,
    .split,
    .kpi-grid,
    .recommendation-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        padding-top: 20px;
    }

    .title-row {
        align-items: flex-start;
        flex-direction: column;
    }

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

@media (max-width: 540px) {
    .shell {
        padding: 22px 14px 40px;
    }

    .grid-2,
    dl div,
    .bar-row {
        grid-template-columns: 1fr;
    }

    .kpi-grid strong {
        font-size: 1.2rem;
    }
}
