/* ══════════════════════════════════════════════════════════════
   TACTICAL COMMAND CENTER — Sodexo CI Portal v2.0
   ══════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;800&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --bg-deep: #030508;
    --bg-primary: #0a0e1a;
    --bg-panel: rgba(8, 14, 30, 0.85);
    --bg-panel-hover: rgba(12, 20, 42, 0.95);
    --bg-elevated: rgba(15, 25, 50, 0.9);
    --border: rgba(0, 200, 255, 0.08);
    --border-active: rgba(0, 200, 255, 0.25);
    --border-glow: rgba(0, 200, 255, 0.4);
    /* Neon accent palette */
    --cyan: #00d4ff;
    --cyan-dim: rgba(0, 212, 255, 0.15);
    --cyan-glow: rgba(0, 212, 255, 0.35);
    --magenta: #ff2d78;
    --magenta-dim: rgba(255, 45, 120, 0.12);
    --amber: #ffaa00;
    --amber-dim: rgba(255, 170, 0, 0.12);
    --green: #00ff88;
    --green-dim: rgba(0, 255, 136, 0.1);
    --red: #ff3355;
    --red-dim: rgba(255, 51, 85, 0.12);
    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #b9c8e3;
    --text-muted: #7286a8;
    /* Fonts */
    --ff-display: 'Orbitron', sans-serif;
    --ff-body: 'Inter', sans-serif;
    --ff-mono: 'JetBrains Mono', monospace;
}

/* ── LIGHT MODE OVERRIDES ───────────────────────────────────── */
[data-theme="light"] {
    --bg-deep: #f0f4fa;
    --bg-primary: #e8edf8;
    --bg-panel: rgba(255, 255, 255, 0.88);
    --bg-panel-hover: rgba(245, 248, 255, 0.98);
    --bg-elevated: rgba(235, 240, 250, 0.95);
    --border: rgba(30, 80, 200, 0.1);
    --border-active: rgba(0, 150, 220, 0.3);
    --border-glow: rgba(0, 100, 220, 0.25);
    --text-primary: #0d1a3a;
    --text-secondary: #2a3d6a;
    --text-muted: #6a7a9a;
    --cyan-dim: rgba(0, 120, 200, 0.1);
    --cyan-glow: rgba(0, 100, 220, 0.2);
    --red-dim: rgba(200, 30, 50, 0.08);
    --amber-dim: rgba(200, 130, 0, 0.1);
    --green-dim: rgba(0, 160, 80, 0.1);
}

[data-theme="light"] body {
    background-image:
        radial-gradient(ellipse at 50% 0%, rgba(0, 100, 220, .06) 0%, transparent 50%),
        linear-gradient(rgba(30, 80, 200, .04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(30, 80, 200, .04) 1px, transparent 1px);
}

[data-theme="light"] body::before {
    background: radial-gradient(ellipse at center, transparent 30%, rgba(230, 238, 255, .5) 100%);
}

[data-theme="light"] header {
    background: rgba(240, 244, 250, .85);
}

[data-theme="light"] nav {
    background: rgba(232, 237, 248, .9);
}

[data-theme="light"] #global-search {
    background: rgba(255, 255, 255, .8);
    color: var(--text-primary);
}
/* ── LIGHT MODE GAP FIXES & NEW OVERRIDES ────────────────────────────── */
/* Fix 1: .ticker-bar hardcoded cyan tint, no prior light override */
[data-theme="light"] .ticker-bar {
    background: rgba(30, 80, 200, 0.02);
}

/* Fix 2: tr:hover td hardcoded cyan tint, no prior light override */
[data-theme="light"] tr:hover td {
    background: rgba(30, 80, 200, 0.04);
}

/* Fix 3: .sb track rgba(255,255,255,.06) invisible on light bg */
[data-theme="light"] .sb {
    background: rgba(0, 0, 0, 0.08);
}

/* Fix 4: #network-container hardcoded dark bg */
[data-theme="light"] #network-container {
    background: rgba(235, 240, 250, 0.95);
}

/* Fix 5: #cmp-modal hardcoded dark backdrop */
[data-theme="light"] #cmp-modal {
    background: rgba(200, 210, 235, 0.85);
}

