:root {
  --bg: #07090d;
  --bg-elev: #0d1117;
  --bg-card: #121821;
  --border: #1f2937;
  --border-soft: #1a222e;
  --fg: #e6edf3;
  --fg-muted: #8b97a7;
  --accent: #ff2452;
  --accent-soft: rgba(255, 36, 82, 0.12);
  --ok: #1fd576;
  --crit: #ff2452;
  --high: #ff8800;
  --med: #ffcc00;
  --low: #00aaff;
  --info: #6b7785;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; line-height: 1.5; }

a { color: var(--accent); text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea {
  font: inherit; background: var(--bg-elev); color: var(--fg);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 9px 11px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: white; padding: 9px 18px;
  border-radius: 6px; font-weight: 600; letter-spacing: 0.2px; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { color: var(--fg-muted); padding: 8px 14px; border: 1px solid var(--border);
  border-radius: 6px; }
.btn-ghost:hover { color: var(--fg); border-color: var(--accent); }

.muted { color: var(--fg-muted); }
.small { font-size: 12px; }
.err { color: var(--crit); font-size: 13px; margin-top: 8px; min-height: 18px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; border-bottom: 1px solid var(--border);
  background: var(--bg-elev); position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700;
  letter-spacing: 1px; }
.logo-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 12px var(--accent); }
.tabs { display: flex; gap: 4px; }
.tab { padding: 8px 16px; border-radius: 6px; color: var(--fg-muted);
  font-weight: 500; }
.tab:hover { color: var(--fg); }
.tab.active { background: var(--accent-soft); color: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.content { padding: 24px; max-width: 1400px; margin: 0 auto; }
.pane { display: none; }
.pane.active { display: block; }
.pane-head { display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; }
.pane-head h2 { margin: 0; font-size: 20px; }
.filter-row { display: flex; gap: 8px; }

.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px;
  margin-bottom: 18px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px; display: flex; flex-direction: column;
  gap: 6px; position: relative; overflow: hidden; }
.stat-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; }
.stat-card.crit::before { background: var(--crit); }
.stat-card.high::before { background: var(--high); }
.stat-card.med::before { background: var(--med); }
.stat-card.low::before { background: var(--low); }
.stat-card.info::before { background: var(--info); }
.stat-num { font-size: 28px; font-weight: 700; font-family: var(--mono); }
.stat-label { color: var(--fg-muted); font-size: 12px; text-transform: uppercase;
  letter-spacing: 1px; }

.row-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-bottom: 18px; }
.card { background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px; }
.card h3 { margin: 0 0 12px; font-size: 14px; text-transform: uppercase;
  letter-spacing: 1px; color: var(--fg-muted); }
.ops { display: flex; gap: 28px; }
.ops strong { font-family: var(--mono); font-size: 20px; margin-left: 8px; }
.quick { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }

.data-table { background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; }
.data-table table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 11px 16px; font-size: 12px;
  color: var(--fg-muted); text-transform: uppercase; letter-spacing: 1px;
  border-bottom: 1px solid var(--border); background: var(--bg-elev); }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255, 255, 255, 0.02); }
.data-table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-mono { font-family: var(--mono); font-size: 12px; color: var(--fg-muted); }

.sev-tag { display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px; }
.sev-tag.CRITICAL { background: rgba(255, 36, 82, 0.18); color: var(--crit); }
.sev-tag.HIGH { background: rgba(255, 136, 0, 0.18); color: var(--high); }
.sev-tag.MEDIUM { background: rgba(255, 204, 0, 0.18); color: var(--med); }
.sev-tag.LOW { background: rgba(0, 170, 255, 0.18); color: var(--low); }
.sev-tag.INFO { background: rgba(107, 119, 133, 0.2); color: var(--info); }

.status-tag { display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; }
.status-tag.queued { background: rgba(107, 119, 133, 0.18); color: var(--fg-muted); }
.status-tag.running { background: rgba(0, 170, 255, 0.18); color: var(--low); }
.status-tag.completed { background: rgba(31, 213, 118, 0.18); color: var(--ok); }
.status-tag.failed { background: rgba(255, 36, 82, 0.18); color: var(--crit); }
.status-tag.cancelled { background: rgba(255, 204, 0, 0.18); color: var(--med); }

