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

:root {
  --primary: #2dd4a0;
  --primary-dim: rgba(45, 212, 160, 0.15);
  --accent: #facc15;
  --bg: #0a0f1c;
  --bg-2: #060912;
  --sidebar: #060a14;
  --card: rgba(15, 23, 42, 0.7);
  --card-solid: #131c30;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --text-faint: #475569;
  --border: rgba(45, 212, 160, 0.25);
  --border-soft: rgba(255, 255, 255, 0.06);
  --critical: #dc2626;
  --high: #f87171;
  --medium: #fb923c;
  --low: #facc15;
  --success: #2dd4a0;
  --info: #60a5fa;
  --mono: 'JetBrains Mono', 'Consolas', monospace;
  --radius: 12px;
  --sidebar-w: 240px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', sans-serif;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(45, 212, 160, 0.08), transparent),
    radial-gradient(ellipse 60% 50% at 100% 50%, rgba(248, 113, 113, 0.05), transparent),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  line-height: 1.55;
}

button { font-family: inherit; }

/* ───── LAYOUT ───── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ───── SIDEBAR ───── */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 1.2rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sb-top {
  padding: 0 1.4rem 1.3rem;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 1rem;
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--primary);
  font-weight: 800;
  font-size: 1.15rem;
}

.brand-mark { font-size: 1.6rem; }

.brand-text span {
  background: linear-gradient(135deg, var(--primary), #4ade80);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sb-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0 0.8rem;
}

.sb-link {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 500;
  text-align: left;
  width: 100%;
  position: relative;
  transition: all 0.15s;
}

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

.sb-link.active {
  background: var(--primary-dim);
  color: var(--primary);
}

.sb-icon { font-size: 1.15rem; flex-shrink: 0; }

.sb-pulse {
  width: 8px;
  height: 8px;
  background: var(--critical);
  border-radius: 50%;
  margin-left: auto;
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.6); }
  50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}

.sb-bottom {
  padding: 1rem 1.4rem 0;
  border-top: 1px solid var(--border-soft);
  margin-top: 1rem;
}

.back-link {
  display: inline-block;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  margin-bottom: 0.8rem;
  transition: all 0.2s;
}

.back-link:hover {
  background: var(--primary-dim);
  transform: translateX(-3px);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--success);
  font-size: 0.82rem;
  font-weight: 600;
}

.status-dot {
  width: 9px;
  height: 9px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(45, 212, 160, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(45, 212, 160, 0); }
}

/* ───── MAIN ───── */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: rgba(10, 15, 28, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.mobile-menu {
  display: none;
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
}

.page-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  flex: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.live-clock {
  font-family: var(--mono);
  color: var(--primary);
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--primary-dim);
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.threat-level {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: rgba(251, 146, 60, 0.15);
  border: 1px solid rgba(251, 146, 60, 0.3);
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--medium);
  letter-spacing: 1px;
}

.tl-dot {
  width: 9px;
  height: 9px;
  background: var(--medium);
  border-radius: 50%;
  animation: pulse-orange 1.5s infinite;
}

@keyframes pulse-orange {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 146, 60, 0.6); }
  50% { box-shadow: 0 0 0 6px rgba(251, 146, 60, 0); }
}

/* ───── PAGE ───── */
.page {
  padding: 2rem;
  animation: fadeIn 0.3s ease;
}

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

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filters {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  flex: 1;
}

.filters input,
.filters select {
  background: var(--card);
  border: 1.5px solid var(--border-soft);
  border-radius: 8px;
  color: var(--text);
  padding: 0.6rem 0.9rem;
  font-family: inherit;
  font-size: 0.9rem;
  min-width: 160px;
}

.filters input:focus, .filters select:focus {
  outline: none;
  border-color: var(--primary);
}

