/* ============================================
   4NMAIL — HackTheBox Theme
   ============================================ */

/* ===== DESIGN TOKENS ===== */
:root {
  /* Backgrounds — HTB layered system */
  --bg-deep: #0d1117;
  --bg-base: #161b22;
  --bg-elevated: #21262d;
  --bg-surface: #30363d;
  --bg-overlay: rgba(13, 17, 23, 0.85);

  /* Accent — HTB brand green */
  --accent: #9fef00;
  --accent-hover: #b3ff33;
  --accent-dim: #6b9e00;
  --accent-bg: rgba(159, 239, 0, 0.08);
  --accent-border: rgba(159, 239, 0, 0.25);
  --accent-glow: rgba(159, 239, 0, 0.15);

  /* Semantic colors */
  --green: #9fef00;
  --green-bg: rgba(159, 239, 0, 0.08);
  --green-border: rgba(159, 239, 0, 0.25);
  --red: #ff7b72;
  --red-bg: rgba(255, 123, 114, 0.08);
  --red-border: rgba(255, 123, 114, 0.25);
  --yellow: #d29922;
  --yellow-bg: rgba(210, 153, 34, 0.08);
  --yellow-border: rgba(210, 153, 34, 0.25);
  --blue: #58a6ff;
  --blue-bg: rgba(88, 166, 255, 0.08);
  --blue-border: rgba(88, 166, 255, 0.25);
  --purple: #bc8cff;
  --purple-bg: rgba(188, 140, 255, 0.08);
  --purple-border: rgba(188, 140, 255, 0.25);

  /* Text */
  --text: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;

  /* Borders */
  --border: #30363d;
  --border-light: #21262d;
  --border-hover: #9fef00;

  /* Spacing */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* Transitions */
  --transition: 0.15s ease-in-out;
  --transition-slow: 0.25s ease-in-out;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-deep);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===== SELECTION ===== */
::selection {
  background: var(--accent-bg);
  color: var(--accent);
}

/* ===== APP CONTAINER ===== */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  position: relative;
}

/* Subtle radial glow at top */
.app-container::before {
  content: "";
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  /* Capped to the viewport: a fixed 800px element widened the page on phones,
     where body's overflow-x:hidden does not stop the viewport scrolling. */
  width: min(800px, 100vw);
  height: 400px;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--accent) 3%, transparent) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ===== BACKGROUND LIGHTNING (scripts/lightning.js) =====
   A canvas behind every panel (z-index -1 over the page background), never
   clickable. It is clear except for the moment of a strike. */
.lightning {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .lightning {
    display: none;
  }
}

/* ===== TRUST BANNER ===== */
.trust-banner {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 1rem;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 1.25rem;
  position: relative;
  z-index: 1;
}
.trust-banner svg {
  flex-shrink: 0;
  opacity: 0.8;
}

/* ===== HEADER ===== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
  position: relative;
  z-index: 1;
}
.app-header h1 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
/* ===== WORDMARK: 4NMAIL, in the style of its sibling 4NSEC =====
   The 4 glows in the accent colour; the rest is plain. Every so often the A
   breaks up and comes back as an @ for a moment, and hovering the name
   glitches the 4. */
.wordmark {
  font: 800 19px/1 "JetBrains Mono", monospace;
  letter-spacing: 0.14em;
  display: flex;
  align-items: baseline;
}
.wordmark .four {
  color: var(--accent);
  text-shadow: 0 0 10px var(--accent-glow);
  margin-right: 0.04em;
}
.wordmark .rest {
  color: var(--text);
}
.glitch-a {
  position: relative;
  display: inline-block;
  animation: a-glitch 7s step-end infinite;
}
.glitch-a::after {
  content: attr(data-glyph);
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  color: var(--accent);
  animation: at-glitch 7s step-end infinite;
}
/* The @ is drawn inside the A, so the A hides by going transparent rather
   than by opacity, which would take the @ with it. */
@keyframes a-glitch {
  0%, 86%, 100% { color: var(--text); transform: none; text-shadow: none; }
  87% { color: var(--text); transform: translateX(2px) skewX(-12deg); text-shadow: -3px 0 var(--red), 3px 0 var(--blue); }
  88% { color: transparent; transform: none; text-shadow: none; }
  91% { color: var(--text); transform: translateX(-1px); text-shadow: 2px 0 var(--red), -2px 0 var(--blue); }
  92% { color: transparent; transform: none; text-shadow: none; }
  95% { color: var(--text); transform: none; text-shadow: none; }
}
@keyframes at-glitch {
  0%, 86%, 100% { opacity: 0; transform: none; text-shadow: none; }
  88% { opacity: 1; transform: translateX(-2px); text-shadow: 3px 0 var(--red), -3px 0 var(--blue), 0 0 10px var(--accent-glow); }
  89% { transform: translateX(1px) skewX(10deg); }
  90% { transform: none; text-shadow: 0 0 10px var(--accent-glow); }
  91% { opacity: 0; }
  92% { opacity: 1; transform: translateX(1px); text-shadow: -2px 0 var(--red), 2px 0 var(--blue); }
  95% { opacity: 0; }
}
.app-header h1:hover .wordmark .four {
  animation: four-glitch 0.45s steps(2, end) 1;
}
@keyframes four-glitch {
  0% { text-shadow: 3px 0 var(--red), -3px 0 var(--blue); transform: translateX(-1px); }
  50% { text-shadow: -2px 0 var(--red), 2px 0 var(--blue); transform: translateX(2px); }
  100% { text-shadow: 0 0 10px var(--accent-glow); transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .app-header h1:hover .wordmark .four,
  .glitch-a,
  .glitch-a::after {
    animation: none;
  }
}
/* The logo takes the place of the old ">" prompt mark. */
.app-logo {
  color: var(--accent);
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  /* One turn every 14 seconds: noticeable if you watch it, invisible if
     you are reading a verdict next to it. */
  animation: logo-spin 14s linear infinite;
}
@keyframes logo-spin {
  to {
    transform: rotate(360deg);
  }
}
/* Anyone who has asked their system for less motion gets a still mark. */
@media (prefers-reduced-motion: reduce) {
  .app-logo {
    animation: none;
  }
}

/* ===== PANELS ===== */
.panel {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
  transition: border-color var(--transition);
}
.panel:hover {
  border-color: var(--border-hover);
  box-shadow: 0 0 20px var(--accent-glow);
}
.panel h2 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.panel h2::before {
  content: "";
  width: 3px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
}

/* ===== INPUT SECTION ===== */
.input-methods {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.input-method {
  display: flex;
  flex-direction: column;
}
.input-method label {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Terminal-style textarea */
textarea {
  width: 100%;
  min-height: 180px;
  padding: 1rem;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--accent);
  font-family: "JetBrains Mono", "Roboto Mono", "Fira Code", monospace;
  font-size: 12px;
  line-height: 1.7;
  resize: vertical;
  transition: all var(--transition);
  caret-color: var(--accent);
}
textarea::placeholder {
  color: var(--text-muted);
}
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px var(--accent-glow);
}

/* File upload */
input[type="file"] {
  padding: 0.75rem;
  background: var(--bg-deep);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  width: 100%;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
}
input[type="file"]:hover {
  border-color: var(--accent);
  border-style: solid;
}
input[type="file"]::file-selector-button {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 0.75rem;
  transition: all var(--transition);
}
input[type="file"]::file-selector-button:hover {
  background: var(--border);
}
.file-hint {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 0.5rem;
}

/* Input actions */
.input-actions {
  display: flex;
  gap: 0.625rem;
  margin-bottom: 0.5rem;
}

/* ===== BUTTONS ===== */
.btn {
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: "Inter", sans-serif;
  letter-spacing: 0.01em;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast, #0d1117);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 0 15px var(--accent-glow);
}
.btn-primary:active {
  transform: scale(0.98);
}
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg-surface);
  border-color: var(--text-muted);
}
.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red-border);
}
.btn-danger:hover {
  background: rgba(255, 123, 114, 0.15);
  border-color: var(--red);
}
.btn-sm {
  padding: 0.25rem 0.625rem;
  font-size: 11px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-family: "Inter", sans-serif;
}
.btn-sm:hover {
  background: var(--bg-surface);
  color: var(--text);
  border-color: var(--text-muted);
}
.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition);
  line-height: 1;
}
.btn-close:hover {
  color: var(--text);
}

