/* Constructor-specific styles */

/* Button icons */
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* Прячем сайтовый футер, когда в конструктор загружены файлы. */
body.constructor-page.constructor-has-files .site-chrome--footer {
  display: none !important;
}

/* Модалка условий: кнопка «Понятно» строго по центру. */
body.constructor-page .system-work-terms-modal .crop-help-modal__actions {
  justify-content: center;
}

/* Обводка у иконок (триминг, палитра, обновление, скачать раскладку) и согласованный вид с основной кнопкой экспорта */
.btn-icon-outline {
  border: 1px solid var(--border);
  background: #fff;
  box-sizing: border-box;
}
.btn-icon-outline:hover {
  background: #eef0f4;
}
.toolbar .btn-icon.btn-trim--active,
.mobile-footer .btn-icon.btn-trim--active {
  border-color: var(--green);
  color: #15803d;
  background: #ecfdf5;
}
.toolbar .btn-icon.btn-trim--active:hover,
.mobile-footer .btn-icon.btn-trim--active:hover {
  background: #d1fae5;
  border-color: var(--green);
}
.toolbar .btn-icon.btn-mirror--active,
.mobile-footer .btn-icon.btn-mirror--active {
  border-color: var(--green);
  color: #15803d;
  background: #ecfdf5;
}
.toolbar .btn-icon.btn-mirror--active:hover,
.mobile-footer .btn-icon.btn-mirror--active:hover {
  background: #d1fae5;
  border-color: var(--green);
}
.toolbar .btn-success.btn-icon-outline,
.constructor-settings-bar .btn-success.btn-icon-outline,
.mobile-footer .btn-success.btn-icon-outline {
  border-color: var(--green);
  color: #15803d;
  background: #fff;
}
.toolbar .btn-success.btn-icon-outline:hover,
.constructor-settings-bar .btn-success.btn-icon-outline:hover,
.mobile-footer .btn-success.btn-icon-outline:hover {
  background: #ecfdf5;
}
.toolbar .btn-danger.btn-icon-outline,
body.constructor-page .constructor-settings-bar .btn-danger.btn-icon-outline,
body.constructor-page .mobile-footer .btn-danger.btn-icon-outline {
  border: 1px solid var(--red);
  border-color: var(--red);
  color: var(--red);
  background: #fff;
}
.toolbar .btn-danger.btn-icon-outline:hover,
body.constructor-page .constructor-settings-bar .btn-danger.btn-icon-outline:hover,
body.constructor-page .mobile-footer .btn-danger.btn-icon-outline:hover {
  background: #fef2f2;
  border-color: #d32f2f;
}

/* Очистить — красная обводка (как в /constructor); id перебивает синюю .constructor-settings-bar .btn */
body.constructor-page .constructor-settings-bar #btnClear,
body.constructor-page .mobile-footer #btnFooterClear {
  border: 1px solid #f44336;
  border-color: #f44336;
  color: #d32f2f;
  background: #fff;
}
body.constructor-page .constructor-settings-bar #btnClear:hover,
body.constructor-page .mobile-footer #btnFooterClear:hover {
  border-color: #d32f2f;
  background: #fef2f2;
  color: #c62828;
}
body.constructor-page .constructor-settings-bar #btnClear .constructor-svg-icon,
body.constructor-page .mobile-footer #btnFooterClear .constructor-svg-icon {
  color: inherit;
}

/* Drop hint */
.drop-hint__text {
  display: block;
  line-height: 1.5;
  white-space: normal;
}

.drop-hint__important {
  font-size: 2em;
  font-weight: 700;
  display: block;
  margin: 0.28em 0 0.06em;
  color: #c85a5a;
}

.drop-hint__link {
  display: inline-flex;
  align-items: center;
  color: #2563eb;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
  margin-top: 0.5em;
}

.drop-hint__link:hover {
  color: #1d4ed8;
}

.drop-hint__link svg {
  margin-left: 6px;
  flex-shrink: 0;
}

.drop-hint__copies {
  display: block;
  margin: 0.5em 0;
}

.drop-hint__copies-mobile {
  display: none;
}

@media (max-width: 768px) {
  .drop-hint__copies-desktop {
    display: none;
  }

  .drop-hint__copies-mobile {
    display: block;
  }
}

