/* ─────────────────────────────────────────────────────────────
   CRM workspace (Oct 2026 redesign)
   One workspace, five tabs. Dense, tabular, quiet: numbers first,
   colour only where it means something (phase, overdue, waiting).
   Every colour comes from the theme tokens, so Default, Dark and
   Steep all render it in their own palette.
   ───────────────────────────────────────────────────────────── */

/* .sortable-fallback: the drag preview lives on <body>, outside .crm. */
.crm, .sortable-fallback {
  --crm-card: var(--paper, #fff);
  --crm-well: var(--paper-2, #f6f6f4);
  --crm-well-2: var(--paper-3, #efede8);
  --crm-line: var(--line-strong, rgba(0,0,0,.12));
  --crm-hair: var(--line, rgba(0,0,0,.07));
  --crm-ink: var(--ink, #111);
  --crm-ink-2: var(--ink-3, #555);
  --crm-mute: var(--text-muted, #777);
  --crm-accent: var(--gold, #0a6cff);
  --crm-ok: var(--success, #2f8a5b);
  --crm-bad: var(--danger, #c4453c);
  --crm-warn: #c98a1a;
  --crm-r: 14px;
  --crm-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --p-inbound: #3b82f6;
  --p-qualify: #8b5cf6;
  --p-proposal: #d97706;
  --p-contract: #0891b2;
  --p-onboarding: #16a34a;
  --p-parked: #94a3b8;
  font-family: var(--font-body);
  color: var(--crm-ink);
  font-variant-numeric: tabular-nums;
}
.crm a, a.sortable-fallback { color: inherit; }
.crm a.crm-btn--primary, .crm .crm-btn--primary { color: var(--crm-card); }

/* ── header ─────────────────────────────────────────────── */
.crm-head { margin-bottom: 20px; }
.crm-head__row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.crm-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--crm-mute); }
.crm-title { font-family: var(--font-body); font-size: 28px; font-weight: 650; letter-spacing: -.02em; margin: 2px 0 0; line-height: 1.15; }
.crm-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.crm-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--crm-line); background: var(--crm-card);
  font: 600 13px/1 var(--font-body); color: var(--crm-ink); text-decoration: none; cursor: pointer;
  box-shadow: var(--crm-shadow); white-space: nowrap; transition: background .12s, border-color .12s;
}
.crm-btn:hover { background: var(--crm-well); }
.crm-btn--primary { background: var(--crm-ink); color: var(--crm-card); border-color: var(--crm-ink); }
.crm-btn--primary:hover { background: var(--crm-ink); opacity: .9; }
.crm-btn--sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; box-shadow: none; }
.crm-btn--ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--crm-ink-2); }
.crm-btn--ghost:hover { background: var(--crm-well); }
.crm-btn--danger { color: var(--crm-bad); }
.crm-inline { display: inline; margin: 0; }

.crm-kpis {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 18px;
  background: var(--crm-card); border: 1px solid var(--crm-hair); border-radius: var(--crm-r);
  box-shadow: var(--crm-shadow); overflow: hidden;
}
.crm-kpi { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; text-decoration: none; border-left: 1px solid var(--crm-hair); transition: background .12s; }
.crm-kpi:first-child { border-left: 0; }
.crm-kpi:hover { background: var(--crm-well); }
.crm-kpi__label { font-size: 12px; color: var(--crm-mute); font-weight: 500; }
.crm-kpi__value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; }
.crm-kpi__value small { font-size: 15px; font-weight: 600; margin-left: 1px; }
.crm-kpi__sub { font-size: 11.5px; color: var(--crm-mute); }
.crm-kpi--alert .crm-kpi__value { color: var(--crm-bad); }

.crm-tabs { display: flex; gap: 4px; margin-top: 18px; border-bottom: 1px solid var(--crm-hair); overflow-x: auto; scrollbar-width: none; }
.crm-tabs::-webkit-scrollbar { display: none; }
.crm-tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px 12px;
  font-size: 14px; font-weight: 550; color: var(--crm-mute); text-decoration: none; white-space: nowrap;
}
.crm-tab:hover { color: var(--crm-ink); }
.crm-tab.is-active { color: var(--crm-ink); }
.crm-tab.is-active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--crm-ink); }
.crm-tab__badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--crm-bad); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

