* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
    background: #fafafa;
    color: #111;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
}

/* ============ TOP NAV (was side nav) ============ */
#side-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    padding: 0 24px;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
#side-nav .side-nav-title { display: none; }
#side-nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0;
    max-width: 100%;
    margin: 0 auto;
}
#side-nav li { margin: 0; }
#side-nav a {
    display: block;
    padding: 11px 14px;
    color: #555;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
}
#side-nav a:hover { color: #111; background: #f5f5f5; }
#side-nav a.active {
    color: #111;
    border-bottom-color: #111;
    font-weight: 600;
}

/* ============ FLAG ICONS ============ */
.fi {
    display: inline-block;
    width: 1.25em;
    height: 0.9em;
    vertical-align: -0.12em;
    border-radius: 1.5px;
    box-shadow: 0 0 0 0.5px rgba(0,0,0,0.15);
}
.flag-wrap {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
/* Tracker/news table column-header flags sit above country text */
#tracker-table th .fi,
#news-table th .fi { display: block; margin: 0 auto 3px; }
#tracker-table tr.country-bar td .fi { display: block; margin: 0 auto 2px; }

/* ============ INDICATOR CONTINUATION ROWS ============ */
tr.metric-continuation td {
    border-top: 1px dashed #eee !important;
    padding-top: 4px;
    padding-bottom: 4px;
}
tr.metric-continuation .metric-label-cont {
    background: #fafafa;
}

/* ============ NEWSFEED DATE GROUPING ============ */
#news-table tr.date-group-start td {
    border-top: 1px solid #d4d4d4 !important;
}
#news-table .date-cell-first {
    font-weight: 600;
    color: #111;
    white-space: nowrap;
}
#news-table .date-cell-cont {
    color: #bbb;
}

/* ============ SECTION NAV ============ */
.section-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    display: flex;
    gap: 0;
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.section-nav a {
    color: #999;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    padding: 10px 16px;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
}
.section-nav a:hover {
    color: #fff;
    background: #2a2a2a;
}
.section-nav .nav-heatmap {
    margin-left: auto;
    color: #4ade80;
    font-weight: 600;
    border-left: 1px solid #333;
}
.section-nav .nav-heatmap:hover {
    background: #0d4a2e;
    color: #fff;
}

/* ============ HEADER ============ */
header {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    padding: 28px 0;
}

.header-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 24px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
}

header h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: #111;
}

.subtitle {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
    font-weight: 400;
}

.header-stats {
    display: flex;
    gap: 1px;
    background: #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.stat {
    background: #fafafa;
    padding: 10px 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
}

.stat:first-child { border-radius: 8px 0 0 8px; }
.stat:last-child { border-radius: 0 8px 8px 0; }

.stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #999;
    font-weight: 500;
}

.stat-value {
    font-size: 14px;
    font-weight: 600;
    color: #111;
    margin-top: 2px;
    white-space: nowrap;
}

#brent-stat .stat-value {
    color: #c00;
}

/* ============ MAIN ============ */
main {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 24px;
}

section {
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 16px;
    border: 1px solid #e5e5e5;
}

