/* ShadowNest — Naval Dark v2 */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg:      #06090f;
  --bg1:     #0b1120;
  --bg2:     #101828;
  --bg3:     #172035;
  --border:  #1c2e47;
  --border2: #243a58;
  --primary:       #6366f1;
  --primary-dark:  #4f46e5;
  --primary-light: #818cf8;
  --primary-glow:  rgba(99,102,241,0.22);
  --success: #10b981;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --fg:  #dde5f0;
  --fg2: #7a96b4;
  --fg3: #3d5470;
  --font: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Courier New', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[x-cloak] { display: none !important; }

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  background-image: radial-gradient(circle, #1c2e47 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ─── Scrollbar ─────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--border2) var(--bg); }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: var(--bg); }
*::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
*::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ─── Loading ───────────────────────────────────────────── */
.loading-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.loading-inner { display: flex; flex-direction: column; gap: 1rem; align-items: center; }
.loading-bar { width: 200px; height: 2px; background: var(--bg3); overflow: hidden; border-radius: 1px; }
.loading-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  animation: loadanim 1.4s ease infinite;
}
@keyframes loadanim {
  0%   { width: 0%;  margin-left: 0%; }
  50%  { width: 60%; margin-left: 20%; }
  100% { width: 0%;  margin-left: 100%; }
}
.loading-label {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--fg3);
  text-transform: uppercase;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ─── Header ────────────────────────────────────────────── */
header {
  background: rgba(6, 9, 15, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
}
.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 200px 1fr 240px;
  align-items: stretch;
  height: 56px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-right: 1px solid var(--border);
}
.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px var(--primary-glow);
  flex-shrink: 0;
}
.logo-mark svg { width: 18px; height: 18px; stroke: #fff; fill: none; }
.logo-name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #dde5f0, var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

/* Tab nav */
.tab-nav {
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }
.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 16px;
  height: 56px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--fg2);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  text-transform: uppercase;
  white-space: nowrap;
  position: relative;
  top: 1px;
  font-family: var(--font);
}
.tab svg { width: 15px; height: 15px; flex-shrink: 0; }
.tab:hover { color: var(--fg); }
.tab.active { color: var(--primary-light); border-bottom-color: var(--primary); }

/* Header right */
.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 20px;
  border-left: 1px solid var(--border);
}
.last-scan { font-size: 0.72rem; color: var(--fg3); font-family: var(--mono); white-space: nowrap; }
.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.status-pill.idle    { background: rgba(30,45,71,0.8); color: var(--fg2); border: 1px solid var(--border2); }
.status-pill.running { background: rgba(99,102,241,0.15); color: var(--primary-light); border: 1px solid rgba(99,102,241,0.4); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.status-pill.running .status-dot { animation: pulse-dot 1.5s infinite; }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* ─── Panels ────────────────────────────────────────────── */
.panel { max-width: 1440px; margin: 0 auto; padding: 28px 24px; }

/* ─── Stats Row ─────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}
.stat:hover { border-color: var(--border2); }
.stat::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99,102,241,0.04) 0%, transparent 60%);
  pointer-events: none;
}
.stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg3);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-label svg { width: 13px; height: 13px; }
.stat-value { font-size: 2.2rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.stat-value.accent {
  background: linear-gradient(135deg, var(--fg) 20%, var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-sub { font-size: 0.72rem; color: var(--success); margin-top: 6px; }

/* ─── Dash Grid ─────────────────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }

/* ─── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg2);
  display: flex;
  align-items: center;
  gap: 7px;
}
.card-title svg { width: 14px; height: 14px; color: var(--primary-light); }
.card-body { padding: 20px; }

/* Chart areas */
.chart-area { position: relative; height: 200px; }
.chart-area.tall { height: 240px; }

/* ─── Scraper card ──────────────────────────────────────── */
.scraper-card {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

/* Site toggles */
.site-checks { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.check-row { display: flex; align-items: center; justify-content: space-between; }
.check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--fg2);
  cursor: pointer;
  user-select: none;
}
.check-label input { display: none; }
.toggle {
  width: 34px;
  height: 19px;
  border-radius: 9999px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  position: relative;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--fg3);
  transition: transform 0.2s, background 0.2s;
}
.check-label input:checked ~ .toggle { background: rgba(99,102,241,0.25); border-color: var(--primary); }
.check-label input:checked ~ .toggle::after { transform: translateX(15px); background: var(--primary-light); }
.site-name { flex: 1; }
.site-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--bg3);
  color: var(--fg3);
  border: 1px solid var(--border);
  font-family: var(--mono);
}
.site-badge.active { background: rgba(16,185,129,0.1); color: var(--success); border-color: rgba(16,185,129,0.25); }