/* ===== STATUS MESSAGES ===== */
.status-message {
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  margin-top: 0.5rem;
  border: 1px solid transparent;
}
.status-message.error {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red-border);
}
.status-message.success {
  background: var(--green-bg);
  color: var(--green);
  border-color: var(--green-border);
}
.status-message.info {
  background: var(--blue-bg);
  color: var(--blue);
  border-color: var(--blue-border);
}

/* ===== SUMMARY GRID ===== */
.summary-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
/* Grid children default to min-width:auto, so one wide child widens its whole
   track past the viewport. */
.summary-top-row > *,
.summary-bottom-row > * {
  min-width: 0;
}

/* ===== VERDICT STRIP (top of summary) ===== */
.summary-verdict {
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius-lg);
  padding: 0.875rem 1.25rem;
  margin-bottom: 1rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1.5rem;
  align-items: center;
}
.summary-verdict.tier-high { background: var(--red-bg); border-color: var(--red-border); border-left-color: var(--red); }
.summary-verdict.tier-medium { background: var(--yellow-bg); border-color: var(--yellow-border); border-left-color: var(--yellow); }
.summary-verdict.tier-low { background: var(--green-bg); border-color: var(--green-border); border-left-color: var(--green); }
.summary-verdict-main {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.summary-verdict-tier {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.tier-high .summary-verdict-tier { color: var(--red); }
.tier-medium .summary-verdict-tier { color: var(--yellow); }
.tier-low .summary-verdict-tier { color: var(--green); }
.summary-verdict-score {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--text-secondary);
}
.summary-verdict-reasons {
  list-style: none;
  font-size: 12px;
  color: var(--text);
}
.summary-verdict-reasons li::before {
  content: "›";
  color: var(--text-muted);
  margin-right: 0.5rem;
}
.summary-caveat,
.verdict-caveat {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--yellow);
  margin-top: 0.375rem;
}
.verdict-caveat {
  max-width: 640px;
  margin: 0.5rem auto 0;
}
.summary-bottom-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

/* Auth card in summary */
.summary-auth-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  transition: all var(--transition);
}
.summary-auth-card:hover {
  border-color: var(--accent-border);
}
.auth-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.auth-card-header svg {
  color: var(--accent);
  opacity: 0.7;
}

/* Auth badge pills */
.auth-badges-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.auth-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full, 20px);
  font-size: 11px;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.auth-badge-pill.pass {
  background: var(--green-bg);
  color: var(--green);
  border-color: var(--green-border);
}
.auth-badge-pill.fail {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red-border);
}
.auth-badge-pill.softfail {
  background: var(--yellow-bg);
  color: var(--yellow);
  border-color: var(--yellow-border);
}
.auth-badge-pill.none {
  background: var(--blue-bg);
  color: var(--blue);
  border-color: var(--blue-border);
}
.auth-badge-pill.unknown {
  background: var(--bg-surface);
  color: var(--text-muted);
  border-color: var(--border);
}

/* IOC count card in summary */
.summary-ioc-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  transition: all var(--transition);
}
.summary-ioc-card:hover {
  border-color: var(--accent-border);
}
.ioc-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.ioc-card-header svg {
  color: var(--accent);
  opacity: 0.7;
}
/* Counters share the row evenly instead of wrapping onto a second line, which
   made this card twice the height of the Authentication card beside it. */
.ioc-count-grid {
  display: flex;
  gap: 0.5rem;
}
.ioc-count-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.25rem;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.ioc-count-item.high {
  border-color: var(--red-border);
  background: var(--red-bg);
}
.ioc-count-num {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: "JetBrains Mono", monospace;
  color: var(--text);
  line-height: 1;
}
.ioc-count-item.high .ioc-count-num {
  color: var(--red);
}
.ioc-count-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.2rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.summary-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  transition: all var(--transition);
}
.summary-card:hover {
  border-color: var(--accent-border);
}
.summary-card.risk-border-high {
  border-left: 3px solid var(--red);
}
.summary-card.risk-border-medium {
  border-left: 3px solid var(--yellow);
}
.summary-card.risk-border-low {
  border-left: 3px solid var(--green);
}
.summary-card.risk-border-neutral {
  border-left: 3px solid var(--text-muted);
}
.summary-card .card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.summary-card .card-header svg {
  color: var(--accent);
  opacity: 0.7;
}
.summary-card .card-header h3 {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0;
  gap: 0.5rem;
}
.summary-row .label {
  color: var(--text-muted);
  font-size: 12px;
}
.summary-row .value {
  font-size: 12px;
  color: var(--text);
  text-align: right;
  /* Break long unbroken tokens only when they must; break-all split ordinary
     words mid-word ("Differs from From d/omain"). */
  overflow-wrap: anywhere;
  min-width: 0;
}
.summary-row .value.mono {
  font-family: "JetBrains Mono", "Roboto Mono", monospace;
}
.summary-row .value.verified {
  color: var(--green);
}
.summary-row .value.suspicious {
  color: var(--yellow);
}
.summary-row .value.malicious {
  color: var(--red);
  font-weight: 600;
}

/* ===== VERDICT ===== */
.verdict-box {
  padding: 2rem;
  border-radius: var(--radius-lg);
  text-align: center;
  margin-bottom: 1.25rem;
  border: 1px solid transparent;
}
.verdict-box.tier-high {
  background: var(--red-bg);
  border-color: var(--red-border);
}
.verdict-box.tier-medium {
  background: var(--yellow-bg);
  border-color: var(--yellow-border);
}
.verdict-box.tier-low {
  background: var(--green-bg);
  border-color: var(--green-border);
}
.verdict-tier {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}
.tier-high .verdict-tier {
  color: var(--red);
}
.tier-medium .verdict-tier {
  color: var(--yellow);
}
.tier-low .verdict-tier {
  color: var(--green);
}
.verdict-score {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-family: "JetBrains Mono", monospace;
}
/* Score breakdown: one column per category, bar above its own reasons */
.score-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.score-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}
.score-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.score-reasons {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 12px;
  color: var(--text);
}
.score-reasons li {
  padding-left: 0.875rem;
  position: relative;
  overflow-wrap: anywhere;
}
.score-reasons li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
}
.score-reasons li.none {
  color: var(--text-muted);
}
.score-reasons li.none::before {
  display: none;
}
.score-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.score-bar {
  height: 6px;
  background: var(--bg-deep);
  border-radius: 3px;
  overflow: hidden;
}
.score-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease;
}
/* Coloured by severity: in this design green means "pass", so a full green
   risk bar read as reassurance. */
