/* ============================================================
   Security Intelligence Dashboard — Dark Terminal Theme
   ============================================================ */

:root {
  --bg-base:     #0a0e1a;
  --bg-surface:  #0f1628;
  --bg-card:     #131929;
  --bg-elevated: #161d35;
  --bg-hover:    #1c2540;
  --border:      #1e2d4a;
  --border-bright: #2a3d5e;

  --cyan:        #00d4ff;
  --cyan-dim:    #0099cc;
  --cyan-glow:   rgba(0, 212, 255, 0.15);
  --amber:       #ff8c00;
  --amber-dim:   #cc7000;
  --red:         #ff3b5c;
  --green:       #00ff88;
  --green-dim:   #00cc66;
  --yellow:      #ffd700;

  --text-primary:   #e8eaf0;
  --text-secondary: #8892a4;
  --text-muted:     #4a5568;
  --text-mono:      'JetBrains Mono', monospace;
  --text-sans:      'Inter', system-ui, sans-serif;

  --threat-critical: #ff1a3c;
  --threat-high:     #ff8c00;
  --threat-medium:   #ffd700;
  --threat-low:      #00ff88;
  --threat-unknown:  #4a5568;

  --radius: 0px;
  --transition: 150ms ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--text-sans);
  line-height: 1.6;
  min-height: 100vh;
  /* subtle grid texture */
  background-image:
    linear-gradient(rgba(0,212,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.02) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ── Utility ── */
.hidden { display: none !important; }
.page { min-height: 100vh; }
.cyan { color: var(--cyan); }
.amber { color: var(--amber); }
.red { color: var(--red); }
.green { color: var(--green); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-bright); }
::-webkit-scrollbar-thumb:hover { background: var(--cyan-dim); }

/* ================================================================
   LOGIN PAGE
   ================================================================ */
.login-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.logo-icon {
  font-size: 2.5rem;
  color: var(--cyan);
  text-shadow: 0 0 20px var(--cyan);
  line-height: 1;
}
.login-title { font-size: 1.4rem; font-weight: 700; letter-spacing: 0.08em; color: var(--text-primary); }
.login-sub { font-size: 0.75rem; color: var(--text-secondary); font-family: var(--text-mono); letter-spacing: 0.15em; }
.login-form {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-size: 0.7rem; letter-spacing: 0.12em; color: var(--text-secondary); text-transform: uppercase; }
.form-group input {
  background: var(--bg-base);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--text-mono);
  font-size: 0.875rem;
  padding: 0.6rem 0.75rem;
  outline: none;
  transition: border-color var(--transition);
}
.form-group input:focus { border-color: var(--cyan); }
.login-error { color: var(--red); font-size: 0.8rem; font-family: var(--text-mono); }