/* Fix 6: .tag hardcoded cyan tint */
[data-theme="light"] .tag {
    background: rgba(30, 80, 200, 0.07);
    color: var(--text-secondary);
}

/* Fix 7: .gp inner top highlight (white on white invisible) */
[data-theme="light"] .gp {
    box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.05), 0 0 0 transparent;
}

/* Fix 8: .feed-exp cyan tint */
[data-theme="light"] .feed-exp {
    background: rgba(30, 80, 200, 0.025) !important;
}

/* Fix 9: .leaderboard-item cyan tint */
[data-theme="light"] .leaderboard-item {
    background: rgba(30, 80, 200, 0.03);
}

/* New: .gp hover glow in light mode */
[data-theme="light"] .gp:hover {
    box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.05), 0 0 24px rgba(0, 100, 220, 0.08);
    border-color: var(--border-active);
}

/* New: nav active tab in light mode */
[data-theme="light"] nav button.act {
    box-shadow: 0 3px 0 var(--cyan), 0 0 12px var(--cyan-glow);
}

/* New: alternating table row tint in light mode */
[data-theme="light"] tbody tr:nth-child(even) td {
    background: rgba(30, 80, 200, 0.02);
}

/* New: .fb active pill gradient in light mode */
[data-theme="light"] .fb.act {
    background: linear-gradient(135deg, rgba(0, 100, 220, 0.12), rgba(0, 130, 255, 0.08));
}


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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-deep);
    color: var(--text-primary);
    font-family: var(--ff-body);
    min-height: 100vh;
    overflow-x: hidden;
    /* Subtle grid lines for "command center" feel */
    background-image:
        radial-gradient(ellipse at 50% 0%, rgba(0, 200, 255, .05) 0%, transparent 50%),
        linear-gradient(rgba(0, 200, 255, .03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 200, 255, .03) 1px, transparent 1px);
    background-size: 100% 100%, 50px 50px, 50px 50px;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(3, 5, 8, .6) 100%);
}

#app {
    position: relative;
    z-index: 1;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

/* ── HEADER ─────────────────────────────────────────────────── */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(3, 5, 8, .7);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.h-logo {
    font-family: var(--ff-display);
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: .15em;
    color: var(--cyan);
    text-shadow: 0 0 20px var(--cyan-glow);
}

.h-logo em {
    color: var(--text-secondary);
    font-style: normal;
    font-weight: 400;
    font-size: .85rem;
}

.h-center {
    font-family: var(--ff-mono);
    font-size: .65rem;
    color: var(--text-muted);
    letter-spacing: .15em;
}

.h-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-family: var(--ff-mono);
    font-size: .72rem;
    color: var(--text-secondary);
}

#search-wrap {
    position: relative;
}

#global-search {
    background: rgba(0, 200, 255, .06);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 30px 7px 12px;
    color: var(--text-primary);
    font-family: var(--ff-mono);
    font-size: .75rem;
    width: 200px;
    outline: none;
    transition: all .2s;
}

#global-search:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 12px var(--cyan-dim);
}

#search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: .8rem;
    display: none;
}

#search-clear.vis {
    display: block;
}

.pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 2s infinite;
    box-shadow: 0 0 8px var(--green);
}

#theme-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: .8rem;
    transition: all .2s;
}

#theme-btn:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}

.mono {
    font-family: var(--ff-mono);
}

/* ── TICKER ─────────────────────────────────────────────────── */
.ticker-bar {
    overflow: hidden;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 200, 255, .02);
}

.ticker-track {
    display: flex;
    width: max-content;
    animation: ticker 60s linear infinite;
}

.ti {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    padding: 0 24px;
    font-size: .75rem;
    color: var(--text-secondary);
}

.ti-type {
    font-family: var(--ff-mono);
    font-size: .65rem;
    font-weight: 600;
}

.ti-WIN .ti-type {
    color: var(--green);
}

.ti-THREAT .ti-type {
    color: var(--red);
}

.ti-SIGNAL .ti-type {
    color: var(--amber);
}

.ti strong {
    color: var(--text-primary);
}

.ti-sep {
    color: var(--text-muted);
    font-size: .5rem;
}

/* ── STAT BAR ───────────────────────────────────────────────── */
.stat-bar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    padding: 16px 0;
}

