/* «Обращения» — рабочее место сотрудника (staff/support-desk.js и соседи; волна
   «чат вместо Jivo», дорожка desk-ui). Подключается после chat-kit.css. Только
   токены styles.css: тёмная тема кабинета приходит сама. Высоту рабочего места
   задаёт экран (--desk-h: окно минус всё, что над ним) — общей прокрутки нет. */

/* Кабинет вокруг: без нижнего колонтитула и широкого поля — место ленте. */
body.desk-mode .cabinet-footer { display:none; }
.content.is-desk { max-width:none; padding:10px 16px 0; }
.content.is-desk > * { animation:none; }

.desk { --desk-h:calc(100dvh - 90px); display:flex; flex-direction:column; gap:6px; height:var(--desk-h); min-height:0; }
.desk-top { display:flex; flex-wrap:wrap; align-items:center; gap:6px 14px; flex:none; }
.desk-tabs { display:flex; gap:4px; overflow-x:auto; scrollbar-width:thin; max-width:100%; }
.desk-tab { display:inline-flex; align-items:center; gap:6px; min-height:36px; padding:4px 12px; border:1px solid var(--line); border-radius:999px; background:var(--surface); color:var(--ink-2); font:600 14px/1.2 var(--font); white-space:nowrap; cursor:pointer; }
.desk-tab.is-on { background:var(--primary); border-color:var(--primary); color:var(--on-primary); }
.desk-tab-n { min-width:20px; padding:0 6px; border-radius:999px; background:var(--chip-bg); color:var(--ink); font-size:12.5px; text-align:center; }
.desk-tab.is-on .desk-tab-n { background:var(--on-primary); color:var(--primary); }
.desk-tab-n.is-late { background:var(--red-bg); color:var(--red-ink); }
.desk-load { margin:0; }
.desk-now { font-size:13.5px; color:var(--ink-2); }
.desk-now-n { font-weight:600; }
.desk-now-down { color:var(--amber-ink); }
.desk-person-toggle { display:none; margin-left:auto; }
.desk-warn, .desk-unsent, .desk-link { flex:none; padding:6px 12px; border-radius:10px; font-size:14px; }
.desk-warn { background:var(--amber-bg); border:1px solid var(--amber-line); color:var(--amber-ink); }
.desk-unsent { background:var(--red-bg); border:1px solid var(--red-line); color:var(--red-ink); }
/* Потеря связи — предупреждение, как «нет связи» каналов: жёлтая полоса. */
.desk-link { background:var(--amber-bg); border:1px solid var(--amber-line); color:var(--amber-ink); }
.desk-offer { font-size:13.5px; }
.desk-warn[hidden], .desk-unsent[hidden], .desk-offer[hidden], .desk-link[hidden], .desk-now[hidden] { display:none; }

.desk-grid { flex:1 1 auto; min-height:0; display:grid; grid-template-columns:340px minmax(0,1fr) 300px; gap:12px; }
.desk-grid[hidden], .desk-report[hidden] { display:none; }
.desk-report { flex:1 1 auto; min-height:0; overflow:auto; }
.desk-col { min-width:0; min-height:0; display:flex; flex-direction:column; border:1px solid var(--line); border-radius:12px; background:var(--surface); }
.desk-col-title { margin:0 0 8px; font:700 15px/1.3 var(--display); color:var(--ink); }

