/* ── Design tokens ──────────────────────────────────────────────────────────── */
:root {
  /* Backgrounds — 4 depth levels */
  --bg:          #05080f;
  --bg-sidebar:  #070a15;
  --bg-card:     #0b1121;
  --bg-raised:   #101826;
  --bg-hover:    #151f30;
  --bg-input:    #0d1525;

  /* Borders */
  --border:      rgba(255,255,255,0.055);
  --border-md:   rgba(255,255,255,0.10);
  --border-hi:   rgba(255,255,255,0.18);

  /* Text */
  --text:        #deeaf8;
  --text-muted:  #4c6075;
  --text-dim:    #273545;

  /* Brand blue */
  --blue:        #4b83f0;
  --blue-soft:   rgba(75,131,240,0.12);
  --blue-glow:   rgba(75,131,240,0.30);

  /* Severity */
  --high:        #ef4444;
  --high-soft:   rgba(239,68,68,0.10);
  --high-glow:   rgba(239,68,68,0.25);
  --medium:      #f59e0b;
  --medium-soft: rgba(245,158,11,0.10);
  --low:         #10b981;
  --low-soft:    rgba(16,185,129,0.10);
  --low-glow:    rgba(16,185,129,0.18);

  /* Layout */
  --ticker-h:   38px;
  --sidebar-w:  278px;
  --header-h:   54px;

  /* Radii */
  --r-lg:  12px;
  --r-md:   8px;
  --r-sm:   5px;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Easing */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Toast ──────────────────────────────────────────────────────────────────── */
.toast-wrap {
  position: fixed; top: 14px; right: 14px;
  z-index: 1000; display: flex; flex-direction: column; gap: 6px;
  pointer-events: none; max-width: 310px;
}
.toast {
  padding: 10px 16px; border-radius: var(--r-md);
  font-size: 0.8rem; font-weight: 500;
  backdrop-filter: blur(20px); border: 1px solid var(--border-md);
  pointer-events: all; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.45);
  animation: toast-in 0.22s var(--ease) both;
}
.toast.success { background: rgba(16,185,129,0.13); color: var(--low);    border-color: rgba(16,185,129,0.24); }
.toast.info    { background: rgba(75,131,240,0.13);  color: var(--blue);   border-color: rgba(75,131,240,0.24); }
.toast.error   { background: rgba(239,68,68,0.13);   color: var(--high);   border-color: rgba(239,68,68,0.24); }
.toast.out     { animation: toast-out 0.22s var(--ease) both; }
@keyframes toast-in  { from { opacity:0; transform:translateY(-6px) scale(.97); } to { opacity:1; transform:none; } }
@keyframes toast-out { to   { opacity:0; transform:translateY(-6px) scale(.97); } }

/* ── Ticker ─────────────────────────────────────────────────────────────────── */
.ticker-bar {
  display: none; position: fixed; top: 0; left: 0; right: 0;
  height: var(--ticker-h);
  background: rgba(239,68,68,0.065);
  border-bottom: 1px solid rgba(239,68,68,0.18);
  z-index: 200; align-items: center; overflow: hidden;
  backdrop-filter: blur(20px);
}
body.has-ticker .ticker-bar { display: flex; }
body.has-ticker .shell      { padding-top: var(--ticker-h); }

.ticker-live {
  display: flex; align-items: center; gap: 6px; padding: 0 14px;
  font-size: 0.61rem; font-weight: 800; letter-spacing: 0.13em;
  color: var(--high); white-space: nowrap; border-right: 1px solid rgba(239,68,68,0.18);
  height: 100%; flex-shrink: 0;
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--high); animation: blink 1.6s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1} 45%,55%{opacity:0.1} }

.ticker-wrap { flex: 1; overflow: hidden; height: 100%; display: flex; align-items: center; }
.ticker-scroll { display: flex; white-space: nowrap; animation: ticker-run 65s linear infinite; }
.ticker-scroll:hover { animation-play-state: paused; }
@keyframes ticker-run { from{transform:translateX(0)} to{transform:translateX(-50%)} }

.ticker-item {
  display: inline-flex; align-items: center; gap: 10px; padding: 0 28px;
  border-right: 1px solid rgba(255,255,255,0.04);
  font-size: 0.79rem; color: var(--text);
}
.ticker-sev {
  font-size: 0.59rem; font-weight: 800; padding: 2px 7px;
  border-radius: 3px; letter-spacing: 0.07em; text-transform: uppercase;
}
.ticker-sev.high   { background: var(--high-soft);   color: var(--high); }
.ticker-sev.medium { background: var(--medium-soft); color: var(--medium); }

