/* ───────────────────────────────────────────────────────────────────────
   Email Verifier — shared design system
   ───────────────────────────────────────────────────────────────────────
   Color system is deliberate, not decorative: FOUR hues map to FOUR kinds
   of evidence, not just "good/bad":
     emerald  → confirmed real (the server told us so)
     brick    → confirmed fake (the server told us so)
     amber    → ambiguous/needs review (catch-all, risky, unknown)
     indigo   → WE DON'T KNOW (blocked / rate-limited / temporary) —
                deliberately neither red nor green, because that's the
                whole point of the fix this build ships: a server that
                blocked our probe never told us anything about the
                recipient, and must never render as a failure.
   ─────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* Palette */
  --paper: #F6F4EE;
  --surface: #FFFFFF;
  --surface-sunk: #FBFAF6;
  --ink: #1A1D19;
  --ink-soft: #5B5F57;
  --ink-faint: #8A8D84;
  --line: #E5E1D5;
  --line-strong: #D3CDB9;

  --verified: #15784F;
  --verified-ink: #0E5A3B;
  --verified-soft: #E3F1E7;
  --verified-line: #BFDDC9;

  --risk: #AC3424;
  --risk-ink: #82261A;
  --risk-soft: #F7E5E0;
  --risk-line: #E2BEB3;

  --caution: #A8721A;
  --caution-ink: #7E5611;
  --caution-soft: #FAEFDA;
  --caution-line: #E6CC9E;

  --unverified: #4744A8;
  --unverified-ink: #34317F;
  --unverified-soft: #EAE9F8;
  --unverified-line: #C7C4EA;

  --accent: #15784F;
  --accent-ink: #0E5A3B;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 2px rgba(26,29,25,0.04), 0 8px 24px -12px rgba(26,29,25,0.10);
  --shadow-pop: 0 12px 32px -8px rgba(26,29,25,0.22);

  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Layout shell ─────────────────────────────────────────────────────── */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: #21231D;
  color: #DEDDD3;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 22px;
}

.brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(155deg, var(--verified) 0%, #0E5A3B 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: #EFFBF3;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: #F4F3EC;
  line-height: 1.15;
}
.brand-sub { font-size: 11px; color: #8C8F83; margin-top: 1px; }

.nav-section-label {
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #6F726A;
  padding: 14px 10px 6px;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: #C7C6BB;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-link:hover { background: #2B2D25; color: #F4F3EC; }
.nav-link.active { background: #2F4A3C; color: #BFEBD2; }
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.9; }

.sidebar-foot {
  margin-top: auto;
  padding: 12px 10px;
  font-size: 11px;
  color: #6F726A;
  border-top: 1px solid #2D2F27;
  line-height: 1.5;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar h1 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}
.topbar .sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }

.content { padding: 26px 28px 60px; max-width: 1180px; }

/* ── Buttons ──────────────────────────────────────────────────────────── */

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: transform 0.06s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #FFFFFF; }
.btn-primary:hover:not(:disabled) { background: var(--accent-ink); }

.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-sunk); }

.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-sunk); color: var(--ink); }

.btn-danger-outline { background: var(--surface); color: var(--risk-ink); border-color: var(--risk-line); }
.btn-danger-outline:hover:not(:disabled) { background: var(--risk-soft); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }

/* ── Cards ────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

/* ── Status badges / pills ───────────────────────────────────────────── */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.status-Valid, .status-LikelyValid {
  background: var(--verified-soft); color: var(--verified-ink); border-color: var(--verified-line);
}
.status-Valid .dot, .status-LikelyValid .dot { background: var(--verified); }

.status-Invalid { background: var(--risk-soft); color: var(--risk-ink); border-color: var(--risk-line); }
.status-Invalid .dot { background: var(--risk); }

.status-CatchAll, .status-Risky {
  background: var(--caution-soft); color: var(--caution-ink); border-color: var(--caution-line);
}
.status-CatchAll .dot, .status-Risky .dot { background: var(--caution); }

.status-BlockedUnverified, .status-TemporaryIssue, .status-Unknown {
  background: var(--unverified-soft); color: var(--unverified-ink); border-color: var(--unverified-line);
}
.status-BlockedUnverified .dot, .status-TemporaryIssue .dot, .status-Unknown .dot { background: var(--unverified); }

.tag {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

/* ── Filter chips ─────────────────────────────────────────────────────── */

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.12s ease;
}
.chip:hover { border-color: var(--ink-faint); color: var(--ink); }
.chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .count { font-family: var(--font-mono); font-size: 11px; opacity: 0.75; }

/* ── Table ────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }
table.results-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.results-table th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.results-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.results-table tbody tr { cursor: pointer; transition: background 0.1s ease; }
table.results-table tbody tr:hover { background: var(--surface-sunk); }
table.results-table tbody tr.expanded { background: var(--surface-sunk); }

.email-cell { font-family: var(--font-mono); font-size: 12.5px; }
.score-cell { font-family: var(--font-mono); font-weight: 600; }

.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  font-family: var(--font-display);
}

/* ── Detail drawer (expanded row content) ────────────────────────────── */