/* ── Список ── */
.desk-list-tools { flex:none; display:flex; flex-direction:column; gap:6px; padding:10px 10px 6px; border-bottom:1px solid var(--line-2); }
.desk-search { width:100%; min-height:40px; }
.desk-filters { display:flex; gap:6px; }
.desk-filter { flex:1 1 0; min-width:0; min-height:36px; font-size:14px; }
.desk-quiet { flex:none; display:flex; flex-wrap:wrap; gap:4px; padding:6px 10px 0; }
.desk-quiet[hidden], .desk-bulk[hidden] { display:none; }
.desk-bulk { flex:none; display:flex; align-items:center; justify-content:space-between; gap:8px; padding:6px 10px; background:var(--surface-2); font-size:14px; }
.desk-list { flex:1 1 auto; min-height:0; overflow-y:auto; overscroll-behavior:contain; padding:4px 0 8px; }
.desk-list:focus { outline:none; }
.desk-new { position:sticky; top:0; z-index:1; display:block; width:calc(100% - 16px); margin:4px 8px; min-height:32px; border:0; border-radius:999px; background:var(--primary); color:var(--on-primary); font:600 13.5px/1.2 var(--font); cursor:pointer; }
.desk-new[hidden], .desk-more[hidden] { display:none; }
.desk-more { display:block; margin:8px auto; }
.desk-group { margin:0; }
.desk-group-head { display:flex; justify-content:space-between; align-items:center; width:100%; min-height:32px; padding:4px 12px; border:0; background:transparent; color:var(--muted); font:700 12.5px/1.2 var(--font); text-transform:uppercase; letter-spacing:.04em; cursor:pointer; }
.desk-group-head::after { content:'▾'; margin-left:6px; font-size:12px; }
.desk-group-head[aria-expanded='false']::after { content:'▸'; }
.desk-group-head span:first-child { margin-right:auto; }
.desk-group-rows { list-style:none; margin:0; padding:0; }
.desk-row { display:flex; align-items:stretch; border-left:3px solid transparent; }
.desk-row.is-open { border-left-color:var(--accent); background:var(--accent-soft); }
.desk-row.is-gone { opacity:.75; }
.desk-row-check { flex:none; width:20px; height:20px; margin:12px 0 0 8px; }
.desk-row-link { flex:1 1 auto; min-width:0; display:flex; flex-direction:column; gap:2px; padding:8px 12px; color:var(--ink); text-decoration:none; border-bottom:1px solid var(--line-2); }
.desk-row-link:hover { background:var(--item-hover); }
.desk-row-link:focus-visible { outline:2px solid var(--accent-2); outline-offset:-2px; }
.desk-row-top { display:flex; align-items:center; gap:6px; min-width:0; }
.desk-row-name { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:14.5px; }
.desk-unread { flex:none; width:8px; height:8px; border-radius:50%; background:var(--unread-mark); }
.desk-ch { flex:none; padding:1px 6px; border-radius:6px; background:var(--badge-gray-bg); color:var(--badge-gray-ink); font-size:11.5px; font-weight:600; }
.desk-ch.ch-telegram { background:var(--blue-bg); color:var(--blue-ink); }
.desk-ch.ch-vk { background:var(--blue-bg); color:var(--blue-ink); }
.desk-ch.ch-max { background:var(--badge-violet-bg); color:var(--badge-violet-ink); }
.desk-lead { flex:none; display:inline-flex; align-items:center; justify-content:center; width:24px; height:24px; border-radius:50%; background:var(--surface-3); color:var(--ink-2); font-size:11px; font-weight:700; }
.desk-lead.is-me { background:var(--accent-soft); color:var(--ink); }
.desk-wait { flex:none; margin-left:auto; font-size:12.5px; font-weight:600; color:var(--muted); white-space:nowrap; }
.desk-wait.level-warn { color:var(--amber-ink); }
.desk-wait.level-late { color:var(--red-ink); }
.desk-row-last { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; color:var(--ink-2); font-size:13.5px; line-height:1.35; overflow-wrap:anywhere; }
.desk-row-last.is-draft { color:var(--amber-ink); font-style:italic; }
.desk-row-last.is-staff, .desk-row-last.is-bot { color:var(--muted); }
.desk-row-flags { display:flex; flex-wrap:wrap; gap:4px; }
.desk-row-flags:empty { display:none; }
.desk-mark { padding:1px 6px; border-radius:6px; font-size:11.5px; font-weight:600; background:var(--badge-gray-bg); color:var(--badge-gray-ink); }
.desk-mark.tone-danger { background:var(--red-bg); color:var(--red-ink); }
.desk-mark.tone-warn { background:var(--amber-bg); color:var(--amber-ink); }
.desk-mark.tone-info { background:var(--blue-bg); color:var(--blue-ink); }
.desk-empty { padding:24px 16px; color:var(--muted); text-align:center; }
.desk-empty p { margin:0 0 4px; }

