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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #0a0e17;
    color: #e0e0e0;
    line-height: 1.5;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

header { margin-bottom: 2rem; }
header h1 { font-size: 1.8rem; color: #f0f0f0; margin-bottom: 0.3rem; }
header .subtitle { color: #6b7280; font-size: 0.85rem; }

.summary-bar {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1rem 1.5rem;
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 10px;
}

.summary-stat { text-align: center; }
.summary-stat .value { font-size: 1.8rem; font-weight: 700; color: #60a5fa; }
.summary-stat .label { font-size: 0.75rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; }

/* Tab Navigation */
.tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #1f2937;
}
.tab-bar .tab {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}
.tab-bar .tab:hover { color: #d1d5db; }
.tab-bar .tab.active {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    align-items: baseline;
    gap: 0.8rem;
    margin: 1.5rem 0 1rem;
}
.section-header h2 { font-size: 1rem; color: #9ca3af; font-weight: 600; }
.section-note { font-size: 0.75rem; color: #4b5563; }

.sparse-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

.card {
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 10px;
    padding: 1.2rem;
    transition: border-color 0.15s;
}
.card.sparse { padding: 0.8rem; opacity: 0.8; }
.card.sparse .count { font-size: 1.4rem; }
.card.sparse .mini-bars { height: 24px; }
.card:hover { border-color: #374151; }
.card.significant { border-color: #ef4444; border-width: 2px; }
.card.elevated { border-color: #f59e0b; border-width: 2px; }
.card.shifting { border-color: #a78bfa; border-width: 2px; }
.card.declining { border-color: #3b82f6; }

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

.card .name {
    font-size: 0.85rem;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card .count {
    font-size: 2rem;
    font-weight: 700;
    color: #f0f0f0;
}

.card .count-label {
    font-size: 0.75rem;
    font-weight: 400;
    color: #6b7280;
}

.stats-row {
    display: flex;
    gap: 0.8rem;
    margin: 0.4rem 0;
    flex-wrap: wrap;
}

.stats-row .stat {
    font-size: 0.7rem;
    color: #6b7280;
    font-variant-numeric: tabular-nums;
}

.status-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
}
.status-badge.significant { background: #7f1d1d; color: #fca5a5; }
.status-badge.elevated { background: #78350f; color: #fde68a; }
.status-badge.shifting { background: #4c1d95; color: #c4b5fd; }
.status-badge.declining { background: #1e3a5f; color: #93c5fd; }
.status-badge.normal { background: #1f2937; color: #6b7280; }

.card .trend-row { display: flex; gap: 1rem; align-items: center; margin-top: 0.3rem; }
.card .trend { font-size: 0.85rem; font-weight: 600; }
.trend.rising { color: #34d399; }
.trend.falling { color: #f87171; }
.trend.stable { color: #6b7280; }
.shift { font-size: 0.75rem; font-weight: 600; }
.shift.up { color: #34d399; }
.shift.down { color: #f87171; }

.card .mini-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 32px;
    margin-top: 0.8rem;
}

.card .mini-bar {
    flex: 1;
    background: #3b82f6;
    border-radius: 2px;
    min-height: 2px;
    transition: opacity 0.1s;
}
.card .mini-bar.clickable { cursor: pointer; }
.card .mini-bar.clickable:hover { opacity: 0.7; }
.card.significant .mini-bar { background: #ef4444; }
.card.elevated .mini-bar { background: #f59e0b; }
.card.shifting .mini-bar { background: #a78bfa; }

.card-details {
    margin-top: 0.6rem;
    border-top: 1px solid #1f2937;
    padding-top: 0.4rem;
}
.card-details summary {
    font-size: 0.7rem;
    color: #6b7280;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    list-style: none;
}
.card-details summary::before { content: "+ "; }
.card-details[open] summary::before { content: "− "; }
.card-details summary::-webkit-details-marker { display: none; }
.card-details .stats-row { margin-top: 0.4rem; }

.contributing {
    margin-top: 0.8rem;
    padding-top: 0.6rem;
    border-top: 1px solid #1f2937;
}

.contributing-label {
    font-size: 0.7rem;
    color: #6b7280;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}

.contributing-article {
    display: block;
    font-size: 0.75rem;
    color: #60a5fa;
    text-decoration: none;
    padding: 0.15rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.contributing-article:hover { text-decoration: underline; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 10px;
    overflow: hidden;
}

.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    background: #1f2937;
    color: #9ca3af;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.data-table th.num { text-align: right; }

.data-table td {
    padding: 0.6rem 1rem;
    border-top: 1px solid #1f2937;
    font-size: 0.9rem;
}
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tr:hover { background: #1a2332; }

/* Threat Actor Mapping */
.actor-table-wrap { margin-bottom: 2rem; }
.actor-table .actor-name { font-weight: 600; color: #f0f0f0; white-space: nowrap; }
.actor-archetypes { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tag.actor-archetype { background: #1e293b; color: #94a3b8; font-size: 0.7rem; transition: background 0.1s; }
.tag.actor-archetype.clickable { cursor: pointer; }
.tag.actor-archetype.clickable:hover { background: #334155; color: #e2e8f0; }
.actor-count { color: #6b7280; }

/* State-Sponsored Nation Cards */
.nation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.nation-card {
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 10px;
    padding: 1.2rem;
}
.nation-card:hover { border-color: #374151; }
.nation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid #1f2937;
}
.nation-name { font-size: 1.1rem; font-weight: 700; color: #f0f0f0; }
.nation-count { font-size: 0.8rem; color: #60a5fa; font-weight: 600; }
.nation-section { margin-bottom: 0.6rem; }
.nation-label {
    display: block;
    font-size: 0.65rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}
.nation-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tag.actor-tag { background: #1a2332; color: #c4b5fd; }
.tag.archetype-tag { background: #1e293b; color: #94a3b8; }

/* CVE Tracker */
.cve-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.8rem;
    margin-bottom: 2rem;
}
.cve-card {
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 8px;
    padding: 0.8rem;
}
.cve-card.new { border-color: #34d399; border-width: 2px; }
.cve-card.spiking { border-color: #ef4444; border-width: 2px; }
.cve-card.persistent { border-color: #f59e0b; }
.cve-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}
.cve-header-right { display: flex; gap: 0.4rem; align-items: center; }
.cvss-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-variant-numeric: tabular-nums;
}
.cvss-badge.critical { background: #7f1d1d; color: #fca5a5; }
.cvss-badge.high { background: #78350f; color: #fde68a; }
.cvss-badge.medium { background: #1e3a5f; color: #93c5fd; }
.cvss-badge.low { background: #1f2937; color: #6b7280; }
.cve-description {
    font-size: 0.7rem;
    color: #9ca3af;
    line-height: 1.4;
    margin-bottom: 0.4rem;
}
.cve-id { font-size: 0.8rem; font-weight: 700; color: #f0f0f0; font-family: monospace; text-decoration: none; }
.cve-id:hover { color: #60a5fa; text-decoration: underline; }
.cve-signal {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
}
.cve-signal.new { background: #064e3b; color: #6ee7b7; }
.cve-signal.spiking { background: #7f1d1d; color: #fca5a5; }
.cve-signal.persistent { background: #78350f; color: #fde68a; }
.cve-signal.active { background: #1f2937; color: #6b7280; }
.cve-products { display: flex; flex-wrap: wrap; gap: 0.2rem; margin-bottom: 0.4rem; }
.cve-products .tag { font-size: 0.65rem; background: #1e3a5f; color: #93c5fd; }
.cve-stats { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.cve-stats .stat { font-size: 0.65rem; color: #6b7280; }
.cve-card .card-details { margin-top: 0.4rem; border-top: 1px solid #1f2937; padding-top: 0.3rem; }

/* Article Overlay */
.overlay-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
}
.overlay-card {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(640px, 90vw);
    max-height: 80vh;
    overflow-y: auto;
    background: #1a2332;
    border: 1px solid #374151;
    border-radius: 12px;
    padding: 1.5rem;
    z-index: 101;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}
.overlay-header h3 {
    font-size: 1rem;
    color: #f0f0f0;
    line-height: 1.4;
}
.overlay-close {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}
.overlay-close:hover { color: #f0f0f0; }
.overlay-summary {
    font-size: 0.85rem;
    color: #d1d5db;
    line-height: 1.6;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #1f2937;
}
.overlay-meta { display: flex; flex-direction: column; gap: 0.6rem; }
.overlay-field { }
.overlay-label {
    font-size: 0.65rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 0.3rem;
}
.overlay-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tag {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: #1f2937;
    color: #9ca3af;
}
.tag.sector { background: #1e3a5f; color: #93c5fd; }
.tag.entity { background: #1a332e; color: #6ee7b7; }
.tag.mitre { background: #3b1f2b; color: #fca5a5; }
.overlay-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid #1f2937;
}
.overlay-date { font-size: 0.75rem; color: #6b7280; }
.overlay-link {
    font-size: 0.8rem;
    color: #60a5fa;
    text-decoration: none;
}
.overlay-link:hover { text-decoration: underline; }

/* Week popover articles */
.week-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding-bottom: 0.8rem;
    margin-bottom: 0.4rem;
    border-bottom: 1px solid #1f2937;
}
.week-article {
    display: block;
    padding: 0.6rem 0;
    border-bottom: 1px solid #1f2937;
    text-decoration: none;
    color: inherit;
}
.week-article:last-child { border-bottom: none; }
.week-article:hover { background: #111827; margin: 0 -1.5rem; padding-left: 1.5rem; padding-right: 1.5rem; }
.week-article-title { font-size: 0.85rem; color: #60a5fa; line-height: 1.4; }
.week-article-date { font-size: 0.7rem; color: #6b7280; margin-top: 0.15rem; }
.week-empty { font-size: 0.85rem; color: #6b7280; padding: 1rem 0; }

footer {
    margin-top: 2rem;
    text-align: center;
    color: #4b5563;
    font-size: 0.75rem;
}
