/* ═══════════════════════════════════════════════════════════════
   AXIOM Design System — MasterOSINT
   Slate palette · DM Sans/JetBrains Mono · Sidebar layout
   ═══════════════════════════════════════════════════════════════ */

/* ─── VARIABLES ─── */
:root {
  /* NEW canonical variables */
  --bg-primary: #0a0e17;
  --bg-secondary: #0f1520;
  --bg-card: #131a28;
  --bg-card-hover: #182030;
  --bg-elevated: #1a2235;
  --border: rgba(255,255,255,0.06);
  --border-active: rgba(255,255,255,0.12);
  --text-primary: #e8ecf4;
  --text-secondary: #7b8ba3;
  --text-muted-v2: #4a5568;
  --accent: #3b82f6;
  --accent-glow: rgba(59,130,246,0.15);
  --accent-warm: #f59e0b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --purple: #8b5cf6;
  --sidebar-w: 240px;
  --radius: 10px;
  --radius-sm: 6px;

  /* BACKWARD-COMPAT ALIASES */
  --bg-base: var(--bg-primary);
  --bg-surface: var(--bg-card);
  --bg-surface-hover: var(--bg-card-hover);
  --border-subtle: var(--border);
  --border-focus: var(--accent);
  --accent-primary: var(--accent);
  --accent-primary-hover: #2563eb;
  --status-success: #059669;
  --status-success-bg: rgba(5, 150, 105, 0.1);
  --status-warning: #E11D48;
  --status-warning-bg: rgba(225, 29, 72, 0.1);
  --status-attention: #D97706;
  --status-attention-bg: rgba(217, 119, 6, 0.1);
  --status-info: #2563EB;
  --status-info-bg: rgba(37, 99, 235, 0.1);
  --font-ui: 'DM Sans', sans-serif;
  --font-data: 'JetBrains Mono', monospace;
}

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

/* ─── BODY & LAYOUT ─── */
body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.layout-sidebar {
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent-primary); }
a:hover { color: var(--accent-primary-hover); }

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

code { font-family: var(--font-data); font-size: 0.85em; color: #38BDF8; }

.data-text { font-family: var(--font-data); font-size: 0.85rem; color: var(--text-secondary); }
.text-muted, .text-secondary { color: var(--text-secondary) !important; }

/* ─── SIDEBAR ─── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.brand-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.brand-header h1 {
  font-family: var(--font-data);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 3px;
  margin-bottom: 2px;
}
.brand-header span {
  font-size: 10px;
  color: var(--text-muted-v2);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  display: block;
  margin-top: 4px;
}

.nav-menu {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer;
}
.nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
  text-decoration: none;
}
.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
}
.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active svg { opacity: 1; }

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 12px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-footer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted-v2);
}
.sidebar-footer-item .value {
  font-family: var(--font-data);
  color: var(--text-secondary);
  font-size: 11px;
}

.btn-signout {
  margin-top: 4px;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
}
.btn-signout:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(239,68,68,0.05);
}

/* Legacy compat */
.system-status {
  padding: 20px 24px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 6px;
}
.status-dot-green { background-color: var(--status-success); }
.status-dot-amber { background-color: var(--status-attention); }

/* ─── MAIN CONTENT ─── */
.main-content {
  margin-left: var(--sidebar-w);
  padding: 40px 48px;
  min-height: 100vh;
  overflow-y: auto;
}

.view-header {
  margin-bottom: 32px;
}
.view-header h2 {
  font-size: 1.75rem;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

/* ─── CARDS ─── */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  overflow: hidden;
}
.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-body { padding: 24px; }
.card p:last-child { margin-bottom: 0; }

/* ─── TABLES ─── */
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 12px 24px; font-size: 0.9rem; border-bottom: 1px solid var(--border-subtle); }
th { font-weight: 500; color: var(--text-secondary); }
tr:last-child td { border-bottom: none; }
.table-responsive { overflow-x: auto; }

