/* ============================================================
   HuntMonitor — Design System & Global Styles
   Dark glassmorphism theme, premium feel
   ============================================================ */

/* --- Dark Theme (default) --- */
:root {
  --bg-base: #0a0b0f;
  --bg-surface: #111218;
  --bg-elevated: #191b25;
  --bg-hover: #1e2030;
  --border: rgba(255, 255, 255, 0.07);
  --border-accent: rgba(99, 102, 241, 0.35);

  --text-primary: #e8eaf6;
  --text-muted: #7b7f9e;
  --text-dim: #4a4f6a;

  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --green: #10b981;
  --green-dim: rgba(16, 185, 129, 0.15);
  --yellow: #f59e0b;
  --yellow-dim: rgba(245, 158, 11, 0.15);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.15);
  --purple: #8b5cf6;
  --purple-dim: rgba(139, 92, 246, 0.15);
  --cyan: #06b6d4;

  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --sidebar-w: 220px;
  --topbar-h: 60px;
  --transition: 0.18s ease;
}

/* --- Light Theme --- */
[data-theme="light"] {
  --bg-base: #f0f2f8;
  --bg-surface: #ffffff;
  --bg-elevated: #eef0f8;
  --bg-hover: #e5e8f5;
  --border: rgba(0, 0, 0, 0.08);
  --border-accent: rgba(99, 102, 241, 0.4);

  --text-primary: #1a1d2e;
  --text-muted: #5a5f7d;
  --text-dim: #9299b8;

  --accent: #5558e0;
  --accent-glow: rgba(85, 88, 224, 0.12);
  --green: #059669;
  --green-dim: rgba(5, 150, 105, 0.12);
  --yellow: #d97706;
  --yellow-dim: rgba(217, 119, 6, 0.12);
  --red: #dc2626;
  --red-dim: rgba(220, 38, 38, 0.1);
  --purple: #7c3aed;
  --purple-dim: rgba(124, 58, 237, 0.1);
  --cyan: #0891b2;
}

/* Smooth theme transitions */
*,
*::before,
*::after {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.15s ease, box-shadow 0.25s ease;
}

/* But keep interactive transitions snappy (they'll inherit the above, override for controls) */
.btn,
.chip,
.nav-item,
.icon-btn,
.toggle,
.page-btn,
.row-check,
input,
select,
textarea {
  transition: all var(--transition);
}


/* --- Reset --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  height: 100%;
  display: flex;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: var(--font);
}

input,
select,
textarea {
  font-family: var(--font);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.logo-icon {
  font-size: 20px;
  filter: drop-shadow(0 0 6px var(--accent));
}

.logo-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 5px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  position: relative;
}

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

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid var(--border-accent);
}

.nav-icon {
  font-size: 14px;
  opacity: 0.9;
}

.nav-badge {
  margin-left: auto;
  background: var(--red-dim);
  color: var(--red);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}

.api-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-dim);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: background 0.5s;
}

.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.status-dot.offline {
  background: var(--red);
}

/* ============================================================
   MAIN
   ============================================================ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.page-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

/* --- Pages --- */
.page {
  display: none;
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  gap: 20px;
  flex-direction: column;
}

.page.active {
  display: flex;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: #5558e0;
  box-shadow: 0 0 12px var(--accent-glow);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-outline:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

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

.btn-ghost:hover {
  color: var(--text-primary);
}

.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
}

.accent-green {
  border-color: rgba(16, 185, 129, 0.3) !important;
  color: var(--green) !important;
}

.accent-green:hover {
  background: var(--green-dim) !important;
}

.accent-yellow {
  border-color: rgba(245, 158, 11, 0.3) !important;
  color: var(--yellow) !important;
}

.accent-muted {
  color: var(--text-dim) !important;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top left, var(--accent-glow), transparent 70%);
  opacity: 0;
  transition: opacity var(--transition);
}

.stat-card:hover {
  border-color: var(--border-accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card.accent-green::before {
  background: radial-gradient(ellipse at top left, var(--green-dim), transparent 70%);
}

.stat-card.accent-green:hover {
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 20px var(--green-dim);
}

.stat-card.accent-yellow::before {
  background: radial-gradient(ellipse at top left, var(--yellow-dim), transparent 70%);
}

.stat-card.accent-yellow:hover {
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 0 20px var(--yellow-dim);
}

.stat-card.accent-purple::before {
  background: radial-gradient(ellipse at top left, var(--purple-dim), transparent 70%);
}

.stat-card.accent-purple:hover {
  border-color: rgba(139, 92, 246, 0.35);
  box-shadow: 0 0 20px var(--purple-dim);
}

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

.stat-value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--text-primary);
}

