/* ============================================================
   Wardrop Digital — Coda-inspired design system
   Cream parchment canvas, hairline borders instead of shadows,
   charcoal-only CTAs, mono pill badges, one forest-green band.
   ============================================================ */

:root {
  /* Surface */
  --bg: #f8f9eb;             /* cream parchment — the canvas */
  --card: #ffffff;
  --card-solid: #ffffff;
  --line: #c0c2a9;           /* sage mist hairlines */
  --line-soft: #edeee1;      /* bone — near-canvas divider */

  /* Ink */
  --text: #000000;           /* obsidian */
  --charcoal: #202020;
  --muted: #5a5a4f;          /* olive slate */
  --faint: #7c7d76;          /* pebble */

  /* The only "accent" is ink — no chromatic CTAs */
  --primary: #202020;
  --primary-deep: #000000;
  --primary-wash: #edeee1;

  /* Brand band + pastel punctuation */
  --forest: #003d21;
  --mint: #aafdc0;
  --cobalt: #041668;
  --plum: #2d0078;
  --wine: #3f0929;
  --lilac: #d3beff;
  --sky: #b0f4ff;
  --rose: #ffc0e6;

  --danger: #3f0929;
  --coral: #3f0929;
  --coral-wash: #ffe4f3;

  /* Stage inks (dots, bars, chart segments) */
  --c-new: #041668;
  --c-engaged: #2d0078;
  --c-setup: #aafdc0;
  --c-won: #003d21;
  --c-not-interested: #c0c2a9;
  --c-no-answer: #3f0929;
  --c-follow-up: #2d0078;

  /* Temperature inks — hot reads red, warm reads orange, cold reads blue */
  --c-cold: #041668;
  --c-warm: #c26a00;
  --c-hot: #a81c0c;
  --hot-wash: #ffcdc2;
  --warm-wash: #ffe0ae;
  --hot-ink: #8f1a0f;
  --warm-ink: #7a4300;

  --radius: 22px;            /* cards */
  --radius-sm: 13px;         /* buttons */
  --shadow: none;            /* elevation comes from outline, not shadow */
  --shadow-lift: none;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  font-family: "Archivo", "Space Grotesk", "Inter Tight", -apple-system, sans-serif;
  font-size: 15px;
  color: var(--charcoal);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

/* ---------------------------------------------------------------- sidebar
   The app's one Forest Depths band — every other surface stays cream. */

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 236px; z-index: 40;
  display: flex; flex-direction: column;
  padding: 22px 14px 18px;
  background: var(--forest);
  border-right: none;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 24px; }
.brand-mark {
  width: 27px; height: 27px; border-radius: 9px; flex-shrink: 0;
  background: var(--mint);
  border: 2px solid #000000;
}
.brand-text {
  font-weight: 800; font-size: 15px; letter-spacing: -.01em; line-height: 1.02;
  text-transform: uppercase; color: var(--bg);
}

.sidenav { display: flex; flex-direction: column; gap: 4px; }

.navlink {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: rgba(248, 249, 235, .72); font-weight: 600; font-size: 14.5px;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.navlink:hover { background: rgba(248, 249, 235, .1); color: var(--bg); }
.navlink.on { background: var(--bg); color: var(--text); }
.navlink.on::before { content: none; }
.navicon { width: 19px; height: 19px; flex-shrink: 0; display: grid; place-items: center; }
.navicon svg { width: 19px; height: 19px; }
.navlink.on .navicon { color: var(--text); }
.navtext { white-space: nowrap; }

.navcount {
  margin-left: auto; min-width: 21px; padding: 2px 8px; border-radius: 999px;
  background: var(--mint); color: var(--forest);
  font-family: var(--mono); font-size: 10.5px; font-weight: 700; text-align: center;
}
.navcount-red { background: var(--rose); color: var(--wine); }
.navcount-amber { background: var(--lilac); color: var(--plum); }

.sidefoot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.navlink-ask { font-size: 14px; }

.btn-add {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px; border-radius: var(--radius-sm); font-weight: 700;
}

.whoami {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  background: transparent;
  border: 1.5px solid rgba(248, 249, 235, .28);
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--mint); border: 1.5px solid #000;
  color: #000; font-weight: 800; font-size: 13px;
}
.whoami-name { font-weight: 600; font-size: 14px; color: var(--bg); overflow: hidden; text-overflow: ellipsis; }
.iconbtn {
  margin-left: auto; border: none; background: none; padding: 4px; cursor: pointer;
  color: rgba(248, 249, 235, .6); border-radius: 8px; display: grid; place-items: center;
  transition: color .18s var(--ease), background .18s var(--ease);
}
.iconbtn svg { width: 17px; height: 17px; }
.iconbtn:hover { color: var(--bg); background: rgba(248, 249, 235, .12); }

main { padding: 30px 34px 60px; }
main.withnav { margin-left: 236px; }
body.bare main { margin: 0; }

@media (max-width: 900px) {
  .sidebar { width: 64px; padding: 18px 8px; }
  .sidebar .navtext, .sidebar .brand-text, .whoami-name { display: none; }
  .navlink, .whoami { justify-content: center; }
  .navcount { position: absolute; top: 4px; right: 4px; margin: 0; }
  main.withnav { margin-left: 64px; padding: 22px 18px 50px; }
}

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

.page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 18px; flex-wrap: wrap; margin-bottom: 24px;
}
.page-head h1 {
  margin: 0; font-size: 40px; font-weight: 800;
  letter-spacing: -.01em; line-height: .95; text-transform: uppercase;
  color: var(--text);
}
.subtitle { margin: 7px 0 0; color: var(--muted); font-size: 14.5px; }
.head-actions { display: flex; gap: 8px; align-items: center; }

.card {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: none;
}
.card h2, .tile-title, .section-title {
  margin: 0 0 14px; font-family: var(--mono); font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .09em; color: var(--faint);
}
.section-title { margin: 30px 0 14px; }

/* Entrance animation */
.rise { opacity: 0; }
.rise-in { animation: rise .5s var(--ease) forwards; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- controls */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px; border: 1.5px solid var(--line);
  border-radius: 9px; background: var(--card-solid); color: var(--charcoal);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease);
}
.btn:hover { background: var(--line-soft); border-color: var(--text); box-shadow: none; transform: none; }
.btn:active { transform: none; }
.btn-primary {
  background: var(--charcoal);
  border-color: var(--charcoal); border-radius: var(--radius-sm);
  color: #fff; box-shadow: none;
}
.btn-primary:hover { background: #2e2e2e; border-color: #2e2e2e; color: #fff; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn-quiet:hover { background: var(--line-soft); border-color: transparent; box-shadow: none; }
.btn-tiny { padding: 3px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; justify-content: center; padding: 12px; }
.btn-won { background: var(--forest); border-color: var(--forest); color: var(--mint); }
.btn-lost { background: var(--line-soft); border-color: var(--line); color: var(--muted); }
.btn-danger { background: var(--wine); border-color: var(--wine); color: #fff; }
.btn-danger:hover { background: #571037; border-color: #571037; }
.btn-danger-quiet { color: var(--wine); }
.btn-danger-quiet:hover { background: var(--coral-wash); }
.btn-call { font-weight: 600; }

/* The sidebar's CTA sits on forest — invert to cream, keep it monochrome */
.sidebar .btn-primary { background: var(--bg); border-color: var(--bg); color: var(--text); }
.sidebar .btn-primary:hover { background: #fff; border-color: #fff; }

input, select, textarea {
  padding: 8px 11px; border: 1.5px solid var(--line);
  border-radius: 9px; font: inherit; font-size: 14px;
  background: var(--card-solid); color: var(--charcoal);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--text);
  box-shadow: 0 0 0 3px var(--line-soft);
}
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input[type="search"] { min-width: 250px; }
.inline-form { display: inline-block; margin: 0; }
.inline-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 11px 0 0; line-height: 1.55; }
.hint-inline { font-weight: 400; color: var(--muted); }
.form-actions { display: flex; gap: 10px; }

/* ---------------------------------------------------------------- flashes & toast */

.flash {
  padding: 12px 18px; border-radius: var(--radius-sm); margin-bottom: 16px;
  font-weight: 600; font-size: 14px; border: 1.5px solid transparent;
  animation: rise .4s var(--ease);
}
.flash-success { background: var(--mint); color: var(--forest); border-color: transparent; }
.flash-error { background: var(--rose); color: var(--wine); border-color: transparent; }
.flash-warn { background: var(--lilac); color: var(--plum); border-color: transparent; }

.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 60;
  background: var(--charcoal); color: #fff; font-size: 14px; font-weight: 600;
  padding: 11px 20px; border-radius: 999px;
  box-shadow: none; border: 1.5px solid #000;
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.toast.show { opacity: 1; transform: none; }
.toast.toast-bad { background: var(--wine); border-color: var(--wine); }

/* ---------------------------------------------------------------- tables */

.table-wrap {
  background: var(--card);
  border: 1.5px solid var(--line); border-radius: var(--radius);
  box-shadow: none; overflow: auto;
  max-height: calc(100vh - 250px);
}
.table-wrap thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--card-solid);
}
.table-flat { max-height: 340px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 15px; text-align: left; white-space: nowrap; }
th {
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--faint); border-bottom: 1.5px solid var(--line);
}
tbody tr { border-bottom: 1px solid var(--line-soft); transition: background .16s var(--ease); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f4f5e9; }
.num, th.num { text-align: center; }
td.lead-name { font-weight: 700; }
td.lead-name a { color: var(--text); transition: color .16s var(--ease); }
td.lead-name a:hover { text-decoration: underline; text-underline-offset: 3px; }
td.cell-badge { padding: 6px 10px; }
th.tick, td.tick { width: 38px; padding-left: 15px; padding-right: 0; text-align: center; }
td.tick input, th.tick input { cursor: pointer; width: 15px; height: 15px; accent-color: var(--charcoal); }

