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

:root {
  /* Mission Control — Dark Charcoal Palette */
  --bg: #0f0e0c;
  --bg-section: #1a1917;
  --bg-elevated: #242320;
  --bg-hover: #2a2926;
  --text-primary: #f0ede8;
  --text-secondary: #a8a39a;
  --text-muted: #6b6560;
  --border: #2a2926;
  --border-light: #242320;
  --border-focus: #3a3834;

  /* Accent — Burnt Orange (intentional, renamed from --blue) */
  --accent: #ff630f;
  --accent-light: #ff8c42;
  --accent-glow: rgba(255, 99, 15, 0.15);
  --accent-text: #ff8c42;

  /* Semantic Colors */
  --green: #25d366;
  --green-dim: #1a9c4a;
  --green-glow: rgba(37, 211, 102, 0.12);
  --red: #ff546e;
  --red-dim: #cc3344;
  --red-glow: rgba(255, 84, 110, 0.12);
  --amber: #f5a623;
  --amber-dim: #c47f12;
  --amber-glow: rgba(245, 166, 35, 0.12);

  /* Typography */
  --font-ui: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  --radius: 14px;
  --radius-sm: 10px;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle noise texture overlay for atmosphere */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.025;
  pointer-events: none;
  z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 128px 128px;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.dashboard {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px 60px;
}

/* ====== HEADER ====== */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-badge {
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  box-shadow: 0 0 20px var(--accent-glow);
}

.header-title h1 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.header-title .subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  /* Force controls onto a new row below the title + auth-slot row. */
  width: 100%;
}

/* Search — Glassmorphism */
.search-box {
  position: relative;
  width: 280px;
}

.search-box input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-section);
  font-size: 13px;
  font-family: var(--font-ui);
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s ease;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-elevated);
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
}

.search-box .search-hint {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-muted);
  pointer-events: none;
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* Select and buttons */
.project-select {
  padding: 9px 36px 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-section);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-ui);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6560' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: all 0.2s ease;
}

.project-select:hover {
  border-color: var(--border-focus);
}

.project-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}

.refresh-btn {
  padding: 9px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-section);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.refresh-btn:hover {
  border-color: var(--border-focus);
  background: var(--bg-elevated);
  transform: translateY(-1px);
}

.refresh-btn:active {
  transform: translateY(0);
}

.refresh-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  font-family: var(--font-mono);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: dot-pulse 2s ease-in-out infinite;
  box-shadow: 0 0 6px var(--green-glow);
}

.live-dot.fetching {
  background: var(--amber);
  animation: dot-pulse 0.5s ease-in-out infinite;
  box-shadow: 0 0 6px var(--amber-glow);
}

