:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  
  --color-primary: #0284c7;
  --color-primary-glow: rgba(2, 132, 199, 0.08);
  --color-success: #059669;
  --color-success-glow: rgba(5, 150, 105, 0.08);
  --color-warning: #d97706;
  --color-warning-glow: rgba(217, 119, 6, 0.08);
  --color-danger: #dc2626;
  --color-danger-glow: rgba(220, 38, 38, 0.08);
  --color-accent: #7c3aed;
  --color-accent-glow: rgba(124, 58, 237, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 1.5rem;
  max-width: 1800px;
  margin: 0 auto;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

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

.logo-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #0f172a 0%, #475569 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text .subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pulse-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  position: relative;
}

.pulse-indicator::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  animation: pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.status-active {
  background-color: var(--color-success);
}
.status-active::after {
  background-color: var(--color-success);
}

@keyframes pulse-ring {
  0% { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}

.header-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  min-width: 0;
}

.version-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  background-color: var(--bg-tertiary);
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--color-primary);
}

.kill-switch-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background-color: rgba(220, 38, 38, 0.04);
  border: 1px solid rgba(220, 38, 38, 0.15);
  padding: 0.5rem 1rem;
  border-radius: 8px;
}

.kill-switch-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--color-danger);
}

/* Switch Toggle widget */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
}

input:checked + .slider {
  background-color: var(--color-danger);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--color-danger);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

.metric-icon {
  font-size: 1.75rem;
  width: 3.5rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
}

.metric-data h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.metric-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Workspace Columns: 6 claim feeds laid out in a 3x2 grid (1 card per cell so rows never have uneven vertical gaps) */
.workspace-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: stretch;
}

@media (max-width: 1200px) {
  .workspace-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .workspace-layout {
    grid-template-columns: 1fr;
  }
}

.workspace-col {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

.workspace-col > .card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.workspace-col > .card > .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.workspace-col .panel-desc {
  min-height: 2.6rem;
}

/* Cards Panels */
.card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  width: 100%;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background-color: rgba(241, 245, 249, 0.5);
}

.card-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.card-body {
  padding: 1.25rem;
}

.panel-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* Badges */
.badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}
.badge-info { background-color: var(--color-primary-glow); color: var(--color-primary); border: 1px solid rgba(2, 132, 199, 0.2); }
.badge-success { background-color: var(--color-success-glow); color: var(--color-success); border: 1px solid rgba(5, 150, 105, 0.2); }
.badge-warning { background-color: var(--color-warning-glow); color: var(--color-warning); border: 1px solid rgba(217, 119, 6, 0.2); }
.badge-danger { background-color: var(--color-danger-glow); color: var(--color-danger); border: 1px solid rgba(220, 38, 38, 0.2); }
.badge-accent { background-color: var(--color-accent-glow); color: var(--color-accent); border: 1px solid rgba(124, 58, 237, 0.2); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
  border: 1px solid transparent;
  gap: 0.5rem;
}

/* A DISABLED BUTTON MUST LOOK DISABLED. Nothing styled :disabled, so a greyed-out control
   rendered in full primary blue with a pointer cursor and silently swallowed every click —
   reported as "Connect Google doesn't do anything visible", which is exactly what a button
   that refuses to be pressed and does not say so looks like. Global, because every button in
   this app had the same hole; `cursor: not-allowed` is the half that answers the click. */
.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(55%);
}
.btn:disabled:hover,
.btn[disabled]:hover { background-color: inherit; }

.btn-primary { background-color: var(--color-primary); color: #ffffff; }
.btn-primary:hover { background-color: #0270a5; }

.btn-secondary { background-color: var(--bg-tertiary); border-color: var(--border-color); color: var(--text-main); }
.btn-secondary:hover { background-color: #e2e8f0; }

.btn-warning { background-color: var(--color-warning); color: #ffffff; }
.btn-warning:hover { background-color: #b45309; }

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

.btn-danger-outline { background-color: transparent; border-color: var(--color-danger); color: var(--color-danger); }
.btn-danger-outline:hover { background-color: var(--color-danger-glow); }

.btn-small { padding: 0.3rem 0.6rem; font-size: 0.75rem; background-color: var(--bg-tertiary); border: 1px solid var(--border-color); color: var(--text-main); }
.btn-small:hover { background-color: #e2e8f0; }

.btn-block { width: 100%; }

/* Ingestion Simulation Box */
.simulation-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  margin: 1.25rem 0;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}
.divider:not(:empty)::before { margin-right: 1em; }
.divider:not(:empty)::after { margin-left: 1em; }

.custom-post-form textarea {
  width: 100%;
  height: 80px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  padding: 0.75rem;
  font-family: inherit;
  font-size: 0.85rem;
  resize: none;
  margin-bottom: 0.75rem;
}

.custom-post-form textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
}

.form-row select {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  padding: 0.5rem;
  font-family: inherit;
  font-size: 0.85rem;
}

/* Claims List */
.claims-list-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.25rem;
}

.claims-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 250px;
  overflow-y: auto;
}

.claim-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-tertiary);
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.claim-info {
  flex: 1;
  margin-right: 1rem;
}

.claim-item-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.15rem;
}

