
/* ========== TOKENS ==========
   Every colour is a variable so the light theme is a token swap rather than a
   second stylesheet. Nothing below this block hard-codes a colour; the score
   gauge, badges and tables all read from --band or the named tokens. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;

  --bg: #0F172A;
  --bg-panel: #1E293B;
  --bg-sunken: rgba(0,0,0,0.35);
  --bg-raised: rgba(255,255,255,0.06);
  --bg-raised-hi: rgba(255,255,255,0.12);
  --border: #334155;
  --border-hi: #475569;
  --hairline: rgba(255,255,255,0.035);
  --overlay: rgba(15,23,42,0.95);
  --grid-line: rgba(255,255,255,0.04);
  --glow: rgba(0,212,255,0.02);
  --scroll-track: #0F172A;
  --scroll-thumb: #334155;
  --scroll-thumb-hi: #475569;
  --gauge-track: #334155;
  --link-blue: #3B82F6;
  --link-blue-bg: rgba(59,130,246,0.13);
  --link-blue-br: rgba(59,130,246,0.3);

  --text: #CBD5E1;
  --text-hi: #F8FAFC;
  --text-dim: #94A3B8;
  --text-faint: #64748B;

  --cyan: #06B6D4;
  --green: #10B981;
  --amber: #F59E0B;
  --orange: #F97316;
  --red: #EF4444;
  --grey: #64748B;

  /* Tint / border pairs */
  --t-cyan: rgba(6,182,212,0.1);   --b-cyan: rgba(6,182,212,0.3);
  --t-green: rgba(16,185,129,0.1);  --b-green: rgba(16,185,129,0.24);
  --t-amber: rgba(245,158,11,0.1);  --b-amber: rgba(245,158,11,0.24);
  --t-orange: rgba(249,115,22,0.1); --b-orange: rgba(249,115,22,0.24);
  --t-red: rgba(239,68,68,0.1);   --b-red: rgba(239,68,68,0.26);
  --t-grey: rgba(100,116,139,0.12);--b-grey: rgba(100,116,139,0.22);
}

/* Light theme. The neon palette is unreadable on white, so the hues are
   re-picked for contrast rather than merely darkened — a dimmed #39ff14 is
   still an unreadable yellow-green against a light panel. */
:root[data-theme="light"] {
  --bg: #f2f5f9;
  --bg-panel: rgba(255,255,255,0.88);
  --bg-sunken: rgba(15,23,42,0.05);
  --bg-raised: rgba(15,23,42,0.05);
  --bg-raised-hi: rgba(15,23,42,0.1);
  --border: rgba(15,23,42,0.1);
  --border-hi: rgba(15,23,42,0.2);
  --hairline: rgba(15,23,42,0.08);
  --overlay: rgba(242,245,249,0.96);
  --grid-line: rgba(11,114,133,0.05);
  --glow: rgba(11,114,133,0.05);
  --scroll-track: #e2e8f0;
  --scroll-thumb: #b8c4d4;
  --scroll-thumb-hi: #97a6ba;
  --gauge-track: #dde4ee;
  --link-blue: #1d4ed8;
  --link-blue-bg: rgba(29,78,216,0.09);
  --link-blue-br: rgba(29,78,216,0.28);

  --text: #26313f;
  --text-hi: #0d1522;
  --text-dim: #526174;
  --text-faint: #71809a;

  --cyan: #0b6f80;
  --green: #157f3c;
  --amber: #92620a;
  --orange: #b8430c;
  --red: #bd1b1b;
  --grey: #56657a;

  --t-cyan: rgba(11,111,128,0.1);   --b-cyan: rgba(11,111,128,0.3);
  --t-green: rgba(21,127,60,0.1);   --b-green: rgba(21,127,60,0.28);
  --t-amber: rgba(146,98,10,0.1);   --b-amber: rgba(146,98,10,0.28);
  --t-orange: rgba(184,67,12,0.1);  --b-orange: rgba(184,67,12,0.28);
  --t-red: rgba(189,27,27,0.09);    --b-red: rgba(189,27,27,0.28);
  --t-grey: rgba(86,101,122,0.1);   --b-grey: rgba(86,101,122,0.26);
}

/* Score bands. Set once on a container; the gauge, verdict pill and batch
   rows all inherit --band from it, so a band never has to be recomputed. */
.band-safe   { --band: var(--green); }
.band-susp   { --band: var(--amber); }
.band-likely { --band: var(--orange); }
.band-danger { --band: var(--red); }

/* ========== RESET & BASE ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--scroll-track); }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hi); }

/* ========== BACKGROUND ========== */
.bg-grid {
  position: fixed; inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none; z-index: 0;
}
.bg-glow {
  position: fixed; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle at 50% 50%, var(--glow) 0%, transparent 50%);
  pointer-events: none; z-index: 0;
  animation: bgPulse 8s ease-in-out infinite;
}
@keyframes bgPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* ========== LAYOUT ========== */
.app { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

/* ========== TOP BAR ========== */
.topbar { display: flex; justify-content: flex-end; gap: 0.5rem; padding-top: 0.25rem; }
.icon-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.35rem 0.7rem; border-radius: 8px; cursor: pointer;
  background: var(--bg-raised); border: 1px solid var(--border-hi);
  color: var(--text-dim); font-family: var(--mono); font-size: 0.74rem;
  transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--bg-raised-hi); color: var(--text-hi); }

