:root {
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  color: #1b303a;
  background: #f4f6f7;
  font-synthesis: none;
  --navy: #0e2939;
  --navy-hover: #20475d;
  --sage: #809888;
  --ink: #1b303a;
  --muted: #4b606a;
  --line: #dce5e8;
  --line-strong: #bccdd4;
  --paper: #fff;
  --page: #f4f6f7;
  --rail: #edf2f3;
  --wash: #f6f8f9;
  --selection: #e3edf2;
  --focus: #18749a;
  --amber: #805016;
  --amber-wash: #fff2dd;
  --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; font-size: 14px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: wait; opacity: .63; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { color: var(--navy); font-size: clamp(23px, 2.2vw, 31px); font-weight: 680; letter-spacing: -.038em; line-height: 1.12; }
h2 { color: var(--navy); font-size: 17px; font-weight: 660; letter-spacing: -.02em; line-height: 1.25; }
h3 { font-size: 14px; }
label { display: grid; gap: 7px; color: var(--ink); font-size: 13px; font-weight: 650; }
input, select, textarea { width: 100%; min-width: 0; padding: 9px 11px; color: var(--ink); background: var(--paper); border: 1px solid var(--line-strong); border-radius: 8px; }
input:not([type="checkbox"]):not([type="radio"]), select { min-height: 38px; }
input::placeholder, textarea::placeholder { color: #596c79; }
a { color: var(--navy-hover); }

.button { display: inline-flex; gap: 8px; align-items: center; justify-content: center; min-height: 40px; padding: 9px 15px; border: 1px solid transparent; border-radius: 8px; font-size: 13px; font-weight: 650; text-decoration: none; white-space: nowrap; }
#new-dialog > span { font-size: 17px; line-height: .9; }
.button.primary { color: #fff; background: var(--navy); }
.button.primary:hover { background: var(--navy-hover); }
.button.secondary { color: var(--navy); border-color: var(--line-strong); background: var(--paper); }
.button.secondary:hover { background: var(--wash); border-color: var(--navy-hover); }
.stack { display: grid; gap: 16px; }
.form-error { padding: 10px 12px; color: #852e24; background: #fae9e3; border-radius: 8px; font-size: 13px; white-space: pre-line; }

.auth { min-height: 100dvh; border-top: 6px solid var(--navy); }
.auth-main { display: grid; min-height: calc(100dvh - 6px); place-items: center; padding: 26px 18px; }
.auth-content { width: min(100%, 422px); padding: clamp(23px, 5vw, 36px); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.auth-logo { display: block; width: min(230px, 100%); height: auto; margin-bottom: 28px; }
.auth-content h1 { margin-bottom: 24px; }
.quick-signin { display: grid; margin-top: 25px; border-top: 1px solid var(--line); }
.quick-signin > p { padding: 16px 0 5px; color: var(--muted); font-size: 13px; font-weight: 650; }
.account-choice { display: block; padding: 10px 8px; text-align: left; color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--line); }
.account-choice:hover { background: var(--wash); }
.account-choice strong { font-size: 14px; }
.account-choice small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }

.shell { --workspace-header-height: 80px; --workspace-bottom: 20px; display: grid; grid-template-columns: 206px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { display: flex; flex-direction: column; align-self: start; position: sticky; top: 0; height: 100dvh; overflow-y: auto; padding: 0 13px 15px; border-right: 1px solid var(--line); background: var(--rail); }
.brand-logo { display: block; width: min(149px, 100%); height: auto; margin: 28px 8px 27px; }
.brand-symbol { display: none; }
.navigation { display: grid; gap: 4px; }
.nav-button { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 6px; min-height: 41px; padding: 7px 10px; color: var(--muted); text-align: left; text-decoration: none; background: transparent; border: 1px solid transparent; border-radius: 8px; font-size: 14px; font-weight: 650; }
.nav-button:hover { color: var(--navy); background: var(--paper); }
.nav-button.active, .nav-button[aria-current="page"] { color: var(--navy); background: var(--paper); border-color: var(--line); box-shadow: inset 3px 0 var(--navy); }
.nav-settings-toggle.active { background: transparent; border-color: transparent; box-shadow: none; }
.nav-settings-toggle.active:hover { background: var(--paper); }
.nav-settings-chevron { flex: 0 0 7px; height: 7px; margin: -4px 2px 0 0; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg); }
.nav-settings-toggle[aria-expanded="true"] .nav-settings-chevron { margin-top: 4px; transform: rotate(225deg); }
.settings-links { display: grid; gap: 2px; margin: 1px 0 5px 13px; padding-left: 9px; border-left: 1px solid var(--line-strong); }
.nav-sub-link { min-height: 35px; justify-content: flex-start; font-size: 13px; font-weight: 560; }
.nav-sub-link.active, .nav-sub-link[aria-current="page"] { font-weight: 670; box-shadow: none; }
.count { min-width: 19px; padding: 1px 5px; text-align: center; background: var(--amber-wash); border-radius: 4px; color: var(--amber); font-size: 11px; font-variant-numeric: tabular-nums; }
.sidebar-account { display: grid; gap: 5px; margin-top: auto; padding: 13px 5px 0; border-top: 1px solid var(--line); }
.profile { display: flex; align-items: center; gap: 8px; }
.profile-mark { display: grid; place-items: center; flex: 0 0 36px; border-radius: 10px; height: 36px; color: var(--navy); background: var(--paper); border: 1px solid var(--line); font-size: 14px; font-weight: 700; }
.profile strong { display: block; font-size: 12px; overflow-wrap: anywhere; }
.profile small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.logout { width: fit-content; min-height: 34px; padding: 0 4px; color: var(--navy); background: transparent; border: 0; font-size: 13px; }
.logout:hover { text-decoration: underline; }
.skip-link { position: fixed; z-index: 10; top: 9px; left: 12px; padding: 9px 14px; color: var(--navy); background: var(--paper); border: 1px solid var(--line-strong); transform: translateY(calc(-100% - 12px)); }
.skip-link:focus { transform: none; }

.workspace { width: 100%; max-width: 1840px; min-width: 0; margin-inline: auto; padding: 0 clamp(15px, 2.1vw, 32px) var(--workspace-bottom); }
.workspace-header { display: flex; justify-content: space-between; align-items: center; min-height: var(--workspace-header-height); gap: 16px; }
.heading p { color: var(--muted); margin-top: 5px; font-size: 13px; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 15px; }
.engine { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.engine::before { content: ""; flex: 0 0 7px; height: 7px; border-radius: 50%; background: var(--sage); }
.desk { display: grid; grid-template-columns: clamp(235px, 22%, 305px) minmax(0, 1fr) clamp(205px, 22%, 286px); grid-template-areas: "inbox chat lead"; height: calc(100dvh - var(--workspace-header-height) - var(--workspace-bottom)); min-height: 490px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.inbox, .chat, .lead { min-width: 0; min-height: 0; }
.inbox { grid-area: inbox; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.inbox-header { display: flex; align-items: center; gap: 8px; padding: 15px 15px 10px; min-height: 50px; }
.inbox-total { min-width: 24px; padding: 3px 5px; color: var(--muted); background: var(--wash); border-radius: 5px; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; }
.inbox-reset { margin-left: auto; min-height: 28px; padding: 4px 6px; background: transparent; border: 0; color: var(--navy-hover); border-radius: 5px; font-size: 12px; }
.inbox-reset:hover { background: var(--selection); }
.inbox-controls { display: grid; gap: 9px; padding: 0 13px 12px; border-bottom: 1px solid var(--line); }
.search { display: flex; position: relative; align-items: center; }
.search input { min-width: 0; min-height: 38px; padding: 7px 10px 7px 31px; background: var(--wash); font-size: 13px; font-weight: 400; }
.search i { position: absolute; z-index: 1; left: 12px; width: 10px; height: 10px; border: 1px solid var(--muted); border-radius: 50%; pointer-events: none; }
.search i::after { position: absolute; content: ""; width: 4px; height: 1px; background: var(--muted); right: -3px; bottom: -1px; transform: rotate(45deg); }
.inbox-options { min-width: 0; }
.inbox-options-toggle { min-height: 28px; padding: 5px 6px; color: var(--navy); font-size: 12px; font-weight: 650; cursor: pointer; }
.inbox-options-toggle:hover { background: var(--wash); }
.inbox-options-toggle span { color: var(--muted); font-weight: 450; overflow-wrap: anywhere; }
.inbox-options-fields { display: grid; gap: 8px; padding: 7px 6px 2px; }
.inbox-options label { min-width: 0; gap: 4px; color: var(--muted); font-size: 12px; }
.inbox-options select { min-height: 36px; padding: 5px 8px; font-size: 12px; font-weight: 500; text-overflow: ellipsis; }
.filter { display: grid; grid-template-columns: minmax(0, .83fr) minmax(0, 1.17fr); gap: 3px; }
.filter button { display: flex; justify-content: space-between; align-items: center; gap: 4px; min-height: 30px; padding: 4px 6px; text-align: left; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 6px; font-size: 12px; font-weight: 630; line-height: 1.2; }
.filter button:hover, .role-switch button:hover { color: var(--ink); background: var(--wash); }
.filter button.selected { color: var(--navy); background: var(--selection); border-color: var(--line); }
.filter-count { flex: 0 0 auto; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.filter [data-filter="handoff"] .filter-count { color: var(--amber); }
.role-switch { display: flex; align-items: center; gap: 4px; }
.role-switch button { padding: 5px 8px; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 4px; font-size: 12px; font-weight: 650; }
.role-switch button.selected { color: var(--navy); background: var(--selection); border-color: var(--line); }
.conversation-list { flex: 1 1 auto; overflow: auto; }
.conversation { display: flex; flex-direction: column; gap: 5px; width: 100%; padding: 12px 13px 11px 12px; text-align: left; color: var(--ink); background: transparent; border: 0; border-left: 3px solid transparent; border-bottom: 1px solid var(--line); }
.conversation:hover { background: var(--wash); }
.conversation.active { background: var(--selection); border-left-color: var(--navy); }
.conversation:focus-visible { outline-offset: -3px; }
.conversation-line { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; width: 100%; min-width: 0; }
.conversation-activity { display: inline-flex; flex: none; align-items: center; gap: 5px; }
.conversation-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 650; }
.conversation-time { white-space: nowrap; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.conversation-location, .conversation-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.conversation-preview { max-width: 100%; }
.conversation .status { gap: 4px; padding: 3px 5px; font-size: 10px; }
.conversation-dot { flex: 0 0 7px; height: 7px; align-self: center; background: #aa6025; border-radius: 50%; }
.list-empty { padding: 20px 14px; color: var(--muted); line-height: 1.5; font-size: 13px; }

.chat { grid-area: chat; display: flex; flex-direction: column; }
.chat.empty-chat { grid-area: 1 / 2 / 2 / 4; place-content: center; align-items: center; padding: 25px; text-align: center; background: var(--wash); }
.empty-chat p { margin-top: 10px; color: var(--muted); font-size: 13px; }
.chat-header { display: flex; justify-content: space-between; align-items: center; flex: 0 0 auto; gap: 12px; padding: 12px 19px; min-height: 68px; border-bottom: 1px solid var(--line); }
.chat-header-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 7px; }
.lead-toggle, .lead .lead-close { display: none; }
.lead-toggle { min-height: 32px; padding: 4px 8px; font-size: 12px; }
.chat-identity { display: flex; align-items: center; min-width: 0; gap: 9px; }
.chat-identity > div { min-width: 0; }
.chat-identity h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-identity p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.avatar { flex: 0 0 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: var(--navy); background: var(--selection); font-size: 15px; font-weight: 700; }
.status { flex: none; display: inline-flex; gap: 6px; align-items: center; width: fit-content; padding: 4px 7px; border-radius: 4px; color: #305747; background: #e8f0eb; font-size: 11px; font-weight: 650; white-space: nowrap; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.handoff { color: var(--amber); background: var(--amber-wash); }
.status.manager { color: #3d5768; background: var(--selection); }
.chat-header .status { padding: 6px 9px; font-size: 12px; }
.thread { display: flex; flex: 1 1 auto; flex-direction: column; gap: 18px; overflow: auto; overscroll-behavior: contain; padding: 20px clamp(14px, 2.4vw, 29px); background: var(--wash); }
.thread-empty { margin: auto; max-width: 240px; color: var(--muted); text-align: center; line-height: 1.5; font-size: 13px; }
.message { width: fit-content; max-width: min(87%, 65ch); }
.message.assistant { align-self: flex-end; }
.message-meta { margin: 0 3px 4px; color: var(--muted); font-size: 11px; font-weight: 600; }
.message.assistant .message-meta { text-align: right; }
.message-bubble { padding: 10px 13px; border: 1px solid var(--line); border-radius: 11px 11px 11px 3px; color: var(--ink); background: var(--paper); font-size: 14px; line-height: 1.58; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.assistant .message-bubble { border-color: #d4e2ea; border-radius: 11px 11px 3px 11px; background: #e8f0f5; }
.message.manager .message-bubble { border-color: #cbd9d0; background: #edf3ee; }
.message-attachment { display: grid; gap: 6px; min-width: 0; margin-top: 4px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); overflow-wrap: anywhere; }
.message-attachment img { display: block; width: min(100%, 260px); height: auto; aspect-ratio: 4 / 3; object-fit: contain; object-position: left top; border-radius: 5px; }
.message-attachment-link { width: fit-content; font-size: 13px; font-weight: 650; }
.message-attachment-status { color: var(--muted); font-size: 12px; }
.message-attachment-status[data-send-status="uncertain"] { color: var(--amber); }
.message-sources { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 8px; margin: 4px 3px 0; padding: 0; list-style: none; color: var(--muted); font-size: 11px; }
.message-sources li { min-width: 0; overflow-wrap: anywhere; }
.feedback-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; margin-top: 3px; }
.feedback-actions button { min-height: 25px; padding: 3px 7px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--muted); font-size: 11px; }
.feedback-actions button:hover, .feedback-actions button[aria-pressed="true"] { color: var(--navy); border-color: var(--line-strong); background: var(--paper); }
.feedback-note { padding: 5px 0 0 7px; color: var(--muted); font-size: 11px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.composer { flex: 0 0 auto; padding: 11px 16px 13px; border-top: 1px solid var(--line); }
.composer-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 7px; margin-bottom: 8px; }
.role-note { color: var(--muted); font-size: 11px; text-align: end; }
.composer-attachments { display: grid; gap: 6px; margin-bottom: 8px; }
.composer-attachment-actions, .composer-attachment-selection { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.composer-attachment-selection { width: fit-content; max-width: 100%; padding: 4px 6px 4px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--wash); color: var(--navy); font-size: 12px; }
.composer-attachment-selection span { min-width: 0; overflow-wrap: anywhere; }
button.composer-attachment-send, .composer-attachments .button { min-height: 30px; padding: 4px 8px; font-size: 12px; }
.composer-attachment-send { justify-self: start; white-space: normal; }
.message-form { display: flex; align-items: flex-end; gap: 9px; }
.message-form textarea { resize: vertical; min-width: 0; min-height: 56px; max-height: 165px; padding: 9px 10px; font-size: 14px; }

.lead { grid-area: lead; overflow: auto; padding: 18px 16px; border-left: 1px solid var(--line); background: var(--paper); }
.lead-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 13px; }
.lead-fields { display: grid; gap: 0; margin: 0 0 14px; }
.lead-fields div { display: grid; align-items: baseline; gap: 2px; padding-block: 6px; }
.lead-fields dt { color: var(--muted); font-size: 12px; }
.lead-fields dd { margin: 0; font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }
.lead-card-download { display: inline-flex; align-items: center; min-height: 28px; margin: -7px 0 7px; font-size: 13px; font-weight: 650; }
.lead-section { margin: 13px 0; padding-top: 12px; border-top: 1px solid var(--line); }
.lead-section h3 { margin-bottom: 7px; }
.lead-section p, .lead-section li { color: var(--muted); font-size: 13px; line-height: 1.44; overflow-wrap: anywhere; }
.lead-section p { margin-top: 6px; white-space: pre-wrap; }
.lead-section .lead-reason { color: var(--ink); font-weight: 650; }
.lead-section ul { display: grid; gap: 6px; padding: 0; margin: 0; list-style-type: none; }
.lead-section li { padding: 5px 7px; border-left: 2px solid var(--line-strong); background: var(--wash); }
.take-over { width: 100%; white-space: normal; }
.take-over.is-priority { color: var(--paper); background: var(--navy); border-color: var(--navy); }
.take-over.is-priority:hover { background: var(--navy-hover); }

.catalog-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.panel { min-width: 0; padding: 20px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.panel p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.catalog-import-dialog { width: min(590px, calc(100% - 24px)); }
.catalog-import-dialog a { width: fit-content; font-weight: 650; }
.catalog-import-fields { display: grid; gap: 9px; min-width: 0; margin: 0; padding: 0; border: 0; }
.catalog-import-fields input[type="file"] { border-style: dashed; background: var(--wash); }
.catalog-import-fields input::file-selector-button { padding: 5px 9px; margin-right: 9px; color: var(--navy); background: var(--paper); border: 1px solid var(--line-strong); border-radius: 5px; font: inherit; }
.catalog-import-status { padding: 10px 13px; border-left: 3px solid var(--sage); border-radius: 5px; color: var(--navy); background: #e7f0eb; }
.import-files { max-height: 220px; margin: 0; padding: 0; overflow: auto; list-style: none; }
.import-file { display: flex; align-items: center; gap: 9px; padding: 7px 2px; border-bottom: 1px solid var(--line); }
.import-file-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.import-file-size { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.import-file-remove { min-height: 30px; padding: 4px 8px; }
.import-history { padding-block: 12px; }
.import-history summary { min-height: 30px; padding-block: 4px; color: var(--navy); font-size: 14px; font-weight: 660; cursor: pointer; }
.history-grid { display: flex; flex-wrap: wrap; gap: 9px; }
.history-grid article { flex: 1 1 190px; padding: 10px 14px; border-left: 2px solid var(--sage); background: var(--wash); }
.import-history[open] .history-grid { margin-top: 9px; }
.history-grid h3 { margin-bottom: 5px; }
.history-grid p { overflow-wrap: anywhere; }
.inventory-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 15px; gap: 13px; }
.inventory-title { display: flex; align-items: baseline; gap: 8px; }
.inventory-count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.inventory-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.inventory-filters input, .inventory-filters select { min-width: 125px; }
.inventory-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 7px; padding-top: 12px; color: var(--muted); font-size: 13px; }
.inventory-pagination .button { min-height: 32px; padding: 4px 11px; }
.table-scroll { min-width: 0; overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
th { color: var(--muted); background: var(--wash); font-size: 12px; font-weight: 680; }
tbody tr:hover { background: var(--wash); }
td { white-space: nowrap; }
td:first-child { white-space: normal; min-width: 146px; }
td small { display: block; margin-top: 3px; color: var(--muted); }
.inventory-panel :is(th, td):nth-child(n + 4) { text-align: right; font-variant-numeric: tabular-nums; }
.settings-panel .search { width: min(250px, 100%); }
.settings-panel table .button { min-height: 33px; padding-block: 4px; }
.settings-panel table td.employee-branches { min-width: 116px; max-width: 260px; white-space: normal; }
.settings-panel table th:last-child, .settings-panel table td:last-child { text-align: right; }
.employee-identity { font-weight: 650; }
.employee-account { overflow-wrap: anywhere; white-space: normal; }
.employee-state { display: inline-flex; gap: 5px; align-items: center; min-height: 25px; padding: 3px 7px; border-radius: 6px; color: #305747; background: #e7f0eb; font-size: 12px; }
.employee-state.blocked { color: #82382d; background: #f9eae6; }
.employee-branch-count { margin-top: 3px; color: var(--muted); font-size: 12px; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.settings-actions .primary { flex: 1 1 170px; }
.avito-accounts { display: grid; gap: 0; margin-top: 9px; }
.avito-account { display: grid; grid-template-columns: minmax(170px, 1.7fr) minmax(130px, 1fr) minmax(120px, .7fr); align-items: center; gap: 12px; min-width: 0; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.avito-account header { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: 8px; }
.avito-account header > div { min-width: 0; overflow-wrap: anywhere; }
.avito-account .button { min-height: 33px; padding-block: 4px; }
.avito-account .avito-account-summary { color: var(--ink); }
.avito-roster { display: grid; gap: 6px; max-height: 270px; padding: 3px; overflow: auto; }
.avito-roster:empty { display: none; }
.avito-employee { display: grid; grid-template-columns: minmax(0, 1fr) minmax(125px, 1fr); align-items: center; gap: 7px; padding: 6px; border: 1px solid var(--line); border-radius: 5px; }
.avito-employee small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 500; overflow-wrap: anywhere; }

.branch-directory { display: grid; grid-template-columns: minmax(215px, 278px) minmax(0, 1fr); align-items: stretch; min-height: min(450px, 70dvh); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: clip; }
.branch-index { min-width: 0; border-right: 1px solid var(--line); background: var(--wash); }
.branch-index-head { display: grid; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.branch-list { max-height: max(260px, calc(100dvh - 190px)); margin: 0; padding: 7px 8px; overflow: auto; list-style: none; }
.branch-list-button { display: grid; gap: 4px; width: 100%; min-height: 47px; padding: 9px 10px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--ink); text-align: left; overflow-wrap: anywhere; }
.branch-list-button:hover { background: var(--paper); }
.branch-list-button[aria-pressed="true"] { border-color: var(--line); background: var(--paper); box-shadow: inset 3px 0 var(--navy); }
.branch-list-button:focus-visible { outline-offset: -3px; }
.branch-list-button strong { font-size: 14px; }
.branch-list-button small, .branch-list-status { color: var(--muted); font-size: 12px; }
.branch-list-status { padding: 5px 14px 14px; }
.branch-profile { min-width: 0; padding: clamp(17px, 2.65vw, 34px); }
.branch-profile-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; }
.branch-profile-header h2 { font-size: 21px; overflow-wrap: anywhere; }
.branch-profile-header p { margin-top: 4px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.branch-profile-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.branch-contact-card { display: block; width: min(100%, 560px); height: auto; margin-top: 18px; border: 1px solid var(--line); border-radius: 8px; }
.branch-card-actions, .branch-card-dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.branch-card-actions { margin-top: 12px; }
.branch-card-dialog-actions { justify-content: flex-end; }
.branch-facts { margin: 19px 0 0; border-top: 1px solid var(--line); }
.branch-facts > div { display: grid; grid-template-columns: minmax(116px, 180px) minmax(0, 1fr); gap: 6px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.branch-facts dt { color: var(--muted); }
.branch-facts dd { max-width: 75ch; margin: 0; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
dialog { width: min(434px, calc(100% - 24px)); max-height: calc(100dvh - 30px); padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink); overscroll-behavior: contain; box-shadow: 0 16px 55px #0e29392d; }
dialog::backdrop { background: #0e293969; }
dialog header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.branch-modal { width: min(720px, calc(100% - 24px)); }
.employee-modal { width: min(586px, calc(100% - 24px)); }
.employee-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.branch-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.branch-editor-group { display: grid; min-width: 0; gap: 9px; margin: 0; padding: 9px 12px 12px; border: 1px solid var(--line); border-radius: 6px; }
.branch-editor-group legend { padding: 0 5px; font-size: 13px; font-weight: 700; }
.branch-checklist { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(158px, 100%), 1fr)); gap: 4px 10px; max-height: 146px; padding: 3px; overflow: auto; }
.branch-check { display: flex; align-items: center; gap: 8px; min-height: 31px; font-weight: 500; overflow-wrap: anywhere; }
.branch-check input { flex: 0 0 16px; width: 16px; height: 16px; margin: 1px; accent-color: var(--navy); }
.branch-field-hint { color: var(--muted); font-size: 12px; line-height: 1.45; }
.branch-editor-group > .button { justify-self: start; }
.employee-branch-picker { background: var(--wash); }
.employee-branch-picker > .employee-branch-trigger { width: 100%; justify-content: space-between; }
.employee-branch-trigger[aria-expanded="true"] .nav-settings-chevron { margin-top: 4px; transform: rotate(225deg); }
.employee-branch-summary { color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.employee-branch-panel { display: grid; gap: 8px; padding-top: 3px; }
.employee-branch-picker-head { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.employee-branch-picker-head .search { flex: 1 1 190px; }
.employee-branch-filter { min-height: 36px; padding: 5px 9px; font-size: 12px; }
.employee-branch-filter[aria-pressed="true"] { border-color: var(--navy-hover); color: var(--navy); background: var(--selection); }
.employee-branch-list { max-height: min(225px, 34dvh); margin: 0; padding: 4px; overflow: auto; overscroll-behavior: contain; list-style: none; background: var(--paper); border: 1px solid var(--line); border-radius: 7px; }
.employee-branch-list:empty { display: none; }
.employee-branch-option .branch-check { min-height: 35px; padding: 5px 7px; border-radius: 5px; cursor: pointer; }
.employee-branch-option .branch-check:hover, .employee-branch-option .branch-check:focus-within { background: var(--selection); }
.employee-branch-option .branch-check span { min-width: 0; overflow-wrap: anywhere; }
.close-modal { display: grid; place-items: center; width: 33px; height: 33px; padding: 0; color: var(--muted); background: var(--wash); border: 1px solid var(--line); border-radius: 7px; font-size: 21px; }
.toast { position: fixed; z-index: 5; right: 20px; bottom: 17px; width: fit-content; max-width: min(400px, calc(100vw - 40px)); padding: 12px 15px; color: white; background: var(--navy); border: 1px solid var(--navy-hover); border-radius: 6px; box-shadow: 0 3px 14px #0e293927; font-size: 13px; line-height: 1.45; }
.toast.error { background: #78362c; border-color: #9c554a; }

@media (max-width: 1190px) {
  .desk { position: relative; grid-template-columns: clamp(210px, 32%, 274px) minmax(0, 1fr); grid-template-areas: "inbox chat"; }
  .chat.empty-chat { grid-area: chat; }
  .lead { position: absolute; inset: 64px 10px 10px auto; z-index: 3; width: min(282px, 62%); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 8px 26px #0e293926; }
  .desk:not(.lead-open) .lead { display: none; }
  .lead-toggle { display: inline-flex; }
  .lead .lead-close { display: grid; }
}

@media (max-width: 970px) {
  .shell { grid-template-columns: 170px minmax(0, 1fr); }
  .sidebar { padding-inline: 9px; }
  .brand-logo { width: min(134px, 100%); }
  .avito-account { grid-template-columns: minmax(0, 1fr) minmax(0, .8fr); }
  .avito-account header { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); --workspace-header-height: 70px; }
  .sidebar { z-index: 6; flex-direction: row; align-items: center; gap: 10px; height: auto; min-height: 58px; padding: 6px max(9px, env(safe-area-inset-right)) 6px max(9px, env(safe-area-inset-left)); overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand-logo { display: none; }
  .brand-symbol { display: block; width: 29px; height: 29px; }
  .navigation { display: flex; align-items: center; flex-wrap: wrap; gap: 3px; }
  .nav-button { width: auto; min-height: 36px; padding: 6px 8px; font-size: 13px; }
  .settings-nav { position: relative; }
  .settings-links { display: flex; flex-wrap: wrap; gap: 3px; position: absolute; top: calc(100% + 6px); right: 0; z-index: 7; width: 182px; margin: 0; padding: 6px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--rail); box-shadow: 0 6px 18px #0e293926; }
  .nav-sub-link { width: 100%; }
  .sidebar-account { display: flex; align-items: center; gap: 0; margin: 0 0 0 auto; padding: 0 0 0 3px; border-top: 0; }
  .sidebar-account .profile { display: none; }
  .logout { font-size: 12px; }
  .workspace { padding-inline: 12px; }
  .workspace-header { min-height: var(--workspace-header-height); }
  .heading p { font-size: 12px; }
  .header-actions { align-items: flex-end; flex-wrap: wrap; gap: 5px; }
  .header-actions .engine { display: none; }
  .desk { grid-template-areas: "inbox" "chat" "lead"; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; height: auto; min-height: 0; }
  .inbox { border-right: 0; border-bottom: 1px solid var(--line); }
  .conversation-list { max-height: min(212px, 31dvh); }
  .chat { height: min(540px, max(405px, 65dvh)); }
  .chat.empty-chat { grid-area: chat; min-height: 240px; }
  .chat-header { min-height: 58px; padding: 8px 12px; }
  .lead { position: static; width: auto; border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; }
  .lead-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
  .take-over { width: auto; }
  .panel { padding: 14px; }
  .inventory-heading { flex-direction: column; align-items: stretch; }
  .inventory-filters > label { flex: 1 1 130px; }
  .branch-directory { grid-template-columns: minmax(0, 1fr); min-height: auto; }
  .branch-index { border-right: 0; border-bottom: 1px solid var(--line); }
  .branch-list { max-height: 190px; }
}

@media (max-width: 570px) {
  .branch-form-grid, .avito-employee, .avito-account, .employee-form-grid { grid-template-columns: minmax(0, 1fr); }
  .branch-facts > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

@media (max-width: 430px) {
  .sidebar { gap: 5px; }
  .nav-button { padding-inline: 5px; font-size: 12px; }
  .settings-links { right: -17px; }
  .workspace { padding-inline: 8px; }
  .workspace-header { gap: 8px; }
  .header-actions .button { padding-inline: 9px; }
  .chat-header-actions { flex-wrap: wrap; justify-content: end; max-width: 54%; }
  .message-form .button { padding-inline: 7px; }
  .message { max-width: 94%; }
}
