/* ============================================================
   WP Malware Scanner AI — Chat-style UI
   ============================================================ */

:root {
  --bg:          #0a1020;
  --bg2:         #10182b;
  --surface:     rgba(13, 22, 39, .88);
  --surface2:    #16233a;
  --surface3:    #1e3050;
  --border:      rgba(132, 163, 212, .16);
  --border2:     rgba(132, 163, 212, .28);
  --text:        #ecf3ff;
  --text2:       #c8d7f2;
  --muted:       #8ca0c3;
  --accent:      #7bb0ff;
  --accent-h:    #a3c9ff;
  --accent-bg:   rgba(123,176,255,.12);
  --critical:    #ff5a5a;
  --high:        #ffc56a;
  --medium:      #5a9eff;
  --low:         #4ccc70;
  --clean:       #4ccc70;
  --radius:      14px;
  --radius-sm:   6px;
  --mono:        'JetBrains Mono','Fira Code','Cascadia Code',monospace;
  --sidebar-w:   260px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background:
    radial-gradient(circle at top left, rgba(58, 103, 176, .24), transparent 28%),
    radial-gradient(circle at top right, rgba(18, 181, 164, .10), transparent 24%),
    linear-gradient(180deg, #09101d 0%, #0b1324 55%, #09101d 100%);
  color: var(--text);
  font-family: 'Segoe UI', 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}


/* ══════════════════════════════════════════════════════════════
   UTILITIES
   ══════════════════════════════════════════════════════════════ */
.hidden { display: none !important; }
.mono   { font-family: var(--mono); }
.muted  { color: var(--muted); }
.small  { font-size: 12px; }

::-webkit-scrollbar          { width: 5px; height: 5px; }
::-webkit-scrollbar-track    { background: transparent; }
::-webkit-scrollbar-thumb    { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.45; } }
@keyframes fadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
@keyframes dotBounce {
  0%,80%,100% { transform: translateY(0); }
  40%         { transform: translateY(-5px); }
}


/* ══════════════════════════════════════════════════════════════
   LOGIN SCREEN
   ══════════════════════════════════════════════════════════════ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.75rem 2.25rem;
  text-align: center;
  animation: fadeIn .3s ease;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1rem;
}

.login-icon { width: 28px; height: 28px; color: var(--accent); }

.login-subtitle {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.login-error {
  background: rgba(255,90,90,.1);
  border: 1px solid rgba(255,90,90,.3);
  color: var(--critical);
  border-radius: var(--radius-sm);
  padding: .6rem .875rem;
  font-size: 13px;
  margin-bottom: 1.25rem;
  text-align: left;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  width: 100%;
  padding: .75rem 1.25rem;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
}
.google-btn:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 6px rgba(0,0,0,.2);
}

.google-logo { width: 20px; height: 20px; flex-shrink: 0; }

.login-domain-note {
  margin-top: 1.25rem;
  font-size: 12px;
  color: var(--muted);
}
.login-domain-note strong { color: var(--text2); }


/* ══════════════════════════════════════════════════════════════
   APP SHELL — sidebar + chat
   ══════════════════════════════════════════════════════════════ */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}


/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(10, 18, 33, .92), rgba(12, 21, 38, .84));
  border-right: 1px solid var(--border);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem .75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -.2px;
}

.brand-icon { width: 20px; height: 20px; }

.new-scan-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
}
.new-scan-btn:hover { background: var(--surface3); color: var(--text); }
.new-scan-btn svg  { width: 14px; height: 14px; }

.sidebar-section-label {
  padding: .75rem 1rem .35rem;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--muted);
  flex-shrink: 0;
}

.sidebar-jobs {
  flex: 1;
  overflow-y: auto;
  padding: .25rem .5rem;
}

