/* Deal Flow. One sidebar for navigation, search everything with ⌘K, quiet surfaces and
   colour only where it carries meaning: triage status, scores and verification. */
:root {
  /* Swiss-style data dashboard: slate neutrals, navy for actions, amber only where a
     decision is yours, green for verified. Secondary text keeps 4.5:1 contrast. */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --hover: #f1f5f9;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #526075;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --line-2: #eef2f7;
  --accent: #1e40af;
  --accent-hover: #1e3a8a;
  --accent-ink: #ffffff;
  --accent-soft: #eef2ff;
  --accent-line: #c7d2fe;
  --ok: #15803d;
  --ok-soft: #e8f6ee;
  --warn: #92400e;
  --warn-soft: #fef3c7;
  --warn-line: #f5d27a;
  --bad: #b91c1c;
  --bad-soft: #fdecec;
  --short-row: #fffbeb;
  --short-edge: #d97706;
  --disc-row: #fdf2f2;
  --disc-edge: #dc2626;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(15, 23, 42, 0.06);
  --radius: 10px;
  --radius-sm: 7px;
  --sidebar: 244px;
  --font: "Fira Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --s-fintech: #1e40af; --s-agritech: #15803d; --s-deep_tech: #6d28d9;
  --s-healthtech: #c2410c; --s-climatetech: #0e7490; --s-edtech: #be185d;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120; --surface: #111827; --surface-2: #0f172a; --hover: #1e293b;
    --ink: #e2e8f0; --ink-2: #cbd5e1; --muted: #94a3b8; --faint: #64748b;
    --line: #1f2a3c; --line-2: #18222f;
    --accent: #93b4ff; --accent-hover: #b4cbff; --accent-ink: #0b1120; --accent-soft: #172554; --accent-line: #2c4a9a;
    --ok: #4ade80; --ok-soft: #10301f; --warn: #fbbf24; --warn-soft: #3a2a0a; --warn-line: #6b4d12;
    --bad: #f87171; --bad-soft: #3b1414;
    --short-row: #2a2109; --short-edge: #f59e0b; --disc-row: #2b1414; --disc-edge: #ef4444;
    --s-fintech: #93b4ff; --s-agritech: #4ade80; --s-deep_tech: #c4b5fd; --s-healthtech: #fdba74; --s-climatetech: #67e8f9; --s-edtech: #f9a8d4;
    --shadow: 0 1px 2px rgba(0,0,0,0.4); --shadow-lg: 0 24px 48px -12px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
.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; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 18px; font-weight: 650; margin: 0; letter-spacing: -0.015em; }
h3 { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
kbd {
  display: inline-block; min-width: 18px; padding: 0 5px; font: 500 11px/17px var(--font); text-align: center;
  color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* App shell: sidebar + workspace */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.workspace { min-width: 0; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px;
  padding: 14px 10px; background: var(--surface-2); border-right: 1px solid var(--line);
}
.sidebar-top { display: flex; flex-direction: column; gap: 12px; padding: 2px 4px 8px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 700; font-size: 15px; letter-spacing: -0.01em; padding: 2px 4px; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--ink); color: var(--bg); font-size: 13px; font-weight: 800; }
.searchtrigger {
  display: flex; align-items: center; gap: 8px; padding: 0 8px; height: 34px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--muted);
  box-shadow: var(--shadow); cursor: text;
}
.searchtrigger:hover { border-color: var(--accent-line); }
.searchtrigger input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: 13px; color: var(--ink); outline: none; }
.searchtrigger input::placeholder { color: var(--muted); }
.navgroup { display: flex; flex-direction: column; gap: 1px; padding: 4px 0; }
.navheading { margin: 10px 10px 4px; font-size: 11px; font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase; color: var(--faint); }
.navitem { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: var(--radius-sm); color: var(--ink-2); font-size: 13.5px; }
.navitem > span:nth-last-child(2) { flex: 1; }
.navitem svg { color: var(--muted); }
.navitem:hover { background: var(--hover); text-decoration: none; color: var(--ink); }
.navitem.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.navitem.active svg { color: var(--accent); }
.navitem.empty { color: var(--faint); }
.navitem.sub { padding-left: 34px; font-size: 13px; }
.navcount { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.navcount.pill { background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 0 7px; font-weight: 600; font-size: 11px; line-height: 18px; }
.substages { margin: 1px 0 4px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot-fintech { background: var(--s-fintech); } .dot-agritech { background: var(--s-agritech); }
.dot-deep_tech { background: var(--s-deep_tech); } .dot-healthtech { background: var(--s-healthtech); }
.dot-climatetech { background: var(--s-climatetech); } .dot-edtech { background: var(--s-edtech); }
.sidebar-foot { margin-top: auto; padding: 10px 6px 2px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.runbox { display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.runstatus { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; color: var(--ink-2); }
.runlabel { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.statusdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.statusdot.run-running, .req-in_progress .statusdot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.run-succeeded { color: var(--ok); } .run-partial { color: var(--warn); } .run-failed { color: var(--bad); } .run-running { color: var(--accent); }
.shortcut-hint { align-self: flex-start; font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }

/* Buttons: primary (navy, one per area), secondary (outlined), quiet (text). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 13.5px; font-weight: 600; line-height: 1.2;
  min-height: 36px; padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover:not(:disabled) { border-color: var(--faint); background: var(--hover); text-decoration: none; }
.btn:disabled { cursor: not-allowed; opacity: 0.55; }
.btn-small { min-height: 32px; padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-secondary { border-color: var(--accent-line); color: var(--accent); }
.btn-secondary:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }
.btn-quiet { color: var(--muted); box-shadow: none; border-color: transparent; background: none; }
.btn-quiet:hover:not(:disabled) { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.btn-primary, .btn-accent, .btn-memo { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover:not(:disabled), .btn-accent:hover:not(:disabled), .btn-memo:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn-memo { margin-left: auto; }
.tri-shortlist[aria-pressed="true"] { background: var(--short-row); border-color: var(--short-edge); color: var(--warn); }
.tri-discard[aria-pressed="true"] { background: var(--disc-row); border-color: var(--disc-edge); color: var(--bad); }
.linkbtn { font: inherit; font-size: 13px; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

/* Page */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100vh; }
.layout.with-panel { grid-template-columns: minmax(0, 1fr) minmax(440px, 540px); }
.main { padding: 28px 32px 48px; min-width: 0; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.pagehead .sub, .sub { margin: 5px 0 0; color: var(--muted); font-size: 13px; max-width: 760px; }
.crumb { color: var(--muted); font-weight: 500; }
.newdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); vertical-align: 1px; }
.back { margin: 0 0 10px; font-size: 13px; }

/* Toolbar: one filter box and compact pill selects */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.filterbox {
  flex: 1 1 260px; max-width: 420px; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--muted); box-shadow: var(--shadow);
}
.filterbox-wide { max-width: 640px; }
.filterbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.filterbox input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: 13.5px; color: var(--ink); outline: none; }
.filterbox input::-webkit-search-cancel-button { cursor: pointer; }
.pillselect {
  position: relative; display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 10px;
  background: var(--surface); border: 1px dashed var(--line); border-radius: 17px; font-size: 13px; color: var(--muted); cursor: pointer;
}
.pillselect:hover { border-color: var(--faint); }
.pillselect.on { border-style: solid; border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.pillselect span { font-weight: 550; }
.pillselect select {
  appearance: none; -webkit-appearance: none; border: 0; background: none; font: inherit; font-size: 13px;
  color: var(--ink); padding-right: 14px; cursor: pointer; outline: none; max-width: 190px; field-sizing: content;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 4px center, right 0 center; background-size: 4px 4px; background-repeat: no-repeat;
}
.pillselect.on select { color: var(--accent); font-weight: 600; }
.pillselect select option { color: #111; }
.clear { font-size: 13px; margin-left: 4px; }

/* Tables */
.tablewrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th {
  position: sticky; top: 0; z-index: 1; text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted);
  padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2);
}
td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
th a.sortlink { color: var(--muted); } th a.sortlink:hover { color: var(--ink); text-decoration: none; } th a.sortlink.on { color: var(--ink); }
.companies tbody tr { cursor: pointer; }
.companies tbody tr:hover td { background: var(--hover); }
.companies td.name a { color: var(--ink); font-weight: 600; }
.companies tr.selected td { background: var(--accent-soft) !important; }
.companies tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.companies tr.kbd-cursor td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.namecell { display: flex; align-items: center; gap: 10px; }
.domain { font-size: 12px; color: var(--muted); font-weight: 400; }
.avatar {
  display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 7px;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12.5px;
}
.avatar-lg { width: 40px; height: 40px; border-radius: 10px; font-size: 17px; }
.sectortag { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.score { display: inline-block; min-width: 34px; padding: 1px 7px; border-radius: 6px; font-weight: 650; font-size: 12.5px; text-align: center; }
.score-hi { background: var(--ok-soft); color: var(--ok); }
.score-mid { background: var(--accent-soft); color: var(--accent); }
.score-lo { background: var(--bad-soft); color: var(--bad); }

/* With the panel open, the list keeps only what is needed to pick the next company. */
.layout.with-panel .companies .opt { display: none; }

/* Triage highlights: yellow for shortlisted, red for discarded. */
.companies tr.status-shortlisted td { background: var(--short-row); }
.companies tr.status-shortlisted td:first-child { box-shadow: inset 3px 0 0 var(--short-edge); }
.companies tr.status-discarded td { background: var(--disc-row); }
.companies tr.status-discarded td:first-child { box-shadow: inset 3px 0 0 var(--disc-edge); }
.companies tr.status-discarded td.name a { color: var(--bad); }
.tri-label { font-size: 11px; font-weight: 650; margin-left: 6px; }
tr.status-shortlisted .tri-label { color: var(--warn); }
tr.status-discarded .tri-label { color: var(--disc-edge); }
.badge { display: inline-block; font-size: 10.5px; font-weight: 650; letter-spacing: 0.03em; padding: 1px 6px; border-radius: 4px; margin-left: 6px; vertical-align: 1px; }
.badge-new { background: var(--accent); color: var(--accent-ink); }
.badge-unclear { background: var(--warn-soft); color: var(--warn); }
table.plain td.detail { color: var(--ink-2); max-width: 460px; font-size: 13px; }
table.holds td.detail { width: 44%; min-width: 280px; max-width: none; }
table.holds td.name { min-width: 140px; }
table.holds td.src { min-width: 120px; max-width: 170px; font-size: 12.5px; overflow-wrap: break-word; }
table.holds td, table.holds th { vertical-align: top; }
table.plain td.name { font-weight: 600; }
.errors { margin: 6px 0 0; padding-left: 16px; color: var(--bad); font-size: 12.5px; }
.hints { margin: 12px 2px 0; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.hints kbd { margin: 0 1px; }
tr[hidden] { display: none; }
tr.flash td { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: var(--warn-soft); } }
tr.leaving { opacity: 0; transition: opacity 0.25s; }

.emptystate { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 28px; color: var(--ink-2); max-width: 680px; }
.tablewrap .emptystate { border: 0; max-width: none; }
.emptystate p { margin: 0 0 6px; }

/* Review queue */
.tabs { display: flex; gap: 2px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 550; }
.tabs a.active { color: var(--ink); border-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.count { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 9px; background: var(--hover); color: var(--ink-2); font-size: 11px; text-align: center; font-weight: 600; }
.reasons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.reason { font: inherit; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 4px 11px; font-size: 12.5px; color: var(--ink-2); }
.reason:hover { border-color: var(--faint); }
.reason.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.reason strong { margin-left: 3px; }
.reasontag { font-size: 12.5px; white-space: nowrap; color: var(--ink-2); }
.verification { font-size: 12.5px; margin-top: 6px; color: var(--ink-2); }
.rowactions { white-space: nowrap; text-align: right; }
.rowactions form { display: inline; }
.srcpub { color: var(--ink-2); font-weight: 600; margin-right: 4px; }

/* Detail panel */
.panelhost { min-width: 0; }
.panel {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface);
  border-left: 1px solid var(--line); padding: 0 24px 40px; box-shadow: -8px 0 24px -16px rgba(16,24,40,0.18);
  animation: slidein 0.18s ease-out;
}
@keyframes slidein { from { transform: translateX(12px); opacity: 0; } }
.panel-sticky { position: sticky; top: 0; z-index: 2; background: var(--surface); padding: 20px 0 0; margin: 0 -24px; padding-left: 24px; padding-right: 24px; border-bottom: 1px solid var(--line); }
.panelhead { display: flex; align-items: flex-start; gap: 12px; }
.panelhead-text { flex: 1; min-width: 0; }
.panelhead .meta { margin: 3px 0 0; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.close { font-size: 22px; line-height: 1; color: var(--muted); padding: 2px 8px; border-radius: 6px; }
.close:hover { color: var(--ink); background: var(--hover); text-decoration: none; }
.actions { display: flex; gap: 8px; align-items: center; padding: 14px 0; }
.links { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 14px 0 6px; font-size: 13px; }
.flag { display: inline-block; font-size: 11.5px; font-weight: 550; color: var(--muted); background: var(--hover); padding: 1px 8px; border-radius: 5px; }
.flag-warn { color: var(--warn); background: var(--warn-soft); }
.flag-ok { color: var(--ok); background: var(--ok-soft); }
.panel section { padding: 18px 0; border-bottom: 1px solid var(--line-2); }
.panel section:last-child { border-bottom: 0; }
.facts { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px 14px; margin: 0; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; }
.factval { margin-bottom: 2px; }
.cite { font-size: 11px; margin-left: 3px; vertical-align: 2px; }
.chip { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px; margin-left: 4px; }
.chip-missing { margin-left: 0; color: var(--muted); background: var(--hover); font-weight: 500; }
.chip-unverified { color: var(--warn); background: var(--warn-soft); }
.chip-conflict { margin-left: 0; color: var(--bad); background: var(--bad-soft); }
.note { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }
.rating { margin-bottom: 18px; }
.rating:last-child { margin-bottom: 0; }
.ratinghead { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.ratinglabel { font-weight: 600; }
.ratingscore { font-weight: 650; font-variant-numeric: tabular-nums; }
.outof { color: var(--muted); font-weight: 500; font-size: 12px; }
.bar { height: 8px; background: var(--hover); border-radius: 4px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar-empty { background: repeating-linear-gradient(135deg, var(--hover) 0 6px, var(--line-2) 6px 12px); }
.rationale { margin: 8px 0 0; color: var(--ink-2); }
details summary { cursor: pointer; color: var(--accent); font-size: 12.5px; margin-top: 8px; }
.criteria { margin-top: 8px; font-size: 12.5px; }
.criteria td { padding: 6px 8px 6px 0; vertical-align: top; }
.sources { margin: 0; padding-left: 20px; font-size: 13px; }
.sources li { margin-bottom: 6px; }
.sources li:target { background: var(--warn-soft); }
.requestbar { padding: 8px 0 4px; font-size: 13px; }
.requestbar p { margin: 0 0 8px; }
.queued { background: var(--accent-soft); color: var(--accent); padding: 8px 10px; border-radius: var(--radius-sm); }
.queued .linkbtn { margin-left: 6px; }
.failed { background: var(--bad-soft); color: var(--bad); padding: 8px 10px; border-radius: var(--radius-sm); }
.memos { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.memo { display: flex; gap: 12px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.memo span { margin-right: auto; font-weight: 600; }
.founderq { margin: 2px 0 8px; }
.q { font-size: 11.5px; font-weight: 600; padding: 1px 6px; border-radius: 4px; }
.q-strong { background: var(--ok-soft); color: var(--ok); }
.q-adequate { background: var(--accent-soft); color: var(--accent); }
.q-weak { background: var(--bad-soft); color: var(--bad); }
.q-insufficient_evidence { background: var(--hover); color: var(--muted); }
details.manual p { white-space: pre-wrap; margin: 6px 0 0; color: var(--ink-2); font-size: 12.5px; }

/* Requests and runs */
.req { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; text-transform: capitalize; }
.req-queued { color: var(--muted); } .req-in_progress { color: var(--accent); } .req-done { color: var(--ok); }
.req-failed { color: var(--bad); } .req-cancelled { color: var(--faint); }

/* Add form */
.evidence, .addform { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; max-width: 760px; box-shadow: var(--shadow); }
.evidence p { margin: 0; }
.evidence pre { white-space: pre-wrap; font: 12.5px/1.5 var(--font); color: var(--ink-2); background: var(--surface-2); padding: 10px; border-radius: 6px; max-height: 260px; overflow: auto; }
.addform { display: flex; flex-direction: column; gap: 14px; }
.addform label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.addform input, .addform select, .addform textarea { font: inherit; font-size: 14px; color: var(--ink); padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.addform input:focus, .addform select:focus, .addform textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.formrow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.hint { font-weight: 400; font-size: 12px; color: var(--muted); margin: 0; }
.formerror { margin: 0; padding: 10px 12px; border-radius: 6px; background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.formactions { display: flex; align-items: center; gap: 14px; }
.formactions .btn-memo { margin-left: 0; }
.searchbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; max-width: 640px; font-size: 13px; }

/* Search results page */
.resultcount { margin: 0 0 14px; }
.resultgroup { margin-bottom: 22px; max-width: 760px; }
.results { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.results li + li { border-top: 1px solid var(--line-2); }
.result { display: flex; align-items: center; gap: 12px; padding: 10px 14px; color: var(--ink); }
.result:hover { background: var(--hover); text-decoration: none; }
.result-text { flex: 1; min-width: 0; }
.result-title { font-weight: 600; }
.result-sub { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-go { color: var(--faint); }
.kind-founder { background: var(--ok-soft); color: var(--ok); }
.kind-candidate { background: var(--warn-soft); color: var(--warn); }
.kind-screened_out { background: var(--hover); color: var(--muted); }
.kind-page, .kind-action { background: var(--hover); color: var(--ink-2); }

/* Command palette */
.palette, .shortcuts { position: fixed; inset: 0; z-index: 100; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.palette[hidden], .shortcuts[hidden] { display: none; }
.palette-backdrop { position: absolute; inset: 0; background: rgba(15, 18, 25, 0.35); backdrop-filter: blur(2px); animation: fade 0.12s ease-out; }
@keyframes fade { from { opacity: 0; } }
.palette-box, .shortcuts-box {
  position: relative; width: min(640px, 100%); max-height: 70vh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop 0.14s ease-out;
}
@keyframes pop { from { transform: scale(0.98); opacity: 0; } }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.palette-input svg { width: 18px; height: 18px; }
.palette-input input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font: inherit; font-size: 16px; color: var(--ink); }
.palette-input input::-webkit-search-cancel-button { display: none; }
.palette-list { overflow-y: auto; padding: 6px; }
.palette-group { padding: 8px 10px 4px; font-size: 11px; font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase; color: var(--faint); display: flex; justify-content: space-between; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; color: var(--ink); cursor: pointer; }
.palette-item .avatar { width: 26px; height: 26px; font-size: 12px; }
.palette-item .result-sub { font-size: 12px; }
.palette-item[aria-selected="true"] { background: var(--accent-soft); }
.palette-item[aria-selected="true"] .result-go { color: var(--accent); }
.palette-item:hover { text-decoration: none; }
.palette-empty { padding: 22px 14px; color: var(--muted); text-align: center; font-size: 13.5px; }
.palette-item mark { background: none; color: var(--accent); font-weight: 700; }
.palette-foot { display: flex; gap: 16px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); background: var(--surface-2); }
.palette-foot kbd { margin-right: 2px; }
.shortcuts-box { padding: 22px 24px; }
.shortcuts-box dl { display: grid; grid-template-columns: max-content 1fr; gap: 10px 22px; margin: 16px 0 0; font-size: 13.5px; }
.shortcuts-box dt { color: var(--muted); } .shortcuts-box dd { margin: 0; }

/* Toasts */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 110; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px; font-size: 13.5px;
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); animation: pop 0.16s ease-out;
}
.toast.bad { background: var(--bad); color: #fff; }
.toast.leaving { opacity: 0; transition: opacity 0.3s; }

/* Narrow screens: the sidebar becomes a top bar and the panel covers the list. */
@media (max-width: 1100px) {
  .layout.with-panel { grid-template-columns: minmax(0, 1fr); }
  .panel { position: fixed; inset: 0 0 0 auto; width: min(560px, 100%); height: 100vh; z-index: 30; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .sidebar-top { flex-direction: row; align-items: center; padding: 0; flex: 1 1 100%; }
  .searchtrigger { flex: 1; }
  .searchtrigger kbd { display: none; }
  .navgroup { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; padding: 0; scrollbar-width: none; max-width: 100%; }
  .navgroup + .navgroup, .navheading, .substages, .sidebar-foot { display: none; }
  .navitem { white-space: nowrap; }
  .main { padding: 18px 16px 32px; }
  .hints { display: none; }
}
@media (max-width: 560px) {
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 10px; }
  .formrow { grid-template-columns: 1fr; }
  .navitem svg { display: none; }
  .filterbox { max-width: none; }
}

/* ---- Redesign additions ---- */
.navcount.pill-quiet { background: var(--hover); color: var(--ink-2); }
.navitem .tri { display: inline-block; width: 8px; height: 8px; border-radius: 2px; flex: none; }
.tri-shortlisted { background: var(--short-edge); } .tri-none { background: var(--faint); } .tri-discarded { background: var(--disc-edge); }
.pagehead .sub strong { color: var(--ink); font-weight: 600; }
.newnote { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; color: var(--accent); font-weight: 500; }

/* Verification tiles: they add up to "All". */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--ink); box-shadow: var(--shadow); transition: border-color 0.15s, background 0.15s;
}
a.tile:hover { border-color: var(--accent-line); text-decoration: none; }
.tile.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.tile-n { font-size: 24px; font-weight: 700; line-height: 1.1; }
.tile-label { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13.5px; }
.tile-help { font-size: 12px; color: var(--muted); }
.tile.empty .tile-n { color: var(--faint); }
.tile-unclear .tile-n { color: var(--warn); }
.tile-verified .tile-n { color: var(--ok); }
.tiles-static .tile { box-shadow: none; }
.tile-req-in_progress .tile-n { color: var(--accent); } .tile-req-done .tile-n { color: var(--ok); } .tile-req-failed .tile-n { color: var(--bad); }
.checkdot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.check-verified { background: var(--ok); } .check-unclear { background: var(--short-edge); } .check-unchecked { background: var(--faint); }

/* Toolbar: search this list, then filters, sort at the end. */
.toolbar .filters { display: flex; flex-wrap: wrap; gap: 8px; }
.toolbar-end { margin-left: auto; }
.filterbox { max-width: 460px; height: 38px; }

/* Sector chips */
.schips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.schip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 4px 12px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; font-weight: 500; white-space: nowrap;
}
.schip:hover { border-color: var(--faint); text-decoration: none; color: var(--ink); }
.schip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.schip.on .dot { box-shadow: 0 0 0 2px var(--bg); }
.schip.empty { color: var(--faint); }
.schip-n { color: inherit; opacity: 0.7; font-weight: 600; }

/* Active filters, each removable */
.activefilters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; font-size: 13px; }
.fpill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.fpill span { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; font-size: 14px; }
.fpill:hover { text-decoration: none; } .fpill:hover span { background: var(--accent-line); }

/* Company table */
th.groupcol { text-align: center; border-bottom: 1px solid var(--line-2); padding-bottom: 4px; }
tr.subhead th { top: 30px; padding-top: 4px; font-size: 11px; }
.namebody { min-width: 0; }
.nameline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.nameline .badge { margin-left: 0; }
.badge { white-space: nowrap; }
.badge-check-verified { background: var(--ok-soft); color: var(--ok); }
.badge-check-unclear { background: var(--warn-soft); color: var(--warn); }
.badge-check-unchecked { background: var(--hover); color: var(--muted); }
td.strong { font-weight: 700; color: var(--ok); }

/* Candidates */
.reasons { align-items: center; }
.reasons-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-right: 4px; }
.reasontag { display: inline-block; padding: 2px 8px; border-radius: 5px; font-weight: 500; }
.reason-soft { background: var(--warn-soft); color: var(--warn); }
.reason-hard { background: var(--hover); color: var(--ink-2); }
.srcpub { display: block; }
.srclink { font-size: 12.5px; }
.rowactions { width: 1%; }
.rowbtns { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }

/* Sourcing runs */
.legend { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: -4px 0 14px; font-size: 12.5px; }
.legend div { display: flex; gap: 6px; } .legend dt { font-weight: 600; color: var(--ink-2); } .legend dd { margin: 0; color: var(--muted); }
.errors li.warn { color: var(--warn); }

@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) { .toolbar-end { margin-left: 0; } .tile-help { display: none; } }
.layout.with-panel .tile-help { display: none; }
.layout.with-panel .tile-n { font-size: 20px; }

/* Pipeline: numbered steps in the sidebar and the funnel strip on each pipeline page. */
.navitem.step { align-items: flex-start; padding: 7px 10px; }
.stepnum {
  display: inline-grid; place-items: center; width: 20px; height: 20px; flex: none; margin-top: 1px; border-radius: 50%;
  background: var(--hover); color: var(--ink-2); font-size: 11.5px; font-weight: 700;
}
.navitem.active .stepnum { background: var(--accent); color: var(--accent-ink); }
.stepnum-short { background: var(--warn-soft); color: var(--warn); }
.steptext { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.steptitle { font-weight: 600; color: var(--ink); }
.navitem.active .steptitle { color: var(--accent); }
.stepdef { font-size: 11.5px; line-height: 1.35; color: var(--muted); font-weight: 400; }
.navitem.step .navcount { margin-top: 1px; }

.funnel { list-style: none; margin: 0 0 22px; padding: 0; display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: stretch; gap: 8px; }
.farrow { align-self: center; color: var(--faint); font-size: 18px; }
.fstep {
  display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 10px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); transition: border-color 0.15s;
}
.fstep:hover { border-color: var(--accent-line); text-decoration: none; }
.fstep.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: var(--accent-soft); }
.fstep.on .stepnum { background: var(--accent); color: var(--accent-ink); }
.fstep-top { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 14px; }
.fstep-n { margin-left: auto; font-size: 18px; font-weight: 700; }
.fstep-def { font-size: 12px; color: var(--muted); line-height: 1.4; }
.countline { margin-top: 8px !important; }
.layout.with-panel .fstep-def { display: none; }
@media (max-width: 820px) {
  .funnel { grid-template-columns: 1fr; gap: 6px; } .farrow { display: none; }
  .stepdef { display: none; }
}

/* Claude's check of leads: flags with an explanation, never a removal. */
.checkline { margin: -4px 0 12px; font-size: 13px; color: var(--muted); max-width: 900px; }
.checkline strong { color: var(--ink); }
.badge-flag { display: inline-block; margin: 4px 0 0; background: var(--bad-soft); color: var(--bad); white-space: normal; }
td.name .badge { margin-left: 0; margin-top: 4px; }
.flagnote { margin: 0 0 8px; padding: 8px 10px; border-radius: 6px; background: var(--bad-soft); color: var(--ink-2); font-size: 12.5px; }
.flagnote strong { color: var(--bad); }
.count-flag { background: var(--bad-soft); color: var(--bad); }
.badge-fixed { display: inline-block; margin: 4px 0 0; background: var(--ok-soft); color: var(--ok); white-space: normal; }
.fixnote { margin: 0 0 8px; padding: 8px 10px; border-radius: 6px; background: var(--ok-soft); color: var(--ink-2); font-size: 12.5px; }
.fixnote strong { color: var(--ok); }
.count-ok { background: var(--ok-soft); color: var(--ok); }
.removedlinks { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; }
.removedlinks a.reason { text-decoration: none; }

/* Four pipeline stages, with Claude's two checkpoints on the arrows. */
.funnel.funnel-4 { grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; }
.farrow-claude { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 18px; color: var(--accent); }
.farrow-label { font-size: 10.5px; font-weight: 650; letter-spacing: 0.03em; white-space: nowrap; color: var(--accent); }
@media (max-width: 1100px) { .funnel.funnel-4 { grid-template-columns: 1fr 1fr; } .funnel.funnel-4 .farrow { display: none; } }

/* A source jumped to from its [n] marker. */
.sources li { scroll-margin: 140px 0; border-radius: 6px; padding: 2px 4px; margin-left: -4px; }
.sources li.cited { animation: cited 2.4s ease-out; }
@keyframes cited { 0%, 40% { background: var(--warn-soft); box-shadow: 0 0 0 2px var(--short-edge); } 100% { background: transparent; box-shadow: none; } }
.cite { cursor: pointer; }
.verifybar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 4px; }
p.verifybar { display: block; }
.verifyall { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: -6px 0 14px; }
.submitlink { display: flex; align-items: center; gap: 8px; margin: 0 4px 4px; padding: 7px 10px; border-radius: var(--radius-sm);
  border: 1px dashed var(--accent-line); color: var(--accent); font-weight: 600; font-size: 13.5px; }
