/* CRM: only what is its own. The base (theme tokens from the site theme, inputs, buttons, tabs, cards, notes, toolbars,
 * the top bar) is shared/biz/app.css. Here: the pipeline board, the customer list and detail, the forms and bulk actions, and
 * the split view (list and detail side by side on a wide screen). */
.main { max-width: 1100px; }
.toolbar { align-items: flex-end; margin-bottom: 10px; }
.toolbar > .note { margin: 0; flex: 1 1 220px; }
.toolbar label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--mute); }
.search { flex: 1 1 220px; min-width: 0; }
.search input, select, input[type="text"], input[type="date"], input[type="email"], input[type="tel"], textarea { min-width: 0; width: 100%; color: var(--ink); }
.empty, .empty-col { color: var(--mute); padding: 12px 0; margin: 0; }
.msg { color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { background: var(--chip); border: 0; border-radius: 999px; padding: 1px 8px; font-size: 12px; color: var(--mute); }
.chip::before { content: none; }   /* a tag, not a status: no status dot */
.stage { font-size: 12px; border-radius: 999px; padding: 2px 9px; border: 1px solid var(--line); white-space: nowrap; align-self: center; }
.s-lead { color: var(--mute); }
.s-contacted { color: var(--warn); border-color: var(--warn); }
.s-customer { color: var(--ok); border-color: var(--ok); }
.s-lost { color: var(--danger); border-color: var(--danger); }
.s-supplier { color: var(--accent); border-color: var(--accent); }
.board { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 900px) { .board { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-width: 0; }
.col.over { border-color: var(--focus); box-shadow: 0 0 0 2px var(--focus) inset; }
.col-h { display: flex; justify-content: space-between; align-items: center; margin: 2px 2px 8px; font-size: 14px; }
.count { color: var(--mute); font-weight: 400; }
.col-body { display: flex; flex-direction: column; gap: 8px; min-height: 48px; }
.card-c { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; cursor: grab; }
.card-c:focus-visible { outline-offset: 1px; }
.c-name { background: none; border: 0; padding: 0; text-align: left; font-weight: 600; cursor: pointer; overflow-wrap: anywhere; }
.c-meta, .c-follow { color: var(--mute); font-size: 12px; overflow-wrap: anywhere; }
.c-follow { color: var(--warn); }
.c-move { align-self: flex-start; background: none; border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; font-size: 12px; cursor: pointer; }
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.row.overdue { border-color: var(--danger); }
.row.today { border-color: var(--warn); }
.row-open { flex: 1; min-width: 0; background: none; border: 0; text-align: left; padding: 0; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.row-sub { color: var(--mute); font-size: 12px; overflow-wrap: anywhere; }
.d-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.d-head .h2 { margin: 0; }
.d-sec { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.h2 { font-size: 20px; margin: 0 0 8px; }
.h3 { font-size: 15px; margin: 0 0 8px; }
.field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; font-size: 12px; color: var(--mute); }
.inline { display: flex; gap: 8px; flex-wrap: wrap; }
.inline input { flex: 1 1 200px; }
.kvs { margin: 0; display: grid; gap: 6px; }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 8px; }
.kv dt { color: var(--mute); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv a { color: var(--accent); }
.note-form { display: grid; gap: 8px; grid-template-columns: 1fr; margin-bottom: 10px; }
.note-form textarea { resize: vertical; }
.notes, .docs { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.notes li { display: grid; grid-template-columns: 96px 1fr; gap: 8px; border-top: 1px solid var(--line); padding-top: 6px; }
.note-date { color: var(--mute); font-size: 12px; }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.docs li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; border-top: 1px solid var(--line); padding-top: 6px; }
.docs .row-sub { flex: 1 1 auto; }
.amt { font-variant-numeric: tabular-nums; }
#view-customer > .sf-p-foot { margin-top: 12px; border-radius: var(--r) var(--r) 0 0; }   /* Edit details, Delete customer (js/ui/detail.js) */
/* a phone: the record is a bottom sheet over the list (TlbxSheet, js/ui/app.js), its footer stuck to the sheet's foot */
.ssh-phone > #view-customer.ssh-panel { block-size: 88dvh; max-block-size: 88dvh; padding: 0 14px; box-sizing: border-box; display: flex; flex-direction: column; }
.ssh-phone > #view-customer > #dBody { flex: 1 0 auto; padding-top: 12px; }
.ssh-phone > #view-customer > .sf-p-foot { position: sticky; bottom: 0; margin: 12px -14px 0; border-radius: 0; }
.crm-form { display: grid; gap: 10px; min-width: min(360px, 80vw); }
.crm-form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--mute); }
.crm-form textarea { resize: vertical; }
.sel-head { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; color: var(--mute); font-size: 13px; }
.sel-head input, .row-check { margin: 0; width: 16px; height: 16px; flex: none; accent-color: var(--accent); }
.bulk { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--panel); border: 1px solid var(--accent); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
.bulk-count { font-weight: 600; margin-right: 4px; }
.bulk select, .bulk input[type="date"] { width: auto; }
.bulk-date { display: inline-flex; gap: 6px; align-items: center; }
.btn.danger:hover { border-color: var(--danger); }
.main.split { max-width: 1320px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.main.split > .view#view-customers { min-width: 0; }
.main.split > .view#view-customer { position: sticky; top: 16px; max-height: calc(100vh - 112px);   /* below the menu bar and the tabs: its footer (Edit details) in view */
  overflow-y: auto; min-width: 0; }
.d-head { display: flex; align-items: center; gap: 12px; }
.d-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; min-width: 0; }
.d-close { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; width: 32px; height: 32px; font-size: 18px; cursor: pointer; }
.main.split .d-close { display: inline-grid; place-items: center; margin-left: auto; }
.main.split .d-head .h2 { margin: 0; }
.sub { display: grid; gap: 6px; margin: 8px 0; }
.sub-t { font-size: 12px; color: var(--mute); text-transform: uppercase; letter-spacing: .04em; }
h4.sub-t { margin: 8px 0 2px; font-weight: 400; }
.kv dd a { overflow-wrap: anywhere; }

