:root {
  --bg-0: #060a12;
  --bg-1: #0c1322;
  --bg-2: #121c31;
  --bg-3: #182540;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(56, 189, 248, 0.35);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --cyan: #22d3ee;
  --cyan-dark: #0891b2;
  --emerald: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 42px rgba(2, 6, 23, 0.55);
  --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(34, 211, 238, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(34, 211, 238, 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  top: -180px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 460px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.16), transparent 65%);
  pointer-events: none;
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  width: min(1240px, 94vw);
  margin: 0 auto;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(14px);
  background: rgba(6, 10, 18, 0.86);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.22), rgba(16, 185, 129, 0.18));
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  color: var(--cyan);
}

.brand-icon svg {
  width: 22px;
  height: 22px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.brand-text small {
  font-size: 0.72rem;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 8px 13px;
  border-radius: 9px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: 0.18s ease;
}

.nav-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.nav-btn.active {
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
  border-color: rgba(34, 211, 238, 0.3);
}

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

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

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

/* Main Content & Cards */
.main-content {
  padding: 26px 0 60px;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.2s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: linear-gradient(180deg, rgba(18, 28, 49, 0.85), rgba(12, 19, 34, 0.92));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

h1, h2, h3, h4 {
  margin-top: 0;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  line-height: 1.15;
  margin-bottom: 12px;
}

h2 {
  font-size: 1.35rem;
  margin-bottom: 6px;
}

.muted {
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* Buttons & Chips */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.18s ease;
  color: var(--text);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.82rem;
}

.btn-primary {
  background: linear-gradient(135deg, #06b6d4, #0284c7);
  color: #04131c;
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(34, 211, 238, 0.12);
  border-color: rgba(34, 211, 238, 0.32);
  color: var(--cyan);
}

.btn-secondary:hover {
  background: rgba(34, 211, 238, 0.2);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.26);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.4);
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--cyan);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.link-btn:hover {
  text-decoration: underline;
}

.chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: 0.16s ease;
}

.chip:hover, .chip.active {
  color: var(--cyan);
  border-color: rgba(34, 211, 238, 0.45);
  background: rgba(34, 211, 238, 0.1);
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 24px;
  align-items: center;
  border-color: rgba(34, 211, 238, 0.22);
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.28);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.2);
}

.hero-sub {
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 1rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.telemetry-card {
  background: rgba(6, 10, 18, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.telemetry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.stat-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
}

.text-danger { color: var(--red); }
.text-warn { color: var(--amber); }
.text-cyan { color: var(--cyan); }
.text-safe { color: var(--emerald); }

.privacy-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.24);
  padding: 9px 11px;
  border-radius: 8px;
}

/* Quick Triage & Forms */
.section-head, .panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.quick-presets, .preset-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-input-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.quick-input-row textarea {
  flex: 1;
}

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  background: rgba(6, 10, 18, 0.82);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.92rem;
  transition: border-color 0.16s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--cyan);
}

.code-textarea {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.5;
}

.form-group {
  margin-bottom: 14px;
}

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

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

/* Grids */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.icon-cyan { background: rgba(34, 211, 238, 0.16); color: var(--cyan); }
.icon-amber { background: rgba(245, 158, 11, 0.16); color: var(--amber); }
.icon-emerald { background: rgba(16, 185, 129, 0.16); color: var(--emerald); }

.split-layout {
  display: grid;
  grid-template-columns: 1fr 1.12fr;
  gap: 20px;
  align-items: start;
}

/* Badges & Results */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-safe { background: rgba(16, 185, 129, 0.16); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.35); }
.badge-warn { background: rgba(245, 158, 11, 0.16); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.35); }
.badge-danger { background: rgba(239, 68, 68, 0.18); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }
.badge-cyan { background: rgba(34, 211, 238, 0.15); color: var(--cyan); border: 1px solid rgba(34, 211, 238, 0.35); }

.empty-result {
  text-align: center;
  padding: 46px 18px;
}

.shield-illustration {
  width: 60px;
  height: 60px;
  margin: 0 auto 14px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.3);
}

