:root {
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    color: #172033;
    background: #f4f6f8;
    line-height: 1.5;
    font-weight: 400;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: #f4f6f8;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.page-container {
    width: min(1400px, calc(100% - 2rem));
    margin-inline: auto;
}

.site-header {
    padding: 2rem 0;
    color: #ffffff;
    background: #172033;
}

.site-header h1 {
    margin: 0;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.site-header p {
    max-width: 680px;
    margin: 0.4rem 0 0;
    color: #cbd5e1;
}

main.page-container {
    padding-block: 1.5rem 3rem;
}

.search-panel,
.summary-panel,
.historical-panel,
.metrics-panel {
    border: 1px solid #dfe5ec;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 5px 18px rgb(15 23 42 / 6%);
}

.search-panel {
    padding: 1.25rem;
}

.search-form {
    display: grid;
    gap: 0.5rem;
}

.search-form label {
    font-size: 0.9rem;
    font-weight: 700;
    color: #344054;
}

.search-controls {
    display: flex;
    gap: 0.75rem;
}

.search-controls input {
    width: 100%;
    min-width: 0;
    padding: 0.8rem 0.9rem;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    color: #172033;
    background: #ffffff;
    text-transform: uppercase;
    outline: none;
}

.search-controls input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgb(37 99 235 / 15%);
}

.search-controls button {
    min-width: 110px;
    padding: 0.8rem 1.2rem;
    border: 0;
    border-radius: 9px;
    color: #ffffff;
    background: #2563eb;
    font-weight: 700;
    transition:
        background 150ms ease,
        transform 150ms ease;
}

.search-controls button:hover {
    background: #1d4ed8;
}

.search-controls button:active {
    transform: translateY(1px);
}

.search-controls button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.status-message {
    min-height: 1.5rem;
    margin: 0.75rem 0 0;
    color: #475467;
}

.status-message.status-error {
    color: #b42318;
}

.status-message.status-success {
    color: #067647;
}

.summary-panel {
    margin-top: 1.25rem;
    padding: 1.25rem;
}

.summary-heading {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
}

.summary-heading h2 {
    margin: 0.2rem 0 0;
    font-size: 1.5rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.summary-item {
    padding: 0.9rem 1rem;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    background: #f8fafc;
}

.summary-label,
.metric-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #667085;
    text-transform: uppercase;
}

.summary-item strong {
    display: block;
    margin-top: 0.25rem;
    font-size: 1rem;
}

.dashboard {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr);
    gap: 1.25rem;
    margin-top: 1.25rem;
    align-items: start;
}

.historical-panel,
.metrics-panel {
    min-width: 0;
    padding: 1.25rem;
}

.metrics-panel {
    position: sticky;
    top: 1rem;
}

.panel-header {
    margin-bottom: 1rem;
}

.panel-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.panel-header p {
    margin: 0.3rem 0 0;
    color: #667085;
    font-size: 0.9rem;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
}

.price-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}

.price-table th,
.price-table td {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid #e4e7ec;
    white-space: nowrap;
    text-align: right;
}

.price-table th:first-child,
.price-table td:first-child {
    text-align: left;
}

.price-table th {
    color: #475467;
    background: #f8fafc;
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.price-table tbody tr:last-child td {
    border-bottom: 0;
}

.price-table tbody tr:hover {
    background: #f8fafc;
}

.metrics-placeholder {
    padding: 2rem 1rem;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    color: #667085;
    background: #f8fafc;
    text-align: center;
}

.metrics-grid {
    display: grid;
    gap: 0.75rem;
}

.metric-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    min-height: 66px;
    padding: 0.85rem 0.95rem;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    background: #ffffff;
}

.metric-value {
    flex-shrink: 0;
    color: #172033;
    font-size: 1rem;
    text-align: right;
}

.metric-value-small {
    max-width: 145px;
    font-size: 0.82rem;
    line-height: 1.3;
}

.metric-positive {
    color: #067647;
}

.metric-negative {
    color: #b42318;
}

.loading-row td,
.empty-row td {
    padding: 2rem;
    color: #667085;
    text-align: center;
}

[hidden] {
    display: none !important;
}

@media (max-width: 950px) {
    .dashboard {
        grid-template-columns: 1fr;
    }

    .metrics-panel {
        position: static;
    }

    .metrics-grid {
        grid-template-columns:
            repeat(auto-fit, minmax(230px, 1fr));
    }
}

@media (max-width: 640px) {
    .page-container {
        width: min(100% - 1rem, 1400px);
    }

    .site-header {
        padding: 1.5rem 0;
    }

    main.page-container {
        padding-top: 1rem;
    }

    .search-controls {
        flex-direction: column;
    }

    .search-controls button {
        width: 100%;
    }

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

    .metric-card {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.35rem;
    }

    .metric-value,
    .metric-value-small {
        max-width: none;
        text-align: left;
    }
}