/* Export confirmation modal */
.export-confirm-modal {
  text-align: center;
  width: 750px;
  min-width: 550px;
  max-width: 92vw;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  max-height: 90dvh;
  overflow: hidden;
}

.export-confirm__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  line-height: 1.6;
}

.export-confirm__body--centered {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

.export-confirm__body--centered > * {
  width: 100%;
  box-sizing: border-box;
}

.export-confirm__text {
  margin-bottom: 1em;
}

.export-confirm__terms-link {
  color: #2563eb;
  font-weight: 700;
  text-decoration: underline;
}
.export-confirm__terms-link:hover {
  color: #1d4ed8;
}

.export-confirm__gap-agreed {
  text-align: center;
  margin: 0.5em 0 1em;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.4;
}

.export-confirm__edits-list,
.export-confirm__trim-list,
.export-confirm__dpi-list {
  margin: 0.5em 0;
  text-align: left;
  font-size: 13px;
}

.export-confirm__file-row {
  padding: 0.55em 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.45;
  text-align: left;
}

.export-confirm__file-row:last-child {
  border-bottom: none;
}

.export-confirm__mirror-warn {
  text-align: center;
  margin: 0 0 1em;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.35;
}

.export-confirm__attention {
  color: #c00;
  font-weight: 700;
  text-align: center;
  margin: 1em 0 0.5em;
}

.export-confirm__block {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 0.8em 0;
  text-align: left;
}

.export-confirm__block-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 0.5em;
  text-align: center;
}

.export-confirm__dpi-list {
  margin: 0;
}

.export-confirm__dpi-warn {
  margin-top: 1em;
  font-size: 13px;
}

.export-confirm__recommend {
  font-weight: 700;
}

.export-confirm__risks {
  margin-top: 1em;
  font-weight: 600;
  text-align: center;
}

.export-confirm__actions {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 1em;
  padding-top: 1em;
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 0px);
  border-top: 1px solid var(--border);
}

.export-confirm__actions .btn-small {
  font-size: 12px;
  padding: 5px 12px;
}

