/* ===================================================================================================
   Mazaboard — мобильная версия (подключается только на экране до 760 px: <link media="(max-width: 760px)">).
   На компьютере этот файл не применяется вовсе. Здесь только отображение: логика и данные не меняются.
   =================================================================================================== */

:root { --top: 56px; }
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
/* поля ввода 16 px — иначе iPhone приближает страницу при касании */
.inp, input.inp, textarea.inp, select, .sel-s, .wd-q input, .cv-box textarea, .lg-inp input { font-size: 16px !important; }

/* ---------- каркас: меню убрано из колонки, открывается сверху по кнопке ---------- */
.shell, .shell.min { display: block; }
main { min-height: 100dvh; }
.content { border-top-left-radius: 0; min-height: calc(100dvh - var(--top)); }
.topbar::after { display: none; }
.topbar { height: var(--top); padding: 0 10px; gap: 6px; padding-top: env(safe-area-inset-top); }
.topbar .burger, .topbar .ic { width: 38px; height: 38px; flex-shrink: 0; }
.topbar .crumbs { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; display: block; font-size: 14px; }
.topbar .crumbs > * { overflow: hidden; text-overflow: ellipsis; }
.topbar .search { display: none !important; }
.topbar .wav { width: 34px !important; height: 34px !important; }
.topbar #back { display: none; }

.rail {
  position: fixed; top: var(--top); left: 0; right: 0; height: auto; max-height: calc(100dvh - var(--top) - 12px);
  border-radius: 0 0 18px 18px; box-shadow: 0 18px 40px rgba(0, 0, 0, .35); padding: 8px 12px 14px; z-index: 45; overflow-y: auto;
  transform: translateY(-10px); opacity: 0; visibility: hidden; pointer-events: none; transition: transform .2s ease, opacity .2s ease, visibility 0s .2s;
}
body.mnav-open .rail { transform: none; opacity: 1; visibility: visible; pointer-events: auto; transition: transform .22s cubic-bezier(.2,.8,.2,1), opacity .2s ease; }
.mnav-back { display: block; position: fixed; inset: var(--top) 0 0 0; z-index: 44; background: rgba(8, 11, 18, .45); backdrop-filter: blur(2px); opacity: 0; visibility: hidden; transition: opacity .2s, visibility 0s .2s; }
body.mnav-open .mnav-back { opacity: 1; visibility: visible; transition: opacity .2s; }
body.mnav-open { overflow: hidden; }
.rail .brand, .rail .foot { display: none; }
.mnav-me { display: flex; align-items: center; gap: 10px; padding: 8px 6px 10px; border-bottom: 1px solid var(--line); order: -1; }
.mnav-me .ava { width: 34px; height: 34px; }
.mnav-me span:last-child { display: flex; flex-direction: column; }
.mnav-me b { font-size: 14px; } .mnav-me small { font-size: 11.5px; color: var(--ink3); }
/* пункты меню — две колонки плиток, группы во всю ширину; подписи видны всегда (даже если на компьютере меню свёрнуто) */
.nav { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 6px; overflow: visible; flex: none; }
.nav .grp, .shell.min .nav .grp { display: block; grid-column: 1 / -1; padding: 12px 6px 4px; }
.nav a, .shell.min .nav a { justify-content: flex-start; padding: 11px 10px; border-radius: 12px; background: var(--bg2); font-size: 13.5px; min-height: 44px; white-space: normal; line-height: 1.2; }
.shell.min .nav a span, .shell.min .nav .badge { display: inline; }
.nav a.on { background: var(--accent-soft); }
.nav a .badge { padding: 3px 6px; }
.nav a.soon { opacity: .55; }

/* ---------- страница ---------- */
.page { padding: 14px 12px calc(40px + env(safe-area-inset-bottom)); }
.page.flush { padding: 0; }
.ph { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 14px; }
.ph h1 { font-size: 22px; line-height: 1.2; }
.ph .sub { font-size: 12.5px; }
.ph .acts { width: 100%; flex-wrap: wrap; justify-content: flex-start; }
.ph .acts > .btn, .ph .acts > a.btn { flex: 1 1 auto; justify-content: center; }
.ph .ov-acts { align-items: stretch; }
.ph .ov-acts > .row { flex-wrap: wrap; }
.ph .ov-acts .btn.p { flex: 1; justify-content: center; }
.fxs { flex-wrap: wrap; gap: 6px 10px; font-size: 12.5px; }
.card { border-radius: 14px; }
.card > .hd { flex-wrap: wrap; gap: 8px; padding: 12px 14px; }
.card .bd { padding: 14px; }
.grid, .grid.g2, .grid.g3, .grid.g4, .g-3-2, .g-1-2, .g-2-1 { grid-template-columns: 1fr !important; }
.btn { min-height: 38px; }
.btn.xs { min-height: 30px; }
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.utabs, .tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.utabs::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
.utabs button, .tabs button { flex-shrink: 0; }
.fbar { font-size: 12px; }