.ticker-close {
  padding: 0 14px; font-size: 0.75rem; color: var(--text-muted);
  cursor: pointer; flex-shrink: 0; border: none; background: none;
  border-left: 1px solid rgba(255,255,255,0.06);
  height: 100%; display: flex; align-items: center; transition: color 0.15s;
}
.ticker-close:hover { color: var(--text); }

/* ── Shell ──────────────────────────────────────────────────────────────────── */
.shell { display: flex; height: 100vh; overflow: hidden; transition: padding-top 0.3s; }

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: var(--bg-raised) transparent;
}

/* Brand */
.sb-brand {
  display: flex; align-items: center; gap: 10px; padding: 15px 16px 14px;
  border-bottom: 1px solid var(--border); position: relative; flex-shrink: 0;
}
.sb-brand::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, rgba(75,131,240,0.5) 0%, transparent 55%);
}
.sb-brand-icon {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 7px;
  background: var(--blue-soft); border: 1px solid rgba(75,131,240,0.22);
  display: flex; align-items: center; justify-content: center; color: var(--blue);
}
.sb-brand-icon svg { width: 16px; height: 16px; }
.sb-brand-text { flex: 1; min-width: 0; }
.sb-brand-name { font-size: 0.86rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.sb-brand-sub  { font-size: 0.62rem; color: var(--text-dim); margin-top: 1px; }
.sb-brand-tag  {
  font-size: 0.52rem; font-weight: 800; letter-spacing: 0.1em; flex-shrink: 0;
  color: var(--blue); background: var(--blue-soft);
  border: 1px solid rgba(75,131,240,0.2); padding: 2px 7px; border-radius: 10px;
}

/* Status block — horizontal layout */
.sb-status-block {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 16px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.sb-status-ring {
  position: relative; width: 68px; height: 68px; flex-shrink: 0;
  border-radius: 50%; border: 2px solid var(--border-md);
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.5s, box-shadow 0.5s;
}
.sb-status-ring.critical { border-color: var(--high);   box-shadow: 0 0 0 4px rgba(239,68,68,0.07), 0 0 22px rgba(239,68,68,0.2); }
.sb-status-ring.monitor  { border-color: var(--medium); box-shadow: 0 0 18px rgba(245,158,11,0.18); }
.sb-status-ring.clean    { border-color: var(--low);    box-shadow: 0 0 18px rgba(16,185,129,0.14); }

.sb-pulse {
  position: absolute; inset: -8px;
  border-radius: 50%; border: 2px solid transparent; pointer-events: none;
}
.sb-status-ring.critical .sb-pulse {
  border-color: rgba(239,68,68,0.2);
  animation: pulse-ring 2.5s ease-in-out infinite;
}
@keyframes pulse-ring {
  0%,100% { transform: scale(1);    opacity: 0.8; }
  50%      { transform: scale(1.15); opacity: 0; }
}
.sb-status-inner { text-align: center; }
.sb-status-label {
  font-size: 0.69rem; font-weight: 800; letter-spacing: 0.09em;
  text-transform: uppercase; line-height: 1;
}
.sb-status-ring.critical .sb-status-label { color: var(--high); }
.sb-status-ring.monitor  .sb-status-label { color: var(--medium); }
.sb-status-ring.clean    .sb-status-label { color: var(--low); }
.sb-status-sub { font-size: 0.57rem; color: var(--text-dim); margin-top: 2px; letter-spacing: 0.08em; text-transform: uppercase; }

.sb-status-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.sb-status-why  { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; }
.sb-status-time { font-size: 0.64rem; color: var(--text-dim); }

/* Sections */
.sb-section      { padding: 13px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sb-section-grow { flex: 1; overflow-y: auto; }

.sb-section-title {
  font-size: 0.59rem; font-weight: 800; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: 10px;
}
.sb-placeholder { font-size: 0.76rem; color: var(--text-dim); }

/* Threat distribution */
.threat-track {
  height: 6px; display: flex; border-radius: 4px; overflow: hidden;
  background: var(--bg-raised); margin-bottom: 9px;
}
.threat-seg { height: 100%; transition: width 0.65s var(--ease); }
.seg-high   { background: var(--high); }
.seg-medium { background: var(--medium); }
.seg-low    { background: var(--low); }

.threat-legend { display: flex; gap: 12px; font-size: 0.71rem; color: var(--text-muted); }
.threat-legend b { color: var(--text); font-weight: 700; margin-left: 2px; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.dot-high   { background: var(--high); }
.dot-medium { background: var(--medium); }
.dot-low    { background: var(--low); }

/* Domain list */
.sb-domains { display: flex; flex-direction: column; gap: 2px; }
.domain-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px;
  cursor: pointer; transition: background 0.13s; position: relative;
}
.domain-row:hover  { background: var(--bg-hover); }
.domain-row.active { background: var(--blue-soft); }
.domain-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.domain-dot.high   { background: var(--high); box-shadow: 0 0 5px var(--high-glow); }
.domain-dot.medium { background: var(--medium); }
.domain-dot.low    { background: var(--low); }
.domain-name {
  font-size: 0.78rem; color: var(--text); flex: 1; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.domain-count {
  font-size: 0.63rem; font-weight: 700; color: var(--text-muted);
  background: var(--bg-raised); padding: 1px 6px; border-radius: 8px; min-width: 20px; text-align: center;
}
.domain-row.active .domain-name  { color: var(--blue); }
.domain-row.active .domain-count { color: var(--blue); background: rgba(75,131,240,0.15); }
.domain-bar {
  position: absolute; bottom: 0; left: 8px; right: 8px; height: 1.5px;
  border-radius: 2px; background: var(--blue);
  opacity: 0.2; transition: width 0.5s var(--ease);
}
.domain-row.active .domain-bar { opacity: 0.5; }

/* Severity filters */
.sb-sev-filters { display: flex; flex-direction: column; gap: 3px; }
.sev-btn {
  font-family: var(--font); font-size: 0.78rem; font-weight: 500;
  padding: 7px 10px; border-radius: var(--r-md);
  border: 1px solid transparent; background: transparent; color: var(--text-muted);
  cursor: pointer; text-align: left; transition: all 0.13s;
  display: flex; align-items: center; gap: 0;
}
.sev-btn-label { flex: 1; }
.sev-btn:hover { background: var(--bg-hover); color: var(--text); }
.sev-btn.active           { background: var(--blue-soft);   border-color: rgba(75,131,240,0.2);  color: var(--blue);   }
.sev-btn.sev-high.active  { background: var(--high-soft);   border-color: rgba(239,68,68,0.2);   color: var(--high);   }
.sev-btn.sev-medium.active{ background: var(--medium-soft); border-color: rgba(245,158,11,0.2);  color: var(--medium); }
.sev-btn.sev-low.active   { background: var(--low-soft);    border-color: rgba(16,185,129,0.2);  color: var(--low);    }
.sev-btn-count {
  font-size: 0.63rem; font-weight: 700; font-family: var(--mono);
  background: var(--bg-raised); padding: 1px 6px;
  border-radius: 8px; color: var(--text-dim); min-width: 20px; text-align: center;
}
.sev-btn.active .sev-btn-count { color: inherit; opacity: 0.75; background: rgba(255,255,255,0.07); }

.sb-spacer { flex: 1; min-height: 12px; }

/* Countdown */
.sb-countdown {
  padding: 11px 16px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px; flex-shrink: 0;
}
.countdown-row { display: flex; align-items: baseline; justify-content: space-between; }
.countdown-label { font-size: 0.59rem; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; color: var(--text-dim); }
.countdown-timer { font-family: var(--mono); font-size: 0.92rem; font-weight: 500; color: var(--text-muted); }
.countdown-bar-wrap { height: 2px; background: var(--bg-raised); border-radius: 2px; overflow: hidden; }
.countdown-bar {
  height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--blue), rgba(75,131,240,0.35));
  transition: width 1s linear; width: 100%;
}

/* Footer links */
.sb-footer {
  padding: 11px 16px; border-top: 1px solid var(--border);
  display: flex; gap: 4px; flex-shrink: 0;
}
.sb-footer-link {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  flex: 1; padding: 7px 8px; border-radius: var(--r-md);
  font-size: 0.75rem; color: var(--text-muted);
  text-decoration: none; transition: all 0.13s;
}
.sb-footer-link svg { width: 13px; height: 13px; }
.sb-footer-link:hover { color: var(--text); background: var(--bg-hover); }

/* ── Main panel ─────────────────────────────────────────────────────────────── */
.main {
  flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
  /* Subtle ambient gradient */
  background:
    radial-gradient(ellipse 80% 50% at 60% -10%, rgba(75,131,240,0.045) 0%, transparent 60%),
    var(--bg);
}

/* Header */
.main-header {
  display: flex; align-items: center; gap: 18px;
  padding: 0 28px; height: var(--header-h);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}

/* Stats strip */
.stats-strip { display: flex; align-items: center; gap: 20px; }
.stat-sep { width: 1px; height: 26px; background: var(--border-md); }
.stat-card { display: flex; flex-direction: column; gap: 1px; }
.stat-num {
  font-size: 1.55rem; font-weight: 900; letter-spacing: -0.055em;
  line-height: 1; transition: color 0.3s; font-family: var(--font);
}
.stat-lbl {
  font-size: 0.58rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-dim);
}
.stat-card--high .stat-num   { color: var(--high); }
.stat-card--medium .stat-num { color: var(--medium); }
.stat-card--low .stat-num    { color: var(--low); }

/* KSA Clock */
.header-center { flex: 1; display: flex; justify-content: center; }
.ksa-clock {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 15px; background: var(--bg-raised);
  border: 1px solid var(--border); border-radius: var(--r-md);
}
.clock-flag { font-size: 0.85rem; line-height: 1; }
.clock-sep  { width: 1px; height: 14px; background: var(--border-md); }
.clock-label{ font-size: 0.57rem; font-weight: 800; letter-spacing: 0.14em; color: var(--text-dim); text-transform: uppercase; }
.clock-time { font-size: 0.9rem; font-weight: 500; color: var(--text-muted); }
.mono { font-family: var(--mono); }

/* Header right */
.header-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.live-badge {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px;
  background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.2);
  font-size: 0.59rem; font-weight: 800; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--low);
}
.live-badge-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--low); animation: blink 2s ease-in-out infinite;
}