/* ============================================================
   CHARTS
   ============================================================ */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chart-card {
  overflow: visible;
}

.chart-wide {
  grid-column: 1 / -1;
}

.chart-wrap {
  padding: 16px;
  height: 220px;
  position: relative;
}

/* ============================================================
   FILTER PANEL
   ============================================================ */
.filter-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 7px 12px;
  font-size: 13px;
  flex: 1;
  min-width: 160px;
  transition: border-color var(--transition);
  outline: none;
}

.filter-input:focus {
  border-color: var(--accent);
}

.filter-input.filter-short {
  flex: 0 0 160px;
}

.filter-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 7px 12px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.filter-select:focus {
  border-color: var(--accent);
}

/* Chips */
.status-chips,
.state-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.chip:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.chip.active {
  background: var(--accent-glow);
  border-color: var(--border-accent);
  color: var(--accent);
}

.chip-2xx.active {
  background: var(--green-dim);
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--green);
}

.chip-3xx.active {
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.4);
  color: var(--cyan);
}

.chip-4xx.active {
  background: var(--yellow-dim);
  border-color: rgba(245, 158, 11, 0.4);
  color: var(--yellow);
}

.chip-5xx.active {
  background: var(--red-dim);
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--red);
}

/* ============================================================
   VIEWS BAR
   ============================================================ */
.views-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.views-label {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.views-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.view-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.view-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
}

.view-chip .del {
  opacity: 0.4;
  font-size: 10px;
  margin-left: 2px;
}

.view-chip:hover .del {
  opacity: 0.8;
}

/* ============================================================
   BULK BAR
   ============================================================ */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#bulk-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  min-width: 80px;
}

.bulk-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================
   DATA TABLE
   ============================================================ */
.table-card {
  overflow: visible;
  margin: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

.data-table th[data-sort] {
  cursor: pointer;
}

.data-table th[data-sort]:hover {
  color: var(--text-muted);
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: var(--bg-hover);
}

.data-table tr.selected td {
  background: rgba(99, 102, 241, 0.07);
}

/* Column widths */
.col-check {
  width: 36px;
}

.col-status {
  width: 70px;
}

.col-url {
  max-width: 360px;
  overflow: hidden;
}

.col-len {
  width: 80px;
  text-align: right;
}

.col-words {
  width: 70px;
  text-align: right;
}

.col-tool {
  width: 100px;
}

.col-tags {
  max-width: 160px;
}

.col-state {
  width: 110px;
}

.col-time {
  width: 130px;
}

/* URL cell */
.url-cell {
  font-family: var(--mono);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 360px;
  display: block;
  cursor: pointer;
  color: var(--text-primary);
}

.url-cell:hover {
  color: var(--accent);
}

/* Status badges */
.badge-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  min-width: 42px;
  text-align: center;
}

.s-2xx {
  background: var(--green-dim);
  color: var(--green);
}

.s-3xx {
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan);
}

.s-4xx {
  background: var(--yellow-dim);
  color: var(--yellow);
}

.s-5xx {
  background: var(--red-dim);
  color: var(--red);
}

.s-other {
  background: var(--bg-elevated);
  color: var(--text-dim);
}

/* Tool badge */
.badge-tool {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-elevated);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.tool-ffuf {
  color: var(--purple);
  border-color: rgba(139, 92, 246, 0.3);
  background: var(--purple-dim);
}

.tool-feroxbuster {
  color: var(--cyan);
  border-color: rgba(6, 182, 212, 0.3);
  background: rgba(6, 182, 212, 0.1);
}

/* State badge */
.badge-state {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.state-new {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
}

.state-interesting {
  background: var(--green-dim);
  color: var(--green);
}

.state-triaged {
  background: rgba(6, 182, 212, 0.12);
  color: var(--cyan);
}

.state-ignored {
  background: var(--bg-elevated);
  color: var(--text-dim);
}

.state-false_positive {
  background: rgba(239, 68, 68, 0.08);
  color: var(--red);
  opacity: 0.7;
}

/* Tag chips */
.tag-chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid var(--border-accent);
  margin: 1px;
}

