/* Pipeline: deal desk for Lee Woodlands Group.
   Ink navy shell, cool paper workspace, one signal colour (amber) reserved
   for "this needs you". Staleness is the memorable element: every lead shows
   how long since anyone touched it. */
:root {
  --ink: #162033;
  --ink-2: #1f2b42;
  --ink-3: #2c3a55;
  --paper: #f5f6f8;
  --card: #ffffff;
  --line: #e2e5eb;
  --text: #1b2433;
  --muted: #697285;
  --signal: #d9822b;
  --signal-soft: #fbefe2;
  --good: #2f7d5b;
  --good-soft: #e5f2ec;
  --bad: #b5443a;
  --radius: 8px;
  --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--paper);
  font-feature-settings: "tnum" 1; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* shell */
.shell { display: grid; grid-template-columns: 224px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #cdd3df; padding: 20px 12px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; }
.brand { color: #fff; font-weight: 600; font-size: 15px; padding: 4px 10px 22px; letter-spacing: -0.01em; }
.brand span { display: block; font-weight: 400; font-size: 12px; color: #8d97ab; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: #cdd3df; }
.nav a:hover { background: var(--ink-2); text-decoration: none; color: #fff; }
.nav a.on { background: var(--ink-3); color: #fff; }
.nav svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.7; flex: none; }
.side-foot { margin-top: auto; font-size: 12px; color: #8d97ab; padding: 10px; line-height: 1.45; }
.side-foot .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); margin-right: 6px; }
.side-foot .dot.off { background: var(--bad); }
.main { min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 28px; border-bottom: 1px solid var(--line); background: var(--card); }
.page { padding: 24px 28px 48px; }

/* buttons + inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card);
  padding: 7px 12px; border-radius: 6px; font: inherit; font-weight: 500; cursor: pointer; color: var(--text); }
.btn:hover { border-color: #c7ccd6; text-decoration: none; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--ink-3); }
input, select, textarea { font: inherit; color: var(--text); border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 10px; background: #fff; width: 100%; }
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }

/* panels */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: 1fr 1fr; }
.g-3 { grid-template-columns: repeat(3, 1fr); }

/* dashboard figures: a single ledger strip, not five cards */
.ledger { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 16px; }
.ledger div { padding: 16px 18px; border-left: 1px solid var(--line); }
.ledger div:first-child { border-left: 0; }
.ledger b { display: block; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.ledger span { font-size: 12px; color: var(--muted); }
.ledger .flag b { color: var(--signal); }

.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.rows .grow { flex: 1; min-width: 0; }
.rows .grow > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.empty { color: var(--muted); padding: 8px 0; }

.av { width: 32px; height: 32px; border-radius: 50%; background: #e8ebf1; color: var(--ink); display: grid;
  place-items: center; font-weight: 600; font-size: 12px; flex: none; }
.av.lg { width: 56px; height: 56px; font-size: 18px; }

.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: #eef0f4; color: var(--ink); white-space: nowrap; }
.pill.signal { background: var(--signal-soft); color: #9a5512; }
.pill.good { background: var(--good-soft); color: var(--good); }

/* staleness rail: the one bold device. Width and colour = days since last touch */
.stale { height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; margin-top: 8px; }
.stale i { display: block; height: 100%; background: var(--good); }
.stale.warm i { background: #c9a227; }
.stale.cold i { background: var(--signal); }

/* pipeline board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: 272px; gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.col { background: #eceef2; border-radius: var(--radius); padding: 10px; min-height: 60vh; }
.col.over { background: #e2e6ee; outline: 2px dashed #b8c0cf; }
.col-h { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 4px 10px; font-weight: 600; }
.col-h .muted { font-weight: 400; font-size: 12px; }
.deal { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; cursor: grab; }
.deal:active { cursor: grabbing; }
.deal.dragging { opacity: 0.5; }
.deal-t { font-weight: 600; display: block; }
.deal-m { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* tables */
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; font-weight: 500; color: var(--muted); border-top: 0; background: #fafbfc; }
tbody tr:hover { background: #fafbfc; }
.who { display: flex; align-items: center; gap: 10px; }
.filters { display: flex; gap: 8px; margin-bottom: 14px; }
.filters input { max-width: 320px; }
.filters select { max-width: 200px; }

/* contact page */
.contact { display: grid; grid-template-columns: 300px 1fr 300px; gap: 16px; align-items: start; }
.id-card { text-align: left; }
.id-card h1 { margin-top: 12px; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 18px 26px; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .mk { position: absolute; left: 0; top: 4px; width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--ink); background: #fff; }
.timeline .mk.out { border-color: var(--muted); }
.timeline .mk.meet { background: var(--ink); }
.t-h { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.t-body { margin-top: 6px; white-space: pre-wrap; color: #34405a; font-size: 13px; max-height: 9.5em; overflow: hidden; }
.t-body.open { max-height: none; }
.more { font-size: 12px; color: var(--muted); background: none; border: 0; padding: 4px 0; cursor: pointer; font: inherit; }

/* conversations */
.inbox { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 71px); }
.inbox-list { border-right: 1px solid var(--line); overflow-y: auto; background: var(--card); }
.inbox-list a { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.inbox-list a:hover { background: #fafbfc; text-decoration: none; }
.inbox-list a.on { background: #eef1f6; box-shadow: inset 3px 0 0 var(--ink); }
.inbox-list .l1 { display: flex; justify-content: space-between; gap: 8px; }
.inbox-list .l1 b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-list .l2, .inbox-list .l3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.inbox-list .l3 { color: var(--muted); }
.inbox-read { overflow-y: auto; padding: 24px 32px; }
.msg { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 12px; max-width: 760px; }
.msg.me { margin-left: 48px; border-color: #d3d9e4; background: #f8f9fc; }
.msg-h { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
.msg-b { white-space: pre-wrap; font-size: 14px; }
.tabs { display: flex; gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; }
.tabs a { padding: 5px 10px; border-radius: 6px; font-size: 13px; color: var(--muted); }
.tabs a.on { background: var(--ink); color: #fff; text-decoration: none; }

/* calendar */
.day { margin-bottom: 22px; }
.day h2 { font-size: 13px; color: var(--muted); font-weight: 500; }
.slot { display: grid; grid-template-columns: 110px 1fr auto; gap: 16px; align-items: center; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 8px; }
.slot time { font-weight: 600; }
.slot.cancelled { opacity: 0.55; }
.slot.cancelled .slot-t { text-decoration: line-through; }

.notes-doc { white-space: pre-wrap; max-width: 780px; font-size: 14px; line-height: 1.65; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--ink); }
.login form { background: #fff; padding: 32px; border-radius: var(--radius); width: 340px; }
.login h1 { margin-bottom: 4px; }
.err { color: var(--bad); font-size: 13px; margin-top: 10px; }

@media (max-width: 1100px) {
  .contact { grid-template-columns: 1fr; }
  .ledger { grid-template-columns: repeat(2, 1fr); }
  .g-2, .g-3 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; }
  .brand { padding: 4px 10px; }
  .nav { display: flex; flex-wrap: wrap; }
  .side-foot { display: none; }
  .page, .top { padding-left: 16px; padding-right: 16px; }
  .inbox { grid-template-columns: 1fr; height: auto; }
  .slot { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.banner { padding: 9px 28px; font-size: 13px; background: var(--signal-soft); color: #7a4310; border-bottom: 1px solid #f0d9bf; }
.banner.stop { background: #f8e3e0; color: #8a2f27; border-color: #efc9c4; }
.banner a { text-decoration: underline; }
.login form, .login-card { background: #fff; padding: 32px; border-radius: var(--radius); width: 360px; max-width: calc(100vw - 32px); }
.qr { display: grid; place-items: center; margin: 12px 0; }

code { font-size: 12px; background: #eef0f4; padding: 2px 5px; border-radius: 4px; word-break: break-all; }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 15px; letter-spacing: .04em; }
.codes li { background: #eef0f4; border-radius: 6px; padding: 6px 10px; text-align: center; }

/* ---------- v3: context-first layout ---------- */
h3 { font-size: 12px; font-weight: 600; color: var(--muted); margin: 16px 0 6px; }
.sub { margin: -8px 0 10px; }
.callout { margin-bottom: 16px; border-color: #e8d8c4; background: #fffaf3; }
.seg { display: inline-flex; background: #eceef2; border-radius: 7px; padding: 3px; gap: 2px; }
.seg a { padding: 5px 11px; border-radius: 5px; font-size: 13px; color: var(--muted); }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg a.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(22,32,51,.12); }
.seg button { padding: 5px 11px; border-radius: 5px; font-size: 13px; color: var(--muted); background: none; border: 0; cursor: pointer; font-family: inherit; }
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(22,32,51,.12); }
form.seg { align-items: center; }
.chip { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 999px; background: #eef1f6; margin: 0 6px 6px 0; }
.chip.warn { background: var(--signal-soft); color: #7a4310; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; color: var(--ink); text-decoration: underline; cursor: pointer; }

/* stage pills carry the journey: open stages ink, late stages signal, outcomes green/grey */
.pill.stage-proposal_requested, .pill.stage-proposal_sent, .pill.stage-negotiating { background: #e7ebf3; color: var(--ink); font-weight: 500; }
.pill.stage-won { background: var(--good-soft); color: var(--good); }
.pill.stage-stalled { background: #f3f0ea; color: #7c6a4c; }
.pill.stage-lost { background: #f1f2f4; color: #8a909c; }
.pill.intent-hot { background: #fbe7dc; color: #9a3d12; }
.pill.intent-warm { background: var(--signal-soft); color: #7a4310; }
.pill.intent-cold { background: #eef0f4; color: var(--muted); }

/* today */
.today { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: grid; gap: 16px; }
.moves { list-style: none; margin: 0; padding: 0; }
.moves li { border-top: 1px solid var(--line); }
.moves li:first-child { border-top: 0; }
.move { display: flex; gap: 12px; padding: 12px 6px; border-radius: 6px; }
.move:hover { background: #f7f8fa; text-decoration: none; }
.move-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.move-who { font-size: 13px; }
.move-next { font-size: 15px; font-weight: 500; line-height: 1.4; }
.move-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; margin-top: 2px; }
.rows li.col-row { flex-direction: column; align-items: stretch; gap: 2px; }
.row-h { display: flex; justify-content: space-between; gap: 10px; }
.prep { margin: 4px 0 0; font-size: 13px; color: #3a4660; }
.funnel { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.stage-cell { background: #f5f6f8; border-radius: 6px; padding: 10px 12px; }
.stage-cell:hover { background: #eceef2; text-decoration: none; }
.stage-cell b { display: block; font-size: 20px; }
.stage-cell span { font-size: 12px; color: var(--muted); }

/* pipeline cards */
.deal-p { font-size: 12px; color: var(--muted); margin-top: 1px; }
.deal-next { font-size: 13px; margin: 8px 0 6px; line-height: 1.4; color: #2a3550;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.deal-m { align-items: center; }
.col-empty { color: #9aa1ae; font-size: 12px; padding: 4px; margin: 0; }

/* contacts table */
.leads .next-cell { max-width: 380px; font-size: 13px; }
.leads .next-cell .pill { margin-top: 4px; }

/* lead page */
.lead-head { flex-wrap: wrap; }
.lead-head .who { gap: 14px; }
.lead-head h1 { margin: 0; }
.head-tags { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lead { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.lead-main, .lead-side { display: grid; gap: 16px; min-width: 0; }
.stand .summary { font-size: 15px; line-height: 1.55; margin: 0 0 14px; max-width: 70ch; }
.next { border: 1px solid var(--line); border-left: 3px solid var(--ink-3); border-radius: 6px; padding: 10px 14px; }
.next.mine { border-left-color: var(--signal); background: #fffbf6; }
.next-h { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
.next p { margin: 6px 0 0; }
.next-step { font-weight: 500; font-size: 15px; }
.commit { list-style: none; padding: 0; margin: 0; }
.commit li { padding: 5px 0; font-size: 14px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.facts p { margin: 0; }
.reason { margin: 14px 0 4px; }
.gist { margin: 6px 0 4px; font-size: 14px; }
.actions { margin: 4px 0; padding-left: 18px; font-size: 13px; }
details summary { cursor: pointer; font-size: 13px; color: var(--ink); }
details .notes-doc { margin-top: 8px; font-size: 13px; color: #34405a; max-height: 420px; overflow-y: auto; }
.t-mail details summary { list-style: none; color: var(--text); }
.t-mail details summary::-webkit-details-marker { display: none; }
.t-mail details[open] + .t-snip { display: none; }
.t-snip { font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* conversations */
.thread-ctx { background: #f5f6f8; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; max-width: 760px; }
.thread-ctx p { margin: 6px 0 0; }
.ask { color: #7a4310; }

/* calendar */
.slot-main { min-width: 0; }
.slot .prep { max-width: 80ch; }

.notes-wrap h2 { margin-top: 18px; }
.notes-wrap h2:first-child { margin-top: 0; }

@media (max-width: 1100px) {
  .today, .lead { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
}

.qr svg { width: 240px; height: 240px; display: block; }
.manual { margin: 4px 0 8px; }
.key { font: 600 17px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; word-spacing: .3em; background: #eef0f4; padding: 8px 10px; border-radius: 6px; margin: 6px 0 8px; }

/* ---------- v5: clients, invoices, lead finder ---------- */
.ledger-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; align-items: end; }
.form-grid.form-4 { grid-template-columns: 2fr 1.4fr 1.2fr auto; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .go { padding-bottom: 0; }
.form-grid .btn { margin-top: 12px; }
.check-row { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--text); margin-top: 12px; }
.check-row input { width: auto; }
tr.inactive td { opacity: .5; }
form.inline { margin: 0; }
form.inline select { width: auto; padding: 4px 8px; font-size: 13px; }
select.status-held { border-color: var(--good); color: var(--good); }
select.status-no_show { border-color: var(--signal); color: #9a5512; }
select.status-cancelled { color: var(--muted); }
.appts td, .appts th { padding: 8px 10px; }
.row-h h2 { margin: 0; }
.row-h { align-items: center; margin-bottom: 10px; }
.plan-steps { padding-left: 20px; margin: 8px 0; }
.plan-steps li { margin-bottom: 10px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.finder { margin-bottom: 16px; }
.finder-body { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.searches a.b { font-weight: 600; }
.prospects td { vertical-align: top; }
.err { color: var(--bad); }
@media (max-width: 1100px) {
  .finder-body { grid-template-columns: 1fr; }
  .form-grid.form-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .form-grid, .form-grid.form-4 { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .ledger-3 { grid-template-columns: 1fr; }
}

/* ---------- v6: threads, compose, signals, agent keys ---------- */
.count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: #e7ebf3; color: var(--ink);
  font-size: 11px; font-weight: 600; text-align: center; line-height: 17px; vertical-align: 1px; }
.nav-count { margin-left: auto; background: var(--signal); color: #fff; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 0 7px; line-height: 18px; }
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13px; }
.flash.good { background: var(--good-soft); color: var(--good); border: 1px solid #cfe5d9; }

/* thread reading */
.thread-h { margin: 16px 0 14px; }
.thread-h h1 { margin-bottom: 2px; }
.msg { display: block; }
.msg > summary { list-style: none; cursor: pointer; gap: 12px; margin-bottom: 0; }
.msg > summary::-webkit-details-marker { display: none; }
.msg[open] > summary { margin-bottom: 8px; }
.msg-who { display: flex; gap: 10px; min-width: 0; }
.msg-who b { white-space: nowrap; }
.msg-peek { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.msg[open] .msg-peek { display: none; }
.msg-when { white-space: nowrap; flex-shrink: 0; }
.msg:not([open]) { padding-top: 10px; padding-bottom: 10px; }
.msg-to { margin: -4px 0 8px; }
.msg-b { line-height: 1.6; overflow-wrap: anywhere; }
.earlier { margin-bottom: 12px; max-width: 760px; }
.earlier > summary { cursor: pointer; font-size: 13px; color: var(--muted); padding: 8px 0; list-style: none; }
.earlier > summary::before { content: "▸ "; }
.earlier[open] > summary::before { content: "▾ "; }
.earlier > summary::-webkit-details-marker { display: none; }

/* contact timeline: email threads + agent notes */
.t-thread > summary { cursor: pointer; }
.t-thread[open] + .t-snip { display: none; }
.t-msgs { margin-top: 10px; }
.t-msgs .msg { max-width: none; margin-left: 0; margin-bottom: 8px; padding: 10px 14px; }
.t-msgs .msg.me { margin-left: 24px; }
.t-msgs .msg-b { font-size: 13px; }
.timeline .mk.sig { border-color: var(--signal); background: var(--signal-soft); }

/* compose */
.compose { max-width: 760px; margin-top: 16px; scroll-margin-top: 16px; }
.inbox-read .compose { margin-bottom: 40px; }
.compose .row-h { flex-wrap: wrap; }
.ai-row { display: flex; gap: 8px; align-items: center; flex: 1; justify-content: flex-end; min-width: 280px; }
.ai-ask { max-width: 340px; font-size: 13px; padding: 6px 10px; }
.compose .addr { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 8px; margin-bottom: 6px; }
.compose .addr label { margin: 0; }
.compose-body { min-height: 220px; margin-top: 6px; line-height: 1.55; }
.compose-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; }
.compose .btn.busy { opacity: .6; pointer-events: none; }

/* signals */
.signals { display: grid; gap: 12px; max-width: 900px; }
.signal-card { border-left: 3px solid var(--line); }
.signal-card.u-high { border-left-color: var(--signal); }
.signal-card.u-medium { border-left-color: #c7ccd6; }
.sig-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.sig-tags { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.score { font-weight: 600; font-size: 14px; }
.score small { font-weight: 400; color: var(--muted); font-size: 11px; }
.sig-title { font-size: 16px; font-weight: 600; margin: 10px 0 4px; }
.sig-who { margin: 0 0 6px; }
.sig-next { margin-top: 10px; padding: 8px 12px; background: #f6f7fa; border-radius: 6px; font-size: 13px; }
.sig-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.sig-actions form { margin: 0; }
.filters .seg { margin-right: 6px; }

/* agent keys */
.key-once { border: 1px solid #e8d8c4; background: #fffaf3; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.key-row { display: flex; gap: 8px; align-items: center; }
.key-row code { flex: 1; overflow-wrap: anywhere; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; font-size: 12px; }
.key-new { display: flex; gap: 8px; }
.key-new input { max-width: 160px; }
.key-new select { max-width: 200px; }
@media (max-width: 760px) {
  .ai-row { justify-content: flex-start; }
  .compose .addr { grid-template-columns: 1fr; gap: 2px; }
  .compose-foot { flex-direction: column; align-items: stretch; }
  .key-new { flex-direction: column; }
  .key-new input, .key-new select { max-width: none; }
}
form.inline { display: inline; margin: 0; }
.sig-title { color: var(--text); }
.lead-main .compose { max-width: none; }

/* profiles */
.profiles { display: grid; gap: 12px; max-width: 1000px; }
.profiles > .panel > details > summary { list-style: none; cursor: pointer; margin: 0; }
.profiles > .panel > details > summary::-webkit-details-marker { display: none; }
.profiles > .panel > details[open] > summary { margin-bottom: 12px; }
.profiles details[open] ~ .p-peek, .profiles details[open] ~ .pb-peek { display: none; }
.p-name { font-size: 15px; }
.p-meta { display: flex; gap: 10px; align-items: center; }
.p-peek, .pb-peek { margin: 8px 0 0; color: #34405a; }
.profile.inactive { opacity: .65; }
.p-top { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 10px; align-items: end; }
.p-top label { margin-top: 0; }
.p-top .check-row { margin: 0 0 10px; display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text); }
.p-top .check-row input { width: auto; }
.p-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.p-grid textarea { min-height: 96px; font-size: 13px; line-height: 1.5; }
.playbook { min-height: 420px; font-size: 13px; line-height: 1.55; }
@media (max-width: 760px) { .p-top, .p-grid { grid-template-columns: 1fr; } }
tr.sub td:first-child { padding-left: 26px; }
.sub-mark { color: var(--muted); margin-right: 6px; }
.sub-add { display: flex; gap: 8px; margin-top: 10px; }

/* Grok tasks */
.flash.warn { background: var(--signal-soft); color: #7a4310; border: 1px solid #f0d9bf; }
.flash.warn a { text-decoration: underline; }
.nav-count.quiet { background: var(--ink-3); color: #cdd3df; }
.ask-any { max-width: 900px; margin-bottom: 14px; }
.ask-any > summary, .list-grok > summary { cursor: pointer; list-style: none; }
.ask-any > summary::-webkit-details-marker, .list-grok > summary::-webkit-details-marker { display: none; }
.ask-any[open] > summary, .list-grok[open] > summary { margin-bottom: 10px; }
.list-grok { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.ask-grok textarea { min-height: 56px; font-size: 13px; }
.ask-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.sig-grok { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.task { border: 1px solid var(--line); border-left: 3px solid #c7ccd6; border-radius: 6px; padding: 10px 12px; margin-bottom: 10px; background: #fbfbfd; }
.task.t-needs_input { border-left-color: var(--signal); background: #fffaf3; }
.task.t-in_progress { border-left-color: var(--ink); }
.task.t-done { border-left-color: var(--good); }
.task.t-failed { border-left-color: var(--bad); }
.task.t-cancelled { opacity: .6; }
.task-h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.task-pill.t-needs_input { background: var(--signal-soft); color: #9a5512; }
.task-pill.t-done { background: var(--good-soft); color: var(--good); }
.task-pill.t-in_progress { background: var(--ink); color: #fff; }
.task-pill.t-failed { background: #f8e3e0; color: #8a2f27; }
.task-ins { white-space: pre-wrap; font-size: 13px; margin-top: 6px; }
.task-msg { font-size: 13px; margin-top: 6px; white-space: pre-wrap; }
.task-msg.agent { color: #34405a; }
.task-result { margin-top: 8px; font-size: 13px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.task-result div { white-space: pre-wrap; margin: 2px 0 4px; }
.task-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.task-reply { display: flex; gap: 8px; flex: 1; min-width: 260px; }
.tasks-page { display: grid; gap: 12px; max-width: 900px; }
.task-wrap { padding: 12px; }
.task-wrap .task { margin: 0; }
.lead-side .ask-row .small { display: none; }

/* prospects */
.prospect-card { border-left: 3px solid var(--line); }
.prospect-card.ps-replied, .prospect-card.ps-booked { border-left-color: var(--signal); }
.prospect-card.ps-promoted { border-left-color: var(--good); opacity: .8; }
.prospect-card.ps-parked { opacity: .65; }
.ps-select { width: auto; font-size: 13px; padding: 4px 8px; }
.thesis { margin-top: 8px; padding: 9px 12px; background: #f6f7fa; border-radius: 6px; font-size: 13px; line-height: 1.55; }
.thesis div { white-space: pre-wrap; }
td .thesis { margin-top: 6px; padding: 6px 9px; }
.p-notes { margin-top: 8px; white-space: pre-wrap; color: #34405a; }
.promote { display: flex; gap: 8px; margin: 0; }
.promote input { max-width: 220px; }
.p-edit > summary { list-style: none; }
.p-edit > summary::-webkit-details-marker { display: none; }
.p-edit[open] { flex-basis: 100%; }
.p-edit-form { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 10px; margin-top: 10px; }
.p-edit-form .span-2 { grid-column: 1 / -1; }
@media (max-width: 760px) { .p-edit-form { grid-template-columns: 1fr; } .promote { flex-direction: column; } }
.dots span + span::before { content: " · "; color: var(--muted); }

/* outreach */
.outreach { display: grid; gap: 12px; max-width: 920px; }
.tabs-seg { justify-self: start; }
.approve-bar, .enrol-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; position: sticky; top: 8px; z-index: 5; box-shadow: 0 2px 10px rgba(22,32,51,.06); }
.approve-bar .btn, .enrol-bar .btn { margin-left: auto; }
.enrol-bar { margin-bottom: 12px; max-width: 900px; }
.enrol-bar select { width: auto; max-width: 260px; }
.enrol-bar .small { flex-basis: 100%; }
.check-row { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text); margin: 0; }
.check-row input { width: auto; }
.ox-card { padding: 14px 16px; }
.ox-card.s-approved { border-left: 3px solid var(--ink); }
.ox-card.s-sent { border-left: 3px solid var(--good); }
.ox-card.s-failed { border-left: 3px solid var(--bad); }
.ox-head { display: flex; gap: 10px; align-items: baseline; }
.ox-head .grow { flex: 1; min-width: 0; }
.ox-head input[type=checkbox] { width: auto; transform: translateY(2px); }
.ox-thesis { margin: 6px 0 0; }
.ox-edit { margin-top: 10px; display: grid; gap: 6px; }
.ox-edit input { font-weight: 600; }
.ox-edit textarea { min-height: 190px; font-size: 13.5px; line-height: 1.55; }
.ox-actions { display: flex; gap: 8px; align-items: center; }
.ox-view { margin-top: 8px; }
.ox-view summary { cursor: pointer; }
.ox-body { white-space: pre-wrap; font-size: 13.5px; margin-top: 8px; line-height: 1.55; }
.reply-snip { margin: 8px 0 0; padding: 8px 12px; background: var(--signal-soft); border-radius: 6px; white-space: pre-wrap; }
.reply-card.bounced .reply-snip { background: #f3f4f6; }
.seq summary { cursor: pointer; list-style: none; }
.seq summary::-webkit-details-marker { display: none; }
.seq details[open] summary { margin-bottom: 12px; }
.seq-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.seq-form .span-2 { grid-column: 1 / -1; }
.seq-form .hours input { width: 70px; display: inline-block; }
.seq-form .check-row { margin-top: 10px; }
.sig-tags .p-pick { width: auto; }
@media (max-width: 760px) { .seq-form { grid-template-columns: 1fr; } .approve-bar .btn, .enrol-bar .btn { margin-left: 0; } }
.backup-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 4px; }
.backup-grid > div > span:first-child { display: block; margin-bottom: 2px; }
@media (max-width: 760px) { .backup-grid { grid-template-columns: 1fr; } }
.pill.tiny { font-size: 10px; padding: 0 6px; vertical-align: 1px; }

/* Today queue */
.queue { margin-bottom: 16px; }
.q-list { list-style: none; margin: 0; padding: 0; }
.q-list li { border-top: 1px solid var(--line); }
.q-list li:first-child { border-top: 0; }
.q-item { display: flex; gap: 12px; align-items: center; padding: 10px 2px; }
.q-item:hover { background: #fafbfc; text-decoration: none; }
.q-item .pill { min-width: 74px; text-align: center; }
.q-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.q-body .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-at { white-space: nowrap; }
.pill.bad { background: #f8e3e0; color: #8a2f27; }

/* results */
.results { display: grid; gap: 14px; }
.results .ledger { margin-bottom: 0; }
.funnel-bars { display: grid; gap: 6px; }
.fb { display: grid; grid-template-columns: 150px 1fr 48px; gap: 10px; align-items: center; font-size: 13px; }
.fb-bar { background: #eef0f4; border-radius: 4px; height: 14px; overflow: hidden; }
.fb-bar i { display: block; height: 100%; background: var(--ink); border-radius: 4px; }
.fb b { text-align: right; }
.res-table td, .res-table th { white-space: nowrap; }
@media (max-width: 760px) { .fb { grid-template-columns: 100px 1fr 36px; } .res-table { display: block; overflow-x: auto; } }

/* ---------- v9: clustered sidebar ---------- */
/* Outreach, Pipeline and Clients each open a fly-out of their tools on hover or keyboard focus. */
.side { z-index: 30; }
.nav-group { position: relative; }
.nav .nav-head .chev { width: 13px; height: 13px; margin-left: auto; opacity: .45; transition: transform .12s, opacity .12s; }
.nav .nav-head .nav-count { margin-left: auto; }
.nav .nav-head .nav-count + .chev { margin-left: 6px; }
.nav-group.on > .nav-head { background: var(--ink-3); color: #fff; }
.nav-group:hover > .nav-head, .nav-group:focus-within > .nav-head, .nav-group.open > .nav-head { background: var(--ink-2); color: #fff; }
.nav-group.on:hover > .nav-head, .nav-group.on:focus-within > .nav-head { background: var(--ink-3); }
.nav-group:hover .chev, .nav-group:focus-within .chev, .nav-group.open .chev { opacity: 1; transform: translateX(2px); }
.nav-fly { position: absolute; left: calc(100% + 8px); top: -8px; min-width: 216px; padding: 8px; background: var(--ink-2);
  border: 1px solid var(--ink-3); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(10, 16, 28, .32);
  visibility: hidden; opacity: 0; transform: translateX(-4px);
  transition: opacity .12s ease, transform .12s ease, visibility 0s linear .18s; }
/* an invisible bridge so the pointer can cross the gap without the menu closing */
.nav-fly::before { content: ""; position: absolute; left: -22px; top: 0; bottom: 0; width: 22px; }
.nav-group:hover .nav-fly, .nav-group:focus-within .nav-fly, .nav-group.open .nav-fly {
  visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
.nav-fly-h { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #8d97ab; padding: 4px 10px 6px; }
.nav .nav-fly a { padding: 7px 10px; white-space: nowrap; }
.nav .nav-fly a:hover { background: var(--ink-3); }
.nav .nav-fly a.on { background: var(--ink); color: #fff; box-shadow: inset 2px 0 0 var(--signal); }
.nav-settings { margin-top: 2px; }
@media (max-width: 760px) {
  .nav-fly { left: 0; top: calc(100% + 4px); transform: translateY(-4px); }
  .nav-fly::before { left: 0; right: 0; top: -6px; bottom: auto; width: auto; height: 6px; }
}
@media (prefers-reduced-motion: reduce) { .nav-fly, .nav .nav-head .chev { transition: none; } }

/* ---------- v9: proposals ---------- */
.prop-new { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px 24px; align-items: start; }
.prop-new textarea { min-height: 168px; line-height: 1.5; }
.prop-new .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.prop-src { margin-top: 10px; padding: 10px 12px; background: #fafbfc; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.prop-src b { font-weight: 600; }
.prop-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn.busy { opacity: .6; pointer-events: none; }
.prop-edit { display: grid; grid-template-columns: minmax(360px, 1fr) minmax(0, 1.15fr); gap: 20px; align-items: start; }
.prop-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.prop-fields .wide { grid-column: 1 / -1; }
.prop-body { min-height: 520px; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; tab-size: 2; }
.prop-key { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.prop-key code { background: #eef0f4; border-radius: 4px; padding: 0 4px; font-size: 11.5px; }
.prop-ai { display: flex; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.prop-ai input { flex: 1; }
.prop-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.prop-side { position: sticky; top: 16px; min-width: 0; }
.prop-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; min-height: 24px; }
.prop-gaps { margin: 0 0 12px; padding: 10px 14px 10px 30px; font-size: 13px; background: var(--signal-soft); color: #7a4310;
  border: 1px solid #f0d9bf; border-radius: var(--radius); }
.prop-gaps li { margin: 2px 0; }
.sheet-wrap { background: #e4e7ed; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; overflow: hidden; }
.sheet-fit { transform-origin: 0 0; }
.pdoc { position: relative; background: #fff; box-shadow: 0 1px 3px rgba(22, 32, 51, .18); box-sizing: border-box;
  width: 8.5in; min-height: 11in; padding: 0.55in 0.75in 0.65in; text-align: left; font-feature-settings: normal; }
.pdoc.a4 { width: 210mm; min-height: 297mm; }
.pdoc .pfoot { position: absolute; left: 0.75in; right: 0.75in; bottom: 0.3in; }
.pdoc tbody tr:hover { background: none; }
.pdoc table { overflow: visible; }
.pdoc td, .pdoc th { vertical-align: baseline; }
.pdoc.over::after { content: "Page one ends here"; position: absolute; left: 0; right: 0; top: 11in; border-top: 1.5px dashed var(--bad);
  color: var(--bad); font: 500 11px/1.8 var(--font); text-align: right; padding-right: 10px; }
.pdoc.a4.over::after { top: 297mm; }
@media (max-width: 1100px) { .prop-edit, .prop-new { grid-template-columns: 1fr; } .prop-side { position: static; } }

/* v17: a done/queued state shown where a button was */
.btn.ghost { background: transparent; border-style: dashed; color: var(--muted); cursor: default; font-weight: 400; }
.btn.ghost:hover { border-color: var(--line); }

/* v21: what Grok proposes, with a one-click yes */
.task-suggest { margin-top: 8px; font-size: 13px; background: var(--signal-soft); border: 1px solid #f0d9bf; border-radius: 6px; padding: 8px 10px; color: #5f3a12; }
.task-suggest div { white-space: pre-wrap; margin-top: 2px; }

/* v23: contact form outreach */
.ledger-4 { grid-template-columns: repeat(4, 1fr); }
.cforms .filters { align-items: center; flex-wrap: wrap; }
.cf-table td { vertical-align: top; }
.cf-table tr.cf-more td { border-top: 0; padding-top: 0; padding-bottom: 12px; }
.cf-table tr.cf-more:hover, .cf-table tr:hover + tr.cf-more { background: none; }
.cf-table tr.cf-fresh { background: #fffaf3; }
.cf-table tr.cf-fresh > td:first-child { box-shadow: inset 3px 0 0 var(--signal); }
.cf-table details > summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.cf-msg, .cf-reply div { white-space: pre-wrap; font-size: 13px; line-height: 1.55; }
.cf-msg { margin: 8px 0; padding: 10px 12px; background: #fafbfc; border: 1px solid var(--line); border-radius: 6px; max-width: 760px; }
.cf-reply { margin: 0 0 8px; padding: 10px 12px; background: var(--good-soft); border: 1px solid #cfe5d9; border-radius: 6px; max-width: 760px; }
.cf-reply div { margin-top: 3px; }
.cf-tools { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.cf-mark { display: flex; gap: 8px; min-width: 320px; flex: 0 1 460px; margin: 0; }
.cf-act { text-align: right; white-space: nowrap; }
tr[id^="f"]:target { outline: 2px solid var(--signal); outline-offset: -2px; }
@media (max-width: 760px) { .ledger-4 { grid-template-columns: repeat(2, 1fr); } .cf-table { display: block; overflow-x: auto; } }

/* v24: lead finder as lists */
.finder-form { display: grid; grid-template-columns: 2fr 1.4fr 130px 1.3fr; gap: 0 14px; align-items: end; }
.finder-form label { margin-top: 0; }
.finder-form .ff-must { grid-column: 1 / 4; border: 0; padding: 0; margin: 14px 0 0; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.finder-form .ff-must legend { float: left; padding: 0; margin-right: 4px; font-size: 12px; color: var(--muted); }
.finder-form .go { margin-top: 14px; display: flex; justify-content: flex-end; }
label.check { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-size: 14px; color: var(--text); cursor: pointer; }
label.check input { width: 16px; height: 16px; padding: 0; accent-color: var(--ink); }
.lists { margin-top: 16px; }
.lists td { vertical-align: top; }
@media (max-width: 900px) { .finder-form { grid-template-columns: 1fr 1fr; gap: 10px 14px; } .finder-form .ff-must { grid-column: 1 / -1; margin-top: 4px; } .finder-form .go { grid-column: 1 / -1; margin-top: 4px; } .lists { display: block; overflow-x: auto; } }

/* v25: Google bill on the lead finder */
.gbill { display: grid; grid-template-columns: 190px 1fr; gap: 24px; align-items: center; margin-top: 16px; }
.gbill-main b { display: block; font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--good); border-radius: 3px; }
.meter.warm i { background: #c9a227; }
.meter.full i { background: var(--signal); }
@media (max-width: 760px) { .gbill { grid-template-columns: 1fr; gap: 10px; } }

/* v26: run labels */
.finder-form { grid-template-columns: 2fr 1.4fr 120px 1.2fr 1fr; }
.finder-form .ff-must { grid-column: 1 / 5; }
.pill.tagp { background: var(--ink); color: #fff; text-decoration: none; }
.label-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.label-form label { margin: 0; }
.label-form input { width: 200px; }
@media (max-width: 900px) { .finder-form { grid-template-columns: 1fr 1fr; } .finder-form .ff-must { grid-column: 1 / -1; } }

/* v27: the client is the run's label */
.finder-form { grid-template-columns: 2fr 1.4fr 130px 1.3fr; }
.finder-form .ff-must { grid-column: 1 / 4; }
.label-form select { width: 240px; }
@media (max-width: 900px) { .finder-form { grid-template-columns: 1fr 1fr; } .finder-form .ff-must { grid-column: 1 / -1; } }

/* ---- agents: bar, tabs, chat ---- */
.agent-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 12px; }
.agent-bar .agent-default { margin-left: auto; align-items: center; }
.seg .seg-off { padding: 5px 11px; font-size: 13px; color: #a3a9b5; cursor: not-allowed; }
.chat-panel { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid #e3e6ec; }
.chat-log { height: calc(100vh - 360px); min-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 16px; background: #fafbfc; }
.cmsg { max-width: 78%; padding: 9px 13px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.5; }
.cmsg.user { align-self: flex-end; background: #162033; color: #fff; border-bottom-right-radius: 4px; }
.cmsg.agent { align-self: flex-start; background: #fff; color: #1b2230; border: 1px solid #e3e6ec; border-bottom-left-radius: 4px; }
.cmsg.failed { outline: 1px solid #c0392b; }
.cmsg.typing { color: #6b7280; font-style: italic; }
.cmsg[hidden] { display: none; }
.chat-empty { margin: auto; text-align: center; }
.chat-composer { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid #e3e6ec; background: #fff; align-items: flex-end; }
.chat-composer textarea { flex: 1; resize: none; min-height: 44px; font: inherit; padding: 9px 11px; border: 1px solid #d5d9e0; border-radius: 8px; }
@media (max-width: 760px) { .cmsg { max-width: 92%; } .agent-bar .agent-default { margin-left: 0; } }

/* ---- contact forms: approval ---- */
.cf-draft { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin: 12px 0; background: #fff; }
.cf-draft-h { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.cf-draft label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 4px; }
.cf-draft textarea { width: 100%; min-height: 140px; font: inherit; font-size: 13.5px; line-height: 1.55; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; resize: vertical; box-sizing: border-box; }
.cf-draft input[type=email] { width: 100%; max-width: 360px; box-sizing: border-box; }
.cf-draft-act { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.cf-draft-act input[name=reason] { flex: 1; min-width: 160px; max-width: 280px; }
.cf-flagged { border-color: #e6b8b2; }
.cf-flag-row { padding: 12px 0; border-top: 1px solid var(--line); }
.cf-flag-row form { margin-top: 8px; }

.chat-wrap { display: grid; grid-template-columns: 250px 1fr; gap: 14px; align-items: start; }
.chat-list { padding: 12px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 240px); overflow-y: auto; }
.chat-list nav { display: flex; flex-direction: column; gap: 4px; }
.chat-item { display: block; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: inherit; border: 1px solid transparent; }
.chat-item:hover { background: #f1f3f7; }
.chat-item.on { background: #eef1f8; border-color: #d5dbea; }
.chat-item-t { display: block; font-size: 14px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.chat-item-s { display: block; font-size: 12px; color: #6b7280; margin-top: 2px; }
.chat-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #d98a1b; margin-left: 4px; }
@media (max-width: 800px) { .chat-wrap { grid-template-columns: 1fr; } .chat-list { max-height: 220px; } }
.cf-bulk { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; position: sticky; top: 0; z-index: 5; background: var(--panel, #fff); padding: 8px 0; border-bottom: 1px solid var(--line, #ddd); margin-bottom: 8px; }
.cf-auto { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.cf-draft-h input[type=checkbox] { width: 20px; height: 20px; }

/* 14 Oct UX pass */
.stack { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.today > * { min-width: 0; }
.cf-auto label, .cf-bulk label { display: inline-flex; align-items: center; gap: 6px; }
.cf-auto input[type=checkbox], .cf-bulk input[type=checkbox] { margin: 0; }
.ledger-4 { grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; }
details > summary { cursor: pointer; }
.task-full { margin-top: 4px; }
.task-full > summary { list-style: revert; }

.cf-mine { background: #f2f7f3; }
.cf-follow { display: grid; gap: 6px; margin-top: 8px; }
.cf-follow input, .cf-follow textarea { width: 100%; }
.cf-follow .btn { justify-self: start; }
.cf-sugg { margin: 4px 0 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; max-width: 980px; }
.cf-sugg-h { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.cf-sugg-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px; }
.cf-sugg-card { display: flex; flex-direction: column; gap: 6px; padding: 10px; background: #fafbfc; border: 1px solid var(--line); border-radius: 6px; }
.cf-sugg-card .btn { align-self: flex-start; margin-top: auto; }
.cf-sugg-body { white-space: pre-wrap; font-size: 13px; line-height: 1.55; }
.cf-sugg-ask { display: flex; gap: 8px; margin-top: 8px; }
.cf-sugg-ask input { flex: 1; }
.cf-sugg-link { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.cf-sugg-link details.inline { display: inline; }
.cf-sugg-link details.inline[open] { display: inline-flex; gap: 6px; }
.plan { margin: 12px 0; }
.plan-act { padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; margin: 8px 0; display: grid; gap: 4px; }
.plan-act.is-done { opacity: .75; }
.plan-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.plan-when { font-size: 14px; }
.plan-btns { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.plan-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-top: 6px; }
.plan-redo { display: flex; gap: 8px; margin-top: 10px; }
.plan-redo input { flex: 1; }
.plan-also { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.cf-score-t { width: 100%; max-width: 720px; border-collapse: collapse; font-size: 13px; }
.cf-score-t th { text-align: right; font-weight: 600; color: var(--muted, #667); padding: 4px 10px; }
.cf-score-t th:first-child, .cf-score-t td:first-child { text-align: left; padding-left: 0; }
.cf-score-t td { text-align: right; padding: 5px 10px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.plan-do { border-left: 3px solid var(--signal); }
.plan-send { display: grid; gap: 6px; margin-top: 10px; }
.plan-send textarea { width: 100%; font-size: 13px; line-height: 1.5; }
.seg button { padding: 5px 11px; border-radius: 5px; font-size: 13px; color: var(--muted); background: none; border: 0; cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.cf-score .ledger { margin-top: 10px; }
.cf-win[hidden] { display: none !important; }
.cf-remind { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 8px; }
/* calling */
.call-import { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.call-import label { display: grid; gap: 4px; font-size: 13px; }
.dial-grid { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .dial-grid { grid-template-columns: 1fr; } }
.dial-queue { max-height: calc(100vh - 160px); overflow: auto; position: sticky; top: 16px; }
.dial-rows li { display: flex; gap: 8px; align-items: center; padding: 7px 6px; border-radius: 6px; }
.dial-rows li a { display: grid; color: inherit; text-decoration: none; min-width: 0; }
.dial-rows li a b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dial-rows li.on { background: var(--signal-soft, #fff4e5); }
.dial-who { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.dial-num { font-size: 22px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dial-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.dial-go { min-width: 110px; font-size: 15px; }
.btn.bad { background: #c0392b; border-color: #c0392b; color: #fff; }
.btn.good { background: var(--good, #1e7e4a); border-color: var(--good, #1e7e4a); color: #fff; }
.dial-state { font-size: 13px; color: var(--muted); }
.dial-timer { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.dial-q { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; }
.dial-q i { width: 9px; height: 9px; border-radius: 50%; background: #2e9e5b; }
.dial-q.fair i { background: #e0a100; } .dial-q.poor i { background: #c0392b; } .dial-q.poor span { color: #c0392b; }
.dial-pad { display: grid; grid-template-columns: repeat(3, 56px); gap: 6px; margin-top: 8px; }
.dial-out { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.dial-promote { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
#notes { width: 100%; }
.dial-dev { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-top: 8px; }
.dial-dev label { display: grid; gap: 4px; }
.mic-meter { display: inline-block; width: 140px; height: 8px; background: #eceef2; border-radius: 4px; overflow: hidden; }
.mic-meter i { display: block; height: 100%; width: 0; background: #2e9e5b; transition: width .08s; }
.mic-meter i.hot { background: #c0392b; }
.tx-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 14px; align-items: end; }
.tx-form label { display: grid; gap: 4px; font-size: 13px; }
.call-send { display: inline-flex; gap: 6px; }
.dial-keypad { margin: 0 0 12px; }
.dial-keypad summary { list-style: none; display: inline-flex; }
.dial-keypad summary::-webkit-details-marker { display: none; }
.kp-box { display: grid; gap: 8px; max-width: 260px; margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.kp-box input { font-size: 18px; font-variant-numeric: tabular-nums; }
.kp-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.kp-keys .btn { font-size: 17px; padding: 10px 0; }
/* anything marked hidden stays hidden, whatever its own display style */
[hidden] { display: none !important; }
/* collapsible panels */
.fold-head { cursor: pointer; user-select: none; }
.fold-head h2, h2.fold-head { display: flex; align-items: center; gap: 8px; }
.fold-head h2::after, h2.fold-head::after { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: -3px 0 0 4px; transition: transform .15s; }
.panel.folded .fold-head h2::after, .panel.folded h2.fold-head::after { transform: rotate(-45deg); margin-top: 0; }
.panel.folded > .fold-body { display: none; }
.panel.folded { padding-bottom: 14px; }
.panel.folded > .fold-head { margin-bottom: 0; }
.panel.folded > h2.fold-head, .panel.folded > .fold-head h2 { margin-bottom: 0; }
/* keypad as a small pop-over */
.dial-keypad { position: relative; display: inline-block; margin: 0; }
.dial-keypad .kp-box { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: 230px; max-width: none; background: var(--card, #fff);
  box-shadow: 0 8px 28px rgba(22,32,51,.16); margin: 0; }
.kp-box input { font-size: 16px; padding: 8px 10px; }
.kp-keys .btn { justify-content: center; text-align: center; font-size: 16px; padding: 8px 0; }
.dial-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dial-top .dial-bar { flex: 1; margin: 0; border: 0; padding: 0; }

/* sheet view for calling lists imported from Google Sheets */
.sg-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 12px; overflow-x: auto; }
.sg-tabs a { padding: 7px 14px; border: 1px solid var(--line); border-bottom: none; border-radius: 6px 6px 0 0; color: var(--muted); text-decoration: none; white-space: nowrap; font-size: 13px; }
.sg-tabs a.on { background: var(--panel, #fff); color: var(--text); font-weight: 600; box-shadow: 0 1px 0 var(--panel, #fff); }
.sg-dial .dial-main { margin-bottom: 12px; }
.sg-bar { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; margin: 4px 0 6px; }
.sg-h { display: inline-flex; gap: 4px; align-items: center; } .sg-h .btn { padding: 3px 8px; font-size: 12px; }
.sg-wrap { overflow: auto; max-height: 72vh; border: 1px solid var(--line); border-radius: 6px; background: var(--panel, #fff); }
table.sg { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: max-content; font-size: 13px; }
table.sg th, table.sg td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0; text-align: left; vertical-align: top; }
table.sg th { position: sticky; top: 0; z-index: 2; background: var(--bg-soft, #f4f5f7); font-weight: 600; padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.sg td .c { padding: 4px 8px; white-space: pre-wrap; word-break: break-word; overflow: hidden; max-height: var(--h, 40px); line-height: 18px; }
table.sg tr[style*="--h: none"] td .c, table.sg tr[style*="--h:none"] td .c { max-height: none; }
table.sg td:nth-child(2) { padding: 4px 6px; }
table.sg .sg-n { position: sticky; left: 0; z-index: 1; background: var(--bg-soft, #f4f5f7); color: var(--muted); text-align: center; font-size: 12px; padding: 4px 0; }
table.sg th.sg-n { z-index: 3; }
table.sg th, table.sg .sg-n { position: sticky; }
table.sg tbody tr[data-p] { cursor: pointer; } table.sg tbody tr[data-p]:hover td { background: rgba(0,0,0,.025); }
table.sg tr.on td:not([style*="background"]) { background: var(--signal-soft, #fff4e5); } table.sg tr.on .sg-n { color: var(--text); font-weight: 600; }
table.sg tr.nop td { color: var(--muted); }
table.sg td.sg-notes .c { color: var(--text); }
.sg-cr { position: absolute; right: 0; top: 0; bottom: 0; width: 6px; cursor: col-resize; }
.sg-cr:hover, .sg-rr:hover { background: var(--accent, #3b82f6); opacity: .5; }
table.sg th { position: sticky; } table.sg th { overflow: visible; }
.sg-rr { position: absolute; left: 0; right: 0; bottom: -2px; height: 5px; cursor: row-resize; display: block; }
table.sg td.sg-n { position: sticky; }
table.sg td.sg-n { overflow: visible; }
@media (prefers-color-scheme: dark) { table.sg tbody tr[data-p]:hover td { background: rgba(255,255,255,.04); } }

.sg-ctx { margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--signal, #e0a100); background: var(--signal-soft, #fff4e5); border-radius: 0 6px 6px 0; }
.sg-ctx div { white-space: pre-wrap; margin-top: 4px; font-size: 14px; }
.sheetview #notes { min-height: 0; height: 60px; }
.sheetview .dial-bar { margin-top: 10px; padding: 8px 12px; }
.sheetview .dial-main { padding-top: 14px; padding-bottom: 14px; }

.notes-save { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.row-colour { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.row-colour .rc { display: inline-flex; gap: 6px; align-items: center; padding: 5px 10px; }
.row-colour .rc i { width: 14px; height: 14px; border-radius: 3px; background: var(--rc); display: inline-block; }
.row-colour .rc.on { outline: 2px solid var(--rc); outline-offset: 1px; font-weight: 600; }
table.sg tr.on td { box-shadow: inset 0 2px 0 #1f6feb, inset 0 -2px 0 #1f6feb; }
table.sg tr.nop td[style*="color:#fff"] { color: #fff; }

/* Lead finder: tick boxes and the bar above the lists */
table.lists th.tick, table.lists td.tick { width: 34px; padding-right: 0; }
table.lists td.tick input, table.lists th.tick input, .bulkbar input { width: auto; margin: 0; cursor: pointer; }
table.lists tr.picked td { background: var(--signal-soft, #fff4e5); }
.bulkbar { position: sticky; top: 0; z-index: 5; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; margin: 8px 0;
  background: var(--panel, #fff); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.bulkbar .check { display: inline-flex; gap: 8px; align-items: center; margin-right: auto; font-size: 14px; }
.bulkbar .btn.bad { background: #b42318; border-color: #b42318; color: #fff; }

/* ---- sheet dialling: one pinned dialler, the sheet underneath ---- */
.sd-page { padding: 14px 20px 20px; }
.sd-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.sd-title { display: grid; gap: 2px; } .sd-title b { font-size: 18px; }
.sd-head .sg-tabs { margin: 0; border: 0; }
.sd-bar { position: sticky; top: 0; z-index: 20; display: grid; gap: 8px; padding: 10px 14px; margin-bottom: 10px;
  background: var(--panel, #fff); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 4px 14px rgba(0,0,0,.07); }
.sd-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sd-row-n { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 3px 7px; white-space: nowrap; }
.sd-who { flex: 1 1 220px; min-width: 0; display: grid; }
.sd-who b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-who span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-num { display: grid; text-align: right; } .sd-num > span:first-child { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sd-dial.dial-bar { margin: 0; padding: 0; border: 0; gap: 8px; flex-wrap: nowrap; }
.sd-dial .dial-state { min-width: 90px; }
.sd-nav { display: flex; gap: 6px; } .sd-nav #sd-next { min-width: 112px; }
.sd-ctx { padding: 6px 10px; border-left: 3px solid #f1c232; background: var(--signal-soft, #fff4e5); border-radius: 0 6px 6px 0; cursor: pointer; }
.sd-ctx div { white-space: pre-wrap; font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sd-ctx.open div { display: block; }
.sd-work { display: grid; grid-template-columns: minmax(260px, 1fr) auto; gap: 10px; align-items: start; }
@media (max-width: 1100px) { .sd-work { grid-template-columns: 1fr; } }
.sd-work textarea { min-height: 0; height: 58px; resize: vertical; margin: 0; }
.sd-actions { display: grid; gap: 6px; }
.sd-out { display: flex; gap: 5px; flex-wrap: wrap; } .sd-out .btn { padding: 6px 10px; font-size: 13px; }
.sd-more { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sd-more .btn { padding: 5px 10px; font-size: 13px; }
.sd-cb { display: inline-flex; gap: 6px; align-items: center; } .sd-cb input { width: auto; padding: 4px 6px; }
.sd-colours { display: inline-flex; gap: 4px; }
.sd-colours .rc { width: 24px; height: 24px; border-radius: 5px; border: 2px solid transparent; background: var(--rc); cursor: pointer; padding: 0; }
.sd-colours .rc.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--panel, #fff) inset; }
.sd-foot { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.sd-foot .check { display: inline-flex; gap: 6px; align-items: center; } .sd-foot input { width: auto; }
.sd-audio summary { cursor: pointer; }
.sd-page .sg-wrap { max-height: calc(100vh - 330px); min-height: 260px; }
.sd-page .dial-pad { margin: 0; }

.lsrc { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; flex-basis: 100%; margin-bottom: 10px; }
.lsrc select { width: auto; padding: 4px 8px; }

.gbill .lsrc { grid-column: 1 / -1; margin: 0; }