.tier-tag { display: inline-block; padding: 2px 7px; border-radius: 4px;
  background: var(--bg-elev); border: 1px solid var(--border);
  font-size: 11px; font-family: var(--mono); color: var(--fg-muted); }

.progress { height: 6px; background: var(--bg-elev); border-radius: 3px;
  overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); transition: width 0.3s; }

.finding-list { display: flex; flex-direction: column; gap: 8px; }
.finding-item { display: grid; grid-template-columns: auto 1fr auto;
  gap: 12px; padding: 12px; background: var(--bg-elev); border-radius: 6px;
  border-left: 3px solid var(--info); align-items: center; cursor: pointer; }
.finding-item:hover { background: rgba(255, 255, 255, 0.02); }
.finding-item.CRITICAL { border-left-color: var(--crit); }
.finding-item.HIGH { border-left-color: var(--high); }
.finding-item.MEDIUM { border-left-color: var(--med); }
.finding-item.LOW { border-left-color: var(--low); }
.finding-item .ftitle { font-weight: 600; }
.finding-item .fmeta { color: var(--fg-muted); font-size: 12px; }

.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.75);
  display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-card { background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px; width: 460px; max-width: 92vw;
  display: flex; flex-direction: column; gap: 12px; }
.modal-card.wide { width: 760px; max-height: 86vh; overflow: auto; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 8px; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px;
  font-size: 13px; }
.kv > span:nth-child(odd) { color: var(--fg-muted); }
pre.evidence { background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 12px; overflow: auto; max-height: 280px;
  font-family: var(--mono); font-size: 12px; }

.auth-screen { position: fixed; inset: 0; background: radial-gradient(
  ellipse at center, rgba(255, 36, 82, 0.08), transparent 60%), var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; padding: 24px; }
.auth-card { background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 14px; padding: 32px; width: 420px; max-width: 92vw;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5); }
.auth-card h2 { margin: 0; font-size: 18px; }
.auth-card input { font-size: 18px; letter-spacing: 4px; text-align: center;
  font-family: var(--mono); padding: 12px; }
.auth-brand { display: flex; flex-direction: column; align-items: center;
  gap: 4px; margin-bottom: 8px; }
.auth-brand .logo-dot { width: 14px; height: 14px; }
.auth-brand .logo-text { font-size: 18px; font-weight: 800; letter-spacing: 4px;
  margin-top: 6px; }
.auth-brand .logo-sub { font-size: 11px; color: var(--fg-muted); letter-spacing: 6px; }
.auth-footer { letter-spacing: 1px; }

.qr-box { display: flex; justify-content: center; padding: 12px;
  background: white; border-radius: 8px; }
.qr-box img { width: 220px; height: 220px; image-rendering: pixelated; }

#secret-row { font-family: var(--mono); word-break: break-all;
  background: var(--bg-elev); padding: 8px; border-radius: 4px; }

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .row-cards { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 8px; }
}

/* === ANIMATIONS === */

@keyframes wz-spin { to { transform: rotate(360deg); } }
@keyframes wz-pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(255, 36, 82, 0.55); }
  70% { box-shadow: 0 0 0 14px rgba(255, 36, 82, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 36, 82, 0); }
}
@keyframes wz-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes wz-slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes wz-pop-in {
  0% { opacity: 0; transform: scale(0.9); }
  60% { opacity: 1; transform: scale(1.04); }
  100% { transform: scale(1); }
}
@keyframes wz-scan-line {
  0% { left: -30%; }
  100% { left: 100%; }
}
@keyframes wz-dot-blink {
  0%, 60% { opacity: 1; }
  60.001%, 100% { opacity: 0.15; }
}
@keyframes wz-flash {
  0% { background: rgba(255, 36, 82, 0.18); }
  100% { background: transparent; }
}
@keyframes wz-logo-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 12px var(--accent); }
  50% { transform: scale(1.25); box-shadow: 0 0 20px var(--accent); }
}

