/* crm.css — round 39 (owned by the crm agent). Loaded after app.css/game.css/hud.css, so rules here override them.
 *
 * The Pipeline (tools/pipeline.js) and Outreach (tools/outreach.js): the KPI strip, the view tabs,
 * Today rows, the board, the list (cards on a phone), the lead drawer (stage path, reach buttons,
 * next step, contacts, value, tags, timeline), the task panel, sequences and the batch sender.
 * Deep navy glass, electric blue accents, white type: the Vault and the Map are the reference.
 */

/* ---- Shared ---- */
.crm { display: grid; gap: var(--s-4); min-width: 0; }
.crm > * { min-width: 0; }
.crm .grow { flex: 1 1 auto; }
.crm .sel { user-select: text; -webkit-user-select: text; overflow-wrap: anywhere; }
.crm .linkish { font: inherit; font-size: var(--t-xs); color: var(--neon-hot); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-align: left; }
.crm .linkish:focus-visible { outline: 2px solid var(--scan); outline-offset: 2px; border-radius: 4px; }
.crm .input--sm { min-height: 38px; padding: 0.4rem 0.75rem; font-size: var(--t-sm); width: auto; max-width: 100%; }
.crm select.input--sm { appearance: none; padding-right: 2rem; background-image: linear-gradient(45deg, transparent 50%, var(--fg-dim) 50%), linear-gradient(135deg, var(--fg-dim) 50%, transparent 50%); background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
/* .crm-chip: the one chip look lives in arsenal.css. */
.crm .seg button:focus-visible, .crm-tab:focus-visible { outline: 2px solid var(--scan); outline-offset: 2px; }
.crm .seg--sm button { padding: 4px 10px; font-size: var(--t-2xs); }
.crm .crm-hint { font-size: var(--t-xs); margin: 0; }
.ico { display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 7px; color: var(--neon-hot); background: rgba(var(--neon-rgb), 0.12); }
.ico svg { width: 14px; height: 14px; }
.ico--lg { width: 34px; height: 34px; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(var(--neon-rgb), 0.35); }
.ico--lg svg { width: 18px; height: 18px; }
.ico--call { color: #7fd1ff; } .ico--text { color: #9fb8ff; } .ico--email { color: #c9d6ff; }
.ico--stage, .ico--seq, .ico--added, .ico--task { color: var(--fg-dim); background: rgba(255, 255, 255, 0.06); }
.ico--score { color: var(--money-hot); background: rgba(var(--money-rgb), 0.12); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: var(--t-2xs); font-weight: 600; color: #cfe0ff; padding: 2px 8px; border-radius: var(--r-pill); background: rgba(var(--neon-rgb), 0.14); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag--x button { font: inherit; color: var(--fg-faint); background: none; border: 0; padding: 0 0 0 2px; cursor: pointer; line-height: 1; }
.tag--x button:hover, .tag--x button:focus-visible { color: #fff; }
.pill--idle { color: #ffb4a8; background: rgba(var(--red-rgb), 0.14); }

/* View tabs (Today / Board / List, Queue / Sequences / Batch). */
.crm-tabs { justify-self: start; display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-pill); background: rgba(4, 10, 28, 0.6); box-shadow: inset 0 0 0 1px var(--line-strong); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.crm-tabs::-webkit-scrollbar { display: none; }
.crm-tab { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: var(--t-sm); font-weight: 700; color: var(--fg-dim); background: none; border: 0; padding: 7px 14px; border-radius: var(--r-pill); cursor: pointer; white-space: nowrap; min-height: 36px; }
.crm-tab[aria-selected="true"] { background: linear-gradient(180deg, var(--neon-hot), var(--neon)); color: #fff; box-shadow: 0 0 18px -4px rgba(var(--neon-rgb), 0.8); }
.crm-tab__n { min-width: 20px; padding: 0 6px; height: 20px; display: inline-grid; place-items: center; border-radius: var(--r-pill); font-size: var(--t-2xs); background: rgba(255, 255, 255, 0.18); color: #fff; }
.crm-tab:not([aria-selected="true"]) .crm-tab__n { background: rgba(var(--neon-rgb), 0.28); }

/* ---- Pipeline: numbers, bar, filters ---- */
.crm-kpis { display: grid; gap: var(--s-3); padding-block: var(--s-4); }
.crm-kpis__head { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); align-items: baseline; justify-content: space-between; }
.crm-kpis__why { font-size: var(--t-xs); }
.crm-kpis__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: var(--s-3) var(--s-4); }
.crm-kpis .week__v { font-size: var(--t-lg); }
.crm-kpis .week__l { overflow-wrap: break-word; }
.crm-bar { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }
.crm-search { flex: 1 1 220px; min-width: 0; max-width: 420px; }
.crm-bar__end { display: flex; gap: var(--s-2); margin-left: auto; }
.crm-filters { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; margin-top: calc(-1 * var(--s-2)); }
.crm-filters[hidden] { display: none; }
.crm-tools { display: grid; gap: var(--s-3); }
.crm-tools .card__head { margin: 0; }
.crm-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.crm-file__label { position: relative; cursor: pointer; }
.crm-file__label:focus-within { outline: 2px solid var(--scan); outline-offset: 2px; }

/* ---- Today ---- */
.today2__sec { display: grid; gap: var(--s-3); }
.today2__sec .card__head { margin: 0; }
.today2__sec--overdue { box-shadow: inset 3px 0 0 var(--red), var(--shadow-card, none); }
.today2__sec--today { box-shadow: inset 3px 0 0 var(--neon), var(--shadow-card, none); }
.today2__sec--nodate { box-shadow: inset 3px 0 0 var(--warn), var(--shadow-card, none); }
.today2__sec--score { box-shadow: inset 3px 0 0 #bfe0ff, var(--shadow-card, none); }
/* To score: compact rows (name, Score, Record), so a fresh list of a hundred stays one glance. */
.today2__scorelist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 6px; }
.today2__scorelist li { display: flex; align-items: center; gap: var(--s-2); padding: 8px 10px; border-radius: var(--r-md); background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); min-width: 0; }
.today2__scorename { flex: 1; display: grid; min-width: 0; font-size: var(--t-sm); line-height: 1.3; }
.today2__scorename b, .today2__scorename span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today2__scorename span { font-size: var(--t-xs); }
.today2__more { justify-self: start; }
.today2__why { margin: calc(-1 * var(--s-2)) 0 0; font-size: var(--t-xs); }
.today2__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.trow { border-radius: var(--r-md); background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow var(--dur-fast); }
.trow.is-open { box-shadow: inset 0 0 0 1px rgba(var(--neon-rgb), 0.75), 0 0 22px -10px rgba(var(--neon-rgb), 0.8); }
.trow__line { display: flex; align-items: center; gap: var(--s-2); padding-right: var(--s-3); }
.trow__main { flex: 1 1 auto; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1.1fr) minmax(0, 1.3fr) auto; gap: 4px var(--s-3); align-items: center; text-align: left; font: inherit; color: var(--fg); background: none; border: 0; padding: var(--s-3); cursor: pointer; border-radius: var(--r-md); }
.trow__main:focus-visible { outline: 2px solid var(--scan); outline-offset: -2px; }
.trow__who { display: grid; gap: 2px; min-width: 0; }
.trow__who b { font-size: var(--t-sm); overflow-wrap: anywhere; }
.trow__who .dim { font-size: var(--t-2xs); }
.trow__what { font-size: var(--t-sm); color: var(--fg-dim); min-width: 0; overflow-wrap: break-word; }
.trow__chips { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.trow__side { flex: none; }
.trow__panel { padding: 0 var(--s-3) var(--s-3); }
@media (max-width: 760px) {
  .trow__line { flex-wrap: wrap; padding: 0 var(--s-3) var(--s-3) 0; }
  .trow__main { grid-template-columns: auto minmax(0, 1fr); }
  .trow__main .ico--lg { grid-row: span 2; align-self: start; }
  .trow__what, .trow__chips { grid-column: 2; }
  .trow__chips { justify-content: flex-start; }
  .trow__side { margin-left: calc(34px + var(--s-3) * 2); }
}

/* ---- The task panel (outreach.js renderTaskPanel) ---- */
.task { display: grid; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-md); background: rgba(3, 8, 24, 0.55); box-shadow: inset 0 0 0 1px rgba(var(--neon-rgb), 0.28); }
.task__step { display: flex; gap: var(--s-3); align-items: center; }
.task__step > div { display: grid; gap: 2px; min-width: 0; }
.task__step b { font-size: var(--t-sm); overflow-wrap: break-word; }
.task__step .dim { font-size: var(--t-2xs); }
.task__pick { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: center; }
.task__msg { display: grid; gap: var(--s-2); }
.task__env { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; align-items: baseline; font-size: var(--t-sm); margin: 0; }
.task__text { white-space: pre-wrap; font-family: var(--font-sans); font-size: var(--t-sm); line-height: 1.55; margin: 0; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--bg-1); box-shadow: inset 0 0 0 1px var(--line); max-height: 320px; overflow: auto; overflow-wrap: anywhere; }
.task__talk summary { cursor: pointer; font-size: var(--t-sm); font-weight: 600; color: var(--neon-hot); }
.task__talk[open] { display: grid; gap: var(--s-2); }
.task__talk .btn { justify-self: start; }
.task__warn { margin: 0; font-size: var(--t-xs); color: var(--warn); }
.task__fine { margin: 0; font-size: var(--t-2xs); color: var(--fg-faint); line-height: 1.5; }
.task__call { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: center; font-size: var(--t-sm); }
.task__call .btn { gap: 6px; }
.task__call .ico { background: none; width: auto; height: auto; color: inherit; }
.task__outcomes, .task__days { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.task__date { width: auto; min-height: 36px; padding: 0.3rem 0.6rem; font-size: var(--t-xs); }
.task__nextset { display: grid; gap: var(--s-2); }
.task__next { margin: 0; font-size: var(--t-xs); }
.task .field { display: grid; gap: 4px; }
.task__go { padding-top: 2px; }

/* ---- Board ---- */
.pipe { grid-auto-columns: minmax(236px, 1fr); }
.pipe__col { transition: box-shadow var(--dur-fast), background var(--dur-fast); }
.pipe__col.is-drop { box-shadow: inset 0 0 0 2px rgba(var(--neon-rgb), 0.85); background: rgba(var(--neon-rgb), 0.1); }
.crm.is-dragging .pipe__col--slim { opacity: 1; }

.pipe__count { display: inline-flex; align-items: baseline; gap: 6px; }
.pipe__count small { font-size: var(--t-2xs); color: var(--money-hot); font-weight: 600; }
.crm .lead { gap: 5px; --surface: transparent; background: linear-gradient(180deg, rgba(26, 48, 102, 0.92), rgba(13, 26, 60, 0.96)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 0 0 1px rgba(var(--neon-rgb), 0.22), 0 8px 18px -12px rgba(0, 0, 0, 0.9); }
.crm .lead__meta { color: #9fb2d8; }
.crm .lead.is-open { box-shadow: inset 0 0 0 1px rgba(var(--neon-rgb), 0.9), 0 0 22px -6px rgba(var(--neon-rgb), 0.7); }
.lead.is-dragging { opacity: 0.45; }
.lead:focus-visible { outline: 2px solid var(--scan); outline-offset: 2px; }
.lead__top { display: flex; gap: 6px; align-items: start; justify-content: space-between; }
.lead__seq { flex: none; font-size: var(--t-2xs); padding: 1px 6px; border-radius: var(--r-pill); color: #fff; background: rgba(var(--neon-rgb), 0.45); }
.lead__next, .lead__contact { display: flex; gap: 6px; align-items: start; font-size: var(--t-xs); color: var(--fg-dim); line-height: 1.35; min-width: 0; }
.lead__next > span:last-child { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.lead__next .ico, .lead__contact .ico { width: 18px; height: 18px; border-radius: 5px; }
.lead__next .ico svg, .lead__contact .ico svg { width: 12px; height: 12px; }
.lead__contact .ico { color: var(--fg-dim); background: rgba(255, 255, 255, 0.06); }
.lead__val { font-size: var(--t-2xs); font-weight: 700; color: var(--money-hot); }
.lead__score { font-size: var(--t-2xs); font-weight: 700; color: var(--fg-dim); }
@media (max-width: 760px) {
  .pipe { grid-auto-columns: 84%; scroll-snap-type: x mandatory; margin-inline: calc(-1 * var(--s-2)); padding-inline: var(--s-2); }
}

/* ---- List: a table on wide screens, cards on a phone ---- */
.crm-table td { vertical-align: top; }
.crm-table .td-sub { display: block; font-size: var(--t-2xs); margin-top: 2px; }
.crm-table td .pill { margin: 0 4px 4px 0; }
.crm-table tr:focus-visible td { background: rgba(var(--neon-rgb), 0.12); outline: none; }
.th-sort { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-transform: inherit; letter-spacing: inherit; }
.th-sort.is-on { color: var(--neon-hot); }
.th-sort.is-on::after { content: ' ↓'; }
@media (max-width: 760px) {
  .crm-table-wrap { background: none; overflow: visible; }
  .crm-table, .crm-table tbody, .crm-table tr, .crm-table td { display: block; width: 100%; }
  .crm-table thead { display: none; }
  .crm-table tbody { display: grid; gap: var(--s-2); }
  .crm-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); }
  .crm-table td { padding: 0; border: 0; font-size: var(--t-xs); min-width: 0; overflow-wrap: anywhere; }
  .crm-table td::before { content: attr(data-label); display: block; font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-faint); margin-bottom: 2px; }
  .crm-table td:first-child { grid-column: 1 / -1; font-size: var(--t-sm); }
  .crm-table td:first-child::before { display: none; }
  .crm-table td.num { text-align: left; }
}

/* ---- The drawer: the record ----
 * Wide screens: a sticky column beside the work (pipeline.js keeps it inside the page).
 * Phones and tablets: a full-screen sheet on <body> (.is-sheet), sliding in from the right. */
.crm__main { display: grid; gap: var(--s-4); min-width: 0; align-content: start; }
.crm__main > * { min-width: 0; }
.crm__main > div:empty { display: none; }
.crm-drawer { display: grid; width: min(480px, 100%); z-index: 300; background: linear-gradient(180deg, rgba(10, 20, 48, 0.98), rgba(5, 10, 26, 0.99)); box-shadow: -1px 0 0 rgba(var(--neon-rgb), 0.35), var(--shadow-float); outline: none; overscroll-behavior: contain; }
.crm-drawer.is-sheet { width: 100%; background: linear-gradient(180deg, #0a1430, #050a1a); transition: transform 380ms var(--ease-drawer), visibility 0s linear 380ms; }
.crm-drawer.is-sheet:not(.is-open) { visibility: hidden; }
.crm-drawer.is-sheet.is-open { transition: transform 380ms var(--ease-drawer), visibility 0s; }
@media (min-width: 1100px) {
  .crm.pipeline.has-drawer { grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); align-items: start; }
  .crm.pipeline > .crm-drawer { position: sticky; top: 0; right: auto; bottom: auto; width: auto; transform: none; transition: none; border-radius: var(--r-xl); max-height: calc(100dvh - var(--top-h, 64px) - var(--dock-h, 96px) - 28px); box-shadow: inset 0 0 0 1px rgba(var(--neon-rgb), 0.35), 0 30px 60px -30px rgba(0, 0, 0, 0.9); z-index: 2; }
  .crm.pipeline > .crm-drawer:not(.is-open) { display: none; }
}
.crm-drawer .drawer__head { position: sticky; top: calc(-1 * var(--s-5)); z-index: 2; margin: calc(-1 * var(--s-5)) calc(-1 * var(--s-5)) 0; padding: var(--s-5) var(--s-5) var(--s-3); background: linear-gradient(180deg, #0a1430 78%, rgba(10, 20, 48, 0)); border-radius: inherit; }
.crm-drawer.is-sheet .drawer__head { top: calc(-1 * (env(safe-area-inset-top, 0px) + var(--s-5))); padding-top: calc(env(safe-area-inset-top, 0px) + var(--s-5)); margin-top: calc(-1 * (env(safe-area-inset-top, 0px) + var(--s-5))); }
.crm-drawer .drawer__title { gap: 4px; }
.crm-drawer .drawer__title .pill { justify-self: start; }
.drawer__x { flex: none; min-width: 40px; }
.crm-drawer .drawer__body { gap: var(--s-4); }
.crm-drawer section { display: grid; gap: var(--s-2); }
.drawer__sechead { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); flex-wrap: wrap; }
.drawer__acts { gap: var(--s-2); }

/* Stage path: every active stage as a segment; click to move. */
.spath { display: grid; gap: var(--s-2); }
.spath__steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 3px; }
.spath__steps li { flex: 1 1 0; min-width: 0; }
.spath__steps li:has(.is-now) { flex: 3 1 auto; }
.spath__step:not(.is-now) span { display: none; }
.spath__step { width: 100%; height: 26px; display: grid; place-items: center; font: inherit; font-size: var(--t-2xs); font-weight: 700; letter-spacing: 0.02em; color: var(--fg-faint); background: rgba(255, 255, 255, 0.09); border: 0; cursor: pointer; padding: 0 2px; clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 50%, calc(100% - 6px) 100%, 0 100%, 6px 50%); transition: background var(--dur-fast), color var(--dur-fast); }
.spath__steps li:first-child .spath__step { clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 50%, calc(100% - 6px) 100%, 0 100%); border-radius: 6px 0 0 6px; }
.spath__step span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.spath__step.is-done { background: rgba(var(--neon-rgb), 0.32); color: #dbe7ff; }
.spath__step.is-now { background: linear-gradient(180deg, var(--neon-hot), var(--neon)); color: #fff; }
.spath__step:hover { color: #fff; }
.spath__step:focus-visible { outline: 2px solid var(--scan); outline-offset: 1px; }
.spath__foot { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: center; justify-content: space-between; }
.spath__now { font-size: var(--t-xs); min-width: 0; flex: 1 1 200px; }

/* Reach: call, text, email, directions, each with its number as text. */
.reach-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.reach { display: grid; justify-items: center; gap: 4px; padding: var(--s-3) 4px; border-radius: var(--r-md); background: var(--bg-1); box-shadow: inset 0 0 0 1px var(--line); color: var(--fg); text-decoration: none; text-align: center; min-width: 0; }
.reach b { font-size: var(--t-xs); }
.reach small { font-size: 0.62rem; color: var(--fg-faint); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.reach:hover, a.reach:focus-visible { box-shadow: inset 0 0 0 1px rgba(var(--neon-rgb), 0.8); background: rgba(var(--neon-rgb), 0.1); outline: none; }
.reach.is-off { opacity: 0.45; }

/* Next step and sequence. */
.drawer__next { padding: var(--s-4); border-radius: var(--r-lg); background: rgba(var(--neon-rgb), 0.08); box-shadow: inset 0 0 0 1px rgba(var(--neon-rgb), 0.25); }
.drawer__when { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.drawer__when input[type="date"] { width: auto; min-height: 36px; padding: 0.3rem 0.6rem; font-size: var(--t-xs); }
.drawer__seq { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; padding-top: var(--s-2); border-top: 1px solid var(--line); font-size: var(--t-xs); }
.drawer__seqname { flex: 1 1 160px; min-width: 0; }
.drawer__seq--start select { flex: 1 1 180px; }
.seqbar { display: inline-flex; gap: 3px; }
.seqbar i { width: 14px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); }
.seqbar i.is-done { background: rgba(var(--neon-rgb), 0.55); }
.seqbar i.is-now { background: var(--neon-hot); box-shadow: 0 0 8px rgba(var(--neon-rgb), 0.9); }

/* Contacts. */
.contacts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.contact { display: grid; gap: 6px; padding: var(--s-3); border-radius: var(--r-md); background: var(--bg-1); box-shadow: inset 0 0 0 1px var(--line); }
.contact.is-primary { box-shadow: inset 0 0 0 1px rgba(var(--neon-rgb), 0.5); }
.contact__top { display: flex; flex-wrap: wrap; gap: 6px var(--s-2); align-items: center; font-size: var(--t-sm); }
.contact__top .dim { font-size: var(--t-xs); }
.contact__lines { display: flex; flex-wrap: wrap; gap: 6px var(--s-4); font-size: var(--t-xs); }
.contact__lines a, .contact__lines span { display: inline-flex; gap: 6px; align-items: center; color: var(--fg); min-width: 0; overflow-wrap: anywhere; }
.contact__lines a { text-decoration: none; }
.contact__lines a:hover { color: var(--neon-hot); }
.contact__lines .ico { width: 18px; height: 18px; }
.contact__form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); padding-top: var(--s-2); }
.contact__form > .field:first-child, .contact__form > .cluster { grid-column: 1 / -1; }
.contact-add summary { cursor: pointer; font-size: var(--t-sm); font-weight: 600; color: var(--neon-hot); list-style: none; padding: 4px 0; }
.contact-add summary::-webkit-details-marker { display: none; }
@media (max-width: 420px) { .contact__form { grid-template-columns: 1fr; } }

/* Value and score. */
.drawer__valgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-3); align-items: center; }
.drawer__score { display: grid; gap: var(--s-2); justify-items: start; font-size: var(--t-sm); }
@media (max-width: 420px) { .drawer__valgrid { grid-template-columns: 1fr; } }

/* Timeline. */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; position: relative; }
.tl { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: var(--s-3); align-items: start; padding: 7px 0; font-size: var(--t-xs); position: relative; }
.tl::before { content: ''; position: absolute; left: 10.5px; top: 30px; bottom: -7px; width: 1px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl__text { padding-top: 3px; overflow-wrap: anywhere; line-height: 1.45; }
.tl__at { padding-top: 3px; font-size: var(--t-2xs); color: var(--fg-faint); white-space: nowrap; }
.tl--note .tl__text { color: #e6edff; }
.crm-del { color: var(--red-hot); }

/* ---- Outreach ---- */
.crm .field > .label { display: block; margin-bottom: 4px; }

.crm-queuehead { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); align-items: baseline; }
.crm-queuehead .dim { font-size: var(--t-xs); }
.crm-queue { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.qitem { border-radius: var(--r-lg); background: var(--bg-1); box-shadow: inset 0 0 0 1px var(--line); }
.qitem.is-open { box-shadow: inset 0 0 0 1px rgba(var(--neon-rgb), 0.7), 0 0 28px -14px rgba(var(--neon-rgb), 0.9); }
.qitem__head { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: var(--s-3); align-items: center; font: inherit; color: var(--fg); background: none; border: 0; padding: var(--s-3) var(--s-4); text-align: left; cursor: pointer; border-radius: var(--r-lg); }
.qitem__head:focus-visible { outline: 2px solid var(--scan); outline-offset: -2px; }
.qitem__who { display: grid; gap: 2px; min-width: 0; }
.qitem__who b { overflow-wrap: anywhere; }
.qitem__who .dim, .qitem__what { font-size: var(--t-xs); }
.qitem .task { margin: 0 var(--s-3) var(--s-3); }
@media (max-width: 760px) {
  .qitem__head { grid-template-columns: auto minmax(0, 1fr) auto; }
  .qitem__what { grid-column: 2 / -1; grid-row: 2; }
}
.crm-soon summary { cursor: pointer; font-weight: 600; }
.crm-soon__list { list-style: none; margin: var(--s-3) 0 0; padding: 0; display: grid; gap: 6px; }
.crm-soon__list li { display: grid; grid-template-columns: auto minmax(0, 0.8fr) minmax(0, 1.2fr) auto; gap: var(--s-2); align-items: center; font-size: var(--t-xs); }
@media (max-width: 560px) { .crm-soon__list li { grid-template-columns: auto minmax(0, 1fr) auto; } .crm-soon__list li > .dim { grid-column: 2 / -1; grid-row: 2; } }

/* Sequences. */
.seqgrid { display: grid; grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.6fr); gap: var(--s-4); align-items: start; }
@media (max-width: 900px) { .seqgrid { grid-template-columns: 1fr; } }
.seqlist { display: grid; gap: var(--s-2); }
.seqcard { display: grid; gap: 8px; text-align: left; font: inherit; color: var(--fg); padding: var(--s-3) var(--s-4); border: 0; border-radius: var(--r-lg); background: var(--bg-1); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; min-width: 0; }
.seqcard[aria-selected="true"] { background: linear-gradient(160deg, rgba(var(--neon-rgb), 0.24), rgba(var(--neon-rgb), 0.06)); box-shadow: inset 0 0 0 1px rgba(var(--neon-rgb), 0.85); }
.seqcard:focus-visible { outline: 2px solid var(--scan); outline-offset: 2px; }
.seqcard__name { font-weight: 700; font-size: var(--t-sm); overflow-wrap: break-word; }
.seqcard__chain { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.seqcard__step { display: inline-flex; gap: 3px; align-items: center; }
.seqcard__step + .seqcard__step::before { content: ''; width: 8px; height: 1px; background: var(--line-strong); margin-right: 1px; }
.seqcard__step small { font-size: 0.62rem; color: var(--fg-faint); }
.seqcard__meta { font-size: var(--t-2xs); }
.seqlist__new { justify-self: start; }
.seqdetail { display: grid; gap: var(--s-4); }
.seqdetail__head { display: flex; flex-wrap: wrap; gap: var(--s-3); justify-content: space-between; align-items: start; }
.seqdetail__head > div:first-child { flex: 1 1 260px; min-width: 0; }
.seqdetail__head p { margin: 4px 0 0; font-size: var(--t-sm); }
.seqsteps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.seqstep { display: grid; grid-template-columns: 52px auto minmax(0, 1fr); gap: var(--s-3); align-items: start; padding: var(--s-2) 0; position: relative; }
.seqstep::before { content: ''; position: absolute; left: calc(52px + var(--s-3) + 16.5px); top: 46px; bottom: -8px; width: 1px; background: rgba(var(--neon-rgb), 0.35); }
.seqstep:last-child::before { display: none; }
.seqstep__day { font-size: var(--t-2xs); font-weight: 700; color: var(--neon-hot); padding-top: 9px; letter-spacing: 0.04em; text-transform: uppercase; }
.seqstep__body { display: grid; gap: 4px; padding-top: 6px; min-width: 0; font-size: var(--t-sm); }
.seqstep__body summary { cursor: pointer; font-size: var(--t-xs); }
.seqstep__body details[open] { display: grid; gap: var(--s-2); }
.enroll { display: grid; gap: var(--s-2); padding: var(--s-4); border-radius: var(--r-lg); background: rgba(3, 8, 24, 0.5); box-shadow: inset 0 0 0 1px var(--line); }
.enroll__head { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; justify-content: space-between; }
.enroll__list { display: grid; gap: 4px; max-height: 300px; overflow: auto; overscroll-behavior: contain; }
.enroll__row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s-2) var(--s-3); align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--bg-2); cursor: pointer; font-size: var(--t-sm); }
.enroll__row:has(input:checked) { box-shadow: inset 0 0 0 1px rgba(var(--neon-rgb), 0.8); background: rgba(var(--neon-rgb), 0.1); }
.enroll__row.is-busy { opacity: 0.6; cursor: default; }
.enroll__row input { width: 18px; height: 18px; accent-color: var(--neon); }
.enroll__name { display: grid; min-width: 0; overflow-wrap: anywhere; }
.enroll__name small { font-size: var(--t-2xs); }
.enroll__to { font-size: var(--t-2xs); overflow-wrap: anywhere; text-align: right; }
@media (max-width: 480px) { .enroll__row { grid-template-columns: auto minmax(0, 1fr); } .enroll__row > :last-child:not(.enroll__name) { grid-column: 2; justify-self: start; text-align: left; } }
.seqactive { display: grid; gap: var(--s-2); }
.seqactive ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.seqactive__row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: var(--s-3); align-items: center; font-size: var(--t-sm); }
@media (max-width: 480px) { .seqactive__row { grid-template-columns: minmax(0, 1fr) auto; } }
.seqedit { display: grid; gap: var(--s-4); }
.seqedit .card__head { margin: 0; flex-wrap: wrap; }
.seqedit .card__head .dim { font-size: var(--t-xs); }
.seqedit__meta { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--s-3); }
.seqedit__about { grid-column: 1 / -1; }
.seqedit__steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); counter-reset: step; }
.seqedit__step { display: grid; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-radius: var(--r-lg); background: var(--bg-1); box-shadow: inset 0 0 0 1px var(--line); }
.seqedit__row { display: grid; grid-template-columns: 80px 130px minmax(0, 1fr) auto; gap: var(--s-2); align-items: end; }
@media (max-width: 640px) { .seqedit__row { grid-template-columns: 72px minmax(0, 1fr) auto; } .seqedit__title { grid-column: 1 / -1; grid-row: 2; } .seqedit__meta { grid-template-columns: 1fr; } }