/* ── generic panels / lists ─────────────────────────────── */
.crm-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.crm-toolbar__meta { font-size: 12.5px; color: var(--crm-mute); }
.crm-panel { background: var(--crm-card); border: 1px solid var(--crm-hair); border-radius: var(--crm-r); box-shadow: var(--crm-shadow); }
.crm-panel + .crm-panel { margin-top: 16px; }
.crm-panel__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--crm-hair); }
.crm-panel__title { font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.crm-panel__count { font-size: 12px; font-weight: 600; color: var(--crm-mute); background: var(--crm-well); border-radius: 6px; padding: 1px 7px; }
.crm-panel__body { padding: 6px 18px; }
.crm-panel__body--flush { padding: 0; }
.crm-empty { padding: 22px 18px; font-size: 13px; color: var(--crm-mute); }

.crm-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--crm-hair); text-decoration: none; }
.crm-panel__body--flush .crm-row:first-child { border-top: 0; }
a.crm-row:hover { background: var(--crm-well); }
.crm-row__main { min-width: 0; flex: 1; }
.crm-row__title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-row__sub { font-size: 12.5px; color: var(--crm-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.crm-row__end { display: flex; align-items: center; gap: 8px; flex-shrink: 0; font-size: 12.5px; color: var(--crm-mute); }

.crm-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--crm-ink-2); background: var(--crm-well-2);
}
.crm-avatar--lg { width: 52px; height: 52px; font-size: 18px; }