@keyframes dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.last-updated {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ====== METRICS PANEL ====== */
.metrics-panel {
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.metrics-panel h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-family: var(--font-mono);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 20px;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  transition: all 0.2s ease;
}

.metric:hover {
  border-color: var(--border-focus);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.metric-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}

.metric-value.green { color: var(--green); text-shadow: 0 0 20px var(--green-glow); }
.metric-value.red { color: var(--red); text-shadow: 0 0 20px var(--red-glow); }

.metric-sublabel {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.metric-wide {
  grid-column: span 2;
  min-width: 200px;
}

/* ====== CARDS & BUTTONS ====== */
.status-card {
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.status-card:hover {
  border-color: var(--border-focus);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.status-card.amber {
  border-color: var(--amber-dim);
  box-shadow: 0 2px 12px var(--amber-glow);
}

.status-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.green { background: var(--green); box-shadow: 0 0 6px var(--green-glow); }
.status-dot.red { background: var(--red); box-shadow: 0 0 6px var(--red-glow); }
.status-dot.amber { background: var(--amber); box-shadow: 0 0 6px var(--amber-glow); }

.status-count {
  font-weight: 500;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

.entry-card {
  padding: 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  transition: all 0.2s ease;
  cursor: pointer;
  background: var(--bg);
}

.entry-card:hover {
  border-color: var(--border-focus);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transform: translateX(2px);
}

.entry-card.highlight-flash {
  animation: card-highlight 1.5s ease-out;
}

@keyframes card-highlight {
  0% { background: var(--accent-glow); border-color: var(--accent); }
  100% { background: var(--bg); border-color: var(--border-light); }
}

.entry-title {
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--text-primary);
}

.entry-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
  font-family: var(--font-mono);
}

.config-badge {
  display: inline-block;
  padding: 3px 8px;
  background: var(--bg-elevated);
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  font-family: var(--font-mono);
  border: 1px solid var(--border);
}

.fail-reason {
  font-size: 12px;
  color: var(--red);
  background: var(--red-glow);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
  border: 1px solid rgba(255, 84, 110, 0.15);
  font-family: var(--font-mono);
}

.dehydration-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.dehydration-badge.ok {
  background: var(--green-glow);
  color: var(--green);
  border: 1px solid rgba(37, 211, 102, 0.15);
}

.dehydration-badge.fail {
  background: var(--red-glow);
  color: var(--red);
  border: 1px solid rgba(255, 84, 110, 0.15);
}

.retry-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  gap: 8px;
  flex-wrap: wrap;
}

.retry-count {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 11px;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.btn:hover {
  background: var(--bg-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn:focus-visible,
.refresh-btn:focus-visible,
.project-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-green {
  border-color: var(--green-dim);
  color: var(--green);
}
.btn-green:hover { background: var(--green-glow); box-shadow: 0 0 12px var(--green-glow); }

.btn-red {
  border-color: var(--red-dim);
  color: var(--red);
}
.btn-red:hover { background: var(--red-glow); box-shadow: 0 0 12px var(--red-glow); }

.btn-amber {
  border-color: var(--amber-dim);
  color: var(--amber);
}
.btn-amber:hover { background: var(--amber-glow); box-shadow: 0 0 12px var(--amber-glow); }

.btn-group {
  display: flex;
  gap: 8px;
}

/* ====== HISTORY TABLE ====== */
.history-panel {
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.history-panel h2 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.history-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.history-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.history-table th {
  text-align: left;
  padding: 12px 14px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-section);
  font-family: var(--font-mono);
}

.history-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  transition: background 0.15s ease;
}

/* Zebra striping */
.history-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.015);
}

.history-table tbody tr[data-record-id] {
  cursor: pointer;
}

/* Row hover */
.history-table tbody tr:hover td {
  background: var(--bg-hover);
}

/* Left accent border on hover */
.history-table tbody tr:hover td:first-child {
  border-left: 2px solid var(--accent);
  padding-left: 12px;
}

.history-table tbody tr td:first-child {
  border-left: 2px solid transparent;
  padding-left: 12px;
  border-radius: 4px 0 0 4px;
}

.history-table tbody tr td:last-child {
  border-radius: 0 4px 4px 0;
}

.history-table td:last-child {
  white-space: nowrap;
}

.status-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.status-pill.pass {
  background: var(--green-glow);
  color: var(--green);
  border: 1px solid rgba(37, 211, 102, 0.15);
}

.status-pill.fail {
  background: var(--red-glow);
  color: var(--red);
  border: 1px solid rgba(255, 84, 110, 0.15);
}

.status-pill.pending {
  background: var(--amber-glow);
  color: var(--amber);
  border: 1px solid rgba(245, 166, 35, 0.15);
}

/* ====== TOAST NOTIFICATIONS ====== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  font-size: 13px;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  background: var(--bg-section);
  border: 1px solid var(--border);
  color: var(--text-primary);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  max-width: 400px;
  word-break: break-word;
  animation: toast-in 0.3s ease-out;
  font-family: var(--font-ui);
}

.toast.error {
  border-color: var(--red-dim);
  background: var(--red-glow);
  color: var(--red);
}

.toast.success {
  border-color: var(--green-dim);
  background: var(--green-glow);
  color: var(--green);
}

.toast.fade-out { animation: toast-out 0.3s ease-in forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(30px); }
}

/* ====== UTILITY ====== */
.hidden {
  display: none;
}

/* ====== NO RESULTS ====== */
.no-results {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
  font-size: 14px;
  display: none;
  font-family: var(--font-mono);
}

/* ====== RUNNING TASKS ====== */
.running-panel {
  background: linear-gradient(135deg, #ff630f 0%, #ff8c42 100%);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(255, 99, 15, 0.25);
}

.running-panel.hidden {
  display: none;
}

.running-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.running-header h2 {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.running-dot {
  display: inline-flex;
  width: 10px;
  height: 10px;
  background: #ffd4c2;
  border-radius: 50%;
  box-shadow: 0 0 12px #ffd4c2;
  animation: dot-pulse 1.5s ease-in-out infinite;
}

.running-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  opacity: 0.95;
  font-family: var(--font-mono);
}

.running-indicator .gear {
  display: inline-block;
  animation: spin 2s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.running-jobs {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.running-job {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-sm);
  padding: 16px;
  min-width: 280px;
  flex: 1;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.running-job-title {
  font-size: 12px;
  color: #ffe8dc;
  font-weight: 500;
  font-family: var(--font-mono);
}

.running-job-id {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  font-family: var(--font-mono);
  letter-spacing: -0.3px;
}

.running-job-meta {
  font-size: 12px;
  opacity: 0.95;
  font-family: var(--font-mono);
}

.running-job-meta .config-badge {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.running-job-meta .phase-badge {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  font-size: 11px;
  color: #fff;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  margin-top: 12px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #ffd4c2;
  border-radius: 2px;
  width: 100%;
  transform-origin: left;
  animation: progress-pulse 2s ease-in-out infinite;
}

@keyframes progress-pulse {
  0%, 100% { opacity: 0.7; transform: scaleX(0.45); }
  50% { opacity: 1; transform: scaleX(0.65); }
}

/* Sweep gradient animation */
.running-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  transform: translateX(-100%);
  animation: sweep 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes sweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Typing indicator */
.typing-indicator {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #ffd4c2;
  overflow: hidden;
  white-space: nowrap;
  animation: typing 3s steps(20) infinite;
  width: 0;
}

@keyframes typing {
  0% { width: 0; }
  60% { width: 100%; }
  100% { width: 100%; }
}

/* Click dots */
.click-dot {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  animation: dot-appear 2s ease-out infinite;
  pointer-events: none;
}

.click-dot:nth-child(1) { top: 20%; left: 30%; animation-delay: 0s; }
.click-dot:nth-child(2) { top: 60%; left: 70%; animation-delay: 0.5s; }
.click-dot:nth-child(3) { top: 40%; left: 50%; animation-delay: 1s; }
.click-dot:nth-child(4) { top: 80%; left: 20%; animation-delay: 1.5s; }

@keyframes dot-appear {
  0% { opacity: 0; transform: scale(0); }
  30% { opacity: 1; transform: scale(1); }
  70% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0); }
}

/* ====== STATUS BOARD GRID ====== */
.status-board {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.status-board.three-col {
  grid-template-columns: 1fr;
  gap: 14px;
}

.writeback-card {
  grid-column: 1 / -1;
  max-width: 50%;
}

/* ====== PAGE NAVIGATION ====== */
.page-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.page-nav-link {
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s ease;
}

.page-nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.page-nav-link.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-focus);
}

/* ====== ROOT CAUSE PILLS ====== */
.root-cause-pill {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  font-family: var(--font-mono);
  border: 1px solid transparent;
}

.root-cause-pill.regression {
  background: var(--red-glow);
  color: var(--red);
  border-color: rgba(255, 84, 110, 0.15);
}

.root-cause-pill.missing {
  background: var(--amber-glow);
  color: var(--amber);
  border-color: rgba(245, 166, 35, 0.15);
}

.root-cause-pill.edge {
  background: rgba(33, 150, 243, 0.1);
  color: #64b5f6;
  border-color: rgba(33, 150, 243, 0.15);
}

.root-cause-pill.data {
  background: rgba(171, 71, 188, 0.1);
  color: #ce93d8;
  border-color: rgba(171, 71, 188, 0.15);
}

.root-cause-pill.unknown {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border-color: var(--border);
}

/* ====== TEST CASE COUNT BADGE ====== */
.tc-count {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--green-glow);
  color: var(--green);
  border: 1px solid rgba(37, 211, 102, 0.15);
  font-family: var(--font-mono);
}

/* ====== FOOTER / VERSION BADGE ====== */
.dashboard-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.version-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
}

.version-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green-glow);
}