/* ========== HEADER ========== */
.header { text-align: center; margin-bottom: 2rem; padding: 0.75rem 0 0.5rem; }
.header h1 {
  font-family: var(--mono);
  font-size: 1.9rem; font-weight: 700; letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--cyan) 0%, var(--green) 50%, var(--cyan) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  animation: shimmer 4s linear infinite;
  margin-bottom: 0.4rem;
}
@keyframes shimmer { to { background-position: 200% center; } }
.header .tagline { font-size: 0.92rem; color: var(--text-dim); }
.header-badges {
  display: flex; align-items: center; justify-content: center;
  gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem;
}
.chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.32rem 0.8rem; border-radius: 100px;
  font-size: 0.74rem; font-family: var(--mono);
}
.chip-green { background: var(--t-green); border: 1px solid var(--b-green); color: var(--green); }
.chip-grey  { background: var(--t-grey); border: 1px solid var(--b-grey); color: var(--grey); }

/* ========== INTAKE ========== */
.intake-container { margin-bottom: 2rem; }
.intake-tabs { display: flex; gap: 0.5rem; justify-content: center; margin-bottom: 1rem; }
.tab-btn {
  padding: 0.5rem 1.25rem; border-radius: 8px; border: 1px solid var(--border-hi);
  background: rgba(13,19,32,0.6); color: var(--text-dim); font-family: var(--mono);
  font-size: 0.82rem; cursor: pointer; transition: background .2s, color .2s, border-color .2s;
}
.tab-btn:hover { background: var(--bg-raised); color: var(--text); }
.tab-btn[aria-selected="true"] {
  background: var(--t-cyan); border-color: var(--b-cyan); color: var(--cyan);
}
#rawSourceBox {
  background: var(--bg-panel); border: 1px solid var(--b-cyan);
  border-radius: 16px; padding: 1.25rem;
}
#rawSourceText {
  width: 100%; height: 260px; background: var(--bg-sunken);
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text-hi); font-family: var(--mono); font-size: 0.8rem;
  padding: 1rem; outline: none; resize: vertical; line-height: 1.55;
}
#rawSourceText::placeholder { color: var(--text-faint); }
.source-actions { display: flex; gap: 0.7rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }

/* ========== DROP ZONE ========== */
#dropZone {
  position: relative; display: block; width: 100%;
  border: 2px dashed var(--b-cyan); border-radius: 16px;
  padding: 3.5rem 2rem; text-align: center; cursor: pointer;
  transition: border-color .3s, background .3s, box-shadow .3s;
  background: var(--bg-panel); color: inherit;
}
#dropZone:hover, #dropZone.dragover {
  border-color: var(--cyan); background: var(--t-cyan);
  box-shadow: 0 0 40px var(--t-cyan);
}
.drop-icon {
  width: 76px; height: 76px; margin: 0 auto 1.25rem; border-radius: 50%;
  background: var(--t-cyan);
  display: flex; align-items: center; justify-content: center;
  animation: dropPulse 2.4s ease-in-out infinite;
}
@keyframes dropPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--b-cyan); }
  50% { box-shadow: 0 0 0 18px transparent; }
}
.drop-icon svg { width: 34px; height: 34px; stroke: var(--cyan); fill: none; stroke-width: 1.5; }
.drop-title { font-family: var(--mono); font-size: 1.12rem; color: var(--text-hi); margin-bottom: 0.4rem; }
.drop-sub { font-size: 0.82rem; color: var(--text-faint); margin-bottom: 1.25rem; }
.browse-cta {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 1.4rem; background: var(--t-cyan);
  border: 1px solid var(--b-cyan); border-radius: 8px;
  color: var(--cyan); font-size: 0.84rem; font-family: var(--mono);
}
#fileInput { display: none; }

/* ========== SCAN OVERLAY ========== */
#scanOverlay {
  display: none; position: fixed; inset: 0;
  background: var(--overlay); z-index: 1000;
  flex-direction: column; align-items: center; justify-content: center;
}
#scanOverlay.active { display: flex; }
.scan-ring {
  width: 110px; height: 110px; border-radius: 50%;
  border: 3px solid var(--t-cyan); border-top-color: var(--cyan);
  animation: spin 1s linear infinite; margin-bottom: 1.75rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.scan-text { font-family: var(--mono); font-size: 0.95rem; color: var(--cyan); text-align: center; padding: 0 1rem; }
.scan-steps { margin-top: 1.25rem; list-style: none; text-align: left; font-family: var(--mono); font-size: 0.8rem; }
.scan-steps li { padding: 0.28rem 0; color: var(--text-faint); opacity: 0.55; transition: color .3s, opacity .3s; }
.scan-steps li.done, .scan-steps li.active { opacity: 1; }
.scan-steps li.done { color: var(--green); }
.scan-steps li.active { color: var(--cyan); }
.scan-steps li::before { content: '▸ '; }
.scan-steps li.done::before { content: '✓ '; }

/* ========== DASHBOARD ========== */
#dashboard { display: none; }
#dashboard.active {
  display: block;
  animation: fadeUp .5s ease-out;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

/* Two-column grid wrapper — injected inside the dashboard */
.dash-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 1.5rem;
}
.dash-left  { display: flex; flex-direction: column; gap: 1.25rem; }
.dash-right { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
}

