:root {
    --bg-dark: #090a0f;
    --panel-bg: rgba(17, 20, 32, 0.65);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-muted: #9ca3af;

    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.3);
    --secondary: #06b6d4;

    --success: #10b981;
    --warning: #f97316;
    --danger: #f43f5e;

    /* Surfaces. Depth is built from layered translucency and one-pixel
       borders rather than from gradients: the brief is long-form reading and
       a gradient behind body text costs contrast for no information. */
    --surface-1: rgba(19, 22, 34, 0.72);
    --surface-2: rgba(26, 30, 45, 0.62);
    --surface-3: rgba(12, 14, 22, 0.55);
    --hairline: rgba(255, 255, 255, 0.07);
    --hairline-strong: rgba(255, 255, 255, 0.14);

    /* Band accents. The 5-25% band gets its own hue because it is the one
       Nigeria discloses and a 25%-threshold tool does not. */
    --band-critical: #fb7185;
    --band-high: #fb923c;
    --band-elevated: #c084fc;
    --band-nigeria: #22d3ee;
    --band-muted: #64748b;

    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Outfit', sans-serif;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --dur-fast: 160ms;
    --dur: 260ms;
}

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

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    transition: outline-offset 0.2s ease;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Background wash.
   Was three stacked radial gradients at 15/12/5% opacity, which is what makes
   a dark dashboard read as generic. Now: one weak off-centre wash for depth,
   plus a fine dot lattice that gives the eye a fixed reference so the moving
   pixel field behind it does not feel like drifting noise. */
.glow-bg {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(120% 80% at 12% 0%, rgba(139, 92, 246, 0.10) 0%, transparent 55%),
        radial-gradient(90% 70% at 100% 100%, rgba(6, 182, 212, 0.07) 0%, transparent 55%);
    z-index: -2;
    pointer-events: none;
}

.glow-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px);
    background-size: 34px 34px;
    /* Fades the lattice out toward the bottom so it never competes with the
       long-form brief. */
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 78%);
    mask-image: linear-gradient(to bottom, #000 0%, transparent 78%);
}

/* The animated pixel field sits behind the wash. */
.backdrop-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: -3;
    pointer-events: none;
    /* Rendered at ~200px wide and upscaled; pixelated keeps the grain crisp
       instead of turning it into blur. */
    image-rendering: pixelated;
    opacity: 0.85;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Glassmorphism Styles */