.score-fill.high { background: var(--red); }
.score-fill.medium { background: var(--yellow); }
.score-fill.low { background: var(--green); }
.score-value {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: "JetBrains Mono", monospace;
}

/* ===== AUTHENTICATION ===== */
.auth-mechanisms {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.auth-mech {
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  transition: all var(--transition);
}
.auth-mech:hover {
  border-color: var(--accent-border);
}
.auth-mech.pass {
  border-left: 3px solid var(--green);
}
.auth-mech.fail {
  border-left: 3px solid var(--red);
}
.auth-mech.softfail {
  border-left: 3px solid var(--yellow);
}
.auth-mech.none {
  border-left: 3px solid var(--blue);
}
.auth-mech .mech-name {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}
.auth-mech .mech-status {
  font-size: 1rem;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
}
.auth-mech.pass .mech-status {
  color: var(--green);
}
.auth-mech.fail .mech-status {
  color: var(--red);
}
.auth-mech.softfail .mech-status {
  color: var(--yellow);
}
.auth-mech.none .mech-status {
  color: var(--blue);
}
.auth-mech .mech-details {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 0.35rem;
  font-family: "JetBrains Mono", monospace;
  word-break: break-all;
}

/* Auth section headings */
.auth-section h3 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.auth-section h3::before {
  content: "";
  width: 3px;
  height: 12px;
  background: var(--accent);
  border-radius: 2px;
}

/* Alignment table */
.alignment-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 1.25rem;
}
.alignment-table th {
  text-align: left;
  padding: 0.625rem 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.alignment-table td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
}
.alignment-table tr:last-child td {
  border-bottom: none;
}
.alignment-table tr:hover td {
  background: var(--bg-elevated);
}
.alignment-table .verified {
  color: var(--green);
  font-weight: 600;
}
.alignment-table .malicious {
  color: var(--red);
  font-weight: 600;
}