.last-updated { font-size: 0.69rem; color: var(--text-dim); white-space: nowrap; }

.btn-refresh {
  font-family: var(--font);
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; font-size: 0.77rem; font-weight: 500;
  color: var(--text-muted); background: var(--bg-raised);
  border: 1px solid var(--border); border-radius: var(--r-md);
  cursor: pointer; transition: all 0.13s; white-space: nowrap;
}
.btn-refresh svg { width: 12px; height: 12px; flex-shrink: 0; }
.btn-refresh:hover { background: var(--bg-hover); border-color: var(--border-md); color: var(--text); }
.btn-refresh.loading svg { animation: spin 0.65s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Threat spectrum bar */
.threat-bar-top { height: 3px; display: flex; flex-shrink: 0; background: var(--bg-raised); }
.tbt-high   { background: var(--high);   height: 100%; transition: width 0.65s var(--ease); }
.tbt-medium { background: var(--medium); height: 100%; transition: width 0.65s var(--ease); }
.tbt-low    { background: var(--low);    height: 100%; transition: width 0.65s var(--ease); }

/* Toolbar */
.toolbar {
  display: flex; align-items: stretch; gap: 0; padding: 0 28px;
  border-bottom: 1px solid var(--border); flex-shrink: 0; flex-wrap: wrap;
  min-height: 46px;
}
.tabs { display: flex; }
.tab {
  font-family: var(--font); font-size: 0.8rem; font-weight: 500;
  padding: 0 16px; border: none; background: transparent; color: var(--text-muted);
  cursor: pointer; border-bottom: 2px solid transparent;
  transition: color 0.13s, border-color 0.13s;
  white-space: nowrap; display: flex; align-items: center;
}
.tab:hover   { color: var(--text); }
.tab--active { color: var(--blue) !important; border-bottom-color: var(--blue) !important; }

.toolbar-right { display: flex; gap: 8px; margin-left: auto; align-items: center; }

.result-count {
  font-size: 0.71rem; color: var(--text-dim); white-space: nowrap;
  font-weight: 600; font-family: var(--mono);
}

.search-box {
  display: flex; align-items: center; gap: 7px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 0 11px; height: 32px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(75,131,240,0.1); }
.search-box svg { width: 13px; height: 13px; color: var(--text-muted); flex-shrink: 0; }
.search-box input {
  font-family: var(--font); font-size: 0.79rem;
  border: none; background: transparent; color: var(--text);
  width: 200px; outline: none;
}
.search-box input::placeholder { color: var(--text-dim); }
.search-clear {
  font-family: var(--font); font-size: 0.72rem; background: none; border: none;
  color: var(--text-muted); cursor: pointer; padding: 0 3px; border-radius: 3px;
  transition: color 0.13s; flex-shrink: 0; display: flex; align-items: center;
}
.search-clear:hover { color: var(--text); }

#filterDomain {
  font-family: var(--font); font-size: 0.79rem; padding: 0 10px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--r-md); color: var(--text);
  cursor: pointer; outline: none; transition: border-color 0.13s;
  height: 32px; appearance: auto;
}
#filterDomain:hover { border-color: var(--border-md); }
#filterDomain:focus { border-color: var(--blue); }