tbody td:first-child { box-shadow: inset 3px 0 0 transparent; }
tr.row-new td:first-child { box-shadow: inset 3px 0 0 var(--c-new); }
tr.row-engaged td:first-child { box-shadow: inset 3px 0 0 var(--c-engaged); }
tr.row-setup-call-booked td:first-child { box-shadow: inset 3px 0 0 var(--c-setup); }
tr.row-won td:first-child { box-shadow: inset 3px 0 0 var(--c-won); }
tr.row-not-interested td:first-child { box-shadow: inset 3px 0 0 var(--c-not-interested); }

tr.overdue td { background: rgba(255, 192, 230, .14); }
tr.overdue:hover td { background: rgba(255, 192, 230, .24); }
tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--wine) !important; }
tr.overdue .lead-name a { color: var(--wine); }

.date-overdue { color: var(--wine); font-weight: 700; }
.overdue-tag {
  margin-left: 6px; font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  color: var(--wine); text-transform: uppercase; letter-spacing: .04em;
}
.due-tag { margin-left: 6px; font-family: var(--mono); font-size: 9.5px; font-weight: 700; color: var(--forest); text-transform: uppercase; }

th.draghead { cursor: grab; user-select: none; position: relative; }
th.draghead:hover { color: var(--text); }
th.draghead.dragging { opacity: .4; }
th.draghead.drop-left::before, th.draghead.drop-right::after {
  content: ""; position: absolute; top: 6px; bottom: 6px; width: 3px;
  border-radius: 2px; background: var(--text);
}
th.draghead.drop-left::before { left: -1px; }
th.draghead.drop-right::after { right: -1px; }

/* ---------------------------------------------------------------- pills
   Status is a mono system tag: pastel wash, dark ink, full pill. */

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 118px; padding: 6px 13px; border-radius: 999px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--charcoal); white-space: nowrap;
}
.badge-sm { min-width: 66px; padding: 5px 10px; font-size: 10px; }
.stage-new { background: var(--sky); color: var(--cobalt); }
.stage-engaged { background: var(--lilac); color: var(--plum); }
.stage-no-answer { background: var(--rose); color: var(--wine); }
.stage-follow-up { background: var(--lilac); color: var(--plum); }
.stage-setup-call-booked { background: var(--mint); color: var(--forest); }
.stage-won { background: var(--forest); color: var(--mint); }
.stage-not-interested { background: var(--line-soft); color: var(--faint); }
.temp-cold { background: var(--sky); color: var(--cobalt); }
.temp-warm { background: var(--warm-wash); color: var(--warm-ink); }
.temp-hot { background: var(--hot-wash); color: var(--hot-ink); }
.temp-none { background: transparent; color: var(--muted); border: 1.5px solid var(--line); }

.badge-select {
  appearance: none; -webkit-appearance: none; border: none;
  min-width: 118px; padding: 6px 13px; border-radius: 999px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .04em;
  text-align: center; text-align-last: center; cursor: pointer;
  transition: filter .16s var(--ease), box-shadow .16s var(--ease);
}
.badge-select option { background: #fff; color: var(--charcoal); font-family: "Archivo", sans-serif; text-transform: none; }
.badge-select.badge-sm { min-width: 66px; padding: 5px 10px; font-size: 10px; }
.badge-select:hover { filter: brightness(.96); }
.badge-select:focus { box-shadow: 0 0 0 3px var(--line-soft); outline: none; }
.badge-select.temp-none { color: var(--muted); border: 1.5px solid var(--line); font-weight: 500; }
.badge-select.temp-none:hover { background: var(--line-soft); }

.chip {
  display: inline-block; padding: 4px 11px; border-radius: 999px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .04em;
  background: var(--line-soft); color: var(--charcoal);
}
.chip-call { background: var(--lilac); color: var(--plum); }
.chip-sms { background: var(--sky); color: var(--cobalt); }
.chip-warn { background: var(--rose); color: var(--wine); }
.chip-email { background: var(--mint); color: var(--forest); }
.chip-select {
  appearance: none; -webkit-appearance: none; border: none;
  padding: 4px 11px; border-radius: 999px; font-family: var(--mono);
  font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em;
  background: var(--line-soft);
  color: var(--charcoal); text-align: center; text-align-last: center; cursor: pointer;
}
.inline-select, .inline-date {
  border-color: transparent; background: transparent; padding: 5px 7px; cursor: pointer;
}
.inline-select:hover, .inline-date:hover { border-color: var(--line); background: var(--card-solid); }
.inline-date { width: 148px; font-size: 14px; }
.inline-date.date-overdue { color: var(--wine); font-weight: 700; }
.saving { opacity: .5; }

.warn-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--rose); color: var(--wine); font-size: 11px; font-weight: 800;
}
.tel-link, .phone-copy {
  border: none; background: none; padding: 0; font: inherit;
  color: var(--text); font-weight: 700; cursor: pointer;
}
.phone-copy:hover { text-decoration: underline; text-underline-offset: 3px; }
.phone-copy.copied { color: var(--forest); text-decoration: none; }

/* ---------------------------------------------------------------- view chips & toggle */

.viewchips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.viewchip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 15px; border-radius: 999px;
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .04em;
  background: transparent; border: 1.5px solid var(--line); color: var(--charcoal);
  transition: all .18s var(--ease);
}
.viewchip:hover { border-color: var(--text); transform: none; box-shadow: none; color: var(--text); }
.viewchip span {
  background: var(--line-soft); color: var(--charcoal);
  border-radius: 999px; padding: 0 7px; font-size: 10px; font-weight: 700;
}
.viewchip.on { color: #fff; border-color: var(--charcoal); background: var(--charcoal); box-shadow: none; }
.viewchip.on span { background: rgba(255,255,255,.25); color: #fff; }
.vc-red.on, .vc-blue.on, .vc-purple.on, .vc-teal.on,
.vc-green.on, .vc-amber.on, .vc-slate.on { background: var(--charcoal); }

.layout-toggle {
  display: inline-flex; padding: 4px; gap: 3px;
  background: transparent; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
}
.layout-toggle a {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 14px; border-radius: 9px; font-size: 13.5px; font-weight: 600;
  color: var(--muted); transition: all .18s var(--ease);
}
.layout-toggle a:hover { color: var(--text); }
.layout-toggle a.on { background: var(--charcoal); color: #fff; box-shadow: none; }
.layout-toggle svg { width: 15px; height: 15px; }

/* ---------------------------------------------------------------- kanban */

.kanban { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; }
.kcol {
  flex: 0 0 288px; background: var(--line-soft);
  border: 1.5px solid transparent; border-radius: var(--radius); padding: 14px;
  transition: background .18s var(--ease), border-color .18s var(--ease);
}
.kcol.kover { background: var(--mint); border-color: var(--text); }
.kcol-head { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; }
.kcol-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.kcol-name { font-family: var(--mono); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.kcol-count {
  margin-left: auto; font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--muted);
  background: #fff; padding: 2px 9px; border-radius: 999px;
}
.kcard {
  background: var(--card-solid); border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); padding: 13px 14px; margin-bottom: 10px; cursor: grab;
  box-shadow: none;
  transition: border-color .16s var(--ease);
}
.kcard:hover { transform: none; box-shadow: none; border-color: var(--text); }
.kcard.dragging { opacity: .45; }
.kcard-name { font-weight: 700; font-size: 14.5px; display: block; color: var(--text); margin-bottom: 8px; }
.kcard-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.kcard-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.kcard-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft);
  font-size: 12px; color: var(--muted);
}
.kcol-empty { color: var(--faint); font-size: 13px; text-align: center; padding: 18px 0; }

