/* ITS CRM control sizes. Loaded last so these sizes win over older per-module rules.
   Three sizes only: --h-sm 32px (compact), --h-md 40px (default), header/icon 36px.
   Row-level micro controls (rename pencils, row menus, quick replies) keep their own size. */

/* Text buttons: 40px, small: 32px */
:root[data-theme] :is(.btn, a.btn, summary.btn, label.btn):not(.icon-btn) {
  height: var(--h-md);
  min-height: var(--h-md);
  padding-block: 0;
  padding-inline: var(--sp-4);
  font-size: var(--fs-sm);
  border-radius: var(--r-sm);
  line-height: 1.2;
}
:root[data-theme] :is(.btn, a.btn, summary.btn, label.btn).small:not(.icon-btn) {
  height: var(--h-sm);
  min-height: var(--h-sm);
  padding-inline: var(--sp-3);
  font-size: var(--fs-xs);
}

/* Page-level primary actions used to be 44px; align them with the rest of the toolbar */
:root[data-theme] :is(.task-create, .mail-write, .deal-create, .add-card) {
  height: var(--h-md);
  min-height: var(--h-md);
}

/* Square icon buttons: 36px (32px when marked small) */
:root[data-theme] :is(.icon-btn, .btn.icon-btn):not(.channel-row-menu, .message-reply-quick, .sales-stage-rename) {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: var(--r-sm);
}
:root[data-theme] .icon-btn.small {
  width: var(--h-sm);
  height: var(--h-sm);
  min-height: var(--h-sm);
}

/* Header controls (notifications, view, theme, refresh) share one 36px size */
:root[data-theme] :is(.notice-toggle, .theme-toggle, .call-start-trigger),
:root #app .notice-toggle {
  width: 36px;
  height: 36px;
  min-height: 36px;
}
:root[data-theme] .call-start-trigger { width: auto; }
:root[data-theme] .topbar .btn:not(.icon-btn) { height: 36px; min-height: 36px; }

/* Chat list heading icons were 34px */
:root #app .chat-list-heading :is(.icon-btn, .ui-appearance > summary) {
  width: 36px;
  height: 36px;
  min-height: 36px;
}

/* Chat list: search + category (the separate «search all messages» icon lives in the ⋯ menu) */
:root #app .chat-directory-bar {
  grid-template-columns: minmax(0, 1fr) 128px;
}
@media (max-width: 760px) {
  :root #app .chat-directory-bar { grid-template-columns: minmax(0, 1fr) minmax(112px, 40%); }
}
/* Chat list heading: status takes the free width; ⋯ is a visible button like + */
:root #app .chat-list-heading .chat-user-status { flex: 1 1 auto; max-width: none; min-width: 0; }
:root[data-theme] #app .chat-list-heading [data-work="list-menu"] {
  background: var(--surface); border: 1px solid var(--control-line); color: var(--ink);
}
:root[data-theme] #app .chat-list-heading [data-work="list-menu"]:hover { background: var(--surface-2); border-color: var(--blue-line); }
/* «Выйти из чата» in chat settings */
:root[data-theme] #modal-root .chat-settings-leave { color: var(--danger-text); border-color: color-mix(in srgb, var(--danger-text) 35%, var(--control-line)); }
:root[data-theme] #modal-root .chat-settings-leave .icon { width: 15px; height: 15px; }

/* Dropdown triggers in filter bars match inputs: 40px */
:root[data-theme] .filter-select-trigger {
  height: var(--h-md);
  min-height: var(--h-md);
  padding-block: 0;
}

/* Filter chips and metric toggles: 32px */
:root[data-theme] :is(.ui-filter-chip, .deal-metric) {
  height: var(--h-sm);
  min-height: var(--h-sm);
  padding-block: 0;
}