/* ====== FAILURES-ONLY TOGGLE ====== */
.failures-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-section);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.failures-toggle:hover {
  border-color: var(--red-dim);
  color: var(--red);
}

.failures-toggle.active {
  background: var(--red-glow);
  border-color: var(--red-dim);
  color: var(--red);
  box-shadow: 0 0 12px var(--red-glow);
}

.failures-toggle .toggle-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all 0.2s ease;
}

.failures-toggle.active .toggle-dot {
  background: var(--red);
  box-shadow: 0 0 6px var(--red-glow);
}

/* ====== STATUS BOARD — FAILURE-FIRST ====== */
.status-board.failure-first {
  grid-template-columns: 1fr;
  gap: 20px;
}

.status-board.failure-first .status-card.failed-card {
  border-color: var(--red-dim);
  box-shadow: 0 2px 16px var(--red-glow);
}

.status-board.failure-first .status-card.failed-card .status-dot.red {
  animation: dot-pulse 1.5s ease-in-out infinite;
}

/* ====== RUN DETAIL DRAWER ====== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 20000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 720px;
  max-width: 92vw;
  max-height: 88vh;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  z-index: 20001;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.96);
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drawer-panel.open {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-header .drawer-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.drawer-header .drawer-status.complete {
  background: var(--green-glow);
  color: var(--green);
  border: 1px solid rgba(37, 211, 102, 0.15);
}

.drawer-header .drawer-status.failed {
  background: var(--red-glow);
  color: var(--red);
  border: 1px solid rgba(255, 84, 110, 0.15);
}

.drawer-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.drawer-close:hover {
  border-color: var(--red-dim);
  color: var(--red);
  background: var(--red-glow);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.drawer-section {
  margin-bottom: 28px;
}

.drawer-section h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 14px;
  font-family: var(--font-mono);
}

.drawer-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.drawer-meta-item {
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.drawer-meta-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  font-family: var(--font-mono);
}

.drawer-meta-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

/* Phase Timeline */
.phase-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.phase-item {
  display: flex;
  gap: 14px;
  position: relative;
  padding-bottom: 20px;
}