/* ───── BUTTONS ───── */
.btn-primary, .btn-ghost, .btn-pause, .chip-btn {
  font-family: inherit;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  border: none;
  font-size: 0.9rem;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #22b387);
  color: #0a0f1c;
  padding: 0.7rem 1.4rem;
  box-shadow: 0 6px 20px rgba(45, 212, 160, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(45, 212, 160, 0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--border);
  padding: 0.55rem 1.1rem;
}

.btn-ghost:hover { background: var(--primary-dim); }

.btn-pause {
  background: rgba(248, 113, 113, 0.15);
  color: var(--high);
  border: 1.5px solid rgba(248, 113, 113, 0.3);
  padding: 0.55rem 1.1rem;
  font-size: 0.85rem;
}

.btn-pause:hover { background: rgba(248, 113, 113, 0.25); }
.btn-pause.paused { background: var(--primary-dim); color: var(--primary); border-color: var(--border); }

.chip-btn {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  border: 1px solid var(--border-soft);
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
}

.chip-btn:hover { background: var(--primary-dim); color: var(--primary); border-color: var(--border); }

/* ───── KPI ───── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.4rem;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  transition: all 0.2s;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px;
  height: 100%;
}

.kpi-card.critical::before { background: var(--critical); }
.kpi-card.warn::before { background: var(--medium); }
.kpi-card.info::before { background: var(--info); }
.kpi-card.success::before { background: var(--success); }

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border);
}

.kpi-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.kpi-icon { font-size: 1.5rem; }

.kpi-trend {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}

.kpi-trend.up { color: var(--high); background: rgba(248, 113, 113, 0.1); }
.kpi-trend.down { color: var(--success); background: var(--primary-dim); }

.kpi-value {
  font-family: var(--mono);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 0.4rem;
}

.kpi-label {
  color: var(--text-dim);
  font-size: 0.82rem;
}

/* ───── DASH GRID ───── */
.dash-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(10px);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.panel h2 { margin: 0; font-size: 1.1rem; }
.panel h3 { margin: 0 0 0.5rem; font-size: 1rem; }

.live-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--critical);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  background: rgba(220, 38, 38, 0.1);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
}

.live-dot {
  width: 6px;
  height: 6px;
  background: var(--critical);
  border-radius: 50%;
  animation: pulse 1s infinite;
}

/* ───── THREAT FEED ───── */
.threat-feed {
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.threat-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.8rem;
  padding: 0.8rem 0.9rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  border-left: 3px solid var(--medium);
  align-items: center;
  animation: slideInRight 0.4s ease;
  font-size: 0.88rem;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.threat-row.critical { border-left-color: var(--critical); }
.threat-row.high { border-left-color: var(--high); }
.threat-row.medium { border-left-color: var(--medium); }
.threat-row.low { border-left-color: var(--low); }

.threat-time {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.threat-info { min-width: 0; }
.threat-type { font-weight: 600; color: var(--text); }
.threat-detail { font-size: 0.78rem; color: var(--text-dim); }
.threat-detail .ip { font-family: var(--mono); color: var(--primary); }

.sev-pill {
  font-size: 0.7rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.sev-pill.critical { background: rgba(220, 38, 38, 0.15); color: var(--critical); }
.sev-pill.high { background: rgba(248, 113, 113, 0.15); color: var(--high); }
.sev-pill.medium { background: rgba(251, 146, 60, 0.15); color: var(--medium); }
.sev-pill.low { background: rgba(250, 204, 21, 0.15); color: var(--low); }

/* ───── SERVICES / ORIGINS LIST ───── */
.services-list, .origins-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.service-item, .origin-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  align-items: center;
}

.service-name, .origin-flag {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.origin-flag-emoji { font-size: 1.2rem; }
.service-port { font-family: var(--mono); color: var(--text-dim); font-size: 0.78rem; }
.service-bar-wrap, .origin-bar-wrap {
  position: relative;
  width: 100%;
  margin-top: 0.4rem;
}

.service-bar, .origin-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  overflow: hidden;
  flex: 1;
}

.service-fill, .origin-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width 0.6s;
}

.service-count, .origin-count {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--high);
  font-size: 0.9rem;
}

/* ───── CHART WRAPS ───── */
.chart-wrap { position: relative; height: 280px; margin-top: 1rem; }
.chart-wrap-sm { position: relative; height: 240px; }