.export-confirm__replace {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  padding: 11px 26px;
  min-height: 44px;
  border: 2px solid var(--primary, #2563eb);
  border-radius: 8px;
  background: var(--bg-secondary, #fff);
  color: var(--primary, #2563eb);
  box-sizing: border-box;
}

.export-confirm__replace:hover {
  background: rgba(37, 99, 235, 0.1);
  border-color: #1d4ed8;
  color: #1d4ed8;
}

.export-confirm__submit {
  min-width: 160px;
  padding: 10px 24px;
}

.duplicate-list-modal {
  width: min(520px, 92vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  text-align: left;
}
.duplicate-list-modal__title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 12px;
  text-align: center;
  flex-shrink: 0;
}
.duplicate-list-modal__body {
  flex: 1;
  min-height: 0;
  max-height: min(60vh, 420px);
  overflow-y: auto;
  overflow-x: hidden;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--text, #1a1d26);
  border: 1px solid var(--border, #e0e4ea);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fafbfc;
}
.duplicate-list-modal__row {
  padding: 8px 0;
  border-bottom: 1px solid var(--border, #e0e4ea);
  word-break: break-word;
}
.duplicate-list-modal__row:last-child {
  border-bottom: none;
}
.duplicate-list-modal .modal-actions {
  flex-shrink: 0;
  margin-top: 12px;
}
.toast.toast-orange .toast-duplicate-btn {
  margin-top: 12px;
  font-weight: 600;
}
.toast.toast-green.toast-ack .toast-ack-actions {
  margin-top: 12px;
}
.toast.toast-green.toast-ack .toast-ack-btn {
  font-weight: 600;
  border: 2px solid #fff;
  background: rgba(255, 255, 255, 0.95);
  color: #2e7d32;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.toast.toast-green.toast-ack .toast-ack-btn:hover {
  background: #fff;
  color: #1b5e20;
  border-color: #fff;
}

.export-confirm__submit.btn--disabled,
.export-confirm__submit:disabled,
.export-confirm__submit[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Info modal */
.info-modal {
  text-align: center;
  max-width: 380px;
}

.info-modal.info-modal--wide {
  width: min(calc(92vw * 1.22), 928px);
  max-width: min(calc(92vw * 1.22), 928px);
}

.info-modal__text {
  line-height: 1.6;
  margin-bottom: 1em;
  white-space: pre-line;
  text-align: left;
}

.info-modal .modal-actions {
  justify-content: center;
}

/* Sheet limits block */
.sheet-limits-block {
  position: sticky;
  top: 0;
  /* Ниже фикс. нижней панели (.mobile-footer z-index:100) */
  z-index: 1;
  flex-shrink: 0;
  max-width: 100%;
  box-sizing: border-box;
  background: #f8f9fa;
  padding: 16px;
  border-radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: #333;
}
.sheet-limits-block__title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #1976d2;
  text-align: center;
}
.sheet-limits-block__body {
  margin-bottom: 0;
}
.sheet-limits-block__metrics {
  background: #fff;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 8px;
}
.sheet-limits-block__metrics-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.sheet-limits-block__hint {
  background: #e3f2fd;
  padding: 10px 12px;
  border-radius: 6px;
  margin: 8px 0;
}
.sheet-limits-block__meta {
  margin-top: 12px;
  font-size: 14px;
  color: #666;
  border-top: 1px solid #ddd;
  padding-top: 12px;
}
.sheet-limits-block__meta-line2 {
  margin-top: 4px;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .export-confirm-modal {
    width: min(96vw, calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 8px));
    min-width: 0;
    max-width: min(96vw, calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 8px));
    max-height: 96vh;
    max-height: 96dvh;
  }
}

/* Cart button - blue */
.btn-cart {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
  transition: all 0.2s;
  border: 1px solid #1e40af;
  box-sizing: border-box;
}
.btn-cart:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
  border-color: #1e3a8a;
}

@media (max-width: 768px) {
  .mobile-footer .btn-cart {
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 600;
  }
}

/* Green success button */
.btn-success {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
  border-color: #16a34a;
}
.btn-success:hover {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  border-color: #15803d;
}

.toolbar .hdr-ctrl--cost .hdr-input {
  width: 72px;
}

/* Crop modal */
.modal.crop-modal {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: min(96vh, 920px);
  width: 100%;
  max-width: min(96vw, 920px);
  text-align: center;
}
.crop-modal__head {
  position: relative;
  flex-shrink: 0;
  z-index: 6;
  padding: 16px 48px 12px 20px;
  margin: 0;
  text-align: center;
  background: #fff;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.crop-modal__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  padding: 0 8px;
}
.modal.crop-modal .crop-modal__title {
  margin-bottom: 0;
}
.crop-modal__help-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 50%;
  background: var(--bg-soft, #f4f5f7);
  color: var(--muted, #6b7280);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.crop-modal__head > .crop-modal__help-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}
.crop-modal__help-btn:hover {
  border-color: var(--accent, #4a6cf7);
  color: var(--accent, #4a6cf7);
  background: #fff;
}
.crop-modal__help-btn--close {
  position: static;
  transform: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 22px;
  font-weight: 400;
}
.crop-modal__help-btn--close:focus,
.crop-modal__help-btn--close:focus-visible {
  outline: none;
  box-shadow: none;
}
.crop-modal__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 20px 8px;
  text-align: center;
  -webkit-overflow-scrolling: touch;
}
/* Блочный overflow — иначе у flex-вьюпорта часто занижается scrollHeight, pan обрывается сверху/снизу. */
.crop-modal__viewport {
  position: relative;
  display: block;
  width: 100%;
  height: min(65vh, 640px);
  max-height: min(65vh, 640px);
  margin: 0 auto 12px;
  overflow: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  min-height: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.crop-modal__viewport.crop-modal__viewport--panning {
  cursor: grabbing;
}
/* Не меньше окна превью и не меньше картинки — корректные scrollWidth/scrollHeight; flex только внутри. */
.crop-modal__viewport-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 100%;
  width: max-content;
  min-height: 100%;
  height: max-content;
  box-sizing: border-box;
}
.crop-modal__zoom-inner {
  position: relative;
  display: block;
  flex: 0 0 auto;
}
.crop-modal__viewport img {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  user-select: none;
  pointer-events: none;
  vertical-align: top;
}
/* Сайт: img { max-width: 100% } — жёстко фиксируем превью, чтобы рамка обрезки совпадала с расчётом в JS */
body.constructor-page #cropModal img#cropImg {
  max-width: none !important;
}
.crop-modal__frame {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  box-sizing: border-box;
  border: 1px solid #52525b;
  box-shadow: none;
  cursor: move;
  touch-action: none;
}
.crop-modal__handle {
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fafafa;
  border: 1px solid #52525b;
  border-radius: 2px;
  z-index: 2;
  box-sizing: border-box;
}
.crop-modal__handle[data-h="nw"] { left: -8px; top: -8px; cursor: nwse-resize; }
.crop-modal__handle[data-h="ne"] { right: -8px; top: -8px; cursor: nesw-resize; }
.crop-modal__handle[data-h="sw"] { left: -8px; bottom: -8px; cursor: nesw-resize; }
.crop-modal__handle[data-h="se"] { right: -8px; bottom: -8px; cursor: nwse-resize; }
.crop-modal__footer {
  flex-shrink: 0;
  z-index: 6;
  margin: 0;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border, #e5e7eb);
  background: #fff;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
}
.crop-modal__footer-row--trim {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
}
.crop-modal__footer-left,
.crop-modal__footer-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}
.crop-modal__footer-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, #6b7280);
  margin-right: 2px;
}

#cropHelpModal.modal-overlay {
  z-index: 10501;
}
/* С шапкой сайта: тот же уровень, что в constructor/constructor.css — выше .site-chrome--header (10260) */
#constructorHelpModal.modal-overlay {
  z-index: 10503;
}
#systemWorkTermsModal.modal-overlay {
  z-index: 215;
}

