/* ─── Variables ─────────────────────────────────────────────── */
:root {
  --bg-base: #f9fafb;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f3f4f6;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --border-subtle: #f3f4f6;
  --border-default: #e5e7eb;
  --border-strong: #d1d5db;
  --accent: #111827;
  --accent-hover: #374151;
  --accent-text: #ffffff;
  --primary: #2563eb;
  --success: #15803d;
  --success-bg: #f0fdf4;
  --success-border: #dcfce7;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-border: #fee2e2;
  --warning: #b45309;
  --warning-bg: #fffbeb;
  --warning-border: #fef3c7;
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 0.875rem;
  --sidebar-w: 256px;
}

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

/* ─── Body / App shell ──────────────────────────────────────── */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-primary);
  background: var(--bg-base);
  line-height: 1.5;
  height: 100vh;
  display: flex;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
}

.sidebar-brand {
  padding: 1.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.sidebar-brand [data-lucide] { width: 1.15rem; height: 1.15rem; flex-shrink: 0; }
.sidebar-brand .brand-muted { color: var(--text-muted); font-weight: 300; }

.sidebar-nav {
  flex: 1;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.nav-item:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.nav-item.active { background: var(--bg-surface-hover); color: var(--text-primary); }
.nav-item [data-lucide] { width: 1rem; height: 1rem; flex-shrink: 0; stroke-width: 1.75; }

.nav-badge {
  margin-left: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  min-width: 1.4rem;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.nav-section {
  padding: 1.5rem 0.75rem 0.5rem;
  font-size: 0.67rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-default);
  flex-shrink: 0;
}
.sidebar-user { display: flex; align-items: center; gap: 0.75rem; }
.user-avatar {
  width: 2rem; height: 2rem;
  border-radius: 9999px;
  background: var(--bg-surface-hover);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.user-name { font-size: 0.875rem; font-weight: 500; display: block; }
.user-role { font-size: 0.72rem; color: var(--text-muted); }

/* ─── Main wrapper ──────────────────────────────────────────── */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.main-header {
  height: 64px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  flex-shrink: 0;
}
.header-title {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-primary);
}
.header-actions { display: flex; align-items: center; gap: 0.75rem; }

.main-content { flex: 1; overflow-y: auto; padding: 2rem; }
.content-inner { max-width: 1100px; margin: 0 auto; }

/* ─── Section label ─────────────────────────────────────────── */
.section-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

/* ─── Stats ─────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 0.875rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.stat-icon { font-size: 1.2rem; margin-bottom: 0.3rem; line-height: 1; }
.stat-number { font-size: 1.875rem; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
.stat-label { color: var(--text-muted); font-size: 0.78rem; margin-top: 0.3rem; }
.stat-card-success .stat-number { color: var(--success); }
.stat-card-danger .stat-number { color: var(--danger); }

/* ─── Section ───────────────────────────────────────────────── */
.section { margin-bottom: 2rem; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.875rem; }

/* ─── Card shell ────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.card-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border-default);
  background: rgba(249,250,251,0.5);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: 0.875rem; font-weight: 500; }
.card-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.15rem; }

/* ─── Update / feed cards ────────────────────────────────────── */
.update-list { display: flex; flex-direction: column; gap: 0.75rem; }

.update-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  display: block;
  color: inherit;
  text-decoration: none;
}
.update-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  border-color: var(--border-strong);
}