h2 {
    font-size: 14px;
    font-weight: 600;
    color: #111;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* ============ HEAT MAP CELLS ============ */
.progression-history {
    color: #555;
    font-size: 11px;
}

/* Gas price 3-line format */
.gas-line-current {
    font-size: 12px;
    margin-bottom: 2px;
}
.gas-line-summary {
    font-size: 11.5px;
    margin-bottom: 2px;
}
.gas-line-history {
    color: #555;
    font-size: 10.5px;
}

.progression-current {
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 2px;
    white-space: nowrap;
}

.peak-label {
    color: #999;
    font-size: 10px;
    margin-left: 4px;
}

.progression-price {
    color: #888;
    font-size: 11px;
    font-weight: 400;
    margin-left: 2px;
}

.progression-peak {
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
}

.heat-neutral { color: #555; }

/* Red gradient — fuel price hikes (more red = more pain) */
.heat-red-1 { background: #ffebee; color: #c62828; }
.heat-red-2 { background: #ef9a9a; color: #b71c1c; }
.heat-red-3 { background: #c62828; color: #fff; }

/* Green gradient — EV interest spike (more green = more interest) */
.heat-green-1 { background: #e8f5e9; color: #2e7d32; }
.heat-green-2 { background: #a5d6a7; color: #1b5e20; }
.heat-green-3 { background: #2e7d32; color: #fff; }

/* EV interest signal tier row — country-level rollup */
#tracker-table tr.tier-row td.tier-cell {
    text-align: center;
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.5px;
    padding: 6px 4px;
}

/* March BEV sales cells — share bold, YoY small below, bg by swing */
#tracker-table td.sales-cell {
    text-align: center;
    padding: 6px 4px;
    line-height: 1.3;
}
#tracker-table td.sales-cell .sales-share {
    display: block;
    font-weight: 700;
    font-size: 12px;
}
#tracker-table td.sales-cell .sales-yoy {
    display: block;
    font-size: 10px;
    font-weight: 500;
    margin-top: 1px;
}
#tracker-table td.sales-cell.s-up    { background: #c8e6c9; color: #1b5e20; }
#tracker-table td.sales-cell.s-up2   { background: #e6f4d7; color: #33691e; }
#tracker-table td.sales-cell.s-watch { background: #fff9c4; color: #827717; }
#tracker-table td.sales-cell.s-decel { background: #ffe0b2; color: #bf360c; }
#tracker-table td.sales-cell.s-down  { background: #ffcdd2; color: #b71c1c; }

/* Survey intent row — % stated */
#tracker-table td.survey-cell {
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    padding: 6px 4px;
}
#tracker-table td.survey-cell.sv-hi { background: #a5d6a7; color: #1b5e20; }
#tracker-table td.survey-cell.sv-md { background: #e8f5e9; color: #2e7d32; }
#tracker-table td.survey-cell.sv-lo { background: #f5f5f5; color: #555; }
#tracker-table td.policy-cell {
    background: #e8f5e9;
    color: #1b5e20;
    font-size: 11px;
    line-height: 1.3;
    padding: 6px 5px;
}
#tracker-table td.policy-cell strong { font-size: 12px; }
#tracker-table td.policy-cell .policy-detail { color: #33691e; font-weight: 400; }
.tier-strong   { background: #2e7d32; color: #fff; }
.tier-moderate { background: #a5d6a7; color: #1b5e20; }
.tier-weak     { background: #eeeeee; color: #555; }
.tier-none     { background: #fafafa; color: #999; }

/* ============ EXECUTIVE SUMMARY ============ */
#summary-text {
    font-size: 14px;
    color: #333;
    line-height: 1.7;
}

.section-note {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 16px;
}

.section-subtitle {
    font-size: 12px;
    font-weight: 400;
    color: #999;
    text-transform: none;
    letter-spacing: normal;
    margin-left: 6px;
}

#highlights-list {
    list-style: none;
    padding: 0;
}

#highlights-list li {
    padding: 10px 0 10px 16px;
    border-left: 2px solid #2e7d32;
    margin-bottom: 8px;
    font-size: 13.5px;
    color: #333;
    line-height: 1.65;
}


/* ============ COUNTRY COMMENTARY ============ */
#country-commentary-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.country-card {
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 18px 20px;
}

.country-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: #111;
    margin: 0 0 14px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e5e5;
}

.country-section {
    margin-bottom: 12px;
}

.country-section:last-child {
    margin-bottom: 0;
}

.country-section-label {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}

.country-section-text {
    font-size: 13px;
    color: #333;
    line-height: 1.65;
}
.country-section-text strong {
    color: #111;
    font-weight: 700;
    background: #fff4b8;
    padding: 0 2px;
    border-radius: 2px;
}

.toggle-btn {
    width: 100%;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #111;
    cursor: pointer;
    transition: all 0.15s;
    margin-top: 8px;
}

.toggle-btn:hover {
    background: #f5f5f5;
    border-color: #999;
}

.toggle-btn-small {
    float: right;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #555;
    cursor: pointer;
    text-transform: none;
    letter-spacing: normal;
    margin-top: -2px;
}

.toggle-btn-small:hover {
    background: #f5f5f5;
    border-color: #999;
    color: #111;
}

/* Extra country columns hidden by default */
.extra-country-col {
    display: none;
}

body.show-extra-countries .extra-country-col {
    display: table-cell;
}

/* ============ SALES TABLE ============ */
#sales-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

#sales-table th {
    background: #111;
    color: #fff;
    padding: 9px 10px;
    text-align: left;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2px;
}

#sales-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

