/* GreenPac Lead Finder — packing-slip utility theme */
:root {
  --ink: #15241b;
  --ink-soft: #4a5a50;
  --ink-faint: #7a857c;
  --paper: #eef1ec;
  --card: #ffffff;
  --line: #d7ddd3;
  --green: #1e7a46;
  --green-deep: #134e2e;
  --green-soft: #e3efe7;
  --kraft: #c0894e;
  --kraft-soft: #f1e6d6;
  --amber: #b9772a;
  --amber-soft: #f6e9d6;
  --grey: #7a857c;
  --grey-soft: #e8ece7;
  --red: #b23a3a;
  --red-soft: #f5e1e1;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 36, 27, 0.06), 0 10px 28px rgba(20, 36, 27, 0.07);
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }

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

/* ---- top bar ------------------------------------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand__logo { height: 30px; width: auto; display: block; }
.brand__sep { color: var(--ink-faint); }
.brand__tool { font-family: var(--display); font-weight: 500; color: var(--green-deep); }
.brand__internal {
  margin-left: 6px; padding: 2px 7px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--kraft); background: var(--kraft-soft); border-radius: 100px;
}

.meta { display: flex; align-items: center; gap: 14px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  font-size: 12px; font-weight: 600;
  background: var(--grey-soft); color: var(--ink-soft);
  border-radius: 100px;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.is-live { background: var(--green-soft); color: var(--green-deep); }
.pill.is-mock { background: var(--kraft-soft); color: var(--kraft); }

.credits { display: flex; gap: 14px; font-family: var(--mono); font-size: 12px; }
.credits__loading { color: var(--ink-faint); }
.gauge { display: flex; align-items: baseline; gap: 6px; color: var(--ink-soft); }
.gauge__label { font-family: var(--body); font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.gauge__num { font-weight: 500; }
.gauge.is-empty .gauge__num { color: var(--red); }

/* ---- layout ------------------------------------------------------------- */
.wrap { max-width: 880px; margin: 0 auto; padding: 28px 20px 80px; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px 6px 0;
  overflow: hidden;
}

.tabs { display: flex; gap: 4px; padding: 8px 12px 0; }
.tab {
  appearance: none; border: 0; background: none; cursor: pointer;
  padding: 10px 14px 12px;
  font-family: var(--body); font-size: 14px; font-weight: 600;
  color: var(--ink-faint);
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--ink-soft); }
.tab.is-active { color: var(--green-deep); border-bottom-color: var(--green); }

.form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px 16px;
  padding: 22px;
  align-items: end;
}
.form.is-hidden { display: none; }

.field { display: flex; flex-direction: column; gap: 6px; grid-column: 1 / -1; }
.field--half { grid-column: 1 / 2; }
.field__label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.field__opt { font-weight: 400; color: var(--ink-faint); }

.input {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--body); font-size: 15px; color: var(--ink);
  background: #fcfdfc;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.input::placeholder { color: var(--ink-faint); }
.input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

