/* ============ Vendor Threat Monitor — design system ============ */
:root {
  --bg: #0a0e17;
  --bg-soft: #0d1220;
  --surface: #111827;
  --surface-2: #17202f;
  --surface-3: #1d2839;
  --border: rgba(148, 163, 184, 0.13);
  --border-strong: rgba(148, 163, 184, 0.25);
  --text: #e7ecf5;
  --text-soft: #aab4c5;
  --muted: #74809a;
  --accent: #6172f3;
  --accent-soft: rgba(97, 114, 243, 0.14);
  --accent-hover: #7684ff;
  --crit: #f43f5e;   --crit-bg: rgba(244, 63, 94, 0.13);
  --high: #f97316;   --high-bg: rgba(249, 115, 22, 0.13);
  --med:  #eab308;   --med-bg: rgba(234, 179, 8, 0.13);
  --low:  #22c55e;   --low-bg: rgba(34, 197, 94, 0.13);
  --unk:  #64748b;   --unk-bg: rgba(100, 116, 139, 0.15);
  --cve:  #38bdf8;   --cve-bg: rgba(56, 189, 248, 0.12);
  --kev:  #f43f5e;   --kev-bg: rgba(244, 63, 94, 0.14);
  --ta:   #c084fc;   --ta-bg: rgba(192, 132, 252, 0.13);
  --br:   #fb7185;   --br-bg: rgba(251, 113, 133, 0.13);
  --oth:  #94a3b8;   --oth-bg: rgba(148, 163, 184, 0.12);
  --ok:   #34d399;
  --radius: 10px;
  --radius-sm: 7px;
  --sidebar-w: 232px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, sans-serif;
  --mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font-family: inherit; }
::selection { background: rgba(97, 114, 243, 0.35); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #29354a; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

#root, .shell { height: 100vh; }
.shell { display: flex; }

/* ---------------- sidebar ---------------- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 18px 12px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; }
.brand-icon {
  width: 34px; height: 34px; border-radius: 9px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(240, 86, 63, 0.35); flex-shrink: 0;
}
.brand-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-name { font-weight: 700; font-size: 14px; letter-spacing: 0.2px; }
.brand-sub { font-size: 10.5px; color: var(--muted); letter-spacing: 0.6px; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav-label { font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-soft); cursor: pointer; border: none; background: none;
  font-size: 13px; width: 100%; text-align: left; transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: #aab6ff; font-weight: 600; }
.nav-item svg { flex-shrink: 0; opacity: 0.85; }
.nav-badge {
  margin-left: auto; background: var(--crit-bg); color: var(--crit);
  font-size: 10.5px; font-weight: 700; border-radius: 20px; padding: 0 7px; line-height: 17px;
}

.sidebar-footer { margin-top: auto; padding: 10px 8px 0; border-top: 1px solid var(--border); }
.src-row { display: flex; align-items: center; gap: 7px; padding: 3px 2px; font-size: 11.5px; color: var(--text-soft); }
.src-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.src-dot.bad { background: var(--crit); }
.src-dot.warn { background: var(--med); }
.src-dot.idle { background: var(--unk); }
.src-meta { margin-left: auto; color: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }

/* ---------------- main / topbar ---------------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 58px; min-height: 58px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px; border-bottom: 1px solid var(--border);
  background: rgba(13, 18, 32, 0.7); backdrop-filter: blur(8px);
}
.page-title { font-size: 16px; font-weight: 700; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.lastscan { font-size: 11.5px; color: var(--muted); text-align: right; line-height: 1.35; }
.lastscan b { color: var(--text-soft); font-weight: 600; }

/* NOTE: no top padding on the scroll container — sticky table headers must
   pin flush against its top edge. The ::before spacer provides the visual
   top gap and scrolls away with the content. */
.content { flex: 1; overflow-y: auto; padding: 0 22px 40px; }
.content::before { content: ""; display: block; height: 20px; }

/* ---------------- buttons / inputs ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 7px 13px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: background .12s, border-color .12s; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.danger { color: #ff8fa3; border-color: rgba(244, 63, 94, 0.4); }
.btn.danger:hover { background: var(--crit-bg); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { padding: 4px 9px; font-size: 11.5px; }

.input, .select {
  background: var(--surface); border: 1px solid var(--border-strong);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 7px 11px; font-size: 12.5px; font-family: inherit; outline: none;
  transition: border-color .12s;
}
.input:focus, .select:focus { border-color: var(--accent); }
.input::placeholder { color: var(--muted); }
.select { appearance: none; -webkit-appearance: none; padding-right: 26px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%2374809a' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 9px center; }
label.fld { display: block; font-size: 11.5px; color: var(--text-soft); font-weight: 600; margin-bottom: 5px; }

.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search-wrap .input { padding-left: 30px; width: 100%; }

/* ---------------- cards / panels ---------------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.panel-title { font-size: 12px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-soft); }
.panel-body { padding: 14px 16px; }

.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; position: relative; overflow: hidden; }
.stat-card .accentbar { position: absolute; top: 0; left: 0; right: 0; height: 2.5px; }
.stat-label { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; }
.stat-value { font-size: 26px; font-weight: 750; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

.dash-grid { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.dash-grid2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px; }

/* severity bars */
.sevbar-row { display: flex; align-items: center; gap: 10px; margin: 9px 0; }
.sevbar-label { width: 64px; font-size: 11.5px; color: var(--text-soft); font-weight: 600; }
.sevbar-track { flex: 1; height: 9px; background: var(--surface-3); border-radius: 5px; overflow: hidden; }
.sevbar-fill { height: 100%; border-radius: 5px; transition: width .5s ease; }
.sevbar-count { width: 36px; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-soft); }