.sc {
    padding: 16px 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    transition: all .3s;
    position: relative;
    overflow: hidden;
}

.sc::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--cyan);
    opacity: .7;
    box-shadow: 0 0 8px var(--cyan-glow);
}

.sc-threats::before {
    background: var(--red);
}

.sc-opps::before {
    background: var(--amber);
}

.sc-trends::before {
    background: var(--magenta);
}

.sc:hover {
    border-color: var(--border-active);
    transform: translateY(-2px);
}

.sc-lbl {
    font-family: var(--ff-display);
    font-size: .6rem;
    letter-spacing: .2em;
    color: var(--text-muted);
}

.sc-val {
    font-family: var(--ff-mono);
    font-size: 2.2rem;
    font-weight: 700;
    margin: 4px 0;
    letter-spacing: -.02em;
}

.sc-threats .sc-val {
    color: var(--red);
    text-shadow: 0 0 16px var(--red-dim);
}

.sc-opps .sc-val {
    color: var(--amber);
    text-shadow: 0 0 16px var(--amber-dim);
}

.sc-trends .sc-val {
    color: var(--magenta);
}

.sc-sub {
    font-size: .65rem;
    color: var(--text-muted);
    font-family: var(--ff-mono);
}

/* ── NAV ────────────────────────────────────────────────────── */
nav {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: rgba(3, 5, 8, .5);
    position: sticky;
    top: 62px;
    z-index: 99;
    overflow-x: auto;
    white-space: nowrap;
    box-shadow: inset -40px 0 20px -30px rgba(0, 200, 255, 0.4);
}

nav::-webkit-scrollbar {
    display: none;
}

nav button {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 14px 20px;
    font-family: var(--ff-display);
    font-size: .7rem;
    letter-spacing: .18em;
    transition: all .2s;
}

nav button:hover {
    color: var(--text-secondary);
    background: rgba(0, 200, 255, .03);
}

nav button.act {
    color: var(--cyan);
    border-bottom: 3px solid var(--cyan);
    text-shadow: 0 0 10px var(--cyan-glow);
    box-shadow: 0 3px 0 var(--cyan), 0 0 16px var(--cyan-glow);
}

/* ── TABS ───────────────────────────────────────────────────── */
.tab {
    display: none;
    padding: 20px 0;
    animation: tabIn .4s ease forwards;
    opacity: 0;
    transform: translateY(8px);
}

.tab.act {
    display: block;
}

@keyframes tabIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── GLASS PANELS ───────────────────────────────────────────── */
.gp {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all .3s;
    backdrop-filter: blur(12px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.gp:hover {
    border-color: var(--border-active);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 28px var(--border-glow);
}

/* Section headers */
.sh {
    font-family: var(--ff-display);
    font-size: .8rem;
    letter-spacing: .18em;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sh span {
    font-family: var(--ff-mono);
    font-size: .6rem;
    color: var(--text-muted);
}

/* ── OVERVIEW GRID ──────────────────────────────────────────── */
.ov-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 16px;
}

.col-l,
.col-r {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── TABLE ──────────────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    font-family: var(--ff-display);
    font-size: .6rem;
    letter-spacing: .15em;
    color: var(--text-muted);
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-active);
    cursor: pointer;
    user-select: none;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: .82rem;
    vertical-align: middle;
    transition: background .15s;
}

tbody tr:nth-child(even) td {
    background: rgba(0, 200, 255, 0.015); /* light override in gap-fixes block */
}

tr:hover td {
    background: rgba(0, 200, 255, .05);
}

/* ── BADGES ─────────────────────────────────────────────────── */
.bd {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-family: var(--ff-mono);
    font-size: .65rem;
    font-weight: 600;
    border: 1px solid;
    letter-spacing: .05em;
}

.bd-critical {
    color: var(--red);
    border-color: var(--red);
    background: var(--red-dim);
    animation: critPulse 2s infinite;
}

.bd-elevated,
.bd-high {
    color: var(--amber);
    border-color: var(--amber);
    background: var(--amber-dim);
}

.bd-moderate {
    color: var(--cyan);
    border-color: var(--cyan);
    background: var(--cyan-dim);
}

.bd-low {
    color: var(--text-muted);
    border-color: var(--text-muted);
}

.bd-thr {
    color: var(--red);
    border-color: var(--red);
    background: var(--red-dim);
}

.bd-opp {
    color: var(--amber);
    border-color: var(--amber);
    background: var(--amber-dim);
}

.bd-pos {
    color: var(--green);
    border-color: var(--green);
    background: var(--green-dim);
}

/* ── SCORE BAR ──────────────────────────────────────────────── */
.sb-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sb {
    width: 60px;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, .06);
    overflow: hidden;
}

