body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0 0 3rem;
    background: #f4f4f4;
}

/* ── App header / nav ──────────────────────────────── */
.app-header {
    background: #1a1a2e;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

.header-inner {
    max-width: 1200px;
    margin: auto;
    padding: 0 2rem;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-logo {
    color: #fff;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: bold;
    letter-spacing: 0.02em;
}

.main-nav {
    display: flex;
    gap: 0.2rem;
}

.main-nav a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    padding: 0.35rem 0.8rem;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.main-nav a:hover { background: rgba(255,255,255,0.12); color: #fff; }
.main-nav a.nav-active { background: rgba(255,255,255,0.2); color: #fff; }

/* ── Views ─────────────────────────────────────────── */
.view.hidden { display: none !important; }
.view { padding-top: 2rem; }

/* ── Container / page layout ────────────────────────── */
.container {
    max-width: 1200px;
    margin: auto;
    padding: 2rem;
    background: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: #1a1a2e;
}

h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #444;
}

.subtitle {
    font-size: 0.8rem;
    text-transform: none;
    letter-spacing: 0;
    color: #888;
    font-weight: normal;
}

/* ── Summary cards ─────────────────────────────── */
.summary-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.card {
    flex: 1 1 130px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    text-align: center;
}

.card-highlight {
    background: #e8f4fd;
    border-color: #007acc;
}

.card-value {
    font-size: 2rem;
    font-weight: bold;
    color: #007acc;
}

.card-label {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Two-column stats grid ─────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-box {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.25rem;
}

.stat-box.full-width {
    grid-column: 1 / -1;
    margin-bottom: 1.5rem;
}

/* ── Feed stats table ──────────────────────────── */
#feedStatsTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

#feedStatsTable th,
#feedStatsTable td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #ddd;
    text-align: left;
}

#feedStatsTable th {
    background: #007acc;
    color: white;
}

#feedStatsTable tr:last-child td {
    border-bottom: none;
}

/* ── Vendor bar chart ──────────────────────────── */
.bar-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.bar-label {
    width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333;
    flex-shrink: 0;
}

.bar-track {
    flex: 1;
    background: #e0e0e0;
    border-radius: 4px;
    height: 14px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: #007acc;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.bar-value {
    width: 32px;
    text-align: right;
    color: #555;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* ── Daily advisory chart ──────────────────────── */
.daily-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 120px;
    padding-top: 1.5rem;
    overflow-x: auto;
}

.daily-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 24px;
    height: 100%;
}

.daily-count {
    font-size: 0.65rem;
    color: #888;
    margin-bottom: 2px;
    min-height: 14px;
}

.daily-bar-wrap {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
}

.daily-bar {
    width: 100%;
    background: #007acc;
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    transition: height 0.3s ease;
    cursor: default;
}

.daily-bar:hover {
    background: #005fa3;
}

.daily-label {
    font-size: 0.6rem;
    color: #888;
    margin-top: 4px;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    white-space: nowrap;
}

/* ── TTP section ───────────────────────────────── */
#ttpSection {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

#ttpSection > h2 {
    margin-bottom: 1rem;
}

.enrichment-bar-wrap {
    margin-bottom: 1.25rem;
}

.enrichment-label {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 4px;
}

.enrichment-track {
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.enrichment-fill {
    height: 100%;
    background: #007acc;
    border-radius: 5px;
    transition: width 0.4s ease;
}

.ttp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.ttp-table th,
.ttp-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid #ddd;
    text-align: left;
    white-space: nowrap;
}

.ttp-table th {
    background: #007acc;
    color: white;
}

.ttp-table td:last-child {
    width: 180px;
    min-width: 120px;
}