/* ========== SCORE ========== */
.score-section {
  text-align: center;
  padding: 2rem 1.25rem 1.75rem;
  background: var(--bg-panel);
  border-radius: 16px;
  border: 1px solid var(--border-hi);
  position: sticky;
  top: 1rem;
}
.score-file { font-family: var(--mono); font-size: 0.72rem; color: var(--text-faint); margin-bottom: 1rem; word-break: break-all; }
.gauge-container { position: relative; width: 180px; height: 180px; margin: 0 auto 1.1rem; }
.gauge-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge-bg { fill: none; stroke: var(--gauge-track); stroke-width: 10; }
.gauge-fill {
  fill: none; stroke-width: 10; stroke-linecap: round; stroke: var(--band);
  transition: stroke-dashoffset 1.4s cubic-bezier(0.4,0,0.2,1), stroke .5s ease;
}
.gauge-score {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-family: var(--mono); font-size: 2.9rem; font-weight: 700; line-height: 1;
  color: var(--band);
}
.gauge-label {
  position: absolute; top: 66%; left: 50%; transform: translateX(-50%);
  font-size: 0.64rem; color: var(--text-faint); text-transform: uppercase;
  letter-spacing: 2px; font-family: var(--mono);
}
.verdict {
  font-family: var(--mono); font-size: 1.1rem; font-weight: 700;
  padding: 0.5rem 1.6rem; border-radius: 100px; display: inline-block;
  letter-spacing: 0.5px;
}
.verdict-safe { color: var(--green); background: var(--t-green); border: 1px solid var(--b-green); }
.verdict-suspicious { color: var(--amber); background: var(--t-amber); border: 1px solid var(--b-amber); }
.verdict-likely-phishing { color: var(--orange); background: var(--t-orange); border: 1px solid var(--b-orange); }
.verdict-dangerous { color: var(--red); background: var(--t-red); border: 1px solid var(--b-red); }
.score-note {
  font-size: 0.76rem; color: var(--text-faint); margin-top: 0.8rem;
  max-width: 36ch; margin-left: auto; margin-right: auto; line-height: 1.6;
}
.score-summary { display: flex; justify-content: center; gap: 1.5rem; margin-top: 1.25rem; flex-wrap: wrap; }
.score-stat { text-align: center; }
.score-stat .num { font-family: var(--mono); font-size: 1.3rem; font-weight: 700; }
.score-stat .label { font-size: 0.68rem; color: var(--text-faint); margin-top: 0.1rem; letter-spacing: 0.5px; text-transform: uppercase; }
.stat-pass .num { color: var(--green); }
.stat-warn .num { color: var(--amber); }
.stat-fail .num { color: var(--red); }
.stat-info .num { color: var(--grey); }

/* ========== FINDINGS ========== */
.findings { display: flex; flex-direction: column; gap: 0.4rem; }
.findings-title {
  font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 2px; color: var(--text-faint); margin-bottom: 0.4rem; padding-left: 0.1rem;
}
.finding {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 0.85rem 1rem; border-radius: 12px;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-left: 3px solid var(--grey);
  transition: border-color .2s, background .2s;
}
.finding:hover { background: var(--bg-raised); }
.finding.f-fail { border-left-color: var(--red); }
.finding.f-warn { border-left-color: var(--amber); }
.finding-body { flex: 1; min-width: 0; }
.finding-name { font-weight: 600; color: var(--text-hi); font-size: 0.85rem; margin-bottom: 0.2rem; }
.finding-detail { font-size: 0.78rem; color: var(--text-dim); line-height: 1.5; word-break: break-word; }
.finding-cat {
  font-family: var(--mono); font-size: 0.65rem; color: var(--text-faint);
  margin-top: 0.3rem; text-transform: uppercase; letter-spacing: 0.8px;
}
.no-findings {
  padding: 1.1rem 1rem; border-radius: 12px; background: var(--t-green);
  border: 1px solid var(--b-green); color: var(--green);
  font-size: 0.84rem; font-family: var(--mono);
}