/* Run / Stop */
.run-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px;
  margin-top: 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.25s;
  box-shadow: 0 0 24px var(--primary-glow);
}
.run-btn:hover:not(:disabled) { box-shadow: 0 0 36px rgba(99,102,241,0.4); transform: translateY(-1px); }
.run-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.run-btn svg { width: 16px; height: 16px; }

.stop-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--danger);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
}
.stop-btn:hover { background: rgba(239,68,68,0.2); }
.stop-btn svg { width: 14px; height: 14px; }

/* Progress */
.prog-wrap { margin-top: 16px; }
.prog-track { height: 3px; background: var(--bg3); border-radius: 2px; overflow: hidden; margin-bottom: 12px; }
.prog-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 2px;
  transition: width 0.4s ease;
  box-shadow: 0 0 8px var(--primary-glow);
}
.prog-log {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  max-height: 160px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.9;
}
.log-entry { color: var(--fg3); display: flex; gap: 8px; align-items: baseline; }
.log-entry.success { color: var(--success); }
.log-entry.error   { color: var(--danger); }
.log-entry.info    { color: var(--primary-light); }
.log-time { color: var(--fg3); opacity: 0.6; flex-shrink: 0; }

/* ─── Filter bar ────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 20px;
  margin-bottom: 16px;
}
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-lbl {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg3);
  white-space: nowrap;
}
.f-input {
  padding: 7px 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--fg);
  font-size: 0.82rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
}
.f-input:focus { border-color: var(--primary); }
.f-input::placeholder { color: var(--fg3); }
.f-search { min-width: 200px; flex: 1; }
.filter-sep { width: 1px; height: 24px; background: var(--border); flex-shrink: 0; }

/* ─── Table card ────────────────────────────────────────── */
.table-card {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.tbl-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--bg); }
th {
  padding: 10px 16px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg3);
  text-align: left;
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
th:hover { color: var(--fg2); }
td { padding: 12px 16px; font-size: 0.85rem; border-bottom: 1px solid rgba(28,46,71,0.6); vertical-align: middle; }
tr:last-child td { border: none; }
tr.listing-row { cursor: pointer; transition: background 0.1s; }
tr.listing-row:hover td { background: rgba(99,102,241,0.04); }
tr.row-new { background: rgba(99,102,241,0.025); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-type { background: rgba(99,102,241,0.15); color: var(--primary-light); }
.badge-new  { background: rgba(16,185,129,0.12); color: var(--success); font-size: 0.62rem; vertical-align: middle; margin-left: 6px; }

/* Source chip — per-site accent colors */
.source-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}
.source-chip[data-site="pararius"]     { background: rgba(245,158,11,0.12);  color: #f59e0b; }
.source-chip[data-site="kamernet"]     { background: rgba(16,185,129,0.12);  color: var(--success); }
.source-chip[data-site="funda"]        { background: rgba(239,68,68,0.12);   color: var(--danger); }
.source-chip[data-site="huurwoningen"] { background: rgba(129,140,248,0.15); color: var(--primary-light); }
.source-chip:not([data-site="pararius"]):not([data-site="kamernet"]):not([data-site="funda"]):not([data-site="huurwoningen"]) {
  background: var(--bg3); color: var(--fg2);
}

/* Table cell helpers */
.td-city  { font-weight: 600; white-space: nowrap; }
.td-price { font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
.td-total { color: var(--fg2); white-space: nowrap; }
.td-date  { font-family: var(--mono); font-size: 0.75rem; color: var(--fg3); white-space: nowrap; }
.dim { color: var(--fg3); }

/* Hide button */
.hide-btn {
  background: transparent;
  border: none;
  color: var(--fg3);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
tr:hover .hide-btn { opacity: 1; }
.hide-btn:hover { color: var(--danger); background: rgba(239,68,68,0.1); }
@media (pointer: coarse) { .hide-btn { opacity: 0.5; } }

/* Empty state */
.empty-cell { padding: 4rem 1rem !important; }
.empty-state { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
.empty-icon { color: var(--fg3); }
.empty-icon svg { width: 36px; height: 36px; }
.empty-sub { font-size: 0.85rem; color: var(--fg3); }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}
.page-info { font-size: 0.75rem; color: var(--fg3); font-family: var(--mono); }
.page-btns { display: flex; align-items: center; gap: 8px; }
.page-btns span { font-size: 0.8rem; color: var(--fg2); min-width: 80px; text-align: center; }

/* ─── Config sections ───────────────────────────────────── */
.config-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.config-section {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.config-section.full { grid-column: span 2; }
.section-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-head svg { width: 15px; height: 15px; color: var(--primary-light); }
.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg2);
}
.section-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }

/* Form elements */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-lbl { font-size: 0.8rem; font-weight: 500; color: var(--fg2); }
.form-input, .form-select, .form-textarea {
  padding: 9px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-size: 0.85rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); }