/* ── Feed ───────────────────────────────────────────────────────────────────── */
.feed {
  flex: 1; overflow-y: auto; padding: 18px 28px 48px;
  scrollbar-width: thin; scrollbar-color: var(--bg-raised) transparent;
}

/* 2-column card grid on wide screens */
.findings {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
  gap: 10px;
  align-items: start;
}

/* Empty state */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 72px 20px; color: var(--text-muted);
  font-size: 0.84rem; text-align: center;
  grid-column: 1 / -1; /* span all columns */
}
.empty-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--bg-raised); border: 1px solid var(--border-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
}
.empty-icon svg { width: 26px; height: 26px; }
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border-md); border-top-color: var(--blue);
  border-radius: 50%; animation: spin 0.65s linear infinite;
}
.btn-scan-now {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 20px; margin-top: 4px;
  background: var(--blue); color: #fff;
  border: none; border-radius: var(--r-md);
  font-family: var(--font); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: opacity 0.15s, transform 0.15s;
}
.btn-scan-now svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-scan-now:hover:not(:disabled) { opacity: 0.85; transform: translateY(-1px); }
.btn-scan-now:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; cursor: pointer;
  opacity: 0; transform: translateY(8px);
}
.card.in-view {
  opacity: 1; transform: none;
  transition: opacity 0.32s var(--ease), transform 0.32s var(--ease),
              border-color 0.18s, box-shadow 0.18s;
}
.card.in-view:hover {
  transform: translateY(-2px);
  border-color: var(--border-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.card.sev-high.in-view:hover   { border-color: rgba(239,68,68,0.3);  box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 0 0 1px rgba(239,68,68,0.08); }
.card.sev-medium.in-view:hover { border-color: rgba(245,158,11,0.28); box-shadow: 0 8px 28px rgba(0,0,0,0.35); }
.card.src-grok.in-view:hover   { border-color: rgba(75,131,240,0.28); box-shadow: 0 8px 28px rgba(0,0,0,0.35); }
.card.expanded { border-color: var(--border-hi) !important; box-shadow: 0 12px 48px rgba(0,0,0,0.5) !important; }

/* Severity tinted backgrounds */
.card.sev-high   { background: linear-gradient(150deg, rgba(239,68,68,0.05) 0%, var(--bg-card) 50%); }
.card.sev-medium { background: linear-gradient(150deg, rgba(245,158,11,0.03) 0%, var(--bg-card) 50%); }

/* Top severity stripe */
.card-accent { height: 2px; }
.card.sev-high   .card-accent { background: linear-gradient(90deg, var(--high), rgba(239,68,68,0.3)); }
.card.sev-medium .card-accent { background: linear-gradient(90deg, var(--medium), rgba(245,158,11,0.3)); }
.card.sev-low    .card-accent { background: linear-gradient(90deg, var(--low), rgba(16,185,129,0.3)); }
.card.src-grok   .card-accent { background: linear-gradient(90deg, var(--blue), rgba(75,131,240,0.3)); }

/* Inner layout */
.card-inner {
  display: flex; gap: 0; align-items: flex-start;
  padding: 14px 16px 14px 16px; position: relative;
}

/* Logo column — logo + company name stacked */
.card-logo-col {
  width: 72px; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding-right: 14px;
}
.card-logo {
  width: 52px; height: 52px; flex-shrink: 0;
  border-radius: 12px; overflow: hidden;
  background: var(--bg-raised); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.card.in-view:hover .card-logo { border-color: var(--border-md); }
.card.sev-high.in-view:hover .card-logo  { border-color: rgba(239,68,68,0.22); box-shadow: 0 0 0 3px rgba(239,68,68,0.06); }
.card.sev-medium.in-view:hover .card-logo{ border-color: rgba(245,158,11,0.22); }
.card-logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; transition: opacity 0.3s; }
.card-logo img.loading { opacity: 0; }
.card-logo-initials {
  font-size: 0.78rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase;
}
.card-logo-name {
  font-size: 0.6rem; font-weight: 600; color: var(--text-dim);
  text-align: center; width: 100%; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  letter-spacing: 0.02em; line-height: 1;
}

/* Card body */
.card-body { flex: 1; min-width: 0; }
.card-top  { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 5px; }

/* Badges */
.badge {
  font-size: 0.59rem; font-weight: 700; padding: 2px 7px;
  border-radius: var(--r-sm); text-transform: uppercase; letter-spacing: 0.06em; flex-shrink: 0;
}
.badge-high   { background: var(--high-soft);   color: var(--high);   border: 1px solid rgba(239,68,68,0.22); }
.badge-medium { background: var(--medium-soft); color: var(--medium); border: 1px solid rgba(245,158,11,0.22); }
.badge-low    { background: var(--low-soft);    color: var(--low);    border: 1px solid rgba(16,185,129,0.22); }
.badge-ai     { background: var(--blue-soft);   color: var(--blue);   border: 1px solid rgba(75,131,240,0.22); }
.badge-domain { background: transparent; color: var(--text-muted); border: 1px solid var(--border-md); font-weight: 500; text-transform: none; letter-spacing: 0; cursor: pointer; transition: color .15s, border-color .15s, background .15s; }
.badge-domain:hover { color: var(--blue); border-color: var(--blue); background: var(--blue-soft); }

/* Active domain filter chip */
.active-filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px 3px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: .03em;
  background: var(--blue-soft); color: var(--blue); border: 1px solid rgba(75,131,240,0.30);
}
.filter-chip-label { opacity: .65; margin-right: 1px; }
.filter-chip-clear {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  background: rgba(75,131,240,0.18); cursor: pointer; font-size: 11px; line-height: 1;
}
.filter-chip-clear:hover { background: rgba(75,131,240,0.35); }

.card-time {
  font-size: 0.65rem; color: var(--text-dim); margin-left: auto;
  white-space: nowrap; font-family: var(--mono);
}
.card-expand-arrow {
  font-size: 0.8rem; color: var(--text-dim); flex-shrink: 0; margin-left: 3px;
  transition: transform 0.3s var(--ease), color 0.15s;
  user-select: none; line-height: 1;
}
.card.expanded .card-expand-arrow { transform: rotate(180deg); color: var(--text-muted); }

.card-title {
  font-size: 0.895rem; font-weight: 600; line-height: 1.43; margin-bottom: 5px; color: var(--text);
}
.card-title a { color: inherit; text-decoration: none; }
.card-title a:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }

mark { background: rgba(245,158,11,0.2); color: var(--medium); border-radius: 2px; padding: 0 2px; }

.card-summary { font-size: 0.79rem; color: var(--text-muted); line-height: 1.57; margin-bottom: 9px; }

.card-footer {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px;
}
.card-source { font-size: 0.67rem; color: var(--text-dim); display: flex; align-items: center; gap: 5px; }
.card-source a { color: inherit; text-decoration: none; }
.card-source a:hover { color: var(--blue); }

/* Expand panel */
.card-expand {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 0.36s var(--ease);
  border-top: 0px solid var(--border);
}
.card.expanded .card-expand { grid-template-rows: 1fr; border-top: 1px solid var(--border); }
.card-expand-inner { overflow: hidden; }
.card-expand-body {
  /* align with body text: 16px card-inner pad + 72px logo-col = 88px */
  padding: 12px 16px 14px 88px;
  background: rgba(0,0,0,0.2);
}

/* Stat number pop animation */
@keyframes numPop { from { opacity:0.3; transform:translateY(3px); } to { opacity:1; transform:none; } }
.stat-anim { animation: numPop 0.28s var(--ease) both; }

/* Expand content */
.expand-section { margin-bottom: 13px; }
.expand-section:last-child { margin-bottom: 0; }
.expand-label {
  font-size: 0.58rem; font-weight: 800; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: 7px;
}
.action-list { display: flex; flex-direction: column; gap: 5px; }
.action-item {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 0.78rem; color: var(--text-muted); line-height: 1.45;
}
.action-arrow { color: var(--blue); font-weight: 700; flex-shrink: 0; margin-top: 1px; font-size: 0.73rem; }
.related-list { display: flex; flex-direction: column; gap: 3px; }
.related-item {
  font-size: 0.74rem; color: var(--text-dim);
  padding: 3px 0; border-bottom: 1px solid var(--border);
}
.related-item:last-child { border-bottom: none; }