/* Received chain */
.received-chain {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.received-hop {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  transition: all var(--transition);
}
.received-hop:hover {
  border-color: var(--accent-border);
}
.received-hop.suspicious-hop {
  border-color: var(--red-border);
  background: var(--red-bg);
}
.hop-num {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  font-family: "JetBrains Mono", monospace;
}
.hop-details {
  flex: 1;
}
.hop-from,
.hop-by,
.hop-ip,
.hop-date {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 0.15rem;
}
.hop-warning {
  margin-top: 0.25rem;
  color: var(--red);
  font-size: 11px;
  font-weight: 600;
}

/* ===== IOC SECTION ===== */
.ioc-section {
  margin-bottom: 1.5rem;
}
.ioc-section:last-child {
  margin-bottom: 0;
}
.ioc-section h3 {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ioc-section h3::before {
  content: "";
  width: 3px;
  height: 12px;
  background: var(--accent);
  border-radius: 2px;
}

/* IOC table */
.ioc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.ioc-table th {
  text-align: left;
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.06em;
  background: var(--bg-elevated);
}
.ioc-table td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.ioc-table tr:last-child td {
  border-bottom: none;
}
.ioc-table tr:hover td {
  background: var(--bg-elevated);
}
.ioc-row {
  transition: background var(--transition);
}
.ioc-row:hover {
  background: var(--bg-elevated);
}
.ioc-value-cell {
  width: 40%;
}
.ioc-risk-cell {
  width: 20%;
}

.ioc-original,
.ioc-defanged {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  word-break: break-all;
  color: var(--text);
}
.ioc-defanged.hidden {
  display: none;
}

/* Risk tags */
.risk-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.risk-tag.high {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}
.risk-tag.medium {
  background: var(--yellow-bg);
  color: var(--yellow);
  border: 1px solid var(--yellow-border);
}
.risk-tag.low {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

/* IOC actions */
.ioc-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}
.ioc-lookup-btns {
  display: flex;
  gap: 0.35rem;
}

/* Prominent IOC lookup buttons */
.btn-ioc-lookup {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.625rem;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-family: "Inter", sans-serif;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-ioc-lookup svg {
  flex-shrink: 0;
}

/* VT button — blue */
.btn-ioc-lookup.btn-vt {
  background: var(--blue-bg);
  border-color: var(--blue-border);
  color: var(--blue);
}
.btn-ioc-lookup.btn-vt:hover {
  background: rgba(88, 166, 255, 0.2);
  border-color: var(--blue);
  box-shadow: 0 0 10px rgba(88, 166, 255, 0.15);
}

/* AbuseIPDB button — purple */
.btn-ioc-lookup.btn-abuse {
  background: var(--purple-bg);
  border-color: var(--purple-border);
  color: var(--purple);
}
.btn-ioc-lookup.btn-abuse:hover {
  background: rgba(188, 140, 255, 0.2);
  border-color: var(--purple);
  box-shadow: 0 0 10px rgba(188, 140, 255, 0.15);
}

/* Disabled state */
.btn-ioc-lookup.disabled {
  opacity: 0.4;
  cursor: pointer;
}
.btn-ioc-lookup.disabled:hover {
  opacity: 0.7;
}

/* No API key saved: the button still works, it just opens the vendor's site. */
.btn-ioc-lookup.no-key {
  opacity: 0.65;
  border-style: dashed;
}
.btn-ioc-lookup.no-key:hover {
  opacity: 1;
}

/* Old button styles (kept for compatibility) */
.btn-lookup {
  padding: 0.25rem 0.625rem;
  font-size: 11px;
  background: var(--blue-bg);
  border: 1px solid var(--blue-border);
  color: var(--blue);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-family: "Inter", sans-serif;
  font-weight: 500;
}
.btn-lookup:hover {
  background: rgba(88, 166, 255, 0.15);
  border-color: var(--blue);
}
.lookup-hint {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
}

/* ===== BODY & LANGUAGE ===== */
.body-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: "Inter", sans-serif;
}
.tab-btn:hover {
  color: var(--text);
}
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-content.hidden {
  display: none;
}

.body-note {
  margin: 0 0 0.5rem;
  font-size: 12px;
  color: var(--text-muted);
}

.body-text {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
}

.html-preview {
  width: 100%;
  height: 300px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
}

/* Language analysis */
.language-panel {
  margin-top: 1.25rem;
}
.language-panel h3 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.language-panel h3::before {
  content: "";
  width: 3px;
  height: 12px;
  background: var(--accent);
  border-radius: 2px;
}
.lang-summary {
  color: var(--text-secondary);
  font-size: 12px;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent);
}
.lang-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.lang-category {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  min-width: 120px;
}
.lang-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}
.lang-cat-name {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.lang-cat-count {
  font-size: 14px;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  color: var(--accent);
}
.lang-cat-phrases {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.lang-phrase {
  font-size: 10px;
  padding: 0.15rem 0.4rem;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: "JetBrains Mono", monospace;
}

/* Language highlights in body text */
mark.lang-highlight {
  padding: 0.1rem 0.25rem;
  border-radius: 2px;
  font-weight: 500;
}
mark.lang-highlight.urgency {
  background: var(--yellow-bg);
  color: var(--yellow);
}
mark.lang-highlight.authority {
  background: var(--red-bg);
  color: var(--red);
}
mark.lang-highlight.financial {
  background: var(--blue-bg);
  color: var(--blue);
}
mark.lang-highlight.bec {
  background: var(--purple-bg);
  color: var(--purple);
}
mark.lang-highlight.credential {
  background: var(--purple-bg);
  color: var(--purple);
}

/* Language flags in verdict */
.lang-flags-section {
  margin-top: 0.75rem;
}
.lang-flags-section h4 {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.lang-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  margin: 0.15rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11px;
}
.lang-flag .flag-name {
  color: var(--text-secondary);
  text-transform: capitalize;
}
.lang-flag .flag-count {
  color: var(--accent);
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
}

/* Legacy highlight marks */
mark.highlight-urgency {
  background: var(--yellow-bg);
  color: var(--yellow);
  padding: 0.1rem 0.2rem;
  border-radius: 2px;
}
mark.highlight-authority {
  background: var(--red-bg);
  color: var(--red);
  padding: 0.1rem 0.2rem;
  border-radius: 2px;
}
mark.highlight-financial {
  background: var(--blue-bg);
  color: var(--blue);
  padding: 0.1rem 0.2rem;
  border-radius: 2px;
}
mark.highlight-bec {
  background: var(--purple-bg);
  color: var(--purple);
  padding: 0.1rem 0.2rem;
  border-radius: 2px;
}
mark.highlight-credential {
  background: var(--purple-bg);
  color: var(--purple);
  padding: 0.1rem 0.2rem;
  border-radius: 2px;
}

/* ===== HEADERS TABLE ===== */
.headers-table-wrapper {
  position: relative;
}
.headers-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.headers-table th {
  text-align: left;
  padding: 0.625rem 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.headers-table td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.headers-table tr:last-child td {
  border-bottom: none;
}
.headers-table tr:hover td {
  background: var(--bg-elevated);
}
.headers-table .header-name {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
  width: 180px;
  font-weight: 500;
}
.headers-table .header-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--text);
  word-break: break-all;
}

/* ===== LOOKUP RESULTS ===== */
.lookup-result-row {
  background: var(--bg-base);
}
.lookup-result-row.hidden {
  display: none;
}
.lookup-result-cell {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
}
.lookup-result-content {
  font-size: 12px;
}
.lookup-loading {
  color: var(--blue);
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.lookup-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.lookup-error {
  color: var(--red);
  font-weight: 500;
}
.lookup-info {
  color: var(--text-secondary);
  font-style: italic;
}
.lookup-result {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.875rem;
}
.lookup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.lookup-header strong {
  color: var(--text);
  font-size: 13px;
}
.lookup-reputation {
  font-size: 10px;
  font-weight: 700;
  padding: 0.2rem 0.625rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.lookup-reputation.lookup-malicious {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}
.lookup-reputation.lookup-suspicious {
  background: var(--yellow-bg);
  color: var(--yellow);
  border: 1px solid var(--yellow-border);
}
.lookup-reputation.lookup-clean {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}
.lookup-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.lookup-stats .stat {
  font-size: 11px;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
}
.lookup-stats .stat.malicious {
  color: var(--red);
  background: var(--red-bg);
}
.lookup-stats .stat.suspicious {
  color: var(--yellow);
  background: var(--yellow-bg);
}
.lookup-stats .stat.harmless {
  color: var(--green);
  background: var(--green-bg);
}
.lookup-stats .stat.undetected {
  color: var(--text-muted);
}
.lookup-date,
.lookup-domain,
.lookup-usage,
.lookup-rep-score,
.lookup-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.lookup-meta::before {
  content: "";
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}

/* Lookup actions row */
.lookup-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  align-items: center;
}

/* Header with actions */
.lookup-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Rescan button */
.btn-rescan {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-family: "Inter", sans-serif;
}
.btn-rescan:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}
.btn-rescan:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-rescan.rescan-queued {
  background: var(--blue-bg);
  border-color: var(--blue-border);
  color: var(--blue);
}
.btn-rescan.rescan-failed {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: var(--red);
}

/* Open in VT web link */
.btn-vt-web {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.btn-vt-web:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

/* ===== SETTINGS MODAL ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-content {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
  font-weight: 600;
}
.modal-body {
  padding: 1.5rem;
}
.settings-note {
  padding: 0.625rem 0.875rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  border-left: 3px solid var(--accent);
}
.setting-field {
  margin-bottom: 1.25rem;
}
.setting-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-secondary);
  font-size: 12px;
}
.setting-field input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  transition: all var(--transition);
}
.setting-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.setting-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}
.setting-check input {
  width: auto;
  accent-color: var(--accent);
}
.setting-field small {
  display: block;
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 11px;
}
.setting-field small a {
  color: var(--accent);
  text-decoration: none;
}
.setting-field small a:hover {
  text-decoration: underline;
}
.theme-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.setting-field .theme-row input[type="color"] {
  width: 44px;
  height: 36px;
  padding: 2px;
  cursor: pointer;
  flex-shrink: 0;
}
.theme-row code {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 5.5em;
}
.setting-actions {
  display: flex;
  gap: 0.625rem;
  justify-content: flex-end;
  padding-top: 0.5rem;
}

/* ===== UTILITIES ===== */
.hidden {
  display: none !important;
}

.mono {
  font-family: "JetBrains Mono", "Roboto Mono", monospace;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .app-container {
    padding: 0 0.75rem 2rem;
  }
  .input-methods {
    grid-template-columns: 1fr;
  }
  .score-breakdown {
    grid-template-columns: 1fr;
  }
  .auth-mechanisms {
    grid-template-columns: 1fr;
  }
  .summary-grid {
    grid-template-columns: 1fr;
  }
  .summary-top-row {
    grid-template-columns: 1fr;
  }
  .summary-bottom-row {
    grid-template-columns: 1fr;
  }
  .summary-verdict {
    grid-template-columns: 1fr;
  }
  .score-breakdown {
    grid-template-columns: 1fr;
  }
  .auth-badges-row {
    gap: 0.35rem;
  }
  .auth-badge-pill {
    font-size: 10px;
    padding: 0.25rem 0.5rem;
  }
  /* On a phone five counters cannot share one row; let them wrap. */
  .ioc-count-grid {
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  .ioc-count-item {
    flex: 1 1 56px;
    padding: 0.4rem 0.5rem;
  }
  .app-header {
    padding: 0.75rem 1rem;
  }
  .panel {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 12px;
  }
  .app-header h1 {
    font-size: 1rem;
  }
  .verdict-tier {
    font-size: 1.25rem;
  }
}

/* ===== LARGE RESULTS =====
   Long values (200+ character tracking URLs, base64 DKIM signatures) used to
   run off the side of the page: body sets overflow-x:hidden, and no table had
   a scroll container, so the overflow was clipped and unreachable. Each wide
   table now scrolls inside its own box. */
.table-scroll {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.table-scroll > table {
  min-width: 100%;
}
.ioc-table .ioc-value-cell,
.ioc-table td.mono {
  max-width: 520px;
  word-break: break-all;
  overflow-wrap: anywhere;
}
.ioc-table .ioc-actions {
  white-space: nowrap;
}

/* Header dump: collapsed by default, and capped so it cannot push the rest of
   the report off-screen once expanded. */
.headers-details > .headers-summary {
  cursor: pointer;
  padding: 0.625rem 0.75rem;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elevated);
  user-select: none;
}
.headers-details[open] > .headers-summary {
  margin-bottom: 0.75rem;
}
.headers-scroll {
  max-height: 60vh;
  overflow-y: auto;
}
.headers-table .header-value {
  max-width: 640px;
  overflow-wrap: anywhere;
}

/* "Show all N" control under a truncated IOC table. */
.ioc-more {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0;
}
.ioc-more-note {
  color: var(--text-muted);
  font-size: 11px;
}

/* Authentication panel additions */
.auth-source-note,
.align-verdict {
  font-size: 11px;
  margin: 0 0 0.625rem;
  color: var(--text-muted);
}
.align-verdict.verified {
  color: var(--green);
}
.align-verdict.malicious {
  color: #ef4444;
}
.align-note {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 400;
}
.mech-details {
  font-size: 11px;
  color: var(--text);
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.mech-source {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
  overflow-wrap: anywhere;
}
.trust-warnings {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.trust-warning {
  font-size: 11px;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b;
  padding: 0.5rem 0.625rem;
  border-radius: 4px;
}
.hop-tag {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 4px;
}
.muted {
  color: var(--text-muted);
}
.preview-note {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

/* ===== SENDER IP CARD =====
   The originating IP is the analyst's first pivot, so it gets its own
   full-width card with lookup buttons rather than a truncated line in a
   three-across grid. */
/* Background, border and header come from .summary-card, so it matches the
   cards above it instead of sitting on a lighter surface. */
.summary-ip-card {
  margin-top: 1rem;
}
.ip-primary,
.ip-secondary {
  padding: 0.5rem 0;
}
.ip-secondary {
  border-top: 1px solid var(--border-light, #1f1f1f);
  margin-top: 0.5rem;
}
.ip-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
}
.ip-hint {
  opacity: 0.7;
}
.ip-value-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.ip-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}
.ip-actions {
  display: inline-flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}
.ip-host {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 0.25rem;
  overflow-wrap: anywhere;
}
.ip-warning {
  font-size: 11px;
  color: #ef4444;
  margin-top: 0.375rem;
}
.summary-ip-card .lookup-result-content:empty {
  display: none;
}
.summary-ip-card .lookup-result-content {
  margin-top: 0.75rem;
}

/* ===== FILE HASHES ON ATTACHMENT ROWS ===== */
.ioc-hashes {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hash-line {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  font-size: 10px;
}
.hash-label {
  color: var(--text-muted);
  min-width: 52px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hash-val {
  color: var(--text);
  overflow-wrap: anywhere;
  font-size: 10px;
}
.att-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ===== API AVAILABILITY NOTICE ===== */
.api-notice {
  margin: 0.75rem 0 1.25rem;
  padding: 0.625rem 0.75rem;
  border-radius: 6px;
  border-left: 3px solid #f59e0b;
  background: rgba(245, 158, 11, 0.08);
  color: var(--text-secondary, #9ca3af);
  font-size: 11px;
  line-height: 1.5;
}
.api-notice code {
  background: var(--bg-elevated);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--accent);
  font-family: "JetBrains Mono", monospace;
}
.api-notice.ok {
  border-left-color: var(--green);
  background: var(--green-bg);
}

/* Shown in place of lookup buttons for an address no reputation service can
   answer for (private, reserved, loopback). */
.ip-note {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
  align-self: center;
}
.ip-value.muted {
  font-size: 13px;
  font-weight: 500;
  font-style: italic;
}

/* Explains that the originating IP shown is not the literal first hop, because
   that hop recorded a private address. */
.ip-internal {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 0.5rem;
  line-height: 1.5;
  padding-left: 0.625rem;
  border-left: 2px solid var(--border);
}

/* ===== SPF: both headers side by side ===== */
.spf-sources {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-top: 0.5rem;
}
.spf-src {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.375rem 0.5rem;
}
.spf-src-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 10px;
}
.spf-src-name {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.spf-src-result {
  font-weight: 700;
}
.spf-src-line {
  font-size: 11px;
  color: var(--text);
  overflow-wrap: anywhere;
}
.spf-verdict,
.spf-sender {
  font-size: 11px;
  margin-top: 0.5rem;
  overflow-wrap: anywhere;
}
.spf-verdict.ok { color: var(--green); }
.spf-verdict.bad { color: #f59e0b; font-weight: 600; }

/* ===== Alignment: spelled-out comparison ===== */
.align-compare {
  font-size: 12px;
}
.align-side {
  white-space: nowrap;
}
.align-op {
  display: inline-block;
  margin: 0 0.5rem;
  font-weight: 700;
  color: var(--accent);
}
.align-why {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}
.align-why.warn {
  color: #f59e0b;
}

/* ===== URL DECODERS ===== */
.url-decode {
  margin-top: 0.375rem;
}
.url-decode > summary {
  cursor: pointer;
  font-size: 11px;
  color: var(--text-muted);
  user-select: none;
  list-style-position: inside;
  width: fit-content;
}
.url-decode > summary:hover {
  color: var(--accent);
}
.url-decode.has-encoding > summary {
  color: #f59e0b;
}
.decode-hint {
  margin-left: 0.5rem;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}
.decode-body {
  margin-top: 0.5rem;
  padding: 0.625rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-deep, #0a0a0a);
}
.decode-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}
.decode-btn {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
}
.decode-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}
.decode-btn.applies {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--accent);
}
.decode-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast, #000);
}
.decode-result {
  margin-top: 0.625rem;
}
.decode-note {
  font-size: 11px;
  color: #f59e0b;
  margin-bottom: 0.375rem;
  overflow-wrap: anywhere;
}
.decode-output {
  margin: 0 0 0.375rem;
  padding: 0.5rem;
  background: var(--bg-elevated);
  border-radius: 4px;
  font-size: 11px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-all;
  color: var(--text);
  max-height: 240px;
  overflow-y: auto;
}
.decode-empty {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== EXPORT BAR ===== */
.export-bar {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.875rem 1.5rem;
  padding: 0.875rem 1.25rem;
  margin-bottom: 1rem;
  background: var(--bg-base);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 1px transparent, 0 0 24px var(--accent-glow);
}
.export-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--accent);
  min-width: 0;
}
.export-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.export-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}
.export-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem 1rem;
}
.export-formats {
  display: flex;
  /* Three formats no longer fit one phone row. */
  flex-wrap: wrap;
  gap: 0.5rem;
  border: 0;
  padding: 0;
  margin: 0;
}
.export-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition);
}
.export-chip small {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
}
.export-chip input {
  accent-color: var(--accent);
  margin: 0;
}
.export-chip:has(input:checked) {
  border-color: var(--accent-border);
  background: var(--accent-bg);
  color: var(--accent);
}
.export-chip:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.export-raw {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
}
.export-raw input {
  accent-color: var(--accent);
  margin: 0;
}
.export-raw.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.export-actions {
  display: flex;
  gap: 0.5rem;
}
.export-actions .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.export-status {
  flex-basis: 100%;
  font-size: 11px;
  min-height: 0;
}
.export-status:empty {
  display: none;
}
.export-status.ok {
  color: var(--accent);
}
.export-status.error {
  color: var(--red);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
@media (max-width: 768px) {
  .export-controls,
  .export-actions {
    width: 100%;
  }
  .export-actions .btn {
    flex: 1;
    justify-content: center;
  }
}
/* Phones: the main action gets its own full-width row, so no button label
   breaks over two lines. */
@media (max-width: 480px) {
  .input-actions,
  .export-actions {
    flex-wrap: wrap;
  }
  .input-actions .btn,
  .export-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
    white-space: nowrap;
    padding-inline: 0.875rem;
  }
  #analyze-btn,
  #export-download {
    flex-basis: 100%;
    order: -1;
  }
}