.crm-chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 550; background: var(--crm-well); color: var(--crm-ink-2); white-space: nowrap; }
.crm-chip--bad { background: color-mix(in srgb, var(--crm-bad) 12%, transparent); color: var(--crm-bad); }
.crm-chip--warn { background: color-mix(in srgb, var(--crm-warn) 14%, transparent); color: var(--crm-warn); }
.crm-chip--ok { background: color-mix(in srgb, var(--crm-ok) 14%, transparent); color: var(--crm-ok); }
.crm-chip--accent { background: color-mix(in srgb, var(--crm-accent) 12%, transparent); color: var(--crm-accent); }
.crm-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--p-parked); }
.crm-dot[data-phase="inbound"] { background: var(--p-inbound); }
.crm-dot[data-phase="waiting"] { background: #94a3b8; }
.crm-dot[data-phase="qualify"] { background: var(--p-qualify); }
.crm-dot[data-phase="proposal"] { background: var(--p-proposal); }
.crm-dot[data-phase="contract"] { background: var(--p-contract); }
.crm-dot[data-phase="onboarding"] { background: var(--p-onboarding); }
.crm-stage { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 550; white-space: nowrap; }

/* ── pipeline board ─────────────────────────────────────── */
.crm-board { display: grid; grid-template-columns: repeat(6, minmax(190px, 1fr)); gap: 12px; align-items: stretch; }
.crm-col { display: flex; flex-direction: column; background: var(--crm-well); border: 1px solid var(--crm-hair); border-radius: var(--crm-r); padding: 10px; min-height: 120px; transition: background .15s, border-color .15s, box-shadow .15s; }
.crm-col__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 10px; }
.crm-col__title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 650; }
.crm-col__count { font-size: 12px; font-weight: 600; color: var(--crm-mute); }
.crm-col__bar { height: 3px; border-radius: 3px; margin: 0 4px 10px; background: var(--p-parked); opacity: .9; }
.crm-col[data-phase="inbound"] .crm-col__bar { background: var(--p-inbound); }
.crm-col[data-phase="waiting"] .crm-col__bar { background: #94a3b8; }
.crm-col[data-phase="qualify"] .crm-col__bar { background: var(--p-qualify); }
.crm-col[data-phase="proposal"] .crm-col__bar { background: var(--p-proposal); }
.crm-col[data-phase="contract"] .crm-col__bar { background: var(--p-contract); }
.crm-col[data-phase="onboarding"] .crm-col__bar { background: var(--p-onboarding); }
.crm-col__empty { font-size: 12px; color: var(--crm-mute); padding: 10px 6px; text-align: center; }

.crm-card {
  display: block; background: var(--crm-card); border: 1px solid var(--crm-hair); border-radius: 12px;
  padding: 12px; text-decoration: none; box-shadow: var(--crm-shadow); transition: border-color .12s, transform .12s;
}
.crm-card:hover { border-color: var(--crm-line); transform: translateY(-1px); }
.crm-card__top { display: flex; align-items: center; gap: 10px; }
.crm-card__name { font-size: 14px; font-weight: 650; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-card__meta { font-size: 12px; color: var(--crm-mute); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-card__stage { margin-top: 10px; font-size: 12px; color: var(--crm-ink-2); display: flex; justify-content: space-between; gap: 8px; }
.crm-card__next { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--crm-hair); font-size: 12.5px; line-height: 1.4; }
.crm-card__next--none { color: var(--crm-bad); }
.crm-card__flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }

.crm-parked { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12.5px; color: var(--crm-mute); }
.crm-parked a { text-decoration: none; }
.crm-parked a:hover { color: var(--crm-ink); }

/* drag and drop: the whole column is the drop zone, the target column
   lights up, the slot where the card will land is a dashed outline, and
   the card follows the pointer without being clipped by a scrolling column. */
.crm-col__list { min-height: 60px; flex: 1 0 auto; }
.crm-col__list.is-capped { flex: 0 0 auto; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; scrollbar-width: thin; }
.crm-col__more { margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--crm-mute); text-align: center; }
.crm-col__list .crm-card { margin-top: 8px; }
.crm-col__list .crm-card:first-child { margin-top: 0; }
.crm-col__list:has([data-lead-id]) .crm-col__empty,
.crm-hold__list:has([data-lead-id]) .crm-col__empty { display: none; }
.crm-col__list .crm-col__empty { border: 1.5px dashed var(--crm-line); border-radius: 10px; padding: 18px 6px; }
.crm-hold__list .crm-col__empty { padding: 16px 18px; text-align: left; }
.crm-card, .crm-hold__list .crm-row { cursor: grab; -webkit-user-drag: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.crm-card .crm-touch { user-select: none; }
body.crm-is-dragging, body.crm-is-dragging * { cursor: grabbing !important; }
body.crm-is-dragging .crm-card:hover { transform: none; }
body.crm-is-dragging .crm-col, body.crm-is-dragging .crm-hold { border-style: dashed; border-color: var(--crm-line); }
.crm-col.is-over, .crm-hold.is-over { background: color-mix(in srgb, var(--crm-accent) 9%, var(--crm-well)); border: 1px solid var(--crm-accent) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--crm-accent) 18%, transparent); }
.crm-col.is-home { opacity: .75; }
/* the slot the card will land in */
.crm-card.is-ghost, .crm-row.is-ghost { background: transparent !important; border: 1.5px dashed var(--crm-accent) !important; box-shadow: none !important; transform: none !important; }
.crm-card.is-ghost > *, .crm-row.is-ghost > * { visibility: hidden; }
.crm-card.is-saving, .crm-row.is-saving { opacity: .6; pointer-events: none; }
/* the card under the pointer */
.sortable-fallback { transition: none !important; animation: none !important; opacity: 1 !important; box-shadow: 0 18px 40px rgba(16, 24, 40, .28) !important; pointer-events: none; z-index: 1000 !important; font-family: var(--font-body); color: var(--crm-ink); }
.crm-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 100; padding: 10px 16px; border-radius: 12px; background: var(--ink, #111); color: var(--paper, #fff); font: 600 13px var(--font-body); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.crm-toast.is-bad { background: var(--danger, #c4453c); color: #fff; }
@media (max-width: 1023px) { .crm-toast { bottom: 90px; } }

/* ── table ──────────────────────────────────────────────── */
.crm-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.crm-filters input, .crm-filters select {
  height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--crm-line); background: var(--crm-card);
  font: 13px var(--font-body); color: var(--crm-ink); min-width: 0;
}
.crm-filters input[type="search"] { flex: 1 1 220px; }
.crm-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.crm-table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--crm-mute); text-transform: uppercase; letter-spacing: .05em; padding: 10px 14px; background: var(--crm-well); border-bottom: 1px solid var(--crm-hair); white-space: nowrap; }
.crm-table th:first-child { border-top-left-radius: var(--crm-r); }
.crm-table th:last-child { border-top-right-radius: var(--crm-r); }
.crm-table td { padding: 11px 14px; border-bottom: 1px solid var(--crm-hair); vertical-align: middle; }
.crm-table tr:last-child td { border-bottom: 0; }
.crm-table tbody tr { cursor: pointer; }
.crm-table tbody tr:hover td { background: var(--crm-well); }
.crm-table .num { text-align: right; }
.crm-who { display: flex; align-items: center; gap: 10px; min-width: 180px; }

