/* ============================================================
   Ransomware CTI — Slate day (light default) + optional dark
   Bust: v=slate4
   ============================================================ */

:root, body.theme-light {
  color-scheme: light;
  /* Slightly cooler/darker page so body text has room to breathe */
  --bg-full: #e8eef5;
  --bg-primary: #f7fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #d5dee8;
  --bg-hover: #edf2f7;
  --border: #cbd5e1;
  --border-subtle: #dde5ee;
  /* WCAG-friendlier slate ink on light surfaces */
  --text-primary: #0b1220;
  --text-secondary: #1e293b;
  --text-tertiary: #334155;
  --accent: #0284c7;
  --accent-soft: rgba(2, 132, 199, 0.14);
  --accent-border: rgba(2, 132, 199, 0.5);
  --accent-ink: #ffffff;
  --danger: #b91c1c;
  --success: #047857;
  --warn: #b45309;
  --pink: #be185d;
  --purple: #6d28d9;
  --radius-card: 20px;
  --radius-control: 12px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.08);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --nav-bg: rgba(247, 250, 252, 0.94);
}

body.theme-dark {
  color-scheme: dark;
  --bg-full: #0b1220;
  --bg-primary: #0f172a;
  --bg-secondary: #111827;
  --bg-tertiary: #1e293b;
  --bg-hover: #1e293b;
  --border: #334155;
  --border-subtle: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --accent-border: rgba(56, 189, 248, 0.4);
  --accent-ink: #0b1220;
  --danger: #f87171;
  --success: #34d399;
  --warn: #fbbf24;
  --pink: #f472b6;
  --purple: #a78bfa;
  --shadow-card: 0 1px 0 rgba(255,255,255,0.04), 0 12px 40px rgba(0,0,0,0.35);
  --nav-bg: rgba(11, 18, 32, 0.92);
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg-full);
}

body {
  font-family: var(--font) !important;
  background: var(--bg-full) !important;
  color: var(--text-primary);
}

h1, h2, .hero-title, .report-title { text-wrap: balance; }
.prose p, p.tw-summary { text-wrap: pretty; }

.tabular-nums,
#hero-total-victims, #hero-active-groups, #hero-last-24h, #hero-last-7d,
#card-feeds-malware, #card-feeds-urls, #card-feeds-ssl, #card-feeds-ja3,
#card-cve-critical, #card-cve-vendors, #card-cve-cwes,
#card-attack-ttps, #card-attack-sub, #card-attack-groups, #card-attack-atomic,
[id^="stat-"], .metric-val, .delta-chip, .stat-value {
  font-variant-numeric: tabular-nums;
}

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- App shell nav (BoardUI-ish top bar) ---------- */
#site-nav {
  position: sticky;
  top: 0;
  z-index: 5000;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
}
#site-nav .site-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
  padding: 8px 10px;
  border-radius: var(--radius-control);
}
#site-nav .site-brand::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}
#site-nav .site-brand:hover { color: var(--accent); background: var(--accent-soft); }

#site-nav .site-nav-links {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px;
}
#site-nav .site-nav-links::-webkit-scrollbar { display: none; }

#site-nav .site-nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  transition-property: color, background-color, transform;
  transition-duration: 140ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
#site-nav .site-nav-links a:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}
#site-nav .site-nav-links a.active {
  color: var(--accent-ink);
  background: var(--accent);
  font-weight: 700;
}
#site-nav .site-nav-links a[data-nav^="brief"] {
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}
#site-nav .site-nav-links a[data-nav^="brief"].active {
  background: var(--accent);
  color: var(--accent-ink);
}

#site-nav .site-nav-meta {
  margin-left: auto;
  color: var(--text-tertiary);
  font-size: 11px;
  font-family: var(--mono);
  white-space: nowrap;
  display: none;
}
@media (min-width: 1100px) {
  #site-nav .site-nav-meta { display: block; }
}

/* Mobile menu button */
#site-nav .nav-menu-btn {
  display: none;
  margin-left: auto;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
#site-nav.nav-open .site-nav-links {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  position: absolute;
  left: 10px; right: 10px;
  top: calc(100% + 6px);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 8px;
  box-shadow: var(--shadow-card);
  overflow: visible;
  max-height: 70vh;
  overflow-y: auto;
  z-index: 5100;
}
#site-nav.nav-open .site-nav-links a {
  width: 100%;
  border-radius: 10px;
}
@media (max-width: 860px) {
  #site-nav { flex-wrap: wrap; }
  #site-nav .site-nav-links { display: none; }
  #site-nav .nav-menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  #site-nav.nav-open .site-nav-links { display: flex; width: 100%; }
}