/* ── Grok analysis report ───────────────────────────────────────────────────── */
.grok-report-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-left: 3px solid var(--blue); border-radius: var(--r-lg);
  padding: 16px 20px; margin-bottom: 10px;
}
.grok-report-header {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.84rem; font-weight: 600; margin-bottom: 12px;
}
.ai-badge {
  font-size: 0.56rem; font-weight: 800; padding: 2px 7px;
  background: var(--blue-soft); color: var(--blue);
  border: 1px solid rgba(75,131,240,0.22); border-radius: var(--r-sm); letter-spacing: 0.08em;
}
.grok-report-body {
  font-size: 0.78rem; color: var(--text-muted); line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
}

/* ── Keyboard hint ──────────────────────────────────────────────────────────── */
.kb-hint {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  padding: 5px 14px; font-size: 0.71rem; color: var(--text-muted);
  background: var(--bg-raised); border: 1px solid var(--border-md);
  border-radius: 20px; pointer-events: none; white-space: nowrap;
  opacity: 0; transition: opacity 0.2s; z-index: 50;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}
.kb-hint.show { opacity: 1; }
kbd {
  font-family: var(--mono); font-size: 0.68rem; padding: 1px 6px;
  background: var(--bg-hover); border: 1px solid var(--border-hi); border-radius: 4px; color: var(--text);
}

