:root {
    color-scheme: light;
    --page-background: #f8fbff;
    --surface: #ffffff;
    --surface-strong: #fbfdff;
    --surface-muted: #eef4fc;
    --surface-accent: #e7f0fb;
    --border: #d8e1ee;
    --border-strong: #b7c3d4;
    --ink: #162033;
    --text: #3b4961;
    --muted: #617087;
    --muted-soft: #8b97a9;
    --primary: #0b57d0;
    --primary-deep: #0842a0;
    --primary-soft: #dbe8ff;
    --accent-teal: #157a6e;
    --accent-amber: #c76f2b;
    --error: #f7dfe0;
    --error-text: #b91c1c;
    --warning: #faecd8;
    --warning-text: #b45309;
    --success-text: #0f766e;
    --chart-background: #f9fbff;
    --chart-border: #dfe6f1;
    --chart-grid: #d7deea;
    --chart-axis: #96a3b8;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--page-background);
}

body {
    margin: 0;
    color: var(--text);
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.65;
    text-rendering: optimizeLegibility;
}

button,
input {
    font: inherit;
}

a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--primary-deep);
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}

::selection {
    background: var(--primary-soft);
    color: var(--ink);
}

.page {
    min-height: 100vh;
    background: var(--page-background);
}

.shell {
    width: 100%;
    margin: 0;
    padding: 24px var(--page-horizontal-margin) 48px;
}

.main-flow {
    display: grid;
    gap: 20px;
    margin-top: 12px;
    min-width: 0;
}

.hero {
    display: grid;
    gap: 14px;
    padding: 22px 24px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.86);
}

.hero-kicker,
.eyebrow {
    margin: 0;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1.4;
    text-transform: uppercase;
}

.hero h1 {
    margin: 8px 0 10px;
    color: var(--ink);
    font-size: clamp(2rem, 4.8vw, 3.25rem);
    font-weight: 700;
    letter-spacing: -2px;
    line-height: 1.04;
}

.hero-copy p:last-child {
    max-width: 58rem;
    margin: 0;
    color: var(--text);
    font-size: 18px;
    line-height: 1.65;
}

.status-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    min-height: 27px;
    padding: 4px 10px;
    border-radius: 9999px;
    background: var(--primary-soft);
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
}

.status-chip.status-ready {
    background: rgba(21, 122, 110, 0.12);
    color: var(--success-text);
}

.status-chip.status-error {
    background: var(--error);
    color: var(--error-text);
}

.status-chip.status-refreshing {
    background: var(--warning);
    color: var(--warning-text);
}

.refresh-form {
    margin-left: auto;
}

.button-primary,
.button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--ink);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.button-primary {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary-deep);
}

.button-primary:hover {
    background: var(--primary);
    color: #ffffff;
}

.button-secondary {
    background: var(--surface);
}

.button-secondary:hover {
    border-color: var(--border-strong);
    background: var(--surface-muted);
    text-decoration: none;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.summary-card {
    min-width: 0;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
}

.summary-label,
.summary-detail {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.summary-value {
    margin: 4px 0 0;
    color: var(--ink);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.summary-detail {
    margin-top: 4px;
}

.control-panel,
.chart-section {
    min-width: 0;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.86);
}

.control-panel {
    display: grid;
    gap: 16px;
}

.control-heading h2,
.section-heading h2 {
    margin: 0;
    color: var(--ink);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
}

.control-heading p,
.section-heading p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.outlet-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.outlet-fieldset legend,
.field-label {
    margin-bottom: 8px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
}

.outlet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
}

.outlet-option {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-strong);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
}

.outlet-option:hover {
    border-color: var(--border-strong);
    background: var(--surface-accent);
}

.outlet-option input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--primary);
    flex: 0 0 auto;
}

.filter-row {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 12px;
}

.field {
    display: grid;
    flex: 1 1 180px;
    gap: 5px;
    min-width: 180px;
}

.field input {
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
}

.filter-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}

.chart-section {
    display: grid;
    gap: 12px;
}

.chart-card {
    min-width: 0;
    padding: 6px;
    overflow: hidden;
    border: 1px solid var(--chart-border);
    border-radius: 20px;
    background: var(--chart-background);
}

.chart-plot {
    width: 100%;
    max-width: 100%;
    min-height: 410px;
}

.notice,
.empty-state,
.section-note {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #ffffff;
    color: var(--text);
}

.notice.warning,
.empty-state {
    border-color: #e4cfb3;
    background: var(--warning);
    color: var(--warning-text);
}

.notice.error {
    border-color: #e4c0c2;
    background: var(--error);
    color: var(--error-text);
}

.section-note {
    border-radius: 18px;
    background: var(--primary-soft);
    line-height: 1.6;
}

.site-footer {
    margin-top: 24px;
    padding: 8px 10px;
    border-top: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.04);
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

@media (max-width: 960px) {
    .shell {
        padding: 18px 4% 40px;
    }

    .chart-plot {
        min-height: 390px;
    }
}

@media (max-width: 600px) {
    .shell {
        padding: 16px 16px 32px;
    }

    .hero {
        padding: 18px;
    }

    .hero h1 {
        letter-spacing: -1px;
    }

    .status-row {
        align-items: stretch;
        flex-direction: column;
    }

    .refresh-form,
    .refresh-form button {
        width: 100%;
        margin-left: 0;
    }

    .control-panel,
    .chart-section {
        padding: 14px;
    }

    .filter-row,
    .filter-actions {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
        margin-left: 0;
    }

    .field {
        width: 100%;
    }

    .filter-actions > * {
        width: 100%;
    }

    .chart-plot {
        min-height: 360px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