/* ───── THREATS TABLE ───── */
.threats-table-wrap, .table-wrap {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
  backdrop-filter: blur(10px);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.data-table thead {
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--border-soft);
}

.data-table th {
  text-align: left;
  padding: 0.9rem 1.1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 600;
}

.data-table td {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.9rem;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(45, 212, 160, 0.03); }

.mono { font-family: var(--mono); color: var(--primary); }
.row-time { font-family: var(--mono); color: var(--text-dim); font-size: 0.85rem; }

.action-btn {
  background: rgba(248, 113, 113, 0.1);
  color: var(--high);
  border: 1px solid rgba(248, 113, 113, 0.3);
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.2s;
}

.action-btn:hover { background: var(--high); color: #0a0f1c; }

.action-btn.success {
  background: var(--primary-dim);
  color: var(--primary);
  border-color: var(--border);
}

.action-btn.success:hover { background: var(--primary); color: #0a0f1c; }

/* ───── WATCHLIST ───── */
.watchlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.ip-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.3rem;
  backdrop-filter: blur(10px);
  transition: all 0.2s;
}

.ip-card:hover {
  transform: translateY(-2px);
  border-color: var(--border);
}

.ip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.ip-address {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
}

.ip-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.ip-flag-emoji { font-size: 1.2rem; }

.threat-score-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.threat-score-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s;
}

.score-low { background: var(--low); }
.score-medium { background: var(--medium); }
.score-high { background: var(--high); }
.score-critical { background: var(--critical); }

.ip-score-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
  color: var(--text-dim);
}

.ip-score-val { color: var(--text); font-weight: 700; font-family: var(--mono); }

.ip-reason {
  background: rgba(0, 0, 0, 0.25);
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
  color: var(--text-dim);
  border-left: 3px solid var(--medium);
}

.ip-last-seen {
  font-size: 0.78rem;
  color: var(--text-faint);
  font-family: var(--mono);
  margin-bottom: 0.8rem;
}

.ip-actions {
  display: flex;
  gap: 0.5rem;
}

.ip-status {
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ip-status.blocked { background: rgba(220, 38, 38, 0.15); color: var(--critical); }
.ip-status.monitoring { background: rgba(251, 146, 60, 0.15); color: var(--medium); }

/* ───── SCANNER ───── */
.scanner-intro {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(10px);
}

.scanner-intro h2 { margin: 0 0 0.5rem; font-size: 1.3rem; }
.scanner-intro p { color: var(--text-dim); margin: 0; font-size: 0.95rem; }

.scanner-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(10px);
}

.scan-input {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.scan-input input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1.5px solid var(--border-soft);
  border-radius: 10px;
  color: var(--text);
  padding: 0.85rem 1rem;
  font-family: var(--mono);
  font-size: 0.95rem;
}

.scan-input input:focus {
  outline: none;
  border-color: var(--primary);
}

.scan-quick {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* Scan progress */
.scan-progress {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(10px);
}

.scan-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
  font-size: 0.92rem;
}

.scan-pct { font-family: var(--mono); color: var(--primary); font-weight: 700; }

.scan-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.scan-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width 0.3s;
}

.scan-console {
  background: #000;
  border-radius: 8px;
  padding: 1rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--primary);
  max-height: 220px;
  overflow-y: auto;
  line-height: 1.6;
}

.scan-console .ts { color: var(--text-faint); margin-right: 0.5rem; }
.scan-console .ok { color: var(--success); }
.scan-console .warn { color: var(--medium); }
.scan-console .err { color: var(--critical); }

/* Scan results */
.scan-results {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(10px);
}

.scan-result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.scan-result-head h3 { margin: 0; font-size: 1.15rem; }
.scan-result-head span#scanTargetLabel {
  font-family: var(--mono);
  color: var(--primary);
}

.risk-score {
  text-align: center;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.5rem 1.2rem;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
}

.risk-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
}

.risk-value {
  display: block;
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 800;
  margin-top: 0.2rem;
}

.scan-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.summary-stat {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 0.8rem;
  text-align: center;
}

.summary-stat .num {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  display: block;
  margin-bottom: 0.2rem;
}

.summary-stat .lbl {
  color: var(--text-dim);
  font-size: 0.78rem;
}