.tag-admin {
  background: var(--red-dim);
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.3);
}

.tag-backup,
.tag-sensitive {
  background: var(--yellow-dim);
  color: var(--yellow);
  border-color: rgba(245, 158, 11, 0.3);
}

.tag-critical,
.tag-vcs {
  background: var(--red-dim);
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.35);
}

.tag-api {
  background: var(--green-dim);
  color: var(--green);
  border-color: rgba(16, 185, 129, 0.3);
}

.tag-static {
  background: var(--bg-elevated);
  color: var(--text-dim);
  border-color: var(--border);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}

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

.page-btn.active {
  background: var(--accent-glow);
  border-color: var(--border-accent);
  color: var(--accent);
  font-weight: 600;
}

.page-info {
  font-size: 12px;
  color: var(--text-dim);
  padding: 0 8px;
}

/* ============================================================
   FINDING DRAWER
   ============================================================ */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
  display: none;
  animation: fadeIn 0.2s ease;
}

.drawer-overlay.open {
  display: block;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 520px;
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  z-index: 50;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.drawer.open {
  transform: translateX(0);
}

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

.drawer-title {
  font-weight: 600;
  font-size: 15px;
}

.drawer-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}

.drawer-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.drawer-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-value {
  font-size: 13px;
  color: var(--text-primary);
  word-break: break-all;
}

.detail-value.mono {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg-elevated);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Sectioned drawer layout */
.detail-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.detail-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-dim);
  padding: 7px 12px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.detail-section .detail-row {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.detail-section .detail-row:last-child {
  border-bottom: none;
}

.detail-section .detail-grid {
  padding: 8px 12px;
  gap: 8px;
}

.detail-section .detail-grid .detail-row {
  padding: 0;
  border: none;
}

.detail-value-wrap {
  font-size: 13px;
  color: var(--text-primary);
}

.drawer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

textarea.notes-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 13px;
  resize: vertical;
  width: 100%;
  min-height: 80px;
  font-family: var(--font);
  outline: none;
}

textarea.notes-input:focus {
  border-color: var(--accent);
}

/* ============================================================
   RULES PAGE
   ============================================================ */
.rules-header {
  display: flex;
  gap: 10px;
  margin-bottom: 4px;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}

.rule-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rule-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.rule-card.disabled {
  opacity: 0.5;
}

.rule-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.rule-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.rule-priority {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
}

.rule-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.rule-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rule-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.rule-json {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  white-space: pre-wrap;
  word-break: break-all;
}

.rule-actions-row {
  display: flex;
  gap: 6px;
}

/* Toggle switch */
.toggle {
  width: 34px;
  height: 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 9px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform 0.2s, background 0.2s;
}

.toggle.on {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle.on::after {
  background: #fff;
  transform: translateX(16px);
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 520px;
  max-width: calc(100vw - 40px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.modal-sm {
  width: 360px;
}

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

.modal-title {
  font-size: 15px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group small {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 400;
}

.form-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}

.form-input:focus {
  border-color: var(--accent);
}

.form-input.mono {
  font-family: var(--mono);
  font-size: 12px;
}

/* ============================================================
   SCANS PAGE
   ============================================================ */
.scan-status-running {
  color: var(--yellow);
}

.scan-status-done {
  color: var(--green);
}

.scan-status-error {
  color: var(--red);
}

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-dim);
  gap: 10px;
  text-align: center;
}

.empty-icon {
  font-size: 40px;
  opacity: 0.5;
}

.empty-text {
  font-size: 14px;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  height: 14px;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.25s ease forwards;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .chart-wide {
    grid-column: auto;
  }

  .drawer {
    width: 100vw;
  }
}

/* ============================================================
   SMART QUERY BAR
   ============================================================ */
.query-bar-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;
}

.query-bar-inner {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 4px 8px 4px 14px;
}

.qb-icon {
  font-size: 15px;
  color: var(--text-dim);
  margin-right: 8px;
  flex-shrink: 0;
  opacity: 0.7;
}

.query-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 13px;
  padding: 8px 0;
  min-width: 0;
}

.query-input::placeholder {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
}

.query-bar-inner .btn {
  margin-left: 8px;
  flex-shrink: 0;
}