/* Batch send. */
.batch { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-4); align-items: start; }
.batch__send { grid-column: 1 / -1; display: grid; gap: var(--s-3); }
.batch__send .card__head, .batch__who .card__head, .batch__what .card__head { margin-bottom: var(--s-3); flex-wrap: wrap; }
.batch__who { display: grid; gap: var(--s-3); }
.batch__who .card__head { margin: 0; }
@media (max-width: 860px) { .batch { grid-template-columns: 1fr; } }
.batch__rows { display: grid; gap: 6px; }
.batch__row { display: grid; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); }
.batch__row summary { display: flex; flex-wrap: wrap; gap: 4px var(--s-3); align-items: center; cursor: pointer; font-size: var(--t-sm); }
.batch__row summary .num { font-size: var(--t-xs); }
.batch__row.is-done { opacity: 0.7; }
.batch__row[open] { box-shadow: inset 0 0 0 1px rgba(var(--neon-rgb), 0.5); }
.outreach__consent { margin-top: 0; }

/* Long script titles in a select must not widen the panel. */
.task > *, .drawer__body > * { min-width: 0; }
.task select, .crm-drawer select { width: 100%; min-width: 0; text-overflow: ellipsis; }
.crm-drawer { overflow-x: hidden; }


/* ---- Phone: the strip and the bar fold tighter ---- */
@media (max-width: 640px) {
  .crm-kpis__why { display: none; }
  .crm-kpis__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-3) var(--s-2); }
  .crm-kpis .week__v { font-size: var(--t-md); }
  .crm-kpis .week__v small { font-size: var(--t-2xs); }
  .crm-bar { gap: var(--s-2); }
  .crm-search { order: 3; flex-basis: 100%; max-width: none; }
  .crm-bar__end { margin-left: 0; flex: 1 1 100%; order: 2; }
  .crm-bar__end > .btn { flex: 1 1 0; }
  .crm-filters select { flex: 1 1 140px; }
  .task { padding: var(--s-3); }
}
.task__warn a { color: var(--neon-hot); }