/* ── Mobile ─────────────────────────────────────────────────────────────────── */
.sidebar-overlay, .mobile-menu-btn { display: none; }

@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: calc(-1 * var(--sidebar-w));
    top: 0; bottom: 0; z-index: 100;
    transition: left 0.25s var(--ease);
  }
  .sidebar.open { left: 0; box-shadow: 8px 0 52px rgba(0,0,0,0.75); }
  body.has-ticker .sidebar { top: var(--ticker-h); }

  .sidebar-overlay {
    display: block; position: fixed; inset: 0;
    background: rgba(0,0,0,0.72); z-index: 90;
    opacity: 0; pointer-events: none; transition: opacity 0.25s;
  }
  .sidebar-overlay.open { opacity: 1; pointer-events: all; }

  .mobile-menu-btn {
    display: flex; align-items: center; justify-content: center;
    position: fixed; bottom: 18px; right: 16px;
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--blue); border: none; color: #fff;
    cursor: pointer; z-index: 80; box-shadow: 0 4px 20px var(--blue-glow);
    transition: transform 0.15s var(--ease);
  }
  .mobile-menu-btn:active { transform: scale(0.92); }
  .mobile-menu-btn svg { width: 17px; height: 17px; }

  .main-header { padding: 0 16px; height: auto; min-height: var(--header-h); flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; gap: 10px; }
  .toolbar  { padding: 0 16px; }
  .feed     { padding: 14px 16px 72px; }
  .stats-strip  { gap: 14px; }
  .header-center{ display: none; }
  .live-badge   { display: none; }
  .search-box input { width: 130px; }
  .card-expand-body { padding: 12px 16px; }
}
@media (max-width: 540px) {
  .stat-lbl { display: none; }
  .toolbar-right { width: 100%; padding-bottom: 8px; }
  .search-box input { width: 100px; }
  .last-updated { display: none; }
}

/* ── Light mode ─────────────────────────────────────────────────────────────── */
body.light-mode {
  --bg:          #f0f4f8;
  --bg-sidebar:  #e8edf4;
  --bg-card:     #ffffff;
  --bg-raised:   #f5f8fc;
  --bg-hover:    #eaf0f8;
  --bg-input:    #f5f8fc;
  --border:      rgba(0,0,0,0.07);
  --border-md:   rgba(0,0,0,0.12);
  --border-hi:   rgba(0,0,0,0.20);
  --text:        #0f1c2e;
  --text-muted:  #5c7a96;
  --text-dim:    #94aec4;
  --blue-soft:   rgba(75,131,240,0.10);
  --high-soft:   rgba(239,68,68,0.08);
  --low-soft:    rgba(16,185,129,0.08);
}
body.light-mode .main {
  background: radial-gradient(ellipse 80% 50% at 60% -10%, rgba(75,131,240,0.07) 0%, transparent 60%), var(--bg);
}
body.light-mode .card { box-shadow: 0 1px 6px rgba(0,0,0,0.06); }
body.light-mode .sidebar { border-right-color: var(--border); }