.phase-item:last-child {
  padding-bottom: 0;
}

.phase-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 24px;
  width: 2px;
  height: calc(100% - 8px);
  background: var(--border);
}

.phase-item.complete:not(:last-child)::before {
  background: var(--green-dim);
}

.phase-item.failed:not(:last-child)::before {
  background: var(--red-dim);
}

.phase-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  z-index: 1;
  font-family: var(--font-mono);
}

.phase-item.complete .phase-dot {
  background: var(--green-glow);
  color: var(--green);
  border: 1px solid rgba(37, 211, 102, 0.2);
}

.phase-item.failed .phase-dot {
  background: var(--red-glow);
  color: var(--red);
  border: 1px solid rgba(255, 84, 110, 0.2);
}

.phase-item.pending .phase-dot {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.phase-item.running .phase-dot {
  background: var(--amber-glow);
  color: var(--amber);
  border: 1px solid rgba(245, 166, 35, 0.2);
  animation: dot-pulse 1.5s ease-in-out infinite;
}

.phase-info {
  flex: 1;
  padding-top: 2px;
}

.phase-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.phase-duration {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.phase-cost {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* Test Cases */
.test-case-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.test-case-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  transition: all 0.15s ease;
}

.test-case-item:hover {
  border-color: var(--border-focus);
}

.test-case-status {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 10px;
}

.test-case-status.pass {
  background: var(--green-glow);
  color: var(--green);
}

.test-case-status.fail {
  background: var(--red-glow);
  color: var(--red);
}

.test-case-status.error {
  background: var(--amber-glow);
  color: var(--amber);
}

.test-case-status.manual {
  background: rgba(120, 120, 120, 0.16);
  color: var(--text-muted);
}

.test-case-status.skip,
.test-case-status.pending {
  background: rgba(120, 120, 120, 0.10);
  color: var(--text-muted);
}

/* PR Review section */
.drawer-section.pr-review h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pr-review-pr-tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-primary);
}