.sidebar-job-item {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: .75rem .8rem;
  margin-bottom: .45rem;
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(255,255,255,.02);
  cursor: pointer;
  transition: transform .14s ease, border-color .14s ease, background .14s ease, box-shadow .14s ease;
}
.sidebar-job-item:hover {
  transform: translateY(-1px);
  background: rgba(123,176,255,.08);
  border-color: rgba(123,176,255,.16);
  box-shadow: 0 10px 24px rgba(3, 10, 25, .26);
}
.sidebar-job-item.active {
  background: linear-gradient(180deg, rgba(123,176,255,.14), rgba(123,176,255,.08));
  border-color: rgba(123,176,255,.26);
  box-shadow: inset 0 0 0 1px rgba(123,176,255,.12);
}
.sji-url {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text2);
  word-break: break-word;
}
.sji-owner {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  word-break: break-all;
}
.sji-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.sji-time {
  color: var(--muted);
  font-size: 11px;
}
.sji-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  padding: .22rem .5rem;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.badge-complete { background: rgba(76,204,112,.12); color: var(--clean); border-color: rgba(76,204,112,.2); }
.badge-failed { background: rgba(255,90,90,.12); color: var(--critical); border-color: rgba(255,90,90,.2); }
.badge-pending { background: rgba(255,197,106,.12); color: var(--high); border-color: rgba(255,197,106,.2); }
.badge-running { background: rgba(123,176,255,.12); color: var(--accent-h); border-color: rgba(123,176,255,.2); }

.sidebar-empty {
  font-size: 12px;
  color: var(--muted);
  padding: .5rem .5rem;
}

/* Job item in sidebar */
.job-item {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .55rem .6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s;
  margin-bottom: 2px;
}
.job-item:hover   { background: var(--surface2); }
.job-item.active  { background: var(--accent-bg); }

.job-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.job-dot.pending,
.job-dot.downloading,
.job-dot.scanning,
.job-dot.tracing,
.job-dot.inspecting,
.job-dot.extracting,
.job-dot.reporting { background: var(--medium); animation: pulse 1.5s infinite; }
.job-dot.complete  { background: var(--clean); }
.job-dot.failed    { background: var(--critical); }

.job-item-info    { flex: 1; min-width: 0; }
.job-item-domain  { font-size: 13px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-item-meta    { font-size: 11px; color: var(--muted); margin-top: 1px; }
.job-item.active .job-item-domain { color: var(--accent); }

/* Sidebar footer — user chip */
.sidebar-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
}

.user-chip {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .6rem;
  min-width: 0;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.user-meta   { min-width: 0; }
.user-name   { font-size: 12px; font-weight: 600; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email  { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.signout-btn {
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  transition: color .15s;
}
.signout-btn:hover { color: var(--critical); }
.signout-btn svg   { width: 16px; height: 16px; }


/* ── Chat main ─────────────────────────────────────────────── */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(6,12,23,.16), rgba(6,12,23,0)),
    radial-gradient(circle at top, rgba(123,176,255,.08), transparent 36%);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}


/* ── Welcome state ─────────────────────────────────────────── */
.welcome-state {
  max-width: 580px;
  margin: auto;
  text-align: center;
  padding: 3rem 1rem;
  animation: fadeIn .4s ease;
}

.welcome-icon {
  width: 56px;
  height: 56px;
  background: var(--accent-bg);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  color: var(--accent);
}
.welcome-icon svg { width: 30px; height: 30px; }

.welcome-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .6rem;
}

.welcome-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.welcome-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: center;
}

.suggestion-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .4rem .95rem;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.suggestion-chip:hover { background: var(--surface2); border-color: var(--border2); color: var(--text); }


/* ══════════════════════════════════════════════════════════════
   MESSAGES
   ══════════════════════════════════════════════════════════════ */
.msg-row {
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  padding: .6rem 0;
  animation: fadeIn .2s ease;
}

/* User message — right-aligned bubble */
.msg-row.user, .msg-row--user { display: flex; justify-content: flex-end; }