/* ===== HEADERS: two views ===== */
.headers-views {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}
.headers-count {
  margin-left: 0.5rem;
  font-weight: 400;
  color: var(--text-muted);
}
.headers-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.625rem;
}
.headers-toolbar .btn-sm {
  flex-shrink: 0;
  margin-left: auto;
}
.headers-note {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 720px;
}
.headers-table .header-index {
  width: 2.5rem;
  color: var(--text-muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  text-align: right;
}
.headers-ordered tr.hdr-received td:first-child {
  box-shadow: inset 3px 0 0 var(--blue);
}
.headers-ordered tr.hdr-auth td:first-child {
  box-shadow: inset 3px 0 0 var(--purple);
}
.hdr-tag {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
  color: var(--blue);
  background: var(--blue-bg);
  white-space: nowrap;
}

/* ===== MOBILE =====
   Measured at 375px with a realistic message: tables needed up to 810px of
   sideways scrolling, nearly every button was under 36px tall, and around 80
   labels rendered at 9–10px. */
@media (max-width: 768px) {
  /* --- Tables become stacked cards: no sideways scrolling on a phone --- */
  .table-scroll {
    overflow-x: visible;
  }
  .ioc-table,
  .alignment-table,
  .headers-table {
    display: block;
    width: 100%;
    min-width: 0 !important;
  }
  .ioc-table thead,
  .alignment-table thead,
  .headers-table thead {
    display: none;
  }
  .ioc-table tbody,
  .ioc-table tr,
  .ioc-table td,
  .alignment-table tbody,
  .alignment-table tr,
  .alignment-table td,
  .headers-table tbody,
  .headers-table tr,
  .headers-table td {
    display: block;
    width: 100%;
    max-width: none;
  }
  .ioc-table tr:not(.lookup-result-row),
  .alignment-table tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.5rem;
  }
  .ioc-table td,
  .alignment-table td {
    border: 0 !important;
    padding: 0.2rem 0 !important;
    background: transparent !important;
  }
  .ioc-table tr:hover td,
  .alignment-table tr:hover td,
  .headers-table tr:hover td {
    background: transparent;
  }
  .ioc-table td:empty {
    display: none;
  }
  .ioc-table .ioc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    white-space: normal;
    padding-top: 0.5rem !important;
  }
  .ioc-lookup-btns {
    display: contents;
  }
  .ioc-table tr.lookup-result-row {
    margin: -0.25rem 0 0.75rem;
  }
  .ioc-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-family: "Inter", sans-serif;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
  }
  .align-side {
    white-space: normal;
  }
  .align-op {
    margin: 0 0.35rem;
  }

  /* Headers: name above value instead of a fixed 180px name column */
  .headers-table tr {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
  }
  .headers-table td {
    border: 0 !important;
    padding: 0.1rem 0.25rem !important;
  }
  .headers-table .header-name {
    width: auto;
    white-space: normal;
  }
  .headers-table .header-index {
    display: none;
  }
  .headers-ordered tr.hdr-received,
  .headers-ordered tr.hdr-auth {
    padding-left: 0.5rem;
  }
  .headers-ordered tr.hdr-received {
    box-shadow: inset 3px 0 0 var(--blue);
  }
  .headers-ordered tr.hdr-auth {
    box-shadow: inset 3px 0 0 var(--purple);
  }
  .headers-ordered tr td:first-child {
    box-shadow: none;
  }
  .headers-scroll {
    max-height: 70vh;
  }
  .headers-toolbar {
    flex-direction: column;
  }
  .headers-toolbar .btn-sm {
    margin-left: 0;
    width: 100%;
  }
  .headers-count {
    display: block;
    margin-left: 0;
  }

  /* --- Tap targets: at least 40px tall --- */
  .btn,
  .btn-sm,
  .btn-ioc-lookup,
  .btn-rescan,
  .decode-btn,
  .tab-btn,
  .export-chip {
    min-height: 40px;
  }
  .btn-close {
    min-width: 40px;
    min-height: 40px;
  }
  .btn-sm,
  .btn-ioc-lookup,
  .decode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .url-decode > summary,
  .headers-details > .headers-summary {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
  .ip-actions {
    width: 100%;
  }
  .ip-actions > * {
    flex: 1;
  }

  /* --- Legible text: nothing below 11px --- */
  small,
  th,
  .auth-badge-pill,
  .ioc-count-label,
  .score-label,
  .spf-src-name,
  .spf-src-result,
  .mech-source,
  .align-note,
  .align-why,
  .hop-tag,
  .hdr-tag,
  .decode-hint,
  .risk-tag,
  .hash-label,
  .hash-val,
  .att-meta,
  .lang-phrase,
  .lang-flags-section h4,
  .export-chip small {
    font-size: 11px;
  }
  .ioc-table .mono,
  .header-value.mono,
  .decode-output {
    font-size: 12px;
  }

  /* --- Density --- */
  .verdict-box {
    padding: 1.25rem 1rem;
  }
  .modal-content {
    width: calc(100% - 1.5rem);
    max-height: calc(100vh - 1.5rem);
  }
  .received-hop {
    padding: 0.625rem;
  }
}

