/* The canvas keeps its own coordinate direction; the surrounding tools follow the language. */
:root { --editor-ink: #29256e; --editor-coral: #e95640; }
.editor-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.global-topbar { min-height: 68px; height: auto; padding: 10px 12px; gap: 12px; }
.global-topbar-left { flex: 1; gap: 8px; }
.global-topbar-right { flex: 0 0 auto; }
.global-product-title { font-size: 18px; min-width: 0; }
.global-price-wrap { margin: 0; margin-inline-start: auto; flex: 0 1 auto; }
.global-price-value { font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.global-icon-btn { flex: 0 0 44px; width: 44px; height: 44px; color: var(--editor-ink); }
.global-cta { min-height: 44px; height: auto; font-size: 13px; padding: 8px 12px; line-height: 1.3; }
.global-cta.primary { background: var(--editor-ink); border-color: var(--editor-ink); }
.global-topbar:has(#editorLoadFailure) { flex-wrap: wrap; }
#editorLoadFailure { flex: 1 1 100%; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 8px 10px; border: 1px solid #f0c9c1; border-radius: 8px; background: #fff4f1; color: #8f2f25; font-size: 13px; line-height: 1.4; box-sizing: border-box; }
#editorLoadFailure > span { flex: 1 1 200px; }
#editorLoadFailure button { min-height: 44px; padding: 6px 14px; border: 1px solid var(--editor-ink); border-radius: 7px; color: #fff; background: var(--editor-ink); font: inherit; cursor: pointer; }
.editor-language-label select { min-height: 40px; width: 65px; padding: 4px; font: inherit; font-size: 13px; border: 1px solid #d4d4e0; border-radius: 7px; background: #fff; color: var(--editor-ink); }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--editor-ink); outline-offset: 2px; }
.layout { height: calc(100dvh - var(--global-topbar-h)); margin-left: 0; margin-inline-start: var(--sidebar-w); }
.sidebar { left: auto; inset-inline-start: 0; height: calc(100dvh - var(--global-topbar-h)); overflow-y: auto; overflow-x: hidden; }
.workspace, .app { min-width: 0; }
.top-toolbar { overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain; scrollbar-width: thin; z-index: 10; min-height: 64px; }
.top-toolbar > * { flex-shrink: 0; }
.tb-btn, .tb-chip, .tb-align-trigger, .tb-style-block, .tb-zoom-box { min-height: 40px; }
.tb-style-block, .tb-zoom-box { height: 40px; }
.tb-zoom-box { margin-left: 0; margin-inline-start: auto; }
.tb-align-menu { position: fixed; left: auto; top: auto; z-index: 2500; }
.tb-align-group:focus-within .tb-align-menu, .tb-align-group.editor-align-open .tb-align-menu { display: inline-flex; }
.panel { overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
.panel-close-rail { left: auto; inset-inline-start: var(--design-panel-w); }
.panel-image-head { flex-wrap: wrap; }
.product-row { gap: 12px; flex-wrap: wrap; }
#editorVariantSize { min-height: 44px; min-width: 95px; max-width: 100%; font: inherit; background: #fff; border: 1px solid #d0d0dc; border-radius: 7px; padding: 6px 10px; }
#selectedColorName:empty, .product-id:empty { display: none; }
.swatch-grid { grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); }
.swatch { width: 32px; height: 32px; }
.swatch-grid:has(.editor-colour-choice) { grid-template-columns: repeat(auto-fit, minmax(95px, 1fr)); }
.editor-colour-choice { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 0; border: 1px solid #d0d0df; border-radius: 7px; background: #fff; color: #292a3a; padding: 7px; font: inherit; font-size: 13px; overflow-wrap: anywhere; cursor: pointer; }
.editor-colour-choice.active, .editor-colour-choice[aria-pressed="true"] { border-color: var(--editor-ink); box-shadow: inset 0 0 0 1px var(--editor-ink); color: var(--editor-ink); }
.editor-colour-choice[style*="--variant-colour"]::before { content: ""; width: 16px; height: 16px; flex: 0 0 16px; border: 1px solid #bdbdc9; border-radius: 50%; background: var(--variant-colour); }
.attrs-panel { min-width: 0; overflow: auto; height: calc(100dvh - var(--global-topbar-h) - 16px); }
.attrs-input-wrap, .attrs-field, .layer-title { min-width: 0; }
.layer-title { overflow-wrap: anywhere; }
.editor-wrap, .editor, .konvajs-content { direction: ltr; }
.editor-attributes-toggle, .editor-panel-close, .editor-panel-backdrop { display: none; }
.preview-modal-overlay, .exit-modal-overlay { box-sizing: border-box; padding: 12px; z-index: 3200; }
.preview-modal, .exit-modal { max-width: 100%; max-height: calc(100dvh - 24px); overflow: auto; }
.preview-modal-body { min-height: 0; }
.preview-modal-image { max-height: calc(100dvh - 190px); }
.exit-modal-actions { flex-wrap: wrap; }
.exit-btn, .preview-modal-close, .exit-modal-close, .preview-tab, .design-review-bg-btn { min-height: 44px; }
.preview-modal-close, .exit-modal-close { min-width: 44px; }
[dir="rtl"] #leaveCustomizer { transform: scaleX(-1); }
[dir="rtl"] .panel-close-rail { transform: translate(50%, -50%); }
[dir="rtl"] .attrs-panel { right: auto; }
[dir="rtl"] .global-product-title { direction: rtl; }
@media (max-width: 1180px) {
  :root { --sidebar-w: 66px; }
  .global-topbar { flex-wrap: wrap; gap: 6px; padding: 6px 10px; }
  .global-topbar-left, .global-topbar-right { width: 100%; flex: 1 1 100%; }
  .global-topbar-right { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .global-cta { white-space: normal; padding: 7px 8px; font-size: 12px; }
  .global-product-title { font-size: 16px; }
  .global-price-value { font-size: 13px; max-width: 130px; }
  .global-icon-btn { flex-basis: 36px; width: 36px; }
  .tool-btn { width: 54px; min-height: 55px; font-size: 11px; padding: 4px 0; }
  .sidebar { padding: 6px; }
  .layout { padding: 6px 6px 6px 0; }
  [dir="rtl"] .layout { padding: 6px 0 6px 6px; }
  .panel, .attrs-panel { position: absolute; inset-block: 0; width: min(340px, 100%); height: 100%; padding: 54px 12px 16px; background: #f7f7fa; border: 1px solid #dedee8; box-shadow: 0 8px 28px #14133126; z-index: 2300; }
  .panel { inset-inline-start: 0; }
  .attrs-panel { display: none; inset-inline-end: 0; }
  body.editor-attributes-open .attrs-panel { display: flex; }
  .panel-close-rail, .panel-close-rail.visible { display: none; }
  .editor-panel-close { position: absolute; inset-block-start: 6px; inset-inline-end: 8px; display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; border: 1px solid #d8d8e4; border-radius: 8px; color: var(--editor-ink); background: #fff; cursor: pointer; }
  .editor-panel-close svg { width: 20px; height: 20px; }
  .editor-panel-backdrop { position: absolute; inset: 0; border: 0; background: #1111264d; z-index: 2200; }
  .editor-panel-backdrop:not([hidden]) { display: block; }
  .editor-attributes-toggle { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border: 1px solid #d0d0df; border-radius: 7px; background: #fff; color: var(--editor-ink); padding: 6px 10px; font: inherit; font-size: 12px; }
  .toggle { width: 100%; box-sizing: border-box; padding: 0; gap: 6px; }
  .toggle-btn { font-size: 14px; padding: 8px 12px; min-height: 44px; }
  .upload-image-action { width: 36px; min-width: 36px; height: 36px; flex-basis: 36px; }
  .settings-title, .help-head, .text-head, .attrs-panel h3 { font-size: 23px; }
  .settings-row label { font-size: 18px; }
  .panel-image-head { font-size: 22px; }
  .settings-reset-btn, .panel-upload-btn, .panel-tab, .folder-inline-btn, .curve-card, .help-tab, .text-close { min-height: 44px; }
  .text-search, .help-search, .folder-inline-input { min-height: 44px; box-sizing: border-box; font-size: 16px; }
  .exit-modal-head h3 { font-size: 22px; }
  .design-review-modal { height: auto; }
  .design-review-stage { min-height: 200px; }
  .design-review-main-image { max-height: 45dvh; }
  .design-review-controls { flex-wrap: wrap; }
}
@media (max-width: 360px) {
  :root { --sidebar-w: 58px; }
  .sidebar { padding-inline: 2px; }
  .tool-btn { width: 52px; font-size: 10px; }
  .image-library-list { grid-template-columns: 1fr; }
  .global-price-value { max-width: 92px; font-size: 12px; }
  .editor-language-label select { width: 56px; }
  .global-product-title { font-size: 13px; }
  .global-cta { font-size: 11px; }
  .toggle-btn { padding-inline: 8px; }
  .editor-attributes-toggle { font-size: 11px; padding-inline: 6px; }
}
