/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
  --sidebar-bg:   #1a2332;
  --sidebar-text: #c8d3e0;
  --sidebar-w:    220px;
  --accent:       #3b82f6;
  --accent-dark:  #2563eb;
  --bg:           #f1f5f9;
  --card-bg:      #ffffff;
  --border:       #e2e8f0;
  --text:         #1e293b;
  --muted:        #64748b;
  --critical:     #dc2626;
  --high:         #ea580c;
  --medium:       #d97706;
  --low:          #16a34a;
  --info:         #6b7280;
  --open:         #3b82f6;
  --fp:           #a855f7;
  --closed:       #6b7280;
  --radius:       6px;
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg); }

/* ── Layout ────────────────────────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 90px; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
}
.sidebar.hidden { display: none; }

.sidebar-brand {
  padding: 20px 16px 16px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-icon { color: var(--accent); font-size: 20px; }

.nav-links { list-style: none; padding: 12px 0; flex: 1; }
.nav-links li a {
  display: block;
  padding: 9px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  font-size: 13.5px;
}
.nav-links li a:hover,
.nav-links li a.active {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.nav-links .nav-section {
  padding: 14px 20px 4px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
}
.nav-user { display: block; color: #fff; font-weight: 500; margin-bottom: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-link { background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 12px; padding: 0; }
.btn-link:hover { color: var(--sidebar-text); }

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 122px 36px 32px;
  max-width: 1280px;
}
.main-content.full { margin-left: 0; display: flex;
  align-items: center; justify-content: center; min-height: 100vh; padding-top: 90px; }

/* ── Page header ────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 600; }
.page-header p { color: var(--muted); margin-top: 4px; }
.page-header-row { display: flex; align-items: center;
  justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card { background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; }
.card-title { font-size: 14px; font-weight: 600; margin-bottom: 16px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em; }

.stats-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px; flex: 1; min-width: 120px; }
.stat-card .stat-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; }
.stat-card.critical .stat-value { color: var(--critical); }
.stat-card.high     .stat-value { color: var(--high); }
.stat-card.medium   .stat-value { color: var(--medium); }
.stat-card.low      .stat-value { color: var(--low); }
.stat-card.info     .stat-value { color: var(--info); }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); background: #f8fafc; }
tr:hover td { background: #f8fafc; }
td a { color: var(--accent); text-decoration: none; }
td a:hover { text-decoration: underline; }

/* ── Severity badges ────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.badge-critical { background: #fee2e2; color: var(--critical); }
.badge-high     { background: #ffedd5; color: var(--high); }
.badge-medium   { background: #fef3c7; color: var(--medium); }
.badge-low      { background: #dcfce7; color: var(--low); }
.badge-info     { background: #f1f5f9; color: var(--info); }
.badge-open     { background: #dbeafe; color: var(--open); }
.badge-fp       { background: #f3e8ff; color: var(--fp); }
.badge-closed   { background: #f1f5f9; color: var(--closed); }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius); font-size: 13.5px;
  font-weight: 500; cursor: pointer; border: none; transition: background 0.15s; }
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: var(--card-bg); color: var(--text);
  border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger    { background: #fee2e2; color: var(--critical); }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500;
  margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13.5px; outline: none;
  transition: border-color 0.15s; background: var(--card-bg); color: var(--text);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-error { color: var(--critical); font-size: 12px; margin-top: 4px; }

/* ── Auth card (login) ──────────────────────────────────────────────────── */
.auth-card { background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 40px; width: 380px; }
.auth-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.auth-card .subtitle { color: var(--muted); margin-bottom: 28px; font-size: 13px; }
.auth-card .btn { width: 100%; justify-content: center; margin-top: 4px; }

/* ── Upload zone ────────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: #eff6ff;
}
.upload-zone input[type=file] { display: none; }
.upload-zone .upload-icon { font-size: 36px; margin-bottom: 12px; color: var(--muted); }
.upload-zone p { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 28px;
  width: 480px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-header { display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; }
.modal-header h2 { font-size: 17px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px;
  cursor: pointer; color: var(--muted); line-height: 1; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ── Misc ───────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .empty-icon { font-size: 42px; margin-bottom: 12px; }

.loading { text-align: center; padding: 60px 20px; color: var(--muted); }

.alert { padding: 12px 16px; border-radius: var(--radius);
  margin-bottom: 16px; font-size: 13px; }
.alert-danger  { background: #fee2e2; color: var(--critical); }
.alert-success { background: #dcfce7; color: #16a34a; }
.alert-info    { background: #dbeafe; color: #1d4ed8; }

.tabs { display: flex; border-bottom: 2px solid var(--border);
  margin-bottom: 24px; gap: 4px; }
.tab-btn { background: none; border: none; padding: 8px 16px;
  font-size: 13.5px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s; }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }

.pagination { display: flex; align-items: center; gap: 8px;
  margin-top: 16px; justify-content: flex-end; }
.pagination button { padding: 5px 10px; border: 1px solid var(--border);
  background: var(--card-bg); border-radius: var(--radius);
  cursor: pointer; font-size: 12px; }
.pagination button:hover { background: var(--bg); }
.pagination button:disabled { opacity: 0.5; cursor: default; }
.pagination .page-info { font-size: 12px; color: var(--muted); }

.filter-row { display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap; margin-bottom: 16px; }
.filter-row select, .filter-row input {
  padding: 6px 10px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13px;
  background: var(--card-bg); color: var(--text);
}

.detail-grid { display: grid; grid-template-columns: 140px 1fr;
  gap: 8px 16px; font-size: 13px; }
.detail-grid dt { color: var(--muted); font-weight: 500; }
.detail-grid dd { word-break: break-word; }

pre.raw-output { background: #f8fafc; border: 1px solid var(--border);
  padding: 12px; border-radius: var(--radius); font-size: 12px;
  white-space: pre-wrap; word-break: break-word; max-height: 300px; overflow-y: auto; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: #f1f5f9; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; color: var(--muted); }

/* ── Host severity bars ─────────────────────────────────────────────────── */
.sev-bar { display: flex; gap: 4px; align-items: center; }
.sev-dot { width: 8px; height: 8px; border-radius: 50%; }
.sev-dot.critical { background: var(--critical); }
.sev-dot.high     { background: var(--high); }
.sev-dot.medium   { background: var(--medium); }
.sev-dot.low      { background: var(--low); }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { top: 70px; transform: translateX(-100%); transition: transform 0.25s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 90px 16px 20px; }
  .main-content.full { padding-top: 70px; }
}