.user-bubble, .msg-bubble--user {
  max-width: 72%;
  background: linear-gradient(135deg, #8cb8ff 0%, #73a8ff 100%);
  color: #081121;
  padding: .8rem 1rem;
  border-radius: 18px 18px 6px 18px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 14px 34px rgba(7, 15, 31, .18);
}
.msg-meta {
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .35rem;
}
.msg-bubble--user .msg-meta {
  color: rgba(8, 17, 33, .72);
}

/* Assistant message — full-width text with avatar */
.msg-row.assistant, .msg-row--assistant {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 10px;
}

/* AI shield avatar icon */
.msg-avatar {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  margin-top: 4px;
  color: var(--accent);
}
.msg-avatar svg { width: 100%; height: 100%; }

.assistant-content, .msg-bubble--assistant {
  flex: 1;
  max-width: 100%;
  color: var(--text);
  font-size: 14px;
  line-height: 1.75;
  white-space: normal;
  word-break: break-word;
  background: rgba(8, 16, 30, .44);
  border: 1px solid rgba(132, 163, 212, .12);
  border-radius: 18px;
  padding: .95rem 1.05rem;
  box-shadow: 0 16px 40px rgba(5, 10, 24, .2);
}
.md-block { display: block; }
.assistant-content p, .msg-bubble--assistant p  { margin-bottom: .5rem; }
.assistant-content p:last-child, .msg-bubble--assistant p:last-child { margin-bottom: 0; }
.msg-bubble--assistant h1,
.msg-bubble--assistant h2,
.msg-bubble--assistant h3 {
  margin: .2rem 0 .55rem;
  line-height: 1.35;
}
.msg-bubble--assistant h1 { font-size: 1rem; }
.msg-bubble--assistant h2 { font-size: .95rem; color: var(--accent-h); }
.msg-bubble--assistant h3 { font-size: .88rem; color: var(--text2); }
.msg-bubble--assistant ul,
.msg-bubble--assistant ol {
  margin: .45rem 0 .35rem 1.2rem;
}
.msg-bubble--assistant li {
  margin: .2rem 0;
}

/* Typing dots indicator */
.typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: .5rem 0;
}
.typing-dots span {
  width: 7px; height: 7px;
  background: var(--muted);
  border-radius: 50%;
  animation: dotBounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .30s; }

/* Progress list — shown during scan */
.progress-list {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding: .25rem 0;
}
.progress-line {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: 13px;
  color: var(--muted);
}
.progress-line.active { color: var(--text2); }
.progress-line.done   { color: var(--clean); }
.progress-line.failed { color: var(--critical); }