@media (max-width: 480px) {
  /* Icon-only header buttons (Settings, Back) so the title stays on one line */
  .app-header .btn .btn-label {
    display: none;
  }
  .app-header .btn {
    min-width: 40px;
    justify-content: center;
    padding-left: 0.625rem;
    padding-right: 0.625rem;
  }
  .app-header h1 {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .trust-banner {
    font-size: 11px;
    align-items: flex-start;
  }
}

/* The URL cell breaks anywhere so long URLs fit; the decoder summary and its
   hint are ordinary words and must not inherit that ("redirec / t"). */
.url-decode > summary,
.decode-hint,
.decode-btn,
.decode-note,
.ioc-hashes .att-meta {
  word-break: normal;
  overflow-wrap: break-word;
}
@media (max-width: 768px) {
  .decode-hint {
    display: table;
    margin: 0.35rem 0 0;
  }
}

/* ===== SUMMARY: LANGUAGE CARD ===== */
.summary-lang-card {
  margin-top: 1rem;
}
.summary-lang-card .card-header .lang-total {
  margin-left: auto;
  font-size: 11px;
  font-family: "JetBrains Mono", monospace;
  color: var(--text-muted);
}
.lang-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}
.lang-group {
  min-width: 0;
}
.lang-group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.lang-group-name {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
.lang-group-count {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 0 7px;
  border-radius: var(--radius-full);
  border: 1px solid;
  white-space: nowrap;
  flex-shrink: 0;
}
.lang-group-count.bad { color: var(--red); background: var(--red-bg); border-color: var(--red-border); }
.lang-group-count.warn { color: var(--yellow); background: var(--yellow-bg); border-color: var(--yellow-border); }
.lang-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.lang-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 12px;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
  overflow-wrap: anywhere;
}
.lang-chip b {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  opacity: 0.8;
}
.lang-chip.bad { color: var(--red); background: var(--red-bg); border-color: var(--red-border); }
.lang-chip.warn { color: var(--yellow); background: var(--yellow-bg); border-color: var(--yellow-border); }
.lang-empty {
  font-size: 12px;
  color: var(--text-muted);
}
.lang-empty.verified {
  color: var(--green);
}
@media (max-width: 768px) {
  .lang-chip b {
    font-size: 11px;
  }
}

