:root {
  --bg: #080c14;
  --bg-elevated: #0f1520;
  --bg-card: #121a28;
  --bg-input: #0a1019;
  --bg-hover: #1a2436;
  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.22);
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --positive: #10b981;
  --positive-soft: rgba(16, 185, 129, 0.12);
  --negative: #f43f5e;
  --negative-soft: rgba(244, 63, 94, 0.12);
  --neutral: #94a3b8;
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.25);
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --topbar-h: 64px;
  --transition: 160ms ease;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59, 130, 246, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(16, 185, 129, 0.04), transparent);
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--topbar-h);
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 12, 20, 0.85);
  backdrop-filter: blur(12px);
}

.topbar-start {
  display: flex;
  align-items: center;
  gap: 2rem;
  min-width: 0;
}

.topbar-end {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.brand h1 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
}

.app-nav {
  display: flex;
  gap: 0.25rem;
  padding: 0.2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.nav-link {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover { color: var(--text); background: var(--bg-hover); }
.nav-link.active {
  color: var(--text);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.api-key-input {
  width: 140px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  font: inherit;
  font-size: 0.8125rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.api-key-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.api-key-input.api-key-missing {
  border-color: #f43f5e;
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.2);
}

/* Toast */
.toast {
  position: fixed;
  top: calc(var(--topbar-h) + 0.75rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  max-width: min(520px, calc(100vw - 2rem));
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  animation: toast-in 0.25s ease;
}

.toast.success { border-color: rgba(16, 185, 129, 0.35); background: #0d1a14; }
.toast.error { border-color: rgba(244, 63, 94, 0.35); background: #1a0d12; }
.toast.info { border-color: rgba(59, 130, 246, 0.35); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Main layout */
.main {
  flex: 1;
  width: 100%;
  margin: 0;
  padding: 0;
  max-width: none;
}

.view { display: none; min-height: calc(100vh - var(--topbar-h)); }
.view.active { display: block; animation: fade-in 0.2s ease; }

.page-narrow {
  max-width: 820px;
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  gap: 1rem;
}

.system-page {
  max-width: 960px;
  gap: 1.15rem;
}

.system-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.system-last-updated {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  padding-top: 0.35rem;
}

.system-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 1.15rem 1.25rem;
}

.system-hero-body {
  display: grid;
  gap: 1rem;
  flex: 1;
  min-width: min(100%, 320px);
}

.system-hero-status {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.system-hero-title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 600;
}

.status-chip-lg {
  font-size: 0.75rem;
  padding: 0.35rem 0.65rem;
  margin-top: 0.15rem;
}

.system-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.55rem;
}

.system-stat {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
  display: grid;
  gap: 0.15rem;
  background: rgba(15, 23, 42, 0.25);
}

.system-stat span {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.system-stat strong {
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: capitalize;
}

.system-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding-top: 0.15rem;
}

.system-scheduler-hint {
  margin-top: 0.35rem;
  font-size: 0.78rem;
}

.system-two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

/* Source fetch dashboard */
.fetch-report-panel {
  gap: 1rem;
}

.fetch-report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.65rem;
}

.fetch-stat-card {
  display: grid;
  gap: 0.2rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.fetch-stat-card span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.fetch-stat-card strong {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
}

.fetch-stat-card strong em {
  font-size: 0.85rem;
  font-style: normal;
  font-weight: 500;
  color: var(--text-muted);
}

.fetch-stat-card .text-bad {
  color: var(--negative);
}

.fetch-report-watches {
  display: grid;
  gap: 0.45rem;
}

.fetch-watch-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.fetch-watch-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--accent-soft);
  color: #bfdbfe;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.fetch-report-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.fetch-report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.fetch-report-table th,
.fetch-report-table td {
  padding: 0.7rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.fetch-report-table th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.02);
}

.fetch-report-table tbody tr:last-child td {
  border-bottom: none;
}

.fetch-report-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 1.5rem !important;
}

.fetch-source-name {
  font-weight: 600;
  color: var(--text-primary);
}

.fetch-source-meta {
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.fetch-bar {
  margin-top: 0.45rem;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.fetch-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  transition: width 0.35s ease;
}

.fetch-row-fetching .fetch-bar span {
  animation: fetch-pulse 1.2s ease-in-out infinite;
}

@keyframes fetch-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.fetch-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.fetch-status-ok {
  background: var(--positive-soft);
  color: var(--positive);
}

.fetch-status-error {
  background: var(--negative-soft);
  color: var(--negative);
}

.fetch-status-fetching {
  background: var(--accent-soft);
  color: #93c5fd;
}

.fetch-status-pending {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
}

.fetch-status-skipped,
.fetch-status-disabled {
  background: rgba(148, 163, 184, 0.08);
  color: #64748b;
}

.fetch-num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.fetch-latency {
  color: var(--text-muted);
  font-weight: 500;
}

.fetch-row-error td:first-child .fetch-source-name {
  color: #fda4af;
}

.system-card {
  padding: 1rem 1.15rem;
  display: grid;
  gap: 0.65rem;
  align-content: start;
}

.system-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.system-card-head h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.incidents-log-body {
  max-height: 220px;
}

.system-admin-block {
  display: grid;
  gap: 0.75rem;
}

.system-section-label {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.system-admin-grid {
  display: grid;
  gap: 0.65rem;
}

.system-accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  overflow: hidden;
}

.system-accordion-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  list-style: none;
}

.system-accordion-summary::-webkit-details-marker { display: none; }

.system-accordion-hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

.system-accordion-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border);
}