/* ── Переписка ── */
.desk-talk-col { overflow:hidden; }
.desk-empty-talk { margin:auto; padding:24px; }
.desk-talk { flex:1 1 auto; min-height:0; display:flex; flex-direction:column; }
.desk-talk:focus { outline:none; }
.desk-talk-head { flex:none; display:flex; flex-wrap:wrap; align-items:center; gap:4px 8px; padding:8px 12px; border-bottom:1px solid var(--line-2); }
.desk-back { display:none; flex:none; width:40px; height:40px; }
.desk-back svg { transform:rotate(180deg); }
.desk-talk-who { min-width:0; flex:1 1 180px; }
.desk-talk-name { margin:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font:700 16px/1.25 var(--display); color:var(--ink); }
.desk-talk-meta { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); font-size:13px; }
.desk-status.is-open { color:var(--amber-ink); font-weight:600; }
.desk-status.is-closed { color:var(--muted); }
.desk-talk-acts { flex:0 1 auto; margin-left:auto; display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:4px; }
.desk-talk-acts .btn.sm, .desk-talk-acts .desk-more-menu > summary { min-height:32px; padding:4px 10px; }
.desk-more-menu, .desk-send-more, .m-menu { position:relative; }
.desk-more-menu > summary, .desk-send-more > summary, .m-menu > summary { list-style:none; cursor:pointer; }
.desk-more-menu > summary::-webkit-details-marker, .desk-send-more > summary::-webkit-details-marker, .m-menu > summary::-webkit-details-marker { display:none; }
.m-menu-list { position:absolute; right:0; top:100%; z-index:5; display:flex; flex-direction:column; min-width:220px; padding:4px; border:1px solid var(--line); border-radius:10px; background:var(--surface); box-shadow:var(--sh-md); }
.desk-send-more .m-menu-list { top:auto; bottom:100%; }
.m-menu-list > button, .m-menu-list > a { min-height:40px; padding:8px 12px; border:0; border-radius:8px; background:transparent; color:var(--ink); font:500 14px/1.3 var(--font); text-align:left; text-decoration:none; cursor:pointer; }
.m-menu-list > button:hover, .m-menu-list > a:hover { background:var(--hover); }
.m-menu-list > .desk-phone-only, .m-menu-list > .desk-narrow-only { display:none; }
.m-menu > summary { display:inline-flex; align-items:center; justify-content:center; width:28px; height:24px; margin-left:6px; border-radius:6px; color:var(--muted); }
.m-menu > summary:hover { background:var(--hover); }
.desk-talk-strips { flex:none; max-height:30%; overflow:auto; display:flex; flex-direction:column; gap:6px; padding:6px 12px 0; }
.desk-talk-strips:empty { display:none; }
.desk-strip { margin:0; }
.desk-strip-note { padding:6px 10px; border-left:3px solid var(--amber); border-radius:6px; background:var(--amber-bg); color:var(--ink); font-size:14px; }
.desk-brief { font-size:14px; }
.desk-brief summary { cursor:pointer; color:var(--ink-2); font-weight:600; }
.desk-brief dl { display:grid; grid-template-columns:auto 1fr; gap:2px 10px; margin:6px 0 0; }
.desk-brief dt { color:var(--muted); }
.desk-brief dd { margin:0; overflow-wrap:anywhere; }
.desk-talk .ck-feed { flex:1 1 auto; min-height:48px; }
.desk-talk .msg { max-width:min(640px,88%); }
.desk-talk .msg.note { align-self:stretch; max-width:none; padding:8px 12px; border:0; border-left:3px solid var(--amber); border-radius:6px; background:var(--amber-bg); color:var(--ink); }
.desk-note-tag { margin-left:8px; color:var(--amber-ink); font-size:12px; font-weight:600; }
.desk-talk .msg.pending { opacity:.85; }
.m-text { white-space:pre-wrap; overflow-wrap:anywhere; }
.desk-pending { display:flex; flex-wrap:wrap; gap:4px 10px; margin-top:4px; color:var(--muted); font-size:13px; }
.desk-pending.is-failed { color:var(--red-ink); }
.desk-msg-cards { list-style:none; margin:6px 0 0; padding:0; display:flex; flex-direction:column; gap:4px; }
.desk-msg-card { display:flex; flex-direction:column; padding:6px 10px; border:1px solid var(--line); border-radius:8px; background:var(--surface-2); font-size:13.5px; }
.desk-talk-above { flex:none; display:flex; flex-direction:column; gap:4px; padding:0 12px; }
.desk-talk-above:empty { display:none; }
.desk-above { display:flex; flex-wrap:wrap; align-items:center; gap:4px 8px; padding:6px 10px; border-radius:8px; background:var(--surface-2); color:var(--ink-2); font-size:14px; }
.desk-above-warn { background:var(--amber-bg); color:var(--ink); border:1px solid var(--amber-line); }
.desk-above-info { background:var(--blue-bg); color:var(--ink); }
.desk-above-quote { margin-top:2px; color:var(--ink-2); white-space:pre-wrap; max-height:4.5em; overflow:auto; }
.desk-above-acts { display:flex; gap:6px; margin-left:auto; }
.desk-talk-compose { flex:none; display:flex; flex-direction:column; gap:4px; padding:6px 12px 8px; border-top:1px solid var(--line-2); }
.desk-talk .ck-composer { gap:4px; }
.desk-talk .ck-send, .desk-talk .ck-attach { min-height:38px; height:auto; }
.desk-talk .ck-attach { width:38px; height:38px; }
.desk-compose-top { display:flex; align-items:center; justify-content:space-between; gap:8px; }
/* Не «.desk-mode»: так называется класс body рабочего места. */
.desk-write-mode { display:inline-flex; padding:2px; border-radius:999px; background:var(--tabs-bg); }
.desk-mode-btn { min-height:30px; padding:2px 12px; border:0; border-radius:999px; background:transparent; color:var(--ink-2); font:600 13.5px/1.2 var(--font); cursor:pointer; }
.desk-mode-btn.is-on { background:var(--surface); color:var(--ink); box-shadow:var(--sh-sm); }
.desk-mode-btn[data-mode='note'].is-on { background:var(--amber-bg); }
.desk-to { color:var(--muted); font-size:13px; text-align:right; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.desk-talk .ck-composer-label { position:absolute; width:1px; height:1px; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); }
/* Под полем — одна строка: инструменты слева, подпись справа (обрезается). */
.desk-compose-row { display:flex; align-items:center; gap:4px 10px; min-width:0; }
.desk-compose-foot { flex:1 1 0; min-width:0; margin:0; font-size:12.5px; line-height:1.4; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:right; }
.desk-compose-foot .btn-link { font-size:12.5px; }
.desk-tools-wrap { flex:0 1 auto; min-width:0; display:flex; align-items:flex-start; gap:6px; }
.desk-tools { display:flex; flex-wrap:wrap; gap:4px; }
.desk-talk-compose { position:relative; }
.desk-tools .btn.sm { min-height:30px; padding:3px 10px; font-size:13px; }
.desk-tools .btn.sm svg { width:14px; height:14px; }
.desk-talk-compose .support-tools-note { margin:0; font-size:12.5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.desk-tools-plus { display:none; }
.desk-closed { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.desk-cards { display:flex; flex-wrap:wrap; align-items:center; gap:4px 6px; font-size:13.5px; }
.desk-cards-title { color:var(--muted); }
.desk-card-chip { display:inline-flex; align-items:center; gap:4px; padding:2px 4px 2px 8px; border:1px solid var(--line); border-radius:999px; background:var(--surface-2); }
.desk-card-off { width:24px; height:24px; padding:0; border:0; border-radius:50%; background:transparent; color:var(--ink-2); cursor:pointer; }
.desk-cards-total { font-weight:700; }
.desk-pop-host:empty { display:none; }
.desk-pick { display:flex; flex-direction:column; gap:6px; max-height:260px; padding:8px; border:1px solid var(--line); border-radius:10px; background:var(--surface); box-shadow:var(--sh-md); }
.desk-pick-list { flex:1 1 auto; min-height:0; overflow-y:auto; list-style:none; margin:0; padding:0; }
.desk-pick-item { display:flex; align-items:flex-start; gap:6px; padding:4px; border-radius:8px; }
.desk-pick-item.is-active { background:var(--accent-soft); }
.desk-pick-main { flex:1 1 auto; min-width:0; display:flex; flex-direction:column; gap:2px; padding:4px; border:0; background:transparent; color:var(--ink); font:14px/1.35 var(--font); text-align:left; cursor:pointer; }
.desk-pick-body { color:var(--muted); font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.desk-pick-pin { flex:none; width:32px; height:32px; border:0; border-radius:8px; background:transparent; color:var(--muted); font-size:18px; cursor:pointer; }
.desk-pick-pin.is-on { color:var(--accent-2); }
.desk-pick-acts { flex:none; display:flex; gap:4px; }
.desk-pick-empty { padding:8px; color:var(--muted); }
.desk-pick-found { display:flex; flex-wrap:wrap; align-items:center; gap:4px; font-size:13px; color:var(--muted); }

/* ── «О человеке» ── */
.desk-person { overflow-y:auto; padding:10px 12px; }
.desk-person-head { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.desk-person-close { display:none; }
.desk-person-sec { border-bottom:1px solid var(--line-2); padding:6px 0; }
.desk-person-sec > summary { cursor:pointer; font-weight:600; color:var(--ink-2); min-height:32px; }
.desk-person-name { font-weight:700; margin:4px 0; overflow-wrap:anywhere; }
.desk-person-row { display:flex; gap:8px; font-size:13.5px; line-height:1.5; }
.desk-person-k { flex:none; color:var(--muted); }
.desk-person-v { min-width:0; overflow-wrap:anywhere; }
.desk-person-contact { display:flex; flex-direction:column; gap:2px; margin:4px 0; font-size:14px; }
.desk-person-acts { display:flex; gap:10px; }
.desk-person-past, .desk-person-orders, .desk-person-asked { list-style:none; margin:4px 0 0; padding:0; font-size:13.5px; display:flex; flex-direction:column; gap:4px; }
.desk-person-preview { color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ── Листы ── */
.desk-sheet { display:flex; flex-direction:column; gap:10px; }
.desk-sheet-list { display:flex; flex-wrap:wrap; gap:6px; }
.desk-sheet-row { display:flex; gap:6px; flex-wrap:wrap; }
.desk-sheet-people { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:4px; }
.desk-person-pick { display:flex; justify-content:space-between; width:100%; min-height:44px; padding:8px 12px; border:1px solid var(--line); border-radius:10px; background:var(--surface); color:var(--ink); font:14px/1.3 var(--font); cursor:pointer; }
.desk-person-pick span { color:var(--muted); }
.desk-person-pick.is-away { opacity:.75; }
.desk-close-tiles { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.desk-close-tile { display:flex; flex-direction:column; align-items:flex-start; gap:2px; min-height:64px; padding:10px 12px; border:1px solid var(--line); border-radius:12px; background:var(--surface); color:var(--ink); font:14px/1.3 var(--font); text-align:left; cursor:pointer; }
.desk-close-tile kbd { font-size:11px; color:var(--muted); }
.desk-close-tile span { color:var(--muted); font-size:13px; }
.desk-close-tile.is-active, .desk-close-tile.is-current { border-color:var(--accent); box-shadow:inset 0 0 0 1px var(--accent); }
.desk-close-step { display:flex; flex-direction:column; gap:8px; margin-top:10px; }
.desk-close-step:empty { display:none; }
.desk-close-reasons { display:flex; flex-wrap:wrap; gap:6px; }
.desk-close-own, .desk-close-think { display:flex; flex-wrap:wrap; gap:6px; }
.desk-close-own .input { flex:1 1 200px; }
.desk-keys { display:grid; grid-template-columns:auto 1fr; gap:6px 14px; margin:0; }
.desk-keys dd { margin:0; }

/* ── Сигналы (staff/support-live.js): тосты слева внизу и строка звука ── */
.desk-toasts { position:fixed; left:16px; bottom:16px; z-index:60; display:flex; flex-direction:column; gap:6px; max-width:min(360px,calc(100vw - 32px)); }
.desk-toasts:empty { display:none; }
.desk-toast { display:block; padding:10px 14px; border-radius:10px; background:var(--primary); color:var(--on-primary); box-shadow:var(--sh-md); font-size:14px; text-decoration:none; overflow-wrap:anywhere; }
.desk-toast:focus-visible { outline:2px solid var(--accent-2); outline-offset:2px; }
.desk-sound-blocked { position:fixed; left:16px; bottom:16px; z-index:61; display:inline-flex; align-items:center; gap:6px; min-height:40px; padding:6px 14px; border:1px solid var(--amber-line); border-radius:999px; background:var(--amber-bg); color:var(--amber-ink); font:600 14px/1.2 var(--font); cursor:pointer; }

/* Отчёт: полосы. */
.desk-report-bars { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:16px; margin:0 0 14px; }
.desk-report-h { margin:0 0 6px; font:700 14px/1.3 var(--display); }
.desk-bars { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:4px; }
.desk-bar { display:grid; grid-template-columns:110px 1fr 36px; align-items:center; gap:8px; font-size:13px; }
.desk-bar-track { height:8px; border-radius:4px; background:var(--surface-3); overflow:hidden; }
.desk-bar-fill { display:block; height:100%; background:var(--primary); }
.desk-bar-n { text-align:right; color:var(--ink-2); }
/* Подпись отчёта — короткими пунктами. */
.support-report-notes { margin:10px 0 0; padding-left:18px; display:flex; flex-direction:column; gap:2px; overflow-wrap:anywhere; }

/* Отчёт до 640 px: строка сотрудника — карточкой «подпись — значение». */
@media (max-width:640px) {
  .desk-report .support-report-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
  .desk-report .support-report-table table, .desk-report .support-report-table tbody, .desk-report .support-report-table tr { display:block; width:100%; }
  /* Общая table.data на телефоне шириной 560 px: карточка уехала бы вправо во
     внутреннюю прокрутку, и видны были бы одни подписи без чисел. */
  .desk-report .support-report-table table { min-width:0; }
  .desk-report .support-report-table tr { margin:0 0 10px; padding:8px 10px; border:1px solid var(--line); border-radius:10px; background:var(--surface); }
  .desk-report .support-report-table th[scope='row'] { display:block; padding:0 0 4px; text-align:left; }
  .desk-report .support-report-table td { display:flex; justify-content:space-between; gap:12px; padding:2px 0; border:0; }
  .desk-report .support-report-table td::before { content:attr(data-label); color:var(--muted); }
  .desk-bar { grid-template-columns:80px 1fr 32px; }
}
/* Меню кабинета в «Обращениях» — шторкой и на ноутбуке (до 1599 px): 270 px
   колонки нужнее переписке. Порог — тот же, что DESK_DRAWER_QUERY в core.js
   (там же inert и закрытие шторки); правила шторки — как в styles.css до 1000 px. */
@media (min-width:1001px) and (max-width:1599px) {
  body.desk-mode { --sidebar-w:0px; }
  body.desk-mode .shell { grid-template-columns:minmax(0,1fr); }
  body.desk-mode .sidebar { position:fixed; z-index:70; left:-286px; width:270px; transition:left var(--dur-slow) var(--ease); }
  body.desk-mode .sidebar.open { left:0; box-shadow:var(--sh-lg); }
  body.desk-mode .scrim { display:block; position:fixed; z-index:65; inset:0; width:100%; height:100%; padding:0; border:0; background:rgba(5,18,14,.65); -webkit-backdrop-filter:blur(2px); backdrop-filter:blur(2px); cursor:pointer; }
  body.desk-mode .topbar .burger { display:flex; }
}
/* Поле и кнопки рядом, а не друг под другом: строка ленты дороже. */
@media (min-width:1000px) {
  .desk-talk .ck-composer { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:end; column-gap:8px; }
  .desk-talk .ck-composer > :not(.ck-composer-text):not(.ck-composer-bar) { grid-column:1 / -1; }
  .desk-talk .ck-composer-text { grid-column:1; grid-row:1; }
  .desk-talk .ck-composer-bar { grid-column:2; grid-row:1; flex-wrap:nowrap; }
  .desk-talk .ck-composer-label { grid-row:1; }
}
/* 1000–1279: «О человеке» выдвигается кнопкой. */
@media (max-width:1279px) {
  .desk-grid { grid-template-columns:300px minmax(0,1fr); }
  .desk-person-toggle { display:inline-flex; }
  .desk:not(.has-talk) .desk-person-toggle { display:none; }
  .desk-person { display:none; }
  .desk-person-close { display:inline-flex; }
  .m-menu-list > .desk-narrow-only { display:block; }
  .desk.person-open .desk-person { display:block; position:fixed; z-index:30; top:80px; right:12px; bottom:12px; width:300px; box-shadow:var(--sh-md); }
}
/* Телефон и узкое окно: два экрана — список и разговор. */
@media (max-width:999px) {
  .content.is-desk { padding:6px 8px 0; }
  .desk-grid { grid-template-columns:minmax(0,1fr); }
  .desk.has-talk .desk-list-col { display:none; }
  .desk:not(.has-talk) .desk-talk-col { display:none; }
  .desk.has-talk .desk-top { display:none; }
  .desk-back { display:inline-flex; }
  .desk-tabs { flex-wrap:nowrap; }
  .desk-talk-head { padding:4px 8px; }
  .desk-talk-acts > .btn.sm:not([data-close-outcome]):not([data-claim]) { display:none; }
  .m-menu-list > .desk-phone-only { display:block; }
  .desk-talk-acts .desk-more-menu { display:inline-block; }
  .desk-talk-compose { padding:6px 8px; }
  .desk-tools-plus { display:inline-flex; align-items:center; justify-content:center; min-width:44px; min-height:44px; font-size:20px; }
  .desk-talk .ck-send, .desk-talk .ck-attach { min-height:44px; }
  .desk-talk .ck-attach { width:44px; height:44px; }
  .desk-tools { display:none; }
  .desk-tools.is-open { display:flex; }
  .desk-tools .btn.sm, .desk-talk-acts .btn.sm, .desk-talk-acts .desk-more-menu > summary { min-height:44px; }
  .desk-compose-foot, .desk-talk-compose .support-tools-note { display:none; }
  .desk-compose-row:not(:has(.desk-tools.is-open)) { display:none; }
  .desk-row-link, .desk-group-head, .desk-tab, .m-menu-list > button, .m-menu-list > a { min-height:44px; }
  .desk-talk .msg { max-width:92%; }
  .desk.person-open .desk-person { top:60px; left:8px; right:8px; width:auto; }
  .desk-toasts { left:8px; right:8px; bottom:8px; max-width:none; }
}
/* Телефон: открыто обращение — внизу поле ответа, тосты встают под шапку. */
@media (max-width:520px) {
  body:not(.is-landing):has(.desk.has-talk):not(:has(.modal-bg:not(.is-closing))) #toast-root { top:calc(62px + 8px + env(safe-area-inset-top, 0px)); bottom:auto; }
  body.desk-mode:has(.desk.has-talk) .desk-toasts { top:calc(62px + 8px); bottom:auto; }
}
/* Телефон и низкий экран: инструменты «+» — листом поверх ленты, над полем:
   поле не уезжает вниз за край. */
@media (max-width:999px), (max-height:560px) {
  .desk-tools.is-open { position:absolute; z-index:6; left:8px; right:8px; bottom:calc(100% + 4px); flex-wrap:wrap; gap:6px; padding:8px; border:1px solid var(--line); border-radius:12px; background:var(--surface); box-shadow:var(--sh-md); }
}
/* Низкий экран (масштаб 200 %, телефон боком): поле остаётся на экране, а ленте —
   как можно больше строк: шапка кабинета при открытом разговоре прячется (назад —
   кнопкой «←»), шапка разговора — одной строкой, полосы «Кратко» — нет. */
@media (max-height:560px) {
  .desk-talk-strips, .desk-offer { display:none; }
  .desk-compose-foot, .desk-talk-compose .support-tools-note { display:none; }
  .desk-compose-row:not(:has(.desk-tools.is-open)) { display:none; }
  .desk-tools-plus { display:inline-flex; align-items:center; justify-content:center; min-width:38px; }
  .desk-tools { display:none; }
  .desk-tools.is-open { display:flex; }
  .desk-talk-head { padding:2px 8px; flex-wrap:nowrap; }
  .desk-talk-who { display:flex; align-items:baseline; gap:8px; flex:1 1 auto; }
  .desk-talk-name { flex:0 1 auto; font-size:15px; }
  .desk-talk-meta { flex:1 1 0; min-width:0; }
  .desk-talk-acts { flex-wrap:nowrap; }
  .desk-talk .ck-feed { min-height:40px; }
  .desk-talk-compose { padding:4px 8px; gap:2px; }
  .content.is-desk { padding-top:4px; }
}
/* Мышь на низком экране (масштаб 200 %): кнопки ниже. Палец — цели 44 px остаются. */
@media (max-height:560px) and (pointer:fine) {
  .desk-talk-acts .btn.sm, .desk-talk-acts .desk-more-menu > summary { min-height:32px; padding:2px 8px; }
  .desk-back { width:36px; height:36px; }
  .desk-mode-btn { min-height:26px; }
  .desk-talk .ck-send, .desk-talk .ck-attach, .desk-tools-plus { min-height:36px; }
  .desk-talk .ck-attach { width:36px; height:36px; }
}
/* Разговор на весь низкий узкий экран: шапка кабинета прячется, назад — «←». */
@media (max-height:560px) and (max-width:999px) {
  body.desk-mode:has(.desk.has-talk) .topbar { display:none; }
}
@media (prefers-reduced-motion:reduce) {
  .desk-row-link, .desk-tab { transition:none; }
}
@media (forced-colors:active) {
  .desk-row.is-open { border-left-color:Highlight; }
  .desk-tab.is-on, .desk-mode-btn.is-on { outline:2px solid Highlight; }
  .desk-unread { background:Highlight; }
  .desk-toast, .desk-new { border:1px solid ButtonText; }
  .desk-bar-fill { background:Highlight; }
}
