/* CRM upgrade (modules/crm.js): board, deal page, tasks. Uses the app's tokens so themes and dark mode follow. */
.crm-pipes { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--white); border: 1px solid var(--line); border-radius: 9px; padding: 3px; margin: 4px 0 12px; }
.crm-pipes button { border: 0; background: transparent; color: var(--muted); font: 600 12px 'DM Sans', sans-serif; padding: 6px 12px; border-radius: 7px; cursor: pointer; }
.crm-pipes button.on { background: var(--primary); color: #fff; }
.crm-board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.crm-col { flex: 0 0 240px; background: color-mix(in srgb, var(--line) 55%, var(--paper)); border-radius: 12px; padding: 8px; min-height: 260px; border: 2px dashed transparent; }
.crm-col.over { border-color: var(--primary); background: var(--tint, var(--mint)); }
.crm-col-head { display: flex; align-items: center; gap: 6px; padding: 2px 4px 8px; font-size: 12px; }
.crm-col-head span { background: var(--white); border-radius: 10px; padding: 0 7px; } .crm-col-head small { margin-left: auto; color: var(--muted); }
.crm-card { background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; margin-bottom: 8px; display: grid; gap: 2px; cursor: grab; user-select: none; -webkit-touch-callout: none; box-shadow: var(--elev-1); }
.crm-card:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--line)); }
.crm-card b { font-size: 13px; } .crm-card > span { color: var(--muted); font-size: 11px; }
.crm-card-foot { display: flex; justify-content: space-between; gap: 6px; margin-top: 5px; font-size: 11px; }
.crm-card-foot em { font-style: normal; font-weight: 700; } .crm-card-foot small { color: var(--muted); }
.crm-card.dragging { opacity: .35; }
.crm-ghost { position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none; box-shadow: var(--elev-3); }
.late { color: var(--sec-warn, #c07a35); font-weight: 700; }

.crm-crumb { margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.crm-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; min-height: 0; }
.crm-head h2 { font-size: 20px; margin: 0 0 4px; } .crm-head p { margin: 0; font-size: 12px; color: var(--muted); }
.crm-amt { font: 700 20px Manrope, sans-serif; } .crm-amt small { font: 500 12px 'DM Sans', sans-serif; color: var(--muted); }
.crm-record { display: grid; grid-template-columns: 280px minmax(0, 1fr) 300px; gap: 12px; align-items: start; }
.crm-record .panel { min-height: 0; }
.crm-details { display: grid; gap: 4px; }
.crm-stage { display: grid; gap: 4px; font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.crm-stage select { width: 100%; }
.crm-logbox { display: grid; gap: 8px; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.crm-logbox textarea { width: 100%; font: inherit; color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; resize: vertical; }
.crm-logbox div { display: flex; gap: 6px; flex-wrap: wrap; }
.crm-tl { display: grid; grid-template-columns: 12px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.crm-tl:last-child { border-bottom: 0; } .crm-tl p { margin: 0; } .crm-tl small { color: var(--muted); font-size: 11px; }
.crm-tl-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 2px 0 !important; }
.crm-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 4px; background: var(--muted); }
.crm-k-call .crm-dot { background: var(--primary); } .crm-k-email .crm-dot { background: #4c7fb5; } .crm-k-meeting .crm-dot { background: #8a5fb0; }
.crm-k-reply .crm-dot { background: #2f9b8f; } .crm-k-stage .crm-dot { background: var(--secondary); } .crm-tl-notes .crm-dot { background: #c2a23a; }
.crm-side { display: grid; gap: 12px; }
.crm-task { display: grid; grid-template-columns: 24px 1fr auto; gap: 9px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.crm-task:last-child { border-bottom: 0; } .crm-task span { display: grid; min-width: 0; } .crm-task small { color: var(--muted); font-size: 11px; }
.crm-task em { font-style: normal; font-size: 11px; color: var(--muted); white-space: nowrap; } .crm-task em.late { color: var(--sec-warn, #c07a35); font-weight: 700; }
.crm-task.done b { text-decoration: line-through; color: var(--muted); }
.crm-tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); background: var(--white); color: #fff; cursor: pointer; font-size: 12px; padding: 0; display: grid; place-items: center; }
.crm-tick:hover { border-color: var(--primary); } .crm-task.done .crm-tick { background: var(--primary); border-color: var(--primary); }
.crm-tick-follow { border: 0; cursor: default; color: inherit; }
.crm-tasks-tools { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.crm-tasks-tools label { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.crm-tgroups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.crm-tg { min-height: 0; } .crm-tg h2 span { color: var(--muted); font-weight: 600; } .crm-tg[data-g=overdue] h2 { color: var(--sec-warn, #c07a35); }
@media (max-width: 1180px) { .crm-record { grid-template-columns: 260px minmax(0, 1fr); } .crm-side { grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); } }
@media (max-width: 760px) {
  .crm-record, .crm-tgroups, .crm-side { grid-template-columns: minmax(0, 1fr); }
  .crm-col { flex-basis: 78vw; }
}
/* fit the app's panel style */
.crm-record .panel h2, .crm-side .panel h2, .crm-tg h2 { font: 700 13px Manrope, sans-serif; margin: 0 0 10px; letter-spacing: 0; }
.crm-side .panel-heading { margin-bottom: 6px; } .crm-side .panel-heading h2 { margin: 0; }
.crm-head .status-pill { display: inline-flex; width: auto; vertical-align: middle; margin: 0 2px; }
.crm-crumb a, .crm-task a, .crm-follow a { color: var(--primary); text-decoration: none; font-weight: 600; }
.crm-crumb a:hover, .crm-task a:hover { text-decoration: underline; }
.crm-tasks-tools select { font: inherit; color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; }
.crm-record .panel, .crm-side .panel, .crm-tg { padding: 14px 16px; }

/* R2: companies */
.crm-co-row { cursor: pointer; } .crm-co-row:hover td { background: var(--tint, var(--mint)); }
.crm-co-row[hidden] { display: none; }
#crm-co-filter { margin: 4px 0 10px; max-width: 320px; }
.crm-record h2.crm-gap { margin-top: 14px; }
.crm-head a { color: var(--primary); text-decoration: none; font-weight: 600; }
.crm-record .linked-row span, .crm-side .linked-row span { font-size: 13px; }
.crm-record .linked-row small, .crm-side .linked-row small { font-size: 11px; }