/* ========== FINDINGS FILTER ========== */
.findings-toolbar {
  display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.findings-toolbar input[type="search"] {
  flex: 1 1 200px; min-width: 0;
  padding: 0.45rem 0.75rem; border-radius: 8px;
  background: var(--bg-sunken); border: 1px solid var(--border-hi);
  color: var(--text); font-family: var(--mono); font-size: 0.78rem;
}
.findings-toolbar input[type="search"]::placeholder { color: var(--text-faint); }
.filter-chip {
  padding: 0.35rem 0.7rem; border-radius: 100px; cursor: pointer;
  background: var(--bg-raised); border: 1px solid var(--border-hi);
  color: var(--text-dim); font-family: var(--mono); font-size: 0.72rem;
  transition: background .2s, color .2s, border-color .2s;
}
.filter-chip:hover { background: var(--bg-raised-hi); color: var(--text); }
.filter-chip[aria-pressed="true"] { background: var(--t-cyan); border-color: var(--b-cyan); color: var(--cyan); }
.filter-empty {
  padding: 0.8rem; border-radius: 10px; background: var(--bg-sunken);
  border: 1px solid var(--border); color: var(--text-dim); font-size: 0.82rem;
}

/* ========== PANELS ========== */
.panel {
  background: var(--bg-panel); border-radius: 16px; border: 1px solid var(--border);
  margin-bottom: 0; overflow: hidden;
  transition: border-color .2s;
}
.panel:hover { border-color: var(--border-hi); }
.panel-header, .category-header {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  width: 100%; padding: 1rem 1.25rem; cursor: pointer;
  background: none; border: none; color: inherit; text-align: left;
  transition: background .2s;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.panel-header:hover, .category-header:hover { background: var(--bg-raised); }
.panel-header h2 {
  font-family: var(--mono); font-size: 0.85rem; font-weight: 700; color: var(--text-hi);
  display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap;
  letter-spacing: 0.3px;
}
.chevron { transition: transform .3s; color: var(--text-faint); font-size: 0.75rem; flex-shrink: 0; }
.panel.open .chevron, .category-card.open .chevron { transform: rotate(180deg); }
.panel-body { display: none; padding: 1.1rem 1.25rem 1.25rem; }
.panel.open .panel-body { display: block; }

.badge { font-size: 0.68rem; padding: 0.12rem 0.5rem; border-radius: 100px; font-weight: 600; font-family: var(--mono); }
.badge-pass { background: var(--t-green); color: var(--green); }
.badge-warn { background: var(--t-amber); color: var(--amber); }
.badge-fail { background: var(--t-red); color: var(--red); }
.badge-info { background: var(--t-grey); color: var(--grey); }

/* ========== METADATA ========== */
.meta-grid { display: grid; grid-template-columns: 130px 1fr; gap: 0.5rem 1rem; font-size: 0.85rem; }
.meta-key { font-family: var(--mono); color: var(--text-faint); font-weight: 500; }
.meta-val { color: var(--text); word-break: break-word; }

.raw-headers {
  font-family: var(--mono); font-size: 0.74rem; color: var(--text-dim);
  background: var(--bg-sunken); padding: 1rem; border-radius: 8px;
  white-space: pre-wrap; word-break: break-word;
  max-height: 420px; overflow: auto; line-height: 1.55;
}
.body-preview {
  font-size: 0.85rem; color: var(--text-dim); background: var(--bg-sunken);
  padding: 1rem; border-radius: 8px; max-height: 340px; overflow: auto;
  line-height: 1.7; border: 1px solid var(--border); white-space: pre-wrap; word-break: break-word;
}

/* ========== CATEGORY CARDS ========== */
.category-card {
  background: var(--bg-panel); border-radius: 14px; border: 1px solid var(--border);
  margin-bottom: 0.5rem; overflow: hidden; transition: border-color .2s;
}
.category-card:hover { border-color: var(--border-hi); }
.cat-left { display: flex; align-items: center; gap: 0.75rem; flex: 1; min-width: 0; }
.cat-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.cat-info { min-width: 0; }
.cat-name { font-family: var(--mono); font-size: 0.82rem; font-weight: 700; color: var(--text-hi); letter-spacing: 0.2px; }
.cat-sub { font-size: 0.7rem; color: var(--text-faint); margin-top: 0.1rem; }
.cat-badges { display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.category-body { display: none; }
.category-card.open .category-body { display: block; }
.check-list { padding: 0 1.15rem 0.9rem; }
.check-item {
  display: flex; align-items: flex-start; gap: 0.7rem;
  padding: 0.6rem 0; border-bottom: 1px solid var(--hairline); font-size: 0.83rem;
}
.check-item:last-child { border-bottom: none; }
.check-icon {
  width: 21px; height: 21px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem; flex-shrink: 0; margin-top: 0.12rem; font-weight: 700;
}
.icon-pass { background: var(--t-green); color: var(--green); }
.icon-warn { background: var(--t-amber); color: var(--amber); }
.icon-fail { background: var(--t-red); color: var(--red); }
.icon-info { background: var(--t-grey); color: var(--grey); }
.check-content { flex: 1; min-width: 0; }
.check-name { font-weight: 500; color: var(--text); }
.check-detail { color: var(--text-dim); font-size: 0.78rem; margin-top: 0.18rem; word-break: break-word; }
.check-weight {
  font-family: var(--mono); font-size: 0.66rem; color: var(--text-faint);
  flex-shrink: 0; margin-top: 0.25rem;
}

/* ========== TABLES ========== */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.data-table th {
  text-align: left; padding: 0.5rem; color: var(--text-faint);
  font-family: var(--mono); font-weight: 500; font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 0.5rem; color: var(--text); border-bottom: 1px solid var(--hairline);
  font-family: var(--mono); word-break: break-all; vertical-align: top;
}
.table-scroll { overflow-x: auto; }
.risk-high { color: var(--red); font-weight: 600; }
.risk-medium { color: var(--amber); }
.risk-low { color: var(--green); }
.hash { font-size: 0.68rem; color: var(--text-faint); }
.zip-list {
  margin: 0.35rem 0 0; padding-left: 0.9rem; list-style: none;
  font-size: 0.7rem; color: var(--text-faint); max-height: 150px; overflow: auto;
}
.zip-list li::before { content: '↳ '; }
.zip-list li.danger { color: var(--red); }

/* ========== BATCH ========== */
#batchSection { display: none; margin-bottom: 1rem; }
#batchSection.active { display: block; }
.batch-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem;
}
.batch-head h2 { font-family: var(--mono); font-size: 1rem; color: var(--text-hi); }
.batch-summary { font-size: 0.78rem; color: var(--text-dim); }
.batch-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.batch-table th {
  text-align: left; padding: 0.55rem 0.6rem; color: var(--text-faint);
  font-family: var(--mono); font-weight: 500; font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 1px;
  border-bottom: 1px solid var(--border-hi); white-space: nowrap;
}
.batch-table th[data-sort] { cursor: pointer; user-select: none; }
.batch-table th[data-sort]:hover { color: var(--text); }
.batch-table th .arrow { opacity: 0.35; }
.batch-table th[aria-sort] .arrow { opacity: 1; color: var(--cyan); }
.batch-table td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.batch-row { cursor: pointer; transition: background .15s; }
.batch-row:hover, .batch-row:focus-visible { background: var(--bg-raised); }
.batch-score {
  font-family: var(--mono); font-weight: 700; font-size: 0.95rem; color: var(--band);
}
.batch-verdict { font-family: var(--mono); font-size: 0.72rem; color: var(--band); white-space: nowrap; }
.batch-file { color: var(--text-hi); word-break: break-all; }
.batch-sub { color: var(--text-dim); font-size: 0.74rem; margin-top: 0.15rem; word-break: break-word; }
.batch-top { color: var(--text-dim); font-size: 0.74rem; }
.batch-error td { color: var(--red); }
.batch-back { margin-bottom: 0.75rem; }

/* ========== URL LIST ========== */
.url-list { list-style: none; font-size: 0.78rem; max-height: 340px; overflow: auto; }
.url-list li {
  display: flex; align-items: center; gap: 0.6rem; justify-content: space-between;
  padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--hairline);
}
.url-list li:last-child { border-bottom: none; }
.url-text { font-family: var(--mono); color: var(--text); word-break: break-all; flex: 1; min-width: 0; }
.url-actions { display: flex; gap: 0.35rem; flex-shrink: 0; }
.mini-btn {
  padding: 0.18rem 0.5rem; border-radius: 5px; font-size: 0.68rem;
  font-family: var(--mono); text-decoration: none; cursor: pointer;
  background: var(--bg-raised); border: 1px solid var(--border-hi);
  color: var(--text-dim); transition: background .2s, color .2s;
}
.mini-btn:hover { background: var(--bg-raised-hi); color: var(--text); }
.mini-btn.ext { background: var(--link-blue-bg); border-color: var(--link-blue-br); color: var(--link-blue); }
.mini-btn.ext:hover { background: var(--link-blue-br); color: var(--text-hi); }
.defang-note {
  font-size: 0.74rem; margin-bottom: 0.7rem;
  padding: 0.5rem 0.7rem; background: var(--t-amber);
  border: 1px solid var(--b-amber); border-radius: 8px; color: var(--amber);
}

/* ========== TIMELINE ========== */
.timeline { list-style: none; font-size: 0.79rem; }
.timeline li {
  position: relative; padding: 0 0 1rem 1.4rem;
  border-left: 1px solid var(--border-hi); margin-left: 0.35rem;
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ''; position: absolute; left: -4.5px; top: 0.45rem;
  width: 8px; height: 8px; border-radius: 50%; background: var(--cyan);
}
.tl-host { font-family: var(--mono); color: var(--text-hi); word-break: break-all; }
.tl-meta { color: var(--text-faint); font-size: 0.73rem; margin-top: 0.15rem; font-family: var(--mono); }
.tl-delay { color: var(--amber); }

/* ========== ACTIONS ========== */
.actions-bar { display: flex; gap: 0.6rem; margin-top: 2rem; justify-content: center; flex-wrap: wrap; }
.action-btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.6rem 1.2rem; border-radius: 100px; font-size: 0.8rem;
  font-family: var(--mono); font-weight: 600; cursor: pointer; border: none;
  transition: background .2s, box-shadow .2s, color .2s;
  letter-spacing: 0.3px;
}
.btn-primary { background: var(--t-cyan); border: 1px solid var(--b-cyan); color: var(--cyan); }
.btn-primary:hover { background: var(--b-cyan); box-shadow: 0 0 24px var(--t-cyan); }
.btn-secondary { background: var(--bg-raised); border: 1px solid var(--border-hi); color: var(--text-dim); }
.btn-secondary:hover { background: var(--bg-raised-hi); color: var(--text); }
.action-btn[hidden] { display: none; }