/* Hide old separate briefs strip — briefs live in nav now */
#ai-briefs { display: none !important; }

/* ---------- BoardUI-like surfaces ---------- */
.cyber-card,
a.dashboard-card,
.metric-card,
.panel,
.metric {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-card) !important;
  box-shadow: var(--shadow-card);
}
a.dashboard-card {
  transition-property: transform, border-color, box-shadow;
  transition-duration: 160ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
a.dashboard-card:hover {
  border-color: var(--accent-border) !important;
  box-shadow: 0 0 0 1px var(--accent-border), var(--shadow-card);
}
a.dashboard-card:active { transform: scale(0.985); }

/* Concentric inner radii */
a.dashboard-card .rounded-xl,
a.dashboard-card .rounded-lg,
.cyber-card .rounded-xl,
.cyber-card .rounded-lg {
  border-radius: 14px !important;
}

/* Hero stat cards — BoardUI Stat Cards vibe */
.hero-stats > div,
.mitre-stats > div {
  border-radius: 20px !important;
  padding: 1rem 1.1rem !important;
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-card);
}
.hero-stats .text-2xl,
.mitre-stats .text-2xl,
.stat-value {
  font-size: 1.6rem !important;
  letter-spacing: -0.02em;
  color: var(--text-primary) !important;
}

.delta-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.3;
}
.delta-chip.up {
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fca5a5;
}
.delta-chip.flat {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
}
.delta-chip.hot {
  color: #9d174d;
  background: #fce7f3;
  border: 1px solid #f9a8d4;
  font-weight: 800;
}
body.theme-dark .delta-chip.up {
  color: #fecaca;
  background: rgba(248, 113, 113, 0.16);
  border: 1px solid rgba(248, 113, 113, 0.3);
}
body.theme-dark .delta-chip.flat {
  color: var(--text-secondary);
  background: rgba(161, 161, 181, 0.12);
  border: 1px solid rgba(161, 161, 181, 0.22);
}
body.theme-dark .delta-chip.hot {
  color: #fbcfe8;
  background: rgba(244, 114, 182, 0.16);
  border: 1px solid rgba(244, 114, 182, 0.32);
}

/* Primary path — CTA row */
#primary-path {
  max-width: 80rem;
  margin: 0.75rem auto 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: center;
  padding: 0 1rem;
}
#primary-path a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 650;
  box-shadow: var(--shadow-card);
  transition-property: transform, background-color, border-color;
  transition-duration: 140ms;
}
#primary-path a.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}
#primary-path a:hover { border-color: var(--accent-border); }
#primary-path a:active { transform: scale(0.96); }
@media (max-width: 640px) {
  #primary-path a { width: 100%; max-width: 24rem; }
}

/* This week — alert feed style */
#this-week {
  padding-top: 0.5rem;
}
#this-week .tw-panel {
  max-width: 80rem;
  margin: 0 auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-card);
}
#this-week .tw-kicker {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
#this-week .tw-summary {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.65rem;
}
#this-week .tw-hot { color: var(--pink); font-weight: 800; }
body.theme-light #this-week .tw-hot { color: #9d174d; }
#this-week .tw-chip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}
@media (min-width: 640px) {
  #this-week .tw-chip-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  #this-week .tw-chip-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
#this-week .tw-chip {
  display: block;
  text-decoration: none;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 0.7rem 0.75rem;
  transition-property: border-color, transform;
  transition-duration: 140ms;
}
#this-week .tw-chip:hover { border-color: var(--accent-border); }
#this-week .tw-chip:active { transform: scale(0.98); }
#this-week .tw-chip-title {
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#this-week .tw-chip-meta {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Page head unify — hide leftover local headers when shared chrome exists */
body:has(#site-nav) header.site-header,
body:has(#site-nav) .legacy-topnav,
body:has(#site-nav) nav.navbar:not(#site-nav) {
  display: none !important;
}

/* Tables */
.data-table thead th,
table.data-table thead th,
.datatable-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0e0e18;
  color: var(--text-tertiary);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  padding: 0.7rem 0.8rem !important;
  border-bottom: 1px solid var(--border);
}
.data-table tbody td,
.datatable-table tbody td {
  padding: 0.6rem 0.8rem !important;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-subtle);
  font-variant-numeric: tabular-nums;
}
.data-table tbody tr:hover td,
.datatable-table tbody tr:hover td {
  background: var(--accent-soft);
}
.overflow-x-auto:has(table.data-table),
.datatable-wrapper {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--bg-secondary);
  box-shadow: var(--shadow-card);
}
.cti-empty, .cti-error {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-secondary);
}
.cti-error { color: var(--danger); }
.cti-empty a, .cti-error a { color: var(--accent); }