.btn {
  appearance: none; cursor: pointer;
  font-family: var(--body); font-size: 14px; font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 12px 18px;
  transition: transform 0.06s ease, background 0.12s ease, border-color 0.12s ease;
}
.btn:active { transform: translateY(1px); }
.btn--go { background: var(--green); color: #fff; align-self: end; white-space: nowrap; }
.btn--go:hover { background: var(--green-deep); }
.btn--go:disabled { opacity: 0.6; cursor: progress; }
.btn--ghost { background: transparent; color: var(--green-deep); border-color: var(--line); padding: 8px 14px; }
.btn--ghost:hover { border-color: var(--green); background: var(--green-soft); }

.hint { grid-column: 1 / -1; margin: 2px 0 0; font-size: 12.5px; color: var(--ink-faint); }

/* ---- tag inputs (locations / roles) ------------------------------------- */
.tags {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  min-height: 46px;
  padding: 7px 10px;
  background: #fcfdfc;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: text;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.tags.is-focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 6px 4px 10px;
  font-size: 13px; font-weight: 500;
  color: var(--amber); background: var(--kraft-soft);
  border: 1px solid var(--kraft); border-radius: 100px;
}
.tag__x {
  appearance: none; cursor: pointer; border: 0; background: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; line-height: 1;
  font-size: 14px; color: var(--amber); border-radius: 50%;
}
.tag__x:hover { background: rgba(185, 119, 42, 0.18); }

.tags__input {
  flex: 1; min-width: 120px;
  border: 0; outline: none; background: none;
  font-family: var(--body); font-size: 14px; color: var(--ink);
  padding: 4px 2px;
}
.tags__input::placeholder { color: var(--ink-faint); }

.suggest {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 8px;
}
.suggest__label { font-size: 11.5px; color: var(--ink-faint); }
.suggest__chip {
  appearance: none; cursor: pointer;
  font-family: var(--body); font-size: 12px; color: var(--ink-soft);
  background: #fff; border: 1px dashed var(--line); border-radius: 100px;
  padding: 3px 10px;
}
.suggest__chip:hover { border-style: solid; border-color: var(--green); color: var(--green-deep); }
.suggest__chip[disabled] { opacity: 0.4; cursor: default; border-style: solid; }

/* ---- status / messages -------------------------------------------------- */
.status:empty { display: none; }
.status { margin-top: 18px; }
.msg {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.msg--info { background: var(--green-soft); color: var(--green-deep); }
.msg--warn { background: var(--amber-soft); color: var(--amber); }
.msg--err { background: var(--red-soft); color: var(--red); }

/* ---- results ------------------------------------------------------------ */
.results { margin-top: 22px; }
.results.is-hidden { display: none; }
.results__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.results__title { margin: 0; font-family: var(--display); font-size: 16px; font-weight: 600; color: var(--ink); }
.results__title span { color: var(--ink-faint); font-weight: 500; }
.results__list { display: flex; flex-direction: column; gap: 12px; }

.ticket {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px 16px 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 18px;
  animation: rise 0.22s ease both;
}
.ticket::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px;
  background: var(--kraft); border-radius: 0 3px 3px 0;
}
.ticket__main { min-width: 0; }
.ticket__name { font-family: var(--display); font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.ticket__title { color: var(--ink-soft); font-size: 14px; }
.ticket__org { margin-top: 6px; font-size: 13px; color: var(--ink-faint); }
.ticket__org b { color: var(--ink-soft); font-weight: 600; }

.ticket__contact { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.line__key { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); width: 46px; flex: none; }
.line__val { font-family: var(--mono); font-size: 13px; color: var(--ink); word-break: break-all; }
.line__val.is-empty { color: var(--ink-faint); font-style: italic; font-family: var(--body); }

.copy {
  appearance: none; cursor: pointer; border: 1px solid var(--line); background: #fff;
  font-size: 11px; color: var(--ink-soft); padding: 1px 7px; border-radius: 100px;
}
.copy:hover { border-color: var(--green); color: var(--green-deep); }

.chip {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 100px;
  letter-spacing: 0.01em;
}
.chip--verified { background: var(--green-soft); color: var(--green-deep); }
.chip--likely { background: var(--amber-soft); color: var(--amber); }
.chip--unavailable { background: var(--grey-soft); color: var(--grey); }

.ticket__side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 12px; }
.fit {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 100px; white-space: nowrap;
}
.fit--strong { background: var(--green-deep); color: #fff; }
.fit--good { background: var(--green-soft); color: var(--green-deep); }
.fit--weak { background: var(--amber-soft); color: var(--amber); }
.fit--off { background: var(--grey-soft); color: var(--grey); }
.fit--unknown { background: var(--grey-soft); color: var(--grey); }

.ticket__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* cache badge: this record was served from an earlier lookup (no credit spent) */
.ticket__cache {
  margin-top: 12px;
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ink-faint);
}
.ticket__cache .icon { color: var(--kraft); width: 14px; height: 14px; }
.act {
  appearance: none; cursor: pointer; font-family: var(--body); font-size: 12.5px; font-weight: 600;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  padding: 7px 11px;
}
.act:hover { border-color: var(--green); color: var(--green-deep); }
.act--li { text-decoration: none; }
.act.is-done { background: var(--green-soft); color: var(--green-deep); border-color: var(--green-soft); }

/* ---- recent panel (shared lookup history) ------------------------------- */
.panel--recent { margin-top: 22px; padding: 18px 20px 12px; }
.panel--recent[hidden] { display: none; }

.panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.panel__title { margin: 0; font-family: var(--display); font-size: 16px; font-weight: 600; color: var(--ink); }
.panel__sub { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-faint); }