.logo-dot.scanning { animation: wz-logo-pulse 1.2s ease-in-out infinite; }

.spinner {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: wz-spin 0.8s linear infinite;
  vertical-align: -2px; margin-right: 6px;
}

.btn-primary[disabled], .btn-ghost[disabled] {
  opacity: 0.6; cursor: not-allowed;
}
.btn-primary.is-busy {
  background: linear-gradient(90deg, var(--accent) 0%, #ff5577 50%, var(--accent) 100%);
  background-size: 200% 100%;
  animation: wz-shimmer 1.4s linear infinite;
}

.progress.is-active {
  position: relative; overflow: hidden;
}
.progress.is-active > div {
  background: linear-gradient(90deg, var(--accent), #ff8800, var(--accent));
  background-size: 200% 100%;
  animation: wz-shimmer 1.6s linear infinite;
  min-width: 4px;
}
.progress.is-active::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 30%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  animation: wz-scan-line 1.8s ease-in-out infinite;
}

.status-tag.running, .status-tag.queued { position: relative; }
.status-tag.running::before {
  content: "●"; margin-right: 4px; color: var(--low);
  animation: wz-dot-blink 1s ease-in-out infinite;
}
.status-tag.queued::before {
  content: "●"; margin-right: 4px; color: var(--fg-muted);
  animation: wz-dot-blink 1.4s ease-in-out infinite;
}

.data-table tr.is-running td {
  background: rgba(0, 170, 255, 0.04);
  position: relative;
}
.data-table tr.is-running td:first-child {
  border-left: 2px solid var(--low);
  box-shadow: inset 4px 0 8px -4px var(--low);
}

.finding-item.is-new { animation: wz-pop-in 0.45s cubic-bezier(.2,.9,.3,1.3); }
.finding-item.is-flash { animation: wz-flash 1.4s ease-out; }

.stat-card.is-bump .stat-num {
  animation: wz-pop-in 0.45s cubic-bezier(.2,.9,.3,1.5);
  color: var(--accent);
  transition: color 0.6s;
}

.toast-stack {
  position: fixed; top: 20px; right: 20px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 10px 14px; border-radius: 6px;
  min-width: 240px; max-width: 380px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  animation: wz-slide-in 0.3s ease-out;
  pointer-events: auto; cursor: pointer;
  font-size: 13px;
}
.toast .toast-title { font-weight: 700; margin-bottom: 2px; }
.toast .toast-body { color: var(--fg-muted); font-size: 12px; }
.toast.is-info { border-left-color: var(--low); }
.toast.is-success { border-left-color: var(--ok); }
.toast.is-warn { border-left-color: var(--med); }
.toast.is-err { border-left-color: var(--crit); }
.toast.is-leaving { opacity: 0; transform: translateX(20px); transition: all 0.3s; }

.quick-launch-busy {
  position: relative; overflow: hidden;
}
.quick-launch-busy::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 200% 100%;
  animation: wz-shimmer 1.2s linear infinite;
}

.live-progress { display: inline-flex; align-items: center; gap: 6px; }
.live-progress.is-streaming::after {
  content: "●"; color: var(--low); animation: wz-dot-blink 1s ease-in-out infinite;
}

.live-feed {
  background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: 6px; padding: 8px 10px; margin-top: 8px;
  font-family: var(--mono); font-size: 11px; color: var(--fg-muted);
  max-height: 120px; overflow-y: auto;
}
.live-feed .feed-line { padding: 1px 0; animation: wz-slide-in 0.25s; }
.live-feed .feed-line.is-finding { color: var(--fg); }
.live-feed .feed-line.is-finding[data-sev="CRITICAL"] { color: var(--crit); }
.live-feed .feed-line.is-finding[data-sev="HIGH"] { color: var(--high); }
.live-feed .feed-line.is-finding[data-sev="MEDIUM"] { color: var(--med); }

.is-scanning .topbar { box-shadow: 0 0 0 1px rgba(0, 170, 255, 0.25); }