.form-input::placeholder, .form-textarea::placeholder { color: var(--fg3); }
.form-textarea { min-height: 100px; resize: vertical; }
.form-textarea.tall { min-height: 160px; }

/* Site toggles in config */
.cfg-site-list { display: flex; flex-direction: column; gap: 10px; }
.cfg-site-list .check-label { font-size: 0.85rem; }

/* DB management */
.db-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.db-info-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.db-info-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg3);
  margin-bottom: 10px;
}
.db-info-row {
  font-size: 0.82rem;
  line-height: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}
.db-info-row svg { width: 13px; height: 13px; color: var(--fg3); flex-shrink: 0; }
.db-info-row strong { color: var(--fg); }
.db-meta { font-size: 0.7rem; color: var(--fg3); margin-top: 6px; font-family: var(--mono); }
.db-action-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.db-action-group { display: flex; flex-direction: column; gap: 8px; }
.db-action-lbl {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg3);
}
.db-btn-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* Save bar */
.save-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
  flex-wrap: wrap;
}
.save-hint { font-size: 0.78rem; color: var(--warning); }

/* ─── Shared buttons ────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-sm { padding: 6px 12px; font-size: 0.75rem; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 0 16px var(--primary-glow); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); box-shadow: 0 0 24px rgba(99,102,241,0.4); }
.btn-ghost { background: var(--bg2); color: var(--fg2); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--bg3); color: var(--fg); border-color: var(--border2); }
.btn-danger { background: rgba(239,68,68,0.1); color: var(--danger); border: 1px solid rgba(239,68,68,0.25); }
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.2); }

/* ─── Detail panel ──────────────────────────────────────── */
.detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 150;
  backdrop-filter: blur(4px);
}
.detail-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 440px;
  background: var(--bg1);
  border-left: 1px solid var(--border);
  z-index: 200;
  overflow-y: auto;
  box-shadow: -20px 0 60px rgba(0,0,0,0.6);
}
.detail-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100%;
}
.detail-top { display: flex; justify-content: space-between; align-items: flex-start; }
.detail-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.close-btn {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--fg2);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
}
.close-btn:hover { border-color: var(--border2); color: var(--fg); }
.detail-city { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.detail-address { font-size: 0.82rem; color: var(--fg3); margin-top: -0.5rem; }
.detail-price-block {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.detail-price-row { display: flex; justify-content: space-between; align-items: baseline; }
.detail-price-row.total { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 2px; }
.dp-label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg3); }
.dp-val { font-size: 1rem; font-weight: 600; }
.detail-price-row.total .dp-val { font-size: 1.25rem; color: var(--primary-light); }
.detail-meta { font-size: 0.75rem; color: var(--fg3); font-family: var(--mono); }
.detail-desc-block { display: flex; flex-direction: column; gap: 8px; }
.detail-desc-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary-light);
  opacity: 0.8;
}
.detail-desc {
  font-size: 0.82rem;
  color: var(--fg2);
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg2);
  padding: 14px;
  border-radius: 8px;
  border-left: 2px solid var(--primary);
}
.detail-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.open-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--primary);
  color: #fff;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s;
  box-shadow: 0 0 16px var(--primary-glow);
}
.open-btn:hover { background: var(--primary-dark); box-shadow: 0 0 24px rgba(99,102,241,0.4); }
.dismiss-btn {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg2);
  color: var(--fg2);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.dismiss-btn:hover { background: var(--bg3); color: var(--fg); border-color: var(--border2); }