.submitlink:hover, .submitlink.active { background: var(--accent-soft); text-decoration: none; border-style: solid; }
.headbtn { vertical-align: middle; margin-left: 10px; }
.evidence.submitted { border-color: var(--ok); background: var(--ok-soft); }
tr.asked td { background: var(--accent-soft); }
tr.asked td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.askednote { color: var(--accent); font-weight: 500; }
.btn.is-done { opacity: 0.75; cursor: default; }
.tile { position: relative; }
.tile-link { display: flex; flex-direction: column; gap: 2px; color: inherit; }
.tile-link:hover { text-decoration: none; }
div.tile:hover { border-color: var(--accent-line); }
.tile-action { margin-top: 8px; }
.funnel.funnel-5 { grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr auto 1fr; margin-bottom: 6px; }
@media (max-width: 1250px) { .funnel.funnel-5 { grid-template-columns: 1fr 1fr 1fr; } .funnel.funnel-5 .farrow { display: none; } }
@media (max-width: 700px) { .funnel.funnel-5 { grid-template-columns: 1fr; } }
.fstep-source { border-style: dashed; }
.funnel-exit { margin: 0 0 22px; font-size: 12.5px; color: var(--muted); }
.fstep-when { display: block; margin-top: 3px; color: var(--faint); }
.companyline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.companyline form { margin: 0; }
.funnel.funnel-plain { grid-template-columns: repeat(4, 1fr); margin-bottom: 6px; }
@media (max-width: 900px) { .funnel.funnel-plain { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .funnel.funnel-plain { grid-template-columns: 1fr; } }
.reasons .confirmall { margin-left: auto; }
.loginpage { min-height: 100vh; display: grid; place-items: center; background: var(--bg, #f7f8fa); }
.loginbox { width: min(360px, calc(100vw - 32px)); background: var(--panel, #fff); border: 1px solid var(--line, #e5e7eb); border-radius: 12px; padding: 28px; }
.loginbox .brand { margin-bottom: 18px; }
.loginbox h1 { font-size: 20px; margin: 0 0 14px; }
.signedin { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }

/* ---- iPhone ---- */
.menubtn { display: none; }
@media (max-width: 820px) {
  .menubtn { display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel, #fff); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; }
  .sidebar { padding-top: max(10px, env(safe-area-inset-top)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .sidebar.menu-open { max-height: 100vh; overflow-y: auto; }
  .sidebar.menu-open .navgroup + .navgroup { display: flex; flex-direction: column; flex: 1 1 100%; overflow: visible; padding-top: 8px; border-top: 1px solid var(--line); }
  .sidebar.menu-open .navheading { display: block; }
  .sidebar.menu-open .navgroup + .navgroup .navitem { white-space: normal; }
  .sidebar.menu-open .sidebar-foot { display: block; flex: 1 1 100%; padding-top: 8px; }
  .sidebar.menu-open .shortcut-hint { display: none; }
  /* The menu strip already shows the four stages: the large boxes give way to the list. */
  .funnel { display: none; }
  .funnel-exit { margin-bottom: 14px; }
  /* iOS zooms into fields with text under 16px. */
  input, select, textarea { font-size: 16px; }
  .btn, .reason, .rowbtns .btn { min-height: 36px; }
  .main { padding-bottom: max(32px, env(safe-area-inset-bottom)); }
  .tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .rowbtns { flex-wrap: wrap; }
  .reasons .confirmall { margin-left: 0; width: 100%; justify-content: center; }
}
@media (max-width: 820px) {
  .brand { white-space: nowrap; }
  /* Leads and Ruled out: each row becomes a card instead of a wide table. */
  table.holds thead { display: none; }
  table.holds, table.holds tbody, table.holds tr, table.holds td { display: block; width: 100%; }
  table.holds tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.holds td { padding: 3px 0; border: 0; }
  table.holds td.rowactions { padding-top: 8px; }
  .tablewrap:has(table.holds) { overflow-x: visible; }
}
@media (max-width: 820px) {
  .sidebar-top { gap: 8px; min-width: 0; }
  .searchtrigger { min-width: 0; }
  .searchtrigger input { min-width: 0; width: 100%; }
  .menubtn { flex: none; }
}
@media (max-width: 820px) { .sidebar.menu-open .navgroup:first-of-type .navheading { display: none; } }