/* ---------------------------------------------------------------- dashboard */

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.stat {
  position: relative; overflow: hidden;
  background: var(--card);
  border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: none;
  transition: border-color .18s var(--ease);
}
a.stat:hover { transform: none; box-shadow: none; border-color: var(--text); }
.stat-n {
  display: block; font-size: 44px; font-weight: 800;
  letter-spacing: -.01em; line-height: .95; color: var(--text);
}
.stat-l {
  display: block; margin-top: 8px; font-family: var(--mono); font-size: 10.5px;
  font-weight: 500; text-transform: uppercase; letter-spacing: .07em; color: var(--faint);
}
.stat::after { content: none; }
.stat-red .stat-n { color: var(--wine); }
.stat-blue .stat-n { color: var(--cobalt); }
.stat-amber .stat-n { color: var(--plum); }
.stat-green .stat-n { color: var(--forest); }
.stat-teal .stat-n { color: var(--cobalt); }
.stat-purple .stat-n { color: var(--plum); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
@media (max-width: 1080px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* Donut */
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut { position: relative; width: 148px; height: 148px; flex-shrink: 0; }
.donut svg { transform: rotate(-90deg); width: 148px; height: 148px; }
.donut circle { fill: none; stroke-width: 15; transition: stroke-dasharray .7s var(--ease); }
.donut-mid {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
}
.donut-mid b { display: block; font-size: 27px; font-weight: 800; letter-spacing: -.01em; }
.donut-mid span { font-family: var(--mono); font-size: 9.5px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.legend { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 150px; }
.legend-row { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; border: 1px solid rgba(0,0,0,.2); }
.legend-n { margin-left: auto; font-weight: 700; }
.legend-pct { color: var(--faint); font-family: var(--mono); font-size: 11px; width: 38px; text-align: right; }

/* Momentum bars */
.spark { display: flex; align-items: flex-end; gap: 6px; height: 132px; padding-top: 10px; }
.spark-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.spark-bar {
  width: 100%; border-radius: 4px 4px 2px 2px; min-height: 3px;
  background: var(--forest);
  animation: grow .6s var(--ease) backwards;
}
.spark-bar.zero { background: var(--line-soft); }
@keyframes grow { from { height: 0 !important; opacity: .3; } }
.spark-day { font-family: var(--mono); font-size: 9.5px; color: var(--faint); font-weight: 500; }

/* Funnel */
.funnel-row { display: flex; align-items: center; gap: 14px; margin-bottom: 11px; }
.funnel-label { width: 140px; flex-shrink: 0; font-weight: 600; font-size: 13.5px; }
.funnel-track { flex: 1; height: 26px; background: var(--line-soft); border-radius: 8px; overflow: hidden; }
.funnel-fill { height: 100%; border-radius: 8px; animation: widen .8s var(--ease) backwards; }
@keyframes widen { from { width: 0 !important; } }
.funnel-1 { background: var(--sky); }
.funnel-2 { background: var(--lilac); }
.funnel-3 { background: var(--mint); }
.funnel-4 { background: var(--forest); }
.funnel-n { width: 168px; flex-shrink: 0; font-size: 13px; text-align: right; }
.funnel-n .muted { color: var(--faint); }
.stagefill-new { background: var(--c-new); }
.stagefill-engaged { background: var(--c-engaged); }
.stagefill-setup-call-booked { background: var(--c-setup); }
.stagefill-won { background: var(--c-won); }
.stagefill-not-interested { background: var(--c-not-interested); }

.streak-badge {
  display: inline-flex; align-items: center; gap: 9px; font-size: 14px;
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: 999px; padding: 9px 19px; color: var(--muted); box-shadow: none;
}
.streak-badge.streak-on { background: var(--mint); border-color: transparent; color: var(--forest); }
.streak-badge strong { font-size: 18px; }
.streak-flame { font-size: 17px; }
.streak-on .streak-flame { animation: flicker 2.4s ease-in-out infinite; }
@keyframes flicker { 0%,100% { transform: scale(1); } 50% { transform: scale(1.16) rotate(-5deg); } }

.mini-list { display: flex; flex-direction: column; gap: 9px; }
.mini-row {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border-radius: var(--radius-sm); background: transparent; border: 1px solid var(--line-soft);
  font-size: 13.5px; transition: border-color .16s var(--ease);
}
.mini-row:hover { transform: none; border-color: var(--line); }
.mini-name { font-weight: 700; color: var(--text); }
.mini-when { margin-left: auto; color: var(--muted); font-size: 12.5px; white-space: nowrap; }

/* ---------------------------------------------------------------- lead detail */
.panel-followup { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.panel-followup-label {
  display: block; margin-bottom: 9px; font-family: var(--mono); font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .09em; color: var(--faint);
}
.panel-followup .followup-form { gap: 7px; }
.panel-followup select { flex: 0 0 74px; }
.panel-followup input[type=date] { flex: 1; min-width: 0; }
.panel-followup .hint { margin-top: 8px; font-size: 12px; }

.lead-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
@media (max-width: 1380px) { .lead-layout { grid-template-columns: 300px minmax(0, 1fr); } .lead-layout .workcol { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; } }
@media (max-width: 1080px) { .lead-layout { grid-template-columns: 1fr; } .lead-layout .workcol { grid-template-columns: 1fr; } }
.workcol { display: flex; flex-direction: column; gap: 18px; }

/* The conversation column */
.convo { padding: 0; display: flex; flex-direction: column; height: calc(100vh - 110px); min-height: 520px; overflow: hidden; }
.convo-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1.5px solid var(--line); flex-wrap: wrap; }
.seq-state { font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.seq-wait { color: var(--wine); }
.seq-off { color: var(--faint); }
.seq-actions { display: flex; gap: 6px; align-items: center; }
.convo .thread { padding: 16px 18px; }
.thread-empty { align-self: center; margin: auto 0; }
.record-reply { margin-top: auto; padding-top: 14px; align-self: stretch; }
.record-reply summary { cursor: pointer; color: var(--faint); font-size: 12.5px; list-style: none; }
.record-reply summary::before { content: '+ '; }
.record-reply[open] summary::before { content: '– '; }
.record-reply form { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.lead-send { padding: 12px 18px 6px; align-items: flex-end; }
.send-main { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.send-main textarea { width: 100%; }
.send-chip { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; font-size: 12px; color: var(--plum); background: var(--lilac); padding: 3px 6px 3px 10px; border-radius: 999px; }
.send-chip[hidden] { display: none; }
.chip-x { border: 0; background: transparent; color: inherit; font-size: 15px; line-height: 1; cursor: pointer; padding: 0 4px; }
.send-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 0 18px 12px; min-height: 30px; }
.send-tools .hint, .send-tools .action-hint { margin: 0; }
.send-tools select { padding: 4px 8px; font-size: 13px; }

/* The panel is taller than the viewport on a worked lead — it scrolls on its
   own: put the pointer over it and the wheel moves the panel, not the page. */
.lead-panel {
  position: sticky; top: 30px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.lead-panel::-webkit-scrollbar { width: 8px; }
.lead-panel::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 4px;
}
.lead-panel:hover::-webkit-scrollbar-thumb { background: var(--faint); }
.panel-name {
  margin: 0 0 6px; font-size: 23px; font-weight: 800;
  letter-spacing: -.01em; line-height: 1.02; text-transform: uppercase;
  color: var(--text);
}
.panel-avatar {
  width: 62px; height: 62px; border-radius: var(--radius-sm); margin: 0 auto 14px;
  display: grid; place-items: center; font-size: 26px; font-weight: 800; color: #000;
  background: var(--mint);
  border: 2px solid #000; box-shadow: none;
}
.panel-top { text-align: center; padding-bottom: 18px; border-bottom: 1px solid var(--line-soft); }
.panel-phone { font-size: 16px; font-weight: 700; margin-top: 6px; display: inline-block; }
.panel-fields { display: flex; flex-direction: column; gap: 13px; padding-top: 18px; }
.panel-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-field > span { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 500; }
.panel-links { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.panel-actions {
  display: flex; gap: 7px; flex-wrap: wrap; justify-content: center;
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-soft);
}
.panel-next {
  margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--sky); color: var(--cobalt); font-size: 13.5px; text-align: center;
}
.panel-next.is-overdue { background: var(--rose); color: var(--wine); }
.panel-pinned { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.pinned-note {
  background: var(--line-soft); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 13px; font-size: 13px; white-space: pre-wrap; line-height: 1.5;
}

/* Two real columns, each its own drop target */
.tile-card { position: relative; cursor: grab; transition: border-color .18s var(--ease); }
.tile-card:active { cursor: grabbing; }
.tile-card input, .tile-card select, .tile-card textarea,
.tile-card button, .tile-card a, .tile-card .note-item, .tile-card .msg-box { cursor: auto; }
.tile-card button, .tile-card a, .tile-card select { cursor: pointer; }
.tile-card.dragging { opacity: .45; }
.tile-card.tile-over { outline: 2px dashed var(--text); outline-offset: 4px; }
.tile-title { user-select: none; display: flex; align-items: center; gap: 7px; }
.tile-title::before { content: "⠿"; opacity: .4; letter-spacing: 0; }
.tile-title:hover { color: var(--text); }
.tile-title-sub { margin-top: 24px; }
.tile-card[data-tile="notes"] { border-top: 3px solid var(--text); }
.card-accent-teal { border-left: 3px solid var(--c-setup); }

.callrow { display: flex; flex-direction: column; gap: 9px; align-items: flex-start; }
.callrow textarea { width: 100%; align-self: stretch; }
.callrow .action-row { margin-bottom: 0; }
.action-row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-bottom: 11px; }
.action-hint { color: var(--muted); font-size: 13px; }
.action-note { flex: 1; min-width: 150px; }
.followup-form { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.fu-draft { margin-top: 8px; }

dl { display: grid; grid-template-columns: 120px 1fr; gap: 9px 12px; margin: 0; font-size: 14px; }
dt { color: var(--muted); font-weight: 600; }
dd { margin: 0; }
.notes { white-space: pre-wrap; margin: 0; }

/* Notes */
.note-form { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; }
.note-form textarea { flex: 1; }
.note-form-block { flex-direction: column; align-items: stretch; gap: 9px; }
.note-form-block textarea { width: 100%; }
.note-form-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mention-toggle { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.mention {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  background: var(--lilac); color: var(--plum);
}
.mention-out { background: var(--line-soft); color: var(--muted); }

.note-list { list-style: none; margin: 0; padding: 0; }
.note-item {
  border: 1.5px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 13px 15px; margin-bottom: 10px; background: var(--card-solid);
  transition: border-color .16s var(--ease);
}
.note-item:hover { box-shadow: none; border-color: var(--line); }
.note-pinned { border-color: var(--line); background: var(--line-soft); }
.note-body { white-space: pre-wrap; margin-bottom: 9px; line-height: 1.55; }
.note-meta {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  align-items: center; color: var(--faint); font-size: 12px;
}
.note-actions { display: flex; gap: 6px; }

.question-open {
  border: 1.5px solid var(--sky); background: #eefcff;
  border-radius: var(--radius-sm); padding: 15px 17px; margin-bottom: 13px;
}
.question-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 9px; }
.question-body { white-space: pre-wrap; margin-bottom: 11px; font-weight: 500; line-height: 1.55; }
.question-card { border-left: 3px solid var(--cobalt); }
.msg-question { border-left: 3px solid var(--cobalt); }

/* Activity — long histories collapse behind a See all button */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline.clamped { max-height: 360px; overflow: hidden; position: relative; }
.timeline.clamped::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 64px;
  background: linear-gradient(180deg, rgba(255,255,255,0), rgba(255,255,255,.94));
  pointer-events: none;
}
.timeline.clamped.open {
  max-height: 60vh; overflow-y: auto; overscroll-behavior: contain;
}
.timeline.clamped.open::after { display: none; }
.seemore { margin-top: 12px; }
.activity { padding: 13px 0 13px 18px; border-bottom: 1px solid var(--line-soft); position: relative; }
.activity::before {
  content: ""; position: absolute; left: 0; top: 19px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--line);
}
.activity-created::before { background: var(--c-new); }
.activity-note::before { background: var(--c-engaged); }
.activity-stage_change::before { background: var(--c-setup); border: 1px solid rgba(0,0,0,.25); }
.activity-temperature_change::before { background: var(--c-warm); }
.activity-followup_scheduled::before { background: var(--c-won); }
.activity-call_attempt::before, .activity-call_answered::before { background: var(--wine); }
.activity:last-child { border-bottom: none; }
.activity-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.activity-type { font-weight: 700; font-size: 13px; }
.activity-when { color: var(--faint); font-family: var(--mono); font-size: 10.5px; }
.activity-detail { margin-top: 4px; white-space: pre-wrap; font-size: 13.5px; line-height: 1.55; }
.seq-status { margin: 0 0 12px; font-size: 14px; }

/* Editing lead details in place */
.pencil {
  border: none; background: none; cursor: pointer; padding: 0 4px;
  color: var(--faint); font-size: 12px; line-height: 1;
  opacity: 0; transition: opacity .15s var(--ease), color .15s var(--ease);
}
.lead-panel:hover .pencil, .pencil:focus { opacity: 1; }
.pencil:hover { color: var(--text); }
.field-edit { margin: 6px 0; text-align: left; }
.field-edit input {
  width: 100%; font: inherit; font-size: 13px; padding: 7px 10px;
  border: 1.5px solid var(--text); border-radius: 9px;
  background: var(--card-solid);
}
.field-edit-actions { display: flex; gap: 6px; margin-top: 6px; }
.field-edit label {
  display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px;
  font-family: var(--mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); text-align: left;
}
.panel-email { margin-top: 7px; font-size: 13.5px; font-weight: 600; }
.panel-email a { color: var(--charcoal); }
.panel-email a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Sortable column headers */
.sortlink {
  color: inherit; text-decoration: none; display: inline-flex;
  align-items: center; gap: 4px;
}
.sortlink:hover { color: var(--text); }
th.sorted { color: var(--text); }
.sortmark { font-size: 10px; opacity: .85; }
.table-wrap thead th.num .sortlink { justify-content: flex-end; }

/* Editing a note in place */
.note-edit { margin: 4px 0 2px; }
.note-edit textarea {
  width: 100%; font: inherit; font-size: 13px; line-height: 1.5;
  padding: 8px 10px; border: 1.5px solid var(--text); border-radius: 9px;
  background: var(--card-solid); resize: vertical;
}
.note-edit-actions { display: flex; gap: 6px; margin-top: 6px; }

/* Follow-up presets */
.fu-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.chip-preset {
  border: 1.5px solid var(--line); background: transparent; color: var(--charcoal);
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .04em; padding: 4px 11px;
  border-radius: 999px; cursor: pointer;
  transition: all .16s var(--ease);
}
.chip-preset:hover { color: var(--text); border-color: var(--text); background: var(--line-soft); }
.chip-clear { color: var(--wine); }
.chip-clear:hover { color: var(--wine); border-color: var(--wine); background: var(--coral-wash); }
.fu-seq { margin-top: 10px; }
.dp-input { cursor: pointer; }

/* The in-app calendar — bordered like a blueprint, never clipped */
.dp-pop {
  position: fixed; z-index: 60;
  background: var(--card-solid); border: 1.5px solid var(--text);
  border-radius: var(--radius-sm); box-shadow: none; padding: 13px;
  animation: rise .18s var(--ease);
  width: 268px;
}
.dp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; font-weight: 700; font-size: 14px; }
.dp-nav {
  border: none; background: none; font: inherit; font-size: 16px; font-weight: 700;
  color: var(--muted); cursor: pointer; padding: 2px 9px; border-radius: 8px;
}
.dp-nav:hover { background: var(--line-soft); color: var(--text); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.dp-dow { color: var(--faint); font-family: var(--mono); font-weight: 500; font-size: 9.5px; padding: 3px 0; }
.dp-day { padding: 6px 0; border-radius: 8px; cursor: pointer; font-size: 12.5px; font-weight: 600; }
.dp-day:hover { background: var(--line-soft); }
.dp-day.dp-off { color: var(--faint); opacity: .4; cursor: default; }
.dp-day.dp-off:hover { background: none; }
.dp-day.dp-past { opacity: .5; }
.dp-day.dp-today { box-shadow: inset 0 0 0 1.5px var(--text); }
.dp-day.dp-sel { background: var(--charcoal); color: #fff; }

/* Payments */
.owed-badge {
  text-align: right; background: var(--card); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 12px 20px; box-shadow: none;
}
.owed-badge.owed-live { border-color: transparent; background: var(--mint); }
.owed-label { display: block; font-family: var(--mono); font-size: 9.5px; font-weight: 500; text-transform: uppercase;
              letter-spacing: .09em; color: var(--faint); }
.owed-total { font-size: 28px; font-weight: 800; letter-spacing: -.01em; line-height: 1; }
.owed-live .owed-total { color: var(--forest); }
.owed-live .owed-label { color: var(--forest); }
.owed-line { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.owed-live .owed-line { color: var(--forest); }
.sale-tick { width: 16px; height: 16px; cursor: pointer; accent-color: var(--forest); }
.day-leads { margin-top: 12px; }

/* Dialogs */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center;
  background: rgba(32, 32, 32, .45);
  animation: rise .22s var(--ease);
}
.modal-backdrop[hidden] { display: none; }
.modal-card {
  width: min(440px, 92vw); background: var(--card-solid);
  border: 2px solid var(--text);
  border-radius: var(--radius); padding: 28px 30px; box-shadow: none;
}
.modal-title {
  margin: 0 0 20px; font-size: 24px; font-weight: 800;
  text-transform: uppercase; letter-spacing: -.01em; line-height: 1.02; color: var(--text);
}
.modal-card form { display: flex; flex-direction: column; gap: 14px; }
.modal-card label {
  display: flex; flex-direction: column; gap: 6px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 6px; }

/* Tour */
.tour-backdrop {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  background: rgba(32, 32, 32, .5);
  animation: rise .3s var(--ease);
}
.tour-card {
  width: min(460px, 92vw); background: var(--card-solid);
  border: 2px solid var(--text);
  border-radius: var(--radius); padding: 30px 32px; box-shadow: none;
}
.tour-card h2 { margin: 0 0 10px; font-size: 24px; font-weight: 800;
                text-transform: uppercase; letter-spacing: -.01em; line-height: 1.02; color: var(--text); }
.tour-card p { margin: 0; color: var(--muted); line-height: 1.6; }
.tour-dots { display: flex; gap: 6px; margin-bottom: 18px; }
.tour-dot { width: 22px; height: 4px; border-radius: 2px; background: var(--line-soft); transition: background .25s var(--ease); }
.tour-dot.on { background: var(--forest); }
.tour-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }

/* Stage colours for the split statuses */
.stage-no-response { background: var(--rose); color: var(--wine); }
.stage-in-conversation { background: var(--lilac); color: var(--plum); }
.stagefill-no-response { background: var(--c-no-answer); }
.stagefill-in-conversation { background: var(--c-engaged); }
tr.row-no-response td:first-child { box-shadow: inset 3px 0 0 var(--c-no-answer); }
tr.row-in-conversation td:first-child { box-shadow: inset 3px 0 0 var(--c-engaged); }

.pin-long { font-size: 13px; opacity: .75; }
.vc-slate.on { background: var(--charcoal); }
.panel-fb { display: block; margin-top: 7px; font-size: 13.5px; font-weight: 600; }
.sprint-nav { display: flex; gap: 8px; align-items: center; }

/* ---------------------------------------------------------------- sprint */

.sprint-bar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: var(--card);
  border: 1.5px solid var(--line); border-left: 3px solid var(--text);
  border-radius: var(--radius); padding: 14px 20px; margin-bottom: 20px;
  box-shadow: none;
}
.sprint-bar.sprint-final { border-left-color: var(--forest); }
.sprint-meta { display: flex; align-items: baseline; gap: 9px; }
.sprint-label { font-family: var(--mono); font-size: 9.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); }
.sprint-count { font-weight: 800; font-size: 15px; white-space: nowrap; }
.sprint-track { flex: 1; min-width: 150px; height: 9px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.sprint-fill {
  height: 100%; border-radius: 999px;
  background: var(--forest);
  transition: width .55s var(--ease);
}
.sprint-final .sprint-fill { background: var(--mint); }

.sprint-launch-row { display: flex; gap: 18px; flex-wrap: wrap; align-items: stretch; margin-bottom: 22px; }
.sprint-launch { text-align: center; width: 262px; }
.sprint-ring {
  width: 122px; height: 122px; margin: 0 auto 10px; border-radius: 50%;
  background: conic-gradient(var(--forest) calc(var(--pct) * 1%), var(--line-soft) 0);
  display: grid; place-items: center;
}
.sprint-ring-inner { width: 98px; height: 98px; border-radius: 50%; background: var(--card-solid); display: grid; place-items: center; }
.sprint-big { font-size: 40px; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.sprint-blurb { color: var(--muted); margin: 6px 0 16px; font-size: 14px; }
.sprint-facts { display: flex; flex-direction: column; gap: 9px; justify-content: center; }
.fact {
  background: var(--card); border: 1.5px solid var(--line); border-left: 3px solid var(--line);
  border-radius: var(--radius-sm); padding: 9px 17px; font-size: 14px; color: var(--muted); min-width: 158px;
}
.fact strong { color: var(--text); font-size: 18px; margin-right: 6px; font-weight: 800; }
.fact-hot { border-left-color: var(--c-hot); }
.fact-cool { border-left-color: var(--cobalt); }

.sprint-complete { text-align: center; max-width: 430px; margin: 8vh auto 0; padding: 44px 26px; }
.sprint-complete h1 { margin: 14px 0 0; }
.sprint-complete-actions { justify-content: center; }
.sprint-tick {
  width: 76px; height: 76px; margin: 0 auto; border-radius: 50%;
  background: var(--mint); color: var(--forest); border: 2px solid var(--forest);
  font-size: 40px; display: grid; place-items: center;
  animation: pop .5s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------------------------------------------------------------- queues, settings, misc */

.queue-list { display: flex; flex-direction: column; gap: 14px; }
.queue-item { padding: 17px 20px; }
.queue-item-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.queue-name { font-weight: 800; font-size: 16px; color: var(--text); }
.queue-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.queue-biz { color: var(--muted); margin-left: 8px; }
.queue-meta { display: flex; gap: 10px; align-items: center; }
.queue-phone { font-weight: 600; }
.queue-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.msg-box {
  background: var(--line-soft); border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 13px 15px; margin: 12px 0;
  white-space: pre-wrap; line-height: 1.55;
}
.msg-reply { border-left: 3px solid var(--plum); }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 1.5px solid var(--line); }
.tab {
  padding: 10px 17px; font-weight: 600; font-size: 14px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1.5px; transition: all .18s var(--ease);
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--text); }
.count { display: inline-block; min-width: 19px; padding: 1px 7px; border-radius: 999px;
         background: var(--rose); color: var(--wine); font-family: var(--mono); font-size: 10px; font-weight: 700; text-align: center; }
.count-amber { background: var(--lilac); color: var(--plum); }
.count-green { background: var(--mint); color: var(--forest); }
.count-blue { background: var(--sky); color: var(--cobalt); }

.settings-card { margin-bottom: 18px; }
.settings-row { display: flex; gap: 13px; align-items: flex-start; margin-bottom: 13px; }
.settings-step {
  flex-shrink: 0; width: 27px; height: 27px; display: grid; place-items: center;
  border-radius: 50%; background: var(--charcoal); color: #fff;
  font-family: var(--mono); font-weight: 500; font-size: 12px; margin-top: 7px;
}
.settings-row textarea { flex: 1; }
.settings-delay { color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; margin-top: 8px; }
.settings-delay input { width: 62px; }
.upload-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-spaced { margin-top: 18px; }
.hint code { line-height: 2; }
.map-table { width: 100%; font-size: 14px; }
.map-table th { text-align: left; padding: 7px 11px; }
.map-table td { padding: 6px 11px; }
.map-field { font-weight: 700; white-space: nowrap; }
.map-req { color: var(--muted); font-weight: 400; font-size: 12px; }
.opt-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 9px; }
.opt-sep { margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line-soft); }
code {
  background: var(--line-soft); border: 1px solid transparent;
  border-radius: 7px; padding: 2px 7px;
  font-family: var(--mono); font-size: 12.5px; word-break: break-all;
}