/* ========== ERROR ========== */
.error-box {
  background: var(--t-red); border: 1px solid var(--b-red);
  border-radius: 12px; padding: 1.25rem; margin-bottom: 1rem;
}
.error-box h2 { font-family: var(--mono); font-size: 1rem; color: var(--red); margin-bottom: 0.5rem; }
.error-box p { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 0.35rem; }
.error-box pre {
  font-family: var(--mono); font-size: 0.72rem; color: var(--text-faint);
  background: var(--bg-sunken); padding: 0.7rem; border-radius: 6px;
  margin-top: 0.6rem; white-space: pre-wrap; word-break: break-word; max-height: 180px; overflow: auto;
}

/* ========== TOAST ========== */
.toast {
  position: fixed; bottom: 2rem; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg); border: 1px solid var(--b-green);
  box-shadow: 0 6px 24px rgba(0,0,0,0.25);
  color: var(--green); padding: 0.65rem 1.4rem; border-radius: 8px;
  font-family: var(--mono); font-size: 0.83rem;
  opacity: 0; transition: opacity .35s ease, transform .35s ease;
  z-index: 2000; pointer-events: none; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: var(--b-red); color: var(--red); }

/* ========== SHORTCUT HELP ========== */
#shortcutHelp {
  display: none; position: fixed; inset: 0; z-index: 1500;
  background: var(--overlay); padding: 2rem 1rem; overflow: auto;
}
#shortcutHelp.active { display: flex; align-items: center; justify-content: center; }
.shortcut-card {
  background: var(--bg-panel); border: 1px solid var(--border-hi);
  border-radius: 14px; padding: 1.5rem; max-width: 440px; width: 100%;
}
.shortcut-card h2 { font-family: var(--mono); font-size: 1rem; color: var(--text-hi); margin-bottom: 0.9rem; }
.shortcut-card dl { display: grid; grid-template-columns: auto 1fr; gap: 0.55rem 1rem; font-size: 0.83rem; }
.shortcut-card dt { font-family: var(--mono); color: var(--cyan); white-space: nowrap; }
.shortcut-card dd { color: var(--text-dim); }
kbd {
  font-family: var(--mono); font-size: 0.75rem; padding: 0.1rem 0.4rem;
  border: 1px solid var(--border-hi); border-bottom-width: 2px;
  border-radius: 4px; background: var(--bg-sunken); color: var(--text);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 760px) {
  .app { padding: 0.75rem 0.85rem 3rem; }
  .header { margin-bottom: 1.25rem; }
  .header h1 { font-size: 1.3rem; }
  .header .tagline { font-size: 0.82rem; }
  .gauge-container { width: 168px; height: 168px; }
  .gauge-score { font-size: 2.4rem; }
  .score-section { padding: 1.5rem 0.75rem; }
  .score-summary { gap: 1.1rem; }
  .meta-grid { grid-template-columns: 1fr; gap: 0.2rem 0; }
  .meta-key { margin-top: 0.5rem; }
  .cat-badges { justify-content: flex-start; }
  .category-header, .panel-header { flex-wrap: wrap; }
  #dropZone { padding: 2.25rem 1rem; }
  .drop-icon { width: 60px; height: 60px; }
  .intake-tabs { flex-direction: column; }
  .tab-btn { width: 100%; }
  .source-actions { justify-content: stretch; }
  .source-actions .action-btn { flex: 1; justify-content: center; }
  .actions-bar { gap: 0.45rem; }
  .actions-bar .action-btn { flex: 1 1 45%; justify-content: center; padding: 0.6rem 0.5rem; font-size: 0.76rem; }
  /* On a narrow screen the batch table is unreadable side-scrolling, so each
     row becomes a stacked card instead. */
  .batch-table thead { display: none; }
  .batch-table, .batch-table tbody, .batch-table tr, .batch-table td { display: block; width: 100%; }
  .batch-table tr {
    border: 1px solid var(--border); border-radius: 10px;
    margin-bottom: 0.5rem; padding: 0.5rem 0.6rem;
  }
  .batch-table td { border-bottom: none; padding: 0.15rem 0; }
  .batch-table td[data-label]::before {
    content: attr(data-label) ': '; color: var(--text-faint);
    font-family: var(--mono); font-size: 0.68rem;
  }
}

