:root {
  --ink: #171915;
  --ink-soft: #5d6259;
  --paper: #f4f4ef;
  --surface: #ffffff;
  --line: #dcded5;
  --signal: #ff5c35;
  --signal-dark: #b72f12;
  --moss: #234f3d;
  --mint: #dcebe1;
  --amber: #f6e9c8;
  --shadow: 0 22px 60px rgba(32, 39, 29, 0.08);
  font-family: "Fira Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }

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

.topbar {
  min-height: 72px;
  padding: 0 clamp(20px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; font-weight: 700; letter-spacing: -0.02em; }
.brand-mark { width: 27px; height: 27px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; align-items: end; }
.brand-mark i { display: block; background: var(--ink); border-radius: 6px 6px 2px 2px; }
.brand-mark i:nth-child(1) { height: 55%; }
.brand-mark i:nth-child(2) { height: 100%; background: var(--signal); }
.brand-mark i:nth-child(3) { height: 75%; }
.topbar-meta { display: flex; align-items: center; gap: 9px; color: var(--ink-soft); font-size: 14px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #c3a83d; box-shadow: 0 0 0 4px rgba(195, 168, 61, 0.12); }
.live-dot.ready { background: #2d865b; box-shadow: 0 0 0 4px rgba(45, 134, 91, 0.12); }
.live-dot.error { background: var(--signal); box-shadow: 0 0 0 4px rgba(255, 92, 53, 0.12); }

main { width: min(1480px, 100%); margin: 0 auto; }
.hero { padding: clamp(48px, 7vw, 100px) clamp(20px, 5vw, 72px) clamp(56px, 7vw, 96px); display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(440px, 1.1fr); gap: clamp(40px, 7vw, 120px); align-items: end; }
.eyebrow { margin: 0 0 13px; font: 600 12px/1.2 "Fira Code", monospace; letter-spacing: 0.12em; text-transform: uppercase; color: var(--signal-dark); }
h1, h2, h3, p { text-wrap: pretty; }
h1 { margin: 0; max-width: 760px; font-size: clamp(42px, 5.5vw, 82px); line-height: 0.98; letter-spacing: -0.055em; font-weight: 600; }
h1 span { color: var(--ink-soft); }
.hero-copy { max-width: 630px; margin: 28px 0 0; color: var(--ink-soft); font-size: clamp(17px, 1.3vw, 20px); line-height: 1.55; }

.search-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: clamp(22px, 3vw, 36px); box-shadow: var(--shadow); }
.search-panel > label { display: block; margin-bottom: 12px; font-size: 15px; font-weight: 600; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
input[type="search"] { width: 100%; min-height: 52px; border: 1px solid #c9ccc2; border-radius: 12px; padding: 0 16px; background: #fbfbf8; color: var(--ink); outline: none; transition: border-color 180ms ease, box-shadow 180ms ease; }
input[type="search"]:focus { border-color: var(--ink); box-shadow: 0 0 0 4px rgba(23, 25, 21, 0.08); }
input::placeholder { color: #8b9086; }
.primary-button, .secondary-button { min-height: 48px; border-radius: 12px; padding: 0 20px; border: 1px solid transparent; font-weight: 600; transition: transform 180ms ease, background 180ms ease, border-color 180ms ease; }
.primary-button { min-height: 52px; background: var(--signal); color: #24120d; }
.primary-button:hover { background: #ff704e; transform: translateY(-1px); }
.primary-button:disabled { cursor: wait; opacity: 0.65; transform: none; }
.secondary-button { background: transparent; border-color: var(--line); color: var(--ink); }
.secondary-button:hover { border-color: var(--ink); background: var(--surface); }
.search-options { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; margin-top: 16px; }
.segmented { margin: 0; padding: 3px; border: 1px solid var(--line); border-radius: 10px; display: inline-flex; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { min-height: 36px; padding: 0 12px; border-radius: 7px; display: inline-flex; align-items: center; color: var(--ink-soft); font-size: 14px; }
.segmented input:checked + span { background: var(--ink); color: #fff; }
.segmented input:focus-visible + span { outline: 3px solid rgba(255, 92, 53, 0.4); outline-offset: 2px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 7px; }
.suggestions button { min-height: 36px; border: 0; border-radius: 999px; background: var(--paper); padding: 0 12px; color: var(--ink-soft); font-size: 13px; }
.suggestions button:hover { background: var(--mint); color: var(--moss); }
.form-note { margin: 16px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.5; }

.workspace { background: #e9ebe4; border-top: 1px solid var(--line); padding: clamp(44px, 6vw, 76px) clamp(20px, 5vw, 72px) 100px; min-height: 55vh; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; }
h2 { margin: 0; font-size: clamp(32px, 4vw, 52px); line-height: 1; letter-spacing: -0.04em; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 30px; }
.stats-grid article { min-height: 110px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,0.68); display: flex; flex-direction: column; justify-content: space-between; }
.stats-grid span { color: var(--ink-soft); font-size: 13px; }
.stats-grid strong { font: 600 clamp(26px, 3vw, 38px)/1 "Fira Code", monospace; }
.filters { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 22px 0 16px; }
.filters label { color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.filters select { min-height: 42px; border: 1px solid var(--line); border-radius: 9px; padding: 0 32px 0 11px; background: var(--surface); color: var(--ink); }
.result-count { margin-left: auto; color: var(--ink-soft); font: 500 12px/1.4 "Fira Code", monospace; }
.notice { margin-bottom: 14px; padding: 13px 16px; border-radius: 11px; background: var(--amber); color: #5a4515; font-size: 14px; }
.notice.error { background: #f7dcd5; color: #7a2816; }

.lead-list { display: grid; gap: 10px; }
.lead-card { display: grid; grid-template-columns: 88px minmax(0, 1fr) 180px; gap: 20px; align-items: start; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); transition: border-color 180ms ease, transform 180ms ease; }
.lead-card:hover { border-color: #b7baaf; transform: translateY(-1px); }
.score { width: 74px; height: 74px; border-radius: 50%; background: var(--mint); display: grid; place-content: center; text-align: center; }
.score.medium { background: var(--amber); }
.score.low { background: #ecece7; }
.score strong { font: 600 25px/1 "Fira Code", monospace; }
.score span { margin-top: 3px; color: var(--ink-soft); font: 500 10px/1 "Fira Code", monospace; }
.lead-meta { min-height: 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 7px 10px; font-size: 13px; }
.author { font-weight: 700; text-decoration: none; }
.author:hover { text-decoration: underline; }
.intent { padding: 4px 7px; border-radius: 5px; background: var(--paper); color: var(--ink-soft); font: 500 11px/1.2 "Fira Code", monospace; }
.lead-meta time { color: var(--ink-soft); }
.lead-text { margin: 13px 0; font-size: 17px; line-height: 1.5; white-space: pre-line; }
.reasons { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.reasons li { padding: 5px 8px; border-radius: 6px; background: #f4f4ef; color: var(--ink-soft); font-size: 12px; }
.lead-actions { display: grid; gap: 7px; }
.lead-actions a, .lead-actions button { min-height: 40px; border-radius: 9px; border: 1px solid var(--line); padding: 0 11px; background: transparent; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: none; transition: background 160ms ease, border-color 160ms ease; }
.lead-actions a { background: var(--ink); color: #fff; border-color: var(--ink); }
.lead-actions a:hover { background: var(--moss); }
.lead-actions button:hover { border-color: var(--ink); background: var(--paper); }
.lead-actions .dismiss { color: #862f1b; }
.lead-card.is-saved { border-left: 4px solid #2d865b; }
.lead-card.is-contacted { opacity: 0.72; }

.empty-state { max-width: 560px; margin: 70px auto 0; text-align: center; }
.empty-state[hidden] { display: none; }
.empty-state h3 { margin: 24px 0 8px; font-size: 21px; }
.empty-state p { margin: 0; color: var(--ink-soft); line-height: 1.55; }
.empty-visual { width: 132px; height: 84px; margin: 0 auto; display: flex; align-items: end; justify-content: center; gap: 10px; border-bottom: 1px solid #bfc2b8; }
.empty-visual span { width: 24px; background: #cdd0c6; border-radius: 8px 8px 2px 2px; }
.empty-visual span:nth-child(1) { height: 32px; }
.empty-visual span:nth-child(2) { height: 66px; background: var(--signal); }
.empty-visual span:nth-child(3) { height: 48px; }

:focus-visible { outline: 3px solid rgba(255, 92, 53, 0.55); outline-offset: 3px; }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; align-items: start; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .lead-card { grid-template-columns: 76px 1fr; }
  .lead-actions { grid-column: 2; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .topbar { min-height: 62px; }
  .topbar-meta { font-size: 0; }
  .hero { padding-top: 42px; }
  .search-row { grid-template-columns: 1fr; }
  .primary-button { width: 100%; }
  .search-options { align-items: flex-start; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid article { min-height: 96px; padding: 15px; }
  .section-heading { align-items: start; }
  .secondary-button { min-width: 48px; padding: 0 13px; }
  .result-count { width: 100%; margin-left: 0; }
  .lead-card { grid-template-columns: 1fr; padding: 18px; }
  .score { width: 64px; height: 64px; }
  .lead-actions { grid-column: 1; grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