.lead-form fieldset {
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 18px 22px 22px; margin: 0 0 18px; box-shadow: none;
}
.lead-form legend { font-weight: 700; padding: 0 7px; }
.lead-form .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 15px; }
.lead-form label { display: flex; flex-direction: column; gap: 6px; font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 500; }
.lead-form textarea { width: 100%; }

.customise-card { margin-bottom: 18px; }
.col-list { list-style: none; margin: 0 0 15px; padding: 0; max-width: 420px; }
.col-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 8px 12px; border: 1.5px solid var(--line-soft);
  border-radius: 9px; margin-bottom: 6px; background: var(--card-solid);
}
.col-list li.col-off { opacity: .5; }
.col-list label { display: flex; align-items: center; gap: 9px; font-weight: 500; }

.bulk-bar {
  display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
  background: var(--mint); border: 1.5px solid var(--forest);
  border-radius: var(--radius-sm); padding: 11px 18px; margin-bottom: 14px;
  position: sticky; top: 0; z-index: 8; animation: rise .3s var(--ease);
}
.bulk-count { font-size: 14px; color: var(--forest); }
.bulk-count strong { font-size: 16px; }
.bulk-value { display: inline-flex; }
.bulk-bar[hidden], .bulk-value[hidden] { display: none; }

.delete-card { max-width: 540px; margin: 6vh auto 0; text-align: center; }
.delete-card-wide { max-width: 640px; }
.delete-card h1 { margin: 0 0 7px; font-size: 23px; }
.delete-name { font-size: 18px; font-weight: 800; margin: 0 0 15px; }
.delete-card .queue-actions { justify-content: center; margin-top: 20px; }
.delete-list {
  list-style: none; margin: 17px 0; padding: 0; text-align: left;
  max-height: 260px; overflow-y: auto; border: 1.5px solid var(--line-soft); border-radius: var(--radius-sm);
}
.delete-list li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 13px; border-bottom: 1px solid var(--line-soft); font-size: 14px;
}
.delete-list li:last-child { border-bottom: none; }
.delete-stage { color: var(--muted); font-size: 12px; white-space: nowrap; }