/* ========== MOTION / PRINT ========== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important; scroll-behavior: auto !important;
  }
  .header h1 { -webkit-text-fill-color: var(--cyan); }
}
@media print {
  .bg-grid, .bg-glow, .actions-bar, .intake-container, #scanOverlay,
  .toast, .topbar, .findings-toolbar, #shortcutHelp, .url-actions,
  .batch-back { display: none !important; }
  body { background: #fff; color: #111; }
  .panel, .category-card, .score-section, .finding, .shortcut-card { background: #fff; border-color: #bbb; }
  .panel-body, .category-body { display: block !important; }
  #batchSection { display: block !important; }
  .check-name, .cat-name, .finding-name, .meta-val, .panel-header h2,
  .batch-file, .batch-head h2 { color: #111; }
  .finding, .panel, .category-card, .batch-table tr { break-inside: avoid; }
}

/* ========== VIRUSTOTAL INTEGRATION ========== */
#vtConfigPanel {
  display: none; position: fixed; inset: 0; z-index: 1600;
  background: var(--overlay); padding: 2rem 1rem; overflow: auto;
}
#vtConfigPanel.active { display: flex; align-items: center; justify-content: center; }
.vt-card {
  background: var(--bg-panel); border: 1px solid var(--border-hi);
  border-radius: 14px; padding: 1.5rem; max-width: 520px; width: 100%;
}
.vt-card h2 { font-family: var(--mono); font-size: 1rem; color: var(--text-hi); margin-bottom: 0.6rem; }
.vt-desc { font-size: 0.82rem; color: var(--text-dim); line-height: 1.6; margin-bottom: 0.9rem; }
.vt-desc a { color: var(--link-blue); }
.vt-key-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.vt-key-input {
  flex: 1; padding: 0.5rem 0.8rem; border-radius: 8px;
  background: var(--bg-sunken); border: 1px solid var(--border-hi);
  color: var(--text); font-family: var(--mono); font-size: 0.79rem; outline: none;
  transition: border-color .2s;
}
.vt-key-input:focus { border-color: var(--b-cyan); }
.vt-key-input::placeholder { color: var(--text-faint); }
.vt-tier-note {
  font-size: 0.73rem; color: var(--text-faint); font-family: var(--mono);
  padding: 0.3rem 0; min-height: 1.4em;
}
.vt-config-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }
.icon-btn.vt-active { background: var(--t-cyan); border-color: var(--b-cyan); color: var(--cyan); }
.vt-badge {
  display: inline-flex; align-items: center; gap: 0.2rem;
  padding: 0.1rem 0.45rem; border-radius: 100px;
  font-size: 0.65rem; font-family: var(--mono); font-weight: 600;
  margin-left: 0.35rem; vertical-align: middle;
}
.vt-badge-clean  { background: var(--t-green); color: var(--green); border: 1px solid var(--b-green); }
.vt-badge-threat { background: var(--t-red); color: var(--red); border: 1px solid var(--b-red); }
.vt-badge-susp   { background: var(--t-amber); color: var(--amber); border: 1px solid var(--b-amber); }
.vt-badge-info   { background: var(--t-grey); color: var(--grey); border: 1px solid var(--b-grey); }
.vt-badge-spin   { background: var(--t-cyan); color: var(--cyan); border: 1px solid var(--b-cyan); animation: vtPulse .9s ease-in-out infinite; }
@keyframes vtPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
a.vt-badge { text-decoration: none; cursor: pointer; }
a.vt-badge:hover { opacity: 0.8; }
.vt-progress-msg {
  font-size: 0.74rem; color: var(--text-dim); font-family: var(--mono);
  text-align: center; padding: 0.25rem 0; min-height: 1.4em;
}
.vt-file-warning {
  background: color-mix(in srgb, var(--amber) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  font-size: 0.79rem;
  line-height: 1.55;
  color: var(--text-dim);
  margin-bottom: 1rem;
}
.vt-file-warning strong { color: var(--amber); }
.vt-file-cmd { display: block; margin-top: 0.5rem; color: var(--text-faint); font-size: 0.72rem; }
.vt-file-code {
  display: inline-block;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  margin: 0.25rem 0.2rem 0 0;
  color: var(--text);
  user-select: all;
}

/* ========== WHY-SCORE EXPLANATION BOX ========== */
.score-why {
  margin: 1.2rem auto 0;
  max-width: 560px;
  background: var(--bg-sunken);
  border: 1px solid var(--border-hi);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  text-align: left;
}
.score-why-title {
  font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 1.4px; color: var(--text-faint); margin-bottom: 0.5rem;
}
.score-why-item {
  display: flex; align-items: baseline; gap: 0.55rem;
  font-size: 0.78rem; padding: 0.22rem 0;
  border-bottom: 1px solid var(--hairline);
}
.score-why-item:last-child { border-bottom: none; }
.score-why-weight {
  font-family: var(--mono); font-size: 0.68rem; font-weight: 700;
  flex-shrink: 0; min-width: 2rem; text-align: right;
}
.score-why-item.s-fail .score-why-weight { color: var(--red); }
.score-why-item.s-warn .score-why-weight { color: var(--amber); }
.score-why-text { color: var(--text-dim); flex: 1; min-width: 0; }
.score-why-note {
  font-size: 0.72rem; color: var(--text-faint); font-style: italic;
  margin-top: 0.35rem;
}

/* ========== SCORE BREAKDOWN BAR ========== */
.score-breakdown {
  margin: 1rem auto 0; max-width: 560px;
}
.score-breakdown-title {
  font-family: var(--mono); font-size: 0.68rem; text-transform: uppercase;
  letter-spacing: 1.4px; color: var(--text-faint); margin-bottom: 0.45rem;
  text-align: left;
}
.score-breakdown-bar {
  display: flex; height: 8px; border-radius: 100px; overflow: hidden;
  background: var(--bg-sunken); gap: 1px;
}
.score-breakdown-seg {
  height: 100%; transition: width .6s cubic-bezier(0.4,0,0.2,1);
  border-radius: 1px;
}
.score-breakdown-labels {
  display: flex; gap: 0.4rem; flex-wrap: wrap;
  margin-top: 0.45rem; justify-content: center;
}
.score-breakdown-chip {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-family: var(--mono); font-size: 0.64rem; color: var(--text-dim);
}
.score-breakdown-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}