.drawer-pr-urls {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-pr-urls a {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-family: var(--font-mono);
  word-break: break-all;
}

.drawer-pr-urls a:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.pr-review-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.pr-count {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  font-family: var(--font-mono);
}

.pr-count.critical {
  background: var(--red-glow);
  border-color: var(--red-dim);
  color: var(--red);
}

.pr-count.high {
  background: var(--amber-glow);
  border-color: var(--amber-dim);
  color: var(--amber);
}

.pr-count.medium {
  background: var(--green-glow);
  border-color: var(--green-dim);
  color: var(--green);
}

.pr-review-summary {
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.pr-findings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pr-finding {
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
}

.pr-finding.critical { border-left-color: var(--red); }
.pr-finding.high    { border-left-color: var(--amber); }
.pr-finding.medium  { border-left-color: var(--green); }

.pr-finding-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.pr-finding-id {
  font-weight: 600;
  color: var(--text-primary);
}

.pr-finding-cat {
  padding: 2px 6px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.pr-finding-file {
  color: var(--text-muted);
  word-break: break-all;
  font-size: 11px;
}

.pr-finding-desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.pr-finding-why,
.pr-finding-hint {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
  margin-top: 4px;
}

.pr-finding-why .label,
.pr-finding-hint .label,
.pr-impact-focus .label {
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-right: 4px;
}

.pr-impact-areas {
  margin-top: 16px;
}

.pr-impact-areas > summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 6px 0;
}

.pr-impact-item {
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

.pr-impact-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.pr-impact-paths {
  margin: 6px 0;
  padding-left: 18px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  line-height: 1.6;
  word-break: break-all;
}

.pr-impact-focus {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.test-case-name {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
}

.test-case-duration {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Log Output */
.log-output {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-secondary);
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-output .log-line {
  display: block;
  padding: 1px 0;
}

.log-output .log-time {
  color: var(--text-muted);
  margin-right: 8px;
}

.log-output .log-info {
  color: var(--green);
}

.log-output .log-error {
  color: var(--red);
}

.log-output .log-warn {
  color: var(--amber);
}

/* ====== RESPONSIVE ====== */
@media (max-width: 1100px) {
  .status-board {
    grid-template-columns: 1fr;
  }
  .writeback-card {
    max-width: 100%;
  }
  .metric-wide {
    grid-column: span 1;
  }
}

@media (max-width: 900px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-right {
    width: 100%;
  }

  .search-box {
    width: 100%;
    max-width: none;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .running-jobs {
    flex-direction: column;
  }

  .history-table {
    font-size: 12px;
  }

  .history-table th,
  .history-table td {
    padding: 10px;
  }
}

@media (max-width: 600px) {
  .dashboard {
    padding: 12px;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .metric-value {
    font-size: 26px;
  }

  .history-table {
    display: block;
    overflow-x: auto;
  }

  .status-board {
    gap: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ====== HEAL ACTIVITY STATUS COLORS ====== */
.status-applied { color: #2a9d2a; font-weight: 500; }
.status-rejected_judge,
.status-rejected_shadow { color: #c44; }
.status-executor_failed,
.status-no_patches,
.status-skipped_anomaly { color: #888; }
.status-in_progress { color: #999; font-style: italic; }

/* === Auth header slot === */
.auth-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  /* Pin to the top-right, on the same row as .header-left. */
  margin-left: auto;
}
.auth-user {
  font-size: 13px;
  color: var(--text-muted, #888);
}
.auth-btn {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.12);
  background: #fff;
  color: #333;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}
.auth-btn:hover { background: #f5f5f5; }
.auth-btn-primary {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}
.auth-btn-primary:hover { background: #1d4ed8; }

/* === Disabled write buttons (rerun / retry-writeback) === */
button[disabled].retry-btn,
button[disabled].rerun-btn,
button[disabled].retry-writeback-btn {
  opacity: 0.5;
  cursor: not-allowed;
}

/* === Login page === */
.login-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Geist, system-ui, -apple-system, sans-serif;
  background: #fafafa;
}
.login-card {
  width: 360px;
  padding: 28px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.login-title { margin: 0 0 4px; font-size: 18px; font-weight: 600; }
.login-sub { font-size: 13px; color: #666; margin-bottom: 8px; }
.login-label { font-size: 12px; color: #555; margin-top: 6px; }
.login-input {
  height: 36px; padding: 0 10px; border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.16); font-size: 14px;
  font-family: inherit;
}
.login-input:focus { outline: 2px solid #2563eb33; border-color: #2563eb; }
.login-submit {
  margin-top: 10px; height: 38px; border-radius: 6px;
  background: #2563eb; color: #fff; border: 0; font-size: 14px;
  font-weight: 500; cursor: pointer;
}
.login-submit[disabled] { opacity: 0.6; cursor: not-allowed; }
.login-error {
  margin-top: 4px; font-size: 13px; color: #b91c1c;
  padding: 8px 10px; border-radius: 6px; background: #fee2e2;
}
.login-back { margin-top: 8px; font-size: 12px; color: #666; text-align: center; }

/* === Fallback toast === */
.auth-toast {
  position: fixed; top: 16px; right: 16px;
  padding: 10px 14px; border-radius: 6px;
  background: #333; color: #fff; font-size: 13px;
  z-index: 9999;
}
.auth-toast-warn { background: #b45309; }

/* ============ Bug Verify tab ============ */

.verdict-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 12px;
}

.verdict-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border, #ddd);
  border-radius: 999px;
  background: var(--bg-section, #fff);
  color: var(--text-muted, #444);
  font-size: 13px;
  cursor: pointer;
  transition: all 120ms ease;
  font-family: inherit;
}

.verdict-chip:hover {
  border-color: #888;
  color: var(--text, #111);
}

.verdict-chip.active {
  background: var(--text, #111);
  border-color: var(--text, #111);
  color: #fff;
}

.verdict-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.verdict-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.verdict-pass { background: rgba(42, 157, 42, 0.15); color: #1e7a1e; }
.verdict-fail { background: rgba(204, 51, 51, 0.15); color: #b21f1f; }
.verdict-manual { background: rgba(204, 153, 0, 0.20); color: #8a6500; }
.verdict-error { background: rgba(120, 120, 120, 0.22); color: #555; }

.verdict-dot.verdict-pass { background: #2a9d2a; }
.verdict-dot.verdict-fail { background: #cc3333; }
.verdict-dot.verdict-manual { background: #cc9900; }
.verdict-dot.verdict-error { background: #888; }

.status-warn {
  margin-left: 4px;
  color: #b21f1f;
  cursor: help;
}

.panel-hint {
  font-size: 12px;
  font-weight: 400;
  color: #888;
  margin-left: 8px;
}

/* ============ BUG INSIGHTS PAGE ============ */

.window-selector {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-right: 12px;
}
.window-selector button {
  background: transparent;
  border: 0;
  padding: 6px 10px;
  font: 500 12px/1 var(--font-mono);
  color: var(--text-muted);
  cursor: pointer;
}
.window-selector button + button { border-left: 1px solid var(--border); }
.window-selector button.active {
  background: var(--accent);
  color: var(--bg);
}

.stale-banner {
  margin: 12px 0;
  padding: 10px 14px;
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.35);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
}
.stale-banner.hidden { display: none; }

/* ----- Panel 1: KPIs ----- */
.insight-kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.insight-kpi-cell {
  padding: 14px 16px;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.insight-kpi-label {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.insight-kpi-value {
  font-size: 24px;
  font-weight: 600;
  margin-top: 4px;
}
.insight-kpi-delta {
  margin-top: 4px;
  font-size: 12px;
  font-family: var(--font-mono);
}
.insight-kpi-delta.up   { color: var(--red); }
.insight-kpi-delta.down { color: var(--green); }
.insight-kpi-delta.flat { color: var(--text-muted); }

/* ----- Panel 2: What Changed ----- */
.insight-changed {
  margin: 16px 0;
  padding: 14px 16px;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.insight-changed.hidden { display: none; }
.changed-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 8px 0;
}
.changed-row-label {
  width: 80px;
  font: 500 12px/1.4 var(--font-mono);
  color: var(--text-muted);
}
.changed-bar {
  flex: 1;
  display: flex;
  height: 18px;
  border-radius: 3px;
  overflow: hidden;
}
.bar-segment.p0 { background: var(--red); }
.bar-segment.p1 { background: #f97316; }
.bar-segment.p2 { background: #eab308; }
.bar-segment.p3 { background: #6b7280; }
.bar-segment.p4 { background: #4b5563; }
.bar-segment.unknown { background: #1f2937; }
.bar-segment {
  display: flex; align-items: center; justify-content: center;
  font: 500 11px/1 var(--font-mono); color: var(--bg);
}

/* ----- Panel 3: Recurring Patterns ----- */
.insight-recurring {
  margin: 16px 0;
  padding: 14px 16px;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.insight-recurring.hidden { display: none; }
.insight-recurring h2 { margin: 0 0 8px 0; font-size: 14px; }
.recurring-row {
  display: grid;
  grid-template-columns: 16px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  cursor: pointer;
}
.recurring-row:hover { background: rgba(255,255,255,0.02); }
.recurring-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
.recurring-dot.red    { background: var(--red); }
.recurring-dot.orange { background: #f97316; }
.recurring-dot.yellow { background: #eab308; }
.recurring-dot.gray   { background: #6b7280; }
.recurring-label { font: 500 13px/1.3 var(--font-mono); }
.recurring-counts { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }
.recurring-arrow { color: var(--text-muted); }

/* ----- Panel 4: Hotspots ----- */
.insight-hotspots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.hotspot-column {
  padding: 14px 16px;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.hotspot-column h2 { margin: 0 0 8px 0; font-size: 13px; }
.hotspot-row {
  display: grid;
  grid-template-columns: 1fr 80px 32px;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  cursor: pointer;
}
.hotspot-row[data-clickable="false"] { cursor: default; opacity: 0.7; }
.hotspot-row:hover[data-clickable="true"] { background: rgba(255,255,255,0.02); }
.hotspot-name { font: 500 12px/1.3 var(--font-mono); }
.hotspot-bar {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}
.hotspot-bar-fill {
  height: 100%;
  background: var(--accent);
}
.hotspot-count { font: 500 12px/1 var(--font-mono); text-align: right; }

/* ----- Panel 5: Browse ----- */
.insight-browse {
  margin: 16px 0;
  padding: 14px 16px;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.section-header {
  display: flex; align-items: baseline; gap: 12px;
}
.section-header h2 { margin: 0; font-size: 14px; }
.browse-count { font: 500 12px/1 var(--font-mono); color: var(--text-muted); }
.browse-filters {
  display: flex; gap: 8px; margin: 8px 0 12px 0; flex-wrap: wrap;
}
.browse-filters input[type="search"] {
  flex: 1; min-width: 200px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text-primary);
  font-family: var(--font-mono); font-size: 12px;
}
.browse-filters select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text-primary);
  font-family: var(--font-mono); font-size: 12px;
  min-width: 130px;
  max-height: 32px;
}
.browse-filters button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  color: var(--text-primary);
  font: 500 12px/1 var(--font-mono);
  cursor: pointer;
}
.browse-table {
  width: 100%; border-collapse: collapse;
}
.browse-table th, .browse-table td {
  padding: 8px 10px;
  text-align: left;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.browse-table th { font-family: var(--font-mono); color: var(--text-muted); cursor: pointer; user-select: none; }
.browse-table td.ai-reasoning {
  max-width: 480px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.severity-pill {
  display: inline-block; padding: 2px 8px;
  border-radius: 4px;
  font: 500 11px/1.4 var(--font-mono);
}
.severity-pill.p0 { background: var(--red); color: var(--bg); }
.severity-pill.p1 { background: #f97316; color: var(--bg); }
.severity-pill.p2 { background: #eab308; color: var(--bg); }
.severity-pill.p3 { background: #6b7280; color: var(--bg); }
.severity-pill.p4 { background: #4b5563; color: var(--bg); }
.severity-pill.unknown { background: #1f2937; color: var(--text-muted); }
.chip {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-right: 4px;
  font: 500 10px/1.4 var(--font-mono);
  color: var(--text-muted);
}
.load-more {
  display: block; margin: 12px auto 0 auto;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 16px;
  color: var(--text-primary);
  font: 500 12px/1 var(--font-mono);
  cursor: pointer;
}
.load-more.hidden { display: none; }
.empty-state {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font: 500 12px/1 var(--font-mono);
}
