.crm-panel { display: flex; flex-direction: column; gap: var(--s-m); }
.crm-panel .btn { width: auto; min-width: 0; height: auto; min-height: 36px; padding: 6px var(--s-m); }
.crm-panel h2, .crm-panel h3, .crm-panel h4, .crm-customer h3, .crm-customer h4 { margin: var(--s-s) 0 0; }
.crm-tabs, .crm-filters { display: flex; flex-wrap: wrap; gap: var(--s-s); }
.crm-area { display: flex; flex-direction: column; gap: var(--s-m); min-width: 0; }
.crm-muted { margin: 0; color: var(--c-textSecondary); font-size: 13px; }
.crm-error { margin: 0; color: var(--c-warning); }
.crm-error:empty { display: none; }
.crm-chat { display: grid; grid-template-columns: 300px minmax(0, 1fr) 280px; gap: var(--s-m); align-items: start; }
.crm-list, .crm-thread, .crm-side, .crm-form, .crm-customer { display: flex; flex-direction: column; gap: var(--s-s); background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-l); padding: var(--s-m); min-width: 0; }
.crm-list, .crm-side { max-height: 78vh; overflow-y: auto; }
.crm-search input, .crm-field input, .crm-field select, .crm-field textarea, .crm-compose textarea, .crm-form textarea { width: 100%; box-sizing: border-box; font: inherit; }
.crm-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--c-textSecondary); }
.crm-panel .crm-row { display: flex; flex-direction: column; align-items: stretch; gap: 2px; width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--c-line); border-radius: var(--r-s); color: var(--c-text); }
.crm-row.on { background: var(--c-primarySoft); }
.crm-row-top { display: flex; justify-content: space-between; gap: var(--s-s); }
.crm-row.unread b::after { content: ''; display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: var(--c-primary); }
.crm-preview { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; color: var(--c-textSecondary); }
.crm-thread-head { display: flex; flex-direction: column; gap: 4px; }
.crm-thread-head h3 { margin: 0; }
.crm-panel .crm-back { display: none; align-self: flex-start; }
.crm-log { display: flex; flex-direction: column; gap: var(--s-s); min-height: 260px; max-height: 56vh; overflow-y: auto; padding: var(--s-s); background: var(--c-surfaceAlt); border-radius: var(--r-m); }
.crm-msg { display: flex; flex-direction: column; gap: 4px; max-width: 80%; padding: var(--s-s) var(--s-m); border-radius: var(--r-m); background: var(--c-surface); white-space: pre-wrap; overflow-wrap: anywhere; }
.crm-msg.out { align-self: flex-end; background: var(--c-primarySoft); }
.crm-msg small { color: var(--c-textSecondary); font-size: 11px; }
.crm-photo { display: block; max-width: 100%; max-height: 320px; border-radius: var(--r-s); }
.crm-compose { display: flex; gap: var(--s-s); align-items: flex-end; }
.crm-card { display: flex; flex-direction: column; gap: 4px; padding: var(--s-s); background: var(--c-surfaceAlt); border-radius: var(--r-m); }
.crm-card p { margin: 0; }
.crm-results { display: flex; flex-direction: column; gap: var(--s-s); }
.crm-product { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: var(--s-s); align-items: center; }
.crm-product img { width: 44px; height: 44px; object-fit: cover; border-radius: var(--r-s); }
.crm-product b, .crm-product small { display: block; }
.crm-product small { color: var(--c-textSecondary); font-size: 12px; }
.crm-table { overflow-x: auto; }
.crm-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.crm-table th, .crm-table td { padding: var(--s-s); text-align: left; border-bottom: 1px solid var(--c-line); }
.crm-table th { font-size: 12px; color: var(--c-textSecondary); }
.crm-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-s); }
.crm-tile { display: flex; flex-direction: column; gap: 2px; padding: var(--s-m); background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-m); }
.crm-tile small { font-size: 12px; color: var(--c-textSecondary); }
.crm-bars { display: flex; flex-direction: column; gap: 4px; }
.crm-bar { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; gap: var(--s-s); align-items: center; font-size: 13px; }
.crm-bar span { background: var(--c-surfaceAlt); border-radius: var(--r-s); overflow: hidden; }
.crm-bar i { display: block; height: 12px; background: var(--c-primary); }
.crm-inline { display: flex; flex-wrap: wrap; gap: var(--s-s); align-items: flex-end; }
.crm-inline input, .crm-inline select { min-width: 0; max-width: 100%; }
.crm-customer { margin-top: var(--s-m); }
.crm-customer .crm-form { padding: 0; border: 0; background: transparent; }
@media (max-width: 1100px) { .crm-chat { grid-template-columns: 260px minmax(0, 1fr); } .crm-side { grid-column: 2; } }
@media (max-width: 720px) {
  .crm-chat { grid-template-columns: minmax(0, 1fr); }
  .crm-side { grid-column: auto; }
  .crm-chat.has-thread .crm-list { display: none; }
  .crm-panel .crm-back { display: inline-flex; }
  .crm-list, .crm-side { max-height: none; }
  .crm-log { max-height: 50vh; }
  .crm-bar { grid-template-columns: 74px minmax(0, 1fr); }
  .crm-bar b { grid-column: 1 / -1; }
}