.tv-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.tv-row:last-child { border-bottom: none; }
.tv-rank { width: 20px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.tv-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-count { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------------- badges ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.4px;
  border-radius: 5px; padding: 2px 7px; text-transform: uppercase; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.b-crit { background: var(--crit-bg); color: var(--crit); }
.b-high { background: var(--high-bg); color: var(--high); }
.b-med  { background: var(--med-bg);  color: var(--med); }
.b-low  { background: var(--low-bg);  color: var(--low); }
.b-unk  { background: var(--unk-bg);  color: #9aa8bd; }
.b-cve  { background: var(--cve-bg);  color: var(--cve); }
.b-kev  { background: var(--kev-bg);  color: var(--kev); border: 1px solid rgba(244,63,94,.35); }
.b-ta   { background: var(--ta-bg);   color: var(--ta); }
.b-br   { background: var(--br-bg);   color: var(--br); }
.b-oth  { background: var(--oth-bg);  color: var(--oth); }
.chip {
  display: inline-block; background: var(--surface-3); color: var(--text-soft);
  border-radius: 5px; padding: 1px 7px; font-size: 11px; margin: 1px 3px 1px 0;
}

/* ---------------- tables ---------------- */
/* border-collapse: separate is required — collapsed borders detach from
   position:sticky header cells in Chrome/Safari. */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.tbl th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--muted); font-weight: 700; padding: 9px 12px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: var(--surface); z-index: 2;
}
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { cursor: pointer; transition: background .1s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .no-hover tr { cursor: default; }
.td-title { max-width: 480px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-muted { color: var(--muted); font-size: 11.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 11.5px; }

.row-new td:first-child { position: relative; }
.row-new td:first-child::before {
  content: ""; position: absolute; left: 0; top: 20%; bottom: 20%; width: 2.5px;
  background: var(--accent); border-radius: 2px;
}

/* status pill toggle */
.status-pill {
  font-size: 10.5px; font-weight: 700; border-radius: 20px; padding: 2.5px 10px;
  cursor: pointer; border: 1px solid transparent; letter-spacing: .4px; text-transform: uppercase;
}
.status-pill.new { background: var(--accent-soft); color: #aab6ff; border-color: rgba(97,114,243,.4); }
.status-pill.reviewed { background: transparent; color: var(--muted); border-color: var(--border-strong); }
.status-pill:hover { filter: brightness(1.2); }

/* ---------------- filter bar ---------------- */
.filterbar { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-bottom: 14px; }
.filterbar .search-wrap { flex: 1; min-width: 200px; max-width: 340px; }
.fgroup { display: flex; gap: 4px; background: var(--surface); padding: 3px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.fchip {
  border: none; background: transparent; color: var(--text-soft); cursor: pointer;
  font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 5px;
}
.fchip:hover { color: var(--text); }
.fchip.on { background: var(--surface-3); color: var(--text); }
.fchip.on.c-crit { color: var(--crit); } .fchip.on.c-high { color: var(--high); }
.fchip.on.c-med { color: var(--med); }  .fchip.on.c-low { color: var(--low); }

/* ---------------- drawer ---------------- */
.drawer-overlay { position: fixed; inset: 0; background: rgba(5, 8, 15, 0.6); z-index: 40; animation: fade .15s; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 92vw);
  background: var(--bg-soft); border-left: 1px solid var(--border-strong);
  z-index: 41; display: flex; flex-direction: column;
  animation: slidein .18s ease; box-shadow: -20px 0 60px rgba(0,0,0,.45);
}
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.drawer-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.drawer-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.drawer-title { font-size: 15px; font-weight: 700; line-height: 1.4; margin: 8px 0 6px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 7px 14px; font-size: 12.5px; margin: 14px 0; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { color: var(--text); word-break: break-word; }
.desc-block {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 12.5px; color: var(--text-soft); white-space: pre-wrap; word-break: break-word;
}
.ref-link { display: block; color: #86a6ff; font-size: 12px; text-decoration: none; padding: 3px 0; word-break: break-all; }
.ref-link:hover { text-decoration: underline; }
.sect-label { font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 18px 0 8px; }

/* ---------------- modal ---------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(5, 8, 15, 0.65); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding-top: 9vh;
  animation: fade .15s;
}
.modal {
  background: var(--bg-soft); border: 1px solid var(--border-strong); border-radius: 14px;
  width: min(520px, 94vw); box-shadow: 0 30px 80px rgba(0,0,0,.5); animation: pop .16s ease;
  max-height: 82vh; display: flex; flex-direction: column;
}
@keyframes pop { from { transform: scale(.97) translateY(6px); opacity: 0; } }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-head h3 { font-size: 14.5px; }
.modal-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 13px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 9px; }
.x-btn { margin-left: auto; background: none; border: none; color: var(--muted); cursor: pointer; font-size: 17px; padding: 2px 6px; border-radius: 5px; }
.x-btn:hover { color: var(--text); background: var(--surface-2); }

/* ---------------- dropdown menu ---------------- */
.menu-wrap { position: relative; }
.menu {
  position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 60;
  background: var(--surface-3); border: 1px solid var(--border-strong);
  border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,.55);
  min-width: 260px; padding: 5px; animation: pop .14s ease;
}
.menu-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: var(--text); padding: 8px 11px; border-radius: 7px; cursor: pointer;
  font-size: 12.5px; font-weight: 600;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item .sub { display: block; font-size: 10.5px; color: var(--muted); font-weight: 400; margin-top: 1px; }

/* ---------------- toast ---------------- */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text);
  padding: 10px 15px; border-radius: 9px; font-size: 12.5px; box-shadow: 0 10px 30px rgba(0,0,0,.4);
  animation: pop .18s ease; max-width: 360px; display: flex; gap: 9px; align-items: center;
}
.toast.err { border-color: rgba(244, 63, 94, .5); }
.toast.ok { border-color: rgba(52, 211, 153, .4); }

/* ---------------- misc ---------------- */
.spin { animation: rot 0.9s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 46px 20px; font-size: 13px; }
.empty svg { opacity: .5; margin-bottom: 10px; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding: 12px 4px 0; font-size: 12px; color: var(--muted); }
.donut-wrap { display: flex; gap: 18px; align-items: center; }
.legend { font-size: 11.5px; color: var(--text-soft); display: flex; flex-direction: column; gap: 5px; }
.legend-row { display: flex; align-items: center; gap: 7px; }
.legend-dot { width: 8px; height: 8px; border-radius: 3px; }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
a { color: #86a6ff; }
.scanphase { font-size: 11px; color: var(--accent); font-weight: 600; }
.hint { font-size: 11px; color: var(--muted); line-height: 1.45; }
.aliases-cell { max-width: 260px; }

/* fraud-card review states */
.status-pill.blocked { background: rgba(239,68,68,.14); color: #ff9a9a; border-color: rgba(239,68,68,.42); }
.status-pill.dismissed { background: transparent; color: var(--muted); border-color: var(--border); opacity: .7; }

/* ---------------------------------------------- calendar / range picker ---- */
.cal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 10px 10px 8px;
  user-select: none;
}
.cal-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.cal-title { flex: 1; text-align: center; font-size: 13.5px; font-weight: 600; color: var(--text); }
.cal-nav {
  width: 26px; height: 26px; line-height: 1; flex: none;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-3); color: var(--text-soft);
  font-size: 16px; cursor: pointer;
}
.cal-nav:hover { background: var(--accent-soft); color: var(--text); border-color: var(--border-strong); }
.cal-dow, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow span {
  text-align: center; font-size: 10.5px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); padding-bottom: 4px;
}
.cal-day {
  aspect-ratio: 1 / 1; min-height: 30px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-soft);
  font: inherit; font-size: 12.5px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.cal-day:hover { background: var(--accent-soft); color: var(--text); }
.cal-day.out { color: var(--muted); opacity: .45; }
/* the stretch between the two ends, including while it is being dragged out */
.cal-day.in { background: var(--accent-soft); color: var(--text); border-radius: 0; }
.cal-day.edge {
  background: var(--accent); color: #fff; font-weight: 600;
  border-radius: var(--radius-sm);
}
.cal-day.today { border-color: var(--border-strong); }
.cal-day.today.edge { border-color: var(--accent); }
.cal-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-soft); min-height: 24px;
}
.cal-quick { display: flex; gap: 5px; flex: none; }
.cal-quick button {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-3); color: var(--text-soft);
  font: inherit; font-size: 11px; padding: 3px 8px; cursor: pointer;
}
.cal-quick button:hover { background: var(--accent-soft); color: var(--text); border-color: var(--border-strong); }
.cal-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.cal-month {
  padding: 9px 0;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--surface-3); color: var(--text-soft);
  font: inherit; font-size: 12.5px; cursor: pointer;
}
.cal-month:hover { background: var(--accent-soft); color: var(--text); }
.cal-month.today { border-color: var(--border-strong); }
.cal-month.edge { background: var(--accent); color: #fff; font-weight: 600; border-color: var(--accent); }