.claim-item-text {
  font-size: 0.8rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.new-claim-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.new-claim-form input {
  width: 100%;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  font-size: 0.85rem;
}

.new-claim-form input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Human Queue */
.human-queue-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 580px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.queue-item {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  position: relative;
  animation: slide-in 0.25s ease-out;
}

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

.queue-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
}

.queue-post-source {
  color: var(--text-muted);
}

.queue-post-source strong {
  color: var(--color-primary);
}

.queue-confidence {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--color-warning);
}

.queue-text {
  background-color: var(--bg-primary);
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  border-left: 3px solid var(--color-warning);
}

.queue-match-details {
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
  margin-bottom: 0.75rem;
}

.queue-match-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.queue-match-excerpt {
  font-size: 0.8rem;
  background-color: rgba(217, 119, 6, 0.04);
  border: 1px dashed rgba(217, 119, 6, 0.2);
  padding: 0.5rem;
  border-radius: 4px;
}

.queue-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Logs Panel */
.logs-container {
  height: 300px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.75rem;
}

.log-entry {
  line-height: 1.4;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
}

.log-time {
  color: #64748b;
}

.log-step {
  font-weight: 700;
  text-transform: uppercase;
  margin: 0 0.4rem;
}

.log-step.ingest { color: var(--color-primary); }
.log-step.dedup_hit { color: var(--color-accent); }
.log-step.gemini_start { color: #64748b; }
.log-step.gemini_result { color: #b45309; }
.log-step.dual_pass_start { color: #be123c; }
.log-step.dual_pass_result { color: #6d28d9; }
.log-step.human_queue { color: var(--color-warning); }
.log-step.published { color: var(--color-success); }
.log-step.skipped { color: var(--text-muted); }
.log-step.pre_filter { color: #f59e0b; font-weight: 700; }
.log-step.discarded { color: var(--color-danger); }

.log-text {
  color: var(--text-main);
}

.log-subtext {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  padding-left: 1rem;
}

/* Yoriki Delivered Feed */
.yoriki-feed-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 400px;
  overflow-y: auto;
}

.yoriki-item {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem;
}

.yoriki-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}

.yoriki-title {
  font-weight: 700;
  color: var(--color-success);
}

.yoriki-time {
  color: var(--text-muted);
}

.yoriki-post-url {
  font-size: 0.75rem;
  color: var(--color-primary);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 0.5rem;
  word-break: break-all;
}

.yoriki-post-url:hover {
  text-decoration: underline;
}

.yoriki-detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.yoriki-detail-label {
  font-weight: 700;
}

.yoriki-detail-value {
  color: var(--text-main);
  font-family: 'JetBrains Mono', monospace;
}

.yoriki-variants-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.yoriki-variant {
  font-size: 0.75rem;
  background-color: var(--bg-primary);
  padding: 0.4rem;
  border-radius: 4px;
  margin-bottom: 0.25rem;
  border-left: 2px solid var(--color-accent);
}

.yoriki-feedback-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border-color);
}

.yoriki-feedback-status {
  font-size: 0.7rem;
  font-weight: 600;
  background-color: rgba(5, 150, 105, 0.05);
  border: 1px solid rgba(5, 150, 105, 0.2);
  padding: 0.3rem;
  border-radius: 4px;
  color: var(--color-success);
  margin-top: 0.5rem;
  text-align: center;
}

/* Empty States */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.empty-state span {
  font-size: 0.75rem;
}

.loading-placeholder {
  color: var(--text-muted);
  text-align: center;
  padding: 1rem;
  font-size: 0.85rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #cbd5e1;
}

/* Tabs Navigation styling */
.tabs-nav {
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.tab-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active-tab {
  color: var(--color-primary);
}

.tab-btn.active-tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 3px;
  background-color: var(--color-primary);
  border-radius: 2px 2px 0 0;
}

/* Hide default browser details marker arrows */
summary::-webkit-details-marker {
  display: none;
}
summary {
  list-style: none;
}

/* Smooth Scrolling & Clickable Match Highlighting */
html {
  scroll-behavior: smooth;
}

.claim-feed-detail-card:target {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 12px var(--color-primary-glow) !important;
  animation: pulse-highlight 2s ease-in-out;
}

@keyframes pulse-highlight {
  0% { transform: scale(1); border-color: var(--border-color); }
  50% { transform: scale(1.025); border-color: var(--color-primary); }
  100% { transform: scale(1); border-color: var(--color-primary); }
}

.icon-storage {
  background-color: var(--color-warning-glow);
  color: var(--color-warning);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 420px;
  background: var(--bg-secondary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--color-primary);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  backdrop-filter: blur(8px);
}

.toast.toast-success {
  border-left-color: var(--color-success);
}

.toast.toast-danger {
  border-left-color: var(--color-danger);
}

.toast.toast-info {
  border-left-color: var(--color-primary);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
}

/* ── Dashboard period selector ───────────────────────────────────────────────
 * A segmented control, not a tab bar. It borrowed .tab-btn for its shape and then
 * toggled `.active` — a class the stylesheet does not define, since tabs use
 * `.active-tab` — so the selected period was distinguished only by font weight.
 * On a control that changes every number under it, "which one is selected" has to
 * be unmissable rather than inferable.
 */
.dash-window-btn {
  padding: 0.3rem 0.85rem;
  font-size: 0.8rem;
  border-radius: 4px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
}

.dash-window-btn:hover {
  color: var(--text-main);
  background: rgba(148, 163, 184, 0.12);
}

.dash-window-btn.active {
  /* Filled, not tinted. The selected period is the single most load-bearing piece of
   * state on this screen: every figure below it means something different depending
   * on this one button, so it is given the contrast of a primary action. */
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.35);
}