/* ── RTL / Arabic mode ──────────────────────────────────────────────────────── */
body.rtl { direction: rtl; }
body.rtl .sb-brand           { flex-direction: row-reverse; }
body.rtl .sb-brand-tag       { margin-right: auto; margin-left: 0; }
body.rtl .sb-status-block    { flex-direction: row-reverse; }
body.rtl .card-inner         { flex-direction: row-reverse; }
body.rtl .card-logo-col      { padding-right: 0; padding-left: 14px; }
body.rtl .card-top           { flex-direction: row-reverse; }
body.rtl .card-expand-arrow  { transform: scaleX(-1); }
body.rtl .header-right       { flex-direction: row-reverse; }
body.rtl .toolbar-right      { flex-direction: row-reverse; }
body.rtl .stats-strip        { flex-direction: row-reverse; }
body.rtl .domain-row         { flex-direction: row-reverse; }
body.rtl .threat-legend      { flex-direction: row-reverse; }
body.rtl .sb-footer          { flex-direction: row-reverse; }
body.rtl .action-item        { flex-direction: row-reverse; }

/* ── Header control buttons (theme, lang, export) ───────────────────────────── */
.hdr-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--bg-raised); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  transition: all 0.15s; flex-shrink: 0;
}
.hdr-btn svg { width: 13px; height: 13px; }
.hdr-btn:hover { background: var(--bg-hover); border-color: var(--border-md); color: var(--text); }
.hdr-btn.active { background: var(--blue-soft); border-color: rgba(75,131,240,0.3); color: var(--blue); }

/* ── Command Palette ────────────────────────────────────────────────────────── */
.cp-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(5,8,15,0.75);
  backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 15vh;
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s;
}
.cp-overlay.open { opacity: 1; pointer-events: auto; }
.cp-modal {
  width: 100%; max-width: 580px; margin: 0 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  border-radius: 14px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6);
  overflow: hidden;
  transform: translateY(-12px) scale(0.98);
  transition: transform 0.2s var(--ease);
}
.cp-overlay.open .cp-modal { transform: none; }
.cp-search {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.cp-search svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.cp-search input {
  flex: 1; background: none; border: none; outline: none;
  font-family: var(--font); font-size: 0.95rem; color: var(--text);
}
.cp-search input::placeholder { color: var(--text-muted); }
.cp-kbd {
  font-family: var(--mono); font-size: 0.62rem; color: var(--text-muted);
  background: var(--bg-raised); border: 1px solid var(--border-md);
  border-radius: 4px; padding: 2px 6px; flex-shrink: 0;
}
.cp-results { max-height: 360px; overflow-y: auto; padding: 6px; }
.cp-section-label {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted); padding: 6px 10px 4px;
}
.cp-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  transition: background 0.1s;
}
.cp-item:hover, .cp-item.selected { background: var(--bg-raised); }
.cp-item-icon {
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem; font-weight: 800;
}
.cp-item-icon.high   { background: var(--high-soft); color: var(--high); }
.cp-item-icon.medium { background: rgba(245,158,11,0.10); color: var(--medium); }
.cp-item-icon.low    { background: var(--low-soft); color: var(--low); }
.cp-item-icon.grok   { background: var(--blue-soft); color: var(--blue); }
.cp-item-body { flex: 1; min-width: 0; }
.cp-item-title { font-size: 0.8rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-item-sub   { font-size: 0.68rem; color: var(--text-muted); margin-top: 1px; }
.cp-item-enter { font-size: 0.62rem; color: var(--text-muted); flex-shrink: 0; }
.cp-empty { padding: 32px 16px; text-align: center; color: var(--text-muted); font-size: 0.84rem; }
.cp-footer {
  padding: 8px 14px; border-top: 1px solid var(--border);
  display: flex; gap: 16px;
  font-size: 0.64rem; color: var(--text-muted);
}
.cp-footer kbd {
  font-family: var(--mono); background: var(--bg-raised); border: 1px solid var(--border-md);
  border-radius: 3px; padding: 1px 5px; margin-right: 4px;
}

/* ── Print / Export ─────────────────────────────────────────────────────────── */
@media print {
  .sidebar, .ticker-bar, .toolbar, .main-header .header-right,
  .btn-refresh, .mobile-menu-btn, .kb-hint, .sidebar-overlay,
  .toast-wrap, .threat-bar-top, .card-expand, .hdr-btn { display: none !important; }
  .shell { display: block; }
  .main  { margin: 0; padding: 0; }
  .findings { display: block; gap: 0; }
  .card { break-inside: avoid; margin-bottom: 12px; opacity: 1 !important; transform: none !important; box-shadow: none; border: 1px solid #ccc; }
  .main-header { border-bottom: 1px solid #ccc; }
  body { background: #fff !important; color: #000 !important; }
}
