/* ═══════════════════════════════════════════════════════
   Watt Index — Stylesheet
   Matches watt.maestrolabs.ai theme:
   White background · Green (#22c55e) accent · Bold black type
═══════════════════════════════════════════════════════ */

/* ── Google Font ──────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Reset & Base ─────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #f8faf8;
    --surface: #ffffff;
    --surface2: #f0f7f0;
    --border: #e2e8e2;
    --green: #22c55e;
    --green-dark: #16a34a;
    --green-light: #dcfce7;
    --text: #0f172a;
    --muted: #64748b;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

html {
    font-size: 16px;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    min-height: 100vh;
    line-height: 1.5;
}

/* ── Header ───────────────────────────────────────────── */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.logo-icon {
    background: var(--green);
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 800;
}

.logo-watt {
    color: var(--text);
}

.logo-index {
    color: var(--green);
}

.logo-sub {
    font-size: 0.68rem;
    color: var(--muted);
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-left: 0.3rem;
    align-self: flex-end;
    margin-bottom: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

/* ── Status dot ───────────────────────────────────────── */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.last-updated {
    font-size: 0.78rem;
    color: var(--muted);
}

.last-updated span {
    color: var(--text);
    font-weight: 600;
}

/* ── Main layout ──────────────────────────────────────── */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* ── Section headers ──────────────────────────────────── */
.section-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── KPI cards ────────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.4rem 1.6rem;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.kpi-card:hover {
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.1);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--green);
    opacity: 0.6;
}

.kpi-card.national::before {
    opacity: 1;
}

.kpi-card.load::before {
    opacity: 0.7;
}

.kpi-card.isos::before {
    opacity: 0.5;
}

.kpi-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.kpi-value {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.3rem;
    color: var(--text);
    letter-spacing: -0.02em;
}

.kpi-card.national .kpi-value {
    color: var(--green-dark);
}

.kpi-sub {
    font-size: 0.78rem;
    color: var(--muted);
}

/* ── Chart cards ──────────────────────────────────────── */
.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.4rem 1.6rem;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
}

.chart-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.chart-subtitle {
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 0.15rem;
}

.chart-wrap {
    position: relative;
    height: 260px;
}

.chart-wrap-tall {
    position: relative;
    height: 320px;
}

/* ── Two-column grid ──────────────────────────────────── */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ── ISO table ────────────────────────────────────────── */
.iso-table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

thead th {
    text-align: left;
    padding: 0.6rem 1rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--surface2);
}

tbody td {
    padding: 0.75rem 1rem;
}

.iso-badge {
    display: inline-block;
    background: var(--green-light);
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 0.15rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--green-dark);
}

.price-cell {
    font-weight: 700;
    color: var(--text);
}

.load-cell {
    color: var(--muted);
}

/* ── Selectors ────────────────────────────────────────── */
.controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

select {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.35rem 2rem 0.35rem 0.8rem;
    font-size: 0.82rem;
    font-family: var(--font);
    font-weight: 500;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
}

select:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

/* ── Hub price cards ──────────────────────────────────── */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.2rem;
}

.hub-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.9rem 1rem;
    transition: box-shadow 0.15s;
}

.hub-card:hover {
    box-shadow: 0 2px 10px rgba(34, 197, 94, 0.12);
}

.hub-name {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hub-price {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--green-dark);
    letter-spacing: -0.01em;
}

/* ── Loading spinner ──────────────────────────────────── */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--muted);
    font-size: 0.88rem;
    gap: 0.5rem;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.no-data {
    color: var(--muted);
    font-size: 0.85rem;
    padding: 0.5rem 0;
}

/* ── Footer ───────────────────────────────────────────── */
footer {
    text-align: center;
    padding: 2rem;
    font-size: 0.75rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

footer a {
    color: var(--green-dark);
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    text-decoration: underline;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 900px) {
    .kpi-grid {
        grid-template-columns: 1fr 1fr;
    }

    .two-col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    main {
        padding: 1rem;
    }

    header {
        padding: 0 1rem;
    }

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

    .kpi-value {
        font-size: 1.9rem;
    }
}