:root {
  --paper: #f4f2ec;
  --card: #fafaf6;
  --ink: #161513;
  --muted: #6a6862;
  --line: #ddd9cf;
  --green: #146b52;
  --green-mid: #1e8a6a;
  --green-soft: #dcefe7;
  --mint: #8fe3c4;
  --danger: #b0472f;
  --shadow: 0 1px 0 rgba(22, 21, 19, 0.04), 0 8px 24px rgba(22, 21, 19, 0.04);
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: light; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.45;
  min-height: 100vh;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 22px;
  height: 54px;
  padding: 0 22px;
  background: #fffcf7;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-weight: 600;
  font-size: 20px;
  line-height: 1;
  letter-spacing: -0.045em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--ink); }
.brand-crm {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
  margin-left: 2px;
  position: relative;
  top: -1px;
}
.ai-wrap {
  position: relative;
  width: 26px;
  height: 26px;
  margin-left: 1px;
  flex: none;
  overflow: visible;
  --poof: 16px;
}
.ai-wrap.live { animation: hop 12s ease-in-out infinite; }
.face {
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #8fe3c4;
  position: relative;
  overflow: hidden;
  transform-origin: 50% 80%;
  opacity: 0;
}
.ai-wrap.live .face { opacity: 1; animation: hopBody 12s ease-in-out infinite; }
.ai-letters {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 20px/1 "Bricolage Grotesque", system-ui;
  color: #8fe3c4;
  letter-spacing: -0.045em;
  pointer-events: none;
}
.ai-wrap.intro .ai-letters { animation: lettersPoof .42s cubic-bezier(.2,.8,.2,1) forwards; }
.ai-wrap.intro .face { animation: faceIn .5s .16s cubic-bezier(.18,1.25,.32,1) forwards; }
.ai-wrap.intro .puff { animation: puff .5s ease-out forwards; }
.ai-wrap.intro .poof i { animation: poofDot .48s ease-out forwards; }
.ai-wrap.live .ai-letters,
.ai-wrap.live .poof { display: none; }
.poof { position: absolute; inset: -40%; pointer-events: none; z-index: 4; }
.puff {
  position: absolute; left: 50%; top: 50%;
  width: 170%; height: 170%;
  transform: translate(-50%,-50%) scale(.25);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.22) 0%, rgba(143,227,196,.16) 28%, transparent 62%);
  opacity: 0;
}
.poof i {
  position: absolute; left: 50%; top: 50%;
  width: 3px; height: 3px;
  margin: -1.5px 0 0 -1.5px;
  border-radius: 50%;
  background: rgba(22,21,19,.28);
  opacity: 0;
}
.poof i:nth-child(2) { --a: 12deg; }
.poof i:nth-child(3),
.poof i:nth-child(5),
.poof i:nth-child(7),
.poof i:nth-child(9) { display: none; }
.poof i:nth-child(4) { --a: 102deg; }
.poof i:nth-child(6) { --a: 196deg; }
.poof i:nth-child(8) { --a: 284deg; }
.eyes {
  position: absolute; inset: 0;
  display: flex; justify-content: center; align-items: center;
  gap: 5px;
  padding-top: 10%;
  transform: translate(var(--ex, 0px), var(--ey, 0px));
  transition: transform .22s ease;
}
.eye {
  display: block;
  width: 5px; height: 5px;
  background: var(--ink);
  border-radius: 50%;
  transform-origin: 50% 50%;
}
.face.blink .eye { animation: blink .16s linear; }
@keyframes lettersPoof {
  0%   { opacity: 1; transform: scale(1); filter: blur(0); }
  22%  { opacity: 1; transform: scale(1.04); filter: blur(0); }
  100% { opacity: 0; transform: scale(.2); filter: blur(1.2px); }
}
@keyframes puff {
  0%   { opacity: 0; transform: translate(-50%,-50%) scale(.2); }
  30%  { opacity: .28; transform: translate(-50%,-50%) scale(.7); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(1.25); }
}
@keyframes poofDot {
  0%   { opacity: 0; transform: rotate(var(--a)) translate(0) scale(.3); }
  16%  { opacity: .35; }
  100% { opacity: 0; transform: rotate(var(--a)) translate(var(--poof)) scale(.15); }
}
@keyframes faceIn {
  0%   { opacity: 0; transform: scale(.08); }
  58%  { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes hop {
  0%, 18% { transform: translate(0, 0); }
  20% { transform: translate(-2px, -3px); }
  23% { transform: translate(-3px, 0.5px); }
  26% { transform: translate(-2px, 0); }
  30%, 68% { transform: translate(0, 0); }
  70% { transform: translate(2px, -3px); }
  73% { transform: translate(3px, 0.5px); }
  76% { transform: translate(2px, 0); }
  80%, 100% { transform: translate(0, 0); }
}
@keyframes hopBody {
  0%, 18% { transform: rotate(0deg) scale(1, 1); }
  20% { transform: rotate(-7deg) scale(0.98, 1.04); }
  23% { transform: rotate(-5deg) scale(1.05, 0.95); }
  26% { transform: rotate(-2deg) scale(1, 1); }
  30%, 68% { transform: rotate(0deg) scale(1, 1); }
  70% { transform: rotate(7deg) scale(0.98, 1.04); }
  73% { transform: rotate(5deg) scale(1.05, 0.95); }
  76% { transform: rotate(2deg) scale(1, 1); }
  80%, 100% { transform: rotate(0deg) scale(1, 1); }
}
@keyframes blink {
  0%, 100% { transform: scaleY(1); }
  45% { transform: scaleY(.06); }
  70% { transform: scaleY(1); }
  82% { transform: scaleY(.08); }
}
.nav { display: flex; gap: 4px; }
.nav a {
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
}
.nav a:hover, .nav a.is-on { color: var(--ink); background: var(--green-soft); }
.top-search { flex: 1; max-width: 420px; }
.top-search input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 7px;
  padding: 0 12px;
  font: inherit;
  color: var(--ink);
}
.top-search input:focus { outline: 2px solid var(--green-soft); border-color: var(--green); }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.who-email { font-size: 13px; color: var(--muted); }
.who-out { font-size: 13px; font-weight: 500; color: var(--ink); }

.page { width: min(1120px, calc(100% - 40px)); margin: 28px auto 64px; }
.page-auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.stack.narrow { width: min(720px, 100%); }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.page-title {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  line-height: 1.1;
}
.lede { margin: 0; color: var(--muted); }
.crumb { margin: 0; color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.dim { color: #9a968c; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.pad-top { padding-top: 10px; }

.btn, .btn-quiet, .btn-ghost, .btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
}
.btn { background: var(--green); color: #fff; }
.btn:hover { background: var(--green-mid); text-decoration: none; }
.btn-quiet { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-quiet:hover { border-color: var(--ink); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--green-soft); text-decoration: none; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
}
.stat:hover { border-color: var(--green); text-decoration: none; }
.stat-k { display: block; color: var(--muted); font-size: 12px; font-weight: 550; letter-spacing: 0.04em; text-transform: uppercase; }
.stat-v { display: block; font-family: var(--serif); font-size: 36px; margin-top: 4px; letter-spacing: -0.03em; }
.stat-accent { background: var(--green); border-color: var(--green); color: #fff; }
.stat-accent .stat-k { color: var(--mint); }
.stat-accent:hover { background: var(--green-mid); border-color: var(--green-mid); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 600; }

.piles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.pile { text-decoration: none; color: inherit; }
.pile:hover { text-decoration: none; }
.pile-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.pile-bar { height: 8px; background: #ece8de; border-radius: 99px; overflow: hidden; }
.pile-bar i { display: block; height: 100%; background: var(--green); border-radius: 99px; }

.note-feed, .thread { list-style: none; margin: 0; padding: 0; }
.note-feed li + li, .thread li + li { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.note-feed a { color: inherit; text-decoration: none; display: block; }
.note-feed a:hover { color: inherit; }
.note-feed p, .thread p { margin: 6px 0 0; white-space: pre-wrap; }
.note-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }
.empty { color: var(--muted); margin: 0; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.filters input, .filters select, .form input, .form select, .form textarea,
.status-form select, .note-form textarea, .note-form select {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
.filters input[type="search"] { min-width: 240px; flex: 1; }
.filters select { height: 36px; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); box-shadow: var(--shadow); }
.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.grid th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f7f5ef;
  white-space: nowrap;
}
.grid td { padding: 10px 12px; border-bottom: 1px solid #efebe3; vertical-align: top; }
.grid tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover td { background: #f3faf6; }
.co { color: var(--ink); font-weight: 550; }
.co:hover { color: var(--green); }
.buyer { font-weight: 500; }
.sub { color: var(--muted); font-size: 12.5px; }

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 99px;
  background: #ece8de;
  color: #4a4741;
  white-space: nowrap;
}
.pill-not_called { background: #ece8de; color: #4a4741; }
.pill-called { background: #dce8f5; color: #1d3b66; }
.pill-no_answer { background: #f6e7c8; color: #6a4a10; }
.pill-callback { background: #d7efe8; color: #0f4a3c; }
.pill-meeting { background: var(--green-soft); color: var(--green); }
.pill-not_interested { background: #f3ddd8; color: var(--danger); }

.pager { display: flex; gap: 14px; align-items: center; }
.pager .is-off { color: #b7b3a8; }

.acct-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.meta-line { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.status-form { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); padding: 10px 12px; border-radius: 10px; }
.status-form label { font-size: 12px; color: var(--muted); font-weight: 550; }
.split { display: grid; grid-template-columns: 1fr 1.3fr; gap: 12px; }
.buyer-name { font-size: 18px; font-weight: 600; margin: 0 0 2px; }
.contact-list { list-style: none; margin: 12px 0 0; padding: 0; }
.contact-list li { display: grid; grid-template-columns: 72px 1fr; gap: 8px; padding: 6px 0; border-top: 1px solid #efebe3; }
.contact-list span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; align-self: center; }
.opener { font-family: var(--serif); font-size: 22px; margin: 0 0 10px; }
.hook { margin: 0; color: #2b2924; }

.note-form { margin-bottom: 18px; }
.note-form textarea { width: 100%; min-height: 84px; resize: vertical; }
.note-form-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.form fieldset { border: 0; margin: 0 0 18px; padding: 0; }
.form legend { font-weight: 600; margin-bottom: 10px; }
.form label { display: block; font-size: 12px; font-weight: 550; color: var(--muted); margin-bottom: 10px; }
.form input, .form select, .form textarea { width: 100%; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.form-row:has(label:nth-child(3)) { grid-template-columns: 1.2fr 1.2fr 0.8fr; }
.form-actions { display: flex; gap: 10px; align-items: center; }

.auth-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 32px 28px;
  box-shadow: var(--shadow);
  text-align: center;
}
.brand-card {
  justify-content: center;
  font-size: 28px;
  margin: 0 0 2px;
}
.auth-card .ai-wrap,
.auth-card .face { width: 32px; height: 32px; }
.auth-card .eye { width: 6px; height: 6px; }
.auth-card .eyes { gap: 6px; }
.auth-mark { font-family: var(--serif); font-size: 28px; margin: 0; }
.auth-card h1 {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--green);
  margin: 2px 0 12px;
}
.auth-sub { color: var(--muted); margin: 0 0 22px; }
.auth-note { font-size: 12px; color: var(--muted); margin: 16px 0 0; }
.btn-google {
  width: 100%;
  height: 42px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 550;
}
.btn-google:hover { border-color: var(--ink); text-decoration: none; }
.btn-google.is-off { opacity: 0.45; cursor: not-allowed; }
.banner {
  text-align: left;
  background: #f6e7c8;
  color: #6a4a10;
  padding: 10px 12px;
  border-radius: 8px;
  margin: 0 0 16px;
  font-size: 13.5px;
}
.banner-bad { background: #f3ddd8; color: var(--danger); }

@media (max-width: 860px) {
  .top { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 10px; }
  .top-search { max-width: none; order: 4; flex-basis: 100%; }
  .who { margin-left: 0; }
  .page { width: calc(100% - 24px); margin: 18px auto 48px; }
  .stats, .piles, .split, .form-row, .form-row:has(label:nth-child(3)) { grid-template-columns: 1fr 1fr; }
  .page-head, .acct-head { flex-direction: column; align-items: stretch; }
  .page-title { font-size: 28px; }
}
@media (max-width: 560px) {
  .stats, .piles, .split, .form-row, .form-row:has(label:nth-child(3)) { grid-template-columns: 1fr; }
  .who-email { display: none; }
}