.dash-window-btn.active:hover {
  background: var(--color-primary);
  color: #fff;
}

/* ── Historical Matches quick date range ─────────────────────────────────────
 * The same segmented-control shape as the Dashboard period, kept as its own
 * selector rather than folded into `.dash-window-btn`: the two live on different
 * screens and one of them is inside a dense filter bar, so they are a size apart.
 * `.active` is FILLED for the same reason it is there — this control decides what
 * every count on the subtab is counting, so "which one is selected" has to be
 * unmissable rather than inferable from font weight.
 */
.hist-range-btn {
  padding: 0.22rem 0.6rem;
  font-size: 0.72rem;
  border-radius: 4px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
}

.hist-range-btn:hover {
  color: var(--text-main);
  background: rgba(148, 163, 184, 0.12);
}

.hist-range-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.35);
}

.hist-range-btn.active:hover {
  background: var(--color-primary);
  color: #fff;
}

/* The Custom marker is a span sharing the shape, so it needs the padding the
 * .tab-btn class gives the real buttons. It is never interactive. */
span.hist-range-btn {
  cursor: default;
  align-items: center;
  font-weight: 700;
}

/* ── Alert pulse range (SOC-226) ─────────────────────────────────────────────
 * The same segmented-control shape as the Dashboard period and the Historical
 * Matches range, kept as its own selector for the reason the second one already
 * gives: these live in different places at different sizes. `.active` is FILLED,
 * not tinted, because this control is the card's own window and is deliberately
 * NOT the Period toggle a few lines above it — the one thing a reader must not
 * have to infer here is which of two ranges on one screen they are looking at.
 */
.pulse-range-btn {
  padding: 0.22rem 0.6rem;
  font-size: 0.72rem;
  border-radius: 4px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
}

.pulse-range-btn:hover {
  color: var(--text-main);
  background: rgba(148, 163, 184, 0.12);
}

.pulse-range-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: 800;
}

.pulse-range-btn.active:hover { background: var(--color-primary); color: #fff; }

/* A column is a hover target for the whole hour, so the breakdown is one pointer
 * away on an empty hour too — which is the hour most worth asking about. */
.pulse-col:hover { background: rgba(148, 163, 184, 0.12); }

/* ── Dashboard summary comparison table ───────────────────────────────────────
 * Explicit cell padding and tabular-nums so adjacent right-aligned columns of
 * 6-digit numbers never run into each other. */
#dash-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

#dash-summary-table th,
#dash-summary-table td {
  padding: 0.42rem 0.85rem;
  white-space: nowrap;
}

#dash-summary-table thead tr {
  border-bottom: 1px solid var(--border-color);
}

/* ── Search term highlight & sentiment pills ────────────────────────────── */
mark.search-hl {
  background: #fef08a;
  color: #0f172a;
  padding: 0.02rem 0.16rem;
  border-radius: 3px;
  font-weight: 600;
}

.search-sentiment-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.search-sentiment-pill.neg {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.search-sentiment-pill.neu {
  background: rgba(100, 116, 139, 0.12);
  color: #475569;
  border: 1px solid rgba(100, 116, 139, 0.3);
}
.search-sentiment-pill.pos {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.32);
}
.search-sentiment-pill.mix {
  background: rgba(124, 58, 237, 0.12);
  color: #6d28d9;
  border: 1px solid rgba(124, 58, 237, 0.3);
}

.search-risk-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.08rem 0.44rem;
  border-radius: 999px;
  letter-spacing: 0.015em;
  white-space: nowrap;
  cursor: help;
}
.search-risk-pill.libel {
  background: rgba(217, 119, 6, 0.14);
  color: #b45309;
  border: 1px dashed rgba(217, 119, 6, 0.48);
}
.search-risk-pill.incitement {
  background: rgba(225, 29, 72, 0.14);
  color: #be123c;
  border: 1px dashed rgba(225, 29, 72, 0.48);
}
.search-risk-pill.criminal {
  background: rgba(79, 70, 229, 0.14);
  color: #4338ca;
  border: 1px dashed rgba(79, 70, 229, 0.48);
}
