/* Чатбург — клиентский кабинет (Issue #85, дизайн «Чатбург v3»).
   Цвета задаются токенами. Тема, акцент и вид меню меняются атрибутами на <html>:
   data-theme="dark", data-accent="cobalt|indigo|sky", data-rail="light" (ui.js). */

:root {
  --page: #f4f6fa;
  --surface: #ffffff;
  --surface-soft: #eef2fb;
  --field: #f1f3f7;
  --tray: #e3e7ef;
  --text: #171a22;
  --muted: #707789;
  --faint: #9aa1b2;
  --line: #e2e6ee;
  --line-strong: #cfd5e0;
  --brand: #4d67e8;
  --brand-soft: #e9edff;
  --brand-strong: #3148bd;
  --on-brand: #ffffff;
  --danger: #c33f55;
  --danger-soft: #fbe4e8;
  --success: #25846f;
  --success-soft: #dff3ec;
  --warn: #8a5a00;
  --warn-soft: #fbefd6;
  --note: #fff8e6;
  --note-line: #e3c26b;
  --nav: #141824;
  --nav-text: #9098aa;
  --nav-hover: rgba(255, 255, 255, .06);
  --nav-active: #252b3a;
  --nav-active-text: #ffffff;
  --nav-brand: #ffffff;
  --manager-message: #dce8ff;
  --manager-message-text: #12141a;
  --incoming: #f1f3f7;
  --telegram: #229ed9;
  --max: #6f5ae8;
  --avito: #0f6fd1;
  --on-solid: #ffffff;
  --switch-thumb: #ffffff;
  --avatar-fallback: #e8ebf3;
  --avatar-coral: #df806c;
  --avatar-blue: #229ed9;
  --avatar-violet: #6f5ae8;
  --avatar-lime: #25846f;
  --avatar-ink: #343946;
  --tag-rose-text: light-dark(#8e1f33, #ffb3bf);
  --tag-rose-bg: light-dark(#fbe1e6, #4a1f2a);
  --tag-amber-text: light-dark(#7a4b00, #f6cf86);
  --tag-amber-bg: light-dark(#fbeccb, #3d2f12);
  --tag-blue-text: light-dark(#2643a8, #b7c6ff);
  --tag-blue-bg: light-dark(#e3e9ff, #232d55);
  --tag-violet-text: light-dark(#5a3aa8, #d4c4ff);
  --tag-violet-bg: light-dark(#ece4fd, #30264f);
  --tag-green-text: light-dark(#17695a, #9ee0c9);
  --tag-green-bg: light-dark(#ddf2ea, #163a31);
  --accent-blue-swatch: #4d67e8;
  --accent-cobalt-swatch: #245fd4;
  --accent-indigo-swatch: #4f46e5;
  --accent-sky-swatch: #0a7bc2;
  --browser-theme-color: #ffffff;
  --shadow-sm: 0 1px 2px rgba(23, 26, 34, .06);
  --shadow-lg: 0 18px 50px rgba(23, 26, 34, .18), 0 0 0 1px rgba(23, 26, 34, .05);
  --shadow-control: 0 1px 3px rgba(23, 26, 34, .1);
  --shadow-switch: 0 2px 4px rgba(0, 0, 0, .2);
  --shadow-nav-selection: 0 1px 2px rgba(23, 26, 34, .08), 0 0 0 1px var(--line);
  --shadow-nav-peek: 18px 0 50px rgba(23, 26, 34, .22);
  --shadow-panel: -18px 0 50px rgba(23, 26, 34, .16);
  --dialog-backdrop: rgba(13, 16, 23, .45);
  --mini-rail: rgba(255, 255, 255, .15);
  --mini-rail-selected: rgba(255, 255, 255, .45);
  --radius: 12px;
  --head-h: 58px;
  --rail-w: 224px;
  --list-w: 400px;
  --panel-w: 340px;
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%23737a8b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  color-scheme: light;
}
html[data-accent="cobalt"] { --brand: #245fd4; --brand-soft: #eaf1ff; --brand-strong: #184fbf; }
html[data-accent="indigo"] { --brand: #4f46e5; --brand-soft: #eeedfd; --brand-strong: #3730a3; }
html[data-accent="sky"] { --brand: #0a7bc2; --brand-soft: #e3f2fb; --brand-strong: #075e95; }
html[data-rail="light"] { --nav: #f1f3f8; --nav-text: #5f6678; --nav-hover: rgba(23, 26, 34, .05); --nav-active: #ffffff; --nav-active-text: #171a22; --nav-brand: #171a22; }
html[data-theme="dark"] {
  --page: #0d1017; --surface: #161a23; --surface-soft: #202637; --field: #1f2531; --tray: #1c222e;
  --text: #f3f5fb; --muted: #9da6ba; --faint: #6f788b; --line: #2a3040; --line-strong: #3a4256;
  --brand: #7f96ff; --brand-soft: #242d55; --brand-strong: #aebcff; --on-brand: #0d1330;
  --danger: #ff8292; --danger-soft: #3f1d25; --success: #63c7ae; --success-soft: #15302a;
  --warn: #f0c46b; --warn-soft: #3a2e12; --note: #2a2414; --note-line: #6b5a22;
  --nav: #090b10; --nav-active: #1d2230; --manager-message: #26315f; --incoming: #222937;
  --browser-theme-color: #161a23;
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .06);
  color-scheme: dark;
}
html[data-theme="dark"][data-accent="cobalt"] { --brand: #7da7f2; --brand-soft: #172440; --brand-strong: #afc7f7; }
html[data-theme="dark"][data-accent="indigo"] { --brand: #8b85f7; --brand-soft: #221f47; --brand-strong: #c3c0fb; }
html[data-theme="dark"][data-accent="sky"] { --brand: #5db6ec; --brand-soft: #0f2736; --brand-strong: #a9d9f5; }
html[data-theme="dark"][data-rail="light"] { --nav: #12161f; --nav-text: #9da6ba; --nav-active: #202637; --nav-active-text: #f3f5fb; --nav-brand: #f3f5fb; }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; max-width: 100%; overflow-x: hidden; }
body { font-size: 15px; }
body { color: var(--text); background: var(--surface); font-family: Manrope, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.4; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
svg.lucide { width: 20px; height: 20px; flex: none; stroke-width: 1.9; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
/* Указатель «палец» на всём кликабельном */
:is(button, [role="button"], [role="tab"], a[href], select, summary, label:has(input[type="checkbox"], input[type="radio"]), .chat-row, .settings-row:has(.switch)) { cursor: pointer; }
:is(button, select, input):disabled { cursor: default; }

/* ---------- кнопки и общие элементы ---------- */
.btn { min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; color: var(--text); background: var(--surface); font-size: 14px; font-weight: 600; white-space: nowrap; }
.btn:hover { background: var(--field); }
.btn.primary { border-color: var(--brand); color: var(--on-brand); background: var(--brand); }
.btn.primary:hover { filter: brightness(.95); }
.btn.secondary { background: var(--surface); }
.btn.small { min-height: 32px; padding: 0 11px; border-radius: 9px; font-size: 13px; }
.btn.wide { width: 100%; min-height: 46px; }
.btn.danger-outline { border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); background: transparent; }
.btn.danger-outline:hover { background: var(--danger-soft); }
.btn svg.lucide { width: 17px; height: 17px; }
.icon-button { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 11px; display: inline-grid; place-items: center; color: var(--muted); background: transparent; }
.icon-button:hover { color: var(--text); background: var(--field); }
.btn:disabled, .icon-button:disabled { opacity: .5; }
.component-spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: message-spin .8s linear infinite; }
.status-badge { height: 24px; padding: 0 9px; border-radius: 99px; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status-badge.live { color: var(--success); background: var(--success-soft); }
.status-badge.error { color: var(--danger); background: var(--danger-soft); }
.status-badge.warn { color: var(--warn); background: var(--warn-soft); }
.status-badge.neutral { color: var(--muted); background: var(--field); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--success); flex: none; }
.section-kicker { margin: 0 0 4px; color: var(--muted); font-size: 12px; font-weight: 500; }
.switch { position: relative; width: 51px; height: 31px; flex: none; border-radius: 99px; display: inline-block; background: var(--line-strong); transition: background .15s; }
.switch i, .switch em { position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: var(--switch-thumb); box-shadow: var(--shadow-switch); transition: transform .15s; }
.switch.on { background: var(--brand); }
.switch.on i, .switch.on em { transform: translateX(20px); }

/* ---------- общие поля, таблица и пагинация (#72) ---------- */
.ui-field { min-width: 0; display: grid; gap: 5px; color: var(--muted); font-size: 14px; font-weight: 500; }
.ui-field-control { position: relative; min-width: 0; display: flex; align-items: center; }
.ui-field input, .ui-field select { width: 100%; min-width: 0; min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; outline: 0; color: var(--text); background: var(--surface); font-size: 14px; }
.ui-field input:focus, .ui-field select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.ui-field input:disabled, .ui-field select:disabled { color: var(--muted); background: var(--field); }
.ui-field.is-invalid input, .ui-field.is-invalid select { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.ui-field small { color: var(--muted); font-weight: 400; }
.ui-field .ui-field-error { color: var(--danger); }
.ui-field-control .component-spinner { position: absolute; right: 12px; color: var(--brand); }
.data-table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.data-table th, .data-table td { min-width: 0; padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; overflow-wrap: anywhere; }
.data-table th { height: var(--head-h); color: var(--muted); background: var(--field); font-size: 12px; font-weight: 600; }
.data-table th:last-child, .data-table td:last-child { width: 116px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.table-actions { display: flex; justify-content: flex-end; gap: 2px; }
.table-actions .icon-button { width: 32px; height: 32px; }
.table-state { min-height: 180px; padding: 28px; display: grid; place-content: center; justify-items: center; gap: 5px; color: var(--muted); text-align: center; }
.table-state b { color: var(--text); font-size: 15px; }
.table-state .btn { margin-top: 8px; }
.table-state.error b { color: var(--danger); }
.table-skeleton { width: 80%; height: 12px; border-radius: 6px; display: block; background: var(--field); animation: sample-pulse 1.1s ease-in-out infinite alternate; }
.table-skeleton.short { width: 48px; margin-left: auto; }
@keyframes sample-pulse { to { opacity: .45; } }
.data-pagination { min-height: 58px; padding: 10px 14px; display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 12px; }
.data-pagination > span:first-child { margin-right: auto; }
.data-pagination label, .data-pagination-actions { display: flex; align-items: center; gap: 8px; }
.data-pagination select { min-height: 34px; padding: 0 28px 0 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.data-pagination-actions b { color: var(--text); font-weight: 600; }

.sample-block { padding: 18px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.sample-block h1, .sample-block h2 { margin: 0 0 14px; font-size: 17px; font-weight: 600; }
.sample-block h2:not(:first-child) { margin-top: 24px; }
.sample-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sample-form { max-width: 560px; padding: 18px; border-radius: 16px; display: grid; gap: 16px; background: var(--surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.sample-form .sample-actions { justify-content: flex-end; }
.sample-contact-method { max-width: 720px; margin: 0 auto; }
.sample-contact-method-form { padding: 28px; border-radius: 20px; display: grid; gap: 20px; background: var(--surface); box-shadow: var(--shadow-lg), 0 0 0 1px var(--line); }
.sample-contact-method-form header p { margin: 0 0 5px; color: var(--muted); font-size: 14px; }
.sample-contact-method-form header h2 { margin: 0; font-size: 24px; font-weight: 600; }
.sample-contact-method-field, .sample-contact-comment { display: grid; gap: 8px; }
.sample-contact-method-field > label, .sample-contact-comment > span { color: var(--muted); font-size: 14px; font-weight: 500; }
.sample-contact-comment small { font-weight: 400; }
.sample-contact-composite { min-width: 0; min-height: 56px; border: 1px solid var(--line); border-radius: 13px; display: flex; overflow: hidden; background: var(--surface); }
.sample-contact-composite:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.sample-contact-composite > * { min-width: 0; min-height: 54px; padding: 0 14px; border: 0; border-right: 1px solid var(--line); outline: 0; color: var(--text); background: transparent; font: inherit; }
.sample-contact-composite > *:last-child { border-right: 0; }
.sample-contact-composite select { flex: 0 1 auto; padding-right: 40px; -webkit-appearance: none; appearance: none; background-image: var(--select-chevron); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; font-weight: 600; }
.sample-contact-composite #sample-contact-method { min-width: 120px; }
.sample-contact-composite [data-contact-identifier] { min-width: 138px; }
.sample-contact-composite [data-contact-prefix] { min-width: 92px; }
.sample-contact-composite [data-contact-value] { min-width: 150px; flex: 1 1 220px; }
.sample-contact-composite [data-contact-extension-action] { flex: 0 0 auto; color: var(--brand-strong); white-space: nowrap; }
.sample-contact-composite [data-contact-extension] { width: 100px; flex: 0 0 100px; }
.sample-contact-composite > [hidden] { display: none; }
.sample-contact-composite :disabled { color: var(--muted); background: var(--field); opacity: 1; }
.sample-contact-composite select:disabled { background-image: none; }
.sample-contact-method-field > p { min-height: 18px; margin: 0; color: var(--muted); font-size: 12px; }
.sample-contact-comment-control { position: relative; display: block; }
.sample-contact-comment input { width: 100%; min-height: 54px; padding: 0 54px 0 14px; border: 1px solid var(--line); border-radius: 12px; outline: 0; color: var(--text); background: var(--surface); font: inherit; }
.sample-contact-comment input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.sample-contact-comment-control .icon-button { position: absolute; top: 50%; right: 9px; transform: translateY(-50%); }
.sample-contact-primary { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.sample-contact-primary input { width: 18px; height: 18px; accent-color: var(--brand); }
.sample-contact-actions { margin-top: 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sample-contact-actions .btn { min-height: 52px; border-radius: 12px; }
.sample-token-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.sample-token-grid article { padding: 12px; border-radius: 14px; display: grid; gap: 6px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.sample-token-grid article > span { height: 72px; border: 1px solid var(--line); border-radius: 10px; }
.sample-token-grid b { font-size: 13px; }
.sample-token-grid code { color: var(--muted); font-size: 11px; }
.sample-type-scale { padding: 18px; border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.sample-type-scale p, .sample-type-scale h1, .sample-type-scale h2 { margin: 0 0 18px; }
.sample-type-scale .sample-caption { color: var(--muted); font-size: 12px; }
.sample-type-scale h2 { font-size: 18px; }
.sample-type-scale h1 { font-size: 26px; }
.sample-spacing { padding: 18px; border-radius: 16px; display: grid; gap: 14px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.sample-spacing div { display: flex; align-items: center; gap: 12px; }
.sample-spacing span { height: 16px; display: block; background: var(--brand); }
.sample-view-bar { max-width: 760px; padding: 14px; border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.sample-view-row { position: relative; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.sample-view-list { min-width: 0; flex: 1 1 auto; display: flex; align-items: center; gap: 6px; overflow: hidden; }
.sample-view-tab { min-width: 0; min-height: 36px; padding: 0 12px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 12px; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; }
.sample-view-tab > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sample-view-tab small { color: var(--muted); font-size: 11px; }
.sample-view-tab.active { color: var(--surface); border-color: var(--text); background: var(--text); }
.sample-view-tab.active small { color: inherit; opacity: .72; }
.sample-view-tab[data-custom-view="true"] { cursor: grab; }
.sample-view-tab.is-dragging, .sample-view-menu-item.is-dragging { opacity: .45; }
.sample-view-overflow-wrap { position: relative; flex: 0 0 auto; }
.sample-view-overflow-wrap > .icon-button, .sample-view-row > .icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.sample-view-overflow { font-size: 21px; line-height: 1; letter-spacing: 1px; }
.sample-view-menu { z-index: 4; position: absolute; top: 42px; right: 0; width: 230px; padding: 8px; border: 1px solid var(--line); border-radius: 14px; display: grid; gap: 4px; background: var(--surface); box-shadow: var(--shadow-lg); }
.sample-view-menu > p { margin: 4px 6px 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.sample-view-menu > small { margin: 5px 6px 3px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.sample-view-menu-item { width: 100%; min-height: 36px; padding: 0 9px; border: 0; border-radius: 9px; display: flex; align-items: center; gap: 8px; color: var(--text); background: transparent; text-align: left; cursor: grab; }
.sample-view-menu-item:hover, .sample-view-menu-item.active { background: var(--field); }
.sample-view-drag-handle { color: var(--muted); letter-spacing: -4px; transform: rotate(90deg); }
.sample-filter-tools { display: flex; align-items: center; gap: 8px; }
.sample-filter-tools .compact-search { margin-right: auto; }
.sample-view-editor { margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 10px; background: var(--field); }
.sample-view-editor h3 { margin: 0; font-size: 14px; }
.sample-view-editor > label { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
.sample-view-editor input { min-height: 40px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--surface); font: inherit; font-size: 14px; }
.sample-filter-editor { margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); }
.sample-filter-editor h3 { margin: 0 0 10px; font-size: 14px; }
.sample-filter-editor .sample-actions { margin-top: 10px; justify-content: flex-end; }
.sample-feedback { min-height: 250px; display: grid; place-items: stretch; }
.sample-loading { padding: 28px; display: grid; gap: 12px; }
.sample-loading span { height: 18px; border-radius: 9px; background: var(--field); animation: sample-pulse 1.1s ease-in-out infinite alternate; }
.sample-loading span:nth-child(2) { width: 72%; }
.sample-loading span:nth-child(3) { width: 86%; }
.sample-success { min-height: 180px; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--success); }
.sample-success div { display: grid; gap: 3px; }
.sample-success span { color: var(--muted); font-size: 13px; }
.sample-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.sample-nav button { min-height: 42px; padding: 0 13px; border: 0; border-radius: 11px; display: inline-flex; align-items: center; gap: 8px; color: var(--muted); background: var(--field); }
.sample-nav button.active { color: var(--brand-strong); background: var(--brand-soft); }
.sample-conversation-list { width: min(100%, 440px); min-height: 640px; margin: 0 auto; border-radius: 16px; overflow: hidden; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.sample-conversation-list .list-tools { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.sample-settings { max-width: 900px; margin: 0 auto; }

@media (max-width: 760px) {
  .data-table-wrap { overflow: visible; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table thead { display: none; }
  .data-table tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .data-table tr:last-child { border-bottom: 0; }
  .data-table td { width: 100% !important; padding: 6px 0; border: 0; display: grid; grid-template-columns: minmax(96px, .7fr) minmax(0, 1.3fr); gap: 10px; }
  .data-table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; }
  .data-table td[colspan] { display: block; }
  .data-table td[colspan]::before { content: none; }
  .table-actions { justify-content: flex-start; }
  .data-pagination { align-items: flex-start; flex-direction: column; }
  .data-pagination > span:first-child { margin-right: 0; }
  .data-pagination-actions { width: 100%; justify-content: space-between; }
  .sample-filter-tools { align-items: stretch; flex-direction: column; }
  .sample-filter-tools .compact-search { width: 100%; margin-right: 0; }
  .sample-filter-tools .compact-search input { width: 100%; }
  .sample-contact-method-form { padding: 20px 14px; gap: 18px; }
  .sample-contact-composite { flex-wrap: wrap; }
  .sample-contact-composite > * { flex: 1 1 140px; }
  .sample-contact-composite [data-contact-value], .sample-contact-composite #contactMethodValue { flex-basis: 100%; border-top: 1px solid var(--line); }
  .sample-contact-composite [data-contact-extension-action], .sample-contact-composite #contactMethodExtensionAction { flex-basis: 100%; border-top: 1px solid var(--line); text-align: left; }
  .sample-contact-composite [data-contact-extension], .sample-contact-composite #contactMethodExtension { width: auto; flex-basis: 100%; border-top: 1px solid var(--line); }
  .sample-contact-actions { grid-template-columns: 1fr; }
  .sample-contact-actions .btn.primary { grid-row: 1; }
}

/* ---------- аватары ---------- */
.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; display: inline-grid; place-items: center; color: var(--on-solid); font-size: 14px; font-weight: 600; }
.avatar.coral { background: var(--avatar-coral); }
.avatar.blue { background: var(--avatar-blue); }
.avatar.violet { background: var(--avatar-violet); }
.avatar.lime { background: var(--avatar-lime); }
.avatar.ink { background: var(--avatar-ink); }
.avatar.large { width: 52px; height: 52px; font-size: 17px; }
.manager-avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: inline-block;
  overflow: hidden;
  border-radius: 50%;
  background-color: var(--avatar-fallback);
  background-image: url("assets/avatars/manager-sprite.png");
  background-repeat: no-repeat;
  background-size: 500% 200%;
}
.manager-avatar.avatar-0 { background-position: 0 0; }
.manager-avatar.avatar-1 { background-position: 25% 0; }
.manager-avatar.avatar-2 { background-position: 50% 0; }
.manager-avatar.avatar-3 { background-position: 75% 0; }
.manager-avatar.avatar-4 { background-position: 100% 0; }
.manager-avatar.avatar-5 { background-position: 0 100%; }
.manager-avatar.avatar-6 { background-position: 25% 100%; }
.manager-avatar.avatar-7 { background-position: 50% 100%; }
.manager-avatar.avatar-8 { background-position: 75% 100%; }
.manager-avatar.avatar-9 { background-position: 100% 100%; }
.manager-avatar.avatar-10, .manager-avatar.avatar-11, .manager-avatar.avatar-12, .manager-avatar.avatar-13, .manager-avatar.avatar-14,
.manager-avatar.avatar-15, .manager-avatar.avatar-16, .manager-avatar.avatar-17, .manager-avatar.avatar-18, .manager-avatar.avatar-19,
.manager-avatar.avatar-20, .manager-avatar.avatar-21, .manager-avatar.avatar-22, .manager-avatar.avatar-23, .manager-avatar.avatar-24,
.manager-avatar.avatar-25, .manager-avatar.avatar-26, .manager-avatar.avatar-27, .manager-avatar.avatar-28, .manager-avatar.avatar-29 { background-position: center; background-size: cover; }
.manager-avatar.avatar-10 { background-image: url("assets/avatars/manager-11-blonde-blue-eyes.png"); }
.manager-avatar.avatar-11 { background-image: url("assets/avatars/manager-12-bald-man.png"); }
.manager-avatar.avatar-12 { background-image: url("assets/avatars/manager-13-asian-woman.png"); }
.manager-avatar.avatar-13 { background-image: url("assets/avatars/manager-14-light-brown-hair-woman.png"); }
.manager-avatar.avatar-14 { background-image: url("assets/avatars/manager-15-caucasus-man.png"); }
.manager-avatar.avatar-15 { background-image: url("assets/avatars/manager-16-plus-brunette-bun.png"); }
.manager-avatar.avatar-16 { background-image: url("assets/avatars/manager-17-plus-gray-haired-man.png"); }
.manager-avatar.avatar-17 { background-image: url("assets/avatars/manager-18-plus-black-bob-woman.png"); }
.manager-avatar.avatar-18 { background-image: url("assets/avatars/manager-19-plus-curly-haired-man.png"); }
.manager-avatar.avatar-19 { background-image: url("assets/avatars/manager-20-plus-black-woman.png"); }
.manager-avatar.avatar-20 { background-image: url("assets/avatars/manager-21-plus-blond-man.png"); }
.manager-avatar.avatar-21 { background-image: url("assets/avatars/manager-22-plus-red-haired-woman.png"); }
.manager-avatar.avatar-22 { background-image: url("assets/avatars/manager-23-plus-gray-haired-woman.png"); }
.manager-avatar.avatar-23 { background-image: url("assets/avatars/manager-24-plus-dark-haired-man.png"); }
.manager-avatar.avatar-24 { background-image: url("assets/avatars/manager-25-plus-chef.png"); }
.manager-avatar.avatar-25 { background-image: url("assets/avatars/manager-26-plus-blonde-blue-eyes.png"); }
.manager-avatar.avatar-26 { background-image: url("assets/avatars/manager-27-plus-bald-man.png"); }
.manager-avatar.avatar-27 { background-image: url("assets/avatars/manager-28-plus-asian-woman.png"); }
.manager-avatar.avatar-28 { background-image: url("assets/avatars/manager-29-plus-light-brown-hair-woman.png"); }
.manager-avatar.avatar-29 { background-image: url("assets/avatars/manager-30-plus-caucasus-man.png"); }

/* ---------- метки ---------- */
.tag { height: 22px; max-width: 100%; padding: 0 8px; border: 0; border-radius: 7px; display: inline-flex; align-items: center; gap: 4px; overflow: hidden; font-size: 11px; font-weight: 500; line-height: 1; white-space: nowrap; }
.tag > span { overflow: hidden; text-overflow: ellipsis; }
.tag.tone-rose { color: var(--tag-rose-text); background: var(--tag-rose-bg); }
.tag.tone-amber { color: var(--tag-amber-text); background: var(--tag-amber-bg); }
.tag.tone-blue { color: var(--tag-blue-text); background: var(--tag-blue-bg); }
.tag.tone-violet { color: var(--tag-violet-text); background: var(--tag-violet-bg); }
.tag.tone-green { color: var(--tag-green-text); background: var(--tag-green-bg); }
.tag.tone-gray { color: var(--muted); background: var(--field); }
.tag.tone-custom { color: var(--tag-text); background: var(--tag-bg); }
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

/* ---------- каркас ---------- */
#app.app-shell { height: 100vh; height: 100dvh; display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); background: var(--surface); transition: grid-template-columns .18s ease; }
html.nav-collapsed #app.app-shell { --rail-w: 68px; }
.view { min-width: 0; min-height: 0; }

/* левое меню */
.app-nav { position: relative; z-index: 30; min-height: 0; padding: 0 12px 14px; display: flex; flex-direction: column; color: var(--nav-text); background: var(--nav); transition: width .18s ease, box-shadow .18s ease; }
html[data-rail="light"] .app-nav { border-right: 1px solid var(--line); }
.nav-head { height: var(--head-h); padding: 0 0 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--nav-brand); font-size: 19px; font-weight: 700; letter-spacing: -.03em; text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; display: block; object-fit: contain; }
.nav-main, .nav-footer { display: flex; flex-direction: column; gap: 4px; }
.nav-main { margin-top: 10px; }
.nav-footer { margin-top: auto; }
.nav-button { position: relative; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 12px; display: flex; align-items: center; gap: 12px; color: var(--nav-text); background: transparent; font-size: 14px; font-weight: 500; text-align: left; white-space: nowrap; }
.nav-button:hover { color: var(--nav-active-text); background: var(--nav-hover); }
.nav-button.active, .nav-button.is-open { color: var(--nav-active-text); background: var(--nav-active); }
html[data-rail="light"] .nav-button.active { box-shadow: var(--shadow-nav-selection); }
html[data-rail="light"] .nav-button.active svg { color: var(--brand); }
.nav-button b { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; color: var(--on-solid); background: var(--brand); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.profile-card { margin-top: 6px; padding: 8px 4px 0 6px; display: flex; align-items: center; gap: 10px; }
.profile-card .manager-avatar { width: 34px; height: 34px; flex-basis: 34px; }
.profile-card div { min-width: 0; flex: 1; }
.profile-card b { display: block; overflow: hidden; color: var(--nav-active-text); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.profile-card small { display: block; font-size: 12px; }
.profile-card .icon-button { color: var(--nav-text); }
.profile-card .icon-button:hover { color: var(--nav-active-text); background: var(--nav-hover); }

/* иконка боковых панелей: залита только выезжающая часть = закреплено */
.side-toggle { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 11px; display: inline-grid; place-items: center; color: var(--nav-text); background: transparent; }
.side-toggle:hover { background: var(--nav-hover); color: var(--nav-active-text); }
.side-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-icon .side-pane { fill: currentColor; stroke: none; opacity: 0; transition: opacity .15s; }
.side-toggle.is-pinned .side-pane { opacity: 1; }
.app-nav .side-toggle.is-pinned { color: var(--nav-active-text); }
html[data-rail="light"] .app-nav .side-toggle.is-pinned { color: var(--brand); }

/* свёрнутое меню */
html.nav-collapsed:not(.nav-peek) .app-nav .brand span,
html.nav-collapsed:not(.nav-peek) .app-nav .nav-button span,
html.nav-collapsed:not(.nav-peek) .profile-card div,
html.nav-collapsed:not(.nav-peek) .profile-card .icon-button { display: none; }
html.nav-collapsed:not(.nav-peek) .nav-head { padding: 0; justify-content: center; }
html.nav-collapsed:not(.nav-peek) .nav-head .brand { display: none; }
html.nav-collapsed:not(.nav-peek) .nav-button { justify-content: center; padding: 0; }
html.nav-collapsed:not(.nav-peek) .nav-button b { position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px; font-size: 9px; }
html.nav-collapsed:not(.nav-peek) .profile-card { justify-content: center; padding: 8px 0 0; }
html.nav-collapsed.nav-peek .app-nav { width: 224px; box-shadow: var(--shadow-nav-peek); }

/* ---------- диалоги: сетка ---------- */
.inbox-view { position: relative; height: 100vh; height: 100dvh; display: grid; grid-template-columns: var(--list-w) 0 minmax(380px, 1fr) 0 var(--panel-w); }
.inbox-view.panel-floating { grid-template-columns: var(--list-w) 0 minmax(380px, 1fr) 0 0; }
.column-resizer { position: relative; z-index: 12; width: 0; }
.column-resizer span { position: absolute; top: 0; bottom: 0; left: -5px; width: 9px; cursor: col-resize; touch-action: none; }
.column-resizer span::after { content: ""; position: absolute; top: 18%; bottom: 18%; left: 3.5px; width: 2px; border-radius: 2px; background: transparent; transition: background .15s; }
.column-resizer:hover span::after, .column-resizer.is-active span::after { background: var(--brand); }
.column-resizer[data-width]::before { content: attr(data-width); position: absolute; top: 50%; left: 0; z-index: 2; padding: 4px 7px; border-radius: 7px; color: var(--surface); background: var(--text); font-size: 11px; font-weight: 600; transform: translate(-50%, -50%); pointer-events: none; opacity: 0; }
.column-resizer.is-active[data-width]::before { opacity: 1; }
.inbox-view.panel-floating .column-resizer[data-resize="panel"] { display: none; }
body.is-resizing { cursor: col-resize; user-select: none; }

/* ---------- список диалогов ---------- */
.conversation-list { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface); }
.list-header { height: var(--head-h); padding: 0 12px 0 16px; display: flex; align-items: center; justify-content: space-between; flex: none; }
.list-header h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.015em; }
.list-tools { padding: 0 12px; display: grid; grid-template-columns: minmax(0, 1fr) 36px; gap: 8px; flex: none; }
.search-box { height: 36px; padding: 0 11px; border-radius: 11px; display: flex; align-items: center; gap: 8px; background: var(--field); }
.search-box svg { width: 17px; height: 17px; color: var(--muted); }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; font-size: 14px; }
.search-box input::placeholder { color: var(--muted); }
.search-box:focus-within { box-shadow: 0 0 0 2px var(--brand); }
.search-box kbd { padding: 1px 5px; border: 1px solid var(--line); border-radius: 5px; color: var(--faint); background: var(--surface); font: 500 10px/1.4 ui-monospace, Menlo, monospace; }
.tool-button { position: relative; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 11px; display: grid; place-items: center; color: var(--text); background: var(--field); }
.tool-button:hover, .tool-button.is-open { color: var(--brand); background: var(--brand-soft); }
.tool-button svg.lucide { width: 19px; height: 19px; }
.tool-count { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center; color: var(--on-solid); background: var(--brand); font-size: 10px; font-weight: 700; box-shadow: 0 0 0 2px var(--surface); }
.filter-row { padding: 10px 12px 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: none; }
.filter-chip { height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 99px; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); background: var(--surface); font-size: 12px; font-weight: 600; white-space: nowrap; }
.filter-chip span { opacity: .7; }
.filter-chip.active { border-color: var(--text); color: var(--surface); background: var(--text); }
.tiny-channel { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.tiny-channel.telegram { background: var(--telegram); }
.tiny-channel.avito { background: var(--avito); }
.tiny-channel.max { background: var(--max); }
.active-filters { padding: 8px 12px 0; display: flex; flex-wrap: wrap; gap: 5px; flex: none; }
.active-filters .filter-tag { height: 24px; padding: 0 4px 0 9px; border: 0; border-radius: 7px; display: inline-flex; align-items: center; gap: 4px; color: var(--brand-strong); background: var(--brand-soft); font-size: 12px; font-weight: 600; }
.active-filters .filter-tag svg { width: 13px; height: 13px; }
.active-filters .filter-clear { border: 0; padding: 0 4px; color: var(--muted); background: none; font-size: 12px; font-weight: 600; }
.queue-summary { margin-top: 10px; padding: 8px 16px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; flex: none; }
.queue-summary b { min-width: 22px; height: 22px; border-radius: 11px; display: grid; place-items: center; color: var(--brand); background: var(--brand-soft); font-size: 11px; }
.chat-list { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.chat-row { position: relative; width: 100%; min-height: 76px; padding: 10px 14px 10px 32px; border: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 11px; align-items: start; color: inherit; background: var(--surface); text-align: left; }
.chat-row:hover { background: color-mix(in srgb, var(--brand) 4%, var(--surface)); }
.chat-row.active { background: var(--brand-soft); }
.channel-rail { position: absolute; top: 0; bottom: 0; left: 0; width: 20px; display: grid; place-items: center; overflow: hidden; color: var(--on-solid); background: var(--telegram); }
.channel-rail.max { background: var(--max); }
.channel-rail.avito { background: var(--avito); }
.channel-rail span { max-height: calc(100% - 8px); overflow: hidden; font-size: 10px; font-weight: 700; letter-spacing: .03em; text-overflow: ellipsis; white-space: nowrap; writing-mode: vertical-rl; transform: rotate(180deg); }
.chat-row .avatar { width: 46px; height: 46px; font-size: 15px; }
.chat-row-main { min-width: 0; display: grid; gap: 2px; }
.chat-row-title { min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.chat-row-title b { min-width: 0; flex: 1; overflow: hidden; font-size: 15px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.chat-row-title time { flex: none; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chat-row-preview { min-width: 0; display: flex; align-items: center; gap: 8px; }
#app .chat-row p { margin: 0; min-width: 0; flex: 1; overflow: hidden; color: var(--muted); font-size: 13px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.chat-row.is-unread p { color: var(--text); }
.unread-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; color: var(--on-solid); background: var(--brand); font-size: 11px; font-style: normal; font-weight: 700; }
.row-assignee { color: var(--faint); font-size: 11px; font-style: normal; font-weight: 600; }
.chat-row.is-closed .chat-row-title b { color: var(--muted); }
.chat-row-tags { position: relative; margin-top: 4px; padding-right: 26px; display: flex; flex-wrap: wrap; gap: 4px; max-height: 48px; overflow: hidden; }
.chat-row-tags:empty { display: none; }
.chat-row-tags.is-expanded { max-height: none; }
.chat-row-tags .row-tags-more { position: absolute; right: 0; bottom: 0; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; color: var(--brand-strong); background: var(--brand-soft); }
.chat-row-tags .row-tags-more svg { width: 15px; height: 15px; transition: transform .15s; }
.chat-row-tags.is-expanded .row-tags-more svg { transform: rotate(180deg); }
.empty-state { padding: 40px 20px; color: var(--muted); font-size: 14px; text-align: center; }

/* ---------- переписка ---------- */
.chat-pane { position: relative; min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--surface); }
.chat-header { position: relative; z-index: 5; border-bottom: 1px solid var(--line); background: var(--surface); }
.chat-title-row { height: var(--head-h); padding: 0 10px 0 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; container-type: inline-size; }
.chat-person { min-width: 0; padding: 0; border: 0; display: flex; align-items: center; gap: 10px; color: inherit; background: transparent; text-align: left; }
.chat-person .avatar { width: 40px; height: 40px; font-size: 13px; }
.chat-title { min-width: 0; }
.chat-title h2 { margin: 0; overflow: hidden; font-size: 16px; font-weight: 600; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.chat-title p { margin: 3px 0 0; display: flex; align-items: center; gap: 6px; min-width: 0; }
.channel-pill { height: 20px; padding: 0 7px; border-radius: 6px; display: inline-flex; align-items: center; gap: 5px; overflow: hidden; color: var(--on-solid); background: var(--telegram); font-size: 11px; font-weight: 600; white-space: nowrap; }
.channel-pill:has(.channel-dot.max) { background: var(--max); }
.channel-pill .channel-dot { display: none; }
.status-pill { height: 20px; padding: 0 7px; border-radius: 6px; display: inline-flex; align-items: center; color: var(--muted); background: var(--field); font-size: 11px; font-weight: 600; white-space: nowrap; }
.chat-actions { display: flex; align-items: center; gap: 2px; }
.head-action { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 11px; display: grid; place-items: center; color: var(--brand); background: transparent; }
.head-action:hover { background: var(--field); }
.head-action.is-open { background: var(--brand-soft); }
.head-action svg.lucide, .head-action .side-icon { width: 20px; height: 20px; }
.close-chat { color: var(--danger); }
.close-chat:hover { background: var(--danger-soft); }
.close-chat .icon-reopen { display: none; }
.close-chat[data-state="closed"] { color: var(--brand); }
.close-chat[data-state="closed"]:hover { background: var(--field); }
.close-chat[data-state="closed"] .icon-close { display: none; }
.close-chat[data-state="closed"] .icon-reopen { display: block; }
.head-separator { width: 1px; height: 22px; margin: 0 4px; background: var(--line); }
.panel-toggle { color: var(--muted); }
.panel-toggle.is-pinned { color: var(--brand); }
.head-more { display: none; }
@container (max-width: 470px) {
  .chat-actions .head-extra { display: none; }
  .chat-actions .head-more { display: grid; }
}
.chat-tags { padding: 0 16px 10px; display: grid; grid-template-columns: minmax(0, 1fr) 36px; align-items: start; }
.chat-tags:empty { display: none; }
.chat-tags-list { position: relative; min-width: 0; max-height: 48px; overflow: hidden; display: flex; flex-wrap: wrap; gap: 4px; }
.chat-tags.is-expanded .chat-tags-list { max-height: none; }
.add-tag { height: 22px; padding: 0 9px 0 6px; border: 1px dashed color-mix(in srgb, var(--brand) 60%, transparent); border-radius: 7px; display: inline-flex; align-items: center; gap: 3px; flex: none; color: var(--brand-strong); background: transparent; font-size: 11px; font-weight: 600; white-space: nowrap; position: relative; }
.add-tag::after { content: ""; position: absolute; inset: -6px -3px; }
.add-tag svg.lucide { width: 13px; height: 13px; stroke-width: 2.4; }
.add-tag:hover, .add-tag.is-open { border-style: solid; background: var(--brand-soft); }
.tags-expand { width: 36px; height: 44px; padding: 0 0 5px; border: 0; border-radius: 10px; display: flex; align-items: flex-end; justify-content: center; color: var(--brand-strong); background: transparent; }
.tags-expand:hover { background: var(--field); }
.tags-expand svg.lucide { width: 20px; height: 20px; transition: transform .15s; }
.chat-tags.is-expanded .tags-expand svg { transform: rotate(180deg); }
.property-chip-button { min-width: 0; padding: 0; border: 0; border-radius: 7px; display: inline-flex; color: inherit; background: transparent; cursor: pointer; }
.property-chip-button:hover, .property-chip-button:focus-visible { outline: 0; box-shadow: 0 0 0 2px var(--brand-soft); }
.chat-search { position: sticky; top: -20px; z-index: 4; margin: -20px -28px 14px; padding: 10px 28px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); background: var(--surface); }
.chat-search label { height: 36px; padding: 0 11px; border-radius: 11px; display: flex; flex: 1; align-items: center; gap: 8px; background: var(--field); }
.chat-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; font-size: 14px; }
.chat-search span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.messages.is-searching :is(.message-line, .note-message):not(.is-hit) { opacity: .3; }
.messages .is-hit .message-bubble, .note-message.is-hit { box-shadow: 0 0 0 2px var(--brand); }

.messages { min-height: 0; padding: 20px 28px; overflow-y: auto; overscroll-behavior: contain; background: var(--surface); }
.day-separator { width: max-content; margin: 0 auto 14px; padding: 3px 9px; border-radius: 9px; color: var(--muted); background: var(--field); font-size: 11px; font-weight: 500; }
#app .message-line { width: 100%; margin: 8px 0 14px; display: flex; align-items: flex-end; gap: 8px; }
#app .message-line.out { flex-direction: row-reverse; }
#app .message-line .message { min-width: 0; max-width: calc(100% - 41px); margin: 0; display: grid; gap: 3px; }
@media (min-width: 761px) { #app .message-line .message { max-width: min(68%, 620px); } }
#app .message-line.out .message { justify-items: end; }
#app .message-avatar { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; font-size: 11px; }
#app .message-bubble { padding: 8px 12px; border: 1px solid transparent; border-radius: 15px; background: var(--incoming); font-size: 15px; line-height: 1.35; }
#app .message-line.in .message-bubble { border-bottom-left-radius: 5px; }
#app .message-line.out .message-bubble { border-bottom-right-radius: 5px; }
#app .message.out .message-bubble { color: var(--manager-message-text); background: var(--manager-message); }
html[data-theme="dark"] #app .message.out .message-bubble { color: var(--text); }
#app .message-bubble, #app .message-text { overflow-wrap: anywhere; }
#app .message-text { white-space: pre-wrap; }
#app .message-text a { color: var(--brand-strong); text-decoration-thickness: 1px; text-underline-offset: 2px; overflow-wrap: anywhere; }
#app .message-meta { min-height: 18px; max-width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
#app .message-state { display: inline-flex; align-items: center; gap: 6px; }
#app .delivery-state { min-width: 14px; color: var(--faint); font-weight: 800; letter-spacing: -.12em; text-align: center; }
#app .delivery-state.sent { color: var(--muted); }
#app .delivery-state.delivered { color: var(--text); }
#app .delivery-state.read { color: var(--brand); }
#app .delivery-state.failed, #app .failure-reason { color: var(--danger); }
#app .delivery-label, #app .delivery-progress { color: var(--muted); font-size: 11px; font-weight: 600; }
#app .delivery-progress { display: inline-flex; align-items: center; gap: 6px; }
#app .message-spinner { width: 12px; height: 12px; border: 2px solid var(--line-strong); border-top-color: var(--brand); border-radius: 50%; animation: message-spin .8s linear infinite; }
@keyframes message-spin { to { transform: rotate(360deg); } }
#app .retry-message { min-height: 26px; padding: 0 10px; border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); border-radius: 99px; color: var(--danger); background: transparent; font-size: 12px; font-weight: 600; }
#app .retry-message:hover { background: var(--danger-soft); }
#app .message.is-failed .message-bubble { border-color: color-mix(in srgb, var(--danger) 30%, transparent); background: var(--danger-soft); }
#app .failure-reason { min-width: 0; max-width: 100%; flex: 1 1 120px; white-space: normal; }
.system-message { margin: 14px auto; max-width: min(calc(100% - 24px), calc(100vw - 32px), 420px); display: flex; align-items: flex-start; justify-content: center; gap: 7px; color: var(--muted); font-size: 12px; text-align: center; }
.system-message svg.lucide { width: 17px; height: 17px; color: var(--brand); }
.system-message.is-closed svg.lucide { color: var(--danger); }
.system-message-content { min-width: 0; display: grid; justify-items: center; gap: 2px; }
.system-message-text, .system-message-detail, .system-message-meta { max-width: 100%; overflow-wrap: anywhere; }
.system-message-detail { color: var(--muted); font-weight: 600; }
.system-message-meta { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 2px 5px; color: var(--faint); font-size: 11px; }
.system-message-actor { min-width: 0; overflow-wrap: anywhere; }
.system-message-time { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.robot-message { margin: 12px 0; max-width: min(78%, 560px); padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: 13px; display: flex; gap: 10px; font-size: 13px; }
.robot-message img { width: 28px; height: 28px; border-radius: 50%; object-fit: contain; }
.robot-message p { margin: 2px 0 0; color: var(--muted); }
.note-message { margin: 10px 0; padding: 10px 12px; border: 1px dashed var(--note-line); border-radius: 13px; background: var(--note); font-size: 14px; }
.note-message b { margin-bottom: 3px; display: flex; align-items: center; gap: 6px; color: var(--warn); font-size: 12px; font-weight: 600; }
.note-message b svg.lucide { width: 14px; height: 14px; }
.attachment-card { min-width: 200px; max-width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; display: flex; align-items: center; gap: 10px; color: inherit; background: var(--surface); text-decoration: none; }
.attachment-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; color: var(--brand); background: var(--brand-soft); font-weight: 700; }
.attachment-card b { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.attachment-card small { color: var(--muted); font-size: 12px; }

/* поле сообщения */
.composer { padding: 10px 22px 14px; background: var(--surface); }
.composer-box { min-height: 52px; padding: 6px 6px 6px 8px; border: 1px solid var(--line); border-radius: 18px; display: flex; align-items: flex-end; gap: 4px; background: var(--surface); }
.composer-box:focus-within { border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
.attach-button { width: 38px; height: 38px; padding: 0; border: 0; border-radius: 12px; display: grid; place-items: center; flex: none; color: var(--brand); background: transparent; }
.attach-button:hover { background: var(--field); }
.attach-button svg.lucide { width: 21px; height: 21px; }
#messageInput { min-width: 0; min-height: 38px; max-height: 120px; padding: 9px 4px; border: 0; outline: 0; flex: 1; resize: none; background: transparent; font-size: 15px; line-height: 1.35; }
#messageInput::placeholder { color: var(--muted); }
.composer-shortcut { align-self: center; color: var(--faint); font-size: 11px; }
.composer-shortcut kbd { padding: 1px 5px; border: 1px solid var(--line); border-radius: 5px; font: 500 10px/1.4 ui-monospace, Menlo, monospace; }
.composer-sending { align-self: center; color: var(--muted); font-size: 12px; }
.send-button { width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--on-brand); background: var(--brand); }
.send-button:disabled { color: var(--faint); background: var(--field); }
.send-button svg.lucide { width: 18px; height: 18px; }
#app .composer-caption { margin: 6px 4px 0; display: flex; flex-wrap: wrap; overflow-wrap: anywhere; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
#app .composer-caption b { color: var(--text); font-weight: 600; }

/* ---------- правая панель ---------- */
.contact-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--surface); }
.inbox-view.panel-floating .contact-panel { position: absolute; top: 0; right: 0; bottom: 0; z-index: 20; width: min(var(--panel-w), 90%); box-shadow: var(--shadow-panel); animation: panel-in .18s ease; }
.inbox-view.panel-floating:not(.panel-peek):not(.details-open) .contact-panel { display: none; }
@keyframes panel-in { from { transform: translateX(22px); opacity: 0; } }
.panel-head { height: var(--head-h); padding: 0 10px 0 12px; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); flex: none; }
.details-close { display: none; }
.panel-tabs { padding: 3px; flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; border-radius: 12px; background: var(--tray); }
.panel-tabs button { min-height: 32px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 500; }
.panel-tabs button.active { color: var(--text); background: var(--surface); box-shadow: var(--shadow-control); }
.contact-panel .panel-toggle { flex: none; }
.inbox-view:not(.panel-floating) #panelPinButton { display: none; }
.panel-body { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px; }
.panel-section { display: grid; gap: 18px; }
.contact-profile { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 12px; }
.contact-profile h3 { margin: 0; font-size: 16px; font-weight: 600; }
.contact-profile p { margin: 3px 0 0; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.text-link { margin-top: 5px; padding: 0; border: 0; color: var(--brand); background: transparent; font-size: 12px; font-weight: 600; }
.detail-section h4 { margin: 0 0 8px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 500; }
.detail-section h4 button:not(.action-icon) { padding: 0; border: 0; color: var(--brand); background: none; font-size: 12px; font-weight: 600; }
.detail-section h4 span:not(.detail-title) { padding: 2px 7px; border-radius: 6px; color: var(--muted); background: var(--field); font-size: 11px; }
/* Единая кнопка «Изменить» в карточке диалога — карандаш, как на странице контакта. */
.detail-section .action-icon { width: 28px; height: 28px; min-width: 28px; border-radius: 8px; }
.detail-section .action-icon svg { width: 14px; height: 14px; }
.detail-section dl .detail-assignee { align-items: center; }
.detail-assignee dd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.detail-assignee dd > span { min-width: 0; overflow-wrap: anywhere; }
.detail-assignee dd > span.is-empty { color: var(--muted); font-weight: 400; }
.take-conversation { margin-right: 6px; }
.detail-section dl { margin: 0; display: grid; gap: 8px; }
.detail-section dl div { display: grid; grid-template-columns: minmax(100px, 42%) minmax(0, 1fr); gap: 10px; font-size: 13px; }
.detail-section dt { color: var(--muted); }
.detail-section dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.detail-section p { margin: 0; color: var(--muted); font-size: 13px; }
.client-note { padding: 11px 13px; border-radius: 13px; color: var(--text) !important; background: var(--field); line-height: 1.45; }
.client-note.is-empty { color: var(--muted) !important; }
.client-note.is-error { color: var(--danger) !important; background: var(--danger-soft); }
.legacy-client-note { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--note-line); border-radius: 12px; background: var(--note); }
.legacy-client-note b, .legacy-client-note small { display: block; }
.legacy-client-note b { color: var(--text); font-size: 12px; }
.legacy-client-note p { margin: 4px 0; color: var(--text); overflow-wrap: anywhere; }
.legacy-client-note small { color: var(--muted); font-size: 11px; }
.legacy-client-note button { margin-top: 7px; padding: 0; border: 0; display: inline-flex; align-items: center; gap: 5px; color: var(--brand); background: transparent; font-size: 12px; font-weight: 600; }
.legacy-client-note button svg.lucide { width: 14px; height: 14px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-row .muted { font-size: 13px; }
.select-field select { width: 100%; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 13px; }
.history-list { display: grid; }
.history-list div { padding: 9px 0; display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); font-size: 13px; }
.history-list div:last-child { border-bottom: 0; }
.history-list small, .history-list time { color: var(--muted); white-space: nowrap; }
.empty-card { padding: 14px; border: 1px dashed var(--line-strong); border-radius: 14px; display: flex; gap: 12px; color: var(--muted); font-size: 13px; }
.empty-card svg.lucide { color: var(--brand); }
.empty-card b { color: var(--text); font-weight: 600; }
.empty-card p { margin: 3px 0 0; }
.crm-preview button { margin-top: 10px; min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13px; font-weight: 600; }

/* ---------- страницы ---------- */
.page-view { height: 100vh; height: 100dvh; padding: 0 32px 48px; overflow-y: auto; background: var(--page); }
.page-view > * { max-width: 1440px; margin-left: auto; margin-right: auto; }
.page-header { min-height: 84px; padding: 20px 0 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-header h1 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -.025em; }
.page-header p { margin: 4px 0 0; font-size: 14px; }
.page-tabs { margin-bottom: 14px; padding: 3px; width: max-content; max-width: 100%; display: flex; gap: 3px; overflow-x: auto; border-radius: 12px; background: var(--tray); }
.page-tabs button { min-height: 32px; padding: 0 14px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 500; white-space: nowrap; }
.page-tabs button.active { color: var(--text); background: var(--surface); box-shadow: var(--shadow-control); }
.team-overview { margin-bottom: 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.team-overview > div { padding: 14px 16px; border-radius: 16px; display: grid; gap: 2px; background: var(--surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.team-overview span { color: var(--muted); font-size: 13px; }
.team-overview b { font-size: 26px; font-weight: 600; letter-spacing: -.03em; }
.team-overview b.text-stat { font-size: 18px; }
.team-overview small { color: var(--muted); font-size: 12px; }
.content-card { border-radius: 18px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.table-head { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.table-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.table-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.compact-search { height: 34px; padding: 0 10px; border-radius: 10px; display: flex; align-items: center; gap: 7px; background: var(--field); }
.compact-search svg.lucide { width: 16px; height: 16px; color: var(--muted); }
.compact-search input { width: 180px; border: 0; outline: 0; background: transparent; font-size: 13px; }
.client-directory article, .team-row { padding: 12px 16px; display: grid; grid-template-columns: 40px minmax(0, 1.4fr) minmax(0, 1fr) auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.client-directory article:has(.contact-directory-properties) { grid-template-columns: 40px minmax(180px, 1.1fr) minmax(180px, 1fr) minmax(90px, auto) auto; }
.contact-directory-properties { min-width: 0; display: grid; grid-template-columns: repeat(min(var(--property-columns, 2), 2), minmax(0, 1fr)); gap: 6px 14px; }
.contact-directory-property { min-width: 90px; }
.contact-directory-property small, .contact-directory-property b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-directory-property b { font-size: 13px; font-weight: 500; }
.contact-directory-property .property-preview { margin-top: 3px; flex-wrap: wrap; }
.contact-directory-property .property-preview .tag { max-width: 100%; }
.client-directory article:last-child, .team-row:last-child { border-bottom: 0; }
.client-directory b, .team-row .person b { display: block; font-size: 14px; font-weight: 600; }
.client-directory small, .team-row .person span { color: var(--muted); font-size: 12px; }
.client-directory button { min-height: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 13px; font-weight: 600; }
.contacts-list-pagination { border-top: 1px solid var(--line); border-right: 0; border-bottom: 0; border-left: 0; border-radius: 0; }
.page-actions { display: flex; gap: 8px; }
.contacts-directory-card { width: 100%; }
.contacts-table-head { align-items: flex-start; }
.contacts-table-head > div:first-child { min-width: 0; display: grid; gap: 10px; }
.saved-view-bar { position: relative; min-width: 0; display: flex; align-items: center; gap: 6px; }
.saved-view-tabs { min-width: 0; display: flex; align-items: center; gap: 6px; overflow: hidden; }
.saved-view-tab, .saved-view-action { min-height: 34px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--surface); font-size: 13px; font-weight: 600; white-space: nowrap; }
.saved-view-tab { padding: 0 11px; display: inline-flex; align-items: center; gap: 6px; }
.saved-view-tab.active { border-color: var(--text); color: var(--surface); background: var(--text); }
.saved-view-tab .view-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-grid; place-items: center; color: var(--brand-strong); background: var(--brand-soft); font-size: 10px; }
.saved-view-tab.active .view-count { color: var(--danger); background: var(--surface); }
.saved-view-action { width: 34px; padding: 0; display: inline-grid; place-items: center; flex: none; }
.saved-view-action:hover, .saved-view-tab:hover { color: var(--text); background: var(--field); }
.saved-view-action svg { width: 16px; height: 16px; }
.saved-view-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; width: min(280px, 80vw); padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg); }
.saved-view-menu button { width: 100%; min-height: 38px; padding: 0 10px; border: 0; border-radius: 8px; display: flex; align-items: center; justify-content: space-between; color: var(--text); background: transparent; text-align: left; }
.saved-view-menu button:hover { background: var(--field); }
.filter-row { padding: 0 16px 12px; }
.conversation-list > .saved-view-bar { padding: 10px 12px; }
/* Вкладки списка диалогов: неактивные серые, выбранная белая, «Новые» красная. */
.conversation-list > .saved-view-bar :is(.saved-view-tab, .saved-view-action) { min-height: 30px; border-radius: 9px; font-size: 13px; }
.conversation-list > .saved-view-bar .saved-view-tab { padding: 0 10px; border-color: transparent; color: var(--muted); background: var(--field); }
.conversation-list > .saved-view-bar .saved-view-tab:hover { color: var(--text); background: var(--tray); }
.conversation-list > .saved-view-bar .saved-view-tab.active { border-color: var(--line); color: var(--text); background: var(--surface); box-shadow: var(--shadow-control); }
.conversation-list > .saved-view-bar .saved-view-action { width: 30px; border-color: transparent; background: var(--field); }
.conversation-list > .saved-view-bar .saved-view-tab .view-count { min-width: 16px; height: 16px; padding: 0 4px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 600; }
.conversation-list > .saved-view-bar .saved-view-tab.has-new { border-color: var(--danger); color: var(--on-solid); background: var(--danger); }
.conversation-list > .saved-view-bar .saved-view-tab.has-new:hover { filter: brightness(1.05); }
.conversation-list > .saved-view-bar .saved-view-tab.has-new .view-count { color: var(--on-solid); background: color-mix(in srgb, var(--on-solid) 24%, transparent); }
.conversation-list > .saved-view-bar .saved-view-tab.has-new.active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--danger); }
.saved-view-menu:empty { display: none; }
.conversation-list > .saved-view-bar .saved-view-tabs { flex: 1; }
.contact-view-bar { max-width: min(760px, calc(100vw - 420px)); }
.contact-card-view { width: 100%; min-height: 100%; padding: 24px 32px 48px; overflow: visible; background: var(--surface); }
#contactsView:has(#contactCard:not([hidden])) { padding: 0; background: var(--surface); }
#contactsView:has(#contactCard:not([hidden])) > * { max-width: none; }
.contact-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.contact-card-head .back-link { margin: 0; }
.contact-card-profile { margin-top: 22px; display: flex; align-items: center; gap: 12px; }
.contact-profile-main { min-width: 0; flex: 1; }
.contact-card-profile h2 { margin: 0; font-size: 21px; line-height: 1.35; }
.contact-card-profile p { margin: 4px 0 0; font-size: 13px; }
.editable-heading, .section-heading, .contact-comment-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.editable-heading { justify-content: flex-start; }
.contact-name-form { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.contact-name-form input { width: min(440px, 52vw); min-height: 36px; padding: 4px 10px; border: 1px solid var(--brand); border-radius: 9px; color: var(--text); background: var(--surface); font-size: 21px; font-weight: 600; line-height: 1.35; box-shadow: 0 0 0 3px var(--brand-soft); }
.contact-name-form input:focus { outline: 0; }
.inline-form-error { width: 100%; color: var(--danger); font-size: 12px; }
.small-icon { width: 32px; height: 32px; }
.small-icon svg { width: 16px; height: 16px; }
.contact-read-view { width: 100%; margin-top: 22px; }
.contact-read-view h3, .contact-comment-head h3 { margin: 0; font-size: 15px; }
.contact-comment-head .text-link { margin: 0 0 8px; display: inline-flex; align-items: center; gap: 5px; }
.contact-comment-head .text-link svg { width: 14px; height: 14px; }
.contact-comment-display { width: 100%; margin: 0; padding: 9px; border: 1px solid var(--line); border-radius: 13px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; color: var(--text); background: var(--surface); font: inherit; line-height: 1.45; text-align: left; }
.contact-comment-value { min-width: 0; min-height: 36px; padding: 4px 5px; border: 0; display: block; flex: 1; color: inherit; background: transparent; font: inherit; line-height: inherit; text-align: left; }
.contact-comment-value span { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.contact-comment-display .action-icon { flex: none; }
.contact-comment-display:hover { border-color: var(--line-strong); }
.contact-comment-display:focus-within { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.contact-form { margin-top: 8px; display: grid; grid-template-columns: 1fr; gap: 10px; }
.contact-form label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 500; }
.contact-form input, .contact-form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--surface); font: inherit; }
.contact-form textarea { resize: vertical; }
.contact-form input:focus, .contact-form textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.contact-form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.form-error { grid-column: 1 / -1; margin: 0; padding: 10px 12px; border-radius: 12px; color: var(--danger); background: var(--danger-soft); font-size: 13px; }
.contact-card-section, .contact-history, .contact-service-info { width: 100%; margin-top: 22px; }
.contact-card-section h3, .contact-history h3, .contact-service-info h3 { margin: 0; color: var(--text); font-size: 15px; font-weight: 600; line-height: 1.4; }
.contact-properties { margin-top: 10px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.contact-property-row { min-height: 58px; padding: 10px 12px; display: grid; grid-template-columns: minmax(150px, .55fr) minmax(0, 1.45fr) auto; align-items: center; gap: 12px; border-top: 1px solid var(--line); }
.contact-property-row:first-child { border-top: 0; }
.contact-property-row > span:first-child { font-size: 13px; font-weight: 600; }
.contact-property-value { min-width: 0; overflow-wrap: anywhere; }
.contact-property-value.is-empty { color: var(--muted); }
.contact-property-editor { display: flex; align-items: center; gap: 8px; }
.contact-property-editor :is(input, select, textarea) { width: 100%; min-width: 0; }
.contact-property-editor select[multiple] { min-height: 104px; }
.contact-property-editor textarea { min-height: 76px; resize: vertical; }
.contact-property-actions { display: flex; align-items: center; gap: 6px; }
.section-heading { min-height: 36px; margin-bottom: 8px; }
.action-icon { width: 34px; height: 34px; min-width: 34px; padding: 0; border: 1px solid var(--line); border-radius: 9px; display: inline-grid; place-items: center; color: var(--muted); background: var(--surface); text-decoration: none; }
.action-icon:hover { border-color: var(--line-strong); color: var(--text); background: var(--field); }
.action-icon:focus-visible { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.action-icon:disabled { cursor: default; opacity: .45; }
.action-icon svg { width: 16px; height: 16px; }
.editable-heading .action-icon, .contact-comment-head .action-icon { flex: none; }
.contact-comment-head { min-height: 36px; margin-bottom: 8px; }
.contact-comment-head h3 { margin: 0; }
.contact-table { width: 100%; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.contact-table-header, .contact-table-body > [role="row"] { display: grid; align-items: center; column-gap: 12px; }
.contact-table-header { min-height: 38px; padding: 0 12px; color: var(--muted); background: var(--field); font-size: 11px; font-weight: 700; line-height: 1.3; letter-spacing: .03em; text-transform: uppercase; }
.contact-table-body > [role="row"] { min-height: 58px; padding: 10px 12px; border-top: 1px solid var(--line); color: var(--text); font-size: 13px; line-height: 1.35; }
.contact-table-body > [role="row"]:first-child { border-top: 0; }
.contact-table-body > [role="row"] > * { min-width: 0; }
.contact-table-empty { border: 0; border-radius: 0; }
.contact-data-header, .contact-data-table article { grid-template-columns: 38px minmax(96px, .65fr) minmax(96px, .75fr) minmax(170px, 1.4fr) minmax(100px, .8fr) minmax(170px, auto); }
.contact-conversation-header, .contact-conversation-table article { grid-template-columns: 38px minmax(150px, 1.25fr) minmax(105px, .7fr) minmax(170px, 1fr) minmax(150px, auto); }
.contact-history-header, .contact-history-row { grid-template-columns: minmax(150px, 1.15fr) minmax(150px, 1fr) minmax(130px, .75fr) minmax(150px, .8fr); }
.contact-history-row time { white-space: nowrap; }
.contact-history-row { min-height: 44px !important; padding-top: 6px !important; padding-bottom: 6px !important; }
.contact-history-event { min-width: 0; display: flex; align-items: flex-start; gap: 7px; overflow-wrap: anywhere; }
.history-event-icon { width: 16px; height: 16px; margin-top: 1px; flex: none; color: var(--brand); }
.history-event-icon.is-closed { color: var(--danger); }
.method-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.contact-way-link { color: var(--brand); text-decoration: none; }
.contact-way-link:hover { text-decoration: underline; }
.contact-way-value { display: block; overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.contact-way-channel, .contact-way-details { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.contact-way-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; color: var(--brand-strong); background: var(--brand-soft); }
.contact-way-icon svg { width: 18px; height: 18px; }
.contact-conversation-table .channel-logo { width: 38px; height: 38px; border-radius: 11px; }
.contact-way-type, .contact-conversation-table b { font-size: 13px; font-weight: 600; }
.contact-way-conversation { width: min(200px, 18vw); min-height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: var(--surface); font-size: 12px; }
.contact-open-conversation { white-space: nowrap; }
.contact-pagination { min-height: 52px; padding: 8px 12px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 14px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.contact-history-table { border-radius: 14px 14px 0 0; }
.contact-pagination-summary, .contact-pagination-controls, .history-page-size { display: flex; align-items: center; gap: 8px; }
.contact-pagination-summary, .contact-pagination-controls { color: var(--muted); font-size: 12px; }
.history-page-size { margin: 0; font-size: 12px; font-weight: 500; }
.history-page-size select { min-height: 32px; padding: 0 28px 0 9px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: var(--surface); }
.contact-service-info { padding-top: 18px; border-top: 1px solid var(--line); }
.contact-service-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 12px; }
.contact-uid-copy { min-width: 0; display: inline-flex; align-items: center; gap: 6px; }
.contact-service-info code { overflow-wrap: anywhere; color: var(--text); font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.view-filter-builder { margin-top: 16px; padding: 14px; border-radius: 14px; background: var(--field); }
.view-filter-builder-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.view-filter-builder-head h3 { margin: 0; font-size: 14px; }
.view-filter-builder-head p, .view-condition-empty { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.view-condition-chips { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.view-condition-chip { min-width: 0; min-height: 32px; border: 1px solid var(--line); border-radius: 10px; display: inline-flex; align-items: center; overflow: hidden; background: var(--surface); }
.view-condition-chip button { min-height: 30px; padding: 0 9px; border: 0; color: var(--text); background: transparent; font-size: 12px; }
.view-condition-chip button:first-child { max-width: min(440px, 62vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.view-condition-chip button:last-child { width: 30px; padding: 0; color: var(--muted); }
.view-condition-editor { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 10px; background: var(--surface); }
.view-condition-editor label { display: grid; gap: 5px; }
.view-condition-editor input[type="search"], .view-condition-editor input[type="text"], .view-condition-editor input[type="number"], .view-condition-editor input[type="date"] { min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--surface); }
.condition-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; font-weight: 500; }
.view-operator-list { display: flex; flex-wrap: wrap; gap: 6px; }
.view-operator-list button { min-height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); background: var(--surface); font-size: 12px; }
.view-operator-list button.active { border-color: var(--brand); color: var(--brand-strong); background: var(--brand-soft); }
.view-condition-selection { margin: 7px 0; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.view-condition-selection button { padding: 0; border: 0; color: var(--brand); background: transparent; font-size: 12px; }
.view-condition-options { max-height: 210px; border: 1px solid var(--line); border-radius: 10px; overflow-y: auto; background: var(--surface); }
.view-condition-options label { min-height: 36px; padding: 6px 9px; display: flex; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.view-condition-options label:hover { background: var(--field); }
.view-condition-options input { width: 17px; height: 17px; }
.view-condition-options p { margin: 0; padding: 10px; color: var(--muted); font-size: 12px; }
.view-condition-range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.view-condition-actions { display: flex; justify-content: flex-end; gap: 8px; }
.checkbox-row { min-height: 36px; display: flex !important; grid-template-columns: none !important; flex-direction: row; align-items: center; gap: 8px !important; color: var(--text) !important; }
.checkbox-row input { width: 18px; height: 18px; }
.view-dialog-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: nowrap; gap: 8px; }
.view-dialog-actions > .danger-outline { margin-right: auto; }
.view-dialog-actions > span { display: none; }
.dialog select { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--surface); }
.dialog.contact-method-dialog { width: min(720px, calc(100vw - 24px)); padding: 0; background: transparent; box-shadow: none; }
.contact-method-dialog .sample-contact-method-form { max-width: none; }
.contact-method-dialog .dialog-head { margin-bottom: 0; }
.sample-contact-composite #contactMethodKind { min-width: 142px; }
.sample-contact-composite #contactMethodProvider { min-width: 138px; }
.sample-contact-composite #contactMethodCountry { min-width: 104px; }
.sample-contact-composite #contactMethodValue { min-width: 150px; flex: 1 1 220px; }
.sample-contact-composite #contactMethodExtensionAction { flex: 0 0 auto; color: var(--brand-strong); white-space: nowrap; }
.sample-contact-composite #contactMethodExtension { width: 112px; flex: 0 0 112px; }
.sample-contact-composite #contactMethodValue,
.sample-contact-composite #contactMethodExtension { border-radius: 0; box-shadow: none; }
.sample-contact-composite #contactMethodExtensionAction { border-radius: 0; background: transparent; font-weight: 600; }
.sample-contact-comment-control #contactMethodLabel { font-size: 15px; }
.contact-method-delete { width: 100%; min-height: 46px; border-radius: 12px; }
.dialog.contact-method-dialog { width: min(760px, calc(100vw - 24px)); }
.contact-method-dialog .sample-contact-method-form { --contact-method-control-height: 40px; max-width: none; padding: 20px; gap: 12px; border-radius: 18px; }
.contact-method-dialog .sample-contact-method-form header h2 { font-size: 22px; line-height: 1.25; }
.contact-method-grid { display: grid; grid-template-columns: minmax(150px, .85fr) minmax(100px, .55fr) minmax(310px, 1.9fr); align-items: start; gap: 8px 10px; }
.contact-method-dialog .sample-contact-method-form[data-kind="email"] .contact-method-grid { grid-template-columns: minmax(150px, .8fr) minmax(310px, 2.2fr); }
.contact-method-dialog .sample-contact-method-form[data-kind="email"] .contact-method-value-control #contactMethodValue { padding-right: 12px; }
.contact-method-dialog .sample-contact-method-form[data-kind="messenger"][data-provider-phone="true"] .contact-method-grid { grid-template-columns: minmax(130px, .8fr) minmax(120px, .75fr) minmax(90px, .5fr) minmax(260px, 2fr); gap: 8px; }
.contact-method-field { min-width: 0; display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 500; }
.contact-method-field[hidden] { display: none; }
.contact-method-field > span:first-child { min-height: 18px; }
.contact-method-field input,
.contact-method-field .sample-select-trigger { width: 100%; min-height: 40px; }
.contact-method-field > .sample-select { width: 100%; min-width: 0; }
.contact-method-field input { padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; outline: 0; color: var(--text); background: var(--surface); font: inherit; font-size: 14px; font-weight: 500; }
.contact-method-field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.contact-method-field input:disabled { color: var(--muted); background: var(--field); }
.contact-method-field small { min-height: 17px; color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.45; }
.contact-method-value-control { min-width: 0; position: relative; display: flex; align-items: stretch; }
.contact-method-value-control #contactMethodValue { min-width: 0; flex: 1 1 auto; padding-right: 60px; font-variant-numeric: tabular-nums; }
.contact-method-extension-action { position: absolute; top: 1px; right: 1px; bottom: 1px; min-width: 54px; padding: 0 8px; border: 0; border-left: 1px solid var(--line); border-radius: 0 10px 10px 0; color: var(--brand-strong); background: var(--surface); font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap; }
.contact-method-value-control #contactMethodExtension { width: 112px; margin-left: 8px; flex: 0 0 112px; }
.contact-method-dialog .sample-contact-comment { gap: 6px; }
.contact-method-dialog .sample-contact-comment input { min-height: 40px; font-size: 14px; }
.contact-method-dialog .sample-contact-primary { min-height: 30px; display: flex; align-items: center; flex-direction: row; flex-wrap: nowrap; gap: 8px; white-space: nowrap; }
.contact-method-dialog .sample-contact-primary > span { min-width: 0; color: var(--text); font-size: 14px; font-weight: 500; line-height: 1.35; }
.contact-method-dialog .sample-contact-primary input { margin: 0; flex: 0 0 18px; }
.contact-method-dialog .sample-contact-actions { margin-top: 0; display: flex; align-items: center; gap: 8px; }
.contact-method-dialog .sample-contact-actions .btn { min-width: 108px; min-height: 40px; padding: 0 16px; border-radius: 11px; }
.contact-method-dialog .contact-method-action-spacer { flex: 1 1 auto; }
.contact-method-dialog .contact-method-delete { width: auto; min-width: 88px; }

.team-row { grid-template-columns: 40px minmax(0, 1.45fr) minmax(0, 1fr) minmax(0, .8fr) minmax(112px, .55fr); }
.team-row .manager-avatar { width: 40px; height: 40px; flex-basis: 40px; }
.team-row .online { color: var(--success); }
.team-row .team-access { justify-self: end; }
.analytics-bars { height: 220px; padding: 20px 16px 16px; display: grid; grid-template-columns: repeat(7, 1fr); align-items: end; gap: 10px; }
.analytics-bars div { height: 100%; display: grid; grid-template-rows: 1fr auto; grid-template-columns: 1fr 1fr; align-items: end; gap: 3px; }
.analytics-bars i { height: var(--new); border-radius: 6px 6px 2px 2px; background: var(--brand); }
.analytics-bars b { height: var(--closed); border-radius: 6px 6px 2px 2px; background: color-mix(in srgb, var(--brand) 35%, var(--surface)); }
.analytics-bars span { grid-column: 1 / -1; color: var(--muted); font-size: 12px; text-align: center; }
.security-note { margin-bottom: 16px; padding: 12px 14px; border-radius: 14px; display: flex; gap: 10px; color: var(--brand-strong); background: var(--brand-soft); font-size: 13px; }
.security-note p { margin: 2px 0 0; color: var(--muted); }
.channel-section { margin-bottom: 22px; }
.channel-section-head { margin-bottom: 10px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.channel-section-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.channel-section-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.section-count { min-width: 28px; height: 28px; border-radius: 14px; display: grid; place-items: center; color: var(--muted); background: var(--surface); box-shadow: 0 0 0 1px var(--line); font-size: 12px; font-weight: 600; }
.channel-list { display: grid; gap: 8px; }
.channel-card { padding: 14px 16px; border-radius: 16px; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 14px; background: var(--surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.channel-card.failed { box-shadow: 0 0 0 1px color-mix(in srgb, var(--danger) 45%, transparent); }
.channel-logo, .future-logo { position: relative; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; overflow: hidden; color: var(--on-solid); background: var(--telegram); font-size: 16px; font-weight: 700; }
.channel-logo.max { background: var(--max); }
.channel-logo.avito { background: var(--avito); }
.future-logo { color: var(--muted); background: var(--field); font-size: 13px; }
.channel-logo:has(> img), .future-logo:has(> img) { border: 1px solid var(--line); background: var(--surface); }
.channel-logo.avito { border: 1px solid var(--line); color: var(--avito); background: var(--surface); }
.channel-logo > img, .future-logo > img { position: absolute; inset: 50% auto auto 50%; width: 26px; height: 26px; display: block; transform: translate(-50%, -50%); }
.channel-logo-fallback { display: block; }
.channel-logo > img + .channel-logo-fallback, .future-logo > img + .channel-logo-fallback { display: none; }
.channel-main { min-width: 0; }
.channel-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.channel-title h2 { margin: 0; font-size: 16px; font-weight: 600; }
.channel-main p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.channel-alert-icon { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: var(--on-solid); background: var(--danger); font-size: 12px; font-weight: 700; }
.channel-meta { display: grid; justify-items: end; gap: 6px; font-size: 12px; }
.channel-card-actions { display: flex; gap: 6px; }
.channel-empty { padding: 18px; border: 1px dashed var(--line-strong); border-radius: 16px; color: var(--muted); font-size: 13px; text-align: center; }
.future-channel { opacity: .85; }

/* настройки: профиль сотрудника и список по макету #53 */
.settings-profile-card { margin-bottom: 14px; border-radius: 18px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.settings-profile-summary { min-height: 104px; padding: 18px 20px; display: flex; align-items: center; gap: 16px; }
.profile-avatar-button { position: relative; padding: 0; border: 0; border-radius: 50%; background: none; }
.profile-avatar-button .manager-avatar { width: 64px; height: 64px; flex-basis: 64px; }
.profile-avatar-button svg.lucide { position: absolute; right: -2px; bottom: -2px; width: 26px; height: 26px; padding: 5px; border-radius: 50%; color: var(--on-solid); background: var(--brand); box-shadow: 0 0 0 3px var(--surface); }
.settings-profile-identity { min-width: 0; }
.settings-profile-name { min-width: 0; display: flex; align-items: center; gap: 6px; }
.settings-profile-name b { min-width: 0; overflow: hidden; font-size: 18px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.settings-profile-identity > small { color: var(--muted); font-size: 14px; }
.settings-profile-action { border: 1px solid var(--line); background: var(--surface); }
.settings-profile-action svg.lucide { width: 18px; height: 18px; }
.settings-profile-section-head { padding: 15px 20px 12px; border-top: 1px solid var(--line); }
.settings-profile-section-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.settings-profile-section-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.settings-contact-table-wrap { overflow: visible; border-top: 1px solid var(--line); }
.settings-contact-table th:first-child { width: 180px; }
.settings-contact-table th:nth-child(3) { width: 260px; }
.settings-contact-table th:last-child, .settings-contact-table td:last-child { width: 126px; }
.settings-contact-kind { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.settings-contact-kind svg.lucide { width: 18px; height: 18px; color: var(--muted); }
.settings-contact-value { font-weight: 500; }
.settings-contact-note { color: var(--muted); }
.settings-contact-action { min-width: 96px; }
.settings-contact-action svg.lucide { flex: none; }
.settings-list { margin-bottom: 14px; border-radius: 18px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.property-entity-tabs { margin: 14px 0 0; padding: 3px; width: max-content; max-width: 100%; display: flex; gap: 3px; border-radius: 12px; background: var(--tray); }
.property-entity-tabs button { min-width: 150px; min-height: 34px; padding: 0 16px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 14px; font-weight: 500; cursor: pointer; }
.property-entity-tabs button.active { color: var(--text); background: var(--surface); box-shadow: var(--shadow-control); }
.dialog.properties-dialog { width: min(800px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow: auto; }
.properties-toolbar { margin: 14px 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.properties-toolbar > span { color: var(--muted); font-size: 13px; }
.properties-list { display: grid; gap: 8px; }
.properties-hidden { margin-top: 18px; }
.properties-hidden-title { margin: 0 0 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.properties-hidden-title small { margin-left: 4px; color: var(--faint); font-weight: 500; }
.property-card { position: relative; width: 100%; min-height: 72px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 10px; color: var(--text); background: var(--surface); cursor: pointer; }
.property-card:hover { border-color: var(--line-strong); background: var(--field); }
.property-card.is-hidden .property-card-main { opacity: .6; }
.property-card.is-dragging, .property-value-row.is-dragging { opacity: .45; }
.property-card.is-drop-before::before, .property-card.is-drop-after::after, .property-value-row.is-drop-before::before, .property-value-row.is-drop-after::after { content: ''; position: absolute; z-index: 3; left: 8px; right: 8px; height: 3px; border-radius: 99px; background: var(--brand); box-shadow: 0 0 0 3px var(--surface); pointer-events: none; }
.property-card.is-drop-before::before, .property-value-row.is-drop-before::before { top: -6px; }
.property-card.is-drop-after::after, .property-value-row.is-drop-after::after { bottom: -6px; }
.property-drag-handle { width: 36px; height: 44px; border: 0; border-radius: 11px; display: grid; place-items: center; color: var(--muted); background: var(--field); cursor: grab; }
.property-drag-handle.is-static { background: transparent; cursor: default; }
.property-drag-handle:active { cursor: grabbing; }
.property-drag-handle svg.lucide { width: 18px; height: 18px; }
.property-card-main { min-width: 0; padding: 0; border: 0; display: grid; grid-template-rows: 20px 22px; align-items: center; gap: 2px; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.property-card-main b { overflow: hidden; font-size: 14px; line-height: 20px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.property-card-main > small { color: var(--muted); font-size: 12px; line-height: 22px; white-space: nowrap; }
.property-card-main:has(.property-preview) { grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; }
.property-card-main:has(.property-preview) b { grid-column: 1 / -1; }
.property-card .property-preview { min-width: 0; margin: 0; height: 22px; overflow: hidden; flex-wrap: nowrap; }
.property-card .property-preview .tag { flex: none; }
.property-card-meta { display: flex; align-items: center; gap: 4px; }
.property-card-meta > svg.lucide { width: 17px; height: 17px; color: var(--faint); }
.property-visibility, .property-visibility-slot { width: 36px; height: 36px; flex: none; }
.property-visibility { border: 0; border-radius: 10px; display: grid; place-items: center; color: var(--text); background: transparent; cursor: pointer; }
.property-visibility:hover, .property-visibility:focus-visible { background: var(--surface); box-shadow: 0 0 0 1px var(--line); outline: 0; }
.property-visibility.is-hidden { color: var(--faint); }
.property-visibility svg.lucide { width: 18px; height: 18px; }
.property-kind { padding: 4px 8px; border-radius: 99px; color: var(--muted); background: var(--field); font-size: 11px; white-space: nowrap; }
.property-preview { margin-top: 7px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.property-preview .tag { max-width: 140px; }
.property-editor { margin-top: 4px; display: grid; gap: 14px; }
.property-source { margin: -4px 0 0; color: var(--muted); font-size: 13px; }
.dialog .property-name-field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.dialog .property-name-field input { height: 46px; }
.property-name-field input:disabled { color: var(--text); background: var(--field); opacity: 1; }
.property-mode { margin: 0; padding: 0; border: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.property-mode[hidden], .property-fixed-type[hidden], .property-values-section[hidden] { display: none; }
.property-mode legend { grid-column: 1 / -1; margin-bottom: 6px; padding: 0; font-size: 13px; font-weight: 600; }
.dialog .property-mode label { min-height: 52px; flex-direction: row; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; display: flex; align-items: center; gap: 9px; color: var(--text); cursor: pointer; }
.property-mode label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.property-mode label:has(input:disabled) { cursor: default; }
.property-mode label:has(input:disabled):not(:has(input:checked)) { color: var(--muted); }
.dialog .property-mode input { flex: none; min-height: 0; padding: 0; width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }
.property-mode b { display: block; font-size: 14px; font-weight: 500; }
.dialog .property-fixed-type { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.property-fixed-type b { min-height: 46px; padding: 0 12px; border-radius: 12px; display: flex; align-items: center; color: var(--text); background: var(--field); font-size: 14px; font-weight: 500; }
.property-values-section { display: grid; gap: 8px; }
.property-values-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.property-values-head b { font-size: 13px; font-weight: 600; }
.property-values { display: grid; gap: 8px; }
.property-value-row { position: relative; min-height: 58px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 13px; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto 36px 36px; align-items: center; gap: 8px; background: var(--surface); }
.property-value-row.is-hidden .property-value-main { opacity: .45; }
.property-value-main { min-width: 0; padding: 6px 4px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.property-value-row.is-readonly .property-value-main { cursor: default; }
.property-value-main .tag { max-width: 100%; }
.property-value-color { min-height: 34px; padding: 0 12px; border: 0; border-radius: 10px; display: inline-flex; align-items: center; gap: 6px; color: var(--brand-strong); background: var(--brand-soft); font-size: 13px; font-weight: 600; cursor: pointer; }
.property-value-color svg.lucide { width: 15px; height: 15px; }
.property-value-color:hover { box-shadow: 0 0 0 1px var(--brand); }
.property-value-row .property-value-remove { width: 36px; height: 36px; color: var(--danger); }
.property-value-row .property-value-remove:hover { background: var(--danger-soft); }
.property-editor-actions { margin-top: 2px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.property-editor-actions-start, .property-editor-actions-end { display: flex; align-items: center; gap: 8px; }
.property-editor-actions .btn { min-height: 40px; }
.property-editor-actions-end .btn { min-width: 112px; }
.property-enum-picker { position: relative; min-width: 220px; }
.property-enum-trigger { width: 100%; min-height: 42px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 11px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text); background: var(--surface); text-align: left; }
.property-enum-trigger > span { min-width: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.property-enum-trigger svg { width: 16px; height: 16px; flex: none; }
.property-enum-menu { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: min(360px, calc(100vw - 48px)); padding: 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow-lg); }
.property-enum-menu[hidden] { display: none; }
.property-enum-menu input[type="search"] { width: 100%; min-height: 40px; margin-bottom: 8px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--field); }
.property-enum-options { max-height: 240px; margin-bottom: 8px; display: grid; gap: 4px; overflow: auto; }
.property-enum-option { min-height: 38px; padding: 6px 8px; border: 0; border-radius: 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text); background: transparent; text-align: left; }
.property-enum-option:hover, .property-enum-option.selected { background: var(--field); }
.dialog.value-editor-dialog { width: min(780px, calc(100vw - 24px)); height: min(840px, calc(100dvh - 32px)); max-height: calc(100dvh - 32px); overflow: hidden; }
.value-editor-dialog form { height: 100%; display: grid; grid-template-rows: auto auto auto auto minmax(0, 1fr) auto; gap: 14px; }
.value-preview { min-height: 92px; padding: 18px; border-radius: 16px; display: grid; place-items: center; background: var(--field); }
.value-preview .tag { height: 28px; padding: 0 11px; font-size: 13px; }
.value-color-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.value-color-controls > button { min-height: 58px; padding: 8px 10px 8px 12px; border: 1px solid var(--line); border-radius: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text); background: var(--surface); font-size: 14px; text-align: left; cursor: pointer; }
.value-color-controls > button:hover { border-color: var(--brand); background: var(--brand-soft); }
.value-color-current { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.value-color-current i { width: 38px; height: 38px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--selected-color); box-shadow: inset 0 0 0 3px var(--surface); }
.value-presets { min-height: 0; overflow: auto; }
.value-presets > b { display: block; margin-bottom: 7px; font-size: 13px; }
.value-presets > div { display: grid; grid-template-columns: repeat(10, minmax(44px, 1fr)); gap: 7px; }
.value-preset { min-height: 48px; padding: 5px; border: 2px solid transparent; border-radius: 12px; display: grid; place-items: center; background: var(--surface); }
.value-preset.active { border-color: var(--brand); }
.value-preset .tag { width: 100%; height: 30px; padding-inline: 5px; justify-content: center; font-size: 12px; font-weight: 700; }
.dialog.color-picker-dialog { width: min(1120px, calc(100vw - 24px)); height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); overflow: hidden; }
.color-picker-dialog form { height: 100%; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto auto; gap: 14px; }
.color-picker-palette { min-height: 0; padding: 12px; border: 1px solid var(--line); border-radius: 16px; display: grid; grid-template-columns: repeat(12, minmax(44px, 1fr)); align-content: start; gap: 10px; overflow: auto; background: var(--field); }
.color-picker-swatch { position: relative; aspect-ratio: 1; min-height: 46px; border: 2px solid var(--surface); border-radius: 12px; background: var(--swatch-color); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.color-picker-swatch:hover { transform: translateY(-2px); box-shadow: 0 0 0 2px var(--brand); }
.color-picker-swatch.active { box-shadow: 0 0 0 3px var(--brand); }
.color-picker-custom { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 12px; }
.color-picker-preview { min-height: 58px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; display: flex; align-items: center; gap: 12px; color: var(--muted); background: var(--surface); }
.color-picker-preview i { width: 38px; height: 38px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--selected-color); box-shadow: inset 0 0 0 3px var(--surface); }
.color-picker-custom label { min-height: 58px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; display: grid; grid-template-columns: 1fr 120px; align-items: center; gap: 10px; color: var(--text); background: var(--surface); }
.settings-list-title { margin: 0; padding: 14px 16px 6px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.settings-row { min-height: 60px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-top: 1px solid var(--line); }
.settings-list-title + .settings-row { border-top: 0; }
.settings-row b { display: block; font-size: 15px; font-weight: 500; }
.settings-row small { display: block; color: var(--muted); font-size: 13px; }
.settings-row > svg.lucide { color: var(--faint); }
.settings-action-row { width: 100%; border: 0; color: var(--text); background: transparent; font: inherit; text-align: left; }
.settings-action-row:hover { background: var(--field); }
.settings-row-meta { display: flex; align-items: center; gap: 8px; flex: none; }
.settings-row-meta svg.lucide { width: 18px; height: 18px; color: var(--faint); }
.settings-preference-row > span:first-child { min-width: 0; }
.settings-preference-row > select, .settings-preference-row > .sample-select { width: min(360px, 48%); flex: 0 1 360px; }
.settings-preference-row .sample-select-trigger { width: 100%; }

/* окна */
.dialog { width: min(620px, calc(100vw - 24px)); max-height: calc(100vh - 40px); padding: 18px; border: 0; border-radius: 20px; color: var(--text); background: var(--surface); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: var(--dialog-backdrop); }
.dialog-head { margin-bottom: 12px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-head h2 { margin: 0; font-size: 20px; font-weight: 600; }
.dialog-actions { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dialog-actions .btn { min-height: 46px; border-radius: 14px; }
.dialog label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 500; }
.dialog input[type="email"], .dialog input[type="password"], .dialog input[type="text"] { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--surface); }
.dialog-hint { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.dialog-error, .dialog-result { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; font-size: 13px; }
.dialog-error, .dialog-result.error { color: var(--danger); background: var(--danger-soft); }
.dialog-result { color: var(--muted); background: var(--field); }
.dialog-result.success { color: var(--success); background: var(--success-soft); }
.dialog-progress { margin-top: 12px; padding: 12px; border-radius: 12px; display: flex; gap: 10px; background: var(--brand-soft); font-size: 13px; }
.profile-dialog { width: min(480px, calc(100vw - 24px)); }
.profile-dialog-fields { display: grid; gap: 14px; }
.profile-dialog .dialog-error { margin-bottom: 0; }
.dialog-progress p { margin: 2px 0 0; color: var(--muted); }
.dialog-spinner { width: 18px; height: 18px; border: 2px solid var(--line-strong); border-top-color: var(--brand); border-radius: 50%; animation: message-spin .8s linear infinite; flex: none; }
.avito-connect-intro { margin-top: 0; }
.avito-connect-intro + .form-stack { margin-top: 12px; }
.avito-connect-help { margin-top: 12px; }
.avito-connect-help summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; color: var(--brand); font-size: 14px; font-weight: 600; }
.avito-connect-help summary::-webkit-details-marker { display: none; }
.avito-connect-help summary svg.lucide { width: 17px; height: 17px; transition: transform .15s; }
.avito-connect-help[open] summary svg.lucide { transform: rotate(180deg); }
.avito-connect-help ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.avito-connect-help a { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--brand-strong); font-size: 13px; font-weight: 600; }
.avito-connect-help a svg.lucide { width: 14px; height: 14px; }
.settings-dialog { width: min(760px, calc(100vw - 24px)); }
.channel-connection { margin-bottom: 14px; padding: 14px; border-radius: 16px; background: var(--field); }
.channel-connection.failed { box-shadow: 0 0 0 1px color-mix(in srgb, var(--danger) 40%, transparent); }
.channel-connection-head { margin-bottom: 10px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.channel-connection-head span { color: var(--muted); font-size: 12px; }
.channel-connection-head b { display: block; font-size: 15px; }
.channel-connection-head small { color: var(--muted); }
.connection-field-label { color: var(--muted); font-size: 12px; }
.connection-token-row { margin-top: 6px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.connection-token-row input { min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.connection-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.channel-capabilities { margin-bottom: 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.channel-capabilities div { padding: 10px 12px; border-radius: 12px; display: grid; gap: 2px; background: var(--field); font-size: 12px; }
.channel-capabilities span, .channel-capabilities small { color: var(--muted); }
.policy-intro h3, .policy-heading h3 { margin: 0; font-size: 16px; font-weight: 600; }
.policy-section { margin-top: 14px; padding: 14px; border-radius: 16px; display: grid; gap: 10px; box-shadow: 0 0 0 1px var(--line); }
.check-setting { display: flex !important; align-items: center; justify-content: space-between; gap: 12px; color: var(--text) !important; }
.check-setting b { display: block; font-size: 14px; font-weight: 600; }
.check-setting small { color: var(--muted); font-size: 12px; font-weight: 400; }
.check-setting input { width: 20px; height: 20px; accent-color: var(--brand); }
.format-settings.is-hidden { display: none; }
.format-settings { display: grid; gap: 10px; }
.format-toolbar { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.format-toolbar button, .insert-template-object, .reset-notice { justify-self: start; padding: 0; border: 0; color: var(--brand); background: none; font-size: 13px; font-weight: 600; }
.format-row { display: grid; gap: 6px; font-size: 13px; }
.format-row div { display: flex; flex-wrap: wrap; gap: 6px; }
.format-row label { display: inline-flex !important; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 8px; color: var(--text) !important; background: var(--field); font-size: 12px !important; }
.notice-editor span { font-size: 12px; }
.template-editor { min-height: 70px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--surface); font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
.template-object { padding: 1px 6px; border-radius: 6px; color: var(--brand-strong); background: var(--brand-soft); font-weight: 600; }
.avatar-dialog { width: min(560px, calc(100vw - 24px)); }
.avatar-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; margin-top: 12px; }
.avatar-choice { aspect-ratio: 1; padding: 4px; border: 2px solid transparent; border-radius: 50%; display: grid; place-items: center; background: none; }
.avatar-choice .manager-avatar { width: 100%; height: 100%; flex-basis: auto; }
.avatar-choice:hover { border-color: var(--line-strong); }
.avatar-choice.selected { border-color: var(--brand); }
.upload-placeholder { width: 100%; margin-top: 14px; min-height: 46px; border: 1px dashed var(--line-strong); border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); background: transparent; font-size: 14px; font-weight: 500; }
.upload-placeholder small { color: var(--faint); }

/* всплывающее уведомление */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 12px; color: var(--surface); background: var(--text); box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- всплывающие окна ui.js ---------- */
.ui-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.ui-popover { position: fixed; pointer-events: auto; width: 300px; max-width: calc(100vw - 16px); max-height: min(560px, calc(100vh - 24px)); padding: 6px; display: flex; flex-direction: column; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-lg); animation: pop-in .14s ease; }
@keyframes pop-in { from { transform: translateY(-4px); opacity: 0; } }
.ui-popover h6 { margin: 6px 8px; color: var(--muted); font-size: 12px; font-weight: 500; }
.ui-popover hr { margin: 6px 4px; border: 0; border-top: 1px solid var(--line); }
.menu-item { width: 100%; min-height: 40px; padding: 0 8px; border: 0; border-radius: 10px; display: flex; align-items: center; gap: 10px; color: var(--text); background: transparent; font-size: 14px; text-align: left; }
.menu-item:hover { background: var(--field); }
.menu-item.is-selected { background: var(--brand-soft); font-weight: 600; }
.menu-item svg.lucide { width: 18px; height: 18px; color: var(--brand); }
.menu-item small { margin-left: auto; color: var(--muted); font-size: 12px; }
.menu-item .manager-avatar { width: 28px; height: 28px; flex-basis: 28px; }
.menu-item .menu-sub { display: block; margin: 0; color: var(--muted); font-size: 12px; }
.ui-popover textarea { width: 100%; min-height: 88px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; resize: vertical; color: var(--text); background: var(--note); font-size: 14px; line-height: 1.4; }
.popover-row { margin-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.popover-row > div { display: flex; gap: 6px; }
.popover-error { margin: 8px 4px 0; color: var(--danger); font-size: 12px; }
.saved-view-order-actions { margin-top: 12px; display: flex; align-items: center; gap: 8px; }
.saved-view-order-actions > span { margin-right: auto; color: var(--muted); font-size: 13px; }
.import-result-dialog { width: min(620px, calc(100vw - 24px)); }
.import-error-list { max-height: min(440px, 55vh); display: grid; gap: 8px; overflow-y: auto; }
.import-error-list article { padding: 10px 12px; border: 1px solid var(--danger-soft); border-radius: 12px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 10px; background: var(--surface); }
.import-error-list article b { color: var(--danger); font-size: 12px; }
.import-error-list article span { overflow-wrap: anywhere; font-size: 13px; }
.import-error-list article code { grid-column: 2; color: var(--muted); font-size: 11px; }
.seg { padding: 3px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; border-radius: 12px; background: var(--tray); }
.seg button { min-height: 32px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 500; }
.seg button.active { color: var(--text); background: var(--surface); box-shadow: var(--shadow-control); }
.swatch[data-value="blue"] i { background: var(--accent-blue-swatch); }
.swatch[data-value="cobalt"] i { background: var(--accent-cobalt-swatch); }
.swatch[data-value="indigo"] i { background: var(--accent-indigo-swatch); }
.swatch[data-value="sky"] i { background: var(--accent-sky-swatch); }
.look-popover { width: 286px; padding: 14px; gap: 14px; }
.look-popover h5 { margin: 0 0 7px; color: var(--muted); font-size: 12px; font-weight: 500; }
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.swatch { padding: 8px 4px 6px; border: 1px solid var(--line); border-radius: 12px; display: grid; justify-items: center; gap: 5px; color: var(--muted); background: var(--surface); font-size: 11px; }
.swatch i { width: 22px; height: 22px; border-radius: 50%; }
.swatch.active { border-color: var(--brand); color: var(--text); box-shadow: 0 0 0 1px var(--brand); }
.tags-popover { width: 360px; padding: 0; }
.property-assignment-popover { z-index: 40; }
.property-assignment-option { min-width: 0; padding: 0; border: 0; border-radius: 9px; display: inline-flex; color: inherit; background: transparent; cursor: pointer; }
.property-assignment-option .tag { height: 28px; padding: 0 10px; border-radius: 9px; font-size: 12px; box-shadow: inset 0 0 0 1px transparent; transition: box-shadow .12s; }
.property-assignment-option:hover .tag { box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 35%, transparent); }
.property-assignment-option.is-on .tag { box-shadow: inset 0 0 0 2px currentColor; font-weight: 600; }
.property-assignment-option:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tags-search { margin: 10px 10px 6px; height: 36px; padding: 0 11px; border-radius: 11px; display: flex; align-items: center; gap: 8px; background: var(--field); }
.tags-search svg.lucide { width: 16px; height: 16px; color: var(--muted); }
.tags-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; font-size: 14px; }
.tags-search kbd { color: var(--muted); font: 500 11px/1 ui-monospace, Menlo, monospace; }
.tags-list { min-height: 0; overflow-y: auto; padding: 0 6px 6px; }
.tags-group { padding: 9px 8px 4px; display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 500; }
.tags-chips { padding: 2px 8px 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.tags-chips .tag { height: 28px; padding: 0 10px; border-radius: 9px; font-size: 12px; box-shadow: inset 0 0 0 1px transparent; transition: box-shadow .12s; }
.tags-chips .tag:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 35%, transparent); }
.tags-chips .tag.is-on { box-shadow: inset 0 0 0 2px currentColor; font-weight: 600; }
.tags-chips .tag.is-hl { outline: 2px solid var(--brand); outline-offset: 2px; }
.tags-foot { padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.filter-popover { width: 380px; padding: 0; }
.filter-body { min-height: 0; overflow-y: auto; padding: 4px 14px 12px; display: grid; gap: 14px; }
.filter-body h6 { margin: 0 0 6px; padding: 0; }
.filter-options { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-tag-group { display: grid; gap: 6px; }
.filter-tag-group + .filter-tag-group { margin-top: 10px; }
.filter-tag-group > span { color: var(--muted); font-size: 12px; font-weight: 600; }
.filter-tag-options .tag { height: 28px; padding: 0 10px; border-radius: 9px; font-size: 12px; }
.filter-tag-options .tag.is-on { box-shadow: inset 0 0 0 2px currentColor; }
.filter-option { height: 32px; padding: 0 10px 0 8px; border: 1px solid var(--line); border-radius: 9px; display: inline-flex; align-items: center; gap: 6px; color: var(--text); background: var(--surface); font-size: 13px; font-weight: 500; }
.filter-option.active { border-color: var(--brand); background: var(--brand-soft); }
.filter-condition { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.2fr); gap: 6px; }
.filter-condition select, .filter-condition input { min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 14px; }
.filter-condition input:disabled { background: var(--field); }
.filter-condition .sample-select-trigger { min-height: 36px; padding-right: 30px; border-radius: 10px; font-size: 14px; }
.filter-condition .sample-select-trigger::after { right: 9px; }
.select-field .sample-select, .contact-property-editor .sample-select { width: 100%; }
.select-field .sample-select-trigger { min-height: 40px; border-radius: 12px; font-size: 13px; }
.dialog .sample-select { width: 100%; }
.dialog .sample-select-trigger { min-height: 44px; border-radius: 12px; }
.filter-foot { padding: 10px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border-top: 1px solid var(--line); }

/* Кастомное раскрытие select: нативное меню macOS не совпадает с интерфейсом. */
.sample-select { position: relative; min-width: 0; display: inline-flex; }
.sample-native-select { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; opacity: 0 !important; pointer-events: none !important; }
.sample-select-trigger { width: 100%; min-height: 42px; padding: 0 40px 0 12px; position: relative; border: 1px solid var(--line); border-radius: 11px; display: flex; align-items: center; color: var(--text); background: var(--surface); font-size: 14px; font-weight: 500; text-align: left; }
.sample-select-trigger > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sample-select-trigger::after { content: ''; position: absolute; top: 50%; right: 12px; width: 16px; height: 16px; background: var(--select-chevron) center / 16px no-repeat; transform: translateY(-50%); transition: transform .15s; }
.sample-select-trigger:hover { border-color: var(--line-strong); }
.sample-select-trigger:focus-visible, .sample-select-trigger.is-open { border-color: var(--brand); outline: 0; box-shadow: 0 0 0 3px var(--brand-soft); }
.sample-select-trigger.is-open::after { transform: translateY(-50%) rotate(180deg); }
.sample-select-trigger:disabled { color: var(--muted); background: var(--field); }
.sample-select-menu { z-index: 80; position: fixed; inset: auto; max-height: min(320px, calc(100vh - 16px)); margin: 0; padding: 6px; overflow-y: auto; border: 1px solid var(--line); border-radius: 13px; display: grid; gap: 2px; background: var(--surface); box-shadow: var(--shadow-lg); }
.sample-select-option { width: 100%; min-height: 38px; padding: 0 10px; border: 0; border-radius: 9px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text); background: transparent; font-size: 14px; font-weight: 500; text-align: left; }
.sample-select-option:hover, .sample-select-option:focus-visible { outline: 0; background: var(--field); }
.sample-select-option[aria-selected="true"] { color: var(--brand-strong); background: var(--brand-soft); }
.sample-select-option:disabled { color: var(--faint); }
.sample-select-check { width: 16px; flex: 0 0 16px; color: var(--brand); font-size: 14px; font-weight: 700; text-align: center; }
.sample-select-search { width: calc(100% - 4px); min-height: 38px; margin: 2px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; outline: 0; color: var(--text); background: var(--surface); font: inherit; font-size: 14px; }
.sample-select-search:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.sample-select-options { max-height: 250px; overflow-y: auto; display: grid; gap: 2px; }
.sample-select-empty { margin: 0; padding: 10px; color: var(--muted); font-size: 13px; }
.ui-field-control .sample-select { width: 100%; }
.data-pagination .sample-select { min-width: 72px; }
.sample-view-editor .sample-select, .sample-filter-editor .sample-select, .filter-condition .sample-select { width: 100%; }
.sample-contact-composite > .sample-select { min-height: 54px; padding: 0; flex: 0 1 auto; border: 0; border-right: 1px solid var(--line); }
.sample-contact-composite > .sample-select .sample-select-trigger { min-height: 54px; border: 0; border-radius: 0; background: transparent; font-weight: 600; box-shadow: none; }
.sample-contact-composite > .sample-select-contact-method { min-width: 120px; }
.sample-contact-composite > .sample-select-contact-identifier { min-width: 138px; }
.sample-contact-composite > .sample-select-contact-prefix { min-width: 92px; }
.ui-field.is-loading .sample-select-trigger::after { display: none; }
.contact-method-dialog .contact-method-field input,
.contact-method-dialog .contact-method-field .sample-select-trigger,
.contact-method-dialog .sample-contact-comment input {
  height: var(--contact-method-control-height);
  min-height: var(--contact-method-control-height);
  max-height: var(--contact-method-control-height);
  box-sizing: border-box;
  line-height: 1.2;
}
.contact-method-dialog .contact-method-value-control { min-height: var(--contact-method-control-height); }

/* ---------- узкие экраны ---------- */
@media (max-width: 1180px) {
  .inbox-view { grid-template-columns: var(--list-w) 0 minmax(360px, 1fr) 0 0; }
  .inbox-view .column-resizer[data-resize="panel"] { display: none; }
  .inbox-view .contact-panel { position: absolute; top: 0; right: 0; bottom: 0; z-index: 20; width: min(var(--panel-w), 90%); box-shadow: var(--shadow-panel); }
  .inbox-view:not(.panel-peek):not(.details-open) .contact-panel { display: none; }
  #panelPinButton { display: none !important; }
}
@media (max-width: 760px) {
  .contact-method-dialog .sample-contact-method-form { padding: 18px 14px; gap: 12px; }
  .contact-method-grid,
  .contact-method-dialog .sample-contact-method-form[data-kind="email"] .contact-method-grid,
  .contact-method-dialog .sample-contact-method-form[data-kind="messenger"][data-provider-phone="true"] .contact-method-grid { grid-template-columns: 1fr; gap: 9px; }
  .contact-method-field { grid-column: 1; }
  .contact-method-dialog .sample-contact-actions { gap: 6px; }
  .contact-method-dialog .sample-contact-actions .btn { min-width: 0; padding: 0 12px; flex: 0 1 auto; }
  .contact-method-dialog .sample-contact-actions .btn.primary { grid-row: auto; }
}
@media (max-width: 980px) {
  #app.app-shell { --rail-w: 68px; }
  .app-nav .brand span, .app-nav .nav-button span, .profile-card div, .profile-card .icon-button, #navToggle { display: none; }
  .nav-head { padding: 0; justify-content: center; }
  .nav-button { justify-content: center; padding: 0; }
  .nav-button b { position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px; font-size: 9px; }
  .profile-card { justify-content: center; padding: 8px 0 0; }
  .inbox-view { --list-w: 320px; }
}
@media (max-width: 900px) {
  .contact-table-header { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .contact-table-body > [role="row"] { padding: 12px; display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 8px 12px; align-items: start; }
  .contact-table-body > [role="row"] > [data-column] { grid-column: 2; display: grid; grid-template-columns: minmax(88px, .65fr) minmax(0, 1fr); gap: 8px; align-items: start; overflow-wrap: anywhere; white-space: normal; }
  .contact-table-body > [role="row"] > [data-column]::before { content: attr(data-column); color: var(--muted); font-size: 11px; font-weight: 600; }
  .contact-data-table .contact-way-icon, .contact-conversation-table .channel-logo { grid-column: 1; grid-row: 1 / span 4; }
  .contact-data-table .method-actions, .contact-conversation-table .method-actions { grid-column: 1 / -1; width: 100%; display: flex; grid-template-columns: none; justify-content: flex-start; flex-wrap: wrap; }
  .contact-data-table .method-actions::before, .contact-conversation-table .method-actions::before { width: 88px; flex: none; }
  .contact-way-conversation { width: min(100%, 260px); flex: 1 1 170px; }
  .contact-history-row { grid-template-columns: 1fr !important; }
  .contact-history-row > [data-column] { grid-column: 1 !important; }
}
@media (max-width: 760px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  input, textarea, select { font-size: 16px !important; }
  .sample-contact-composite > .sample-select { flex: 1 1 140px; }
  #app.app-shell { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .app-nav { grid-row: 2; padding: 6px max(8px, env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-right)); flex-direction: row; }
  html[data-rail="light"] .app-nav { border-right: 0; border-top: 1px solid var(--line); }
  .nav-head, .nav-footer .profile-card, #lookButton { display: none; }
  .nav-main, .nav-footer { margin: 0; flex-direction: row; flex: 1; }
  .nav-main { flex: 5; }
  .nav-footer { flex: 1; }
  .nav-main .nav-button, .nav-footer .nav-button { min-height: 52px; padding: 0; flex-direction: column; justify-content: center; gap: 3px; font-size: 10px; }
  .app-nav .nav-button span { display: block; }
  .nav-button b { position: absolute; top: 2px; right: calc(50% - 22px); }
  .inbox-view, .page-view { height: 100%; }
  .inbox-view { grid-template-columns: 1fr !important; }
  .column-resizer { display: none !important; }
  .inbox-view .chat-pane, .inbox-view .contact-panel { display: none; }
  .inbox-view.chat-open .conversation-list { display: none; }
  .inbox-view.chat-open .chat-pane { display: grid; }
  .inbox-view.details-open .chat-pane { display: none; }
  .inbox-view.details-open .contact-panel { position: static; display: flex !important; width: auto; box-shadow: none; animation: none; }
  .details-close { display: grid; }
  .contact-panel .panel-toggle { display: none; }
  .mobile-only { display: inline-grid; }
  .chat-title-row { padding: 0 6px 0 4px; gap: 4px; grid-template-columns: auto minmax(0, 1fr) auto; }
  .chat-actions .head-extra, .chat-actions .head-separator { display: none; }
  .chat-actions .head-more { display: grid; }
  .messages { padding: 14px 12px; }
  .composer { padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); }
  .page-view { padding: 0 16px 32px; }
  .team-overview { grid-template-columns: 1fr; }
  .client-directory article, .team-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .client-directory article:has(.contact-directory-properties) { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .contact-directory-properties { grid-column: 2 / -1; }
  .client-directory article > span:nth-of-type(2), .team-row .team-role, .team-row .team-presence { display: none; }
  .page-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .contacts-table-head .compact-search { width: 100%; order: -1; }
  .contacts-table-head .compact-search input { width: 100%; }
  .contact-view-bar { max-width: calc(100vw - 64px); }
  .contact-card-view { margin-top: 0; padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); }
  .contact-card-head { align-items: flex-start; flex-direction: column; }
  .contact-form { grid-template-columns: 1fr; }
  .contact-form-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .contact-pagination { align-items: stretch; flex-direction: column; }
  .contact-pagination-summary, .contact-pagination-controls { justify-content: space-between; }
  .contact-name-form { width: 100%; }
  .contact-name-form input { width: min(100%, 360px); flex: 1 1 220px; }
  .contact-service-row { align-items: flex-start; flex-direction: column; }
  .contact-uid-copy { max-width: 100%; }
  .view-filter-builder-head { align-items: stretch; flex-direction: column; }
  .view-filter-builder-head .btn { width: 100%; }
  .view-condition-chip { width: 100%; }
  .view-condition-chip button:first-child { max-width: none; flex: 1; }
  .view-condition-range { grid-template-columns: 1fr; }
  .view-condition-selection { align-items: flex-start; flex-wrap: wrap; }
  .saved-view-order-actions { align-items: stretch; flex-wrap: wrap; }
  .saved-view-order-actions > span { width: 100%; }
  .view-dialog-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .view-dialog-actions > .danger-outline:not([hidden]) { grid-column: 1 / -1; margin-right: 0; }
  .channel-card { grid-template-columns: 44px minmax(0, 1fr); }
  .channel-meta { grid-column: 1 / -1; justify-items: start; }
  .channel-capabilities { grid-template-columns: 1fr; }
  .settings-profile-summary { min-height: 96px; padding: 16px; }
  .settings-profile-action { width: 44px; height: 44px; }
  .settings-profile-action svg.lucide { width: 22px; height: 22px; }
  .settings-profile-identity > small { font-size: 15px; }
  .settings-profile-section-head { padding: 14px 16px 11px; }
  .settings-profile-section-head h2 { font-size: 17px; }
  .settings-profile-section-head p { font-size: 15px; }
  .settings-contact-table tr { padding: 12px 16px; }
  .settings-contact-table td { grid-template-columns: minmax(96px, .72fr) minmax(0, 1.28fr); }
  .settings-contact-table td::before { font-size: 15px; }
  .settings-contact-kind, .settings-contact-value { font-size: 17px; }
  .settings-contact-note { font-size: 15px; }
  .settings-contact-action { min-height: 44px; font-size: 15px; }
  .settings-contact-table .table-actions { justify-content: flex-start; }
  .settings-row { min-height: 64px; }
  .dialog.properties-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); padding: 16px; }
  .property-entity-tabs { width: 100%; }
  .property-entity-tabs button { min-width: 0; flex: 1; padding: 4px 8px; white-space: normal; line-height: 1.2; }
  .property-card-main, .property-card-main:has(.property-preview) { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
  .property-card .property-preview { height: auto; flex-wrap: wrap; }
  .property-card .property-preview .tag { max-width: 140px; }
  .property-card { grid-template-columns: 34px minmax(0, 1fr) auto; padding-inline: 8px; }
  .property-drag-handle { width: 34px; }
  .property-mode { grid-template-columns: 1fr; }
  .property-mode legend { grid-column: auto; }
  .property-value-row { grid-template-columns: 34px minmax(0, 1fr) auto 36px 36px; padding-inline: 6px; }
  .property-value-color { padding-inline: 9px; }
  .property-value-color span { display: none; }
  .property-editor-actions { align-items: stretch; flex-direction: column; }
  .property-editor-actions-start, .property-editor-actions-end { display: grid; grid-template-columns: 1fr 1fr; }
  .property-editor-actions .btn { width: 100%; }
  .dialog.value-editor-dialog { width: calc(100vw - 16px); height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); padding: 16px; }
  .value-color-controls { grid-template-columns: 1fr; }
  .value-presets > div { grid-template-columns: repeat(5, minmax(44px, 1fr)); }
  .dialog.color-picker-dialog { width: calc(100vw - 16px); height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); padding: 16px; }
  .color-picker-palette { grid-template-columns: repeat(6, minmax(38px, 1fr)); gap: 8px; }
  .color-picker-custom { grid-template-columns: 1fr; }
  .contact-property-row { grid-template-columns: 1fr auto; }
  .contact-property-row > span:first-child { grid-column: 1 / -1; }
  .settings-row b { font-size: 17px; }
  .settings-row small { font-size: 15px; }
  .settings-preference-row { align-items: stretch; flex-direction: column; }
  .settings-preference-row > select, .settings-preference-row > .sample-select { width: 100%; flex-basis: auto; }
  #settingsLoginEmail { color: var(--text); font-size: 17px; }
  .ui-popover.is-sheet { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100%; max-height: 85vh; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .chat-search { margin: -14px -12px 12px; padding: 8px 12px; top: -14px; }
}
@media (min-width: 761px) { .mobile-only { display: none !important; } }

/* ---------- экран входа ---------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 520px) 1fr; background: var(--surface); }
.auth-panel { padding: 28px 40px; display: flex; flex-direction: column; }
.auth-topline { display: flex; align-items: center; justify-content: space-between; }
.auth-panel .brand { color: var(--text); }
.language-button { min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); font-size: 13px; }
.auth-card { width: 100%; max-width: 380px; margin: auto 0; }
.product-label { color: var(--brand); font-size: 13px; font-weight: 600; }
.auth-card h1 { margin: 8px 0 6px; font-size: 32px; font-weight: 600; letter-spacing: -.03em; }
.auth-card .muted { margin: 0 0 22px; font-size: 15px; }
.form-stack { display: grid; gap: 14px; }
.form-stack label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 500; }
.form-stack input { min-height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--surface); font-size: 15px; }
.form-stack input:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.text-button { margin-top: 12px; padding: 0; border: 0; color: var(--brand); background: none; font-size: 14px; font-weight: 600; }
.back-link { margin-bottom: 18px; padding: 0; border: 0; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); background: none; font-size: 14px; }
.back-link svg.lucide { width: 17px; height: 17px; }
.demo-note { margin-top: 26px; padding: 12px 14px; border-radius: 14px; display: flex; gap: 10px; color: var(--muted); background: var(--field); font-size: 13px; }
.demo-note svg.lucide { color: var(--success); }
.demo-note p { margin: 0; }
.demo-note b { color: var(--text); }
.auth-foot { color: var(--faint); font-size: 12px; }
.auth-product { padding: 56px; display: grid; align-content: center; gap: 36px; background: radial-gradient(circle at 25% 15%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 45%), var(--page); }
.auth-product-copy h2 { margin: 14px 0 10px; font-size: 44px; font-weight: 600; line-height: 1.05; letter-spacing: -.035em; }
.auth-product-copy p { max-width: 460px; margin: 0; color: var(--muted); font-size: 16px; }
.live-pill { height: 28px; padding: 0 11px; border-radius: 99px; display: inline-flex; align-items: center; gap: 7px; color: var(--brand-strong); background: var(--brand-soft); font-size: 13px; font-weight: 600; }
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.product-window { max-width: 640px; border-radius: 18px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-lg); }
.window-body { height: 300px; display: grid; grid-template-columns: 56px 190px 1fr; }
.mini-rail { padding: 14px 0; display: grid; justify-items: center; align-content: start; gap: 12px; background: var(--nav); }
.mini-rail .mini-logo { width: 26px; height: 26px; border-radius: 8px; background: url("assets/brand/chatburg-color.png?v=20261103-brand-v1") center / contain no-repeat; }
.mini-rail i { width: 26px; height: 10px; border-radius: 5px; background: var(--mini-rail); }
.mini-rail i.selected { background: var(--mini-rail-selected); }
.mini-list { padding: 12px; display: grid; align-content: start; gap: 8px; border-right: 1px solid var(--line); }
.mini-search { height: 24px; border-radius: 8px; background: var(--field); }
.mini-row { padding: 8px; border-radius: 10px; display: grid; grid-template-columns: 26px 1fr; gap: 8px; }
.mini-row.active { background: var(--brand-soft); }
.mini-row b { width: 26px; height: 26px; border-radius: 50%; background: var(--line-strong); }
.mini-row span { display: grid; gap: 5px; }
.mini-row span i { height: 7px; border-radius: 4px; background: var(--line); }
.mini-row span i + i { width: 70%; }
.mini-row em { display: none; }
.mini-chat { padding: 14px; display: grid; align-content: start; gap: 10px; }
.mini-chat-head { height: 22px; width: 50%; border-radius: 8px; background: var(--field); }
.mini-chat i { height: 30px; border-radius: 12px; }
.mini-chat .incoming { width: 60%; background: var(--incoming); }
.mini-chat .outgoing { width: 55%; justify-self: end; background: var(--manager-message); }
.mini-chat .outgoing.short { width: 30%; }
.mini-compose { height: 34px; margin-top: 80px; border: 1px solid var(--line); border-radius: 14px; }
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-product { display: none; }
  .auth-panel { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Команда → «Роли и права», задача 132 */
.team-roles-card, .team-rights-card { margin-bottom: 14px; }
.team-roles-card .table-head p, .team-rights-card .table-head p { margin: 4px 0 0; font-size: 13px; }
.role-tree { padding: 4px 16px 16px; }
.role-list, .role-children { margin: 0; padding: 0; list-style: none; }
.role-children { margin: 6px 0 0 14px; padding-left: 14px; border-left: 1px dashed var(--line-strong); display: grid; gap: 6px; }
.role-node { display: grid; }
.role-row { padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; display: flex; align-items: center; gap: 10px; background: var(--field); }
.role-row[draggable="true"] { cursor: grab; }
.role-row.is-dragging { opacity: .5; }
.role-row.is-drop-target { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.role-row > svg { flex: none; width: 16px; height: 16px; color: var(--muted); }
.role-row.is-admin > svg { color: var(--brand); }
.role-main { min-width: 0; flex: 1; display: grid; gap: 5px; }
.role-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
.role-group { margin-left: 6px; padding: 1px 8px; border-radius: 6px; color: var(--brand); background: var(--brand-soft); font-size: 12px; font-weight: 500; }
.role-channel { padding: 1px 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: var(--surface); font-size: 11px; }
.role-members { display: flex; flex-wrap: wrap; gap: 4px; }
.role-member { padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 12px; }
.role-member i { margin-left: 3px; color: var(--muted); font-style: normal; }
.role-empty { color: var(--muted); font-size: 12px; }
.role-actions { flex: none; display: flex; gap: 4px; }
.role-actions .action-icon { width: 30px; height: 30px; min-width: 30px; }
.role-hint { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.dialog.role-dialog { width: min(560px, calc(100vw - 24px)); }
.role-form { display: grid; gap: 12px; }
.role-form fieldset { margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 6px; }
.role-form legend { padding: 0 4px; font-size: 13px; font-weight: 600; }
.role-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.role-check input { width: 16px; height: 16px; accent-color: var(--brand); }
.role-member-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.role-priority { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.role-priority input { width: 56px; height: 30px; padding: 0 6px; border: 1px solid var(--line); border-radius: 8px; }
.rights-actions { display: flex; align-items: center; gap: 8px; }
.rights-actions .select-field { min-width: 190px; }
.rights-table-wrap { padding: 0 16px 16px; overflow-x: auto; }
.rights-table { width: 100%; min-width: 760px; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.rights-table th, .rights-table td { padding: 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.rights-table thead th { color: var(--muted); font-weight: 500; }
.rights-table thead th:first-child { width: 22%; }
.rights-status { padding: 2px 8px; border-radius: 6px; font-size: 12px; }
.rights-status.s0 { color: var(--danger); background: var(--danger-soft); }
.rights-status.s1 { color: var(--brand); background: var(--brand-soft); }
.rights-status.s2 { color: var(--tag-amber-text); background: var(--tag-amber-bg); }
.rights-status.s3 { color: var(--muted); background: var(--field); }
.rights-role th { padding-top: 14px; font-size: 14px; font-weight: 600; background: var(--surface); }
.rights-action { padding-left: 14px !important; color: var(--muted); }
.rights-table select { width: 100%; min-height: 34px; font-size: 12px; }
.rights-targets { display: grid; gap: 2px; }
.rights-target { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.rights-target.inherit { color: var(--muted); }
.rights-target input { width: 14px; height: 14px; accent-color: var(--brand); }
.dialog.role-dialog label.role-check { min-height: 0; display: flex; flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; font-weight: 400; }
.dialog.role-dialog label.role-priority { min-height: 0; display: flex; flex-direction: row; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 400; }
.dialog.role-dialog .role-check input, .dialog.role-dialog .role-priority input { min-height: 0; margin: 0; }
.dialog.role-dialog .role-priority input { width: 56px; height: 30px; padding: 0 6px; }
.rights-table .sample-select, .rights-table .sample-select-trigger { width: 100%; }
.conversation-locked { margin: auto; max-width: 340px; display: grid; justify-items: center; gap: 8px; text-align: center; }
.conversation-locked svg { width: 22px; height: 22px; color: var(--muted); }
/* Окно «Добавить сотрудника»: поля с отступами, рамка фокуса не наезжает на соседние. */
.invite-form { display: grid; gap: 16px; }
.invite-form label { display: grid; gap: 6px; }
.invite-form small { color: var(--muted); font-size: 12px; font-weight: 400; }
.invite-form .dialog-hint { margin: 0; }
.team-row.is-invited { color: var(--muted); }
.invited-avatar { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--field); color: var(--muted); }
.invited-avatar svg { width: 18px; height: 18px; }
.invitation-actions { display: flex; gap: 10px; justify-content: flex-end; }
.invitation-actions .text-link { padding: 0; border: 0; background: none; color: var(--brand); font-size: 12px; font-weight: 600; }
.invitation-actions .text-link.danger { color: var(--danger); }
.invitation-status { color: var(--muted); font-size: 12px; }
.invitation-status.is-expired { color: var(--danger); }
@media (max-width: 760px) {
  .team-row.is-invited .invitation-status { display: none; }
}
.invite-email-hint:empty { display: none; }
.invite-email-hint.is-error { color: var(--danger); }