.detail-row td { padding: 0; border-bottom: 1px solid var(--line); }
.detail-panel {
  padding: 18px 20px 22px 64px;
  background: var(--surface-sunk);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.detail-block { font-size: 12.5px; }
.detail-block h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-faint); margin: 0 0 8px; font-weight: 600;
}
.detail-block .kv { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; color: var(--ink-soft); }
.detail-block .kv b { color: var(--ink); font-weight: 600; }
.detail-block .warn-line { color: var(--caution-ink); font-size: 12px; margin-top: 4px; }
.detail-block .reason-list { margin: 0; padding-left: 16px; color: var(--ink-soft); }
.detail-block .reason-list li { margin-bottom: 3px; }
.raw-smtp {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: #1A1D19;
  color: #C7E9D4;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Gauges / trust score ring ───────────────────────────────────────── */

.ring { display: inline-flex; align-items: center; gap: 8px; }
.ring svg { transform: rotate(-90deg); }

/* ── Upload / dropzone ────────────────────────────────────────────────── */

.dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone.dragover { border-color: var(--accent); background: var(--verified-soft); }
.dropzone .icon { width: 44px; height: 44px; margin: 0 auto 14px; color: var(--accent); }
.dropzone h3 { font-family: var(--font-display); font-size: 16px; margin: 0 0 6px; }
.dropzone p { font-size: 13px; color: var(--ink-soft); margin: 0; }
.dropzone .filename {
  margin-top: 14px; font-family: var(--font-mono); font-size: 12.5px;
  background: var(--surface-sunk); padding: 6px 12px; border-radius: 999px; display: inline-flex; gap: 8px; align-items:center;
}

/* ── Limit slider ─────────────────────────────────────────────────────── */

.limit-control { display: flex; flex-direction: column; gap: 10px; }
.limit-control input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--fill, 50%), var(--line) var(--fill, 50%), var(--line) 100%);
  border-radius: 999px;
  outline: none;
}
.limit-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--accent);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.limit-control input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--accent); cursor: pointer;
}
.limit-readout { font-family: var(--font-display); font-weight: 700; font-size: 26px; }
.limit-presets { display: flex; gap: 8px; }

/* ── Live verification trace (signature element) ─────────────────────── */

.trace-panel {
  background: #161812;
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  height: 220px;
  overflow-y: auto;
  color: #B9BBAF;
}
.trace-line { display: flex; gap: 8px; opacity: 0; animation: trace-in 0.25s ease forwards; }
.trace-line .glyph { flex-shrink: 0; width: 14px; text-align: center; }
@keyframes trace-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: translateY(0); } }

.trace-line.t-valid .glyph, .trace-line.t-valid { color: #79D9A5; }
.trace-line.t-invalid .glyph, .trace-line.t-invalid { color: #E4897B; }
.trace-line.t-caution .glyph, .trace-line.t-caution { color: #E0BD78; }
.trace-line.t-unverified .glyph, .trace-line.t-unverified { color: #ABA8EC; }
.trace-line.t-info { color: #82857A; }

/* ── Progress ring ────────────────────────────────────────────────────── */

.progress-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.stat-card .num { font-family: var(--font-display); font-size: 24px; font-weight: 700; }
.stat-card .label { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }

.progress-bar-track {
  height: 8px; border-radius: 999px; background: var(--line); overflow: hidden;
}
.progress-bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), #2A9E6E);
  border-radius: 999px; transition: width 0.3s ease;
}

/* ── Toggle switch (settings) ─────────────────────────────────────────── */

.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: var(--line-strong); border-radius: 999px;
  transition: background 0.15s ease; cursor: pointer;
}
.switch .track::before {
  content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::before { transform: translateX(18px); }

/* ── Form fields ──────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.field .hint { font-size: 11.5px; color: var(--ink-faint); }
.field input[type="text"], .field input[type="number"], .field input[type="email"] {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}
.field input:focus { border-color: var(--accent); }

.settings-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.settings-row:last-child { border-bottom: none; }
.settings-row .meta { flex: 1; }
.settings-row .meta h4 { margin: 0 0 3px; font-size: 13.5px; font-weight: 600; }
.settings-row .meta p { margin: 0; font-size: 12px; color: var(--ink-soft); }

/* ── Misc ─────────────────────────────────────────────────────────────── */

.empty-state { text-align: center; padding: 60px 20px; color: var(--ink-soft); }
.empty-state .icon { width: 40px; height: 40px; margin: 0 auto 14px; opacity: 0.5; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-sunk) 25%, var(--line) 37%, var(--surface-sunk) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .content { padding: 18px 16px 48px; }
  .topbar { padding: 14px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .trace-line { animation: none; opacity: 1; }
  .skeleton { animation: none; }
}