.system-work-terms-modal__body p {
  margin: 0 0 12px;
}
.system-work-terms-modal__body p:last-child {
  margin-bottom: 0;
}

/*
 * В site style.css модалки показываются классом .active и по умолчанию имеют opacity:0/visibility:hidden.
 * Конструктор открывает окна классом .open — принудительно переопределяем видимость для его модалок.
 */
body.constructor-page #infoModal.modal-overlay,
body.constructor-page #exportConfirmModal.modal-overlay,
body.constructor-page #systemWorkTermsModal.modal-overlay,
body.constructor-page #colorModal.modal-overlay,
body.constructor-page #cropModal.modal-overlay,
body.constructor-page #cropHelpModal.modal-overlay,
body.constructor-page #constructorHelpModal.modal-overlay,
body.constructor-page #cropPreviewColorModal.modal-overlay,
body.constructor-page #duplicateListModal.modal-overlay,
body.constructor-page #orderExcelPngGateModal.modal-overlay,
body.constructor-page #manualEditorHotkeysModal.modal-overlay {
  opacity: 1;
  visibility: visible;
  transition: none;
}
body.constructor-page #infoModal.modal-overlay:not(.open),
body.constructor-page #exportConfirmModal.modal-overlay:not(.open),
body.constructor-page #systemWorkTermsModal.modal-overlay:not(.open),
body.constructor-page #cropModal.modal-overlay:not(.open),
body.constructor-page #cropHelpModal.modal-overlay:not(.open),
body.constructor-page #constructorHelpModal.modal-overlay:not(.open),
body.constructor-page #cropPreviewColorModal.modal-overlay:not(.open),
body.constructor-page #colorModal.modal-overlay:not(.open),
body.constructor-page #duplicateListModal.modal-overlay:not(.open),
body.constructor-page #orderExcelPngGateModal.modal-overlay:not(.open),
body.constructor-page #manualEditorHotkeysModal.modal-overlay:not(.open) {
  display: none !important;
  pointer-events: none;
}
body.constructor-page #infoModal.modal-overlay.open,
body.constructor-page #exportConfirmModal.modal-overlay.open,
body.constructor-page #systemWorkTermsModal.modal-overlay.open,
body.constructor-page #cropModal.modal-overlay.open,
body.constructor-page #cropHelpModal.modal-overlay.open,
body.constructor-page #constructorHelpModal.modal-overlay.open,
body.constructor-page #cropPreviewColorModal.modal-overlay.open,
body.constructor-page #colorModal.modal-overlay.open,
body.constructor-page #duplicateListModal.modal-overlay.open,
body.constructor-page #orderExcelPngGateModal.modal-overlay.open,
body.constructor-page #manualEditorHotkeysModal.modal-overlay.open {
  display: flex !important;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

