/* Operational Clarity: shared presentation for CRM and sales. */
:root {
 --bg-app:#f6f7f8; --bg-subtle:#f1f3f4; --bg-sidebar:#10211d;
 --bg-sidebar-hover:#18302a; --text-primary:#17211f; --text-secondary:#5f6d69;
 --text-muted:#71807a; --border:#dde2e4; --border-strong:#c7cfd2;
 --accent:#2f73f6; --accent-hover:#1f61dc; --accent-soft:#eef5ff;
 --success:#1d6b43; --success-soft:#ecf8f1; --warning:#8a5a13;
 --warning-soft:#fff7e8; --danger:#a73838; --danger-soft:#fff0f0;
 --radius-sm:8px; --radius-md:12px; --radius-lg:16px;
}
body {font-size:14px;line-height:1.45}
.brand-mark {background:#dce8e4;color:#10211d}
.sidebar-nav a.active {background:#214239;box-shadow:inset 3px 0 #92bcae;color:#fff}
.sidebar-nav a:hover {background:#18302a}
.workspace-header {padding:24px 32px;min-height:112px;border-bottom:1px solid var(--border);background:var(--bg-surface)}
.workspace-header h1 {font-size:28px;line-height:36px;font-weight:650;letter-spacing:-.6px}
.route-content {padding:24px 32px;max-width:1680px;margin:0 auto;width:100%}
.metric-card {border:0;border-radius:0;box-shadow:none;background:transparent;border-right:1px solid var(--border);min-height:120px}
.metric-card:last-child {border-right:0}
.metric-emphasis {color:var(--text-primary);background:transparent}
.metric-emphasis small,.metric-emphasis>div {color:var(--text-secondary)}
.metric-card strong {font-size:30px;font-variant-numeric:tabular-nums}
.metric-card i {display:none}
.data-table th {height:40px;background:var(--bg-subtle);position:sticky;top:0;z-index:1}
.data-table td {height:52px;padding:10px 12px}
.data-table tr:focus-visible {outline:2px solid var(--accent);outline-offset:-2px;background:var(--accent-soft)}
.status-badge i {display:inline-grid;place-items:center;width:13px;height:13px;border-radius:0;background:transparent;font-style:normal;font-size:12px;font-weight:700}
.status-info {color:#285ca8;background:#eef5ff}
.status-danger {color:var(--danger);background:var(--danger-soft)}
.sales-status-dot[data-running=false] {background:#89938f;box-shadow:none}
.sales-desk:has(>.sales-navigation) {display:grid;grid-template-columns:184px minmax(0,1fr);gap:0 28px;align-items:start}
.sales-project-top {grid-column:1/-1}
.sales-section-content {min-width:0}
.sales-navigation {position:sticky;top:24px;padding:0 12px 12px 0;border-right:1px solid var(--border)}
.sales-navigation summary {display:none}
.sales-navigation nav {display:grid;gap:12px}
.sales-navigation .nav-group {color:var(--text-secondary);margin:12px 8px 8px;font-size:10px}
.sales-navigation a {display:block;padding:9px 10px;color:var(--text-secondary);border-radius:6px;font-size:13px;margin:2px 0;transition:background .15s}
.sales-navigation a:hover {background:var(--bg-subtle);color:var(--text-primary)}
.sales-navigation a[aria-current] {background:var(--accent-soft);color:var(--accent-hover);font-weight:600}
.sales-section {border-radius:0;box-shadow:none}
.sales-desk label {font-size:14px}
.sales-mode {flex-wrap:wrap}
.command-dialog {color:var(--text-primary);border:1px solid var(--border);padding:28px;background:white;max-width:calc(100vw - 32px)}
.command-dialog::backdrop {background:rgb(16 33 29 / 38%)}
.command-drawer {margin:0 0 0 auto;width:480px;height:100dvh;max-height:100dvh;border-radius:0}
.command-confirm {width:480px;border-radius:16px}
.command-dialog form {width:100%;max-width:none;display:grid;gap:20px}
.command-dialog h2 {margin:6px 0;font-size:22px}
.command-dialog label {display:grid;gap:8px}
.command-dialog input,.command-dialog textarea {padding:10px 12px;width:100%;min-width:0;border:1px solid var(--border-strong);border-radius:8px}
.command-dialog footer {display:flex;gap:12px;justify-content:flex-end;border-top:1px solid var(--border);padding-top:20px}
.command-status {color:var(--text-secondary);overflow-wrap:anywhere}
.button-danger {background:var(--danger);color:white;border-color:var(--danger)}
@media (min-width:901px) and (max-width:1100px) {
 .app-shell {grid-template-columns:72px minmax(0,1fr)}
 .sidebar .brand-lockup>div,.sidebar-nav b,.sidebar-foot .operator>div,.sidebar-collapse {display:none}
 .sidebar .nav-group {font-size:0;margin:8px 0;height:12px}
 .sidebar {padding-inline:10px}
}
@media (max-width:1279px) {
 .sales-desk:has(>.sales-navigation) {display:block}
 .sales-navigation {position:static;border:1px solid var(--border);border-radius:8px;background:white;margin-bottom:24px;padding:12px}
 .sales-navigation summary {display:list-item;cursor:pointer;font-weight:600}
 .sales-navigation nav {grid-template-columns:repeat(4,minmax(0,1fr));margin-top:12px}
}
@media (max-width:900px) {
 .app-shell {grid-template-columns:minmax(0,1fr)}
 .workspace-header {padding:18px 20px}
 .route-content {padding:20px}
}
@media (max-width:620px) {
 .workspace-header {padding:16px}
 .workspace-header h1 {font-size:22px;line-height:28px}
 .route-content {padding:16px}
 .sales-navigation nav {grid-template-columns:1fr 1fr}
 .sales-navigation a {min-height:44px}
 .sales-mode span:last-child {display:inline}
 .sales-project-top {flex-wrap:wrap}
 .command-drawer {width:100vw;max-width:100vw;padding:20px}
 .metric-card {padding:12px 8px;min-height:110px}
 .data-table td {height:auto;overflow-wrap:anywhere}
 .sales-table td {min-width:0}
 .data-table td small {white-space:normal}
 .data-table td[data-label]::before {content:attr(data-label);font-size:11px;color:var(--text-secondary)}
 .sales-worklist .data-table-wrap {max-height:none}
}
@media(prefers-reduced-motion:no-preference) {
 .command-drawer[open] {animation:command-enter .18s ease-out}
 .sidebar-nav a,.button {transition:background .15s ease,color .15s ease}
 @keyframes command-enter {from{transform:translateX(24px);opacity:0}to{transform:translateX(0);opacity:1}}
}
@media(prefers-reduced-motion:reduce) {*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
.active-filters {display:flex;gap:8px;flex-wrap:wrap;margin:-8px 0 20px}
.active-filters a {padding:7px 10px;border:1px solid var(--border);border-radius:8px;background:white;color:var(--text-secondary);font-size:12px}
.active-filters a:hover {color:var(--accent-hover);border-color:var(--accent)}
.sales-state::before {content:'·';margin-right:5px;font-weight:700}
.sales-state[data-state=paid]::before,.sales-state[data-state=delivered]::before,.sales-state[data-state=ticket_issued]::before {content:'✓'}
.sales-state[data-state=blocked]::before,.sales-state[data-state=failed]::before,.sales-state[data-state=unknown]::before {content:'!'}
.sales-state[data-state=failed] {color:var(--danger);background:var(--danger-soft)}

/* Каналы и аккаунты: колонки не наезжают друг на друга, неактивные аккаунты приглушены, номер мессенджера отдельной строкой */
.settings-accounts {table-layout:fixed}
.settings-accounts th:nth-child(1){width:22%}.settings-accounts th:nth-child(2){width:14%}.settings-accounts th:nth-child(3){width:20%}.settings-accounts th:nth-child(4){width:16%}.settings-accounts th:nth-child(5){width:14%}.settings-accounts th:nth-child(6){width:14%}
/* Ячейка остаётся table-cell (display:flex ломал высоту строки и обрезал кнопки); кнопки — inline-flex, переносятся сами */
.settings-account-actions {overflow:visible!important;white-space:normal}
.settings-account-actions .button {display:inline-flex;margin:0 6px 6px 0;padding:5px 9px;font-size:12px;vertical-align:top}
.settings-accounts td {vertical-align:top;overflow-wrap:anywhere}
.settings-accounts td small {display:block;margin-top:3px;color:var(--text-muted);font-size:11px}
.settings-accounts .status-badge {margin-bottom:2px}
.settings-account-inactive td {color:var(--text-muted)}
.settings-account-inactive td b {color:var(--text-secondary)}
.settings-phone {display:block;margin-top:2px;font-variant-numeric:tabular-nums;color:var(--text-primary)}

/* Менеджеры (TASK-CRM-045) */
.manager-grid {display:grid;grid-template-columns:repeat(auto-fill,minmax(340px,1fr));gap:14px;margin-top:12px}
.manager-card {padding:16px 18px;display:flex;flex-direction:column;gap:10px}
.manager-card .sales-toolbar {margin:0}
.manager-card h3 {margin:2px 0 0;font-size:17px}
.manager-accounts {display:flex;flex-direction:column;gap:6px}
.manager-account-row {display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 10px;border:1px solid var(--border);border-radius:8px;background:#fafbfb}
.manager-account-row .button {padding:3px 8px;font-size:12px}
.manager-account b {font-weight:600;margin-right:4px}
.manager-account small {color:var(--text-muted);margin-left:4px}
.manager-assign {display:flex;gap:8px;align-items:center}
.manager-assign select {flex:1;min-height:36px;border:1px solid var(--border-strong);border-radius:7px;padding:6px 10px;background:#fff}
.mailbox-inline > td {background:#fafbfb;padding:10px 14px}
.mailbox-command {margin:6px 0 0;padding:10px 12px;border:1px solid var(--border);border-radius:8px;background:#fff;font-size:12px;white-space:pre-wrap;overflow-wrap:anywhere;user-select:all}
.mailbox-address {display:flex;gap:6px;align-items:stretch}
.mailbox-address input {flex:1;min-width:0}
.mailbox-address select {flex:0 0 auto;width:auto}
.mailbox-password-form {margin:0}
.mailboxes-table th:nth-child(1){width:34%}.mailboxes-table th:nth-child(2){width:18%}.mailboxes-table th:nth-child(3){width:16%}.mailboxes-table th:nth-child(4){width:32%}

/* --- Диалоги (TASK-CRM-047): список · лента · клиент; на телефоне — список или тред ------------------------------------ */
.inbox-layout {display:grid;grid-template-columns:minmax(260px,320px) minmax(0,1fr) minmax(240px,300px);gap:0 20px;align-items:start;min-height:60vh}
.inbox-list {border-right:1px solid var(--border);padding-right:16px;min-width:0}
.inbox-filters {display:flex;flex-wrap:wrap;gap:8px 12px;align-items:center;padding:0 0 10px;border-bottom:1px solid var(--border)}
.inbox-filters select {min-height:34px;border:1px solid var(--border-strong);border-radius:7px;padding:4px 8px;background:#fff;font:inherit}
.inbox-check {display:inline-flex;align-items:center;gap:6px;font-size:13px;white-space:nowrap}
.inbox-clear {font-size:12px;color:var(--text-secondary)}
.inbox-items {list-style:none;margin:0;padding:0;max-height:calc(100vh - 260px);overflow:auto}
.inbox-item > a {display:block;padding:10px 8px;border-bottom:1px solid var(--border);color:inherit;text-decoration:none;border-left:3px solid transparent}
.inbox-item > a:hover {background:var(--bg-subtle)}
.inbox-item.is-active > a {background:var(--accent-soft);border-left-color:var(--accent)}
.inbox-item.is-awaiting .inbox-name::before {content:'';display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--accent);margin-right:6px;vertical-align:middle}
.inbox-item-head {display:flex;justify-content:space-between;gap:8px;align-items:baseline}
.inbox-item-head time {font-size:12px;color:var(--text-muted);white-space:nowrap}
.inbox-name {min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.inbox-item .inbox-name a {display:inline;font-weight:600;color:var(--text-primary);padding:0;border:0}
.inbox-item .inbox-name .cp-ref {display:none}
.inbox-item-meta {display:flex;gap:8px;align-items:center;font-size:12px;color:var(--text-secondary);margin-top:2px;flex-wrap:wrap}
.inbox-item-meta em {font-style:normal;color:var(--warning)}
.inbox-chan {padding:1px 6px;border-radius:4px;background:var(--bg-subtle);border:1px solid var(--border)}
.inbox-chan[data-channel=telegram] {color:#1d6fb8}.inbox-chan[data-channel=whatsapp] {color:var(--success)}.inbox-chan[data-channel=max] {color:var(--purple)}.inbox-chan[data-channel=email] {color:var(--warning)}
.inbox-preview {display:block;margin-top:4px;font-size:13px;color:var(--text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.inbox-more {margin-top:12px;width:100%;justify-content:center}
.inbox-thread {display:flex;flex-direction:column;min-width:0;min-height:60vh}
.inbox-thread-empty {align-items:center;justify-content:center}
.inbox-thread-head {display:flex;gap:14px;align-items:center;padding:0 0 12px;border-bottom:1px solid var(--border)}
.inbox-thread-head h2 {margin:0;font-size:18px}.inbox-thread-head p {margin:2px 0 0;font-size:13px}
.inbox-back {display:none;color:var(--text-secondary);white-space:nowrap}
.inbox-older {align-self:center;margin:10px 0 0}
.inbox-feed {list-style:none;margin:0;padding:12px 4px;flex:1;overflow:auto;max-height:calc(100vh - 320px);display:flex;flex-direction:column;gap:8px}
.inbox-day {align-self:center;font-size:12px;color:var(--text-muted);margin:8px 0 2px}
.inbox-day span {padding:2px 10px;border-radius:10px;background:var(--bg-subtle);border:1px solid var(--border)}
.inbox-msg {display:flex}.inbox-msg.is-out {justify-content:flex-end}
.inbox-bubble {max-width:min(72%,640px);padding:8px 12px;border-radius:12px;background:var(--bg-subtle);border:1px solid var(--border);overflow-wrap:anywhere}
.inbox-msg.is-out .inbox-bubble {background:var(--accent-soft);border-color:#cfe0ff}
.inbox-bubble header {display:flex;justify-content:space-between;gap:12px;font-size:12px;color:var(--text-secondary)}
.inbox-bubble p {margin:4px 0 0;white-space:pre-wrap;line-height:1.5}
.inbox-bubble footer {margin-top:4px;font-size:11px;color:var(--text-muted);text-align:right}
.inbox-bubble footer[data-status=failed] {color:var(--danger)}.inbox-bubble footer[data-status=read] {color:var(--success)}
.inbox-composer {display:flex;gap:10px;align-items:flex-end;padding-top:12px;border-top:1px solid var(--border)}
.inbox-sender {display:flex;flex-wrap:wrap;gap:6px 12px;align-items:center;justify-content:space-between;padding-top:10px;font-size:13px;color:var(--text-secondary)}
.inbox-sender > p {margin:0;min-width:0;overflow-wrap:anywhere}
.inbox-sender b {color:var(--text-primary)}
.inbox-other-box {flex-basis:100%}
.inbox-sender + .inbox-composer {border-top:0;padding-top:8px}
.inbox-composer textarea {flex:1;resize:vertical;padding:8px 10px;border:1px solid var(--border-strong);border-radius:8px;font:inherit;background:#fff}
.inbox-composer-blocked {display:block;background:var(--warning-soft);border:1px solid #f0dcb8;border-radius:10px;padding:12px 14px;margin-top:12px}
.inbox-composer-blocked p {margin:0 0 8px;font-size:13px;line-height:1.5}
.inbox-customer {border-left:1px solid var(--border);padding-left:16px;font-size:14px}
.inbox-customer h3 {margin:0 0 10px;font-size:16px}.inbox-customer h4 {margin:16px 0 6px;font-size:13px;color:var(--text-secondary)}
.inbox-customer .contact-chip {margin:4px 0}
/* TASK-CRM-130: имя клиента и вкладки «Беседа / Клиент / Досье» */
.ic-head {margin:0 0 8px}
.ic-head h3 {margin:0;font-size:16px;overflow-wrap:anywhere}
.ic-head p {margin:2px 0 0;font-size:13px}
.ic-tabs {display:flex;gap:4px;margin:0 0 10px;border-bottom:1px solid var(--border)}
.ic-tabs button {border:0;background:none;padding:6px 8px;margin-bottom:-1px;border-bottom:2px solid transparent;font:inherit;font-size:13px;font-weight:600;color:var(--text-secondary);cursor:pointer}
.ic-tabs button[aria-selected=true] {color:var(--text-primary);border-bottom-color:var(--accent)}
.ic-tabs button small {color:var(--text-muted);font-weight:500}
.ic-pane .facts dd small {display:block;color:var(--text-muted);font-size:12px}
.ic-links {display:flex;flex-direction:column;align-items:flex-end;gap:2px;overflow-wrap:anywhere}
.ic-links a {color:var(--accent-hover);text-decoration:none}
.ic-deals {list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.ic-deals li {display:flex;flex-direction:column}
.ic-deals small {color:var(--text-muted);font-size:12px}
.ic-note {margin:6px 0;font-size:12px}
.ic-edit {margin-top:12px}
.ic-edit summary {cursor:pointer;color:var(--accent-hover);font-size:13px}
.ic-form {display:flex;flex-direction:column;gap:8px;margin-top:8px}
.ic-form label {display:flex;flex-direction:column;gap:4px;font-size:13px}
.ic-form input, .ic-form textarea {padding:6px 8px;border:1px solid var(--border-strong);border-radius:6px;font:inherit}
.ic-pane[data-ic-pane=dossier] h4 {margin:12px 0 4px}
.contact-chip b {white-space:normal;overflow-wrap:anywhere}
.inbox-actions {display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.inbox-others {list-style:none;margin:0;padding:0}.inbox-others li {padding:4px 0;border-bottom:1px solid var(--border)}
@media (max-width:1100px) {.inbox-layout {grid-template-columns:minmax(240px,300px) minmax(0,1fr)} .inbox-customer {grid-column:1 / -1;border-left:0;border-top:1px solid var(--border);padding:12px 0 0}}
@media (max-width:900px) {
 .inbox-layout {display:block}
 .inbox-list {border-right:0;padding-right:0}
 .inbox-layout[data-view=thread] .inbox-list {display:none}
 .inbox-layout[data-view=list] .inbox-thread {display:none}
 .inbox-back {display:inline}
 .inbox-items {max-height:none}
 .inbox-feed {max-height:none}
 .inbox-bubble {max-width:88%}
}

/* Черновик AI в ленте: видно, что сообщение ещё не ушло клиенту (TASK-CRM-049) */
.inbox-msg.is-draft .inbox-bubble { border: 1px dashed var(--accent, #4f46e5); background: transparent; }
.inbox-msg.is-draft .inbox-bubble footer { color: var(--muted, #6b7280); }
.inbox-draft-actions { margin-top: 6px; }

/* Подсказка AI над полем ввода и история под входящими (TASK-CRM-075) */
.inbox-suggest {margin-top:12px;min-width:0;border:1px solid #cfe0ff;border-radius:10px;background:var(--accent-soft);padding:0}
.inbox-suggest[data-kind=declined],.inbox-suggest[data-kind=failed],.inbox-suggest[data-kind=not_needed] {background:var(--bg-subtle);border-color:var(--border)}
.inbox-suggest > summary {display:flex;gap:10px;align-items:baseline;padding:10px 14px;cursor:pointer;list-style:none;min-width:0}
.inbox-suggest > summary::-webkit-details-marker {display:none}
.inbox-suggest > summary b {white-space:nowrap;font-size:13px}
/* width:0 — строка без переноса не должна задавать ширину карточки (иначе на телефоне появляется горизонтальная прокрутка) */
.inbox-suggest-line {flex:1 1 0;width:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;color:var(--text-secondary)}
.inbox-suggest[open] .inbox-suggest-line {display:none}
.inbox-suggest-body {padding:0 14px 12px}
.inbox-suggest-text {margin:0;white-space:pre-wrap;line-height:1.5;overflow-wrap:anywhere}
.inbox-suggest textarea {width:100%;box-sizing:border-box;resize:vertical;padding:8px 10px;border:1px solid var(--border-strong);border-radius:8px;font:inherit;background:#fff}
.inbox-suggest-reasons {border:0;margin:8px 0 0;padding:0;display:flex;flex-wrap:wrap;gap:6px 12px}
.inbox-suggest-reasons legend {font-size:12px;color:var(--text-secondary);padding:0;margin-bottom:4px}
.inbox-suggest .inbox-actions {margin-top:10px;align-items:center}
.inbox-suggest-blocked {margin:0;font-size:13px;color:var(--warning);flex-basis:100%}
.inbox-suggest-hint {margin:6px 0 0;font-size:12px}
.inbox-suggest-why {margin-top:8px;font-size:13px}
.inbox-suggest-why summary {cursor:pointer;color:var(--text-secondary)}
.inbox-suggest-why ul {margin:4px 0;padding-left:18px}
.inbox-suggest-why p {margin:4px 0}
.inbox-rate {display:inline-flex;gap:4px;margin-left:auto}
.inbox-rate-btn {border:1px solid var(--border);background:#fff;border-radius:6px;padding:2px 8px;cursor:pointer;font-size:14px;line-height:1.4}
.inbox-rate-btn.is-on {border-color:var(--accent);background:var(--accent-soft)}
.inbox-sugg-note {align-self:flex-end;max-width:min(72%,640px);font-size:12px;color:var(--text-secondary)}
.inbox-sugg-note > details > summary {cursor:pointer;overflow-wrap:anywhere}
.inbox-sugg-note[data-outcome=stale] > details > summary,.inbox-sugg-note[data-outcome=closed] > details > summary {color:var(--text-muted)}
.inbox-sugg-note p {margin:4px 0;white-space:pre-wrap;color:var(--text-primary);font-size:13px}
.inbox-sugg-note .inbox-rate {margin:4px 0 0}
.inbox-customer .facts dd small {display:block;color:var(--text-muted);font-size:12px}
.inbox-note {margin:6px 0 0;font-size:12px;line-height:1.4}
@media (max-width:900px) {
 .inbox-suggest .inbox-actions .button {flex:1 1 auto}
 .inbox-sugg-note {max-width:88%}
}
.inbox-composer-buttons {display:flex;flex-direction:column;gap:6px}
.inbox-proposal-head {margin:10px 0 6px;font-size:13px}
.inbox-proposal .inbox-suggest-body {padding-top:2px}
.inbox-tabs {display:flex;flex-wrap:wrap;gap:4px;padding:8px 0;border-bottom:1px solid var(--border)}
.inbox-tab {padding:4px 10px;border-radius:14px;font-size:13px;color:var(--text-secondary);text-decoration:none;border:1px solid transparent;white-space:nowrap}
.inbox-tab:hover {background:var(--bg-subtle)}
.inbox-tab.is-active {background:var(--accent-soft);border-color:#cfe0ff;color:var(--text-primary);font-weight:600}
.inbox-tab .sales-count {margin-left:4px;font-size:12px}
.inbox-ai-stats {margin:8px 0 0;font-size:13px}
.inbox-ai-stats > summary {cursor:pointer;color:var(--text-secondary)}
.inbox-ai-stats .facts > div {display:block;padding:6px 0}
.inbox-ai-stats .facts dt {font-size:12px}
.inbox-ai-stats .facts dd {text-align:left;overflow-wrap:anywhere}
@media (max-width:900px) {
 .inbox-composer-buttons .button {white-space:nowrap}
}

/* Вложения в ленте «Диалогов» (TASK-CRM-081): ссылкой, без превью */
.inbox-atts {list-style:none;margin:6px 0 0;padding:0;display:flex;flex-direction:column;gap:4px;min-width:min(320px,62vw)}   /* пузырь сжимается по тексту — без этого имя файла режется до пары слов */
.inbox-att {display:flex;align-items:center;gap:8px;min-width:0;padding:6px 8px;border:1px solid var(--border);border-radius:8px;background:#fff;color:inherit;text-decoration:none;font-size:13px}
a.inbox-att:hover {border-color:var(--accent);background:var(--accent-soft)}
.inbox-att-ico {flex:none;font-size:16px;line-height:1}
.inbox-att-name {flex:1 1 0;width:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.inbox-att small {flex:none;color:var(--text-muted);white-space:nowrap}
.inbox-att.is-missing {opacity:.75}
.inbox-att.is-missing em {flex:none;font-style:normal;font-size:12px;color:var(--warning)}
@media (max-width:900px) {
 /* на телефоне имя файла — целой строкой, тип и размер — под ним */
 .inbox-att {flex-wrap:wrap;row-gap:2px}
 .inbox-att small,.inbox-att.is-missing em {flex-basis:calc(100% - 24px);margin-left:24px}
}

/* Просмотр и отдельная ссылка «скачать» у вложений Google Drive */
.inbox-att-row {display:flex;align-items:stretch;gap:4px;min-width:0}
.inbox-att-row > .inbox-att {flex:1 1 auto;min-width:0}
.inbox-att-dl {flex:none;display:flex;align-items:center;padding:0 8px;border:1px solid var(--border);border-radius:8px;background:#fff;color:var(--text-secondary);font-size:12px;text-decoration:none}
.inbox-att-dl:hover {border-color:var(--accent);color:var(--accent)}
/* «Поручения» (TASK-CRM-090): таблица проверки — текст правится прямо в строке, пропущенные строки приглушены */
.cp-assign-table td {vertical-align:top}
.cp-assign-table textarea {width:100%;min-width:260px;font:inherit;font-size:13px}
.cp-assign-table tr.is-muted td {opacity:.55}
.cp-assign-matches ul {list-style:none;margin:6px 0 0;padding:0}
.cp-assign-matches li {display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:4px 0}
.cp-assign-phone {margin-top:6px}
.cp-assign-history-toggle {margin-top:6px}
.cp-assign-history-row[hidden] {display:none !important}
.cp-assign-history-row td {background:var(--surface-muted, rgba(0,0,0,.02))}
.cp-assign-history h4 {margin:4px 0 6px;font-size:13px}
.cp-assign-history-list {list-style:none;margin:0 0 10px;padding:0;max-height:420px;overflow-y:auto}
.cp-assign-history-list li {padding:6px 8px;margin:4px 0;border-left:3px solid var(--border);overflow-wrap:anywhere}
.cp-assign-history-list li.is-outgoing {border-left-color:var(--border-strong)}
.cp-assign-history-list li.is-incoming {border-left-color:#3b82f6}
.cp-assign-history-list .cp-text {max-width:80ch;margin-top:2px}
.cp-assign-attention {display:inline-block;padding:3px 6px;border-radius:6px;background:var(--warning-soft);color:var(--warning)}
.cp-assign-phone-form {display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}
.cp-assign-phone-form input {min-width:0;flex:1 1 140px;font:inherit}
.cp-assign-phone-result ul {list-style:none;margin:6px 0 0;padding:0}
.cp-assign-phone-result li {display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:6px 0;border-top:1px solid var(--border)}

/* TASK-CRM-095: «Диалоги» как рабочее место — на всю ширину и высоту окна, колонки прокручиваются сами,
   шапка раздела в одну строку, панель действий в шапке диалога, вкладки-переключатель, чипы «Мои»/«Непрочитанные» */
.workspace:has(.inbox-layout) .workspace-header {min-height:0;padding:10px 24px}
.workspace:has(.inbox-layout) .workspace-header h1 {font-size:20px;line-height:26px}
.workspace:has(.inbox-layout) #page-kicker, .workspace:has(.inbox-layout) #page-description {display:none}
.route-content:has(.inbox-layout) {max-width:none;padding:0 0 0 16px}
.route-content:has(.inbox-layout) .sales-desk {margin:0;grid-template-columns:minmax(0,1fr)}
.sales-desk > .inbox-layout {min-width:0}
.inbox-layout {grid-template-columns:minmax(280px,360px) minmax(0,1fr) minmax(260px,320px);gap:0;height:calc(100dvh - var(--inbox-top,72px));min-height:420px;align-items:stretch}
.inbox-layout[data-panel=off] {grid-template-columns:minmax(280px,360px) minmax(0,1fr)}
.inbox-layout[data-panel=off] .inbox-customer {display:none}
.inbox-list {display:flex;flex-direction:column;min-height:0;padding:12px 12px 0 0}
.inbox-items {flex:1 1 auto;min-height:0;max-height:none;overflow:auto;overscroll-behavior:contain}
.inbox-thread {min-height:0;padding:12px 20px 12px}
.inbox-thread-empty {display:flex}
.inbox-feed {flex:1 1 auto;min-height:0;max-height:none;overscroll-behavior:contain}
.inbox-customer {min-height:0;overflow:auto;padding:14px 16px}
.inbox-customer .contact-chip small {text-transform:none;letter-spacing:0;font-size:12px}

/* поиск и фильтры */
.inbox-filters {display:grid;grid-template-columns:1fr 1fr;gap:6px;padding:0 0 10px;border-bottom:0}
.inbox-filters input[type=search] {grid-column:1 / -1;min-height:36px;border:1px solid var(--border-strong);border-radius:8px;padding:6px 10px;font:inherit;background:#fff}
.inbox-filters input[type=search]:focus, .inbox-filters select:focus {outline:2px solid var(--accent-soft);border-color:var(--accent)}
.inbox-filters select {min-height:32px;font-size:13px}
.inbox-clear {grid-column:1 / -1}

/* вкладки состояния — сегментированный переключатель */
.inbox-tabs {display:flex;flex-wrap:wrap;gap:2px;padding:3px;border:1px solid var(--border);border-radius:9px;background:var(--bg-subtle)}
.inbox-tab {display:inline-flex;align-items:center;gap:5px;padding:5px 9px;border-radius:7px;font-size:13px;color:var(--text-secondary);text-decoration:none;white-space:nowrap}
.inbox-tab:hover {color:var(--text-primary);background:#fff}
.inbox-tab.is-active {color:var(--accent);background:#fff;box-shadow:0 1px 3px rgb(14 35 31 / 10%);font-weight:600}
.inbox-tab .sales-count {font-size:11px}
.inbox-chips {display:flex;gap:6px;margin:8px 0 6px}
.inbox-chip {display:inline-flex;gap:5px;align-items:center;padding:3px 10px;border:1px solid var(--border-strong);border-radius:999px;font-size:12px;color:var(--text-secondary);text-decoration:none;background:#fff}
.inbox-chip span {color:var(--text-muted)}
.inbox-chip:hover {border-color:var(--accent);color:var(--accent)}
.inbox-chip.is-on {border-color:var(--accent);color:var(--accent);background:var(--accent-soft);font-weight:600}

/* строка списка: непрочитанное — жирное имя и превью; отметки «мой», «отложен» */
.inbox-item > a {padding:10px 10px 10px 8px}
.inbox-item .inbox-name {font-size:14px}
.inbox-item.is-unread .inbox-name, .inbox-item.is-unread .inbox-preview {font-weight:650;color:var(--text-primary)}
.inbox-item.is-awaiting .inbox-name::before {background:var(--warning)}
.inbox-flag {font-style:normal;padding:0 6px;border-radius:4px;background:var(--bg-subtle);color:var(--text-secondary)}
.inbox-item-meta em.inbox-flag {color:var(--text-secondary)}
.inbox-item-meta em.inbox-flag.is-mine {color:var(--success);background:var(--success-soft)}
.inbox-item-meta em.inbox-flag.is-snoozed {color:var(--purple);background:#f1efff}
.inbox-list-foot {border-top:1px solid var(--border);padding:8px 0;font-size:12px;color:var(--text-secondary)}
.inbox-list-foot details + details {margin-top:4px}
.inbox-list-foot summary {cursor:pointer}
.inbox-summary .inbox-replies {margin:6px 0}
.inbox-keys dl {display:grid;gap:3px;margin:6px 0 0}
.inbox-keys dl div {display:flex;gap:8px}.inbox-keys dt {min-width:84px}.inbox-keys dd {margin:0}
kbd {display:inline-block;padding:0 5px;border:1px solid var(--border-strong);border-bottom-width:2px;border-radius:4px;background:#fff;font:11px/16px ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--text-secondary)}

/* шапка диалога и панель действий */
.inbox-thread-head {flex-wrap:wrap;gap:8px 16px;padding-bottom:10px}
.inbox-thread-title {min-width:0;flex:1 1 200px}
.inbox-thread-title h2 {overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.inbox-toolbar {display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px}
.inbox-toolbar-group {display:flex;flex-wrap:wrap;align-items:center;gap:6px;position:relative}
.inbox-toolbar .button {min-height:32px;padding:5px 12px;font-size:13px}
.inbox-toolbar .button.is-on {border-color:var(--success);color:var(--success);background:var(--success-soft)}
.inbox-step {min-width:32px;justify-content:center;padding:5px 8px}
.inbox-step[aria-disabled=true] {opacity:.4;pointer-events:none}
.inbox-menu {position:relative}
.inbox-menu > summary {list-style:none;cursor:pointer}
.inbox-menu > summary::-webkit-details-marker {display:none}
.inbox-menu > summary::after {content:'';width:6px;height:6px;margin-left:6px;border:solid currentColor;border-width:0 1.5px 1.5px 0;transform:translateY(-2px) rotate(45deg)}
.inbox-menu[open] > summary {border-color:var(--accent);color:var(--accent)}
.inbox-menu-pop {position:absolute;z-index:20;top:calc(100% + 6px);left:0;min-width:230px;display:flex;flex-direction:column;padding:6px;border:1px solid var(--border);border-radius:10px;background:#fff;box-shadow:var(--shadow-float)}
.is-end .inbox-menu-pop {left:auto;right:0}
.inbox-menu-pop > button, .inbox-menu-pop > a {display:flex;justify-content:space-between;gap:12px;padding:7px 10px;border:0;border-radius:7px;background:transparent;font:inherit;font-size:13px;color:var(--text-primary);text-align:left;text-decoration:none;cursor:pointer}
.inbox-menu-pop > button:hover, .inbox-menu-pop > a:hover, .inbox-menu-pop > button:focus-visible {background:var(--accent-soft);color:var(--accent);outline:0}
.inbox-menu-pop form, .inbox-menu-pop .inbox-tpl-save {display:flex;flex-wrap:wrap;align-items:flex-end;gap:6px;padding:8px 10px 4px;border-top:1px solid var(--border);margin-top:4px}
.inbox-menu-pop label {display:flex;flex-direction:column;gap:3px;font-size:12px;color:var(--text-secondary)}
.inbox-menu-pop input {padding:5px 8px;border:1px solid var(--border-strong);border-radius:7px;font:inherit;font-size:13px}
.inbox-menu-pop p {margin:6px 10px 2px;font-size:12px}
.inbox-reasons {position:absolute;z-index:20;top:calc(100% + 6px);right:0;width:300px;display:flex;flex-direction:column;gap:4px;padding:10px;border:1px solid var(--border);border-radius:10px;background:#fff;box-shadow:var(--shadow-float)}
.inbox-reasons[hidden] {display:none}
.inbox-reasons p {margin:0 0 4px;font-size:13px;font-weight:600}
.inbox-reason {padding:7px 10px;border:1px solid var(--border);border-radius:7px;background:var(--bg-subtle);font:inherit;font-size:13px;text-align:left;cursor:pointer}
.inbox-reason:hover {border-color:var(--accent);color:var(--accent);background:var(--accent-soft)}
.inbox-reason-own {display:flex;gap:6px;margin-top:4px}
.inbox-reason-own input {flex:1;min-width:0;padding:6px 8px;border:1px solid var(--border-strong);border-radius:7px;font:inherit;font-size:13px}

/* лента и поле ответа: текст крупнее, поле растёт по мере набора */
.inbox-bubble p {font-size:15px}
.inbox-bubble header {font-size:12px}
.inbox-composer textarea {min-height:64px;max-height:320px;font-size:15px;line-height:1.45}
.inbox-composer textarea:focus {outline:2px solid var(--accent-soft);border-color:var(--accent)}
.inbox-composer-buttons {display:flex;flex-direction:column;gap:6px}
.inbox-composer-blocked .inbox-note {margin:8px 0 0;font-size:12px}

@media (max-width:1100px) {
 .inbox-layout, .inbox-layout[data-panel=off] {grid-template-columns:minmax(260px,320px) minmax(0,1fr)}
 .inbox-customer {display:none}
 .inbox-layout[data-panel=on] .inbox-customer {display:block;grid-column:2;border-left:0;border-top:1px solid var(--border)}
 .inbox-layout[data-panel=on] {height:auto}
}
@media (max-width:900px) {
 .route-content:has(.inbox-layout) {padding:0 12px}
 .inbox-layout, .inbox-layout[data-panel=on] {height:auto;display:block}
 .inbox-list {padding-right:0}
 .inbox-thread {padding:10px 0}
 .inbox-feed {max-height:none}
 .inbox-thread-head {flex-wrap:wrap;min-width:0;max-width:100%}
 .inbox-toolbar {flex:1 1 100%;min-width:0;width:100%;flex-wrap:nowrap;overflow-x:auto;gap:6px;padding-bottom:2px;scrollbar-width:none}
 .inbox-toolbar::-webkit-scrollbar {display:none}
 .inbox-toolbar-group {flex-wrap:nowrap}
 .inbox-toolbar .inbox-step {display:none}
 .inbox-toolbar .button {min-height:40px;white-space:nowrap}
 .inbox-tabs {flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none}
 .inbox-tabs::-webkit-scrollbar {display:none}
 .inbox-composer {flex-wrap:wrap}
 .inbox-composer textarea {flex:1 1 100%}
 .inbox-composer-buttons {flex-direction:row;width:100%}
 .inbox-composer-buttons .button {flex:1;justify-content:center}
 .inbox-menu-pop, .inbox-reasons {position:fixed;left:12px;right:12px;top:auto;bottom:12px;width:auto}
 .inbox-composer {position:sticky;bottom:0;background:var(--bg-app);padding-bottom:10px}
 .inbox-list-foot .inbox-keys {display:none}
}
@media (prefers-reduced-motion:no-preference) {
 .inbox-menu-pop, .inbox-reasons {animation:inbox-pop .14s cubic-bezier(.16,1,.3,1)}
 @keyframes inbox-pop {from {opacity:0;transform:translateY(-4px)}}
}
/* статус действий в «Диалогах» — всплывающей плашкой у нижнего края, а не строкой под раскладкой за пределами экрана */
.sales-desk:has(.inbox-layout) {gap:0}
.sales-desk:has(.inbox-layout) > #cp-status {position:fixed;z-index:40;left:50%;top:14px;transform:translateX(-50%);max-width:min(560px,calc(100vw - 32px));margin:0;padding:10px 16px;border-radius:10px;background:var(--text-primary);color:#fff;font-size:13px;box-shadow:var(--shadow-float)}
.sales-desk:has(.inbox-layout) > #cp-status:empty {display:none}
.sales-desk:has(.inbox-layout) > #cp-status[data-tone=error] {color:#fff;background:var(--danger)}

/* TASK-CRM-095: шаблоны ответов и «Назначить» */
.inbox-menu-pop.is-up {top:auto;bottom:calc(100% + 6px);left:auto;right:0;width:min(380px,calc(100vw - 32px))}
.inbox-menu-head {margin:8px 10px 2px!important;font-size:11px!important;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--text-muted)}
.inbox-tpl-list {list-style:none;margin:0;padding:0;max-height:300px;overflow:auto}
.inbox-tpl-list li {display:flex;align-items:stretch;gap:2px}
.inbox-tpl {flex:1;min-width:0;display:flex;flex-direction:column;gap:1px;padding:7px 10px;border:0;border-radius:7px;background:transparent;font:inherit;text-align:left;cursor:pointer}
.inbox-tpl b {font-size:13px;font-weight:600}
.inbox-tpl small {font-size:12px;color:var(--text-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.inbox-tpl:hover, .inbox-tpl:focus-visible {background:var(--accent-soft);outline:0}
.inbox-tpl-del {flex:none;width:28px;border:0;border-radius:7px;background:transparent;color:var(--text-muted);cursor:pointer}
.inbox-tpl-del:hover {background:var(--danger-soft);color:var(--danger)}
.inbox-tpl-save {flex-direction:column;align-items:stretch!important}
.inbox-tpl-save small {font-size:11px}
.inbox-templates > summary {justify-content:center}
@media (max-width:900px) {.inbox-composer-buttons .inbox-templates {flex:1} .inbox-composer-buttons .inbox-templates > summary {width:100%}}

/* поле ответа: текст сверху на всю ширину, кнопки строкой под ним — «Отправить» справа */
.inbox-composer {flex-direction:column;align-items:stretch;gap:8px}
.inbox-composer-buttons {flex-direction:row;align-items:center;gap:8px;width:100%}
.inbox-composer-buttons > .button-primary {margin-left:auto;min-width:120px;justify-content:center}
.inbox-composer-hint {font-size:12px;margin-left:auto}
.inbox-composer-hint + .button-primary {margin-left:0}
.inbox-tpl-save .button {justify-content:center}
@media (max-width:900px) {.inbox-composer-hint {display:none} .inbox-composer-buttons > .button-primary {margin-left:auto}}
@media (max-width:900px) {.inbox-composer-buttons {flex-wrap:wrap} .inbox-composer-buttons > .button-primary {flex:1 1 100%;order:3} .inbox-composer-buttons > * {min-width:0}}

/* TASK-CRM-095b: сводка за 30 дней — сверху списка, свёрнута в одну строку; цифры — ссылки на эти диалоги */
.inbox-summary {margin:0 0 10px;border:1px solid var(--border);border-radius:10px;background:var(--bg-surface)}
.inbox-summary > summary {display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 8px;padding:8px 12px;cursor:pointer;list-style:none;font-size:13px}
.inbox-summary > summary::-webkit-details-marker {display:none}
.inbox-summary > summary::before {content:'';width:6px;height:6px;border:solid var(--text-muted);border-width:0 1.5px 1.5px 0;transform:rotate(-45deg);margin-right:2px;transition:transform .15s}
.inbox-summary[open] > summary::before {transform:rotate(45deg)}
.inbox-summary > summary span {color:var(--text-secondary);font-size:12px}
.inbox-summary-body {padding:0 12px 10px;display:flex;flex-direction:column;gap:8px}
.inbox-metrics {display:flex;flex-wrap:wrap;gap:6px}
.inbox-metric {display:inline-flex;align-items:baseline;gap:5px;padding:4px 9px;border:1px solid var(--border-strong);border-radius:8px;background:#fff;color:var(--text-primary);text-decoration:none;font-size:12px}
.inbox-metric b {font-size:14px;font-variant-numeric:tabular-nums}
.inbox-metric span {color:var(--text-secondary)}
a.inbox-metric:hover, a.inbox-metric:focus-visible {border-color:var(--accent);background:var(--accent-soft);outline:0}
a.inbox-metric:hover b, a.inbox-metric:hover span {color:var(--accent)}
.inbox-metric.is-flat {border-style:dashed;background:transparent;color:var(--text-muted)}
.inbox-metric.is-flat b, .inbox-metric.is-flat span {color:var(--text-muted)}
.inbox-summary-note {margin:0;font-size:12px;color:var(--text-secondary)}
.inbox-sugg-filter {margin:4px 0 6px;padding:6px 10px;border-radius:8px;background:var(--accent-soft);font-size:12px;color:var(--text-primary)}
.inbox-sugg-filter .inbox-clear {margin-left:6px;color:var(--accent)}
.inbox-empty {text-align:left}
.inbox-empty p {margin:0 0 8px;font-size:13px;line-height:1.5}
.inbox-empty-actions {display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px}
.inbox-metrics h4 {flex:1 1 100%;margin:4px 0 0;font-size:11px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--text-muted)}

/* TASK-CRM-095c: iPhone (Safari) увеличивает страницу при нажатии в поле с шрифтом меньше 16px и сам масштаб не возвращает —
   страница становится шире экрана и «ездит» вбок. На телефонной ширине все поля ввода — 16px (вся CRM, не только «Диалоги»). */
@media (max-width:900px) {
 input:not([type=checkbox]):not([type=radio]):not([type=hidden]), textarea, select {font-size:16px!important}
}

/* Файл в ответе из «Диалогов» (TASK-CRM-103) */
.inbox-file {cursor:pointer;text-align:center;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.inbox-file:focus-within {outline:2px solid var(--accent-soft)}
.inbox-file-clear {border:0;background:none;color:var(--text-secondary);font-size:12px;cursor:pointer;padding:0}
.inbox-file-clear:hover {color:var(--text-primary);text-decoration:underline}

/* «Написать первым» в карточке клиента (TASK-CRM-103) */
.first-contact {margin:12px 0}
.first-contact-blocker {margin:6px 0;padding:6px 8px;border-radius:6px;background:var(--warning-soft);color:var(--warning)}
.first-contact-box {border:1px solid var(--border);border-radius:10px;padding:10px 14px;background:var(--surface, #fff)}
.first-contact-box > summary {cursor:pointer}
.first-contact-form {display:flex;flex-wrap:wrap;gap:10px;align-items:flex-end;margin-top:8px}
.first-contact-form label {display:flex;flex-direction:column;gap:4px;font-size:13px;min-width:220px;flex:1 1 220px}
.first-contact-status {flex-basis:100%;margin:0;font-size:13px}
.first-contact-status:empty {display:none}
/* TASK-CRM-128: карточка настройки на странице «Пользователи» */
.users-card.users-amo {display:flex;flex-direction:row;flex-wrap:wrap;gap:12px 20px;align-items:center;justify-content:space-between;margin-bottom:16px}
.users-amo > div {flex:1 1 360px;min-width:0}
.users-amo h3 {margin:0 0 4px}
.users-amo p {margin:0}
/* TASK-CRM-128: «amoCRM в интерфейсе» выключено — прячем всё для сверки с amoCRM (данные не трогаем) */
html.amo-off [data-amo], html.amo-off [data-tab="amo"], html.amo-off [data-panel="amo"], html.amo-off a[href*="amocrm.ru"] {display:none !important}
.first-contact-form label:first-child {flex:2 1 320px}
.first-contact-form label[hidden] {display:none}
.first-contact-form select {width:100%}
.inbox-contact-note {margin:6px 0 0;font-size:12px;line-height:1.4;text-align:left}
.cp-assign-send {display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}
.cp-assign-send .button {white-space:normal}

/* «Сейчас» — очередь менеджера (TASK-CRM-106): карточка дела, главная кнопка слева, исходы справа; на телефоне всё в столбик */
.now-top {display:flex;flex-wrap:wrap;gap:12px;align-items:flex-end;justify-content:space-between;margin-bottom:12px}
.now-summary {display:flex;flex-wrap:wrap;gap:16px;font-size:15px;color:var(--text-secondary)}
.now-summary b {font-size:22px;color:var(--text-primary);font-variant-numeric:tabular-nums;margin-right:4px}
.now-summary .is-overdue b {color:var(--danger)}
.now-picker {display:flex;flex-direction:column;gap:4px;font-size:13px;color:var(--text-secondary)}
.now-list {list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}
.now-item {border:1px solid var(--border);border-left:4px solid var(--accent);border-radius:var(--radius-md);padding:12px 14px;background:var(--bg-surface, #fff)}
.now-item.is-overdue {border-left-color:var(--danger)}
.now-item[data-kind=followup] {border-left-color:var(--border-strong)}
.now-head {display:flex;flex-wrap:wrap;gap:4px 10px;align-items:baseline}
.now-what {font-size:16px}
.now-client {font-size:15px;color:var(--text-primary)}
.now-why {margin:4px 0 0;color:var(--text-secondary);font-size:13px}
.now-item.is-overdue .now-why {color:var(--danger)}
.now-last {margin:6px 0 0;padding:6px 10px;border-radius:var(--radius-sm);background:var(--bg-subtle);white-space:pre-wrap;overflow-wrap:anywhere}
.now-note {margin:6px 0 0;font-size:13px}
.now-also {margin:4px 0 0;font-size:12px;color:var(--text-muted)}
.now-actions {display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-top:10px}
.now-outcomes {display:flex;flex-wrap:wrap;gap:6px}
.now-main {min-width:150px;text-align:center}
.now-when {display:flex;flex-wrap:wrap;gap:8px 12px;align-items:flex-end;margin-top:10px;padding-top:10px;border-top:1px dashed var(--border)}
.now-when label {display:flex;flex-direction:column;gap:4px;font-size:13px}
.now-quick, .now-form-actions {display:flex;flex-wrap:wrap;gap:6px}
.now-note-field {flex:1 1 220px}
.now-empty {padding:24px 0}
.now-later ul {list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.now-later li span:first-child {display:inline-block;min-width:130px;color:var(--text-secondary);font-variant-numeric:tabular-nums}
@media (max-width:620px) {
 .now-item {padding:12px}
 .now-actions {flex-direction:column;align-items:stretch}
 .now-desk .now-main {width:100%;min-height:48px;display:flex;align-items:center;justify-content:center;font-size:16px}
 .now-outcomes {display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
 .now-desk .now-outcomes .button, .now-desk .now-quick .button, .now-desk .now-form-actions .button {width:100%;min-height:44px;white-space:normal}
 .now-quick, .now-form-actions {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%}
 .now-when, .now-when label {width:100%}
 .now-picker, .now-picker select {width:100%}
}

/* TASK-CRM-107: «Сделки» — воронка, карточка сделки, счета */
.deal-desk > .sales-section {min-width:0}
.deal-filters {display:flex;flex-wrap:wrap;gap:8px 12px;align-items:flex-end;margin-bottom:12px}
.deal-filters label {display:flex;flex-direction:column;gap:4px;font-size:13px;color:var(--text-secondary)}
.deal-search {flex:1 1 200px}
.deal-funnel {list-style:none;margin:12px 0;padding:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:6px}
.deal-funnel a {display:flex;flex-direction:column;gap:2px;padding:8px 10px;border:1px solid var(--border);border-top:3px solid var(--accent);border-radius:var(--radius-sm);color:inherit;text-decoration:none;min-height:44px}
.deal-funnel a[data-kind=won] {border-top-color:var(--success)}
.deal-funnel a[data-kind=lost] {border-top-color:var(--danger)}
.deal-funnel a[aria-current] {background:var(--accent-soft)}
.deal-funnel span {font-size:13px;color:var(--text-secondary)}
.deal-funnel b {font-size:20px;font-variant-numeric:tabular-nums}
.deal-funnel small, .cpdeal-table small {color:var(--text-muted);font-size:12px;display:block}
.deal-num {font-variant-numeric:tabular-nums;white-space:nowrap}
.deal-stage {display:inline-block;padding:2px 8px;border-radius:999px;font-size:12px;background:var(--accent-soft);color:var(--text-primary)}
.deal-stage[data-kind=won] {background:var(--success-soft);color:var(--success)}
.deal-stage[data-kind=lost] {background:var(--danger-soft);color:var(--danger)}
.deal-facts {display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:10px 16px;margin:0 0 14px}
.deal-facts dt {font-size:12px;color:var(--text-muted)}
.deal-facts dd {margin:2px 0 0;font-size:15px}
.deal-facts dd small {display:block;color:var(--text-secondary);font-size:12px}
.deal-stages {list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:4px}
.deal-stages li > * {display:flex;align-items:center;min-height:40px;padding:6px 12px;border:1px solid var(--border);border-radius:var(--radius-sm);font-size:13px;background:var(--bg-surface, #fff);color:var(--text-secondary)}
.deal-stages li.is-passed > * {background:var(--accent-soft);color:var(--text-primary)}
.deal-stages li.is-current > * {background:var(--accent);border-color:var(--accent);color:#fff;font-weight:600}
.deal-stages li.is-current[data-kind=won] > * {background:var(--success);border-color:var(--success)}
.deal-stages li.is-current[data-kind=lost] > * {background:var(--danger);border-color:var(--danger)}
.deal-stage-btn {cursor:pointer;font:inherit}
.deal-stage-btn:hover {border-color:var(--accent);color:var(--text-primary)}
.deal-stages li[data-kind=lost] .deal-stage-btn:hover {border-color:var(--danger);color:var(--danger)}
.deal-lost {display:flex;flex-wrap:wrap;gap:8px 12px;align-items:flex-end;margin-top:10px}
.deal-lost label, .deal-inv-form label {display:flex;flex-direction:column;gap:4px;font-size:13px;flex:1 1 240px}
.deal-actions {display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin-top:12px}
.deal-actions p {margin:0}
.deal-manager {display:flex;flex-direction:column;gap:4px;font-size:13px;color:var(--text-secondary)}
.deal-invoices {list-style:none;margin:0 0 12px;padding:0;display:flex;flex-direction:column;gap:10px}
.deal-invoice {border:1px solid var(--border);border-radius:var(--radius-md);padding:12px 14px}
.deal-invoice[data-status=paid] {border-left:4px solid var(--success)}
.deal-invoice[data-status=issued] {border-left:4px solid var(--accent)}
.deal-invoice[data-status=cancelled] {opacity:.7}
.deal-invoice-head {display:flex;flex-wrap:wrap;gap:6px 10px;align-items:center}
.deal-invoice-head .deal-num {margin-left:auto;font-size:16px}
.deal-lines {list-style:none;margin:8px 0 0;padding:0}
.deal-lines li {display:flex;justify-content:space-between;gap:12px;padding:3px 0;border-bottom:1px dashed var(--border);font-size:13px}
.deal-lines li b {font-weight:500;font-variant-numeric:tabular-nums;white-space:nowrap}
.deal-invoice p {margin:6px 0 0;font-size:12px}
.deal-invoice-actions {display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}
.deal-inv-form {display:flex;flex-wrap:wrap;gap:8px 12px;align-items:flex-end;margin-top:10px;padding-top:10px;border-top:1px dashed var(--border)}
.deal-paid-at {flex:0 1 170px !important}
.deal-lines-edit {display:flex;flex-direction:column;gap:6px;margin-bottom:8px}
.deal-line-row {display:grid;grid-template-columns:minmax(0,1fr) 80px auto;gap:6px}
.deal-total {font-size:15px;margin:8px 0}
.deal-total b {font-variant-numeric:tabular-nums}
.deal-check {display:flex;gap:8px;align-items:center;margin:4px 0 10px;font-size:14px}
.deal-intent-note {padding:8px 10px;border-radius:var(--radius-sm);background:var(--accent-soft);font-size:13px}
.deal-history {list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px;font-size:13px}
.deal-history li > span:first-child {display:inline-block;min-width:130px;color:var(--text-secondary);font-variant-numeric:tabular-nums}
.deal-history small {display:block;color:var(--text-muted);margin-left:134px}
.deal-others {margin:0;padding-left:18px;font-size:13px}
@media (max-width:620px) {
 .deal-filters label, .deal-filters select, .deal-filters input, .deal-filters .button {width:100%}
 .deal-funnel {display:flex;overflow-x:auto;scroll-snap-type:x proximity;padding-bottom:4px}
 .deal-funnel li {flex:0 0 118px;scroll-snap-align:start}
 .deal-stages {display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
 .deal-stages li > * {width:100%;justify-content:center;text-align:center;min-height:44px}
 .deal-actions {flex-direction:column;align-items:stretch}
 .deal-actions .button, .deal-invoice-actions .button, .deal-desk form .button-primary {width:100%;min-height:44px}
 .deal-invoice-actions {display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
 .deal-history small {margin-left:0}
 .cpdeal-table thead {display:none}
 .cpdeal-table tr {display:grid;grid-template-columns:1fr auto;gap:2px 10px;padding:10px 0;border-bottom:1px solid var(--border)}
 .cpdeal-table td {border:0;padding:0}
 .cpdeal-table td:nth-child(n+5) {display:none}
}

/* TASK-CRM-111: «Настройки → Пользователи» — список слева, карточка человека справа; на телефоне по одному */
.access-chip {display:inline-flex;align-items:center;min-height:26px;padding:3px 10px;border:1px solid #f3dcb5;border-radius:999px;color:var(--warning);background:var(--warning-soft);font-size:12px;font-weight:650;margin-right:6px}
.users-layout {display:grid;grid-template-columns:minmax(260px,320px) minmax(0,1fr);gap:20px;align-items:start}
.users-list {position:sticky;top:12px;display:flex;flex-direction:column;gap:10px;min-width:0}
.users-list-tools {display:flex;gap:8px}
.users-list-tools input {flex:1;min-width:0;min-height:38px;padding:8px 11px;border:1px solid var(--border-strong);border-radius:8px;background:#fff;font:inherit}
.users-rows {display:flex;flex-direction:column;border:1px solid var(--border);border-radius:var(--radius-md);background:var(--bg-surface);overflow:hidden}
.users-row {display:grid;grid-template-columns:34px minmax(0,1fr) auto;gap:10px;align-items:center;padding:10px 12px;color:inherit;text-decoration:none;border-bottom:1px solid var(--border)}
.users-row:last-child {border-bottom:0}
.users-row:hover {background:var(--bg-subtle)}
.users-row.is-selected {background:var(--accent-soft);box-shadow:inset 3px 0 0 var(--accent)}
.users-row.is-off {opacity:.62}
.users-row-main {display:flex;flex-direction:column;min-width:0}
.users-row-main b, .users-row-main small {overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.users-row-main small, .users-row-state small {color:var(--text-secondary);font-size:12px}
.users-row-state {text-align:right}
.users-row-state em {font-style:normal;font-size:12px;color:var(--danger)}
.users-avatar {display:grid;place-items:center;width:34px;height:34px;border-radius:50%;background:#e7eeec;color:#24443d;font-weight:750}
.users-avatar.is-large {width:52px;height:52px;font-size:20px}
.users-off-toggle, .users-back {font-size:13px;color:var(--accent)}
.users-back {display:none;margin-bottom:10px}
.users-none {padding:14px}
.users-editor {display:flex;flex-direction:column;gap:14px;min-width:0}
.users-editor-head {display:flex;gap:14px;align-items:flex-start}
.users-editor-head h2 {margin:0 0 2px;font-size:22px}
.users-editor-head p {margin:2px 0}
.users-warn {color:var(--warning)}
.users-card {display:flex;flex-direction:column;gap:12px;padding:18px;border:1px solid var(--border);border-radius:var(--radius-md);background:var(--bg-surface)}
.users-card h3 {margin:0;font-size:16px}
.users-card > p {margin:0}
.users-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.users-grid label, .users-inline label {display:flex;flex-direction:column;gap:5px;font-size:13px;font-weight:600;color:var(--text-secondary)}
.users-grid input, .users-grid select, .users-grid textarea, .users-inline input {min-height:38px;padding:8px 11px;border:1px solid var(--border-strong);border-radius:8px;background:#fff;color:var(--text-primary);font:inherit;font-weight:400}
.users-grid input:focus-visible, .users-grid select:focus-visible, .users-grid textarea:focus-visible, .users-inline input:focus-visible, .users-list-tools input:focus-visible {outline:2px solid var(--accent);outline-offset:1px}
.users-wide {grid-column:1 / -1}
.users-inline {display:flex;gap:10px;align-items:flex-end;flex-wrap:wrap}
.users-inline label {flex:1 1 240px}
.users-actions {display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.users-hint {margin:0;font-size:12px}
.users-note {margin:0;padding:10px 14px;border-radius:8px;background:var(--success-soft);color:var(--success);font-weight:600}
.users-secret {display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:12px;align-items:center;padding:14px 16px;border:1px solid #b9e2d5;border-radius:var(--radius-md);background:var(--success-soft)}
.users-secret p {margin:2px 0 0;font-size:13px}
.users-secret code {padding:8px 10px;border-radius:6px;background:#fff;border:1px solid #b9e2d5;font-size:15px;user-select:all;word-break:break-all}
.users-matrix {display:flex;flex-direction:column;gap:14px}
.users-matrix-head, .users-level {display:grid;grid-template-columns:minmax(0,1fr) repeat(4,78px);gap:4px;align-items:center}
.users-matrix-head {position:sticky;top:0;z-index:1;padding:6px 0;background:var(--bg-surface);font-size:12px;font-weight:700;color:var(--text-muted);text-align:center}
.users-matrix-head span:first-child {text-align:left}
.users-matrix-group {display:flex;flex-direction:column}
.users-matrix-group .eyebrow {margin:4px 0 2px}
.users-level {margin:0;padding:6px 0;border:0;border-top:1px solid var(--border);min-width:0}
.users-level.users-level-toggle {grid-template-columns:minmax(0,1fr) repeat(2,100px);padding-bottom:12px;border-top:0;border-bottom:1px solid var(--border)}
.users-level-toggle legend {width:100%}
.users-level legend {float:left;display:flex;flex-direction:column;padding:0;font-size:14px;font-weight:600;color:var(--text-primary)}
.users-level legend small {font-size:11px;font-weight:500}
.users-changed {display:none;color:var(--warning)}
.users-level.is-changed .users-changed {display:inline}
.users-level.is-changed legend > span::before {content:"";display:inline-block;width:7px;height:7px;margin-right:6px;border-radius:50%;background:var(--warning);vertical-align:middle}
.users-level-option {position:relative;display:flex;justify-content:center}
.users-level-option input {position:absolute;opacity:0;width:1px;height:1px}
.users-level-option span {display:inline-flex;align-items:center;justify-content:center;width:100%;min-height:32px;border:1px solid var(--border-strong);border-radius:7px;background:#fff;font-size:13px;font-weight:600;color:var(--text-secondary);cursor:pointer;transition:background .15s,border-color .15s,color .15s}
.users-level-option input:checked + span {border-color:var(--accent);background:var(--accent);color:#fff}
.users-level-option input[value=none]:checked + span {border-color:#9aa6a3;background:#e9eeed;color:var(--text-primary)}
.users-level-option input[value=own]:checked + span {border-color:var(--purple);background:var(--purple)}
.users-level-option input[value=read]:checked + span {border-color:var(--success);background:var(--success)}
.users-level-option input:focus-visible + span {outline:2px solid var(--accent);outline-offset:2px}
.users-level-option input:disabled + span {cursor:default}
.users-level-option.is-na span {border-style:dashed;color:var(--text-muted);background:transparent}
.users-level-option input:disabled:not(:checked) + span {opacity:.7}
#users-status:empty {display:none}
#users-status[data-tone=error] {color:var(--danger);font-weight:600}
@media (max-width:900px) {
 .users-layout {grid-template-columns:minmax(0,1fr)}
 .users-list {position:static}
 .users-layout.has-detail .users-list {display:none}
 .users-layout:not(.has-detail) .users-detail {display:none}
 .users-back {display:inline-block}
 .users-grid {grid-template-columns:minmax(0,1fr)}
 .users-secret {grid-template-columns:minmax(0,1fr)}
}
@media (max-width:620px) {
 .users-matrix-head {display:none}
 .users-level {grid-template-columns:repeat(4,minmax(0,1fr))}
 .users-level.users-level-toggle {grid-template-columns:repeat(2,minmax(0,1fr))}
 .users-level legend {grid-column:1 / -1;margin-bottom:4px}
 .users-card {padding:14px}
}
.manager-login {margin:8px 0 4px;font-size:13px}
.manager-login a {font-weight:650}

/* Карточка сделки (TASK-CRM-125): клиент и переписка на первом экране */
.dc {--dc-top:300px;display:flex;flex-direction:column;gap:10px;min-width:0}
.dc ~ #cp-status {position:fixed;left:50%;bottom:24px;transform:translateX(-50%);z-index:30;margin:0;display:flex;gap:14px;align-items:center;max-width:calc(100vw - 32px);padding:9px 14px;border-radius:var(--radius-sm);background:var(--text-primary);color:#fff;box-shadow:0 10px 28px rgb(14 35 31 / 24%)}
.dc ~ #cp-status:empty {display:none}
.dc ~ #cp-status[data-tone=error] {background:var(--danger)}
.dc-undo {border:0;background:none;padding:0;color:#b9d2ff;font:inherit;font-weight:600;cursor:pointer;white-space:nowrap}
.dc-wait {display:flex;align-items:center;justify-content:space-between;gap:12px;padding:6px 8px 6px 14px;border-radius:var(--radius-sm);background:var(--warning-soft);color:var(--warning);font-weight:600}
.dc-stages {display:flex;align-items:stretch;gap:10px;min-width:0}
.dc-rail {list-style:none;margin:0;padding:0;flex:1;min-width:0;display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:3px}
.dc-rail li > * {display:flex;align-items:center;justify-content:center;width:100%;height:100%;min-height:38px;padding:4px 8px;border:0;border-radius:3px;background:var(--bg-subtle);color:var(--text-secondary);font:inherit;font-size:13px;line-height:1.2;text-align:center}
.dc-rail li:first-child > * {border-radius:var(--radius-sm) 3px 3px var(--radius-sm)}
.dc-rail li:last-child > * {border-radius:3px var(--radius-sm) var(--radius-sm) 3px}
.dc-stage-btn {cursor:pointer}
.dc-rail .dc-stage-btn:hover {background:var(--border);color:var(--text-primary)}
.dc-rail li.is-passed > * {background:#dbe8fe;color:#2356b8}
.dc-rail li.is-current > * {background:var(--accent);color:#fff;font-weight:600}
.dc-rail li.is-current[data-kind=won] > * {background:var(--success)}
.dc-quiet {border-color:transparent !important;background:transparent !important;color:var(--text-secondary) !important;box-shadow:none !important}
.dc-quiet:hover {background:var(--bg-subtle) !important;color:var(--text-primary) !important}
.dc-lost-open {flex:none;white-space:nowrap}
.dc-closed {margin:0;color:var(--danger)}
.dc-lost {display:flex;flex-wrap:wrap;gap:6px;align-items:center;padding:10px 12px;border-radius:var(--radius-sm);background:var(--danger-soft)}
.dc-lost[hidden] {display:none}
.dc-lost > span {font-weight:600;color:var(--danger);margin-right:4px}
.dc-lost input {flex:1 1 160px;min-width:0;padding:6px 9px;border:1px solid var(--border-strong);border-radius:var(--radius-sm);font:inherit}
.dc-link {border:0;background:none;padding:2px 0;color:var(--accent-hover);font:inherit;font-weight:500;cursor:pointer;text-decoration:none;white-space:nowrap}
.dc-link:hover {text-decoration:underline}
.dc-tabs {display:none}
.dc-body {display:grid;grid-template-columns:minmax(0,1fr) 340px;height:calc(100dvh - var(--dc-top) - 20px);min-height:460px;border:1px solid var(--border);border-radius:var(--radius-md);background:var(--bg-surface);overflow:hidden}
.dc-thread {display:flex;flex-direction:column;min-width:0;min-height:0;background:var(--bg-app)}
.dc-filters {display:flex;gap:4px;padding:6px 12px;background:var(--bg-surface);border-bottom:1px solid var(--border);overflow-x:auto}
.dc-filters button {display:flex;align-items:center;gap:6px;padding:5px 10px;border:0;border-radius:6px;background:transparent;color:var(--text-secondary);font:inherit;white-space:nowrap;cursor:pointer}
.dc-filters button:hover {background:var(--bg-subtle)}
.dc-filters button[aria-pressed=true] {background:var(--bg-subtle);color:var(--text-primary);font-weight:600}
.dc-filters small {color:var(--text-muted);font-size:12px}
.dc-ch {display:inline-flex;align-items:center;gap:4px;font-weight:600}
.dc-ch svg {width:14px;height:14px;flex:none}
.dc-ch[data-ch=telegram] {color:#1c7fb8}
.dc-ch[data-ch=whatsapp] {color:#1d7a4c}
.dc-ch[data-ch=email] {color:#5b5fa8}
.dc-ch[data-ch=max] {color:#7a4fb5}
.dc-feed {list-style:none;margin:0;padding:14px 16px;flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;gap:8px}
.dc-day {align-self:center;margin:8px 0 2px;font-size:12px;color:var(--text-muted);text-align:center}
.dc-msg {display:flex;flex-direction:column;gap:3px;max-width:min(620px,84%)}
.dc-msg.is-out {align-self:flex-end;align-items:flex-end}
.dc-bubble {padding:8px 12px;border:1px solid var(--border);border-radius:12px;background:var(--bg-surface);white-space:pre-wrap;overflow-wrap:anywhere}
.dc-msg.is-out .dc-bubble {background:#e9f1ff;border-color:#d4e3fd}
.dc-msg.is-failed .dc-bubble {background:var(--danger-soft);border-color:#f2d3d3}
.dc-msg.is-failed .dc-status {color:var(--danger);font-weight:600}
.dc-meta {display:flex;flex-wrap:wrap;align-items:center;gap:2px 8px;font-size:12px;color:var(--text-muted)}
.dc-meta a {text-decoration:none}
.dc-event {align-self:center;padding:3px 12px;border-radius:12px;background:var(--bg-subtle);font-size:12.5px;color:var(--text-secondary);text-align:center}
.dc-event b {color:var(--text-primary);font-weight:600}
.dc-event span {color:var(--text-muted)}
.dc-empty {margin:auto;max-width:420px;padding:24px 0;text-align:center;color:var(--text-secondary)}
.dc-empty h2 {margin:0 0 6px;font-size:17px;color:var(--text-primary)}
.dc-empty p {margin:0 0 12px}
.dc-composer {padding:8px 12px 10px;border-top:1px solid var(--border);background:var(--bg-surface)}
.dc-send-as {display:flex;align-items:center;gap:4px 6px;margin-bottom:6px;overflow-x:auto;scrollbar-width:none;font-size:13px}
.dc-send-as button {flex:none;display:inline-flex;align-items:center;gap:5px;min-height:30px;padding:3px 9px;border:1px solid var(--border);border-radius:6px;background:transparent;color:var(--text-secondary);font:inherit;cursor:pointer}
.dc-send-as button svg {width:13px;height:13px}
.dc-send-as button[aria-pressed=true] {border-color:var(--border-strong);background:var(--bg-subtle);color:var(--text-primary);font-weight:600}
.dc-from {margin-left:auto;padding-left:8px;color:var(--text-muted);font-size:12.5px;white-space:nowrap}
.dc-draft {display:flex;gap:10px;align-items:baseline;margin-bottom:6px;padding:7px 10px;border-radius:var(--radius-sm);background:var(--accent-soft);font-size:13px}
.dc-draft[hidden] {display:none}
.dc-draft p {flex:1;margin:0;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden}
.dc-blocked {margin:0;padding:7px 10px;border-radius:var(--radius-sm);background:var(--warning-soft);color:var(--warning);font-size:13px}
.dc-row {display:flex;gap:8px;align-items:flex-end}
.dc-row[hidden] {display:none}
.dc-row textarea {flex:1;min-width:0;min-height:40px;max-height:140px;padding:8px 10px;border:1px solid var(--border-strong);border-radius:var(--radius-sm);font:inherit;resize:vertical}
.dc-aside {border-left:1px solid var(--border);overflow-y:auto;min-height:0}
.dc-sec {padding:14px 16px;border-bottom:1px solid var(--border)}
.dc-sec:last-child {border-bottom:0}
#dc-info > .dc-sec:last-child {border-bottom:0}
.dc-sec h2 {margin:0 0 8px;font-size:14px;font-weight:650}
.dc-sec h2 small {margin-left:4px;color:var(--text-muted);font-weight:400}
.dc-sec > p {margin:0 0 8px}
.dc-sec details summary {padding:2px 0;color:var(--text-secondary);cursor:pointer}
.dc-sec details p, .dc-sec details ul {margin:6px 0 4px;font-size:13px}
.dc-facts {margin:8px 0 0;display:flex;flex-direction:column;gap:7px}
.dc-facts > div {display:grid;grid-template-columns:96px minmax(0,1fr);gap:8px}
.dc-facts dt {color:var(--text-secondary)}
.dc-facts dd {margin:0;font-weight:500}
.dc-facts select {width:100%;padding:4px 6px;border:1px solid var(--border-strong);border-radius:6px;background:var(--bg-surface);font:inherit;font-weight:500}
.dc-links {display:flex;flex-wrap:wrap;gap:4px 14px;margin:10px 0 0 !important}
.dc-links a {color:var(--accent-hover);font-weight:500;text-decoration:none}
.dc-wide {width:100%}
.dc-input {width:100%;margin-bottom:8px;padding:8px 10px;border:1px solid var(--border-strong);border-radius:var(--radius-sm);font:inherit}
.dc-cand {display:flex;justify-content:space-between;align-items:center;gap:8px;width:100%;margin-bottom:6px;padding:8px 10px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--bg-surface);font:inherit;text-align:left;cursor:pointer}
.dc-cand:hover {background:var(--bg-subtle)}
.dc-form {display:flex;flex-direction:column;gap:9px}
.dc-form label {display:flex;flex-direction:column;gap:3px;color:var(--text-secondary);font-size:13px}
.dc-form input {padding:7px 9px;border:1px solid var(--border-strong);border-radius:var(--radius-sm);font:inherit;color:var(--text-primary)}
.dc-form .deal-total {margin:2px 0}
.dc-form #deal-add-line {align-self:flex-start}
.dc-aside .deal-invoices {margin-bottom:8px}
@media (max-width:900px) {
 .dc {gap:8px}
 .dc-wait .button {min-height:40px}
 .dc-stages {gap:4px;overflow-x:auto;scrollbar-width:none}
 .dc-rail {display:flex;flex:none}
 .dc-rail li {flex:none}
 .dc-rail li > *, .dc-rail li:first-child > *, .dc-rail li:last-child > * {min-height:44px;padding:6px 12px;white-space:nowrap;border-radius:var(--radius-sm)}
 .dc-lost-open {min-height:44px}
 .dc-tabs {display:grid;grid-template-columns:1fr 1fr;border-bottom:1px solid var(--border)}
 .dc-tabs button {min-height:44px;border:0;border-bottom:2px solid transparent;background:none;color:var(--text-secondary);font:inherit;cursor:pointer}
 .dc-tabs button[aria-pressed=true] {border-bottom-color:var(--accent);color:var(--text-primary);font-weight:600}
 .dc-body {grid-template-columns:minmax(0,1fr);height:auto;min-height:0;border:0;border-radius:0;background:none;overflow:visible}
 .dc-body[data-tab=thread] .dc-aside, .dc-body[data-tab=info] .dc-thread {display:none}
 .dc-feed {min-height:320px;max-height:58dvh;padding:12px 4px}
 .dc-aside {border:1px solid var(--border);border-radius:var(--radius-md);background:var(--bg-surface)}
 .dc-thread {background:none}
 .dc-filters {padding:6px 0;background:none}
 .dc-filters button {min-height:36px}
 .dc-composer {position:sticky;bottom:0;padding:8px 0 10px}
 .dc-from {display:none}
 .dc-row .button.button-primary {width:auto;flex:none;min-height:44px}
 .dc-draft {flex-wrap:wrap;gap:0 14px}
 .dc-draft p {flex:1 0 100%;-webkit-line-clamp:2}
 .dc-send-as button {min-height:40px}
 .dc-msg {max-width:92%}
 .dc-link {min-height:44px;padding:0 4px;display:inline-flex;align-items:center}
 .dc-row textarea, .dc-form input, .dc-input, .dc-lost input, .dc-facts select {font-size:16px}
 .dc-cand {min-height:44px}
 .dc ~ #cp-status {bottom:96px;width:max-content}
}

/* TASK-CRM-125B: правка контактов, сайт, комментарии */
.dc-inline {display:flex;flex-direction:column;gap:6px;margin:4px 0 8px;padding:8px;border-radius:var(--radius-sm);background:var(--bg-subtle)}
.dc-inline select, .dc-inline input {width:100%;padding:7px 9px;border:1px solid var(--border-strong);border-radius:var(--radius-sm);background:var(--bg-surface);font:inherit}
.dc-inline p {margin:0;font-size:12.5px}
.dc-inline-actions {display:flex;flex-wrap:wrap;gap:6px}
.dc-danger {border-color:var(--danger) !important;color:var(--danger) !important}
.dc-facts dd .dc-inline {margin:0}
.dc-note {align-self:center;display:flex;flex-direction:column;align-items:center;gap:3px;max-width:min(560px,90%)}
.dc-note .dc-bubble {background:#fff8e1;border-color:#f1e2b0}
.dc-note-tag {font-weight:600;color:var(--warning)}
.dc-send-as .dc-note-btn {margin-left:4px}
.dc-send-as .dc-note-btn[aria-pressed=true] {background:#fff8e1;border-color:#e8d38f}
@media (max-width:900px) {
 .dc-inline select, .dc-inline input {font-size:16px}
 .dc-inline-actions .button {min-height:44px}
}

/* TASK-CRM-125B: контакт — строка-кнопка, меню действий под ней */
.dc-ct {margin:0 -8px}
.dc-ct-btn {display:flex;align-items:center;gap:10px;width:100%;padding:7px 8px;border:0;border-radius:var(--radius-sm);background:none;color:inherit;font:inherit;text-align:left;cursor:pointer}
.dc-ct-btn.is-static {cursor:default}
button.dc-ct-btn:hover, .dc-ct-btn[aria-expanded=true] {background:var(--bg-subtle)}
.dc-ct-text {flex:1;min-width:0;overflow-wrap:anywhere}
.dc-ct-text b {font-weight:500}
.dc-ct-text small {display:block;color:var(--text-muted);font-size:12px}
.dc-ct-chev {flex:none;display:flex;color:var(--text-muted);transition:transform .16s cubic-bezier(.2,.8,.2,1)}
.dc-ct-chev svg {width:16px;height:16px}
.dc-ct-btn[aria-expanded=true] .dc-ct-chev {transform:rotate(180deg);color:var(--text-primary)}
.dc-menu {list-style:none;margin:2px 8px 8px 32px;padding:4px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--bg-surface);box-shadow:0 6px 18px rgb(14 35 31 / 10%)}
.dc-menu[hidden] {display:none}
.dc-menu-item {display:flex;align-items:center;width:100%;min-height:34px;padding:6px 10px;border:0;border-radius:6px;background:none;color:var(--text-primary);font:inherit;text-align:left;text-decoration:none;cursor:pointer}
.dc-menu-item:hover, .dc-menu-item:focus-visible {background:var(--bg-subtle);outline:none}
.dc-menu-item:focus-visible {box-shadow:inset 0 0 0 2px var(--accent)}
.dc-menu-item.is-danger {color:var(--danger)}
.dc-menu-item[data-sure="1"] {background:var(--danger-soft);font-weight:600}
@media (max-width:900px) {
 .dc-ct-btn {min-height:52px}
 .dc-menu {margin-left:8px}
 .dc-menu-item {min-height:44px}
}
@media (prefers-reduced-motion:reduce) {.dc-ct-chev {transition:none}}

/* TASK-CRM-125C: кто клиент, соцсети, другие люди сделки */
.dc-who {display:flex;align-items:flex-start;justify-content:space-between;gap:8px;margin:-2px 0 8px}
.dc-who b {display:block;font-size:16px;font-weight:650;line-height:1.3;overflow-wrap:anywhere}
.dc-who small {display:block;color:var(--text-secondary);font-size:13px}
.dc-socials {list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}
.dc-socials li {display:flex;align-items:center;gap:4px;min-width:0}
.dc-socials a {min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--accent-hover);text-decoration:none;font-weight:400}
.dc-socials a b {color:var(--text-primary);font-weight:500}
.dc-x {flex:none;width:24px;height:24px;border:0;border-radius:6px;background:none;color:var(--text-muted);font:inherit;font-size:16px;line-height:1;cursor:pointer}
.dc-x:hover {background:var(--danger-soft);color:var(--danger)}
.dc-person {display:flex;flex-direction:column;gap:2px;padding:4px 0}
.dc-person b {font-weight:500}
.dc-person .dc-link {display:inline-flex;align-items:center;gap:4px}
.dc-person .dc-link svg {width:13px;height:13px}
@media (max-width:900px) {.dc-x {width:40px;height:40px}}

/* TASK-CRM-125D: диктофон, досье */
.dc-mic {flex:none;display:inline-flex;align-items:center;gap:6px;min-height:40px;padding:0 10px}
.dc-mic svg {width:18px;height:18px}
.dc-mic[data-state=rec] {background:var(--danger);border-color:var(--danger);color:#fff;font-variant-numeric:tabular-nums}
.dc-mic[data-state=rec] svg {animation:dc-pulse 1.2s ease-in-out infinite}
.dc-mic[data-state=busy] {color:var(--text-secondary)}
@keyframes dc-pulse {50% {opacity:.35}}
.dc-panes {position:sticky;top:0;z-index:2;display:grid;grid-template-columns:1fr 1fr;border-bottom:1px solid var(--border);background:var(--bg-surface)}
.dc-panes button {min-height:40px;border:0;border-bottom:2px solid transparent;background:none;color:var(--text-secondary);font:inherit;cursor:pointer}
.dc-panes button[aria-pressed=true] {border-bottom-color:var(--accent);color:var(--text-primary);font-weight:600}
.dc-panes small, .dc-tabs small {color:var(--text-muted);font-weight:400}
.dc-dossier > .muted {margin:0 0 10px;font-size:13px}
.dc-facts-list {list-style:none;margin:0 0 10px;padding:0;display:flex;flex-direction:column;gap:2px}
.dc-fact {padding:7px 0;border-bottom:1px solid var(--border)}
.dc-fact:last-child {border-bottom:0}
.dc-fact p {margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
.dc-fact small {display:block;margin-top:2px;color:var(--text-muted);font-size:12px}
.dc-fact-act {display:flex;gap:12px;margin-top:2px}
.dc-link.is-danger {color:var(--danger)}
.dc-empty-note {margin:0 0 10px;padding:10px 12px;border-radius:var(--radius-sm);background:var(--bg-subtle);color:var(--text-secondary);font-size:13px}
.dc-inline textarea {width:100%;padding:7px 9px;border:1px solid var(--border-strong);border-radius:var(--radius-sm);background:var(--bg-surface);font:inherit;resize:vertical}
@media (max-width:900px) {
 .dc-tabs {grid-template-columns:1fr 1fr 1fr}
 .dc-panes {display:none}
 .dc-mic {min-height:44px}
 .dc-inline textarea {font-size:16px}
}
@media (prefers-reduced-motion:reduce) {.dc-mic[data-state=rec] svg {animation:none}}

/* TASK-CRM-125E: досье в двух разделах; кнопка микрофона не перебивает hidden */
.dc-mic[hidden] {display:none}
.dc-row .dc-mic {width:40px;padding:0;justify-content:center}
.dc-row .dc-mic[data-state=rec], .dc-row .dc-mic[data-state=busy] {width:auto;padding:0 10px}
.dc-dossier-head h2 {margin-bottom:2px}
.dc-dossier-head p {margin:0 0 10px;font-size:13px}
.dc-dossier-tools {display:flex;flex-wrap:wrap;gap:8px;margin-bottom:14px}
.dc-dossier-tools .button {display:inline-flex;align-items:center;gap:6px;min-height:36px;padding:0 12px}
.dc-dossier-tools svg {width:16px;height:16px}
.dc-dossier-part {margin-bottom:14px}
.dc-dossier-part h3 {margin:0 0 4px;font-size:13px;font-weight:650;text-transform:none;color:var(--text-primary)}
.dc-dossier-part h3 span {font-weight:400;color:var(--text-secondary)}
.dc-part-empty {margin:0;padding:8px 10px;border-radius:var(--radius-sm);background:var(--bg-subtle);color:var(--text-muted);font-size:13px}
.dc-part-note {margin:0 0 6px;font-size:12.5px;color:var(--text-secondary)}
.dc-fact-act {flex-wrap:wrap;gap:4px 12px}
.dc-add-fact {display:flex;flex-direction:column;gap:6px;padding-top:12px;border-top:1px solid var(--border)}
.dc-add-fact textarea {width:100%;padding:7px 9px;border:1px solid var(--border-strong);border-radius:var(--radius-sm);background:var(--bg-surface);font:inherit;resize:vertical}
.dc-add-row {display:flex;align-items:center;justify-content:space-between;gap:8px}
.dc-seg {display:inline-flex;padding:2px;border-radius:var(--radius-sm);background:var(--bg-subtle)}
.dc-seg label {cursor:pointer}
.dc-seg input {position:absolute;opacity:0;pointer-events:none}
.dc-seg span {display:inline-flex;align-items:center;min-height:30px;padding:0 10px;border-radius:6px;font-size:13px;color:var(--text-secondary)}
.dc-seg input:checked + span {background:var(--bg-surface);color:var(--text-primary);font-weight:600;box-shadow:0 1px 2px rgb(14 35 31 / 12%)}
.dc-seg input:focus-visible + span {outline:2px solid var(--accent);outline-offset:1px}
@media (max-width:900px) {
 .dc-row .dc-mic {width:44px}
 .dc-dossier-tools .button {min-height:44px}
 .dc-seg span {min-height:40px}
 .dc-add-fact textarea {font-size:16px}
 .dc-add-row .button {width:auto !important}
}

/* TASK-CRM-125F: компания сделки из ядра, люди сделки с ролями */
.dc-company-none {margin:0 0 8px}
.dc-check {display:flex;align-items:center;gap:8px;font-size:13px;color:var(--text-secondary);cursor:pointer}
.dc-inline .dc-check input {width:auto;margin:0}
.dc-inline label:not(.dc-check) {display:flex;flex-direction:column;gap:3px;font-size:12.5px;color:var(--text-secondary)}
.dc-company-found {display:flex;flex-direction:column}
.dc-company-found .dc-cand {margin-bottom:4px}
.dc-cand > span:first-child {display:flex;flex-direction:column;min-width:0}
.dc-cand b {font-weight:600;overflow-wrap:anywhere}
.dc-cand small {color:var(--text-secondary);font-size:12px}
.dc-cand[disabled] {cursor:default;opacity:.7}
.dc-cand-new {border-style:dashed}
.dc-cand-new > span:first-child {display:block}
.dc-person-head {display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:4px 6px}
.dc-person-head b {grid-column:1/-1;min-width:0;overflow-wrap:anywhere}
.dc-person-head .dc-role {width:100%}
.dc-person-head b a {color:inherit;text-decoration:none}
.dc-person-head b a:hover {text-decoration:underline}
.dc-person-head small {color:var(--text-secondary);font-size:12.5px}
.dc-role {max-width:100%;padding:3px 6px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--bg-surface);font:inherit;font-size:12.5px;color:var(--text-secondary)}
.dc-x.is-sure {width:auto;padding:0 6px;font-size:12.5px;color:var(--danger);background:var(--danger-soft)}
.dc-cpeople {margin-top:8px}
.dc-cpeople summary {cursor:pointer;font-size:13px;color:var(--text-secondary)}
.dc-cpeople ul {list-style:none;margin:6px 0 0;padding:0;display:flex;flex-direction:column;gap:2px}
.dc-cpeople li {display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:13.5px}
.dc-cpeople li a {color:var(--text-primary);text-decoration:none;overflow-wrap:anywhere}
.dc-cpeople li a:hover {text-decoration:underline}
#dc-company-edit {margin-top:2px}
@media (max-width:900px) {
 .dc-role {min-height:40px;font-size:16px}
 .dc-x.is-sure {height:40px}
}

/* TASK-CRM-125G: раздел «Компании» */
.co-search {display:flex;gap:8px;margin-bottom:12px;max-width:560px}
.co-search input {flex:1;min-width:0;padding:8px 10px;border:1px solid var(--border-strong);border-radius:var(--radius-sm);background:var(--bg-surface);font:inherit}
.co-table td small {display:block;color:var(--text-secondary);font-size:12px}
.co-table td a {text-decoration:none;color:var(--text-primary)}
.co-table td a:hover b {text-decoration:underline}
.co-pager {display:flex;align-items:center;gap:12px;margin:12px 0}
.co-back {margin:0 0 8px}
.co-back a {color:var(--accent-hover);text-decoration:none;font-size:13.5px}
.co-grid {display:grid;grid-template-columns:minmax(0,1.4fr) minmax(280px,1fr);gap:16px;align-items:start}
.co-main, .co-aside {display:flex;flex-direction:column;gap:12px;min-width:0}
.co-grid .dc-sec {background:var(--bg-surface);border:1px solid var(--border);border-radius:var(--radius-md, 10px);padding:14px 16px}
.co-grid .dc-sec h2 small {color:var(--text-muted);font-weight:500}
.co-people {list-style:none;margin:0 0 8px;padding:0;display:flex;flex-direction:column}
.co-person {display:flex;align-items:center;justify-content:space-between;gap:8px;padding:7px 0;border-bottom:1px solid var(--border)}
.co-person:last-child {border-bottom:0}
.co-person > div {min-width:0}
.co-person a {color:var(--text-primary);text-decoration:none}
.co-person a:hover b {text-decoration:underline}
.co-person small {display:block;color:var(--text-secondary);font-size:12.5px}
.co-deals {list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
.co-deals li {display:grid;grid-template-columns:minmax(0,1fr) auto;gap:2px 10px;padding:8px 0;border-bottom:1px solid var(--border)}
.co-deals li:last-child {border-bottom:0}
.co-deals a {color:var(--text-primary);text-decoration:none;overflow-wrap:anywhere}
.co-deals a:hover b {text-decoration:underline}
.co-deals small {grid-column:1/-1;color:var(--text-secondary);font-size:12.5px}
.dc-company-link {color:inherit;text-decoration:none}
.dc-company-link:hover {text-decoration:underline}
@media (max-width:900px) {
 .co-grid {grid-template-columns:1fr}
 .co-search input {font-size:16px}
 .co-person .dc-link {min-height:44px}
}
.co-leave:not(.is-danger) {color:var(--text-secondary);font-weight:400}