.login-wrap { display: flex; justify-content: center; padding-top: 12vh; }
.login-card { width: 390px; border: 2px solid var(--text); }
.login-card h1 { margin: 0 0 5px; font-size: 26px; font-weight: 800; text-transform: uppercase; letter-spacing: -.01em; line-height: 1.02; }
.login-card form { display: flex; flex-direction: column; gap: 13px; margin-top: 20px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 500; color: var(--muted); }

.empty {
  text-align: center; padding: 64px 22px;
  background: transparent; border: 1.5px dashed var(--line);
  border-radius: var(--radius); color: var(--muted);
}
.empty-win { border-style: solid; background: var(--card); }
.empty-emoji { font-size: 46px; margin-bottom: 10px; }
.empty .btn { margin-top: 10px; }
.empty-small { color: var(--muted); font-size: 14px; }
.flag-banner {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--lilac); border: 1.5px solid transparent; border-radius: var(--radius);
  padding: 12px 18px; margin-bottom: 18px; font-weight: 500; color: var(--plum);
}
.import-box { width: 100%; font-family: var(--mono); font-size: 12px; }
.import-steps { margin: 0 0 15px; padding-left: 20px; color: var(--muted); }

/* ---------------------------------------------------------------- inbox */

.inbox {
  display: grid; grid-template-columns: 340px 1fr; grid-template-rows: 100%; gap: 0;
  height: calc(100vh - 90px); min-height: 480px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.inbox-list { display: flex; flex-direction: column; border-right: 1.5px solid var(--line); min-width: 0; min-height: 0; }
.inbox-list-head { padding: 16px 14px 10px; display: flex; flex-direction: column; gap: 10px; }
.inbox-list-head .btn-primary { align-self: flex-start; border-radius: 999px; padding: 9px 18px; }
.inbox-search input { width: 100%; }
.inbox-filters { display: flex; gap: 6px; }
.chip-link {
  font-size: 12.5px; font-weight: 600; color: var(--muted); text-decoration: none;
  padding: 4px 11px; border-radius: 999px; border: 1.5px solid transparent;
}
.chip-link:hover { background: var(--line-soft); }
.chip-link.on { background: var(--primary-wash); border-color: var(--line); color: var(--text); }
.chip-link b { color: var(--wine); }
.needs-rob {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 9px 22px; background: var(--rose); color: var(--wine); font-size: 13px; font-weight: 600;
}
.inbox-rows { flex: 1 1 0; min-height: 0; overflow-y: auto; }
.inbox-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  color: inherit; text-decoration: none; border-top: 1px solid var(--line-soft);
  transition: background .12s var(--ease);
}
.inbox-row:hover { background: var(--line-soft); }
.inbox-row.on { background: var(--primary-wash); }
.avatar {
  flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%;
  background: var(--forest); color: var(--mint);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}
