/* Рабочий кабинет D4 (пакет Codex 09.10, docs/03-DESIGN.txt; макет preview/bank — слои bank → refinement → journal → workspace).
   Подключается ПОСЛЕ app.css только у тех, кто включил новый вид: переназначает переменные прежнего оформления на токены D4
   (страницы и их классы не меняются) и задаёт оболочку .d4-*. Светлая схема всегда — в D4 тёмной нет.
   Шрифты Geist / Geist Mono — локальные (OFL, fonts/OFL.txt), без CDN. */
@font-face { font-family: Geist; src: url("fonts/Geist-cyrillic.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Geist; src: url("fonts/Geist-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: GeistMono; src: url("fonts/GeistMono-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

html[data-design="d4"] {
  /* токены D4 */
  --d4-bg: #f3f4f6; --d4-surface: #fff; --d4-ink: #202329; --d4-muted: #626a76; --d4-blue: #2563cf; --d4-blue-soft: #eef4ff;
  --d4-yellow: #ffce51; --d4-yellow-hover: #f2be3b; --d4-line: #eef0f3; --d4-field: #d5dae1; --d4-success: #23734a;
  --d4-success-bg: #edf6f0; --d4-amber: #986014; --d4-amber-bg: #fff5e3; --d4-red: #b13b3e; --d4-red-bg: #fbeeee;
  --d4-hover: #e8ebef;
  /* прежние переменные app.css → D4 */
  --skin: var(--d4-ink); --skin-2: var(--d4-blue); --flesh: var(--d4-blue-soft); --flesh-2: #f6f9ff; --flesh-ink: var(--d4-blue);
  --pit: var(--d4-amber); --pit-2: var(--d4-amber);
  --bg: var(--d4-bg); --card: var(--d4-surface); --soft: #f5f6f8; --ink: var(--d4-ink); --muted: var(--d4-muted); --line: var(--d4-line);
  --head: var(--d4-surface); --head-ink: var(--d4-ink); --head-muted: var(--d4-muted);
  --act: var(--d4-blue); --act-ink: #fff;
  --up: var(--d4-success-bg); --up-ink: var(--d4-success); --down: var(--d4-red-bg); --down-ink: var(--d4-red); --new: var(--d4-amber-bg);
  --r: 20px; --shadow: none; --shadow-up: 0 8px 24px -14px rgba(23, 39, 65, .22);
  --display: Geist, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; --text: var(--display);
  color-scheme: light;
}
html[data-design="d4"] body { background: var(--d4-bg); color: var(--d4-ink); font: 14.5px/1.5 var(--text); }

/* ---------- спокойнее: без украшений прежнего вида ---------- */
.d4-shell main, .d4-shell .item, .d4-shell .group, .d4-shell .panel, .d4-shell .kpi, .d4-shell .note { animation: none; }
.d4-shell .item:hover, .d4-shell .group:hover { transform: none; box-shadow: none; }
.d4-shell .pricetag:hover, .d4-shell .printone:hover { transform: none; }
.d4-shell button:active, .d4-shell .btn:active { transform: translateY(1px); }
.d4-shell button, .d4-shell .btn, .d4-shell input, .d4-shell select { transition: background .15s, border-color .15s, box-shadow .15s; }

/* ---------- типографика ---------- */
.d4-shell h2 { font: 650 30px/1.2 var(--display); letter-spacing: -.85px; margin: 4px 0 18px; }
.d4-shell h3 { font: 620 19px/1.35 var(--display); letter-spacing: -.3px; margin: 28px 0 12px; }
.d4-shell .num, .d4-shell td.r, .d4-shell .kpi b { font-variant-numeric: tabular-nums; }
.d4-shell code, .d4-shell .mono { font-family: GeistMono, ui-monospace, monospace; font-size: 12.5px; }

/* ---------- кнопки и поля ---------- */
.d4-shell button, .d4-shell .btn { font: 560 14px/1 var(--text); min-height: 42px; padding: 11px 16px; border-radius: 12px;
  border: 1px solid var(--d4-field); background: var(--d4-surface); color: var(--d4-ink); }
.d4-shell button:hover, .d4-shell .btn:hover { border-color: #b9c0ca; background: #fafbfc; }
.d4-shell button.primary, .d4-shell .btn.primary { background: var(--d4-yellow); border-color: var(--d4-yellow); color: var(--d4-ink); }
.d4-shell button.primary:hover, .d4-shell .btn.primary:hover { background: var(--d4-yellow-hover); border-color: var(--d4-yellow-hover); box-shadow: none; }
.d4-shell button.ghost { background: var(--d4-surface); }
.d4-shell button.danger { color: var(--d4-red); }
.d4-shell button.tagbtn { background: var(--d4-blue-soft); color: var(--d4-blue); border-color: transparent; }
.d4-shell button:disabled { opacity: .55; cursor: not-allowed; }
.d4-shell input, .d4-shell select, .d4-shell textarea { font: 15px var(--text); border: 1px solid var(--d4-field); border-radius: 11px;
  background: var(--d4-surface); color: var(--d4-ink); min-height: 42px; }
.d4-shell input[type=checkbox], .d4-shell input[type=radio] { min-height: 0; accent-color: var(--d4-blue); }
.d4-shell input:focus, .d4-shell select:focus, .d4-shell textarea:focus { outline: none; border-color: var(--d4-blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--d4-blue) 22%, transparent); }
.d4-shell a:focus-visible, .d4-shell button:focus-visible { outline: 3px solid var(--d4-blue); outline-offset: 2px; }
.d4-shell a { color: inherit; }
.d4-shell main :is(p, td, li, .note, .sub, .muted) > a:not(.btn) { color: var(--d4-blue); text-underline-offset: 3px; }

/* ---------- поверхности, таблицы, статусы ---------- */
.d4-shell .panel { border-radius: 22px; background: var(--d4-surface); box-shadow: none; }
.d4-shell .list th { background: transparent; color: var(--d4-muted); font-size: 12px; font-weight: 550; letter-spacing: 0;
  border-bottom: 1px solid var(--d4-line); padding: 13px 14px; }
.d4-shell .list td { padding: 13px 14px; border-bottom: 1px solid var(--d4-line); }
.d4-shell tr.link:hover td { background: #f7f8fa; }
.d4-shell .tag { border-radius: 8px; padding: 3px 9px; font-weight: 560; background: #eef0f3; color: #48515e; }
.d4-shell .tag.okt { background: var(--d4-success-bg); color: var(--d4-success); }
.d4-shell .tag.warn { background: var(--d4-amber-bg); color: var(--d4-amber); }
.d4-shell .note { border-radius: 14px; font-weight: 520; }
.d4-shell .badge { background: #e8ecf2; color: #43546e; border-radius: 6px; font-weight: 600; }
.d4-shell .kpi { border-radius: 20px; background: var(--d4-surface); box-shadow: none; padding: 18px 20px; }
.d4-shell .kpi b { font: 620 26px/1.15 var(--display); letter-spacing: -.6px; color: var(--d4-ink); }
.d4-shell .search .box { border: 1px solid var(--d4-field); border-radius: 14px; box-shadow: none; }
.d4-shell .search .box:focus-within { border-color: var(--d4-blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--d4-blue) 20%, transparent); }
.d4-shell .search input { font-size: 17px; border: 0; box-shadow: none; min-height: 0; background: transparent; }
.d4-shell .search input:focus { box-shadow: none; }
.d4-shell .item { border-radius: 16px; box-shadow: none; border: 1px solid transparent; }
.d4-shell .item.incart { background: var(--d4-surface); border-color: color-mix(in srgb, var(--d4-blue) 35%, transparent); }
.d4-shell .pricetag { background: #f3f5f8; color: var(--d4-ink); border-radius: 12px; padding: 8px 13px; font: 650 19px/1 var(--display); }
.d4-shell .pricetag::before { display: none; }
.d4-shell .pricetag.none { color: var(--d4-muted); }
.d4-shell .printone { background: var(--d4-blue-soft); color: var(--d4-blue); }
.d4-shell .group { border-radius: 14px; box-shadow: none; border: 1px solid var(--d4-line); }
.d4-shell .group:hover { border-color: color-mix(in srgb, var(--d4-blue) 35%, transparent); }
.d4-shell .group .fold { width: 28px; height: 28px; }
.d4-shell .toast { background: var(--d4-ink); }
.d4-shell .printbar { background: color-mix(in srgb, var(--d4-surface) 94%, transparent); }
.d4-shell .printbar .in { max-width: 1720px; }

/* ---------- оболочка ---------- */
.d4-skip { position: fixed; top: -80px; left: 16px; z-index: 40; padding: 12px 16px; border-radius: 10px; background: var(--d4-ink); color: #fff; }
.d4-skip:focus { top: 10px; }
.d4-ic { width: 20px; height: 20px; flex: none; }
.d4-header { height: 72px; display: flex; align-items: center; gap: 28px; padding: 0 28px; background: var(--d4-surface);
  position: sticky; top: 0; z-index: 30; border-bottom: 1px solid #e8ecf1; }   /* refinement.css: шапка 72px закреплена */
.d4-brand { display: flex; align-items: center; gap: 12px; min-width: 226px; text-decoration: none; color: var(--d4-ink); }
.d4-mark { width: 38px; height: 38px; flex: none; display: grid; grid-template-columns: repeat(2, 7px); grid-template-rows: repeat(2, 7px);
  gap: 4px; place-content: center; background: var(--d4-ink); border-radius: 12px; }
.d4-mark i { background: var(--d4-yellow); border-radius: 1px; }
.d4-mark i:last-child { border-radius: 50%; }
.d4-name b { display: block; font: 650 17px/1.2 var(--display); letter-spacing: -.4px; }
.d4-name small { display: block; color: var(--d4-muted); font-size: 11.5px; margin-top: 3px; white-space: nowrap; }
.d4-name small i { font-style: normal; color: #c3c8cf; margin: 0 4px; }
.d4-find { flex: 1; max-width: 530px; height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-radius: 12px;
  background: var(--d4-bg); color: var(--d4-muted); text-decoration: none; font-size: 14px; }
.d4-find:hover, .d4-find:focus-within { background: var(--d4-hover); }
.d4-shell .d4-find input { flex: 1; min-width: 0; min-height: 0; height: 40px; padding: 0; border: 0; background: transparent;
  font: 14px var(--text); color: var(--d4-ink); box-shadow: none; }
.d4-shell .d4-find input:focus { box-shadow: none; }
.d4-shell .d4-find input::placeholder { color: var(--d4-muted); }

/* ---------- заголовок страницы ---------- */
.d4-pagehead { margin: 4px 0 18px; }
.d4-pagehead h1 { margin: 0; font: 650 30px/1.2 var(--display); letter-spacing: -.85px; }
.d4-pagehead p { margin: 6px 0 0; color: var(--d4-muted); font-size: 13px; }

/* ---------- каталог: строки одной таблицей (разметку строк рисует app.js — общая со старым видом) ---------- */
.d4-shell .search { padding-top: 0; }
.d4-shell .printpref { font-size: 13px; color: var(--d4-muted); gap: 10px; }
.d4-shell .printpref select { min-height: 36px; padding: 6px 10px; font-size: 13px; }
.d4-shell .items:not(:empty) { gap: 0; background: var(--d4-surface); border-radius: 22px; overflow: hidden; }
.d4-shell .items .item { border-radius: 0; border: 0; border-bottom: 1px solid var(--d4-line); padding: 14px 20px; background: transparent; }
.d4-shell .items .item:last-child { border-bottom: 0; }
.d4-shell .items .item:hover { background: #fafbfc; }
.d4-shell .items .item.incart { background: #f7faff; box-shadow: inset 3px 0 0 var(--d4-blue); }
.d4-shell .item .nm { font-weight: 600; font-size: 15px; }
.d4-shell .item .meta { font-family: GeistMono, ui-monospace, monospace; font-size: 12px; margin-top: 3px; }
.d4-shell .item .sub { font-size: 12px; }
.d4-shell .item .sub.stk b { font-weight: 600; }
.d4-shell .item .pend { color: var(--d4-amber); font-weight: 600; }
.d4-shell .stepper { border-color: var(--d4-field); border-radius: 11px; }
.d4-shell .stepper button { min-height: 40px; padding: 0 12px; border: 0; border-radius: 0; background: transparent; }
.d4-shell .stepper input { min-height: 40px; border: 0; border-radius: 0; box-shadow: none; }
.d4-shell .crumbs a { color: var(--d4-muted); }
.d4-shell .crumbs a.cur { color: var(--d4-ink); }
.d4-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.d4-shell .d4-iconbtn { width: 42px; height: 42px; min-height: 0; padding: 0; justify-content: center; border: 0; border-radius: 50%;
  background: transparent; color: var(--d4-ink); display: inline-flex; align-items: center; position: relative; }
.d4-shell .d4-iconbtn:hover { background: var(--d4-bg); }
.d4-shell .d4-iconbtn.on { color: var(--d4-blue); background: var(--d4-blue-soft); }
.d4-iconbtn span, .d4-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.d4-shell .d4-dot { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 11px;
  line-height: 18px; text-align: center; background: var(--d4-blue); color: #fff; border: 2px solid var(--d4-surface); box-sizing: content-box; }
/* профиль — компактное меню с реальными действиями (правки Codex 11.10 п.4) */
.d4-profile { position: relative; }
.d4-profile > summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 24px; }
.d4-profile > summary::-webkit-details-marker { display: none; }
.d4-profile > summary:hover { background: var(--d4-bg); }
.d4-profile > summary:focus-visible { outline: 3px solid var(--d4-blue); outline-offset: 2px; }
.d4-avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #e9edf4; color: #43546e; font-weight: 600; font-size: 16px; }
.d4-who b { display: block; font-size: 13px; font-weight: 560; }
.d4-who small { display: block; font-size: 11.5px; color: var(--d4-muted); }
.d4-chev { color: var(--d4-muted); margin-left: 2px; }
.d4-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; display: grid; gap: 2px; padding: 8px; background: var(--d4-surface);
  border: 1px solid #e3e6eb; border-radius: 16px; box-shadow: 0 12px 32px -12px rgba(23, 39, 65, .25); z-index: 40; }
.d4-menu-who { margin: 4px 10px 8px; display: grid; gap: 2px; }
.d4-menu-who small { color: var(--d4-muted); font-size: 12px; }
.d4-shell .d4-menu a, .d4-shell .d4-menu button { display: flex; align-items: center; width: 100%; min-height: 40px; padding: 8px 10px; border: 0;
  border-radius: 10px; background: transparent; color: var(--d4-ink); text-decoration: none; font: 500 14px var(--text); justify-content: flex-start; }
.d4-shell .d4-menu a:hover, .d4-shell .d4-menu button:hover { background: var(--d4-bg); }
.d4-menu form { margin: 4px 0 0; border-top: 1px solid var(--d4-line); padding-top: 4px; }
.d4-shell .d4-menu form button { color: var(--d4-red); }

.d4-frame { display: grid; grid-template-columns: 232px minmax(0, 1fr); max-width: 1720px; margin: 0 auto; min-height: calc(100vh - 72px); }
/* боковое меню закреплено под шапкой и прокручивается само (refinement.css: sticky top 72px, height 100dvh − 72px) */
.d4-sidebar { position: sticky; top: 72px; align-self: start; height: calc(100dvh - 72px); overflow-y: auto; overscroll-behavior: contain;
  padding: 24px 16px 20px 24px; display: flex; flex-direction: column; gap: 18px; }
.d4-shell .d4-create { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; width: 100%; border: 0; border-radius: 12px;
  background: var(--d4-yellow); color: var(--d4-ink); font: 580 14px var(--text); }
.d4-shell .d4-create:hover { background: var(--d4-yellow-hover); }
.d4-shell nav.d4-side { display: block; padding: 0; overflow: visible; flex: none; }
.d4-group { margin-bottom: 14px; }
.d4-caption { font-size: 11.5px; color: var(--d4-muted); padding: 0 14px; margin: 6px 0 6px; }
.d4-shell nav.d4-side a.d4-link { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 14px; border-radius: 12px;
  font-size: 14px; font-weight: 480; color: #48515e; background: transparent; white-space: nowrap; text-decoration: none; }
.d4-shell nav.d4-side a.d4-link .d4-ic { color: #7b8491; }
.d4-shell nav.d4-side a.d4-link:hover { background: var(--d4-hover); color: var(--d4-ink); }
.d4-shell nav.d4-side a.d4-link.on { background: var(--d4-surface); color: var(--d4-ink); font-weight: 600; box-shadow: 0 2px 8px rgba(23, 39, 65, .05); }
.d4-shell nav.d4-side a.d4-link.on .d4-ic { color: var(--d4-blue); }
.d4-shell .d4-count { margin-left: auto; font-size: 11.5px; line-height: 18px; min-width: 22px; text-align: center; padding: 0 6px; }
.d4-sync { margin-top: auto; padding: 16px 14px 0; border-top: 1px solid #e5e8ed; font-size: 12px; color: var(--d4-muted); display: grid; gap: 2px; }
.d4-sync b { font-weight: 560; color: var(--d4-ink); display: flex; align-items: center; gap: 7px; }
.d4-sync b::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--d4-success); }
.d4-sync.bad b { color: var(--d4-red); }
.d4-sync.bad b::before { background: var(--d4-red); }
/* «Обмен 1С live / пауза / разрыв» (владелец 11.10) */
.d4-sync-word { font-size: 11px; font-weight: 600; line-height: 18px; padding: 0 7px; border-radius: 999px; background: var(--d4-success-bg); color: var(--d4-success); }
.d4-sync.pause b::before { background: var(--d4-amber); }
.d4-sync.pause .d4-sync-word { background: var(--d4-amber-bg); color: var(--d4-amber); }
.d4-sync.bad .d4-sync-word { background: var(--d4-red-bg); color: var(--d4-red); }
.d4-sync.live b::before { animation: d4-live 2.4s ease-in-out infinite; }
@keyframes d4-live { 50% { box-shadow: 0 0 0 4px var(--d4-success-bg); } }
@media (prefers-reduced-motion: reduce) { .d4-sync.live b::before { animation: none; } }
.d4-shell main { max-width: none; margin: 0; padding: 26px 32px 40px 24px; min-width: 0; }   /* refinement.css: 26px 32px 20px 24px */
.d4-shell main:focus { outline: none; }
html[data-design="d4"] { scroll-padding-top: 94px; }
.d4-shell nav.d4-bottom { display: none; }
/* «Новая операция» — модальное окно с переходами к настоящим сценариям */
.d4-dialog { width: min(560px, calc(100vw - 32px)); border: 0; border-radius: 22px; padding: 22px 22px 18px; color: var(--d4-ink);
  box-shadow: 0 24px 64px -24px rgba(23, 39, 65, .4); }
.d4-dialog::backdrop { background: rgba(23, 27, 33, .35); }
.d4-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.d4-shell .d4-dialog h2 { margin: 0; font-size: 22px; }
.d4-dialog > p { margin: 6px 0 14px; font-size: 13px; }
.d4-choices { display: grid; gap: 2px; }
.d4-choice { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 14px; text-decoration: none; color: var(--d4-ink); }
.d4-choice:hover, .d4-choice:focus-visible { background: var(--d4-bg); }
.d4-choice b { display: block; font-size: 14.5px; font-weight: 600; }
.d4-choice small { display: block; color: var(--d4-muted); font-size: 12.5px; margin-top: 2px; }
.d4-choice-ic { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--d4-blue-soft); color: var(--d4-blue); }
/* вторая строка переходов внутри раздела (виды проверки смены) */
.d4-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; margin: 0 0 16px; border-radius: 12px; background: #e9ecf0; }
.d4-seg a { padding: 7px 14px; border-radius: 9px; color: var(--d4-muted); text-decoration: none; font-size: 13.5px; font-weight: 520; }
.d4-seg a.on { background: var(--d4-surface); color: var(--d4-ink); box-shadow: 0 1px 3px rgba(32, 35, 41, .07); }

@media (max-width: 1190px) {
  .d4-frame { grid-template-columns: 210px minmax(0, 1fr); }
  .d4-sidebar { padding-left: 14px; padding-right: 8px; }
  .d4-brand { min-width: 0; }
  .d4-who, .d4-chev { display: none; }
}
@media (max-width: 1000px) {
  .d4-find { max-width: 320px; }
  .d4-header { gap: 14px; }
}
@media (max-width: 760px) {
  .d4-header { height: 64px; padding: 0 10px 0 16px; gap: 6px; background: var(--d4-bg); border-bottom: 0; }
  .d4-brand { flex: 1; min-width: 0; gap: 10px; }
  .d4-mark { width: 32px; height: 32px; border-radius: 10px; }
  .d4-name b { font-size: 15px; }
  .d4-name small { overflow: hidden; text-overflow: ellipsis; }
  .d4-find { display: none; }
  .d4-actions { gap: 0; }
  .d4-profile > summary { padding: 2px; }
  .d4-avatar { width: 34px; height: 34px; font-size: 13px; }
  .d4-frame { display: block; min-height: 0; }
  .d4-shell main { padding: 14px 16px calc(96px + env(safe-area-inset-bottom, 0px)); }
  .d4-shell h2 { font-size: 24px; letter-spacing: -.5px; }
  .d4-sidebar { display: none; }
  .d4-shell.menu-open .d4-sidebar { display: flex; position: fixed; inset: 64px 0 calc(64px + env(safe-area-inset-bottom, 0px)) 0; z-index: 20; height: auto;
    background: var(--d4-bg); overflow-y: auto; padding: 8px 16px 16px; }
  .d4-shell.menu-open { overflow: hidden; }
  .d4-shell nav.d4-bottom { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
    background: var(--d4-surface); border-top: 1px solid #e5e8ed; padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); gap: 0; flex-wrap: nowrap; }
  .d4-shell nav.d4-bottom a, .d4-shell nav.d4-bottom button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 50px; padding: 4px 2px; border: 0; border-radius: 12px; background: transparent; font: 520 11px/1.2 var(--text);
    color: var(--d4-muted); text-decoration: none; white-space: nowrap; }
  .d4-shell nav.d4-bottom a[aria-current=page], .d4-shell nav.d4-bottom button[aria-expanded=true] { color: var(--d4-blue); }
  .d4-shell nav.d4-bottom .d4-ic { width: 22px; height: 22px; }
  .d4-shell .printbar { bottom: calc(62px + env(safe-area-inset-bottom, 0px)); padding-bottom: 11px; }
  .d4-shell .toast { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .d4-menu { right: -6px; }
}
@media (prefers-reduced-motion: reduce) { .d4-shell * { transition: none !important; } }

/* ---------- вход ---------- */
html[data-design="d4"] body.login { background: var(--d4-bg); }
html[data-design="d4"] .login .card { border: 0; box-shadow: none; border-radius: 24px; padding: 32px 28px; width: min(100%, 390px);
  max-width: 390px; min-width: 0; gap: 16px; animation: none; }
html[data-design="d4"] .login input { width: 100%; min-width: 0; }
@media (max-width: 400px) { html[data-design="d4"] .login .card { padding: 26px 20px; } }
html[data-design="d4"] .login .d4-brand { min-width: 0; margin-bottom: 10px; }
html[data-design="d4"] .login input { border: 1px solid var(--d4-field); border-radius: 11px; min-height: 46px; font: 16px var(--text); }
html[data-design="d4"] .login input:focus { border-color: var(--d4-blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--d4-blue) 22%, transparent); }
html[data-design="d4"] .login button.primary { background: var(--d4-yellow); border: 0; color: var(--d4-ink); min-height: 48px; border-radius: 12px; font: 600 15px var(--text); }
html[data-design="d4"] .login label { color: var(--d4-muted); font: 550 13px var(--text); }
html[data-design="d4"] .login label[for=pw] { margin-bottom: -10px; }
.d4-pw { position: relative; display: grid; }
html[data-design="d4"] .d4-pw input { padding-right: 104px; }
html[data-design="d4"] .d4-pw button { position: absolute; right: 5px; top: 5px; bottom: 5px; min-height: 0; padding: 0 12px;
  border: 0; border-radius: 9px; background: var(--d4-bg); color: var(--d4-blue); font: 560 13px var(--text); justify-content: center; }
html[data-design="d4"] .d4-pw button:hover { background: var(--d4-blue-soft); }

/* ---------- КУР (cabinet-d4-kur-*.png; правки дизайнера Codex 11.10, п.5) ---------- */
.d4-shell .kur-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; background: var(--d4-surface); border-radius: 20px;
  padding: 12px 14px; margin: 0 0 12px; }
.d4-shell .kur-bar .kur-q { flex: 1 1 280px; min-width: 0; }
.d4-shell .kur-bar .kur-q label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.d4-shell .kur-bar .kur-q input { width: 100%; background: var(--d4-bg); border-color: transparent; min-height: 44px; }
.d4-shell .kur-presets { margin: 0; gap: 4px; display: flex; flex-wrap: wrap; }
.d4-shell .kur-presets .btn { min-height: 40px; padding: 8px 14px; border-radius: 10px; background: transparent; border-color: transparent; color: var(--d4-muted); }
.d4-shell .kur-presets .btn.on { background: var(--d4-blue-soft); color: var(--d4-blue); font-weight: 600; }
.d4-shell .kur-more > summary { list-style: none; cursor: pointer; color: var(--d4-blue); font-weight: 560; padding: 9px 12px; border-radius: 10px; }
.d4-shell .kur-more > summary::-webkit-details-marker { display: none; }
.d4-shell .kur-more > summary:hover { background: var(--d4-blue-soft); }
.d4-shell .kur-more[open] { flex-basis: 100%; order: 5; }
.d4-shell .kur-more[open] > summary { display: inline-flex; }
.d4-shell .kur-bar .kur-filters { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 2px; padding: 0; background: transparent; }
.d4-shell .kur-bar .kur-filters > div { flex: 1 1 180px; min-width: 0; }
.d4-shell .kur-bar .kur-filters label { display: block; margin-bottom: 4px; color: var(--d4-muted); font-weight: 550; font-size: 12px; }
.d4-shell .kur-bar .kur-filters input, .d4-shell .kur-bar .kur-filters select { width: 100%; }
.d4-shell .kur-bar > button.primary { min-height: 44px; }
.kur-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.d4-shell .kur-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 9px; background: var(--d4-blue-soft);
  color: var(--d4-blue); font-size: 13px; font-weight: 520; text-decoration: none; }
.d4-shell .kur-chip span { font-size: 15px; line-height: 1; }
.d4-shell .kur-chip:hover { background: #dfe9fb; }
.d4-shell .kur-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 0 0 22px; background: transparent; overflow: visible; }
.d4-shell .kur-kpis .kpi { display: grid; gap: 4px; align-content: start; background: transparent; padding: 4px 20px 4px 0; margin-right: 20px;
  border-radius: 0; border-right: 1px solid #e3e6eb; box-shadow: none; }
.d4-shell .kur-kpis .kpi:last-child { border-right: 0; margin-right: 0; }
.d4-shell .kur-kpis .kpi span { color: var(--d4-muted); font-size: 12.5px; }
.d4-shell .kur-kpis .kpi b { font: 650 26px/1.15 var(--display); letter-spacing: -.6px; color: var(--d4-ink); }
.d4-shell .kur-kpis .kpi.kpi-del b { color: #9a4a2a; }
.d4-shell .kur-kpis .kpi small { color: var(--d4-muted); font-size: 12px; }
.d4-shell .kur-tabs { margin-bottom: 16px; }
.d4-shell .kur-tabs .badge { margin-left: 6px; }
.kur-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px 18px; margin: 0 0 6px; }
.d4-shell .kur-density { margin: 0; }
.d4-shell .d4-seg button { min-height: 32px; padding: 6px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--d4-muted); font-size: 13px; }
.d4-shell .d4-seg button[aria-pressed=true] { background: var(--d4-surface); color: var(--d4-ink); box-shadow: 0 1px 3px rgba(32, 35, 41, .07); }
.d4-shell .kur-store { border-top: 0; margin-top: 22px; }
.kur-store-head { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.d4-shell .kur-store-head h3 { margin: 0; font-size: 20px; }
.kur-mono { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px; background: #e9edf4; color: #43546e; font-weight: 600; }
.d4-shell .kur-flow { display: none; margin: 0 0 0 auto; }
.d4-shell .kur-compare { gap: 24px; }
.d4-shell .kur-compare h4 { font-size: 16px; margin: 0 0 12px; }
.d4-shell .kur-compare .kj { border-left-width: 0; border-radius: 12px; box-shadow: none; padding: 16px 18px; margin-bottom: 12px; background: var(--d4-surface); }
.d4-shell .kur-compare .kj.whole { box-shadow: inset 4px 0 0 var(--d4-red); }
.d4-shell .kur-compare .kj.pos { box-shadow: inset 4px 0 0 var(--d4-amber); }
.d4-shell .kur-compare .receipt { box-shadow: inset 4px 0 0 var(--d4-success); }
.d4-shell .kj header { align-items: baseline; }
.d4-shell .kj-time { font: 620 20px/1.2 var(--display); letter-spacing: -.3px; }
.d4-shell .kj-time small { font-size: 12px; font-weight: 450; color: var(--d4-muted); margin-left: 4px; }
.d4-shell .kj-sum { font: 650 24px/1.2 var(--display); letter-spacing: -.5px; }
.d4-shell .kj .kjr { margin: 8px 0 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px; }
.d4-shell .kj-lines { margin-top: 10px; border-top: 1px solid var(--d4-line); padding-top: 8px; }
.d4-shell .kj-lines > summary { cursor: pointer; color: var(--d4-muted); font-size: 13px; padding: 4px 0; }
.d4-shell .kji li { font-size: 14.5px; padding: 6px 0; }
/* «До удаления чека убрали» — отдельный блок над составом (владелец 11.10) */
.d4-shell .kj-before { border: 0; border-left: 3px solid var(--d4-amber); background: var(--d4-amber-bg); border-radius: 0 12px 12px 0; padding: 4px 12px; }
.d4-shell .kj-before > summary { color: var(--d4-amber); font-weight: 600; }
.d4-shell .kcmp-btn { margin-top: 10px; min-height: 38px; color: var(--d4-blue); }
#kur-journal.kur-compact .kj { padding: 10px 14px; margin-bottom: 8px; }
#kur-journal.kur-compact .kj .kur-meta, #kur-journal.kur-compact .kj .kopen { font-size: 12px; margin: 2px 0; }
#kur-journal.kur-compact .kji li { padding: 3px 0; }   /* компактно — меньше воздуха, товарные строки не скрываются */
.d4-shell mark { background: #fff1b8; color: inherit; border-radius: 3px; padding: 0 1px; }
.kur-cmp { width: min(1080px, calc(100vw - 32px)); }
.cmp-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.d4-shell .cmp-cols h3 { margin: 0 0 8px; font-size: 15px; }
.cmp-cols section { background: var(--d4-bg); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.cmp-time { list-style: none; margin: 0; padding: 0; }
.cmp-time li { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid #e3e6eb; font-size: 14px; }
.cmp-time li:last-child { border-bottom: 0; }
@media (max-width: 1000px) { .d4-shell .kur-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 16px; }
  .d4-shell .kur-kpis .kpi:nth-child(2) { border-right: 0; margin-right: 0; } .cmp-cols { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .d4-shell .kur-flow { display: inline-flex; }
  .d4-shell .kur-store[data-flow=deleted] .kur-receipts, .d4-shell .kur-store[data-flow=receipts] .kur-deleted { display: none; }
  .kur-store-head { flex-wrap: wrap; }
  .d4-shell .kur-bar > button.primary { flex: 1 1 100%; }
  .d4-shell .kj-sum { font-size: 22px; }
}

/* ---------- вкладки разделов (.atabs: Оплаты/Акты…, Перепечатать/Проверка…) — подчёркивание, как в макете ---------- */
.d4-shell .atabs { gap: 24px; border-bottom: 1px solid #e3e6eb; margin: 0 0 20px; padding-bottom: 0; }
.d4-shell .atabs a { padding: 10px 0 12px; border-radius: 0; background: transparent; color: var(--d4-muted); font-weight: 520;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.d4-shell .atabs a:hover { color: var(--d4-ink); background: transparent; }
.d4-shell .atabs a.on { background: transparent; color: var(--d4-ink); font-weight: 620; border-bottom-color: var(--d4-blue); }

/* ---------- заголовки секций внутри страницы: меньше заголовка страницы, с воздухом сверху ---------- */
.d4-shell main h2 { font-size: 24px; letter-spacing: -.5px; margin: 32px 0 14px; }
.d4-shell main > h2:first-child, .d4-shell main > .atabs + h2, .d4-shell main > .atabs + p + h2 { margin-top: 6px; font-size: 30px; letter-spacing: -.85px; }

/* ---------- печать: только документ, без оболочки (как header.top/.sync в прежнем виде) ---------- */
@media print {
  .d4-header, .d4-sidebar, .d4-shell nav.d4-bottom, .d4-skip, .d4-dialog { display: none !important; }
  .d4-frame { display: block; max-width: none; }
  .d4-shell main { padding: 0; }
  html[data-design="d4"] body { background: #fff; }
}

/* поле выбора файла и подписи форм не шире карточки на телефоне */
.d4-shell .form > *, .d4-shell .form label { min-width: 0; }
.d4-shell input[type=file] { width: 100%; max-width: 100%; min-width: 0; padding: 8px; font-size: 14px; }

/* ---------- главная (app/home.py, templates/home.html) ---------- */
.home-date { margin: -10px 0 18px; font-size: 13px; }
.home-quick { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; background: var(--d4-surface); border-radius: 22px;
  padding: 10px; margin: 0 0 24px; }
.d4-shell .home-quick .btn { justify-content: flex-start; gap: 12px; border: 0; background: transparent; min-height: 56px; padding: 10px 14px;
  font-weight: 560; color: var(--d4-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d4-shell .home-quick .btn:hover { background: var(--d4-bg); }
.home-quick .btn .d4-ic { width: 40px; height: 40px; padding: 10px; border-radius: 12px; background: var(--d4-blue-soft); color: var(--d4-blue); }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 24px; align-items: start; margin-bottom: 24px; }
.d4-shell .home-grid .panel { padding: 24px 26px; }
.d4-shell .home-grid h3 { margin: 0 0 4px; font-size: 20px; }
.home-big { font: 620 44px/1.15 var(--display); letter-spacing: -1.6px; margin: 16px 0 6px; }
.home-big span { color: #848b94; font-weight: 420; font-size: .8em; }
.home-delta { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; }
.home-metrics { display: flex; flex-wrap: wrap; gap: 14px 32px; margin: 16px 0 6px; padding-top: 16px; border-top: 1px solid var(--d4-line); }
.home-metrics dt { color: var(--d4-muted); font-size: 12px; }
.home-metrics dd { margin: 2px 0 0; font-size: 17px; font-weight: 580; }
.home-sub { margin: 22px 0 6px; font-size: 13px; color: var(--d4-muted); font-weight: 520; }
.home-store, .home-task { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--d4-line);
  text-decoration: none; color: var(--d4-ink); }
.home-store:last-child, .home-task:last-of-type { border-bottom: 0; }
.home-mono { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; background: #e9edf4; color: #43546e; font-weight: 600; }
.home-store-name, .home-task-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.home-store-name small, .home-task-text small { font-size: 12px; overflow-wrap: anywhere; }
.home-store-sum { display: grid; justify-items: end; gap: 2px; font-size: 17px; }
.home-task-n { min-width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--d4-amber-bg);
  color: var(--d4-amber); font-weight: 650; }
.home-arrow { color: #9aa1ab; font-size: 22px; }
.home-store:hover, .home-task:hover { background: #fafbfc; }
.home-feed-list { list-style: none; margin: 14px 0 6px; padding: 0; display: grid; gap: 0; }
.home-feed-list li { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--d4-line); font-size: 13.5px; }
.home-feed-list li:last-child { border-bottom: 0; }
.home-feed-list li span:nth-child(2) { overflow-wrap: anywhere; }
.home-sync { margin-top: 4px; }
@media (max-width: 1190px) { .home-quick { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .home-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 6px; }
  .home-big { font-size: 36px; }
  .home-feed-list li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
@media (max-width: 760px) {   /* быстрые действия на телефоне — значок над подписью, как в мобильном макете */
  .home-quick { grid-template-columns: repeat(3, minmax(0, 1fr)); background: transparent; padding: 0; gap: 10px 4px; }
  .d4-shell .home-quick .btn { flex-direction: column; justify-content: flex-start; gap: 6px; min-height: 0; padding: 2px 1px;
    font-size: 10.5px; font-weight: 520; line-height: 1.25; white-space: normal; text-align: center; overflow: visible; }
  .home-quick .btn .d4-ic { width: 48px; height: 48px; padding: 13px; border-radius: 15px; background: var(--d4-surface); }
}

/* ---------- навигация внутри страниц: не зависит от analytics.css; app.css прячет любой <nav> на телефоне — возвращаем ---------- */
.d4-shell .atabs { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.d4-shell .atabs::-webkit-scrollbar { display: none; }
.d4-shell .atabs a { flex: none; text-decoration: none; white-space: nowrap; }
.d4-shell nav.d4-side { order: 0; flex-basis: auto; }
@media (max-width: 760px) {
  .d4-shell main nav { display: revert; order: 0; flex-basis: auto; }
  .d4-shell .atabs { display: flex; gap: 18px; }
  .d4-shell .d4-seg { display: inline-flex; }
}

/* ---------- каталог — табличный рабочий экран (макет catalog.js/refinement.css; правки Codex 11.10 п.6) ---------- */
.item-head { display: grid; grid-template-columns: var(--cols, minmax(0, 1fr) 104px 150px auto); column-gap: 18px; padding: 12px 20px;
  font-size: 12px; color: var(--d4-muted); border-bottom: 1px solid var(--d4-line); }
.item-head .c-buy, .item-head .c-retail, .item-head .c-stock { text-align: right; }
.d4-shell .items .item { grid-template-columns: var(--cols, minmax(0, 1fr) 104px 150px auto); column-gap: 18px; row-gap: 6px; align-items: center; }
.d4-shell .items .item .c-name { min-width: 0; }
.d4-shell .items .item .c-buy { text-align: right; color: var(--d4-muted); font-size: 14px; }
.d4-shell .items .item .c-stock { text-align: right; font-size: 15px; }
.d4-shell .items .item .c-stock small { color: var(--d4-muted); font-size: 11px; }
.d4-shell .items .item .price { min-width: 0; justify-self: end; text-align: right; }
.d4-shell .items .item .acts { grid-column: auto; flex-wrap: nowrap; justify-content: flex-end; }
.d4-shell .items .item .acts .cardbtn { min-width: 42px; padding: 0 12px; justify-content: center; font-size: 16px; }
/* раскладку выбирает app.js по ширине таблицы (#results[data-layout]) — правки Codex: проверено 1440/1366/1280/1024/820/768/390/320 */
#results[data-layout=mid] .item-head, .d4-shell #results[data-layout=mid] .item { grid-template-columns: var(--cols-n, minmax(0, 1fr) 96px 170px); }
.d4-shell #results[data-layout=mid] .item .acts { grid-column: 1 / -1; justify-content: flex-end; }
#results[data-layout=narrow] .item-head { display: none; }
.d4-shell #results[data-layout=narrow] .item { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px 16px; gap: 10px 14px; }
.d4-shell #results[data-layout=narrow] .item .c-name, .d4-shell #results[data-layout=narrow] .item .acts { grid-column: 1 / -1; }
.d4-shell #results[data-layout=narrow] .item .c-buy, .d4-shell #results[data-layout=narrow] .item .c-stock,
.d4-shell #results[data-layout=narrow] .item .price { justify-self: stretch; text-align: left; }
.d4-shell #results[data-layout=narrow] .item [data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--d4-muted); margin-bottom: 2px; }
.d4-shell #results[data-layout=narrow] .item .acts { justify-content: flex-start; flex-wrap: wrap; }
.d4-shell .items .item .addcart { white-space: nowrap; }

/* ---------- главная по макету: магазин, период и график, лента с темами, рабочее место, КУР (правки Codex 11.10 п.7) ---------- */
.home-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.home-head .d4-pagehead { margin-bottom: 18px; }
.d4-shell .home-store-pick select { min-height: 42px; border-radius: 12px; min-width: 180px; }
.home-sales-head, .home-feed-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.d4-shell .home-period { margin: 0; }
.d4-shell .home-period a { padding: 5px 12px; font-size: 12.5px; }
.home-chart { margin: 18px 0 4px; }
.home-chart figcaption { margin-bottom: 8px; }
.home-bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: end; gap: 6px; height: 120px;
  padding-bottom: 18px; position: relative; border-bottom: 1px solid var(--d4-line); }
.home-bar { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.home-bar i { display: block; width: 100%; max-width: 28px; height: var(--h); min-height: 0; border-radius: 6px 6px 2px 2px; background: #c9d9f5; }
.home-bar:hover i { background: var(--d4-blue); }
.home-bar small { position: absolute; bottom: -18px; font-size: 10px; color: var(--d4-muted); white-space: nowrap; }
.home-bar:nth-child(even) small { visibility: hidden; }
.d4-shell .home-topics { margin: 12px 0 2px; }
.home-work-list { list-style: none; margin: 12px 0 6px; padding: 0; }
.home-work-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--d4-line); }
.home-work-list li:last-child { border-bottom: 0; }
.home-work-list li > span:first-child { display: grid; gap: 2px; min-width: 0; }
.home-work-list small { font-size: 12px; }
.home-work-list .tag { white-space: nowrap; }
.d4-shell .home-kur-link { display: flex; align-items: center; gap: 16px; padding: 18px 22px; margin-bottom: 24px; text-decoration: none; color: var(--d4-ink); }
.home-kur-ic { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--d4-blue-soft); color: var(--d4-blue); }
.home-kur-text { flex: 1; display: grid; gap: 3px; }
.home-kur-text small { font-size: 13px; }
.home-kur-link .home-arrow { font-size: 14px; color: var(--d4-blue); }
@media (max-width: 760px) {
  .home-head { flex-direction: column; gap: 0; }
  .home-head .home-store-pick { margin: -8px 0 16px; }
  .home-bar:nth-child(3n+2) small, .home-bar:nth-child(3n) small { visibility: hidden; }
  .d4-shell .home-kur-link .home-arrow { display: none; }
}
/* app.css растягивает любой <nav> (flex: 1) — навигация внутри страниц занимает свою ширину */
.d4-shell main nav { flex: 0 1 auto; }
/* быстрые действия: подпись в две строки вместо обрезки */
.d4-shell .home-quick .btn { white-space: normal; line-height: 1.25; text-overflow: clip; }
.home-sales-head { flex-wrap: wrap; }
@media (max-width: 760px) { .d4-shell .d4-dot { top: -2px; right: -6px; } }
/* шапка телефона: корзина, колокольчик и профиль не наезжают друг на друга (владелец 11.10) */
@media (max-width: 760px) {
  .d4-actions { gap: 8px; }
  .d4-shell .d4-iconbtn { width: 38px; height: 38px; }
  .d4-shell .d4-dot { top: -4px; right: -4px; min-width: 16px; height: 16px; line-height: 16px; font-size: 10px; padding: 0 4px; border-width: 2px; }
}
@media (max-width: 760px) {   /* название и организации не заходят под значки шапки */
  .d4-brand .d4-name { min-width: 0; overflow: hidden; }
  .d4-brand .d4-name b, .d4-brand .d4-name small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* Панель действий над списком или документом — сверху и закреплена под шапкой
   (владелец 11.10: «кнопки наверх, внизу неудобно — приходится листать; все похожие кнопки во всех разделах наверх») */
.d4-shell .d4-actionbar { position: sticky; top: 72px; z-index: 6; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px;
  padding: 12px 16px; margin: 0 0 12px; background: var(--d4-surface); border: 1px solid var(--d4-line); border-radius: 16px;
  box-shadow: 0 8px 18px -14px rgba(32, 35, 41, .45); }
.d4-shell .d4-actionbar .grow { flex: 1 1 auto; }
@media (max-width: 760px) {
  .d4-shell .d4-actionbar { top: 64px; padding: 10px 12px; }
  .d4-shell .d4-actionbar > button, .d4-shell .d4-actionbar > .btn { flex: 1 1 auto; }
}
.d4-error h1 { font: 650 24px/1.2 var(--display); margin: 18px 0 8px; }
.d4-error .d4-error-acts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* ── Страницы разделов по макету D4 (правки дизайнера §8): шапка, фильтры, документ с колонкой «Оформление» ── */
.d4-shell .d4-back { display: inline-block; margin: 0 0 6px; color: var(--d4-muted); font-size: 13px; text-decoration: none; }
.d4-shell .d4-back:hover { color: var(--d4-blue); }
.d4-pagehead.acts { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.d4-head-acts { display: flex; gap: 10px; flex-wrap: wrap; }
.d4-pagehead h1 .tag { font: 560 13px/1.4 var(--sans, inherit); vertical-align: middle; letter-spacing: 0; }
.d4-shell .d4-docline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: -8px 0 14px; color: var(--d4-muted); font-size: 13.5px; }
.d4-shell .d4-listpanel { padding: 16px 18px; }
.d4-shell .d4-listpanel > .scroll { margin: 0 -18px -16px; }
.d4-shell .d4-filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; }
.d4-shell .d4-filterbar input[type="search"] { flex: 1 1 240px; min-width: 0; }
.d4-shell .d4-filterbar select { flex: 0 1 200px; min-width: 0; }
.d4-shell .d4-filterbar .d4-shown { margin-left: auto; white-space: nowrap; }
.d4-shell .tag.bad { background: var(--d4-red-bg); color: var(--d4-red); }
.d4-shell .note.warn { background: var(--d4-amber-bg); color: var(--d4-ink); }
.d4-shell .d4-actionbar .d4-bar-sep { width: 1px; align-self: stretch; background: var(--d4-line); margin: 0 2px; }
.d4-shell .d4-actionbar form.inline, .d4-shell .d4-actionbar label.chk { margin: 0; }
.d4-shell .d4-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 18px; align-items: start; }
.d4-shell .d4-cols > .panel { margin: 0; }
.d4-shell .d4-cols h2, .d4-shell .d4-doc-aside h2 { font: 600 16px/1.3 var(--display); margin: 0 0 10px; }
/* документ: строки слева, «Оформление» справа (закреплено); на узком экране — одной колонкой */
.d4-shell .d4-doc { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.d4-shell .d4-doc-main { min-width: 0; }
.d4-shell .d4-doc-main > .panel:first-child, .d4-shell .d4-doc-main > .scanbox { margin-top: 0; }
.d4-shell .d4-doc-aside { position: sticky; top: 88px; display: grid; gap: 14px; }
.d4-shell .d4-doc.with-bar .d4-doc-aside { top: 152px; }
.d4-shell .d4-doc-aside .panel { margin: 0; padding: 16px 18px; }
.d4-shell .d4-facts dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 12px; margin: 0; font-size: 14px; }
.d4-shell .d4-facts dt { color: var(--d4-muted); }
.d4-shell .d4-facts dd { margin: 0; text-align: right; font-weight: 520; overflow-wrap: anywhere; }
.d4-shell .d4-progress .d4-big { font: 650 30px/1.1 var(--display); margin: 0 0 10px; }
.d4-shell .d4-meter { height: 8px; border-radius: 99px; background: var(--d4-line); overflow: hidden; margin-bottom: 8px; }
.d4-shell .d4-meter i { display: block; height: 100%; background: var(--d4-success); border-radius: inherit; }
.d4-shell .d4-inline { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.d4-shell .d4-inline input { width: 90px; }
@media (max-width: 1100px) {
  .d4-shell .d4-doc { grid-template-columns: minmax(0, 1fr); }
  .d4-shell .d4-doc-aside { position: static; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
  .d4-shell .d4-doc.aside-first .d4-doc-aside { order: -1; }
}
/* бумажная накладная: фото и строки рядом; на телефоне — переключатель «Фото / Строки» (поля не перерисовываются) */
.d4-shell .d4-paper { display: grid; grid-template-columns: minmax(260px, 2fr) minmax(0, 3fr); gap: 18px; align-items: start; }
.d4-shell .d4-pane-photos { margin: 0; position: sticky; top: 152px; max-height: calc(100dvh - 168px); overflow: auto; }
.d4-shell .d4-pane-photos img { width: 100%; display: block; border-radius: 10px; margin-bottom: 8px; }
.d4-shell .d4-pane-lines { min-width: 0; }
.d4-shell .d4-pane-lines > .panel:first-child { margin-top: 0; }
.d4-shell .d4-panes-switch { display: none; }
@media (max-width: 1100px) {
  .d4-shell .d4-paper { grid-template-columns: minmax(0, 1fr); }
  .d4-shell .d4-pane-photos { position: static; max-height: none; }
}
@media (max-width: 760px) {
  .d4-shell .d4-panes-switch { display: inline-flex; margin-left: auto; }
  .d4-shell .d4-paper[data-panes="lines"] .d4-pane-photos, .d4-shell .d4-paper[data-panes="photos"] .d4-pane-lines { display: none; }
  .d4-shell .d4-filterbar select { flex: 1 1 140px; }
  .d4-shell .d4-filterbar .d4-shown { margin-left: 0; }
}
@media (min-width: 761px) { .d4-shell .d4-actionbar.d4-only-mobile { display: none; } }
.d4-shell .d4-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 10px; font-size: 14px; }
.d4-shell .d4-tools input { width: 90px; }
@media (max-width: 760px) {   /* панель действий на телефоне — во всю ширину, без скруглений: под ней не просвечивает текст */
  .d4-shell .d4-actionbar { margin-left: -16px; margin-right: -16px; border-radius: 0; border-width: 1px 0; }
}
.d4-shell .legend i { outline: 1px solid rgba(32, 35, 41, .18); }   /* квадратики легенды «вырастет / нет цены» видны на светлом фоне */
/* на телефоне в панели — главное действие и «Ещё ▾»; остальные (d4-sec) — по нажатию «Ещё» */
.d4-shell .d4-actionbar .d4-more-btn { display: none; }
@media (max-width: 760px) {
  .d4-shell .d4-actionbar .d4-more-btn { display: inline-flex; flex: 0 0 auto; }
  .d4-shell .d4-actionbar:not(.more-open) .d4-sec { display: none; }
  .d4-shell .d4-actionbar.more-open .d4-more-btn { background: var(--d4-hover); }
}
.d4-shell .form label.check { display: flex; flex-direction: row; align-items: center; gap: 8px; color: var(--d4-ink); }   /* галочка слева от подписи */
.d4-shell .form label.check input { width: auto; margin: 0; }
.d4-shell .draft-heading .draft-actions { border-top: 0; padding-top: 0; gap: 10px; }   /* «Отправить список» — в заголовке списка */
.d4-shell .d4-doctitle { font: 650 22px/1.25 var(--display); margin: 0 0 6px; }
.d4-shell .d4-actionbar .d4-grow-form { display: flex; flex: 1 1 auto; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; }
.d4-shell .d4-actionbar .d4-grow-form .grow { flex: 1 1 200px; min-width: 0; }
/* меню крупнее (владелец 11.10: «сделай покрупнее шрифт, чтоб было лучше видно») */
.d4-shell nav.d4-side a.d4-link { font-size: 16px; font-weight: 530; color: #2f3640; min-height: 46px; }
.d4-shell nav.d4-side a.d4-link .d4-ic { width: 22px; height: 22px; color: #5f6875; }
.d4-caption { font-size: 13px; font-weight: 560; margin: 8px 0 6px; }
.d4-shell .d4-count { font-size: 12.5px; line-height: 20px; }
/* итоги раздела — настоящие суммы (Финансы: оплаты, банк) */
.d4-shell .d4-sums { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 12px; margin: 0 0 18px; }
.d4-shell .d4-sums > div { background: var(--d4-surface); border-radius: 16px; padding: 14px 16px; display: grid; gap: 2px; }
.d4-shell .d4-sums span { color: var(--d4-muted); font-size: 13px; }
.d4-shell .d4-sums b { font: 650 22px/1.2 var(--display); letter-spacing: -.3px; }
.d4-shell .d4-sums small { color: var(--d4-muted); font-size: 12px; }
/* единая панель фильтров отчётов (Аналитика): одна строка над таблицей */
.d4-shell .d4-filterpanel { background: var(--d4-surface); border-radius: 16px; padding: 12px 16px; margin: 0 0 14px; }
.d4-shell .d4-filterpanel label { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.d4-shell .d4-filterpanel input[type="number"] { width: 76px; }
/* главная: возвратов больше продаж — красный столбец; «День / Неделя» — над графиком (Codex 11.10 п.1, п.6) */
.d4-shell .home-bar.neg i { background: var(--d4-red); opacity: .75; }
.d4-shell .home-chart-head { display: flex; justify-content: flex-end; margin: 0 0 6px; }
.d4-shell .home-store-pick label { color: var(--d4-muted); font-size: 13px; margin-right: 6px; }
@media (max-width: 760px) {   /* Codex 11.10 п.2: КУР на 721–760px — одна колонка в той же точке, где включаются потоки */
  .d4-shell .kur-compare { grid-template-columns: minmax(0, 1fr); }
}

/* 14.10.2026, владелец: «Принять поставку, Бумажная накладная, Списать товар, Переместить, Ценники, График, Все операции —
   только эти; сделай кнопки удобными в два ряда и ровными». На телефоне `.d4-shell main nav { display: revert }` (выше)
   перебивал сетку .home-quick — кнопки ложились строкой текста (3 + 4). Здесь та же область, точнее селектор: 4 равные
   колонки (7 действий = 2 ряда), значок 54px над подписью, подписи в одну-две строки на одной высоте. */
@media (max-width: 760px) {
  .d4-shell main nav.home-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 6px;
    background: transparent; padding: 0; margin: 2px 0 20px; overflow: visible; }
  .d4-shell main nav.home-quick .btn { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 7px;
    width: 100%; min-width: 0; min-height: 88px; padding: 0; border: 0; background: transparent; box-shadow: none;
    font-size: 11.5px; font-weight: 560; line-height: 1.22; white-space: normal; overflow: visible; text-align: center; color: var(--d4-ink); }
  .d4-shell main nav.home-quick .btn:hover { background: transparent; }
  .d4-shell main nav.home-quick .btn .d4-ic { flex: none; width: 54px; height: 54px; padding: 15px; border-radius: 16px;
    background: var(--d4-surface); border: 1px solid var(--d4-line); color: var(--d4-blue); }
}