/* Customers list: a shell that adapts to the width of the list itself (container queries), so a list beside the
   detail pane stacks its sidebar and drops the date columns instead of squeezing them. */
.cshell { container-type: inline-size; }
.cgrid { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 16px; align-items: start; }
.clist { min-width: 0; }
.list-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.list-tools > .note { margin: 0; flex: 1 1 180px; }
.sort-only { display: none; font-size: 12px; color: var(--mute); }
.sort-only select { margin-left: 4px; }
.density { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg-btn { background: var(--chip); border: 0; padding: 4px 10px; cursor: pointer; font-size: 13px; color: var(--mute); }
.seg-btn[aria-checked="true"] { background: var(--panel-2); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.colhead, .crows .row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 96px 96px 96px 84px; gap: 10px; align-items: center; }
.colhead { margin-bottom: 6px; color: var(--mute); font-size: 12px; }
.colhead .sel-head { margin: 0; }
.sort-head { display: contents; }
.c-h { display: flex; }
.sort-btn { background: none; border: 0; padding: 2px 0; cursor: pointer; color: var(--mute); font-size: 12px; text-align: left; }
.c-h[aria-sort="ascending"] .sort-btn, .c-h[aria-sort="descending"] .sort-btn { color: var(--ink); }
.crows .row { padding: 8px 10px; }
.crows .row-open { flex-direction: row; align-items: center; gap: 10px; min-width: 0; }
.row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; text-align: left; }
.row-text b { overflow-wrap: anywhere; }
.c-cell { font-size: 12px; color: var(--mute); font-variant-numeric: tabular-nums; white-space: nowrap; }
.c-fol.overdue { color: var(--danger); }
.crows.compact .row { padding: 4px 8px; gap: 8px; }
.crows.compact .row-sub, .crows.compact .chips { display: none; }
.crows.compact .av { width: 22px; height: 22px; font-size: 10px; }
.crows.compact .row-open { min-height: 0; }
.crows .stage { justify-self: start; }
@container (max-width: 600px) {
  .colhead, .crows .row { grid-template-columns: 22px minmax(0, 1fr) auto auto; }
  .c-cell, .c-h-activity, .c-h-followUp { display: none; }
  .sort-only { display: inline-flex; align-items: center; }
}