.sb-f {
    height: 100%;
    border-radius: 3px;
    transition: width .8s cubic-bezier(.22, .68, 0, 1);
}

.s1-4 .sb-f {
    background: var(--text-muted);
}

.s5-6 .sb-f {
    background: var(--amber);
}

.s7-8 .sb-f {
    background: var(--cyan);
}

.s9-10 .sb-f {
    background: var(--green);
    box-shadow: 0 0 8px var(--green-dim);
}

.sb-num {
    font-family: var(--ff-mono);
    font-size: .65rem;
    color: var(--text-secondary);
}

/* ── SPARKLINE ──────────────────────────────────────────────── */
.spark-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.spark-wrap svg polyline {
    stroke: var(--text-muted);
}

.spark-up svg polyline {
    stroke: var(--green);
}

.spark-dn svg polyline {
    stroke: var(--red);
}

.mom-up {
    color: var(--green);
    font-family: var(--ff-mono);
    font-size: .7rem;
}

.mom-dn {
    color: var(--red);
    font-family: var(--ff-mono);
    font-size: .7rem;
}

.mom-st {
    color: var(--text-muted);
    font-family: var(--ff-mono);
    font-size: .7rem;
}

/* ── INTEL CARDS ────────────────────────────────────────────── */
.ic {
    padding: 14px 16px;
    margin-bottom: 10px;
    border-radius: 8px;
    cursor: pointer;
    border-left: 3px solid var(--border);
    transition: all .2s;
}

.ic.pos {
    border-left-color: var(--green);
}

.ic.neg {
    border-left-color: var(--red);
}

.ic.neu {
    border-left-color: var(--amber);
}

.ic:hover,
.related-intel-item:hover {
    background: var(--bg-panel-hover);
}

.ic-meta {
    display: flex;
    justify-content: space-between;
    font-size: .68rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-family: var(--ff-mono);
}

.ic-hl {
    font-weight: 600;
    font-size: .88rem;
    line-height: 1.4;
    margin-bottom: 4px;
}

.ic-sum {
    font-size: .78rem;
    color: var(--text-secondary);
    line-height: 1.5;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s;
}

.ic.open .ic-sum {
    max-height: 300px;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: .6rem;
    font-family: var(--ff-mono);
    background: rgba(0, 200, 255, .08);
    color: var(--text-secondary);
    margin-right: 4px;
}

/* ── FLAG CARDS ──────────────────────────────────────────────── */
.fc {
    cursor: pointer;
    transition: all .2s;
}

.fc.opp {
    border-left: 3px solid var(--amber);
}

.fc.thr {
    border-left: 3px solid var(--red);
}

.fc.acked {
    border-left-color: var(--green);
    background: rgba(0, 255, 136, 0.05);
    /* very subtle green */
    opacity: .8;
}

.fc-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.fc-hl {
    font-weight: 700;
    font-size: .9rem;
    margin-bottom: 4px;
}

.fc-co {
    font-size: .75rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.fc-expand {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s;
}

.fc.open .fc-expand {
    max-height: 500px;
}

.fc-hint {
    font-size: .6rem;
    color: var(--text-muted);
    font-family: var(--ff-mono);
    margin-top: 6px;
}

.fc.open .fc-hint {
    display: none;
}

.action {
    font-size: .78rem;
    color: var(--cyan);
    margin-top: 8px;
    padding: 8px;
    background: var(--cyan-dim);
    border-radius: 6px;
    font-style: italic;
}

.ack-btn {
    margin-top: 10px;
    background: none;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 5px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--ff-mono);
    font-size: .65rem;
    transition: all .2s;
}

.ack-btn:hover {
    border-color: var(--green);
    color: var(--green);
}