/* Sortable table headers */
.th-sortable a {
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.th-sortable a:hover { color: var(--text-primary); }
.sort-arrow { font-size: 0.75rem; color: var(--accent); }

/* ─── METRICS ─── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}
.metric-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 24px;
  border-radius: var(--radius-sm);
}
.metric-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.metric-value {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ─── BADGES ─── */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  vertical-align: middle;
}
.badge-success { background-color: var(--status-success-bg); color: #34D399; border: 1px solid rgba(5, 150, 105, 0.2); }
.badge-warning { background-color: var(--status-warning-bg); color: #FB7185; border: 1px solid rgba(225, 29, 72, 0.2); }
.badge-attention { background-color: var(--status-attention-bg); color: #FBBF24; border: 1px solid rgba(217, 119, 6, 0.2); }
.badge-neutral { background-color: var(--bg-base); color: var(--text-secondary); border: 1px solid var(--border-subtle); }
.badge-info { background-color: var(--status-info-bg); color: #60A5FA; border: 1px solid rgba(37, 99, 235, 0.2); }
.badge-danger { background-color: var(--status-warning-bg); color: #FB7185; border: 1px solid rgba(225, 29, 72, 0.2); }
.badge-secondary { background-color: var(--bg-base); color: var(--text-secondary); border: 1px solid var(--border-subtle); }
.badge-dark { background-color: rgba(15, 23, 42, 0.8); color: var(--text-secondary); border: 1px solid var(--border-subtle); }
.badge-primary { background-color: var(--status-info-bg); color: #60A5FA; border: 1px solid rgba(37, 99, 235, 0.2); }

/* Finding references in briefs */
.finding-ref {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82em;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
  padding: 0 2px;
}
.finding-ref:hover { color: #60a5fa; border-bottom-style: solid; }

/* ─── BUTTONS ─── */
.btn {
  display: inline-block;
  background-color: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  line-height: 1.5;
  text-align: center;
  vertical-align: middle;
}
.btn:hover { background-color: var(--bg-surface-hover); color: var(--text-primary); text-decoration: none; }
.btn:disabled, .btn.disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background-color: var(--accent-primary); color: #ffffff; border-color: var(--accent-primary); }
.btn-primary:hover { background-color: var(--accent-primary-hover); border-color: var(--accent-primary-hover); color: #fff; }

.btn-success { background-color: var(--status-success); color: #ffffff; border-color: var(--status-success); }
.btn-success:hover { background-color: #047857; border-color: #047857; color: #fff; }

.btn-danger, .btn-warning { border-color: var(--status-warning); color: #FB7185; }
.btn-danger:hover, .btn-warning:hover { background-color: var(--status-warning-bg); }

.btn-attention { border-color: var(--status-attention); color: #FBBF24; }
.btn-attention:hover { background-color: var(--status-attention-bg); }

.btn-info { background-color: var(--status-info-bg); color: #60A5FA; border-color: rgba(37, 99, 235, 0.3); }
.btn-info:hover { background-color: rgba(37, 99, 235, 0.2); }

.btn-sm { padding: 4px 12px; font-size: 0.8rem; }
.btn-xs { padding: 2px 8px; font-size: 0.72rem; }

.btn-outline-secondary { border-color: var(--border-subtle); color: var(--text-secondary); background: transparent; }
.btn-outline-secondary:hover { background-color: var(--bg-surface-hover); color: var(--text-primary); }

.btn-outline-success { border-color: var(--status-success); color: #34D399; background: transparent; }
.btn-outline-success:hover { background-color: var(--status-success-bg); }

.btn-outline-danger { border-color: var(--status-warning); color: #FB7185; background: transparent; }
.btn-outline-danger:hover { background-color: var(--status-warning-bg); }

.btn-outline-warning { border-color: var(--status-attention); color: #FBBF24; background: transparent; }
.btn-outline-warning:hover { background-color: var(--status-attention-bg); }

.btn-outline-info { border-color: rgba(37, 99, 235, 0.3); color: #60A5FA; background: transparent; }
.btn-outline-info:hover { background-color: var(--status-info-bg); }

.btn-outline-light { border-color: var(--border-subtle); color: var(--text-primary); background: transparent; }
.btn-outline-light:hover { background-color: var(--bg-surface-hover); }

.btn-outline-primary { border-color: var(--accent-primary); color: #60A5FA; background: transparent; }
.btn-outline-primary:hover { background-color: var(--status-info-bg); }

/* Custom colored buttons for toggle panels */
.btn-scan-active { background-color: var(--status-success); color: #0F172A; border-color: var(--status-success); }
.btn-relationship-active { background-color: var(--accent-primary); color: #0F172A; border-color: var(--accent-primary); }
.btn-analysis-active { background-color: #A78BFA; color: #0F172A; border-color: #A78BFA; }

/* ─── FORMS ─── */
.form-group { margin-bottom: 24px; }

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-control, .form-select {
  width: 100%;
  background-color: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 14px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  transition: border-color 0.15s;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1px var(--border-focus);
}
.form-control::placeholder { color: #475569; }
.form-control:disabled { opacity: 0.5; cursor: not-allowed; }

/* Autofill override — prevent yellow background in dark theme */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-primary);
  -webkit-box-shadow: 0 0 0px 1000px var(--bg-primary) inset;
  transition: background-color 5000s ease-in-out 0s;
  caret-color: var(--text-primary);
}

.form-control.border-warning { border-color: var(--status-attention); }

.form-select {
  appearance: auto;
  cursor: pointer;
}

.form-control-sm, .form-select-sm {
  padding: 6px 10px;
  font-size: 0.82rem;
}

.form-text {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.form-text.text-warning { color: #FBBF24 !important; }

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.form-check-input {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--accent-primary);
  cursor: pointer;
}
.form-check-label {
  font-size: 0.9rem;
  color: var(--text-primary);
  cursor: pointer;
}

.input-group {
  display: flex;
  align-items: stretch;
}
.input-group .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.input-group-text {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}

.invalid-feedback {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  color: #FB7185;
}
.is-invalid { border-color: var(--status-warning) !important; }

/* ─── SPLIT VIEW ─── */
.split-view { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* ─── PROGRESS ─── */
.progress-container {
  width: 100%;
  background-color: var(--bg-base);
  border-radius: 9999px;
  height: 8px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background-color: var(--accent-primary);
  border-radius: 9999px;
  transition: width 0.3s;
}
.progress-bar-success { background-color: var(--status-success); }
.progress-bar-warning { background-color: var(--status-attention); }
.progress-bar-danger { background-color: var(--status-warning); }

/* ─── GAP ITEMS ─── */
.gap-item {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
}
.gap-item:last-child { border-bottom: none; }
.gap-accent-a { border-left: 3px solid var(--accent); }
.gap-accent-b { border-left: 3px solid var(--purple); }
.gap-accent-c { border-left: 3px solid var(--warning); }
.gap-summary {
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.5;
}
.gap-summary::after { content: ' \25BE'; font-size: 10px; opacity: 0.5; }
.gap-summary-active::after { content: ' \25B4'; }
.gap-full-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease, padding-top 0.2s ease;
}
.gap-full-text.gap-expanded {
  max-height: 200px;
  padding-top: 8px;
}

/* ─── ACTION BAR ─── */
.action-bar {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

/* ─── ALERTS ─── */
.alert {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.9rem;
  border: 1px solid transparent;
  position: relative;
}
.alert-success { background-color: var(--status-success-bg); color: #34D399; border-color: rgba(5, 150, 105, 0.2); }
.alert-warning { background-color: var(--status-attention-bg); color: #FBBF24; border-color: rgba(217, 119, 6, 0.2); }
.alert-danger { background-color: var(--status-warning-bg); color: #FB7185; border-color: rgba(225, 29, 72, 0.2); }
.alert-info { background-color: var(--status-info-bg); color: #60A5FA; border-color: rgba(37, 99, 235, 0.2); }
.alert-secondary { background-color: var(--bg-surface); color: var(--text-secondary); border-color: var(--border-subtle); }

.alert a { color: inherit; text-decoration: underline; }
.alert a:hover { opacity: 0.8; }
.alert .alert-link { color: inherit; font-weight: 600; }

.alert-dismissible { padding-right: 48px; }
.alert-dismissible .btn-close {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: inherit;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.7;
  padding: 4px;
  line-height: 1;
}
.alert-dismissible .btn-close:hover { opacity: 1; }
.alert-dismissible .btn-close::after { content: '\00D7'; }

/* ─── DROPDOWN (vanilla CSS) ─── */
.dropdown { position: relative; display: inline-block; }
.dropdown-toggle::after {
  content: '';
  display: inline-block;
  margin-left: 6px;
  vertical-align: 2px;
  border-top: 4px solid;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
}
.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  min-width: 160px;
  z-index: 1000;
  padding: 4px 0;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 16px;
  font-size: 0.85rem;
  color: var(--text-primary);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
}
.dropdown-item:hover { background-color: var(--bg-surface-hover); }
.dropdown-divider {
  height: 0;
  margin: 4px 0;
  border: 0;
  border-top: 1px solid var(--border-subtle);
}

/* ─── JSON BLOCK ─── */
pre.json-block {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1rem;
  color: #34D399;
  font-family: var(--font-data);
  font-size: 0.85rem;
  max-height: 60vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ─── TOGGLE PANEL CARDS ─── */
.toggle-panel-scan { border-left: 3px solid var(--status-success); }
.toggle-panel-scan-off { border-left: 3px solid var(--text-secondary); }
.toggle-panel-relationship { border-left: 3px solid var(--accent-primary); }
.toggle-panel-relationship-off { border-left: 3px solid var(--text-secondary); }
.toggle-panel-analysis { border-left: 3px solid #A78BFA; }
.toggle-panel-analysis-off { border-left: 3px solid var(--text-secondary); }
.toggle-panel-investigate { border-left: 3px solid var(--status-success); }
.toggle-panel-investigate-off { border-left: 3px solid var(--text-secondary); }
.toggle-panel-tasks { border-left: 3px solid var(--accent-primary); }
.toggle-panel-subprojects { border-left: 3px solid #F59E0B; }
.toggle-panel-goal { border-left: 3px solid var(--accent-primary); }

/* ─── AUTH PAGE ─── */
.auth-page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--bg-base);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 40px;
}
.auth-card .brand {
  text-align: center;
  margin-bottom: 32px;
}
.auth-card .brand h1 {
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.auth-card .brand span {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─── BRIEF CONTAINER (light theme, preserved) ─── */
.brief-container {
  background: #f8f9fa;
  color: #1a1a2e;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3rem 3.5rem;
  font-family: "Times New Roman", Georgia, serif;
  line-height: 1.7;
  max-width: 850px;
  margin: 0 auto;
}
.brief-container h1 {
  font-size: 1.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  border-bottom: 3px double #1a1a2e;
  padding-bottom: .6rem;
  margin-bottom: 1.5rem;
  color: #0d1117;
}
.brief-container h2 {
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #1a1a2e;
  margin-top: 2rem;
  margin-bottom: .75rem;
  border-bottom: 1px solid #c0c0c0;
  padding-bottom: .3rem;
}
.brief-container h3 { font-size: 1rem; font-weight: 700; color: #333; margin-top: 1.5rem; }
.brief-container p { text-align: justify; margin-bottom: .8rem; }
.brief-container ul, .brief-container ol { margin-left: 1.2rem; margin-bottom: 1rem; }
.brief-container li { margin-bottom: .4rem; }
.brief-container table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .9rem; }
.brief-container th {
  background: #e2e3e5;
  font-weight: 700;
  text-transform: uppercase;
  font-size: .75rem;
  letter-spacing: .04em;
  padding: .5rem .75rem;
  border: 1px solid #c0c0c0;
  color: #333;
}
.brief-container td { padding: .45rem .75rem; border: 1px solid #d0d0d0; vertical-align: top; color: #333; }
.brief-container tr:nth-child(even) td { background: #f0f0f2; }
.brief-header { text-align: center; margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 3px double #1a1a2e; }
.brief-header .classification { font-size: .85rem; font-weight: 700; letter-spacing: .12em; color: #b22222; margin-bottom: .5rem; }
.brief-header .project-name { font-size: 1.3rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #333; }
.brief-header .date-line { font-size: .85rem; color: #555; margin-top: .3rem; }

/* ─── SPINNER ─── */
.spinner-border {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.spinner-border-sm { width: 0.8rem; height: 0.8rem; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── UTILITY LAYER ─── */
.d-flex { display: flex; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-none { display: none; }
.d-block { display: block; }
.flex-wrap { flex-wrap: wrap; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-grow-1 { flex-grow: 1; }
.flex-column { flex-direction: column; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.justify-content-end { justify-content: flex-end; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.align-items-end { align-items: flex-end; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-auto { margin-top: auto; }
.ms-1 { margin-left: 4px; }
.ms-2 { margin-left: 8px; }
.ms-auto { margin-left: auto; }
.me-1 { margin-right: 4px; }
.me-2 { margin-right: 8px; }
.mx-1 { margin-left: 4px; margin-right: 4px; }
.p-0 { padding: 0; }
.p-2 { padding: 8px; }
.p-3 { padding: 16px; }
.p-4 { padding: 24px; }
.pb-0 { padding-bottom: 0; }
.px-1 { padding-left: 4px; padding-right: 4px; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.px-4 { padding-left: 24px; padding-right: 24px; }
.py-0 { padding-top: 0; padding-bottom: 0; }
.py-1 { padding-top: 4px; padding-bottom: 4px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.text-center { text-align: center; }
.text-end { text-align: right; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-nowrap { white-space: nowrap; }
.text-decoration-none { text-decoration: none; }
.text-decoration-none:hover { text-decoration: none; }
.text-success { color: #34D399 !important; }
.text-danger { color: #FB7185 !important; }
.text-warning { color: #FBBF24 !important; }
.text-info { color: #60A5FA !important; }
.text-light { color: var(--text-primary) !important; }
.small { font-size: 0.85rem; }
.fw-bold { font-weight: 600; }
.fw-normal { font-weight: 400; }
.w-100 { width: 100%; }
.h-100 { height: 100%; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* optgroup styling */
optgroup { font-weight: 600; color: var(--text-secondary); }
option { font-weight: 400; color: var(--text-primary); }

/* ─── TOPBAR ─── */
.topbar {
  position: relative;
  background: rgba(10,14,23,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -40px -48px 24px;
  width: calc(100% + 96px);
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-left h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 0;
}
.topbar-meta {
  font-size: 12px;
  color: var(--text-muted-v2);
  font-family: var(--font-data);
}
.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.topbar .btn svg { width: 14px; height: 14px; }

/* ─── MISSION BANNER ─── */
.mission-banner {
  background: linear-gradient(135deg, rgba(59,130,246,0.08) 0%, rgba(139,92,246,0.06) 100%);
  border: 1px solid rgba(59,130,246,0.12);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  animation: fadeSlideIn 0.5s ease;
}
.mission-banner::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--purple));
  border-radius: 3px 0 0 3px;
}
.mission-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.mission-label svg { width: 14px; height: 14px; }
.mission-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 900px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.mission-text.expanded {
  max-height: 2000px;
}
.mission-details {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.04);
}
.mission-details.open { display: block; }
.mission-detail-item {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 0 4px 16px;
  position: relative;
  line-height: 1.5;
}
.mission-detail-item::before {
  content: '';
  position: absolute;
  left: 0; top: 11px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.5;
}
.mission-toggle {
  margin-top: 10px;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-ui);
  cursor: pointer;
  padding: 0;
  opacity: 0.8;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.mission-toggle:hover { opacity: 1; }
.mission-toggle-icon { width: 14px; height: 14px; transition: transform 0.2s; }

/* ─── CERTAINTY RING + STATS ─── */
.top-row {
  display: grid;
  grid-template-columns: 5fr minmax(0, 280px) 4fr;
  gap: 20px;
  margin-bottom: 24px;
  align-items: stretch;
  animation: fadeSlideIn 0.5s ease 0.1s both;
}

/* ─── DASHBOARD ─── */
.top-row-dash {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 20px;
  margin-bottom: 24px;
  align-items: stretch;
  animation: fadeSlideIn 0.5s ease 0.1s both;
}
.dash-projects {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
  animation: fadeSlideIn 0.5s ease 0.2s both;
}
.dash-project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s;
}
.dash-project-card:hover { border-color: var(--border-active); }
.dash-project-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}
.dash-project-name:hover { color: var(--accent); }
.dash-project-goal {
  font-size: 12px;
  color: var(--text-muted-v2);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-project-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted-v2);
}
.dash-project-meta .data-val {
  font-family: var(--font-data);
  color: var(--text-secondary);
  font-weight: 600;
}
.dash-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  animation: fadeSlideIn 0.5s ease 0.3s both;
}
.dash-section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}
@media (max-width: 1100px) {
  .top-row-dash { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .top-row-dash { grid-template-columns: 1fr; }
  .dash-projects { grid-template-columns: 1fr; }
}

/* ─── INVESTIGATION PANEL (DASHBOARD) ─── */
.inv-panel { margin-bottom: 24px; }
.inv-rows {
  max-height: 500px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(148,163,184,0.3) transparent;
}

/* Row */
.inv-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  min-height: 72px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background 150ms ease;
  cursor: pointer;
}
.inv-row:last-child { border-bottom: none; }
.inv-row:hover { background: var(--bg-card-hover); }

/* Staleness left border + tint */
.inv-stale-green { border-left: 4px solid var(--success); }
.inv-stale-blue  { border-left: 4px solid var(--accent); }
.inv-stale-amber {
  border-left: 4px solid var(--warning);
  background: rgba(245,158,11,0.02);
}
.inv-stale-red {
  border-left: 4px solid var(--danger);
  background: rgba(239,68,68,0.02);
}
.inv-stale-amber:hover { background: rgba(245,158,11,0.05); }
.inv-stale-red:hover   { background: rgba(239,68,68,0.05); }

/* Status column */
.inv-status {
  flex: 0 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.inv-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.inv-dot-green { background: var(--success); }
.inv-dot-blue  { background: var(--accent); }
.inv-dot-pulse { animation: pulse 2s ease-in-out infinite; }
.inv-icon      { display: block; }
.inv-icon-red  { color: var(--danger); }
.inv-icon-amber { color: var(--warning); }

/* Title column */
.inv-title-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.inv-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.inv-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inv-row:hover .inv-name { color: var(--accent); }
.inv-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.inv-tag {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 9999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
  line-height: 1.6;
}

/* Stats cluster */
.inv-stats {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted-v2);
  white-space: nowrap;
}
.inv-stat-val {
  font-family: var(--font-data);
  color: var(--text-secondary);
  font-weight: 600;
}
.inv-stat-detail { font-size: 11px; }
.inv-stat-done { color: var(--success); }
.inv-sep { color: var(--border-active); font-size: 10px; }
.inv-time { font-family: var(--font-data); }
.inv-time-3 { color: var(--success); }
.inv-time-2 { color: var(--text-secondary); }
.inv-time-1 { color: var(--warning); }
.inv-time-0 { color: var(--danger); }

/* Progress column */
.inv-progress-col {
  flex: 0 0 160px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.inv-progress-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
}
.inv-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 300ms ease;
}
.inv-progress-high { background: var(--success); }
.inv-progress-complete { background: var(--success); }
.inv-progress-indeterminate {
  width: 40%;
  animation: inv-indeterminate 1.5s ease-in-out infinite;
}
@keyframes inv-indeterminate {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}
.inv-progress-label {
  font-size: 10px;
  color: var(--text-muted-v2);
  font-family: var(--font-data);
}
.inv-progress-done {
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Actions column */
.inv-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
}

/* Investigation panel responsive */
@media (max-width: 1100px) {
  .inv-stats { display: none; }
  .inv-progress-col { flex: 0 0 120px; }
}
@media (max-width: 900px) {
  .inv-row {
    flex-wrap: wrap;
    min-height: auto;
    padding: 12px 16px;
    gap: 8px;
  }
  .inv-status { flex: 0 0 20px; }
  .inv-title-col { flex: 1 1 calc(100% - 40px); }
  .inv-stats { display: flex; flex: 1 1 100%; order: 10; padding-left: 28px; }
  .inv-progress-col { flex: 1 1 100%; order: 11; padding-left: 28px; }
  .inv-actions { flex: 0 0 auto; order: 12; padding-left: 28px; }
}

.certainty-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.certainty-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: radial-gradient(circle at 50% 30%, rgba(59,130,246,0.06), transparent 70%);
  pointer-events: none;
}
.certainty-card-wide .certainty-top {
  display: flex;
  gap: 24px;
  align-items: center;
  width: 100%;
}
.certainty-card-wide .certainty-ring-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}
.certainty-chart-col {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}
.certainty-chart-label {
  font-size: 10px;
  color: var(--text-muted-v2);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  margin-bottom: 6px;
}
#certaintyChart {
  width: 100%;
  height: 100px;
  display: block;
}
.certainty-ring {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 12px;
}
.certainty-ring svg {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);
}
.certainty-ring .bg-ring {
  fill: none;
  stroke: rgba(255,255,255,0.05);
  stroke-width: 8;
}
.certainty-ring .fg-ring {
  fill: none;
  stroke: url(#scoreGradient);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.4,0,0.2,1);
}
.certainty-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.certainty-value .number {
  font-family: var(--font-data);
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.certainty-value .of {
  font-size: 11px;
  color: var(--text-muted-v2);
  margin-top: 2px;
}
.certainty-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}
.certainty-change {
  font-size: 11px;
  color: var(--success);
  margin-top: 4px;
  font-family: var(--font-data);
}

/* Stats bar (single card) */
.stats-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.stats-bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.stats-bar-value {
  font-family: var(--font-data);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.stats-bar-label {
  font-size: 10px;
  color: var(--text-muted-v2);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  white-space: nowrap;
}
.stats-bar-divider {
  width: 1px;
  height: 32px;
  background: var(--border);
  flex-shrink: 0;
}
.stats-bar-vertical {
  flex-direction: column;
  padding: 16px 20px;
  gap: 12px;
}
.stats-bar-vertical .stats-bar-item {
  flex-direction: row;
  gap: 10px;
}
.stats-bar-vertical .stats-bar-value {
  font-size: 18px;
  min-width: 32px;
  text-align: right;
}
.stats-bar-vertical .stats-bar-divider {
  width: 100%;
  height: 1px;
}

/* Stats column (project detail — two-tier) */
.stats-column {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.stats-primary {
  display: flex;
  align-items: center;
  gap: 20px;
}
.stats-primary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.stats-primary-value {
  font-family: var(--font-data);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.stats-primary-label {
  font-size: 10px;
  color: var(--text-muted-v2);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}
.stats-primary-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
  flex-shrink: 0;
}
.stats-secondary {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted-v2);
  flex-wrap: wrap;
  justify-content: center;
}
.stats-secondary-value {
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Legacy stat classes (kept for other pages) */
.stat-label {
  font-size: 11px;
  color: var(--text-muted-v2);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 8px;
}
.stat-value {
  font-family: var(--font-data);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.stat-value.accent { color: var(--accent); }
.stat-sub {
  font-size: 11px;
  color: var(--text-muted-v2);
  margin-top: 6px;
}

/* ─── PANELS (briefs) ─── */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-header {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.panel-title {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-title .count {
  background: rgba(59,130,246,0.12);
  color: var(--accent);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--font-data);
}
.panel-link {
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.panel-link:hover { opacity: 1; color: var(--accent); }

/* Collapsible panel */
.panel-chevron {
  transition: transform 150ms ease;
  flex-shrink: 0;
}
.panel-chevron.chevron-open {
  transform: rotate(90deg);
}
.panel-collapsible {
  max-height: 1000px;
  overflow: hidden;
  transition: max-height 250ms ease;
}
.panel-collapsible.collapsed {
  max-height: 0;
}

/* Briefs table */
.briefs-table { width: 100%; border-collapse: collapse; }
.briefs-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted-v2);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
}
.briefs-table td {
  padding: 14px 22px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.briefs-table tr:last-child td { border-bottom: none; }
.briefs-table tr:hover td { background: rgba(255,255,255,0.015); }
.version-tag {
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
  padding: 3px 10px;
  border-radius: 4px;
}
.version-tag.latest {
  background: rgba(59,130,246,0.1);
  color: var(--accent);
}
.certainty-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
}
.certainty-badge.high { background: rgba(16,185,129,0.1); color: var(--success); }
.certainty-badge.medium { background: rgba(245,158,11,0.1); color: var(--warning); }
.certainty-badge.low { background: rgba(239,68,68,0.1); color: var(--danger); }
.btn-read {
  font-size: 12px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 500;
  opacity: 0.7;
  transition: opacity 0.15s;
  text-decoration: none;
}
.btn-read:hover { opacity: 1; color: var(--accent); }

/* ─── CONTROL CARD (investigation engine) ─── */
.control-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.control-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.control-card-title {
  font-size: 13px;
  font-weight: 600;
}
.status-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 10px;
}
.status-badge.off {
  background: rgba(255,255,255,0.05);
  color: var(--text-muted-v2);
}
.status-badge.running {
  background: rgba(16,185,129,0.1);
  color: var(--success);
  animation: pulse 2s infinite;
}
.control-desc {
  font-size: 12px;
  color: var(--text-muted-v2);
  margin-bottom: 16px;
  line-height: 1.5;
}
.control-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
.control-group { flex: 1; }
.control-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted-v2);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
.control-select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 12px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%237b8ba3' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.control-select:focus {
  outline: none;
  border-color: var(--accent);
}
.checkbox-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}
.checkbox-item input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--border-active);
  border-radius: 3px;
  background: var(--bg-elevated);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.checkbox-item input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox-item input[type="checkbox"]:checked::after {
  content: '\2713';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #fff;
  font-weight: bold;
}
.btn-start {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-start:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 20px rgba(59,130,246,0.3);
}
.btn-start svg { width: 16px; height: 16px; }
.search-terms-link {
  text-align: center;
  margin-top: 8px;
}
.search-terms-link a {
  font-size: 12px;
  color: var(--text-muted-v2);
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.1);
  cursor: pointer;
  transition: color 0.15s;
}
.search-terms-link a:hover { color: var(--text-secondary); }

/* ─── BRIEF SUMMARY CARD ─── */
.brief-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.brief-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.brief-summary-title {
  font-size: 13px;
  font-weight: 600;
}
.brief-summary-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-height: 80px;
  overflow: hidden;
  position: relative;
}
.brief-summary-text::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 30px;
  background: linear-gradient(transparent, var(--bg-card));
}
.brief-read-more {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-ui);
  opacity: 0.8;
  text-decoration: none;
}
.brief-read-more:hover { opacity: 1; color: var(--accent); }

/* ─── TWO-COL LAYOUT ─── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  animation: fadeSlideIn 0.5s ease 0.2s both;
}

/* Project detail content area */
.detail-content {
  padding: 28px 32px 48px;
  max-width: 1280px;
}

/* ─── ANIMATIONS ─── */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

/* ─── RELATIONSHIP TYPE HEADERS ─── */
.rel-type-header td {
  background: transparent;
  border-bottom: none;
  padding-top: 14px;
  padding-bottom: 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted-v2);
}
.rel-type-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.rel-type-dot-a { background: var(--accent); }
.rel-type-dot-b { background: var(--purple); }
.rel-type-dot-c { background: var(--success); }
.rel-type-dot-d { background: var(--warning); }
.rel-type-dot-e { background: var(--danger); }

/* ─── OBJECT TOOLBAR + TYPE BADGES ─── */
.obj-toolbar {
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}
.obj-type-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.obj-type-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.obj-type-pill:hover { border-color: var(--border-active); color: var(--text-primary); }
.obj-type-pill.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 8px rgba(59,130,246,0.15);
}
.obj-type-count {
  font-family: var(--font-data);
  font-size: 10px;
  opacity: 0.6;
}
.obj-type-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.obj-search {
  width: 160px;
  padding: 5px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 12px;
}
.obj-search:focus { outline: none; border-color: var(--accent); }
.obj-search::placeholder { color: var(--text-muted-v2); }

/* Entity type colors */
.obj-type-dot-person, .obj-type-badge-person { background: rgba(16,185,129,0.15); color: #34D399; border-color: rgba(16,185,129,0.25); }
.obj-type-dot-person { background: #34D399; }
.obj-type-dot-company, .obj-type-badge-company { background: rgba(59,130,246,0.15); color: #60A5FA; border-color: rgba(59,130,246,0.25); }
.obj-type-dot-company { background: #60A5FA; }
.obj-type-dot-organization, .obj-type-badge-organization { background: rgba(139,92,246,0.15); color: #a78bfa; border-color: rgba(139,92,246,0.25); }
.obj-type-dot-organization { background: #a78bfa; }
.obj-type-dot-domain, .obj-type-badge-domain { background: rgba(245,158,11,0.15); color: #FBBF24; border-color: rgba(245,158,11,0.25); }
.obj-type-dot-domain { background: #FBBF24; }
.obj-type-dot-ip_address, .obj-type-badge-ip_address { background: rgba(239,68,68,0.15); color: #f87171; border-color: rgba(239,68,68,0.25); }
.obj-type-dot-ip_address { background: #f87171; }
.obj-type-dot-email, .obj-type-badge-email { background: rgba(6,182,212,0.15); color: #22d3ee; border-color: rgba(6,182,212,0.25); }
.obj-type-dot-email { background: #22d3ee; }
.obj-type-dot-handle, .obj-type-badge-handle { background: rgba(167,139,250,0.15); color: #c4b5fd; border-color: rgba(167,139,250,0.25); }
.obj-type-dot-handle { background: #c4b5fd; }
.obj-type-dot-phone, .obj-type-badge-phone { background: rgba(148,163,184,0.15); color: #94a3b8; border-color: rgba(148,163,184,0.25); }
.obj-type-dot-phone { background: #94a3b8; }
.obj-type-dot-media, .obj-type-badge-media { background: rgba(236,72,153,0.15); color: #f472b6; border-color: rgba(236,72,153,0.25); }
.obj-type-dot-media { background: #f472b6; }
.obj-type-dot-location, .obj-type-badge-location { background: rgba(20,184,166,0.15); color: #2dd4bf; border-color: rgba(20,184,166,0.25); }
.obj-type-dot-location { background: #2dd4bf; }
.obj-type-dot-event, .obj-type-badge-event { background: rgba(234,179,8,0.15); color: #facc15; border-color: rgba(234,179,8,0.25); }
.obj-type-dot-event { background: #facc15; }
.obj-type-dot-financial, .obj-type-badge-financial { background: rgba(245,158,11,0.15); color: #f59e0b; border-color: rgba(245,158,11,0.25); }
.obj-type-dot-financial { background: #f59e0b; }
.obj-type-dot-other, .obj-type-badge-other { background: rgba(148,163,184,0.1); color: var(--text-secondary); border-color: rgba(148,163,184,0.2); }
.obj-type-dot-other { background: var(--text-secondary); }

/* Ensure type badges inherit badge base */
[class*="obj-type-badge-"] {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  border: 1px solid;
}

/* ─── PRINT ─── */
@media print {
  .sidebar, .no-print, .nav-menu, .system-status, .brand-header, .topbar, .sidebar-footer { display: none !important; }
  body { background: #fff !important; color: #111 !important; }
  body.layout-sidebar { display: block; height: auto; overflow: visible; }
  .main-content { margin-left: 0; padding: 0; overflow: visible; }
  .brief-container { border: none !important; box-shadow: none !important; max-width: 100% !important; }
}

/* ─── FORM RANGE (sliders) ─── */
.form-range {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--border-subtle);
  border-radius: 3px;
  outline: none;
}
.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent-primary);
  border-radius: 50%;
  cursor: pointer;
}

/* ─── STATS CARD ─── */
.sc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: background 0.15s, border-color 0.15s;
}
.sc-card:hover {}
.sc-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.sc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.sc-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.sc-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}
.sc-icon-entities { color: #2dd4bf; }
.sc-icon-rels { color: #3b82f6; }
.sc-icon-spend { color: #fbbf24; }

.sc-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 48px;
}

.sc-value {
  font-family: var(--font-data);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}
.sc-value-entities { color: #2dd4bf; }
.sc-value-rels { color: #3b82f6; }
.sc-value-spend { color: #fbbf24; }

.sc-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  color: var(--text-muted-v2);
}

.sc-spark-wrap {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.sc-spark {
  width: 120px;
  height: 32px;
  display: block;
}

.sc-delta {
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.sc-delta-up {
  color: #34d399;
  background: rgba(52, 211, 153, 0.1);
}
.sc-delta-down {
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
}
.sc-delta-zero {
  color: var(--text-muted-v2);
  background: rgba(255, 255, 255, 0.04);
}

.sc-divider {
  height: 1px;
  background: rgba(51, 65, 85, 0.5);
  margin: 4px 0;
}

.sc-footer {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding-top: 4px;
}

.sc-foot-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  padding: 8px 4px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
  text-decoration: none;
}
.sc-foot-chip-link {
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.sc-foot-chip-link:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.2);
}

.sc-foot-val {
  font-family: var(--font-data);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}
.sc-foot-val-terms { color: var(--text-secondary); }
.sc-foot-val-filtered { color: #f97316; }
.sc-foot-val-sub { color: #3b82f6; }

.sc-foot-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted-v2);
  margin-top: 4px;
}

.sc-tooltip {
  position: absolute;
  top: -28px;
  right: 0;
  background: #0f172a;
  color: #94a3b8;
  font-size: 10px;
  font-family: var(--font-data);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(51, 65, 85, 0.5);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}
.sc-tooltip-show {
  opacity: 1;
}

/* ─── RELATIONSHIP GRAPH HERO ─── */
.rg-panel {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid rgba(71, 85, 105, 0.6);
  border-radius: 12px;
  height: 360px;
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.rg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.rg-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px 24px;
  background: linear-gradient(to bottom, var(--bg-surface) 40%, transparent);
  z-index: 2;
  pointer-events: none;
}
.rg-header > * { pointer-events: auto; }
.rg-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}
.rg-count {
  background: rgba(59,130,246,0.12);
  color: var(--accent-blue);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--font-data);
  margin-left: 6px;
}
.rg-fullview {
  font-size: 11px;
  color: var(--accent-blue);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.rg-fullview:hover { opacity: 1; }
.rg-footer {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 18px 10px;
  background: linear-gradient(to top, var(--bg-surface) 40%, transparent);
  z-index: 2;
  pointer-events: none;
}
.rg-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 10px;
  color: var(--text-secondary);
}
.rg-legend > span {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.rg-legend-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  flex-shrink: 0;
}
.rg-stats {
  font-size: 10px;
  font-family: var(--font-data);
  color: var(--text-secondary);
  opacity: 0.7;
}
.rg-tooltip {
  position: absolute;
  background: #0f172a;
  border: 1px solid rgba(51,65,85,0.6);
  border-radius: 6px;
  padding: 6px 10px;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  max-width: 220px;
}
.rg-tooltip-show { opacity: 1; }
.rg-tooltip-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rg-tooltip-meta {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ─── Graph popup (click detail card) ─── */
.rg-popup {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 260px;
  max-height: 330px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 14px;
  z-index: 20;
  display: none;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}
.rg-popup-show { display: flex; }
.rg-popup-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.rg-popup-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.rg-popup-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}
.rg-popup-close:hover { color: var(--text-primary); }
.rg-popup-type {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 500;
  align-self: flex-start;
}
.rg-popup-connections {
  overflow-y: auto;
  max-height: 180px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148,163,184,0.3) transparent;
}
.rg-popup-rel-group {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 4px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border-subtle);
}
.rg-popup-rel-group:first-child { margin-top: 0; }
.rg-popup-rel-item {
  font-size: 11px;
  color: var(--text-primary);
  padding: 2px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rg-popup-rel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rg-popup-rel-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.rg-popup-rel-conf {
  font-size: 9px;
  font-family: var(--font-data);
  color: var(--text-secondary);
  flex-shrink: 0;
}
.rg-popup-link {
  font-size: 11px;
  color: var(--accent-blue);
  text-decoration: none;
  padding-top: 4px;
  border-top: 1px solid var(--border-subtle);
}
.rg-popup-link:hover { text-decoration: underline; }

.rg-mobile-fallback {
  display: none !important;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--text-secondary);
}
.rg-mobile-fallback a {
  color: var(--accent-blue);
  text-decoration: none;
  font-size: 12px;
}

@media (max-width: 1200px) {
  .rg-panel { height: 300px; }
  .rg-popup { max-height: 260px; }
  .rg-popup-connections { max-height: 120px; }
}
@media (max-width: 900px) {
  .rg-panel { display: none !important; }
  .rg-mobile-fallback { display: flex !important; }
}

/* ─── INVESTIGATION CREATOR ─── */

/* Two-column layout */
.nf-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 32px;
  align-items: start;
}
.nf-main {
  position: relative;
  padding-left: 44px;
}

/* Step progress indicator */
.nf-steps {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 20px;
  padding-top: 28px;
  gap: 0;
}
.nf-step { position: relative; display: flex; align-items: center; justify-content: center; }
.nf-step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-active);
  display: block;
  transition: background 0.3s, box-shadow 0.3s;
}
.nf-step-line {
  width: 2px;
  height: 100%;
  background: var(--border);
  display: block;
}
.nf-step-active .nf-step-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
.nf-step-done .nf-step-dot {
  background: var(--success);
}

/* Section cards */
.nf-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
  transition: opacity 0.3s, filter 0.3s;
  animation: nfFadeSlideIn 0.5s ease both;
}
.nf-section:nth-child(3) { animation-delay: 0.1s; }
.nf-section:nth-child(4) { animation-delay: 0.2s; }

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

.nf-section-locked {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(0.4);
}

.nf-section-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.nf-section-num {
  font-family: var(--font-data);
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.05em;
}
.nf-section-title {
  font-weight: 600;
  font-size: 0.95rem;
}
.nf-section-body { padding: 24px; }

/* Section 2: Goal prominence */
.nf-section-goal {
  border-left: 4px solid var(--accent);
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(59,130,246,0.03) 100%);
}

/* Goal textarea */
.nf-goal-textarea {
  min-height: 160px;
  line-height: 1.7;
}

/* Refine button — purple accent */
.nf-btn-refine {
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #a78bfa;
  padding: 10px 24px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nf-btn-refine:hover {
  background: rgba(139, 92, 246, 0.22);
  color: #c4b5fd;
}
.nf-btn-refine:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Goal helper */
.nf-goal-helper {
  background: rgba(59, 130, 246, 0.04);
  border: 1px solid rgba(59, 130, 246, 0.08);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.nf-goal-helper strong { color: var(--text-primary); font-size: 0.82rem; }
.nf-goal-helper ul { padding-left: 18px; margin: 8px 0 0; }
.nf-goal-helper li { margin-bottom: 4px; }

/* Tag input */
.nf-tag-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  min-height: 42px;
  cursor: text;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.nf-tag-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.nf-tag-pills { display: contents; }
.nf-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 9999px;
  font-size: 0.8rem;
  color: #93c5fd;
  white-space: nowrap;
}
.nf-tag-remove {
  cursor: pointer;
  opacity: 0.6;
  font-size: 14px;
  line-height: 1;
  margin-left: 2px;
}
.nf-tag-remove:hover { opacity: 1; }
.nf-tag-field {
  flex: 1;
  min-width: 100px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  outline: none;
  padding: 4px 0;
}
.nf-tag-field::placeholder { color: var(--text-muted-v2); }

/* Review card */
.nf-review-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 20px;
}
.nf-review-row {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.nf-review-row:last-child { border-bottom: none; }
.nf-review-label {
  flex: 0 0 80px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.8rem;
}
.nf-review-value {
  flex: 1;
  color: var(--text-primary);
  word-break: break-word;
}
.nf-review-tag {
  display: inline-block;
  padding: 1px 8px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 9999px;
  font-size: 0.75rem;
  color: #93c5fd;
  margin-right: 4px;
  margin-bottom: 2px;
}
.nf-review-note {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* Launch button */
.nf-btn-launch {
  width: 100%;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: box-shadow 0.2s, opacity 0.2s;
}
.nf-btn-launch:hover:not(:disabled) {
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}
.nf-btn-launch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Context panel */
.nf-context {
  position: sticky;
  top: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  animation: nfFadeSlideIn 0.5s ease 0.3s both;
}
.nf-ctx-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.nf-ctx-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Template cards */
.nf-template-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 0.85rem;
}
.nf-template-card:hover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.05);
}
.nf-tpl-icon { font-size: 1.3rem; flex-shrink: 0; line-height: 1.2; }
.nf-tpl-name { font-weight: 600; font-size: 0.85rem; }
.nf-tpl-desc {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Quality checklist */
.nf-checklist { margin-top: 8px; }
.nf-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: color 0.2s;
}
.nf-check-item:last-child { border-bottom: none; }
.nf-check-icon {
  font-size: 1rem;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  transition: color 0.2s;
}
.nf-check-pass .nf-check-icon { color: var(--success); }
.nf-check-pass { color: var(--text-primary); }

/* Timeline */
.nf-timeline { padding-left: 20px; border-left: 2px solid var(--border); margin-top: 8px; }
.nf-tl-item {
  position: relative;
  padding: 0 0 20px 16px;
  font-size: 0.85rem;
}
.nf-tl-item:last-child { padding-bottom: 0; }
.nf-tl-dot {
  position: absolute;
  left: -25px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.nf-tl-item p {
  color: var(--text-secondary);
  font-size: 0.78rem;
  margin-top: 2px;
}
.nf-tl-item strong { font-weight: 600; }

/* Responsive */
@media (max-width: 1100px) {
  .nf-layout {
    grid-template-columns: 1fr;
  }
  .nf-context {
    position: static;
    order: -1;
  }
}

/* ─── SETTINGS PAGE ─── */
.st-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  align-items: start;
}
.st-nav {
  position: sticky;
  top: 40px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
}
.st-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
  position: relative;
}
.st-nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
  text-decoration: none;
}
.st-nav-item.st-nav-active {
  background: var(--accent-glow);
  color: var(--accent);
}
.st-nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.7; }
.st-nav-item.st-nav-active svg { opacity: 1; }

.st-nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-warm, #FBBF24);
  margin-left: auto;
  display: none;
}
.st-nav-item.st-nav-dirty .st-nav-dot { display: block; }

.st-content { max-width: 720px; }

.st-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
  margin-bottom: 24px;
  animation: nfFadeSlideIn 0.5s ease both;
}
.st-section:nth-child(2) { animation-delay: 0.06s; }
.st-section:nth-child(3) { animation-delay: 0.12s; }
.st-section:nth-child(4) { animation-delay: 0.18s; }
.st-section:nth-child(5) { animation-delay: 0.24s; }

.st-section-head { margin-bottom: 24px; }
.st-section-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; }
.st-section-desc { font-size: 0.82rem; color: var(--text-secondary); }

.st-field {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.st-field:last-of-type { border-bottom: none; }
.st-field-label { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.st-field-hint {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}
.st-field-hint a { color: var(--accent); }

/* Status badges */
.st-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 9999px;
}
.st-status-ok {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.st-status-warn {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.2);
}
.st-status-none {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.st-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.st-status-ok .st-status-dot { background: #34d399; }
.st-status-warn .st-status-dot { background: #fbbf24; }
.st-status-none .st-status-dot { background: var(--text-secondary); }

/* Password show/hide toggle */
.st-pw-wrap { position: relative; }
.st-pw-wrap .form-control { padding-right: 44px; }
.st-pw-toggle {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: color 0.15s;
}
.st-pw-toggle:hover { color: var(--text-primary); }
.st-pw-toggle svg { width: 16px; height: 16px; }

/* Password checklist */
.st-pw-check { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.st-pw-rule {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  transition: color 0.2s;
}
.st-pw-rule.st-pw-pass { color: #34d399; }
.st-pw-rule-icon { width: 14px; text-align: center; flex-shrink: 0; }

/* Danger links */
.st-danger-link {
  background: none;
  border: none;
  color: var(--danger, #F87171);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.st-danger-link:hover { opacity: 1; }

/* Integration cards */
.st-integ-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}
.st-integ-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.st-integ-title {
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.st-integ-title svg { width: 18px; height: 18px; opacity: 0.7; }
.st-integ-coming {
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

/* Account info footer */
.st-account-info {
  margin: 20px -28px 0;
  padding: 20px 28px 0;
  border-top: 1px solid var(--border);
}
.st-info-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.82rem;
}
.st-info-label { color: var(--text-secondary); }
.st-info-value {
  color: var(--text-primary);
  font-family: var(--font-data);
  font-size: 0.8rem;
}

/* Inline toast */
.st-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 200;
  transform: translateY(20px);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.st-toast.st-toast-show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.st-toast-success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.st-toast-error {
  background: rgba(239, 68, 68, 0.15);
  color: #fb7185;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Disabled field */
.st-disabled .form-control {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(255,255,255,0.02);
}

/* Save row */
.st-save-row {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Responsive: <900px — nav becomes horizontal tabs, fields stack */
@media (max-width: 900px) {
  .st-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .st-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    gap: 0;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    scrollbar-width: none;
  }
  .st-nav::-webkit-scrollbar { display: none; }
  .st-nav-item {
    white-space: nowrap;
    padding: 8px 16px;
    border-radius: 9999px;
    font-size: 0.8rem;
  }
  .st-field {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* ─── MISC ─── */
.border { border: 1px solid var(--border-subtle) !important; }
.border-warning { border-color: var(--status-attention) !important; }
hr { border: 0; border-top: 1px solid var(--border-subtle); margin: 16px 0; }

/* ═══════════════════════════════════════════════════════════════
   USAGE & BUDGET DASHBOARD — ub- prefix
   ═══════════════════════════════════════════════════════════════ */

/* ─── RANGE TOGGLE ─── */
.ub-range-toggle {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.ub-range-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.ub-range-btn:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
  text-decoration: none;
}
.ub-range-active,
.ub-range-active:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-active);
}

/* ─── METRICS ROW ─── */
.ub-metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.ub-metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ub-metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ub-metric-header svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted-v2);
}
.ub-metric-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
.ub-metric-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ub-metric-value {
  font-family: var(--font-data);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}
.ub-metric-value-tokens { color: #2dd4bf; }
.ub-metric-value-cost { color: #fbbf24; }
.ub-metric-of {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted-v2);
}
.ub-metric-footer {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ub-metric-hint {
  font-size: 10px;
  color: var(--text-muted-v2);
}
.ub-spark {
  width: 100px;
  height: 32px;
  display: block;
  flex-shrink: 0;
}
.ub-delta {
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 4px;
}
.ub-delta-up   { color: #34d399; background: rgba(52,211,153,0.1); }
.ub-delta-down { color: #f87171; background: rgba(248,113,113,0.1); }
.ub-delta-flat { color: var(--text-muted-v2); background: rgba(255,255,255,0.04); }

/* ─── CIRCULAR GAUGE ─── */
.ub-gauge {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto;
}
.ub-gauge-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.ub-gauge-bg {
  fill: none;
  stroke: rgba(255,255,255,0.05);
  stroke-width: 8;
}
.ub-gauge-fg {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.4,0,0.2,1);
}
.ub-gauge-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ub-gauge-pct {
  font-family: var(--font-data);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}
.ub-gauge-sub {
  font-size: 9px;
  color: var(--text-muted-v2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* ─── MODULE STATUS DOTS ─── */
.ub-module-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.ub-module-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  cursor: default;
}
.ub-dot-active {
  background: var(--success);
  box-shadow: 0 0 6px rgba(16,185,129,0.4);
}
.ub-dot-idle {
  background: rgba(255,255,255,0.12);
}
.ub-dot-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
}
.ub-dot-label-ok { color: var(--success); }

/* ─── CHART PANEL ─── */
.ub-chart-panel { margin-bottom: 24px; }
.ub-chart-wrap {
  position: relative;
  padding: 16px 20px 20px;
}
.ub-chart-wrap canvas {
  display: block;
  width: 100%;
  height: 240px;
}
.ub-chart-legend {
  display: flex;
  gap: 16px;
}
.ub-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: opacity 0.15s;
  user-select: none;
}
.ub-legend-item:hover { opacity: 0.8; }
.ub-legend-item.ub-legend-off { opacity: 0.35; }
.ub-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.ub-chart-tooltip {
  position: absolute;
  background: var(--bg-elevated);
  border: 1px solid var(--border-active);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 11px;
  line-height: 1.6;
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
  transform: translateX(-50%);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.ub-chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted-v2);
  font-size: 13px;
}

/* ─── AI MODEL RATE LIMIT CARDS ─── */
.ub-ai-section-head    { display:flex; justify-content:space-between; align-items:baseline; margin-bottom:16px; }
.ub-ai-timestamp       { font-size:10px; color:var(--text-muted-v2); font-family:var(--font-data); }
.ub-model-grid         { display:grid; grid-template-columns:repeat(2,1fr); gap:16px; }
.ub-model-card         { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:20px; display:flex; flex-direction:column; gap:14px; transition:border-color .15s; }
.ub-model-card:hover   { border-color:var(--border-active); }
.ub-model-card-limited { border-color:var(--danger); }
.ub-model-header       { display:flex; justify-content:space-between; align-items:flex-start; gap:8px; }
.ub-model-name         { font-family:var(--font-data); font-size:14px; font-weight:600; color:var(--text-primary); }
.ub-model-tier         { font-size:10px; font-weight:600; text-transform:uppercase; padding:2px 8px; border-radius:var(--radius-sm, 4px); margin-top:4px; display:inline-block; }
.ub-model-tier-speed      { background:rgba(45,212,191,.12); color:#2dd4bf; }
.ub-model-tier-reasoning  { background:rgba(139,92,246,.12); color:#a78bfa; }
.ub-model-limits       { display:flex; flex-direction:column; gap:10px; }
.ub-model-limit-row    { display:grid; grid-template-columns:40px 1fr auto; align-items:center; gap:10px; }
.ub-model-dim          { font-size:10px; font-weight:600; font-family:var(--font-data); color:var(--text-muted-v2); text-transform:uppercase; }
.ub-model-bar-wrap     { height:6px; background:rgba(255,255,255,.05); border-radius:3px; overflow:hidden; }
.ub-model-bar          { height:100%; border-radius:3px; transition:width .8s ease; }
.ub-model-val          { font-size:11px; font-family:var(--font-data); color:var(--text-secondary); white-space:nowrap; min-width:80px; text-align:right; }
.ub-model-footer       { display:flex; justify-content:space-between; align-items:center; padding-top:10px; border-top:1px solid var(--border); }
.ub-model-binding      { font-size:10px; color:var(--text-muted-v2); font-family:var(--font-data); }
.ub-model-projection   { font-size:10px; font-family:var(--font-data); }
.ub-model-empty        { grid-column:1/-1; text-align:center; padding:40px; color:var(--text-secondary); }

/* ─── SETTINGS: MODEL RATE LIMITS ─── */
.st-model-limit-group       { margin-bottom:16px; padding-bottom:16px; border-bottom:1px solid var(--border); }
.st-model-limit-group:last-child { border-bottom:none; margin-bottom:0; padding-bottom:0; }
.st-model-limit-name        { font-size:13px; font-weight:600; color:var(--text-primary); font-family:var(--font-data); margin-bottom:8px; }
.st-model-limit-row         { display:grid; grid-template-columns:1fr 1fr 1fr; gap:12px; }

/* ─── MODULE CARDS GRID ─── */
.ub-modules-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.ub-module-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s;
}
.ub-module-card:hover {
  border-color: var(--border-active);
}
.ub-module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ub-module-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted-v2);
  flex-shrink: 0;
}
.ub-module-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.ub-module-stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.ub-module-value {
  font-family: var(--font-data);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}
.ub-module-unit {
  font-size: 11px;
  color: var(--text-muted-v2);
}
.ub-module-bar-wrap {
  height: 4px;
  background: rgba(255,255,255,0.05);
  border-radius: 2px;
  overflow: hidden;
}
.ub-module-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.8s ease;
}
.ub-module-limit {
  font-size: 10px;
  color: var(--text-muted-v2);
  font-family: var(--font-data);
}
.ub-module-usage {
  font-size: 11px;
  color: var(--text-secondary);
}
.ub-module-rate {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted-v2);
}

/* ─── INVESTIGATION COST TABLE ─── */
.ub-inv-panel { margin-bottom: 24px; }
.ub-inv-header-link {
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}
.ub-inv-header-link:hover { text-decoration: underline; }
.ub-inv-row {
  display: grid;
  grid-template-columns: 1fr 120px 80px 140px;
  align-items: center;
  gap: 16px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
}
.ub-inv-row:last-child { border-bottom: none; }
.ub-inv-name { min-width: 0; }
.ub-inv-name a {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.ub-inv-name a:hover { color: var(--accent); }
.ub-inv-bar-col {
  height: 6px;
  background: rgba(255,255,255,0.04);
  border-radius: 3px;
  overflow: hidden;
}
.ub-inv-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 3px;
  transition: width 0.8s ease;
}
.ub-inv-has-period .ub-inv-row {
  grid-template-columns: 1fr 120px 80px 80px 140px;
}
.ub-inv-header-row {
  border-bottom: 1px solid var(--border) !important;
  padding: 8px 22px !important;
}
.ub-inv-header-cell {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted-v2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ub-inv-cost {
  font-family: var(--font-data);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}
.ub-inv-period {
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  text-align: right;
}
.ub-inv-cost-zero { color: var(--text-muted-v2); }
.ub-inv-sub-hint {
  font-size: 11px;
  color: var(--text-muted-v2);
  margin-left: 6px;
}
.ub-inv-toggle {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
  user-select: none;
  padding: 2px 4px;
  border-radius: 3px;
  transition: background 0.15s;
}
.ub-inv-toggle:hover { background: rgba(255,255,255,0.06); }
.ub-inv-child-row {
  background: rgba(255,255,255,0.015);
}
.ub-inv-child-name {
  padding-left: 16px;
}
.ub-inv-child-prefix {
  color: var(--text-muted-v2);
  margin-right: 4px;
  font-size: 12px;
}
.ub-inv-child-row .ub-inv-cost {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-secondary);
}
.ub-inv-stats {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-secondary);
}
.ub-inv-stats .data-text {
  font-family: var(--font-data);
}

/* ─── EMPTY / PLACEHOLDER ─── */
.ub-empty {
  padding: 32px;
  text-align: center;
  color: var(--text-muted-v2);
  font-size: 13px;
}
.ub-alerts-panel { margin-bottom: 24px; }
.ub-alerts-placeholder {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted-v2);
}
.ub-alerts-placeholder svg {
  width: 32px;
  height: 32px;
  margin-bottom: 12px;
  opacity: 0.3;
}
.ub-alerts-placeholder p {
  font-size: 13px;
  margin: 0;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1200px) {
  .ub-modules-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1100px) {
  .ub-metrics-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .ub-metrics-row { grid-template-columns: 1fr; }
  .ub-modules-grid { grid-template-columns: 1fr 1fr; }
  .ub-model-grid { grid-template-columns: 1fr; }
  .st-model-limit-row { grid-template-columns: 1fr; }
  .ub-inv-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .ub-inv-has-period .ub-inv-row {
    grid-template-columns: 1fr 1fr;
  }
  .ub-inv-bar-col { grid-column: 1 / -1; }
  .ub-inv-header-row { display: none; }
  .ub-range-toggle { flex-wrap: wrap; }
}
