:root {
  --paper: #f6f3ec;
  --card: #fffdf8;
  --ink: #14130f;
  --muted: #6f6a60;
  --line: #e3ddd0;
  --accent: #1f4d3a;
  --accent-soft: #e6efe6;
  --warn: #a8452b;
  --warn-soft: #fbeee9;
  --shadow: 0 1px 2px rgba(20, 19, 15, 0.05), 0 12px 28px -18px rgba(20, 19, 15, 0.35);
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button { font: inherit; cursor: pointer; }

/* ---------- shell ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 14px 26px;
  background: rgba(246, 243, 236, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand .hand { font-size: 19px; }
.brand b { font-weight: 650; }
.brand em { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: 16px; }

nav.tabs { display: flex; gap: 2px; }
nav.tabs button {
  border: 0;
  background: transparent;
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}
nav.tabs button:hover { background: #efeade; color: var(--ink); }
nav.tabs button[aria-selected="true"] { background: var(--ink); color: #fdfbf5; }

.top .spacer { flex: 1; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}
.pill b { color: var(--ink); font-weight: 600; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.btn {
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 13.5px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.btn:hover { background: #ebe5d8; }
.btn.primary { background: var(--ink); color: #fdfbf5; border-color: var(--ink); }
.btn.primary:hover { background: #2b2924; }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.ghost { border-color: var(--line); color: var(--muted); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

main { max-width: 1180px; margin: 0 auto; padding: 30px 26px 90px; }

/* ---------- headings ---------- */

h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}
h1 em { font-style: italic; }
.sub { color: var(--muted); font-size: 15px; margin: 0 0 26px; max-width: 62ch; }

h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 26px;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
h3 { font-size: 14px; font-weight: 600; margin: 0 0 10px; }
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}

/* ---------- cards ---------- */

.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 24px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}
.stat .n { font-family: var(--serif); font-size: 40px; line-height: 1; letter-spacing: -0.02em; }
.stat .n small { font-size: 15px; font-family: var(--sans); color: var(--muted); }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 8px; }

.section { margin-top: 30px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head p { margin: 0; color: var(--muted); font-size: 13px; }

/* ---------- feed / leads ---------- */

.feed { display: grid; gap: 8px; }
.row {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 13px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
  width: 100%;
  color: inherit;
}
button.row:hover { border-color: #c9c2b2; transform: translateY(-1px); }
.fit {
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1;
  text-align: right;
  color: var(--accent);
}
.fit.low { color: var(--muted); }
.who { min-width: 0; }
.who .name { font-weight: 600; font-size: 14.5px; }
.who .meta { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.why {
  font-size: 12.5px;
  color: #4a463d;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sig { text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; }
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  margin-bottom: 3px;
}
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.plain { background: #f0ece2; color: var(--muted); }

.empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 26px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

/* ---------- detail drawer ---------- */

.drawer-wrap {
  position: fixed;
  inset: 0;
  background: rgba(20, 19, 15, 0.35);
  display: none;
  z-index: 40;
}
.drawer-wrap.open { display: block; }
.drawer {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(560px, 100%);
  background: var(--card);
  border-left: 1px solid var(--line);
  padding: 26px;
  overflow-y: auto;
}
.drawer .close { position: absolute; right: 18px; top: 16px; border: 0; background: transparent; font-size: 22px; color: var(--muted); }
.drawer h2 { margin-bottom: 2px; }
.drawer .role { color: var(--muted); margin-bottom: 18px; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 12px; font-size: 13px; margin: 16px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.evidence {
  border-left: 2px solid var(--accent);
  padding: 2px 0 2px 13px;
  margin: 12px 0;
}
.evidence .q { font-family: var(--serif); font-size: 18px; line-height: 1.25; }
.evidence .when { color: var(--muted); font-size: 12px; margin-top: 5px; }
.reasons { padding-left: 18px; margin: 8px 0; font-size: 13px; }
.reasons li { margin-bottom: 3px; }

/* ---------- outreach ---------- */

.msg {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 15px 16px;
}
.msg .body {
  font-size: 13.5px;
  white-space: pre-wrap;
  background: #f5f1e7;
  border-radius: 9px;
  padding: 10px 12px;
  margin-top: 8px;
  border: 1px solid #eae4d6;
}
.msg .to { font-size: 13px; }
.msg .to b { font-weight: 600; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 0; }
.step {
  font-size: 11.5px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #faf7f0;
}
.step.sent { border-color: #bfd8c4; background: var(--accent-soft); color: var(--accent); }
.step.draft { border-color: #e7d3a8; background: #fdf5e3; color: #8a6417; }
.step.stopped { border-color: #e5c4ba; background: var(--warn-soft); color: var(--warn); }

/* ---------- integrations ---------- */

.code {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f3efe4;
  border: 1px solid #e6dfcf;
  border-radius: 9px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 12.5px;
  overflow-x: auto;
}
.code code { flex: 1; white-space: nowrap; }
pre.skill {
  background: #14130f;
  color: #e9e3d5;
  border-radius: 12px;
  padding: 16px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  overflow-x: auto;
  max-height: 340px;
}
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }

/* ---------- forms ---------- */

label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
input[type="text"], input[type="number"], textarea, select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffdf8;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
}
textarea { min-height: 74px; resize: vertical; line-height: 1.45; }
input:focus, textarea:focus, select:focus { outline: 2px solid #cfdccd; outline-offset: 1px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fdfbf5;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
  z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- consent ---------- */

body.consent { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.consent-card {
  width: min(460px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.consent-card h1 { font-size: 30px; margin: 18px 0 8px; }
.consent-card p { font-size: 13.5px; color: #3f3c35; }
ul.consent-scope { list-style: none; padding: 0; margin: 16px 0 20px; font-size: 13px; }
ul.consent-scope li { padding: 6px 0 6px 20px; position: relative; }
ul.consent-scope li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); }
ul.consent-scope li.no::before { content: "✕"; color: var(--warn); }
.fine { color: var(--muted); font-size: 11.5px; margin-top: 16px; }
.consent-card form { display: flex; gap: 8px; }

@media (max-width: 720px) {
  .top { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  nav.tabs { order: 3; width: 100%; overflow-x: auto; }
  main { padding: 22px 16px 80px; }
  .row { grid-template-columns: 46px 1fr; }
  .sig { display: none; }
  .row2 { grid-template-columns: 1fr; }
}
