*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
input[type=number]{-moz-appearance:textfield;text-align:center}
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
input[type=number]:focus{-moz-appearance:auto}
input[type=number]:focus::-webkit-outer-spin-button,
input[type=number]:focus::-webkit-inner-spin-button{-webkit-appearance:auto}
/*
 * Размеры — на :root (совместимо с JS --site-header-offset на documentElement).
 * Палитра конструктора — только на .constructor-app (встроено в сайт), иначе :root
 * перебивает тёмную тему магазина на html и ломает шапку/футер на /sheet-constructor.
 * Автономный просмотр constructor.html: body:not(.constructor-page) ниже.
 */
:root{
  --header-h:48px;
  --toolbar-h:72px;
  --stats-h:28px;
  --site-header-offset:0px;
}
.constructor-app,
body:not(.constructor-page){
  --accent:#4a6cf7;--accent-hover:#3a5bd6;
  --bg:#f0f2f5;--card:#fff;--border:#e0e4ea;
  --text:#1a1d26;--muted:#6b7280;
  --radius:8px;--shadow:0 1px 3px rgba(0,0,0,.08);
  --green:#22c55e;--orange:#f59e0b;--red:#ef4444;
  --beige:#fdf6e3;
}
html,body{height:100%;overflow:hidden}
body:not(.constructor-page){font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:var(--bg);color:var(--text)}
body.constructor-page{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif}

/* ── Header ── */
.header{position:fixed;top:0;left:0;right:0;height:var(--header-h);background:#fff;border-bottom:1px solid var(--border);display:flex;align-items:center;padding:0 12px;gap:8px;z-index:100;box-shadow:var(--shadow)}
.header__title{font-weight:700;font-size:15px;white-space:nowrap}

/* ── Toolbar (fixed under header on desktop) ── */
.toolbar{
  position:fixed;top:var(--site-header-offset);left:0;right:0;height:var(--toolbar-h);
  background:#fff;border-bottom:1px solid var(--border);
  display:flex;align-items:center;justify-content:center;padding:0 12px;gap:10px;
  z-index:99;box-shadow:0 1px 2px rgba(0,0,0,.04);
  font-size:13px;white-space:nowrap;
}
.hdr-ctrl{display:flex;align-items:center;gap:4px;cursor:pointer;color:var(--text)}
.hdr-input{width:48px;text-align:center;border:1px solid var(--border);border-radius:4px;padding:4px 6px;font-size:13px}
.toolbar .btn-icon{width:44px;height:44px;font-size:18px}
.toolbar .btn-cart{min-height:44px;padding:8px 14px;font-size:13px}
/* W и A+✂ — те же 44×44, что и .toolbar .btn-icon */
.toolbar .mfooter-toggle-btn{
  width:44px;min-width:44px;height:44px;padding:0;margin:0;
}
.toolbar .mfooter-toggle--autotrim{
  width:44px;min-width:44px;height:44px;padding:1px 2px 2px;gap:0;
}
.toolbar .mfooter-autotrim__a{font-size:12px;font-weight:800;line-height:1;margin-bottom:0}
.toolbar .mfooter-autotrim__icon{font-size:15px;line-height:1}
.toolbar .mfooter-toggle--sepwhite .mfooter-toggle-w-text{font-size:28px}
.toolbar #headerSepWhite:checked+.mfooter-toggle--sepwhite .mfooter-toggle-w-text,
.toolbar #footerSepWhite:checked+.mfooter-toggle--sepwhite .mfooter-toggle-w-text{font-size:28px}
.toolbar .tech-bar-inline .tech-btn{padding:8px 14px;font-size:13px}

/* Кнопки-переключатели W / Авто триминг (десктоп + моб. футер; селекторы по id чекбоксов) */
.toolbar .mfooter-toggle-wrap{flex-shrink:0}
.mfooter-toggle-wrap{position:relative;display:flex;align-items:center;flex-shrink:0}
.mfooter-checkbox-hidden{
  position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);
  white-space:nowrap;border:0;opacity:0;pointer-events:none;
}
.mfooter-toggle-btn{
  box-sizing:border-box;min-width:36px;height:36px;padding:0 6px;margin:0;border:1px solid var(--border);
  border-radius:8px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:inline-flex;align-items:center;
  justify-content:center;font:inherit;line-height:1;transition:background .15s,color .15s,border-color .15s,box-shadow .15s;
  -webkit-tap-highlight-color:transparent;
}
.mfooter-toggle-btn:active{transform:scale(.96)}
#footerSepWhite:not(:checked)+.mfooter-toggle--sepwhite,
#headerSepWhite:not(:checked)+.mfooter-toggle--sepwhite{
  background:#e5e7eb;border-color:#d1d5db;color:#9ca3af;
  position:relative;overflow:hidden;
}
#footerSepWhite:not(:checked)+.mfooter-toggle--sepwhite::after,
#headerSepWhite:not(:checked)+.mfooter-toggle--sepwhite::after{
  content:'';
  position:absolute;left:50%;top:50%;z-index:1;
  width:2px;height:160%;
  background:rgba(107,114,128,.92);
  transform:translate(-50%,-50%) rotate(-45deg);
  border-radius:1px;pointer-events:none;
}
#footerSepWhite:checked+.mfooter-toggle--sepwhite,
#headerSepWhite:checked+.mfooter-toggle--sepwhite{
  background:#dcfce7;border-color:#4ade80;color:#15803d;font-weight:700;
  box-shadow:0 0 0 1px rgba(34,197,94,.25);
}
#footerSepWhite:checked+.mfooter-toggle--sepwhite .mfooter-toggle-w-text,
#headerSepWhite:checked+.mfooter-toggle--sepwhite .mfooter-toggle-w-text{font-size:28px}
.mfooter-toggle--sepwhite .mfooter-toggle-w-text{font-size:28px;font-weight:700;position:relative;z-index:0}

.mfooter-toggle--autotrim{flex-direction:column;gap:0;padding:2px 4px 3px;min-width:36px;justify-content:center}
.mfooter-autotrim__a{font-size:12px;font-weight:800;line-height:1;letter-spacing:.02em;margin-bottom:1px}
.mfooter-autotrim__icon{font-size:14px;line-height:1}
#footerAutoTrim:not(:checked)+.mfooter-toggle--autotrim,
#headerAutoTrim:not(:checked)+.mfooter-toggle--autotrim{
  background:#e5e7eb;border-color:#d1d5db;color:#9ca3af;position:relative;overflow:hidden;
}
#footerAutoTrim:not(:checked)+.mfooter-toggle--autotrim .mfooter-autotrim__a,
#headerAutoTrim:not(:checked)+.mfooter-toggle--autotrim .mfooter-autotrim__a{opacity:.85}
#footerAutoTrim:not(:checked)+.mfooter-toggle--autotrim::after,
#headerAutoTrim:not(:checked)+.mfooter-toggle--autotrim::after{
  content:'';
  position:absolute;left:50%;top:50%;z-index:1;
  width:2px;height:160%;
  background:rgba(107,114,128,.92);
  transform:translate(-50%,-50%) rotate(-45deg);
  border-radius:1px;pointer-events:none;
}
#footerAutoTrim:checked+.mfooter-toggle--autotrim,
#headerAutoTrim:checked+.mfooter-toggle--autotrim{
  background:#dcfce7;border-color:#4ade80;color:#15803d;
  box-shadow:0 0 0 1px rgba(34,197,94,.25);
}
#footerAutoTrim:checked+.mfooter-toggle--autotrim .mfooter-autotrim__a,
#headerAutoTrim:checked+.mfooter-toggle--autotrim .mfooter-autotrim__a{color:#15803d}

/* ── Stats bar (fixed under toolbar on desktop) ── */
.stats-bar{
  position:fixed;top:calc(var(--site-header-offset) + var(--toolbar-h));left:0;right:0;
  height:var(--stats-h);background:#f8f9fb;border-bottom:1px solid var(--border);
  display:flex;align-items:center;justify-content:center;
  padding:0 12px;z-index:98;
  font-size:13px;font-weight:700;color:var(--text);white-space:nowrap;overflow:hidden;
}
.stats-bar span{display:inline-flex;align-items:center;gap:3px;margin:0 8px}
.stats-bar span.stats-sep{
  display:inline-flex;align-items:center;justify-content:center;
  margin:0 2px;padding:0 1px;min-width:0;flex-shrink:0;
  color:var(--muted);font-weight:600;font-size:1.1em;line-height:1;user-select:none;
}
/* Встроенный конструктор: сводка только в .constructor-price-row; иначе fixed + top дают «лишнюю полосу» и сдвиг .main */
body.constructor-page .stats-bar{
  position:relative;top:auto;left:auto;right:auto;z-index:auto;
  height:auto;min-height:0;background:transparent;border:none;padding:0;
  box-shadow:none;overflow:visible;white-space:normal;
}

/* ── Tech bar (technology selection, visible on mobile under header) ── */
.tech-bar{
  display:none;
}
.tech-bar:empty{display:none!important}
.mobile-stats{display:none}