/* ── TREND CARD ─────────────────────────────────────────────── */
.tc {
    cursor: pointer;
}

.tc-conf {
    margin-bottom: 8px;
}

.tc-title {
    font-family: var(--ff-display);
    font-size: .85rem;
    letter-spacing: .08em;
    margin-bottom: 4px;
}

.tc-co {
    font-size: .7rem;
    color: var(--text-muted);
    font-family: var(--ff-mono);
}

.tc-expand {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s;
}

.tc.open .tc-expand {
    max-height: 500px;
}

.tc-desc {
    font-size: .8rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 10px 0;
}

.tc-impl {
    font-size: .78rem;
    padding: 10px;
    background: var(--red-dim);
    border-radius: 6px;
    border-left: 3px solid var(--red);
    margin-bottom: 8px;
}

.tc-act {
    font-size: .78rem;
    color: var(--cyan);
    padding: 8px;
    background: var(--cyan-dim);
    border-radius: 6px;
}

.bd-confirmed {
    color: var(--green);
    border-color: var(--green);
    background: var(--green-dim);
}

.bd-emerging {
    color: var(--amber);
    border-color: var(--amber);
    background: var(--amber-dim);
}

.bd-declining {
    color: var(--text-muted);
    border-color: var(--text-muted);
}

/* ── COMPETITOR PROFILE ─────────────────────────────────────── */
.cp {
    margin-bottom: 16px;
}

.cp-hdr {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.cp-name {
    font-family: var(--ff-display);
    font-size: 1.2rem;
    letter-spacing: .1em;
}

.cp-metrics {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}

.cp-m {
    text-align: center;
}

.cp-m .val {
    font-family: var(--ff-mono);
    font-size: 1.4rem;
    font-weight: 700;
}

.cp-m .lbl {
    font-size: .6rem;
    color: var(--text-muted);
    font-family: var(--ff-display);
    letter-spacing: .1em;
    margin-top: 4px;
}

/* ── BATTLECARD ──────────────────────────────────────────────── */
.bc {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
    background: var(--bg-panel);
    position: relative;
    overflow: hidden;
}

.bc::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.bc.bc-critical::before {
    background: linear-gradient(90deg, var(--red), var(--magenta));
}

.bc.bc-elevated::before,
.bc.bc-high::before {
    background: linear-gradient(90deg, var(--amber), var(--red));
}

.bc.bc-moderate::before {
    background: linear-gradient(90deg, var(--cyan), var(--amber));
}

.bc.bc-low::before {
    background: var(--text-muted);
}

.bc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.bc-name {
    font-family: var(--ff-display);
    font-size: 1.3rem;
    letter-spacing: .1em;
}

.bc-section {
    margin-bottom: 14px;
}

.bc-section-title {
    font-family: var(--ff-display);
    font-size: .6rem;
    letter-spacing: .2em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.bc-section p {
    font-size: .82rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ── FLAGS GRID ─────────────────────────────────────────────── */
.flags-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.flags-col h3 {
    font-family: var(--ff-display);
    font-size: 1rem;
    letter-spacing: .12em;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.flags-col.thr-col h3 {
    color: var(--red);
    border-color: var(--red);
}

.flags-col.opp-col h3 {
    color: var(--amber);
    border-color: var(--amber);
}

/* ── TRENDS GRID ────────────────────────────────────────────── */
.trends-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.trends-col h3 {
    font-family: var(--ff-display);
    font-size: .9rem;
    letter-spacing: .12em;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

/* ── MIND MAP ───────────────────────────────────────────────── */
#network-container {
    width: 100%;
    height: 550px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(3, 5, 8, .8);
}

/* ── PERCEPTION ─────────────────────────────────────────────── */
.perc-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.perc-m {
    padding: 16px;
    text-align: center;
}

.perc-m .pval {
    font-family: var(--ff-mono);
    font-size: 2rem;
    font-weight: 600;
}

.perc-m .plbl {
    font-size: .6rem;
    color: var(--text-muted);
    font-family: var(--ff-display);
    letter-spacing: .12em;
    margin-top: 4px;
}

/* ── FILTERS ────────────────────────────────────────────────── */
.filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.fb {
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 5px 14px;
    cursor: pointer;
    font-size: .7rem;
    color: var(--text-muted);
    transition: all .2s;
    font-family: var(--ff-mono);
}

.fb:hover,
.fb.act {
    background: var(--cyan-dim);
    border-color: var(--cyan);
    color: var(--cyan);
}

/* ── EXPORT BTN ─────────────────────────────────────────────── */
.export-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    padding: 4px 12px;
    cursor: pointer;
    font-family: var(--ff-mono);
    font-size: .6rem;
    transition: all .2s;
}

.export-btn:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}

/* ── LOAD MORE ──────────────────────────────────────────────── */
.load-more-wrap {
    text-align: center;
    padding: 16px;
}

.load-more-btn {
    background: var(--cyan-dim);
    border: 1px solid var(--cyan);
    color: var(--cyan);
    padding: 8px 28px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--ff-display);
    font-size: .7rem;
    letter-spacing: .12em;
    transition: all .2s;
}

.load-more-btn:hover {
    background: var(--cyan);
    color: var(--bg-deep);
}

.load-more-btn:disabled {
    opacity: .3;
    cursor: default;
}

/* ── DEEP DIVE BTN ──────────────────────────────────────────── */
.dd-btn {
    background: linear-gradient(135deg, var(--magenta-dim), var(--cyan-dim));
    border: 1px solid var(--magenta);
    color: var(--magenta);
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--ff-mono);
    font-size: .6rem;
    transition: all .2s;
    margin-left: 6px;
}