.update-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.625rem;
}
.update-card-top-left { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.source-pill {
  background: var(--bg-surface-hover);
  color: var(--text-secondary);
  font-size: 0.63rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.ts-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}
.ts-text [data-lucide] { width: 0.75rem; height: 0.75rem; flex-shrink: 0; }

.update-card-title {
  font-size: 0.975rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.375rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.12s;
}
.update-card:hover .update-card-title { color: var(--primary); }

.update-card-snippet {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Action bar (pending list cards) */
.update-card-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding-top: 0.875rem;
  margin-top: 0.875rem;
  border-top: 1px solid var(--border-subtle);
}

/* Inline reject form */
.reject-inline {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.875rem;
  margin-top: 0.875rem;
  border-top: 1px solid var(--border-subtle);
}
.reject-inline.open { display: flex; }
.reject-inline-input {
  flex: 1;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-family: inherit;
  background: var(--bg-surface);
  transition: border-color 0.12s;
}
.reject-inline-input:focus {
  outline: none;
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(185,28,28,.08);
}
.reject-inline-input::placeholder { color: var(--text-muted); font-size: 0.8rem; }

/* ─── Job cards ─────────────────────────────────────────────── */
.job-list { display: flex; flex-direction: column; gap: 0.5rem; }
.job-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.job-card-row { display: flex; align-items: center; gap: 0.625rem; }
.job-site-name { font-weight: 500; font-size: 0.875rem; }
.job-pages { color: var(--text-muted); font-size: 0.78rem; }
.job-time { margin-left: auto; color: var(--text-muted); font-size: 0.78rem; white-space: nowrap; cursor: default; }
.job-error { font-size: 0.78rem; color: var(--danger); }

/* ─── Source / Site list ────────────────────────────────────── */
.source-list { display: flex; flex-direction: column; }
.source-item {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-default);
  transition: background 0.1s;
}
.source-item:last-child { border-bottom: none; }
.source-item:hover { background: var(--bg-surface-hover); }
.source-item-body { flex: 1; min-width: 0; }
.source-name-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; }
.source-name { font-weight: 500; font-size: 0.875rem; color: var(--text-primary); }
.source-item:hover .source-name { color: var(--primary); }
.source-freq {
  background: var(--bg-surface-hover);
  color: var(--text-secondary);
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}
.source-meta {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.source-meta [data-lucide] { width: 0.8rem; height: 0.8rem; }
.source-meta-item { display: flex; align-items: center; gap: 0.25rem; }
.source-actions { display: flex; align-items: center; gap: 0.625rem; flex-shrink: 0; margin-left: 1rem; }

/* ─── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}
.badge-pending  { background: var(--warning-bg);  color: var(--warning); }
.badge-approved { background: var(--success-bg);  color: var(--success); }
.badge-rejected { background: var(--danger-bg);   color: var(--danger); }
.badge-notified { background: #dbeafe; color: #1e40af; }
.badge-job-pending   { background: var(--bg-surface-hover); color: var(--text-secondary); }
.badge-job-running   { background: #dbeafe; color: #1e40af; }
.badge-job-completed { background: var(--success-bg); color: var(--success); }
.badge-job-failed    { background: var(--danger-bg); color: var(--danger); }

.spinner {
  display: inline-block;
  width: 10px; height: 10px;
  border: 2px solid #93c5fd;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-left: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Score pill ─────────────────────────────────────────────── */
.score-pill {
  display: inline-block;
  padding: 0.12rem 0.4rem;
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 600;
  background: var(--bg-surface-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn:hover { background: var(--bg-surface-hover); color: var(--text-primary); border-color: var(--border-strong); }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.btn [data-lucide] { width: 0.875rem; height: 0.875rem; stroke-width: 2; }
.btn-sm [data-lucide] { width: 0.8rem; height: 0.8rem; }

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

.btn-success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.btn-success:hover { background: #dcfce7; color: var(--success); }

.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.btn-danger:hover { background: #fee2e2; color: var(--danger); }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Forms ─────────────────────────────────────────────────── */
.form { max-width: 580px; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.4rem; font-size: 0.875rem; }
.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(17,24,39,.08);
}
.form-group textarea { resize: vertical; }
.checkbox-group { display: flex; gap: 1.5rem; }
.checkbox-group label { font-weight: 400; display: flex; align-items: center; gap: 0.4rem; font-size: 0.875rem; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.help-text { display: block; color: var(--text-muted); font-size: 0.78rem; margin-top: 0.3rem; }
.help-text code { background: var(--bg-surface-hover); padding: 0.1rem 0.3rem; border-radius: 3px; font-size: 0.75rem; }
.radio-group { display: flex; flex-direction: column; gap: 0.6rem; }
.radio-group label { font-weight: 400; display: flex; align-items: flex-start; gap: 0.5rem; cursor: pointer; font-size: 0.875rem; }
.radio-group input[type="radio"] { margin-top: 3px; flex-shrink: 0; }
.mode-hint { color: var(--text-muted); font-size: 0.78rem; display: block; margin-left: 1.4rem; }

/* ─── Filter bar ─────────────────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 0.75rem; }
.filter-bar select {
  padding: 0.375rem 0.7rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
}
.filter-bar select:focus { outline: none; border-color: var(--accent); }

/* ─── Update detail ──────────────────────────────────────────── */
.update-detail-header {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.update-detail-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin: 0;
}
.update-detail-title a {
  color: inherit;
  text-decoration: none;
}
.update-detail-title a:hover { text-decoration: underline; }
.update-detail-header .source-pill { align-self: flex-start; }

.update-meta {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.meta-row { display: flex; gap: 0.75rem; padding: 0.3rem 0; font-size: 0.875rem; align-items: baseline; }
.meta-label { font-weight: 500; min-width: 90px; color: var(--text-muted); flex-shrink: 0; }
.meta-row a { color: var(--primary); text-decoration: none; }
.meta-row a:hover { text-decoration: underline; }

.diff-view {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 0.78rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: 'Courier New', Courier, monospace;
}

.review-actions {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.review-reason-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--bg-base);
  resize: vertical;
  transition: border-color 0.12s;
  margin-bottom: 0.75rem;
}
.review-reason-input:focus { outline: none; border-color: var(--danger); box-shadow: 0 0 0 3px rgba(185,28,28,.08); }
.review-reason-input::placeholder { color: var(--text-muted); }
.review-buttons { display: flex; gap: 0.75rem; }
.review-buttons .btn { flex: 1; justify-content: center; }

.ai-actions { display: flex; flex-direction: column; gap: 1rem; }
.qa-form { display: flex; gap: 0.5rem; }
.qa-form input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-family: inherit;
}
.qa-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(17,24,39,.08); }
.qa-answer {
  background: var(--bg-surface-hover);
  padding: 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  white-space: pre-wrap;
  border: 1px solid var(--border-default);
  line-height: 1.6;
}
.ai-summary-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  line-height: 1.65;
  white-space: pre-wrap;
}
.learned-rule-notice {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-md);
  padding: 0.6rem 1rem;
  font-size: 0.82rem;
  color: var(--success);
  margin-top: 0.5rem;
}
.feedback-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0; font-size: 0.875rem; }
.feedback-reason { color: var(--text-secondary); }
.feedback-date { color: var(--text-muted); font-size: 0.78rem; margin-left: auto; }