/* ─── Spinner ───────────────────────────────────────────── */
.spin { animation: spinning 0.7s linear infinite; display: inline-block; }
@keyframes spinning { to { transform: rotate(360deg); } }

/* ─── Toasts ────────────────────────────────────────────── */
.toast-stack {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
  min-width: 280px;
  max-width: 380px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--primary); }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast.success svg { color: var(--success); }
.toast.error   svg { color: var(--danger); }
.toast.info    svg { color: var(--primary-light); }
@keyframes toastIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ─── Alpine transitions ────────────────────────────────── */
.t-fade { transition: opacity 0.2s ease; }
.opacity-0 { opacity: 0; }
.opacity-1 { opacity: 1; }
.t-slide { transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1); }
.translate-out { transform: translateX(100%); }
.translate-in  { transform: translateX(0); }

/* ─── Mobile bottom nav ─────────────────────────────────── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 300;
  background: rgba(11, 17, 32, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.mobile-nav-inner {
  display: flex;
  align-items: stretch;
  height: 60px;
}
.mobile-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg3);
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  transition: color 0.15s;
  padding: 8px 4px;
}
.mobile-tab svg { width: 20px; height: 20px; }
.mobile-tab.active { color: var(--primary-light); }
.mobile-tab.active svg { filter: drop-shadow(0 0 6px var(--primary-glow)); }

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 960px) {
  .header-inner { grid-template-columns: 160px 1fr auto; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: span 1; }
  .config-sections { grid-template-columns: 1fr; }
  .config-section.full { grid-column: span 1; }
  .db-info-grid { grid-template-columns: 1fr; }
  .db-action-groups { grid-template-columns: 1fr; }
  .detail-panel { width: 100%; }
}

@media (max-width: 640px) {
  /* Hide header tabs, show bottom nav */
  .tab-nav { display: none; }
  .mobile-nav { display: block; }
  /* Pad main content so bottom nav doesn't overlap */
  main { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }

  /* Header: logo + status only */
  .header-inner { grid-template-columns: 1fr auto; }
  .logo { border-right: none; padding: 0 16px; }
  .header-right { border-left: none; padding: 0 16px; gap: 8px; }
  .last-scan { display: none; }

  .panel { padding: 16px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 16px 18px; }
  .stat-value { font-size: 1.8rem; }
  .filter-bar { flex-direction: column; align-items: stretch; padding: 12px 16px; }
  .filter-group { flex-wrap: wrap; }
  .f-search { min-width: 0; }
  .filter-sep { display: none; }
  .detail-panel { top: auto; height: 90dvh; border-left: none; border-top: 1px solid var(--border); }
  .config-sections { gap: 12px; }
  .toast-stack { left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; max-width: 100%; }
}