.system-accordion-body .card-desc {
  margin: 0.75rem 0;
}

.page-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* App shell: sidebar + workspace */
.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - var(--topbar-h));
}

.sidebar {
  border-right: 1px solid var(--border);
  background: rgba(15, 21, 32, 0.6);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-head h2 {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-empty {
  margin: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.workspace {
  min-width: 0;
  background: var(--bg);
  overflow-y: auto;
  max-height: calc(100vh - var(--topbar-h));
}

.workspace-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 60vh;
  padding: 2rem;
  gap: 0.5rem;
}

.workspace-empty h2 {
  margin: 0.5rem 0 0;
  font-size: 1.125rem;
}

.watch-workspace {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.workspace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem 0;
  flex-wrap: wrap;
}

.workspace-header h2 {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.workspace-meta {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.workspace-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.75rem 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.workspace-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.55rem 0.9rem;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

.workspace-tab:hover { color: var(--text); }
.workspace-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.workspace-panels {
  padding: 1.25rem 1.5rem 2rem;
  flex: 1;
}

.workspace-panel { display: none; }
.workspace-panel.active {
  display: grid;
  gap: 1rem;
  animation: fade-in 0.15s ease;
}

.workspace-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 1000px) {
  .chart-grid { grid-template-columns: 1fr 1fr; }
}

.split-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.section-divider {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.articles-toolbar-row {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.notif-titles {
  margin: 0.35rem 0 0 1rem;
  padding: 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.notif-titles li { margin: 0.2rem 0; }

.notif-article-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--accent);
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.notif-article-link:hover { color: var(--text-primary); }

.topbar-center {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
  justify-content: center;
  padding: 0 1rem;
}

.scheduler-meta-compact {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  max-width: min(520px, 42vw);
  flex: 1;
  min-width: 0;
  line-height: 1.35;
  text-align: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0;
}

.scheduler-meta-countdown {
  color: var(--text-secondary);
  white-space: nowrap;
}

.status-chip-compact {
  font-size: 0.6875rem;
  padding: 0.2rem 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Modal */
.modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: min(480px, calc(100vw - 2rem));
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin: 0;
  padding: 0;
  width: 100%;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.modal-body {
  padding: 1.25rem;
  display: grid;
  gap: 0.85rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-icon {
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}

.audit-log-body {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: grid;
  gap: 0.35rem;
  max-height: 320px;
  overflow-y: auto;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}

.card-compact { padding: 1rem 1.25rem; }

.card-header { margin-bottom: 1rem; }
.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.card h2 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card h3 {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.card-desc {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Forms */
textarea,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  font: inherit;
  font-size: 0.875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

textarea { resize: vertical; min-height: 72px; line-height: 1.5; }

textarea:focus,
input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field { display: grid; gap: 0.4rem; }
.field-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.field-span-2 { grid-column: span 2; }
.field-grow { flex: 1; min-width: 12rem; }

/* Toggles */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.875rem;
  user-select: none;
}

.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }

.toggle-ui {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 999px;
  flex-shrink: 0;
  transition: background var(--transition);
}

.toggle-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform var(--transition), background var(--transition);
}

.toggle input:checked + .toggle-ui {
  background: var(--accent-soft);
  border-color: rgba(59, 130, 246, 0.4);
}

.toggle input:checked + .toggle-ui::after {
  transform: translateX(16px);
  background: var(--accent);
}

.toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-group { display: flex; gap: 0.35rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform 80ms ease;
  white-space: nowrap;
}

.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) { background: #243044; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--bg-hover);
}

.btn.is-loading .btn-label { opacity: 0.6; }

/* Segmented control */
.segmented {
  display: inline-flex;
  padding: 0.2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.segmented-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.segmented-btn:hover { color: var(--text-secondary); }
.segmented-btn.active {
  color: var(--text);
  background: var(--bg-card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Status */
.status-line {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  min-height: 1.25rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.status-chip.active {
  background: var(--positive-soft);
  color: var(--positive);
  border-color: rgba(16, 185, 129, 0.3);
}

.status-chip.running {
  background: var(--accent-soft);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.3);
}

.info-panel {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.info-panel .meta-item + .meta-item {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}

/* Decision panel */
.decision-panel {
  border-color: rgba(59, 130, 246, 0.25);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), transparent 50%), var(--bg-card);
}

.decision-layout {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  align-items: start;
}

.decision-badge {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: capitalize;
  line-height: 1.2;
}

.decision-summary {
  margin: 0.5rem 0 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.decision-positive, .decision-progress, .decision-favorable { color: var(--positive); }
.decision-negative, .decision-setback, .decision-unfavorable { color: var(--negative); }
.decision-neutral, .decision-no_data, .decision-insufficient_evidence { color: var(--neutral); }
.decision-insufficient_evidence { opacity: 0.85; font-style: italic; }

.lens-conflict-banner {
  border-left: 3px solid var(--warning);
  background: rgba(245, 158, 11, 0.08);
}

.decision-meta-bar {
  padding: 0.75rem 1rem;
}

.decision-meta-line {
  margin: 0;
  font-size: 0.8125rem;
}

.lens-card-decision.decision-insufficient_evidence {
  color: var(--text-muted);
  font-style: italic;
}

.lens-tester textarea {
  width: 100%;
  margin-top: 0.5rem;
}

.lens-tester-results {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.5rem;
}

.lens-test-hit {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.article-favor-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-end;
  margin-left: 0.75rem;
}

.favor-override-btn {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.45rem;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
}

.favor-override-btn:hover { border-color: var(--text-muted); }
.favor-override-btn.is-active { background: rgba(16, 185, 129, 0.15); border-color: var(--positive); }

.glossary-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  margin-left: 0.25rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  font-size: 0.65rem;
  color: var(--text-muted);
  cursor: help;
  vertical-align: middle;
}

.system-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.system-health-item {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.system-health-item span {
  display: block;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.system-stuck-watches {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(244, 63, 94, 0.35);
  background: rgba(244, 63, 94, 0.08);
}

.decision-mixed, .decision-lean_positive, .decision-lean_negative, .decision-cautious_progress { color: var(--warning); }

.decision-stats {
  display: grid;
  gap: 0.65rem;
  min-width: 160px;
}

.metric {
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.metric-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.metric-value {
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
}

.stat-card {
  padding: 1rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stat-positive .stat-value { color: var(--positive); }
.stat-negative .stat-value { color: var(--negative); }
.stat-neutral .stat-value { color: var(--neutral); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.badge-full { background: var(--positive-soft); color: #6ee7b7; }
.badge-partial { background: var(--warning-soft); color: #fcd34d; }
.badge-rss { background: rgba(100, 116, 139, 0.2); color: #cbd5e1; }
.badge-off { background: var(--negative-soft); color: #fda4af; }
.badge-muted { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); }
.badge-new { background: var(--accent-soft); color: #93c5fd; margin-right: 0.35rem; }
.badge-stance { background: rgba(100, 116, 139, 0.2); color: #cbd5e1; }
.badge-favor { font-weight: 700; letter-spacing: 0.03em; }
.badge-favor.favor-favorable { background: var(--positive-soft); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.35); }
.badge-favor.favor-unfavorable { background: var(--negative-soft); color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.35); }
.badge-favor.favor-mixed { background: var(--warning-soft); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.35); }
.badge-favor.favor-unavailable { background: rgba(100, 116, 139, 0.15); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.25); }
.favor-pill-favorable { background: var(--positive-soft); border-color: rgba(16, 185, 129, 0.35); }
.favor-pill-favorable .sentiment-label { color: #6ee7b7; }
.favor-pill-unfavorable { background: var(--negative-soft); border-color: rgba(244, 63, 94, 0.35); }
.favor-pill-unfavorable .sentiment-label { color: #fda4af; }
.favor-pill-mixed { background: var(--warning-soft); border-color: rgba(245, 158, 11, 0.35); }
.favor-pill-mixed .sentiment-label { color: #fcd34d; }
.favor-pill-unavailable .sentiment-label { color: var(--text-muted); }
.lenses-list { display: grid; gap: 0.75rem; }
.lenses-empty { margin: 0; }
.lens-row { padding: 0.85rem 1rem; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); }
.lens-row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.65rem; }
.lens-row-grid { gap: 0.65rem; }
.lens-rolling-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; }
.lens-card { padding: 0.85rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elevated); }
.lens-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.lens-card-head h4 { margin: 0; font-size: 0.92rem; }
.lens-card-score { font-weight: 700; color: #93c5fd; }
.lens-card-decision { margin: 0.35rem 0; font-size: 0.8rem; font-weight: 600; text-transform: capitalize; }
.badge-lens { font-size: 0.62rem; }
.badge-cluster { background: var(--warning-soft); color: #fcd34d; }
.badge-translated { background: rgba(20, 184, 166, 0.15); color: #5eead4; }
.badge-outcome-progress, .badge-outcome-cautious_progress { background: var(--positive-soft); color: #6ee7b7; }
.badge-outcome-setback { background: var(--negative-soft); color: #fda4af; }
.badge-outcome-mixed { background: var(--warning-soft); color: #fcd34d; }
.badge-outcome-neutral { background: rgba(100, 116, 139, 0.2); color: #cbd5e1; }
.badge-tone-positive { background: var(--positive-soft); color: #6ee7b7; }
.badge-tone-negative { background: var(--negative-soft); color: #fda4af; }
.badge-tone-mixed { background: var(--warning-soft); color: #fde68a; }
.badge-story { background: rgba(99, 102, 241, 0.15); color: #c7d2fe; }
.badge-relevance { font-variant-numeric: tabular-nums; }
.badge-relevance-high { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; }
.badge-relevance-medium { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }
.badge-relevance-low { background: var(--warning-soft); color: #fcd34d; }
.badge-relevance-tangential { background: rgba(100, 116, 139, 0.2); color: #94a3b8; }
.article-relevance-reason { color: var(--text-muted); font-size: 0.82rem; }

.article-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

/* Articles */
.results-list { display: grid; gap: 0.75rem; }

.article-card {
  padding: 1.1rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition);
}

.article-card:hover { border-color: var(--border-strong); }

.article-card.is-new {
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: inset 3px 0 0 var(--accent);
}

.article-head {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  align-items: flex-start;
}

.article-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.article-title a {
  color: var(--text);
  text-decoration: none;
  transition: color var(--transition);
}

.article-title a:hover { color: #93c5fd; }

.article-meta {
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
}

.article-meta span::after {
  content: "·";
  margin-left: 0.5rem;
  opacity: 0.5;
}

.article-meta span:last-child::after { content: none; }

.article-reason {
  margin-top: 0.5rem;
  padding: 0.5rem 0.65rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
  border-left: 2px solid var(--border-strong);
}

.sentiment-pill {
  flex-shrink: 0;
  text-align: center;
  min-width: 88px;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
}

.sentiment-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sentiment-positive .sentiment-label { color: var(--positive); }
.sentiment-negative .sentiment-label { color: var(--negative); }
.sentiment-neutral .sentiment-label { color: var(--neutral); }

.sentiment-compound {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.article-content {
  margin-top: 0.85rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  white-space: pre-wrap;
  line-height: 1.6;
}

.article-content.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.toggle-content {
  margin-top: 0.65rem;
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
}

.toggle-content:hover { text-decoration: underline; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 2rem;
  opacity: 0.35;
  margin-bottom: 0.5rem;
}

.empty-state p:first-of-type {
  margin: 0;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Charts */
.chart-card {
  position: relative;
  padding: 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;
}

.chart-card canvas {
  display: block;
  width: 100%;
  max-width: 100%;
}

.chart-canvas,
#trend-chart {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

.chart-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 2.5rem 1rem;
  font-size: 0.875rem;
}

.chart-caption {
  margin: 0.65rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.analytics-block { margin-top: 1.25rem; }
.analytics-block:first-of-type { margin-top: 0; }

.analytics-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.analytics-block-head h3 { margin: 0; }

.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.inline-form.wrap { flex-wrap: wrap; }
.inline-form input { min-width: 140px; }

.entity-scores {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.entity-scores:empty { display: none; }

.entity-scores strong {
  width: 100%;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.entity-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: var(--mono);
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.entity-chip .entity-count { opacity: 0.65; font-size: 0.6875rem; }
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: var(--mono);
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

/* Sources */
.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.65rem;
}

.source-card {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  transition: border-color var(--transition), background var(--transition);
}

.source-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.source-card input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 0.15rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.source-card label { cursor: pointer; flex: 1; min-width: 0; }
.source-name { font-weight: 600; font-size: 0.875rem; }
.source-meta { color: var(--text-muted); font-size: 0.75rem; margin-top: 0.25rem; line-height: 1.4; }

.audit-log {
  margin-top: 1rem;
  max-height: 200px;
  overflow: auto;
  padding: 0.75rem;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--mono);
}

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 1.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.footer-dot { opacity: 0.4; }

.hidden { display: none !important; }

/* Responsive */
.rolling-section {
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}

.rolling-section-desc {
  margin: 0.25rem 0 0.85rem;
}

.rolling-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.rolling-card {
  padding: 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  gap: 0.45rem;
  text-align: center;
}

.rolling-card-primary {
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.12) inset;
}

.rolling-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.rolling-card-head .metric-label {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.rolling-chart-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 132px;
}

.rolling-share-pie {
  width: 132px;
  height: 132px;
  display: block;
}

.rolling-card .rolling-decision {
  font-size: 0.9rem;
  text-transform: capitalize;
  margin: 0;
}

.rolling-card .rolling-stats {
  font-size: 0.72rem;
  line-height: 1.35;
  margin: 0;
}

.rolling-count {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.aggregate-share {
  margin: 1rem 0 0.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.25rem;
}
.aggregate-share-chart {
  flex: 0 0 auto;
  width: 180px;
  max-width: 100%;
}
.aggregate-share-chart canvas {
  width: 180px;
  height: 180px;
  max-width: 100%;
  display: block;
}
.aggregate-share-legend-wrap {
  flex: 1 1 200px;
  min-width: 0;
  display: grid;
  gap: 0.45rem;
}
.aggregate-share-caption {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.share-favorable, .share-dot.share-favorable { background: #10b981; }
.share-mixed, .share-dot.share-mixed { background: #f59e0b; }
.share-unfavorable, .share-dot.share-unfavorable { background: #f43f5e; }
.aggregate-share-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.share-legend-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.share-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.share-legend-muted { opacity: 0.75; }
.share-inline-favorable { color: #6ee7b7; }
.share-inline-unfavorable { color: #fda4af; }
.metric-positive { color: #6ee7b7; }
.metric-negative { color: #fda4af; }
.driver-link { color: #93c5fd; text-decoration: none; }
.driver-link:hover { text-decoration: underline; }
.article-card.selected {
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25) inset;
}

.watch-list {
  display: contents;
}
.watch-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.watch-card-main {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}
.watch-card-text { min-width: 0; flex: 1; }
.watch-card.is-running { border-color: rgba(59, 130, 246, 0.35); }
.watch-card.is-due { border-color: rgba(251, 191, 36, 0.35); }
.watch-progress-ring {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
}
.watch-progress-ring svg { display: block; }
.watch-progress-ring circle { transition: stroke-dashoffset 0.35s linear; }
.watch-progress-ring.is-running circle.progress-arc {
  animation: watch-ring-spin 1.1s linear infinite;
  transform-origin: center;
}
@keyframes watch-ring-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.watch-card-schedule {
  font-size: 0.68rem;
  color: var(--text-secondary);
  margin-top: 0.12rem;
}
.watch-runner-panel {
  margin: 0 0.5rem 0.65rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.35);
}
.watch-runner-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.watch-runner-detail {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}
.incidents-log .audit-log-body { max-height: 280px; }

.incident-row {
  margin-bottom: 0.55rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.incident-row.unread {
  color: var(--text-primary);
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.28);
  border-left: 3px solid var(--accent);
}

.incident-row.read {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--border);
  opacity: 0.72;
}

.incident-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1.35;
}

.incident-row-head time,
.incident-source {
  color: var(--text-muted);
}

.incident-message {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.incident-new-badge {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.22);
}

.incident-severity-error { color: #fca5a5; font-weight: 600; }
.incident-severity-warning { color: #fcd34d; font-weight: 600; }
.watch-card:hover { background: var(--bg-hover); }
.watch-card.selected {
  background: var(--accent-soft);
  border-color: rgba(59, 130, 246, 0.35);
}
.watch-card-title { font-weight: 600; font-size: 0.875rem; }
.watch-card-meta { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.15rem; }
.inner-card { margin-top: 1rem; background: transparent; box-shadow: none; padding: 0; border: none; }
.watch-create-form { margin-bottom: 0.5rem; }

.scheduler-bar { margin-bottom: 0.75rem; }
.scheduler-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.scheduler-bar-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.scheduler-meta { margin: 0; }

.collapsible-panel {
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.collapsible-panel.inner-card {
  margin-top: 1.25rem;
  padding: 0;
  border: 1px solid var(--border);
}
.collapsible-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}
.collapsible-summary::-webkit-details-marker { display: none; }
.collapsible-body { padding: 0 1rem 1rem; }

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 220px;
  }
  .sidebar-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .watch-card {
    min-width: 180px;
    flex-shrink: 0;
  }
  .split-panels { grid-template-columns: 1fr; }
  .topbar-center { display: none; }
  .rolling-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar-start { flex-wrap: wrap; gap: 0.75rem; width: 100%; }
  .app-nav { width: 100%; overflow-x: auto; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .decision-layout { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .field-span-2 { grid-column: span 1; }
}

@media (max-width: 600px) {
  .main { padding: 1rem; }
  .card { padding: 1rem; }
  .article-head { flex-direction: column; }
  .sentiment-pill { align-self: flex-start; }
  .api-key-input { width: 110px; }
}

/* Login page */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
}

.login-shell {
  width: min(420px, calc(100vw - 2rem));
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.login-header {
  text-align: center;
  margin-bottom: 1.25rem;
}

.login-header h1 {
  margin: 0.5rem 0 0.25rem;
  font-size: 1.35rem;
}

.login-form {
  display: grid;
  gap: 0.85rem;
}

.login-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.875rem;
}

.btn-block {
  width: 100%;
}

/* User management */
.user-create-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
}

.user-list {
  display: grid;
  gap: 0.75rem;
}

.user-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  display: grid;
  gap: 0.5rem;
}

.user-row-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.user-row-meta {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.user-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.user-role-select {
  min-width: 110px;
}

@media (max-width: 900px) {
  .user-create-form {
    grid-template-columns: 1fr;
  }
}

/* Data management */
.data-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.data-stat {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  display: grid;
  gap: 0.2rem;
}

.data-stat span {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.data-stat strong {
  font-size: 1.1rem;
}

.wipe-scope-row {
  margin-bottom: 1rem;
}

.wipe-target-list {
  display: grid;
  gap: 0.75rem;
}

.wipe-target-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.wipe-target-copy {
  display: grid;
  gap: 0.35rem;
}

.wipe-target-copy .card-desc {
  margin: 0;
}

/* Run history */
.run-history-table-wrap {
  overflow-x: auto;
}

.run-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.run-history-table th,
.run-history-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.run-history-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.run-status-ok { color: #6ee7b7; }
.run-status-error { color: #fda4af; }

/* Onboarding */
.onboarding-banner {
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  border-left: 3px solid var(--warning);
  background: var(--warning-soft);
}

.onboarding-banner-title {
  margin: 0.25rem 0 0.65rem;
  font-size: 1rem;
}

.onboarding-checklist {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
}

.onboarding-checklist li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.onboarding-checklist li[data-done="true"] {
  color: var(--text-muted);
  text-decoration: line-through;
}

.onboard-check {
  font-weight: 700;
  color: var(--accent);
  width: 1rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
}

.onboarding-modal .modal-header {
  align-items: flex-start;
}

.onboarding-steps {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.onboarding-step {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.onboarding-step.active {
  color: var(--accent);
  border-color: rgba(59, 130, 246, 0.4);
  background: var(--accent-soft);
}

.onboarding-step.done {
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.35);
}

.onboarding-panel {
  display: none;
}

.onboarding-panel.active {
  display: block;
}

.analytics-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.source-health {
  font-variant-numeric: tabular-nums;
}

.source-health-ok {
  color: #6ee7b7;
}

.source-health-unknown {
  color: var(--text-muted);
}

.source-health-error {
  color: #fda4af;
  font-size: 0.72rem;
}

/* Settings page */
.settings-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-bottom: 4.5rem;
}

.settings-header {
  padding: 1.1rem 1.25rem;
}

.settings-title {
  margin: 0.25rem 0 0.35rem;
  font-size: 1.15rem;
}

.settings-sections {
  display: grid;
  gap: 1rem;
}

.settings-section {
  padding: 1.1rem 1.25rem;
}

.settings-section-title {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.settings-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.settings-section-head .settings-section-title {
  margin-bottom: 0.35rem;
}

.settings-section-head .card-desc {
  margin: 0;
}

.settings-note {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  background: var(--accent-soft);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-sm);
}

.settings-form-compact {
  margin-bottom: 1rem;
}

.settings-toggles {
  display: grid;
  gap: 0.5rem;
}

.setting-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.9rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.setting-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.setting-card input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.setting-card-copy {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.setting-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.setting-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.setting-card input:checked + .toggle-ui {
  background: var(--accent-soft);
  border-color: rgba(59, 130, 246, 0.4);
}

.setting-card input:checked + .toggle-ui::after {
  transform: translateX(16px);
  background: var(--accent);
}

.settings-savebar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  background: rgba(8, 12, 20, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.settings-savebar .card-desc {
  margin: 0;
  font-size: 0.8rem;
}

.settings-dirty {
  color: var(--warning) !important;
  font-weight: 500;
}

.lenses-empty-card {
  padding: 1rem 1.1rem;
  background: var(--bg-elevated);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

.lenses-empty-card .card-desc {
  margin: 0 0 0.5rem;
}

.lenses-empty-card .card-desc:last-child {
  margin-bottom: 0;
}

.lens-row-badge {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.analytics-notice {
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
}

.analytics-notice .card-desc {
  margin: 0.35rem 0 0;
}

@media (max-width: 720px) {
  .settings-savebar {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-section-head {
    flex-direction: column;
  }
}