/* ── lead record ────────────────────────────────────────── */
.crm-record-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.crm-record-head__name { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin: 0; line-height: 1.15; }
.crm-record-head__meta { font-size: 13px; color: var(--crm-mute); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.crm-record-head__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.crm-stepper { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 18px 0 20px; }
.crm-step { font-size: 12px; font-weight: 600; color: var(--crm-mute); }
.crm-step__bar { height: 6px; border-radius: 6px; background: var(--crm-well-2); margin-bottom: 6px; }
.crm-step.is-done .crm-step__bar { background: var(--crm-ink); opacity: .55; }
.crm-step.is-current .crm-step__bar { background: var(--crm-ink); }
.crm-step.is-current { color: var(--crm-ink); }
.crm-step__sub { display: block; font-weight: 500; font-size: 11.5px; color: var(--crm-mute); }

.crm-record { display: grid; grid-template-columns: 280px minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.crm-facts dl { margin: 0; }
.crm-fact { display: grid; grid-template-columns: 96px 1fr; gap: 8px; padding: 9px 0; border-top: 1px solid var(--crm-hair); font-size: 13px; }
.crm-fact:first-child { border-top: 0; }
.crm-fact dt { color: var(--crm-mute); }
.crm-fact dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

.crm-composer { padding: 14px 18px; border-bottom: 1px solid var(--crm-hair); display: grid; gap: 8px; }
.crm-composer textarea, .crm-form-grid input, .crm-form-grid select, .crm-form-grid textarea, .crm-composer select {
  width: 100%; border: 1px solid var(--crm-line); border-radius: 10px; background: var(--crm-card); color: var(--crm-ink);
  font: 13.5px/1.45 var(--font-body); padding: 9px 11px; box-sizing: border-box;
}
.crm-composer__row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.crm-composer__row select { width: auto; height: 32px; padding: 0 8px; }

.crm-timeline { list-style: none; margin: 0; padding: 4px 18px 10px; }
.crm-event { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 12px 0; }
.crm-event + .crm-event { border-top: 1px solid var(--crm-hair); }
.crm-event__icon { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; background: var(--crm-well); color: var(--crm-ink-2); }
.crm-event--in .crm-event__icon { background: color-mix(in srgb, var(--p-inbound) 14%, transparent); color: var(--p-inbound); }
.crm-event--out .crm-event__icon { background: color-mix(in srgb, var(--p-onboarding) 14%, transparent); color: var(--p-onboarding); }
.crm-event--note .crm-event__icon { background: color-mix(in srgb, var(--p-proposal) 14%, transparent); color: var(--p-proposal); }
.crm-event__head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.crm-event__who { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-event__when { color: var(--crm-mute); font-size: 12px; white-space: nowrap; }
.crm-event__subject { font-size: 12.5px; color: var(--crm-ink-2); margin-top: 1px; }
.crm-event__body { font-size: 13.5px; line-height: 1.55; margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.crm-event__body--clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.crm-event details summary { list-style: none; cursor: pointer; }
.crm-event details summary::-webkit-details-marker { display: none; }
.crm-event--log { padding: 7px 0; }
.crm-event--log .crm-event__icon { width: 28px; height: 18px; background: none; font-size: 8px; color: var(--crm-mute); }
.crm-event--log .crm-event__head { font-size: 12.5px; color: var(--crm-mute); }

.crm-ai { border-color: color-mix(in srgb, var(--crm-accent) 30%, var(--crm-hair)); background: linear-gradient(180deg, color-mix(in srgb, var(--crm-accent) 6%, var(--crm-card)), var(--crm-card) 60%); }
.crm-ai__text { font-size: 13.5px; line-height: 1.55; white-space: pre-line; }
.crm-ai__next { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--crm-well); font-size: 13px; font-weight: 550; }

.crm-next { font-size: 15px; font-weight: 600; line-height: 1.35; }
.crm-next--none { color: var(--crm-bad); }
.crm-kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 7px 0; border-top: 1px solid var(--crm-hair); }
.crm-kv:first-of-type { border-top: 0; }
.crm-kv span:first-child { color: var(--crm-mute); }

.crm-form-grid { display: grid; gap: 8px; }
.crm-form-grid--2 { grid-template-columns: 1fr 1fr; }
.crm-form-grid label { font-size: 12px; color: var(--crm-mute); font-weight: 550; display: grid; gap: 4px; }

.crm-alert { padding: 12px 16px; border-radius: 12px; font-size: 13px; margin-bottom: 16px; background: color-mix(in srgb, var(--crm-bad) 10%, var(--crm-card)); color: var(--crm-bad); border: 1px solid color-mix(in srgb, var(--crm-bad) 25%, transparent); }
.crm-alert--muted { background: var(--crm-well); color: var(--crm-ink-2); border-color: var(--crm-hair); }

/* inbox */
.crm-split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.crm-insight { padding: 14px 18px; border-top: 1px solid var(--crm-hair); }
.crm-insight:first-child { border-top: 0; }
.crm-insight__head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.crm-insight__title { font-size: 14px; font-weight: 650; line-height: 1.35; }
.crm-insight__detail { font-size: 13px; line-height: 1.55; color: var(--crm-ink-2); margin-top: 6px; white-space: pre-line; }
.crm-insight__fix { font-size: 13px; margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--crm-well); }
.crm-mail-preview { font-size: 13px; line-height: 1.5; white-space: pre-wrap; margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--crm-well); max-height: 260px; overflow: auto; }