/* Screenshots */
.onion-shot,
.group-screenshot,
img.leak-shot,
.lightbox-img {
  outline: 1px solid rgba(255,255,255,0.1);
  outline-offset: -1px;
  border-radius: 12px;
}

/* Report shell */
.period-seg {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  margin: 0.75rem 0 1rem;
}
.period-seg a {
  min-height: 36px;
  padding: 0.35rem 0.95rem;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
}
.period-seg a.active,
.period-seg a:hover {
  color: var(--accent-ink);
  background: var(--accent);
}
.report-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1.25rem;
}
.report-toc a {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.3rem 0.7rem;
  background: var(--bg-secondary);
}
.report-toc a:hover { color: var(--accent); border-color: var(--accent-border); }

/* Homepage copy tweaks */
.page-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  a.dashboard-card:active, #primary-path a:active { transform: none; }
}

/* ============================================================
   Dual/triple mode: Overview · Analyst · Operator
   ============================================================ */

.mode-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  margin-left: 6px;
}
.mode-switch button {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 650;
  padding: 6px 10px;
  min-height: 32px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.mode-switch button:hover { color: var(--text-primary); }
.mode-switch button.active {
  background: var(--accent);
  color: var(--accent-ink);
}
.cmd-btn {
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 999px;
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  margin-left: 6px;
}
.cmd-btn:hover { color: var(--accent); border-color: var(--accent-border); }

/* Overview: calm, brief-first */
body.mode-overview .mitre-stats,
body.mode-overview #features,
body.mode-overview #sources,
body.mode-overview #dashboards .dashboard-card:nth-child(n+4),
body.mode-overview .analyst-only {
  display: none !important;
}
body.mode-overview header.relative .text-xl {
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}
body.mode-overview #overview-brief { display: block; }
body.mode-overview #this-week .tw-chip-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (min-width: 768px) {
  body.mode-overview #this-week .tw-chip-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
}
body.mode-overview #site-nav .site-nav-links a[data-nav="feeds"],
body.mode-overview #site-nav .site-nav-links a[data-nav="cves"],
body.mode-overview #site-nav .site-nav-links a[data-nav="attack"],
body.mode-overview #site-nav .site-nav-links a[data-nav="brief-weekly"],
body.mode-overview #site-nav .site-nav-links a[data-nav="brief-monthly"] {
  display: none;
}
body.mode-overview.nav-open #site-nav .site-nav-links a { display: inline-flex; } /* menu still full on mobile open - handled below */
body.mode-overview #site-nav.nav-open .site-nav-links a { display: flex; }

.overview-brief { display: none; padding: 0.5rem 1rem 0; }
.overview-brief .ov-card {
  max-width: 52rem;
  margin: 0 auto 1rem;
  padding: 1.25rem 1.35rem;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-card);
}
.overview-brief .ov-kicker {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.35rem;
}
.overview-brief .ov-title {
  margin: 0 0 0.5rem;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}
.overview-brief .ov-body {
  color: var(--text-secondary);
  margin: 0 0 1rem;
  line-height: 1.5;
}
.overview-brief .ov-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.overview-brief .ov-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 650;
  font-size: 0.88rem;
}
.overview-brief .ov-actions a.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}

/* Analyst: everything on (default full site) */
body.mode-analyst #overview-brief { display: none !important; }

/* Operator: left rail console */
body.mode-operator {
  padding-left: 232px;
}
body.mode-operator #overview-brief { display: none !important; }
body.mode-operator #site-nav {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 232px;
  flex-direction: column;
  align-items: stretch;
  flex-wrap: nowrap;
  padding: 14px 12px;
  border-right: 1px solid var(--border);
  border-bottom: 0;
  background: var(--bg-primary);
  overflow-y: auto;
  gap: 8px;
}
body.mode-operator #site-nav .site-brand {
  margin-bottom: 6px;
}
body.mode-operator #site-nav .nav-menu-btn { display: none !important; }
body.mode-operator #site-nav .site-nav-links {
  display: flex !important;
  flex-direction: column;
  overflow: visible;
  width: 100%;
  gap: 2px;
}
body.mode-operator #site-nav .site-nav-links a {
  width: 100%;
  border-radius: 10px;
  justify-content: flex-start;
}
body.mode-operator #site-nav .mode-switch {
  flex-wrap: wrap;
  margin: 8px 0;
  width: 100%;
  justify-content: stretch;
}
body.mode-operator #site-nav .mode-switch button { flex: 1; padding: 6px 4px; font-size: 10px; }
body.mode-operator #site-nav .cmd-btn { width: 100%; margin: 0; }
body.mode-operator #site-nav .site-nav-meta {
  display: block;
  margin: 8px 0 0;
  white-space: normal;
}
body.mode-operator .hero-stats,
body.mode-operator .mitre-stats {
  gap: 0.5rem !important;
}
body.mode-operator a.dashboard-card {
  border-radius: 16px !important;
  padding: 1rem !important;
}