.dd-btn:hover {
    background: var(--magenta);
    color: #fff;
    box-shadow: 0 0 16px var(--magenta-dim);
}

/* ── COMPARE ────────────────────────────────────────────────── */
#cmp-bar {
    position: fixed;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    border: 1px solid var(--cyan);
    border-radius: 10px;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    font-family: var(--ff-mono);
    font-size: .75rem;
    transition: bottom .3s;
    z-index: 200;
    box-shadow: 0 0 30px var(--cyan-glow);
}

#cmp-bar.vis {
    bottom: 20px;
}

.cmp-run {
    background: var(--cyan);
    color: var(--bg-deep);
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--ff-display);
    font-size: .7rem;
}

.cmp-cancel {
    background: none;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: .7rem;
}

#cmp-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(3, 5, 8, .85);
    z-index: 300;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
}

#cmp-modal.vis {
    display: flex;
}

#cmp-inner {
    background: var(--bg-primary);
    border: 1px solid var(--border-active);
    border-radius: 12px;
    padding: 30px;
    max-width: 900px;
    width: 95%;
    max-height: 80vh;
    overflow-y: auto;
}

#cmp-close {
    float: right;
    background: none;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 4px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--ff-mono);
    font-size: .7rem;
}

.cmp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.cmp-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
}

.cmp-card-name {
    font-family: var(--ff-display);
    font-size: 1rem;
    letter-spacing: .08em;
    margin-bottom: 8px;
}

.cmp-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: .78rem;
    border-bottom: 1px solid var(--border);
}

.cmp-row .lbl {
    color: var(--text-muted);
}

.cmp-row .val {
    font-family: var(--ff-mono);
}

/* ── EMPTY STATE ────────────────────────────────────────────── */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px;
    gap: 12px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 2.5rem;
    opacity: .3;
}

.empty-msg {
    font-family: var(--ff-display);
    font-size: 1rem;
    letter-spacing: .15em;
}

.no-results {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
    font-family: var(--ff-mono);
}

/* ── FEED EXPAND ────────────────────────────────────────────── */
.feed-exp {
    font-size: .8rem;
    color: var(--text-secondary);
    line-height: 1.6;
    padding: 12px 20px !important;
    background: rgba(0, 200, 255, .02) !important;
    border-left: 3px solid var(--cyan);
}

/* ── KEYFRAMES ──────────────────────────────────────────────── */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.5);
        opacity: .3;
    }
}

@keyframes critPulse {

    0%,
    100% {
        box-shadow: 0 0 4px currentColor;
    }

    50% {
        box-shadow: 0 0 14px currentColor;
    }
}

@keyframes ticker {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}

/* ── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

/* ── NEW KEYFRAMES ─────────────────────────────────────────── */
@keyframes glowBreath {
    0%, 100% { text-shadow: 0 0 10px var(--cyan-glow); }
    50% { text-shadow: 0 0 24px var(--cyan-glow), 0 0 48px var(--cyan-dim); }
}

@keyframes accentSlide {
    from { transform: scaleX(0); transform-origin: left; }
    to   { transform: scaleX(1); transform-origin: left; }
}

/* Apply glowBreath to logo */
.h-logo {
    animation: glowBreath 4s ease-in-out infinite;
}

/* Apply slide-in to stat card accent bars */
.sc::before {
    animation: accentSlide 0.8s cubic-bezier(.22,.68,0,1) forwards;
}

/* ── SCROLLBAR UPGRADE ──────────────────────────────────────── */
/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media(max-width:960px) {

    .ov-grid,
    .stat-bar {
        grid-template-columns: 1fr;
    }

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

    .cp-metrics {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media(max-width:768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .h-right {
        width: 100%;
        justify-content: space-between;
    }

    .ov-grid,
    .flags-grid,
    .trends-grid,
    .perc-bar {
        grid-template-columns: 1fr;
    }

    .stat-bar {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .sc-total {
        grid-column: span 2;
    }

    nav {
        overflow-x: auto;
    }

    nav button {
        padding: 12px 14px;
    }
}

/*  FALLBACK WARNING - */
.fallback-warning {
    background: rgba(255, 170, 0, 0.15);
    border-bottom: 1px solid var(--amber);
    color: var(--amber);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: .8rem;
    position: relative;
    z-index: 1000;
    backdrop-filter: blur(8px);
    animation: slideDown 0.4s ease-out;
}

[data-theme="light"] .fallback-warning {
    background: rgba(200, 130, 0, 0.1);
    border-color: rgba(200, 130, 0, 0.3);
    color: #a36a00;
}

.fw-icon {
    font-size: 1.2rem;
    filter: drop-shadow(0 0 8px var(--amber-dim));
}

.fw-content strong {
    font-family: var(--ff-display);
    letter-spacing: .1em;
    font-size: .75rem;
}

.fw-content span {
    font-size: .75rem;
    opacity: 0.8;
}

.fw-close {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.fw-close:hover {
    opacity: 1;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

/* ── STRATEGIC ANALYSIS ─────────────────────────────────────── */
.analysis-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 20px;
}

.exec-summary-item {
    padding: 18px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 14px;
    border-left: 4px solid var(--cyan);
}

.exec-summary-item.thr {
    border-left-color: var(--red);
}

.exec-summary-item.opp {
    border-left-color: var(--amber);
}

.exec-summary-item h4 {
    font-family: var(--ff-display);
    font-size: .85rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.exec-summary-item p {
    font-size: .8rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.report-hist-item {
    padding: 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background .2s;
}

.report-hist-item:hover {
    background: var(--bg-panel-hover);
}

.report-hist-item .rh-date {
    font-family: var(--ff-mono);
    font-size: .6rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.report-hist-item .rh-hl {
    font-size: .82rem;
    font-weight: 600;
    line-height: 1.4;
}

.report-hist-item .rh-type {
    display: inline-block;
    font-size: .6rem;
    font-family: var(--ff-mono);
    color: var(--cyan);
    margin-top: 4px;
}

/* Region Filter Polish */
#region-filter {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    padding: 4px 8px;
    font-family: var(--ff-mono);
    font-size: .7rem;
    cursor: pointer;
    outline: none;
    transition: all .2s;
}

#region-filter:hover {
    border-color: var(--cyan);
}/*  MOMENTUM TAB  */
.momentum-grid {
    display: flex;
    gap: 20px;
}
#momentum-leaderboard {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 200, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: transform 0.2s;
}
.leaderboard-item:hover {
    transform: translateX(5px);
    border-color: var(--cyan);
}
.leaderboard-rank {
    font-family: var(--ff-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    width: 24px;
}
.leaderboard-name {
    font-weight: 600;
    flex: 1;
}
.leaderboard-score {
    font-family: var(--ff-mono);
    font-weight: 700;
    font-size: 1.1rem;
}
.score-pos { color: var(--green); }
.score-neg { color: var(--red); }
.score-zero { color: var(--text-muted); }