.btn{border:1px solid var(--border);border-radius:6px;padding:6px 12px;font-size:13px;cursor:pointer;font-weight:500;transition:all .15s,border-color .15s;white-space:nowrap;background:transparent;color:var(--text);box-sizing:border-box}
.btn:hover{background:#eef0f4;border-color:#cdd2dc}
.btn-primary{background:var(--primary,var(--accent));color:#fff;border-color:var(--primary,var(--accent))}
.btn-primary:hover{background:var(--primary-hover,var(--accent-hover));border-color:var(--primary-hover,var(--accent-hover))}
.btn-danger{color:var(--red)}
.btn-danger:hover{background:#fef2f2;border-color:#fecaca}
.btn-icon{width:32px;height:32px;padding:0;display:inline-flex;align-items:center;justify-content:center;font-size:16px}

/* ── Main Layout ── */
/* Первая колонка — листы: min 400px, иначе при сжатии окна превью сжималось сильнее колонки файлов (1fr). */
.main{
  display:grid;
  grid-template-columns:minmax(400px,30%) minmax(220px,1fr);
  height:calc(100vh - var(--toolbar-h) - var(--stats-h));
  margin-top:calc(var(--toolbar-h) + var(--stats-h));
}

/* ── Sheets Column ── */
.sheets-col{
  overflow-y:auto;
  padding:10px;
  background:#e8ebf0;
  display:flex;
  flex-direction:column;
  gap:10px;
  min-width:0;
}
.sheets-col::-webkit-scrollbar{width:6px}
.sheets-col::-webkit-scrollbar-thumb{background:#c0c5ce;border-radius:3px}
.sheet-card{background:#fff;border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden;flex-shrink:0}
.sheet-card__head{display:flex;align-items:center;padding:6px 10px;font-size:12px;font-weight:600;border-bottom:1px solid var(--border);gap:6px;cursor:default}
.sheet-card__title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:default}
.sheet-density{color:var(--muted);font-weight:400;cursor:pointer}
.sheet-manual-toggle{display:inline-flex;align-items:center;gap:4px;font-size:11px;font-weight:500;color:var(--muted);margin-left:auto;cursor:pointer;white-space:nowrap}
.sheet-manual-toggle input{margin:0;cursor:pointer}
.sheet-card.sheet-manual .sheet-manual-toggle{color:#1565c0}
.sheet-card.sheet-manual{box-shadow:0 0 0 1px rgba(21,101,192,.25),var(--shadow)}
.sheet-manual-head-actions{display:inline-flex;align-items:center;gap:4px}
.sheet-manual-head-btn{width:24px;height:24px;border:1px solid var(--border);border-radius:6px;background:#fff;color:var(--muted);display:flex;align-items:center;justify-content:center;padding:0;cursor:pointer}
.sheet-manual-head-btn:hover{border-color:var(--accent);color:var(--accent)}
.sheet-manual-head-btn:disabled{opacity:.45;cursor:not-allowed}
.sheet-manual-open.sheet-manual-open--on:not(:disabled){border-color:var(--green);background:#ecfdf5;color:var(--green)}
.sheet-manual-open.sheet-manual-open--on:not(:disabled):hover{border-color:#16a34a;background:#d1fae5;color:#15803d}

/* Ручная раскладка в шапке — скрывать только уже на очень узких экранах (< 500px) */
@media (max-width:499px){
  .sheet-manual-ui--wide-only{display:none!important}
}
.sheet-del{padding:2px 8px;font-size:14px;line-height:1;margin-left:auto}
.sheet-card__canvas-wrap{position:relative;width:100%;cursor:pointer;display:flex;align-items:center;justify-content:center;background:#f5f6f8}
.sheet-card__canvas-wrap canvas{display:block;width:100%}
.sheet-card__info{display:flex;flex-wrap:wrap;gap:6px 10px;padding:6px 10px;font-size:11px;color:var(--muted);cursor:pointer}
.empty-sheets{display:flex;align-items:center;justify-content:center;height:100%;color:var(--muted);font-size:13px;text-align:center;padding:20px;line-height:1.7}

/* ── Files Column ── */
.files-col{overflow-y:auto;padding:10px;display:flex;flex-direction:column;gap:8px;align-items:stretch;min-width:0}
.files-col::-webkit-scrollbar{width:6px}
.files-col::-webkit-scrollbar-thumb{background:#c0c5ce;border-radius:3px}
.files-col__cards{display:flex;flex-wrap:wrap;gap:8px;align-content:flex-start;min-width:0}

/* ── Drop Hint ── */
.drop-hint{width:100%;border:2px dashed var(--border);border-radius:var(--radius);padding:28px 12px;text-align:center;color:var(--muted);font-size:14px;cursor:pointer;transition:all .2s;flex-shrink:0}
.drop-hint:hover{border-color:var(--accent);color:var(--accent)}
.drop-hint input{display:none}
.drop-hint.compact{padding:8px 12px;font-size:12px}

/* ── File Card (vertical; как в эталонном конструкторе) ── */
.file-card{position:relative;display:flex;flex-direction:column;align-items:center;width:180px;min-height:252px;padding:10px 8px 8px;background:var(--card);border-radius:var(--radius);box-shadow:var(--shadow);border:2px solid transparent;transition:border-color .15s;text-align:center;gap:4px;flex-shrink:0;overflow:hidden;-webkit-user-select:none;user-select:none}
.file-card input[type=number],.file-card input[type=text]{-webkit-user-select:text;user-select:text}
.file-card.selected{border-color:var(--accent)}
.file-card.white-file{background:var(--beige)}
.file-card.oversize{border-color:var(--red);box-shadow:0 0 0 1px var(--red),var(--shadow)}
.file-card.oversize.selected{border-color:var(--accent);background:#fee2e2}
.file-card.can-add{background:#e8f5e9;border-color:#4caf50}
.file-card.can-add.selected{border-color:var(--accent)}
.file-card.duplicate{border-color:var(--orange)!important;border-width:3px!important;box-shadow:0 0 0 2px var(--orange),var(--shadow)!important;animation:dup-pulse .4s ease}
.file-card__remove{position:absolute;top:4px;right:4px;background:none;border:none;cursor:pointer;color:var(--muted);font-size:18px;line-height:1;padding:0 3px;z-index:1}
.file-card__remove:hover{color:var(--red)}
.file-card__preview{width:126px;height:126px;border-radius:4px;overflow:hidden;display:flex;align-items:center;justify-content:center;background:#f8f8f8;flex-shrink:0}
.file-card__preview img{max-width:100%;max-height:100%;object-fit:contain;display:block;-webkit-user-drag:none;pointer-events:none}
.file-card__name{font-size:11px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
.file-card__print-name{display:flex;align-items:center;gap:6px;margin:2px 0 4px;width:100%;min-width:0}
.file-card__print-name-input{flex:1;min-width:0;margin:0;padding:3px 6px;font-size:10px;font-weight:500;line-height:1.2;border:1px solid var(--border,#d1d5db);border-radius:4px;background:var(--input-bg,#fff);color:inherit}
.file-card__print-name-input::placeholder{color:var(--text-muted,#9ca3af);opacity:1}
.file-card__print-name-input:focus{outline:2px solid rgba(74,108,247,.35);outline-offset:0;border-color:rgba(74,108,247,.5)}
.file-card__print-name-toggle{display:flex;align-items:center;margin:0;flex-shrink:0;cursor:pointer}
.file-card__print-name-check{margin:0;width:15px;height:15px;cursor:pointer}
.file-card__size{font-size:13px;color:var(--muted);display:flex;align-items:center;gap:4px;justify-content:center}
.dpi-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}
.dpi-dot.green{background:var(--green)}
.dpi-dot.orange{background:var(--orange)}
.dpi-dot.red{background:var(--red)}
.file-card__alpha{min-height:24px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font-size:10px}
.alpha-badge{display:inline-block;font-size:12px;font-weight:600;line-height:1.25;padding:4px 10px;border-radius:999px;white-space:nowrap}
.alpha-badge--bg{background:rgba(244,67,54,.1);color:#c62828}
.alpha-badge--alpha{background:rgba(255,152,0,.1);color:#e65100}
.alpha-badge--empty{background:rgba(33,150,243,.1);color:#1565c0}
.alpha-badge--whitefill{background:#f3e8ff;color:#6b21a8}
.alpha-badge--crop{background:rgba(76,175,80,.15);color:#2e7d32}
.file-card__dims-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);
  grid-template-rows:auto auto;
  column-gap:6px;
  row-gap:3px;
  align-items:center;
  width:100%;
  font-size:12px;
  color:var(--muted);
}
.file-card__dims-hdr{display:block;text-align:center;font-size:12px;line-height:1.2;color:var(--muted)}
.file-card__dims-hdr[for]{cursor:pointer}
.file-card__dims-spacer{grid-column:2;grid-row:1}
.file-card__dims-hdr:nth-of-type(1){grid-column:1;grid-row:1}
.file-card__dims-hdr:nth-of-type(2){grid-column:3;grid-row:1}
.file-card__dims-row input[data-axis="w"]{grid-column:1;grid-row:2;width:100%;max-width:72px;justify-self:center}
.file-card__dims-row input[data-axis="h"]{grid-column:3;grid-row:2;width:100%;max-width:72px;justify-self:center}
.file-card__dims-sep{grid-column:2;grid-row:2;align-self:center;justify-self:center;font-size:13px;line-height:1;font-weight:600;color:var(--muted);padding:0 1px}
.file-card__dims-row input{
  padding:5px 5px;
  border:1px solid var(--border);
  border-radius:5px;
  font-size:13px;
  text-align:center;
  box-sizing:border-box;
}
.file-card__copies-row{display:flex;align-items:center;justify-content:center;gap:5px;font-size:13px;color:var(--muted)}
.file-card__copies-row input{
  width:58px;
  padding:5px 5px;
  border:1px solid var(--border);
  border-radius:5px;
  font-size:12px;
  text-align:center;
  box-sizing:border-box;
}
@keyframes file-card-haptic-kf{
  0%{transform:scale(1);box-shadow:var(--shadow)}
  35%{transform:scale(0.97);box-shadow:0 0 0 3px rgba(74,108,247,.35),var(--shadow)}
  100%{transform:scale(1);box-shadow:var(--shadow)}
}
.file-card.file-card--haptic{animation:file-card-haptic-kf .22s cubic-bezier(.34,1.56,.64,1)}
@media (prefers-reduced-motion:reduce){
  .file-card.file-card--haptic{animation:none;outline:2px solid var(--accent);outline-offset:2px}
}

/* ── Modal ── */
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.4);display:none;align-items:center;justify-content:center;z-index:200}
.modal-overlay.open{display:flex}
#manualEditorHotkeysModal.modal-overlay{z-index:2147483647}
.modal-overlay#infoModal{z-index:2147483647}
.modal-overlay#orderExcelPngGateModal{z-index:2147483646}
.order-excel-png-gate-modal h3{
  text-align:center;
  margin-top:0;
}
.order-excel-png-gate-modal__text{
  margin:0 0 18px;
  text-align:center;
  line-height:1.45;
  color:#444;
  font-size:.95rem;
}
.order-excel-png-gate-modal__actions{
  justify-content:center;
  flex-wrap:wrap;
  gap:10px;
}
.modal{background:#fff;border-radius:12px;padding:24px;width:380px;max-width:92vw;max-height:90vh;overflow-y:auto;box-shadow:0 8px 32px rgba(0,0,0,.18)}
.modal h3{font-size:16px;margin-bottom:16px}
.modal label{display:flex;flex-direction:column;gap:4px;font-size:13px;margin-bottom:12px}
.modal input[type=number],.modal input[type=color],.modal input[type=range]{padding:6px 8px;border:1px solid var(--border);border-radius:6px;font-size:13px;text-align:center}
.modal input[type=color]{height:36px;padding:2px;cursor:pointer}
.modal input[type=range]{padding:0}
.modal .row{display:flex;gap:10px}
.modal .row>label{flex:1}
.modal .check-row{flex-direction:row;align-items:center;gap:8px;cursor:pointer}
.modal .check-row input{width:auto}
.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}
.order-excel-png-gate-modal .modal-actions{justify-content:center}

/* ── Color Modal (compact) ── */
.color-modal .modal{width:min(400px,94vw);padding:14px 16px;display:flex;flex-direction:column;gap:0}
.color-modal .modal h3{font-size:14px;margin-bottom:10px;text-align:center}
.color-modal .modal label{margin-bottom:6px;font-size:11px;gap:2px}
.color-modal .modal .color-modal__row{display:flex;gap:12px;margin-bottom:8px}
.color-modal .modal .color-modal__row label{flex:1;margin-bottom:0}
.color-modal .modal .color-modal__sizes input[type=number]{width:100%;padding:6px 4px;border:1px solid var(--border);border-radius:4px;font-size:12px;text-align:center;box-sizing:border-box}
.color-modal .modal .color-modal__dpi-order-row{margin:0 0 10px;width:100%;box-sizing:border-box}
.color-modal .modal .color-modal__dpi-order-main{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:4px;
  width:100%;
  box-sizing:border-box;
}
.color-modal .modal .color-modal__dpi-order-labels-row{
  display:flex;
  flex-direction:row;
  align-items:flex-end;
  gap:8px;
  width:100%;
  box-sizing:border-box;
}
.color-modal .modal .color-modal__dpi-order-labels-row .color-modal__dpi-label-above{
  flex:0 0 60px;
  width:60px;
  min-width:60px;
  max-width:60px;
  margin:0;
  padding:0;
  font-size:9px;
  font-weight:600;
  color:var(--text,#1a1d26);
  line-height:1.15;
  text-align:center;
  cursor:pointer;
  word-break:break-word;
  hyphens:auto;
  box-sizing:border-box;
}
.color-modal .modal .color-modal__dpi-order-labels-row .color-modal__order-status{
  flex:1 1 0;
  min-width:0;
  margin:0;
  font-size:10px;
  line-height:1.35;
  color:var(--text,#1a1d26);
  word-break:break-word;
}
.color-modal .modal .color-modal__dpi-order-inline{
  display:flex;
  flex-direction:row;
  align-items:center;
  gap:8px;
  width:100%;
  box-sizing:border-box;
}
.color-modal .modal .color-modal__dpi-stack-fixed{
  flex:0 0 60px;
  width:60px;
  min-width:60px;
  max-width:60px;
  display:flex;
  flex-direction:row;
  align-items:center;
  justify-content:center;
  box-sizing:border-box;
}
.color-modal .modal .color-modal__dpi-input-tight{
  width:60px;
  min-width:60px;
  max-width:60px;
  height:32px;
  box-sizing:border-box;
  margin:0;
  padding:0 2px;
  border:1px solid var(--border);
  border-radius:6px;
  font-size:11px;
  text-align:center;
  line-height:1;
  -moz-appearance:textfield;
  appearance:textfield;
}
.color-modal .modal .color-modal__dpi-input-tight::-webkit-outer-spin-button,
.color-modal .modal .color-modal__dpi-input-tight::-webkit-inner-spin-button{margin:0;-webkit-appearance:none}
.color-modal .modal .color-modal__order-buttons{
  flex:1 1 0;
  min-width:0;
  display:flex;
  flex-direction:row;
  flex-wrap:nowrap;
  align-items:center;
  gap:6px;
  height:32px;
  box-sizing:border-box;
}
.color-modal .modal .color-modal__order-buttons .btn-small{
  height:32px;
  min-height:32px;
  padding:0 8px;
  font-size:11px;
  line-height:1;
  box-sizing:border-box;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.color-modal .modal .color-modal__order-buttons > .btn-small:not(.color-modal__btn-order-reset){
  flex:1 1 0;
  min-width:0;
}
.color-modal .modal .color-modal__order-buttons .color-modal__btn-order-reset{
  flex:0 0 32px;
  width:32px;
  min-width:32px;
  max-width:32px;
  height:32px;
  min-height:32px;
  padding:0;
  font-size:13px;
}
.color-modal .modal .color-modal__order-hint{font-size:10px;color:var(--muted,#666);line-height:1.45;margin:0;text-align:left}
.color-modal .modal .color-modal__zip-hint{margin-top:4px}
.color-modal .modal .color-modal__zip-hint--note{margin-top:2px;margin-bottom:2px}
.color-modal .modal .color-modal__zip-flags{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:stretch;gap:5px;margin:8px 0 10px;width:100%;box-sizing:border-box;overflow-x:auto;-webkit-overflow-scrolling:touch}
/* ZIP-флаги: целиковые блоки label с чекбоксом внутри (.is-checked синхронизируется в main.js) */
.color-modal .modal .color-modal__zip-flag-block{display:flex;flex-direction:column;align-items:center;justify-content:center;flex:1 0 0;min-width:90px;box-sizing:border-box;padding:10px 8px;border:2px solid #d1d5db;border-radius:10px;background:#f3f4f6;cursor:pointer;margin:0;text-align:center;transition:border-color .15s,background .15s,box-shadow .15s;position:relative}
.color-modal .modal .color-modal__zip-flag-checkbox{position:absolute;opacity:0;width:0;height:0;pointer-events:none}
.color-modal .modal .color-modal__zip-flag-content{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;position:relative;z-index:0}
.color-modal .modal .color-modal__zip-flag-line1{font-weight:600;font-size:12px;color:var(--text,#1a1d26)}
.color-modal .modal .color-modal__zip-flag-line2{font-size:10px;color:var(--muted,#666)}
.color-modal .modal .color-modal__zip-flag-block:not(.is-checked){overflow:hidden}
.color-modal .modal .color-modal__zip-flag-block:not(.is-checked)::after{
  content:'';
  position:absolute;
  inset:0;
  z-index:1;
  border-radius:inherit;
  pointer-events:none;
  opacity:.93;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cline x1='0' y1='100' x2='100' y2='0' stroke='%236b7280' stroke-width='3.5'/%3E%3C/svg%3E") no-repeat 50% 50% / 100% 100%;
}
.color-modal .modal .color-modal__zip-flag-block:not(.is-checked) .color-modal__zip-flag-line1,
.color-modal .modal .color-modal__zip-flag-block:not(.is-checked) .color-modal__zip-flag-line2{color:#9ca3af}
.color-modal .modal .color-modal__zip-flag-block:not(.is-checked):hover{border-color:#9ca3af;background:#eef2f7}
.color-modal .modal .color-modal__zip-flag-block.is-checked{border-color:#4ade80;background:#dcfce7;box-shadow:0 0 0 1px rgba(34,197,94,.25)}
.color-modal .modal .color-modal__zip-flag-block.is-checked .color-modal__zip-flag-line1{color:#15803d;font-weight:700}
.color-modal .modal .color-modal__zip-flag-block.is-checked .color-modal__zip-flag-line2{color:#166534}
.color-modal .modal .color-modal__zip-flag-block.is-checked:hover{border-color:#22c55e;background:#bbf7d0;box-shadow:0 0 0 1px rgba(34,197,94,.35)}
.color-modal .modal .color-modal__section-title{font-size:14px;font-weight:700;color:var(--text,#1a1d26);margin:10px 0 8px;text-align:center}
.color-modal .modal input[type=color]{height:28px;padding:1px;width:100%}
.color-modal .modal input[type=range]{margin-top:1px}
.color-modal .modal .modal-actions{margin-top:12px;justify-content:center}

/* Настройки размеров листа (#colorModal) — шире и крупнее (превью цветов — отдельный блок ниже) */
#colorModal.color-modal .modal{
  width:min(520px,96vw);
  padding:20px 22px;
  /* Вся форма по высоте контента — без полосы прокрутки внутри окна */
  max-height:none;
  overflow-y:visible;
}
#colorModal.color-modal .modal h3{font-size:18px;margin-bottom:14px}
#colorModal.color-modal .modal label{margin-bottom:8px;font-size:14px;gap:3px}
#colorModal.color-modal .modal .color-modal__row{gap:14px;margin-bottom:10px}
#colorModal.color-modal .modal .color-modal__sizes label{text-align:center}
#colorModal.color-modal .modal .color-modal__field-caption{display:block;line-height:1.2}
#colorModal.color-modal .modal .color-modal__field-caption-compact{display:none}
#colorModal.color-modal .modal .color-modal__sizes input[type=number]{padding:8px 6px;border-radius:6px;font-size:15px}
#colorModal.color-modal .modal .color-modal__dpi-order-row{margin:0 0 14px}
#colorModal.color-modal .modal .color-modal__dpi-order-main{gap:6px}
#colorModal.color-modal .modal .color-modal__dpi-order-labels-row{
  display:grid;
  grid-template-columns:72px minmax(0,1fr);
  gap:10px;
  align-items:end;
}
#colorModal.color-modal .modal .color-modal__dpi-order-labels-row .color-modal__dpi-label-above{
  flex:none;
  width:100%;
  min-width:0;
  max-width:none;
  margin-bottom:0;
  display:block;
  font-size:11px;
  line-height:1.25;
  text-align:center;
}
#colorModal.color-modal .modal .color-modal__dpi-order-labels-row .color-modal__order-status{
  font-size:13px;
  line-height:1.25;
  margin:0;
  padding:0;
}
#colorModal.color-modal .modal .color-modal__dpi-order-inline{gap:10px}
#colorModal.color-modal .modal .color-modal__dpi-stack-fixed{
  flex:0 0 72px;width:72px;min-width:72px;max-width:72px;
}
#colorModal.color-modal .modal .color-modal__dpi-input-tight{
  width:72px;min-width:72px;max-width:72px;height:38px;padding:0 4px;border-radius:8px;font-size:14px;
}
#colorModal.color-modal .modal .color-modal__order-buttons{gap:8px;height:38px}
#colorModal.color-modal .modal .color-modal__order-buttons .btn-small{
  height:38px;min-height:38px;line-height:1.15;
}
#colorModal.color-modal .modal .color-modal__order-buttons > .btn-small:not(.color-modal__btn-order-reset){
  font-size:clamp(7px,1.9vw + 0.22rem,13px);
  padding:0 clamp(4px,1.4vw,12px);
  white-space:nowrap;
}
#colorModal.color-modal .modal .color-modal__order-buttons .color-modal__btn-order-reset{
  flex:0 0 38px;width:38px;min-width:38px;max-width:38px;height:38px;min-height:38px;font-size:16px;padding:0;
}
#colorModal.color-modal .modal .color-modal__order-hint{font-size:13px;line-height:1.5}
#colorModal.color-modal .modal .color-modal__zip-hint{margin-top:6px}
#colorModal.color-modal .modal .color-modal__zip-hint--note{margin-top:4px;margin-bottom:4px}
#colorModal.color-modal .modal .color-modal__zip-flags{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  margin:10px 0 14px;
  overflow-x:visible;
}
#colorModal.color-modal .modal .color-modal__zip-flag-block{
  min-width:0;
  padding:12px 10px;
  border-radius:12px;
}
#colorModal.color-modal .modal .color-modal__zip-flag-content{min-width:0}
#colorModal.color-modal .modal .color-modal__zip-flag-line1{
  font-size:clamp(8px,2vw + 0.28rem,14px);
  line-height:1.2;
  white-space:nowrap;
}
#colorModal.color-modal .modal .color-modal__zip-flag-line2{
  font-size:clamp(6px,1.45vw + 0.22rem,11px);
  line-height:1.2;
  margin-top:3px;
  white-space:nowrap;
}
#colorModal.color-modal .modal .color-modal__section-title{font-size:17px;margin:14px 0 10px}
#colorModal.color-modal .modal .modal-actions{margin-top:16px}
/* «Цвет фона превью» — как на /constructor (color-settings-dialog): подпись над пипеткой, порог отдельным блоком */
#colorModal.color-modal .modal .color-modal__label-row{display:flex;gap:14px;margin-bottom:12px;align-items:flex-end;flex-wrap:wrap}
#colorModal.color-modal .modal .color-modal__label-row label{flex:1;min-width:140px}
#colorModal.color-modal .modal .color-modal__label-color{flex:0 0 auto;min-width:120px}
#colorModal.color-modal .modal .color-modal__preview-bg-row{display:flex;gap:14px;margin-bottom:0;align-items:stretch}
#colorModal.color-modal .modal label.color-modal__preview-bg-label{
  flex:1;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  margin-bottom:0;
  font-size:13px;
  font-weight:500;
  color:var(--text,#1a1d26);
}
#colorModal.color-modal .modal .color-modal__preview-bg-label-text{text-align:center;line-height:1.25}
/* Широкие «капсулы» выбора цвета (как в диалоге на /constructor) */
#colorModal.color-modal .modal .color-modal__preview-bg-label input[type=color]{
  display:block;
  width:100%;
  min-width:0;
  height:44px;
  min-height:44px;
  margin:0;
  padding:4px;
  box-sizing:border-box;
  border:1px solid var(--border,#ddd);
  border-radius:999px;
  background:var(--card,#fff);
  cursor:pointer;
  text-align:start;
  overflow:hidden;
}
#colorModal.color-modal .modal .color-modal__preview-bg-label input[type=color]::-webkit-color-swatch-wrapper{
  padding:0;
}
#colorModal.color-modal .modal .color-modal__preview-bg-label input[type=color]::-webkit-color-swatch{
  border:none;
  border-radius:999px;
}
#colorModal.color-modal .modal .color-modal__preview-bg-label input[type=color]::-moz-color-swatch{
  border:none;
  border-radius:999px;
}
#colorModal.color-modal .modal .color-modal__preview-bg-label input[type=color]:focus,
#colorModal.color-modal .modal .color-modal__preview-bg-label input[type=color]:focus-visible{
  outline:none !important;
  box-shadow:none !important;
}
#colorModal.color-modal .modal label.color-modal__threshold-label{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-top:14px;
  margin-bottom:0;
  font-size:14px;
  color:var(--text,#1a1d26);
}
#colorModal.color-modal .modal .color-modal__threshold-head{
  display:flex;
  align-items:baseline;
  justify-content:center;
  gap:8px;
  flex-wrap:nowrap;
}
#colorModal.color-modal .modal .color-modal__threshold-title{text-align:center;font-weight:600;font-size:14px;white-space:nowrap}
#colorModal.color-modal .modal .color-modal__threshold-value{text-align:center;font-weight:700;font-size:15px;white-space:nowrap}
#colorModal.color-modal .modal .color-modal__threshold-label input[type=range]{width:100%;margin-top:2px}
#colorModal.color-modal .modal .modal-actions .btn{
  min-height:44px;
  min-width:128px;
  padding:0 18px;
  font-size:15px;
  border-radius:10px;
}

/* Поверх окна «Обработка изображения» (200), ниже справки обрезки (210) */
#colorModal.modal-overlay{z-index:205}
#cropPreviewColorModal.modal-overlay{z-index:206}
#duplicateListModal.modal-overlay{z-index:420}
.crop-preview-color-modal .modal{position:relative;width:min(440px,94vw);max-height:85vh;overflow-y:auto}
.crop-preview-color-modal .modal h3{font-size:14px;margin-bottom:8px;text-align:center}
.crop-preview-color-modal__hint{font-size:11px;color:var(--muted);margin:0 0 10px;line-height:1.4;text-align:center}
.crop-preview-color-modal__grid{display:grid;grid-template-columns:repeat(12,1fr);gap:4px;margin:0 0 8px;width:100%;box-sizing:border-box}
.crop-prev-swatch{aspect-ratio:1;width:100%;min-height:0;padding:0;border:1px solid rgba(0,0,0,.12);border-radius:4px;cursor:pointer;box-sizing:border-box;-webkit-tap-highlight-color:transparent}
.crop-prev-swatch:hover{filter:brightness(1.06);z-index:1}
.crop-prev-swatch.selected{outline:2px solid var(--accent,#4a6cf7);outline-offset:1px;box-shadow:0 0 0 1px #fff}
.crop-preview-color-modal__details{width:100%;margin:0 0 4px;text-align:left}
.crop-preview-color-modal__summary{cursor:pointer;font-size:12px;font-weight:600;color:var(--accent,#4a6cf7);user-select:none;list-style:none;padding:6px 0}
.crop-preview-color-modal__summary::-webkit-details-marker{display:none}
.crop-preview-color-modal__details[open] .crop-preview-color-modal__summary{margin-bottom:0;color:var(--text,#1a1d26)}
.crop-preview-color-modal__native-hidden{position:absolute;left:0;bottom:0;width:1px;height:1px;padding:0;margin:0;overflow:hidden;clip:rect(0,0,0,0);clip-path:inset(50%);white-space:nowrap;border:0;opacity:0.001}
.crop-preview-color-modal__native-hidden input{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:default}

/* Модалка «Настройки цвета фона листа» в превью обрезки: ~+45% к базовому макету, кнопки по центру */
#cropPreviewColorModal.crop-preview-color-modal .modal{
  width:min(638px,96vw);
  padding:21px 24px;
  max-height:min(92vh,920px);
}
#cropPreviewColorModal.crop-preview-color-modal .modal h3{font-size:20px;margin-bottom:12px}
#cropPreviewColorModal .crop-preview-color-modal__hint{font-size:16px;margin:0 0 14px;line-height:1.45}
#cropPreviewColorModal .crop-preview-color-modal__grid{gap:6px;margin:0 0 12px}
#cropPreviewColorModal .crop-prev-swatch{border-radius:6px}
#cropPreviewColorModal .crop-preview-color-modal__details{margin:0 0 8px}
#cropPreviewColorModal .crop-preview-color-modal__summary{font-size:17px;padding:8px 0}
#cropPreviewColorModal.crop-preview-color-modal .modal .modal-actions.crop-preview-color-modal__actions{
  justify-content:center;
  gap:12px;
  margin-top:18px;
}

/* ── Drop Overlay ── */
.drop-overlay{position:fixed;inset:0;background:rgba(74,108,247,.15);border:3px dashed var(--accent);display:none;align-items:center;justify-content:center;font-size:22px;font-weight:700;color:var(--accent);z-index:250;pointer-events:none}
.drop-overlay.visible{display:flex}

/* ── Sheet fullscreen ── */
.sheet-fullscreen{position:fixed;inset:0;background:rgba(0,0,0,.92);display:none;align-items:center;justify-content:center;z-index:2147483647;cursor:pointer;overflow:hidden}
.sheet-fullscreen.visible{display:flex}
.sheet-fullscreen__wrap{display:flex;align-items:center;justify-content:center;cursor:default;flex-shrink:0;width:100vw;height:100vh;padding:0}
.sheet-fullscreen__wrap canvas{display:block;cursor:pointer;max-width:100vw;max-height:100vh;object-fit:contain}

/* ── Manual sheet editor overlay ── */
.sheet-manual-editor{
  position:fixed;inset:0;display:none;align-items:center;justify-content:center;
  background:rgba(10,12,18,.82);z-index:2147483646;touch-action:none;
  box-sizing:border-box;
  padding:max(10px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) max(10px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
}
.sheet-manual-editor.open{display:flex}
html.sheet-manual-editor--open{overflow:hidden;height:100%}
.sheet-manual-editor__workspace{
  display:flex;flex-direction:column;align-items:stretch;
  width:min(980px, 100%);
  min-width:0;
  max-width:100%;
  height:90vh;
  max-height:90vh;
  height:min(90vh, calc(100dvh - 20px));
  max-height:min(90vh, calc(100dvh - 20px));
  background:#fff;border-radius:10px;overflow:hidden;touch-action:auto;
  box-sizing:border-box;
}
.sheet-manual-editor__main{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column}
.sheet-manual-editor__metrics{
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto auto auto;
  align-items:center;
  gap:8px 10px;
  padding:10px 12px;
  background:#fff;
  border-bottom:1px solid var(--border);
  font-size:13px;
  font-weight:600;
  color:#334155;
  flex-shrink:0;
}
.sheet-manual-editor__metrics-head-btn{
  width:34px!important;
  min-width:34px!important;
  height:34px!important;
  padding:0!important;
  box-sizing:border-box;
  justify-self:start;
}
.sheet-manual-editor__metrics-head-actions{
  display:flex;
  align-items:center;
  gap:4px;
  justify-self:end;
  position:relative;
}
.sheet-manual-editor__metrics-head-add-wrap{display:flex;align-items:center}
.sheet-manual-editor__preview-bg-wrap{position:relative}
.sheet-manual-editor__preview-bg-popover{
  position:absolute;
  top:calc(100% + 6px);
  right:0;
  z-index:4;
  width:min(280px,calc(100vw - 24px));
  padding:12px 14px 14px;
  background:var(--card,#fff);
  color:var(--text,#1a1d26);
  border:1px solid var(--border);
  border-radius:10px;
  box-shadow:0 8px 24px rgba(15,23,42,.14);
  box-sizing:border-box;
}
.sheet-manual-editor__preview-bg-popover[hidden]{display:none!important}
.sheet-manual-editor__preview-bg-popover .color-modal__section-title{
  font-size:14px;
  margin:0 0 10px;
  text-align:center;
  color:var(--text,#1a1d26);
}
.sheet-manual-editor__preview-bg-popover .color-modal__preview-bg-row{display:flex;gap:12px;margin-bottom:0;align-items:stretch}
.sheet-manual-editor__preview-bg-popover label.color-modal__preview-bg-label{
  flex:1;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  margin-bottom:0;
  font-size:12px;
  font-weight:500;
  color:var(--muted,#6b7280);
}
.sheet-manual-editor__preview-bg-popover .color-modal__preview-bg-label-text{color:inherit}
[data-theme="dark"] :is(body.sheet-constructor-page,body.constructor-print-page) .sheet-manual-editor__preview-bg-popover{
  background:var(--card,#252525)!important;
  color:var(--text,#f5f5f5)!important;
  border-color:var(--border,#404040)!important;
  box-shadow:0 8px 32px rgba(0,0,0,.55);
}
[data-theme="dark"] :is(body.sheet-constructor-page,body.constructor-print-page) .sheet-manual-editor__preview-bg-popover .color-modal__section-title{
  color:var(--text,#f5f5f5)!important;
}
[data-theme="dark"] :is(body.sheet-constructor-page,body.constructor-print-page) .sheet-manual-editor__preview-bg-popover label.color-modal__preview-bg-label{
  color:var(--muted,#9ca3af)!important;
}
[data-theme="dark"] :is(body.sheet-constructor-page,body.constructor-print-page) .sheet-manual-editor__preview-bg-popover label.color-modal__preview-bg-label input[type=color]{
  background:var(--bg-secondary,#1e1e1e)!important;
  border-color:var(--border,#404040)!important;
}
.sheet-manual-editor__preview-bg-popover .color-modal__preview-bg-label-text{text-align:center;line-height:1.25}
.sheet-manual-editor__preview-bg-popover label.color-modal__preview-bg-label input[type=color]{
  display:block;
  width:100%;
  min-width:0;
  height:40px;
  min-height:40px;
  margin:0;
  padding:4px;
  box-sizing:border-box;
  border:1px solid var(--border,#ddd);
  border-radius:999px;
  background:var(--card,#fff);
  cursor:pointer;
}
.sheet-manual-editor__preview-bg-popover label.color-modal__preview-bg-label input[type=color]::-webkit-color-swatch-wrapper{padding:0}
.sheet-manual-editor__preview-bg-popover label.color-modal__preview-bg-label input[type=color]::-webkit-color-swatch{border:none;border-radius:999px}
.sheet-manual-editor__preview-bg-popover label.color-modal__preview-bg-label input[type=color]::-moz-color-swatch{border:none;border-radius:999px}
.sheet-manual-editor__preview-bg-popover label.color-modal__preview-bg-label input[type=color]:focus,
.sheet-manual-editor__preview-bg-popover label.color-modal__preview-bg-label input[type=color]:focus-visible{
  outline:none!important;
  box-shadow:none!important;
}
.sheet-manual-editor__btn-close{
  border:0!important;
  background:transparent!important;
  box-shadow:none!important;
  color:#dc2626!important;
}
.sheet-manual-editor__btn-close:hover{
  color:#b91c1c!important;
  background:rgba(220,38,38,.08)!important;
}
.sheet-manual-editor__btn-close i{font-size:18px;font-weight:700}
.sheet-manual-editor__metrics-inner{
  display:flex;
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
  gap:12px 16px;
  min-width:0;
  text-align:center;
  justify-self:center;
}
.sheet-manual-editor__metrics-settings-btn{
  justify-self:end;
}
.sheet-manual-editor__metrics-zoom{
  display:flex;
  align-items:center;
  gap:6px;
  flex-shrink:0;
  justify-self:end;
}
.sheet-manual-editor__metrics-zoom--desktop{display:flex}
.sheet-manual-editor__metrics-zoom-btn{
  width:34px!important;
  min-width:34px!important;
  height:34px!important;
  padding:0!important;
  box-sizing:border-box;
}
.sheet-manual-editor__metrics-zoom-btn i{font-size:14px}
.sheet-manual-editor__body{display:flex;align-items:stretch;min-height:0;min-width:0;flex:1}
.sheet-manual-editor__stage{flex:1;min-height:0;display:flex;flex-direction:column;overflow:auto;background:#e8eaed}
/* flex:1 здесь обрезал высоту контента до вьюпорта — вертикальный скролл не доходил до низа листа после «по ширине». */
.sheet-manual-editor__canvas-outer{flex:0 0 auto;align-self:flex-start;min-width:100%;min-height:100%;width:max-content;max-width:none;display:flex;align-items:center;justify-content:center;box-sizing:border-box;padding:8px}
.sheet-manual-editor__stage canvas{flex-shrink:0;display:block;max-width:none;max-height:none;border:1px solid rgba(255,255,255,.28);background:#fff}
.sheet-manual-editor__divider{width:1px;background:var(--border)}
.sheet-manual-editor__toolbar{
  --sheet-manual-toolbar-cell:48px;
  --sheet-manual-toolbar-group-gap-h:12px;
  --sheet-manual-toolbar-group-gap-v:8px;
  /* Шире пары кнопок (108px), чтобы в инпуты влезало 999.99 */
  --sheet-manual-toolbar-strip:134px;
  --sheet-manual-size-mid:18px;
  width:calc(var(--sheet-manual-toolbar-strip) + 24px);
  flex-shrink:0;
  align-self:stretch;
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:8px 4px;
  background:#fff;
  border-left:1px solid var(--border);
  overflow:hidden;
}
.sheet-manual-editor__toolbar-sizeplate{width:100%}
.sheet-manual-editor__toolbar-actions-flow{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  flex:1 1 auto;
  min-height:0;
  width:100%;
}
.sheet-manual-editor__toolbar-mobile-only{display:none!important}
/* Десктоп: прежний порядок групп (Дубль → … → Применить) при DOM в порядке «мобильной сетки» */
.sheet-manual-editor__toolbar-group--dup{order:2}
.sheet-manual-editor__toolbar-group--group{order:3}
.sheet-manual-editor__toolbar-group--layer{order:3.5}
.sheet-manual-editor__toolbar-group--distribute{order:4}
.sheet-manual-editor__toolbar-group--align-center{order:5}
.sheet-manual-editor__toolbar-group--align-v{order:6}
.sheet-manual-editor__toolbar-group--align-h{order:7}
.sheet-manual-editor__toolbar-group--undo{order:8}
.sheet-manual-editor__toolbar-group--folder{order:9}
.sheet-manual-editor__toolbar-group--apply{order:10;margin-top:auto}
.sheet-manual-editor__toolbar-actions-flow > .sheet-manual-editor__toolbar-zoom-dock{order:0}
.sheet-manual-editor__toolbar-group{
  display:grid;
  grid-template-columns:repeat(2,var(--sheet-manual-toolbar-cell));
  column-gap:var(--sheet-manual-toolbar-group-gap-h);
  row-gap:var(--sheet-manual-toolbar-group-gap-v);
  justify-content:center;
}
.sheet-manual-editor__toolbar-group:not(.sheet-manual-editor__toolbar-group--size){width:var(--sheet-manual-toolbar-strip);margin-left:auto;margin-right:auto}
.sheet-manual-editor__toolbar-group--size{grid-template-columns:1fr;justify-content:stretch;width:100%}
.sheet-manual-editor__toolbar .btn{width:var(--sheet-manual-toolbar-cell);min-width:var(--sheet-manual-toolbar-cell);height:var(--sheet-manual-toolbar-cell);display:inline-flex;align-items:center;justify-content:center;padding:0;white-space:nowrap}
.sheet-manual-editor__toolbar .btn i{font-size:16px}
.sheet-manual-editor__toolbar .btn i.sheet-manual-editor__toolbar-icon--r90{transform:rotate(90deg)}
.sheet-manual-editor__btn-ghost{border:0!important;background:transparent!important;box-shadow:none!important;color:#64748b}
.sheet-manual-editor__btn-ghost:hover{color:#0f172a;background:rgba(15,23,42,.06)!important}
.sheet-manual-editor__toolbar-add-wrap{width:100%;display:flex;justify-content:center;flex-shrink:0}
.sheet-manual-editor__toolbar .btn.sheet-manual-editor__toolbar-add-icon{
  width:var(--sheet-manual-toolbar-strip)!important;
  min-width:var(--sheet-manual-toolbar-strip)!important;
  max-width:var(--sheet-manual-toolbar-strip)!important;
  height:30px!important;
  min-height:30px!important;
  padding:0!important;
  box-sizing:border-box;
}
.sheet-manual-editor__toolbar-add-icon i{font-size:13px}
.sheet-manual-editor__toolbar-actions{margin-top:auto;display:flex;justify-content:center;width:100%;flex-shrink:0;padding-top:4px}
.sheet-manual-editor__toolbar-actions .btn.sheet-manual-editor__toolbar-apply-bottom{
  width:var(--sheet-manual-toolbar-strip);
  min-width:0;
  max-width:var(--sheet-manual-toolbar-strip);
  height:30px!important;
  min-height:30px!important;
  padding:0 10px!important;
  box-sizing:border-box;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  font-size:12px;
  font-weight:600;
}
.sheet-manual-editor__toolbar-actions .btn.sheet-manual-editor__toolbar-apply-bottom i{font-size:13px}
.sheet-manual-editor__size-controls{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:3px;
  padding:0;
  border:0;
  background:transparent;
  width:100%;
}
.sheet-manual-editor__size-labels{
  width:var(--sheet-manual-toolbar-strip);
  display:grid;
  grid-template-columns:1fr var(--sheet-manual-size-mid) 1fr;
  align-items:end;
  column-gap:1px;
  row-gap:2px;
  font-size:12px;
  font-weight:600;
  color:#475569;
  text-align:center;
  line-height:1.15;
  box-sizing:border-box;
}
.sheet-manual-editor__size-label-gap{pointer-events:none}
.sheet-manual-editor__size-inputs{
  width:var(--sheet-manual-toolbar-strip);
  display:grid;
  grid-template-columns:1fr var(--sheet-manual-size-mid) 1fr;
  align-items:center;
  column-gap:1px;
  row-gap:2px;
  box-sizing:border-box;
}
.sheet-manual-editor__size-inputs input{
  width:100%;
  min-width:0;
  height:28px;
  padding:0 3px;
  border:1px solid var(--border);
  border-radius:4px;
  font-size:11px;
  font-variant-numeric:tabular-nums;
  text-align:center;
  box-sizing:border-box;
  -moz-appearance:textfield;
  appearance:textfield;
}
.sheet-manual-editor__size-inputs input::-webkit-outer-spin-button,
.sheet-manual-editor__size-inputs input::-webkit-inner-spin-button{
  -webkit-appearance:none;
  margin:0;
}
.sheet-manual-editor__size-link{width:var(--sheet-manual-size-mid);min-width:var(--sheet-manual-size-mid);height:28px;margin:0;padding:0;border:0;background:transparent!important;box-shadow:none!important;border-radius:0;font-size:15px;font-weight:700;line-height:1;cursor:pointer;flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;font-family:inherit}
.sheet-manual-editor__size-link--on{color:#16a34a}
.sheet-manual-editor__size-link--off{color:#94a3b8}
.sheet-manual-editor__size-link:hover{color:#15803d}
.sheet-manual-editor__size-link--off:hover{color:#64748b}
.sheet-manual-editor__toolbar .btn.sheet-manual-editor__size-apply{
  width:var(--sheet-manual-toolbar-strip)!important;
  min-width:0!important;
  max-width:var(--sheet-manual-toolbar-strip)!important;
  height:auto;
  min-height:0;
  margin-top:1px;
  padding:3px 6px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  box-sizing:border-box;
  font-size:11px;
  font-weight:600;
  line-height:1.15;
  border-radius:4px;
}
.sheet-manual-editor__size-apply-icon{display:none;font-size:14px;line-height:1}

@media(max-width:768px){
  .sheet-manual-editor__workspace{
    width:100%;
    max-width:100%;
    min-width:0;
    height:min(94vh, calc(100dvh - 24px));
    max-height:min(94vh, calc(100dvh - 24px));
  }
  .sheet-manual-editor__metrics{
    grid-template-columns:auto minmax(0,1fr) auto auto;
    padding:8px 10px;
    gap:8px 10px;
    font-size:12px;
  }
  .sheet-manual-editor__metrics-zoom--desktop{display:none!important}
  .sheet-manual-editor__metrics-inner{
    width:100%;
    min-width:0;
    justify-self:stretch;
  }
  .sheet-manual-editor__metrics-head-btn{
    width:36px!important;
    min-width:36px!important;
    height:36px!important;
  }
  .sheet-manual-editor__body{flex-direction:column}
  .sheet-manual-editor__toolbar{border-left:0;border-top:1px solid var(--border)}
  .sheet-manual-editor__divider{width:auto;height:1px}
  /* Нижняя панель: слева Ш×В (высота = 2 ряда кнопок); справа 2 горизонтальные строки кнопок, пары идут столбцами */
  .sheet-manual-editor__toolbar{
    --sheet-manual-toolbar-cell:36px;
    --sheet-manual-toolbar-gap-row:6px;
    --sheet-manual-toolbar-gap-col:10px;
    /* Шире пары кнопок нижней панели — для 999.99 в полях Ш/В */
    --sheet-manual-sizeplate-w:132px;
    --sheet-manual-size-mid:16px;
    --sheet-manual-toolbar-rows-h:calc(var(--sheet-manual-toolbar-cell) * 2 + var(--sheet-manual-toolbar-gap-row));
    width:100%;
    flex-direction:row;
    flex-wrap:nowrap;
    align-items:flex-start;
    justify-content:center;
    gap:8px;
    padding:8px 10px calc(8px + env(safe-area-inset-bottom,0));
    overflow-x:auto;
    overflow-y:hidden;
    max-height:none;
    box-sizing:border-box;
    -webkit-overflow-scrolling:touch;
  }
  .sheet-manual-editor__toolbar-mobile-only{display:contents!important}
  .sheet-manual-editor__toolbar-sizeplate{
    flex:0 0 var(--sheet-manual-sizeplate-w);
    width:var(--sheet-manual-sizeplate-w);
    max-width:var(--sheet-manual-sizeplate-w);
    align-self:flex-start;
    height:var(--sheet-manual-toolbar-rows-h);
    display:flex;
    flex-direction:column;
    min-height:0;
    flex-shrink:0;
  }
  .sheet-manual-editor__toolbar-sizeplate .sheet-manual-editor__toolbar-group--size{
    flex:0 0 100%;
    height:100%;
    display:flex;
    flex-direction:column;
    min-height:0;
    width:100%;
    margin:0;
  }
  .sheet-manual-editor__toolbar-sizeplate .sheet-manual-editor__size-controls{
    flex:1 1 auto;
    width:100%;
    min-height:0;
    height:100%;
    justify-content:flex-start;
    gap:2px;
  }
  .sheet-manual-editor__toolbar-sizeplate .sheet-manual-editor__size-labels,
  .sheet-manual-editor__toolbar-sizeplate .sheet-manual-editor__size-inputs{
    width:100%;
    max-width:none;
  }
  .sheet-manual-editor__toolbar-sizeplate .sheet-manual-editor__size-labels{
    font-size:10px;
    font-weight:700;
    row-gap:0;
    line-height:1.1;
    align-items:end;
  }
  .sheet-manual-editor__toolbar-sizeplate .sheet-manual-editor__size-inputs input{
    height:22px;
    font-size:10.5px;
    font-variant-numeric:tabular-nums;
    padding:0 2px;
  }
  .sheet-manual-editor__toolbar-sizeplate .sheet-manual-editor__size-link{
    height:22px;
    font-size:13px;
    width:var(--sheet-manual-size-mid);
    min-width:var(--sheet-manual-size-mid);
  }
  .sheet-manual-editor__size-inputs input{height:30px;font-size:12px}
  .sheet-manual-editor__size-link{height:30px}
  .sheet-manual-editor__toolbar .btn.sheet-manual-editor__size-apply{
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    height:22px!important;
    min-height:22px!important;
    max-height:22px!important;
    margin-top:auto;
    margin-left:0;
    margin-right:0;
    padding:0 4px!important;
    font-size:9px!important;
    font-weight:700;
    border-radius:4px;
    line-height:1;
  }
  .sheet-manual-editor__size-apply-icon{display:none!important}
  .sheet-manual-editor__size-apply-label{display:inline!important}
  .sheet-manual-editor__toolbar-actions-flow{
    flex:0 0 auto;
    min-width:0;
    display:grid;
    grid-template-rows:var(--sheet-manual-toolbar-cell) var(--sheet-manual-toolbar-cell);
    grid-auto-flow:column;
    grid-auto-columns:var(--sheet-manual-toolbar-cell);
    column-gap:var(--sheet-manual-toolbar-gap-col);
    row-gap:var(--sheet-manual-toolbar-gap-row);
    height:var(--sheet-manual-toolbar-rows-h);
    width:max-content;
    align-content:start;
    justify-content:start;
    margin:0;
    overflow-x:auto;
    overflow-y:hidden;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior-x:contain;
  }
  .sheet-manual-editor__toolbar-actions-flow > .sheet-manual-editor__toolbar-group{display:contents}
  .sheet-manual-editor__toolbar-actions-flow > .sheet-manual-editor__toolbar-add-wrap{display:contents}
  .sheet-manual-editor__toolbar-actions-flow > .sheet-manual-editor__toolbar-actions{display:contents}
  .sheet-manual-editor__toolbar-actions-flow > .sheet-manual-editor__toolbar-zoom-dock,
  .sheet-manual-editor__toolbar-actions-flow > .sheet-manual-editor__toolbar-group,
  .sheet-manual-editor__toolbar-actions-flow > .sheet-manual-editor__toolbar-add-wrap,
  .sheet-manual-editor__toolbar-actions-flow > .sheet-manual-editor__toolbar-actions{order:unset;margin-top:unset}
  .sheet-manual-editor__toolbar .btn{
    width:var(--sheet-manual-toolbar-cell)!important;
    min-width:var(--sheet-manual-toolbar-cell)!important;
    height:var(--sheet-manual-toolbar-cell)!important;
    min-height:var(--sheet-manual-toolbar-cell)!important;
    box-sizing:border-box;
    border-radius:6px;
  }
  .sheet-manual-editor__toolbar .btn i{font-size:14px}
  .sheet-manual-editor__toolbar .btn.sheet-manual-editor__toolbar-add-icon{
    width:var(--sheet-manual-toolbar-cell)!important;
    min-width:var(--sheet-manual-toolbar-cell)!important;
    max-width:var(--sheet-manual-toolbar-cell)!important;
    height:var(--sheet-manual-toolbar-cell)!important;
    min-height:var(--sheet-manual-toolbar-cell)!important;
  }
  .sheet-manual-editor__toolbar-add-icon i{font-size:14px}
  .sheet-manual-editor__toolbar-actions .btn.sheet-manual-editor__toolbar-apply-bottom{
    width:var(--sheet-manual-toolbar-cell)!important;
    min-width:var(--sheet-manual-toolbar-cell)!important;
    max-width:var(--sheet-manual-toolbar-cell)!important;
    height:var(--sheet-manual-toolbar-cell)!important;
    min-height:var(--sheet-manual-toolbar-cell)!important;
    padding:0!important;
    gap:0;
    font-size:0;
  }
  .sheet-manual-editor__toolbar-actions .btn.sheet-manual-editor__toolbar-apply-bottom span{display:none!important}
  .sheet-manual-editor__toolbar-actions .btn.sheet-manual-editor__toolbar-apply-bottom i{font-size:15px}
}

/* ── Loading: centered overlay spinner (layout calc, file ops) ── */
.loading{
  position:fixed;inset:0;z-index:2147483000;
  display:none;align-items:center;justify-content:center;
  pointer-events:none;
}
.loading.active{display:flex}
.loading__overlay{
  position:absolute;inset:0;
  background:rgba(255,255,255,.55);
  backdrop-filter:blur(2px);
  -webkit-backdrop-filter:blur(2px);
}
.loading__spinner{
  position:relative;z-index:1;
  width:48px;height:48px;
  border:4px solid #e2e8f0;
  border-top-color:var(--accent,#005BFF);
  border-radius:50%;
  animation:layout-calc-spin .75s linear infinite;
}
@keyframes layout-calc-spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){
  .loading__spinner{animation-duration:1.2s}
}
[data-theme="dark"] .loading__overlay{background:rgba(15,23,42,.45)}
[data-theme="dark"] .loading__spinner{border-color:#334155;border-top-color:#60a5fa}

.layout-calc-status{color:var(--accent,#005BFF);font-weight:600;white-space:nowrap}
.layout-calc-status__sep{color:var(--text-secondary,#64748b);font-weight:400}
[data-theme="dark"] .layout-calc-status{color:var(--accent,#60a5fa)}

/* ── Toast ── */
.toast{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);background:var(--red,#ef4444);color:#fff;padding:16px 28px;border-radius:10px;font-size:14px;font-weight:600;line-height:1.6;text-align:center;box-shadow:0 6px 24px rgba(0,0,0,.3);z-index:400;opacity:0;pointer-events:none;transition:opacity .25s}
.toast.visible{opacity:1;pointer-events:auto}
.toast.toast-green{background:#43a047}
.toast.toast-orange{background:#f59e0b}
.toast.toast-session{background:#2563eb}
@keyframes dup-pulse{0%{transform:scale(1)}50%{transform:scale(1.04)}100%{transform:scale(1)}}
@media(max-width:768px){.toast{max-width:calc(100vw - 32px);padding:14px 16px}}

/* ── Swipe Indicator ── */
.swipe-indicator{
  position:fixed;left:0;width:40px;height:40px;border-radius:50%;
  background:var(--accent);color:#fff;font-size:22px;font-weight:700;
  display:flex;align-items:center;justify-content:center;
  transform:translateY(-50%);opacity:0;z-index:250;
  pointer-events:none;transition:opacity .15s,left .05s;
  box-shadow:0 2px 8px rgba(0,0,0,.2);
}
.swipe-indicator.triggered{background:var(--green);transform:translateY(-50%) scale(1.2)}

/* ── Mobile Footer ── */
.mobile-footer{display:none}

/* ── Page Footer (constructor) ── */
.page-footer{
  display:none;
  padding:16px;text-align:center;font-size:12px;color:var(--muted);
  background:#fff;border-top:1px solid var(--border);
}

/* ── Sheet Edit Buttons ── */
.sheet-edit-btns{display:none;align-items:center;gap:4px}
.sheet-edit-pencil,.sheet-edit-save{
  width:28px;height:28px;border-radius:6px;
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;font-size:15px;line-height:1;
  transition:all .15s;padding:0;box-sizing:border-box;
}
.sheet-edit-pencil{
  border:1px solid var(--border);background:transparent;color:var(--muted);
}
.sheet-edit-save{border:none;color:#fff;background:var(--green);display:none}
.sheet-card.sheet-editing .sheet-edit-pencil{color:var(--accent);background:rgba(74,108,247,.1);border-color:rgba(74,108,247,.35)}
.sheet-card.sheet-editing{box-shadow:0 0 0 2px var(--accent),var(--shadow)}
.sheet-card.sheet-dirty .sheet-edit-save{display:flex}
.sheet-card.sheet-dirty .sheet-edit-pencil{display:none}

/* ── Responsive: узкое окно (в т.ч. десктоп) — компактная вёрстка, нижняя панель в две строки ── */
@media(max-width:768px){
  html,body{height:auto;overflow-y:auto;overflow-x:hidden;margin:0;padding:0;width:100%}

  .toolbar{display:none!important}
  .stats-bar{display:none!important}
  .constructor-settings-bar{display:none!important}
  .constructor-price-row{display:none!important}

  body.constructor-page .constructor-app .main{
    margin-top:0!important;
    height:auto!important;
    max-height:none!important;
  }

  .tech-bar{
    display:flex;position:fixed;top:var(--site-header-offset);left:0;right:0;margin:0;padding:0 8px;
    width:100%;max-width:100%;box-sizing:border-box;
    height:48px;background:#fff;border-bottom:1px solid var(--border);
    align-items:center;gap:6px;z-index:97;
    overflow-x:auto;overflow-y:hidden;white-space:nowrap;
    -webkit-overflow-scrolling:touch;
  }
  .tech-bar::-webkit-scrollbar{display:none}
  .tech-btn{
    flex-shrink:0;padding:6px 14px;border:1px solid var(--border);border-radius:6px;
    background:#fff;cursor:pointer;font-size:12px;font-weight:500;transition:all .15s;
    white-space:nowrap;
  }
  .tech-btn:hover{background:#eef0f4;border-color:var(--accent)}
  .tech-btn.active{background:var(--accent);color:#fff;border-color:var(--accent)}

  .mobile-stats{
    position:fixed;top:var(--site-header-offset);left:0;right:0;margin:0;padding:0 8px;
    width:100%;max-width:100%;box-sizing:border-box;
    height:32px;background:#f8f9fb;border-bottom:1px solid var(--border);
    display:flex;align-items:center;justify-content:center;
    z-index:96;
    font-size:12px;font-weight:700;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  }
  .mobile-stats span{display:inline-flex;align-items:center;gap:2px;margin:0 4px}

  /* Конструктор: две строки статистики, не фикс. 32px */
  .mobile-stats.mobile-stats--constructor{
    height:auto!important;
    min-height:0;
    align-items:stretch!important;
    flex-direction:column!important;
    justify-content:center;
    white-space:normal!important;
    overflow:visible!important;
    text-overflow:clip;
    line-height:1.35;
    padding:6px max(12px, env(safe-area-inset-left)) 6px max(12px, env(safe-area-inset-right));
    gap:4px;
  }

  /* Вертикальная прокрутка страницы: файлы и листы идут столбцом, без деления экрана по высоте */
  .main{
    display:flex;flex-direction:column;
    margin:0;padding:0 0 124px 0;overflow:visible;
    height:auto;
    min-height:0;
    position:relative;
    z-index:0;
  }

  .files-col{
    order:-1;flex:0 0 auto;flex-shrink:0;overflow-x:visible;overflow-y:visible;
    flex-direction:column;flex-wrap:nowrap;padding:8px;margin:0;width:100%;max-width:100%;box-sizing:border-box;
  }
  .files-col__cards{
    display:flex;flex-direction:row;flex-wrap:nowrap;gap:8px;align-items:stretch;
    overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;
    scroll-snap-type:x mandatory;width:100%;max-width:100%;min-width:0;box-sizing:border-box;
  }
  .file-card{min-width:140px;scroll-snap-align:start}

  .drop-hint{width:100%;max-width:100%;min-width:0;margin:0;box-sizing:border-box;flex-shrink:0;scroll-snap-align:none}
  .drop-hint.compact{width:100%;max-width:100%;min-width:0;padding:8px 10px;font-size:11px;margin:0;writing-mode:horizontal-tb;line-height:1.3;text-align:center;white-space:normal}

  .sheets-col{
    flex:0 0 auto;
    min-height:0;
    overflow-x:auto;overflow-y:visible;flex-direction:row;
    align-items:stretch;
    scroll-snap-type:x mandatory;padding:8px;gap:8px;margin:0;
  }
  .sheet-card{
    min-width:280px;max-width:360px;width:360px;height:auto;max-height:none;
    display:flex;flex-direction:column;scroll-snap-align:center;flex-shrink:0;
  }
  /* Высота из JS (--konstruktor-sheet-canvas-max-h) = до нижнего дока, лист масштабируется в renderSheetCanvas */
  .sheet-card__canvas-wrap{
    flex:0 0 auto;
    width:100%;max-width:360px;
    height:var(--konstruktor-sheet-canvas-max-h, min(600px, calc(100dvh - 260px)));
    min-height:120px;
    max-height:var(--konstruktor-sheet-canvas-max-h, min(600px, calc(100dvh - 260px)));
    box-sizing:border-box;
    display:flex;align-items:center;justify-content:center;margin:0 auto;
    overflow:hidden;
  }
  .sheet-card__info{flex-shrink:0}

  .empty-sheets{
    display:flex;align-items:center;justify-content:center;
    width:100%;height:auto;min-height:200px;
    color:var(--muted);font-size:13px;text-align:center;padding:20px;line-height:1.7;
  }
  /* top:0 — липкость относительно колонки; z-index ниже .mobile-footer (100) */
  .sheet-limits-block{position:sticky;top:0;z-index:1}

  .mobile-footer{
    display:flex;flex-direction:column;position:fixed;bottom:0;left:0;right:0;
    height:auto;min-height:0;background:#fff;border-top:1px solid var(--border);
    align-items:stretch;justify-content:flex-end;
    padding:8px 10px calc(8px + env(safe-area-inset-bottom, 0px));gap:8px;z-index:100;
    box-shadow:0 -1px 4px rgba(0,0,0,.06);
  }
  .mfooter-top,.mfooter-row--tools{
    display:flex;align-items:center;justify-content:center;gap:6px 8px;flex-wrap:wrap;
    width:100%;min-width:0;
  }
  .mfooter-bottom,.mfooter-row--actions{
    display:flex;align-items:center;justify-content:center;flex-wrap:wrap;
    width:100%;min-width:0;gap:6px 8px;
  }
  .mfooter-ctrl{
    display:flex;align-items:center;gap:5px;font-size:14px;font-weight:500;line-height:1.2;
    color:var(--text);cursor:pointer;
  }
  .mfooter-input{
    width:48px;min-width:44px;min-height:36px;box-sizing:border-box;
    text-align:center;border:1px solid var(--border);border-radius:6px;
    padding:6px 4px;font-size:16px;line-height:1.2;
    -webkit-appearance:textfield;appearance:textfield;
  }
  .mfooter-input::-webkit-outer-spin-button,.mfooter-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
  .mobile-footer #footerCostPerM{width:60px;min-width:56px}
  /* W и A+✂ — те же 36×36, что и .mobile-footer .btn-icon */
  .mobile-footer .mfooter-toggle-btn{
    width:36px;min-width:36px;height:36px;padding:0;margin:0;
  }
  .mobile-footer .mfooter-toggle--autotrim{
    width:36px;min-width:36px;height:36px;padding:1px 2px 2px;gap:0;
  }
  .mobile-footer .mfooter-autotrim__a{font-size:11px;font-weight:800;line-height:1;margin-bottom:0}
  .mobile-footer .mfooter-autotrim__icon{display:block;flex-shrink:0;width:14px;height:14px}
  .mobile-footer .mfooter-toggle--sepwhite .mfooter-toggle-w-text{font-size:24px}
  .mobile-footer #footerSepWhite:checked+.mfooter-toggle--sepwhite .mfooter-toggle-w-text{font-size:24px}
  .mobile-footer .btn-icon{width:36px;height:36px;font-size:16px}
  .mobile-footer .btn-cart{min-height:36px;padding:6px 10px;font-size:12px}
  .mfooter-order-excel,
  .mfooter-pdf-to-png{
    flex-shrink:0;
    display:inline-flex;
    align-items:center;
    gap:4px;
    white-space:nowrap;
    min-height:36px;
    padding:6px 8px;
    font-size:11px;
    line-height:1.2;
    box-sizing:border-box;
  }
  .mfooter-order-excel .constructor-svg-icon,
  .mfooter-pdf-to-png .constructor-svg-icon{flex-shrink:0;width:16px;height:16px}

  /* Редактирование раскладки на превью (карандаш) на мобильном отключено — см. mobileEditIdx в render.js */
  .sheet-edit-btns{display:none!important}

  /* «Настройки размеров листа»: почти на всю ширину; body — выше специфичность, чем у .modal из style.css */
  body.constructor-page #colorModal.color-modal .modal{
    width:100%;
    max-width:min(98vw,calc(100vw - 32px));
    box-sizing:border-box;
  }
  /* Короткие подписи полей мм (узкий экран); ZIP-названия всегда полные */
  #colorModal.color-modal .modal .color-modal__field-caption-full{display:none!important}
  #colorModal.color-modal .modal .color-modal__field-caption-compact{display:inline!important}
}

/* Настройки горячих клавиш ручного редактора */
.manual-editor-hotkeys-modal.crop-help-modal{
  max-width:min(95vw,720px);
  width:100%;
  padding:12px 16px 16px;
}
.manual-editor-hotkeys-modal .crop-help-modal__head{
  margin-bottom:2px!important;
  padding:0!important;
  min-height:0;
}
.manual-editor-hotkeys-modal .crop-help-modal__title{
  line-height:1.2;
}
.manual-editor-hotkeys-modal__intro{
  margin:0 0 8px;
  font-size:12px;
  line-height:1.45;
  color:var(--muted,#6b7280);
}
.manual-editor-hotkeys-modal__body{
  max-height:min(52vh,420px);
  overflow-y:auto;
  padding-right:4px;
  margin:0 0 8px;
}
.manual-editor-hotkeys-modal__group{margin:0 0 12px}
.manual-editor-hotkeys-modal__group:last-child{margin-bottom:0}
.manual-editor-hotkeys-modal__group-title{
  margin:0 0 6px;
  font-size:11px;
  font-weight:700;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:var(--muted,#6b7280);
}
.manual-editor-hotkeys-modal__group-rows{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  column-gap:14px;
  row-gap:0;
}
.manual-editor-hotkeys-modal__row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  min-width:0;
  padding:5px 0;
  border-bottom:1px solid var(--border,#e5e7eb);
}
.manual-editor-hotkeys-modal__group-rows .manual-editor-hotkeys-modal__row:nth-last-child(-n+2){border-bottom:0}
.manual-editor-hotkeys-modal__label{
  flex:1;
  min-width:0;
  font-size:12px;
  font-weight:500;
  color:var(--text,#1a1d26);
}
.manual-editor-hotkeys-modal__bind{
  flex:0 0 auto;
  min-width:96px;
  max-width:48%;
  padding:5px 8px;
  font-size:12px;
  font-weight:600;
  font-family:inherit;
  text-align:center;
  color:var(--text,#1a1d26);
  background:var(--bg-secondary,#f3f4f6);
  border:1px solid var(--border,#d1d5db);
  border-radius:8px;
  cursor:pointer;
  transition:border-color .15s,background .15s,box-shadow .15s;
}
.manual-editor-hotkeys-modal__bind:hover{
  border-color:var(--primary,#2563eb);
  background:var(--card,#fff);
}
.manual-editor-hotkeys-modal__bind:focus-visible{
  outline:2px solid var(--primary,#2563eb);
  outline-offset:2px;
}
.manual-editor-hotkeys-modal__bind--recording{
  border-color:var(--primary,#2563eb);
  background:rgba(37,99,235,.08);
  color:var(--primary,#2563eb);
  animation:manual-editor-hotkey-pulse 1.2s ease-in-out infinite;
}
.manual-editor-hotkeys-modal__bind--conflict{
  border-color:#dc2626;
  background:rgba(220,38,38,.08);
  color:#b91c1c;
}
@keyframes manual-editor-hotkey-pulse{
  0%,100%{box-shadow:0 0 0 0 rgba(37,99,235,.25)}
  50%{box-shadow:0 0 0 4px rgba(37,99,235,.12)}
}
.manual-editor-hotkeys-modal__conflict{
  margin:0 0 8px;
  font-size:12px;
  color:#b91c1c;
}
.manual-editor-hotkeys-modal__actions{gap:8px}
[data-theme="dark"] :is(body.sheet-constructor-page,body.constructor-print-page) .manual-editor-hotkeys-modal__intro{
  color:var(--muted,#9ca3af);
}
[data-theme="dark"] :is(body.sheet-constructor-page,body.constructor-print-page) .manual-editor-hotkeys-modal__group-title{
  color:var(--muted,#9ca3af);
}
[data-theme="dark"] :is(body.sheet-constructor-page,body.constructor-print-page) .manual-editor-hotkeys-modal__label{
  color:var(--text,#f5f5f5);
}
[data-theme="dark"] :is(body.sheet-constructor-page,body.constructor-print-page) .manual-editor-hotkeys-modal__row{
  border-bottom-color:var(--border,#404040);
}
[data-theme="dark"] :is(body.sheet-constructor-page,body.constructor-print-page) .manual-editor-hotkeys-modal__bind{
  color:var(--text,#f5f5f5);
  background:var(--bg-secondary,#1e1e1e);
  border-color:var(--border,#404040);
}
[data-theme="dark"] :is(body.sheet-constructor-page,body.constructor-print-page) .manual-editor-hotkeys-modal__bind:hover{
  border-color:var(--primary,#60a5fa);
  background:var(--card,#252525);
}
[data-theme="dark"] :is(body.sheet-constructor-page,body.constructor-print-page) .manual-editor-hotkeys-modal__bind--recording{
  border-color:var(--primary,#60a5fa);
  background:rgba(96,165,250,.12);
  color:var(--primary,#93c5fd);
}
@media (max-width:560px){
  .manual-editor-hotkeys-modal__group-rows{grid-template-columns:1fr}
  .manual-editor-hotkeys-modal__group-rows .manual-editor-hotkeys-modal__row:nth-last-child(-n+2){border-bottom:1px solid var(--border,#e5e7eb)}
  .manual-editor-hotkeys-modal__group-rows .manual-editor-hotkeys-modal__row:last-child{border-bottom:0}
}