/* row colour coding by average lag */
.lag-negative td { background: #eaf6ea; }
.lag-fast    td { background: #f0f9e8; }
.lag-medium  td { background: #fffbe6; }
.lag-slow    td { background: #fff1f0; }

/* range bar inside last column */
.range-track {
    position: relative;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
}

.range-fill {
    position: absolute;
    top: 0;
    height: 100%;
    background: #a8d4f0;
    border-radius: 5px;
}

.range-avg {
    position: absolute;
    top: -3px;
    width: 3px;
    height: 16px;
    background: #007acc;
    border-radius: 2px;
    transform: translateX(-50%);
}

.range-med {
    position: absolute;
    top: -3px;
    width: 3px;
    height: 16px;
    background: #e67e00;
    border-radius: 2px;
    transform: translateX(-50%);
}

.ttp-note {
    font-size: 0.78rem;
    color: #888;
    margin-top: 0.4rem;
}

/* ── Advisories section ────────────────────────── */
#advisoriesSection {
    margin-top: 2rem;
}

.filter {
    margin-bottom: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem;
    border-bottom: 1px solid #ccc;
    text-align: left;
}

th {
    background: #007acc;
    color: white;
}

/* row hover only on non-data-table tables (data-table has its own hover rules) */
table:not(.data-table) tr:hover {
    background: #f1f1f1;
}

.empty {
    color: #999;
    font-size: 0.9rem;
}

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

    table, thead, tbody, th, td, tr {
        display: block;
    }

    thead {
        display: none;
    }

    tr {
        margin-bottom: 1rem;
        background: #fff;
        padding: 1rem;
        box-shadow: 0 0 5px rgba(0,0,0,0.1);
    }

    td {
        position: relative;
        padding-left: 50%;
    }

    td::before {
        position: absolute;
        left: 1rem;
        width: 45%;
        font-weight: bold;
        content: attr(data-label);
    }
}

/* ── Page-level header ─────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e8e8e8;
    flex-wrap: wrap;
}

.page-header h2 {
    margin: 0;
    font-size: 1.3rem;
    text-transform: none;
    letter-spacing: 0;
    color: #1a1a2e;
}

/* ── Toolbar (search / filter row) ────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.search-input {
    padding: 0.45rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 240px;
}

.search-input:focus { outline: none; border-color: #007acc; box-shadow: 0 0 0 2px rgba(0,122,204,0.15); }

.filter-select {
    padding: 0.45rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
    background: white;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
}

/* ── Generic data table ────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    background: #1a1a2e;
    color: white;
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
}
.data-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.data-table th.sortable:hover { background: #2a2a4e; }
.data-table th.sort-active { background: #2d3a6e; }

.data-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #f7f9fc; }
.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: #eef3fb !important; }

/* column helpers */
.mono  { font-family: 'Courier New', monospace; font-size: 0.85em; }
.num   { text-align: right; }
.nowrap { white-space: nowrap; }
.small { font-size: 0.82rem; }
.dim   { color: #888; }

/* ── Clickable cards ───────────────────────────────── */
.card-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    display: block;
    transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}

.card-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    border-color: #007acc;
}

.card-arrow {
    font-size: 0.7rem;
    color: #007acc;
    margin-left: 0.3rem;
    opacity: 0.8;
}

/* ── Badges ────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

.badge-green  { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef9c3; color: #713f12; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-gray   { background: #f3f4f6; color: #374151; }

.count-badge {
    display: inline-block;
    background: #e0e7ff;
    color: #3730a3;
    padding: 0.1rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: normal;
    margin-left: 0.4rem;
    vertical-align: middle;
}

/* ── Pagination ────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.pag-btn {
    padding: 0.3rem 0.65rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1.4;
    transition: background 0.1s;
}

.pag-btn:hover { background: #f0f4f8; border-color: #bbb; }
.pag-btn.pag-active { background: #1a1a2e; color: white; border-color: #1a1a2e; }
.pag-dots { padding: 0 0.2rem; color: #aaa; font-size: 0.9rem; }
.pag-info { margin-left: auto; font-size: 0.8rem; color: #888; }

/* ── Advisory detail ───────────────────────────────── */
.back-bar { margin-bottom: 1.25rem; }

.back-link {
    color: #007acc;
    text-decoration: none;
    font-size: 0.9rem;
}

.back-link:hover { text-decoration: underline; }

.detail-card {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.75rem;
}

.detail-title {
    font-size: 1.2rem;
    margin: 0 0 1.1rem 0;
    color: #1a1a2e;
    line-height: 1.4;
}

.detail-meta-grid {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 0.45rem 1rem;
    font-size: 0.9rem;
    align-items: start;
}

.detail-meta-label { font-weight: 600; color: #555; }

.ext-link {
    color: #007acc;
    word-break: break-all;
    font-size: 0.85rem;
}

.detail-description {
    font-size: 0.88rem;
    color: #444;
    line-height: 1.65;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
    margin-top: 1rem;
    word-break: break-word;
}

.detail-section {
    margin-bottom: 2rem;
}

.detail-section > h2 {
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
    color: #333;
}

.csaf-summary { display: flex; gap: 0.35rem; }

/* ── CSAF product status table ─────────────────────── */
.csaf-table { font-size: 0.85rem; }
.csaf-row-affected td { background: #fff5f5; }
.csaf-row-ok       td { background: #f0fdf4; }
.csaf-row-affected:hover td { background: #fee8e8 !important; }
.csaf-row-ok:hover       td { background: #e6faf0 !important; }

/* ── CVE expand rows ───────────────────────────────── */
.expand-col { width: 28px; }
.expand-arrow { color: #aaa; font-size: 0.75rem; user-select: none; }
.cve-row-open { background: #f0f4ff; }
.cve-row-open td { border-bottom: none; }
.cve-detail-row td { padding: 0; border-bottom: 1px solid #d8e2ff; }
.cve-expand-inner { padding: 0.75rem 1.5rem 1rem 2.5rem; background: #f5f8ff; }

.inner-table { font-size: 0.85rem; }
.inner-table th { background: #3730a3 !important; }

/* ── Vendor filter badge (products page) ───────────── */
.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #dbeafe;
    color: #1e40af;
    padding: 0.2rem 0.6rem 0.2rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
}

.filter-badge.hidden { display: none; }

.badge-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    color: #1e40af;
    padding: 0;
    display: flex;
    align-items: center;
}

.badge-remove:hover { color: #1e3a8a; }

/* ── Vendor link inside products table ─────────────── */
.vendor-link {
    color: #007acc;
    text-decoration: none;
}

.vendor-link:hover { text-decoration: underline; }

/* ── Recent advisories / section header ────────────── */
#recentSection { margin-top: 2rem; }

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

.section-header h2 { margin: 0; }

.view-all-link {
    color: #007acc;
    font-size: 0.85rem;
    text-decoration: none;
}

.view-all-link:hover { text-decoration: underline; }

/* ── Loading placeholder ───────────────────────────── */
.loading {
    color: #aaa;
    font-style: italic;
    padding: 1.5rem 0;
}

/* ── TTP section spacing ───────────────────────────── */
#ttpSection { margin-top: 2rem; margin-bottom: 1.5rem; }
#ttpSection > h2 { margin-bottom: 1rem; }

/* ── Product expand rows ───────────────────────────── */
.product-row.no-expand { cursor: default; }
.product-row.no-expand:hover td { background: inherit !important; }
.product-row-open { background: #f0f4ff; }
.product-row-open td { border-bottom: none; }
.product-detail-row td { padding: 0; border-bottom: 1px solid #d8e2ff; }
.expand-hint {
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
    margin: 0 0 0.5rem 0;
}