tr.sales-up    { background: #e8f5e9; }
tr.sales-up2   { background: #f1f8e9; }
tr.sales-watch { background: #fffde7; }
tr.sales-decel { background: #fff3e0; }
tr.sales-down  { background: #ffeae8; }

.yoy-pos { color: #2e7d32; font-weight: 600; }
.yoy-neg { color: #c00; font-weight: 600; }

.flag-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.flag-up    { background: #1b5e20; color: #fff; }
.flag-up2   { background: #4caf50; color: #fff; }
.flag-watch { background: #f9a825; color: #333; }
.flag-decel { background: #e65100; color: #fff; }
.flag-down  { background: #b71c1c; color: #fff; }

/* ============ POLICY TABLE ============ */
#policy-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

#policy-table th {
    background: #111;
    color: #fff;
    padding: 9px 10px;
    text-align: left;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2px;
}

#policy-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}


/* ============ COMMENTARY ============ */
#commentary-list {
    list-style: none;
    padding: 0;
}

#commentary-list li {
    padding: 10px 0 10px 16px;
    border-left: 2px solid #ddd;
    margin-bottom: 8px;
    font-size: 13.5px;
    color: #333;
    line-height: 1.65;
}


/* ============ TRACKER TABLE ============ */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 12px;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
}

#tracker-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    min-width: 900px;
}

#tracker-table th {
    background: #111;
    color: #fff;
    padding: 10px 10px;
    text-align: center;
    font-weight: 500;
    font-size: 11.5px;
    position: sticky;
    top: 0;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

#tracker-table th:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 2;
    background: #111;
}

#tracker-table th:last-child {
    text-align: left;
}

#tracker-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
    font-size: 12px;
    white-space: pre-line;
}

#tracker-table td:first-child {
    font-weight: 500;
    min-width: 140px;
    max-width: 200px;
    background: #fff;
    position: sticky;
    left: 0;
    z-index: 1;
}

#tracker-table td:not(:first-child):not(.source-col) {
    text-align: center;
    min-width: 120px;
}

#tracker-table td.source-col {
    color: #999;
    font-size: 11px;
    min-width: 120px;
    white-space: nowrap;
}

#tracker-table tr.section-header td {
    background: #f5f5f5;
    font-weight: 600;
    color: #111;
    font-size: 11.5px;
    padding: 8px 10px;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

#tracker-table tr.section-header td:first-child {
    background: #f5f5f5;
}

#tracker-table tr.subgroup-header td {
    background: #fafafa;
    font-weight: 500;
    color: #888;
    font-size: 11px;
    padding: 5px 10px 5px 20px;
    border: none;
}

#tracker-table tr.subgroup-header td:first-child {
    background: #fafafa;
}


#tracker-table tr.country-bar td {
    background: #ececec;
    color: #555;
    font-size: 10.5px;
    font-weight: 600;
    padding: 5px 4px;
    border-top: 1px solid #d0d0d0;
    border-bottom: 1px solid #d0d0d0;
    text-align: center;
    text-transform: none;
    letter-spacing: 0;
}

#tracker-table tr.country-bar td:first-child,
#tracker-table tr.country-bar td:last-child {
    background: #ececec;
}


#tracker-table tr.extra-metric-row { display: none; }
body.show-extra-countries #tracker-table tr.extra-metric-row { display: table-row; }

#tracker-table a {
    color: #111;
    text-decoration: none;
    border-bottom: 1px dotted #ccc;
}

#tracker-table a:hover {
    border-bottom-color: #111;
}

#tracker-notes {
    font-size: 11px;
    color: #999;
    line-height: 1.6;
}

#tracker-notes p {
    margin-bottom: 4px;
}

/* ============ NEWS FEED ============ */
.news-controls {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 500;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.filter-group select {
    padding: 7px 32px 7px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: #111;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23999' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
    transition: border-color 0.15s;
}

.filter-group select:hover {
    border-color: #999;
}

.filter-group select:focus {
    outline: none;
    border-color: #111;
}

#news-count {
    font-size: 12px;
    color: #999;
    margin-left: auto;
}

#news-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

#news-table thead th {
    background: #111;
    color: #fff;
    padding: 9px 10px;
    text-align: left;
    font-size: 11px;
    font-weight: 500;
    position: sticky;
    top: 0;
    letter-spacing: 0.2px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

#news-table thead th:hover {
    background: #333;
}

.sort-arrow {
    font-size: 9px;
    opacity: 0.7;
}

#news-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}


#news-table td:nth-child(1) { white-space: nowrap; width: 72px; color: #999; font-size: 12px; }
#news-table td:nth-child(2) { width: 85px; font-weight: 500; }
#news-table td:nth-child(3) { width: 95px; }
#news-table td:nth-child(4) { min-width: 240px; }
#news-table td:nth-child(5) { min-width: 180px; color: #666; font-size: 12px; }
#news-table td:nth-child(6) { width: 90px; }

#news-table a {
    color: #111;
    text-decoration: none;
    border-bottom: 1px solid #ddd;
}