.glass {
    background: var(--panel-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-orb {
    width: 25px;
    height: 25px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    box-shadow: 0 0 15px var(--primary);
    position: relative;
    animation: pulseGlow 3s infinite alternate;
}

@keyframes pulseGlow {
    0% { transform: scale(1); box-shadow: 0 0 10px var(--primary); }
    100% { transform: scale(1.15); box-shadow: 0 0 20px var(--primary), 0 0 30px var(--secondary); }
}

.logo-text .logo-word {
    display: block;
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #fff, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text span {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 4px;
    display: block;
    margin-top: -3px;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 20px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.pulse.green {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: activePulse 2s infinite;
}

.pulse.purple {
    background-color: var(--primary);
    box-shadow: 0 0 8px var(--primary);
    animation: activePulse 2s infinite 0.5s;
}

@keyframes activePulse {
    0% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.6; }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    min-height: 44px;
    min-width: 44px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.15);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
}

.stat-icon i {
    width: 24px;
    height: 24px;
}

.purple-glow i { color: #c084fc; filter: drop-shadow(0 0 5px #c084fc); }
.blue-glow i { color: #67e8f9; filter: drop-shadow(0 0 5px #67e8f9); }
.green-glow i { color: #6ee7b7; filter: drop-shadow(0 0 5px #6ee7b7); }
.red-glow i { color: #fda4af; filter: drop-shadow(0 0 5px #fda4af); }

.alert-glow {
    border-color: rgba(244, 63, 94, 0.2);
}

.alert-glow:hover {
    box-shadow: 0 8px 32px 0 rgba(244, 63, 94, 0.15);
    border-color: rgba(244, 63, 94, 0.4);
}

.stat-info h3 {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
}

.stat-info p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Workspace Layout */
.workspace-grid {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 20px;
    align-items: start;
}

.workspace-panel {
    display: flex;
    flex-direction: column;
    padding: 24px;
    height: auto;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.panel-header h2 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.panel-header .subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

/* Search Bar */
.search-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    width: 220px;
    min-height: 44px;
    transition: all 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--primary);
    width: 250px;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

.search-box input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 13px;
    width: 100%;
}

.search-box button {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 8px 10px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s ease;
}

.search-box button:hover {
    color: var(--primary);
}

.search-options {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(14px);
}

/* Filters */
.feed-filters-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.feed-filters-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 55px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-btn, .filter-risk-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    padding: 4px 12px;
    min-height: 32px;
    border-radius: 16px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.filter-btn:hover, .filter-btn.active {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

.filter-risk-btn:hover, .filter-risk-btn.active {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--secondary);
    color: #fff;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

/* Feed meta row: record count + sort */
.feed-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 4px;
    gap: 10px;
}

.feed-count {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sort-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    flex-shrink: 0;
}

.sort-control select {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 11px;
    padding: 5px 8px;
    min-height: 28px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.sort-control select:hover,
.sort-control select:focus {
    border-color: var(--primary);
}

.sort-control select option {
    background: #14172a;
    color: var(--text-primary);
}

/* Articles List Feed */
.articles-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 5px;
}

.articles-list::-webkit-scrollbar {
    width: 4px;
}

.articles-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* Article Card */
.article-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.article-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.article-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}

.badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 9px;
    background: rgba(255, 255, 255, 0.05);
}

.badge.government { color: #38bdf8; background: rgba(56, 189, 248, 0.1); }
.badge.company { color: #a78bfa; background: rgba(167, 139, 250, 0.1); }
.badge.legal { color: #f472b6; background: rgba(244, 114, 182, 0.1); }
.badge.other { color: var(--text-muted); background: rgba(255, 255, 255, 0.06); }

.article-card h3 {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
    transition: color 0.2s ease;
}

.article-card:hover h3 {
    color: var(--secondary);
}

.article-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
}

.risk-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 4px;
}

.risk-dot.low { background-color: var(--success); }
.risk-dot.medium { background-color: var(--warning); }
.risk-dot.high { background-color: var(--danger); }
.risk-dot.critical { background-color: #be123c; }

/* Card entrance stagger (skipped for reduced-motion users) */
@media (prefers-reduced-motion: no-preference) {
    .article-card {
        opacity: 0;
        animation: cardIn 0.35s ease-out forwards;
        animation-delay: calc(var(--stagger, 0) * 40ms);
    }

    @keyframes cardIn {
        from { opacity: 0; transform: translateY(8px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

.source-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.risk-label {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}

/* AI engine provenance chip */
.engine-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--secondary);
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.25);
    white-space: nowrap;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 30px 10px;
    color: var(--text-muted);
}

/* Clickable alert items open the article modal */
.alert-item.clickable {
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.alert-item.clickable:hover,
.alert-item.clickable:focus-visible {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(2px);
}

/* Modal Details tab */
.details-summary {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 14px;
}

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

.fact {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-primary);
    min-width: 0;
    overflow-wrap: anywhere;
}

.fact-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
}

/* Modal Related tab */
.related-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-body);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.related-item:hover,
.related-item:focus-visible {
    background: rgba(139, 92, 246, 0.08);
    border-color: rgba(139, 92, 246, 0.35);
}

.related-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}

.related-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Entity tags are now interactive buttons */
button.entity-tag {
    font-family: var(--font-body);
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

button.entity-tag:hover,
button.entity-tag:focus-visible {
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* Insights Column */
.insights-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Network Graph Panel */
.graph-panel {
    height: 400px;
}

.network-container {
    width: 100%;
    height: 340px;
    min-height: 340px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

/* Knowledge Graph legend */
.graph-legend {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 5;
    display: flex;
    gap: 12px;
    padding: 6px 12px;
    border-radius: 10px;
    background: rgba(9, 10, 15, 0.75);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: none;
    flex-wrap: wrap;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.legend-swatch {
    display: inline-block;
    width: 9px;
    height: 9px;
}

.legend-swatch.person { background: #38bdf8; border-radius: 50%; }
.legend-swatch.company { background: #a78bfa; border-radius: 2px; }
.legend-swatch.agency {
    width: 0;
    height: 0;
    background: transparent;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 9px solid #f472b6;
}
.legend-swatch.psc { background: #ef4444; border-radius: 2px; transform: rotate(45deg) scale(0.85); }

/* vis-network default tooltip restyled to match theme */
div.vis-tooltip {
    background: rgba(17, 20, 32, 0.95) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    color: var(--text-primary) !important;
    font-family: var(--font-body) !important;
    font-size: 11px !important;
    padding: 8px 10px !important;
    white-space: pre-line !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
}

.split-insights {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Alerts panel */
.alerts-panel {
    max-height: 280px;
}

.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    max-height: 200px;
}

.alert-item {
    padding: 10px;
    border-radius: 8px;
    background: rgba(244, 63, 94, 0.03);
    border: 1px solid rgba(244, 63, 94, 0.1);
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.alert-item.critical {
    background: rgba(244, 63, 94, 0.08);
    border-color: rgba(244, 63, 94, 0.2);
}

.alert-item.warning {
    background: rgba(249, 115, 22, 0.05);
    border-color: rgba(249, 115, 22, 0.2);
}

.alert-item-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
}

/* Charts */
.chart-panel {
    max-height: 280px;
}

.chart-container {
    position: relative;
    height: 180px;
    width: 100%;
}

/* Spinner */
.loading-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 60px 0;
    color: var(--text-muted);
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.05);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    /* visibility, not just opacity: an opacity-0 dialog keeps every control
       inside it in the tab order and in the accessibility tree, so keyboard
       and screen-reader users used to tab through four invisible dialogs
       (roughly 30 controls) before reaching the page. visibility is
       transitionable, so the fade still works. */
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
    visibility: visible;
}

.modal-content {
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 30px;
    border-radius: 20px;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    0% { transform: translateY(30px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-modal-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-modal-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.close-modal-btn:hover {
    color: #fff;
}

.modal-body h2 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 15px;
}

.modal-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 25px;
}

.modal-metadata span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.modal-divider {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 20px 0;
}

/* Tabs */
.summary-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    padding: 5px 15px;
    min-height: 44px;
    position: relative;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tab-btn:hover, .tab-btn.active {
    color: #fff;
}

.tab-btn.active:after {
    content: "";
    position: absolute;
    bottom: -11px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary);
}

.tab-content {
    line-height: 1.6;
    font-size: 14px;
    color: #d1d5db;
}

.tab-content.hidden {
    display: none;
}

.entities-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.entity-tag {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.entity-tag.person { border-color: rgba(56, 189, 248, 0.3); color: #38bdf8; }
.entity-tag.company { border-color: rgba(167, 139, 250, 0.3); color: #a78bfa; }
.entity-tag.agency { border-color: rgba(244, 114, 182, 0.3); color: #f472b6; }
.entity-tag.psc { border-color: rgba(239, 68, 68, 0.35); color: #ef4444; }

.modal-actions {
    margin-top: 30px;
    display: flex;
    justify-content: flex-end;
}

.risk-badge {
    padding: 3px 10px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 11px;
}
.risk-badge.low { background-color: rgba(16, 185, 129, 0.15); color: var(--success); }
.risk-badge.medium { background-color: rgba(249, 115, 22, 0.15); color: var(--warning); }
.risk-badge.high { background-color: rgba(244, 63, 94, 0.15); color: var(--danger); }
.risk-badge.critical { background-color: rgba(190, 18, 60, 0.25); color: #fda4af; }

.sentiment-badge {
    padding: 3px 10px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.05);
}

/* Responsiveness */
@media (max-width: 1200px) {
    .workspace-grid {
        grid-template-columns: 1fr;
    }
}

/* Daily Reports Reader Layout */
.reports-modal-content {
    max-width: 1100px;
    width: 95%;
    max-height: 90vh;
    padding: 24px;
}

.reports-split-view {
    display: flex;
    gap: 24px;
    margin-top: 15px;
    height: 70vh;
    overflow: hidden;
}

.reports-sidebar {
    width: 280px;
    border-right: 1px solid var(--border-color);
    padding-right: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
}

.reports-sidebar h3 {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.reports-archive-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    flex: 1;
}

.report-archive-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.report-archive-item:hover, .report-archive-item.active {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--primary);
}

.report-archive-item span.date {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.report-archive-item span.title {
    font-size: 11px;
    color: var(--text-muted);
}

.reports-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow: hidden;
}

.reports-viewer-actions {
    display: flex;
    justify-content: flex-end;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.report-md-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 15px;
    line-height: 1.6;
    color: #d1d5db;
    font-size: 14px;
}

.report-md-content::-webkit-scrollbar {
    width: 4px;
}

.report-md-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* Markdown Specific Elements Styling */
.report-md-content h1 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #fff, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.report-md-content h2 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    color: var(--secondary);
    margin-top: 25px;
    margin-bottom: 15px;
}

.report-md-content h3 {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin-top: 15px;
    margin-bottom: 8px;
}

.report-md-content p {
    margin-bottom: 15px;
}

.report-md-content ul {
    margin-bottom: 20px;
    padding-left: 20px;
}

.report-md-content li {
    margin-bottom: 8px;
    list-style-type: square;
}

.report-md-content li strong {
    color: #fff;
}

.report-divider {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 25px 0;
}

.report-link {
    color: var(--secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.report-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* Graph Control Overlay Toolbar */
.graph-toolbar {
    position: absolute;
    top: 60px;
    right: 25px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 10;
}

.graph-btn {
    background: rgba(17, 20, 32, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e5e7eb;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.graph-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    transform: scale(1.08);
    box-shadow: 0 0 12px var(--primary-glow);
}

.graph-btn.active {
    background: var(--secondary);
    border-color: var(--secondary);
    color: #fff;
}

/* Custom Table Row Hover */
.psc-table-row {
    transition: background 0.2s ease, transform 0.15s ease;
    cursor: pointer;
}

.psc-table-row:hover {
    background: rgba(56, 189, 248, 0.08) !important;
}

/* PSC Executive KPI Summary Bar */
.psc-kpi-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.psc-kpi-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    padding: 12px 16px;
    transition: all 0.2s ease;
}

.psc-kpi-card:hover {
    border-color: rgba(56, 189, 248, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.psc-kpi-card.highlight-risk {
    border-left: 3px solid #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.psc-kpi-card .kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.psc-kpi-card .kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: #f9fafb;
    line-height: 1.2;
}

.psc-kpi-card .kpi-subtext {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
    display: block;
}

/* PSC Filter Chips */
.psc-filter-chips {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.psc-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #d1d5db;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.psc-chip:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: #38bdf8;
    color: #fff;
}

.psc-chip.active {
    background: #38bdf8;
    border-color: #38bdf8;
    color: #0f172a;
    font-weight: 600;
}

/* UBO Lineage Flow Diagram */
.lineage-flow {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin: 15px 0;
    overflow-x: auto;
}

.lineage-node {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 8px 12px;
    text-align: center;
    min-width: 140px;
}

.lineage-node .node-title {
    font-weight: 600;
    font-size: 12px;
    color: #f3f4f6;
}

.lineage-node .node-sub {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.lineage-arrow {
    color: #38bdf8;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}



/* PSC demo-data disclosure banner: sample records must never be mistaken
   for extracted intelligence */
.psc-demo-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: 10px;
    background: rgba(249, 115, 22, 0.08);
    border: 1px solid rgba(249, 115, 22, 0.3);
    color: #fdba74;
    font-size: 12.5px;
    line-height: 1.5;
}

.psc-demo-banner[hidden] { display: none; }

.psc-demo-banner i {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.psc-demo-banner strong { color: #fed7aa; }

/* Keyboard affordance for the dossier rows */
.psc-table-row { cursor: pointer; }

.psc-table-row:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

@media print {
    .modal-overlay { position: static; background: none; }
    .psc-demo-banner { border-color: #999; color: #333; }
    .btn, .close-modal-btn, .graph-toolbar { display: none !important; }
}

/* ==========================================================
   RESPONSIVE — the header's button row is 728px wide and did
   not wrap, forcing the whole document to 936px and side-
   scrolling every page on a phone.
   ========================================================== */

@media (max-width: 900px) {
    .container { padding: 12px; gap: 14px; }

    .dashboard-header {
        flex-wrap: wrap;
        gap: 12px;
        padding: 14px 16px;
    }

    .system-status {
        flex-wrap: wrap;
        gap: 10px;
        width: 100%;
    }

    /* Live-status pills are decorative next to the actions */
    .system-status .status-item { font-size: 12px; }

    .system-status .btn {
        flex: 1 1 auto;
        min-width: 140px;
        justify-content: center;
    }

    .workspace-panel { padding: 16px; }

    .panel-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .search-box,
    .search-box:focus-within { width: 100%; }

    .feed-filters-row { flex-wrap: wrap; }

    .feed-meta-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .split-insights { grid-template-columns: 1fr; }

    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

    /* Wide content scrolls inside its own container, never the page */
    #psc-table-container,
    .psc-kpi-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #psc-table-container table { min-width: 780px; }

    .modal-content {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        margin: 12px;
    }

    .reports-split-view { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .logo-text h1 { font-size: 20px; }

    .system-status .btn {
        width: 100%;
        flex: 1 1 100%;
    }

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

    .stat-card { padding: 14px; gap: 12px; }

    .stat-info h3 { font-size: 22px; }

    .graph-legend {
        position: static;
        margin-top: 10px;
        justify-content: center;
    }
}