/* ========== IDENTITY CLAIMS TABLE ========== */
.identity-claims { margin-top: 1rem; }
.identity-claims-title {
  font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 1.4px; color: var(--text-faint); margin-bottom: 0.5rem;
}
.identity-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.identity-table th {
  font-family: var(--mono); font-size: 0.66rem; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-faint); font-weight: 500;
  padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--border); text-align: left;
}
.identity-table td {
  padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--hairline);
  color: var(--text-dim); vertical-align: top;
}
.identity-table td:first-child { color: var(--text-faint); font-family: var(--mono); font-size: 0.72rem; white-space: nowrap; }
.id-match   { color: var(--green); }
.id-difforg { color: var(--amber); }
.id-free    { color: var(--red); }
.id-missing { color: var(--text-faint); font-style: italic; }
.id-icon    { margin-right: 0.3rem; }

/* ========== MATRIX BACKGROUND ANIMATION ========== */
#phish-bg {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden;
}
.matrix-drop {
  position: absolute; top: -50px;
  color: var(--cyan);
  font-family: var(--mono);
  opacity: 0; user-select: none;
  text-shadow: 0 0 8px var(--cyan);
  animation: matrixFall linear forwards;
}
@keyframes matrixFall {
  0% { transform: translateY(0); opacity: 0; }
  10% { opacity: 0.25; }
  90% { opacity: 0.25; }
  100% { transform: translateY(110vh); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .matrix-drop { animation: none !important; display: none !important; }
}

/* ========== GLASSMORPHISM & MODERN AESTHETICS ========== */
.score-section, .panel, .category-card, #rawSourceBox, #dropZone {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  border-radius: 16px;
}
.panel-body, .category-body {
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
}
.panel-header, .category-header {
  border-radius: 16px;
}