.login-request-link {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.btn-link {
  background: none;
  border: none;
  color: var(--cyan);
  font-size: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-link:hover { color: var(--cyan-bright, #33e0ff); }

.request-panel {
  margin-top: 1.25rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.request-panel-header {
  font-family: var(--text-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 1rem;
}
.label-opt { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }
.req-success {
  color: var(--green);
  font-size: 0.82rem;
  font-family: var(--text-mono);
  padding: 0.5rem 0;
  line-height: 1.5;
}
.request-panel textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-family: var(--text-mono);
  font-size: 0.82rem;
  resize: vertical;
  box-sizing: border-box;
}
.request-panel textarea:focus { outline: none; border-color: var(--cyan); }

/* ================================================================
   HEADER
   ================================================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  height: 52px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  gap: 1.5rem;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}
.brand-name {
  font-family: var(--text-mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--cyan);
}
.brand-sep { color: var(--border-bright); }
.brand-sub { font-family: var(--text-mono); font-size: 0.65rem; color: var(--text-muted); letter-spacing: 0.1em; }
.header-nav { display: flex; gap: 0; margin-left: auto; }
.nav-link {
  font-family: var(--text-mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0 1rem;
  height: 52px;
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.nav-link:hover { color: var(--text-primary); }
.nav-link.active { color: var(--cyan); border-bottom-color: var(--cyan); }
.header-right { display: flex; align-items: center; gap: 1rem; margin-left: 1rem; flex-shrink: 0; }
.header-status { display: flex; align-items: center; gap: 0.5rem; font-family: var(--text-mono); font-size: 0.7rem; color: var(--text-secondary); }
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}
.status-dot.live { background: var(--green); box-shadow: 0 0 6px var(--green); animation: pulse 2s infinite; }
.status-dot.scraping { background: var(--cyan); animation: pulse 0.8s infinite; }
.status-dot.error { background: var(--red); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ================================================================
   BUTTONS
   ================================================================ */
.btn-primary {
  background: var(--cyan);
  color: var(--bg-base);
  border: none;
  font-family: var(--text-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition);
  text-transform: uppercase;
}
.btn-primary:hover { background: var(--cyan-dim); box-shadow: 0 0 12px var(--cyan-glow); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  font-family: var(--text-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  padding: 0.55rem 1rem;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
  text-transform: uppercase;
}
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.7rem; }
.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 1rem;
  width: 32px; height: 32px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color var(--transition), color var(--transition);
}
.btn-icon:hover { border-color: var(--red); color: var(--red); }

/* ================================================================
   MAIN + VIEWS
   ================================================================ */
.main-content { padding: 1.5rem; max-width: 1400px; margin: 0 auto; }
.view { animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.view-title {
  font-family: var(--text-mono);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--cyan);
}
.view-meta { font-family: var(--text-mono); font-size: 0.7rem; color: var(--text-secondary); }
.loading-msg { font-family: var(--text-mono); font-size: 0.8rem; color: var(--text-secondary); padding: 2rem; }

/* ================================================================
   CARDS
   ================================================================ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card:hover { border-color: var(--border-bright); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.card-label {
  font-family: var(--text-mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--text-secondary);
  text-transform: uppercase;
}
.card-meta { font-family: var(--text-mono); font-size: 0.65rem; color: var(--text-muted); }
.card-body { padding: 1rem; }

/* ================================================================
   DASHBOARD GRID
   ================================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}

/* Mobile default: everything full width */
.dashboard-grid .card { grid-column: span 12; }

/* Stats row: always a single flex row across all screen sizes */
.stats-row {
  grid-column: span 12;
  display: flex;
  gap: 1rem;
}
.stats-row .card-stat {
  flex: 1;
  min-width: 0;
}

.card-stat {
  text-align: center;
  padding: 0.6rem 0.75rem;
  min-height: 0;
}

/* All cards full width on every screen size */

/* Stats */
.stat-value { font-family: var(--text-mono); font-size: 1.25rem; font-weight: 600; color: var(--text-primary); }
.stat-label { font-family: var(--text-mono); font-size: 0.55rem; letter-spacing: 0.15em; color: var(--text-muted); text-transform: uppercase; margin-top: 0.15rem; }

/* Threat badge */
.threat-badge {
  font-family: var(--text-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  padding: 0.35rem 0.8rem;
  border: 1px solid;
}
.threat-CRITICAL { color: var(--threat-critical); border-color: var(--threat-critical); background: rgba(255,26,60,0.1); }
.threat-HIGH     { color: var(--threat-high); border-color: var(--threat-high); background: rgba(255,140,0,0.1); }
.threat-MEDIUM   { color: var(--threat-medium); border-color: var(--threat-medium); background: rgba(255,215,0,0.1); }
.threat-LOW      { color: var(--threat-low); border-color: var(--threat-low); background: rgba(0,255,136,0.1); }
.threat-unknown  { color: var(--text-muted); border-color: var(--text-muted); }

/* Sparkline */
.sparkline { width: 100%; height: 60px; display: block; }
.sparkline-bar { fill: var(--cyan); opacity: 0.7; transition: opacity 0.1s; }
.sparkline-bar:hover { opacity: 1; }
.sparkline-legend {
  display: flex;
  justify-content: space-between;
  font-family: var(--text-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Action list */
.action-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.action-list li {
  font-size: 0.825rem;
  color: var(--text-primary);
  padding-left: 1rem;
  position: relative;
}
.action-list li::before { content: "→"; position: absolute; left: 0; color: var(--cyan); }

/* Evidence-backed action items (Section 4) */
.action-item { margin-bottom: 0.6rem; padding-left: 0; position: static; }
.action-item::before { display: none; }
.action-text { color: var(--text-primary); font-size: 0.85rem; line-height: 1.4; padding-left: 1rem; position: relative; }
.action-text::before { content: "→"; position: absolute; left: 0; color: var(--cyan); }
.action-evidence-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.5rem;
  padding-left: 3rem;
  border-left: 2px solid var(--cyan);
}
.action-evidence-label {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.action-evidence {
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  word-break: break-word;
}
.action-evidence:hover {
  color: var(--text-primary);
  border-color: var(--cyan);
  background: rgba(6,182,212,0.06);
}
.action-evidence-title { flex: 1; }
.action-evidence-arrow { flex-shrink: 0; color: var(--text-muted); font-size: 0.7rem; }
.action-evidence-hidden { display: none; }
.action-sources-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.35rem;
  padding: 0.2rem 0.5rem;
  padding-left: 3rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--text-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s;
}
.action-sources-toggle:hover { color: var(--cyan); }

/* Per-user checklist controls */
.action-main-row {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}
.action-check-btn {
  flex-shrink: 0;
  width: 2rem;
  font-family: var(--text-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 1.4;
  transition: color 0.15s;
  text-align: left;
}
.action-check-btn:hover { color: var(--green); }
.action-item.checked .action-check-btn { color: var(--green); }
.action-item.checked {
  opacity: 0.4;
  transition: opacity 0.2s;
}
.action-item.checked .action-text {
  text-decoration: line-through;
  color: var(--text-muted);
}
.action-item.checked .action-text::before { color: var(--text-muted); }
.action-clear-done-btn {
  font-family: var(--text-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  padding: 0.15rem 0.45rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.action-clear-done-btn:hover { color: var(--red); border-color: var(--red); }
.action-cve-link {
  color: var(--cyan);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px dashed var(--cyan);
}
.action-cve-link:hover { border-bottom-style: solid; }

/* Threat actors */
.actor-list { display: flex; flex-direction: column; gap: 0.75rem; }
.actor-item { padding: 0.6rem; border-left: 2px solid var(--amber); background: var(--bg-elevated); }
.actor-name { font-family: var(--text-mono); font-size: 0.8rem; font-weight: 600; color: var(--amber); }
.actor-targets { font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.2rem; }
.actor-ttps { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.2rem; font-style: italic; }

/* Top articles */
.top-article-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.top-article-row:last-child { border-bottom: none; }
.top-article-score {
  font-family: var(--text-mono);
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 2.5rem;
  text-align: right;
  padding-top: 0.1rem;
}
.top-article-info { flex: 1; min-width: 0; }
.top-article-title {
  display: block;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.85rem;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}
.top-article-title:hover { color: var(--cyan); }
.top-article-meta { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.25rem; }

/* Source pills */
.src-pill {
  font-family: var(--text-mono);
  font-size: 0.6rem;
  padding: 0.1rem 0.4rem;
  border-radius: 0;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.src-pill.src-rss { background: rgba(0,212,255,0.12); color: var(--cyan); border: 1px solid rgba(0,212,255,0.3); }
.src-pill.src-mastodon { background: rgba(99,100,255,0.12); color: #9395ff; border: 1px solid rgba(99,100,255,0.3); }
.src-pill.src-reddit { background: rgba(255,69,0,0.12); color: #ff6b35; border: 1px solid rgba(255,69,0,0.3); }
.src-pill.src-cccs { background: rgba(255,0,0,0.12); color: var(--red); border: 1px solid rgba(255,0,0,0.3); }
.src-pill.src-darkweb { background: rgba(180,0,255,0.12); color: #c084fc; border: 1px solid rgba(180,0,255,0.3); }
.src-pill.src-ransomlook { background: rgba(255,30,50,0.15); color: #ff4060; border: 1px solid rgba(255,30,50,0.35); }

/* Term cloud */
.terms-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  line-height: 1.4;
  max-height: 140px;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}
.term-cloud-item {
  font-family: var(--text-mono);
  color: var(--cyan);
  cursor: default;
  transition: opacity var(--transition);
}
.term-cloud-item:hover { opacity: 1 !important; color: var(--amber); }

/* Canada card */
#canadaContent { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.7; }

/* ================================================================
   DATA TABLE
   ================================================================ */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll .data-table { min-width: 560px; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--text-mono);
  font-size: 0.75rem;
}
.data-table th {
  text-align: left;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-elevated); }

/* Severity badges */
.badge {
  display: inline-block;
  font-family: var(--text-mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 0.15rem 0.4rem;
  border: 1px solid;
}
.badge-CRITICAL { color: var(--threat-critical); border-color: var(--threat-critical); }
.badge-HIGH     { color: var(--threat-high); border-color: var(--threat-high); }
.badge-MEDIUM   { color: var(--threat-medium); border-color: var(--threat-medium); }
.badge-LOW      { color: var(--threat-low); border-color: var(--threat-low); }
.badge-rss      { color: var(--cyan); border-color: var(--cyan-dim); }
.badge-reddit   { color: #ff6314; border-color: #ff6314; }
.badge-mastodon { color: #6364ff; border-color: #6364ff; }
.badge-cccs     { color: var(--green); border-color: var(--green-dim); }
.badge-darkweb  { color: #c084fc; border-color: rgba(180,0,255,0.4); }
.badge-yes      { color: var(--threat-critical); border-color: var(--threat-critical); }
.badge-no       { color: var(--text-muted); border-color: var(--border); }

/* ================================================================
   ANALYTICS TAB
   ================================================================ */

.analytics-toolbar { display:flex; align-items:center; gap:0.75rem; margin-bottom:1.25rem; flex-wrap:wrap; }

.analytics-stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  text-align: center;
}
.stat-val { font-family: var(--text-mono); font-size: 2rem; font-weight: 700; color: var(--cyan); line-height: 1.1; }
.stat-lbl { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-top: 0.3rem; }

.analytics-row { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.analytics-chart-card { min-width: 0; }
.analytics-pv-card { min-width: 0; }

/* Page-view bar rows */
.pv-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0; border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.04)); }
.pv-label { font-family: var(--text-mono); font-size: 0.75rem; color: var(--text-secondary); min-width: 80px; }
.pv-bar-wrap { flex: 1; height: 8px; background: var(--bg-elevated); border-radius: 4px; overflow: hidden; }
.pv-bar { height: 100%; background: var(--cyan); opacity: 0.7; border-radius: 4px; transition: width 0.3s; }
.pv-count { font-family: var(--text-mono); font-size: 0.75rem; color: var(--text-muted); min-width: 32px; text-align: right; }

@media (max-width: 768px) {
  .analytics-stat-cards { grid-template-columns: repeat(2, 1fr); }
  .analytics-row { grid-template-columns: 1fr; }
}

/* ================================================================
   FEED VIEW
   ================================================================ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}
.filter-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chip {
  font-family: var(--text-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  padding: 0.3rem 0.7rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  text-transform: uppercase;
}
.chip.active, .chip:hover { background: var(--cyan-glow); border-color: var(--cyan); color: var(--cyan); }
.search-input {
  background: var(--bg-base);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--text-sans);
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
  outline: none;
  min-width: 200px;
  flex: 1;
}
.search-input:focus { border-color: var(--cyan); }
.filter-score { display: flex; align-items: center; gap: 0.5rem; font-family: var(--text-mono); font-size: 0.7rem; color: var(--text-secondary); }
.filter-score input[type="range"] { accent-color: var(--cyan); width: 100px; }
.filter-dates { display: flex; align-items: center; gap: 0.4rem; }
.filter-dates input[type="date"] {
  background: var(--bg-base);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--text-mono);
  font-size: 0.7rem;
  padding: 0.35rem 0.5rem;
}
.filter-sort select {
  background: var(--bg-base);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--text-mono);
  font-size: 0.7rem;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
}
.filter-sort select:focus { outline: none; border-color: var(--cyan); }
.article-list { display: flex; flex-direction: column; gap: 0.5rem; }
.article-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 0.875rem 1rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  transition: border-color var(--transition);
  cursor: pointer;
}
.article-card:hover { border-color: var(--cyan-dim); }
.article-card.read { opacity: 0.6; }
.article-card.starred { border-left: 2px solid var(--amber); }
.article-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  text-decoration: none;
}
.article-title:hover { color: var(--cyan); }
.article-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}
.article-date { font-family: var(--text-mono); font-size: 0.65rem; color: var(--text-muted); }
.article-terms { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.article-snippet {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.25rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.article-snippet mark {
  background: rgba(0, 212, 255, 0.2);
  color: var(--cyan);
  font-style: normal;
  border-radius: 2px;
  padding: 0 2px;
}
.term-chip {
  font-family: var(--text-mono);
  font-size: 0.6rem;
  padding: 0.1rem 0.35rem;
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.25);
  color: var(--cyan-dim);
}
.tg-preview {
  margin-top: 0.35rem;
  font-family: var(--text-mono);
  font-size: 0.65rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.tg-content {
  color: var(--text-primary);
  font-size: 0.75rem;
  line-height: 1.4;
  word-break: break-word;
}
.tg-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.4rem;
}
.tg-preview .tg-key { color: var(--text-muted); }
.tg-preview .tg-val { color: var(--cyan-dim); }
.tg-preview .tg-sep { color: var(--border-bright); }
.article-score-bar {
  width: 60px;
  height: 4px;
  background: var(--border);
  position: relative;
  margin-top: 4px;
}
.article-score-fill {
  height: 100%;
  background: var(--cyan);
  transition: width 0.3s;
}
.article-actions { display: flex; gap: 0.4rem; align-items: flex-start; }
.btn-star {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-star:hover, .btn-star.starred { color: var(--amber); border-color: var(--amber); }
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
  font-family: var(--text-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ================================================================
   REPORTS VIEW
   ================================================================ */
.report-tabs, .admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.rtab, .atab {
  font-family: var(--text-mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  padding: 0.6rem 1.2rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.rtab:hover, .atab:hover { color: var(--text-primary); }
.rtab.active, .atab.active { color: var(--cyan); border-bottom-color: var(--cyan); }
.rtab-panel, .atab-panel { display: none; }
.rtab-panel.active, .atab-panel.active { display: block; }
.report-container { display: flex; flex-direction: column; gap: 1rem; }
.report-section { background: var(--bg-surface); border: 1px solid var(--border); }
.report-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.report-section-title {
  font-family: var(--text-mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--cyan);
}
.report-section-body { padding: 1rem; }
.report-toggle { color: var(--text-muted); font-size: 0.8rem; transition: transform 0.2s; }
.report-toggle.open { transform: rotate(90deg); }
.exec-summary { font-size: 0.9rem; line-height: 1.75; color: var(--text-primary); }

/* Custom query */
.query-panel { max-width: 900px; }
.query-hint { font-size: 0.8rem; color: var(--text-secondary); margin: 0.5rem 0 1rem; }
.query-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--text-sans);
  font-size: 0.875rem;
  padding: 0.75rem;
  resize: vertical;
  outline: none;
  margin-bottom: 0.75rem;
}
.query-input:focus { border-color: var(--cyan); }
.query-controls { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.query-status { font-family: var(--text-mono); font-size: 0.7rem; color: var(--text-secondary); }
.query-output {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 1.25rem;
  min-height: 100px;
  font-size: 0.875rem;
  line-height: 1.7;
  white-space: pre-wrap;
  font-family: var(--text-sans);
}
/* Simple markdown rendering in query output */
.query-output strong { color: var(--text-primary); font-weight: 600; }
.query-output em { color: var(--text-secondary); }
.query-output h1,.query-output h2,.query-output h3 {
  font-family: var(--text-mono);
  color: var(--cyan);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 1rem 0 0.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
}
.query-output ul,.query-output ol { padding-left: 1.5rem; margin: 0.5rem 0; }
.query-output li { margin: 0.25rem 0; }
.query-output code {
  font-family: var(--text-mono);
  font-size: 0.8rem;
  background: var(--bg-elevated);
  padding: 0.1rem 0.3rem;
  color: var(--cyan);
}
.query-output pre {
  background: var(--bg-elevated);
  padding: 0.75rem;
  margin: 0.5rem 0;
  overflow-x: auto;
}

/* ================================================================
   ADMIN VIEW
   ================================================================ */
.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.inline-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.inline-form input, .inline-form select {
  background: var(--bg-base);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--text-mono);
  font-size: 0.75rem;
  padding: 0.4rem 0.6rem;
  outline: none;
}
.inline-form input:focus, .inline-form select:focus { border-color: var(--cyan); }
.inline-form input[type="url"] { min-width: 300px; }
.admin-table { font-size: 0.75rem; }
.toggle-switch {
  width: 36px; height: 18px;
  background: var(--border);
  border: none;
  cursor: pointer;
  position: relative;
  transition: background var(--transition);
}
.toggle-switch::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  top: 2px; left: 2px;
  background: var(--text-secondary);
  transition: transform var(--transition), background var(--transition);
}
.toggle-switch.on { background: rgba(0, 212, 255, 0.3); }
.toggle-switch.on::after { transform: translateX(18px); background: var(--cyan); }
.btn-delete {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-family: var(--text-mono);
  transition: all var(--transition);
}
.btn-delete:hover { border-color: var(--red); color: var(--red); }
.term-add-row { display: flex; align-items: center; gap: 0.5rem; }
.term-add-row input, .term-add-row select {
  background: var(--bg-base);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--text-mono);
  font-size: 0.75rem;
  padding: 0.4rem 0.6rem;
  outline: none;
}
.term-add-row input:focus { border-color: var(--cyan); }
.scraper-status-card { margin-bottom: 1rem; }
.status-info { font-family: var(--text-mono); font-size: 0.75rem; color: var(--text-secondary); line-height: 2; }
.scraper-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }
.scrape-indicator { display: flex; align-items: center; gap: 0.5rem; font-family: var(--text-mono); font-size: 0.75rem; color: var(--cyan); }
.spinner {
  width: 12px; height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.log-output {
  background: var(--bg-base);
  font-family: var(--text-mono);
  font-size: 0.7rem;
  color: var(--green-dim);
  height: 300px;
  overflow-y: auto;
  padding: 0.75rem;
  line-height: 1.6;
  border: 1px solid var(--border);
}
.log-output .log-line { padding: 0.1rem 0; }
.log-output .log-error { color: var(--red); }
.log-output .log-warn { color: var(--amber); }
.settings-form { max-width: 540px; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}
.setting-row label { font-size: 0.8rem; color: var(--text-secondary); }
.setting-input {
  background: var(--bg-base);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--text-mono);
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
  width: 180px;
  outline: none;
}
.setting-input:focus { border-color: var(--cyan); }
/* Toggle component */
.toggle { position: relative; display: inline-block; width: 44px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; bottom: 3px;
  background: var(--text-muted);
  transition: transform var(--transition), background var(--transition);
}
.toggle input:checked + .toggle-slider { background: rgba(0, 212, 255, 0.3); }
.toggle input:checked + .toggle-slider::before { transform: translateX(22px); background: var(--cyan); }
.save-msg { font-family: var(--text-mono); font-size: 0.75rem; color: var(--green); margin-top: 0.75rem; }
.bulk-import { margin-bottom: 1rem; }
#bulkImportArea { margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
#bulkTerms {
  background: var(--bg-base);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--text-mono);
  font-size: 0.75rem;
  padding: 0.75rem;
  resize: vertical;
  outline: none;
}
#bulkTerms:focus { border-color: var(--cyan); }

/* ================================================================
   TRENDS VIEW
   ================================================================ */
.trends-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.trends-card-left,
.trends-card-right {
  min-width: 0;
}

.activity-chart-wrap {
  width: 100%;
  overflow: hidden;
}
.activity-chart {
  width: 100%;
  height: 140px;
  display: block;
}

.chart-tooltip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--text-mono);
  font-size: 0.7rem;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  position: absolute;
  pointer-events: none;
  white-space: nowrap;
}

/* Breach feed */
.breach-feed {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 0.25rem;
}
.breach-item {
  border-left: 2px solid rgba(255, 100, 100, 0.3);
  padding-left: 0.75rem;
}
.breach-item-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.breach-item-title {
  display: block;
  font-size: 0.8rem;
  color: var(--text-primary);
  text-decoration: none;
  line-height: 1.4;
  transition: color 0.15s;
}
.breach-item-title:hover { color: var(--cyan); }
.breach-item-terms {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.3rem;
}

/* Nav link hidden for non-admins */
.header-nav .nav-link.hidden { display: none; }

@media (max-width: 768px) {
  .trends-split { grid-template-columns: 1fr; }
}

/* ================================================================
   ADMIN — TERMS TAGS
   ================================================================ */
.multi-select { position: relative; }
.multi-select-btn {
  font-family: var(--text-mono);
  font-size: 0.7rem;
  background: var(--bg-base);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  transition: border-color var(--transition);
}
.multi-select-btn:hover { border-color: var(--text-muted); }
.multi-select-btn.has-selection { border-color: var(--cyan); color: var(--cyan); }
.ms-arrow { font-size: 0.6rem; opacity: 0.6; }
.multi-select-dropdown {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  min-width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: 200;
  padding: 0.25rem 0;
}
.multi-select-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem;
  font-family: var(--text-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
.multi-select-option:hover { background: var(--bg-surface); color: var(--text-primary); }
.multi-select-option input[type="checkbox"] { accent-color: var(--cyan); cursor: pointer; }

.tags-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  min-width: 120px;
}

.term-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(0, 255, 200, 0.08);
  border: 1px solid rgba(0, 255, 200, 0.25);
  color: var(--cyan);
  font-family: var(--text-mono);
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  white-space: nowrap;
}

.term-tag-rm {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.6rem;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
}
.term-tag-rm:hover { color: var(--red); }

.btn-add-tag {
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  font-family: var(--text-mono);
  font-size: 0.65rem;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-add-tag:hover { border-color: var(--cyan); color: var(--cyan); }
.btn-add-tag.hidden { display: none; }

.tag-input-inline {
  background: var(--bg-base);
  border: 1px solid var(--cyan);
  color: var(--text-primary);
  font-family: var(--text-mono);
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  outline: none;
  width: 100px;
}

/* ================================================================
   ADMIN — USERS TAB
   ================================================================ */
.role-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
}
.role-select:focus { outline: none; border-color: var(--cyan); }

.status-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 0.5rem 0;
}
.status-row span {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.status-row strong {
  color: var(--text-primary);
  margin-left: 0.25rem;
}

.mono-sm {
  font-family: var(--text-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ================================================================
   SOURCE: TELEGRAM
   ================================================================ */
.src-pill.src-telegram {
  background: rgba(42, 171, 238, 0.12);
  color: #2aabee;
  border: 1px solid rgba(42, 171, 238, 0.3);
}
.badge-telegram { color: #2aabee; border-color: rgba(42, 171, 238, 0.4); }

/* ================================================================
   SETTINGS — section label divider
   ================================================================ */
.scraper-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}
.scrape-src-btn {
  font-family: var(--text-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

.setting-section-label {
  font-family: var(--text-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
  margin-bottom: 0.25rem;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
  .header-nav { display: none; }
  .main-content { padding: 1rem; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid .card { grid-column: span 2; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-score, .filter-dates { flex-wrap: wrap; }
  .admin-table th:nth-child(3),
  .admin-table td:nth-child(3) { display: none; }
}
@media (max-width: 640px) {
  .main-content { padding: 0.75rem; }
  .dashboard-grid { gap: 0.5rem; }
  .card-body { padding: 0.75rem; }
  .card-header { flex-direction: column; align-items: flex-start; gap: 0.2rem; }
  #execSummaryText { font-size: 0.78rem; line-height: 1.5; }
  .action-evidence { word-break: break-word; }
  .view-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .terms-cloud { justify-content: center; }
}
@media (max-width: 480px) {
  .brand-sub { display: none; }
  .dashboard-grid { grid-template-columns: 1fr; }
  /* Keep stats side-by-side but shrink text on very small screens */
  .stats-row { gap: 0.4rem; }
  .stats-row .card-stat { padding: 0.4rem 0.3rem; }
}

/* ================================================================
   BREACH FEED
   ================================================================ */
.card-full { grid-column: 1 / -1; }

.breach-item {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.breach-item:last-child { border-bottom: none; }
.breach-item-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.breach-title {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
}
.breach-title:hover { color: var(--cyan); text-decoration: underline; }
.breach-summary {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  line-height: 1.5;
}
.breach-meta {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--text-mono);
  margin-top: 0.15rem;
}

/* Hot-rank list (Top Topics / Top CVEs cards) */
.hot-rank-list { display: flex; flex-direction: column; gap: 0.65rem; }
.hot-rank-row {
  display: grid;
  grid-template-columns: 1.4rem 1fr;
  gap: 0.4rem;
  align-items: start;
}
.hot-rank-num {
  font-family: var(--text-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  padding-top: 0.1rem;
  text-align: right;
}
.hot-rank-content { display: flex; flex-direction: column; gap: 0.25rem; }
.hot-rank-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.hot-rank-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  font-family: var(--text-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}
.hot-rank-cve {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cyan);
  font-family: var(--text-mono);
  text-decoration: none;
  white-space: nowrap;
}
.hot-rank-cve:hover { text-decoration: underline; }
.hot-rank-count {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--text-mono);
  white-space: nowrap;
  flex-shrink: 0;
}
.hot-rank-bar-wrap {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.hot-rank-bar {
  height: 100%;
  background: var(--amber);
  border-radius: 2px;
  transition: width 0.4s ease;
}
.hot-rank-bar-cve { background: var(--cyan); }
.hot-rank-sources { display: flex; gap: 0.2rem; flex-wrap: wrap; }

/* ================================================================
   EMAIL REPORT MODAL
   ================================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: min(520px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-family: var(--text-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--cyan);
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem 0.4rem;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 1rem; }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.modal-footer span { margin-right: auto; }
.fmt-radio {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-secondary);
}
.sections-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}
.section-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-secondary);
}

/* ================================================================
   LINK GUARD MODAL
   ================================================================ */
.link-guard-box {
  width: min(440px, 95vw);
  animation: zoomIn 0.15s ease;
}

/* Regular external link — amber accent */
.link-guard-box[data-mode="external"] .modal-title { color: var(--amber); }
.link-guard-box[data-mode="external"] .link-guard-url-wrap {
  border-left-color: var(--amber);
}

/* Onion link — purple accent */
.link-guard-box[data-mode="onion"] .modal-title { color: #a78bfa; }
.link-guard-box[data-mode="onion"] .link-guard-url-wrap {
  border-left-color: #a78bfa;
}

.link-guard-body { display: flex; flex-direction: column; gap: 0.75rem; }

.link-guard-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.link-guard-url-wrap {
  border-left: 3px solid var(--border-bright);
  padding: 0.5rem 0.75rem;
  background: var(--bg-elevated);
}

.link-guard-url {
  font-family: var(--text-mono);
  font-size: 0.72rem;
  color: var(--text-primary);
  word-break: break-all;
  line-height: 1.5;
  user-select: all;
}

.link-guard-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--text-mono);
  margin: 0;
}

/* ================================================================
   MESSAGES VIEW
   ================================================================ */
.messages-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: calc(100vh - 180px);
}
.msg-thread {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.msg-compose { display: flex; flex-direction: column; }
.msg-textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  padding: 0.6rem;
  font-size: 0.85rem;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}
.msg-textarea:focus { outline: none; border-color: var(--cyan); }

.msg-bubble {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  max-width: 80%;
}
.msg-user {
  background: rgba(0,212,255,0.07);
  border: 1px solid rgba(0,212,255,0.15);
  align-self: flex-end;
}
.msg-admin {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  align-self: flex-start;
}
.msg-bubble-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.2rem;
}
.msg-author {
  font-family: var(--text-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
}
.msg-ts {
  font-family: var(--text-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
}
.msg-content {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  word-break: break-word;
}

/* ================================================================
   ADMIN MESSAGES TAB
   ================================================================ */
.admin-messages-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
  min-height: 480px;
}
.admin-conv-list {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-y: auto;
}
.admin-conv-item {
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.admin-conv-item:hover { background: var(--bg-elevated); }
.admin-conv-item.active { background: rgba(0,212,255,0.08); border-left: 2px solid var(--cyan); }
.admin-conv-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--text-mono);
}
.admin-conv-meta {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.admin-conv-detail {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  gap: 0.75rem;
}
.admin-msg-thread {
  flex: 1;
  overflow-y: auto;
  min-height: 300px;
  max-height: 420px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.admin-reply-bar {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

/* ================================================================
   CARD ZOOM OVERLAY
   ================================================================ */
.card-zoomable:hover {
  border-color: var(--cyan);
}
.card-zoomable .card-header {
  cursor: zoom-in;
}
.card-zoomable .card-header:hover {
  background: var(--bg-elevated);
  color: var(--cyan);
}

.card-zoom-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(2px);
}
.card-zoom-overlay.hidden { display: none; }

.card-zoom-box {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  width: min(1281px, 96vw);
  max-height: 98vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  animation: zoomIn 0.15s ease;
}
@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.card-zoom-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.card-zoom-title {
  font-family: var(--text-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--cyan);
  text-transform: uppercase;
}
.card-zoom-body {
  padding: 1rem;
  overflow-y: auto;
  flex: 1;
  /* Let text breathe — override any max-height clamps from the original card */
  line-height: 1.6;
}
/* Remove overflow/max-height constraints that cards set for their in-grid version */
.card-zoom-body .terms-cloud {
  max-height: none;
  mask-image: none;
  -webkit-mask-image: none;
  flex-wrap: wrap;
}
.card-zoom-body .table-scroll {
  overflow-x: auto;
}
/* Hint text at the bottom */
.card-zoom-hint {
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
}

/* ================================================================
   THREAT ACTOR PROFILES VIEW
   ================================================================ */
.actors-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1rem;
  height: calc(100vh - 120px);
}
@media (max-width: 900px) {
  .actors-layout { grid-template-columns: 1fr; height: auto; }
}

/* Sidebar */
.actors-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow: hidden;
}
.actors-search { width: 100%; }
.actor-list-panel {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
}
.actor-list-empty {
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.actor-list-item {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.actor-list-item:last-child { border-bottom: none; }
.actor-list-item:hover { background: rgba(255,255,255,0.04); }
.actor-list-item.active { background: rgba(6,182,212,0.1); border-left: 3px solid var(--cyan); }
.actor-list-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.actor-list-meta {
  font-size: 0.65rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}
.actor-badge { font-size: 0.7rem; }
.actor-badge-profiled { color: var(--cyan); }
.actor-badge-raw { color: var(--text-muted); }
.actor-motivation { font-family: var(--text-mono); font-size: 0.6rem; color: var(--amber); text-transform: uppercase; }
.actor-article-count { color: var(--cyan); }
.actor-last-seen { margin-left: auto; }

/* Detail panel */
.actors-detail {
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
}
.actor-detail-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
  gap: 0.5rem;
}
.placeholder-icon { font-size: 3rem; opacity: 0.2; }
.placeholder-sub { font-size: 0.75rem; max-width: 380px; line-height: 1.5; }
.actor-detail-loading, .actor-detail-error {
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.actor-detail-card { padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }

.actor-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.actor-detail-title {
  font-size: 1.4rem;
  font-family: var(--text-mono);
  color: var(--text-primary);
  margin: 0;
}
.actor-detail-actions { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; }
.actor-aliases { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.3rem; display: flex; gap: 0.3rem; flex-wrap: wrap; align-items: center; }
.alias-tag {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
}
.actor-detail-meta-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.actor-detail-meta-row strong { color: var(--text-primary); }
.profile-ts { margin-left: auto; font-size: 0.65rem; }

.confidence-badge {
  font-family: var(--text-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-weight: 700;
}
.conf-high { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }
.conf-medium { background: rgba(245,158,11,0.15); color: var(--amber); border: 1px solid rgba(245,158,11,0.3); }
.conf-low { background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid var(--border); }

.actor-summary {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-secondary);
  background: rgba(6,182,212,0.05);
  border-left: 3px solid var(--cyan);
  padding: 0.6rem 0.9rem;
  border-radius: 0 4px 4px 0;
}
.actor-no-profile {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: 6px;
}

/* Profile grid */
.actor-profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 700px) { .actor-profile-grid { grid-template-columns: 1fr; } }

.actor-section { display: flex; flex-direction: column; gap: 0.4rem; }
.actor-section-full { grid-column: 1 / -1; }
.actor-section-title {
  font-family: var(--text-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: var(--cyan);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
}

.actor-dl { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.75rem; font-size: 0.8rem; }
.actor-dl dt { color: var(--text-muted); white-space: nowrap; }
.actor-dl dd { color: var(--text-primary); margin: 0; }

.actor-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.actor-tags-label { font-size: 0.65rem; color: var(--text-muted); margin-top: 0.2rem; }
.actor-tag {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-family: var(--text-mono);
  text-decoration: none;
}
.tag-sector { background: rgba(99,102,241,0.15); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.3); }
.tag-country { background: rgba(16,185,129,0.12); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.25); }
.tag-cve { background: rgba(239,68,68,0.12); color: #fca5a5; border: 1px solid rgba(239,68,68,0.25); }
.tag-cve:hover { background: rgba(239,68,68,0.22); }
.tag-tool { background: rgba(245,158,11,0.12); color: var(--amber); border: 1px solid rgba(245,158,11,0.25); }

.actor-ttp-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.actor-ttp-list li::before { content: "→ "; color: var(--cyan); }

.ioc-group { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; margin-bottom: 0.3rem; }
.ioc-label { font-size: 0.65rem; color: var(--text-muted); min-width: 55px; }
.ioc-val {
  font-family: var(--text-mono);
  font-size: 0.72rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  color: var(--text-secondary);
}
.ioc-hash { font-size: 0.65rem; color: var(--text-muted); max-width: 200px; overflow: hidden; text-overflow: ellipsis; }

.actor-recent { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; margin: 0; }

.actor-articles-list { display: flex; flex-direction: column; gap: 0.4rem; }
.actor-article-item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.78rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.actor-article-item:last-child { border-bottom: none; }
.actor-article-link {
  color: var(--text-secondary);
  text-decoration: none;
  flex: 1;
  min-width: 0;
}
.actor-article-link:hover { color: var(--cyan); }
.actor-article-date { font-size: 0.65rem; color: var(--text-muted); white-space: nowrap; margin-left: auto; }

/* Trust score indicators */
.trust-pips { display: inline-flex; gap: 2px; align-items: center; flex-shrink: 0; margin-left: 0.4rem; vertical-align: middle; }
.trust-pip { width: 5px; height: 9px; border-radius: 1px; background: var(--bg-elevated); border: 1px solid var(--border); }
.trust-pip.tp-high { background: var(--green);  border-color: var(--green-dim);  }
.trust-pip.tp-med  { background: var(--amber);  border-color: var(--amber-dim);  }
.trust-pip.tp-low  { background: #6b7280;        border-color: #4a5568;           }
.actor-ttp-row { display: flex; align-items: baseline; gap: 0.5rem; }
.actor-ttp-row li { display: contents; }
.actor-ttp-list li { display: flex; align-items: baseline; gap: 0.4rem; }
.actor-ttp-text { flex: 1; }
.actor-tag-wrap { display: inline-flex; align-items: center; gap: 0; }
.source-diversity-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.72rem; color: var(--text-muted); margin-top: 0.25rem; }
.src-diversity-bar { display: flex; gap: 2px; }
.src-diversity-seg { width: 14px; height: 5px; border-radius: 1px; background: var(--border); }
.src-diversity-seg.active { background: var(--cyan); }
.trust-tooltip { cursor: default; }

/* ================================================================
   DEV PIPELINE VIEW
   ================================================================ */
.dev-layout {
  display: grid;
  grid-template-columns: 1fr 390px;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 1100px) {
  .dev-layout { grid-template-columns: 1fr; }
}

/* Legend */
.dev-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
}
.dev-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--text-mono);
  font-size: 0.65rem;
  color: var(--text-secondary);
}
.dev-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Pipeline phases */
.dev-phase-section { margin-bottom: 0; }
.dev-phase-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.4rem 0 0.6rem;
}
.dev-phase-label {
  font-family: var(--text-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  text-transform: uppercase;
  white-space: nowrap;
}
.dev-phase-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.dev-phase-connector {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.3rem 0 0.3rem 1.5rem;
  color: var(--border-bright);
  font-size: 1.1rem;
  line-height: 1;
}

/* Node cards */
.dev-nodes-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding-bottom: 0.3rem;
}
.dev-node {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 110px;
  max-width: 160px;
  flex: 1;
  position: relative;
}
.dev-node:hover {
  border-color: var(--node-color, var(--border-bright));
  background: var(--bg-elevated);
}
.dev-node.active {
  border-color: var(--node-color, var(--cyan));
  background: var(--bg-elevated);
  box-shadow: 0 0 0 1px var(--node-color, var(--cyan));
}
.dev-node-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
  margin-bottom: 0.1rem;
}
.dev-node-icon { font-size: 1rem; line-height: 1; }
.dev-node-label {
  font-family: var(--text-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
}
.dev-node-summary {
  font-size: 0.63rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Type badges (node + detail panel) */
.dev-node-badge {
  display: inline-block;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-family: var(--text-mono);
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-dev-trigger  { background: rgba(148,163,184,0.15); color: #94a3b8; }
.badge-dev-external { background: rgba(6,182,212,0.15);   color: #06b6d4; }
.badge-dev-script   { background: rgba(96,165,250,0.15);  color: #60a5fa; }
.badge-dev-db       { background: rgba(245,158,11,0.15);  color: #f59e0b; }
.badge-dev-claude   { background: rgba(167,139,250,0.15); color: #a78bfa; }
.badge-dev-output   { background: rgba(74,222,128,0.15);  color: #4ade80; }

/* Detail panel */
.dev-detail-panel {
  position: sticky;
  top: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
}
.dev-detail-empty {
  padding: 3.5rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: var(--text-mono);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.dev-detail-content { padding: 1rem; }
.dev-detail-title {
  font-family: var(--text-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}
.dev-detail-section-label {
  font-family: var(--text-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0.75rem 0 0.3rem;
}
.dev-detail-what {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.dev-detail-file {
  font-family: var(--text-mono);
  font-size: 0.65rem;
  color: var(--cyan);
  padding: 0.3rem 0.5rem;
  background: rgba(6,182,212,0.07);
  border-left: 2px solid var(--cyan);
}
.dev-detail-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}
.dev-detail-list li {
  font-size: 0.74rem;
  color: var(--text-secondary);
  padding-left: 1rem;
  position: relative;
  line-height: 1.4;
}
.dev-detail-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--border-bright);
  font-size: 0.65rem;
  top: 0.05rem;
}
.dev-detail-note {
  font-size: 0.72rem;
  color: #f59e0b;
  padding: 0.4rem 0.6rem;
  background: rgba(245,158,11,0.07);
  border-left: 2px solid #f59e0b;
  margin-top: 0.75rem;
  line-height: 1.5;
}

/* Scoring table */
.dev-scoring-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.dev-score-row {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  font-size: 0.72rem;
  padding: 0.2rem 0.4rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.dev-score-bonus {
  font-family: var(--text-mono);
  color: var(--cyan);
  font-weight: 700;
  min-width: 3.8rem;
  font-size: 0.67rem;
  flex-shrink: 0;
}
.dev-score-label { color: var(--text-secondary); }

/* Claude API config chips */
.dev-model-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.dev-model-chip {
  font-family: var(--text-mono);
  font-size: 0.6rem;
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-elevated);
}

/* ================================================================
   DB SCHEMA SECTION
   ================================================================ */
.dev-schema-section { margin-top: 2rem; }

.dev-schema-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.4rem 0 0.8rem;
  border-top: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.dev-schema-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.5rem;
}

/* Table cards */
.dev-table-card {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  overflow: hidden;
}
.dev-table-card.open { border-color: var(--border-bright); }

.dev-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  background: var(--bg-elevated);
  gap: 0.5rem;
  transition: background 0.12s;
}
.dev-table-header:hover { background: var(--bg-card, var(--bg-elevated)); }
.dev-table-card.open .dev-table-header { border-bottom: 1px solid var(--border); }

.dev-table-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.dev-table-arrow {
  font-size: 0.6rem;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 0.75rem;
  text-align: center;
}
.dev-table-name {
  font-family: var(--text-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--cyan);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dev-table-count {
  font-family: var(--text-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.dev-table-body { padding: 0.75rem; }

.dev-table-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.6rem;
}

/* Read/write usage pills */
.dev-usage-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}
.dev-usage-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}
.dev-usage-label {
  font-family: var(--text-mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  min-width: 2.8rem;
}
.dev-usage-pill {
  font-family: var(--text-mono);
  font-size: 0.6rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  line-height: 1.4;
}
.pill-read  { background: rgba(6,182,212,0.1);  color: #06b6d4; border: 1px solid rgba(6,182,212,0.25); }
.pill-write { background: rgba(245,158,11,0.1); color: #f59e0b; border: 1px solid rgba(245,158,11,0.25); }

/* Column table */
.dev-col-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  margin-bottom: 0.5rem;
}
.dev-col-table th {
  font-family: var(--text-mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.dev-col-table td {
  padding: 0.22rem 0.4rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: top;
  line-height: 1.4;
}
.dev-col-table tr:last-child td { border-bottom: none; }
.dev-col-table .col-name {
  font-family: var(--text-mono);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  width: 30%;
}
.dev-col-table .col-type {
  font-family: var(--text-mono);
  color: #a78bfa;
  font-size: 0.65rem;
  white-space: nowrap;
  width: 28%;
}
.dev-col-table .col-notes {
  color: var(--text-muted);
  font-size: 0.68rem;
}

/* Known keys (app_settings) */
.dev-known-keys-label {
  font-family: var(--text-mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0.5rem 0 0.3rem;
}
.dev-known-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.dev-key-chip {
  font-family: var(--text-mono);
  font-size: 0.6rem;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--bg-elevated);
}

/* Prompt blocks */
.dev-prompt-block {
  font-family: var(--text-mono);
  font-size: 0.66rem;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 0.6rem 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  max-height: 220px;
  overflow-y: auto;
  border-left: 2px solid #a78bfa;
}