/* reports */
.crm-bars { display: grid; gap: 8px; padding: 12px 18px 16px; }
.crm-bar { display: grid; grid-template-columns: 140px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; }
.crm-bar__track { height: 8px; border-radius: 8px; background: var(--crm-well-2); overflow: hidden; }
.crm-bar__fill { height: 100%; border-radius: 8px; background: var(--crm-ink); opacity: .75; }
.crm-bar span:last-child { text-align: right; color: var(--crm-mute); }

/* ── responsive ─────────────────────────────────────────── */
@media (max-width: 1280px) {
  .crm-record { grid-template-columns: minmax(0, 1fr) 300px; }
  .crm-record__facts { grid-column: 1 / -1; order: -1; }
  .crm-record__facts .crm-panel__body { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); column-gap: 24px; }
  .crm-record__facts .crm-fact:nth-child(2) { border-top: 0; }
}
@media (max-width: 1100px) {
  .crm-board { grid-template-columns: repeat(6, minmax(240px, 82vw)); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
  .crm-col { scroll-snap-align: start; }
  .crm-split { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .crm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .crm-kpi { border-left: 0; border-top: 1px solid var(--crm-hair); }
  .crm-kpi:nth-child(-n+2) { border-top: 0; }
  .crm-kpi:nth-child(2n) { border-left: 1px solid var(--crm-hair); }
  .crm-kpi:last-child { grid-column: 1 / -1; border-left: 0; }
  .crm-record { grid-template-columns: 1fr; }
  .crm-record__side { order: -1; }
  .crm-title, .crm-record-head__name { font-size: 23px; }
  .crm-hide-sm { display: none; }
  .crm-stepper .crm-step__sub { display: none; }
  .crm-record-head__actions { margin-left: 0; width: 100%; }
  .crm-bar { grid-template-columns: 100px 1fr 32px; }
}

/* Log contact: button on cards/rows + dialog */
.crm-touch { display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--crm-line, rgba(0,0,0,.12));
  background: var(--crm-card, #fff); color: var(--crm-ink-2, #555); font: 600 11.5px var(--font-body); cursor: pointer; white-space: nowrap; }
.crm-touch:hover { background: var(--crm-well, #f4f4f4); color: var(--crm-ink, #111); }
.crm-card__foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.crm-card__foot .crm-card__next { margin-top: 0; padding-top: 0; border-top: 0; flex: 1; min-width: 0; }
.crm-dialog { position: fixed; inset: 0; margin: auto; height: fit-content; max-height: calc(100vh - 32px); box-sizing: border-box; overflow-x: hidden; overflow-y: auto; border: 0; border-radius: 16px; padding: 18px; width: min(420px, calc(100vw - 32px)); background: var(--paper, #fff); color: var(--ink, #111); box-shadow: 0 24px 60px rgba(0,0,0,.25); font-family: var(--font-body); }
.crm-dialog::backdrop { background: rgba(15, 23, 42, .35); backdrop-filter: blur(2px); }
.crm-dialog textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--line-strong, rgba(0,0,0,.14)); border-radius: 10px; background: var(--paper, #fff); color: var(--ink, #111); font: 13.5px/1.45 var(--font-body); padding: 9px 11px; }
.crm-dialog__title { font-size: 16px; font-weight: 700; }
.crm-dialog__sub { font-size: 13px; color: var(--text-muted, #777); margin-top: -4px; }
.crm-channels { display: flex; flex-wrap: wrap; gap: 6px; }
.crm-channel input { position: absolute; opacity: 0; pointer-events: none; }
.crm-channel span { display: inline-flex; height: 30px; align-items: center; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong, rgba(0,0,0,.14)); font-size: 13px; font-weight: 600; cursor: pointer; }
.crm-channel input:checked + span { background: var(--ink, #111); color: var(--paper, #fff); border-color: var(--ink, #111); }
.crm-channel input:focus-visible + span { outline: 2px solid var(--gold, #0a6cff); outline-offset: 2px; }
.crm-outcome-group { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted, #777); margin-top: 6px; }
.crm-touch--quiet { border-color: transparent; background: transparent; color: var(--crm-mute, #777); }
.crm-card__actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.crm-clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