.inbox-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.inbox-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.inbox-name { font-weight: 500; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-when { flex: none; color: var(--faint); font-size: 12px; }
.inbox-preview { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-row.unread .inbox-name, .inbox-row.unread .inbox-preview { font-weight: 700; color: var(--text); }
.unread-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #e8a0a8; }
.inbox-empty-list { padding: 14px; }
.inbox-more { display: block; margin: 10px auto; width: max-content; }
.inbox-list-foot { padding: 8px 10px; border-top: 1px solid var(--line-soft); }

.pill {
  display: inline-block; font-family: var(--mono); font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; padding: 1px 7px; border-radius: 999px; margin-left: 6px; vertical-align: middle;
}
.pill-lead { background: var(--lilac); color: var(--plum); }
.pill-failed { background: var(--rose); color: var(--wine); margin-left: 4px; }

.inbox-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.inbox-pane-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 16px 22px; border-bottom: 1.5px solid var(--line);
}
.inbox-title { margin: 0; font-size: 18px; font-weight: 700; text-transform: none; letter-spacing: 0; font-family: inherit; color: var(--text); }
.inbox-sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.rename-form { display: inline-flex; gap: 6px; align-items: center; }
.rename-form input { width: 200px; padding: 5px 9px; font-size: 13px; }

.thread { flex: 1 1 0; min-height: 0; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 6px; }
.thread-day { align-self: center; color: var(--faint); font-size: 12px; margin: 12px 0 6px; }
.bubble-row { display: flex; flex-direction: column; max-width: 68%; }
.bubble-row.in { align-self: flex-start; align-items: flex-start; }
.bubble-row.out { align-self: flex-end; align-items: flex-end; }
.bubble {
  padding: 10px 14px; border-radius: 18px; line-height: 1.45; font-size: 14.5px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.bubble-row.in .bubble { background: var(--line-soft); color: var(--text); border-bottom-left-radius: 5px; }
.bubble-row.out .bubble { background: var(--charcoal); color: #fff; border-bottom-right-radius: 5px; }
.bubble-meta { color: var(--faint); font-size: 11.5px; margin: 3px 6px 0; }

.send-box {
  display: flex; gap: 10px; align-items: flex-end; padding: 14px 22px;
  border-top: 1.5px solid var(--line); background: var(--card);
}
.send-box textarea { flex: 1; resize: none; border-radius: 22px; padding: 10px 16px; max-height: 160px; }
.send-box .btn { border-radius: 999px; }

.inbox-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: var(--faint);
}

.compose { padding: 22px; display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.compose label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; }
.compose-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

@media (max-width: 900px) {
  .inbox { grid-template-columns: 1fr; height: auto; }
  .inbox-list { border-right: 0; border-bottom: 1.5px solid var(--line); max-height: 50vh; }
  .inbox-pane { min-height: 60vh; }
  /* On a phone with nothing open, the list is the whole page */
  .inbox.inbox-listonly { min-height: 0; }
  .inbox.inbox-listonly .inbox-list { max-height: none; border-bottom: 0; }
  .inbox.inbox-listonly .inbox-rows { flex: none; overflow: visible; }
  .inbox.inbox-listonly .inbox-pane { display: none; }
  /* ...and with one open, the conversation is the whole page, with a way back */
  .inbox.inbox-convonly .inbox-list { display: none; }
  .inbox.inbox-convonly .inbox-pane { min-height: calc(100vh - 150px); }
  .inbox-back { display: block; }
  .compose-grid { grid-template-columns: 1fr; }
  .bubble-row { max-width: 88%; }
}

/* ---------------------------------------------------------------- drafts */
.bubble-draft { background: var(--lilac); color: var(--plum); border: 1.5px dashed var(--plum); }
.draft-row .bubble-meta a { color: var(--plum); font-weight: 600; }
.draft-context { background: var(--line-soft); border-radius: var(--radius-sm); padding: 10px 14px; margin: 10px 0; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.draft-line .draft-who { font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-right: 6px; }
.draft-line.in { color: var(--text); }
.draft-line.out { color: var(--muted); }
.draft-reason { margin: 4px 0 8px; }
.draft-form { display: flex; flex-direction: column; gap: 10px; }
.draft-form textarea { width: 100%; }

/* ---------------------------------------------------------------- the assistant */
.claude-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px;
  border-radius: 999px; border: 1.5px solid var(--charcoal); background: var(--charcoal); color: var(--mint);
  font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.claude-fab:hover { background: #2e2e2e; }
.claude-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 100vw; z-index: 70;
  background: var(--card); border-left: 1.5px solid var(--line); display: flex; flex-direction: column;
  box-shadow: -8px 0 30px rgba(0,0,0,.08);
}
.claude-panel[hidden] { display: none; }
.claude-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1.5px solid var(--line); }
.claude-log { flex: 1 1 0; min-height: 0; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.claude-msg { max-width: 92%; padding: 10px 13px; border-radius: 14px; line-height: 1.5; font-size: 14px; white-space: normal; overflow-wrap: anywhere; }
.claude-msg.user { align-self: flex-end; background: var(--charcoal); color: #fff; border-bottom-right-radius: 5px; }
.claude-msg.assistant { align-self: flex-start; background: var(--line-soft); border-bottom-left-radius: 5px; }
.claude-msg.muted { color: var(--faint); font-style: italic; }
.claude-msg.note { background: var(--lilac); color: var(--plum); font-size: 13px; }
.claude-msg.error { background: var(--rose); color: var(--wine); }
.claude-starters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.claude-starters[hidden] { display: none; }
.claude-send { display: flex; gap: 8px; align-items: flex-end; padding: 12px 16px; border-top: 1.5px solid var(--line); }
.claude-send textarea { flex: 1; resize: none; border-radius: 18px; padding: 9px 14px; max-height: 140px; }
.claude-send .btn { border-radius: 999px; }
@media (max-width: 700px) { .claude-panel { width: 100vw; } .claude-fab span { display: none; } }

/* ---------------------------------------------------------------- dashboard, today first */
.today-row { margin-bottom: 8px; }
.stat-zero { opacity: .45; }
.stat-zero:hover { opacity: 1; }
.stat-text { display: block; font-weight: 800; font-size: 20px; line-height: 1.15; letter-spacing: -.01em; color: var(--forest); margin-bottom: 4px; }
.span-2 { grid-column: span 2; }
@media (max-width: 1000px) { .span-2 { grid-column: span 1; } }
.spark-pair { display: flex; align-items: flex-end; gap: 2px; height: 100%; width: 100%; }
.spark-2 .spark-col { height: 100%; }
.spark-bar.spark-in { background: var(--lilac); }
.reply-list { display: flex; flex-direction: column; gap: 12px; }
.reply-item { padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.reply-item:last-child { border-bottom: 0; padding-bottom: 0; }
.reply-text { margin: 4px 0 8px; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.big-stat b { display: block; font-size: 38px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.big-stat span { display: block; color: var(--muted); font-size: 13px; margin-top: 6px; line-height: 1.45; }

.pill-video { background: #ffe9b8; color: #6b4a00; }
.amber-dot { background: #e8b84a; }
.chip-link b.amber { color: #6b4a00; }
.video-banner { background: #ffe9b8; color: #6b4a00; }

/* ---------------------------------------------------------------- queue + schedule */
.bulk-bar { position: sticky; top: 8px; z-index: 5; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 18px; margin-bottom: 16px; }
.bulk-bar .queue-actions { margin-left: auto; }
.draft-head-left { display: flex; align-items: center; gap: 10px; }
.draft-check { width: 18px; height: 18px; }
.draft-card textarea { width: 100%; margin-bottom: 10px; }
.sched { position: relative; display: inline-block; }
.sched summary { list-style: none; cursor: pointer; }
.sched summary::-webkit-details-marker { display: none; }
.sched-pop { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px; min-width: 220px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.sched-inline .sched-pop { left: auto; right: 0; top: auto; bottom: calc(100% + 6px); }
.sched-custom { display: flex; gap: 6px; align-items: center; border-top: 1px solid var(--line-soft); padding-top: 8px; margin-top: 2px; }
.sched-custom input { font-size: 12.5px; padding: 5px 7px; }
.bubble-queued { background: var(--line-soft); color: var(--muted); border: 1.5px dashed var(--line); }
.linkish { border: 0; background: none; padding: 0; color: var(--plum); font: inherit; font-size: inherit; cursor: pointer; text-decoration: underline; }
.queued-row { display: flex; gap: 10px; align-items: center; }
.queued-body { flex: 1; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.draft-card { position: relative; }
.draft-card:has(details[open]), .bulk-bar:has(details[open]) { z-index: 30; }
.queue-list .draft-card:not(:has(details[open])) { z-index: 1; }

/* The page makes room for the assistant instead of sitting under it */
body.claude-open main.withnav { margin-right: 420px; }
body.claude-open .claude-fab { display: none; }
body.claude-open .inbox { grid-template-columns: 300px 1fr; }
@media (max-width: 1500px) { body.claude-open .lead-layout { grid-template-columns: 280px minmax(0, 1fr); } body.claude-open .lead-layout .workcol { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; } }
@media (max-width: 1100px) { body.claude-open main.withnav { margin-right: 0; } }

.draft-when { display: inline-block; min-width: 118px; font-family: var(--mono); font-size: 10.5px; color: var(--faint); margin-right: 6px; }

.drafts-sort { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.drafts-sort label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.drafts-sort select { padding: 5px 8px; font-size: 13px; }
.chip-overdue { background: var(--rose); color: var(--wine); }

.draft-actions { display: flex; gap: 6px; margin-top: 6px; justify-content: flex-end; }

/* ---------------------------------------------------------------- right-click menu + phone app */
.inbox-back { padding: 12px 16px 0; font-weight: 600; color: var(--muted); }
@media (min-width: 901px) { .inbox-back { display: none; } }
.inbox-back:hover { color: var(--text); }
.ctx-menu {
  position: fixed; z-index: 90; min-width: 170px; padding: 6px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(0,0,0,.14); display: flex; flex-direction: column;
}
.ctx-menu[hidden] { display: none; }
.ctx-menu button {
  text-align: left; padding: 9px 12px; border: 0; background: none; border-radius: 8px;
  font: inherit; font-size: 14px; color: var(--text); cursor: pointer;
}
.ctx-menu button:hover { background: var(--line-soft); }
.inbox-row { -webkit-touch-callout: none; }
/* Home-screen app on iPhone: keep clear of the notch and the home bar */
@media (display-mode: standalone) {
  body { padding-top: env(safe-area-inset-top); }
  .sidebar { padding-top: calc(18px + env(safe-area-inset-top)); }
  main.withnav { padding-bottom: calc(50px + env(safe-area-inset-bottom)); }
  .claude-fab { bottom: calc(22px + env(safe-area-inset-bottom)); }
}
.btn[hidden] { display: none; }

/* ---------------------------------------------------------------- phones (≤720px)
   The sidebar turns into a sticky top bar: brand left, menu button far
   right. The links drop down in a rounded panel under the bar with the page
   dimmed behind. Content gets the full width; everything that was a wide
   row becomes a column or a swipe strip. Touch targets 44px+. */
.menu-btn, .menu-backdrop, .menu-count { display: none; }

@media (max-width: 720px) {
  .sidebar {
    top: 0; left: 0; right: 0; bottom: auto; width: auto;
    height: calc(56px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 10px 0 14px;
    flex-direction: row; align-items: center; justify-content: space-between;
    box-shadow: 0 1px 0 rgba(0,0,0,.25);
  }
  .brand { padding: 0; gap: 10px; }
  .sidebar .brand-text { display: block; font-size: 14px; }
  .menu-btn {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; padding: 0; border: 0; background: none; cursor: pointer;
    border-radius: 10px; position: relative;
  }
  .menu-btn .menu-bar { width: 22px; height: 2px; background: var(--bg); border-radius: 2px; margin: 0 auto; transition: transform .2s var(--ease), opacity .2s; }
  .menu-count { display: inline-block; position: absolute; top: 2px; right: 0; margin: 0; }
  body.menu-open .menu-btn .menu-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.menu-open .menu-btn .menu-bar:nth-child(2) { opacity: 0; }
  body.menu-open .menu-btn .menu-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  body.menu-open .menu-count { display: none; }

  .sidemenu {
    display: none; position: fixed; z-index: 46;
    top: calc(64px + env(safe-area-inset-top)); left: 12px; right: 12px;
    flex-direction: column; gap: 10px; padding: 12px;
    background: var(--forest); border-radius: 18px;
    box-shadow: 0 16px 40px rgba(0,0,0,.3);
    max-height: calc(100vh - 80px - env(safe-area-inset-top)); overflow-y: auto;
  }
  body.menu-open .sidemenu { display: flex; }
  /* below the bar (z 40) so the bar and its dropdown stay crisp; above the page */
  .menu-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(20, 50, 30, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
  body.menu-open .menu-backdrop { display: block; }
  .sidenav { gap: 2px; }
  .sidenav .navlink, .sidefoot .navlink { min-height: 46px; justify-content: flex-start; font-size: 15px; }
  .sidebar .navtext, .sidebar .whoami-name { display: inline; }
  .sidemenu .navcount { position: static; margin-left: auto; }
  .menu-count { position: absolute; top: 0; right: 4px; margin: 0; }
  .sidefoot { margin-top: 4px; padding-top: 10px; border-top: 1px solid rgba(248,249,235,.15); }
  .whoami { justify-content: flex-start; }

  main.withnav { margin-left: 0; padding: calc(68px + env(safe-area-inset-top)) 16px calc(90px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 16px; gap: 12px; }
  .page-head h1 { font-size: 28px; }
  .subtitle { font-size: 13px; }
  .page-head > div:first-child { flex: 1 1 100%; }

  /* inputs: 16px stops iOS zooming in on focus; 44px tall for thumbs */
  input, select, textarea { font-size: 16px; min-height: 44px; }
  .btn { min-height: 44px; }
  .btn-tiny { min-height: 36px; }
  .badge-select, .chip-select, .inline-select { min-height: 0; font-size: inherit; }
  .drafts-sort select, .send-tools select { min-height: 38px; font-size: 14px; }
  /* send box: the text box takes the whole width, the buttons sit on a row under it */
  .send-box { flex-wrap: wrap; gap: 8px; padding: 12px 14px; }
  .send-box > textarea, .send-box > .send-main { flex: 1 1 100%; }
  .send-box .btn-primary { margin-left: auto; }

  /* leads page */
  .filters { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .filters input[type="search"] { grid-column: 1 / -1; min-width: 0; width: 100%; }
  .filters > * { min-width: 0; max-width: 100%; }
  .filters .btn { justify-content: center; }
  .filters .inline-check { grid-column: 1 / -1; }
  main.withnav { overflow-x: clip; }
  main.withnav > * { max-width: 100%; }

  /* sprint */
  .sprint-launch { width: 100%; }
  .sprint-launch-row { flex-direction: column; gap: 12px; }
  .sprint-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .fact { min-width: 0; }
  .viewchips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin: 0 -16px 12px; padding: 2px 16px; }
  .viewchips::-webkit-scrollbar { display: none; }
  .viewchip { flex: 0 0 auto; white-space: nowrap; }
  .table-wrap { margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { font-size: 13px; }
  th, td { padding: 10px 10px; }
  td.lead-name { position: sticky; left: 0; background: var(--card-solid); z-index: 2; max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
  th.tick, td.tick { position: sticky; left: 0; background: var(--card-solid); z-index: 2; }
  th.tick + th, td.tick + td.lead-name { left: 38px; }
  th.tick + th { position: sticky; z-index: 4; background: var(--card-solid); }
  /* sticky cells need a solid colour or the next column shows through */
  tr.overdue td.lead-name, tr.overdue td.tick { background: #fff6fb; }
  tbody td:first-child { box-shadow: none; }
  .card { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  /* dashboard: two tiles per row */
  .stat-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px 14px 12px; }
  .stat-n { font-size: 34px; }
  .stat-text { font-size: 16px; }

  /* drafts */
  .bulk-bar { flex-wrap: wrap; gap: 10px; top: calc(64px + env(safe-area-inset-top)); }
  .bulk-bar .queue-actions { margin-left: 0; width: 100%; }
  .queue-actions { flex-wrap: wrap; }
  .queue-item-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .queue-meta { flex-wrap: wrap; }

  /* lead page: one column, so the side panel just scrolls with the page */
  .lead-panel { position: static; max-height: none; overflow: visible; }

  /* inbox: conversation header stacks, actions wrap */
  .inbox-pane-head { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px 16px; }
  .inbox-pane-head > div:first-child { min-width: 0; }
  .inbox-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .head-actions { flex-wrap: wrap; }
  .rename-form { flex: 1 1 100%; }
  .rename-form input { flex: 1; width: auto; min-width: 0; }

  /* settings: each message gets the full width, delay underneath */
  .settings-row { flex-wrap: wrap; }
  .settings-row textarea { flex: 1 1 calc(100% - 48px); min-height: 72px; }
  .settings-delay { margin: 0 0 0 48px; }

  /* the assistant */
  .claude-fab { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: 56px; height: 56px; justify-content: center; padding: 0; }
}

/* ---------------------------------------------------------------- pull to refresh (phones)
   The page follows the finger down from the very top; an iPhone-style
   spinner (eight bars) fades in under the top bar as it goes. */
.ptr {
  display: none; position: fixed; left: 50%; z-index: 60; opacity: 0; pointer-events: none;
  top: calc(56px + env(safe-area-inset-top) + 14px);
  width: 30px; height: 30px; transform: translate(-50%, 0);
}
.ptr-spinner { position: relative; display: block; width: 30px; height: 30px; }
.ptr-spinner i {
  position: absolute; left: 13.5px; top: 2px; width: 3px; height: 8px; border-radius: 2px;
  background: var(--muted); transform-origin: 1.5px 13px;
}
.ptr-spinner i:nth-child(1) { transform: rotate(0deg);   opacity: 1; }
.ptr-spinner i:nth-child(2) { transform: rotate(45deg);  opacity: .88; }
.ptr-spinner i:nth-child(3) { transform: rotate(90deg);  opacity: .76; }
.ptr-spinner i:nth-child(4) { transform: rotate(135deg); opacity: .64; }
.ptr-spinner i:nth-child(5) { transform: rotate(180deg); opacity: .52; }
.ptr-spinner i:nth-child(6) { transform: rotate(225deg); opacity: .4; }
.ptr-spinner i:nth-child(7) { transform: rotate(270deg); opacity: .28; }
.ptr-spinner i:nth-child(8) { transform: rotate(315deg); opacity: .16; }
.ptr.busy .ptr-spinner { animation: ptr-spin .8s steps(8) infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }
main.ptr-snap, .ptr.ptr-snap { transition: transform .28s var(--ease), opacity .2s; }
@media (max-width: 720px) {
  .ptr { display: block; }
  /* stop Safari's own rubber-band so the pull doesn't fight ours */
  html, body { overscroll-behavior-y: none; }
}

/* ---------------------------------------------------------------- phones: bottom tab bar
   The five main pages, always under the thumb. Hidden on desktop. */
.tabbar { display: none; }
@media (max-width: 720px) {
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--card-solid); border-top: 1.5px solid var(--line);
  }
  .tab-link {
    flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 2px 4px; min-height: 50px; color: var(--muted); text-decoration: none;
    font-size: 11px; font-weight: 600; letter-spacing: .01em;
  }
  .tab-link svg { width: 24px; height: 24px; }
  .tab-link.on { color: var(--forest); }
  .tab-link.on svg { stroke-width: 2.2; }
  .tab-link:hover { text-decoration: none; }
  .tab-count {
    position: absolute; top: 2px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px;
    border-radius: 999px; background: var(--forest); color: #fff; font-size: 10.5px; font-weight: 700;
    line-height: 17px; text-align: center; font-family: var(--mono);
  }
  .tab-count-red { background: var(--wine); }
  .tab-count-amber { background: var(--plum); }
  /* room for the bar, and the Claude button sits above it */
  main.withnav { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .claude-fab { bottom: calc(84px + env(safe-area-inset-bottom)); }
  body.claude-open .tabbar { display: none; }
}

/* ---------------------------------------------------------------- phones: the home page
   Big cards, one under the other, like the HubSpot app: a heading with an
   icon, the number that matters, a line of detail and one button. */
.home-phone { display: none; }
@media (max-width: 720px) {
  .home-desktop { display: none; }
  .home-phone { display: block; }
  .home-date { font-family: var(--mono); font-size: 12px; color: var(--muted); margin: 2px 0 8px; letter-spacing: .02em; }
  .home-greet { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin: 0 0 18px; }
  .pcard {
    background: var(--card); border: 1.5px solid var(--line); border-radius: 22px;
    padding: 0; margin-bottom: 14px; overflow: hidden;
  }
  .pcard-head {
    display: flex; align-items: center; gap: 12px; padding: 16px 18px;
    border-bottom: 1px solid var(--line-soft);
  }
  .pcard-icon {
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--line-soft); color: var(--forest);
  }
  .pcard-icon svg { width: 20px; height: 20px; }
  .pcard-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
  .pcard-body { padding: 18px 18px 6px; text-align: center; }
  .pcard-n { display: block; font-size: 52px; font-weight: 800; line-height: 1; letter-spacing: -.02em; color: var(--text); }
  .pcard-red .pcard-n { color: var(--wine); }
  .pcard-blue .pcard-n { color: var(--cobalt); }
  .pcard-amber .pcard-n, .pcard-purple .pcard-n { color: var(--plum); }
  .pcard-green .pcard-n { color: var(--forest); }
  .pcard-text { display: block; font-size: 20px; font-weight: 700; line-height: 1.25; color: var(--forest); letter-spacing: -.01em; }
  .pcard-sub { display: block; margin-top: 8px; color: var(--muted); font-size: 14px; line-height: 1.45; }
  .pcard-list { list-style: none; margin: 14px 0 0; padding: 0; text-align: left; border-top: 1px solid var(--line-soft); }
  .pcard-list li { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 15px; }
  .pcard-list li a { color: var(--text); font-weight: 600; }
  .pcard-list li span { color: var(--muted); font-size: 13px; }
  .pcard-foot { padding: 12px 18px 18px; text-align: center; }
  .pcard-foot .btn { min-height: 44px; padding: 10px 22px; border-radius: 999px; font-weight: 600; }
}
/* Scheduled page: the approved text, shown read-only in place of the textarea */
.scheduled-body { margin: 10px 0 0; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--line-soft); white-space: pre-wrap; }

/* dashboard: chart key sits on one line with its colour squares beside the words */
.card h2.legend-inline { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.legend-key { display: inline-flex; align-items: center; gap: 7px; }
.quiet-line { margin: 0 0 4px; }

/* new message: search first, Google Messages style */
.compose-to { position: relative; }
.compose-to input { width: 100%; }
.compose-matches { list-style: none; margin: 6px 0 0; padding: 0; border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.compose-matches:empty { display: none; }
.compose-matches li a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line-soft); }
.compose-matches li:last-child a { border-bottom: 0; }
.compose-matches li a:hover { background: var(--line-soft); }
.compose-match-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.compose-match-name { font-weight: 600; }
.compose-match-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compose-match-when { color: var(--faint); font-size: 12px; white-space: nowrap; }
.compose-rest[hidden] { display: none; }
.compose-none { margin: 4px 0 0; }

/* phones: with a conversation open, the Claude button clears the text box */
@media (max-width: 720px) {
  body:has(.inbox-convonly) .claude-fab { bottom: calc(160px + env(safe-area-inset-bottom)); width: 48px; height: 48px; }
}

/* automatic replies */
.pill-auto { background: #dff3e6; color: var(--forest); }
.chip-lane { background: var(--line-soft); }
.auto-card { margin-bottom: 18px; }
.auto-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.auto-row .auto-body { flex: 1; min-width: 200px; color: var(--muted); font-size: 13.5px; }
.reading-row .bubble-draft { opacity: .75; font-style: italic; }