.summary-stat.critical .num { color: var(--critical); }
.summary-stat.high .num { color: var(--high); }
.summary-stat.medium .num { color: var(--medium); }
.summary-stat.low .num { color: var(--low); }

.findings {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.finding {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  border-left: 3px solid var(--medium);
}

.finding.critical { border-left-color: var(--critical); }
.finding.high { border-left-color: var(--high); }
.finding.medium { border-left-color: var(--medium); }
.finding.low { border-left-color: var(--low); }

.finding-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.finding-title { font-weight: 600; color: var(--text); }
.finding-desc { color: var(--text-dim); font-size: 0.88rem; margin: 0.3rem 0 0.6rem; }
.finding-rec {
  background: var(--primary-dim);
  border-radius: 6px;
  padding: 0.5rem 0.8rem;
  font-size: 0.82rem;
  color: var(--primary);
  border-left: 2px solid var(--primary);
}
.finding-rec strong { color: var(--text); margin-right: 0.3rem; }

/* ───── INCIDENTS TIMELINE ───── */
.incidents-timeline {
  position: relative;
}

.incident {
  position: relative;
  padding-left: 2.5rem;
  padding-bottom: 1.5rem;
  border-left: 2px solid var(--border-soft);
  margin-left: 0.5rem;
}

.incident:last-child { border-left-color: transparent; }

.incident::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 0.5rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--medium);
  border: 3px solid var(--bg);
}

.incident.critical::before { background: var(--critical); }
.incident.high::before { background: var(--high); }
.incident.medium::before { background: var(--medium); }
.incident.low::before { background: var(--low); }
.incident.resolved::before { background: var(--success); }

.incident-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  backdrop-filter: blur(10px);
}

.incident-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.incident-title { font-weight: 600; }
.incident-time { font-family: var(--mono); color: var(--text-dim); font-size: 0.82rem; }
.incident-desc { color: var(--text-dim); font-size: 0.9rem; margin: 0.4rem 0 0.6rem; }

.incident-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.meta-chip {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.meta-chip.mono-chip {
  font-family: var(--mono);
  color: var(--primary);
}

/* ───── REPORTS ───── */
.reports-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 1000px) {
  .reports-grid { grid-template-columns: 1fr; }
}

/* ───── MODAL ───── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.modal[hidden] { display: none; }

.modal-content {
  background: var(--card-solid);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  position: relative;
  animation: slideUp 0.3s ease;
}

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

.modal-content h2 { margin: 0 0 1.3rem; color: var(--primary); }

.modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: var(--text-dim);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.4rem;
  transition: all 0.2s;
}

.modal-close:hover { background: rgba(255, 255, 255, 0.12); color: var(--text); }

.form-row { margin-bottom: 1.1rem; }
.form-row.split { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }

.form-row label {
  display: block;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.form-row input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1.5px solid var(--border-soft);
  border-radius: 8px;
  color: var(--text);
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 0.92rem;
}

.form-row input:focus {
  outline: none;
  border-color: var(--primary);
}

.form-actions {
  display: flex;
  gap: 0.8rem;
  justify-content: flex-end;
  margin-top: 1.4rem;
}

/* ───── TOAST ───── */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--card-solid);
  border: 1px solid var(--primary);
  color: var(--text);
  padding: 0.9rem 1.4rem;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 2000;
  font-weight: 500;
  animation: toastIn 0.3s ease;
}

.toast[hidden] { display: none; }

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

/* ───── RESPONSIVE ───── */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -280px;
    width: 260px;
    z-index: 200;
    transition: left 0.3s;
  }
  .sidebar.mobile-open { left: 0; box-shadow: 10px 0 30px rgba(0,0,0,0.4); }
  .mobile-menu { display: block; }
  .live-clock { display: none; }
}

@media (max-width: 600px) {
  .page { padding: 1.2rem; }
  .topbar { padding: 0.8rem 1.2rem; }
  .form-row.split { grid-template-columns: 1fr; }
  .scan-input { flex-direction: column; }
  .toast { left: 1rem; right: 1rem; }
}
