.crm { max-width: 1540px; }
.crm-toolbar,.crm-actions { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.crm-toolbar { margin-block:0 12px; }
.crm-toolbar [aria-pressed=true] { font-weight:700; color:var(--lime); box-shadow:inset 0 -2px var(--lime); }
.crm-card,.crm-filter { margin-block:0 14px; padding:16px; min-width:0; }
.crm h3 { margin-block:0 12px; }
.crm-status { min-height:0; margin-block:8px; color:var(--lime); }
.crm-status:empty { margin:0; }
.crm-status.crm-error { color:var(--coral); }
.crm-form { display:grid; gap:12px; justify-items:start; min-width:0; }
.crm-form + .crm-form { border-top:1px solid var(--line); padding-top:18px; margin-top:18px; }
.crm-form h3 { margin:0; }
.crm-filter .crm-form { grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); align-items:end; }
.crm-filter h3 { grid-column:1/-1; }
.crm-field { display:grid; gap:5px; width:100%; max-width:40rem; }
.crm-field label,.crm fieldset legend { color:var(--tx2); }
.crm .crm-check-field {
  display:flex; align-items:center; gap:8px; min-block-size:40px; inline-size:max-content; max-inline-size:100%;
}
.crm-check-field input[type=checkbox],.crm-table input[type=checkbox] { flex:none; margin:0; padding:0; }
.crm-check-field label { cursor:pointer; align-content:center; min-block-size:40px; }
.crm-field textarea { resize:vertical; min-height:105px; }
.crm input:not([type=checkbox]):not([type=radio]),.crm select,.crm textarea {
  min-height:40px; min-width:0; width:100%; max-width:100%; padding:7px 9px; font:inherit;
  border:1px solid var(--edge); color:var(--tx); background:var(--field); border-radius:6px;
}
.crm .btn { min-height:36px; }
.crm :focus-visible { outline:2px solid var(--blue); outline-offset:2px; }
.crm-subline { display:block; margin-top:3px; }
.crm-table { overflow-x:auto; margin-block:10px; }
.crm-table table { width:100%; }
.crm-table caption { position:absolute; inline-size:1px; block-size:1px; overflow:hidden; clip-path:inset(50%); }
.crm-table th { white-space:nowrap; }
.crm-table th:has(> .crm-sort) { padding:0; }
.crm-sort { display:flex; align-items:center; justify-content:space-between; gap:6px; padding:8px 10px;
  width:100%; min-height:36px; border:0; background:none; color:inherit; font:inherit; text-align:inherit; cursor:pointer; }
.crm-sort:hover,[aria-sort] > .crm-sort { color:var(--lime); }
.crm-sort-icon::before { content:"↕"; }
[aria-sort=ascending] .crm-sort-icon::before { content:"↑"; }
[aria-sort=descending] .crm-sort-icon::before { content:"↓"; }
.crm-list-tools .crm-check-field label { min-block-size:44px; padding-inline-end:8px; }
.crm-latest { min-inline-size:15ch; max-inline-size:32ch; white-space:pre-wrap; overflow-wrap:anywhere; }
.crm-saved-followup { width:100%; max-width:40rem; padding:12px; border:1px solid var(--line); border-radius:6px; box-sizing:border-box; }
.crm-saved-followup h4 { margin:0 0 5px; }
.crm-saved-followup p { margin:6px 0 0; white-space:pre-wrap; overflow-wrap:anywhere; }
.crm-phone { display:inline-flex; align-items:center; gap:6px; white-space:nowrap; font-variant-numeric:tabular-nums; }
.crm .crm-phone-toggle { min-block-size:24px; }
.crm-page-jump { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.crm .crm-page-jump input { inline-size:5rem; }
.crm-hint { margin:8px 0 14px; }
.crm fieldset { min-width:0; border:1px solid var(--edge); border-radius:6px; padding:8px 11px; }
.crm-option { display:inline-flex; align-items:center; gap:5px; margin-right:12px; }
.crm input[type=radio],.crm input[type=checkbox] { width:auto; accent-color:var(--lime); }
.crm dialog { width:min(840px, calc(100vw - 28px)); max-height:calc(100dvh - 26px); padding:0 18px 16px;
  color:var(--tx); background:var(--bg); border:1px solid var(--edge); border-radius:10px; }
.crm dialog.crm-customer-action { width:min(560px, calc(100vw - 28px)); }
.crm dialog:modal { overscroll-behavior:contain; }
.crm dialog::backdrop { background:var(--backdrop); overflow:hidden; overscroll-behavior:contain; }
.crm-dialog-head { position:sticky; inset-block-start:0; padding-block:12px; background:var(--bg); z-index:1; }
.crm-dialog-bar { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.crm-dialog-bar .crm-actions { flex:none; }
.crm-dialog-head h2 { margin:0; overflow-wrap:anywhere; }
.crm fieldset.crm-customer-fields { border:0; margin:0; padding:0; }
.crm-summary { display:grid; grid-template-columns:max-content 1fr; gap:8px 16px; margin:0 0 12px; }
.crm-summary dt { color:var(--tx2); }
.crm-summary dd { margin:0; overflow-wrap:anywhere; }
.crm-timeline { list-style:none; padding:0; margin-block:0; }
.crm-timeline li { padding-block:10px; border-bottom:1px solid var(--line); }
.crm-timeline p { white-space:pre-wrap; overflow-wrap:anywhere; margin-block:4px 0; }
.crm-event-head { display:flex; gap:6px 12px; align-items:center; flex-wrap:wrap; }
.crm-event-head time { color:var(--tx2); }
@media (pointer:coarse) {
  .crm .btn,.crm input:not([type=checkbox]):not([type=radio]),.crm select,.crm-check-field label { min-height:48px; }
}
@media (max-width:550px) {
  .crm-filter .crm-form { grid-template-columns:1fr; }
  .crm dialog { padding-inline:12px; }
}