.qb-hint {
  padding: 5px 16px 8px;
  font-size: 11px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.qb-hint code {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
}

/* ============================================================
   FILTER CHIPS ROW
   ============================================================ */
.filter-chips-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sep-v {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}

.filter-select-sm {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  padding: 4px 10px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.filter-select-sm:focus {
  border-color: var(--accent);
  color: var(--text-primary);
}

/* ============================================================
   URL ROW — inline copy + open buttons
   ============================================================ */
.url-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.url-actions {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
  visibility: hidden;
}

tr:hover .url-actions {
  visibility: visible;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-size: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
  border-color: var(--border-accent);
}

/* ============================================================
   COLUMN SORT INDICATORS
   ============================================================ */
.findings-table th[data-sort]::after {
  content: ' ⇅';
  font-size: 10px;
  opacity: 0.3;
}

.findings-table th.sort-asc::after {
  content: ' ↑';
  opacity: 0.7;
  color: var(--accent);
}

.findings-table th.sort-desc::after {
  content: ' ↓';
  opacity: 0.7;
  color: var(--accent);
}

/* ============================================================
   FLASH TOAST
   ============================================================ */
.flash-msg {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  padding: 9px 20px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
  white-space: nowrap;
}

.flash-ok {
  background: var(--green);
  color: #fff;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}

.flash-err {
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}

.flash-out {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
}

/* ============================================================
   LOADING DOTS
   ============================================================ */
.loading-dots span {
  display: inline-block;
  animation: blink 1.4s infinite both;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {

  0%,
  80%,
  100% {
    opacity: 0;
  }

  40% {
    opacity: 1;
  }
}

/* ============================================================
   MISC OVERRIDES
   ============================================================ */
/* Wider URL column now that we have action buttons */
.col-url {
  max-width: 400px;
}

.url-cell {
  max-width: 360px;
}

/* Better distinction: Apply = accent, Reset = ghost with red tint */
#apply-filters-btn {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}

#apply-filters-btn:hover {
  background: #5558e0 !important;
}

#reset-filters-btn {
  color: var(--red) !important;
  opacity: 0.7;
}

#reset-filters-btn:hover {
  opacity: 1;
  background: var(--red-dim) !important;
}

/* Bulk bar improved - danger button */
#bulk-delete-btn {
  border-color: rgba(239, 68, 68, 0.3) !important;
}

#bulk-delete-btn:hover {
  background: var(--red-dim) !important;
}

/* Nav badge only visible when > 0 */
.nav-badge {
  display: inline;
}

/* ============================================================
   THEME TOGGLE BUTTON
   ============================================================ */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 7px 10px;
  margin-bottom: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}

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

/* Show correct label based on theme */
.theme-icon-dark {
  display: inline;
}

.theme-icon-light {
  display: none;
}

[data-theme="light"] .theme-icon-dark {
  display: none;
}

[data-theme="light"] .theme-icon-light {
  display: inline;
}

/* ============================================================
   LIGHT MODE FINE-TUNING
   ============================================================ */
[data-theme="light"] .card,
[data-theme="light"] .stat-card {
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.07);
}

[data-theme="light"] .drawer-overlay {
  background: rgba(0, 0, 0, 0.25);
}

[data-theme="light"] .modal-overlay {
  background: rgba(0, 0, 0, 0.35);
}

[data-theme="light"] .query-input {
  color: #1a1d2e;
}

[data-theme="light"] .data-table tr:hover td {
  background: rgba(85, 88, 224, 0.05);
}

[data-theme="light"] .data-table tr.selected td {
  background: rgba(85, 88, 224, 0.08);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.14);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.24);
}

[data-theme="light"] .nav-item.active {
  background: rgba(85, 88, 224, 0.08);
  border-color: rgba(85, 88, 224, 0.3);
}

[data-theme="light"] .rule-json {
  color: #0891b2;
}

[data-theme="light"] .s-2xx {
  background: rgba(5, 150, 105, 0.12);
}

[data-theme="light"] .s-3xx {
  background: rgba(8, 145, 178, 0.12);
}

[data-theme="light"] .s-4xx {
  background: rgba(217, 119, 6, 0.12);
}

[data-theme="light"] .s-5xx {
  background: rgba(220, 38, 38, 0.10);
}

[data-theme="light"] .s-other {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-dim);
}

[data-theme="light"] .logo-icon {
  filter: drop-shadow(0 0 5px rgba(85, 88, 224, 0.5));
}

[data-theme="light"] .bulk-bar {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .filter-panel,
[data-theme="light"] .query-bar-wrap {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}