/* ══════════════════════════════════════════════════════════════════════
   МОБИЛЬНАЯ ВЕРСИЯ — оболочка (этап 0, 11.10.2026)
   Разметка: includes/mobile_topbar.php, includes/mobile_nav.php. Логика: assets/js/mobile.js.

   Правило файла: всё, что меняет вид, — ТОЛЬКО внутри @media ниже (экран телефона).
   Компьютер этот блок не читает, поэтому компьютерная версия не меняется.
   Вне @media — лишь скрытие новых элементов (у них ещё и атрибут hidden).

   Условие «телефон» одно на весь проект — то же в MOB_MQ (assets/js/mobile.js):
     - ширина до 700px (телефон в обычном положении; планшеты остаются в компьютерном виде);
     - сенсорный экран без мыши высотой до 500px (телефон, повёрнутый боком).
   Новый мобильный стиль для любой страницы — в этот файл или под тем же условием.
   ══════════════════════════════════════════════════════════════════════ */

.mob-top,
.mob-nav,
.mob-sheets,
.mob-desk,
.mob-pbf-more,
.mob-share-btn,
.mob-roles,
.mob-hdr-toggle,
.mob-pick-back,
.mob-pop-back,
.mob-pop-head,
.mob-crm-view,
.mob-stage-bar {
    display: none;
}
/* У кнопок кабинета свой display посильнее — «Поделиться» на компьютере прячем правилом той же силы
   (на телефоне его перекрывает правило ниже, внутри @media) */
body.sb-modern #page-profile .ttab-link-btn.mob-share-btn {
    display: none;
}

@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {

    /* ── Общие размеры ── */
    body.sb-modern {
        --mob-edge: 10px;                 /* отступ верхней строки и меню от краёв экрана */
        --mob-nav-h: 66px;                /* высота нижнего меню */
        --mob-top-h: 58px;                /* высота верхней строки */
        --mob-nav-bottom: max(10px, calc(env(safe-area-inset-bottom, 0px) - 4px));
        --page-gutter: 14px;              /* отступ страниц от краёв (берут все страницы, см. sidebar.css) */
        --mob-ink: #111217;
        --mob-ink-2: #3f4352;
        --mob-muted: #8d919d;
        --mob-line: rgba(17, 18, 23, .07);
        --mob-green: #A8E76A;
        --mob-green-dark: #315d20;
        --mob-green-soft: #eefbe3;
        --mob-grad: linear-gradient(180deg, #b9f184 0%, #A8E76A 100%);
        --mob-card-shadow: 0 14px 36px rgba(15, 17, 23, .08), inset 0 0 0 1px rgba(31, 90, 57, .08);
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
    }

    html {
        -webkit-text-size-adjust: 100%;   /* iPhone не увеличивает текст при повороте */
    }
    /* Полосы прокрутки на телефоне не показываем нигде — блоки листаются пальцем как обычно,
       видимые полосы только мешали (владелец 11.10.2026) */
    /* !important: у части блоков свои видимые полосы с более сильными правилами (например,
       плитки CRM — #crmStatsWrap … ::-webkit-scrollbar { height: 6px }, scrollbar-width: thin) */
    * {
        scrollbar-width: none !important;
    }
    *::-webkit-scrollbar,
    *::-webkit-scrollbar-thumb,
    *::-webkit-scrollbar-track {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        background: transparent !important;
    }
    /* Кнопки, которые на компьютере появляются по наведению (удалить задачу, изменить заметку…),
       на телефоне видны всегда. Иначе iPhone первое касание тратит на «наведение» (строка серела,
       появлялась кнопка), и открывалось только со второго — «чтобы открыть задачу, нужно нажать
       2 раза» */
    .crm-task-del-btn,
    .deal-snz-back,
    .tm-cl-del,
    .ibx-note-del,
    .ibx-glist-row-del,
    .ibx-mchip-x,
    .ibx-pop-row-x,
    .company-contact-copy-icon,
    .dm-comment-edit,
    .dm-comment-delete,
    .dm-comment-pin,
    .dmc-reply-del,
    .dmc-reply-act {
        opacity: 1 !important;
    }
    .crm-task-info:hover {
        background: none;
    }
    html.mob-lock,
    html.mob-lock body {
        overflow: hidden;                 /* страница не прокручивается под открытой шторкой */
    }

    /* Поля ввода — не меньше 16px: при меньшем шрифте iPhone увеличивает страницу при вводе */
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
    select,
    textarea,
    [contenteditable]:not([contenteditable="false"]) {
        font-size: 16px !important;
    }

    /* ── Левое меню на телефоне не показываем ──
       Не display:none: панель уведомлений (#notifPanel) живёт внутри меню и скрылась бы вместе
       с ним. И не visibility:hidden (первая версия): в WebKit (iPhone) касания проходили сквозь
       такую панель на страницу — «уведомления не открываются». Поэтому меню схлопнуто в ноль
       и без фона, всё внутри скрыто, кроме панели уведомлений. Слой меню поднят, чтобы панель
       была поверх блоков страницы (с z-index 100 часть блоков «Обзора» рисовалась поверх неё) */
    body.sb-modern .sidebar {
        width: 0 !important;
        min-width: 0;
        padding: 0;
        border: 0;
        background: none;
        box-shadow: none;
        overflow: visible;
        pointer-events: none;
        z-index: 9980;
    }
    body.sb-modern .sidebar > :not(#notifPanel) {
        display: none !important;
    }
    body.sb-modern .sidebar #notifPanel {
        pointer-events: auto;
    }
    /* Панель уведомлений — шторка снизу (как окна сделки и задачи): «ручка», заголовок и закрыть,
       под ними список; затемнение #mobNotifBack ставит mobile.js (нажатие закрывает). Положение
       toggleNotifPanel() пишет инлайн — отсюда !important; закрытая панель — display:none из того же
       инлайна, поэтому показываем её только когда там display:block */
    body.sb-modern .sidebar #notifPanel {
        position: fixed !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: auto !important;
        max-height: 82vh;
        max-height: 82dvh;
        flex-direction: column;
        border-radius: 26px 26px 0 0 !important;
        background: #fff;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        box-shadow: 0 -14px 44px rgba(17, 18, 23, .2);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        overflow: hidden;
    }
    body.sb-modern .sidebar #notifPanel[style*="display: block"] {
        display: flex !important;
        animation: mobConfirmUp .28s cubic-bezier(.22, .61, .36, 1);
    }
    body.sb-modern .sidebar #notifPanel::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        width: 36px;
        height: 4px;
        margin-left: -18px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .14);
    }
    body.sb-modern .sidebar #notifPanel .notif-panel-head {
        flex: none;
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 22px 14px 10px 18px;
    }
    body.sb-modern .sidebar #notifPanel .notif-panel-title {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 17px;
    }
    body.sb-modern .sidebar #notifPanel .notif-panel-clear {
        flex: none;
        height: 34px;
        padding: 0 12px;
        border-radius: 999px;
    }
    body .mob-notif-x {
        display: grid;
        flex: none;
        width: 34px;
        height: 34px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: #f1f2ef;
        color: var(--mob-ink);
        display: grid;
        place-items: center;
        -webkit-tap-highlight-color: transparent;
    }
    .mob-notif-x svg {
        width: 15px;
        height: 15px;
    }
    body.sb-modern .sidebar #notifPanel .notif-panel-list {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 12px;
    }
    body #mobNotifBack {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 9970;
        background: rgba(15, 17, 23, .38);
        touch-action: none;
        animation: mobCalFade .2s ease both;
    }
    body #mobNotifBack[hidden] {
        display: none;
    }
    .sb-tooltip,
    .pv-tip-float {
        display: none !important;            /* подсказки по наведению мыши: на телефоне касание
                                                выдаётся за наведение, и над кнопками всплывали
                                                плашки, дублирующие меню («Открыта», «Назначить») */
    }

    /* Прокручивается сама страница, а не блок .main, как на компьютере (там html/body высотой
       в экран и .main с overflow). Только при прокрутке страницы iPhone прячет адресную строку
       и возвращает наверх касанием верхнего края экрана. overflow-x: clip — обрезает лишнее
       по ширине, не превращая .main в прокручиваемый блок. */
    html,
    body {
        height: auto;
    }
    body.sb-modern .main {
        overflow: visible;
        overflow-x: clip;
    }

    /* Контент — на всю ширину. !important: при открытой панели Pato Assistant
       отступ ставится инлайн (applyPushLayout() в dev_chat_widget.php) */
    body.sb-modern .main {
        margin-left: 0 !important;
        transition: none;
        padding-bottom: calc(var(--mob-nav-h) + var(--mob-nav-bottom) + 18px);
    }
    body.sb-modern .main > .page {
        padding-top: 14px;
    }

    /* Pato Assistant и календарь на телефоне — на своих этапах (5 и 4), пока скрыты */
    #paiFab,
    #paiGreetTeaser,
    .cal-tab {
        display: none !important;
    }

    /* Сообщения о действиях — пилюлей над нижним меню (оформление — блок «Сообщения о действиях»
       в конце файла) */
    .toast {
        bottom: calc(var(--mob-nav-h) + var(--mob-nav-bottom) + 14px);
    }
    .lead-notif-wrap {
        top: calc(env(safe-area-inset-top, 0px) + 10px);
        left: 10px;
        right: 10px;
    }
    .lead-notif {
        width: auto;
    }
    .ia-gwidget {
        right: 12px;
        bottom: calc(var(--mob-nav-h) + var(--mob-nav-bottom) + 12px);
    }

    /* ══ Верхняя строка ══ */
    .mob-top {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: calc(env(safe-area-inset-top, 0px) + var(--mob-edge)) var(--mob-edge) 0;
        padding: 6px 6px 6px 8px;
        min-height: var(--mob-top-h);
        box-sizing: border-box;
        border-radius: 22px;
        flex-shrink: 0;
        /* Закреплена сверху при прокрутке (просьба владельца 11.10.2026). sticky работает,
           потому что на телефоне прокручивается сама страница, а .main — overflow: visible */
        position: sticky;
        top: calc(env(safe-area-inset-top, 0px) + var(--mob-edge));
        z-index: 90;
    }
    /* Белая карточка строки — отдельным слоем (::after), чтобы под ней можно было
       положить подложку (::before): слои с отрицательным z-index рисуются поверх
       собственного фона элемента, поэтому фон у самой .mob-top прозрачный */
    .mob-top::after {
        content: '';
        position: absolute;
        z-index: -1;
        inset: 0;
        border-radius: inherit;
        background: #fff;
        box-shadow: var(--mob-card-shadow);
        pointer-events: none;
    }
    /* Подложка цвета фона от края экрана до низа строки и чуть ниже — прокручиваемая страница
       уходит под неё и не просвечивает ни над строкой, ни в щели под ней (там закреплённые
       вкладки кабинета: раньше подложка доходила до середины строки, и в щели мелькали блоки) */
    .mob-top::before {
        content: '';
        position: absolute;
        z-index: -2;
        left: calc(-1 * var(--mob-edge) - env(safe-area-inset-left, 0px));
        right: calc(-1 * var(--mob-edge) - env(safe-area-inset-right, 0px));
        top: calc(-1 * var(--mob-edge) - env(safe-area-inset-top, 0px));
        height: calc(var(--mob-edge) + env(safe-area-inset-top, 0px) + 100% + 6px);
        background: #efefee;
        pointer-events: none;
    }

    .mob-top-site {
        flex: 1;
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 2px 8px 2px 0;
        border: 0;
        background: none;
        text-align: left;
        color: var(--mob-ink);
        -webkit-tap-highlight-color: transparent;
    }
    .mob-top-logo {
        width: 40px;
        height: 40px;
        border-radius: 14px;
        flex-shrink: 0;
        filter: drop-shadow(0 6px 12px rgba(31, 90, 57, .12));
    }
    .mob-top-site-text {
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 1px;
    }
    .mob-top-site-cap {
        font-size: 10.5px;
        font-weight: 600;
        letter-spacing: .05em;
        text-transform: uppercase;
        color: var(--mob-muted);
    }
    .mob-top-site-name {
        font-family: 'Unbounded', sans-serif;
        font-size: 14px;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .mob-top-site-chev {
        flex-shrink: 0;
        color: var(--mob-muted);
        margin-left: -4px;
    }

    .mob-top-actions {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
    }
    .mob-top-btn,
    .mob-top-ava {
        position: relative;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        border: 0;
        display: grid;
        place-items: center;
        padding: 0;
        -webkit-tap-highlight-color: transparent;
        transition: transform .15s ease, background .15s ease;
    }
    .mob-top-btn {
        background: #f3f4f1;
        color: var(--mob-ink);
    }
    .mob-top-btn.active {
        background: var(--mob-green-soft);
        color: var(--mob-green-dark);
    }
    .mob-top-btn:active,
    .mob-top-ava:active {
        transform: scale(.94);
    }
    /* Счётчик — на краю кружка, вне содержимого: у календаря внутри день недели, его не закрываем */
    .mob-top-badge {
        position: absolute;
        top: -3px;
        right: -4px;
        min-width: 17px;
        height: 17px;
        padding: 0 4px;
        box-sizing: border-box;
        border-radius: 999px;
        background: linear-gradient(135deg, #5cc531 0%, #2f8a1c 100%);
        color: #fff;
        border: 2px solid #fff;
        font-size: 9.5px;
        font-weight: 700;
        line-height: 13px;
        align-items: center;
        justify-content: center;
    }
    .mob-top-ava {
        overflow: hidden;
        background: var(--mob-grad);
        color: #163414;
        font-family: 'Unbounded', sans-serif;
        font-size: 16px;
        font-weight: 700;
    }
    /* Открыт Личный кабинет — аватар в лаймовом кольце (вместо подсветки «Ещё» внизу) */
    .mob-top-ava.is-active {
        box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--mob-green);
    }
    .mob-top-ava img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    /* ══ Нижнее меню (13.10.2026, вторая версия) ══
       Стеклянная капсула: Обзор · Диалоги · Pato · CRM · Ещё. Выбранный раздел — лаймовая пилюля
       только под иконкой (подпись не подсвечивается, лишь темнеет). При переходе пилюля
       «перетекает»: сначала растягивается и соединяет старый и новый пункт, затем стягивается
       к новому (navIndSync() в mobile.js) */
    .mob-nav {
        position: fixed;
        left: calc(var(--mob-edge) + env(safe-area-inset-left, 0px));
        right: calc(var(--mob-edge) + env(safe-area-inset-right, 0px));
        bottom: var(--mob-nav-bottom);
        z-index: 95;                       /* ниже модалок и меню сайта (z-index от 100) — окна его закрывают */
        height: var(--mob-nav-h);
        box-sizing: border-box;
        display: flex;
        padding: 0;
        background: none;
    }
    .mob-nav-pill {
        position: relative;
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        align-items: stretch;
        padding: 6px;
        border-radius: 999px;
        background: linear-gradient(180deg, rgba(255, 255, 255, .9) 0%, rgba(250, 252, 248, .78) 100%);
        -webkit-backdrop-filter: blur(24px) saturate(1.8);
        backdrop-filter: blur(24px) saturate(1.8);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, .95),
            inset 0 -1px 0 rgba(255, 255, 255, .4),
            inset 0 0 0 1px rgba(255, 255, 255, .5),
            0 0 0 1px rgba(17, 18, 23, .06),
            0 18px 40px -14px rgba(17, 18, 23, .28),
            0 4px 12px -6px rgba(17, 18, 23, .12);
    }
    .mob-nav-ind {
        position: absolute;
        top: 0;
        left: 0;
        width: 54px;
        height: 32px;
        border-radius: 999px;
        background: var(--mob-grad);
        box-shadow: 0 6px 14px -4px rgba(125, 207, 70, .55), inset 0 1px 0 rgba(255, 255, 255, .55);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }
    .mob-nav-ind.is-on {
        opacity: 1;
    }
    .mob-nav-item {
        position: relative;
        z-index: 1;
        flex: 1 1 0;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 0;
        border: 0;
        background: none;
        color: var(--mob-ink-2);
        -webkit-tap-highlight-color: transparent;
    }
    .mob-nav-ic {
        position: relative;
        width: 54px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: transform .15s ease, color .2s ease;
    }
    .mob-nav-item:active .mob-nav-ic {
        transform: scale(.9);
    }
    .mob-nav-ic svg {
        width: 21px;
        height: 21px;
        stroke-width: 1.7;
    }
    .mob-nav-lbl {
        font-size: 10.5px;
        font-weight: 600;
        line-height: 1;
        color: var(--mob-muted);
        white-space: nowrap;
        transition: color .22s ease;
    }
    .mob-nav-item.is-active .mob-nav-ic {
        color: #173b14;
    }
    .mob-nav-item.is-active .mob-nav-lbl {
        color: var(--mob-ink);
        font-weight: 700;
    }
    .mob-nav-badge {
        position: absolute;
        top: -3px;
        right: 2px;
        min-width: 17px;
        height: 17px;
        padding: 0 4px;
        box-sizing: border-box;
        border-radius: 999px;
        background: linear-gradient(135deg, #5cc531 0%, #2f8a1c 100%);
        color: #fff;
        border: 2px solid #fff;
        font-size: 9.5px;
        font-weight: 700;
        line-height: 13px;
        text-align: center;
    }
    .mob-nav-dot {
        position: absolute;
        top: 3px;
        right: 9px;
        width: 9px;
        height: 9px;
        border-radius: 50%;
        background: linear-gradient(135deg, #5cc531 0%, #2f8a1c 100%);
        border: 2px solid #fff;
    }
    .mob-nav-badge[hidden],
    .mob-nav-dot[hidden] {
        display: none;
    }

    /* ══ Шторки («Ещё», «Сайты», «Аккаунт») ══ */
    .mob-sheets.is-shown {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 9990;                     /* под тостами (9999) и уведомлениями о заявках (10000) */
    }
    .mob-sheet-back {
        position: absolute;
        inset: 0;
        background: rgba(17, 18, 23, .34);
        opacity: 0;
        transition: opacity .28s ease;
    }
    .mob-sheets.is-open .mob-sheet-back {
        opacity: 1;
    }
    .mob-sheet {
        display: none;
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 88vh;
        max-height: 88dvh;
        flex-direction: column;
        background: #f4f4f2;
        border-radius: 28px 28px 0 0;
        box-shadow: 0 -18px 48px rgba(15, 17, 23, .16);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
        transform: translateY(100%);
        transition: transform .34s cubic-bezier(.22, .61, .36, 1);
        will-change: transform;
    }
    .mob-sheet.is-on {
        display: flex;
    }
    .mob-sheets.is-open .mob-sheet.is-on {
        transform: translateY(0);
    }
    .mob-sheet.is-dragging {
        transition: none;
    }
    .mob-sheet-grip {
        display: flex;
        justify-content: center;
        padding: 9px 0 2px;
        touch-action: none;
    }
    .mob-sheet-grip span {
        width: 40px;
        height: 5px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .16);
    }
    .mob-sheet-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 6px 14px 10px 20px;
        touch-action: none;
    }
    .mob-sheet-title {
        font-family: 'Unbounded', sans-serif;
        font-size: 19px;
        font-weight: 700;
        color: var(--mob-ink);
    }
    .mob-sheet-x {
        width: 38px;
        height: 38px;
        border-radius: 50%;
        border: 0;
        background: #fff;
        color: var(--mob-ink-2);
        display: grid;
        place-items: center;
        box-shadow: inset 0 0 0 1px rgba(31, 90, 57, .08);
        -webkit-tap-highlight-color: transparent;
    }
    .mob-sheet-body {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        padding: 2px 14px 18px;
    }

    .mob-group-label {
        margin: 12px 8px 8px;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: .07em;
        text-transform: uppercase;
        color: var(--mob-muted);
    }
    .mob-group:first-child .mob-group-label {
        margin-top: 4px;
    }
    .mob-group-card {
        background: #fff;
        border-radius: 20px;
        overflow: hidden;
        box-shadow: inset 0 0 0 1px rgba(31, 90, 57, .06);
        margin-bottom: 10px;
    }

    .mob-row {
        position: relative;
        width: 100%;
        min-height: 58px;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 9px 14px;
        border: 0;
        background: #fff;
        text-align: left;
        font-family: 'Onest', sans-serif;
        font-size: 15px;
        font-weight: 600;
        color: var(--mob-ink);
        -webkit-tap-highlight-color: transparent;
        transition: background .15s ease;
    }
    .mob-row + .mob-row::before {
        content: '';
        position: absolute;
        top: 0;
        left: 64px;
        right: 0;
        height: 1px;
        background: var(--mob-line);
    }
    .mob-row:active {
        background: #f3f8ee;
    }
    .mob-row.is-active .mob-row-ic {
        background: var(--mob-grad);
        color: #173b14;
    }
    .mob-row-ic,
    .mob-row-fav {
        width: 38px;
        height: 38px;
        border-radius: 12px;
        flex-shrink: 0;
        display: grid;
        place-items: center;
        background: #f3f4f1;
        color: var(--mob-ink-2);
    }
    .mob-row-ic svg {
        width: 19px;
        height: 19px;
    }
    .mob-row-ic--green,
    .mob-row-ic--plus {
        background: var(--mob-green-soft);
        color: var(--mob-green-dark);
    }
    .mob-row-ic--danger {
        background: #fdeeee;
        color: #dc2626;
    }
    .mob-row-fav {
        background: var(--mob-grad);
        color: #163414;
        font-family: 'Unbounded', sans-serif;
        font-size: 15px;
        font-weight: 700;
    }
    .mob-row-label {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .mob-row-sub {
        font-size: 12px;
        font-weight: 500;
        color: var(--mob-muted);
    }
    .mob-row-hint {
        flex-shrink: 0;
        padding: 4px 8px;
        border-radius: 999px;
        background: #f3f4f1;
        color: var(--mob-muted);
        font-size: 11px;
        font-weight: 600;
    }
    .mob-row-badge {
        flex-shrink: 0;
        min-width: 20px;
        height: 20px;
        padding: 0 6px;
        box-sizing: border-box;
        border-radius: 999px;
        background: linear-gradient(135deg, #5cc531 0%, #2f8a1c 100%);
        color: #fff;
        font-size: 11px;
        font-weight: 700;
        line-height: 20px;
        text-align: center;
    }
    .mob-row-badge[hidden] {
        display: none;
    }
    .mob-row-chev {
        flex-shrink: 0;
        color: #c3c6cd;
    }
    .mob-row-check {
        flex-shrink: 0;
        color: var(--mob-green-dark);
    }
    .mob-row--danger {
        color: #dc2626;
    }

    .mob-acc-head {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 4px 6px 14px;
    }
    .mob-acc-ava {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        overflow: hidden;
        flex-shrink: 0;
        display: grid;
        place-items: center;
        background: var(--mob-grad);
        color: #163414;
        font-family: 'Unbounded', sans-serif;
        font-size: 20px;
        font-weight: 700;
    }
    .mob-acc-ava img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    .mob-acc-text {
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .mob-acc-name {
        max-width: 100%;
        font-family: 'Unbounded', sans-serif;
        font-size: 16px;
        font-weight: 700;
        color: var(--mob-ink);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .mob-acc-plan {
        padding: 4px 10px;
        border-radius: 999px;
        background: var(--mob-green-soft);
        color: var(--mob-green-dark);
        font-size: 12px;
        font-weight: 700;
    }

    /* «Обзор»: колокольчик и аватар уже есть в верхней строке — второй раз не показываем */
    #page-home .hm-topbar .hm-notif-btn,
    #page-home .hm-topbar .hm-profile-btn {
        display: none;
    }

    /* ══ Раздел «удобнее на компьютере» ══
       mobile.js вставляет карточку первой в страницу и ставит класс mob-desk-on —
       остальное содержимое страницы скрыто, пока не нажмут «Всё равно открыть». */
    .page.mob-desk-on > :not(.mob-desk) {
        display: none !important;
    }
    /* У части таких страниц свои отступы (или их нет) — карточке нужны обычные */
    body.sb-modern .main > .page.mob-desk-on {
        padding: 14px var(--page-gutter) !important;
    }
    .mob-desk {
        display: none;
    }
    .page.mob-desk-on > .mob-desk {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin: 8px 0 0;
        padding: 30px 22px 22px;
        background: #fff;
        border-radius: 26px;
        box-shadow: var(--mob-card-shadow);
    }
    .mob-desk-ic {
        width: 68px;
        height: 68px;
        border-radius: 22px;
        display: grid;
        place-items: center;
        background: var(--mob-green-soft);
        color: var(--mob-green-dark);
        margin-bottom: 18px;
    }
    .mob-desk-title {
        font-family: 'Unbounded', sans-serif;
        font-size: 19px;
        font-weight: 700;
        line-height: 1.25;
        color: var(--mob-ink);
        margin-bottom: 10px;
    }
    .mob-desk-text {
        font-size: 14.5px;
        line-height: 1.5;
        color: #5b5f6b;
        margin-bottom: 22px;
        max-width: 320px;
    }
    .mob-desk-btn {
        width: 100%;
        height: 50px;
        border: 0;
        border-radius: 16px;
        background: var(--mob-ink);
        color: #fff;
        font-family: 'Onest', sans-serif;
        font-size: 15px;
        font-weight: 600;
        -webkit-tap-highlight-color: transparent;
    }
    .mob-desk-btn:active {
        transform: scale(.98);
    }
    .mob-desk-link {
        margin-top: 12px;
        padding: 8px 12px;
        border: 0;
        background: none;
        color: var(--mob-green-dark);
        font-family: 'Onest', sans-serif;
        font-size: 14px;
        font-weight: 600;
        -webkit-tap-highlight-color: transparent;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   «Диалоги» на телефоне (этап 2, 11.10.2026)
   Классы на <html> ставит assets/js/mobile.js (syncInbox()):
     mob-inbox — открыт раздел «Диалоги»: список бесед прокручивается вместе со страницей
                 и уходит под нижнее меню, как на всех страницах;
     mob-chat  — открыта беседа (.ibx-shell.is-detail): страница под ней стоит, карточка
                 беседы закреплена от верхней строки до низа экрана (нижнего меню нет),
                 прокручиваются только сообщения, поле ввода всегда внизу;
     mob-kb    — открыта клавиатура (по visualViewport).
   Одна колонка (список ИЛИ беседа) — правила @container ibxshell в inbox.css, тут не дублируем.
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    /* ── Список бесед — обычная прокрутка страницы, как на всех страницах (владелец 11.10.2026):
       блок «Диалогов» растёт по списку и уходит под нижнее меню ── */
    html.mob-inbox #page-inbox .ibx-wrap {
        height: auto;
        min-height: calc(100vh - var(--mob-top-h) - var(--mob-edge) - 24px);
    }
    html.mob-inbox #page-inbox .ibx-shell {
        flex: 1 0 auto;
    }
    html.mob-inbox #page-inbox .ibx-list-col {
        overflow: visible;
        border-radius: 22px;
    }
    html.mob-inbox #page-inbox .ibx-list-scroll {
        overflow: visible;
        flex: 1 0 auto;
        padding-bottom: 10px;
    }

    /* ── Настройки «Диалогов»: закреплённый экран между верхней строкой и нижним меню,
       прокручивается только раздел настроек (раньше — вместе со страницей, две прокрутки) ── */
    html.mob-iset #page-inbox .ibx-wrap {
        position: fixed;
        left: calc(var(--mob-edge) + env(safe-area-inset-left, 0px));
        right: calc(var(--mob-edge) + env(safe-area-inset-right, 0px));
        top: calc(env(safe-area-inset-top, 0px) + var(--mob-edge) + var(--mob-top-h) + 10px);
        bottom: calc(var(--mob-nav-bottom) + var(--mob-nav-h) + 10px);
        height: auto;
        min-height: 0;
    }
    html.mob-iset #page-inbox .ibx-settings-body {
        padding: 20px 16px 30px;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    /* ── Открытая беседа: страница под ней стоит (body закрепляет mobile.js — lockPage()) ── */
    html.mob-chat,
    html.mob-chat body,
    html.mob-iset,
    html.mob-iset body {
        overflow: hidden;
        overscroll-behavior: none;        /* без «потянуть, чтобы обновить» в Android */
    }
    /* Анимация появления страницы двигает её transform'ом — пока она идёт, закреплённый
       блок встаёт относительно страницы, а не экрана. Здесь она не нужна */
    html.mob-inbox #page-inbox {
        animation: none;
    }
    html.mob-chat #page-inbox .ibx-wrap,
    html.mob-iset #page-inbox .ibx-wrap {
        /* Закреплённый блок сам становится отдельным слоем (WebKit/Chrome) — всё внутри него
           (просмотр фото, окна) не поднимется выше его уровня. Ставим его над верхней строкой
           (z 90): с ней он не пересекается — начинается ниже, — зато просмотр фото внутри
           теперь поверх всего (раньше строка закрывала верх картинки и кнопку «закрыть») */
        z-index: 91;
    }
    html.mob-chat #page-inbox .ibx-wrap {
        position: fixed;
        left: calc(var(--mob-edge) + env(safe-area-inset-left, 0px));
        right: calc(var(--mob-edge) + env(safe-area-inset-right, 0px));
        top: calc(env(safe-area-inset-top, 0px) + var(--mob-edge) + var(--mob-top-h) + 10px);
        bottom: var(--mob-nav-bottom);
        height: auto;
        min-height: 0;
    }
    /* Правила списка выше (рост по содержимому) в беседе не нужны: карточка — по высоте
       экрана, внутри прокручиваются только сообщения */
    html.mob-chat #page-inbox .ibx-shell {
        flex: 1 1 auto;
        min-height: 0;
    }
    html.mob-chat #page-inbox .ibx-msgs {
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    /* Ручка «потянуть, чтобы увеличить поле» — для мыши; на телефоне поле растёт по тексту */
    html.mob-inbox #page-inbox .ibx-composer-resize-handle {
        display: none;
    }
    html.mob-inbox #page-inbox .ibx-editor {
        height: auto !important;          /* высота, оставшаяся от ручки на компьютере, — не нужна */
        max-height: min(160px, 26vh);
    }

    /* ── Открытая беседа ──
       Верхняя строка остаётся (без неё сверху «обрыв» — владелец 11.10.2026), нижнее меню
       уступает место полю ввода: карточка беседы тянется от строки до низа экрана. */
    html.mob-chat .mob-nav {
        display: none;
    }
    /* Страница под беседой закреплена со сдвигом на прокрутку списка (lockPage() в mobile.js) —
       строка «в потоке» уехала бы вместе с ней, поэтому на время беседы она закреплена сама */
    html.mob-chat .mob-top,
    html.mob-iset .mob-top {
        position: fixed;
        top: calc(env(safe-area-inset-top, 0px) + var(--mob-edge));
        left: calc(var(--mob-edge) + env(safe-area-inset-left, 0px));
        right: calc(var(--mob-edge) + env(safe-area-inset-right, 0px));
        margin: 0;
    }
    html.mob-chat #page-inbox .ibx-wrap {
        bottom: var(--mob-nav-bottom);
    }
    html.mob-chat #page-inbox .ibx-thread-col {
        border-radius: 22px;
    }
    /* Шапка беседы — в две строки: «←», аватар и имя целиком; ниже статус, ответственный
       и кнопки (в одну строку имени оставалось 56px — «Анна …») */
    html.mob-chat #page-inbox .ibx-thread-header {
        flex-wrap: wrap;
        row-gap: 8px;
        padding: 10px 10px 8px;
    }
    html.mob-chat #page-inbox .ibx-thread-header-left {
        flex: 1 1 100%;
        min-width: 0;
    }
    html.mob-chat #page-inbox .ibx-thread-header-right {
        flex: 1 1 100%;
        justify-content: flex-start;
        gap: 6px;
        min-width: 0;
    }
    html.mob-chat #page-inbox .ibx-thread-header-right .ibx-split-pill {
        margin-right: auto;
    }
    /* Стрелка справа в первой строке: сворачивает вторую (статус, ответственный, кнопки) —
       больше места сообщениям; кнопку добавляет mobile.js (initHdrToggle()) */
    html.mob-chat .mob-hdr-toggle {
        display: grid;
        place-items: center;
        flex-shrink: 0;
        width: 34px;
        height: 34px;
        margin-left: auto;
        order: 9;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: #f3f4f1;
        color: var(--mob-ink-2);
        -webkit-tap-highlight-color: transparent;
    }
    html.mob-chat .mob-hdr-toggle svg {
        transition: transform .22s ease;
    }
    html.mob-chat.mob-hdr-compact .mob-hdr-toggle svg {
        transform: rotate(180deg);
    }
    html.mob-chat #page-inbox .ibx-thread-header-left > div:last-child {
        flex: 1 1 auto;
        min-width: 0;
    }
    html.mob-chat.mob-hdr-compact #page-inbox .ibx-thread-header-right {
        display: none;
    }
    html.mob-chat.mob-hdr-compact #page-inbox .ibx-thread-header {
        padding-bottom: 10px;
    }

    /* Статус — с названием («Открыта», «Ожидание»…), во второй строке шапки место есть;
       ответственный — по-прежнему аватаром (в узкой шапке названия скрывает inbox.css) */
    html.mob-chat #page-inbox #ibxStatusDd .cdd-value {
        display: inline;
        white-space: nowrap;
    }
    html.mob-chat #page-inbox #ibxThName {
        font-size: 16px;
    }
    /* Кнопки шапки — 36px, плюсик «создать сделку» — аккуратным значком в нижнем правом углу */
    html.mob-chat #page-inbox .ibx-thread-header-right .ibx-contact-toggle-btn {
        width: 36px;
        height: 36px;
        position: relative;
    }
    html.mob-chat #page-inbox .ibx-deal-plus {
        width: 15px;
        height: 15px;
        right: -3px;
        bottom: -3px;
        border: 2px solid #fff;
        box-sizing: border-box;
    }
    html.mob-chat #page-inbox .ibx-deal-plus svg {
        width: 7px;
        height: 7px;
    }
    /* «Переписка / Customer Dashboard»: вторая вкладка — пока заглушка, на телефоне строку
       не показываем — сообщениям нужнее место */
    html.mob-chat #page-inbox .ibx-thread-tabs {
        display: none;
    }
    html.mob-chat #page-inbox #ibxViewDashboard {
        display: none !important;
    }
    html.mob-chat #page-inbox #ibxViewMessages {
        display: flex !important;
    }
    html.mob-chat #page-inbox .ibx-msgs {
        padding: 14px 12px;
    }
    html.mob-chat #page-inbox .ibx-composer {
        padding: 6px 8px 8px;
    }
    /* Поле ввода плотнее (было 150px высоты): «Ответ / Заметка» и «Aa» — ниже ростом,
       кнопка «развернуть поле» не нужна — беседа и так на весь экран */
    html.mob-chat #page-inbox .ibx-composer-box-top {
        padding: 6px 8px 0;
    }
    html.mob-chat #page-inbox .ibx-composer-tab {
        padding: 4px 11px;
    }
    html.mob-chat #page-inbox #ibxComposerExpandBtn {
        display: none;
    }
    html.mob-chat #page-inbox .ibx-editor {
        min-height: 36px;
        padding: 6px 12px;
    }
    html.mob-chat #page-inbox .ibx-composer-toolbar {
        padding: 2px 8px 6px 6px;
        gap: 6px;
    }
    html.mob-chat #page-inbox .ibx-composer-toolbar-left {
        gap: 4px;
    }

    /* Просмотр фото и файлов — поверх всего, в том числе верхней строки (раньше она закрывала
       верх картинки); картинка целиком в экране между кнопками сверху и лентой миниатюр снизу */
    html.mob-inbox #ibxLightbox {
        z-index: 9995;
        padding: calc(env(safe-area-inset-top, 0px) + 64px) 12px calc(env(safe-area-inset-bottom, 0px) + 16px);
    }
    html.mob-inbox #ibxLightbox .ibx-lightbox-bar {
        top: calc(env(safe-area-inset-top, 0px) + 12px);
        right: 12px;
    }
    html.mob-inbox #ibxLightbox .ibx-lightbox-body img,
    html.mob-inbox #ibxLightbox .ibx-lightbox-body video {
        max-width: 100%;
        max-height: calc(100vh - 100px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        max-height: calc(100dvh - 100px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        object-fit: contain;
    }
    html.mob-inbox #ibxLightbox.has-strip {
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 92px);
    }
    html.mob-inbox #ibxLightbox.has-strip .ibx-lightbox-body img,
    html.mob-inbox #ibxLightbox.has-strip .ibx-lightbox-body video {
        max-height: calc(100vh - 176px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        max-height: calc(100dvh - 176px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    }
    /* Жесты внутри просмотра обрабатывает mobile.js (initLightboxGestures) — браузеру не отдаём */
    html.mob-inbox #ibxLightbox {
        touch-action: none;
        overscroll-behavior: contain;
        background: rgba(8, 9, 12, .97);   /* как галерея телефона — страница не просвечивает */
    }
    html.mob-inbox #ibxLightbox .ibx-lightbox-body img {
        transform-origin: center center;
        will-change: transform;
        -webkit-user-select: none;
        user-select: none;
        -webkit-user-drag: none;
        -webkit-touch-callout: none;
    }
    html.mob-inbox #ibxLightbox .ibx-lightbox-strip {
        bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
        justify-content: flex-start;
    }

    /* «О беседе» — шторкой снизу поверх всего (справа на компьютере; на телефоне её заголовок
       с крестиком уходил под верхнюю строку). Правила — без условия html.mob-inbox: класс
       ставится уже после показа страницы, и панель на глазах «уезжала» из компьютерного положения
       в телефонное («при переходе из CRM в Диалоги будто закрывается какое-то окно»). Закрытая
       панель невидима (visibility) — её край не выглядывает из-под низа экрана */
    #ibxConvPanelDim {
        z-index: 9990;
    }
    #ibxConvPanel {
        z-index: 9991;
        top: auto;
        left: 0;
        right: 0 !important;
        bottom: 0;
        width: auto;
        max-height: 86vh;
        max-height: 86dvh;
        border-radius: 26px 26px 0 0;
        transform: translateY(105%);
        visibility: hidden;
        transition: transform .32s cubic-bezier(.22, .61, .36, 1), visibility 0s linear .32s;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    #ibxConvPanel.open {
        transform: translateY(0);
        visibility: visible;
        transition: transform .32s cubic-bezier(.22, .61, .36, 1), visibility 0s;
        box-shadow: 0 -18px 48px rgba(15, 17, 23, .18);
    }

    /* ── Открыта клавиатура ──
       Карточка беседы = видимая область над клавиатурой (--mob-vvt / --mob-vvh из visualViewport,
       считает mobile.js), на всю ширину, верхняя строка на это время уходит — иначе сообщениям
       почти не остаётся места. На iPhone карточка продлена под полупрозрачную плашку
       «вверх / вниз / готово» (--mob-kb-acc), поле ввода стоит над плашкой. */
    html.mob-chat.mob-kb .mob-top {
        visibility: hidden;
    }
    html.mob-chat.mob-kb #page-inbox .ibx-wrap {
        left: 0;
        right: 0;
        top: var(--mob-vvt, 0px);
        bottom: auto;
        height: var(--mob-vvh, 100%);
    }
    html.mob-chat.mob-kb #page-inbox .ibx-thread-col {
        border-radius: 0;
        border: 0;
        box-shadow: none;
    }
    html.mob-chat.mob-kb #page-inbox .ibx-composer {
        padding-bottom: calc(6px + var(--mob-kb-acc, 0px));
    }
}

/* ══════════════════════════════════════════════════════════════════════
   Личный кабинет на телефоне (этап 1, 11.10.2026)
   Главное для владельца с телефона — оплатить подписку и управлять командой.
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {

    /* ── Шапка: «Назад» не нужна (есть нижнее меню), заголовок в одну строку.
       Отступы над ней и под ней ужаты — до вкладок было 72px от верхней строки ── */
    body.sb-modern #page-profile {
        padding-top: 0;
    }
    body.sb-modern #page-profile .prx-shell {
        padding-top: 24px;                /* 12px — заголовок упирался в верхнюю строку */
    }
    body.sb-modern #page-profile .prx-topbar {
        gap: 10px;
        margin-bottom: 6px;
    }
    body.sb-modern #page-profile .prx-back-btn {
        display: none;
    }
    body.sb-modern #page-profile .prx-page-title {
        white-space: nowrap;
    }
    /* «Продлить подписку» в шапке на телефоне не показываем (владелец 11.10.2026): продление —
       во вкладке «Подписка» и в меню аккаунта («Подписка и оплата») */
    body.sb-modern #page-profile .prx-renew-btn {
        display: none;
    }

    /* ── Сначала вкладки и их содержимое. ID-карта — только на «Аккаунте» и после формы,
       блок «Команда» сбоку не показываем — для этого есть вкладка «Команда» ── */
    body.sb-modern #page-profile .prx-layout {
        display: flex;
        flex-direction: column;
        align-items: stretch;             /* на компьютере start — блоки брали ширину по содержимому */
        gap: 14px;
    }
    /* Порядок «вкладки → ID-карта → содержимое» (владелец: на «Аккаунте» сначала карточка,
       потом поля): .prx-main раскрыта (display: contents), её строка вкладок и содержимое
       становятся соседями ID-карты в общей колонке */
    body.sb-modern #page-profile .prx-main {
        display: contents;
    }
    body.sb-modern #page-profile .prx-tabbar {
        order: 0;
    }
    body.sb-modern #page-profile .prx-aside {
        display: none;
        order: 1;
    }
    body.sb-modern #page-profile .prx-content {
        order: 2;
        min-width: 0;
    }
    body.sb-modern #page-profile:has(#ptab-account.active) .prx-aside {
        display: block;
    }
    body.sb-modern #page-profile #tm-card-aside {
        display: none;
    }
    /* ID-карта: на компьютере фото 290×280; на телефоне карта шире (≈360px) при той же высоте —
       фото сильно обрезалось. Здесь кадр квадратный — фото видно целиком, лицо не срезается */
    body.sb-modern #page-profile .prx-idc-photo-section {
        height: auto;
        aspect-ratio: 1 / 1;
    }
    body.sb-modern #page-profile .prx-idc-bg-photo {
        object-position: center 20%;
    }

    /* ── Вкладки закреплены под верхней строкой; выбранную mobile.js держит в видимой части ── */
    body.sb-modern #page-profile .prx-tabbar {
        position: sticky;
        top: calc(env(safe-area-inset-top, 0px) + var(--mob-edge) + var(--mob-top-h) + 4px);
        z-index: 20;
        margin: 0 calc(-1 * var(--page-gutter));
        padding: 6px var(--page-gutter);
        background: #efefee;
        scroll-padding-inline: var(--page-gutter);
    }

    /* ── Аккаунт: кнопки «Изменить фото» / «Сохранить» — под заголовком, на всю ширину ── */
    body.sb-modern #page-profile .pacc-form-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    body.sb-modern #page-profile .pacc-form-actions {
        display: flex;
        gap: 8px;
    }
    body.sb-modern #page-profile .pacc-form-actions > * {
        flex: 1 1 0;
        justify-content: center;
    }

    /* ── Подписка ── */
    /* Карточка текущей подписки — одним цельным блоком (владелец 11.10.2026: столбик плашек
       выглядел плохо). Сверху «Ваш тариф», название крупно, цена; «Продление» и «Осталось» —
       две ячейки рядом; «Продлить сейчас» — на всю ширину; «Отменить» — тихой ссылкой внизу.
       Разметка та же (subscription.php), раскладка — сеткой с областями. */
    body.sb-modern #page-profile .pcard-sub-summary .sub-compact-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "cap    cap"
            "plan   plan"
            "price  price"
            "m1     m2"
            "renew  renew"
            "cancel cancel";
        gap: 0;
        padding: 20px 18px 14px;
        align-items: start;
    }
    body.sb-modern #page-profile .pcard-sub-summary .sub-compact-row::before {
        content: 'Ваш тариф';
        grid-area: cap;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: .07em;
        text-transform: uppercase;
        color: var(--mob-muted);
        margin-bottom: 6px;
    }
    body.sb-modern #page-profile .pcard-sub-summary .sub-vsep,
    body.sb-modern #page-profile .pcard-sub-summary .sub-spacer {
        display: none;
    }
    body.sb-modern #page-profile .pcard-sub-summary .sub-plan-badge {
        grid-area: plan;
        justify-self: start;
        gap: 10px;
        padding: 0;
        background: none;
        color: var(--mob-ink);
        font-size: 22px;
        font-weight: 700;
        line-height: 1.2;
        white-space: normal;
    }
    body.sb-modern #page-profile .pcard-sub-summary .sub-plan-dot {
        width: 9px;
        height: 9px;
        background: #7dcf46;
        box-shadow: 0 0 0 4px rgba(125, 207, 70, .18);
    }
    body.sb-modern #page-profile .pcard-sub-summary .sub-meta {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        margin: 0;
        padding: 0;
        background: none;
        border: 0;
        border-radius: 0;
        min-width: 0;
    }
    /* Ячейки — по порядку после названия (между ними в разметке разделители .sub-vsep,
       поэтому не :nth-of-type): 1 — «Продление», 2 — «Осталось», 3 — «Стоимость».
       Цена — под названием, без подписи */
    body.sb-modern #page-profile .pcard-sub-summary .sub-plan-badge + .sub-vsep + .sub-meta + .sub-vsep + .sub-meta + .sub-vsep + .sub-meta {
        grid-area: price;
        margin: 4px 0 16px 19px;
    }
    body.sb-modern #page-profile .pcard-sub-summary .sub-plan-badge + .sub-vsep + .sub-meta + .sub-vsep + .sub-meta + .sub-vsep + .sub-meta .sub-meta-lbl {
        display: none;
    }
    body.sb-modern #page-profile .pcard-sub-summary .sub-plan-badge + .sub-vsep + .sub-meta + .sub-vsep + .sub-meta + .sub-vsep + .sub-meta .sub-meta-val {
        font-size: 15px;
        font-weight: 600;
        color: #5b5f6b;
    }
    /* «Продление» и «Осталось» — две ячейки в одной светлой плашке */
    body.sb-modern #page-profile .pcard-sub-summary .sub-plan-badge + .sub-vsep + .sub-meta,
    body.sb-modern #page-profile .pcard-sub-summary .sub-plan-badge + .sub-vsep + .sub-meta + .sub-vsep + .sub-meta {
        background: #f4f5f2;
        padding: 12px 14px;
    }
    body.sb-modern #page-profile .pcard-sub-summary .sub-plan-badge + .sub-vsep + .sub-meta {
        grid-area: m1;
        border-radius: 16px 0 0 16px;
    }
    body.sb-modern #page-profile .pcard-sub-summary .sub-plan-badge + .sub-vsep + .sub-meta + .sub-vsep + .sub-meta {
        grid-area: m2;
        border-radius: 0 16px 16px 0;
        box-shadow: inset 1px 0 0 rgba(17, 18, 23, .07);
    }
    body.sb-modern #page-profile .pcard-sub-summary .sub-meta-lbl {
        font-size: 10.5px;
        font-weight: 700;
        letter-spacing: .06em;
        text-transform: uppercase;
        color: var(--mob-muted);
    }
    body.sb-modern #page-profile .pcard-sub-summary .sub-meta-val {
        font-size: 15px;
        font-weight: 700;
        color: var(--mob-ink);
        white-space: nowrap;
    }
    body.sb-modern #page-profile .pcard-sub-summary .sub-renew-btn,
    body.sb-modern #page-profile .pcard-sub-summary .chip-red {
        grid-area: renew;
        justify-self: stretch;
        justify-content: center;
        margin-top: 14px;
    }
    body.sb-modern #page-profile .pcard-sub-summary .sub-renew-btn {
        height: 50px;
        border-radius: 16px;
        font-size: 15px;
        font-weight: 700;
    }
    body.sb-modern #page-profile .pcard-sub-summary .sub-cancel-btn {
        grid-area: cancel;
        justify-self: center;
        margin-top: 6px;
        padding: 10px 14px;
        background: none;
        border: 0;
        color: var(--mob-muted);
        font-size: 13px;
        font-weight: 600;
    }
    /* Если «Продлить сейчас» нет (не привязана карта), «Отменить» встаёт сразу под ячейки */
    body.sb-modern #page-profile .pcard-sub-summary .sub-cancel-btn:last-child {
        margin-top: 10px;
    }
    /* Текущий тариф — первым, ниже — на что можно перейти */
    body.sb-modern #page-profile .plans-grid .plan-box-current {
        order: -1;
    }
    /* Длинный список возможностей тарифа свёрнут до 4 пунктов (кнопку «Все возможности»
       добавляет mobile.js) */
    body.sb-modern #page-profile .plan-box-features.mob-pbf-short > .pbf:nth-child(n+5) {
        display: none;
    }
    body.sb-modern #page-profile .plan-box-features-wrap {
        height: auto !important;
        max-height: none !important;
    }
    .mob-pbf-more {
        display: inline-flex;
        align-self: flex-start;
        margin: 2px 0 12px;
        padding: 8px 14px;
        border: 0;
        border-radius: 999px;
        background: rgba(17, 18, 23, .06);
        color: var(--mob-ink);
        font-family: 'Onest', sans-serif;
        font-size: 13px;
        font-weight: 700;
        -webkit-tap-highlight-color: transparent;
    }
    /* Карты оплаты — по ширине карточки (раньше вылезали за правый край) */
    body.sb-modern #page-profile .pwallet-layout {
        grid-template-columns: minmax(0, 1fr);
    }
    body.sb-modern #page-profile .pwallet-left,
    body.sb-modern #page-profile .wstack,
    body.sb-modern #page-profile .wstack-card,
    body.sb-modern #page-profile .wstack-placeholder {
        width: auto;
        max-width: 100%;
        min-width: 0;
    }
    body.sb-modern #page-profile .pwallet-right:empty {
        display: none;
    }
    /* Окно оплаты — не выше экрана, прокручивается внутри */
    #modal-plan > div {
        max-height: calc(100vh - 32px);
        max-height: calc(100dvh - 32px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    /* ── Безопасность: сверху статус со значком, ниже «Активных сессий» и «Последний вход» —
       две ячейки рядом (раньше значения слипались в одну строку: «Защищён—») ── */
    body.sb-modern #page-profile .sec-overview {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        padding: 16px;
        align-items: stretch;
    }
    body.sb-modern #page-profile .sec-ov-sep {
        display: none;
    }
    body.sb-modern #page-profile .sec-ov-item {
        min-width: 0;
        margin: 0;
    }
    body.sb-modern #page-profile .sec-ov-item:first-child {
        grid-column: 1 / -1;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 2px 2px 4px;
    }
    body.sb-modern #page-profile .sec-ov-item:not(:first-child) {
        background: #f4f5f2;
        border-radius: 16px;
        padding: 12px 14px;
    }
    body.sb-modern #page-profile .sec-ov-copy {
        display: flex;
        flex-direction: column;
        gap: 4px;
        min-width: 0;
    }
    body.sb-modern #page-profile .sec-ov-item:not(:first-child) .sec-ov-val {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* ── Мои проекты: компактная строка (владелец 11.10.2026: «зачем такие большие кнопки») ──
       значок · адрес, под ним статус и дата анализа · справа две круглые кнопки-значки
       «открыть» и «удалить». Статус — не плашкой, а цветной точкой с текстом; у не
       подтверждённого — «Подтвердить ›» (нажатие открывает подтверждение, как раньше) */
    body.sb-modern #page-profile .site-item {
        position: static;
        display: grid;
        grid-template-columns: 42px minmax(0, 1fr) 84px;
        grid-template-areas:
            "fav name act"
            "fav st   act"
            "fav meta act";
        column-gap: 12px;
        row-gap: 2px;
        align-items: center;
        padding: 12px 10px 12px 12px;
        background: #fff;
        border: 1px solid rgba(17, 18, 23, .07);
        border-radius: 18px;
        box-shadow: none;
    }
    body.sb-modern #page-profile .site-item > .site-item-fav {
        position: static;
        grid-area: fav;
        width: 42px;
        height: 42px;
        border-radius: 13px;
        align-self: center;
    }
    body.sb-modern #page-profile .site-item > .site-item-info {
        display: contents;
    }
    body.sb-modern #page-profile .site-item-name {
        grid-area: name;
        font-size: 15px;
        font-weight: 700;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    body.sb-modern #page-profile .site-item-meta {
        grid-area: meta;
        font-size: 12px;
        color: #8d919d;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    body.sb-modern #page-profile .site-item > [class*="chip"] {
        grid-area: st;
        justify-self: start;
        max-width: 100%;
        overflow: hidden;
        white-space: nowrap;
        margin: 0;
        padding: 0;
        background: none;
        border: 0;
        box-shadow: none;
        font-size: 12.5px;
        font-weight: 700;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }
    body.sb-modern #page-profile .site-item > .chip-green {
        color: #2f7d16;
        font-size: 0;                     /* «● Активен» → точка + «Подтверждён» */
    }
    body.sb-modern #page-profile .site-item > .chip-green::before {
        content: '';
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: #4caf3a;
    }
    body.sb-modern #page-profile .site-item > .chip-green::after {
        content: 'Подтверждён';
        font-size: 12.5px;
    }
    body.sb-modern #page-profile .site-item > .chip-orange {
        color: #b45309;
        cursor: pointer;
    }
    body.sb-modern #page-profile .site-item > .chip-orange::before {
        content: '';
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: #f59e0b;
    }
    body.sb-modern #page-profile .site-item > .chip-orange::after {
        content: '›';                     /* нажатие открывает подтверждение домена */
        font-size: 15px;
        line-height: 1;
        margin-left: -2px;
    }
    body.sb-modern #page-profile .site-item > .chip-neutral {
        color: #8d919d;
    }
    /* Кнопки — круглые значки 38px справа: «Открыть» (стрелка) и «Удалить» (корзина) */
    body.sb-modern #page-profile .site-item-active > button.btn {
        grid-area: act;
        width: 38px;
        height: 38px;
        min-width: 0;
        padding: 0;
        margin: 0;
        border: 0;
        border-radius: 50%;
        background: #f3f4f1 no-repeat center / 18px 18px;
        font-size: 0;
        color: transparent;
        justify-self: end;
    }
    body.sb-modern #page-profile .site-item-active > button.btn:nth-of-type(1) {
        margin-right: 46px;               /* две кнопки в одной ячейке — «открыть» левее */
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111217' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17L17 7'/%3E%3Cpath d='M8 7h9v9'/%3E%3C/svg%3E");
    }
    body.sb-modern #page-profile .site-item-active > button.btn:nth-of-type(2) {
        background-color: #fdeeee;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dc2626' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4h8v2'/%3E%3Cpath d='M19 6l-1 14H6L5 6'/%3E%3C/svg%3E");
    }
    /* Свободный слот: «Добавить» — небольшая кнопка справа */
    body.sb-modern #page-profile .site-item:not(.site-item-active) > button.btn {
        grid-area: act;
        height: 34px;
        padding: 0 14px;
        margin: 0;
        border-radius: 999px;
        font-size: 13px;
    }

    /* ── Команда ── */
    /* Карточка ссылки — столбиком; адрес по ширине карточки с многоточием, а не за краем */
    body.sb-modern #page-profile .ttab-link-info {
        align-self: stretch;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    body.sb-modern #page-profile .ttab-link-url {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    /* «Поделиться» (добавляет mobile.js, если телефон умеет) — главная, «Копировать» — рядом светлая */
    body.sb-modern #page-profile .ttab-link-btn.mob-share-btn {
        display: inline-flex;
    }
    body.sb-modern #page-profile .ttab-link-actions {
        flex-wrap: nowrap;
    }
    /* «Обновить ссылку» нажимают редко — круглая кнопка со значком */
    body.sb-modern #page-profile #ttab-refresh-btn {
        font-size: 0;
        gap: 0;
        width: 36px;
        padding: 0;
        justify-content: center;
        flex-shrink: 0;
    }
    body.sb-modern #page-profile .ttab-link-btn--copy.mob-copy-secondary {
        background: rgba(17, 18, 23, .07);
        color: var(--mob-ink);
    }

    /* Участник: аватар · имя и почта · «⋮»; ниже — должность и когда был в сети */
    body.sb-modern #page-profile .ttab-member {
        grid-template-columns: 40px auto minmax(0, 1fr) auto;
        grid-template-areas:
            "av info info act"
            "av role st   act";
        column-gap: 10px;
        row-gap: 6px;
        align-items: center;
    }
    body.sb-modern #page-profile .ttab-member > .ttab-av { grid-area: av; align-self: start; }
    body.sb-modern #page-profile .ttab-member > .ttab-member-info { grid-area: info; min-width: 0; }
    body.sb-modern #page-profile .ttab-member > .ttab-member-role { grid-area: role; }
    body.sb-modern #page-profile .ttab-member > .ttab-member-status { grid-area: st; justify-self: start; }
    body.sb-modern #page-profile .ttab-member > .ttab-member-actions { grid-area: act; }
    body.sb-modern #page-profile .ttab-member-email {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    /* «Должности и права»: вместо широкой таблицы — выбор должности сверху и список
       «раздел — уровень» под ним (строит mobile.js из той же таблицы — initRolesMobile()) */
    body.sb-modern #page-profile .ttab-roles-wrap.mob-roles-done {
        display: none;
    }
    body.sb-modern #page-profile .mob-roles {
        display: block;
        padding: 2px 16px 12px;
    }
    .mob-roles-chips {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        scrollbar-width: none;
        margin: 0 -16px;
        padding: 2px 16px 12px;
    }
    .mob-roles-chips::-webkit-scrollbar {
        display: none;
    }
    .mob-roles-chip {
        flex: 0 0 auto;
        padding: 9px 14px;
        border: 0;
        border-radius: 999px;
        background: #f3f4f1;
        color: var(--mob-ink-2);
        font-family: 'Onest', sans-serif;
        font-size: 13px;
        font-weight: 600;
        -webkit-tap-highlight-color: transparent;
        transition: background .15s, color .15s;
    }
    .mob-roles-chip.is-active {
        background: var(--mob-ink);
        color: #fff;
    }
    .mob-roles-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        min-height: 46px;
        padding: 8px 0;
        border-bottom: 1px solid var(--mob-line);
    }
    .mob-roles-row:last-child {
        border-bottom: 0;
    }
    .mob-roles-name {
        min-width: 0;
        font-size: 14px;
        font-weight: 600;
        color: var(--mob-ink);
        line-height: 1.3;
    }
    .mob-roles-val {
        flex-shrink: 0;
    }

    /* Таблица прав листается вбок, название раздела закреплено слева
       (запасной вид — если список выше не построился) */
    body.sb-modern #page-profile .ttab-roles-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    body.sb-modern #page-profile .ttab-roles-table th:first-child,
    body.sb-modern #page-profile .ttab-roles-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 1;
        background: #fff;
        min-width: 130px;
        box-shadow: 8px 0 10px -8px rgba(17, 18, 23, .12);
    }

    /* ── Окно «Права доступа» участника — шторкой снизу на всю ширину ── */
    body.sb-modern .tperm-modal-bg--open {
        align-items: flex-end;
    }
    body.sb-modern .tperm-modal {
        width: 100%;
        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);
        border-radius: 26px 26px 0 0;
        border-bottom: 0;
        overscroll-behavior: contain;
    }
    body.sb-modern .tperm-presets-wrap {
        padding: 14px 18px 0;
    }
    /* Шаблоны — карточки листаются вбок, а не сжимаются в три узких столбика */
    body.sb-modern .tperm-presets {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        margin: 0 -18px;
        padding: 0 18px 4px;
        scroll-padding-inline: 18px;
    }
    body.sb-modern .tperm-presets::-webkit-scrollbar {
        display: none;
    }
    body.sb-modern .tperm-preset-card {
        flex: 0 0 232px;
        scroll-snap-align: start;
    }
    body.sb-modern .tperm-hint {
        padding-left: 18px;
        padding-right: 18px;
    }
    body.sb-modern .tperm-list {
        padding-left: 18px;
        padding-right: 18px;
    }
    /* Заголовок группы: стрелка · название · «4 из 4» в одну строку, «всей группе» — второй строкой */
    body.sb-modern .tperm-group-head {
        flex-wrap: wrap;
        row-gap: 8px;
        padding: 12px 14px;
    }
    body.sb-modern .tperm-group-title {
        font-size: 14px;
    }
    body.sb-modern .tperm-group-count {
        white-space: nowrap;
        flex-shrink: 0;
    }
    body.sb-modern .tperm-bulk {
        flex-basis: 100%;
        margin-left: 22px;
        align-items: center;
        gap: 4px;
        opacity: 1;
    }
    body.sb-modern .tperm-bulk::before {
        content: 'Всей группе:';
        font-size: 12px;
        font-weight: 600;
        color: var(--mob-muted);
        margin-right: 4px;
    }
    body.sb-modern .tperm-bulk-btn {
        padding: 6px 11px;
        background: #fff;
        font-size: 12px;
        color: var(--mob-ink-2);
        box-shadow: inset 0 0 0 1px rgba(17, 18, 23, .08);
    }
    body.sb-modern .tperm-row-label {
        min-width: 0;
    }
    /* «Сохранить» всегда на виду — закреплено внизу шторки, во всю ширину; отступ под «полоской»
       iPhone один раз (у шторки его больше нет), поэтому кнопка у самого низа */
    body.sb-modern .tperm-modal {
        padding-bottom: 0 !important;
    }
    body.sb-modern .tperm-foot {
        position: sticky;
        bottom: 0;
        z-index: 2;
        display: flex;
        gap: 8px;
        background: rgba(255, 255, 255, .96);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
        border-top: 1px solid rgba(17, 18, 23, .06);
        box-shadow: none;
        padding: 10px 16px max(10px, calc(env(safe-area-inset-bottom, 0px) - 8px));
    }
    body.sb-modern .tperm-foot .tperm-save-btn {
        flex: 1 1 auto;
        height: 46px;
        border-radius: 15px;
        font-size: 15px;
    }
    body.sb-modern .tperm-foot .tperm-reset-btn {
        flex: 0 0 auto;
        max-width: 45%;
        font-size: 12.5px;
        line-height: 1.25;
        text-align: left;
    }
    /* Строки разделов плотнее: название слева, переключатель «Полный · Чтение · Нет» компактнее */
    body.sb-modern .tperm-row {
        padding: 9px 0;
        gap: 10px;
    }
    body.sb-modern .tperm-row-label {
        font-size: 14px;
    }
    body.sb-modern .tperm-seg {
        padding: 3px;
        border-radius: 12px;
        flex-shrink: 0;
    }
    body.sb-modern .tperm-seg-btn {
        padding: 6px 9px;
        font-size: 12px;
        border-radius: 9px;
    }

    /* Окно «Пригласить в команду» — шторкой снизу во всю ширину (по центру его верх
       срезался), прокручивается внутри, «Отправить» внизу */
    body.sb-modern .tm-modal-bg--open {
        align-items: flex-end;
        padding: 0;
    }
    /* Селектор не слабее правила кабинета (body.sb-modern .tm-modal-bg .tm-invite-modal —
       скругление всех углов и высота от 100vh: на iPhone 100vh выше видимой части, верх
       окна срезался). То же для окна подтверждения домена */
    body.sb-modern .tm-modal-bg .tm-invite-modal,
    body.sb-modern .tm-modal-bg .tm-invite-modal--v2,
    body.sb-modern .tm-modal-bg .tm-verify-modal {
        width: 100% !important;
        max-width: none;
        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);
        border: 0;
        border-radius: 26px 26px 0 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        animation: mobSheetUp .28s cubic-bezier(.22, .61, .36, 1);
    }
    /* Окно приглашения изнутри: шапка и вкладки «По email / Ссылка» — закреплены сверху,
       кнопки — снизу, прокручивается только середина, одной прокруткой (список проектов
       больше не прокручивается отдельно внутри окна) */
    body.sb-modern .tm-modal-bg .tm-invite-modal {
        display: flex !important;
        flex-direction: column;
        overflow: hidden;
    }
    body.sb-modern .tm-invite-modal > .tm-modal-head,
    body.sb-modern .tm-invite-modal > .tm-modal-tabs {
        flex: none;
    }
    body.sb-modern .tm-invite-modal > .tm-modal-panel:not(.tm-modal-panel--hidden) {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
    }
    body.sb-modern .tm-invite-modal .tm-modal-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    body.sb-modern .tm-invite-modal .tm-site-list {
        max-height: none;
        overflow: visible;
    }
    body.sb-modern .tm-invite-modal .tm-modal-foot {
        flex: none;
        background: #fff;
        padding-bottom: max(12px, calc(env(safe-area-inset-bottom, 0px) - 6px));
    }
    /* «Ссылка»: внизу была одна кнопка «Закрыть» — закрывает и крестик в шапке */
    body.sb-modern #tm-panel-link .tm-modal-foot {
        display: none;
    }
    body.sb-modern .tm-modal-bg .tm-invite-modal {
        padding-bottom: 0;
    }

    /* Меню «Сменить роль / Удалить из команды» у участника и выбор ответственных за блок —
       шторкой снизу с затемнением (mobile.js — cddBackSync()). Раньше меню висело у кнопки
       и не закрывалось, если следом открыть окно прав */
    body.sb-modern .ttab-ctx-menu {
        position: fixed !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: auto !important;
        min-width: 0;
        max-height: 70vh;
        max-height: 70dvh;
        overflow-y: auto;
        z-index: 99991;
        border: 0;
        border-radius: 24px 24px 0 0;
        padding: 12px 10px calc(14px + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -16px 44px rgba(15, 17, 23, .18);
        transform: translateY(100%);
        transition: transform .26s cubic-bezier(.22, .61, .36, 1), opacity .2s;
    }
    body.sb-modern .ttab-ctx-menu.ttab-ctx-menu--open {
        transform: translateY(0);
    }
    body.sb-modern .ttab-ctx-menu .ttab-ctx-role-item,
    body.sb-modern .ttab-ctx-menu .ttab-ctx-item,
    body.sb-modern .ttab-ctx-menu button {
        min-height: 48px;
        font-size: 15px;
    }

}

/* ══════════════════════════════════════════════════════════════════════
   CRM на телефоне (этап 3, 11.10.2026)
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {

    /* ── Шапка CRM — одна строка (владелец: «выглядит очень загруженно»): слева название вида,
       оно же переключатель («Воронка ▾» → шторка «Воронка · Регулярные · Отложенные · Аналитика»,
       mobile.js — initCrmViewSwitch()), справа поиск, фильтр, «⋯», «+». Заголовка «CRM» (раздел
       и так подсвечен в нижнем меню) и строки вкладок нет; «свернуть / показать цифры» — пунктом
       в «⋯» (он там и в узкой шапке на компьютере). Раньше было три строки: «CRM» с кнопками,
       вкладки со стрелкой, этапы ── */
    body.sb-modern #page-manager .crm-header {
        padding-top: 14px;
    }
    body.sb-modern #page-manager .crm-header-row--merged {
        flex-wrap: nowrap;
        column-gap: 6px;
    }
    body.sb-modern #page-manager .crm-header-left,
    body.sb-modern #page-manager .crm-header-right {
        display: contents;
    }
    body.sb-modern #page-manager .crm-page-title,
    body.sb-modern #page-manager #crmTabsBar,
    body.sb-modern #page-manager #crmStatsToggle {
        display: none !important;
    }
    body.sb-modern #page-manager .mob-crm-view {
        order: 1;
        flex: 0 1 auto;
        min-width: 0;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        height: 42px;
        margin: 0 auto 0 0;
        padding: 0;
        border: 0;
        background: none;
        color: var(--mob-ink);
        font-family: 'Unbounded', sans-serif;
        font-size: 18px;                  /* «Отложенные» и «Регулярные» целиком рядом с четырьмя кнопками */
        font-weight: 600;
        letter-spacing: -.02em;
        -webkit-tap-highlight-color: transparent;
    }
    body.sb-modern #page-manager .mob-crm-view-lbl {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    body.sb-modern #page-manager .mob-crm-view-n {
        flex: none;
        min-width: 22px;
        height: 22px;
        padding: 0 6px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .08);
        font-family: 'Onest', sans-serif;
        font-size: 12px;
        font-weight: 700;
        line-height: 22px;
        text-align: center;
        letter-spacing: 0;
    }
    body.sb-modern #page-manager .mob-crm-view-n:empty {
        display: none;
    }
    body.sb-modern #page-manager .mob-crm-view svg {
        flex: none;
        width: 26px;
        height: 26px;
        padding: 5px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 1px 2px rgba(17, 18, 23, .08);
    }
    @media (max-width: 380px) {
        body.sb-modern #page-manager .mob-crm-view {
            gap: 4px;
            font-size: 16px;
        }
        body.sb-modern #page-manager .mob-crm-view svg {
            width: 22px;
            height: 22px;
            padding: 4px;
        }
    }
    body.sb-modern #page-manager #crm-pipeline-search {
        order: 2;
    }
    body.sb-modern #page-manager .crm-header-right .crm-nav-actions {
        order: 3;
    }
    body.sb-modern #page-manager #crm-header-btn {
        order: 4;
    }
    /* Поиск открыт — название вида на время прячется, поле встаёт на его место в той же строке */
    body.sb-modern #page-manager .crm-header-row--merged:has(#crm-pipeline-search.is-open) .mob-crm-view {
        display: none;
    }
    /* Поле занимает только оставшееся место строки (основа 0): с основой «по содержимому»
       (220px из правил узкой шапки) на телефонах уже 390px оно выталкивало «+» на следующую строку */
    body.sb-modern #page-manager #crm-pipeline-search.is-open {
        flex: 1 1 0% !important;
        min-width: 0 !important;
        width: auto !important;
        max-width: none !important;
        margin-left: 0;
    }
    /* Шторка выбора вида: число у «Отложенных» */
    .mob-row-n {
        flex: none;
        min-width: 24px;
        height: 24px;
        padding: 0 7px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .07);
        font-size: 12.5px;
        font-weight: 700;
        line-height: 24px;
        text-align: center;
        color: var(--mob-ink);
    }
    .mob-row-n:empty {
        display: none;
    }

    /* ── Воронка: строка этапов (добавляет mobile.js — initCrmStages()) и сделки
       выбранного этапа одной колонкой; прокручивается страница ── */
    body.sb-modern #page-manager .mob-stage-bar {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        scrollbar-width: none;
        position: sticky;
        top: calc(env(safe-area-inset-top, 0px) + var(--mob-edge) + var(--mob-top-h) + 4px);
        z-index: 20;
        margin: 0;                        /* у вида CRM нет общего бокового отступа — строка и так во всю ширину */
        padding: 8px var(--page-gutter) 10px;
        background: #efefee;
        scroll-padding-inline: var(--page-gutter);
    }
    body.sb-modern #page-manager .mob-stage-bar::-webkit-scrollbar {
        display: none;
    }
    /* Размеры — как у фильтра «Все / Нужно сделать / Выполнено» на «Регулярных»
       (.crm-rc-tab: 7×14px, шрифт 12px, число в кружке 18px) — владелец 11.10.2026 */
    .mob-stage-chip {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        height: 32px;
        padding: 0 10px 0 13px;
        border: 0;
        border-radius: 999px;
        background: #fff;
        box-shadow: inset 0 0 0 1px rgba(17, 18, 23, .07);
        color: #666d79;
        font-family: 'Onest', sans-serif;
        font-size: 12px;
        font-weight: 800;
        white-space: nowrap;
        -webkit-tap-highlight-color: transparent;
        transition: background .15s, color .15s;
    }
    .mob-stage-chip i {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        flex-shrink: 0;
    }
    .mob-stage-chip b {
        min-width: 18px;
        height: 18px;
        padding: 0 5px;
        box-sizing: border-box;
        border-radius: 999px;
        background: #f3f4f1;
        color: #666d79;
        font-size: 11px;
        font-weight: 800;
        line-height: 18px;
        text-align: center;
    }
    .mob-stage-chip.is-active {
        background: var(--mob-ink);
        color: #fff;
        box-shadow: none;
    }
    .mob-stage-chip.is-active b {
        background: rgba(255, 255, 255, .16);
        color: #fff;
    }
    /* «Аналитика» на компьютере прокручивается внутри своего блока. На телефоне блок оказывался
       ниже экрана (под нижним меню), конец не прокручивался, а перерисовка блока по таймеру
       возвращала его прокрутку наверх. Здесь — как остальные вкладки: прокручивается страница */
    body.sb-modern #page-manager #crm-view-analytics.active {
        overflow: visible;
        height: auto;
        max-height: none;
        flex: none;
        padding-bottom: 24px;
    }
    /* Своя прокрутка у вида и страницы CRM на телефоне не нужна (прокручивается страница), а с ней
       закреплённая строка этапов отсчитывала отступ от блока, а не от экрана, и съезжала вниз */
    body.sb-modern #page-manager,
    body.sb-modern #page-manager #crm-view-pipeline {
        overflow: visible;
    }
    /* На компьютере страница CRM — ровно в экран (height: 100vh), прокручиваются её части.
       На телефоне прокручивается страница: высота — по содержимому. С 100vh содержимое
       вылезало за страницу, а на iPhone при скрытии/появлении адресной строки 100vh
       меняется — страница пересчитывалась и «прыгала» */
    body.sb-modern .page-crm.active {
        height: auto;
        min-height: 0;
        overflow: visible;
    }
    body.sb-modern #page-manager .crm-kanban-wrap.mob-stages {
        display: block;
        overflow: visible;
        height: auto;
        padding-left: 0;
        padding-right: 0;
    }
    body.sb-modern #page-manager .crm-kanban-wrap.mob-stages > .kanban-col:not(.mob-on) {
        display: none !important;
    }
    body.sb-modern #page-manager .crm-kanban-wrap.mob-stages > .kanban-col.mob-on {
        width: auto;
        min-width: 0;
        max-width: none;
        max-height: none;
        height: auto;
        margin: 0 var(--page-gutter);     /* колонка — с тем же отступом от краёв, что плитки и этапы */
    }
    body.sb-modern #page-manager .crm-kanban-wrap.mob-stages .kanban-col-body {
        overflow: visible;
        max-height: none;
        flex: none;
    }

    /* ── Боковые панели CRM и «Клиентов» (карточка клиента и компании, «Новая заявка»,
       настройки CRM) — во весь экран. На компьютере панель 410–480px выезжает справа;
       на телефоне она была шире экрана, левая часть уходила за край. Настройки CRM на
       компьютере привязаны к странице (absolute) — здесь к экрану ── */
    .crm-settings-panel {
        position: fixed;
        top: 0;
        bottom: 0;
        width: 100vw;
        max-width: none;
        right: calc(-100vw - 40px);
        border-radius: 0;
        border: 0;
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-sizing: border-box;
    }
    .crm-settings-panel.open {
        right: 0;
    }
    /* Карточка клиента, компании и «Новая заявка» — лист со скруглённым верхом, выезжает снизу,
       как окно сделки (владелец: «прямые линии, прямоугольники» — было окно во весь экран с
       прямыми углами, выезжало справа). Низ листа держится над клавиатурой (--mob-kbh ставит
       mobile.js — kbSync()): поле заметки внизу карточки раньше «улетало» под клавиатуру */
    .crm-side-panel {
        position: fixed;
        top: calc(env(safe-area-inset-top, 0px) + 10px);
        bottom: 0;
        left: 0;
        right: 0 !important;
        width: auto;
        max-width: none;
        border: 0;
        border-radius: 28px 28px 0 0;
        padding: 0 0 var(--mob-sheet-acc, 0px);
        box-sizing: border-box;
        background: #f4f4f2;
        box-shadow: none;
        transform: translateY(105%);
        visibility: hidden;
        transition: transform .3s cubic-bezier(.22, .61, .36, 1), visibility 0s linear .3s;
    }
    .crm-side-panel.open {
        right: 0 !important;
        transform: none;
        visibility: visible;
        box-shadow: 0 -14px 44px rgba(17, 18, 23, .18);
        transition: transform .3s cubic-bezier(.22, .61, .36, 1), visibility 0s;
    }
    .crm-side-panel .crm-side-header {
        position: relative;
        padding: 20px 14px 10px;
        background: #fff;
        border-bottom: 0;
    }
    .crm-side-panel .crm-side-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        width: 36px;
        height: 4px;
        margin-left: -18px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .14);
    }
    /* Шапка карточки клиента / компании: закрыть слева, действия справа — круглыми кнопками;
       ниже аватар и имя (как шапка окна сделки) */
    #crm-client-side .crm-side-header-top,
    #crm-company-side .crm-side-header-top {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    #crm-client-side .client-drawer-actions,
    #crm-company-side .client-drawer-actions {
        order: -1;
        width: 100%;
        gap: 8px;
    }
    #crm-client-side .client-drawer-actions .crm-side-close,
    #crm-company-side .client-drawer-actions .crm-side-close {
        order: -1;
        margin-right: auto;
    }
    #crm-client-side .client-drawer-actions button,
    #crm-company-side .client-drawer-actions button {
        flex: none;
        width: 36px;
        height: 36px;
        border: 0;
        border-radius: 50%;
        background: #f3f4f1;
    }
    #crm-client-side .client-drawer-actions button::after,
    #crm-company-side .client-drawer-actions button::after {
        content: none;                    /* подсказка по наведению — на телефоне её нет */
    }
    #crm-client-side .client-drawer-actions button svg,
    #crm-company-side .client-drawer-actions button svg {
        width: 16px;
        height: 16px;
    }
    .crm-side-panel .client-drawer-avatar {
        width: 44px;
        height: 44px;
        border-radius: 14px;
    }
    .crm-side-panel .crm-side-title {
        font-size: 19px;
        line-height: 1.25;
    }
    .crm-side-panel .client-drawer-pills {
        flex-wrap: wrap;
    }
    /* Сводка по сделкам компании — в белой шапке, без своей серой плашки */
    #crm-company-side .company-stat-strip {
        margin: 0;
        padding: 4px 14px 12px;
        border-radius: 0;
        background: #fff;
    }
    /* Вкладки карточки — как вкладки окна сделки: текст и лаймовое подчёркивание, листаются вбок */
    .crm-side-panel .crm-side-tabs {
        flex: none;
        gap: 0;
        width: auto;
        max-width: none;
        margin: 0;
        padding: 0 6px;
        border-radius: 0;
        background: #fff;
        border-bottom: 1px solid rgba(17, 18, 23, .08);
        overflow-x: auto;
        -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent);
                mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent);
    }
    .crm-side-panel .crm-side-tab {
        position: relative;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        height: 42px;
        padding: 0 10px;
        border-radius: 0;
        background: none !important;
        color: #666d79;
        font-size: 14px;
        font-weight: 700;
    }
    .crm-side-panel .crm-side-tab:last-child {
        margin-right: 16px;
    }
    .crm-side-panel .crm-side-tab.active {
        color: var(--mob-ink);
        font-weight: 700;
    }
    .crm-side-panel .crm-side-tab.active::after {
        content: '';
        position: absolute;
        left: 8px;
        right: 8px;
        bottom: 0;
        height: 3px;
        border-radius: 3px 3px 0 0;
        background: #A8E76A;
    }
    .crm-side-panel .crm-side-tab .crm-side-tab-n,
    .crm-side-panel .crm-side-tab.active .crm-side-tab-n {
        min-width: 19px;
        height: 19px;
        margin: 0;
        padding: 0 5px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .08);
        color: #3f4352;
        font-size: 11.5px;
        line-height: 19px;
        text-align: center;
    }
    .crm-side-panel .crm-side-tab-n:empty {
        display: none;
    }
    /* Содержимое — на сером фоне белыми карточками без рамок */
    .crm-side-panel .crm-side-body {
        padding: 12px 12px 16px;
        background: #f4f4f2;
        overscroll-behavior: contain;
    }
    .crm-side-panel .client-info-row {
        border: 0;
        border-radius: 16px;
        box-shadow: 0 1px 2px rgba(17, 18, 23, .04);
    }
    .crm-side-panel .dm-section-label {
        margin-top: 4px !important;
    }
    .crm-side-panel .client-info-list + .dm-section-label,
    .crm-side-panel div + .dm-section-label {
        margin-top: 16px !important;
    }
    /* «Новая заявка» — низ окна одной строкой (владелец 11.10.2026: три кнопки в два ряда
       выглядели тяжело). «Отмена» не нужна — окно закрывает крестик в шапке; слева светлая
       «Ещё одну» (= «Создать и добавить ещё»), справа главная «Создать заявку» */
    /* Отступ под нижней «полоской» iPhone считался дважды (у панели и у низа окна) — под
       кнопками оставалась пустая полоса. Теперь только у низа окна, и меньше */
    #crm-dealadd-side.crm-side-panel {
        padding-bottom: 0;
        background: #fff;
    }
    #crm-dealadd-side .dm-footer {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        padding: 10px 16px max(10px, calc(env(safe-area-inset-bottom, 0px) - 8px));
    }
    #crm-dealadd-side .dm-footer .crm-btn-cancel:first-child {
        display: none;
    }
    #crm-dealadd-side .dm-footer .crm-btn-cancel {
        flex: 1 1 0;
        min-width: 0;
        height: 48px;
        margin: 0;
        padding: 0 12px;
        border: 0;
        border-radius: 16px;
        background: rgba(17, 18, 23, .06);
        color: var(--mob-ink);
        font-size: 0;                     /* «Создать и добавить ещё» → «Ещё одну» */
        white-space: nowrap;
    }
    #crm-dealadd-side .dm-footer .crm-btn-cancel::after {
        content: '+ Ещё одну';
        font-size: 14px;
        font-weight: 600;
    }
    #crm-dealadd-side .dm-footer .crm-btn-primary {
        flex: 1.5 1 0;
        justify-content: center;
        height: 48px;
        margin: 0;
        border-radius: 16px;
        font-size: 15px;
    }

    /* «Назад», когда одна панель открыта поверх другой: на компьютере кнопка слева от панели,
       на телефоне места слева нет — внизу слева, поверх панели */
    .crm-panel-back-btn {
        top: auto !important;
        left: 16px !important;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
        width: 46px;
        height: 46px;
    }

    /* ── Шапка «Клиентов» (12.10.2026) — как в CRM и «Задачах»: «Клиенты» · поиск · фильтр · «+»
       одной строкой, под ней «Люди / Компании» переключателем во всю ширину. Значка у заголовка
       нет; открытый поиск встаёт на место заголовка ── */
    body.sb-modern #page-clients .crm-header {
        padding-top: 10px;
    }
    body.sb-modern #page-clients .crm-header-row {
        flex-wrap: wrap;
        align-items: center;
        row-gap: 12px;
        column-gap: 8px;
    }
    body.sb-modern #page-clients .crm-header-left,
    body.sb-modern #page-clients .crm-header-right {
        display: contents;
    }
    body.sb-modern #page-clients .crm-page-title {
        order: 1;
        margin: 0 auto 0 0;
        gap: 0;
        font-family: 'Unbounded', sans-serif;
        font-size: 18px;
        font-weight: 600;
        letter-spacing: -.02em;
    }
    body.sb-modern #page-clients .crm-page-title > svg {
        display: none;
    }
    body.sb-modern #page-clients #crm-clients-search { order: 2; margin-left: 0; }
    body.sb-modern #page-clients .crm-nav-actions { order: 3; }
    body.sb-modern #page-clients #clients-header-btn { order: 4; margin-left: 0; }
    body.sb-modern #page-clients #crm-mode-toggle {
        order: 5;
        flex: 1 1 100%;
        display: flex;
    }
    body.sb-modern #page-clients #crm-mode-toggle .crm-mode-toggle-btn {
        flex: 1 1 0%;
        height: 38px;
        justify-content: center;
        font-size: 13.5px;
    }
    body.sb-modern #page-clients .crm-header-row:has(#crm-clients-search.is-open) .crm-page-title {
        display: none;
    }
    body.sb-modern #page-clients #crm-clients-search.is-open {
        flex: 1 1 0% !important;
        min-width: 0 !important;
        width: auto !important;
        max-width: none !important;
    }
    /* Импорт CSV и переключатель «карточки / таблица» на телефоне не нужны: импорт делают
       с компьютера, таблица на узком экране неудобна (вид — всегда карточки, mobile.js) */
    body.sb-modern #page-clients #crm-import-btn,
    body.sb-modern #page-clients #crm-view-toggle {
        display: none;
    }

    /* «Регулярные»: полоса плиток — как в «Воронке» (начинается от общего отступа, листается
       до края экрана); под ней фильтр «Все / Нужно сделать / Выполнено / На паузе» — капсула
       во всю ширину, листается вбок. Раньше полоса стояла с двойным отступом и обрывалась
       раньше края, фильтр обрезался */
    body.sb-modern #page-manager #crm-view-recurring .crm-rc-summary {
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 10px;
        margin: 0 !important;
        padding: 12px 0 14px !important;
        width: 100%;
        box-sizing: border-box;
    }
    body.sb-modern #page-manager #crm-view-recurring .crm-rc-summary > .crm-rc-tiles {
        flex: none;
        width: 100%;
        box-sizing: border-box;
        padding: 0 var(--page-gutter);
        scroll-padding-inline: var(--page-gutter);
        scrollbar-width: none;
        -webkit-mask-image: none;
        mask-image: none;
    }
    body.sb-modern #page-manager #crm-view-recurring .crm-rc-tiles::-webkit-scrollbar {
        display: none;
    }
    /* Фильтр перенесён под блок плиток (mobile.js — recurSideSync()) и закреплён под верхней
       строкой — как строка этапов «Воронки». Цифры свёрнуты — фильтра нет и на компьютере
       (список тогда показывает «Все»), здесь так же */
    body.sb-modern #page-manager #crm-view-recurring .crm-rc-side.mob-rc-side {
        position: sticky;
        top: calc(env(safe-area-inset-top, 0px) + var(--mob-edge) + var(--mob-top-h) + 4px);
        z-index: 20;
        width: 100%;
        box-sizing: border-box;
        padding: 8px var(--page-gutter) 10px;
        margin: 0;
        display: block;
        background: #efefee;
    }
    body.sb-modern #page-manager #crmRcStatsWrap.is-collapsed + .crm-rc-side.mob-rc-side {
        display: none;
    }
    /* Прокручивается страница (как «Воронка»), у списка своей прокрутки нет */
    body.sb-modern #page-manager #crm-view-recurring {
        overflow: visible;
        height: auto;
        min-height: 0;
    }
    body.sb-modern #page-manager #crm-recurring-body {
        overflow: visible !important;
        flex: none !important;
        height: auto;
        min-height: 0;
    }
    body.sb-modern #page-manager #crmRcTabs {
        display: flex;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: auto;
        scrollbar-width: none;
    }
    body.sb-modern #page-manager #crmRcTabs::-webkit-scrollbar {
        display: none;
    }
    body.sb-modern #page-manager #crmRcTabs > button {
        flex-shrink: 0;
    }

    /* «Регулярные»: на телефоне всегда карточки (mobile.js — recurViewSync()), переключатель вида не нужен */
    body.sb-modern #page-manager #crm-recur-view-toggle {
        display: none;
    }

    /* «Аналитика» → «Оплаты»: в шапке «ОПЛАТЫ · легенда из трёх пунктов · за 30 дн.» в одну
       строку не помещались — карточка становилась шире экрана, справа всё обрезалось.
       Легенду на телефоне не показываем: цвета подписаны в строках «Регулярные / Обычные» ниже,
       линия графика — «накоплено к дню» */
    body.sb-modern #page-manager .can-pay-legend {
        display: none;
    }
    body.sb-modern #page-manager .can-pay-head-right {
        gap: 8px;
        flex-shrink: 0;
    }
    body.sb-modern #page-manager .can-card,
    body.sb-modern #page-manager .can-pay,
    body.sb-modern #page-manager .can-pay-chart {
        min-width: 0;
        max-width: 100%;
    }
    body.sb-modern #page-manager .can-pay-total {
        font-size: 30px;
    }
    /* Подпись над графиком — вместо скрытой легенды: что показывает линия */
    body.sb-modern #page-manager .can-pay-chart::before {
        content: 'Как копилась выручка за период';
        display: block;
        margin: 4px 0 6px;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: .05em;
        text-transform: uppercase;
        color: #8d919d;
    }

    /* Окно «Все источники» (и «Вся команда», «Все услуги» — та же оболочка) — шторкой снизу */
    .can-src-modal {
        align-items: flex-end;
        padding: 0;
    }
    .can-src-dialog {
        width: 100%;
        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);
        border-radius: 26px 26px 0 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .can-src-head {
        padding: 18px 18px 12px;
    }
    .can-src-sum {
        padding: 0 18px 14px;
    }
    .can-src-sum b {
        font-size: 15px;                  /* «112 270 000 ₽» целиком, без «112 270 0…» */
    }
    .can-src-list {
        padding-left: 6px;
        padding-right: 6px;
    }
    /* Строка источника: название с полосой во всю ширину; ниже «Заявки · В работе · Выиграно»;
       под ними «Конверсия» и «Выручка» (на две колонки) — подпись над значением у всех */
    .can-src-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px 8px;
    }
    .can-src-row > .can-src-name {
        grid-column: 1 / -1;
    }
    .can-src-num,
    .can-src-num:has(.can-sc-badge) {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 3px;
        text-align: left;
        font-size: 15px;
    }
    .can-src-num::before {
        content: attr(data-l);
        display: block;
        font-size: 11px;
        font-weight: 700;
        color: #8d919d;
    }
    .can-src-num .can-sc-badge {
        margin-left: 0;
    }
    .can-src-row > .can-src-num:last-child {
        grid-column: 2 / -1;
        white-space: nowrap;
    }

    /* Выпадающие списки — шторкой снизу (mobile.js — cddBackSync()). Положение панели скрипт
       списка ставит инлайн — отсюда !important */
    .cdd-panel.cdd-panel--portal {
        position: fixed !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: auto !important;
        min-width: 0 !important;
        max-height: 62vh !important;
        max-height: 62dvh !important;
        z-index: 99991 !important;
        border-radius: 24px 24px 0 0 !important;
        border: 0 !important;
        padding: 10px 10px calc(14px + env(safe-area-inset-bottom, 0px)) !important;
        box-shadow: 0 -16px 44px rgba(15, 17, 23, .18) !important;
        overscroll-behavior: contain;
        animation: mobSheetUp .26s cubic-bezier(.22, .61, .36, 1);
    }
    .cdd-panel.cdd-panel--portal::before {
        content: '';
        flex: none;
        align-self: center;
        width: 40px;
        height: 5px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .16);
        margin: 0 0 10px;
    }
    .cdd-panel.cdd-panel--portal .cdd-opt {
        min-height: 48px;
        padding: 12px 14px;
        font-size: 15px;
        border-radius: 14px;
    }
    .mob-cdd-back {
        display: none;
    }
    .mob-cdd-back.is-on {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 99990;
        background: rgba(17, 18, 23, .34);
        animation: mobFadeIn .2s ease;
    }
    @keyframes mobSheetUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    @keyframes mobFadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    /* Графики «Аналитики» ведут пальцем (mobile.js — initChartTouch()): вверх-вниз прокручивается
       страница, влево-вправо — показывается день под пальцем */
    body.sb-modern #page-manager #canPaySvgWrap,
    body.sb-modern #page-manager .can-line-plot {
        touch-action: pan-y;
        -webkit-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
    }

    /* «Воронка продаж» на телефоне (владелец 11.10.2026: «выглядит ужасно»): этап — строка
       «название … число», под ней полоса во всю ширину и доля от входящих; между этапами —
       тонкая строка перехода «↓ 80% перешли», самый большой отсев — янтарной плашкой */
    body.sb-modern #page-manager .can-funnel-flow {
        display: flex;
        flex-direction: column;
        gap: 0;
    }
    body.sb-modern #page-manager .can-funnel-card {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "name cnt"
            "bar  pct";
        align-items: center;
        column-gap: 12px;
        row-gap: 8px;
        min-height: 0;
        padding: 12px 14px;
        border: 0;
        border-radius: 16px;
        background: #f6f6f4;
    }
    body.sb-modern #page-manager .can-funnel-card--final {
        background: linear-gradient(180deg, rgba(168, 231, 106, .24), rgba(168, 231, 106, .1));
    }
    body.sb-modern #page-manager .can-funnel-top {
        display: contents;
    }
    body.sb-modern #page-manager .can-funnel-top span {
        grid-area: name;
        font-size: 14px;
        font-weight: 700;
        color: #111217;
    }
    body.sb-modern #page-manager .can-funnel-top strong {
        grid-area: cnt;
        font-size: 20px;
        text-align: right;
    }
    body.sb-modern #page-manager .can-funnel-bar {
        grid-area: bar;
        height: 8px;
        margin: 0;
        border-radius: 999px;
        background: rgba(17, 18, 23, .07);
    }
    body.sb-modern #page-manager .can-funnel-bar i {
        border-radius: 999px;
    }
    body.sb-modern #page-manager .can-funnel-card small {
        grid-area: pct;
        font-size: 11.5px;
        font-weight: 600;
        color: #8d919d;
        text-align: right;
        white-space: nowrap;
    }
    body.sb-modern #page-manager .can-funnel-transition {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 6px;
        min-height: 0;
        margin: 0;
        padding: 7px 0 7px 18px;
        color: #8d919d;
    }
    body.sb-modern #page-manager .can-funnel-transition::before {
        content: '';
        width: 7px;
        height: 7px;
        margin: -4px 4px 0 0;
        border: 0;
        border-right: 2px solid rgba(17, 18, 23, .22);
        border-bottom: 2px solid rgba(17, 18, 23, .22);
        background: none;
        box-shadow: none;
        border-radius: 1px;
        transform: rotate(45deg);
    }
    body.sb-modern #page-manager .can-funnel-transition span {
        font-family: 'Onest', sans-serif;
        font-size: 13px;
        font-weight: 800;
        color: #43464f;
    }
    body.sb-modern #page-manager .can-funnel-transition small {
        font-size: 12px;
        font-weight: 600;
    }
    body.sb-modern #page-manager .can-funnel-transition--worst span,
    body.sb-modern #page-manager .can-funnel-transition--worst small {
        color: #b45309;
    }
    body.sb-modern #page-manager .can-funnel-transition--worst::before {
        border-color: #d97706;
    }
    body.sb-modern #page-manager .can-funnel-badge {
        background: #fef3e2;
        color: #b45309;
        font-size: 11px;
        padding: 5px 10px;
    }

    /* «Динамика заявок»: подпись «Всего за период…» и легенда «Сейчас / Ранее» в одну строку
       не помещались и наезжали друг на друга — легенда первой, подпись под ней */
    body.sb-modern #page-manager .can-line-foot-row {
        flex-direction: column-reverse;
        align-items: flex-start;
        gap: 8px;
    }
    body.sb-modern #page-manager .can-line-legend {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 4px 14px;
    }
    /* «Команда»: подпись «В работе» в шапке таблицы — в одну строку */
    body.sb-modern #page-manager .can-team-hd span {
        white-space: nowrap;
    }

    /* «Аналитика» → «Команда»: колонки по ширине телефона (76 + 76 + 110px не помещались —
       «Выручка» уходила за край) */
    body.sb-modern #page-manager .can-team-hd,
    body.sb-modern #page-manager .can-team-tr {
        grid-template-columns: minmax(0, 1fr) 46px 54px 88px;
        gap: 6px;
    }
    body.sb-modern #page-manager .can-team-hd {
        padding: 0 6px 9px;
    }
    body.sb-modern #page-manager .can-team-tr {
        padding: 9px 6px;
    }
    body.sb-modern #page-manager .can-team-hd span {
        font-size: 9.5px;
        letter-spacing: .03em;
    }

    /* Размытие фона под окнами на телефоне выключено: окно занимает почти весь экран, а на iPhone
       слой размытия при закрытии «дёргался» и оставлял на странице след кнопки («после закрытия
       тень кнопки остаётся») */
    .crm-modal-overlay,
    .dm-overlay {
        -webkit-backdrop-filter: none !important;
                backdrop-filter: none !important;
    }
    /* Наведения на телефоне нет — после касания карточка сделки оставалась «приподнятой» */
    .deal-card:hover {
        transform: none;
        box-shadow: 0 2px 10px rgba(17, 18, 23, .07), 0 0 0 1px rgba(17, 18, 23, .05);
    }
    .deal-open-btn:hover {
        background: rgba(17, 18, 23, .06);
        color: #8d919d;
    }

    /* ── Окна подтверждения (удалить сделку / клиента / компанию, открепить карту, привязать
       контакта к компании) — шторкой снизу: значок и вопрос, пояснение, кнопки во всю ширину
       друг под другом (главная сверху). На компьютере — окно по центру с кнопками в ряд: на
       телефоне длинная подпись «Нет, только для этой заявки» переносилась в две строки ── */
    .crm-confirm-overlay.open {
        align-items: flex-end;
    }
    .crm-confirm-overlay .crm-confirm-modal {
        position: relative;
        width: 100%;
        max-width: none;
        max-height: 88vh;
        padding: 18px 0 max(14px, env(safe-area-inset-bottom, 0px));
        border-radius: 26px 26px 0 0;
        box-shadow: 0 -14px 44px rgba(17, 18, 23, .2);
        animation: mobConfirmUp .26s cubic-bezier(.22, .61, .36, 1);
    }
    .crm-confirm-overlay .crm-confirm-modal::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        width: 36px;
        height: 4px;
        margin-left: -18px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .14);
    }
    @keyframes mobConfirmUp {
        from { transform: translateY(100%); }
        to   { transform: none; }
    }
    .crm-confirm-overlay .crm-confirm-header {
        padding: 10px 18px 4px;
        border-bottom: 0;
    }
    .crm-confirm-overlay .crm-confirm-header .crm-side-close {
        display: none;                    /* закрыть — нижней кнопкой или нажатием мимо */
    }
    .crm-confirm-overlay .crm-confirm-heading {
        align-items: center;
        gap: 12px;
    }
    .crm-confirm-overlay .crm-confirm-icon {
        width: 44px;
        height: 44px;
        border-radius: 15px;
    }
    .crm-confirm-overlay .crm-confirm-title {
        font-size: 18px;
        line-height: 1.25;
    }
    .crm-confirm-overlay .crm-modal-body {
        padding: 10px 18px 16px;
    }
    .crm-confirm-overlay .crm-confirm-text {
        font-size: 15px;
        font-weight: 500;
        line-height: 1.5;
    }
    .crm-confirm-overlay .crm-confirm-actions {
        flex-direction: column-reverse;
        gap: 8px;
        padding: 0 18px;
        border-top: 0;
    }
    .crm-confirm-overlay .crm-confirm-actions > button {
        width: 100%;
        min-width: 0;
        height: 48px;
        padding: 0 16px;
        border-radius: 15px;
        font-size: 15px;
        justify-content: center;
        white-space: nowrap;
    }

    /* ── «Новый клиент» / «Новая компания» (и правка) — лист снизу почти во весь экран: поля в
       одну колонку, кнопки внизу во всю ширину. На компьютере это окно 860px в две колонки;
       на телефоне оно висело посередине с полями, сжатыми в два столбика. Низ листа — над
       клавиатурой (--mob-kbh) ── */
    #modal-client.open,
    #modal-company.open {
        align-items: flex-end;
        box-sizing: border-box;
    }
    #modal-client .ccm-modal,
    #modal-company .ccm-modal {
        position: relative;
        width: 100%;
        max-width: none;
        height: calc(100% - env(safe-area-inset-top, 0px) - 10px);
        max-height: none;
        border-radius: 28px 28px 0 0;
        background: #f4f4f2;
        box-shadow: 0 -14px 44px rgba(17, 18, 23, .2);
        overflow: hidden;
        padding-bottom: var(--mob-sheet-acc, 0px);
        box-sizing: border-box;
        animation: mobConfirmUp .28s cubic-bezier(.22, .61, .36, 1);
    }
    #modal-client .ccm-modal::before,
    #modal-company .ccm-modal::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        z-index: 1;
        width: 36px;
        height: 4px;
        margin-left: -18px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .14);
    }
    #modal-client .crm-modal-header,
    #modal-company .crm-modal-header {
        padding: 22px 14px 12px;
        background: #fff;
        border-bottom: 1px solid rgba(17, 18, 23, .06);
    }
    #modal-client .ccm-modal-header-title .crm-modal-title,
    #modal-company .ccm-modal-header-title .crm-modal-title {
        font-size: 19px;
    }
    #modal-client .crm-modal-header .crm-side-close,
    #modal-company .crm-modal-header .crm-side-close {
        width: 36px;
        height: 36px;
        flex: none;
    }
    #modal-client .ccm-body,
    #modal-company .ccm-body {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        padding: 12px 12px 16px;
        overscroll-behavior: contain;
    }
    #modal-client .ccm-body > *,
    #modal-company .ccm-body > * {
        grid-column: 1 / -1;
        min-width: 0;
    }
    #modal-client .ccm-card,
    #modal-company .ccm-card,
    #modal-company .ccm-quickfill {
        background: #fff;
        -webkit-backdrop-filter: none;
                backdrop-filter: none;
        border: 0;
        border-radius: 18px;
        box-shadow: 0 1px 2px rgba(17, 18, 23, .04);
    }
    #modal-client .ccm-card-head,
    #modal-company .ccm-card-head {
        padding: 12px 14px 4px;
        background: none;
        font-size: 14px;
    }
    #modal-client .ccm-card-body,
    #modal-company .ccm-card-body {
        padding: 8px 14px 14px;
        border-top: 0;
        gap: 10px;
    }
    #modal-client .ccm-hero,
    #modal-company .ccm-hero {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 14px;
        border-radius: 18px;
    }
    #modal-client .ccm-hero-badge,
    #modal-company .ccm-hero-badge,
    #modal-client .ccm-name-avatar {
        width: 44px;
        height: 44px;
        border-radius: 14px;
    }
    #modal-client .ccm-row2,
    #modal-client .ccm-row3,
    #modal-company .ccm-row2,
    #modal-company .ccm-row3 {
        grid-template-columns: minmax(0, 1fr);
    }
    #modal-client .ccm-row-uneven > .ccm-field,
    #modal-company .ccm-row-uneven > .ccm-field {
        flex: 1 1 100% !important;
    }
    #modal-client .ccm-field-input:not(.ccm-field-textarea),
    #modal-company .ccm-field-input:not(.ccm-field-textarea) {
        min-height: 46px;
        border-radius: 12px;
    }
    #modal-client .ccm-hero-sub .ccm-field-input,
    #modal-company .ccm-hero-sub .ccm-field-input {
        max-width: none;
        min-height: 40px;
    }
    #modal-client .crm-modal-footer,
    #modal-company .crm-modal-footer {
        gap: 8px;
        padding: 10px 12px max(12px, env(safe-area-inset-bottom, 0px));
        background: #fff;
        border-top: 1px solid rgba(17, 18, 23, .06);
    }
    #modal-client .crm-modal-footer > button,
    #modal-company .crm-modal-footer > button {
        flex: 1 1 0;
        min-width: 0;
        height: 48px;
        padding: 0 12px;
        border-radius: 15px;
        font-size: 15px;
        justify-content: center;
        white-space: nowrap;
    }
    #modal-client .crm-modal-footer > .crm-btn-primary,
    #modal-company .crm-modal-footer > .crm-btn-primary {
        flex: 1.6 1 0;
    }

    /* ── Клавиатура открыта над листом (класс mob-kbs и --mob-vvt / --mob-vvb ставит mobile.js —
       kbSync(), расчёт окна виджета): лист встаёт ровно в видимую часть экрана над клавиатурой,
       от её верха до низа (низ — под плашкой «вверх / вниз / готово», там белое поле) ── */
    html.mob-kbs .crm-side-panel.open,
    html.mob-kbs #modal-deal.mob-deal .dm-modal {
        top: max(calc(var(--mob-vvt, 0px) + 10px), calc(env(safe-area-inset-top, 0px) + 10px));
        bottom: auto;
        height: calc(var(--mob-vvb, 100vh) - max(calc(var(--mob-vvt, 0px) + 10px), calc(env(safe-area-inset-top, 0px) + 10px)));
    }
    html.mob-kbs .mob-pop-sheet.open {
        top: max(calc(var(--mob-vvt, 0px) + 10px), calc(env(safe-area-inset-top, 0px) + 10px)) !important;
        bottom: auto !important;
        height: calc(var(--mob-vvb, 100vh) - max(calc(var(--mob-vvt, 0px) + 10px), calc(env(safe-area-inset-top, 0px) + 10px))) !important;
    }
    html.mob-kbs #modal-client.open,
    html.mob-kbs #modal-company.open {
        top: var(--mob-vvt, 0px);
        bottom: auto;
        height: calc(var(--mob-vvb, 100vh) - var(--mob-vvt, 0px));
    }

    /* «Ответственное лицо» (и другие сворачиваемые карточки окон): шапка одинаковой высоты в
       свёрнутом и раскрытом виде, «+» / «×» — круглой кнопкой справа (была мелкая квадратная) */
    #modal-client .ccm-card-head,
    #modal-company .ccm-card-head {
        min-height: 50px;
        padding: 12px 12px 12px 14px;
        box-sizing: border-box;
    }
    #modal-client .ccm-card-head + .ccm-card-body,
    #modal-company .ccm-card-head + .ccm-card-body {
        padding-top: 0;
    }
    #modal-client .ccm-card-toggle,
    #modal-company .ccm-card-toggle {
        flex: none;
        width: 34px;
        height: 34px;
        border: 0;
        border-radius: 50%;
        background: #f3f4f1;
        color: var(--mob-ink);
    }
    #modal-client .ccm-card-toggle svg,
    #modal-company .ccm-card-toggle svg {
        width: 15px;
        height: 15px;
    }

    /* ── Выпадающие списки окон «Клиенты» (компания, услуги, контакты, роль, прикрепить клиента) —
       экран снизу почти во весь рост, как выбор клиента в сделке: своя шапка «‹ Название», поиск
       сверху, список прокручивается, низ над клавиатурой. Класс mob-pop-sheet и шапку ставит
       mobile.js (initPopSheets); координаты, которые код страницы пишет окошку, перекрыты ── */
    .mob-pop-sheet {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        top: calc(env(safe-area-inset-top, 0px) + 10px) !important;
        bottom: 0 !important;
        width: auto !important;
        max-width: none !important;
        height: auto !important;
        max-height: none !important;
        display: flex !important;
        flex-direction: column;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 28px 28px 0 0 !important;
        background: #fff !important;
        box-shadow: 0 -14px 44px rgba(17, 18, 23, .2) !important;
        z-index: 99992 !important;
        opacity: 1 !important;
        overflow: hidden !important;
        transform: translateY(105%) !important;
        visibility: hidden;
        pointer-events: none;
        transition: transform .28s cubic-bezier(.22, .61, .36, 1), visibility 0s linear .28s !important;
    }
    .mob-pop-sheet.open {
        transform: none !important;
        visibility: visible;
        pointer-events: auto;
        transition: transform .28s cubic-bezier(.22, .61, .36, 1), visibility 0s !important;
    }
    .mob-pop-sheet .mob-pop-head {
        flex: none;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 16px 14px 10px;
    }
    .mob-pop-sheet .mob-pick-x {
        flex: none;
        width: 36px;
        height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 0;
        border-radius: 50%;
        background: #f3f4f1;
        color: var(--mob-ink);
        -webkit-tap-highlight-color: transparent;
    }
    .mob-pop-sheet .mob-pick-title {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-family: 'Unbounded', sans-serif;
        font-size: 17px;
        font-weight: 600;
        letter-spacing: -.02em;
        color: var(--mob-ink);
    }
    .mob-pop-sheet .dmc-pop-search,
    .mob-pop-sheet .dm-client-link-pop-search {
        flex: none;
        display: flex;
        align-items: center;
        gap: 9px;
        height: 46px;
        margin: 0 14px 8px;
        padding: 0 14px;
        border: 0 !important;
        border-radius: 14px;
        background: #f3f4f1;
    }
    .mob-pop-sheet .dmc-pop-search svg {
        flex: none;
        width: 16px;
        height: 16px;
    }
    .mob-pop-sheet .dmc-pop-search input,
    .mob-pop-sheet .dm-client-link-pop-search input {
        flex: 1;
        min-width: 0;
        border: 0;
        background: none;
        outline: none;
    }
    .mob-pop-sheet .dmc-pop-list,
    .mob-pop-sheet .dm-client-pick-list,
    .mob-pop-sheet .ccm-role-step {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none !important;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + var(--mob-sheet-acc, 0px) + 14px);
    }
    .mob-pop-sheet > div:not(.mob-pop-head):not(.dmc-pop-search):not(.dm-client-link-pop-search):not(.dmc-pop-list):not(.dm-client-pick-list):not(.ccm-role-step) {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
    }
    .mob-pop-sheet .dmc-company-opt {
        min-height: 52px;
        padding: 10px 18px;
        border-radius: 0;
        font-size: 15px;
    }
    .mob-pop-sheet .dmc-company-opt + .dmc-company-opt {
        border-top: 1px solid rgba(17, 18, 23, .05);
    }
    .mob-pop-sheet .dm-client-pick-item {
        padding: 12px 18px;
    }
    .mob-pop-sheet .dm-client-pick-name {
        font-size: 15px;
    }
    .mob-pop-sheet .ccm-role-step {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 4px 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
    }
    .mob-pop-sheet .ccm-role-step .ccm-field-input,
    .mob-pop-sheet .ccm-role-input {
        min-height: 46px;
        border-radius: 12px;
    }
    .mob-pop-sheet .ccm-role-chips button {
        height: 36px;
        padding: 0 14px;
        border-radius: 999px;
        font-size: 14px;
    }
    .mob-pop-sheet .ccm-role-submit {
        width: 100%;
        align-self: stretch;
        min-height: 48px;
        border-radius: 15px;
        font-size: 15px;
    }
    .mob-pop-sheet .dmc-pop-empty-state {
        padding: 24px 18px;
        font-size: 14px;
    }
    .mob-pop-back {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 99991;
        background: rgba(17, 18, 23, .42);
        opacity: 0;
        pointer-events: none;
        transition: opacity .22s;
    }
    .mob-pop-back.is-on {
        opacity: 1;
        pointer-events: auto;
    }

    /* ── Окно задачи сделки (#modal-task-card: просмотр и правка) — шторкой снизу.
       Шапка: кружок «выполнено», название на всю ширину, справа «изменить / удалить / закрыть»;
       «Создал … · дата» — отдельной строкой во всю ширину (на компьютере она стоит рядом с
       названием, на телефоне сжималась в два узких столбика). В просмотре подвала нет (закрыть —
       крестиком или нажатием мимо), в правке — «Отмена» и «Сохранить» во всю ширину ── */
    #modal-task-card.open {
        align-items: flex-end;
    }
    #modal-task-card .tc-card {
        position: relative;
        width: 100%;
        max-width: none;
        max-height: 88vh;
        max-height: 88dvh;
        border: 0;
        border-radius: 26px 26px 0 0;
        box-shadow: 0 -14px 44px rgba(17, 18, 23, .2);
        animation: mobConfirmUp .26s cubic-bezier(.22, .61, .36, 1);
    }
    #modal-task-card .tc-card::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        z-index: 1;
        width: 36px;
        height: 4px;
        margin-left: -18px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .14);
    }
    #modal-task-card .tc-head {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto auto auto;
        align-items: start;
        column-gap: 8px;
        row-gap: 6px;
        padding: 24px 16px 12px;
        background: #fff;
        border-bottom: 1px solid rgba(17, 18, 23, .06);
    }
    #modal-task-card .tc-head-main {
        display: contents;
    }
    #modal-task-card .tc-done-btn {
        width: 30px;
        height: 30px;
        margin-top: 2px;
    }
    #modal-task-card .tc-title-view,
    #modal-task-card .tc-title-input {
        grid-column: 2;
        grid-row: 1;
        align-self: center;
        min-width: 0;
        font-size: 18px;
        line-height: 1.3;
    }
    /* Название в правке — как название заявки в шапке окна сделки: крупный текст без подложки
       и рамки (серое поле владелец отверг) */
    #modal-task-card .tc-title-view,
    #modal-task-card .tc-title-input {
        font-size: 19px;
        line-height: 1.25;
        letter-spacing: -.01em;
    }
    #modal-task-card .tc-title-input,
    #modal-task-card .tc-title-input:hover,
    #modal-task-card .tc-title-input:focus {
        width: 100%;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: none;
        box-shadow: none;
        outline: none;
        font-size: 19px !important;
    }
    #modal-task-card .tc-meta-row {
        grid-column: 1 / -1;
        grid-row: 2;
        flex-wrap: wrap;
        margin: 0;
        padding-left: 38px;               /* под названием: кружок 30px + промежуток */
        font-size: 12.5px;
    }
    #modal-task-card .tc-edit-btn,
    #modal-task-card .tc-head .dm-del-btn,
    #modal-task-card .tc-head .dm-close-btn {
        width: 34px;
        height: 34px;
        flex: none;
    }
    #modal-task-card .tc-edit-btn svg,
    #modal-task-card .tc-head .dm-del-btn svg,
    #modal-task-card .tc-head .dm-close-btn svg {
        width: 15px;
        height: 15px;
    }
    #modal-task-card .tc-body {
        padding: 14px 16px 16px;
    }
    #modal-task-card .tc-desc-view {
        font-size: 15px;
        line-height: 1.5;
    }
    #modal-task-card .tc-desc-view img {
        max-width: 100%;
        height: auto;
        border-radius: 12px;
    }
    #modal-task-card .tc-fields {
        gap: 0;
        margin-top: 12px;
        border-top: 1px solid rgba(17, 18, 23, .06);
    }
    #modal-task-card .tc-fields .dmc-tf-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        min-height: 46px;
        margin: 0;
        border-bottom: 1px solid rgba(17, 18, 23, .06);
    }
    #modal-task-card .tc-fields .dmc-tf-row:last-child {
        border-bottom: 0;
    }
    #modal-task-card .tc-field-static {
        font-size: 14px;
        justify-content: flex-end;
        text-align: right;
    }
    #modal-task-card .tc-static-ava {
        width: 24px;
        height: 24px;
    }
    #modal-task-card .tc-foot {
        padding: 10px 16px max(12px, env(safe-area-inset-bottom, 0px));
        background: #fff;
    }
    #modal-task-card .tc-card:not(.is-edit) .tc-foot {
        display: none;
    }
    #modal-task-card .tc-foot-actions {
        width: 100%;
        gap: 8px;
    }
    #modal-task-card .tc-foot-actions > button {
        flex: 1 1 0;
        height: 46px;
        padding: 0 12px;
        border-radius: 14px;
        font-size: 15px;
        justify-content: center;
    }

    /* ── Окно сделки — на весь экран, одна общая прокрутка ──
       На компьютере три колонки (клиент · что происходило · связанное), каждая со своей
       прокруткой. На телефоне они вставали друг под другом с фиксированной высотой
       (280 / 125 / 280px), и листать приходилось в каждой отдельно. Здесь — один столбец,
       прокручивается тело окна, «Сохранить» закреплено внизу. */
    #modal-deal .dm-modal {
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        border-radius: 0;
        padding-top: env(safe-area-inset-top, 0px);
    }
    #modal-deal .dmc-head {
        padding-left: 16px;
        padding-right: 14px;
    }
    /* Порядок: «Сделка» (этап, температура, ответственный, сумма — главное, что меняют
       с телефона) — первой; потом контакты и данные заявки; в конце — вкладки с историей */
    #modal-deal .dm-modal .dmc-relcol { order: 1; }
    #modal-deal .dm-modal .dmc-idcol  { order: 2; }
    #modal-deal .dm-modal .dmc-main   { order: 3; }
    #modal-deal .dm-modal .dmc-body {
        display: flex !important;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto !important;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    #modal-deal .dm-modal .dmc-idcol,
    #modal-deal .dm-modal .dmc-main,
    #modal-deal .dm-modal .dmc-relcol {
        height: auto !important;
        max-height: none !important;
        min-height: 0;
        overflow: visible !important;
        border-left: 0;
        border-right: 0;
        flex: none;
    }
    #modal-deal .dm-modal .dmc-panes {
        flex: none;
        overflow: visible;
    }
    /* Вкладки «Все · Детали · Задачи · Файлы · История · Повторять» — одной строкой, листаются вбок */
    #modal-deal .dmc-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        margin: 10px 0 0;
        padding: 6px 14px;
    }
    #modal-deal .dmc-tabs::-webkit-scrollbar {
        display: none;
    }
    #modal-deal .dmc-tab {
        flex-shrink: 0;
        white-space: nowrap;
    }
    #modal-deal .dm-footer {
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    /* ══ Упрощённый вид окна сделки (класс .mob-deal ставит mobile.js — dealLayout()) ══ */
    #modal-deal.mob-deal .dmc-drag {
        display: none !important;
    }
    /* Окно — листом со скруглённым верхом (владелец: «у нас в дизайне нет прямых углов»):
       отступ сверху, за ним виден затемнённый экран, сверху «ручка» */
    #modal-deal.mob-deal .dm-modal {
        top: calc(env(safe-area-inset-top, 0px) + 10px);
        bottom: 0;
        padding-bottom: var(--mob-sheet-acc, 0px);
        border-radius: 28px 28px 0 0;
        padding-top: 0;
        overflow: hidden;
        overflow: clip;                   /* clip — окно нельзя прокрутить даже кодом (фокус на поле шторки выбора) */
    }
    /* Шапка в три строки:
       1) закрыть слева · «Отложить» и «Удалить» справа — круглыми кнопками;
       2) название крупно, на всю ширину;
       3) метки: этап (цветная пилюля, нажатие — выбор этапа) · «Регулярная …» · дата */
    #modal-deal.mob-deal .dmc-head {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 16px 14px 8px;
        position: relative;
        background: #fff;
        border-bottom: 0;                 /* шапка и вкладки — один белый блок, линия одна — под вкладками */
    }
    #modal-deal.mob-deal .dmc-head::before {
        content: '';
        position: absolute;
        top: 6px;
        left: 50%;
        width: 36px;
        height: 4px;
        margin-left: -18px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .14);
    }
    #modal-deal.mob-deal .dmc-head-actions {
        order: -1;
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        margin: 0;
    }
    #modal-deal.mob-deal .dmc-head-actions .dm-close-btn {
        order: -1;
        margin-right: auto;
    }
    #modal-deal.mob-deal .dmc-head-actions .dm-close-btn,
    #modal-deal.mob-deal .dmc-head-actions .dm-del-btn {
        width: 34px;
        height: 34px;
        border-radius: 50%;
        background: #f3f4f1;
        border: 0;
        flex: none;
    }
    #modal-deal.mob-deal .dmc-head-actions .dm-close-btn svg,
    #modal-deal.mob-deal .dmc-head-actions .dm-del-btn svg {
        width: 15px;
        height: 15px;
    }
    #modal-deal.mob-deal .dmc-head-actions .dmc-snooze-btn {
        height: 34px;
        padding: 0 13px;
        border-radius: 999px;
        font-size: 13px;
        font-weight: 700;
    }
    #modal-deal.mob-deal .dmc-head-main {
        min-width: 0;
        width: 100%;
    }
    #modal-deal.mob-deal .dmc-head-title-row {
        width: 100%;
    }
    #modal-deal.mob-deal .dmc-head-name {
        width: 100% !important;
        max-width: 100%;
        font-size: 19px;
        line-height: 1.25;
        text-overflow: ellipsis;
    }
    #modal-deal.mob-deal .dmc-head-meta {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px 8px;
        margin-top: 6px;
    }
    #modal-deal.mob-deal .dmc-head-meta > span::before {
        content: none !important;         /* точки-разделители между метками на телефоне не нужны */
    }
    /* Метки повтора — в общей строке с этапом (сам блок раскрыт): «этап · просрочено» первой
       строкой, «Регулярная · …» второй; дата при них не показывается — место нужнее содержимому */
    #modal-deal.mob-deal .dmc-head-meta .dmc-head-recur {
        display: contents;
    }
    #modal-deal.mob-deal .dmc-head-meta .mob-deal-stage { order: 0; }
    #modal-deal.mob-deal .dmc-head-meta .crm-rc-pill { order: 1; }
    #modal-deal.mob-deal .dmc-head-meta .crm-rc-pill--kind { order: 2; }
    #modal-deal.mob-deal .dmc-head-meta:has(.crm-rc-pill) .dmc-head-date {
        display: none;
    }
    #modal-deal.mob-deal .dmc-head-meta .crm-rc-pill {
        height: 28px;
        padding: 0 10px;
        border-radius: 999px;
        font-size: 12px;
        white-space: nowrap;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    /* дата — в строке меток справа (отдельная строка под ней съедала место у содержимого) */
    #modal-deal.mob-deal .dmc-head-date {
        order: 9;
        margin-left: auto;
        font-size: 12px;
        color: #8d919d;
        white-space: nowrap;
    }
    #modal-deal.mob-deal .mob-deal-stage {
        display: inline-flex;
        margin: 0;
    }
    #modal-deal.mob-deal .mob-deal-stage .cdd {
        width: auto;
    }
    #modal-deal.mob-deal .mob-deal-stage .cdd-trigger {
        width: auto;
        height: 28px;
        padding: 0 10px 0 11px;
        gap: 7px;
        border-radius: 999px;
        background: #f3f4f1;
        border: 0;
        font-size: 12.5px;
        font-weight: 700;
    }
    /* Карточки — ровной колонкой с одинаковым шагом */
    #modal-deal.mob-deal .dmc-body {
        padding: 10px 12px 8px;
        gap: 10px;
        background: #f4f4f2;
    }
    /* Колонки раскрыты (display: contents) — карточки одной лентой; какая карточка в какой вкладке,
       решает класс mob-tab-* на окне (mobile.js — dealTab()):
         «Сделка» — «Сделка», «О заявке» и остальные данные заявки (данные с сайта, ответы квиза);
         «Клиент» — контакт, компания, ответственное лицо, бонусы и другие заявки клиента;
         «Лента»  — заметки, задачи, файлы, история, повтор (вкладки ленты листаются вбок) */
    #modal-deal.mob-deal .dmc-idcol,
    #modal-deal.mob-deal .dmc-relcol {
        display: contents !important;
    }
    #modal-deal.mob-deal .dmc-card { order: 3; }
    #modal-deal.mob-deal .dmc-card:has(#deal-f-temp-btns) { order: 1; }
    #modal-deal.mob-deal .dmc-card:has(#deal-date-picker) { order: 2; }
    #modal-deal.mob-deal .dmc-card:has(#dm-client-link-card) { order: 1; }
    #modal-deal.mob-deal .dmc-card:has(#dmCompanyLink) { order: 2; }
    #modal-deal.mob-deal .dmc-card--resp { order: 3; }
    #modal-deal.mob-deal .mob-deal-hide {
        display: none !important;
    }
    /* «Клиент»: всё про человека */
    #modal-deal.mob-deal:not(.mob-tab-client) .dmc-card:has(#dm-client-link-card),
    #modal-deal.mob-deal:not(.mob-tab-client) .dmc-card:has(#dmCompanyLink),
    #modal-deal.mob-deal:not(.mob-tab-client) .dmc-card--resp,
    #modal-deal.mob-deal:not(.mob-tab-client) .dmc-relcol > .dmc-card:not(:has(#deal-f-temp-btns)) {
        display: none !important;
    }
    /* «Сделка»: поля самой сделки и данные заявки (все карточки левой колонки, кроме клиентских) */
    #modal-deal.mob-deal:not(.mob-tab-deal) .dmc-card:has(#deal-f-temp-btns),
    #modal-deal.mob-deal:not(.mob-tab-deal) .dmc-idcol > .dmc-card:not(:has(#dm-client-link-card)):not(:has(#dmCompanyLink)):not(.dmc-card--resp) {
        display: none !important;
    }
    /* «Лента» */
    #modal-deal.mob-deal:not(.mob-tab-feed) .dmc-main {
        display: none !important;
    }
    #modal-deal.mob-deal .dmc-idcol .dmc-card,
    #modal-deal.mob-deal .dmc-relcol .dmc-card {
        margin: 0;
        padding: 14px 16px;
        border-radius: 20px;
        box-shadow: 0 1px 2px rgba(17, 18, 23, .04);
    }
    /* Сами вкладки — закреплённая строка под шапкой, как строка вкладок на компьютере (владелец:
       «не такие пилюли овальные, а как в компьютерной версии»): текст, у выбранной — лаймовое
       подчёркивание, у «Задач» и «Заметок» число, у включённого «Повтора» точка. Шесть пунктов
       (сделка · клиент · лента · задачи · заметки · повтор) в строку не помещаются — строка
       листается вбок, правый край гаснет, выбранный пункт подъезжает в видимую часть */
    #modal-deal.mob-deal .mob-deal-tabs {
        flex: none;
        display: flex;
        gap: 0;
        margin: 0;
        padding: 0 6px;
        background: #fff;
        border-bottom: 1px solid rgba(17, 18, 23, .08);
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent);
                mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent);
    }
    #modal-deal.mob-deal .mob-deal-tab {
        flex: none;
        position: relative;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        height: 42px;
        padding: 0 10px;
        border: 0;
        border-radius: 0;
        background: none;
        color: #666d79;
        font-family: 'Onest', sans-serif;
        font-size: 14px;
        font-weight: 700;
        white-space: nowrap;
        -webkit-tap-highlight-color: transparent;
        transition: color .15s;
    }
    #modal-deal.mob-deal .mob-deal-tab:last-child {
        margin-right: 16px;               /* запас под затухание края */
    }
    #modal-deal.mob-deal .mob-deal-tab.is-active {
        background: none;
        color: var(--mob-ink);
    }
    #modal-deal.mob-deal .mob-deal-tab.is-active::after {
        content: '';
        position: absolute;
        left: 8px;
        right: 8px;
        bottom: 0;
        height: 3px;
        border-radius: 3px 3px 0 0;
        background: #A8E76A;
    }
    #modal-deal.mob-deal .mob-deal-tab-n {
        min-width: 19px;
        height: 19px;
        padding: 0 5px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .08);
        color: #3f4352;
        font-size: 11.5px;
        line-height: 19px;
        text-align: center;
    }
    #modal-deal.mob-deal .mob-deal-tab-n:empty,
    #modal-deal.mob-deal .mob-deal-tab:not(.has-dot) .mob-deal-tab-dot {
        display: none;
    }
    #modal-deal.mob-deal .mob-deal-tab-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: #8fd34f;
    }
    /* «Сделка» и «О заявке»: строки «подпись — значение», как в настройках телефона */
    #modal-deal.mob-deal .dm-info-row:has(#deal-f-amount),
    #modal-deal.mob-deal .dm-info-row:has(#deal-date-picker),
    #modal-deal.mob-deal .dm-info-row:has(#dd-type),
    #modal-deal.mob-deal .dm-info-row:has(#deal-f-assignees) {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 10px 0;
        border-bottom: 1px solid rgba(17, 18, 23, .06);
    }
    #modal-deal.mob-deal .dm-info-row:has(#deal-f-amount) .dm-info-label,
    #modal-deal.mob-deal .dm-info-row:has(#deal-date-picker) .dm-info-label,
    #modal-deal.mob-deal .dm-info-row:has(#dd-type) .dm-info-label,
    #modal-deal.mob-deal .dm-info-row:has(#deal-f-assignees) .dm-info-label {
        width: auto;
        flex: none;
    }
    #modal-deal.mob-deal #deal-f-amount {
        text-align: right;
        font-size: 17px;
        font-weight: 700;
        max-width: 60%;
    }
    #modal-deal.mob-deal #dd-type {
        flex: 0 1 60%;
        min-width: 0;
    }
    #modal-deal.mob-deal #deal-f-assignees {
        justify-content: flex-end;
    }
    /* Карточка контакта внутри «Контактов» — без второй рамки (карточка в карточке читалась кашей) */
    #modal-deal.mob-deal .dmc-contact-card {
        border: 0;
        padding: 4px 0 0;
        background: none;
        box-shadow: none;
    }
    #modal-deal.mob-deal .dmc-card-head {
        margin-bottom: 4px;
    }
    #modal-deal.mob-deal .dmc-card-title {
        font-size: 11px;
        letter-spacing: .07em;
        color: #8d919d;
    }
    /* Пустая лента — подсказка, а не пустой блок */
    #modal-deal.mob-deal .dmc-feed:empty::before {
        content: 'Пока пусто — добавьте заметку, задачу или файл кнопками внизу';
        display: block;
        padding: 6px 4px 4px;
        font-size: 13px;
        color: #8d919d;
        line-height: 1.45;
    }
    /* Кнопки связи с клиентом под карточкой контакта */
    #modal-deal.mob-deal .mob-deal-qa {
        display: flex;
        gap: 8px;
        margin-top: 10px;
    }
    #modal-deal.mob-deal .mob-deal-qa[hidden] {
        display: none;
    }
    #modal-deal.mob-deal .mob-deal-qa-btn {
        flex: 1 1 0;
        min-width: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        height: 40px;
        padding: 0 8px;
        border-radius: 13px;
        background: #f3f4f1;
        color: var(--mob-ink);
        font-size: 13px;
        font-weight: 700;
        white-space: nowrap;
        text-decoration: none;
        -webkit-tap-highlight-color: transparent;
    }
    #modal-deal.mob-deal .mob-deal-qa-btn svg {
        flex: none;
        width: 16px;
        height: 16px;
    }
    #modal-deal.mob-deal .mob-deal-qa-btn.is-call {
        flex: 1.45 1 0;                   /* «Позвонить» длиннее — ей больше места, текст не упирается в края */
        background: var(--mob-grad);
        color: #173b14;
    }
    /* «Лента»: белая карточка. Строки вкладок («Все · Детали заявки · Задачи · Файлы · История ·
       Повторять») на телефоне нет (решение владельца): на экране вся лента, в раздел ведут
       кнопки внизу окна и строка «Повтор сделки» во вкладке «Сделка» — mobile.js, dealFeedPane().
       Кнопки вкладок остаются в разметке: по ним работает код CRM */
    #modal-deal.mob-deal #dmcTabs {
        display: none !important;
    }
    #modal-deal.mob-deal .dmc-main {
        background: #fff;
        border-radius: 20px;
        padding: 0;
    }
    #modal-deal.mob-deal .dmc-panes {
        background: none;
        padding: 12px;
    }
    /* «Задачи», «Заметки» и «Повтор» — без белой подложки (владелец): кнопка «+ Задача» /
       «+ Заметка» стоит прямо на фоне окна, сами задачи, заметки и настройки повтора — своими
       карточками */
    #modal-deal.mob-deal[data-mob-pane="tasks"] .dmc-main,
    #modal-deal.mob-deal[data-mob-pane="chat"] .dmc-main,
    #modal-deal.mob-deal[data-mob-pane="recur"] .dmc-main {
        background: none;
        border-radius: 0;
    }
    #modal-deal.mob-deal[data-mob-pane="tasks"] .dmc-panes,
    #modal-deal.mob-deal[data-mob-pane="chat"] .dmc-panes,
    #modal-deal.mob-deal[data-mob-pane="recur"] .dmc-panes {
        padding: 2px 0 0;
    }
    #modal-deal.mob-deal #dmcPane-tasks > .dmc-card:has(.deal-modal-tasks-empty),
    #modal-deal.mob-deal #dmcPane-chat > .dmc-card--chat {
        background: none;
        border: 0;
        box-shadow: none;
    }
    #modal-deal.mob-deal #dmcPane-chat > .dmc-card--chat {
        padding-left: 0;
        padding-right: 0;
    }
    #modal-deal.mob-deal #dmcPane-chat .dmc-card-head--act {
        padding-left: 0;
        padding-right: 0;
    }
    #modal-deal.mob-deal #dmcPane-recur > .dmc-card {
        border-radius: 20px;
    }
    /* Открыта форма со своей галочкой (новая задача, заметка, правка, комментарий) — нижней
       строки окна нет: большую галочку «Сохранить сделку» нажимали вместо галочки формы, окно
       закрывалось, задача терялась (mobile.js — dealFormSync()) */
    #modal-deal.mob-deal.mob-form-open .dm-footer {
        display: none;
    }
    /* Строка «назад» над разделом: «‹ Вся лента   Задачи» */
    #modal-deal.mob-deal .mob-deal-sub {
        display: none;
        align-items: center;
        gap: 10px;
        padding: 12px 12px 0;
    }
    #modal-deal.mob-deal.mob-feed-sub .mob-deal-sub {
        display: flex;
    }
    #modal-deal.mob-deal .mob-deal-sub-back {
        flex: none;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        height: 34px;
        padding: 0 13px 0 8px;
        border: 0;
        border-radius: 999px;
        background: #f3f4f1;
        color: var(--mob-ink);
        font-family: 'Onest', sans-serif;
        font-size: 13px;
        font-weight: 700;
        -webkit-tap-highlight-color: transparent;
    }
    #modal-deal.mob-deal.mob-feed-noall .mob-deal-sub-back {
        display: none;
    }
    #modal-deal.mob-deal .mob-deal-sub-title {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 15px;
        font-weight: 700;
        color: var(--mob-ink);
    }
    #modal-deal.mob-deal.mob-feed-noall .mob-deal-sub-title {
        padding-left: 4px;
    }
    /* ── Перестановка блоков (перетаскивание заголовков) — только на компьютере: на телефоне
       блоки разложены по вкладкам, а жест по заголовку мешал прокрутке. Сам жест гасит
       mobile.js, здесь — вид: без «хватающего» курсора и без «Вернуть порядок блоков» ── */
    #modal-deal.mob-deal .dmc-card[data-dmc-block] > .dmc-card-head {
        cursor: default;
        touch-action: auto;
    }
    #modal-deal.mob-deal .dmc-layout-reset {
        display: none !important;
    }

    /* Только что добавленная запись в ленте — на пару секунд подсвечена (mobile.js, feedWatch()) */
    #modal-deal.mob-deal .dmc-fi.mob-fi-new {
        animation: mobFiNew 2.4s ease-out;
        border-radius: 12px;
    }
    @keyframes mobFiNew {
        0%, 35% { background: #eefbe3; box-shadow: 0 0 0 6px #eefbe3; }
        100%    { background: transparent; box-shadow: 0 0 0 6px transparent; }
    }

    /* ── Заметки в «Ленте»: форма, список, комментарии — под палец ── */
    /* Строка инструментов текста: всегда одной строкой, листается вбок; кнопки 36px */
    #modal-deal.mob-deal .dmc-comp-tools {
        flex: 1 1 auto;
        min-width: 0;
        flex-wrap: nowrap;
        gap: 2px;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: none;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent);
                mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent);
    }
    #modal-deal.mob-deal .dmc-comp-tools button {
        flex: none;
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 15px;
        color: #666d79;
    }
    #modal-deal.mob-deal .dmc-comp-tools button svg {
        width: 17px;
        height: 17px;
    }
    #modal-deal.mob-deal .dmc-comp-tools-sep {
        flex: none;
        margin: 0 3px;
    }
    /* «Отмена» и «Сохранить / Отправить» — круглыми значками справа от инструментов.
       Подписи кнопок остаются в разметке (font-size: 0), значок — фоном */
    #modal-deal.mob-deal #dmcComposer .dmc-comp-foot,
    #modal-deal.mob-deal .dm-comment-edit-actions,
    #modal-deal.mob-deal .dmc-add-task-actions,
    #modal-deal.mob-deal .dmc-reply-actions {
        flex: none;
        display: flex;
        align-items: center;
        gap: 6px;
        margin: 0;
        padding: 0;
    }
    #modal-deal.mob-deal #dmcComposer .dmc-comp-foot .crm-btn-cancel,
    #modal-deal.mob-deal .dm-comment-edit-actions .crm-btn-cancel,
    #modal-deal.mob-deal .dmc-add-task-actions .crm-btn-cancel,
    #modal-deal.mob-deal .dmc-reply-actions .crm-btn-cancel {
        flex: none;
        width: 36px;
        height: 36px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        font-size: 0;
        background: #f1f2ef url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666d79' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") no-repeat center;
    }
    #modal-deal.mob-deal #dmcComposer .dmc-comp-foot .crm-btn-primary,
    #modal-deal.mob-deal .dm-comment-edit-actions .crm-btn-primary,
    #modal-deal.mob-deal .dmc-add-task-actions .crm-btn-primary,
    #modal-deal.mob-deal .dmc-reply-actions .crm-btn-primary {
        flex: none;
        width: 40px;
        height: 40px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        font-size: 0;
        background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='19' height='19' viewBox='0 0 24 24' fill='none' stroke='%23173b14' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") no-repeat center, var(--mob-grad);
        box-shadow: 0 4px 12px -4px rgba(90, 167, 43, .55);
    }
    #modal-deal.mob-deal .dmc-reply-form .dmc-reply-actions .crm-btn-primary {
        background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='19' height='19' viewBox='0 0 24 24' fill='none' stroke='%23173b14' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M5.5 11.5L12 5l6.5 6.5'/%3E%3C/svg%3E") no-repeat center, var(--mob-grad);      /* новый комментарий — «отправить» */
    }
    /* Форма новой задачи: «Отмена» и «Добавить задачу» — теми же значками (крестик и галочка),
       справа под полями; описание ниже, чем на компьютере */
    #modal-deal.mob-deal .dmc-add-task-actions {
        justify-content: flex-end;
        margin-top: 4px;
    }
    #modal-deal.mob-deal #dm-add-task-wrap .dmc-add-task-actions { margin: 0; }
    /* поле «Подробности»: на компьютере его нижний край — панель инструментов с рамкой; на
       телефоне панель без рамки, и поле выглядело обрезанным — рамка и скругление со всех сторон */
    #modal-task-card #tcDescEditor {
        min-height: 84px;
        max-height: 34vh;
        border: 1px solid rgba(17, 18, 23, .1);
        border-radius: 12px;
        margin-bottom: 4px;
    }
    #modal-deal.mob-deal .dmc-add-task-card .dmc-comp-tools {
        margin: 0 0 8px;
    }
    /* Окно задачи (#modal-task-card лежит вне окна сделки): та же строка инструментов и те же
       значки, что в формах окна сделки */
    #modal-task-card .dmc-comp-tools {
        flex-wrap: nowrap;
        gap: 2px;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: none;
        overflow-x: auto;
        overflow-y: hidden;
    }
    #modal-task-card .dmc-comp-tools button {
        flex: none;
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 15px;
        color: #666d79;
    }
    #modal-task-card .dmc-comp-tools button svg {
        width: 17px;
        height: 17px;
    }
    /* Форма новой заметки */
    #modal-deal.mob-deal #dmcComposer.dmc-comp,
    #modal-deal.mob-deal #dm-add-task-wrap.dmc-comp {
        border-radius: 18px;
    }
    #modal-deal.mob-deal #dmcComposer .dmc-comp-body,
    #modal-deal.mob-deal #dm-add-task-wrap .dmc-comp-body {
        padding-top: 12px;
    }
    /* форма задачи: название и строки «Срок / Ответственный» уже, чем на компьютере */
    #modal-deal.mob-deal #dm-add-task-wrap .dmc-add-task { padding: 0 14px 2px; }
    #modal-deal.mob-deal #dm-add-task-wrap .dmc-task-fields { padding: 10px 14px 12px; }
    #modal-deal.mob-deal #dm-add-task-wrap .dmc-tf-label { min-width: 0; width: 100%; }
    #modal-deal.mob-deal #dmcComposer .dmc-comp-types {
        flex-wrap: nowrap;
        gap: 6px;
        padding: 0 12px;
        margin-bottom: 0;
        overflow-x: auto;
    }
    #modal-deal.mob-deal #dmcComposer .dmc-comp-types button {
        flex: none;
        height: 32px;
        padding: 0 11px;
        border-radius: 999px;
        font-size: 12.5px;
    }
    #modal-deal.mob-deal #dmcComposer .dmc-comp-text,
    #modal-deal.mob-deal #dm-add-task-wrap .dmc-comp-text {
        min-height: 96px;
        max-height: 38vh;
        padding: 12px 14px;
        line-height: 1.5;
    }
    #modal-deal.mob-deal #dmcComposer .dmc-comp-bar,
    #modal-deal.mob-deal #dm-add-task-wrap .dmc-comp-bar {
        gap: 8px;
        padding: 8px 8px 8px 6px;
        border-radius: 0 0 18px 18px;
    }
    /* Кнопки «+ Заметка» / «+ Задача» над списками */
    #modal-deal.mob-deal .dmc-card-act {
        min-height: 38px;
        padding: 0 14px;
        border-radius: 12px;
        font-size: 13.5px;
    }
    /* Заметка: аватар и «кто · когда» строкой, действия справа всегда видны (наведения на
       телефоне нет), текст и комментарии — на всю ширину карточки */
    #modal-deal.mob-deal .dm-comment-item {
        display: grid;
        grid-template-columns: 34px minmax(0, 1fr);
        column-gap: 10px;
        row-gap: 8px;
        align-items: center;
        padding: 12px;
        border-radius: 16px;
    }
    #modal-deal.mob-deal .dm-comment-item-main {
        display: contents;
    }
    #modal-deal.mob-deal .dm-comment-item-ava {
        width: 34px;
        height: 34px;
    }
    #modal-deal.mob-deal .dm-comment-item-top {
        align-items: center;
        gap: 0 4px;
        margin: 0;
        min-width: 0;
    }
    #modal-deal.mob-deal .dm-comment-item-author {
        flex: 1 1 0;                      /* длинное имя сокращается, кнопки действий остаются в строке */
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 14px;
    }
    #modal-deal.mob-deal .dm-comment-item-date {
        order: 10;
        flex-basis: 100%;
        margin: 0;
        font-size: 12px;
        color: #8d919d;
    }
    #modal-deal.mob-deal .dm-comment-pin,
    #modal-deal.mob-deal .dm-comment-edit,
    #modal-deal.mob-deal .dm-comment-delete {
        flex: none;
        width: 32px;
        height: 32px;
        margin: 0;
        border-radius: 10px;
        opacity: 1;
        color: #8d919d;
    }
    #modal-deal.mob-deal .dm-comment-pin svg,
    #modal-deal.mob-deal .dm-comment-edit svg,
    #modal-deal.mob-deal .dm-comment-delete svg {
        width: 15px;
        height: 15px;
    }
    #modal-deal.mob-deal .dm-comment-item-date + button {
        margin-left: auto;                /* первая из кнопок действий прижимает все к правому краю */
    }
    #modal-deal.mob-deal .dm-comment-item-text,
    #modal-deal.mob-deal .dm-comment-edit-bar,
    #modal-deal.mob-deal .dm-comment-item .dmc-replies {
        grid-column: 1 / -1;
        margin: 0;
    }
    #modal-deal.mob-deal .dm-comment-item-text {
        font-size: 14.5px;
        line-height: 1.5;
    }
    #modal-deal.mob-deal .dm-comment-item.is-editing .dm-comment-item-text {
        border-radius: 12px;
        border-bottom: 1px solid rgba(90, 167, 43, .45);
        min-height: 72px;
    }
    /* Правка заметки и комментария: инструменты слева, значки справа — одной строкой */
    #modal-deal.mob-deal .dm-comment-edit-bar,
    #modal-deal.mob-deal .dmc-reply-edit-bar {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }
    /* Комментарии к заметке */
    #modal-deal.mob-deal .dmc-replies-link {
        min-height: 32px;
        font-size: 13px;
    }
    #modal-deal.mob-deal .dmc-replies-list:not(:empty) {
        padding-left: 10px;
    }
    #modal-deal.mob-deal .dmc-reply-top {
        flex-wrap: wrap;
        font-size: 12px;
    }
    #modal-deal.mob-deal .dmc-reply-top b {
        font-size: 13.5px;
    }
    #modal-deal.mob-deal .dmc-reply-text {
        font-size: 14px;
    }
    #modal-deal.mob-deal .dmc-reply-act,
    #modal-deal.mob-deal .dmc-reply-del {
        opacity: 1;
        min-width: 28px;
        min-height: 28px;
        justify-content: center;
    }
    #modal-deal.mob-deal .dmc-reply-stub {
        min-height: 42px;
        display: flex;
        align-items: center;
        border-radius: 12px;
        font-size: 14px;
    }
    /* Новый комментарий: поле, под ним строка «инструменты · отмена · отправить» */
    #modal-deal.mob-deal .dmc-reply-form {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
        align-items: center;
        margin: 10px 0 0;
    }
    #modal-deal.mob-deal .dmc-reply-ed {
        grid-column: 1 / -1;
        min-height: 64px;
        border: 1px solid rgba(90, 167, 43, .45);
        border-radius: 12px;
        padding: 10px 12px;
        line-height: 1.45;
    }

    /* ── Выбор клиента, компании и ответственного — экран поверх окна сделки, выезжает снизу
       (на компьютере — окошко у поля). Закрывает окно целиком: первая версия была шторкой на
       72% высоты, и над ней оставалась затемнённая полоска шапки сделки — владелец: «какое-то
       дополнительное окно сверху, поле под него открывается, непонятно что это». Своя шапка
       («назад» и название) — mobile.js, dealLayout(). Поиск сверху, список получает запас снизу
       на высоту клавиатуры (--mob-kbh). Шторки на телефоне лежат прямо в .dm-modal ── */
    #modal-deal .dm-client-link-pop {
        position: fixed;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        width: auto !important;
        max-width: none;
        height: auto;
        display: flex;
        flex-direction: column;
        padding-top: 0;
        border: 0;
        border-radius: 28px 28px 0 0;
        background: #fff;
        box-shadow: none;
        opacity: 1;
        transform: translateY(105%);
        visibility: hidden;
        transition: transform .28s cubic-bezier(.22, .61, .36, 1), visibility 0s linear .28s;
        z-index: 3001 !important;
    }
    #modal-deal .dm-client-link-pop.open {
        transform: none;
        visibility: visible;
        transition: transform .28s cubic-bezier(.22, .61, .36, 1), visibility 0s;
    }
    #modal-deal .mob-pick-head {
        flex: none;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 14px 10px;
    }
    #modal-deal .mob-pick-x {
        flex: none;
        width: 36px;
        height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 0;
        border-radius: 50%;
        background: #f3f4f1;
        color: var(--mob-ink);
        -webkit-tap-highlight-color: transparent;
    }
    #modal-deal .mob-pick-title {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-family: 'Unbounded', sans-serif;
        font-size: 17px;
        font-weight: 600;
        letter-spacing: -.02em;
        color: var(--mob-ink);
    }
    #modal-deal .dm-client-link-pop-search {
        flex: none;
        gap: 9px;
        height: 46px;
        margin: 0 14px 8px;
        padding: 0 14px;
        border: 0;
        border-radius: 14px;
        background: #f3f4f1;
    }
    #modal-deal .dm-client-link-pop-search svg {
        flex: none;
        width: 17px;
        height: 17px;
    }
    #modal-deal .dm-client-link-pop .dm-client-pick-list {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + var(--mob-sheet-acc, 0px) + 12px);
    }
    #modal-deal .dm-client-link-pop .dm-client-pick-item {
        padding: 12px 18px;
    }
    #modal-deal .dm-client-link-pop .dm-client-pick-name {
        font-size: 15px;
    }
    #modal-deal .dm-client-link-pop .dm-client-pick-sub {
        font-size: 13px;
        margin-top: 2px;
    }
    #modal-deal .dm-client-link-pop .dm-client-pick-empty {
        padding: 22px 18px;
        font-size: 14px;
    }
    .mob-pick-back {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 3000;
        background: rgba(17, 18, 23, .42);
        opacity: 0;
        pointer-events: none;
        transition: opacity .22s;
    }
    .mob-pick-back.is-on {
        opacity: 1;
        pointer-events: auto;
    }

    /* Низ окна — одна строка значков (решение владельца: подписи и вторая строка съедали место):
       слева «Заметка · Задача · Файл», справа «Сохранить» — тёмная кнопка с галочкой.
       Текст кнопки «Сохранить» ставит код CRM при каждом открытии, поэтому он спрятан
       (font-size: 0), а галочка — фоном */
    #modal-deal.mob-deal .dm-footer {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 6px;
        padding: 8px 12px max(8px, calc(env(safe-area-inset-bottom, 0px) - 8px));
    }
    #modal-deal.mob-deal .dm-footer .dmc-actions {
        display: flex;
        gap: 6px;
        flex: 3 1 0;
        min-width: 0;
        margin: 0;
        padding: 0;
        border: 0;
    }
    #modal-deal.mob-deal .dm-footer .dmc-action {
        flex: 1 1 0;
        min-width: 0;
        height: 44px;
        padding: 0;
        gap: 0;
        justify-content: center;
        border-radius: 14px;
        background: #f1f2ef;
        border: 0;
        box-shadow: none;
        color: var(--mob-ink);
        -webkit-tap-highlight-color: transparent;
    }
    #modal-deal.mob-deal .dm-footer .dmc-action span {
        display: none;
    }
    #modal-deal.mob-deal .dm-footer .dmc-action svg {
        flex: none;
        width: 19px;
        height: 19px;
    }
    /* открыт раздел этой кнопки */
    #modal-deal.mob-deal .dm-footer .dmc-action.is-on {
        background: #eefbe3;
        color: #2f6a14;
    }
    #modal-deal.mob-deal .dm-footer #deal-modal-btn {
        flex: 1.25 1 0;
        min-width: 0;
        height: 44px;
        padding: 0;
        margin: 0;
        border-radius: 14px;
        font-size: 0;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: center;
    }
}


/* ══════════════════════════════════════════════════════════════════════
   Окно задачи на телефоне (этап 4, 11.10.2026) — те же решения, что у окна сделки.
   Первая часть СГЕНЕРИРОВАНА из правил окна сделки (#modal-deal → #tmModal, .mob-deal → .mob-task);
   правите окно сделки — правьте и здесь. Вторая часть — своё для задачи
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    html.mob-kbs #tmModal.mob-task {
        top: max(calc(var(--mob-vvt, 0px) + 10px), calc(env(safe-area-inset-top, 0px) + 10px));
        bottom: auto;
        height: calc(var(--mob-vvb, 100vh) - max(calc(var(--mob-vvt, 0px) + 10px), calc(env(safe-area-inset-top, 0px) + 10px)));
    }
    #tmModal {
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        border-radius: 0;
        padding-top: env(safe-area-inset-top, 0px);
    }
    #tmModal .dmc-head {
        padding-left: 16px;
        padding-right: 14px;
    }
    #tmModal .dmc-relcol { order: 1;
    }
    #tmModal .dmc-idcol { order: 2;
    }
    #tmModal .dmc-main { order: 3;
    }
    #tmModal .dmc-body {
        display: flex !important;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto !important;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    #tmModal .dmc-idcol,
    #tmModal .dmc-main,
    #tmModal .dmc-relcol {
        height: auto !important;
        max-height: none !important;
        min-height: 0;
        overflow: visible !important;
        border-left: 0;
        border-right: 0;
        flex: none;
    }
    #tmModal .dmc-panes {
        flex: none;
        overflow: visible;
    }
    #tmModal .dmc-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        margin: 10px 0 0;
        padding: 6px 14px;
    }
    #tmModal .dmc-tabs::-webkit-scrollbar {
        display: none;
    }
    #tmModal .dmc-tab {
        flex-shrink: 0;
        white-space: nowrap;
    }
    #tmModal .dm-footer {
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
    #tmModal.mob-task .dmc-drag {
        display: none !important;
    }
    #tmModal.mob-task {
        top: calc(env(safe-area-inset-top, 0px) + 10px);
        bottom: 0;
        padding-bottom: var(--mob-sheet-acc, 0px);
        border-radius: 28px 28px 0 0;
        padding-top: 0;
        overflow: hidden;
        overflow: clip;
    }
    #tmModal.mob-task .dmc-head {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 16px 14px 8px;
        position: relative;
        background: #fff;
        border-bottom: 0;
    }
    #tmModal.mob-task .dmc-head::before {
        content: '';
        position: absolute;
        top: 6px;
        left: 50%;
        width: 36px;
        height: 4px;
        margin-left: -18px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .14);
    }
    #tmModal.mob-task .dmc-head-actions {
        order: -1;
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        margin: 0;
    }
    #tmModal.mob-task .dmc-head-actions .dm-close-btn {
        order: -1;
        margin-right: auto;
    }
    #tmModal.mob-task .dmc-head-actions .dm-close-btn,
    #tmModal.mob-task .dmc-head-actions .dm-del-btn {
        width: 34px;
        height: 34px;
        border-radius: 50%;
        background: #f3f4f1;
        border: 0;
        flex: none;
    }
    #tmModal.mob-task .dmc-head-actions .dm-close-btn svg,
    #tmModal.mob-task .dmc-head-actions .dm-del-btn svg {
        width: 15px;
        height: 15px;
    }
    #tmModal.mob-task .dmc-head-actions .dmc-snooze-btn {
        height: 34px;
        padding: 0 13px;
        border-radius: 999px;
        font-size: 13px;
        font-weight: 700;
    }
    #tmModal.mob-task .dmc-head-main {
        min-width: 0;
        width: 100%;
    }
    #tmModal.mob-task .dmc-head-title-row {
        width: 100%;
    }
    #tmModal.mob-task .dmc-head-name {
        width: 100% !important;
        max-width: 100%;
        font-size: 19px;
        line-height: 1.25;
        text-overflow: ellipsis;
    }
    #tmModal.mob-task .dmc-head-meta {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px 8px;
        margin-top: 6px;
    }
    #tmModal.mob-task .dmc-head-meta > span::before {
        content: none !important;
    }
    #tmModal.mob-task .dmc-head-meta .dmc-head-recur {
        display: contents;
    }
    #tmModal.mob-task .dmc-head-meta .mob-deal-stage { order: 0;
    }
    #tmModal.mob-task .dmc-head-meta .crm-rc-pill { order: 1;
    }
    #tmModal.mob-task .dmc-head-meta .crm-rc-pill--kind { order: 2;
    }
    #tmModal.mob-task .dmc-head-meta:has(.crm-rc-pill) .dmc-head-date {
        display: none;
    }
    #tmModal.mob-task .dmc-head-meta .crm-rc-pill {
        height: 28px;
        padding: 0 10px;
        border-radius: 999px;
        font-size: 12px;
        white-space: nowrap;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    #tmModal.mob-task .dmc-head-date {
        order: 9;
        margin-left: auto;
        font-size: 12px;
        color: #8d919d;
        white-space: nowrap;
    }
    #tmModal.mob-task .mob-deal-stage {
        display: inline-flex;
        margin: 0;
    }
    #tmModal.mob-task .mob-deal-stage .cdd {
        width: auto;
    }
    #tmModal.mob-task .mob-deal-stage .cdd-trigger {
        width: auto;
        height: 28px;
        padding: 0 10px 0 11px;
        gap: 7px;
        border-radius: 999px;
        background: #f3f4f1;
        border: 0;
        font-size: 12.5px;
        font-weight: 700;
    }
    #tmModal.mob-task .dmc-body {
        padding: 10px 12px 8px;
        gap: 10px;
        background: #f4f4f2;
    }
    #tmModal.mob-task .dmc-idcol,
    #tmModal.mob-task .dmc-relcol {
        display: contents !important;
    }
    #tmModal.mob-task .dmc-card { order: 3;
    }
    #tmModal.mob-task .dmc-card--resp { order: 3;
    }
    #tmModal.mob-task .mob-deal-hide {
        display: none !important;
    }
    #tmModal.mob-task .dmc-idcol .dmc-card,
    #tmModal.mob-task .dmc-relcol .dmc-card {
        margin: 0;
        padding: 14px 16px;
        border-radius: 20px;
        box-shadow: 0 1px 2px rgba(17, 18, 23, .04);
    }
    #tmModal.mob-task .mob-deal-tabs {
        flex: none;
        display: flex;
        gap: 0;
        margin: 0;
        padding: 0 6px;
        background: #fff;
        border-bottom: 1px solid rgba(17, 18, 23, .08);
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent);
                mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent);
    }
    #tmModal.mob-task .mob-deal-tab {
        flex: none;
        position: relative;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        height: 42px;
        padding: 0 10px;
        border: 0;
        border-radius: 0;
        background: none;
        color: #666d79;
        font-family: 'Onest', sans-serif;
        font-size: 14px;
        font-weight: 700;
        white-space: nowrap;
        -webkit-tap-highlight-color: transparent;
        transition: color .15s;
    }
    #tmModal.mob-task .mob-deal-tab:last-child {
        margin-right: 16px;
    }
    #tmModal.mob-task .mob-deal-tab.is-active {
        background: none;
        color: var(--mob-ink);
    }
    #tmModal.mob-task .mob-deal-tab.is-active::after {
        content: '';
        position: absolute;
        left: 8px;
        right: 8px;
        bottom: 0;
        height: 3px;
        border-radius: 3px 3px 0 0;
        background: #A8E76A;
    }
    #tmModal.mob-task .mob-deal-tab-n {
        min-width: 19px;
        height: 19px;
        padding: 0 5px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .08);
        color: #3f4352;
        font-size: 11.5px;
        line-height: 19px;
        text-align: center;
    }
    #tmModal.mob-task .mob-deal-tab-n:empty,
    #tmModal.mob-task .mob-deal-tab:not(.has-dot) .mob-deal-tab-dot {
        display: none;
    }
    #tmModal.mob-task .mob-deal-tab-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: #8fd34f;
    }
    #tmModal.mob-task .dmc-contact-card {
        border: 0;
        padding: 4px 0 0;
        background: none;
        box-shadow: none;
    }
    #tmModal.mob-task .dmc-card-head {
        margin-bottom: 4px;
    }
    #tmModal.mob-task .dmc-card-title {
        font-size: 11px;
        letter-spacing: .07em;
        color: #8d919d;
    }
    #tmModal.mob-task .dmc-feed:empty::before {
        content: 'Пока пусто — добавьте заметку, задачу или файл кнопками внизу';
        display: block;
        padding: 6px 4px 4px;
        font-size: 13px;
        color: #8d919d;
        line-height: 1.45;
    }
    #tmModal.mob-task #tmTabs {
        display: none !important;
    }
    #tmModal.mob-task .dmc-main {
        background: #fff;
        border-radius: 20px;
        padding: 0;
    }
    #tmModal.mob-task .dmc-panes {
        background: none;
        padding: 12px;
    }
    #tmModal.mob-task[data-mob-pane="desc"] .dmc-main,
    #tmModal.mob-task[data-mob-pane="chat"] .dmc-main,
    #tmModal.mob-task[data-mob-pane="recur"] .dmc-main {
        background: none;
        border-radius: 0;
    }
    #tmModal.mob-task[data-mob-pane="desc"] .dmc-panes,
    #tmModal.mob-task[data-mob-pane="chat"] .dmc-panes,
    #tmModal.mob-task[data-mob-pane="recur"] .dmc-panes {
        padding: 2px 0 0;
    }
    #tmModal.mob-task #tmSidePaneChat > .dmc-card--chat {
        background: none;
        border: 0;
        box-shadow: none;
    }
    #tmModal.mob-task #tmSidePaneChat > .dmc-card--chat {
        padding-left: 0;
        padding-right: 0;
    }
    #tmModal.mob-task #tmSidePaneChat .dmc-card-head--act {
        padding-left: 0;
        padding-right: 0;
    }
    #tmModal.mob-task.mob-form-open .dm-footer {
        display: none;
    }
    #tmModal.mob-task .mob-deal-sub {
        display: none;
        align-items: center;
        gap: 10px;
        padding: 12px 12px 0;
    }
    #tmModal.mob-task.mob-feed-sub .mob-deal-sub {
        display: flex;
    }
    #tmModal.mob-task .mob-deal-sub-back {
        flex: none;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        height: 34px;
        padding: 0 13px 0 8px;
        border: 0;
        border-radius: 999px;
        background: #f3f4f1;
        color: var(--mob-ink);
        font-family: 'Onest', sans-serif;
        font-size: 13px;
        font-weight: 700;
        -webkit-tap-highlight-color: transparent;
    }
    #tmModal.mob-task.mob-feed-noall .mob-deal-sub-back {
        display: none;
    }
    #tmModal.mob-task .mob-deal-sub-title {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 15px;
        font-weight: 700;
        color: var(--mob-ink);
    }
    #tmModal.mob-task.mob-feed-noall .mob-deal-sub-title {
        padding-left: 4px;
    }
    #tmModal.mob-task .dmc-card[data-dmc-block] > .dmc-card-head {
        cursor: default;
        touch-action: auto;
    }
    #tmModal.mob-task .dmc-layout-reset {
        display: none !important;
    }
    #tmModal.mob-task .dmc-fi.mob-fi-new {
        animation: mobFiNew 2.4s ease-out;
        border-radius: 12px;
    }
    #tmModal.mob-task .dmc-comp-tools {
        flex: 1 1 auto;
        min-width: 0;
        flex-wrap: nowrap;
        gap: 2px;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: none;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent);
                mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent);
    }
    #tmModal.mob-task .dmc-comp-tools button {
        flex: none;
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 15px;
        color: #666d79;
    }
    #tmModal.mob-task .dmc-comp-tools button svg {
        width: 17px;
        height: 17px;
    }
    #tmModal.mob-task .dmc-comp-tools-sep {
        flex: none;
        margin: 0 3px;
    }
    #tmModal.mob-task #tmNoteComposer .dmc-comp-foot,
    #tmModal.mob-task .dm-comment-edit-actions,
    #tmModal.mob-task .dmc-add-task-actions,
    #tmModal.mob-task .dmc-reply-actions {
        flex: none;
        display: flex;
        align-items: center;
        gap: 6px;
        margin: 0;
        padding: 0;
    }
    #tmModal.mob-task #tmNoteComposer .dmc-comp-foot .crm-btn-cancel,
    #tmModal.mob-task .dm-comment-edit-actions .crm-btn-cancel,
    #tmModal.mob-task .dmc-add-task-actions .crm-btn-cancel,
    #tmModal.mob-task .dmc-reply-actions .crm-btn-cancel {
        flex: none;
        width: 36px;
        height: 36px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        font-size: 0;
        background: #f1f2ef url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666d79' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") no-repeat center;
    }
    #tmModal.mob-task #tmNoteComposer .dmc-comp-foot .crm-btn-primary,
    #tmModal.mob-task .dm-comment-edit-actions .crm-btn-primary,
    #tmModal.mob-task .dmc-add-task-actions .crm-btn-primary,
    #tmModal.mob-task .dmc-reply-actions .crm-btn-primary {
        flex: none;
        width: 40px;
        height: 40px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        font-size: 0;
        background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='19' height='19' viewBox='0 0 24 24' fill='none' stroke='%23173b14' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") no-repeat center, var(--mob-grad);
        box-shadow: 0 4px 12px -4px rgba(90, 167, 43, .55);
    }
    #tmModal.mob-task .dmc-reply-form .dmc-reply-actions .crm-btn-primary {
        background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='19' height='19' viewBox='0 0 24 24' fill='none' stroke='%23173b14' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M5.5 11.5L12 5l6.5 6.5'/%3E%3C/svg%3E") no-repeat center, var(--mob-grad);
    }
    #tmModal.mob-task .dmc-add-task-actions {
        justify-content: flex-end;
        margin-top: 4px;
    }
    #tmModal.mob-task .dmc-add-task-card .dmc-comp-tools {
        margin: 0 0 8px;
    }
    #tmModal.mob-task #tmNoteComposer.dmc-comp {
        border-radius: 18px;
    }
    #tmModal.mob-task #tmNoteComposer .dmc-comp-body {
        padding-top: 12px;
    }
    #tmModal.mob-task #tmNoteComposer .dmc-comp-types {
        flex-wrap: nowrap;
        gap: 6px;
        padding: 0 12px;
        margin-bottom: 0;
        overflow-x: auto;
    }
    #tmModal.mob-task #tmNoteComposer .dmc-comp-types button {
        flex: none;
        height: 32px;
        padding: 0 11px;
        border-radius: 999px;
        font-size: 12.5px;
    }
    #tmModal.mob-task #tmNoteComposer .dmc-comp-text {
        min-height: 96px;
        max-height: 38vh;
        padding: 12px 14px;
        line-height: 1.5;
    }
    #tmModal.mob-task #tmNoteComposer .dmc-comp-bar {
        gap: 8px;
        padding: 8px 8px 8px 6px;
        border-radius: 0 0 18px 18px;
    }
    #tmModal.mob-task .dmc-card-act {
        min-height: 38px;
        padding: 0 14px;
        border-radius: 12px;
        font-size: 13.5px;
    }
    #tmModal.mob-task .dm-comment-item {
        display: grid;
        grid-template-columns: 34px minmax(0, 1fr);
        column-gap: 10px;
        row-gap: 8px;
        align-items: center;
        padding: 12px;
        border-radius: 16px;
    }
    #tmModal.mob-task .dm-comment-item-main {
        display: contents;
    }
    #tmModal.mob-task .dm-comment-item-ava {
        width: 34px;
        height: 34px;
    }
    #tmModal.mob-task .dm-comment-item-top {
        align-items: center;
        gap: 0 4px;
        margin: 0;
        min-width: 0;
    }
    #tmModal.mob-task .dm-comment-item-author {
        flex: 1 1 0;                      
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 14px;
    }
    #tmModal.mob-task .dm-comment-item-date {
        order: 10;
        flex-basis: 100%;
        margin: 0;
        font-size: 12px;
        color: #8d919d;
    }
    #tmModal.mob-task .dm-comment-pin,
    #tmModal.mob-task .dm-comment-edit,
    #tmModal.mob-task .dm-comment-delete {
        flex: none;
        width: 32px;
        height: 32px;
        margin: 0;
        border-radius: 10px;
        opacity: 1;
        color: #8d919d;
    }
    #tmModal.mob-task .dm-comment-pin svg,
    #tmModal.mob-task .dm-comment-edit svg,
    #tmModal.mob-task .dm-comment-delete svg {
        width: 15px;
        height: 15px;
    }
    #tmModal.mob-task .dm-comment-item-date + button {
        margin-left: auto;
    }
    #tmModal.mob-task .dm-comment-item-text,
    #tmModal.mob-task .dm-comment-edit-bar,
    #tmModal.mob-task .dm-comment-item .dmc-replies {
        grid-column: 1 / -1;
        margin: 0;
    }
    #tmModal.mob-task .dm-comment-item-text {
        font-size: 14.5px;
        line-height: 1.5;
    }
    #tmModal.mob-task .dm-comment-item.is-editing .dm-comment-item-text {
        border-radius: 12px;
        border-bottom: 1px solid rgba(90, 167, 43, .45);
        min-height: 72px;
    }
    #tmModal.mob-task .dm-comment-edit-bar,
    #tmModal.mob-task .dmc-reply-edit-bar {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }
    #tmModal.mob-task .dmc-replies-link {
        min-height: 32px;
        font-size: 13px;
    }
    #tmModal.mob-task .dmc-replies-list:not(:empty) {
        padding-left: 10px;
    }
    #tmModal.mob-task .dmc-reply-top {
        flex-wrap: wrap;
        font-size: 12px;
    }
    #tmModal.mob-task .dmc-reply-top b {
        font-size: 13.5px;
    }
    #tmModal.mob-task .dmc-reply-text {
        font-size: 14px;
    }
    #tmModal.mob-task .dmc-reply-act,
    #tmModal.mob-task .dmc-reply-del {
        opacity: 1;
        min-width: 28px;
        min-height: 28px;
        justify-content: center;
    }
    #tmModal.mob-task .dmc-reply-stub {
        min-height: 42px;
        display: flex;
        align-items: center;
        border-radius: 12px;
        font-size: 14px;
    }
    #tmModal.mob-task .dmc-reply-form {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
        align-items: center;
        margin: 10px 0 0;
    }
    #tmModal.mob-task .dmc-reply-ed {
        grid-column: 1 / -1;
        min-height: 64px;
        border: 1px solid rgba(90, 167, 43, .45);
        border-radius: 12px;
        padding: 10px 12px;
        line-height: 1.45;
    }
    #tmModal .mob-pick-head {
        flex: none;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 14px 10px;
    }
    #tmModal .mob-pick-x {
        flex: none;
        width: 36px;
        height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 0;
        border-radius: 50%;
        background: #f3f4f1;
        color: var(--mob-ink);
        -webkit-tap-highlight-color: transparent;
    }
    #tmModal .mob-pick-title {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-family: 'Unbounded', sans-serif;
        font-size: 17px;
        font-weight: 600;
        letter-spacing: -.02em;
        color: var(--mob-ink);
    }
    #tmModal.mob-task .dm-footer {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 6px;
        padding: 8px 12px max(8px, calc(env(safe-area-inset-bottom, 0px) - 8px));
    }
    #tmModal.mob-task .dm-footer .dmc-actions {
        display: flex;
        gap: 6px;
        flex: 3 1 0;
        min-width: 0;
        margin: 0;
        padding: 0;
        border: 0;
    }
    #tmModal.mob-task .dm-footer .dmc-action {
        flex: 1 1 0;
        min-width: 0;
        height: 44px;
        padding: 0;
        gap: 0;
        justify-content: center;
        border-radius: 14px;
        background: #f1f2ef;
        border: 0;
        box-shadow: none;
        color: var(--mob-ink);
        -webkit-tap-highlight-color: transparent;
    }
    #tmModal.mob-task .dm-footer .dmc-action span {
        display: none;
    }
    #tmModal.mob-task .dm-footer .dmc-action svg {
        flex: none;
        width: 19px;
        height: 19px;
    }
    #tmModal.mob-task .dm-footer .dmc-action.is-on {
        background: #eefbe3;
        color: #2f6a14;
    }
    #tmModal.mob-task .dm-footer #tmSubmitBtn {
        flex: 1.25 1 0;
        min-width: 0;
        height: 44px;
        padding: 0;
        margin: 0;
        border-radius: 14px;
        font-size: 0;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: center;
    }

    /* ── Свои правила окна задачи (поверх перенесённых из окна сделки) ── */
    #tmModal.tm-dm.mob-task {
        left: 0;
        right: 0;
        border: 0;
        box-shadow: 0 -14px 44px rgba(17, 18, 23, .18);
    }
    #tmModal.mob-task #tmRelcolToggle {
        display: none !important;
    }
    /* Вкладки: «Описание» (ТЗ и подзадачи) · «Детали» (поля задачи и сводка) · «Клиент» (контакт,
       компания, ответственное лицо) · «Лента» · «Заметки» · «Файлы» · «Повтор». Какие карточки
       видны — по классу mob-tab-* на окне (mobile.js — taskTab) */
    #tmModal.mob-task .dmc-idcol,
    #tmModal.mob-task .dmc-relcol {
        display: contents !important;
    }
    #tmModal.mob-task:not(.mob-tab-client) .dmc-idcol > .dmc-card,
    #tmModal.mob-task:not(.mob-tab-info) .dmc-relcol > .dmc-card,
    #tmModal.mob-task:not(.mob-tab-feed) .dmc-main {
        display: none !important;
    }
    #tmModal.mob-task .dmc-idcol .dmc-card,
    #tmModal.mob-task .dmc-relcol .dmc-card {
        margin: 0;
        padding: 14px 16px;
        border-radius: 20px;
        box-shadow: 0 1px 2px rgba(17, 18, 23, .04);
    }
    #tmModal.mob-task .dmc-body {
        padding: 10px 12px 8px;
        gap: 10px;
        background: #f4f4f2;
    }
    #tmModal.mob-task .mob-deal-hide {
        display: none !important;
    }
    /* «Описание», «Заметки», «Повтор» — без белой подложки: ТЗ, подзадачи и заметки своими карточками */
    #tmModal.mob-task[data-mob-pane="desc"] .dmc-main,
    #tmModal.mob-task[data-mob-pane="chat"] .dmc-main,
    #tmModal.mob-task[data-mob-pane="recur"] .dmc-main {
        background: none;
        border-radius: 0;
    }
    #tmModal.mob-task[data-mob-pane="desc"] .dmc-panes,
    #tmModal.mob-task[data-mob-pane="chat"] .dmc-panes,
    #tmModal.mob-task[data-mob-pane="recur"] .dmc-panes {
        padding: 2px 0 0;
    }
    #tmModal.mob-task #tmPanelDesc .tm-sub-head,#modal-deal.mob-deal #dmcPane-tasks .tm-sub-head  {
        padding: 6px 2px 2px;
    }
    /* Порядок во вкладке «Описание» — как в разметке: поле ТЗ, ответ Pato, подзадачи (шапка, форма,
       список), клиенты. Общее правило `.dmc-card { order: 3 }` (для карточек вкладки «Детали»)
       уводило поле ТЗ ниже шапки «Подзадачи» */
    #tmModal.mob-task #tmPanelDesc > * {
        order: 0;
    }
    #tmModal.mob-task #tmSidePaneChat > .dmc-card--chat {
        padding-left: 0;
        padding-right: 0;
        background: none;
        border: 0;
        box-shadow: none;
    }
    /* Поля «Деталей» строками «подпись — значение» */
    #tmModal.mob-task .dmc-relcol .dm-info-row {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        min-height: 46px;
        padding: 8px 0;
        border-bottom: 1px solid rgba(17, 18, 23, .06);
    }
    #tmModal.mob-task .dmc-relcol .dm-info-row:last-child {
        border-bottom: 0;
    }
    #tmModal.mob-task .dmc-relcol .dm-info-row > .dm-info-label {
        flex: none;
        width: auto;
    }
    #tmModal.mob-task .dmc-relcol .dm-info-row > .cdd {
        flex: 0 1 62%;
        min-width: 0;
    }
    #tmModal.mob-task .dmc-relcol .dm-info-row:has(#tmTagsList) {
        flex-direction: column;
        align-items: stretch;
    }
    /* Название задачи в шапке — как название заявки: крупно, без рамки */
    #tmModal.mob-task .dmc-head-name {
        width: 100% !important;
        max-width: 100%;
        font-size: 19px;
        line-height: 1.25;
        text-overflow: ellipsis;
    }
    #tmModal.mob-task .dmc-head-actions .dmc-snooze-btn {
        height: 34px;
        padding: 0 12px;
        border-radius: 999px;
        font-size: 13px;
        font-weight: 700;
    }
    /* Шапка описания: автор в одну строку (имя сокращается), дата под ним; кнопки справа */
    #tmModal.mob-task .tm-desc-top,#modal-deal.mob-deal .tm-desc-top  {
        align-items: flex-start;
        padding: 12px 10px 0 16px;
    }
    #tmModal.mob-task .tm-desc-author,#modal-deal.mob-deal .tm-desc-author  {
        flex: 1 1 0;
        min-width: 0;
        flex-wrap: wrap;
    }
    #tmModal.mob-task .tm-desc-author-name,#modal-deal.mob-deal .tm-desc-author-name  {
        flex: 1 1 0;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    #tmModal.mob-task .tm-desc-author-meta,#modal-deal.mob-deal .tm-desc-author-meta  {
        flex-basis: 100%;
        padding-left: 30px;
    }
    #tmModal.mob-task .tm-desc-author-meta::before,#modal-deal.mob-deal .tm-desc-author-meta::before  {
        content: none;
    }
    #tmModal.mob-task #tmShareBtn span {
        display: none;                    /* «Поделиться» — значком, места в строке мало */
    }
    #tmModal.mob-task #tmShareBtn {
        width: 34px;
        padding: 0;
        justify-content: center;
    }
}


/* ══════════════════════════════════════════════════════════════════════
   «Задачи» на телефоне (этап 4, 11.10.2026) — как CRM: шапка одной строкой (название вида —
   переключатель «Активные ▾», mobile.js — initTaskViewSwitch), строка этапов доски
   (initTaskStages), на экране одна колонка; прокручивается страница
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    body.sb-modern #page-tasks.active {
        height: auto;
        min-height: 0;
        overflow: visible;
    }
    body.sb-modern #page-tasks .tasks-view.active {
        overflow: visible;
        height: auto;
        max-height: none;
        flex: none;
    }
    body.sb-modern #page-tasks .tasks-header {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 6px;
        padding-top: 14px;
        padding-bottom: 6px;
    }
    body.sb-modern #page-tasks .tasks-header-left {
        display: contents;
    }
    body.sb-modern #page-tasks .tasks-page-title,
    body.sb-modern #page-tasks #tasksStatsBar,
    body.sb-modern #page-tasks #tasksStatsToggle {
        display: none !important;
    }
    body.sb-modern #page-tasks .tasks-header-right {
        order: 2;
        flex: none;
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 6px;
        margin-left: auto;
    }
    body.sb-modern #page-tasks .mob-crm-view {
        order: 1;
        flex: 0 1 auto;
        min-width: 0;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        height: 42px;
        margin: 0 auto 0 0;
        padding: 0;
        border: 0;
        background: none;
        color: var(--mob-ink);
        font-family: 'Unbounded', sans-serif;
        font-size: 17px;
        font-weight: 600;
        letter-spacing: -.02em;
        -webkit-tap-highlight-color: transparent;
    }
    body.sb-modern #page-tasks .mob-crm-view-lbl {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    body.sb-modern #page-tasks .mob-crm-view-n {
        flex: none;
        min-width: 22px;
        height: 22px;
        padding: 0 6px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .08);
        font-family: 'Onest', sans-serif;
        font-size: 12px;
        font-weight: 700;
        line-height: 22px;
        text-align: center;
        letter-spacing: 0;
    }
    body.sb-modern #page-tasks .mob-crm-view-n:empty {
        display: none;
    }
    body.sb-modern #page-tasks .mob-crm-view svg {
        flex: none;
        width: 26px;
        height: 26px;
        padding: 5px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 1px 2px rgba(17, 18, 23, .08);
    }
    @media (max-width: 380px) {
        body.sb-modern #page-tasks .mob-crm-view {
            gap: 4px;
            font-size: 16px;
        }
    }
    body.sb-modern #page-tasks .tasks-header:has(.tasks-search-wrap.is-open) .mob-crm-view {
        display: none;
    }
    body.sb-modern #page-tasks .tasks-header:has(.tasks-search-wrap.is-open) .tasks-header-right {
        flex: 1 1 0%;
        min-width: 0;
        margin-left: 0;
    }
    body.sb-modern #page-tasks .tasks-search-wrap.is-open {
        flex: 1 1 0% !important;
        min-width: 0 !important;
        width: auto !important;
        max-width: none !important;
    }
    /* Строка этапов доски — та же, что у «Воронки» */
    body.sb-modern #page-tasks .mob-stage-bar {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        scrollbar-width: none;
        position: sticky;
        top: calc(env(safe-area-inset-top, 0px) + var(--mob-edge) + var(--mob-top-h) + 4px);
        z-index: 20;
        margin: 0;
        padding: 8px var(--page-gutter) 10px;
        background: #efefee;
        scroll-padding-inline: var(--page-gutter);
    }
    /* строка этапов — только у доски (на «Просроченных», «Регулярных» и т.п. её нет) */
    body.sb-modern #page-tasks:not(:has(#tasksViewOnce.active)) #mobTaskStageBar {
        display: none !important;
    }
    body.sb-modern #page-tasks .mob-stage-bar::-webkit-scrollbar {
        display: none;
    }
    body.sb-modern #page-tasks .tasks-kanban.mob-stages {
        display: block;
        overflow: visible;
        height: auto;
        padding-left: 0;
        padding-right: 0;
    }
    body.sb-modern #page-tasks .tasks-kanban.mob-stages > .tasks-col:not(.mob-on) {
        display: none !important;
    }
    body.sb-modern #page-tasks .tasks-kanban.mob-stages > .tasks-col.mob-on {
        width: auto;
        min-width: 0;
        max-width: none;
        height: auto;
        max-height: none;
        margin: 0 var(--page-gutter) 16px;
        overflow: visible;
    }
    /* «Просроченные» — группы по давности друг под другом (на компьютере — колонками в ряд) */
    body.sb-modern #page-tasks .tasks-ov-kanban {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        overflow: visible;
        height: auto;
        padding: 0 var(--page-gutter) 16px;
    }
    body.sb-modern #page-tasks .tasks-ov-kanban[style*="none"] {
        display: none !important;
    }
    body.sb-modern #page-tasks .tasks-ov-kanban > * {
        width: auto;
        min-width: 0;
        max-width: none;
        height: auto;
        max-height: none;
        flex: none;
        margin: 0;
    }
    body.sb-modern #page-tasks .tasks-ov-kanban .tasks-col-body {
        overflow: visible;
        max-height: none;
        flex: none;
    }
    body.sb-modern #page-tasks .tasks-kanban.mob-stages .tasks-col-body {
        overflow: visible;
        max-height: none;
        flex: none;
    }
}

/* Телефон боком: высоты мало — меню ниже, без подписей и не во всю ширину */
@media (hover: none) and (pointer: coarse) and (max-height: 500px) {
    body.sb-modern {
        --mob-nav-h: 52px;
        --mob-top-h: 52px;
    }
    .mob-nav {
        left: 50%;
        right: auto;
        width: min(460px, calc(100% - 2 * var(--mob-edge)));
        transform: translateX(-50%);
    }
    .mob-nav-pill {
        padding: 5px;
    }
    .mob-pato-ic {
        width: 40px;
        height: 40px;
    }
    .mob-nav-lbl {
        display: none;
    }
    .mob-top {
        margin-top: var(--mob-edge);
    }
    .mob-top-logo {
        width: 34px;
        height: 34px;
    }
    .mob-top-btn,
    .mob-top-ava {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 700px) and (prefers-reduced-motion: reduce), (hover: none) and (pointer: coarse) and (max-height: 500px) and (prefers-reduced-motion: reduce) {
    .mob-sheet,
    .mob-sheet-back,
    .mob-nav-ic {
        transition: none;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   Календарь на телефоне (этап 4, 11.10.2026). Логика — assets/js/calendar.js (не менялась),
   телефонная обвязка — initCalendar() в mobile.js. Ушка у меню нет: вход — кнопка-листок в
   верхней строке (#mobCalBtn, число сегодня и счётчик записей). Панель — лист на весь экран,
   как окно сделки и задачи (сверху щель 10px, скругление, затемнение); карточка записи и форма
   въезжают поверх неё; выбор даты и времени — шторкой снизу (#mobCalPopBack — затемнение)
   ══════════════════════════════════════════════════════════════════════ */
#mobNotifBack,
#mobFilterBack,
.mob-notif-x {
    display: none;
}
#mobCalBtn[hidden],
#mobCalPopBack[hidden],
.mob-hm-date,
.cal-mob-x {
    display: none !important;
}
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    /* Кнопка в верхней строке — листок календаря: день недели и число */
    .mob-top-cal-ic {
        display: flex;
        flex-direction: column;
        align-items: center;
        line-height: 1;
        gap: 1px;
    }
    .mob-top-cal-wd {
        font: 700 8px/1 'Onest', sans-serif;
        font-style: normal;
        letter-spacing: .08em;
        text-transform: uppercase;
        color: var(--mob-muted, #8d919d);
    }
    .mob-top-cal-dn {
        font: 700 15px/1.05 'Unbounded', 'Onest', sans-serif;
        letter-spacing: -.02em;
        font-variant-numeric: tabular-nums;
    }
    .mob-top-cal .mob-top-badge {
        background: linear-gradient(135deg, #5cc531 0%, #2f8a1c 100%);
        color: #fff;
    }
    .mob-top-cal .mob-top-badge.is-pending {
        background: #f6c66b;
        color: #6b4410;
    }
    body.cal-open .mob-top-cal {
        background: var(--mob-green-soft, #eefbe3);
    }

    /* Затемнение и лист */
    .cal-backdrop {
        z-index: 9992;
        background: rgba(15, 17, 23, .32);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .cal-drawer {
        z-index: 9993;
        top: calc(env(safe-area-inset-top, 0px) + 10px);
        bottom: 0;
        left: 0;
        right: 0;
        width: auto;
        padding-left: 0;
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -10px 40px rgba(15, 17, 23, .14);
        clip-path: none;
        transform: translateY(100%);
        transition: transform .42s var(--cal-ease), visibility 0s .42s;
        overscroll-behavior: contain;
    }
    body.cal-open .cal-drawer {
        clip-path: none;
        transform: none;
        transition: transform .42s var(--cal-ease), visibility 0s;
    }
    html.mob-kbs body.cal-open .cal-drawer {
        top: max(calc(var(--mob-vvt, 0px) + 10px), calc(env(safe-area-inset-top, 0px) + 10px));
        bottom: auto;
        height: calc(var(--mob-vvb, 100vh) - max(calc(var(--mob-vvt, 0px) + 10px), calc(env(safe-area-inset-top, 0px) + 10px)));
        transition: none;
    }

    /* Шапка: ручка сверху, заголовок, «+ Запись», закрыть */
    .cal-head {
        position: relative;
        padding: 20px 16px 0;
    }
    .cal-head::before {
        content: '';
        position: absolute;
        top: 7px;
        left: 50%;
        width: 38px;
        height: 4px;
        margin-left: -19px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .14);
    }
    .cal-head-top {
        gap: 8px;
    }
    .cal-title {
        font-size: 19px;
    }
    .cal-add {
        height: 38px;
        padding: 0 14px 0 11px;
        font-size: 13.5px;
    }
    .cal-head-top .cal-mob-x {
        display: grid !important;
        width: 38px;
        height: 38px;
        flex-shrink: 0;
        border: 0;
        border-radius: 50%;
        background: #f2f3f0;
        color: var(--cal-ink2);
        display: grid;
        place-items: center;
        padding: 0;
        -webkit-tap-highlight-color: transparent;
    }
    .cal-mob-x svg {
        width: 18px;
        height: 18px;
    }
    .cal-nav {
        margin-top: 14px;
    }
    .cal-iconbtn {
        width: 38px;
        height: 38px;
    }
    .cal-today-btn {
        height: 32px;
        padding: 0 13px;
        font-size: 12.5px;
    }
    .cal-views {
        margin-top: 12px;
    }
    .cal-views button {
        height: 34px;
        font-size: 13px;
    }
    .cal-strip {
        gap: 2px;
        margin-top: 12px;
    }
    .cal-strip .dn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    .cal-filters {
        margin: 12px -16px 0;
        padding: 0 16px 12px;
    }
    .cal-chip {
        height: 32px;
    }
    .cal-drawer button,
    .cal-pop button,
    .cal-mday,
    .cal-ev,
    .cal-ag-ev {
        -webkit-tap-highlight-color: transparent;
    }
    /* наведения на телефоне нет — подсветки «по наведению» не залипают после касания */
    .cal-ev:hover,
    .cal-ag-ev:hover {
        transform: none;
        box-shadow: none;
    }
    .cal-slot:hover {
        background: none;
    }
    .cal-slot:hover::after {
        content: none;
    }
    .cal-slot:active {
        background: rgba(168, 231, 106, .18);
    }

    /* Тело: низ — над полосой «домой» iPhone */
    .cal-body {
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .cal-allday {
        padding: 12px 16px 4px 62px;
    }
    .cal-grid {
        margin: 8px 12px 22px 0;
    }
    .cal-hour {
        height: 60px;
        padding-left: 56px;
    }
    .cal-hour::after,
    .cal-slot,
    .cal-now {
        left: 56px;
    }
    .cal-hour-l {
        left: 10px;
    }
    .cal-slot {
        height: 30px;
    }
    .cal-empty-hint {
        margin: 12px 16px 0;
    }
    .cal-agenda {
        padding: 4px 16px 24px;
    }
    .cal-ag-ev {
        padding: 11px 12px;
        grid-template-columns: 50px minmax(0, 1fr) auto;
    }
    .cal-month {
        padding: 8px 10px 24px;
    }
    .cal-mgrid {
        gap: 3px;
    }
    .cal-mday {
        min-height: 58px;
        padding: 6px 5px 5px;
        border-radius: 12px;
    }

    /* Карточка записи и форма — во весь лист */
    .cal-sheet {
        left: 0;
        border-radius: 24px 24px 0 0;
    }
    .cal-sheet-head {
        padding: 16px 16px 12px;
    }
    .cal-sheet-head .cal-iconbtn {
        width: 38px;
        height: 38px;
    }
    .cal-sheet-body {
        padding: 16px 16px 20px;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    .cal-sheet-foot {
        padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 12px);
    }
    html.mob-kbs .cal-sheet-foot {
        padding-bottom: calc(var(--mob-sheet-acc, 0px) + 12px);
    }
    /* «Отмена» формы не нужна — назад ведёт стрелка в шапке листа */
    .cal-sheet-foot [data-f="cancel"] {
        display: none;
    }
    .cal-btn {
        height: 46px;
        border-radius: 14px;
        font-size: 14.5px;
    }
    .cal-d-row {
        grid-template-columns: 22px 96px minmax(0, 1fr);
    }
    .cal-d-actions .cal-btn {
        flex: 1 1 calc(50% - 4px);
    }

    /* Форма: «Когда» — дата во всю ширину, начало и конец под ней */
    .cal-f-row3 {
        grid-template-columns: 1fr 1fr;
    }
    .cal-f-row3 > :first-child {
        grid-column: 1 / -1;
    }
    .cal-f-types {
        gap: 6px;
    }
    .cal-f-type {
        height: 44px;
        padding: 0 9px;
        font-size: 13.5px;
    }
    .cal-input,
    .cal-pick,
    .cal-stepper {
        height: 46px;
    }
    .cal-stepper button {
        width: 44px;
    }
    .cal-seg button {
        height: 38px;
        font-size: 13px;
    }
    .cal-who button {
        height: 38px;
    }
    .cal-toggle {
        min-height: 32px;
    }
    .cal-client-res {
        max-height: 200px;
    }
    /* «Гости» и «Стол / зал» — поровну: поле числа без своей ширины не распирает колонку */
    .cal-f-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
    .cal-stepper input {
        width: 0;
    }

    /* Выбор даты и времени — шторкой снизу */
    #mobCalPopBack {
        position: fixed;
        inset: 0;
        z-index: 9995;
        background: rgba(15, 17, 23, .32);
        touch-action: none;
        animation: mobCalFade .2s ease both;
    }
    .cal-pop {
        z-index: 9996;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        bottom: 0 !important;
        padding: 26px 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -10px 40px rgba(15, 17, 23, .16);
        animation: mobCalUp .3s var(--cal-ease) both;
    }
    .cal-pop::before {
        content: '';
        position: absolute;
        top: 9px;
        left: 50%;
        width: 38px;
        height: 4px;
        margin-left: -19px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .14);
    }
    .cal-pop-mhead {
        margin-bottom: 10px;
    }
    .cal-pop-mhead b {
        font-size: 15px;
    }
    .cal-pop-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 3px;
    }
    .cal-pop-grid button {
        width: 100%;
        height: 44px;
        border-radius: 12px;
        font-size: 15px;
    }
    .cal-pop-grid button:hover {
        background: none;
    }
    .cal-pop-grid button.is-sel:hover {
        background: var(--cal-ink);
    }
    .cal-pop-times {
        width: auto;
        max-height: min(52vh, 380px);
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    .cal-pop-times button {
        height: 44px;
        border-radius: 12px;
        font-size: 14px;
    }
    .cal-pop-times button:hover {
        border-color: var(--cal-line);
        background: #fff;
    }
    .cal-pop-times button.is-sel,
    .cal-pop-times button.is-sel:hover {
        background: var(--cal-ink);
        border-color: var(--cal-ink);
        color: #fff;
    }

    .cal-toast {
        left: 50%;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
    }
    .cal-toast.is-high {
        bottom: calc(env(safe-area-inset-bottom, 0px) + 84px);
    }
}
@keyframes mobCalFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mobCalUp { from { transform: translateY(100%); } to { transform: none; } }

/* Календарь на телефоне — выбор клиента из базы (calClientPicker() в mobile.js): экран поверх
   формы записи, как выбор клиента в сделке. Поле «Имя» — кнопка-вход в этот экран */
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    .cal-sheet .cal-input.mcl-trigger {
        cursor: pointer;
        caret-color: transparent;
        padding-right: 36px;
        background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238d919d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
    }
    .cal-sheet .cal-input.mcl-trigger::placeholder {
        color: var(--cal-ink2);
    }
    .cal-f-row:has(.cal-client) {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }
    .cal-client-card.mcl-card {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .mcl-pick {
        position: absolute;
        inset: 0;
        z-index: 30;
        display: flex;
        flex-direction: column;
        background: #fff;
        border-radius: 24px 24px 0 0;
        transform: translateY(100%);
        transition: transform .3s var(--cal-ease);
    }
    .mcl-pick.is-on {
        transform: none;
    }
    .mcl-head {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 16px 16px 10px;
        flex-shrink: 0;
    }
    .mcl-head b {
        font-family: 'Unbounded', sans-serif;
        font-size: 16px;
        font-weight: 700;
        letter-spacing: -.2px;
    }
    .mcl-back {
        width: 38px;
        height: 38px;
        border-radius: 50%;
        border: 1px solid var(--cal-line);
        background: #fff;
        color: var(--cal-ink2);
        display: grid;
        place-items: center;
        padding: 0;
        -webkit-tap-highlight-color: transparent;
    }
    .mcl-back svg {
        width: 17px;
        height: 17px;
    }
    .mcl-search {
        position: relative;
        margin: 0 16px 6px;
        flex-shrink: 0;
    }
    .mcl-search svg {
        position: absolute;
        left: 13px;
        top: 50%;
        width: 17px;
        height: 17px;
        margin-top: -8.5px;
        color: var(--cal-muted);
        pointer-events: none;
    }
    .mcl-search input {
        width: 100%;
        box-sizing: border-box;
        height: 46px;
        padding: 0 14px 0 40px;
        border-radius: 14px;
        border: 1.5px solid #e8e9ec;
        background: #f7f8f5;
        font: inherit;
        font-size: 16px;
        color: var(--cal-ink);
        outline: none;
        -webkit-appearance: none;
        appearance: none;
    }
    .mcl-search input:focus {
        border-color: var(--cal-lime2);
        background: #fff;
        box-shadow: 0 0 0 4px rgba(168, 231, 106, .2);
    }
    .mcl-list {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        padding: 0 10px calc(env(safe-area-inset-bottom, 0px) + 16px);
    }
    html.mob-kbs .mcl-list {
        padding-bottom: calc(var(--mob-sheet-acc, 0px) + 16px);
    }
    .mcl-sec {
        padding: 14px 6px 6px;
        font-size: 11px;
        font-weight: 800;
        letter-spacing: .4px;
        text-transform: uppercase;
        color: var(--cal-muted);
    }
    .mcl-letter {
        position: sticky;
        top: 0;
        z-index: 1;
        padding: 6px 6px 4px;
        background: #fff;
        font: 700 12px/1.2 'Unbounded', 'Onest', sans-serif;
        color: var(--cal-ink2);
    }
    .mcl-row {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        padding: 9px 6px;
        border: 0;
        border-radius: 14px;
        background: none;
        text-align: left;
        font: inherit;
        color: var(--cal-ink);
        -webkit-tap-highlight-color: transparent;
    }
    .mcl-row:active {
        background: #f3fbec;
    }
    .mcl-ava {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
        border-radius: 50%;
        display: grid;
        place-items: center;
        color: #fff;
        font-size: 16px;
        font-weight: 700;
    }
    .mcl-ava--new {
        background: #eefbe3;
        color: var(--cal-green);
    }
    .mcl-ava--new svg {
        width: 18px;
        height: 18px;
    }
    .mcl-txt {
        min-width: 0;
        flex: 1;
    }
    .mcl-txt b {
        display: block;
        font-size: 15px;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .mcl-txt small {
        display: block;
        margin-top: 2px;
        font-size: 12.5px;
        color: var(--cal-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .mcl-new {
        margin-top: 4px;
    }
    .mcl-new .mcl-txt b {
        color: var(--cal-green);
    }
    .mcl-empty {
        padding: 22px 12px;
        text-align: center;
        font-size: 13px;
        line-height: 1.45;
        color: var(--cal-muted);
    }
}

/* ══════════════════════════════════════════════════════════════════════
   «Задачи» на телефоне — доделки 11.10.2026 (по скриншотам владельца)
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    /* Пункт «Скрыть / Показать цифры» в меню «⋯» — только на «Регулярных» */
    #tasksMenu #tasksMenuStatsItem[data-on="1"] {
        display: flex !important;
    }
    /* Поиск в «Задачах» — один в один как в CRM: белый кружок с лёгкой тенью, у открытого — лаймовая
       рамка с кольцом (раньше фон был полупрозрачный, без тени и без кольца) */
    body.sb-modern #page-tasks .tasks-search-wrap {
        background: #fff;
        border: 1px solid rgba(17, 18, 23, .08);
        box-shadow: 0 2px 10px rgba(17, 18, 23, .04);
    }
    body.sb-modern #page-tasks .tasks-search-wrap.is-open,
    body.sb-modern #page-tasks .tasks-search-wrap:focus-within {
        border-color: rgba(168, 231, 106, .75);
        box-shadow: 0 0 0 3px rgba(168, 231, 106, .18);
    }

    /* Лупа в шапке — та же, что в CRM (14px, линия 2) */
    body.sb-modern #page-tasks .tasks-search-wrap svg {
        width: 14px;
        height: 14px;
        stroke-width: 2;
    }

    /* ── «Регулярные»: плитки — полосой от отступа до края экрана, как в CRM ── */
    body.sb-modern #page-tasks #tasksViewRecurring {
        overflow: visible;
        height: auto;
        min-height: 0;
        padding-left: 0;
        padding-right: 0;
    }
    body.sb-modern #page-tasks #tasksViewRecurring .crm-rc-summary {
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 10px;
        margin: 0 !important;
        padding: 12px 0 4px !important;
        width: 100%;
        box-sizing: border-box;
    }
    body.sb-modern #page-tasks #tasksViewRecurring .crm-rc-summary > .crm-rc-tiles {
        flex: none;
        width: 100%;
        box-sizing: border-box;
        padding: 0 var(--page-gutter);
        scroll-padding-inline: var(--page-gutter);
        scrollbar-width: none;
        -webkit-mask-image: none;
        mask-image: none;
    }
    body.sb-modern #page-tasks #tasksViewRecurring .crm-rc-tiles::-webkit-scrollbar {
        display: none;
    }
    /* Фильтр и вид — под плитками, строкой, закреплённой под верхней строкой (как этапы доски).
       Фильтр — отдельными пилюлями (листаются вбок), справа — «Карточки / Список / Клиенты» */
    body.sb-modern #page-tasks .crm-rc-side.mob-rc-side {
        position: sticky;
        top: calc(env(safe-area-inset-top, 0px) + var(--mob-edge) + var(--mob-top-h) + 4px);
        z-index: 20;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        width: 100%;
        box-sizing: border-box;
        margin: 0;
        padding: 8px var(--page-gutter) 10px;
        background: #efefee;
    }
    /* «Скрыть цифры» прячет только плитки — фильтр и вид остаются (просьба владельца 12.10.2026) */
    body.sb-modern #page-tasks #trcStatsWrap:has(#trcSummary[style*="none"]) + .mob-rc-side {
        display: none;
    }
    body.sb-modern #page-tasks .mob-rc-side #trcTabs {
        flex: 1 1 auto;
        min-width: 0;
        order: 1;
        display: flex;
        gap: 6px;
        width: auto;
        max-width: none;
        margin: 0;
        padding: 0;
        background: none;
        box-shadow: none;
        border: 0;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 16px), transparent);
        mask-image: linear-gradient(90deg, #000 calc(100% - 16px), transparent);
    }
    body.sb-modern #page-tasks .mob-rc-side #trcTabs::-webkit-scrollbar {
        display: none;
    }
    body.sb-modern #page-tasks .mob-rc-side #trcTabs .crm-rc-tabs-ind {
        display: none;
    }
    body.sb-modern #page-tasks .mob-rc-side #trcTabs .crm-rc-tab {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        height: 32px;
        padding: 0 8px 0 12px;
        border: 0;
        border-radius: 999px;
        background: #fff;
        box-shadow: inset 0 0 0 1px rgba(17, 18, 23, .07);
        color: #666d79;
        font-size: 12px;
        font-weight: 800;
        white-space: nowrap;
        -webkit-tap-highlight-color: transparent;
    }
    body.sb-modern #page-tasks .mob-rc-side #trcTabs .crm-rc-tab.active {
        background: var(--mob-ink);
        color: #fff;
        box-shadow: none;
    }
    body.sb-modern #page-tasks .mob-rc-side #trcTabs .crm-rc-tab-n {
        min-width: 18px;
        height: 18px;
        padding: 0 5px;
        box-sizing: border-box;
        border-radius: 999px;
        background: #f3f4f1;
        color: #666d79;
        font-size: 11px;
        line-height: 18px;
        text-align: center;
    }
    body.sb-modern #page-tasks .mob-rc-side #trcTabs .crm-rc-tab.active .crm-rc-tab-n {
        background: rgba(255, 255, 255, .16);
        color: #fff;
    }
    body.sb-modern #page-tasks .mob-rc-side #trcTabs .crm-rc-tab-n.is-urgent {
        background: #fde8e8;
        color: #c4262c;
    }
    body.sb-modern #page-tasks .mob-rc-side .trc-view-toggle {
        order: 2;
        flex: none;
        margin: 0;
        padding: 2px;
        height: 32px;
        box-sizing: border-box;
        border-radius: 999px;
    }
    body.sb-modern #page-tasks .mob-rc-side .trc-view-toggle .crm-view-toggle-btn {
        width: 30px;
        height: 28px;
        padding: 0;
        border-radius: 999px;
    }

    /* Прокручивается страница, у области списка своей прокрутки нет */
    body.sb-modern #page-tasks .trc-body {
        overflow: visible !important;
        flex: none !important;
        height: auto !important;
        padding: 6px var(--page-gutter) 24px !important;
        --trc-pad: 0px;
    }
    body.sb-modern #page-tasks .crm-rc-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    /* «Список» — без таблицы: строка-карточка. Сверху задача (аватар, название, клиент · график)
       и действия, ниже статус · срок · циклы, внизу прогресс клиентов (если есть) */
    body.sb-modern #page-tasks .tasks-view--recurring .crm-rc-box {
        min-width: 0;
        border-radius: 18px;
    }
    body.sb-modern #page-tasks .crm-rc-box .crm-rc-head-row.trc-row {
        display: none;
    }
    body.sb-modern #page-tasks .crm-rc-box .trc-row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px 10px;
        height: auto;
        min-height: 0;
        padding: 12px 12px 12px 14px;
    }
    body.sb-modern #page-tasks .trc-row .crm-rc-c-deal {
        order: 1;
        flex: 1 1 calc(100% - 96px);      /* статус и срок — следующей строкой */
        min-width: 0;
    }
    /* «Без клиентов» в виде «Клиенты»: название во всю строку, статус и «+ Клиенты» под ним */
    body.sb-modern #page-tasks .trc-nocl .trc-nocl-row {
        grid-template-columns: 32px auto minmax(0, 1fr);
        row-gap: 8px;
        column-gap: 12px;
        padding: 12px 14px;
    }
    body.sb-modern #page-tasks .trc-nocl .trc-nocl-row > .trc-nocl-main {
        grid-column: 2 / -1;
        grid-row: 1;
    }
    body.sb-modern #page-tasks .trc-nocl .trc-nocl-row > :nth-child(3) {
        grid-column: 2;
        grid-row: 2;
    }
    body.sb-modern #page-tasks .trc-nocl .trc-nocl-row > :nth-child(4) {
        grid-column: 3;
        grid-row: 2;
        justify-self: end;
    }
    body.sb-modern #page-tasks .trc-row .crm-rc-c-act {
        order: 2;
        flex: none;
        display: flex;
        align-items: center;
        gap: 2px;
    }
    body.sb-modern #page-tasks .trc-row .crm-rc-c-status {
        order: 3;
        flex: none;
        flex-basis: auto;
        margin-left: 48px;                /* под названием: аватар 36px + промежуток */
    }
    body.sb-modern #page-tasks .trc-row .crm-rc-c-date {
        order: 4;
        flex: none;
        font-size: 12.5px;
    }
    body.sb-modern #page-tasks .trc-row .crm-rc-c-cycles {
        order: 5;
        flex: none;
        margin-left: auto;
    }
    body.sb-modern #page-tasks .trc-row .trc-c-cl {
        order: 6;
        flex: 1 1 100%;
        padding-left: 48px;
    }
    body.sb-modern #page-tasks .trc-row .trc-c-cl:has(.trc-cl--none) {
        display: none;
    }
    body.sb-modern #page-tasks .trc-row .trc-cl {
        width: 100%;
    }
    body.sb-modern #page-tasks .trc-row .crm-rc-c-deal-txt b {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* «Клиенты» — карточка задачи в ширину экрана: название над строкой состояния,
       столбец «Клиент» уже (шаги видны сразу), кнопки ‹ › — справа от названия */
    body.sb-modern #page-tasks .trc-mx {
        border-radius: 18px;
    }
    body.sb-modern #page-tasks .trc-mx-head {
        flex-wrap: wrap;
        gap: 8px 10px;
        padding: 14px 14px 12px;
    }
    body.sb-modern #page-tasks .trc-mx-head-main {
        flex: 1 1 calc(100% - 90px);
        min-width: 0;
    }
    body.sb-modern #page-tasks .trc-mx-title {
        font-size: 15px;
    }
    body.sb-modern #page-tasks .trc-mx-nav {
        order: 2;
        margin-left: auto;
    }
    body.sb-modern #page-tasks .trc-mx-head > :not(.trc-mx-head-main):not(.trc-mx-nav) {
        order: 3;
        flex: 1 1 100%;
        justify-content: flex-start;
        margin: 0;
    }
    body.sb-modern #page-tasks .trc-mx-scroll {
        --trc-client-w: 128px;
    }
    body.sb-modern #page-tasks .trc-mx .trc-mx-client,
    body.sb-modern #page-tasks .trc-mx th:first-child,
    body.sb-modern #page-tasks .trc-mx td:first-child {
        max-width: 128px !important;
        min-width: 112px !important;
        width: 128px !important;
    }

    /* ── Карточка подзадачи (#tmSubCard) — шторкой снизу, как задача в сделке ── */
    #tmSubCard.open {
        align-items: flex-end;
        justify-content: stretch;
        padding: 0;
        z-index: 9991;
    }
    #tmSubCard .tm-sc-card {
        position: relative;
        width: 100%;
        max-width: none;
        max-height: 88vh;
        max-height: 88dvh;
        margin: 0;
        border: 0;
        border-radius: 26px 26px 0 0;
        box-shadow: 0 -14px 44px rgba(17, 18, 23, .2);
        animation: mobConfirmUp .26s cubic-bezier(.22, .61, .36, 1);
    }
    #tmSubCard .tm-sc-card::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        z-index: 1;
        width: 36px;
        height: 4px;
        margin-left: -18px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .14);
    }
    /* шапка: строка «↳ задача · создана» и кнопки справа; ниже кружок и название во всю ширину;
       под названием срок · ответственный · приоритет в строку с переносом */
    #tmSubCard .tc-head {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto auto auto;
        align-items: center;
        column-gap: 8px;
        row-gap: 6px;
        padding: 24px 14px 6px 16px;
    }
    #tmSubCard .tc-head-main {
        display: contents;
    }
    #tmSubCard .tc-meta-row {
        grid-column: 1 / 3;
        grid-row: 1;
        margin: 0;
        min-width: 0;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        font-size: 12.5px;
    }
    #tmSubCard #tmScParent span {
        max-width: 150px;
    }
    #tmSubCard #tmScEditBtn,
    #tmSubCard #tmScDeleteBtn,
    #tmSubCard #tmScCloseXBtn {
        grid-row: 1;
        width: 34px;
        height: 34px;
        margin: 0;
    }
    #tmSubCard #tmScEditBtn svg,
    #tmSubCard #tmScDeleteBtn svg,
    #tmSubCard #tmScCloseXBtn svg {
        width: 16px;
        height: 16px;
    }
    #tmSubCard #tmScCloseXBtn {
        border-radius: 50%;
        background: #f1f2ef;
        color: var(--mob-ink);
    }
    #tmSubCard .tc-done-btn {
        grid-column: 1;
        grid-row: 2;
        align-self: start;
        width: 26px;
        height: 26px;
        margin: 1px 0 0;
    }
    #tmSubCard .tc-title-view,
    #tmSubCard .tc-title-input {
        grid-column: 2 / -1;
        grid-row: 2;
        min-width: 0;
        font-size: 18px;
        line-height: 1.3;
    }
    #tmSubCard .tc-title-input,
    #tmSubCard .tc-title-input:focus {
        width: 100%;
        margin: 0;
        padding: 0;
        border: 0;
        background: none;
        box-shadow: none;
        outline: none;
        font-size: 18px !important;
    }
    #tmSubCard .tm-sc-chips {
        grid-column: 2 / -1;
        grid-row: 3;
        margin-top: 2px;
        row-gap: 6px;
    }
    #tmSubCard .tm-sc-chip {
        font-size: 13.5px;
    }
    #tmSubCard .tm-sc-card:not(.is-edit) .tc-body,
    #tmSubCard .tc-body {
        padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 18px);
    }
    #tmSubCard #tmScDescView {
        font-size: 15px;
        line-height: 1.55;
    }
    #tmSubCard .tc-desc-view img {
        max-width: 100%;
        height: auto;
        border-radius: 12px;
    }
    #tmSubCard .tc-fields {
        gap: 0;
        margin-top: 12px;
        border-top: 1px solid rgba(17, 18, 23, .06);
    }
    #tmSubCard .tc-fields .dmc-tf-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        min-height: 48px;
        margin: 0;
        border-bottom: 1px solid rgba(17, 18, 23, .06);
    }
    #tmSubCard .tc-fields .dmc-tf-row:last-child {
        border-bottom: 0;
    }
    #tmSubCard .dmc-comp-tools {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        gap: 2px;
    }
    #tmSubCard .dmc-comp-tools button {
        flex: none;
        width: 36px;
        height: 36px;
    }
    #tmSubCard .tc-foot {
        padding: 10px 16px max(12px, env(safe-area-inset-bottom, 0px));
        background: #fff;
    }
    #tmSubCard .tc-foot-actions {
        width: 100%;
        gap: 8px;
    }
    #tmSubCard .tc-foot-actions > button {
        flex: 1 1 0;
        height: 46px;
        padding: 0 12px;
        border-radius: 14px;
        font-size: 15px;
        justify-content: center;
    }
    html.mob-kbs #tmSubCard .tm-sc-card {
        position: fixed;
        left: 0;
        right: 0;
        top: max(calc(var(--mob-vvt, 0px) + 10px), calc(env(safe-area-inset-top, 0px) + 10px));
        bottom: auto;
        height: calc(var(--mob-vvb, 100vh) - max(calc(var(--mob-vvt, 0px) + 10px), calc(env(safe-area-inset-top, 0px) + 10px)));
        max-height: none;
        animation: none;
    }
    html.mob-kbs #tmSubCard .tc-foot {
        padding-bottom: calc(var(--mob-sheet-acc, 0px) + 10px);
    }

    /* ── Описание на весь экран (#tmReader) — лист снизу во весь рост ── */
    .tm-reader {
        padding: calc(env(safe-area-inset-top, 0px) + 10px) 0 0;
        z-index: 9991;
        align-items: stretch;
    }
    .tm-reader-panel {
        width: 100%;
        border-radius: 24px 24px 0 0;
        transform: translateY(24px);
    }
    .tm-reader-head {
        padding: 22px 0 14px;
    }
    .tm-reader-head::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        width: 36px;
        height: 4px;
        margin-left: -18px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .14);
    }
    .tm-reader-head-main {
        max-width: none;
        padding: 0 64px 0 16px;
    }
    .tm-reader-title {
        font-size: 19px;
    }
    .tm-reader-author {
        margin-top: 10px;
    }
    .tm-reader-close {
        top: 18px;
        right: 14px;
        width: 38px;
        height: 38px;
    }
    .tm-reader-scroll {
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    .tm-reader-body {
        max-width: none;
        padding: 18px 16px calc(env(safe-area-inset-bottom, 0px) + 32px);
        font-size: 16px;
        line-height: 1.6;
    }
    .tm-reader-body img {
        max-width: 100%;
        height: auto;
    }

    /* ── Правка ТЗ: одна строка — инструменты (листаются вбок), Pato, «Отмена» и «Опубликовать»
       круглыми значками (как в формах заметок). Подписи кнопок — в разметке, значок — фоном ── */
    #tmModal.mob-task .tm-desc-bar,#modal-deal.mob-deal .tm-desc-bar  {
        gap: 6px;
        padding: 8px 8px 8px 10px;
    }
    #tmModal.mob-task #tmDescCard .tm-desc-tools,#modal-deal.mob-deal #dmTzCard .tm-desc-tools  {
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 14px), transparent);
        mask-image: linear-gradient(90deg, #000 calc(100% - 14px), transparent);
    }
    #tmModal.mob-task #tmDescCard .tm-desc-tools::-webkit-scrollbar,#modal-deal.mob-deal #dmTzCard .tm-desc-tools::-webkit-scrollbar  {
        display: none;
    }
    #tmModal.mob-task #tmDescCard .tm-desc-tools button,#modal-deal.mob-deal #dmTzCard .tm-desc-tools button  {
        flex: none;
        width: 34px;
        height: 34px;
    }
    #tmModal.mob-task .tm-desc-actions,#modal-deal.mob-deal .tm-desc-actions  {
        gap: 6px;
    }
    #tmModal.mob-task .tm-desc-actions .tpa-sw,#modal-deal.mob-deal .tm-desc-actions .tpa-sw  {
        margin: 0;
        padding: 0 8px;
        height: 34px;
    }
    #tmModal.mob-task .tm-desc-actions .tpa-sw > span:not(.ibx-ai-sw),#modal-deal.mob-deal .tm-desc-actions .tpa-sw > span:not(.ibx-ai-sw)  {
        display: none;                    /* «Pato» — значком с переключателем */
    }
    #tmModal.mob-task #tmDescCancelBtn {
        flex: none;
        width: 36px;
        height: 36px;
        min-width: 0;
        padding: 0;
        border: 0;
        border-radius: 50%;
        font-size: 0;
        background: #f1f2ef url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666d79' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") no-repeat center;
    }
    #tmModal.mob-task #tmDescPublishBtn {
        flex: none;
        width: 40px;
        height: 40px;
        min-width: 0;
        padding: 0;
        border: 0;
        border-radius: 50%;
        font-size: 0;
        background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='19' height='19' viewBox='0 0 24 24' fill='none' stroke='%23173b14' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") no-repeat center, var(--mob-grad);
        box-shadow: 0 4px 12px -4px rgba(90, 167, 43, .55);
    }
    #tmModal.mob-task #tmDescPublishBtn:disabled {
        opacity: .4;
        box-shadow: none;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   «Обзор» на телефоне (этап 5, 11.10.2026). Сверху — «Обзор» и сегодняшняя дата (mobile.js,
   .mob-hm-date), под ними строка состояния аудита; первой карточкой — «Фокус на сегодня»
   (что сделать сейчас), потом аудит компактно, мелкие карточки — по две в ряд, «Позиции» —
   во всю ширину. Кнопки шапки «Обзора» (команда, пригласить, задачи, CRM) уже есть в верхней
   строке и в «Ещё» — здесь скрыты. «Маркетинг» ведёт на страницу, которой нет, — скрыт
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    #page-home .hm-shell {
        display: flex;
        flex-direction: column;
        min-height: 0;
        padding: 10px var(--page-gutter) 24px;
    }
    #page-home .hm-title-row {
        order: 1;
        margin: 4px 0 0;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    #page-home .hm-title-row h1 {
        font-size: 28px;
        line-height: 1.05;
    }
    .mob-hm-date {
        display: block !important;
        margin-top: 6px;
        color: var(--hm-muted, #8d919d);
        font-size: 14px;
        font-weight: 600;
    }
    .mob-hm-date::first-letter {
        text-transform: uppercase;
    }
    /* подпись «Единая сводка…» не нужна; без сайта или с закончившимся тарифом — нужна */
    #page-home .hm-shell:not(:has(.hm-grid--locked)) .hm-title-row p {
        display: none;
    }
    #page-home .hm-shell:not(:has(.hm-grid--locked)) .hm-title-row .hm-primary-link {
        display: none;
    }
    #page-home .hm-title-row .hm-primary-link {
        height: 44px;
        border-radius: 14px;
    }

    /* строка состояния аудита */
    #page-home .hm-topbar {
        order: 2;
        margin: 14px 0 0;
        padding: 0;
    }
    #page-home .hm-top-right {
        display: none;
    }
    #page-home .hm-focus-now {
        width: 100%;
        min-width: 0;
        max-width: none;
        height: auto;
        min-height: 64px;
        padding: 13px;
        gap: 12px;
        border-radius: 999px;             /* полная пилюля — по форме круглых значков внутри */
        -webkit-tap-highlight-color: transparent;
    }
    #page-home .hm-focus-now:hover {
        transform: none;
    }
    #page-home .hm-focus-copy {
        display: none;
    }
    #page-home .hm-ai-core {
        width: 38px;
        height: 38px;
    }
    #page-home .hm-focus-meta {
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 3px;
    }
    #page-home .hm-focus-meta b {
        font-size: 14.5px;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    #page-home .hm-focus-meta small {
        font-size: 12.5px;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    /* «Сделать аудит» — круглый серый значок «обновить» в конце строки, как стрелка ↗ у «Фокуса на
       сегодня» (текстовые кнопки — чёрная и светлая пилюли — владелец отверг); подпись — в aria-label,
       нажимается вся строка */
    #page-home .hm-focus-action {
        flex: none;
        width: 38px;
        min-width: 0;
        height: 38px;
        margin-left: auto;
        padding: 0;
        border-radius: 50%;
        font-size: 0;
        color: transparent;
        background: rgba(17, 18, 23, .07) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23111217' stroke-width='2.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 11-2.64-6.36'/%3E%3Cpolyline points='21 3 21 9 15 9'/%3E%3C/svg%3E") no-repeat center / 15px;
        box-shadow: none;
        transform: none !important;
    }
    #page-home .hm-focus-now:hover .hm-focus-action,
    #page-home .hm-focus-now:active .hm-focus-action {
        background-color: rgba(17, 18, 23, .12);
    }

    /* сетка карточек: две колонки */
    #page-home .hm-grid {
        order: 3;
        margin-top: 12px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-auto-rows: auto;
        gap: 10px;
    }
    #page-home .hm-card {
        grid-column: auto;
        grid-row: auto;
        border-radius: 20px;
        -webkit-tap-highlight-color: transparent;
    }
    #page-home .hm-card:active {
        transform: scale(.985);
    }
    #page-home .hm-focus-card    { order: 1; grid-column: 1 / -1; }
    #page-home .hm-audit-card    { order: 2; grid-column: 1 / -1; }
    #page-home .hm-kpi-card--tasks { order: 3; }
    #page-home .hm-crm-card      { order: 4; }
    #page-home .hm-task-card--audit { order: 5; }
    #page-home .hm-team-card     { order: 6; }
    #page-home .hm-positions-card { order: 7; grid-column: 1 / -1; }
    #page-home .hm-task-card--marketing { display: none; }

    /* «Фокус на сегодня»: заголовок и пояснение; «перейти» — маленький круглый значок со стрелкой ↗
       в правом верхнем углу карточки (область нажатия шире самого кружка) */
    #page-home .hm-focus-card {
        display: block;
        padding: 16px 62px 18px 18px;
    }
    #page-home .hm-focus-card h3 {
        font-size: 19px;
    }
    #page-home .hm-focus-card p {
        margin-top: 4px;
        font-size: 13px;
    }
    #page-home .hm-focus-card button {
        position: absolute;
        top: 14px;
        right: 14px;
        width: 34px;
        height: 34px;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 50%;
        font-size: 0;
        background: rgba(17, 18, 23, .09) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23111217' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17L17 7M8 7h9v9'/%3E%3C/svg%3E") no-repeat center / 15px;
        -webkit-tap-highlight-color: transparent;
    }
    #page-home .hm-focus-card button::before {
        content: '';
        position: absolute;
        inset: -8px;
    }

    /* аудит — компактно: заголовок, справа переключатель; балл и вывод в строку; график ниже */
    #page-home .hm-audit-card {
        padding: 16px;
    }
    #page-home .hm-audit-card .hm-card-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    #page-home .hm-audit-card h2 {
        font-size: 18px;
        line-height: 1.25;
    }
    #page-home .hm-audit-body {
        margin-top: 14px;
        grid-template-columns: auto minmax(0, 1fr);
        flex-direction: row;
        align-items: center;
        gap: 14px;
    }
    #page-home .hm-score-box strong {
        font-size: 40px;
    }
    #page-home .hm-score-box small {
        font-size: 11px;
        max-width: 110px;
    }
    #page-home .hm-audit-body p {
        font-size: 13px;
        line-height: 1.45;
    }
    #page-home .hm-bars {
        height: 104px;
        margin-top: 14px;
        padding-top: 12px;
        gap: 6px;
    }
    #page-home .hm-bar {
        grid-template-rows: 1fr 14px;
        gap: 4px;
    }
    #page-home .hm-bar i {
        border-radius: 8px 8px 3px 3px;
    }
    #page-home .hm-bar span {
        font-size: 9px;
    }

    /* мелкие карточки */
    #page-home .hm-kpi-card,
    #page-home .hm-crm-card,
    #page-home .hm-team-card,
    #page-home .hm-task-card--audit {
        padding: 14px;
        min-width: 0;
    }
    #page-home .hm-kpi-card strong,
    #page-home .hm-team-card strong {
        margin-top: 8px;
        font-size: 32px;
    }
    #page-home .hm-kpi-card small,
    #page-home .hm-team-card small {
        display: block;
        margin-top: 8px;
        font-size: 11.5px;
        line-height: 1.35;
    }
    #page-home .hm-deadline {
        margin-top: 10px;
        padding-top: 10px;
        gap: 7px;
    }
    #page-home .hm-deadline b {
        width: 24px;
        height: 24px;
        font-size: 11.5px;
    }
    #page-home .hm-deadline p {
        font-size: 11.5px;
        line-height: 1.25;
    }
    #page-home .hm-crm-card .hm-card-head {
        align-items: flex-start;
    }
    #page-home .hm-crm-card h3 {
        font-size: 15px;
        line-height: 1.25;
    }
    #page-home .hm-crm-card .hm-status-dot {
        display: none;
    }
    /* «Лиды · Диалоги · Конверсия» — строками «подпись — число» (в три столбца не помещались) */
    #page-home .hm-crm-metrics {
        margin-top: 10px;
        padding-top: 8px;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    #page-home .hm-crm-metrics > div {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 6px;
    }
    #page-home .hm-crm-metrics span {
        font-size: 10px;
    }
    #page-home .hm-crm-metrics strong {
        margin: 0;
        font-size: 14px;
    }
    #page-home .hm-task-card--audit {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    #page-home .hm-task-card--audit > div:first-child {
        min-width: 0;
    }
    #page-home .hm-task-card--audit .hm-kicker {
        display: block;
        padding-right: 46px;              /* справа — кольцо */
        line-height: 1.3;
    }
    #page-home .hm-task-card h3 {
        font-size: 32px;
    }
    #page-home .hm-task-card p {
        margin-top: 6px;
        font-size: 11.5px;
    }
    #page-home .hm-task-card--audit .hm-task-orb {
        position: absolute;
        top: 12px;
        right: 12px;
        width: 44px;
        height: 44px;
    }
    #page-home .hm-task-card--audit .hm-task-orb span {
        width: 34px;
        height: 34px;
        font-size: 12px;
    }
    #page-home .hm-avatars {
        margin-top: 10px;
    }
    #page-home .hm-avatars i {
        width: 26px;
        height: 26px;
    }

    /* «Позиции» */
    #page-home .hm-positions-card {
        padding: 16px;
    }
    #page-home .hm-pos-row span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}


/* ══════════════════════════════════════════════════════════════════════
   «Клиенты»: карточки без пустых строк + фильтры шторкой снизу (12.10.2026)
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    /* пустые «—» у телефона и почты не показываем; нет ни того ни другого — нет и блока с чертой
       (классы mob-empty ставит mobile.js — по тексту, CSS его не видит) */
    #page-clients .client-contact-row.mob-empty,
    #page-clients .client-card-contacts.mob-empty,
    #page-clients .deal-divider:has(+ .client-card-contacts.mob-empty),
    #page-clients .client-card-footer.mob-empty {
        display: none;
    }
    #page-clients .client-card-new {
        padding: 14px 14px 12px;
    }
    #page-clients .client-card-top {
        min-height: 40px;
    }
    #page-clients .client-card-name {
        font-size: 15px;
    }

    /* Фильтры — шторкой снизу: «Клиенты» (.crm-filter-panel), CRM и «Задачи» (.tasks-filter-panel).
       На компьютере это выпадающие окошки у кнопки; на телефоне они обрезались экраном снизу.
       Затемнение #mobFilterBack ставит mobile.js (нажатие закрывает тем же «нажатием мимо») */
    body .crm-filter-panel,
    body .tasks-filter-panel {
        position: fixed !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: auto !important;
        max-height: 80vh;
        max-height: 80dvh;
        margin: 0;
        border: 0;
        border-radius: 26px 26px 0 0;
        padding: 26px 18px calc(env(safe-area-inset-bottom, 0px) + 18px);
        box-shadow: 0 -14px 44px rgba(17, 18, 23, .2);
        z-index: 9986;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    body .crm-filter-panel {
        transform: translateY(100%) !important;
        transition: transform .28s cubic-bezier(.22, .61, .36, 1), opacity .2s;
    }
    body .crm-filter-panel.open {
        transform: none !important;
    }
    body .tasks-filter-panel.show {
        animation: mobConfirmUp .28s cubic-bezier(.22, .61, .36, 1);
    }
    body .crm-filter-panel::before,
    body .tasks-filter-panel::before {
        content: '';
        position: absolute;
        top: 9px;
        left: 50%;
        width: 36px;
        height: 4px;
        margin-left: -18px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .14);
    }
    body .crm-filter-panel .tf-panel-title,
    body .tasks-filter-panel .tf-panel-title {
        font-size: 17px;
    }
    body .crm-filter-panel label,
    body .tasks-filter-panel label {
        min-height: 36px;
    }
    body #mobFilterBack {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 9985;
        background: rgba(15, 17, 23, .38);
        touch-action: none;
        animation: mobCalFade .2s ease both;
    }
    body #mobFilterBack[hidden] {
        display: none;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   Pato по центру меню (13.10.2026): живая сфера в цветах Pato (те же пятна света, что у сферы
   на главном экране ассистента — плывут по кругу) и белая искра поверх. Без filter и
   mix-blend-mode — на iPhone они дают квадраты. Ассистент думает при закрытом листе — цвета
   плывут быстрее и искра крутится (.is-thinking), непрочитанный ответ — красная точка
   ══════════════════════════════════════════════════════════════════════ */
#mobPatoBtn {
    display: none;
}
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    body #mobPatoBtn {
        display: flex;
    }
    .mob-nav .mob-nav-pato {
        flex: 0 0 64px;
    }
    .mob-pato-ic {
        position: relative;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        display: grid;
        place-items: center;
        color: #fff;
        box-shadow: 0 8px 18px -6px rgba(15, 100, 97, .55), 0 0 0 3px rgba(255, 255, 255, .7);
        transition: transform .15s ease;
    }
    .mob-nav-pato:active .mob-pato-ic {
        transform: scale(.92);
    }
    .mob-pato-orb {
        position: absolute;
        inset: 0;
        border-radius: 50%;
        overflow: hidden;
        -webkit-mask-image: radial-gradient(circle, #000 69.5%, transparent 70.5%);
        mask-image: radial-gradient(circle, #000 69.5%, transparent 70.5%);
        background:
            radial-gradient(circle at 50% 112%, rgba(160, 230, 125, .6), rgba(160, 230, 125, 0) 55%),
            radial-gradient(circle at 40% 35%, #2fb3aa 0%, #178a85 48%, #0f6461 85%);
    }
    .mob-pato-orb::after {               /* блик и ободок */
        content: '';
        position: absolute;
        inset: 0;
        border-radius: 50%;
        background:
            radial-gradient(40% 24% at 36% 20%, rgba(255, 255, 255, .7), rgba(255, 255, 255, 0)),
            radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0) 62%, rgba(255, 255, 255, .35) 100%);
    }
    .mob-pato-orb b {
        position: absolute;
        border-radius: 50%;
        will-change: transform;
    }
    .mob-pato-orb b:nth-child(1) {
        width: 90%; height: 90%; left: -8%; top: -2%;
        background: radial-gradient(circle, rgba(205, 246, 160, .95) 0%, rgba(168, 231, 106, .6) 30%, rgba(168, 231, 106, 0) 66%);
        transform-origin: 62% 60%;
        animation: mptOrbSpin 9s linear infinite;
    }
    .mob-pato-orb b:nth-child(2) {
        width: 84%; height: 84%; right: -10%; bottom: -8%;
        background: radial-gradient(circle, rgba(255, 222, 165, .95) 0%, rgba(228, 178, 104, .62) 30%, rgba(228, 178, 104, 0) 66%);
        transform-origin: 34% 36%;
        animation: mptOrbSpin 12s linear infinite reverse;
    }
    .mob-pato-orb b:nth-child(3) {
        width: 76%; height: 76%; right: -6%; top: -10%;
        background: radial-gradient(circle, rgba(150, 245, 228, .9) 0%, rgba(80, 210, 190, .55) 30%, rgba(80, 210, 190, 0) 66%);
        transform-origin: 28% 70%;
        animation: mptOrbSpin 7s linear infinite;
    }
    .mob-pato-ic svg {
        position: relative;
        z-index: 1;
        width: 24px;
        height: 24px;
        stroke-width: 1.9;
    }
    .mob-nav-pato.is-thinking .mob-pato-orb b {
        animation-duration: 2.4s;
    }
    .mob-nav-pato.is-thinking .mob-pato-ic svg {
        animation: mptOrbSpin 2.4s linear infinite;
    }
    /* готовый ответ — зелёная точка над сферой (с 13.10.2026 все отметки меню зелёные, не красные) */
    .mob-nav-pato .mob-nav-dot {
        top: 3px;
        right: 3px;
        width: 13px;
        height: 13px;
        background: linear-gradient(135deg, #5cc531 0%, #2f8a1c 100%);
        border: 2.5px solid #fff;
        box-shadow: 0 2px 6px rgba(47, 138, 28, .45);
    }
}
@media (prefers-reduced-motion: reduce) {
    .mob-nav-pato .mob-pato-ic svg {
        animation: none !important;
    }
    .mob-pato-orb b:nth-child(1) { animation-duration: 27s !important; }
    .mob-pato-orb b:nth-child(2) { animation-duration: 36s !important; }
    .mob-pato-orb b:nth-child(3) { animation-duration: 21s !important; }
}

/* ══════════════════════════════════════════════════════════════════════
   Pato Assistant на телефоне (этап 5, 13.10.2026): открывается пунктом «Pato» нижнего меню
   (mobPatoOpen() в mobile.js) на любой странице. Окно — то же, что на компьютере
   (includes/dev_chat_widget.php), но листом снизу во весь экран: «ручка», шапка, разговор, поле ввода.
   Страница под ним стоит (setLock('pato')), затемнение #mobPatoBack и свайп вниз за шапку закрывают.
   Полноэкранного режима и рельсы истории нет — история в меню шапки «Чаты». Документ (отчёт)
   открывается поверх разговора во весь лист
   ══════════════════════════════════════════════════════════════════════ */
#mobPatoBack {
    display: none;
}
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    body .pai-shell {
        position: fixed !important;
        top: calc(env(safe-area-inset-top, 0px) + 10px) !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: auto !important;
        max-width: none !important;
        height: auto !important;
        border: 0 !important;
        border-radius: 26px 26px 0 0 !important;
        box-shadow: 0 -14px 44px rgba(17, 18, 23, .2) !important;
        z-index: 9993 !important;
        opacity: 1;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(100%);
        transition: transform .34s cubic-bezier(.22, .61, .36, 1), visibility 0s .34s !important;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    body .pai-shell.is-open {
        visibility: visible;
        pointer-events: auto;
        transform: none;
        transition: transform .34s cubic-bezier(.22, .61, .36, 1), visibility 0s !important;
    }
    body .pai-shell.mob-pato-drag {
        transition: none !important;
    }
    /* iPhone прокручивает блоки с overflow: hidden к полю в фокусе — лист «бегал» (шапка уезжала
       за край). clip не даёт прокручивать вовсе. Пока лист открыт, страница не тянется
       (обновление жестом в Safari) */
    body .pai-shell,
    body .pai-shell .pai-main-row,
    body .pai-shell .pai-chat-col {
        overflow: clip !important;
    }
    body .pai-shell .pai-input-wrap,
    body .pai-shell .pai-input-row {
        overflow: visible !important;
    }
    html.mob-pato-open,
    html.mob-pato-open body {
        overscroll-behavior: none;
    }
    body .pai-shell .pai-header {
        touch-action: none;
    }
    body .pai-shell::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        z-index: 6;
        width: 38px;
        height: 4px;
        margin-left: -19px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .14);
        pointer-events: none;
    }
    html.mob-kbs body .pai-shell.is-open {
        top: max(calc(var(--mob-vvt, 0px) + 10px), calc(env(safe-area-inset-top, 0px) + 10px)) !important;
        bottom: auto !important;
        height: calc(var(--mob-vvb, 100vh) - max(calc(var(--mob-vvt, 0px) + 10px), calc(env(safe-area-inset-top, 0px) + 10px))) !important;
        padding-bottom: var(--mob-sheet-acc, 0px);
        transition: none !important;
    }
    body .pai-shell .pai-header {
        padding: 22px 12px 8px 14px;
    }
    body .pai-shell #paiExpand,
    body .pai-shell #paiFabReset,
    body .pai-shell .pai-nav-rail {
        display: none !important;
    }
    body .pai-shell .pai-icon-btn {
        width: 38px;
        height: 38px;
    }
    body .pai-shell #paiClose {
        border-radius: 50%;
        background: #f1f2ef;
    }
    body .pai-shell .pai-main-row,
    body .pai-shell .pai-chat-col {
        width: 100% !important;
        max-width: none !important;
        flex: 1 1 auto;
        min-height: 0;
    }
    body .pai-shell .pai-body {
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    body .pai-shell .pai-input-wrap {
        padding-bottom: 6px;
    }
    body .pai-shell .pai-disclaimer {
        padding-bottom: 6px;
        font-size: 10.5px;
    }
    /* документ (отчёт) — поверх разговора во весь лист */
    body .pai-shell.has-doc .pai-doc-col {
        position: absolute;
        inset: 0;
        z-index: 20;
        width: auto !important;
        max-width: none !important;
        background: #fff;
        border-radius: 26px 26px 0 0;
    }
    body .pai-shell .pai-doc-topbar {
        padding-top: 22px;
    }
    /* затемнение под листом */
    body #mobPatoBack {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 9992;
        background: rgba(15, 17, 23, .38);
        touch-action: none;
        animation: mobCalFade .2s ease both;
    }
    body #mobPatoBack[hidden] {
        display: none;
    }
    /* Над листом открыто окно (сделка, клиент, задача, календарь — открыты позже Pato): лист уходит
       под окна (их слои — от 700 по счётчику _crmTopZ, календарь 9992+), но остаётся выше страницы,
       верхней строки и меню. Затемнение листа не нужно — у окна своё. Класс ставит mobile.js
       (patoLayerSync) */
    html.mob-pato-under body .pai-shell.is-open {
        z-index: 400 !important;
    }
    html.mob-pato-under body #mobPatoBack {
        display: none;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   Pato на телефоне — оформление листа (13.10.2026, по образцам владельца: Echo, Anox, Syncra).
   Светлый лист, снизу мягкое свечение цветов Pato (без зерна и размытия — на iPhone они давали квадраты); пустой экран — по центру живая
   сфера, дата пилюлей, приветствие по времени суток и крупное «Чем помочь?»; ниже стеклянные плитки
   только с тем, что горит (patoTodayRender() в mobile.js), внизу над полем — пилюли-подсказки.
   Поле ввода — стеклянная капсула, рядом отдельная круглая кнопка (как капсула меню и круг Pato).
   Прежние «Подсказки», плитки и приветствие окна на телефоне скрыты
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    body .pai-shell #paiSuggested,
    body .pai-shell #paiQuickRow,
    body .pai-shell .pai-empty .pai-greet,
    body .pai-shell .pai-empty .pai-spark--lg {
        display: none !important;
    }
    /* свечение снизу листа — сильнее на пустом экране, в разговоре — едва заметное у поля ввода */
    body .pai-shell .pai-chat-col {
        position: relative;
        isolation: isolate;
    }
    body .pai-shell .pai-chat-col::before {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: -1;
        pointer-events: none;
        transition: opacity .5s ease, height .5s ease;
    }
    body .pai-shell .pai-chat-col::before {
        height: 34%;
        background:
            radial-gradient(70% 80% at 14% 100%, rgba(168, 231, 106, .38), rgba(168, 231, 106, 0) 100%),
            radial-gradient(65% 75% at 60% 108%, rgba(42, 167, 161, .28), rgba(42, 167, 161, 0) 100%),
            radial-gradient(55% 65% at 100% 96%, rgba(215, 171, 107, .26), rgba(215, 171, 107, 0) 100%);
        opacity: .55;
    }
    body .pai-shell .pai-chat-col:has(.pai-empty)::before {
        height: 62%;
        opacity: 1;
    }
    /* Шапка — белая и поверх разговора: на iPhone анимированные слои сферы (пятна, ореол) не
       всегда обрезаются краем прокручиваемой области и залезали в шапку. Поэтому область
       разговора ещё и режет всё по своим краям (contain: paint) */
    body .pai-shell .pai-header {
        position: relative;
        z-index: 8;
        background: #fff;
    }
    body .pai-shell .pai-body {
        contain: paint;
    }
    /* белая «шторка» над полем ввода на компьютере закрывала бы свечение — вместо неё сам текст
       разговора мягко растворяется у нижнего края */
    body .pai-shell .pai-fade-bottom {
        display: none;
    }
    body .pai-shell .pai-body {
        -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent);
        mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent);
    }

    /* пустой экран — на всю высоту области разговора: сфера и заголовок по центру, подсказки внизу */
    body .pai-shell .pai-body:has(> .pai-empty) {
        justify-content: flex-start;
        padding-top: 0;
        padding-bottom: 0;
    }
    body .pai-shell .pai-empty {
        flex: 1 0 auto;
        min-height: 100%;
        margin: 0;
        padding: 0 16px 12px;
        gap: 0;
        align-items: stretch;
        justify-content: flex-start;
        text-align: left;
        box-sizing: border-box;
    }
    .mob-pato-today {
        flex: 1 0 auto;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 18px;
    }
    .mpt-hero {
        margin-top: auto;
        padding: 28px 0 4px;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    /* Сфера Pato — главный образ экрана. Стеклянный бирюзовый шар: внутри по кругу плывут три
       мягких пятна света (лайм, бирюза, золото), цвета перетекают; по краю ободок, сверху блик,
       снизу отсвет; вокруг дышит ореол, шар слегка парит.
       ВАЖНО: без filter: blur и mix-blend-mode — iPhone рисует такие слои внутри скруглённой
       рамки квадратами и может не анимировать их («квадратные фоны», «сфера не двигается»).
       Мягкость — только радиальными градиентами; рамку шара режет mask-image (надёжнее, чем
       overflow + border-radius на iPhone) */
    .mpt-orb {
        position: relative;
        width: 84px;
        height: 84px;
        margin-bottom: 24px;
        border-radius: 50%;
        animation: mptOrbFloat 6s ease-in-out infinite;
    }
    .mpt-orb::before {                    /* ореол */
        content: '';
        position: absolute;
        inset: -20px;
        border-radius: 50%;
        background: radial-gradient(closest-side, rgba(92, 197, 138, .34) 0%, rgba(42, 167, 161, .16) 55%, rgba(42, 167, 161, 0) 100%);
        animation: mptOrbBreath 5s ease-in-out infinite;
    }
    .mpt-orb::after {                     /* тень под шаром */
        content: '';
        position: absolute;
        left: 16%;
        right: 16%;
        bottom: -18px;
        height: 12px;
        border-radius: 50%;
        background: radial-gradient(closest-side, rgba(15, 85, 82, .28), rgba(15, 85, 82, 0));
        animation: mptOrbShadow 6s ease-in-out infinite;
    }
    .mpt-orb i {                          /* сам шар */
        position: absolute;
        inset: 0;
        border-radius: 50%;
        overflow: hidden;
        -webkit-mask-image: radial-gradient(circle, #000 69.5%, transparent 70.5%);
        mask-image: radial-gradient(circle, #000 69.5%, transparent 70.5%);
        background:
            radial-gradient(circle at 50% 112%, rgba(160, 230, 125, .6), rgba(160, 230, 125, 0) 55%),
            radial-gradient(circle at 40% 35%, #2fb3aa 0%, #178a85 45%, #0f6461 80%, #0b4d4b 100%);
    }
    .mpt-orb b {                          /* пятна света, плывут по кругу */
        position: absolute;
        border-radius: 50%;
        will-change: transform;
    }
    .mpt-orb b:nth-child(1) {
        width: 90%;
        height: 90%;
        left: -8%;
        top: -2%;
        background: radial-gradient(circle, rgba(205, 246, 160, .95) 0%, rgba(168, 231, 106, .6) 30%, rgba(168, 231, 106, 0) 66%);
        transform-origin: 62% 60%;
        animation: mptOrbSpin 9s linear infinite;
    }
    .mpt-orb b:nth-child(2) {
        width: 84%;
        height: 84%;
        right: -10%;
        bottom: -8%;
        background: radial-gradient(circle, rgba(255, 222, 165, .95) 0%, rgba(228, 178, 104, .62) 30%, rgba(228, 178, 104, 0) 66%);
        transform-origin: 34% 36%;
        animation: mptOrbSpin 12s linear infinite reverse;
    }
    .mpt-orb b:nth-child(3) {
        width: 76%;
        height: 76%;
        right: -6%;
        top: -10%;
        background: radial-gradient(circle, rgba(150, 245, 228, .9) 0%, rgba(80, 210, 190, .55) 30%, rgba(80, 210, 190, 0) 66%);
        transform-origin: 28% 70%;
        animation: mptOrbSpin 7s linear infinite;
    }
    .mpt-orb i::before {                  /* ободок и объём */
        content: '';
        position: absolute;
        z-index: 2;
        inset: 0;
        border-radius: 50%;
        background:
            radial-gradient(circle at 70% 78%, rgba(4, 40, 38, .38) 0%, rgba(4, 40, 38, 0) 55%),
            radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0) 60%, rgba(255, 255, 255, .16) 76%, rgba(255, 255, 255, .42) 100%);
    }
    .mpt-orb i::after {                   /* блик */
        content: '';
        position: absolute;
        z-index: 3;
        top: 8%;
        left: 17%;
        width: 44%;
        height: 26%;
        border-radius: 50%;
        background: radial-gradient(closest-side, rgba(255, 255, 255, .92), rgba(255, 255, 255, .28) 55%, rgba(255, 255, 255, 0));
        transform: rotate(-30deg);
    }
    .mpt-orb em {                         /* отсвет на нижнем крае */
        position: absolute;
        z-index: 2;
        left: 20%;
        right: 20%;
        bottom: 4%;
        height: 20%;
        border-radius: 50%;
        background: radial-gradient(closest-side, rgba(225, 255, 200, .5), rgba(225, 255, 200, 0));
    }
    .mpt-hi {
        margin-top: 4px;
        font-size: 15px;
        font-weight: 500;
        color: var(--mob-muted);
    }
    .mpt-title {
        margin-top: 2px;
        font-size: 24px;
        font-weight: 650;
        line-height: 1.15;
        letter-spacing: -.03em;
        color: var(--mob-ink);
    }

    /* стеклянные плитки — что горит прямо сейчас: крупная цифра цвета раздела, подпись,
       стрелка в углу и лёгкий отсвет того же цвета из угла плитки; без значков */
    .mpt-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 10px;
    }
    .mpt-grid.is-one {
        grid-template-columns: minmax(0, 1fr);
    }
    .mpt-card {
        position: relative;
        overflow: hidden;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "n go" "l l" "s s";
        align-items: start;
        row-gap: 0;
        padding: 14px 14px 14px 16px;
        border: 0;
        border-radius: 24px;
        background:
            radial-gradient(120% 90% at 100% 0%, var(--mpt-glow, transparent), transparent 60%),
            rgba(255, 255, 255, .78);
        -webkit-backdrop-filter: blur(16px) saturate(1.4);
        backdrop-filter: blur(16px) saturate(1.4);
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .95), 0 1px 2px rgba(17, 18, 23, .04), 0 16px 32px -16px rgba(17, 18, 23, .22);
        text-align: left;
        font: inherit;
        color: var(--mob-ink);
        -webkit-tap-highlight-color: transparent;
        transition: transform .14s ease;
    }
    .mpt-card:active {
        transform: scale(.97);
    }
    .mpt-n {
        grid-area: n;
        font-family: 'Unbounded', sans-serif;
        font-size: 30px;
        font-weight: 700;
        line-height: 1;
        letter-spacing: -.04em;
        color: var(--mpt-c, var(--mob-ink));
        font-variant-numeric: tabular-nums;
    }
    .mpt-go {
        grid-area: go;
        width: 28px;
        height: 28px;
        margin: -4px -4px 0 0;
        border-radius: 50%;
        display: grid;
        place-items: center;
        background: rgba(17, 18, 23, .05);
        color: var(--mob-ink-2);
    }
    .mpt-go svg {
        width: 13px;
        height: 13px;
    }
    .mpt-l {
        grid-area: l;
        margin-top: 12px;
        font-size: 14px;
        font-weight: 650;
        line-height: 1.25;
        letter-spacing: -.01em;
        color: var(--mob-ink);
    }
    .mpt-s {
        grid-area: s;
        margin-top: 3px;
        font-size: 12.5px;
        font-weight: 500;
        line-height: 1.3;
        color: var(--mob-muted);
    }
    .mpt-grid.is-one .mpt-card {
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas: "n l go" "n s go";
        align-items: center;
        column-gap: 14px;
    }
    .mpt-grid.is-one .mpt-l {
        margin-top: 0;
    }
    .mpt-grid.is-one .mpt-go {
        margin: 0;
    }
    .mpt-card--lead { --mpt-c: #3f8a1c; --mpt-glow: rgba(168, 231, 106, .38); }
    .mpt-card--task { --mpt-c: #d1343a; --mpt-glow: rgba(239, 68, 68, .16); }
    .mpt-card--cal  { --mpt-c: #1d8a83; --mpt-glow: rgba(42, 167, 161, .22); }
    .mpt-card--chat { --mpt-c: #4263eb; --mpt-glow: rgba(66, 99, 235, .16); }
    .mpt-calm {
        align-self: center;
        padding: 9px 14px;
        border-radius: 999px;
        background: rgba(255, 255, 255, .7);
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .95);
        font-size: 13px;
        font-weight: 500;
        color: var(--mob-ink-2);
        text-align: center;
    }

    /* пилюли-подсказки внизу, над полем ввода — «облаком»: три ровных ряда со сдвигом,
       ряды уходят за края листа (края растворяются) */
    .mpt-chips {
        margin: auto -16px 0;
        padding: 10px 0 8px;
        overflow: clip;
        -webkit-mask-image: linear-gradient(to right, transparent, #000 22px, #000 calc(100% - 22px), transparent);
        mask-image: linear-gradient(to right, transparent, #000 22px, #000 calc(100% - 22px), transparent);
    }
    .mpt-cloud {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    .mpt-row {
        display: flex;
        flex-wrap: nowrap;
        justify-content: center;
        gap: 8px;
        width: max-content;
    }
    .mpt-row--0 { transform: translateX(22px); }
    .mpt-row--1 { transform: translateX(-30px); }
    .mpt-row--2 { transform: translateX(16px); }
    .mpt-chip {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        gap: 7px;
        min-height: 40px;
        padding: 0 16px 0 13px;
        border: 0;
        border-radius: 999px;
        background: rgba(255, 255, 255, .92);
        box-shadow: inset 0 0 0 1px rgba(17, 18, 23, .07);
        font: inherit;
        font-size: 13.5px;
        font-weight: 600;
        letter-spacing: -.01em;
        color: var(--mob-ink);
        white-space: nowrap;
        -webkit-tap-highlight-color: transparent;
        transition: transform .14s ease, background .14s ease;
    }
    .mpt-chip.is-tint {
        background: rgba(232, 247, 214, .92);
        box-shadow: inset 0 0 0 1px rgba(125, 207, 70, .24);
    }
    .mpt-chip svg {
        flex: none;
        width: 17px;
        height: 17px;
        color: var(--mob-ink-2);
    }
    .mpt-chip:active {
        transform: scale(.95);
    }

    /* ── Поле ввода (по образцу владельца): одна большая стеклянная капсула — подпись слева,
       справа внутри значок звуковой волны (диктовка; значок ставит initPato()). Начали писать —
       на его месте круглая «Отправить», идёт ответ — «Остановить». «+» скрыт. Шрифт 16px —
       иначе iPhone увеличивает страницу при нажатии на поле.
       Запись голоса — в той же капсуле: красная точка, время, живая волна по громкости,
       справа «×» (отменить) и «✓» (готово); расшифровка — там же, «Расшифровываю…» ── */
    body .pai-shell .pai-input-wrap {
        position: relative;
        padding: 8px 14px 10px;
    }
    body .pai-shell .pai-input-row {
        flex-direction: row;
        align-items: flex-end;
        gap: 6px;
        min-height: 60px;
        box-sizing: border-box;
        padding: 8px 8px 8px 22px;
        border: 0;
        border-radius: 30px;
        background: linear-gradient(180deg, rgba(255, 255, 255, .96) 0%, rgba(244, 250, 240, .9) 100%);
        -webkit-backdrop-filter: blur(20px) saturate(1.5);
        backdrop-filter: blur(20px) saturate(1.5);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 1),
            inset 0 0 0 1px rgba(17, 18, 23, .07),
            0 16px 34px -16px rgba(17, 18, 23, .3);
        transition: box-shadow .2s ease;
    }
    /* Нажали на поле (и пока идёт запись голоса) — по краю капсулы бежит переливающаяся рамка
       цветов Pato (лайм → бирюза → золото), снаружи мягко дышит свечение тех же цветов, внутри —
       едва заметный перелив. Без filter: blur — на iPhone он рисуется квадратами */
    body .pai-shell .pai-input-row {
        position: relative;
        isolation: isolate;
    }
    body .pai-shell .pai-input-row::before,
    body .pai-shell .pai-input-row::after {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: inherit;
        pointer-events: none;
        opacity: 0;
        transition: opacity .35s ease;
        background-size: 300% 100%;
    }
    body .pai-shell .pai-input-row::before {      /* рамка */
        z-index: 1;
        padding: 2px;
        background-image: linear-gradient(90deg, #A8E76A, #2aa7a1, #D7AB6B, #7dcf46, #2aa7a1, #A8E76A);
        -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
        -webkit-mask-composite: xor;
        mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    }
    body .pai-shell .pai-input-row::after {       /* перелив внутри */
        z-index: -1;
        background-image: linear-gradient(90deg, rgba(168, 231, 106, .16), rgba(42, 167, 161, .1), rgba(215, 171, 107, .14), rgba(168, 231, 106, .16));
    }
    body .pai-shell .pai-input-row:focus-within::before,
    body .pai-shell .pai-input-row:focus-within::after,
    body .pai-shell .pai-input-row.is-recording::before,
    body .pai-shell .pai-input-row.is-recording::after {
        opacity: 1;
        animation: paiFlow 3.2s ease-in-out infinite alternate;
    }
    body .pai-shell .pai-input-row:focus-within,
    body .pai-shell .pai-input-row.is-recording {
        animation: paiGlow 4.8s ease-in-out infinite;
    }
    body .pai-shell .pai-input-row textarea {
        flex: 1 1 auto;
        min-width: 0;
        align-self: center;
        padding: 9px 0;
        background: none;
        box-shadow: none;
        font-size: 16px;
        line-height: 22px;
        max-height: 30vh;
    }
    body .pai-shell .pai-input-row textarea::placeholder {
        color: #8d919d;
    }
    body .pai-shell .pai-input-row-tools {
        flex: none;
        align-self: flex-end;
        margin: 0;
        padding: 0;
        gap: 0;
    }
    body .pai-shell .pai-attach {
        display: none;
    }
    body .pai-shell .pai-mic,
    body .pai-shell .pai-send {
        width: 44px;
        height: 44px;
        margin: 0;
        border-radius: 50%;
        transition: transform .14s ease, background .15s ease;
    }
    body .pai-shell .pai-mic:active,
    body .pai-shell .pai-send:active {
        transform: scale(.92);
    }
    /* диктовка — значок волны прямо в капсуле, без подложки */
    body .pai-shell .pai-mic {
        background: none;
        color: #43464f;
    }
    body .pai-shell .pai-mic:active {
        background: rgba(17, 18, 23, .06);
    }
    body .pai-shell .pai-mic svg {
        width: 24px;
        height: 24px;
    }
    body .pai-shell .pai-send {
        color: #fff;
        background: linear-gradient(140deg, #A8E76A 0%, #5cc58a 38%, #2aa7a1 72%, #D7AB6B 100%);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 6px 14px -6px rgba(42, 167, 161, .6);
    }
    body .pai-shell .pai-send svg {
        width: 18px;
        height: 18px;
    }
    body .pai-shell .pai-send:disabled {
        background: #e7e9e4;
        color: #a3a7ae;
        box-shadow: none;
    }
    body .pai-shell .pai-send.is-busy {
        background: #111217;
        color: #fff;
        box-shadow: none;
    }
    /* Микрофон и «отправить» меняются местами по тексту в поле, а не по классу .is-composing: он
       остаётся на всём разговоре после первого вопроса, и микрофон пропадал бы навсегда (13.10.2026) */
    body .pai-shell .pai-input-row:has(textarea:placeholder-shown) .pai-mic:not([hidden]) + .pai-send:not(.is-busy) {
        display: none;
    }
    body .pai-shell .pai-input-row:has(textarea:not(:placeholder-shown)) .pai-mic,
    body .pai-shell .pai-mic:disabled {
        display: none;
    }
    /* запись голоса — та же капсула */
    body .pai-shell .pai-input-row.is-recording {
        align-items: center;
        padding: 8px 8px 8px 20px;
    }
    body .pai-shell .pai-rec {
        flex: 1 1 auto;
        min-width: 0;
        flex-direction: row;
        align-items: center;
        gap: 10px;
        padding: 0;
    }
    body .pai-shell .pai-rec-top {
        flex: 1 1 auto;
        min-width: 0;
        gap: 10px;
    }
    body .pai-shell .pai-rec-time {
        font-size: 15px;
        font-weight: 700;
        color: var(--mob-ink);
    }
    body .pai-shell .pai-rec-level {
        height: 28px;
        gap: 3px;
    }
    body .pai-shell .pai-rec-level i {
        flex: 1 1 0;
        max-width: 3px;
        min-height: 3px;
        border-radius: 3px;
        background: linear-gradient(180deg, #2aa7a1, #7dcf46);
        opacity: 1;
    }
    body .pai-shell .pai-rec-hint {
        font-size: 15px;
        font-weight: 600;
        color: var(--mob-ink-2);
    }
    body .pai-shell .pai-rec-actions {
        flex: none;
        gap: 6px;
    }
    body .pai-shell .pai-rec-actions button {
        position: relative;
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 50%;
        font-size: 0;
        color: transparent;
    }
    body .pai-shell .pai-rec-actions button::before {
        content: '';
        position: absolute;
        inset: 0;
        margin: auto;
        width: 18px;
        height: 18px;
        -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat;
        mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") center / contain no-repeat;
        background: #43464f;
    }
    body .pai-shell .pai-rec-cancel {
        background: rgba(17, 18, 23, .06);
    }
    body .pai-shell .pai-rec-done {
        background: linear-gradient(140deg, #A8E76A 0%, #5cc58a 38%, #2aa7a1 72%, #D7AB6B 100%);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 6px 14px -6px rgba(42, 167, 161, .6);
    }
    body .pai-shell .pai-rec-done::before {
        -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") !important;
        mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") !important;
        width: 20px !important;
        height: 20px !important;
        background: #fff !important;
    }
    body .pai-shell .pai-disclaimer {
        padding: 0 12px 6px;
        font-size: 10px;
    }
    body .pai-shell:has(.pai-empty) .pai-disclaimer {
        display: none;
    }
}
/* Невысокий экран (iPhone SE, mini, крупный шрифт) — сфера и заголовок меньше */
@media (max-width: 700px) and (max-height: 640px) {
    .mob-pato-today {
        gap: 14px;
    }
    .mpt-orb {
        width: 62px;
        height: 62px;
        margin-bottom: 18px;
    }
    .mpt-hero {
        padding-top: 24px;
    }
    .mpt-hi {
        font-size: 14px;
    }
    .mpt-title {
        font-size: 21px;
    }
    .mpt-card {
        padding: 12px 12px 12px 14px;
        border-radius: 20px;
    }
    .mpt-n {
        font-size: 25px;
    }
    .mpt-l {
        margin-top: 8px;
        font-size: 13px;
    }
    .mpt-chip {
        min-height: 36px;
        font-size: 13px;
    }
}
@keyframes mptOrbSpin {
    to { transform: rotate(360deg); }
}
@keyframes mptOrbBreath {
    0%, 100% { opacity: .55; transform: scale(.96); }
    50% { opacity: 1; transform: scale(1.04); }
}
@keyframes mptOrbFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}
@keyframes mptOrbShadow {
    0%, 100% { transform: scaleX(1); opacity: 1; }
    50% { transform: scaleX(.86); opacity: .7; }
}
/* «Уменьшить движение» на iPhone: шар не парит, цвета внутри плывут втрое медленнее —
   сфера остаётся живой, но без заметного движения */
@media (prefers-reduced-motion: reduce) {
    .mpt-orb,
    .mpt-orb::after {
        animation: none !important;
    }
    .mpt-orb b:nth-child(1) { animation-duration: 27s !important; }
    .mpt-orb b:nth-child(2) { animation-duration: 36s !important; }
    .mpt-orb b:nth-child(3) { animation-duration: 21s !important; }
}

/* Pato на телефоне — шапка и разговор (13.10.2026). Шапка: слева «закрыть», по центру название
   (нажатие — меню «Новый чат / Чаты»), справа «Чаты» и «Новый чат» круглыми кнопками (их
   добавляет initPato() в mobile.js); «Новый чат» — только когда разговор уже начат. Разговор —
   крупнее шрифт, пузырь вопроса мягче, оценка ответа видна сразу (наведения нет) */
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    body .pai-shell .pai-header {
        position: relative;
        display: flex;
        align-items: center;
        gap: 6px;
        min-height: 38px;
        padding: 22px 12px 6px;
    }
    body .pai-shell .pai-header-right {
        display: contents;
    }
    body .pai-shell #paiClose {
        order: 3;
    }
    body .pai-shell .pai-header-menu {
        order: 0;
        display: flex;
        align-items: center;
        gap: 4px;
        min-width: 0;
        margin-right: auto;
        padding-left: 4px;
    }
    body .pai-shell .pai-header-menu .pai-spark {
        display: none;
    }
    body .pai-shell .pai-title {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    body .pai-shell .pai-icon-btn {
        width: 38px;
        height: 38px;
        border-radius: 50%;
        background: rgba(17, 18, 23, .05);
        color: var(--mob-ink);
    }
    body .pai-shell .pai-icon-btn svg {
        width: 18px;
        height: 18px;
    }
    body .pai-shell .mob-pai-hb {
        display: flex;
        align-items: center;
        justify-content: center;
        order: 2;
    }
    body .pai-shell .mob-pai-hb--new {
        order: 1;
    }
    /* на странице «Чаты» свои «назад» и «Новый» — кнопки шапки там лишние */
    body .pai-shell.is-chats-view .mob-pai-hb {
        display: none;
    }
    body .pai-shell:has(.pai-empty) .mob-pai-hb--new {
        display: none;
    }
}
/* На компьютере этих кнопок нет: история и «Новый чат» там в боковом меню окна и в меню названия.
   Правило сильнее, чем .pai-icon-btn { display: flex } в стилях самого окна (они подключаются
   позже этого файла, и простое .mob-pai-hb проигрывало — кнопки были видны на компьютере),
   но слабее телефонного body .pai-shell .mob-pai-hb выше. */
.pai-shell .mob-pai-hb {
    display: none;
}

/* История чатов Pato на телефоне (13.10.2026): одна шапка вместо двух — шапка ассистента на
   этой странице скрыта, строка «‹ Чаты · поиск · Новый» встаёт на её место (под полоской листа).
   Список — группами в белых карточках (раскладывает initPato() в mobile.js), строка — название и
   время, «⋯» видна всегда (наведения на телефоне нет), значок чата у каждой строки убран */
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    body .pai-shell.is-chats-view .pai-header {
        display: none;
    }
    body .pai-shell .pai-chats-view {
        background: #f4f5f2;
    }
    body .pai-shell .pai-chats-top {
        gap: 8px;
        padding: 24px 14px 12px;
        touch-action: none;
    }
    body .pai-shell .pai-chats-title {
        margin-left: 4px;
        font-size: 22px;
        letter-spacing: -.5px;
    }
    body .pai-shell .pai-chats-top .pai-icon-btn {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 1px 2px rgba(17, 18, 23, .06), inset 0 0 0 1px rgba(17, 18, 23, .05);
        color: var(--mob-ink);
    }
    body .pai-shell .pai-chats-new {
        height: 40px;
        padding: 0 16px 0 13px;
        border-radius: 999px;
        background: linear-gradient(314deg, #7dcf46 0%, #A8E76A 100%);
        color: #173b14;
        font-size: 14px;
        font-weight: 700;
        box-shadow: 0 6px 14px -6px rgba(125, 207, 70, .7);
    }
    body .pai-shell .pai-chats-new:hover {
        background: linear-gradient(314deg, #7dcf46 0%, #A8E76A 100%);
        transform: none;
    }
    body .pai-shell .pai-chats-search-wrap {
        padding: 0 14px 10px;
    }
    body .pai-shell .pai-chats-search input {
        height: 44px;
        border-radius: 999px;
        border-color: transparent;
        background: #fff;
        font-size: 16px;
        box-shadow: inset 0 0 0 1px rgba(17, 18, 23, .06);
    }
    body .pai-shell .pai-chats-list {
        padding: 2px 14px 24px;
    }
    body .pai-shell .pai-chats-fade-bottom {
        display: none;
    }
    .mob-chats-group + .mob-chats-group {
        margin-top: 18px;
    }
    .mob-chats-group-l {
        padding: 0 6px 8px;
        font-size: 12.5px;
        font-weight: 700;
        letter-spacing: .02em;
        color: var(--mob-muted);
    }
    .mob-chats-group-c {
        border-radius: 20px;
        background: #fff;
        box-shadow: 0 1px 2px rgba(17, 18, 23, .04), 0 10px 24px -16px rgba(17, 18, 23, .18);
    }
    body .pai-shell .pai-chat-row {
        gap: 10px;
        margin: 0;
        padding: 0 6px 0 16px;
        min-height: 56px;
        border-radius: 0;
        background: none;
    }
    body .pai-shell .pai-chat-row + .pai-chat-row::before {
        content: '';
        position: absolute;
        top: 0;
        left: 16px;
        right: 0;
        height: 1px;
        background: rgba(17, 18, 23, .07);
    }
    body .pai-shell .pai-chat-row:first-child {
        border-radius: 20px 20px 0 0;
    }
    body .pai-shell .pai-chat-row:last-child {
        border-radius: 0 0 20px 20px;
    }
    body .pai-shell .pai-chat-row:only-child {
        border-radius: 20px;
    }
    body .pai-shell .pai-chat-row:active,
    body .pai-shell .pai-chat-row.is-menu-open {
        background: rgba(17, 18, 23, .04);
    }
    body .pai-shell .pai-chat-row-ic {
        display: none;
    }
    body .pai-shell .pai-chat-row-title {
        font-size: 15px;
        font-weight: 600;
        letter-spacing: -.01em;
    }
    body .pai-shell .pai-chat-row-meta {
        max-width: none;
        opacity: 1;
        overflow: visible;
        gap: 2px;
    }
    body .pai-shell .pai-chat-row-time {
        font-size: 12.5px;
    }
    body .pai-shell .pai-chat-row-more {
        width: 36px;
        height: 36px;
        color: var(--mob-muted);
    }
    body .pai-shell .pai-chat-row-menu {
        top: calc(100% - 6px);
        right: 8px;
        width: 190px;
        border-radius: 16px;
        z-index: 10;
    }
    body .pai-shell .pai-chat-menu-item {
        padding: 11px 12px;
        font-size: 14.5px;
    }
    body .pai-shell .pai-chats-empty {
        padding: 48px 12px;
        font-size: 14px;
    }
}
@keyframes paiFlow {
    from { background-position: 0% 50%; }
    to { background-position: 100% 50%; }
}
@keyframes paiGlow {
    0%, 100% { box-shadow: inset 0 1px 0 #fff, 0 0 0 3px rgba(168, 231, 106, .12), 0 0 22px 1px rgba(125, 207, 70, .32), 0 14px 30px -14px rgba(17, 18, 23, .25); }
    33% { box-shadow: inset 0 1px 0 #fff, 0 0 0 3px rgba(42, 167, 161, .1), 0 0 22px 1px rgba(42, 167, 161, .3), 0 14px 30px -14px rgba(17, 18, 23, .25); }
    66% { box-shadow: inset 0 1px 0 #fff, 0 0 0 3px rgba(215, 171, 107, .12), 0 0 22px 1px rgba(215, 171, 107, .32), 0 14px 30px -14px rgba(17, 18, 23, .25); }
}
@media (prefers-reduced-motion: reduce) {
    body .pai-shell .pai-input-row::before,
    body .pai-shell .pai-input-row::after,
    body .pai-shell .pai-input-row:focus-within,
    body .pai-shell .pai-input-row.is-recording {
        animation: none !important;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   «Почта» на телефоне (этап 6, 13.10.2026). Логика — mail.js / mail_real.js (не менялись),
   телефонная обвязка — initMail() и syncMail() в mobile.js. Классы на <html>:
     mob-mail   — раздел открыт: шапка «Входящие ▾ · обновить · настройки · написать», поиск,
                  список писем прокручивается вместе со страницей (как «Диалоги»);
     mob-mread  — открыто письмо или новое письмо (.mail-shell.is-detail): лист от верхней строки
                  до низа экрана, нижнего меню нет, страница под ним стоит;
     mob-mset   — настройки «Почты»: лист между верхней строкой и нижним меню;
     mob-mail-noacc — ящик не подключён: вместо пустого списка карточка «Подключить почту».
   Одна колонка (список ИЛИ письмо) — правила @container mailshell в mail.css, тут не дублируем.
   ══════════════════════════════════════════════════════════════════════ */
.mob-mail-connect {
    display: none;
}
#mailHeadTools .mob-mail-compose {
    display: none;
}
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    /* Анимация появления страницы двигает её transform'ом — закреплённый лист встал бы
       относительно страницы, а не экрана */
    html.mob-mail body.sb-modern #page-mail {
        animation: none;
    }
    body.sb-modern #page-mail.page.active {
        display: block;
        overflow: visible;
    }
    body.sb-modern #page-mail .mail-wrap {
        height: auto;
        min-height: 0;
    }
    body.sb-modern #page-mail .mail-shell {
        flex-direction: column;
        gap: 0;
    }

    /* ── Список: шапка и поиск на фоне страницы, письма — белой карточкой ── */
    body.sb-modern #page-mail .mail-folders-col {
        display: none;
    }
    body.sb-modern #page-mail .mail-list-wrap {
        background: none;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        overflow: visible;
    }
    body.sb-modern #page-mail .mail-list-col {
        overflow: visible;
    }
    body.sb-modern #page-mail .mail-list-head {
        gap: 8px;
        padding: 0 0 12px;
        font-family: 'Onest', sans-serif;
    }
    body.sb-modern #page-mail #mailListTitle {
        display: none;
    }
    /* Папка — заголовком с выбором, как вид в CRM и «Задачах» */
    body.sb-modern #page-mail .mob-crm-view {
        flex: 0 1 auto;
        min-width: 0;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        height: 42px;
        margin: 0 auto 0 0;
        padding: 0;
        border: 0;
        background: none;
        color: var(--mob-ink);
        font-family: 'Unbounded', sans-serif;
        font-size: 17px;
        font-weight: 600;
        letter-spacing: -.02em;
        -webkit-tap-highlight-color: transparent;
    }
    body.sb-modern #page-mail .mob-crm-view-lbl {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    body.sb-modern #page-mail .mob-crm-view-n {
        flex: none;
        min-width: 22px;
        height: 22px;
        padding: 0 6px;
        border-radius: 999px;
        background: linear-gradient(135deg, #5cc531 0%, #2f8a1c 100%);
        color: #fff;
        font-family: 'Onest', sans-serif;
        font-size: 12px;
        font-weight: 700;
        line-height: 22px;
        text-align: center;
        letter-spacing: 0;
    }
    body.sb-modern #page-mail .mob-crm-view-n:empty {
        display: none;
    }
    body.sb-modern #page-mail .mob-crm-view svg {
        flex: none;
        width: 26px;
        height: 26px;
        padding: 5px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 1px 2px rgba(17, 18, 23, .08);
    }
    body.sb-modern #page-mail .mail-head-tools {
        flex: none;
        gap: 6px;
        margin-left: auto;
    }
    body.sb-modern #page-mail .mail-head-tools button {
        width: 42px;
        height: 42px;
        border-radius: 50%;
        background: #fff;
        color: var(--mob-ink);
        box-shadow: 0 1px 2px rgba(17, 18, 23, .07), 0 6px 16px -10px rgba(17, 18, 23, .3);
        -webkit-tap-highlight-color: transparent;
    }
    body.sb-modern #page-mail .mail-head-tools button svg {
        width: 18px;
        height: 18px;
    }
    body.sb-modern #page-mail .mail-head-tools button:active {
        transform: scale(.94);
    }
    body.sb-modern #page-mail .mail-head-tools button.is-error {
        color: #dc2626;
    }
    body.sb-modern #mailHeadTools .mob-mail-compose {
        display: inline-flex;
        background: #111217;
        color: #fff;
    }
    @media (max-width: 380px) {
        body.sb-modern #page-mail .mob-crm-view {
            gap: 4px;
            font-size: 16px;
        }
        body.sb-modern #page-mail .mail-head-tools {
            gap: 4px;
        }
        body.sb-modern #page-mail .mail-head-tools button {
            width: 38px;
            height: 38px;
        }
    }
    body.sb-modern #page-mail .mail-list-col .mail-search {
        margin: 0 0 12px;
        height: 46px;
        padding: 0 16px;
        gap: 10px;
        background: #fff;
        border-radius: 999px;
        box-shadow: 0 1px 2px rgba(17, 18, 23, .06), 0 8px 20px -14px rgba(17, 18, 23, .3);
    }
    body.sb-modern #page-mail .mail-search:focus-within {
        box-shadow: 0 0 0 2px rgba(125, 207, 70, .6), 0 8px 20px -14px rgba(17, 18, 23, .3);
    }
    body.sb-modern #page-mail .mail-search svg {
        flex: none;
        width: 17px;
        height: 17px;
    }
    body.sb-modern #page-mail .mail-search input {
        font-size: 16px;
    }
    body.sb-modern #page-mail .mail-list-scroll {
        flex: none;
        overflow: visible;
        padding: 4px;
        border-top: 0;
        background: #fff;
        border-radius: 22px;
        box-shadow: 0 1px 2px rgba(17, 18, 23, .05), 0 10px 30px -22px rgba(17, 18, 23, .35);
    }
    body.sb-modern #page-mail .mail-list-empty {
        padding: 44px 16px;
        font-size: 14px;
    }
    body.sb-modern #page-mail .mail-row {
        gap: 12px;
        padding: 12px 10px 12px 16px;
        border-radius: 18px;
        -webkit-tap-highlight-color: transparent;
    }
    body.sb-modern #page-mail .mail-row + .mail-row::after {
        content: '';
        position: absolute;
        top: 0;
        left: 70px;
        right: 14px;
        height: 1px;
        background: var(--mob-line);
    }
    body.sb-modern #page-mail .mail-row:hover {
        background: none;
    }
    body.sb-modern #page-mail .mail-row:active,
    body.sb-modern #page-mail .mail-row.active {
        background: rgba(168, 231, 106, .16);
    }
    body.sb-modern #page-mail .mail-row:active::after,
    body.sb-modern #page-mail .mail-row.active::after,
    body.sb-modern #page-mail .mail-row:active + .mail-row::after,
    body.sb-modern #page-mail .mail-row.active + .mail-row::after {
        opacity: 0;
    }
    body.sb-modern #page-mail .mail-row-avatar {
        width: 42px;
        height: 42px;
        font-size: 13.5px;
    }
    body.sb-modern #page-mail .mail-row-from {
        font-size: 15px;
        line-height: 1.3;
    }
    body.sb-modern #page-mail .mail-row-time {
        font-size: 12px;
    }
    body.sb-modern #page-mail .mail-row-subject {
        margin-top: 2px;
        font-size: 14px;
        line-height: 1.35;
        color: var(--mob-ink);
    }
    body.sb-modern #page-mail .mail-row-snippet {
        margin-top: 2px;
        font-size: 13px;
        line-height: 1.35;
    }
    body.sb-modern #page-mail .mail-row-unread-dot {
        left: 5px;
        top: 30px;
        width: 8px;
        height: 8px;
    }
    /* Звезда — в правом нижнем углу строки, под временем: справа отдельной колонкой она отнимала
       место у имени отправителя (на узком экране «Анна С…») */
    body.sb-modern #page-mail .mail-star-btn {
        position: absolute;
        right: 4px;
        bottom: 6px;
        width: 34px;
        height: 34px;
        margin: 0;
        color: rgba(17, 18, 23, .2);
        -webkit-tap-highlight-color: transparent;
    }
    body.sb-modern #page-mail .mail-row {
        padding-right: 14px;
    }
    body.sb-modern #page-mail .mail-row-snippet {
        padding-right: 26px;
    }
    body.sb-modern #page-mail .mail-star-btn.active {
        color: #d97706;
    }
    body.sb-modern #page-mail .mail-star-btn svg {
        width: 18px;
        height: 18px;
    }

    /* ── Ящик не подключён ── */
    html.mob-mail-noacc body.sb-modern #page-mail .mail-search,
    html.mob-mail-noacc body.sb-modern #page-mail .mail-list-scroll,
    html.mob-mail-noacc body.sb-modern #page-mail .mob-mail-compose {
        display: none;
    }
    html.mob-mail-noacc body.sb-modern #page-mail .mob-mail-connect {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        padding: 30px 22px 24px;
        background: #fff;
        border-radius: 24px;
        text-align: center;
        box-shadow: 0 1px 2px rgba(17, 18, 23, .05), 0 10px 30px -22px rgba(17, 18, 23, .35);
    }
    .mob-mail-connect-ic {
        width: 60px;
        height: 60px;
        border-radius: 18px;
        display: grid;
        place-items: center;
        margin-bottom: 4px;
        background: linear-gradient(314deg, #7dcf46 0%, #A8E76A 100%);
        color: #1f4a0e;
        box-shadow: 0 12px 22px -10px rgba(79, 154, 36, .6);
    }
    .mob-mail-connect b {
        font-family: 'Unbounded', sans-serif;
        font-size: 17px;
        font-weight: 600;
        color: var(--mob-ink);
    }
    .mob-mail-connect p {
        margin: 0;
        font-size: 14px;
        line-height: 1.5;
        color: var(--mob-muted);
    }
    .mob-mail-connect button {
        width: 100%;
        height: 50px;
        margin-top: 8px;
        border: 0;
        border-radius: 999px;
        background: #111217;
        color: #fff;
        font: 700 15px 'Onest', sans-serif;
        -webkit-tap-highlight-color: transparent;
    }

    /* ── Письмо, новое письмо и настройки — закреплённый лист, страница под ним стоит
       (body закрепляет mobile.js — setLock('mail')) ── */
    html.mob-mread,
    html.mob-mread body,
    html.mob-mset,
    html.mob-mset body {
        overflow: hidden;
        overscroll-behavior: none;
    }
    html.mob-mread .mob-nav {
        display: none;
    }
    html.mob-mread .mob-top,
    html.mob-mset .mob-top {
        position: fixed;
        top: calc(env(safe-area-inset-top, 0px) + var(--mob-edge));
        left: calc(var(--mob-edge) + env(safe-area-inset-left, 0px));
        right: calc(var(--mob-edge) + env(safe-area-inset-right, 0px));
        margin: 0;
    }
    html.mob-mread body.sb-modern #page-mail .mail-wrap,
    html.mob-mset body.sb-modern #page-mail .mail-wrap {
        position: fixed;
        z-index: 91;
        left: calc(var(--mob-edge) + env(safe-area-inset-left, 0px));
        right: calc(var(--mob-edge) + env(safe-area-inset-right, 0px));
        top: calc(env(safe-area-inset-top, 0px) + var(--mob-edge) + var(--mob-top-h) + 10px);
        bottom: var(--mob-nav-bottom);
        height: auto;
    }
    html.mob-mset body.sb-modern #page-mail .mail-wrap {
        bottom: calc(var(--mob-nav-bottom) + var(--mob-nav-h) + 10px);
    }
    html.mob-mread body.sb-modern #page-mail .mail-shell {
        flex: 1 1 auto;
        min-height: 0;
    }
    html.mob-mset body.sb-modern #page-mail .mail-shell {
        display: none;
    }
    /* clip, а не hidden: блок с overflow: hidden iPhone прокручивает к полю ввода — шапка уезжала */
    html.mob-mread body.sb-modern #page-mail .mail-reading-col {
        flex: 1 1 auto;
        min-height: 0;
        overflow: clip;
        border: 0;
        border-radius: 22px;
        box-shadow: 0 1px 2px rgba(17, 18, 23, .05), 0 14px 34px -22px rgba(17, 18, 23, .4);
    }

    /* Шапка письма: первая строка — «‹», пометка «клиент» и действия; вторая — тема целиком */
    body.sb-modern #page-mail .mail-thread-head {
        flex-wrap: wrap;
        row-gap: 10px;
        column-gap: 6px;
        padding: 10px 10px 12px;
    }
    body.sb-modern #page-mail .mail-th-back {
        order: 0;
        min-width: 40px;
        height: 40px;
        margin-right: 0;
        background: #f3f4f1;
        -webkit-tap-highlight-color: transparent;
    }
    /* «Обращение клиента» — подписью под темой (одним значком рядом со стрелкой было непонятно) */
    body.sb-modern #page-mail .mail-thread-head .mail-crm-chip {
        order: 4;
        width: auto;
        height: 28px;
        margin: -4px 0 0 4px;
        padding: 0 11px 0 9px;
        font-size: 12px;
        -webkit-tap-highlight-color: transparent;
    }
    body.sb-modern #page-mail .mail-crm-chip-txt {
        display: inline;
    }
    body.sb-modern #page-mail .mail-thread-head .mail-icon-btn {
        order: 2;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: #f3f4f1;
        color: var(--mob-ink);
        -webkit-tap-highlight-color: transparent;
    }
    body.sb-modern #page-mail .mail-thread-head .mail-th-back + .mail-icon-btn {
        margin-left: auto;
    }
    body.sb-modern #page-mail .mail-thread-head .mail-icon-btn svg {
        width: 17px;
        height: 17px;
    }
    body.sb-modern #page-mail .mail-thread-head-subject {
        order: 3;
        flex: 1 1 100%;
        margin: 0 4px;
        font-size: 18px;
        line-height: 1.3;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow-wrap: anywhere;
    }
    body.sb-modern #page-mail .mail-cc-row {
        padding: 10px 14px 0;
        font-size: 12.5px;
    }
    body.sb-modern #page-mail .mail-thread-scroll {
        padding: 12px 12px 20px;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    body.sb-modern #page-mail .mail-msg-collapsed {
        padding: 10px;
        border-radius: 14px;
        -webkit-tap-highlight-color: transparent;
    }
    /* «Наведение» на телефоне залипает после касания — подсветка только в момент нажатия */
    body.sb-modern #page-mail .mail-msg-collapsed:hover {
        background: none;
    }
    body.sb-modern #page-mail .mail-msg-collapsed:active {
        background: rgba(17, 18, 23, .04);
    }
    body.sb-modern #page-mail .mail-msg-collapsed-avatar {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }
    body.sb-modern #page-mail .mail-msg-collapsed-from {
        font-size: 13.5px;
    }
    body.sb-modern #page-mail .mail-msg-collapsed-snippet {
        font-size: 13px;
    }
    body.sb-modern #page-mail .mail-msg-expanded {
        padding: 14px;
        border-radius: 18px;
    }
    /* Шапка сообщения: аватар слева, справа имя, адрес, «Кому» и время — строками друг под другом
       (время справа сжимало адрес, и он рвался на куски) */
    body.sb-modern #page-mail .mail-msg-head {
        display: grid;
        grid-template-columns: 36px minmax(0, 1fr);
        column-gap: 10px;
        row-gap: 3px;
        align-items: start;
    }
    body.sb-modern #page-mail .mail-msg-avatar {
        grid-row: span 2;
        width: 36px;
        height: 36px;
        font-size: 13px;
    }
    body.sb-modern #page-mail .mail-msg-head-text {
        grid-column: 2;
    }
    body.sb-modern #page-mail .mail-msg-head .mail-msg-time {
        grid-column: 2;
        white-space: normal;
    }
    /* Имя, ниже адрес — в одну строку с адресом имя обрезалось */
    body.sb-modern #page-mail .mail-msg-from {
        font-size: 14.5px;
        line-height: 1.3;
    }
    body.sb-modern #page-mail .mail-msg-addr {
        display: block;
        margin: 1px 0 0;
        font-size: 12.5px;
        overflow-wrap: anywhere;
    }
    body.sb-modern #page-mail .mail-msg-to {
        font-size: 12px;
        overflow-wrap: anywhere;
    }
    body.sb-modern #page-mail .mail-msg-time {
        font-size: 11.5px;
    }
    body.sb-modern #page-mail .mail-msg-body {
        font-size: 15px;
        line-height: 1.6;
        overflow-wrap: anywhere;
    }
    body.sb-modern #page-mail .mail-attach-item {
        max-width: 100%;
        padding: 8px 12px;
        border-radius: 12px;
        font-size: 13.5px;
    }
    body.sb-modern #page-mail .mail-attach-item > span:first-of-type {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    body.sb-modern #page-mail .mail-thread-actions {
        gap: 8px;
        margin-top: 6px;
    }
    body.sb-modern #page-mail .mail-action-btn {
        flex: 1 1 0;
        justify-content: center;
        height: 46px;
        padding: 0 14px;
        font-size: 14.5px;
        -webkit-tap-highlight-color: transparent;
    }
    body.sb-modern #page-mail .mail-action-btn:hover {
        border-color: var(--tk-line-2);
        background: #fff;
    }
    body.sb-modern #page-mail .mail-action-btn:active {
        background: rgba(168, 231, 106, .14);
    }

    /* Ответ в письме и новое письмо: поле 16px (иначе iPhone увеличивает страницу), кнопки под палец */
    body.sb-modern #page-mail .mail-reply-box {
        border-radius: 18px;
    }
    body.sb-modern #page-mail .mail-reply-to {
        padding: 12px 14px 0;
        font-size: 13px;
        overflow-wrap: anywhere;
    }
    body.sb-modern #page-mail .mail-reply-box .mail-rte {
        min-height: 110px;
        max-height: none;
        font-size: 16px;
    }
    body.sb-modern #page-mail .mail-reply-toolbar,
    body.sb-modern #page-mail .mail-compose-toolbar {
        flex-wrap: wrap;
        gap: 8px;
    }
    body.sb-modern #page-mail .mail-reply-toolbar {
        padding: 6px 12px 12px;
    }
    body.sb-modern #page-mail .mail-tool-btn {
        width: 40px;
        height: 40px;
    }
    body.sb-modern #page-mail .mail-fmt-toggle-btn {
        border-radius: 12px;
    }
    body.sb-modern #page-mail .mail-send-btn {
        height: 42px;
        padding: 0 16px 0 20px;
        font-size: 14.5px;
    }
    body.sb-modern #page-mail .mail-send-chev {
        width: 32px;
    }
    /* Панель форматирования — одной строкой, листается вбок (в две строки занимала полэкрана) */
    body.sb-modern #page-mail .mail-fmt-panel {
        flex-wrap: nowrap;
        overflow-x: auto;
        border-radius: 14px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    body.sb-modern #page-mail .mail-fmt-panel::-webkit-scrollbar {
        display: none;
    }
    body.sb-modern #page-mail .mail-fmt-btn,
    body.sb-modern #page-mail .mail-fmt-select {
        height: 34px;
    }
    body.sb-modern #page-mail .mail-fmt-btn {
        width: 34px;
    }
    body.sb-modern #page-mail .mail-files-row {
        padding: 0 12px 8px;
    }
    body.sb-modern #page-mail .mail-file-chip {
        max-width: 100%;
        padding: 6px 8px 6px 12px;
        font-size: 13px;
    }
    body.sb-modern #page-mail .mail-file-chip > span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    body.sb-modern #page-mail .mail-file-chip button {
        width: 28px;
        height: 28px;
        font-size: 18px;
    }

    body.sb-modern #page-mail .mail-compose-head {
        padding: 10px 10px 10px 18px;
        font-family: 'Unbounded', sans-serif;
        font-size: 16px;
        font-weight: 600;
    }
    body.sb-modern #page-mail .mail-compose-head .mail-icon-btn {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: #f3f4f1;
        color: var(--mob-ink);
        -webkit-tap-highlight-color: transparent;
    }
    body.sb-modern #page-mail .mail-compose-field-row {
        min-height: 52px;
        padding: 6px 14px 6px 18px;
    }
    body.sb-modern #page-mail .mail-compose-field-label {
        width: 54px;
        font-size: 13.5px;
    }
    body.sb-modern #page-mail .mail-compose-field-row input,
    body.sb-modern #page-mail .mail-chipfield input {
        font-size: 16px;
    }
    body.sb-modern #page-mail .mail-chip-pill {
        max-width: 100%;
        padding: 5px 6px 5px 11px;
        font-size: 13.5px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    body.sb-modern #page-mail .mail-chip-pill button {
        flex: none;
        width: 22px;
        height: 22px;
        font-size: 14px;
    }
    body.sb-modern #page-mail .mail-compose-cc-toggle {
        gap: 12px;
    }
    body.sb-modern #page-mail .mail-compose-cc-toggle button {
        padding: 6px 0;
        font-size: 13px;
        -webkit-tap-highlight-color: transparent;
    }
    /* «Скрытая копия» — «Скрытая»: в строке «Кому» иначе не оставалось места под адрес */
    body.sb-modern #page-mail #mailComposeBccToggleBtn {
        font-size: 0;
    }
    body.sb-modern #page-mail #mailComposeBccToggleBtn::before {
        content: 'Скрытая';
        font-size: 13px;
    }
    @media (max-width: 360px) {
        /* узкий экран: «Отправить», «Aa», скрепка и ссылка — одной строкой */
        body.sb-modern #page-mail .mail-reply-toolbar,
        body.sb-modern #page-mail .mail-compose-toolbar {
            gap: 4px;
        }
        body.sb-modern #page-mail .mail-tool-btn {
            width: 36px;
            height: 36px;
        }
        body.sb-modern #page-mail .mail-reply-toolbar {
            padding: 6px 8px 10px;
        }
        body.sb-modern #page-mail .mail-send-btn {
            padding: 0 8px 0 14px;
            font-size: 14px;
        }
        body.sb-modern #page-mail .mail-send-chev {
            width: 28px;
        }
        /* узкий экран: «Копия / Скрытая» — второй строкой, адресу остаётся вся ширина */
        body.sb-modern #page-mail .mail-compose-field-row:has(.mail-compose-cc-toggle) {
            flex-wrap: wrap;
            row-gap: 0;
        }
        body.sb-modern #page-mail .mail-compose-field-row:has(.mail-compose-cc-toggle) .mail-compose-cc-toggle {
            flex-basis: 100%;
            padding-left: 64px;
        }
    }
    body.sb-modern #page-mail .mail-compose-body {
        min-height: 120px;
        padding: 14px 18px;
        font-size: 16px;
    }
    body.sb-modern #page-mail .mail-compose .mail-fmt-panel {
        margin: 0 12px 10px;
    }
    body.sb-modern #page-mail .mail-compose-toolbar {
        padding: 10px 12px 12px;
    }

    /* Окно «Вставить ссылку» и выбор времени отправки — не уже экрана */
    body.sb-modern #page-mail .mail-dd-panel {
        max-width: calc(100vw - 24px);
        border-radius: 16px;
    }
    body.sb-modern #page-mail .mail-sched-opt {
        min-height: 46px;
        font-size: 14px;
    }
    body.sb-modern #page-mail .mail-link-row input {
        font-size: 16px;
    }

    /* ── Открыта клавиатура: лист = видимая часть экрана (--mob-vvt / --mob-vvb считает mobile.js,
       kbSync), верхняя строка на это время уходит; низ листа продлён под плашку «вверх / вниз /
       готово» на iPhone, кнопки и текст стоят над ней (--mob-sheet-acc) ── */
    html.mob-mread.mob-kbs .mob-top,
    html.mob-mset.mob-kbs .mob-top {
        visibility: hidden;
    }
    html.mob-mread.mob-kbs body.sb-modern #page-mail .mail-wrap,
    html.mob-mset.mob-kbs body.sb-modern #page-mail .mail-wrap {
        left: 0;
        right: 0;
        top: var(--mob-vvt, 0px);
        bottom: auto;
        height: calc(var(--mob-vvb, 100vh) - var(--mob-vvt, 0px));
    }
    html.mob-mread.mob-kbs body.sb-modern #page-mail .mail-reading-col,
    html.mob-mset.mob-kbs body.sb-modern #page-mail .mail-settings-screen {
        border-radius: 0;
        box-shadow: none;
    }
    html.mob-mread.mob-kbs body.sb-modern #page-mail .mail-thread-scroll {
        padding-bottom: calc(20px + var(--mob-sheet-acc, 0px));
    }
    /* Новое письмо с клавиатурой: места мало — поля прокручиваются, панель с «Отправить» прилипает
       к низу видимой части (иначе текст письма выталкивал её под клавиатуру) */
    html.mob-mread.mob-kbs body.sb-modern #page-mail .mail-compose {
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    html.mob-mread.mob-kbs body.sb-modern #page-mail .mail-compose-body {
        flex: 1 0 auto;
        min-height: 96px;
        overflow: visible;
    }
    html.mob-mread.mob-kbs body.sb-modern #page-mail .mail-compose-toolbar {
        position: sticky;
        bottom: 0;
        z-index: 2;
        background: #fff;
        padding-bottom: calc(12px + var(--mob-sheet-acc, 0px));
    }
    html.mob-mset.mob-kbs body.sb-modern #page-mail .mail-settings-body {
        padding-bottom: calc(28px + var(--mob-sheet-acc, 0px));
    }

    /* ── Настройки «Почты» ── */
    body.sb-modern #page-mail .mail-settings-screen {
        border-radius: 22px;
        overflow: clip;
        box-shadow: 0 1px 2px rgba(17, 18, 23, .05), 0 14px 34px -22px rgba(17, 18, 23, .4);
    }
    body.sb-modern #page-mail .mail-settings-topbar {
        gap: 10px;
        padding: 10px 12px;
        border-radius: 22px 22px 0 0;
    }
    /* «Назад к почте» — круглой кнопкой со стрелкой (подпись в aria-label) */
    body.sb-modern #page-mail .mail-settings-back {
        flex: none;
        width: 40px;
        height: 40px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
        font-size: 0;
        background: #f3f4f1;
        -webkit-tap-highlight-color: transparent;
    }
    body.sb-modern #page-mail .mail-settings-back svg {
        width: 18px;
        height: 18px;
    }
    body.sb-modern #page-mail .mail-settings-topbar h1 {
        font-size: 16px;
        font-weight: 600;
    }
    body.sb-modern #page-mail .mail-settings-body {
        padding: 18px 14px 28px;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    body.sb-modern #page-mail .mail-settings-section-title {
        font-size: 16px;
    }
    body.sb-modern #page-mail .mail-settings-section-sub {
        font-size: 13.5px;
        line-height: 1.45;
    }
    body.sb-modern #page-mail .mail-chan-card {
        width: 100%;
        height: auto;
        padding: 16px;
        border-radius: 20px;
        -webkit-tap-highlight-color: transparent;
    }
    body.sb-modern #page-mail .mail-chan-card:hover {
        transform: none;
        box-shadow: none;
    }
    body.sb-modern #page-mail .mail-chan-card h3 {
        font-size: 15px;
    }
    body.sb-modern #page-mail .mail-chan-card p {
        font-size: 13px;
    }
    body.sb-modern #page-mail .mail-mini-back {
        padding: 4px 0 14px;
        font-size: 14px;
    }
    body.sb-modern #page-mail .mail-acc-row-title {
        font-size: 14px;
    }
    body.sb-modern #page-mail .mail-acc-row-sub {
        font-size: 12px;
        line-height: 1.4;
    }
    body.sb-modern #page-mail .mail-acc-count {
        font-size: 14px;
        text-align: right;
    }
    body.sb-modern #page-mail .mail-acc-reconnect,
    body.sb-modern #page-mail .mail-acc-disconnect {
        height: 48px;
        font-size: 14px;
    }
    body.sb-modern #page-mail .mail-cx-hero h2 {
        font-size: 18px;
    }
    body.sb-modern #page-mail .mail-cx-input input,
    body.sb-modern #page-mail .mail-cx-srv-row input {
        font-size: 16px;
    }
    body.sb-modern #page-mail .mail-cx-perks {
        gap: 8px;
    }
    /* Название сервиса — в две строки, если не помещается («Другая почта») */
    body.sb-modern #page-mail .mail-prov-tile {
        gap: 8px;
        padding: 8px 10px 8px 8px;
    }
    body.sb-modern #page-mail .mail-prov-name {
        white-space: normal;
        line-height: 1.2;
    }

    /* ── Окна «Черновики», «Запланированные», подтверждения и выбор времени отправки — шторкой снизу ── */
    body.sb-modern #page-mail .mail-real-modal,
    body.sb-modern #page-mail .mail-sched-modal-overlay {
        position: fixed;
        inset: 0;
        z-index: 9990;
        align-items: flex-end;
        background: rgba(15, 17, 23, .38);
    }
    body.sb-modern #page-mail .mail-real-modal-box,
    body.sb-modern #page-mail .mail-sched-modal {
        width: 100%;
        max-width: none;
        max-height: 86vh;
        max-height: 86dvh;
        overflow-y: auto;
        padding: 24px 18px calc(18px + env(safe-area-inset-bottom, 0px));
        border-radius: 26px 26px 0 0;
        box-shadow: 0 -18px 48px rgba(15, 17, 23, .18);
        animation: mobMailSheetIn .28s cubic-bezier(.22, .61, .36, 1);
    }
    body.sb-modern #page-mail .mail-real-modal-box h3,
    body.sb-modern #page-mail .mail-sched-modal-title {
        font-size: 17px;
        font-weight: 600;
    }
    body.sb-modern #page-mail .mail-real-sub {
        font-size: 14px;
        line-height: 1.5;
    }
    body.sb-modern #page-mail .mail-real-actions button {
        height: 50px;
        border-radius: 999px;
        text-align: center;
        font-size: 15px;
        font-weight: 700;
    }
    body.sb-modern #page-mail .mail-sched-list {
        max-height: none;
    }
    body.sb-modern #page-mail .mail-sched-row b {
        font-size: 14.5px;
    }
    body.sb-modern #page-mail .mail-sched-row small {
        font-size: 12.5px;
        line-height: 1.4;
        white-space: normal;
    }
    body.sb-modern #page-mail .mail-draft-actions {
        flex-direction: column;
    }
    body.sb-modern #page-mail .mail-sched-row .ghost {
        height: 36px;
        padding: 0 14px;
        font-size: 13px;
    }
    body.sb-modern #page-mail .mail-sched-modal-row input {
        min-height: 44px;
        font-size: 16px;
    }
    body.sb-modern #page-mail .mail-sched-modal-confirm,
    body.sb-modern #page-mail .mail-sched-modal-cancel {
        height: 50px;
        font-size: 15px;
    }

    /* Шторка «Папки» — второй блок: черновики и запланированные (открываются списком) */
    .mob-sheet[data-sheet="mailfolders"] .mob-group-card + .mob-group-card {
        margin-top: 4px;
    }
}
@keyframes mobMailSheetIn {
    from { transform: translateY(100%); }
    to { transform: none; }
}

/* ══════════════════════════════════════════════════════════════════════
   Настройки «Диалогов» на телефоне (13.10.2026). Логика — inbox.js (не менялась), обвязка —
   initInboxSettings() / isetSync() / isetSheet() в mobile.js. Боковое меню разделов скрыто: шапка
   #mobIsetBar — «‹» (вложенный экран — шаг назад, иначе к диалогам), раздел заголовком «Каналы ▾»
   (шторка «Настройки» с разделами по группам, как вид в CRM и «Задачах»), «i» раздела. Заголовок
   внутри раздела скрыт — его повторяет шапка. Ниже — разделы под узкий экран.
   ══════════════════════════════════════════════════════════════════════ */
.mob-iset-bar {
    display: none;
}
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    body.sb-modern #ibxSettingsScreen {
        border-radius: 22px;
        overflow: clip;
    }
    body.sb-modern #ibxSettingsScreen .ibx-settings-layout {
        flex-direction: column;
    }
    body.sb-modern #ibxSettingsScreen .ibx-settings-layout::before,
    body.sb-modern #ibxSettingsScreen .ibx-settings-side,
    body.sb-modern #ibxSettingsScreen .ibx-set-backfab {
        display: none !important;
    }
    body.sb-modern #ibxSettingsScreen .mob-iset-bar {
        flex: none;
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px 12px 10px 10px;
        background: #fff;
        border-bottom: 1px solid var(--mob-line);
    }
    body.sb-modern #ibxSettingsScreen .mob-iset-back {
        flex: none;
        width: 40px;
        height: 40px;
        display: grid;
        place-items: center;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: #f3f4f1;
        color: var(--mob-ink);
        -webkit-tap-highlight-color: transparent;
    }
    body.sb-modern #ibxSettingsScreen .mob-iset-back:active {
        transform: scale(.94);
    }
    body.sb-modern #ibxSettingsScreen .mob-crm-view {
        flex: 0 1 auto;
        min-width: 0;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        height: 40px;
        padding: 0 0 0 4px;
        border: 0;
        background: none;
        color: var(--mob-ink);
        font-family: 'Unbounded', sans-serif;
        font-size: 17px;
        font-weight: 600;
        letter-spacing: -.02em;
        -webkit-tap-highlight-color: transparent;
    }
    body.sb-modern #ibxSettingsScreen .mob-crm-view-lbl {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    body.sb-modern #ibxSettingsScreen .mob-crm-view svg {
        flex: none;
        width: 26px;
        height: 26px;
        padding: 5px;
        border-radius: 50%;
        background: #f3f4f1;
    }
    body.sb-modern #ibxSettingsScreen .mob-iset-info {
        flex: none;
        display: flex;
    }
    body.sb-modern #ibxSettingsScreen .mob-iset-info:empty {
        display: none;
    }
    body.sb-modern #ibxSettingsScreen .mob-iset-info .ibx-info-btn {
        width: 32px;
        height: 32px;
    }
    /* Заголовок раздела повторяет шапку — скрыт; первой строкой раздела остаётся пояснение */
    body.sb-modern #ibxSettingsScreen .ibx-settings-view > .ibx-settings-section-title,
    body.sb-modern #ibxSettingsScreen .ibx-set-head .ibx-settings-section-title {
        display: none;
    }
    body.sb-modern #ibxSettingsScreen .ibx-settings-section-sub,
    body.sb-modern #ibxSettingsScreen .ibx-set-head .ibx-settings-section-sub {
        margin: 0 0 14px;
        font-size: 13.5px;
        line-height: 1.5;
    }
    body.sb-modern #ibxSettingsScreen .ibx-set-head .ibx-settings-section-sub {
        margin-bottom: 0;
    }
    body.sb-modern #ibxSettingsScreen .ibx-settings-body {
        padding: 16px 14px 28px;
    }
    /* Шторка «Настройки»: раздел «скоро» — серым */
    .mob-sheet[data-sheet="isetsec"] .mob-row.is-soon {
        color: var(--mob-muted);
    }
}
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    /* ── Каналы: карточки на всю ширину ── */
    body.sb-modern #ibxSettingsScreen .ibx-chan-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }
    body.sb-modern #ibxSettingsScreen .ibx-chan-card {
        width: auto;
        height: auto;
        min-height: 0;
        padding: 16px;
        border-radius: 20px;
        -webkit-tap-highlight-color: transparent;
    }
    body.sb-modern #ibxSettingsScreen .ibx-chan-card:hover {
        transform: none;
        box-shadow: none;
    }
    body.sb-modern #ibxSettingsScreen .ibx-chan-card:active {
        border-color: var(--tk-green-2, #7dcf46);
    }
    body.sb-modern #ibxSettingsScreen .ibx-chan-card h3 {
        font-size: 15px;
    }
    body.sb-modern #ibxSettingsScreen .ibx-chan-card p {
        font-size: 13px;
        -webkit-line-clamp: 3;
    }

    /* ── Строки «название и пояснение — поле справа» (SLA и др.): поле не помещается рядом —
       уходит под пояснение, а не сжимает его в столбик по слову ── */
    body.sb-modern #ibxSettingsScreen .ibx-set-line {
        flex-wrap: wrap;
        row-gap: 10px;
        column-gap: 14px;
        padding: 14px;
    }
    body.sb-modern #ibxSettingsScreen .ibx-set-line-text {
        flex: 1 1 200px;
    }
    body.sb-modern #ibxSettingsScreen .ibx-set-line-title {
        font-size: 14px;
    }
    body.sb-modern #ibxSettingsScreen .ibx-set-line-hint {
        font-size: 12.5px;
    }
    body.sb-modern #ibxSettingsScreen .ibx-num {
        font-size: 13px;
    }
    body.sb-modern #ibxSettingsScreen .ibx-num input,
    body.sb-modern #ibxSettingsScreen input,
    body.sb-modern #ibxSettingsScreen textarea {
        font-size: 16px;
    }

    /* ── Уведомления: колонки переключателей узкие, описанию события — остальное ── */
    body.sb-modern #ibxSettingsScreen .ibx-notify-head,
    body.sb-modern #ibxSettingsScreen .ibx-notify-row {
        grid-template-columns: minmax(0, 1fr) 50px 50px;
        column-gap: 4px;
    }
    body.sb-modern #ibxSettingsScreen .ibx-notify-head {
        padding: 12px 12px 8px 14px;
    }
    /* «В приложении» / «Email» в узкой колонке не помещались — значками: колокольчик и конверт */
    body.sb-modern #ibxSettingsScreen .ibx-notify-head span:not(:first-child) {
        font-size: 0;
        height: 18px;
        display: flex;
        justify-content: center;
    }
    body.sb-modern #ibxSettingsScreen .ibx-notify-head span:not(:first-child)::before {
        content: '';
        width: 18px;
        height: 18px;
        background: var(--mob-muted);
        -webkit-mask: var(--mob-ic) center / 18px no-repeat;
        mask: var(--mob-ic) center / 18px no-repeat;
    }
    body.sb-modern #ibxSettingsScreen .ibx-notify-head span:nth-child(2) {
        --mob-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9'/%3E%3Cpath d='M13.73 21a2 2 0 0 1-3.46 0'/%3E%3C/svg%3E");
    }
    body.sb-modern #ibxSettingsScreen .ibx-notify-head span:nth-child(3) {
        --mob-ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='3'/%3E%3Cpath d='m4 7 8 6 8-6'/%3E%3C/svg%3E");
    }
    body.sb-modern #ibxSettingsScreen .ibx-notify-row {
        padding: 13px 12px 13px 14px;
    }
    body.sb-modern #ibxSettingsScreen .ibx-notify-label {
        font-size: 13.5px;
    }
    body.sb-modern #ibxSettingsScreen .ibx-notify-hint {
        font-size: 12px;
    }
    body.sb-modern #ibxSettingsScreen .ibx-notify-email {
        font-size: 12.5px;
        line-height: 1.45;
    }

    /* ── ИИ-помощник: тон ответов — одной колонкой ── */
    body.sb-modern #ibxSettingsScreen .ibx-ai-tonebox {
        padding: 16px;
        gap: 16px;
    }
    body.sb-modern #ibxSettingsScreen .ibx-ai-tones {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }
    body.sb-modern #ibxSettingsScreen .ibx-ai-chat-in,
    body.sb-modern #ibxSettingsScreen .ibx-ai-chat-out {
        max-width: 92%;
    }

    /* ── Аналитика: в строке канала полоса — под названием, справа числа; сотрудники плотнее ── */
    body.sb-modern #ibxSettingsScreen .ibx-an-thead:not(.ibx-an-thead--person),
    body.sb-modern #ibxSettingsScreen .ibx-an-row:not(.ibx-an-row--person):not(.is-off) {
        grid-template-columns: minmax(0, 1fr) 72px 60px;
        column-gap: 8px;
        row-gap: 7px;
    }
    body.sb-modern #ibxSettingsScreen .ibx-an-thead:not(.ibx-an-thead--person) span:nth-child(2) {
        display: none;
    }
    body.sb-modern #ibxSettingsScreen .ibx-an-row:not(.ibx-an-row--person):not(.is-off) .ibx-an-row-bar {
        grid-column: 1 / -1;
        grid-row: 2;
    }
    body.sb-modern #ibxSettingsScreen .ibx-an-thead--person,
    body.sb-modern #ibxSettingsScreen .ibx-an-row--person {
        grid-template-columns: minmax(0, 1fr) 58px 56px 54px;
        column-gap: 6px;
    }
    body.sb-modern #ibxSettingsScreen .ibx-an-thead {
        font-size: 10.5px;
    }
    body.sb-modern #ibxSettingsScreen .ibx-an-row.is-off .ibx-an-row-name {
        flex-wrap: wrap;
        row-gap: 4px;
        white-space: normal;
    }
    body.sb-modern #ibxSettingsScreen .ibx-an-connect {
        padding: 8px 14px;
        font-size: 12.5px;
    }

    /* ── Окна создания (новая метка, отдел, макрос, правило) — листом снизу во весь экран, поверх
       верхней строки и нижнего меню (было под меню — «Сохранить» у длинной формы не нажать) ── */
    html.mob-iset body.sb-modern #page-inbox .ibx-wrap:has(.ibx-set-drawer.open) {
        z-index: 9989;
    }
    body.sb-modern #ibxSettingsScreen .ibx-set-drawer {
        top: calc(env(safe-area-inset-top, 0px) + 10px) !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: auto !important;
        border: 0;
        border-radius: 26px 26px 0 0;
        transform: translateY(105%);
        visibility: hidden;
        transition: transform .32s cubic-bezier(.22, .61, .36, 1), visibility 0s linear .32s;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    body.sb-modern #ibxSettingsScreen .ibx-set-drawer.open {
        transform: none;
        visibility: visible;
        transition: transform .32s cubic-bezier(.22, .61, .36, 1), visibility 0s;
        box-shadow: 0 -18px 48px rgba(15, 17, 23, .18);
    }
    body.sb-modern #ibxSettingsScreen .ibx-set-drawer-dim {
        background: rgba(15, 17, 23, .38);
    }
    body.sb-modern #ibxSettingsScreen .ibx-set-drawer-head {
        padding: 18px 14px 12px 18px;
        border-radius: 26px 26px 0 0;
    }
    body.sb-modern #ibxSettingsScreen .ibx-set-drawer-close {
        width: 38px;
        height: 38px;
    }
    body.sb-modern #ibxSettingsScreen .ibx-set-drawer-body {
        padding: 18px 16px 24px;
        overscroll-behavior: contain;
    }
    body.sb-modern #ibxSettingsScreen .ibx-form-actions .ibx-btn {
        height: 46px;
        padding: 0 20px;
        font-size: 14px;
    }

    /* ── Клавиатура: лист настроек и окно создания = видимая часть экрана (--mob-vvt / --mob-vvb —
       kbSync в mobile.js), верхняя строка на это время уходит ── */
    html.mob-iset.mob-kbs .mob-top {
        visibility: hidden;
    }
    html.mob-iset.mob-kbs body.sb-modern #page-inbox .ibx-wrap {
        left: 0;
        right: 0;
        top: var(--mob-vvt, 0px);
        bottom: auto;
        height: calc(var(--mob-vvb, 100vh) - var(--mob-vvt, 0px));
        z-index: 9989;
    }
    html.mob-iset.mob-kbs body.sb-modern #ibxSettingsScreen {
        border-radius: 0;
    }
    html.mob-iset.mob-kbs body.sb-modern #ibxSettingsScreen .ibx-settings-body {
        padding-bottom: calc(28px + var(--mob-sheet-acc, 0px));
    }
    html.mob-kbs body.sb-modern #ibxSettingsScreen .ibx-set-drawer.open {
        top: max(calc(var(--mob-vvt, 0px) + 10px), calc(env(safe-area-inset-top, 0px) + 10px)) !important;
        bottom: auto !important;
        height: calc(var(--mob-vvb, 100vh) - max(calc(var(--mob-vvt, 0px) + 10px), calc(env(safe-area-inset-top, 0px) + 10px)));
        transition: none;
    }
    html.mob-kbs body.sb-modern #ibxSettingsScreen .ibx-set-drawer-body {
        padding-bottom: calc(24px + var(--mob-sheet-acc, 0px));
    }
}

/* ══════════════════════════════════════════════════════════════════════
   Всплывающие уведомления на телефоне (13.10.2026): новая заявка, команда, уведомления сервера
   (app.js — showLeadNotif / showTeamNotif / _showNotifToast, контейнер #leadNotifWrap). Как баннеры
   iPhone: компактная плашка сверху — точка и тип, имя и текст в строку, кнопка действия справа,
   без крестика (смахнуть вверх или нажать). Несколько сразу — стопкой: сверху новое, ниже видны края
   двух предыдущих (порядок и высоту ставит notifStackSync() в mobile.js — --mob-d, mob-notif-back)
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    .lead-notif-wrap.mob-notif-stack {
        display: block;
        top: calc(env(safe-area-inset-top, 0px) + 8px);
        left: 8px;
        right: 8px;
        height: 0;
    }
    .mob-notif-stack .lead-notif {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        width: auto;
        box-sizing: border-box;
        border: 0;
        border-radius: 22px;
        background: #fff;
        box-shadow: 0 0 0 1px rgba(17, 18, 23, .05), 0 14px 34px -12px rgba(17, 18, 23, .32);
        transform-origin: 50% 0;
        opacity: 0;
        transform: translateY(-130%);
        transition: transform .45s cubic-bezier(.22, 1, .36, 1), opacity .25s ease, height .3s ease;
        -webkit-tap-highlight-color: transparent;
    }
    .mob-notif-stack .lead-notif.lead-notif--show {
        opacity: 1;
        transform: translateY(calc(var(--mob-d, 0) * 9px)) scale(calc(1 - var(--mob-d, 0) * .05));
    }
    .mob-notif-stack .lead-notif.lead-notif--hide {
        opacity: 0;
        transform: translateY(-130%);
        transition: transform .3s ease, opacity .22s ease;
    }
    /* предыдущие — краями под верхней, без содержимого */
    .mob-notif-stack .lead-notif.mob-notif-back {
        pointer-events: none;
        overflow: hidden;
        background: #f6f7f4;
    }
    .mob-notif-stack .lead-notif.mob-notif-back .lead-notif-inner {
        opacity: 0;
    }
    .mob-notif-stack .lead-notif.mob-notif-gone {
        opacity: 0 !important;
    }

    /* плашка: одна строка содержимого, кнопка справа */
    .mob-notif-stack .lead-notif-inner {
        align-items: center;
        gap: 10px;
        padding: 10px 10px 10px 16px;
        transition: opacity .2s ease;
    }
    .mob-notif-stack .lead-notif-body {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        column-gap: 10px;
        align-items: center;
    }
    .mob-notif-stack .lead-notif-label,
    .mob-notif-stack .lead-notif-name,
    .mob-notif-stack .lead-notif-msg {
        grid-column: 1;
        min-width: 0;
    }
    .mob-notif-stack .lead-notif-label {
        margin: 0 0 2px;
        font-family: 'Onest', sans-serif;
        font-size: 11.5px;
        font-weight: 600;
        letter-spacing: 0;
        text-transform: none;
        color: var(--mob-muted) !important;
    }
    .mob-notif-stack .lead-notif-label::before {
        width: 7px;
        height: 7px;
        background: linear-gradient(135deg, #5cc531 0%, #2f8a1c 100%);
        animation: none;
    }
    .mob-notif-stack .lead-notif-name {
        margin: 0;
        font-size: 14px;
        font-weight: 700;
        line-height: 1.3;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .mob-notif-stack .lead-notif-msg {
        margin-top: 1px;
        font-size: 12.5px;
        line-height: 1.3;
    }
    .mob-notif-stack .lead-notif-actions {
        grid-column: 2;
        grid-row: 1 / span 3;
        margin: 0;
    }
    .mob-notif-stack .lead-notif-btn {
        height: 34px;
        padding: 0 14px;
        font-size: 13px;
        white-space: nowrap;
    }
    .mob-notif-stack .lead-notif-close {
        display: none;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   Сообщения о действиях (#toast, toast() в app.js) на телефоне (13.10.2026): тёмная пилюля по ширине
   текста по центру над нижним меню, значок по смыслу (класс ставит initToast() в mobile.js):
   mob-toast-ok — лаймовая галочка, mob-toast-err — красный «!», без класса — без значка. Пока открыта
   клавиатура — вверху видимой части (внизу её закрыла бы клавиатура); на экранах без нижнего меню
   (беседа, письмо) — над полем ввода
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    body .toast {
        left: 50%;
        right: auto;
        width: max-content;
        max-width: calc(100vw - 32px);
        box-sizing: border-box;
        display: flex;
        align-items: center;
        gap: 9px;
        padding: 11px 18px;
        border-radius: 20px;
        background: rgba(17, 18, 23, .94);
        color: #fff;
        font-family: 'Onest', sans-serif;
        font-size: 14px;
        font-weight: 600;
        line-height: 1.3;
        text-align: left;
        box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .06) inset;
        transform: translate(-50%, 12px) scale(.96);
        transition: opacity .2s ease, transform .32s cubic-bezier(.22, 1, .36, 1);
    }
    body .toast.show {
        transform: translate(-50%, 0) scale(1);
    }
    body .toast.mob-toast-ok,
    body .toast.mob-toast-err {
        padding-left: 11px;
    }
    body .toast.mob-toast-ok::before,
    body .toast.mob-toast-err::before {
        content: '';
        flex: none;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background-position: center;
        background-repeat: no-repeat;
        background-size: 12px;
    }
    body .toast.mob-toast-ok::before {
        background-color: #A8E76A;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23173b14' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
    }
    body .toast.mob-toast-err::before {
        background-color: #ff6b5e;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round'%3E%3Cline x1='12' y1='6' x2='12' y2='13.5'/%3E%3Cline x1='12' y1='18.5' x2='12.01' y2='18.5'/%3E%3C/svg%3E");
    }
    /* без нижнего меню — над полем ввода беседы, письма, окна Pato */
    html.mob-chat body .toast,
    html.mob-mread body .toast,
    html.mob-pato-open body .toast {
        bottom: calc(var(--mob-nav-bottom) + 92px);
    }
    /* клавиатура открыта — вверху видимой части */
    html.mob-kbs body .toast,
    html.mob-kb body .toast {
        top: calc(var(--mob-vvt, 0px) + 14px);
        bottom: auto;
        transform: translate(-50%, -12px) scale(.96);
    }
    html.mob-kbs body .toast.show,
    html.mob-kb body .toast.show {
        transform: translate(-50%, 0) scale(1);
    }
}

/* ══════════════════════════════════════════════════════════════════════
   «Диалоги»: клиент и сделка из беседы на телефоне (13.10.2026). Окно «Не в клиентах» (.ibx-cgate)
   и окно сделок клиента с формой «Новая сделка» (#ibxPop.ibx-pop--deals) — листами снизу (на
   компьютере — панель справа и окошко у кнопки). Обвязка — initInboxDeal() в mobile.js
   ══════════════════════════════════════════════════════════════════════ */
#mobIbxPopDim {
    display: none;
}
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    body .ibx-cgate-dim {
        z-index: 9990;
        background: rgba(15, 17, 23, .38);
    }
    body .ibx-cgate {
        z-index: 9991;
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        max-height: 88vh;
        max-height: 88dvh;
        border-radius: 26px 26px 0 0;
        transform: translateY(105%);
        transition: transform .32s cubic-bezier(.22, .61, .36, 1);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        box-shadow: 0 -18px 48px rgba(15, 17, 23, .18);
    }
    body .ibx-cgate.open {
        transform: none;
    }
    body .ibx-cgate::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        width: 38px;
        height: 4px;
        margin-left: -19px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .14);
    }
    body .ibx-cgate-head {
        padding: 24px 14px 14px 18px;
    }
    body .ibx-cgate-x {
        width: 38px;
        height: 38px;
    }
    body .ibx-cgate-body {
        padding: 14px 14px 16px;
    }
    body .ibx-cgate-row-main b {
        font-size: 14.5px;
    }
    /* кнопки — друг под другом во всю ширину */
    body .ibx-cgate-foot {
        grid-template-columns: minmax(0, 1fr);
        padding: 12px 14px 14px;
    }
    body .ibx-cgate-add,
    body .ibx-cgate-deal {
        height: 50px;
        font-size: 15px;
    }
    body .ibx-cgate-foot-hint {
        text-align: center;
        font-size: 12.5px;
    }

    /* окно сделок клиента и «Новая сделка» */
    body #mobIbxPopDim {
        position: fixed;
        inset: 0;
        z-index: 9990;
        display: block;
        background: rgba(15, 17, 23, .38);
        animation: mobCalFade .2s ease both;
    }
    body #mobIbxPopDim[hidden] {
        display: none;
    }
    body #ibxPop.ibx-pop--deals {
        z-index: 9991;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        bottom: 0 !important;
        width: auto;
        max-width: none;
        max-height: 86vh;
        max-height: 86dvh;
        overflow-y: auto;
        overscroll-behavior: contain;
        border: 0;
        border-radius: 26px 26px 0 0;
        padding: 14px 0 env(safe-area-inset-bottom, 0px);
        box-shadow: 0 -18px 48px rgba(15, 17, 23, .18);
        animation: mobMailSheetIn .28s cubic-bezier(.22, .61, .36, 1);
    }
    body #ibxPop.ibx-pop--deals::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        width: 38px;
        height: 4px;
        margin-left: -19px;
        border-radius: 999px;
        background: rgba(17, 18, 23, .14);
    }
    html.mob-kbs body #ibxPop.ibx-pop--deals.open {
        top: calc(var(--mob-vvt, 0px) + 10px) !important;
        bottom: auto !important;
        max-height: none;
        height: calc(var(--mob-vvb, 100vh) - var(--mob-vvt, 0px) - 10px);
        padding-bottom: var(--mob-sheet-acc, 0px);
        animation: none;
    }
    body #ibxPop.ibx-pop--deals .ibx-dl-head {
        padding: 14px 18px 10px;
    }
    body #ibxPop.ibx-pop--deals .ibx-dl-head span {
        font-family: 'Unbounded', sans-serif;
        font-size: 16px;
        font-weight: 600;
    }
    body #ibxPop.ibx-pop--deals .ibx-dl-list {
        max-height: none;
        padding: 0 10px 8px;
    }
    body #ibxPop.ibx-pop--deals .ibx-dl-row {
        padding: 12px 10px;
    }
    body #ibxPop.ibx-pop--deals .ibx-dl-main b {
        font-size: 14.5px;
    }
    body #ibxPop.ibx-pop--deals .ibx-dl-new {
        margin: 4px 14px 14px;
        height: 48px;
        font-size: 14px;
    }
    body #ibxPop.ibx-pop--deals .ibx-dl-form {
        margin: 4px 14px 14px;
        padding: 14px;
        border-radius: 18px;
    }
    body #ibxPop.ibx-pop--deals .ibx-dl-form-title {
        font-size: 14px;
    }
    body #ibxPop.ibx-pop--deals .ibx-dl-field {
        margin-bottom: 12px;
    }
    body #ibxPop.ibx-pop--deals .ibx-dl-field > span {
        font-size: 11px;
    }
    body #ibxPop.ibx-pop--deals .ibx-dl-field input,
    body #ibxPop.ibx-pop--deals .ibx-dl-field select,
    body #ibxPop.ibx-pop--deals .ibx-dl-field .ibx-sel-cdd .cdd-trigger {
        height: 46px;
        border-radius: 13px;
        font-size: 16px;
    }
    /* «Этап» — список раскрывается прямо под полем, в листе (затемнение общего списка его закрывало) */
    body #ibxPop.ibx-pop--deals .cdd.open .cdd-panel {
        position: static !important;
        width: auto !important;
        max-height: none;
        margin-top: 6px;
        transform: none !important;
        box-shadow: 0 0 0 1px rgba(17, 18, 23, .08);
        border-radius: 14px;
    }
    body #ibxPop.ibx-pop--deals .cdd-opt {
        min-height: 44px;
        font-size: 15px;
    }
    body #ibxPop.ibx-pop--deals .ibx-dl-create,
    body #ibxPop.ibx-pop--deals .ibx-dl-cancel {
        height: 50px;
        font-size: 15px;
    }
}

/* Вкладка «Задачи» окна сделки на телефоне (13.10.2026): ТЗ сделки, «Задачи N/M», форма и список —
   в порядке разметки, как вкладка «Описание» окна задачи (иначе .dmc-card { order: 3 } окна сделки
   уводил карточки под заголовок «Задачи»). Строка под задачей и подзадачей — в одну линию:
   исполнитель сокращается многоточием, срок и приоритет остаются рядом */
@media (max-width: 700px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    #modal-deal.mob-deal #dmcPane-tasks > * { order: 0; }
    #tmSubtaskList .crm-task-meta,
    #deal-modal-tasks-list .crm-task-meta { flex-wrap: nowrap; gap: 6px 12px; }
    #tmSubtaskList .tm-sm-who,
    #deal-modal-tasks-list .tm-sm-who { flex: 0 1 auto; min-width: 0; overflow: hidden; }
    #tmSubtaskList .tm-sm-name,
    #deal-modal-tasks-list .tm-sm-name { max-width: none; }
    #tmSubtaskList .tm-sm-due, #tmSubtaskList .tm-sm-prio, #tmSubtaskList .crm-task-attach-chip,
    #deal-modal-tasks-list .tm-sm-due, #deal-modal-tasks-list .tm-sm-prio, #deal-modal-tasks-list .crm-task-attach-chip { flex: none; white-space: nowrap; }
}