#news-table a:hover {
    border-bottom-color: #111;
}

/* Category badges */
.category-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.cat-marketplaces { background: #e8f5e9; color: #2e7d32; }
.cat-dealers      { background: #fce4ec; color: #c62828; }
.cat-used-ev      { background: #e0f2f1; color: #00695c; }
.cat-sentiment    { background: #fff3e0; color: #e65100; }
.cat-narrative    { background: #f5f5f5; color: #555; }
.cat-fuel-price   { background: #fff8e1; color: #f57f17; }
.cat-market-data  { background: #f3e5f5; color: #7b1fa2; }
.cat-policy       { background: #e3f2fd; color: #1565c0; }
.cat-macro        { background: #efebe9; color: #4e342e; }

/* ============ FOOTER ============ */
footer {
    text-align: center;
    padding: 24px;
    font-size: 12px;
    color: #bbb;
}

/* ============ MOBILE ============ */
@media (max-width: 768px) {
    header {
        padding: 20px 0;
    }

    .header-content {
        padding: 0 16px;
    }

    .header-top {
        flex-direction: column;
        gap: 16px;
    }

    header h1 {
        font-size: 18px;
    }

    .subtitle {
        font-size: 12px;
    }

    .header-stats {
        width: 100%;
    }

    .stat {
        flex: 1;
        padding: 8px 10px;
        min-width: 0;
    }

    .stat-label {
        font-size: 9px;
    }

    .stat-value {
        font-size: 13px;
    }

    main {
        padding: 12px;
    }

    section {
        padding: 16px;
        margin-bottom: 12px;
        border-radius: 8px;
    }

    h2 {
        font-size: 13px;
        margin-bottom: 12px;
    }

    #commentary-list li {
        font-size: 13px;
        padding: 8px 0 8px 12px;
        margin-bottom: 6px;
    }

    /* Tracker table — frozen first column, horizontal scroll */
    .table-scroll {
        margin: 0 -16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    #tracker-table { font-size: 11px; }
    #tracker-table th { font-size: 11px; padding: 8px 6px; }
    #tracker-table td { font-size: 11px; padding: 6px; }

    #tracker-table td:first-child {
        min-width: 110px;
        max-width: 130px;
        font-size: 11px;
        box-shadow: 2px 0 4px rgba(0,0,0,0.06);
    }

    #tracker-table th:first-child {
        box-shadow: 2px 0 4px rgba(0,0,0,0.12);
    }

    #tracker-table td:not(:first-child):not(.source-col) {
        min-width: 100px;
    }

    /* News controls — stack */
    .news-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .filter-group { width: 100%; }

    .filter-group select {
        flex: 1;
        font-size: 14px;
        padding: 10px 12px;
    }

    #news-count {
        margin-left: 0;
        text-align: right;
    }

    /* News feed — card layout on mobile */
    #news-table thead { display: none; }

    #news-table,
    #news-table tbody,
    #news-table tr,
    #news-table td {
        display: block;
        width: 100%;
    }

    #news-table tr {
        padding: 12px 0;
        border-bottom: 1px solid #f0f0f0;
    }

    #news-table td {
        padding: 2px 0;
        border: none;
    }

    #news-table td:nth-child(1) {
        float: left;
        width: auto;
        font-size: 11px;
        color: #999;
        padding-right: 8px;
    }

    #news-table td:nth-child(2) {
        width: auto;
        font-size: 11px;
        color: #111;
        overflow: hidden;
    }

    #news-table td:nth-child(3) {
        width: auto;
        clear: both;
        padding-top: 6px;
    }

    #news-table td:nth-child(4) {
        min-width: 0;
        font-size: 13px;
        font-weight: 500;
        padding-top: 6px;
        line-height: 1.45;
    }

    #news-table td:nth-child(5) {
        min-width: 0;
        font-size: 12px;
        color: #666;
        padding-top: 4px;
    }

    #news-table td:nth-child(6) {
        width: auto;
        font-size: 11px;
        padding-top: 6px;
    }

    footer {
        padding: 16px;
        font-size: 11px;
    }
}

@media (max-width: 375px) {
    header h1 { font-size: 16px; }
    .stat-label { font-size: 8px; }
    .stat-value { font-size: 12px; }
    main { padding: 8px; }
    section { padding: 12px; }
    #commentary-list li { font-size: 12px; }

    #tracker-table td:first-child {
        min-width: 95px;
        max-width: 110px;
        font-size: 10px;
    }

    #tracker-table td { font-size: 10px; }
}