/* «Настройки размеров листа»: окно по высоте контента; при нехватке места — прокрутка оверлея, не внутри .modal */
body.constructor-page #colorModal.modal-overlay.open {
  align-items: flex-start;
  justify-content: center;
  padding: calc(var(--site-header-offset, 0px) + max(10px, env(safe-area-inset-top, 0px))) 16px max(16px, env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* В редакторе ручной раскладки overlay имеет z-index 2147483646,
   поэтому справку и настройки горячих клавиш поднимаем выше. */
body.constructor-page #infoModal.modal-overlay,
body.constructor-page #manualEditorHotkeysModal.modal-overlay {
  z-index: 2147483647;
}

body.constructor-page #orderExcelPngGateModal.modal-overlay {
  z-index: 10508;
}

.toolbar .constructor-help-btn.crop-modal__help-btn {
  position: static;
  transform: none;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  font-size: 18px;
}

/* Скриншоты панели и строки статистики в «Справка: Конструктор печати…» */
.constructor-help-print-toolbar.crop-help-figure,
.constructor-help-toolbar-demo.crop-help-figure,
.constructor-help-statistics-line.crop-help-figure {
  margin: 0 0 14px;
  padding: 0;
  max-width: 100%;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  box-sizing: border-box;
}
/* Чуть уже модалки «Обработка изображения» (.modal.crop-modal: min(96vw, 920px)) */
.crop-help-modal {
  max-width: min(95vw, 880px);
  width: 100%;
  text-align: left;
  container-type: inline-size;
  container-name: crophelp;
}
.crop-help-modal__head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  padding: 0 40px;
  min-height: 36px;
}
.crop-help-modal__title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  flex: 1;
}
.crop-help-modal__head .crop-modal__help-btn--close {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}
.crop-help-modal .crop-help-clone .crop-modal__help-btn {
  position: static !important;
  right: auto !important;
  top: auto !important;
  transform: none !important;
}
.crop-help-modal__body {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text, #1a1d26);
  max-height: min(62vh, 520px);
  overflow-y: auto;
  padding-right: 4px;
}
.crop-help-modal__body ul {
  margin: 0 0 12px;
  padding-left: 1.15em;
  color: var(--muted, #4b5563);
}
.crop-help-modal__body li {
  margin-bottom: 6px;
}
.crop-help-modal__body li:last-child {
  margin-bottom: 0;
}
.crop-help-modal__body .crop-help-btn-img {
  height: 42px;
  width: auto;
  max-width: 100%;
  vertical-align: middle;
  margin: 0 6px 2px 0;
  object-fit: contain;
  display: inline-block;
}
.crop-help-modal__body .crop-help-btn-img--wide {
  height: auto;
  max-height: 52px;
  width: auto;
  max-width: min(100%, 300px);
  vertical-align: middle;
}
.crop-help-modal__body .crop-help-btn-img--field {
  height: auto;
  max-height: 36px;
  width: auto;
  max-width: min(100%, 260px);
  margin: 0 4px 3px 0;
}
.crop-help-modal__body .crop-help-btn-img--field-inline {
  max-height: 26px;
  max-width: 200px;
  margin: 0 3px 1px 0;
  vertical-align: text-bottom;
}
.crop-help-modal__sec .crop-help-figure + .crop-help-modal__h5 {
  margin-top: 12px;
}
.crop-help-modal__body .crop-help-btns-pair {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  vertical-align: middle;
  margin-right: 4px;
}
.crop-help-modal__body .crop-help-btns-pair .crop-help-btn-img {
  margin: 0 0 2px 0;
}
.crop-help-modal__ul--tight {
  margin-top: -4px !important;
}
.crop-help-modal__body li > .crop-help-modal__ul--tight {
  margin-top: 6px !important;
  margin-bottom: 4px;
}
.crop-help-modal__h5 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #1a1d26);
}
.crop-help-modal__sec--hotkeys .crop-help-modal__h5 {
  margin: 12px 0 6px;
}
.crop-help-modal__sec--hotkeys > .crop-help-modal__h5:first-of-type {
  margin-top: 4px;
}
.crop-help-modal__hotkeys-note {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted, #6b7280);
}
.crop-help-modal__sec--hotkeys > ul:last-of-type {
  margin-bottom: 0;
}

