/* ══════════════════════════════════════════════════════════════════════════════
   КАБИНЕТ НА ТЕЛЕФОНЕ — вид мобильной демо daisyUI (~/work/crm-daisyui-demo/m/),
   перенос 18.10.2026. Логика — js/82_dz2-mobile.js и js/16_mobile.js.
   Работает на ширине ≤768 px. Содержимое — под body.dz2m (новый вид); «Прежний вид»
   (html[data-dz-off]) класса не получает. Нижняя панель — для обоих видов.
   Цвета только из токенов (Corporate: --gold и --gold-fill — синий акцент).
   Шрифт один, размеры 12 / 14 / 17 / 28, отступы по сетке 4/8, цели касания ≥44 px.
   ══════════════════════════════════════════════════════════════════════════════ */

@media (max-width:768px){
  /* ── нижняя панель (dock) ── */
  #mobTabbar{align-items:stretch;padding:0 4px env(safe-area-inset-bottom);height:calc(64px + env(safe-area-inset-bottom));
    background:var(--panel);border-top:1px solid var(--line);box-shadow:0 -8px 24px -18px var(--scrim)}
  #mobTabbar button{flex:1 1 0;min-width:0;min-height:56px;padding:6px 2px;gap:4px;justify-content:center;border-radius:12px;color:var(--muted);
    -webkit-tap-highlight-color:transparent;transition:color .15s}
  #mobTabbar button:active{background:var(--hover)}
  #mobTabbar button.active{color:var(--gold)}
  #mobTabbar button.active .mt-lbl{font-weight:600}
  #mobTabbar .mt-ico{display:inline-flex;font-size:0;line-height:0}
  #mobTabbar .mt-ico svg{width:24px;height:24px}
  #mobTabbar .mt-lbl{font-size:12px;line-height:1.1}
  #mobTabbar .mt-badge{top:-6px;right:-12px;min-width:18px;height:18px;border-radius:999px;font-size:12px;line-height:18px;font-weight:600}
  #mobTabbar button:focus-visible{outline:2px solid var(--gold);outline-offset:-2px}
  .main,body.nav-collapsed .main{padding-bottom:calc(88px + env(safe-area-inset-bottom))}
}
@media (max-width:430px){
  #mobTabbar .mt-lbl{font-size:12px}
  #mobTabbar .mt-ico{font-size:0}
}