/* таблицы: прокрутка вбок внутри карточки, а не всей страницы */
.tscroll, .ut-wrap, .card:has(> .tbl) { overflow-x: auto !important; -webkit-overflow-scrolling: touch; max-height: none; }
.card > .tbl { min-width: 620px; }
.tbl th, .tbl td { padding: 9px 10px; }

/* ---------- окна: лист снизу во всю ширину ---------- */
.mback { padding: 0; align-items: end; place-items: end stretch; }
.modal, .modal.lg, .modal.docx { width: 100% !important; max-width: 100% !important; max-height: 92dvh; border-radius: 18px 18px 0 0; }
.modal .hd { padding: 14px 16px; position: sticky; top: 0; background: var(--panel); z-index: 2; }
.modal .bd { padding: 16px; }
.modal .ft { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); position: sticky; bottom: 0; background: var(--panel); flex-wrap: wrap; }
.modal .ft .btn { flex: 1; justify-content: center; }
.udel-g { grid-template-columns: 1fr; }

/* всплывающие панели (уведомления, кто в сети, меню профиля) — во всю ширину */
.wpop { left: 8px !important; right: 8px !important; width: auto !important; max-height: 75dvh; }
.npop, .tmpop { width: auto; }
.per-p { left: 8px !important; right: 8px; width: auto; }
#wtoasts { left: 10px; right: 10px; bottom: calc(12px + env(safe-area-inset-bottom)); }
.wtoast { width: auto; }
.toast { max-width: calc(100vw - 24px); bottom: calc(16px + env(safe-area-inset-bottom)); }
.wask { left: 10px; right: 10px; transform: none; flex-wrap: wrap; bottom: calc(10px + env(safe-area-inset-bottom)); }

/* разовое предупреждение: удобнее с компьютера */
.mobn { display: flex; position: fixed; z-index: 130; left: 10px; right: 10px; bottom: calc(12px + env(safe-area-inset-bottom)); gap: 12px; align-items: flex-start; flex-wrap: wrap; padding: 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line2); box-shadow: 0 16px 40px rgba(0, 0, 0, .35); animation: mobIn .3s cubic-bezier(.2,.8,.2,1) both; }
.mobn.out { opacity: 0; transform: translateY(10px); transition: .25s; }
.mobn-i { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent2); flex-shrink: 0; }
.mobn > div { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 3px; }
.mobn b { font-size: 14px; } .mobn span { font-size: 12.5px; color: var(--ink2); line-height: 1.45; }
.mobn .btn { width: 100%; justify-content: center; }
@keyframes mobIn { from { opacity: 0; transform: translateY(16px); } }

/* ---------- Обзор ---------- */
.kpis { grid-template-columns: 1fr 1fr !important; }
.kpi2 { padding: 12px 12px 50px !important; min-height: 0 !important; }
.kpi2 .v { font-size: 24px !important; }
.kpi2 .l { font-size: 9.5px; letter-spacing: .1em; }
.kpi2 .sub { font-size: 11.5px; }
.kpi2 .st { font-size: 11px; }
.kpi2 + .kpi2 { border-left: 0; }
.kpi2:nth-child(even) { border-left: 1px solid var(--line) !important; }
.kpi2:nth-child(n+3) { border-top: 1px solid var(--line); }
.kico { width: 22px; height: 22px; top: 10px; right: 10px; }
.spark { height: 38px; }
.h3d { grid-template-columns: 1fr !important; min-height: 0; }
.h3d-stage { min-height: 300px !important; height: 52vh; }
.h3d-panel { border-left: 0; border-top: 1px solid var(--line); max-height: none; }
.hm .hm-hd { padding: 12px 14px; }
.hm-legend { display: none; }
.hm .tscroll { overflow-x: auto !important; }
.tbl.hm-t { min-width: 820px; }
.tbl.hm-t td:first-child, .tbl.hm-t th:first-child { position: sticky; left: 0; z-index: 1; background: var(--panel); }
.hm-r.l0 td:first-child { background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }
.hm-x { grid-template-columns: 1fr !important; padding: 14px; gap: 18px; }

/* ---------- Аналитика ---------- */
.ctrls { padding: 10px 12px 0; }
.ctrls .row { gap: 6px; }
.ctrls .sel { width: calc(50% - 3px) !important; }
.sel.metric { margin-left: 0; width: 100% !important; }
svg.chart { height: 220px; }
.legend { gap: 6px 12px; font-size: 11.5px; }
.cv-sum { grid-template-columns: 1fr 1fr; gap: 12px; }
.cv-steps { grid-column: 1 / -1; }
.fl .fi { gap: 10px; }