/* ---- revealed strip ----------------------------------------------------- */
.hist {
  display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 12px;
  scroll-snap-type: x proximity; scrollbar-width: thin;
}
.hist__tile {
  flex: 0 0 200px; scroll-snap-align: start; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.hist__tile:hover { border-color: var(--green); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06); }
.hist__tile:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.hist__avatar {
  width: 30px; height: 30px; margin-bottom: 6px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--green-soft); color: var(--green-deep);
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
}
.hist__name { font-weight: 600; font-size: 14px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist__title { font-size: 12px; color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist__org { font-size: 12px; color: var(--ink-faint); margin-bottom: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist__val { font-family: var(--mono); font-size: 11.5px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist__val.is-empty { color: var(--ink-faint); }
.hist__by { font-size: 11px; color: var(--ink-faint); margin-bottom: 4px; }

/* ---- empty state -------------------------------------------------------- */
.empty { text-align: center; padding: 64px 20px; }
.empty.is-hidden { display: none; }
.empty__mark {
  width: 54px; height: 40px; margin: 0 auto 18px;
  border: 2px solid var(--line); border-radius: 4px; position: relative; background: #fff;
}
.empty__mark::before { content: ""; position: absolute; inset: 8px 0 auto 0; height: 0; border-top: 2px dashed var(--line); }
.empty__mark::after {
  content: ""; position: absolute; left: 50%; top: -7px; width: 30px; height: 13px;
  transform: translateX(-50%) rotate(-3deg); background: var(--kraft-soft); border: 1px solid var(--kraft); border-radius: 2px;
}
.empty__lead { font-family: var(--display); font-size: 18px; font-weight: 600; margin: 0 0 6px; }
.empty__sub { color: var(--ink-faint); margin: 0 auto; max-width: 420px; }

/* ---- toast -------------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px);
  background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 500;
  padding: 10px 16px; border-radius: 100px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-err { background: var(--red); }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- responsive --------------------------------------------------------- */
@media (max-width: 560px) {
  .form { grid-template-columns: 1fr; }
  .field--half { grid-column: 1 / -1; }
  .btn--go { width: 100%; }
  .credits { display: none; }
  .ticket { grid-template-columns: 1fr; }
  .ticket__side { flex-direction: row; align-items: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ===========================================================================
   CRM page — appended for Phase CRM-5. Reuses all existing tokens; no new hex.
   =========================================================================== */

/* ---- nav links (shared between index + crm pages) ----------------------- */
.nav { display: flex; align-items: center; gap: 2px; }
.nav__link {
  padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; color: var(--ink-soft);
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav__link:hover { background: var(--green-soft); color: var(--green-deep); }
.nav__link.is-active { color: var(--green-deep); background: var(--green-soft); }

/* ---- team picker --------------------------------------------------------- */
.team { display: flex; align-items: center; gap: 6px; }
.team__label { font-size: 12px; font-weight: 600; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; }
.team__select {
  appearance: none;
  padding: 5px 26px 5px 10px;
  font-family: var(--body); font-size: 13px; font-weight: 600; color: var(--ink);
  background: var(--green-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpolyline points='4,6 8,10 12,6' stroke='%234a5a50' stroke-width='1.8' fill='none'/%3E%3C/svg%3E") no-repeat right 8px center;
  border: 1px solid var(--line); border-radius: 100px;
  cursor: pointer;
}
.team__select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

/* ---- manage team popover ------------------------------------------------- */
.team-manage { position: relative; }
.team-manage__btn { display: inline-flex; align-items: center; gap: 6px; }
.team-panel {
  position: absolute; z-index: 120; top: calc(100% + 8px); right: 0;
  width: 280px; padding: 16px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  animation: rise 0.12s ease both;
}
.team-panel.is-hidden { display: none; }
.team-panel__title { margin: 0 0 10px; font-family: var(--display); font-size: 14px; font-weight: 600; }
.team-panel__empty { margin: 0 0 12px; font-size: 13px; color: var(--ink-faint); }
.team-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.team-list:empty { margin-bottom: 0; }
.team-member {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 8px; border-radius: var(--radius-sm);
}
.team-member:hover { background: var(--grey-soft); }
.team-member__name { font-size: 13px; color: var(--ink); }
.team-member__remove {
  appearance: none; cursor: pointer; display: inline-flex;
  padding: 4px; border: 0; background: none; color: var(--ink-faint);
  border-radius: 6px;
}
.team-member__remove:hover { color: var(--red); background: var(--red-soft); }
.team-panel__add { display: flex; flex-direction: column; gap: 8px; }
.team-panel__add .input { padding: 8px 12px; font-size: 14px; }
.team-panel__add .btn--go { align-self: stretch; }

/* ---- CRM layout ---------------------------------------------------------- */
.wrap--wide { max-width: 1040px; }

.crmbar {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 18px;
}
.input--search { flex: 1; padding: 10px 14px; }

/* ---- add-company inline form --------------------------------------------- */
.company-form {
  margin-bottom: 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.company-form.is-hidden { display: none; }
.company-form__inner { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.company-form__title { margin: 0 0 4px; font-family: var(--display); font-size: 15px; font-weight: 600; }
.company-form__actions { display: flex; gap: 8px; }

/* ---- board: accordion of company cards ----------------------------------- */
.board { display: flex; flex-direction: column; gap: 10px; }

.company {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.company.is-hidden { display: none; }
.company.is-flash { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

.company__head {
  width: 100%; appearance: none; background: none; border: 0; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  font-family: var(--body); text-align: left;
  border-bottom: 1px solid transparent;
  transition: background 0.1s ease;
}
.company__head:hover { background: var(--grey-soft); }
.company[aria-expanded="true"] .company__head,
.company__head[aria-expanded="true"] { border-bottom-color: var(--line); }

.company__chevron { flex: none; color: var(--ink-faint); transition: transform 0.15s ease; }
.company__head[aria-expanded="true"] .company__chevron { transform: rotate(180deg); }

.company__name { font-family: var(--display); font-size: 15px; font-weight: 600; flex: 1; }
.company__roll { font-size: 12px; color: var(--ink-faint); white-space: nowrap; }
.company__assignee { font-size: 12px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.company__actions-wrap { flex: none; }

.company__body { padding: 0; }
.company__body.is-hidden { display: none; }

/* ---- people list inside a company ---------------------------------------- */
.people { display: flex; flex-direction: column; }

.person { border-bottom: 1px solid var(--grey-soft); }
.person:last-child { border-bottom: 0; }

.person__summary {
  display: grid;
  grid-template-columns: 1fr 170px 140px 36px 36px;
  gap: 0 10px; align-items: center;
  padding: 10px 16px;
}

.person__cell { min-width: 0; }
.person__name { font-size: 14px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person__title-label { font-size: 12px; color: var(--ink-faint); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- read-only stage chip + assignee text on the row -------------------- */
.person__stage { /* uses .stage + .stage--{key}; already styled */ }
.person__assignee { font-size: 12px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- stage chip (standalone, e.g. tally badges) -------------------------- */
.stage {
  display: inline-block;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 100px;
  border: 0; letter-spacing: 0.01em; white-space: nowrap;
}
.stage--not_contacted, .stage--transferred { background: var(--grey-soft); color: var(--ink-soft); }
.stage--contacted, .stage--replied         { background: var(--green-soft); color: var(--green-deep); }
.stage--call_scheduled, .stage--meeting_scheduled { background: var(--amber-soft); color: var(--amber); }
.stage--quote_sent, .stage--quote_discussion      { background: var(--kraft-soft); color: var(--kraft); }
.stage--won  { background: var(--green-deep); color: #fff; }
.stage--lost { background: var(--red-soft); color: var(--red); }

/* ---- icon base ----------------------------------------------------------- */
.icon {
  width: 16px; height: 16px;
  stroke: currentColor; fill: none; stroke-width: 1.8;
  vertical-align: -3px; flex: none;
}

/* ---- small ghost-sm button (expand toggle) ------------------------------- */
.btn--ghost-sm {
  appearance: none; cursor: pointer; border: 1px solid var(--line); background: none;
  color: var(--ink-faint); border-radius: var(--radius-sm);
  padding: 4px 6px; display: inline-flex; align-items: center;
  transition: border-color 0.1s ease, color 0.1s ease;
}
.btn--ghost-sm:hover { border-color: var(--green); color: var(--green-deep); }
.btn--ghost-sm[aria-expanded="true"] .icon { transform: rotate(180deg); }

/* ---- menu button (three-dot) -------------------------------------------- */
.btn--menu {
  appearance: none; cursor: pointer; border: 0; background: none;
  padding: 4px 6px; color: var(--ink-faint); border-radius: var(--radius-sm);
  display: inline-flex; align-items: center;
  transition: background 0.1s ease, color 0.1s ease;
}
.btn--menu:hover { background: var(--grey-soft); color: var(--ink); }

/* ---- add-person button inside company body ------------------------------- */
.btn--add-person {
  display: flex; align-items: center; gap: 6px;
  width: 100%; margin: 0;
  padding: 10px 16px; border-radius: 0;
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  border-top: 1px dashed var(--line);
}
.btn--add-person:hover { color: var(--green-deep); background: var(--green-soft); }

/* ---- person detail (contact + timeline) ---------------------------------- */
.person__detail {
  padding: 12px 16px 16px;
  background: var(--paper);
  border-top: 1px solid var(--grey-soft);
}
.person__detail.is-hidden { display: none; }

.person__contact-lines { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.contact-line { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.contact-line__key { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); width: 56px; flex: none; }
.contact-line__val { font-family: var(--mono); color: var(--ink); }
.contact-line__val.is-empty { color: var(--ink-faint); font-style: italic; font-family: var(--body); }

/* ---- timeline ------------------------------------------------------------ */
.timeline { }
.timeline__list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }

.touch {
  display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap;
  font-size: 13px; color: var(--ink-soft);
  padding: 6px 8px; border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid var(--line);
}
.touch__icon { flex: none; color: var(--ink-faint); margin-top: 1px; }
.touch__seq { font-weight: 600; color: var(--ink); white-space: nowrap; }
.touch__date { color: var(--ink-faint); white-space: nowrap; }
.touch__who { color: var(--ink-soft); }
.touch__note { color: var(--ink); font-style: italic; }
.touch__move { font-size: 12.5px; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 4px; }
.touch__del { margin-left: auto; color: var(--ink-faint); }
.touch__del:hover { color: var(--red); background: var(--red-soft); }
.timeline__empty { font-size: 13px; color: var(--ink-faint); margin: 0 0 4px; }

/* ---- activity header ----------------------------------------------------- */
.timeline__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.timeline__title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); }
.btn--record-ix { padding: 6px 14px; font-size: 13px; }

/* ---- channel chips (reused by the record-interaction modal) -------------- */
.logbar__kind {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 100px;
  font-family: var(--body); font-size: 12px; font-weight: 600;
  border: 1px solid var(--line); background: none; color: var(--ink-soft);
  transition: background 0.1s ease, border-color 0.1s ease, color 0.1s ease;
}
.logbar__kind:hover { border-color: var(--green); color: var(--green-deep); }
.logbar__kind.is-selected { background: var(--green-soft); border-color: var(--green); color: var(--green-deep); }

/* ---- context menu (rename / delete) -------------------------------------- */
.menu {
  position: absolute; z-index: 100;
  min-width: 160px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  padding: 4px;
  animation: rise 0.12s ease both;
}
.menu__item {
  appearance: none; cursor: pointer;
  display: block; width: 100%; text-align: left;
  padding: 8px 12px; border: 0; background: none;
  font-family: var(--body); font-size: 13px; color: var(--ink);
  border-radius: 6px;
}
.menu__item:hover { background: var(--grey-soft); }
.menu__item--danger { color: var(--red); }
.menu__item--danger:hover { background: var(--red-soft); }

/* ---- add person inline form ---------------------------------------------- */
/* A distinct white card (not the --paper detail background) with its own
   heading, so it never reads as more fields of the person row above it. */
.add-person-form {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); margin: 10px 16px 14px; padding: 14px 16px;
}
.add-person-form__title {
  font-family: var(--display); font-size: 15px; font-weight: 600; margin: 0 0 12px; color: var(--ink);
}
.add-person-form__grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-bottom: 12px;
}
.add-person-form__actions { display: flex; gap: 8px; }

/* ---- responsive overrides for CRM -------------------------------------- */
@media (max-width: 560px) {
  /* Two-row layout: name + both icon buttons on row 1; the read-only stage chip
     and assignee text flow onto row 2 so neither collides with the 36px icons. */
  .person__summary {
    grid-template-columns: 1fr auto auto;
    grid-template-areas:
      "name   expand menu"
      "stage  assignee assignee";
    row-gap: 6px;
    align-items: center;
  }
  .person__cell--name     { grid-area: name; }
  .person__cell--expand   { grid-area: expand; }
  .person__cell--menu     { grid-area: menu; }
  .person__cell--stage    { grid-area: stage; justify-self: start; }
  .person__cell--assignee { grid-area: assignee; justify-self: start; }
  .crmbar { flex-direction: column; align-items: stretch; }
  .add-person-form__grid { grid-template-columns: 1fr; }
  .crm-form__fields { grid-template-columns: 1fr; }
}

/* ---- Save to CRM inline form on finder cards ---------------------------- */
.crm-form {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding: 14px 0 4px;
  margin-top: 4px;
}
.crm-form.is-hidden { display: none; }
.crm-form__fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px 14px;
  margin-bottom: 12px;
}
.crm-form__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.crm-form__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
}
.crm-form__input {
  font-family: var(--body);
  font-size: 13px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  width: 100%;
  box-sizing: border-box;
}
.crm-form__input:focus { outline: none; border-color: var(--green); }
.crm-form__footer {
  display: flex;
  gap: 8px;
  align-items: center;
}
.crm-form__cancel {
  appearance: none;
  background: none;
  border: none;
  font-family: var(--body);
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 4px 6px;
}
.crm-form__cancel:hover { color: var(--ink); }
.toast__link { color: inherit; text-decoration: underline; }

/* ---- record-interaction modal -------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal.is-hidden { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(21, 36, 27, 0.45); }
.modal__card {
  position: relative; width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  padding: 18px 18px 16px; animation: rise 0.12s ease both;
}
.modal__head { display: flex; align-items: center; justify-content: space-between; }
.modal__title { font-family: var(--display); font-size: 17px; font-weight: 600; margin: 0; color: var(--ink); }
.modal__sub { margin: 2px 0 14px; font-size: 13px; color: var(--ink-faint); }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.ix-kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.ix-current { margin: 0 0 8px; font-size: 13px; color: var(--ink-soft); }
.ix-changeto { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 4px; }
.ix-preview { margin: 8px 0 0; font-size: 13px; }
.ix-preview.is-hidden { display: none; }
.modal .field { margin-bottom: 14px; }
/* Edit-person modal: two-column field grid (the gap supplies the spacing, so
   the shared .field margin is dropped inside it to avoid doubling up). */
.person-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.person-fields .field { margin-bottom: 0; }
@media (max-width: 560px) {
  .modal { align-items: flex-end; }
  .modal__card { width: 100vw; max-height: 88vh; border-radius: 14px 14px 0 0; }
  .person-fields { grid-template-columns: 1fr; }
}