/* ========== DELIVERY INFORMATION TABLE ========== */
.delivery-info { padding: 1rem; }
.auth-badges { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.auth-badge {
  display: inline-flex; align-items: center; padding: 0.25rem 0.6rem;
  border-radius: 4px; font-family: var(--mono); font-size: 0.72rem;
  font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px;
}
.ab-pass { background: var(--t-green); color: var(--green); border: 1px solid var(--b-green); }
.ab-fail { background: var(--t-red); color: var(--red); border: 1px solid var(--b-red); }
.ab-softfail { background: var(--t-amber); color: var(--amber); border: 1px solid var(--b-amber); }
.ab-none { background: var(--t-grey); color: var(--grey); border: 1px solid var(--b-grey); }

.delivery-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.total-time-badge {
  border: 1px solid var(--orange); color: var(--orange); background: var(--t-orange);
  padding: 0.25rem 0.6rem; border-radius: 4px; font-family: var(--sans); font-size: 0.75rem;
}

.delivery-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; font-family: var(--sans); }
.delivery-table th {
  text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--border-hi);
  color: var(--text-faint); font-weight: 500;
}
.delivery-table td {
  padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--hairline);
  color: var(--text-hi);
}
.delivery-table td.truncate {
  max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.delivery-table td.col-delay { width: 80px; }
.delivery-table td.col-num { width: 40px; font-family: var(--mono); font-size: 0.8rem; font-weight: 600; color: var(--text-hi); }
.delay-bar-container { display: flex; align-items: center; gap: 0.4rem; }
.delay-bar { height: 4px; border-radius: 2px; }
.db-green { background: var(--green); }
.db-amber { background: var(--amber); }
.db-red { background: var(--red); }

/* ========== NEW CYBERSEC SLATE TABLES & PILLS ========== */
.delay-bar-container { display: flex; align-items: center; gap: 0.5rem; }
.delay-bar { height: 6px; border-radius: 3px; background: var(--bg-sunken); flex: 1; position: relative; overflow: hidden; }
.delay-bar-fill { position: absolute; left: 0; top: 0; height: 100%; border-radius: 3px; }
.delay-bar-fill.high { background: var(--orange); }
.delay-bar-fill.low { background: var(--cyan); }
.delay-text { font-family: var(--mono); font-size: 0.75rem; font-weight: 600; min-width: 24px; text-align: right; }
.auth-pills-row { display: flex; gap: 0.75rem; margin-bottom: 1rem; }
.auth-pill { padding: 0.4rem 0.8rem; border-radius: 6px; font-family: var(--mono); font-weight: 700; font-size: 0.75rem; display: inline-flex; align-items: center; }
.auth-pill-pass { background: var(--green); color: #0F172A; }
.auth-pill-fail { background: var(--red); color: #FFF; }
.auth-pill-neutral { background: var(--grey); color: #FFF; }
.flat-section { margin-bottom: 2.5rem; background: transparent; border: none; }
.flat-section h2 { font-family: var(--sans); font-size: 1.25rem; font-weight: 600; color: var(--text-hi); margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
