* {
    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;
}

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

.header-content {
    max-width: 1320px;
    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: 1320px;
    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;
}

/* ============ 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;
}

#commentary-list li:hover {
    border-left-color: #111;
}

/* ============ 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;
}

#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:hover td {
    background: #fafafa;
}

#tracker-table tr:hover td:first-child {
    background: #f5f5f5;
}

#tracker-table tr.section-header:hover td,
#tracker-table tr.subgroup-header:hover td {
    background: inherit;
}

#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 tr:hover {
    background: #fafafa;
}

#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-platform     { background: #e8f5e9; color: #2e7d32; }
.cat-used-evs     { background: #e0f2f1; color: #00695c; }
.cat-lending      { background: #e8eaf6; color: #283593; }
.cat-showroom     { background: #fce4ec; color: #c62828; }
.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; }
}