@media (max-width: 900px) {
  body.mode-operator { padding-left: 0; }
  body.mode-operator #site-nav {
    position: sticky;
    width: 100%;
    height: auto;
    bottom: auto;
    flex-direction: row;
    flex-wrap: wrap;
    overflow: visible;
  }
  body.mode-operator #site-nav .nav-menu-btn { display: inline-flex !important; }
  body.mode-operator #site-nav .site-nav-links { display: none !important; }
  body.mode-operator #site-nav.nav-open .site-nav-links {
    display: flex !important;
    position: absolute;
    left: 10px; right: 10px;
    top: calc(100% + 6px);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 8px;
    z-index: 5100;
  }
}

/* Command palette */
#cmd-palette[hidden] { display: none !important; }
#cmd-palette {
  position: fixed;
  inset: 0;
  z-index: 9000;
}
#cmd-palette .cmd-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
}
#cmd-palette .cmd-panel {
  position: relative;
  width: min(560px, calc(100vw - 24px));
  margin: 12vh auto 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
  overflow: hidden;
}
#cmd-palette input {
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  font-size: 1rem;
  padding: 1rem 1.1rem;
  outline: none;
}
#cmd-palette ul {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 320px;
  overflow: auto;
}
#cmd-palette li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-primary);
}
#cmd-palette li.active,
#cmd-palette li:hover {
  background: var(--accent-soft);
}
#cmd-palette .cmd-k {
  color: var(--text-tertiary);
  font-size: 0.75rem;
}
#cmd-palette .cmd-hint {
  margin: 0;
  padding: 0.55rem 1rem 0.8rem;
  color: var(--text-tertiary);
  font-size: 0.72rem;
}

@media (max-width: 860px) {
  .mode-switch button { padding: 6px 8px; font-size: 10px; }
  #site-nav .cmd-btn { display: none; }
  body.mode-operator #site-nav .cmd-btn { display: inline-flex; }
}


/* ---------- Theme toggle ---------- */
.theme-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  margin-left: 6px;
}
.theme-switch button {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 650;
  padding: 6px 10px;
  min-height: 32px;
  border-radius: 999px;
  cursor: pointer;
}
.theme-switch button.active {
  background: var(--accent);
  color: var(--accent-ink);
}