/* ===== SENDER IP + LANGUAGE ROW ===== */
.summary-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
  align-items: stretch;
}
.summary-split > * {
  min-width: 0;
}
.summary-split > .summary-ip-card,
.summary-split > .summary-lang-card {
  margin-top: 0;
}
/* Half width: categories stack two-up instead of four across. */
.summary-split .lang-groups {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
@media (max-width: 768px) {
  .summary-split {
    grid-template-columns: 1fr;
  }
}


/* ===== SENDER IDENTITY (display-name and lookalike findings) ===== */
.identity-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-base);
  padding: 0.875rem 1rem;
  margin-bottom: 1rem;
}
.identity-card .card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.625rem;
}
.identity-card h3 {
  font-size: 13px;
  margin: 0;
}
.identity-count {
  margin-left: auto;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 0 7px;
  border-radius: var(--radius-full);
  border: 1px solid;
}
.identity-count.high { color: var(--red); background: var(--red-bg); border-color: var(--red-border); }
.identity-count.medium { color: var(--yellow); background: var(--yellow-bg); border-color: var(--yellow-border); }
.identity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.identity-item {
  display: grid;
  gap: 0.15rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--border);
}
.identity-item.high { border-left-color: var(--red); }
.identity-item.medium { border-left-color: var(--yellow); }
.identity-title {
  font-weight: 600;
  font-size: 13px;
}
.identity-detail {
  font-size: 12px;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

/* ===== WHOIS / registration panels ===== */
.whois-panel {
  margin-top: 0.5rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-deep);
}
.whois-panel > summary {
  cursor: pointer;
  padding: 0.35rem 0.625rem;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  word-break: normal;
  min-height: 28px;
  display: flex;
  align-items: center;
}
.whois-panel[open] > summary {
  border-bottom: 1px solid var(--border-light);
  color: var(--accent);
}
.whois-body {
  padding: 0.625rem;
  font-size: 12px;
}
.whois-loading {
  color: var(--text-muted);
  font-size: 12px;
}
.whois-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 0.75rem;
  margin: 0;
}
.whois-grid dt {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.whois-grid dd {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.whois-age {
  display: inline-block;
  margin-bottom: 0.5rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid;
  font-size: 11px;
  font-weight: 700;
}
.whois-age.bad { color: var(--red); background: var(--red-bg); border-color: var(--red-border); }
.whois-age.warn { color: var(--yellow); background: var(--yellow-bg); border-color: var(--yellow-border); }
.whois-age.ok { color: var(--green); background: var(--green-bg); border-color: var(--green-border); }
.whois-note {
  font-size: 12px;
  color: var(--text-secondary);
}
.whois-note.bad {
  color: var(--red);
}
.whois-note code {
  font-family: "JetBrains Mono", monospace;
  background: var(--bg-elevated);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ===== LIVE DNS ===== */
.dim-note {
  font-weight: 400;
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 0.5rem;
}
.dns-body {
  margin-top: 0.625rem;
  display: grid;
  gap: 0.35rem;
}
.dns-verdicts {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}
.dns-verdict {
  font-size: 12px;
  padding: 0.4rem 0.625rem;
  border-radius: var(--radius-md);
  border: 1px solid;
}
.dns-verdict.ok { color: var(--green); background: var(--green-bg); border-color: var(--green-border); }
.dns-verdict.warn { color: var(--yellow); background: var(--yellow-bg); border-color: var(--yellow-border); }
.dns-verdict.bad { color: var(--red); background: var(--red-bg); border-color: var(--red-border); }
.dns-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0.5rem;
  font-size: 12px;
}
.dns-label {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dns-value {
  overflow-wrap: anywhere;
}
.dns-note {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== ARC and header anomalies ===== */
.arc-box {
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius-md);
  padding: 0.625rem 0.75rem;
  font-size: 12px;
  display: grid;
  gap: 0.35rem;
}
.arc-box.bad {
  border-left-color: var(--red);
}
.arc-note {
  color: var(--text-muted);
  font-size: 11px;
}
.anomaly-list {
  display: grid;
  gap: 0.35rem;
}
.anomaly {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 12px;
  color: var(--text-secondary);
}
.anomaly-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 0.3rem;
  flex-shrink: 0;
  background: var(--text-muted);
}
.anomaly.medium .anomaly-dot { background: var(--yellow); }
.anomaly.high .anomaly-dot { background: var(--red); }

@media (max-width: 768px) {
  .whois-grid,
  .dns-row {
    grid-template-columns: 1fr;
  }
  .whois-panel > summary {
    min-height: 40px;
  }
}


/* ===== BATCH RESULTS ===== */
.batch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.batch-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.4rem 0.625rem;
  border-bottom: 1px solid var(--border);
}
.batch-table td {
  padding: 0.5rem 0.625rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  overflow-wrap: anywhere;
}
/* The action column was left to fight the long columns for space, and "Open"
   ended up one letter per line. It takes exactly the width it needs; the
   subject gives way instead. */
.batch-table td:last-child,
.batch-table th:last-child {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}
.batch-table td:last-child .btn-sm {
  white-space: nowrap;
}
.batch-table td:nth-child(4) {
  min-width: 12rem;
}
.batch-tier {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.batch-tier.high { color: var(--red); background: var(--red-bg); border-color: var(--red-border); }
.batch-tier.medium { color: var(--yellow); background: var(--yellow-bg); border-color: var(--yellow-border); }
.batch-tier.low { color: var(--green); background: var(--green-bg); border-color: var(--green-border); }
.batch-error { color: var(--red); font-size: 12px; }
.batch-note,
.batch-progress {
  margin-top: 0.625rem;
  font-size: 12px;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .batch-table,
  .batch-table tbody,
  .batch-table tr,
  .batch-table td {
    display: block;
    width: 100%;
  }
  .batch-table thead { display: none; }
  .batch-table tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
  }
  .batch-table td {
    border: 0;
    padding: 0.2rem 0;
  }
  .batch-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
  }
}


/* A lookup with no API key is a real link, not a button calling window.open —
   browsers block that, and the click silently did nothing. */
a.btn-ioc-lookup {
  text-decoration: none;
}
a.btn-ioc-lookup:hover {
  text-decoration: none;
}