/* The record's hand-offs: two even columns, so none is left alone on a row. */
.drawer__acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
.drawer__acts .btn { justify-content: center; text-align: center; }

/* ---- Today: the queue (work the due list one lead at a time) ---- */
.today2__start { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }
.today2__start .dim { font-size: var(--t-xs); min-width: 0; flex: 1 1 220px; }
.queue { display: grid; gap: var(--s-3); scroll-margin-top: 12px; }
.queue:focus { outline: none; }
.queue__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }
.queue__count { font-weight: 700; color: #fff; white-space: nowrap; }
.queue__bar { flex: 1 1 60px; height: 4px; border-radius: 999px; background: rgba(144, 195, 255, 0.16); overflow: hidden; }
.queue__bar i { display: block; height: 100%; background: var(--blue, #1467ef); box-shadow: 0 0 10px rgba(56, 165, 255, 0.7); transition: width 240ms var(--ease-out, ease); }
.queue__who { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.queue__who h3 { margin: 0; font-size: var(--t-lg); overflow-wrap: anywhere; }
.queue__who p { margin: 0; overflow-wrap: anywhere; }
.queue__what { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--fg); }
@media (max-width: 520px) { .queue__bar { order: 9; flex-basis: 100%; } }
.queue__head button:first-of-type { margin-left: auto; }