/* ---------- Beat Tailwind cyber-dark utilities in LIGHT mode ---------- */
body.theme-light .text-white,
body.theme-light .text-gray-100,
body.theme-light .text-gray-200 { color: var(--text-primary) !important; }
body.theme-light .text-gray-300,
body.theme-light .text-gray-400 { color: var(--text-secondary) !important; }
body.theme-light .text-gray-500,
body.theme-light .text-gray-600,
body.theme-light .text-text-muted,
body.theme-light .text-text-secondary,
body.theme-light .text-slate-400,
body.theme-light .text-slate-500,
body.theme-light .text-slate-600 { color: var(--text-secondary) !important; }
body.theme-light .text-gray-700,
body.theme-light .text-slate-700 { color: var(--text-primary) !important; }
body.theme-light .text-cyber-cyan { color: var(--accent) !important; }
body.theme-light #site-updated,
body.theme-light .site-nav-meta,
body.theme-light input::placeholder,
body.theme-light .placeholder\:text-gray-500::placeholder { color: var(--text-tertiary) !important; opacity: 1 !important; }
body.theme-light .hero-stats .text-xs,
body.theme-light .hero-stats .text-sm,
body.theme-light .mitre-stats .text-xs,
body.theme-light .mitre-stats .text-sm,
body.theme-light .dashboard-card .text-xs,
body.theme-light .dashboard-card .text-sm,
body.theme-light .metric-card .text-xs,
body.theme-light .metric-card .text-sm { color: var(--text-secondary) !important; }
body.theme-light .bg-cyber-dark,
body.theme-light .bg-cyber-darker,
body.theme-light .bg-dark-bg { background: var(--bg-full) !important; }
body.theme-light .cyber-card,
body.theme-light a.dashboard-card,
body.theme-light .metric-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border) !important;
  color: var(--text-primary);
}
body.theme-light .hero-stats > div,
body.theme-light .mitre-stats > div {
  background: var(--bg-secondary) !important;
  border-color: var(--border) !important;
}
body.theme-light .fixed.inset-0.pointer-events-none { opacity: 0.35; filter: saturate(0.6); }
body.theme-light .hero-glow { opacity: 0.25; }
body.theme-light .bg-gradient-to-r.from-cyber-cyan.to-cyber-purple {
  background-image: linear-gradient(to right, #0284c7, #6366f1) !important;
}
body.theme-light .card-glow { box-shadow: var(--shadow-card) !important; }
body.theme-light #cmd-palette .cmd-panel { background: #fff; }
body.theme-light .data-table thead th,
body.theme-light table.data-table thead th,
body.theme-light .datatable-table thead th {
  background: #eef2f7;
  color: var(--text-secondary);
  font-weight: 700;
}
body.theme-light .overflow-x-auto:has(table.data-table),
body.theme-light .datatable-wrapper {
  background: #fff;
}

/* Dark keeps previous cyber-friendly surfaces via tokens */
body.theme-dark .text-white { color: var(--text-primary) !important; }

/* ---------- Light contrast hard-fixes (slate3) ---------- */
/* Tailwind cyber-card is #111118 — lethal on light surfaces */
body.theme-light .bg-cyber-card,
body.theme-light [class*="bg-cyber-card"] {
  background-color: #e2e8f0 !important;
  color: var(--text-primary) !important;
}
body.theme-light .bg-cyber-card\/50,
body.theme-light [class~="bg-cyber-card/50"] {
  background-color: #e8eef5 !important;
}
body.theme-light a.dashboard-card [class*="bg-cyber-card"],
body.theme-light .cyber-card [class*="bg-cyber-card"] {
  background-color: #e8eef5 !important;
  border: 1px solid var(--border);
}
body.theme-light a.dashboard-card .text-white,
body.theme-light a.dashboard-card .text-sm.font-bold,
body.theme-light a.dashboard-card [class*="text-white"],
body.theme-light .cyber-card .text-white,
body.theme-light .cyber-card [class*="text-white"] {
  color: var(--text-primary) !important;
}
body.theme-light a.dashboard-card .text-cyber-cyan,
body.theme-light a.dashboard-card .text-cyber-cyan * {
  color: var(--accent) !important;
}
/* Features pills: were black boxes with dark remapped text */
body.theme-light .card-foot [class*="bg-cyber-card"],
body.theme-light .card-foot .bg-cyber-card,
body.theme-light a.dashboard-card .card-foot span[class*="rounded"] {
  background: #eef2f7 !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  font-weight: 650;
}
body.theme-light .card-foot .text-gray-300,
body.theme-light .card-foot .text-gray-500,
body.theme-light .card-foot span {
  color: var(--text-primary) !important;
}
body.theme-light .card-foot .text-xs.text-gray-500:first-child,
body.theme-light .card-foot > div > span:first-child {
  color: var(--text-secondary) !important;
  font-weight: 700;
}
/* Green/live badges readable on light */
body.theme-light .bg-green-500\/20,
body.theme-light [class*="bg-green-500"] {
  background-color: #dcfce7 !important;
}
body.theme-light .text-green-400 {
  color: #166534 !important;
}

/* ---------- AI report contrast (slate4) ---------- */
body.theme-light .wrap,
body.theme-light .wrap .report-title,
body.theme-light .wrap h1,
body.theme-light .wrap h2,
body.theme-light .wrap h3,
body.theme-light .wrap .metric-val,
body.theme-light .wrap .prose,
body.theme-light .wrap .prose p,
body.theme-light .wrap .prose li,
body.theme-light .wrap .prose strong {
  color: #0b1220 !important;
}
body.theme-light .wrap .sub,
body.theme-light .wrap .metric-lbl,
body.theme-light .wrap .kicker {
  color: #1e293b !important;
}
body.theme-light .wrap .metric,
body.theme-light .wrap .panel {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
}
body.theme-light .wrap .panel h3 {
  color: #0f172a !important;
  font-weight: 700 !important;
}
body.theme-light .wrap .back,
body.theme-light .wrap .kicker {
  color: #0369a1 !important;
  font-weight: 700 !important;
}
body.theme-light .report-toc a {
  color: #1e293b !important;
  border-color: #cbd5e1 !important;
}
body.theme-dark .wrap .prose p,
body.theme-dark .wrap .prose li {
  color: #e2e8f0 !important;
}