.hidden {
  display: none !important;
}

.verdict-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.verdict-banner.safe { background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.35); }
.verdict-banner.warn { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.35); }
.verdict-banner.danger { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.42); }

.verdict-kicker {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.verdict-banner h3 {
  margin: 2px 0 0;
  font-size: 1.2rem;
}

.score-ring {
  text-align: right;
}

.score-ring strong {
  display: block;
  font-size: 1.6rem;
  line-height: 1;
}

.score-ring span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sub-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.metric-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.metric-pill strong {
  color: var(--text);
}

.block {
  margin-bottom: 16px;
}

.block h4 {
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.highlighted-box {
  background: rgba(6, 10, 18, 0.78);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
}

mark.trig-high {
  background: rgba(239, 68, 68, 0.28);
  color: #fecaca;
  border-bottom: 2px solid var(--red);
  padding: 0 3px;
  border-radius: 3px;
}

mark.trig-warn {
  background: rgba(245, 158, 11, 0.25);
  color: #fde68a;
  border-bottom: 2px solid var(--amber);
  padding: 0 3px;
  border-radius: 3px;
}

.signal-bars {
  display: grid;
  gap: 8px;
}

.signal-row {
  display: grid;
  grid-template-columns: 155px 1fr 42px;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
}

.bar-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.findings-list, .advice-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.88rem;
}

.findings-list li, .advice-list li {
  margin-bottom: 6px;
}

/* Bug Findings */
.bug-findings-list {
  display: grid;
  gap: 10px;
}

.bug-item {
  background: rgba(6, 10, 18, 0.78);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  padding: 12px;
}

.bug-item.Critical, .bug-item.High { border-left-color: var(--red); }
.bug-item.Medium { border-left-color: var(--amber); }
.bug-item.Low { border-left-color: var(--cyan); }

.bug-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.bug-code-snippet {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 8px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 6px 0;
  color: #fda4af;
}

.bug-fix {
  font-size: 0.82rem;
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.08);
  padding: 6px 8px;
  border-radius: 6px;
}

.url-anatomy {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.url-part {
  background: rgba(6, 10, 18, 0.75);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.8rem;
  word-break: break-all;
}

.url-part span {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* History & Threat Feed */
.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: rgba(6, 10, 18, 0.65);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.86rem;
}

.feed-toolbar {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 12px;
}

.feed-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.feed-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.feed-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.feed-sample {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: rgba(6, 10, 18, 0.82);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px;
  color: #cbd5e1;
  word-break: break-word;
}

.feed-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Prevention Hub */
.prevent-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 20px;
}

.quiz-prompt {
  background: rgba(6, 10, 18, 0.75);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 14px;
  font-size: 0.92rem;
}

.quiz-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.quiz-feedback {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.86rem;
  margin-bottom: 12px;
}

.quiz-feedback.correct { background: rgba(16, 185, 129, 0.14); border: 1px solid rgba(16, 185, 129, 0.4); }
.quiz-feedback.wrong { background: rgba(239, 68, 68, 0.14); border: 1px solid rgba(239, 68, 68, 0.4); }

.playbook-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.playbook-box {
  background: rgba(6, 10, 18, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 16px;
}

.playbook-box label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 8px;
}

.playbook-box input[type="checkbox"] {
  width: auto;
  margin-top: 4px;
}

.reporting-dirs ul {
  padding-left: 18px;
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.reporting-dirs li {
  margin-bottom: 5px;
}

code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--cyan);
}

.ai-copilot-box {
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 0.88rem;
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.76);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  z-index: 2;
  width: min(560px, 95vw);
  margin: 0;
}

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

.footer {
  border-top: 1px solid var(--border);
  padding: 18px 0;
  background: rgba(6, 10, 18, 0.8);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.84rem;
}

@media (max-width: 960px) {
  .hero, .split-layout, .feature-grid, .feed-grid, .prevent-grid, .feed-toolbar {
    grid-template-columns: 1fr;
  }
  .quick-input-row, .form-row-2 {
    grid-template-columns: 1fr;
    flex-direction: column;
  }
}