@media (max-width:768px){
  body.dz2m{overflow-x:hidden}
  body.dz2m .dz2m-ico{display:inline-block;flex:none;vertical-align:-3px}
  body.dz2m .dz2m-num{font-variant-numeric:tabular-nums}
  body.dz2m .dz2m-mut{color:var(--muted);font-size:12px}
  body.dz2m .dz2m-ell{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block}
  body.dz2m .dz2m-col{display:flex;flex-direction:column;gap:4px;min-width:0;flex:1 1 auto}
  body.dz2m .dz2m-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}

  /* ── кнопки ── */
  body.dz2m .dz2m-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:0 16px;border-radius:14px;
    border:1px solid var(--line);background:var(--panel);color:var(--ink);font:600 14px/1.2 inherit;text-decoration:none;cursor:pointer;
    touch-action:manipulation;transition:transform .12s}
  body.dz2m .dz2m-btn:active{transform:scale(.97)}
  body.dz2m .dz2m-btn.pri{background:var(--gold-fill);border-color:var(--gold-fill);color:var(--on-gold)}
  body.dz2m .dz2m-btn.big{min-height:56px;font-size:17px;border-radius:18px;flex:1 1 auto}
  body.dz2m .dz2m-btn.sq{flex:0 0 56px;width:56px;min-height:56px;padding:0;border-radius:18px}
  body.dz2m .dz2m-btn.full{width:100%;margin-top:12px}
  body.dz2m .dz2m-btn.ghost{background:none}
  body.dz2m .dz2m-btn.dis{color:var(--muted);cursor:default}
  body.dz2m .dz2m-btn[disabled]{opacity:.5}
  body.dz2m .dz2m-ib{width:44px;height:44px;min-width:44px;display:grid;place-items:center;border:0;border-radius:12px;background:none;color:var(--ink);cursor:pointer;flex:none}
  body.dz2m .dz2m-ib:active{background:var(--hover)}
  body.dz2m .dz2m-link{border:0;background:none;color:var(--gold);font:600 12px inherit;min-height:44px;padding:0 4px;cursor:pointer}

  /* ── заголовки, секции ── */
  body.dz2m .dz2m-top{display:flex;align-items:flex-start;gap:8px;margin:4px 0 16px}
  body.dz2m .dz2m-tt{flex:1 1 auto;min-width:0}
  body.dz2m .dz2m-h{font-size:28px;line-height:1.15;font-weight:600;letter-spacing:-.02em;color:var(--ink)}
  body.dz2m .dz2m-sub{font-size:14px;color:var(--muted);margin-top:4px}
  body.dz2m .dz2m-sec{display:flex;align-items:center;gap:8px;margin:24px 0 8px}
  body.dz2m .dz2m-sec h2{margin:0;flex:1;font-size:14px;font-weight:600;color:var(--ink);font-family:inherit;text-transform:none;letter-spacing:0}
  body.dz2m .dz2m-sec>span{font-size:12px;color:var(--muted)}
  body.dz2m .dz2m-hint{font-size:12px;color:var(--muted);text-align:center;margin-top:8px}
  body.dz2m .dz2m-note{font-size:12px;color:var(--muted);margin:12px 4px 0;line-height:1.45}

  /* ── карточки и списки ── */
  body.dz2m .dz2m-card{background:var(--panel);border:1px solid var(--line);border-radius:16px;box-shadow:var(--sh-1);padding:16px}
  body.dz2m .dz2m-list{display:flex;flex-direction:column;background:var(--panel);border:1px solid var(--line);border-radius:16px;overflow:hidden}
  body.dz2m .dz2m-li{display:flex;align-items:center;gap:12px;width:100%;min-height:64px;padding:12px 16px;margin:0;border:0;border-bottom:1px solid var(--line);
    border-radius:0;background:var(--panel);color:var(--ink);text-align:left;font:inherit;cursor:pointer;position:relative}
  body.dz2m .dz2m-list>.dz2m-li:last-child,body.dz2m .dz2m-list>.dz2m-sw:last-child .dz2m-li{border-bottom:0}
  body.dz2m .dz2m-li:active{background:var(--hover)}
  body.dz2m .dz2m-li b{font-size:14px;font-weight:600}
  body.dz2m .dz2m-ti{width:40px;height:40px;flex:none;display:grid;place-items:center;border-radius:12px;background:var(--panel2);color:var(--muted)}
  body.dz2m .dz2m-ti.acc{color:var(--gold);background:var(--soft-gold)}
  body.dz2m .dz2m-r{flex:none;font-size:12px;color:var(--muted)}
  body.dz2m .dz2m-r.bad{color:var(--red)}
  body.dz2m .dz2m-cnt{flex:none;min-width:24px;height:24px;padding:0 8px;border-radius:999px;background:var(--badge);color:var(--on-gold);font-size:12px;font-weight:600;display:inline-grid;place-items:center}

  /* ── метки ── */
  body.dz2m .dz2m-tag{display:inline-flex;align-items:center;gap:4px;min-height:24px;padding:0 8px;border-radius:999px;font-size:12px;font-weight:600;white-space:nowrap;background:var(--panel2);color:var(--muted)}
  body.dz2m .dz2m-tag.acc{background:var(--soft-gold);color:var(--gold)}
  body.dz2m .dz2m-tag.info{background:var(--soft-blue);color:var(--info)}
  body.dz2m .dz2m-tag.bad{background:var(--soft-red);color:var(--red)}

  /* ── сегмент ── */
  body.dz2m .dz2m-seg{display:flex;padding:4px;gap:4px;border-radius:14px;background:var(--panel2);margin:0 0 16px}
  body.dz2m .dz2m-seg button{flex:1 1 0;display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;border:0;border-radius:10px;background:none;
    color:var(--muted);font:600 14px inherit;cursor:pointer;min-width:0}
  body.dz2m .dz2m-seg button.on{background:var(--panel);color:var(--ink);box-shadow:var(--sh-1),0 0 0 1px var(--line)}

  /* ══ «Мой день» ══ */
  body.dz2m #tasks.dz2m-day>:not(#dz2mDay){display:none!important}
  body.dz2m #dz2mDay{max-width:600px;margin:0 auto}
  body.dz2m.dz2m-has-cta #tasks.active #dz2mDay{padding-bottom:88px}
  body.dz2m .dz2m-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));background:var(--panel);border:1px solid var(--line);border-radius:16px;box-shadow:var(--sh-1);overflow:hidden}
  body.dz2m .dz2m-stat{display:flex;flex-direction:column;gap:4px;padding:12px;min-width:0}
  body.dz2m .dz2m-stat+.dz2m-stat{border-left:1px solid var(--line)}
  body.dz2m .dz2m-stat span{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  body.dz2m .dz2m-stat b{font-size:28px;line-height:1.1;font-weight:600;font-variant-numeric:tabular-nums;color:var(--ink)}
  body.dz2m .dz2m-stat b.bad{color:var(--red)}
  body.dz2m .dz2m-prog{display:flex;align-items:center;gap:8px;margin-top:16px;font-size:12px;color:var(--muted)}
  body.dz2m .dz2m-prog span{flex:1}
  body.dz2m .dz2m-prog b{color:var(--ink);font-variant-numeric:tabular-nums}
  body.dz2m .dz2m-bar{height:8px;border-radius:99px;background:var(--panel2);overflow:hidden;margin-top:8px}
  body.dz2m .dz2m-bar i{display:block;height:100%;border-radius:inherit;background:var(--gold-fill);transition:width .6s cubic-bezier(.23,1,.32,1)}

  body.dz2m .dz2m-focus{position:relative;overflow:hidden;cursor:pointer;padding-left:20px}
  body.dz2m .dz2m-focus:active{transform:scale(.995)}
  body.dz2m .dz2m-fbar{position:absolute;left:0;top:0;bottom:0;width:4px;background:var(--gold-fill)}
  body.dz2m .dz2m-focus.over .dz2m-fbar{background:var(--red)}
  body.dz2m .dz2m-who{display:flex;align-items:center;gap:12px;margin-top:16px;color:var(--muted)}
  body.dz2m .dz2m-name{font-size:17px;font-weight:600;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  body.dz2m .dz2m-task{display:flex;align-items:center;gap:12px;margin-top:16px;padding:12px;border-radius:14px;background:var(--panel2)}
  body.dz2m .dz2m-task .dz2m-ti{background:var(--panel);border:1px solid var(--line);color:var(--ink)}
  body.dz2m .dz2m-task b{font-size:14px;font-weight:600;color:var(--ink)}
  body.dz2m .dz2m-resp{display:flex;align-items:center;gap:8px;margin-top:12px;font-size:12px;color:var(--muted)}
  body.dz2m #dz2mDay .dz-ava.lg{width:56px;height:56px;font-size:17px}
  #dz2mSheetHost .dz-ava{flex:none;display:inline-grid;place-items:center;width:40px;height:40px;border-radius:50%;background:var(--panel3) center/cover no-repeat;color:var(--ink);font-size:12px;font-weight:600}

  body.dz2m .dz2m-empty{text-align:center;padding:32px 24px;color:var(--muted);font-size:14px;line-height:1.45}
  body.dz2m .dz2m-empty b{display:block;color:var(--ink);font-size:17px;margin-bottom:4px}
  body.dz2m .dz2m-empty .dz2m-btn{margin-top:16px}
  body.dz2m .dz2m-ei{width:64px;height:64px;margin:0 auto 12px;border-radius:20px;display:grid;place-items:center;background:var(--panel2);color:var(--ink)}
  body.dz2m .dz2m-ei.ok{color:var(--ok);background:var(--soft-ok)}

  /* свайп по строке очереди */
  body.dz2m .dz2m-sw{position:relative;overflow:hidden}
  body.dz2m .dz2m-swbg{position:absolute;inset:0;display:flex;align-items:center;justify-content:space-between;padding:0 20px;font-size:12px;font-weight:600}
  body.dz2m .dz2m-swbg span{display:inline-flex;align-items:center;gap:8px}
  body.dz2m .dz2m-swbg .l{color:var(--ok)}
  body.dz2m .dz2m-swbg .r{color:var(--warn)}
  body.dz2m .dz2m-sw.go-r .dz2m-swbg{background:var(--soft-ok)}
  body.dz2m .dz2m-sw.go-l .dz2m-swbg{background:var(--soft-warn)}
  body.dz2m .dz2m-sw .dz2m-li{transition:transform .25s cubic-bezier(.23,1,.32,1);will-change:transform;touch-action:pan-y}
  body.dz2m .dz2m-sw.drag .dz2m-li{transition:none}

  /* кнопка в зоне большого пальца — над нижней панелью */
  body.dz2m .dz2m-cta{position:fixed;left:0;right:0;bottom:calc(64px + env(safe-area-inset-bottom));z-index:9550;padding:24px 16px 12px;
    background:linear-gradient(to bottom,transparent,var(--bg) 40%);pointer-events:none}
  body.dz2m .dz2m-cta>*{pointer-events:auto;max-width:600px;margin:0 auto}
  body.dz2m .dz2m-ctarow{display:flex;gap:8px;align-items:stretch}
  body.dz2m .dz2m-ctarow .dz2m-btn.pri{box-shadow:0 12px 28px -12px var(--gold-fill)}

  /* ══ шторка снизу ══ */
  #dz2mSheetHost{position:fixed;inset:0;z-index:9650}
  #dz2mSheetHost .dz2m-scrim{position:absolute;inset:0;background:var(--scrim);opacity:0;transition:opacity .25s}
  #dz2mSheetHost.on .dz2m-scrim{opacity:1}
  #dz2mSheetHost .dz2m-sheet{position:absolute;left:0;right:0;bottom:0;max-height:88dvh;overflow:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;
    background:var(--panel);color:var(--ink);border-radius:24px 24px 0 0;padding:8px 16px calc(16px + env(safe-area-inset-bottom));
    transform:translateY(102%);transition:transform .38s cubic-bezier(.23,1,.32,1);box-shadow:var(--sh-2);max-width:600px;margin:0 auto}
  #dz2mSheetHost.on .dz2m-sheet{transform:none}
  #dz2mSheetHost .dz2m-sheet.full{top:calc(8px + env(safe-area-inset-top));max-height:none}
  #dz2mSheetHost .dz2m-grip{width:40px;height:4px;border-radius:4px;background:var(--line);margin:4px auto 12px}
  #dz2mSheetHost .dz2m-sht{font-size:17px;font-weight:600;margin:0 0 4px}
  #dz2mSheetHost .dz2m-shs{font-size:12px;color:var(--muted);margin:0 0 16px;overflow-wrap:anywhere}
  #dz2mSheetHost .dz2m-sec:first-of-type{margin-top:16px}
  #dz2mSheetHost .dz2m-list .dz2m-li{min-height:56px}
  #dz2mSheetHost .dz2m-opt{display:flex;align-items:center;gap:12px;width:100%;min-height:56px;padding:8px 12px;border:1px solid var(--line);border-radius:16px;
    background:var(--panel);color:var(--ink);text-align:left;font:inherit;cursor:pointer}
  #dz2mSheetHost .dz2m-opt+.dz2m-opt{margin-top:8px}
  #dz2mSheetHost .dz2m-opt b{font-size:14px}
  #dz2mSheetHost .dz2m-opt[disabled]{opacity:.45;cursor:default}

  /* поиск */
  #dz2mSheetHost .dz2m-srow{display:flex;align-items:center;gap:8px}
  #dz2mSheetHost .dz2m-search{flex:1 1 auto;display:flex;align-items:center;gap:8px;min-height:48px;padding:0 12px;border-radius:14px;background:var(--panel2);border:1px solid var(--line);color:var(--muted)}
  #dz2mSheetHost .dz2m-search:focus-within{border-color:var(--gold)}
  #dz2mSheetHost .dz2m-search input{flex:1;min-width:0;border:0!important;outline:0;background:none!important;box-shadow:none!important;font-size:16px;color:var(--ink);padding:0;min-height:44px;border-radius:0}
  #dz2mSheetHost .dz2m-chips{display:flex;gap:8px;flex-wrap:wrap}
  body.dz2m .dz2m-chip{flex:none;display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 12px;border-radius:999px;border:1px solid var(--line);
    background:var(--panel);color:var(--muted);font:600 14px inherit;white-space:nowrap;cursor:pointer;max-width:100%}
  body.dz2m .dz2m-chip>span:not(.n){overflow:hidden;text-overflow:ellipsis}
  body.dz2m .dz2m-chip .n{font-size:12px;opacity:.75;font-variant-numeric:tabular-nums}
  body.dz2m .dz2m-chip.on{background:var(--gold-fill);border-color:var(--gold-fill);color:var(--on-gold)}
  body.dz2m .dz2m-dot{width:8px;height:8px;border-radius:50%;flex:none;display:inline-block;background:var(--muted)}
  body.dz2m .dz2m-dot.off{background:var(--line)}
  body.dz2m .dz2m-chip.on .dz2m-dot{box-shadow:0 0 0 2px var(--on-gold)}

  /* ══ воронка: этапы лентой ══ */
  body.dz2m #platform #pfColBtn{display:none!important}
  body.dz2m #platform .pf-stagechips.mob-open{display:none!important}
  body.dz2m .dz2m-stages{margin:0 -12px 8px}
  body.dz2m .dz2m-scroll{display:flex;gap:8px;overflow-x:auto;scrollbar-width:none;padding:4px 12px 8px;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch}
  body.dz2m .dz2m-scroll::-webkit-scrollbar{display:none}
  body.dz2m .dz2m-scroll .dz2m-chip{scroll-snap-align:center;max-width:78vw}
  body.dz2m .dz2m-scroll .dz2m-chip.fin:not(.on){border-style:dashed}
  body.dz2m .dz2m-sthint{text-align:left;margin:0 12px}
  body.dz2m.pl-list-mode .dz2m-stages{display:none}
  body.dz2m #platformBoard.dz2m-in-l .pf-col.mob-active{animation:dz2mInL .28s cubic-bezier(.23,1,.32,1)}
  body.dz2m #platformBoard.dz2m-in-r .pf-col.mob-active{animation:dz2mInR .28s cubic-bezier(.23,1,.32,1)}
  /* «Новая сделка» — в зоне большого пальца, над нижней панелью */
  body.dz2m #platform.active #pfAddBtn{position:fixed;right:16px;bottom:calc(76px + env(safe-area-inset-bottom));z-index:9500;min-height:56px;padding:0 20px;
    border-radius:18px;font-size:14px;box-shadow:0 12px 28px -10px var(--gold-fill),var(--sh-pop)}
  body.dz2m.pf-map-open #platform.active #pfAddBtn{display:none}
  body.dz2m #platform .pf-col .col-body{padding-bottom:88px}
  /* плитка на телефоне: метки не мельче 12 px (размер задан в разметке — перебиваем) */
  body.dz2m #platformBoard .pf-card .pf-src,body.dz2m #platformBoard .pf-card .pf-wt,body.dz2m #platformBoard .pf-card .pf-num{font-size:12px!important}
  body.dz2m #pfWhoSeg button{min-width:44px;min-height:44px}

  /* ══ карточка сделки ══ */
  body.dz2m #listingModal.dz2m-card .modal-win{max-height:100dvh;min-height:100dvh;border-radius:0!important;padding-bottom:0}
  body.dz2m #listingModal.dz2m-card .modal-bar{flex-wrap:nowrap;gap:8px;padding:8px 12px;align-items:center}
  body.dz2m #listingModal.dz2m-card .modal-bar .lc-back{flex:none;min-height:44px}
  body.dz2m #listingModal.dz2m-card .modal-bar .lc-actions{flex:1 1 auto;min-width:0;width:auto;flex-wrap:nowrap!important;overflow-x:auto;scrollbar-width:none;justify-content:flex-start}
  body.dz2m #listingModal.dz2m-card .modal-bar .lc-actions::-webkit-scrollbar{display:none}
  body.dz2m #listingModal.dz2m-card .modal-bar .lc-actions .btn{flex:0 0 auto;min-height:44px}
  body.dz2m #listingModal.dz2m-card .lc-side{padding:12px 16px 8px;border-bottom:1px solid var(--line)}
  body.dz2m #listingModal.dz2m-card .lc-side .modal-title{font-size:28px;line-height:1.15;font-weight:600;letter-spacing:-.02em;overflow-wrap:anywhere}
  /* поля свёрнуты: видны имя, этап, наша шапка и ответственный */
  body.dz2m #listingModal.dz2m-card:not(.dz2m-more) .lc-side>:not(.lc-titlewrap):not(.lc-stwrap):not(#dz2mCardHead):not(#dzResp){display:none!important}
  body.dz2m #listingModal.dz2m-card .lc-side>#dzResp{margin:12px 0 0;width:fit-content;max-width:100%}
  body.dz2m .dz2m-chead{margin:12px 0 4px}
  body.dz2m .dz2m-cacts{display:flex;gap:8px}
  body.dz2m .dz2m-cacts .dz2m-btn{flex:1 1 0;min-width:0}
  body.dz2m .dz2m-ctel{margin-top:8px;text-align:center}
  body.dz2m .dz2m-more-btn{display:flex;align-items:center;gap:8px;width:100%;min-height:44px;margin-top:12px;padding:0 12px;border:1px dashed var(--line);border-radius:12px;
    background:none;color:var(--muted);font:600 14px inherit;cursor:pointer}
  body.dz2m .dz2m-more-btn span{flex:1;text-align:left}
  body.dz2m .dz2m-more-btn[aria-expanded="true"] .dz2m-ico:last-child{transform:rotate(180deg)}
  body.dz2m #listingModal.dz2m-card .dz2m-ctasks{padding:8px 16px 0}
  body.dz2m #listingModal.dz2m-card .dz2m-ctasks:empty{display:none}
  body.dz2m #listingModal.dz2m-card .lc-scroll{padding:12px 16px}
  /* ввод прилипает к низу окна */
  body.dz2m #listingModal.dz2m-card .lc-composer{position:sticky;bottom:0;z-index:4;padding:8px 12px calc(12px + env(safe-area-inset-bottom));
    background:color-mix(in oklab,var(--panel) 94%,transparent);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);border-top:1px solid var(--line)}
  body.dz2m #listingModal.dz2m-card .lc-composer .lc-tabs{display:flex;gap:4px;overflow-x:auto;scrollbar-width:none}
  body.dz2m #listingModal.dz2m-card .lc-composer .lc-tab{flex:none;min-height:36px}
  body.dz2m #listingModal.dz2m-card .lc-composer .lc-note-ta{min-height:44px;max-height:120px;border-radius:14px;font-size:16px}
  body.dz2m #listingModal.dz2m-card .lc-composer .lc-hint{display:none}
}

/* вне телефона нового вида — ничего своего не показываем */
body:not(.dz2m) #dz2mDay,body:not(.dz2m) #dz2mCta,body:not(.dz2m) #dz2mStages,body:not(.dz2m) #dz2mCardHead,body:not(.dz2m) #dz2mSheetHost{display:none!important}

@keyframes dz2mInL{from{opacity:.4;transform:translateX(24px)}to{opacity:1;transform:none}}
@keyframes dz2mInR{from{opacity:.4;transform:translateX(-24px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){
  body.dz2m #platformBoard .pf-col.mob-active{animation:none!important}
  #dz2mSheetHost .dz2m-sheet,#dz2mSheetHost .dz2m-scrim,body.dz2m .dz2m-sw .dz2m-li{transition:none!important}
}
