/* «Оборот» на телефоне (sp11). Всё — под одним брейкпоинтом 700px: шире этого вёрстка не меняется.
   Принципы: одна колонка с полями 16px; навигация — верхняя полоса кабинета и нижняя панель вкладок;
   таблицы — списками и карточками; боковые панели — шторками снизу во всю высоту; цели касания от 44px;
   поля ввода 16px (iOS не увеличивает страницу); цифры моноширинные по ширине (tabular-nums). */

/* Элементы, которых на десктопе нет вовсе */
.mbar, .mtabs, .m-sheet, .m-scrim, .m-cols, .m-colnote, .pop-m-head, .m-only, .m-sort, .board-tabs, .pu-fbtn { display: none !important; }

@media (max-width: 700px) {

  :root { --m-gutter: 16px; --m-tabs: 64px; --m-radius: 16px; }
  html { -webkit-text-size-adjust: 100%; }
  body { font-size: 14px; }
  html.has-sheet, html.has-sheet body { overflow: hidden; }
  input, select, textarea { font-size: 16px !important; }
  table select, .setting select, .ops-pane select, .expense-row select, .pu-bulk select {
    min-height: 44px; padding: 9px 34px 9px 12px; border-radius: 11px; border: 1px solid var(--line); color: var(--text); font-family: var(--ui);
    appearance: none; -webkit-appearance: none; max-width: 100%;
    background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237d8494' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }
  .field select { appearance: none; -webkit-appearance: none; padding-right: 34px;
    background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237d8494' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }
  h1 { font-size: 24px; line-height: 1.15; letter-spacing: -.025em; }
  h2 { font-size: 16px; }
  .muted.small, .small { font-size: 12.5px; }

  /* ── Каркас: вместо левой колонки — верхняя полоса и нижняя панель ───────────────────────────── */
  .app { display: block; min-height: 100dvh; }
  .rail, .topbar { display: none; }
  .main { min-height: 100dvh; }
  .page { z-index: auto; padding: 14px max(var(--m-gutter), env(safe-area-inset-right)) calc(36px + env(safe-area-inset-bottom))
    max(var(--m-gutter), env(safe-area-inset-left)); gap: 16px; max-width: none; }
  .app.has-tabs .page { padding-bottom: calc(var(--m-tabs) + 76px + 8px + env(safe-area-inset-bottom)); }
  .aurora { height: 260px; }
  .aurora::before, .aurora::after { width: 360px; height: 360px; filter: blur(70px); }
  .aurora::before { top: -250px; left: -80px; }
  .aurora::after { top: -270px; right: -100px; }

  .mbar {
    display: flex !important; position: sticky; top: 0; z-index: 30; align-items: center; gap: 4px;
    min-height: calc(54px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(10px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
    background: color-mix(in oklab, var(--bg) 84%, transparent); backdrop-filter: blur(18px) saturate(1.3);
    -webkit-backdrop-filter: blur(18px) saturate(1.3); border-bottom: 1px solid var(--line);
  }
  .mbar-brand { display: grid; place-items: center; width: 44px; height: 44px; margin-right: -4px; flex: none; text-decoration: none; }
  .mbar-brand .brand-mark { width: 24px; height: 24px; border-radius: 7px; }
  .mbar-brand .brand-mark::after { inset: 6px; border-radius: 3px; background: var(--bg); }
  .mbar-cab {
    display: inline-flex; align-items: center; gap: 4px; min-width: 0; min-height: 44px; padding: 0 10px 0 8px;
    border: 0; border-radius: 12px; background: transparent; color: var(--text); font: 600 16px/1.2 var(--ui);
    letter-spacing: -.01em; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .mbar-cab:active { background: var(--surface-2); }
  .mbar-cab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mbar-cab .ico { width: 18px; height: 18px; flex: none; color: var(--text-3); margin-top: 1px; }

  .mtabs {
    display: flex !important; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; gap: 2px;
    padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    background: color-mix(in oklab, var(--rail) 86%, transparent); backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4); border-top: 1px solid var(--line);
  }
  .mtab {
    flex: 1 1 0; min-width: 0; min-height: 52px; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 3px; border-radius: 14px; color: var(--text-3); text-decoration: none;
    font: 500 11px/1.15 var(--ui); letter-spacing: .01em; -webkit-tap-highlight-color: transparent;
  }
  .mtab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mtab .ico { width: 52px; height: 28px; padding: 3px 15px; border-radius: 999px; transition: background .18s ease; }
  .mtab.is-current { color: var(--text); font-weight: 600; }
  .mtab.is-current .ico { background: var(--surface-3); stroke-width: 2; }
  .mtab:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

  /* ── Шторки снизу: свои (.m-sheet), панели раскладки (.drawer), сетка периодов (.pop) ───────── */
  .m-scrim { display: block !important; position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.5);
    animation: m-fade .2s ease; touch-action: none; -webkit-tap-highlight-color: transparent; }
  @media (prefers-color-scheme: light) { .m-scrim { background: rgba(10,14,24,.36); } }
  .m-sheet:not([hidden]) {
    display: flex !important; flex-direction: column; position: fixed; left: 0; right: 0; bottom: 0; z-index: 62;
    max-height: calc(100dvh - env(safe-area-inset-top) - 24px); background: var(--surface);
    border-top: 1px solid var(--line-2); border-radius: 22px 22px 0 0; box-shadow: 0 -20px 60px rgba(0,0,0,.35);
    animation: m-sheet-in .3s cubic-bezier(.2,.8,.2,1);
  }
  .m-sheet-head, .pop-m-head { position: relative; display: flex !important; align-items: center; justify-content: space-between;
    gap: 12px; padding: 24px 16px 12px; touch-action: none; flex: none; }
  .m-sheet-head h2, .pop-m-head h2 { font-size: 18px; letter-spacing: -.01em; }
  .m-sheet-head::before, .pop-m-head::before, .drawer-head::before {
    content: ""; position: absolute; top: 8px; left: 50%; width: 38px; height: 5px; margin-left: -19px;
    border-radius: 3px; background: var(--line-2);
  }
  .m-sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 2px 16px calc(20px + env(safe-area-inset-bottom)); }
  .m-close, .drawer [data-sheet-close] {
    position: relative; flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; margin: -6px -6px -6px 0;
    border-radius: 50%; border: 0; background: transparent; color: var(--text-2);
    font-size: 0; line-height: 0; cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent;
  }
  .m-close::after, .drawer [data-sheet-close]::after { content: ""; position: absolute; inset: 3px; border-radius: 50%;
    border: 1px solid var(--line); background: var(--surface-2); }
  /* Крестик — картинкой (SVG), не текстовым глифом: тот не центрируется ровно и «плавает» в круге
     при разных шрифтах/зуме. Фокус панель получает сама (см. mobile.js/purchasing.js/unit_econ.js —
     .focus() на шторке, не на этой кнопке), так что кольцо фокуса здесь — только с клавиатуры. */
  .m-close::before, .drawer [data-sheet-close]::before {
    content: 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='%237d8494' stroke-width='2.3' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E");
    display: block; width: 16px; height: 16px; position: relative; z-index: 1;
  }
  .m-close:active::after, .drawer [data-sheet-close]:active::after { background: var(--surface-3); }
  .m-close:focus-visible, .drawer [data-sheet-close]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

  .drawer {
    top: auto; left: 0; right: 0; bottom: 0; width: auto !important; height: calc(100dvh - env(safe-area-inset-top) - 18px);
    border-left: 0; border-top: 1px solid var(--line-2); border-radius: 22px 22px 0 0; z-index: 62;
    box-shadow: 0 -20px 60px rgba(0,0,0,.35); animation: m-sheet-in .3s cubic-bezier(.2,.8,.2,1);
  }
  .drawer-head { position: relative; padding: 26px 16px 14px; align-items: flex-start; gap: 12px; touch-action: none; }
  .drawer-head h2 { font-size: 18px; line-height: 1.25; overflow-wrap: anywhere; }
  .drawer-actions { gap: 8px; align-items: center; }
  .drawer-body { padding: 16px 16px calc(28px + env(safe-area-inset-bottom)); gap: 14px; -webkit-overflow-scrolling: touch; }
  .drawer-body > * + * { margin-top: 0; }
  .drawer-body > :empty { display: none; }
  .drawer-body h3 { margin: 8px 0 0; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
  .drawer-section h3 { font-size: 12px; color: var(--text-3); letter-spacing: .06em; margin-bottom: 10px; }
  .drawer-body .tbl-wrap { overflow: visible; }
  @keyframes m-sheet-in { from { transform: translateY(100%); } }
  @keyframes m-fade { from { opacity: 0; } }

  /* ── Общие элементы ─────────────────────────────────────────────────────────────────────────── */
  .page-head { gap: 12px; align-items: flex-start; }
  .page-head > div { min-width: 0; }
  .page-head p { margin-top: 6px; font-size: 13px; }
  .card { border-radius: var(--m-radius); padding: 16px; }
  .btn { min-height: 44px; padding: 10px 16px; font-size: 14px; border-radius: 12px; }
  .btn-small { min-height: 44px; padding: 8px 14px; font-size: 13px; border-radius: 11px; }
  .field { font-size: 13px; }
  .field input, .field select { min-height: 46px; padding: 10px 12px; border-radius: 11px; width: 100%; }
  .check { min-height: 44px; align-items: center; }
  .check input { width: 20px; height: 20px; flex: none; }
  .flash { font-size: 13.5px; }
  .note { font-size: 13px; line-height: 1.5; }
  .notice { padding: 14px; }
  .search { min-height: 44px; border-radius: 12px; padding: 10px 12px; }
  .pill { font-size: 11.5px; }
  .kpi-value { font-variant-numeric: tabular-nums; }
  .seg { max-width: 100%; }
  .seg-item { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; }
  .subnav { width: 100%; padding: 3px; border-radius: 12px; }
  .subnav-item { flex: 1; text-align: center; min-height: 44px; display: grid; place-items: center; font-size: 14px; border-radius: 9px; }

  /* Ленты, которые листаются вбок намеренно: на всю ширину экрана, без полосы прокрутки */
  .m-swipe, [data-m-scroll] { display: flex; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    margin-left: calc(-1 * var(--m-gutter)); margin-right: calc(-1 * var(--m-gutter));
    padding-left: var(--m-gutter); padding-right: var(--m-gutter); scroll-padding: 0 var(--m-gutter); }
  .m-swipe::-webkit-scrollbar, [data-m-scroll]::-webkit-scrollbar { display: none; }

  /* ── Таблицы-карточки: строка — блок «заголовок + подпись/значение» ───────────────────────────
     m-kv   — подпись слева, значение справа (настройки, задачи, журнал);
     m-grid — заголовок и сетка 2×N мини-показателей (подпись над значением). */
  table.m-kv, table.m-grid { display: block; }
  table.m-kv thead, table.m-grid thead { display: none; }
  table.m-kv tbody, table.m-grid tbody { display: flex; flex-direction: column; }
  table.m-kv tr, table.m-grid tr { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.m-kv tr:last-child, table.m-grid tr:last-child { border-bottom: 0; }
  table.m-kv td, table.m-grid td { display: block; border: 0; padding: 0; }
  table.m-kv td:first-child, table.m-grid td:first-child { font-weight: 600; font-size: 14.5px; margin-bottom: 6px; }
  table.m-kv td:empty, table.m-grid td:empty { display: none !important; }
  table.m-kv td + td { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 30px;
    text-align: right; font-size: 13.5px; }
  table.m-kv td + td::before { content: attr(data-label); color: var(--text-3); font: 400 12.5px var(--ui); text-align: left; flex: none; max-width: 52%; }
  table.m-kv td[colspan] { display: block; text-align: left; font-weight: 400; font-size: 13.5px; color: var(--text-2); }
  table.m-kv td:first-child .muted, table.m-grid td:first-child .muted { font-weight: 400; }
  table.m-kv td + td.small, table.m-kv td + td:has(select) { display: block; text-align: left; padding: 4px 0; }
  table.m-kv td + td.small::before, table.m-kv td + td:has(select)::before { display: block; max-width: none; margin-bottom: 4px; }
  table.m-kv td + td:has(select) select { max-width: none; width: 100%; }
  table.m-kv details { margin-top: 6px; }
  table.m-kv details summary { color: var(--text-2); min-height: 44px; display: flex; align-items: center; }
  table.m-kv td[colspan]::before { content: none; }
  table.m-grid tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
  table.m-grid td:first-child { grid-column: 1 / -1; margin: 0; }
  table.m-grid td + td { min-width: 0; text-align: left; font-variant-numeric: tabular-nums; }
  table.m-grid td + td::before { content: attr(data-label); display: block; font: 400 11.5px var(--ui); color: var(--text-3); margin-bottom: 1px; }
  table.m-grid td.num { text-align: left; }
  table.m-grid td:has(select) { grid-column: 1 / -1; }
  table.m-grid input, table.m-grid select { width: 100%; max-width: none; }
  /* ── Шторка «Кабинеты»: выбор кабинета, ссылки, выход ───────────────────────────────────────── */
  .cab-list { display: flex; flex-direction: column; gap: 2px; }
  .cab-row { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 10px; border-radius: 14px;
    color: var(--text); text-decoration: none; font: 500 15px var(--ui); -webkit-tap-highlight-color: transparent; }
  .cab-row:active { background: var(--surface-2); }
  .cab-row.is-current { background: var(--surface-2); font-weight: 600; }
  .cab-row .avatar { width: 36px; height: 36px; border-radius: 11px; font-size: 12px; }
  .cab-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cab-row .ico { width: 20px; height: 20px; flex: none; color: var(--text); }
  .cab-links { display: flex; flex-direction: column; margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
  .cab-link { display: flex; align-items: center; min-height: 48px; padding: 0 10px; border-radius: 12px; color: var(--text-2);
    text-decoration: none; font: 500 15px var(--ui); }
  .cab-link:active { background: var(--surface-2); }
  .m-logout { width: 100%; margin-top: 14px; min-height: 48px; color: var(--crit); background: var(--surface-2); border-color: transparent; }
  .m-sheet-foot { display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
    background: var(--surface); flex: none; }
  .m-sheet-foot .btn { flex: 1; min-height: 48px; }
  .m-sheet-foot .btn-primary { flex: 2; }
  .m-hide { display: none !important; }

}

@media (max-width: 700px) {
  /* ── P&L ───────────────────────────────────────────────────────────────────────────────────── */
  .head-actions { width: 100%; }
  .head-actions .subnav { flex: 1; }
  .gear-btn { width: 44px; height: 44px; flex: none; }
  .head-warn { font-size: 12.5px; line-height: 1.45; }

  .period-picker { flex-wrap: nowrap; gap: 0; }
  .period-step { width: 100%; gap: 8px; }
  .step-btn { width: 44px; height: 44px; border-radius: 12px; font-size: 20px; flex: none; }
  .period-pop { flex: 1; min-width: 0; position: static; }
  .period-current { min-width: 0; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 12px; border-radius: 12px; font-size: 15px; }
  .period-current::after { content: ""; width: 7px; height: 7px; border-right: 1.8px solid var(--text-3); border-bottom: 1.8px solid var(--text-3);
    transform: translateY(-2px) rotate(45deg); margin-left: 4px; }
  .pop {
    position: fixed; left: 0 !important; right: 0 !important; top: auto; bottom: 0; z-index: 62; min-width: 0;
    max-height: calc(100dvh - env(safe-area-inset-top) - 24px); padding: 0 16px calc(20px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0; border: 0; border-top: 1px solid var(--line-2); box-shadow: 0 -20px 60px rgba(0,0,0,.35);
    gap: 16px; overscroll-behavior: contain; animation: m-sheet-in .3s cubic-bezier(.2,.8,.2,1);
  }
  .pop-m-head { margin: 0 -16px -4px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
  .pop-kinds { display: flex; width: 100%; }
  .pop-kinds .seg-item { flex: 1; text-align: center; padding: 0 6px; font-size: 13.5px; }
  .pop-y { font-size: 12.5px; margin-bottom: 8px; }
  .pop-grid { gap: 6px; }
  .pop-item { min-height: 46px; display: grid; place-items: center; border-radius: 12px; font-size: 15px; background: var(--surface-2); }
  .pop-item.is-off { background: transparent; }

  /* плитки: акцент («Чистая прибыль», «Прибыль за 90 дней», «Заказать сейчас») — первой и на всю ширину */
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpis .kpi-hero { order: -1; grid-column: 1 / -1; }
  .kpi { padding: 13px 14px; border-radius: 14px; gap: 4px; min-width: 0; }
  .kpi-label { font-size: 10.5px; letter-spacing: .05em; line-height: 1.3; }
  .kpi-value { font-size: 19px; line-height: 1.15; letter-spacing: -.02em; white-space: nowrap; }
  .kpi-hero .kpi-value { font-size: 30px; }
  .kpi-sub { font-size: 11.5px; line-height: 1.35; }

  /* чипы колонок липнут под верхней полосой: при прокрутке цепочки видно, чья это колонка */
  .m-cols { display: flex !important; gap: 6px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
    position: sticky; top: calc(55px + env(safe-area-inset-top)); z-index: 20; margin: -8px calc(-1 * var(--m-gutter));
    padding: 8px var(--m-gutter); background: color-mix(in oklab, var(--bg) 94%, transparent);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
  .m-cols::-webkit-scrollbar { display: none; }
  .m-col { flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 15px;
    border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2);
    font: 600 13.5px var(--ui); cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent; }
  .m-col .ch-dot { margin: 0; width: 7px; height: 7px; }
  .m-col.is-on { background: var(--primary); color: var(--on-primary); border-color: transparent; }
  .m-colnote { display: block !important; margin: 0 0 10px; font-size: 12.5px; color: var(--text-2); }
  .m-colnote.m-off { display: none !important; }

  /* цепочка — список одной колонки: 8 шагов коротко («9,45 млн ₽»); шаг с подстроками раскрывается на месте */
  .chain-card { padding: 6px 0; }
  .chain-card > .m-colnote, .chain-card > .chain-note { padding: 8px 16px 0; margin: 0; }
  .chain-card .tbl-wrap { overflow: visible; }
  table.chain, table.chain tbody { display: block; }
  table.chain thead { display: none; }
  table.chain .v-k { display: none; } table.chain .v-s { display: inline; }
  table.chain tr { position: relative; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 16px;
    border-bottom: 1px solid var(--line); }
  table.chain tbody:last-child tr:last-child { border-bottom: 0; }
  table.chain tr.m-off, table.chain td.m-off { display: none !important; }
  table.chain th, table.chain td { padding: 0; border: 0 !important; font-size: 14px; background: transparent !important; position: static !important; }
  table.chain th[scope=row] { flex: 1; min-width: 0; white-space: normal; font-size: 14px; line-height: 1.3; padding: 12px 0; }
  table.chain td { flex: none; text-align: right; }
  table.chain .cell { padding: 0; margin: 0; font-weight: 500; font-size: 14.5px; letter-spacing: -.005em; }
  table.chain .cell::after { content: ""; position: absolute; inset: 0; }
  table.chain .cell:hover, table.chain .cell:focus-visible { background: transparent; }
  table.chain tr:has(.cell:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: 10px; }
  table.chain tr[data-row]:has(.cell)::after { content: ""; flex: none; width: 6px; height: 6px; margin-left: -2px; border-right: 1.6px solid var(--text-3);
    border-top: 1.6px solid var(--text-3); transform: rotate(45deg); opacity: .8; }
  table.chain tr:active { background: var(--surface-2); }
  /* th — элемент флекс-строки: z-index:1 от липкой колонки десктопа сделал бы его отдельным слоем, и кнопка шага
     (z-index:2) оказалась бы под слоем нажатия числа (.cell::after на всю строку) — шаг открывал раскладку (ревью 13.10) */
  table.chain th[scope=row] { z-index: auto; }
  table.chain th[scope=row] .step-toggle { position: relative; z-index: 2; padding: 6px 0; margin: -6px 0; }
  table.chain .step-toggle::before { margin-left: 0; }
  table.chain .row-step th, table.chain .row-step .cell { font-weight: 600; }
  table.chain .row-result { background: var(--surface-2); border-bottom-color: transparent; margin: 4px 8px; padding: 0 8px; border-radius: 10px; }
  table.chain .row-sub { min-height: 44px; }
  table.chain .row-sub th[scope=row] { padding: 10px 0 10px 18px; font-size: 13.5px; color: var(--text-2); }
  table.chain .row-sub .cell { font-size: 13.5px; color: var(--text-2); font-weight: 400; }
  table.chain .row-more { min-height: 40px; padding-left: 34px; }
  table.chain .row-more td { padding: 0 !important; text-align: left; }
  table.chain .row-fold th[scope=row] { color: var(--text-2); font-weight: 500; }

  /* шестерёнка «Состояние и настройки» */
  .ops-tabs-wrap { padding: 12px 16px 2px; }
  .ops-tabs .seg-item { min-height: 44px; font-size: 13.5px; padding: 0 6px; }
  .rate-grid { grid-template-columns: 1fr 1fr; }
  .rate-grid .field-wide { grid-column: 1 / -1; }                  /* база ЗП — на всю ширину, текст не обрезается */
  .rate-row .lrow-sub { white-space: normal; }
  .input-num { width: 100%; max-width: none; min-height: 44px; font-size: 16px; }
  .conn-settings { max-width: none; }
  .conn-settings > .btn, .recompute .btn { width: 100%; }
  .kv { grid-template-columns: minmax(96px, auto) minmax(0, 1fr); }

  /* панель раскладки на телефоне — шторка; строки состава — по 48px */
  .drawer-value { font-size: 24px; margin-top: 6px; }
  .drawer .lrow { min-height: 48px; }
  .fold-act.btn-small { min-height: 34px; padding: 4px 12px; }

  /* «Расходы» P&L: список статей — строками, правка — в шторке */
  .exp-total { font-size: 22px; }
  .period-current.period-static::after { content: none; }      /* «Сентябрь 2026» в «Расходах» — не выпадашка */
  .exp-actions .exp-add { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: center;
    border: 1px dashed var(--line-2); border-radius: 12px; font-size: 14.5px; }
  .expense-form .row2 { grid-template-columns: 1fr; }
  .expense-form .form-foot .btn { flex: 1; }
  .card > form > .btn { width: 100%; white-space: normal; text-align: center; }

}

@media (max-width: 700px) {
  /* ── Юнит-экономика: каналы чипами, позиции карточками (3 числа), сортировка списком ─────────── */
  .ch-seg { gap: 6px; padding-top: 0; padding-bottom: 0; background: transparent; border: 0; border-radius: 0; width: auto; max-width: none; }
  .ch-seg .seg-item { flex: none; gap: 7px; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2);
    font-size: 13.5px; font-weight: 600; background: transparent; }
  .ch-seg .seg-item.is-current { background: var(--primary); color: var(--on-primary); border-color: transparent; }
  .ch-seg .seg-count { display: none; }   /* телефон: число позиций канала — в заголовке списка, не в чипе */
  .ch-seg .ch-dot { margin: 0; width: 7px; height: 7px; }
  .gradebar { margin: 6px 0 4px; height: 8px; pointer-events: none; }
  .ue-grades .kpi-sub { white-space: normal; }
  /* «Отдача» и «Оценки» — во всю ширину: подпись оценок в одну строку кнопками по 44 px */
  .ue-kpis .kpi { grid-column: 1 / -1; }
  .gb-legend { margin: 0 -8px -6px; gap: 0; flex-wrap: nowrap; }
  .gb-key { flex: 1 1 auto; justify-content: center; min-height: 44px; padding: 0 6px; font-size: 13px; }

  .ue-list { padding: 0; background: transparent; border: 0; }
  .ue-list .tbl-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-bottom: 12px; }
  .ue-list .tbl-head h2 { grid-column: 1 / -1; font-size: 17px; }
  .ue-list .ue-grade-seg { grid-column: 1 / -1; width: 100%; }
  .ue-list .ue-grade-seg .seg-item { flex: 1; justify-content: center; min-height: 44px; padding: 0 6px; }
  .ue-count { display: inline !important; font-weight: 500; font-size: 14px; margin-left: 4px; }
  .ue-list .search[type=search] { grid-column: 1 / -1; }
  .m-sort { display: block !important; appearance: none; -webkit-appearance: none; min-width: 0; color: var(--text);
    background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237d8494' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
    padding-right: 34px; }
  .ue-list .tbl-head .btn { min-height: 44px; }
  .ue-list .tbl-wrap { overflow: visible; }
  table.ue-table { display: block; }
  table.ue-table thead { display: none; }
  table.ue-table tbody { display: flex; flex-direction: column; gap: 10px; }
  table.ue-table tbody tr[data-article] { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 14px; padding: 14px 16px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--m-radius); -webkit-tap-highlight-color: transparent; }
  table.ue-table tbody tr[data-article]:active { background: var(--surface-2); }
  table.ue-table td { display: block; padding: 0; border: 0; text-align: left; min-width: 0; max-width: none; font-variant-numeric: tabular-nums; }
  table.ue-table td.ue-art { order: 1; flex: 1 1 0; font-size: 14px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
  table.ue-table .ue-code { font-size: 13.5px; }
  .ue-name { display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; margin-top: 3px;
    font: 400 12.5px/1.4 var(--ui); color: var(--text-2); }
  table.ue-table td.ue-roi { order: 2; flex: none; text-align: right; font-size: 13px; }
  table.ue-table td.ue-roi .pill { font-size: 13px; padding: 3px 10px; }
  table.ue-table td.ue-unit, .ue-exp, .ue-more-row { display: none !important; }
  .ue-name { margin-left: 0; }
  table.ue-table td.ue-key { order: 3; flex: 1 1 100%; display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 2px 10px;
    padding-top: 10px; border-top: 1px solid var(--line); font-size: 17px; font-weight: 600; text-align: right; }
  table.ue-table td.ue-key::before { content: attr(data-label); font-size: 13px; font-weight: 400; color: var(--text-2); text-align: left; }
  .ue-sub { display: block; grid-column: 1 / -1; font-size: 12.5px; font-weight: 400; color: var(--text-3); }
  table.ue-table tbody tr:not([data-article]) td { padding: 16px 0; }
  .ue-more { width: 100%; }
  .ue-top3 { grid-template-columns: 1fr 1fr; }
  .ue-top3 .ue-stat:last-child { grid-column: 1 / -1; }
  .coeff-apply { flex-wrap: wrap; }

  /* раскладки в шторках юнитки и закупок: «название … число», ниже — мелко */
  #ue-drawer-body table.drill, .drill-parts table, .pu-sumrows { display: block; }
  #ue-drawer-body table.drill thead, .pu-sumrows thead { display: none; }
  #ue-drawer-body table.drill tbody, .drill-parts table tbody, .pu-sumrows tbody { display: flex; flex-direction: column; }
  #ue-drawer-body table.drill tr, .drill-parts table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px;
    padding: 10px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
  #ue-drawer-body table.drill tr:last-child, .drill-parts table tr:last-child { border-bottom: 0; }
  #ue-drawer-body table.drill td, .drill-parts table td { display: block; padding: 0; border: 0; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
  #ue-drawer-body table.drill td:nth-child(1), .drill-parts table td:nth-child(1) { font-weight: 500; }
  #ue-drawer-body table.drill td:nth-child(2), .drill-parts table td:nth-child(2) { text-align: right; font-weight: 600; white-space: nowrap; }
  #ue-drawer-body table.drill td:nth-child(n+3), .drill-parts table td:nth-child(n+3) { grid-column: 1 / -1; color: var(--text-2); font-size: 12.5px; }
  #ue-drawer-body table.drill td:nth-child(n+3):empty { display: none; }
  #ue-drawer-body table.drill td:nth-child(n+3)[data-label]::before { content: attr(data-label) ": "; color: var(--text-3); }
  #ue-drawer-body table.drill tr.sum-row td { border-top: 0; }
  #ue-drawer-body table.drill tr.sum-row { background: var(--surface-2); margin: 2px -10px; padding: 10px; border-radius: 10px; border-bottom: 0; }
  #ue-drawer-body table.drill-prim tr { display: flex; flex-wrap: wrap; gap: 3px 8px; }
  #ue-drawer-body table.drill-prim tr::before { content: ""; order: 3; flex-basis: 100%; height: 0; }
  #ue-drawer-body table.drill-prim td:nth-child(3) { order: 1; flex: 1 0 60%; grid-column: auto; color: var(--text); font-size: 12.5px; }
  #ue-drawer-body table.drill-prim td:nth-child(3)::before { content: none; }
  #ue-drawer-body table.drill-prim td:nth-child(4) { order: 2; margin-left: auto; grid-column: auto; color: var(--text); font-size: 13px; }
  #ue-drawer-body table.drill-prim td:nth-child(4)::before { content: none; }
  #ue-drawer-body table.drill-prim td:nth-child(1) { order: 4; font-weight: 400; color: var(--text-3); }
  #ue-drawer-body table.drill-prim td:nth-child(2) { order: 5; text-align: left; font-weight: 400; white-space: normal; color: var(--text-3); }
  #ue-drawer-body table.drill-prim td:nth-child(2)::before { content: "· "; }
  #ue-drawer-body pre.detail { font-size: 11px; }
  #ue-drawer-body .notice ul { padding-left: 18px; }

}

@media (max-width: 700px) {
  /* ── Закупки ─────────────────────────────────────────────────────────────────────────────── */
  .page-head .pu-export { display: none; }
  .pu-export-m { display: flex !important; }
  .pu-export-m .btn { width: 100%; min-height: 48px; }

  .pu-kpis { display: flex; flex-direction: column; gap: 0; }
  .pu-kpis .kpi { border-radius: 0; border-top-width: 0; flex-direction: row; align-items: center; gap: 10px; min-height: 52px; padding: 10px 14px;
    -webkit-tap-highlight-color: transparent; }
  .pu-kpis .kpi:active { background: var(--surface-2); }
  .pu-kpis .kpi-hero { flex-direction: column; align-items: flex-start; gap: 4px; border-radius: var(--m-radius); border-top-width: 1px;
    margin-bottom: 10px; padding: 16px; }
  .pu-kpis .kpi-hero .kpi-value { font-size: 30px; }
  .pu-kpis .kpi-hero .kpi-sub { font-size: 12.5px; }
  .pu-kpis .kpi:nth-child(2) { border-top-width: 1px; border-radius: var(--m-radius) var(--m-radius) 0 0; }
  .pu-kpis .kpi:last-child { border-radius: 0 0 var(--m-radius) var(--m-radius); }
  .pu-kpis .kpi:not(.kpi-hero) .kpi-label { flex: none; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); font-weight: 600; }
  .pu-kpis .kpi:not(.kpi-hero) .kpi-sub { order: 2; flex: 1; min-width: 0; text-align: right; font-size: 12.5px; color: var(--text-2);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pu-kpis .kpi:not(.kpi-hero) .kpi-value { order: 3; flex: none; min-width: 26px; text-align: right; font-size: 17px; }
  .pu-kpis .kpi:not(.kpi-hero)::after { content: ""; order: 4; flex: none; width: 6px; height: 6px; border-right: 1.6px solid var(--text-3);
    border-top: 1.6px solid var(--text-3); transform: rotate(45deg); margin-left: 2px; }
  .pu-quiet { margin: -4px 0 0; gap: 8px 18px; }
  .pu-quiet .btn-link { min-height: 44px; display: inline-flex; align-items: center; }

  /* «Заказать в первую очередь» — карточки по 64px: артикул и название · шт и ₽ справа; полоска — под ними */
  .pu-top { padding: 4px 14px 6px; }
  .pu-top h2 { padding-top: 10px; }
  button.lrow.pu-top-row { grid-template-columns: minmax(0, 1fr) auto 12px; grid-template-areas: "main val chev" "cover qty chev"; min-height: 64px; gap: 4px 12px; }
  button.lrow.pu-top-row::after { grid-area: chev; }
  .pu-top-row .lrow-main { grid-area: main; }
  .pu-top-row .lrow-val { grid-area: val; }
  .pu-top-row .cover { grid-area: cover; width: auto; max-width: 160px; }
  .pu-top-row .pu-top-qty { grid-area: qty; font-size: 12.5px; }

  .board { display: block; overflow: visible; }
  .board-tabs { display: flex !important; gap: 6px; position: sticky; top: calc(55px + env(safe-area-inset-top)); z-index: 20;
    margin-bottom: 4px; padding-top: 8px; padding-bottom: 8px; background: color-mix(in oklab, var(--bg) 94%, transparent);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
  .board-tab { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 15px; border-radius: 999px;
    border: 1px solid var(--line-2); background: transparent; color: var(--text-2); font: 600 13.5px var(--ui); white-space: nowrap; cursor: pointer;
    -webkit-tap-highlight-color: transparent; }
  .board-tab-n { font: 500 12px var(--mono); color: var(--text-3); }
  .board-tab.is-on { background: var(--primary); color: var(--on-primary); border-color: transparent; }
  .board-tab.is-on .board-tab-n { color: inherit; opacity: .6; }
  .board .col { display: none; background: transparent; border: 0; padding: 0; gap: 10px; }
  .board .col.is-m-current { display: flex; }
  .board .col-head { display: none; }
  .pcard { padding: 14px 16px; gap: 8px; border-radius: var(--m-radius); -webkit-tap-highlight-color: transparent; }
  .pcard:active { background: var(--surface-2); }
  .pcard-art { font-size: 14px; white-space: normal; overflow-wrap: anywhere; }
  .pcard-name { font-size: 13px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .pcard-order { font-size: 14px; }
  .pcard-order b { font-size: 15px; }
  .col-more { min-height: 44px; font-size: 13px; text-align: center; }

  /* «Все позиции»: поиск и «Фильтры» липнут сверху; карточка — артикул, решение, «Заказать N шт · ₽», полоска */
  .back-link { margin: 0; }
  .page-head:has(.seg-btn) .head-actions { width: 100%; }
  .page-head:has(.seg-btn) .seg { flex: 1; }
  .page-head .seg-btn { flex: 1; min-height: 44px; font-size: 14px; }
  .pu-filters { position: sticky; top: calc(55px + env(safe-area-inset-top)); z-index: 20; margin: 0 calc(-1 * var(--m-gutter));
    padding: 8px var(--m-gutter); background: color-mix(in oklab, var(--bg) 94%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
  .pu-toolbar { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; }
  .pu-sort { display: block !important; width: 100%; min-width: 0; min-height: 44px; }
  .pu-search-field { grid-column: 1 / -1; }
  .pu-search-field input[type=search] { width: 100%; min-height: 46px; padding-left: 38px; border-radius: 12px; }
  .pu-search-icon { left: 13px; width: 16px; height: 16px; }
  .pu-seg, .pu-toolbar > .pu-pop, .pu-toolbar > .pu-pop-btn-plain { display: none !important; }
  .pu-fbtn { display: inline-flex !important; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 12px;
    border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 600 14px var(--ui); cursor: pointer; }
  .pu-fbtn-ico { width: 18px; height: 18px; }
  .pu-fbtn-n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center;
    background: var(--primary); color: var(--on-primary); font: 600 11.5px var(--ui); }
  .pu-toolbar-right { grid-column: 1 / -1; margin-left: 0; justify-content: space-between; gap: 6px; }
  .pu-toolbar-right:empty { display: none; }
  .pu-toolbar-right .btn { min-height: 44px; }
  .pu-chips-row .chip { min-height: 44px; font-size: 13.5px; padding: 0 14px; }
  .pu-fgroup { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
  .pu-fgroup legend { padding: 0; margin-bottom: 10px; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
  .pu-fgroup .chips { gap: 8px; }
  .pu-fgroup .chip { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 14px; font-size: 14px; }
  .chip-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
  .chip-dot.pill-bad { color: var(--crit); } .chip-dot.pill-warn { color: var(--warn); } .chip-dot.pill-good { color: var(--good); }
  .chip-dot.pill-mid { color: var(--text-3); }
  .chip[aria-pressed="true"] .chip-dot { color: inherit; }

  .pu-table.card { padding: 0; background: transparent; border: 0; gap: 12px; }
  .pu-table .tbl-wrap { overflow: visible; }
  table.pu-grid { display: block; }
  table.pu-grid thead { display: none; }
  table.pu-grid tbody { display: flex; flex-direction: column; gap: 10px; }
  table.pu-grid tbody tr { position: relative; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 14px;
    padding: 14px 16px 14px 50px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--m-radius);
    -webkit-tap-highlight-color: transparent; }
  table.pu-grid tbody tr:hover { background: var(--surface); }
  table.pu-grid tbody tr:active { background: var(--surface-2); }
  table.pu-grid td { padding: 0; border: 0; min-width: 0; text-align: left; white-space: normal; width: auto !important; }
  table.pu-grid td.num { text-align: left; }
  table.pu-grid td:nth-child(1) { position: absolute; left: 6px; top: 6px; }
  /* флажок строки — 22 px внутри подписи 44×44: нажатие рядом с квадратиком тоже ставит отметку */
  table.pu-grid td:nth-child(1) input { width: 22px; height: 22px; margin: 0; display: block; }
  table.pu-grid .pu-check { width: 44px; height: 44px; }
  table.pu-grid td:nth-child(2) { order: 1; flex: 1 1 0; }
  table.pu-grid td:nth-child(2) .art { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
  table.pu-grid td:nth-child(2) .sub { font-size: 12.5px; color: var(--text-2); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
  table.pu-grid .pu-exp { display: none; }
  table.pu-grid td:nth-child(3) { order: 2; flex: none; max-width: 48%; text-align: right; }
  table.pu-grid td:nth-child(3) .pill { white-space: normal; }
  table.pu-grid td:nth-child(3) .sub { margin-top: 4px; }
  table.pu-grid td:nth-child(4) { order: 3; flex: 1 1 100%; display: flex; align-items: baseline; gap: 6px; padding: 10px 0 0;
    border-top: 1px solid var(--line); font-size: 15px; font-weight: 600; text-align: left; }
  table.pu-grid td:nth-child(4)::before { content: attr(data-label); display: inline; margin: 0 auto 0 0; font-size: 13px; font-weight: 400; color: var(--text-2); }
  table.pu-grid td:nth-child(4) .sub { display: inline; font-size: 15px; color: var(--text); }
  table.pu-grid td:nth-child(4) .sub:not(:empty)::before { content: "· "; color: var(--text-3); }
  table.pu-grid td:nth-child(5) { order: 4; flex: 1 1 100%; }
  table.pu-grid tr.pu-more-row { display: none; }
  .pu-table > .btn, .pu-list > .pu-more { width: 100%; }
  .pu-bulk { position: fixed; left: 10px; right: 10px; bottom: calc(var(--m-tabs) + 10px + env(safe-area-inset-bottom)); z-index: 45;
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; border-radius: 18px; }
  .pu-bulk > b { align-self: center; font-size: 14px; }
  .pu-bulk > .btn, .pu-bulk > select { min-height: 44px; width: 100%; }
  .pu-table:has(.pu-bulk) { padding-bottom: 200px; }
  .pu-bulk > .btn-ghost { order: -1; grid-column: 2; grid-row: 1; }
  .pu-bulk > span { grid-column: 1 / -1; }
  .pu-bulk > span:empty { display: none; }
  .pu-bulk-done { grid-template-columns: minmax(0, 1fr) auto; }
  .pu-bulk-done > .pu-bulk-msg { grid-column: 1; grid-row: 1; align-self: center; }
  .pu-bulk-done > .btn-ghost { grid-column: 2; }
  .pu-batch .btn-link { min-height: 44px; padding: 0 4px; }

  /* шторка позиции */
  .pu-act { padding: 14px; }
  .pu-mark { width: 100%; min-height: 48px; }
  .drawer-why { font-size: 14px; line-height: 1.6; }
  .drawer-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
  .drawer-form .field { min-width: 0; }
  .drawer-form .field input, .drawer-form .field select { width: 100%; }
  .drawer-form > .btn { grid-column: 1 / -1; min-height: 46px; }
  .drawer-form .drawer-note { grid-column: 1 / -1; }
  .drill-num > summary { padding: 12px; min-height: 44px; }
  .drill-parts { padding: 0 12px 6px; }
  .src-ref { font-size: 11px; }
  .wk-chart svg { height: 170px; }
  .legend { gap: 6px 12px; }
  .tabs { flex-wrap: nowrap; gap: 6px; margin-bottom: 8px; }
  .tabs .chip { flex: none; min-height: 44px; font-size: 13px; padding: 0 14px; }

}

@media (max-width: 700px) {
  /* ── Подключения, кабинеты, вход ─────────────────────────────────────────────────────────── */
  /* «Подключения» на телефоне — список строк по 64px: значок · название (масштаб мелко) · время · › */
  .conn-grid { gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--m-radius); overflow: hidden; }
  .tile.conn-tile { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; min-height: 64px;
    padding: 10px 40px 10px 14px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
  .tile.conn-tile:last-child { border-bottom: 0; }
  .tile.conn-tile .tile-head { padding-right: 0; gap: 12px; }
  .tile.conn-tile .tile-mark { width: 32px; height: 32px; border-radius: 9px; font-size: 13px; }
  .tile.conn-tile h2 { font-size: 15px; }
  .tile-status { font-size: 12px; justify-content: flex-end; text-align: right; }
  .tile-status .status-dot, .tile-status .tile-word, .tile-status .tile-word ~ .tile-last .tile-sep, .tile-desc { display: none !important; }
  .tile-flag { position: static; grid-column: 1 / -1; justify-self: start; margin-left: 44px; order: 3; }
  .tile-arrow { top: 50%; right: 14px; margin-top: -7px; }
  .tile.conn-tile:hover { transform: none; box-shadow: none; }
  .tile.conn-tile:active { background: var(--surface-2); }
  .back-link { margin: -4px 0 -8px; }
  .back-link .btn-link { display: inline-flex; align-items: center; min-height: 44px; }
  .page > p > .btn-ghost.btn-small { padding-left: 4px; border: 0; min-height: 44px; color: var(--text-2); }
  .page-head .src-dot { display: inline-block; margin-right: 8px; vertical-align: middle; }
  .page-head .src-dot + h1 { display: inline; vertical-align: middle; }
  .state-line { font-size: 13px; line-height: 1.45; }
  .conn-form, .conn-settings { gap: 14px; }
  .conn-form > .btn, .conn-settings > .btn { width: 100%; }
  .setting { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 16px 0 2px; margin: 0; gap: 8px; min-width: 0; }
  .setting legend { float: left; width: 100%; padding: 0; margin-bottom: 2px; font-size: 14.5px; }
  .setting legend + * { clear: both; }
  .setting > p { margin: 0; }
  .setting .field input { width: 100%; }
  /* набор флажков (дни недели, склады) — плитками в ряд, а не столбиком */
  .setting:has(> label.check ~ label.check ~ label.check) { flex-direction: row; flex-wrap: wrap; }
  .setting:has(> label.check ~ label.check ~ label.check) > :not(label.check) { flex-basis: 100%; }
  .setting:has(> label.check ~ label.check ~ label.check) > label.check { flex: 0 0 auto; min-height: 44px; padding: 0 14px 0 10px;
    border: 1px solid var(--line-2); border-radius: 12px; gap: 8px; }
  .setting:has(> label.check ~ label.check ~ label.check) > label.check:has(input:checked) { background: var(--surface-3); border-color: transparent; }
  table.jobs td:last-child form, table.jobs td:last-child .btn { width: 100%; }
  /* разделы страницы канала и «Состав числа»: заголовок раздела — зона нажатия от 44 px; CSV в заголовке — тоже */
  details.conn-sec > summary, details.card > summary, .cab-new > summary, details.fold-sm > summary { min-height: 44px; }
  details.fold > summary > .fold-act.btn-small { min-height: 44px; }
  /* «зеркало площадки» в таблице клиентов: флажок 22 px внутри подписи во всю ширину, 44 px высотой */
  table.m-kv td.mirror-cell { display: block; padding: 2px 0 0; }
  table.m-kv td.mirror-cell::before { content: none; }
  .mirror-check { display: flex; align-items: center; min-height: 44px; width: 100%; font-size: 13.5px; color: var(--text-2); }
  .mirror-check input { width: 22px; height: 22px; flex: none; margin: 0; }
  .mirror-text { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  /* подвал панели решений — как у своих шторок: на всю ширину, над полосой «Домой» */
  .drawer-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .drawer-foot .btn { flex: 1; min-height: 48px; }
  .decision-panel .drawer-body { padding-bottom: 16px; }
  table.m-kv td:last-child:has(form) { display: block; margin-top: 8px; }
  table.m-kv td:last-child:has(form)::before { content: none; }
  table.m-kv .prog { width: 120px; }

  .grid-cards { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .cab-card { gap: 12px; }
  .cab-head h2 { font-size: 16px; overflow-wrap: anywhere; }
  .src-list li { gap: 6px 8px; font-size: 13.5px; }
  .src-list .small { flex-basis: 100%; padding-left: 16px; margin-top: -2px; }
  .cab-head h2 a { display: inline-block; padding: 10px 0; margin: -10px 0; }
  .cab-del-form input { min-height: 46px; }
  .cab-del-form .btn, .cab-new .btn { width: 100%; }

  .login { min-height: 100dvh; padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); align-items: center; }
  .login-card { padding: 24px 20px; gap: 16px; border-radius: 22px; }
  .login-card .brand { padding: 0; margin-bottom: 2px; }
  .login-card .btn { min-height: 50px; font-size: 15px; }
}

@media (max-width: 700px) {
  /* шапка экрана без «Отчёт | Расходы» — шестерёнка в одной строке с заголовком */
  .page-head:not(:has(.subnav)) { flex-wrap: nowrap; align-items: center; }
  .page-head:not(:has(.subnav)) .head-actions { width: auto; }
}

/* Кнопка «Наверх» — над нижней панелью вкладок */
@media (max-width: 700px) {
  .to-top { right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); }
}