/* Превью в справке: скриншоты панелей (как раньше — рамка, max-height) */
.crop-help-visual {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.crop-help-figure {
  margin: 0 0 14px;
  padding: 0;
  min-width: 0;
}
.crop-help-figure img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 40px;
  object-fit: contain;
  object-position: left center;
  border-radius: 4px;
  border: 1px solid var(--border, #e5e7eb);
  box-sizing: border-box;
}
.constructor-help-print-toolbar.crop-help-figure img,
.constructor-help-toolbar-demo.crop-help-figure img,
.constructor-help-statistics-line.crop-help-figure img {
  max-height: none;
  width: 100%;
  height: auto;
  border-radius: 0;
  border: none;
}
.crop-help-img-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px dashed var(--border, #d1d5db);
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  vertical-align: middle;
}
.crop-help-img-fallback--wide {
  display: flex;
  width: 100%;
  min-height: 78px;
  padding: 12px;
  box-sizing: border-box;
}

.crop-help-badge-block {
  margin: 0 0 14px;
}
.crop-help-badge-block__line {
  margin: 0 0 10px;
  color: var(--muted, #4b5563);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.crop-help-badge-block__line:last-child {
  margin-bottom: 0;
}
.crop-help-badge-block__line .alpha-badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 7px;
  line-height: 1.35;
  vertical-align: text-bottom;
  white-space: nowrap;
}
.crop-help-badge-block .crop-help-btn-img--badge {
  height: 28px;
  width: auto;
  max-width: 100%;
  margin: 0 4px 0 2px;
  vertical-align: -6px;
  object-fit: contain;
}
.crop-help-modal__sec {
  margin-bottom: 16px;
}
.crop-help-modal__sec:last-child {
  margin-bottom: 0;
}
.crop-help-modal__sec h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text, #1a1d26);
}
.crop-help-modal__sec p {
  margin: 0 0 8px;
  color: var(--muted, #4b5563);
}
.crop-help-modal__sec p:last-child {
  margin-bottom: 0;
}
.crop-help-modal__actions {
  margin-top: 12px;
  justify-content: flex-end;
}

/* Кнопка обрезки — угол карточки (как × справа), не внутри превью */
.file-card__crop {
  position: absolute;
  z-index: 2;
  top: 4px;
  left: 4px;
  width: 28px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border, #e0e4ea);
  border-radius: 6px;
  background: #fff;
  color: var(--text, #1a1d26);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
}
.file-card__crop svg {
  display: block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  pointer-events: none;
}
.file-card__crop:hover {
  border-color: var(--accent, #4a6cf7);
  color: var(--accent, #4a6cf7);
}
.file-card--cropped .file-card__crop {
  border-color: #22c55e;
  background: #e8f5e9;
  color: #2e7d32;
}

.file-card__mirror {
  position: absolute;
  z-index: 2;
  top: 34px;
  left: 4px;
  width: 28px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border, #E0E0E0);
  border-radius: 6px;
  background: #fff;
  color: var(--text, #1a1a1a);
  opacity: 1;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
}
.file-card__mirror svg {
  display: block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  pointer-events: none;
}
.file-card__mirror:hover {
  border-color: var(--primary, #005BFF);
  color: var(--primary, #005BFF);
}
.file-card--flipped .file-card__mirror {
  border-color: #22c55e;
  background: #e8f5e9;
  color: #2e7d32;
}

@media (max-width: 768px) {
  .crop-modal__viewport {
    height: 50vh;
    max-height: 50vh;
  }
  .crop-modal__footer-row--trim {
    flex-direction: column;
    align-items: stretch;
  }
  .crop-modal__footer-left,
  .crop-modal__footer-right {
    justify-content: flex-start;
  }
  .mobile-footer .constructor-help-btn.crop-modal__help-btn {
    position: static;
    transform: none;
    flex-shrink: 0;
    /* размер и шрифт как у кнопки в панели — задаётся в constructor/constructor.css для .btn.btn-icon */
  }

  /* Мобильный информер: две строки, ~90% ширины (локальная копия без body.constructor-page) */
  .mobile-stats.mobile-stats--constructor {
    position: fixed;
    top: var(--constructor-top, var(--site-header-offset, 0px));
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    z-index: 10218;
    min-height: 0;
    height: auto;
    box-sizing: border-box;
    padding: 6px max(12px, env(safe-area-inset-left)) 6px max(12px, env(safe-area-inset-right));
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: center;
    gap: 4px;
    background: var(--bg-secondary, #fafafa);
    border-bottom: 1px solid var(--border, #e0e0e0);
    font-size: clamp(11px, 2.9vw, 14px);
    font-weight: 700;
    color: var(--text, #1a1a1a);
    overflow: visible;
    text-align: center;
    line-height: 1.35;
    white-space: normal;
  }
  .mobile-stats.mobile-stats--constructor .mobile-stats__row {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-left: 0;
    margin-right: 0;
    padding: 0;
    text-align: center;
    box-sizing: border-box;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
}

/* Тосты: типы session / oversize (предсказуемый фон поверх базового .toast) */
.toast.toast-session {
  background: #e8eef5;
  color: #1e293b;
  border: 1px solid #cbd5e1;
  font-weight: 500;
}
.toast.toast-oversize {
  background: #fde8e8;
  color: #5c2222;
  border: 1px solid #e8b8b8;
  font-weight: 500;
}

/*
 * Демо-кнопки как в туре (constructor/js/tour.js), но в модалке справки нет
 * .constructor-driver-popover — дублируем ключевые правила под #constructorHelpModal.
 */
#constructorHelpModal .crop-help-pseudo-field {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 26px;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border, #e0e4ea);
  border-radius: 6px;
  background: var(--bg-secondary, #f4f4f8);
  color: var(--text, #1a1d26);
  vertical-align: middle;
  box-sizing: border-box;
}
#constructorHelpModal .constructor-tour-demo-toggle-pair {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  vertical-align: middle;
  margin-right: 4px;
}
#constructorHelpModal .constructor-tour-demo-toggle-pair__item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
#constructorHelpModal .constructor-tour-demo-toggle-label {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  line-height: 1;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}
#constructorHelpModal .constructor-tour-demo-toggle {
  pointer-events: none;
  user-select: none;
  cursor: default;
  flex-shrink: 0;
  font-family: inherit;
}
#constructorHelpModal .constructor-tour-demo-toggle--w-off {
  position: relative;
  overflow: hidden;
  min-width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  background: #e0e0e0;
  color: #999;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  box-sizing: border-box;
}
#constructorHelpModal .constructor-tour-demo-toggle--w-off::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 2px;
  height: 160%;
  background: rgba(0, 0, 0, 0.55);
  transform: translate(-50%, -50%) rotate(-45deg);
  border-radius: 1px;
  pointer-events: none;
}
#constructorHelpModal .constructor-tour-demo-toggle--w-on {
  position: relative;
  overflow: hidden;
  min-width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #4caf50;
  background: rgba(76, 175, 80, 0.15);
  color: #2e7d32;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  box-sizing: border-box;
  box-shadow: 0 0 0 1px rgba(76, 175, 80, 0.25);
}
#constructorHelpModal .constructor-tour-demo-w-text {
  font-size: 28px;
  font-weight: 700;
  font-family: inherit;
  position: relative;
  z-index: 0;
  line-height: 1;
}
#constructorHelpModal .constructor-tour-demo-toggle--w-on .constructor-tour-demo-w-text {
  color: #2e7d32;
}
#constructorHelpModal .constructor-tour-demo-toggle--autotrim-off {
  position: relative;
  overflow: hidden;
  flex-direction: column;
  gap: 0;
  padding: 2px 4px 3px;
  min-width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  background: #e0e0e0;
  color: #999;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  box-sizing: border-box;
}
#constructorHelpModal .constructor-tour-demo-toggle--autotrim-off::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 2px;
  height: 160%;
  background: rgba(0, 0, 0, 0.55);
  transform: translate(-50%, -50%) rotate(-45deg);
  border-radius: 1px;
  pointer-events: none;
}
#constructorHelpModal .constructor-tour-demo-toggle--autotrim-on {
  position: relative;
  overflow: hidden;
  flex-direction: column;
  gap: 0;
  padding: 2px 4px 3px;
  min-width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #4caf50;
  background: rgba(76, 175, 80, 0.15);
  color: #2e7d32;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  box-sizing: border-box;
  box-shadow: 0 0 0 1px rgba(76, 175, 80, 0.25);
}
#constructorHelpModal .constructor-tour-demo-autotrim__a {
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  margin-bottom: 1px;
  opacity: 0.85;
  position: relative;
  z-index: 0;
}
#constructorHelpModal .constructor-tour-demo-toggle--autotrim-on .constructor-tour-demo-autotrim__a {
  color: #2e7d32;
  opacity: 1;
}
#constructorHelpModal .constructor-tour-demo-toggle--autotrim-off svg,
#constructorHelpModal .constructor-tour-demo-toggle--autotrim-on svg {
  position: relative;
  z-index: 0;
  flex-shrink: 0;
  display: block;
  width: 14px;
  height: 14px;
}
#constructorHelpModal .constructor-tour-demo-btn {
  pointer-events: none;
  user-select: none;
  cursor: default;
  flex-shrink: 0;
  font-family: inherit;
}
#constructorHelpModal .constructor-tour-demo-btn--cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border-radius: 8px;
  line-height: 1.2;
  color: #fff !important;
  border: 1px solid rgba(0, 91, 255, 0.5);
  background: linear-gradient(135deg, #005bff 0%, #005bff 100%);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}
#constructorHelpModal .constructor-tour-bar-btn-demo.btn.btn-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  border-radius: 8px;
  border: 1px solid rgba(0, 91, 255, 0.35);
  box-sizing: border-box;
  background: #fff;
  color: #1a1a1a;
  vertical-align: middle;
  pointer-events: none;
  user-select: none;
  flex-shrink: 0;
  cursor: default;
}
#constructorHelpModal .constructor-tour-bar-btn-demo .constructor-tour-help-svg {
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  pointer-events: none;
  color: #1a1a1a;
}
#constructorHelpModal .constructor-help-demo--plain {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  border-radius: 8px;
  border: 1px solid rgba(0, 91, 255, 0.35);
  box-sizing: border-box;
  background: #fff;
  color: #1a1a1a;
  vertical-align: middle;
  pointer-events: none;
  user-select: none;
  flex-shrink: 0;
  cursor: default;
}
#constructorHelpModal .constructor-help-demo--tour {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  border-radius: 8px;
  border: 1px solid rgba(0, 91, 255, 0.35);
  box-sizing: border-box;
  background: #fff;
  color: #1a1a1a;
  vertical-align: middle;
  pointer-events: none;
  user-select: none;
  flex-shrink: 0;
  cursor: default;
}
#constructorHelpModal .constructor-help-demo--tour .fa-circle-question {
  font-size: 18px;
  line-height: 1;
}
#constructorHelpModal .constructor-tour-demo-btn--trim-outline {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  border-radius: 8px;
  border: 1px solid var(--border, #e0e0e0);
  box-sizing: border-box;
  background: #fff;
  color: #1a1a1a;
}
#constructorHelpModal .constructor-tour-demo-btn--trim-outline .constructor-svg-icon {
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  pointer-events: none;
  color: #1a1a1a;
}
#constructorHelpModal .constructor-tour-demo-btn--mirror-outline {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  border-radius: 8px;
  border: 1px solid var(--border, #e0e0e0);
  box-sizing: border-box;
  background: #fff;
  color: #1a1a1a;
}
#constructorHelpModal .constructor-tour-demo-btn--mirror-outline .constructor-svg-icon {
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  pointer-events: none;
  color: #1a1a1a;
}
#constructorHelpModal .constructor-help-demo--file-card-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  vertical-align: middle;
  border-radius: 4px;
  border: 1px solid var(--border, #e0e0e0);
  box-sizing: border-box;
  background: #fff;
  color: #1a1a1a;
  flex-shrink: 0;
  pointer-events: none;
  user-select: none;
}
#constructorHelpModal .constructor-help-demo--file-card-btn svg {
  display: block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  pointer-events: none;
  color: #1a1a1a;
}
#constructorHelpModal .constructor-tour-demo-btn--recalc {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  border-radius: 8px;
  border: 1px solid var(--green, #4caf50);
  box-sizing: border-box;
  background: #fff;
  color: #2e7d32;
}
#constructorHelpModal .constructor-tour-demo-btn--palette {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-radius: 8px;
  border: 1px solid var(--border, #e0e0e0);
  box-sizing: border-box;
  background: #fff;
  color: #1a1a1a;
  vertical-align: middle;
  box-shadow: none;
  overflow: hidden;
}
#constructorHelpModal .constructor-tour-demo-btn--palette .constructor-tour-svg--palette {
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 1px;
}
#constructorHelpModal .constructor-tour-demo-btn--trash {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-radius: 8px;
  border: 1px solid var(--red, #f44336);
  box-sizing: border-box;
  background: #fff;
  color: var(--red, #f44336);
  vertical-align: middle;
  box-shadow: none;
}
#constructorHelpModal .constructor-tour-demo-btn .constructor-tour-svg {
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
