/* CRM Boards (#/crm) — Monday.com-faithful board skin (Nick 8/12: "copy
   Monday.com's UI in every way possible"; pixel pass calibrated against
   monday.com's own current board imagery). Group colors + status hexes come
   verbatim from the server-driven registry (Monday's exact values).
   Theme follows the portal: LIGHT = Monday's product default; the portal's
   [data-theme="dark"] switches to Monday's dark palette. */

/* Palette + type follow docs/DESIGN.md — navy/gold/cream, Playfair for section
   titles over Inter body. The only Monday-derived colors left are the STATUS
   hexes from Nick's spec workbook, which arrive per-label from the registry. */
#crmScreen { padding: 0; }
#crmRoot {
  max-width: 1560px; margin: 0 auto; padding: 14px 22px 60px;
  --mnd-canvas: var(--lh-white, #ffffff);
  --mnd-panel: var(--lh-gray-50, #fafaf8);
  --mnd-cell: var(--lh-white, #ffffff);
  --mnd-border: var(--lh-gray-300, #cccac4);
  --mnd-border-soft: var(--lh-gray-200, #e5e3de);
  --mnd-text: var(--lh-gray-800, #2c2b28);
  --mnd-text-2: var(--lh-gray-500, #77746c);
  --mnd-accent: var(--lh-gold-dark, #b8943e);
  --mnd-blue: var(--lh-gold-dark, #b8943e);
  --mnd-row-hover: var(--lh-gold-faint, #faf6ec);
  --mnd-selected: var(--lh-gold-pale, #f3ebcf);
  --mnd-head: var(--lh-navy-deep, #1f2533);
  color: var(--mnd-text);
  background: var(--mnd-canvas);
  border-radius: 12px;
}
[data-theme="dark"] #crmRoot {
  --mnd-canvas: var(--surface, #1d2129);
  --mnd-panel: var(--surface-2, #242935);
  --mnd-cell: var(--surface, #1d2129);
  --mnd-border: var(--border-btn, #3a414f);
  --mnd-border-soft: var(--rule, #262b35);
  --mnd-text: var(--text-body, #d5d8df);
  --mnd-text-2: var(--text-muted, #9699a6);
  --mnd-row-hover: rgba(197, 165, 90, 0.09);
  --mnd-selected: rgba(197, 165, 90, 0.16);
  --mnd-head: var(--text-head, #f0f0f3);
}

/* ── Board tabs (the five ops boards) — Monday board-title tab style ── */
.crm-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 2px;
}
.crm-tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.crm-tab {
  border: none; background: transparent; color: var(--mnd-text-2);
  padding: 8px 14px; border-radius: 6px 6px 0 0; font-size: 15px; font-weight: 500;
  cursor: pointer; border-bottom: 2px solid transparent;
}
.crm-tab:hover { color: var(--mnd-text); background: var(--mnd-panel); }
.crm-tab-active { color: var(--mnd-text); font-weight: 700; border-bottom-color: var(--mnd-blue); background: transparent; }

.crm-head-right { display: flex; align-items: center; gap: 10px; }

/* ── View tabs — Monday's view strip (blue underline on the active view) ── */
.crm-views {
  display: flex; gap: 2px; flex-wrap: wrap; width: 100%;
  margin: 0 0 14px; border-bottom: 1px solid var(--mnd-border-soft); padding: 0 2px;
}
.crm-view-chip {
  border: none; background: transparent; color: var(--mnd-text-2);
  padding: 7px 12px 8px; font-size: 13.5px; font-weight: 500; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.crm-view-chip:hover { color: var(--mnd-text); background: var(--mnd-panel); border-radius: 4px 4px 0 0; }
.crm-view-active { color: var(--mnd-text); font-weight: 600; border-bottom-color: var(--mnd-blue); }

.crm-ro-chip {
  font-size: 12px; color: var(--mnd-text-2); border: 1px dashed var(--mnd-border);
  border-radius: 4px; padding: 4px 10px; white-space: nowrap;
}
.crm-sync-btn {
  border: 1px solid var(--mnd-border); background: transparent; color: var(--mnd-text);
  padding: 6px 12px; border-radius: 4px; font-size: 13px; cursor: pointer;
}
.crm-sync-btn:hover { background: var(--mnd-panel); }

.crm-build {
  border: 1px solid var(--mnd-border-soft); background: transparent; color: var(--mnd-text-2);
  border-radius: 4px; padding: 3px 8px; font-size: 11px; cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.crm-build:hover { color: var(--mnd-text); border-color: var(--mnd-blue); }
.crm-diag-pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  white-space: pre-wrap; overflow-wrap: anywhere; background: var(--mnd-panel);
  border: 1px solid var(--mnd-border-soft); border-radius: 8px; padding: 12px; margin: 0;
  color: var(--mnd-text);
}

.crm-empty { color: var(--mnd-text-2); padding: 40px 8px; text-align: center; }
.crm-dim { color: var(--mnd-text-2); }
.crm-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* ── Groups — Monday's colored title (caret + count), color bar incl. header ── */
.crm-group { margin-bottom: 34px; }
.crm-group-head {
  display: flex; align-items: baseline; gap: 8px; cursor: pointer;
  margin: 0 0 8px; font-size: 20px; font-weight: 600; user-select: none;
  font-family: var(--font-serif, 'Playfair Display', Georgia, serif);
}
.crm-caret { font-size: 12px; transition: transform 0.12s ease; width: 14px; text-align: center; align-self: center; }
.crm-group-collapsed .crm-caret { transform: rotate(-90deg); }
.crm-group-name { letter-spacing: 0.01em; }
.crm-group-count { font-size: 13px; color: var(--mnd-text-2); font-weight: 400; }

.crm-tablewrap { overflow-x: auto; }
.crm-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.crm-table th {
  text-align: center; font-size: 13.5px; font-weight: 400; color: var(--mnd-text-2);
  padding: 7px 10px; border-bottom: 1px solid var(--mnd-border-soft);
  border-right: 1px solid var(--mnd-border-soft); border-top: 1px solid var(--mnd-border-soft);
  white-space: nowrap; background: var(--mnd-cell); height: 34px;
}
.crm-table th.crm-name-h { text-align: left; }
.crm-table th.crm-addcol { color: var(--mnd-text-2); font-size: 16px; width: 42px; border-right: none; }
.crm-table td {
  padding: 0 10px; height: 36px; border-bottom: 1px solid var(--mnd-border-soft);
  border-right: 1px solid var(--mnd-border-soft); color: var(--mnd-text);
  white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis;
  background: var(--mnd-cell); text-align: center;
}
.crm-table td.crm-addcol-cell { border-right: none; }
.crm-table tbody tr { cursor: pointer; }
.crm-table tbody tr:hover td { background: var(--mnd-row-hover); }
.crm-table tbody tr.crm-row-selected td { background: var(--mnd-selected); }

/* Group color bar — Monday's 6px strip, spanning the header row too */
td.crm-gbar, th.crm-gbar {
  width: 6px; min-width: 6px; padding: 0; border-right: none; border-bottom: none; border-top: none;
}
.crm-table thead th.crm-gbar { border-top-left-radius: 6px; }
.crm-table tbody tr:last-child td.crm-gbar { border-bottom-left-radius: 6px; }
.crm-table tbody tr:hover td.crm-gbar,
.crm-table tbody tr.crm-row-selected td.crm-gbar { filter: none; }

/* Checkbox column — Monday's row selector (visual selection) */
th.crm-check, td.crm-check { width: 34px; min-width: 34px; padding: 0 8px; }
.crm-check input {
  accent-color: var(--mnd-blue); width: 15px; height: 15px; cursor: pointer;
  vertical-align: middle;
}

.crm-name {
  font-weight: 400; color: var(--mnd-text); min-width: 240px; max-width: 360px;
  text-align: left !important;
}
.crm-name-wrap { display: flex; align-items: center; gap: 6px; min-width: 0; }
.crm-name-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-name-wrap .crm-projlink { flex: 0 0 auto; }

/* ── Status chips — calm: a colored DOT carries the label color, text stays
   neutral. Full label colors live only inside the status picker menu. ── */
.crm-stchip { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; }
.crm-stdot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.crm-stlabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
td.crm-cell-st { min-width: 130px; }
.crm-stage-none { color: var(--mnd-border); font-size: 15px; }
.crm-filecount { color: var(--mnd-text-2); font-size: 12.5px; }

/* Status picker menu (body-level singleton) — the one full-color surface */
.crm-status-menu {
  position: fixed; z-index: 80; width: 232px; max-height: 60vh; overflow-y: auto;
  background: var(--mnd-canvas, #fff); border: 1px solid #d0d4e4; border-radius: 10px;
  box-shadow: 0 14px 44px rgba(0,0,0,0.28); padding: 8px; display: grid; gap: 6px;
}
.crm-menu-chip {
  border: none; border-radius: 4px; color: #fff; font-size: 13px; font-weight: 500;
  padding: 7px 10px; cursor: pointer; text-align: center; text-shadow: 0 1px 1px rgba(0,0,0,0.25);
  width: 100%;
}
.crm-menu-chip:hover { filter: brightness(1.08); }
.crm-menu-current { outline: 2px solid #323338; outline-offset: 1px; }
.crm-menu-clear {
  border: 1px dashed #c3c6d4; background: transparent; color: #676879;
  border-radius: 4px; font-size: 12.5px; padding: 6px 10px; cursor: pointer;
}
.crm-menu-clear:hover { color: #323338; }

/* Search */
.crm-search {
  border: 1px solid var(--mnd-border); background: var(--mnd-cell); color: var(--mnd-text);
  border-radius: 6px; padding: 6px 12px; font-size: 13px; width: 230px; outline: none;
}
.crm-search:focus { border-color: var(--mnd-blue); }
.crm-search::placeholder { color: var(--mnd-text-2); }

/* ── Drawer (item card + sync health) — Monday item-card surface ── */
.crm-scrim { position: fixed; inset: 0; background: rgba(41, 47, 76, 0.45); z-index: 60; }
.crm-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(540px, 94vw); z-index: 61;
  background: var(--mnd-canvas); border-left: 1px solid var(--mnd-border-soft);
  box-shadow: -18px 0 40px rgba(0,0,0,0.28); display: flex; flex-direction: column;
  color: var(--mnd-text);
}
.crm-drawer-wide { width: min(780px, 96vw); }
.crm-drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid var(--mnd-border-soft);
}
.crm-drawer-head h2 {
  margin: 0; font-size: 21px; font-weight: 600; line-height: 1.2;
  font-family: var(--font-serif, 'Playfair Display', Georgia, serif);
  color: var(--mnd-head); overflow-wrap: anywhere; text-wrap: balance;
}
.crm-drawer-heading { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.crm-archived {
  font-size: 11px; color: #df2f4a; border: 1px solid #df2f4a;
  border-radius: 4px; padding: 1px 8px; vertical-align: middle;
}
.crm-monday-link { font-size: 12.5px; color: var(--mnd-blue); white-space: nowrap; }
.crm-close {
  border: none; background: none; color: var(--mnd-text-2); font-size: 16px; cursor: pointer;
  padding: 4px 8px; border-radius: 4px;
}
.crm-close:hover { background: var(--mnd-panel); color: var(--mnd-text); }
.crm-drawer-scroll { overflow-y: auto; padding: 16px 18px; }

/* ── Item card: sectioned, empty fields collapsed ── */
.crm-sec { margin: 0 0 4px; }
.crm-sec + .crm-sec { border-top: 1px solid var(--mnd-border-soft); padding-top: 18px; margin-top: 18px; }
.crm-sec-title {
  margin: 0 0 12px; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.22em; color: var(--lh-gold-dark, #b8943e);
  display: flex; align-items: center; gap: 8px;
}
.crm-sec-count {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; color: var(--mnd-text-2);
  background: var(--mnd-panel); border-radius: 999px; padding: 1px 7px; text-transform: none;
}
.crm-sec-empty { font-size: 13px; }

.crm-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 20px; }
.crm-field { min-width: 0; }
.crm-field-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--mnd-text-2); margin-bottom: 3px;
}
.crm-field-value { font-size: 13.5px; line-height: 1.45; color: var(--mnd-text); overflow-wrap: anywhere; }
.crm-fields-empty { margin-top: 12px; opacity: 0.75; }

/* File chips — a filename is a thing you open, so it should look like one */
.crm-file {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  border: 1px solid var(--mnd-border-soft); border-radius: 6px; padding: 5px 10px;
  background: var(--mnd-panel); margin: 0 6px 5px 0; color: var(--mnd-text);
  cursor: pointer; font: inherit; text-align: left;
}
.crm-file:hover { border-color: var(--lh-gold, #c5a55a); background: var(--lh-gold-faint, #faf6ec); }
.crm-file:hover svg { color: var(--lh-gold-dark, #b8943e); }
.crm-file:focus-visible { outline: 2px solid var(--mnd-blue); outline-offset: 1px; }
.crm-file svg { flex: 0 0 auto; color: var(--mnd-text-2); }
.crm-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }

/* Quick actions under the title */
.crm-quickrow { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.crm-quick {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  font-size: 12.5px; font-weight: 600; padding: 7px 13px; border-radius: 6px;
  background: var(--lh-navy-deep, #1f2533); color: var(--lh-gold, #c5a55a);
  border: 1px solid transparent;
}
.crm-quick:hover { background: var(--lh-navy, #2b3040); }
.crm-quick-quiet {
  background: transparent; color: var(--mnd-text-2); border-color: var(--mnd-border-soft);
  font-weight: 500;
}
.crm-quick-quiet:hover { background: var(--mnd-panel); color: var(--mnd-text); }

.crm-loa {
  font-size: 12.5px; color: var(--mnd-text-2); border-left: 3px solid var(--lh-gold, #c5a55a);
  padding: 6px 0 6px 12px; margin: 0 0 18px;
}
.crm-loa-late { color: var(--lh-red, #d94444); border-left-color: var(--lh-red, #d94444); font-weight: 600; }

.crm-emptywrap { margin-top: 20px; }
.crm-showempty {
  border: 1px solid var(--mnd-border-soft); background: transparent; color: var(--mnd-text-2);
  border-radius: 6px; padding: 6px 12px; font-size: 12.5px; cursor: pointer;
}
.crm-showempty:hover { color: var(--mnd-text); border-color: var(--mnd-border); }

/* Sync-health panel keeps this heading style */
.crm-updates-title {
  font-size: 13px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--mnd-text); margin: 22px 0 10px; display: flex; align-items: center; gap: 8px;
}
.crm-updates-title .crm-group-count { font-size: 12px; }
.crm-update { border: 1px solid var(--mnd-border-soft); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; background: var(--mnd-panel); }
.crm-update-meta { font-size: 11.5px; color: var(--mnd-text-2); margin-bottom: 4px; }
.crm-update-body { font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }

.crm-sync-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.crm-chip {
  font-size: 12.5px; border: 1px solid var(--mnd-border); border-radius: 4px;
  padding: 4px 11px; background: var(--mnd-panel);
}
.crm-chip-good { border-color: #037f4c; color: #0f9b62; }
.crm-chip-bad { border-color: #df2f4a; color: #df2f4a; font-weight: 700; }

@media (max-width: 700px) {
  #crmRoot { padding: 12px 10px 60px; }
  .crm-fields { grid-template-columns: 1fr; }
  .crm-table td { max-width: 180px; }
}

/* Pilot editing affordances */
.crm-chip-pilot { border-style: solid; border-color: var(--mnd-blue); color: var(--mnd-text); }
.crm-editable { cursor: pointer; }
td.crm-editable:hover, .crm-field.crm-editable:hover .crm-field-value { outline: 1px dashed var(--mnd-blue); outline-offset: -2px; }
.crm-editor {
  font: inherit; color: var(--mnd-text); background: var(--mnd-cell);
  border: 1px solid var(--mnd-blue); border-radius: 4px; padding: 4px 8px; max-width: 100%;
}
.crm-editor-area { width: 100%; min-height: 72px; resize: vertical; }

/* ── Kanban (Installations) — one lane per stage, drag to restage ── */
.crm-kanban {
  display: flex; gap: 12px; align-items: flex-start;
  overflow-x: auto; padding: 2px 2px 18px;
}
.crm-kcol {
  flex: 0 0 252px; width: 252px; background: var(--mnd-panel);
  border: 1px solid var(--mnd-border-soft); border-radius: 10px; padding: 10px;
  max-height: 78vh; display: flex; flex-direction: column;
}
.crm-kcol-head {
  display: flex; align-items: center; gap: 7px; padding: 2px 2px 10px;
  font-size: 12.5px; font-weight: 700; color: var(--mnd-text);
}
.crm-kcol-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-kcol-cards { overflow-y: auto; min-height: 24px; }
.crm-kcard {
  background: var(--mnd-cell); border: 1px solid var(--mnd-border-soft);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; cursor: grab;
  box-shadow: 0 1px 2px rgba(31, 37, 51, 0.06);
}
.crm-kcard:hover { border-color: var(--lh-gold, #c5a55a); }
.crm-kcard:active { cursor: grabbing; }
.crm-kcard-drag { opacity: 0.45; }
.crm-kcol-over { border-color: var(--lh-gold, #c5a55a); background: var(--lh-gold-faint, #faf6ec); }
.crm-kcard-name { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.crm-kcard-title {
  flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--mnd-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crm-kcard-meta { font-size: 12px; color: var(--mnd-text-2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-kcard-dates {
  font-size: 12px; color: var(--mnd-text); margin-top: 4px;
  border-left: 3px solid var(--lh-gold, #c5a55a); padding-left: 8px;
}

/* Row-level portal-project link (inline SVG map icon) */
.crm-projlink {
  text-decoration: none; color: var(--mnd-blue); display: inline-flex;
  align-items: center; gap: 4px; padding: 2px; border-radius: 4px; opacity: 0.75;
}
.crm-projlink:hover { opacity: 1; background: var(--mnd-panel); }
.crm-projlink svg { display: block; }

/* Skeleton loading — the board's shape appears instantly */
.crm-sk {
  border-radius: 6px;
  background: linear-gradient(100deg, var(--mnd-panel) 40%, var(--mnd-row-hover) 50%, var(--mnd-panel) 60%);
  background-size: 200% 100%;
  animation: crm-shimmer 1.3s ease-in-out infinite;
}
.crm-sk-title { width: 220px; height: 22px; margin-bottom: 12px; }
.crm-sk-row { height: 36px; margin-bottom: 6px; }
@keyframes crm-shimmer { from { background-position: 120% 0; } to { background-position: -80% 0; } }

/* Group expander ("Show all N items") + inline empty-state action */
.crm-expand {
  margin-top: 8px; border: 1px solid var(--mnd-border-soft); background: var(--mnd-cell);
  color: var(--mnd-blue); border-radius: 6px; padding: 6px 14px; font-size: 13px; cursor: pointer;
}
.crm-expand:hover { background: var(--mnd-panel); }

/* Toast (non-blocking feedback — alert() froze the tab) */
.crm-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px); z-index: 90;
  background: #323338; color: #fff; border-radius: 8px; padding: 10px 18px;
  font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  opacity: 0; pointer-events: none; transition: opacity 0.18s ease-out, transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.crm-toast-show { opacity: 1; transform: translate(-50%, 0); }

/* Editability affordance: a quiet chevron appears on hover of a status cell */
td.crm-cell-st.crm-editable { cursor: pointer; position: relative; }
td.crm-cell-st.crm-editable::after {
  content: "▾"; position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--mnd-text-2); opacity: 0; transition: opacity 0.12s ease-out;
}
td.crm-cell-st.crm-editable:hover::after { opacity: 0.9; }

/* Keyboard focus — visible, consistent */
.crm-tab:focus-visible, .crm-view-chip:focus-visible, .crm-sync-btn:focus-visible,
.crm-expand:focus-visible, .crm-menu-chip:focus-visible, .crm-menu-clear:focus-visible,
.crm-close:focus-visible, .crm-search:focus-visible, .crm-projlink:focus-visible {
  outline: 2px solid var(--mnd-blue); outline-offset: 1px;
}

/* Motion: drawer slides, menus scale in — quick, state-conveying only */
.crm-drawer { animation: crm-drawer-in 0.2s cubic-bezier(0.22, 1, 0.36, 1); }
.crm-scrim { animation: crm-fade-in 0.16s ease-out; }
.crm-status-menu { animation: crm-pop-in 0.13s cubic-bezier(0.22, 1, 0.36, 1); transform-origin: top left; }
.crm-profile-card { animation: crm-fade-in 0.14s ease-out; }
/* Transform only — never animate the drawer's opacity: a renderer or a
   backgrounded tab that catches the first frame would show a faded panel. */
@keyframes crm-drawer-in { from { transform: translateX(24px); } to { transform: none; } }
@keyframes crm-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes crm-pop-in { from { transform: scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .crm-drawer, .crm-scrim, .crm-status-menu, .crm-profile-card { animation: none; }
  .crm-sk { animation: none; }
  .crm-caret, .crm-toast { transition: none; }
}

/* ── User avatars (Monday's initial bubbles) + profile card ── */
.crm-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; color: #fff;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em; cursor: pointer;
  vertical-align: middle; user-select: none; border: 2px solid var(--mnd-cell);
  text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}
.crm-avatar:hover { filter: brightness(1.1); }
.crm-avatar-lg { width: 44px; height: 44px; font-size: 16px; cursor: default; border: none; }
.crm-avatar-stack { display: inline-flex; align-items: center; }
.crm-avatar-stack .crm-avatar + .crm-avatar { margin-left: -8px; }
/* No name beside the bubble anywhere — hovering it names the person, and the
   profile card carries the rest. */
.crm-profile-card {
  /* Body-level: --mnd-* tokens live on #crmRoot, so every value needs a
     literal fallback or the card renders transparent. */
  position: fixed; z-index: 2147482000; width: 260px;
  background: var(--mnd-canvas, #fff); border: 1px solid var(--mnd-border-soft, #d0d4e4);
  border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,0.25);
  padding: 14px 16px; color: var(--mnd-text);
}
.crm-profile-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.crm-profile-name { font-size: 15px; font-weight: 600; }
.crm-profile-role { font-size: 12px; color: var(--mnd-text-2); text-transform: capitalize; }
.crm-profile-mail { font-size: 12.5px; color: var(--mnd-blue); text-decoration: none; overflow-wrap: anywhere; }
.crm-profile-mail:hover { text-decoration: underline; }

/* End-to-end journey rail (drawer) — lead → closeout in one read.
   Gold left-border is the portal's signature accent (DESIGN.md §5). */
.crm-journey {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 14px 18px;
  border-left: 3px solid var(--lh-gold, #c5a55a); background: var(--mnd-panel);
  border-radius: 0 8px 8px 0; padding: 14px 16px; margin: 0 0 20px;
}
.crm-journey-seg { min-width: 0; }
.crm-journey-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--mnd-text-2); margin-bottom: 4px;
}
.crm-journey-body { font-size: 12.5px; overflow-wrap: anywhere; line-height: 1.4; }
.crm-journey-body a { text-decoration: none; color: var(--lh-gold-dark, #b8943e); font-weight: 600; }
.crm-journey-body a:hover { text-decoration: underline; }
/* The connectors were noise in a wrapping grid — the reading order carries it */
.crm-journey-arrow { display: none; }
.crm-loa-late { color: #df2f4a; font-weight: 700; }

/* ── W14: personal view chips + the view builder tray ──
   The builder is an inline tray under the view strip (Monday's filter tray
   gesture) on the same --mnd-* tokens: panel surface, full soft border, gold
   only where the design system already uses it (section eyebrows, links,
   focus). Primary action = navy in light / gold in dark, per docs/DESIGN.md. */
.crm-view-mine { font-style: normal; }
.crm-view-edit {
  display: inline-block; margin-left: 7px; color: var(--mnd-text-2);
  font-size: 12px; line-height: 1; cursor: pointer;
}
.crm-view-edit:hover { color: var(--mnd-accent); }
.crm-view-add { color: var(--mnd-text-2); }
.crm-view-add:hover { color: var(--mnd-accent); }

.crm-builder {
  background: var(--mnd-panel); border: 1px solid var(--mnd-border-soft);
  border-radius: 10px; padding: 14px 16px 16px; margin: -6px 0 18px;
  animation: crm-builder-in 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes crm-builder-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .crm-builder { animation: none; }
}

.crm-builder-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.crm-builder-spacer { flex: 1 1 auto; }
.crm-bname { flex: 0 1 320px; font-weight: 600; }

.crm-binput, .crm-bsel {
  background: var(--mnd-cell); border: 1px solid var(--mnd-border);
  border-radius: 6px; padding: 6px 10px; font-size: 13px; color: var(--mnd-text);
  font-family: inherit; min-width: 0;
}
.crm-bsel { cursor: pointer; max-width: 220px; }
.crm-binput::placeholder { color: var(--mnd-text-2); }

.crm-bbtn {
  border: 1px solid var(--mnd-border); background: transparent; color: var(--mnd-text);
  padding: 6px 14px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer;
}
.crm-bbtn:hover { background: var(--mnd-row-hover); }
.crm-bbtn-primary {
  background: var(--lh-navy-deep, #1f2533); border-color: var(--lh-navy-deep, #1f2533);
  color: #ffffff; font-weight: 600;
}
.crm-bbtn-primary:hover { background: #2a3244; }
[data-theme="dark"] .crm-bbtn-primary {
  background: var(--lh-gold, #c5a55a); border-color: var(--lh-gold, #c5a55a);
  color: #1f2533;
}
[data-theme="dark"] .crm-bbtn-primary:hover { background: #d0b46e; }
.crm-bbtn-danger { color: #df2f4a; border-color: rgba(223, 47, 74, 0.45); }
.crm-bbtn-danger:hover { background: rgba(223, 47, 74, 0.08); }

.crm-builder-cols {
  display: grid; grid-template-columns: minmax(300px, 1.7fr) minmax(210px, 1fr) minmax(230px, 1fr);
  gap: 8px 26px; align-items: start;
}
@media (max-width: 900px) {
  .crm-builder-cols { grid-template-columns: 1fr; gap: 18px; }
}
.crm-bcol > .crm-sec-title { margin-bottom: 10px; }

/* Rule row: lead | controls | remove — a grid so the lead never orphans and
   the × never wraps away from its rule; chips flow on their own line under
   the controls, still aligned to the controls column. */
.crm-brule {
  display: grid; grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 6px 8px; align-items: start; margin: 0 0 8px;
}
.crm-brule-lead {
  text-align: right; font-size: 12.5px; color: var(--mnd-text-2);
  padding-top: 7px;
}
.crm-brule-body { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.crm-brow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; }
.crm-brule-del {
  border: none; background: transparent; color: var(--mnd-text-2); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 4px 6px; border-radius: 4px;
}
.crm-brule-del:hover { color: #df2f4a; background: var(--mnd-row-hover); }

.crm-blink {
  border: none; background: transparent; color: var(--lh-gold-dark, #b8943e);
  font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 0; margin-left: 50px;
}
.crm-blink:hover { text-decoration: underline; }

.crm-bcombine {
  display: inline-flex; border: 1px solid var(--mnd-border); border-radius: 6px;
  overflow: hidden; margin: 0 0 8px 50px;
}
.crm-bseg {
  border: none; background: transparent; color: var(--mnd-text-2);
  padding: 5px 12px; font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.crm-bseg + .crm-bseg { border-left: 1px solid var(--mnd-border); }
.crm-bseg-on { background: var(--mnd-selected); color: var(--mnd-text); font-weight: 600; }
.crm-brule .crm-bcombine { margin: 0; }

.crm-bvchips { display: flex; flex-wrap: wrap; gap: 6px; grid-column: 2; margin: 0; }
.crm-bvchip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--mnd-border); background: var(--mnd-cell); color: var(--mnd-text);
  border-radius: 999px; padding: 4px 11px; font-size: 12.5px; cursor: pointer;
}
.crm-bvchip:hover { border-color: var(--mnd-accent); }
.crm-bvchip-on { font-weight: 600; }
.crm-bvchip-on .crm-stdot { background: currentColor !important; opacity: 0.9; }

.crm-bgroups { display: flex; flex-direction: column; gap: 5px; }
.crm-bgroup {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--mnd-border-soft); background: var(--mnd-cell);
  border-radius: 6px; padding: 6px 10px; cursor: grab; font-size: 13px;
}
.crm-bgroup:active { cursor: grabbing; }
.crm-bgroup-before { box-shadow: 0 -2px 0 0 var(--mnd-accent); }
.crm-bgroup-after { box-shadow: 0 2px 0 0 var(--mnd-accent); }
.crm-bgrip { color: var(--mnd-text-2); font-size: 11px; letter-spacing: -2px; cursor: grab; }
.crm-bgroup-title { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-bgroup-btns { display: flex; gap: 2px; }
.crm-bgroup-btns button {
  border: none; background: transparent; color: var(--mnd-text-2); cursor: pointer;
  font-size: 13px; padding: 2px 5px; border-radius: 4px;
}
.crm-bgroup-btns button:hover:not(:disabled) { background: var(--mnd-row-hover); color: var(--mnd-text); }
.crm-bgroup-btns button:disabled { opacity: 0.3; cursor: default; }

.crm-view-edit:focus-visible, .crm-view-add:focus-visible, .crm-bbtn:focus-visible,
.crm-binput:focus-visible, .crm-bsel:focus-visible, .crm-bseg:focus-visible,
.crm-bvchip:focus-visible, .crm-blink:focus-visible, .crm-brule-del:focus-visible,
.crm-bgroup-btns button:focus-visible {
  outline: 2px solid var(--mnd-accent); outline-offset: 1px;
}