/* ---------- Воронка ---------- */
.dtb, .dtb-top, .dtb-f { width: 100%; }
.dtb-top .dq { flex: 1 1 100%; order: -1; }
.dtb-top .dq .inp { width: 100%; }
.dtb-top .seg, .dtb-top #newdeal { flex: 1; justify-content: center; }
.dtb-f > .seg { width: 100%; }
.dtb-f .sel, .dtb-f .per-b { width: calc(50% - 4px) !important; }
.per-b { justify-content: flex-start; } .per-b b { overflow: hidden; text-overflow: ellipsis; }
.kanban { scroll-snap-type: x mandatory; gap: 10px; padding-bottom: 12px; -webkit-overflow-scrolling: touch; }
.col, .kanban .col { flex: 0 0 84vw !important; max-width: 84vw !important; min-width: 0 !important; scroll-snap-align: start; max-height: calc(100dvh - 240px); }
.xp2 { grid-template-columns: 1fr !important; padding: 12px 14px; width: calc(100vw - 26px) !important; }
.xp2 .xbar .xsrc { width: 100%; }
.stages .st { flex-shrink: 0; }
.dedit { grid-template-columns: 1fr; }

/* ---------- Клиенты ---------- */
.cpan { padding-left: 0; border-left: 0; }
.cp-kpis { grid-template-columns: 1fr 1fr !important; padding-left: 0; }
.cp-foot { flex-direction: column; align-items: flex-start; padding-left: 0; }
.tscroll .tbl.dt tr.xrow:not(.xrow2) > td > .xp { width: calc(100vw - 40px) !important; max-width: calc(100vw - 40px) !important; grid-template-columns: 1fr !important; }
.chk-l { grid-template-columns: 1fr; }

/* ---------- КП и документы ---------- */
.qwrap { grid-template-columns: 1fr; }

/* ---------- Данные и ETL ---------- */
.etl-strip { flex-wrap: wrap; }
.a3 { grid-template-columns: 1fr !important; }
.a3-scene { height: 62vh; min-height: 380px; }
.a3-panel { height: auto; min-height: 0; }
.a3-legend button { font-size: 11px; padding: 4px 8px; }
.a3-hint { display: none; }

/* ---------- Администрирование ---------- */
.tbl.ut { min-width: 860px; }
.acc { grid-template-columns: 1fr !important; }
.acc-l { position: static; }
.acc-ul { max-height: 240px; }
.acc-h { flex-direction: column; align-items: flex-start; }

/* ---------- Чат: список или разговор, по очереди ---------- */
.cp { grid-template-columns: 1fr !important; height: calc(100dvh - var(--top)); }
.cp .cp-side { display: flex !important; border-right: 0; border-radius: 0; }
.cp.has-chat .cp-side { display: none !important; }
.cp:not(.has-chat) .cp-main { display: none; }
.cp-back { display: inline-grid; place-items: center; margin-right: 2px; }
.cp-head { gap: 8px; padding: 8px 10px; }
.cp-head .btn.sm:not(#cp-mute) { display: none; }
.cp-info { display: none !important; }
.wdock { inset: var(--top) 0 0 0 !important; width: auto !important; border-radius: 0 !important; }

/* ---------- Журнал, хранилище, личный кабинет ---------- */
.jr-book { padding: 14px 12px 30px; }
.jr-top { flex-wrap: wrap; gap: 10px; }
.jr-ttl { border-left: 0; padding-left: 0; }
.jr-sheet.open { inset: var(--top) 0 0 0 !important; width: 100% !important; }
.fs-row { grid-template-columns: 34px minmax(0, 1fr) 70px; }

/* ---------- инструменты во фрейме ---------- */
iframe.frame { min-height: calc(100dvh - var(--top)); }

/* ---------- личный кабинет ---------- */
.pf-hero { border-radius: 16px; }
.pf-cover { height: 84px; }
.pf-hb { padding: 0 14px 16px; gap: 12px; margin-top: -44px; }
.pf-ava .wav { width: 84px !important; height: 84px !important; font-size: 28px !important; }
.pf-who { min-width: 0; flex: 1 1 100%; }
.pf-who h1 { font-size: 21px; }
.pf-hb > .btn, .pf-hb .pf-status { width: 100%; justify-content: center; }
.pf-tabs button { flex-shrink: 0; padding: 0 12px; }
.pf-form { padding: 4px 14px 18px; border-radius: 14px; }
.pf-save { flex-wrap: wrap; gap: 8px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 10px 12px; }
.pf-save > span:first-child { flex: 1 1 100%; }
.pf-save .btn { flex: 1 1 0; justify-content: center; min-width: 0; }
.h3d-panel .note { display: none; }
