:root {
  --bg: #07080a;
  --bg-1: #0d0f12;
  --bg-2: #14171c;
  --bg-3: #1c2026;
  --line: rgba(255,255,255,0.06);
  --line-2: rgba(255,255,255,0.12);
  --text: #f5f5f4;
  --text2: #b8bfce;
  --text3: rgba(245,245,244,0.5);
  --accent: #ef4444;
  --accent-soft: rgba(239,68,68,0.12);
  --accent-glow: rgba(239,68,68,0.4);
  --warn: #f59e0b;
  --green: #22c55e;
  --critical: #dc2626;
  --high: #ea580c;
  --medium: #ca8a04;
  --low: #16a34a;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
}
* { box-sizing: border-box }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, system-ui, sans-serif; font-size: 14px; }
button { font: inherit; color: inherit; cursor: pointer; background: var(--bg-2); border: 1px solid var(--line); padding: 6px 12px; border-radius: 6px; }
button:hover { background: var(--bg-3); }
button.primary { background: var(--accent); border-color: var(--accent); color: #0a0a0a; font-weight: 600; }
button.primary:hover { filter: brightness(1.1); }
button.danger { background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.35); color: #ef4444; }
input, select { font: inherit; background: var(--bg-2); border: 1px solid var(--line); color: var(--text); padding: 6px 10px; border-radius: 6px; outline: none; }
input:focus, select:focus { border-color: var(--accent); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.tnum { font-variant-numeric: tabular-nums; }

.app { max-width: 1300px; margin: 0 auto; padding: 16px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.brand { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; font-size: 16px; }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.icon-btn { padding: 5px 9px; font-size: 13px; }
.user-pill { font-size: 12px; color: var(--text3); }

.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.stat-box { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; }
.stat-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; }
.stat-value.accent { color: var(--accent); }
.stat-value.green { color: var(--green); }

.filter-bar { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; margin-bottom: 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; align-items: end; }
.filter-group label { display: block; font-size: 11px; color: var(--text3); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.filter-group input, .filter-group select { width: 100%; }
.filter-search { grid-column: 1 / -1; }
.filter-search input { width: 100%; }

.cve-list { display: flex; flex-direction: column; gap: 8px; }
.cve-row { background: var(--bg-1); border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--r-sm); padding: 12px 14px; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.cve-row.sev-CRITICAL { border-left-color: var(--critical); }
.cve-row.sev-HIGH { border-left-color: var(--high); }
.cve-row.sev-MEDIUM { border-left-color: var(--medium); }
.cve-row.sev-LOW { border-left-color: var(--low); }
.cve-row.sev-UNKNOWN { border-left-color: var(--text3); }
.cve-id { font-family: ui-monospace, monospace; font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; }
.cve-body { min-width: 0; }
.cve-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; font-size: 12px; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 4px; font-weight: 600; }
.badge-sev { color: #fff; }
.badge-sev.CRITICAL { background: var(--critical); }
.badge-sev.HIGH { background: var(--high); }
.badge-sev.MEDIUM { background: var(--medium); }
.badge-sev.LOW { background: var(--low); }
.badge-kev { background: rgba(239,68,68,.18); color: var(--accent); border: 1px solid rgba(239,68,68,.35); }
.badge-epss { background: var(--bg-3); color: var(--text2); border: 1px solid var(--line-2); }
.badge-meta { color: var(--text3); }
.cve-product { font-size: 12px; color: var(--text2); font-weight: 500; margin-bottom: 3px; }
.cve-desc { font-size: 12.5px; color: var(--text2); line-height: 1.45; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cve-meta { font-size: 11px; color: var(--text3); text-align: right; white-space: nowrap; }
.cve-meta div { margin-bottom: 2px; }

.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 16px; align-items: center; }
.empty { text-align: center; padding: 40px; color: var(--text3); }
.loader { display: grid; place-items: center; height: 100vh; color: var(--text3); }

/* Login screen */
.login-shell { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login-card { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px; max-width: 380px; width: 100%; }
.login-card h1 { margin: 0 0 6px; font-size: 22px; }
.login-card p { margin: 0 0 20px; color: var(--text2); font-size: 13px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 4px; }
.field input { width: 100%; padding: 8px 12px; }
.login-error { color: var(--accent); font-size: 12px; margin-bottom: 12px; }
.login-foot { text-align: center; font-size: 12px; color: var(--text3); margin-top: 14px; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 200; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 22px; max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal h2 { margin: 0; font-size: 18px; }
.x-btn { background: transparent; border: 0; font-size: 20px; color: var(--text2); padding: 0 6px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--bg-1); border: 1px solid var(--accent); padding: 10px 18px; border-radius: 100px; font-size: 13px; box-shadow: 0 0 20px var(--accent-soft); z-index: 300; }

.admin-table { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.admin-row { display: grid; grid-template-columns: 1fr auto auto auto auto; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); align-items: center; font-size: 13px; }
.admin-row:last-child { border-bottom: 0; }
.admin-row.head { background: var(--bg-2); font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: .04em; }

@media (max-width: 700px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .cve-row { grid-template-columns: 1fr; gap: 6px; }
  .cve-meta { text-align: left; }
  .admin-row { grid-template-columns: 1fr; gap: 4px; }
}