.progress-spinner {
  width: 13px; height: 13px;
  border: 1.5px solid rgba(108,143,255,.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
.progress-check  { color: var(--clean);    font-size: 13px; flex-shrink: 0; }
.progress-cross  { color: var(--critical); font-size: 13px; flex-shrink: 0; }
.progress-arrow  { color: var(--muted);    font-size: 11px; flex-shrink: 0; }


/* ══════════════════════════════════════════════════════════════
   RESULTS CARD — inline in the chat thread
   ══════════════════════════════════════════════════════════════ */
.results-card {
  background: linear-gradient(180deg, rgba(14,24,42,.92), rgba(12,20,35,.9));
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  width: 100%;
  margin: .35rem 0;
  box-shadow: 0 20px 48px rgba(4, 9, 22, .24);
}

.results-card__header {
  padding: 1rem 1.15rem .4rem;
  border-bottom: 1px solid rgba(132,163,212,.08);
}
.results-card__eyebrow {
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .4rem;
}
.results-card__hero {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.results-card__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.results-summary {
  padding: .9rem 1.15rem 0;
  color: var(--text2);
  line-height: 1.6;
}
.results-card__footer {
  margin: 1rem 1.15rem 1.1rem;
  padding-top: .8rem;
  border-top: 1px solid rgba(132,163,212,.08);
  color: var(--muted);
  font-size: 12px;
}
.results-confidence {
  display: inline-flex;
  align-items: center;
  padding: .26rem .56rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.conf-high { background: rgba(255,90,90,.12); color: #ff9f9f; border-color: rgba(255,90,90,.18); }
.conf-medium { background: rgba(255,197,106,.12); color: #ffd48c; border-color: rgba(255,197,106,.18); }
.conf-low { background: rgba(123,176,255,.12); color: var(--accent-h); border-color: rgba(123,176,255,.18); }
.conf-clean { background: rgba(76,204,112,.12); color: #9ff2b4; border-color: rgba(76,204,112,.18); }

.results-header {
  padding: 1rem 1.25rem .75rem;
  border-bottom: 1px solid var(--border);
}

.results-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .6rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.results-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  padding: 1rem 1.15rem 0;
}
.findings-list,
.ai-scan-section,
.trace-card,
.clean-line {
  margin: 1rem 1.15rem 0;
}
.findings-list {
  padding-top: .15rem;
}
.findings-list__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .65rem;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.rs {
  min-width: 104px;
  padding: .75rem .8rem;
  border-radius: 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(132,163,212,.08);
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.rs-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}
.rs-val--danger { color: #ff9f9f; }
.rs-val--warn { color: #ffd48c; }
.rs-label {
  font-size: 11px;
  color: var(--muted);
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .65rem;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.stat-pill.critical { background: rgba(255,90,90,.12);  color: var(--critical); }
.stat-pill.high     { background: rgba(255,179,71,.12);  color: var(--high); }
.stat-pill.medium   { background: rgba(90,158,255,.12);  color: var(--medium); }
.stat-pill.clean    { background: rgba(76,204,112,.12);  color: var(--clean); }
.stat-pill.info     { background: var(--surface2);       color: var(--muted); }

/* Results tabs */
.results-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 1.25rem;
  overflow-x: auto;
  flex-shrink: 0;
}
.rtab {
  padding: .55rem .875rem;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all .15s;
  margin-bottom: -1px;
}
.rtab:hover  { color: var(--text2); }
.rtab.active { color: var(--accent); border-bottom-color: var(--accent); }

.rtab-panel          { display: none; padding: 1rem 1.25rem; }
.rtab-panel.active   { display: block; }

/* Finding rows inside results card */
.finding-row {
  display: flex;
  gap: .75rem;
  padding: .9rem .95rem;
  border: 1px solid rgba(132,163,212,.08);
  border-radius: 14px;
  align-items: center;
  background: rgba(255,255,255,.02);
  margin-bottom: .55rem;
}
.finding-row:last-child { margin-bottom: 0; }
.finding-row--critical { border-color: rgba(255,90,90,.2); }
.finding-row--high { border-color: rgba(255,197,106,.16); }

.finding-sev {
  flex-shrink: 0;
  padding: .15rem .5rem;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 2px;
}
.finding-sev.CRITICAL { background: rgba(255,90,90,.15);  color: var(--critical); }
.finding-sev.HIGH     { background: rgba(255,179,71,.15);  color: var(--high); }
.finding-sev.MEDIUM   { background: rgba(90,158,255,.15);  color: var(--medium); }
.finding-sev.LOW      { background: rgba(76,204,112,.15);  color: var(--clean); }

.finding-body { flex: 1; min-width: 0; }
.finding-desc { font-size: 13px; font-weight: 600; margin-bottom: .35rem; line-height: 1.45; }
.finding-loc  {
  display: inline-flex;
  align-items: center;
  padding: .24rem .5rem;
  border-radius: 9px;
  background: rgba(123,176,255,.08);
  border: 1px solid rgba(123,176,255,.1);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 0;
}
.clean-line {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .85rem .95rem;
  border-radius: 14px;
  background: rgba(76,204,112,.06);
  border: 1px solid rgba(76,204,112,.12);
  color: var(--text2);
}
.more-note {
  color: var(--muted);
  font-size: 12px;
  margin-top: .5rem;
}

/* Trace steps */
.trace-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .9rem 1rem;
}
.trace-card__header {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
  font-size: 13px;
  font-weight: 600;
}
.trace-conf {
  display: inline-flex;
  align-items: center;
  padding: .16rem .45rem;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.trace-conf--high { background: rgba(255,90,90,.12); color: #ff9f9f; }
.trace-conf--medium { background: rgba(255,197,106,.12); color: #ffd48c; }
.trace-conf--low { background: rgba(123,176,255,.12); color: var(--accent-h); }
.trace-query {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: .6rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}

.trace-step {
  display: flex;
  gap: .65rem;
  margin-bottom: .55rem;
  align-items: flex-start;
}
.trace-step:last-child { margin-bottom: 0; }
.trace-step__num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(123,176,255,.12);
  color: var(--accent-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.trace-step__body {
  flex: 1;
  min-width: 0;
}
.trace-snippet {
  margin-top: .4rem;
}
.decode-badge {
  display: inline-flex;
  margin-top: .35rem;
  padding: .16rem .45rem;
  border-radius: 999px;
  background: rgba(123,176,255,.08);
  border: 1px solid rgba(123,176,255,.12);
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.trace-num {
  width: 20px; height: 20px;
  background: var(--surface3);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.trace-body    { flex: 1; font-size: 13px; }
.trace-desc    { margin-bottom: .15rem; }
.trace-loc     { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* Code / pre blocks */
pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .6rem .875rem;
  font-family: var(--mono);
  font-size: 12px;
  color: #a5d6ff;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: .35rem 0;
}

code {
  background: var(--surface2);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
}

/* Hooks table inside results card */
.hooks-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.hooks-table th {
  text-align: left;
  padding: .35rem .5rem;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
}
.hooks-table td {
  padding: .45rem .5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.hooks-table tr:last-child td { border-bottom: none; }

/* Markdown report */
.report-pre {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text2);
  background: none;
  border: none;
  padding: 0;
}

/* Alert variants */
.inline-alert {
  padding: .6rem .875rem;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-top: .5rem;
}
.inline-alert.success { background: rgba(76,204,112,.1);  border: 1px solid rgba(76,204,112,.25);  color: var(--clean); }
.inline-alert.info    { background: rgba(90,158,255,.1);  border: 1px solid rgba(90,158,255,.25);  color: var(--medium); }
.inline-alert.warn    { background: rgba(255,179,71,.1);  border: 1px solid rgba(255,179,71,.25);  color: var(--high); }
.inline-alert.error   { background: rgba(255,90,90,.1);   border: 1px solid rgba(255,90,90,.25);   color: var(--critical); }

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.badge.complete  { background: rgba(76,204,112,.15);  color: var(--clean); }
.badge.failed    { background: rgba(255,90,90,.15);   color: var(--critical); }
.badge.scanning  { background: rgba(90,158,255,.15);  color: var(--medium); }
.badge.HIGH      { color: var(--critical); }
.badge.MEDIUM    { color: var(--high); }
.badge.LOW       { color: var(--clean); }
.badge.CLEAN     { color: var(--clean); }


/* ══════════════════════════════════════════════════════════════
   CHAT INPUT BAR
   ══════════════════════════════════════════════════════════════ */
.chat-input-area {
  flex-shrink: 0;
  padding: .75rem 1.5rem 1.25rem;
  background:
    linear-gradient(180deg, rgba(9,16,29,0), rgba(9,16,29,.68) 28%, rgba(9,16,29,.92) 100%);
  backdrop-filter: blur(14px);
}

.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: .65rem;
  background: rgba(10, 18, 34, .78);
  border: 1px solid var(--border2);
  border-radius: 18px;
  padding: .75rem .75rem .75rem 1rem;
  max-width: 780px;
  margin: 0 auto;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: 0 14px 34px rgba(2, 8, 18, .24);
}
.chat-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(123,176,255,.12), 0 14px 34px rgba(2, 8, 18, .24);
}

.chat-textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  resize: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  max-height: 180px;
  overflow-y: auto;
  padding: 0;
  caret-color: var(--accent);
}
.chat-textarea::placeholder { color: var(--muted); }

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #8cb8ff 0%, #73a8ff 100%);
  color: #081121;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, opacity .15s;
}
.send-btn svg         { width: 17px; height: 17px; }
.send-btn:hover       { background: var(--accent-h); }
.send-btn:disabled    { opacity: .35; cursor: not-allowed; background: var(--accent); }

.input-hint {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  margin-top: .45rem;
  max-width: 780px;
  margin-left: auto;
  margin-right: auto;
}
.input-hint strong { color: var(--text2); font-weight: 500; }


/* ══════════════════════════════════════════════════════════════
   ACTIVITY FEED (live SSE log)
   ══════════════════════════════════════════════════════════════ */
.activity-panel {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.activity-panel summary {
  cursor: pointer;
  list-style: none;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface2);
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.activity-panel summary::-webkit-details-marker { display: none; }
.activity-panel summary::after {
  content: "▸";
  margin-left: auto;
  font-size: 10px;
  transition: transform .15s;
}
.activity-panel[open] summary::after { transform: rotate(90deg); }

.activity-feed {
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg2);
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

.activity-line {
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-all;
}
.activity-line--warn {
  color: var(--high);
}
.activity-line:first-child { padding-top: 2px; }
.activity-line:last-child  { padding-bottom: 2px; }

.scan-started {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.scan-started__title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}
.scan-started__url {
  color: var(--text2);
  word-break: break-word;
}
.scan-started__id {
  color: var(--muted);
  font-size: 12px;
}
.scan-started__owner {
  margin-top: .45rem;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}


/* ══════════════════════════════════════════════════════════════
   AI SCAN SECTION — shown on CLEAN results
   ══════════════════════════════════════════════════════════════ */
.ai-scan-section {
  margin: .75rem 0;
  padding: .75rem .9rem;
  background: rgba(108,143,255,.06);
  border: 1px solid rgba(108,143,255,.2);
  border-radius: var(--radius);
}
.ai-scan-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: .2rem;
}
.ai-scan-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: .65rem;
  line-height: 1.5;
}
.ai-scan-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .3rem 0;
  border-top: 1px solid var(--border);
}
.ai-scan-filename {
  font-size: 12px;
  color: var(--text2);
  word-break: break-all;
}

/* ══════════════════════════════════════════════════════════════
   FINDING ROW — updated layout with Analyse button
   ══════════════════════════════════════════════════════════════ */
.finding-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.analyse-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid rgba(108,143,255,.25);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .15s, border-color .15s;
}
.analyse-btn:hover:not(:disabled) {
  background: rgba(108,143,255,.2);
  border-color: rgba(108,143,255,.45);
}
.analyse-btn:disabled { opacity: .5; cursor: default; }

/* ══════════════════════════════════════════════════════════════
   ANALYSIS SLOT + CARD
   ══════════════════════════════════════════════════════════════ */
.analysis-slot {
  display: none;
  margin: .2rem 0 .6rem 1rem;
}
.analysis-card {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  font-size: 13px;
}
.analysis-card--loading {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--muted);
  padding: .6rem 1rem;
}
.analysis-card--error { color: var(--critical); }
.analysis-loading-text { font-size: 13px; }

.analysis-card__header {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .5rem;
}
.verdict-badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.verdict--malicious { background: rgba(255,90,90,.15);  color: var(--critical); border: 1px solid rgba(255,90,90,.3); }
.verdict--suspicious { background: rgba(255,179,71,.15); color: var(--high);     border: 1px solid rgba(255,179,71,.3); }
.verdict--clean      { background: rgba(76,204,112,.15); color: var(--clean);    border: 1px solid rgba(76,204,112,.3); }

.analysis-filename   { color: var(--muted); font-size: 12px; }
.analysis-badge-fallback {
  font-size: 10px;
  padding: .15rem .4rem;
  border-radius: 3px;
  background: var(--surface3);
  color: var(--muted);
}
.analysis-meta {
  display: flex;
  gap: .45rem;
  align-items: center;
  margin-bottom: .45rem;
  flex-wrap: wrap;
}
.analysis-category { font-size: 12px; color: var(--text2); font-weight: 500; }
.analysis-severity {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: .1rem .35rem;
  border-radius: 3px;
}
.sev-critical { background: rgba(255,90,90,.15);  color: var(--critical); }
.sev-high     { background: rgba(255,179,71,.15);  color: var(--high); }
.sev-medium   { background: rgba(90,158,255,.15);  color: var(--medium); }
.sev-low      { background: rgba(76,204,112,.15);  color: var(--clean); }

.analysis-headline {
  font-size: 13px;
  color: var(--text2);
  font-style: italic;
  margin-bottom: .7rem;
  line-height: 1.5;
}
.analysis-section { margin-bottom: .75rem; }
.analysis-section:last-child { margin-bottom: 0; }
.analysis-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin-bottom: .35rem;
}
.analysis-breakdown { display: flex; flex-direction: column; gap: .3rem; }
.analysis-breakdown-row {
  background: var(--surface3);
  border-radius: var(--radius-sm);
  padding: .4rem .65rem;
}
.abr-header { display: flex; gap: .5rem; align-items: baseline; margin-bottom: .1rem; }
.abr-lines  { font-family: var(--mono); font-size: 10px; color: var(--accent); flex-shrink: 0; }
.abr-title  { font-weight: 600; font-size: 13px; }
.abr-detail { font-size: 12px; color: var(--text2); }

.ioc-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ioc-table th {
  text-align: left; font-size: 11px; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--border); padding: .2rem .4rem .3rem;
}
.ioc-table td { padding: .3rem .4rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.ioc-table tr:last-child td { border-bottom: none; }
.ioc-table code { font-size: 11px; color: var(--accent-h); word-break: break-all; }

.analysis-remediation {
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  color: var(--text2);
}
.analysis-remediation li { font-size: 13px; line-height: 1.5; }

.history-divider {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .1rem .2rem;
  color: var(--muted);
  font-size: 12px;
}
.history-divider__label {
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 10px;
}
.history-divider__count {
  padding: .2rem .5rem;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(132,163,212,.1);
}


/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 700px) {
  .sidebar           { display: none; }
  .chat-messages     { padding: 1rem; }
  .chat-input-area   { padding: .5rem .75rem 1rem; }
  .user-bubble       { max-width: 88%; }
}