/* ─── Alert ─────────────────────────────────────────────────── */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius-md); margin-bottom: 1rem; font-size: 0.875rem; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.alert-error   { background: var(--danger-bg);  color: var(--danger);  border: 1px solid var(--danger-border); }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ─── Rules add card ─────────────────────────────────────────── */
.rules-add-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.rules-add-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr 0.8fr auto;
  gap: 0.75rem;
  align-items: end;
}
.rules-add-grid .form-group { margin: 0; }
.rules-help {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

/* ─── Table ─────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.table th, .table td { padding: 0.75rem 1rem; text-align: left; }
.table th {
  background: var(--bg-surface-hover);
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-default);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.table td { border-bottom: 1px solid var(--border-subtle); font-size: 0.875rem; }
.table tr:last-child td { border-bottom: none; }
.table a { color: var(--primary); text-decoration: none; }
.table a:hover { text-decoration: underline; }

/* ─── Empty state ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-xl);
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ─── Toast ──────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  padding: 0.65rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  pointer-events: auto;
  animation: toast-in 0.2s ease;
  max-width: 340px;
}
.toast-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.toast-error   { background: var(--danger-bg);  color: var(--danger);  border: 1px solid var(--danger-border); }
.toast-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(0.75rem); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── Pagination ─────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 0.4rem; margin-top: 1.5rem; justify-content: center; }
.pagination a, .pagination span {
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  text-decoration: none;
  color: var(--text-secondary);
  background: var(--bg-surface);
}
.pagination a:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.pagination .page-current { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.pagination .page-disabled { color: var(--text-muted); cursor: default; }
.pagination-info { text-align: center; color: var(--text-muted); font-size: 0.78rem; margin-top: 0.5rem; }

/* ─── Selector auto-detect ───────────────────────────────────── */
.selector-row { display: flex; gap: 0.5rem; align-items: center; }
.selector-row input { flex: 1; }
.selector-reasoning { display: block; font-size: 0.78rem; margin-top: 0.35rem; }
.selector-reasoning-ok   { color: var(--success); }
.selector-reasoning-info { color: var(--text-muted); }

/* ─── Collapsible details ────────────────────────────────────── */
details.collapsible {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
  background: var(--bg-surface);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
details.collapsible > summary {
  padding: 0.75rem 1.25rem;
  background: var(--bg-surface-hover);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  border-bottom: 1px solid var(--border-default);
  color: var(--text-secondary);
}
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary::after { content: '▾'; font-size: 0.75rem; color: var(--text-muted); }
details.collapsible[open] > summary::after { content: '▴'; }
details.collapsible > .collapsible-body { padding: 1.25rem; }

/* ─── Text utilities ─────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.relevance-score { font-weight: 600; }

/* ─── Info banner (new site form) ─────────────────────────────── */
.info-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}
.info-banner [data-lucide] {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  margin-top: 0.15rem;
  color: #2563eb;
}

/* ─── Admin section (edit site form, collapsible) ─────────────── */
details.admin-section {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
details.admin-section > summary {
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--text-secondary);
  background: var(--bg-surface-hover);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}
details.admin-section > summary::-webkit-details-marker { display: none; }
details.admin-section > summary::after {
  content: '▾';
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: auto;
}
details.admin-section[open] > summary::after { content: '▴'; }
details.admin-section > summary [data-lucide] {
  width: 0.9rem;
  height: 0.9rem;
  color: var(--text-muted);
}
details.admin-section[open] > summary {
  border-bottom: 1px solid var(--border-default);
}
details.admin-section > .form-group,
details.admin-section > *:not(summary) {
  padding: 0 1rem;
}
details.admin-section > .form-group:first-of-type { padding-top: 1rem; }
details.admin-section > .form-group:last-child { padding-bottom: 1rem; margin-bottom: 0; }

/* ─── Probe notes box (inside admin section) ──────────────────── */
.probe-notes-box {
  margin: 1rem 1rem 0;
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
}
.probe-notes-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}
.probe-notes-label [data-lucide] {
  width: 0.85rem;
  height: 0.85rem;
  color: var(--text-muted);
}
.probe-notes-text {
  color: var(--text-secondary);
  line-height: 1.55;
  white-space: pre-wrap;
}
.probe-status-tag {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.probe-status-ok       { background: var(--success-bg); color: var(--success); }
.probe-status-pending,
.probe-status-running  { background: var(--warning-bg); color: var(--warning); }
.probe-status-failed   { background: var(--danger-bg);  color: var(--danger); }
.probe-status-needs_review { background: var(--warning-bg); color: var(--warning); }