/* Link out to the comparison page. */
.btn-compare {
  text-decoration: none;
}
.panel-link {
  margin-left: 0.625rem;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}
.panel-link:hover {
  text-decoration: underline;
}


/* The other addresses a hop recorded, beside the one used as the sender. */
.hop-also {
  color: var(--text-muted);
  font-size: 11px;
  margin-left: 0.35rem;
}


/* ===== HTML PREVIEW ===== */
.preview-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.preview-bar .preview-note {
  margin: 0;
}
.preview-stats {
  display: block;
  margin-top: 0.2rem;
  color: var(--text-secondary);
}
.preview-heading,
.preview-empty {
  font-size: 12px;
  color: var(--yellow);
  margin: 0 0 0.5rem;
}
.preview-empty {
  color: var(--text-muted);
}
.preview-forward {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 12px;
  color: var(--text);
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.625rem;
  border: 1px solid var(--accent-border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--accent-bg);
}
/* The frame can be dragged taller, or expanded to most of the screen. */
.preview-frame-wrap {
  resize: vertical;
  overflow: hidden;
  height: 520px;
  min-height: 200px;
  max-height: 90vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
}
.preview-frame-wrap.expanded {
  height: 85vh;
}
.preview-frame-wrap .html-preview {
  height: 100%;
  border: 0;
  border-radius: 0;
  display: block;
}

/* ===== HTML ATTACHMENT FINDINGS ===== */
.att-findings {
  margin-top: 0.5rem;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-deep);
  font-size: 12px;
  /* The value cell breaks anywhere so hashes fit; sentences should not. */
  word-break: normal;
  line-height: 1.5;
}
.att-findings-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.att-findings ul {
  margin: 0;
  padding-left: 1.1rem;
}
.att-findings li {
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
.att-findings li.bad { color: var(--red); }
.att-findings li.warn { color: var(--yellow); }
.att-preview {
  margin-top: 0.5rem;
}
.att-preview > summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--accent);
  min-height: 28px;
  display: flex;
  align-items: center;
  word-break: normal;
}
.att-preview .html-preview {
  height: 420px;
  margin-top: 0.4rem;
}
.att-open {
  margin-top: 0.5rem;
}
@media (max-width: 768px) {
  .preview-frame-wrap {
    height: 420px;
  }
  .att-preview > summary {
    min-height: 40px;
  }
}


/* ===== LANGUAGE: tiers and new categories ===== */
.lang-group-count small,
.flag-count small,
.lang-cat-count small {
  font-weight: 500;
  opacity: 0.75;
}
.lang-group-count.muted {
  color: var(--text-muted);
  border-color: var(--border);
}
.lang-chip.muted {
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border-color: var(--border);
}
.lang-broad {
  margin-top: 0.35rem;
}
.lang-broad > summary {
  cursor: pointer;
  font-size: 11px;
  color: var(--text-muted);
  min-height: 24px;
  display: flex;
  align-items: center;
}
.lang-broad[open] > summary {
  margin-bottom: 0.35rem;
}
.lang-phrase.broad {
  opacity: 0.7;
}
/* Highlight colours for every category; broad words are underlined, not filled. */
.highlight-urgency,
.highlight-authority,
.highlight-lure,
.highlight-social {
  background: var(--yellow-bg);
  color: var(--yellow);
  border-radius: 2px;
}
.highlight-financial,
.highlight-credential,
.highlight-advancefee,
.highlight-extortion {
  background: var(--red-bg);
  color: var(--red);
  border-radius: 2px;
}
.highlight-bec {
  background: var(--purple-bg);
  color: var(--purple);
  border-radius: 2px;
}
mark.broad {
  background: transparent;
  color: inherit;
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
mark.highlight-urgency.broad, mark.highlight-authority.broad, mark.highlight-lure.broad, mark.highlight-social.broad { text-decoration-color: var(--yellow); }
mark.highlight-financial.broad, mark.highlight-credential.broad, mark.highlight-advancefee.broad, mark.highlight-extortion.broad { text-decoration-color: var(--red); }
mark.highlight-bec.broad { text-decoration-color: var(--purple); }
@media (max-width: 768px) {
  .lang-broad > summary {
    min-height: 40px;
  }
}


/* ===== QUOTED THREAD ===== */
.tab-btn.tab-alert {
  color: var(--red);
}
.tab-btn.tab-alert::after {
  content: " ⚠";
}
.thread-note,
.thread-empty,
.thread-status,
.thread-clean {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 0.625rem;
}
.thread-clean,
.thread-ok {
  color: var(--green);
}
.thread-bad {
  color: var(--red);
}
.thread-findings {
  margin-bottom: 0.75rem;
}
.thread-table td {
  vertical-align: top;
  overflow-wrap: anywhere;
}
.thread-table td div {
  font-size: 11px;
  margin-top: 0.15rem;
}


/* ===== SAVING FILES / DECODE TO FILE ===== */
.btn-save {
  border-color: var(--accent-border);
  color: var(--accent);
}
.decode-file {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-deep);
}
.decode-file > summary {
  cursor: pointer;
  padding: 0.6rem 0.875rem;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  min-height: 40px;
  display: flex;
  align-items: center;
}
.decode-file[open] > summary {
  border-bottom: 1px solid var(--border);
  color: var(--accent);
}
.decode-file-body {
  padding: 0.875rem;
  display: grid;
  gap: 0.625rem;
}
.decode-file-body > label {
  font-size: 12px;
  color: var(--text-secondary);
}
.decode-file-body code {
  font-family: "JetBrains Mono", monospace;
  background: var(--bg-elevated);
  padding: 0 4px;
  border-radius: 3px;
}
#decode-input {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  box-sizing: border-box;
  background: var(--bg-base);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.625rem;
  font: 12px/1.5 "JetBrains Mono", monospace;
}
#decode-input:focus {
  outline: none;
  border-color: var(--accent);
}
.decode-file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}
.decode-file-row label {
  display: grid;
  gap: 0.25rem;
  font-size: 12px;
  color: var(--text-secondary);
}
.decode-file-row select,
.decode-file-row input {
  background: var(--bg-base);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.6rem;
  font-size: 12px;
  min-height: 36px;
}
.decode-file-result {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  background: var(--bg-base);
}
.decode-file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.decode-file-actions a {
  text-decoration: none;
}
.decode-file-note {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
}
.decode-file-error {
  color: var(--red);
  font-size: 12px;
  margin: 0;
}
@media (max-width: 768px) {
  .decode-file-row > * {
    flex: 1 1 100%;
  }
  .decode-file-row select,
  .decode-file-row input {
    min-height: 40px;
  }
}


/* ===== OWN DOMAINS ===== */
#own-domains {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-deep);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  font: 12px/1.5 "JetBrains Mono", monospace;
  resize: vertical;
  min-height: 0; /* the email box's 180px minimum is for whole messages */
}
#own-domains:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.optional {
  font-weight: 400;
  color: var(--text-muted);
}


/* ===== ATTACK TYPE ===== */
.summary-attack {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
}
.summary-attack-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-right: 0.15rem;
}
.attack-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 0.1rem 0.55rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--red-border);
  background: var(--red-bg);
  color: var(--red);
}

/* ===== DRAG AND DROP ===== */
#input-section.dropping {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-border), 0 0 24px var(--accent-glow);
}
