/* ============================================================================
   MOSAICA PATTERN ATELIER — AUTORSKI SYSTEM WIZUALNY (NORDIC BENTO & INDIGO)
   ============================================================================ */

:root {
  --bg-workspace: #faf9f7;
  --bg-card: #ffffff;
  --bg-subtle: #fff8f5;
  --bg-hover: #fff0ea;

  --text-primary: #1f242d;
  --text-secondary: #4a5260;
  --text-muted: #707987;

  --border-color: #ece9e6;
  --border-strong: #d8d4cf;

  --indigo: #1f242d;
  --indigo-hover: #11151b;
  --indigo-soft: #fff2ef;
  --indigo-border: #f5c2ba;

  --hero-bg: #fef6df;
  --hero-text: #9a620b;
  --hero-border: #f6ce78;

  --filler-bg: #eef7f1;
  --filler-text: #1e6b45;
  --filler-border: #9ad4b5;

  --danger: #d94b43;
  --danger-soft: #fff1f0;

  --radius-xl: 14px;
  --radius-lg: 12px;
  --radius-md: 9px;
  --radius-sm: 7px;

  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-artboard: 0 8px 26px rgba(15, 23, 42, 0.08);
  --shadow-floating: 0 6px 20px rgba(15, 23, 42, 0.12);
}

/* TRYB CIEMNY (DARK MODE) */
[data-theme="dark"] {
  --bg-workspace: #11161c;
  --bg-card: #182028;
  --bg-subtle: #202a34;
  --bg-hover: #273442;

  --text-primary: #eef2f6;
  --text-secondary: #b7c4d1;
  --text-muted: #8494a4;

  --border-color: #293543;
  --border-strong: #39495b;

  --indigo: #5b82a6;
  --indigo-hover: #7098bd;
  --indigo-soft: #213040;
  --indigo-border: #3a526a;

  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-artboard: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-floating: 0 8px 24px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .atelier-header,
[data-theme="dark"] .mobile-step-nav {
  background: rgba(24, 32, 40, 0.96);
}

[data-theme="dark"] .bento-sidebar.left,
[data-theme="dark"] .bento-sidebar.right {
  background: rgba(20, 27, 34, 0.85);
}

[data-theme="dark"] .selection-toolbar,
[data-theme="dark"] .stage-placement-card,
[data-theme="dark"] .stage-zoom-card,
[data-theme="dark"] .mini-preview-2x2-card,
[data-theme="dark"] .export-watermark-box,
[data-theme="dark"] .export-colorways-box {
  background: var(--bg-card);
  border-color: var(--border-strong);
}

[data-theme="dark"] .wm-protection-note {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fcd34d;
}

[data-theme="dark"] .watermark-badge {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.35);
}

[data-theme="dark"] .recolor-select,
[data-theme="dark"] .field-input,
[data-theme="dark"] .hex-field-input {
  color: var(--text-primary);
}

.theme-ico-sun {
  display: none;
}

[data-theme="dark"] .theme-ico-moon {
  display: none;
}

[data-theme="dark"] .theme-ico-sun {
  display: block;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg-workspace);
  color: var(--text-primary);
  font-family: "Poppins", "Segoe UI Variable", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  font-size: 13.5px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

input[type="text"],
input[type="number"],
textarea {
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}

/* Estetyczne paski przewijania na Windows */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.45);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(91, 79, 233, 0.55);
}

button, input, select {
  font: inherit;
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 2px;
}

/* ============================================================================
   GÓRNY PASEK NAWIGACJI + PASEK INSTRUKCJI
   ============================================================================ */

.atelier-header {
  height: 54px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border-color);
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  z-index: 30;
}

.header-left-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
}

.btn-header-subtle {
  height: 34px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.13s ease;
}

.btn-header-subtle:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.brand-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.brand-gem {
  width: 34px;
  height: 34px;
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  display: grid;
  place-items: center;
  box-shadow: none;
  flex-shrink: 0;
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-name {
  font-family: "Quicksand", "Poppins", sans-serif;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
  color: var(--text-primary);
}

.pill-300dpi {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--indigo-soft);
  color: var(--indigo);
  border: 1px solid var(--indigo-border);
}

.brand-tagline {
  font-size: 11px;
  color: var(--text-muted);
}

/* ŚRODKOWY PRZEŁĄCZNIK WIDOKU PŁÓTNA */
.canvas-mode-segmented {
  display: flex;
  align-items: center;
  background: var(--bg-workspace);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  gap: 3px;
}

.mode-tab {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s ease;
  text-align: center;
}

.mode-tab .tab-ico {
  flex-shrink: 0;
  font-size: 12.5px;
  line-height: 1;
}

.mode-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.65);
}

.mode-tab.active {
  background: var(--bg-card);
  color: var(--indigo);
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(17, 24, 39, 0.08);
}

/* PRAWE AKCJE NAGŁÓWKA */
.header-right-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.btn-help-pill {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--indigo-border);
  background: var(--indigo-soft);
  color: var(--indigo);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.14s;
}

.btn-help-pill:hover {
  background: var(--indigo);
  color: #ffffff;
}

.btn-help-pill span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--indigo);
  color: #ffffff;
  font-size: 11px;
  display: grid;
  place-items: center;
}

.btn-help-pill:hover span {
  background: #ffffff;
  color: var(--indigo);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.14s;
}

.icon-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-primary-indigo {
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #3d5266 0%, #4d657d 100%);
  color: #ffffff;
  padding: 0 15px;
  height: 36px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 4px 12px rgba(61, 82, 102, 0.22);
  transition: all 0.15s ease;
}

.btn-primary-indigo:hover:not(:disabled) {
  background: linear-gradient(135deg, #2f4152 0%, #3d5266 100%);
  transform: translateY(-1px);
}

.btn-primary-indigo:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ============================================================================
   UKŁAD GŁÓWNY 3-KOLUMNOWY (LEWA: KROK 1 | ŚRODEK: PŁÓTNO | PRAWA: KROK 2, ZNAK WODNY, KROK 3)
   ============================================================================ */

.atelier-grid {
  display: grid;
  grid-template-columns: 318px minmax(460px, 1fr) 318px;
  height: calc(100vh - 54px);
  width: 100%;
  overflow: hidden;
}

.bento-sidebar {
  padding: 9px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.bento-sidebar.left {
  border-right: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.55);
}

.bento-sidebar.right {
  border-left: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.55);
}

.bento-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 13px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* CZYSTE KARTY KROKÓW BEZ CIĘŻKICH PASKÓW BOCZNYCH */
.step-card {
  border: 1px solid var(--border-color);
}

.step-banner {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3d5266 0%, #526b82 100%);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 900;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(61, 82, 102, 0.22);
}

.step-num.small {
  width: 28px;
  height: 28px;
  font-size: 13px;
}

.step-banner-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.step-kicker {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1.1;
}

.card-heading {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.step-title-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
}

.counter-pill {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: 999px;
}

.helper-text {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.divider-section {
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
}

/* ============================================================================
   KROK 1: 5 WIZUALNYCH SZABLONÓW + WŁASNY, ZESTAWY I ELEMENTY
   ============================================================================ */

.templates-visual-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

/* PATTERN DENSITY (GĘSTOŚĆ WZORU) */
.density-slider-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
}

.density-slider-wrap input[type="range"] {
  flex: 1;
  accent-color: var(--indigo);
  cursor: pointer;
}

.density-end-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.density-readout {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--indigo);
  background: var(--indigo-soft);
  border: 1px solid var(--indigo-border);
  border-radius: 6px;
  padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}

.density-presets-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.density-preset-btn {
  text-align: center;
  justify-content: center;
}

.auto-layout-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.auto-layout-row .btn-outline {
  font-size: 11px;
  min-height: 32px;
  padding: 0 6px;
}

.tpl-tile-card {
  border: 1.5px solid var(--border-color);
  background: var(--bg-subtle);
  border-radius: 11px;
  padding: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: all 0.14s ease;
  position: relative;
}

.tpl-tile-card:hover {
  border-color: var(--indigo);
  background: var(--bg-hover);
  transform: translateY(-1px);
}

.tpl-tile-card.active {
  border-color: var(--indigo);
  background: var(--indigo-soft);
  box-shadow: 0 0 0 1px var(--indigo);
}

.tpl-thumb-box {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  border-radius: 7px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tpl-thumb-box svg,
.tpl-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.tpl-tile-card span {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.15;
}

.tpl-tile-card.upload-own {
  border-style: dashed;
  border-color: var(--border-strong);
  justify-content: center;
}

.tpl-tile-card.upload-own .tpl-thumb-box {
  border: 0;
  background: transparent;
  font-size: 22px;
  color: var(--indigo);
}

.tpl-tile-card.has-custom-tpl {
  border-style: solid;
}

.tpl-tile-card.has-custom-tpl .tpl-thumb-box {
  border: 1px solid var(--border-color);
  background: #ffffff;
}

.tpl-replace-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 0;
  background: rgba(30, 36, 43, 0.78);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 3;
  transition: transform 0.12s ease, background 0.12s ease;
}

.tpl-replace-btn:hover {
  background: var(--indigo);
  transform: scale(1.1);
}

/* GOTOWY ZESTAW DO ĆWICZEŃ */
.starter-packs-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.starter-packs-row.single-pack {
  grid-template-columns: 1fr;
}

.pack-chip {
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  border-radius: 8px;
  padding: 8px 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  transition: all 0.13s;
}

.pack-chip:hover {
  background: var(--bg-hover);
}

.pack-chip.active {
  background: var(--indigo);
  color: #ffffff;
  border-color: var(--indigo);
}

/* ZASOBNIK TWOICH ELEMENTÓW (KOMPAKTOWE, CZYTELNE KAFELKI — 5 W RZĘDZIE) */
.asset-tray-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  max-height: 185px;
  overflow-y: auto;
  padding: 2px;
}

.asset-slot {
  position: relative;
  aspect-ratio: 1;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.15s ease;
}

.asset-slot:hover {
  border-color: var(--indigo);
  transform: translateY(-1px);
}

.asset-pick-btn {
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  padding: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.asset-pick-btn img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.asset-remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 0;
  background: rgba(17, 24, 39, 0.72);
  color: #ffffff;
  font-size: 8.5px;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.14s;
}

.asset-slot:hover .asset-remove-btn {
  opacity: 1;
}

.asset-slot.add-new {
  border-style: dashed;
  border-color: var(--border-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.1;
}

.asset-slot.add-new:hover {
  border-color: var(--indigo);
  color: var(--indigo);
  background: var(--indigo-soft);
}

.tray-buttons-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.btn-outline {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 9px;
  min-height: 36px;
  padding: 0 11px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.13s;
}

.btn-outline.primary-tint {
  background: var(--indigo-soft);
  border-color: var(--indigo-border);
  color: var(--indigo);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-outline.danger {
  color: var(--danger);
  border-color: #fecdd3;
}

.btn-outline.danger:hover:not(:disabled) {
  background: var(--danger-soft);
}

/* KONTROLKI PODKŁADU SZABLONU W KROKU 1 */
.template-guide-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-top: 9px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.template-guide-box[hidden] {
  display: none !important;
}

.sub-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sub-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* PRZYCISKI PYTAJNIKÓW (?) Z INFORMACJĄ O ROZMIARACH PLIKÓW */
.info-q-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--indigo-border);
  background: var(--indigo-soft);
  color: var(--indigo);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.14s ease;
}

.info-q-btn:hover,
.info-q-btn.active {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #ffffff;
  transform: scale(1.06);
}

.size-info-popover {
  background: var(--indigo-soft);
  border: 1px solid var(--indigo-border);
  border-left: 3.5px solid var(--indigo);
  border-radius: 9px;
  padding: 9px 11px;
  margin-bottom: 8px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-primary);
  box-shadow: 0 4px 12px rgba(61, 82, 102, 0.08);
}

.size-info-popover[hidden] {
  display: none !important;
}

.size-info-popover strong {
  display: block;
  color: var(--indigo);
  margin-bottom: 4px;
  font-size: 11.5px;
}

.size-info-popover ul {
  margin: 0;
  padding-left: 15px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.segmented-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--border-color);
  padding: 2px;
  border-radius: 8px;
  gap: 2px;
}

.seg-pill {
  border: 0;
  background: transparent;
  padding: 6px 6px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}

.seg-pill.fmt-btn,
.seg-pill.res-btn {
  font-size: 11.5px;
  padding: 6px 4px;
}

.seg-pill.active {
  background: var(--bg-card);
  color: var(--indigo);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.switch-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--indigo);
  cursor: pointer;
}

.generate-action-row {
  display: flex;
  gap: 7px;
}

.generate-action-row .btn-primary-indigo {
  flex: 1;
  height: 36px;
}

.btn-shuffle {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid var(--indigo-border);
  background: var(--indigo-soft);
  color: var(--indigo);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-shuffle:hover {
  background: var(--indigo);
  color: #ffffff;
}

/* ============================================================================
   ŚRODKOWA PRZESTRZEŃ ROBOCZA + KWADRATOWY PODGLĄD 2x2 NA ŻYWO
   ============================================================================ */

.atelier-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 12px;
  gap: 8px;
  background-color: var(--bg-workspace);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.stage-top-bar {
  width: 100%;
  max-width: 780px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 10;
}

.stage-Hint-pill {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 7px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.stage-quick-switches {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-pill-btn {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.13s ease;
}

.mini-pill-btn[hidden] {
  display: none !important;
}

.mini-pill-btn.active {
  background: var(--indigo);
  color: #ffffff;
  border-color: var(--indigo);
}

.mini-pill-btn.accent-pill {
  background: var(--indigo-soft);
  color: var(--indigo);
  border-color: var(--indigo-border);
}

.mini-pill-btn.accent-pill:hover {
  background: var(--indigo);
  color: #ffffff;
  border-color: var(--indigo);
}

/* KONTENER KWADRATOWEGO PŁÓTNA 1:1 + PASKA POD PŁÓTNEM + PODGLĄDU 2x2 */
.artboard-outer-center {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  position: relative;
  min-height: 0;
  padding: 6px 10px;
  overflow: auto;
}

.artboard-canvas-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin: auto 0;
}

.stage-under-canvas-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.artboard-wrap {
  position: relative;
  width: 480px;
  height: 480px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  box-shadow: var(--shadow-artboard);
  border: 1px solid rgba(17, 24, 39, 0.12);
  background: #ffffff;
  flex-shrink: 0;
}

/* WARSTWA PODGLĄDU OTOCZENIA ZA KRAWĘDZIĄ (JAK EDGE-REPEAT-LAYER W EASY PATTERN STUDIO) */
.edge-repeat-canvas {
  display: none;
  position: absolute;
  width: 140%;
  height: 140%;
  left: -20%;
  top: -20%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.16s ease;
  z-index: 1;
  filter: saturate(0.95);
}

.artboard-wrap.show-edge-preview .edge-repeat-canvas {
  display: block;
  opacity: 0.34;
}

.artboard-wrap.transparent-checker {
  background-color: #ffffff;
  background-image:
    linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
    linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

#artboardCanvas {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 7px;
  cursor: grab;
  touch-action: none;
}

#artboardCanvas:active {
  cursor: grabbing;
}

/* LISTA ELEMENTÓW NA PŁÓTNIE W KROKU 1 (JAK "MOTIFS" W EASY PATTERN STUDIO) */
.canvas-motif-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 185px;
  overflow-y: auto;
  padding-right: 2px;
}

.motif-list-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 8px;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  cursor: pointer;
  text-align: left;
  transition: all 0.12s ease;
}

.motif-list-row:hover {
  border-color: var(--indigo);
  background: var(--bg-hover);
}

.motif-list-row.selected {
  border-color: var(--indigo);
  background: var(--indigo-soft);
  box-shadow: 0 0 0 1px var(--indigo);
}

.motif-list-row img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 5px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 2px;
  flex-shrink: 0;
}

.motif-list-row .motif-row-name {
  flex: 1;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.motif-list-row .motif-row-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--indigo);
  background: #ffffff;
  border: 1px solid var(--indigo-border);
  border-radius: 99px;
  padding: 1px 6px;
}

/* IDEALNIE KWADRATOWY PODGLĄD 2x2 Z NAGŁÓWKIEM POWYŻEJ KAFELKA (NIE ZASŁANIA WZORU) */
.mini-preview-2x2-card {
  position: relative;
  width: 184px;
  height: auto;
  background: rgba(255, 255, 255, 0.98);
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  padding: 6px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  align-self: center;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: all 0.16s ease;
}

.mini-preview-2x2-card:hover {
  border-color: var(--indigo);
  transform: translateY(-2px);
  box-shadow: var(--shadow-floating);
}

.mini-preview-2x2-card[hidden] {
  display: none !important;
}

.mini-preview-header {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.mini-preview-title {
  flex: 1;
  white-space: nowrap;
}

.mini-preview-expand {
  color: var(--indigo);
  font-size: 11.5px;
  font-weight: 800;
}

.mini-preview-canvas-box {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  background: #ffffff;
}

#miniPreview2x2Canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #ffffff;
}

/* RAMKA ZAZNACZENIA I UCHWYTY */
.selection-box {
  position: absolute;
  pointer-events: none;
  border: 2px dashed var(--indigo);
  border-radius: 4px;
  z-index: 15;
}

.selection-box[hidden] { display: none !important; }

.transform-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 2.5px solid var(--indigo);
  box-shadow: 0 2px 6px rgba(17, 24, 39, 0.25);
  pointer-events: auto;
  cursor: nwse-resize;
}

.transform-handle:hover {
  transform: scale(1.22);
  background: var(--indigo);
}

.transform-handle.nw { top: -8px; left: -8px; cursor: nwse-resize; }
.transform-handle.ne { top: -8px; right: -8px; cursor: nesw-resize; }
.transform-handle.sw { bottom: -8px; left: -8px; cursor: nesw-resize; }
.transform-handle.se { bottom: -8px; right: -8px; cursor: nwse-resize; }

.transform-handle.rotate {
  top: -34px;
  left: calc(50% - 11px);
  width: 22px;
  height: 22px;
  background: var(--indigo);
  color: #ffffff;
  border: 2px solid #ffffff;
  cursor: grab;
  display: grid;
  place-items: center;
  font-size: 12px;
}

.transform-handle.rotate::after {
  content: "";
  position: absolute;
  top: 20px;
  left: 50%;
  width: 2px;
  height: 12px;
  background: var(--indigo);
  transform: translateX(-50%);
}

/* JASNY, MINIMALISTYCZNY PASEK NARZĘDZI PRZY ZAZNACZONYM MOTYWIE */
.selection-toolbar {
  position: absolute;
  transform: translateX(-50%);
  background: #ffffff;
  color: var(--text-primary);
  border-radius: 10px;
  padding: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
  max-width: calc(100% - 12px);
  box-shadow: var(--shadow-floating);
  z-index: 25;
  white-space: nowrap;
  border: 1px solid var(--border-strong);
}

.selection-toolbar[hidden] { display: none !important; }

.toolbar-tile-btn {
  height: 29px;
  padding: 0 8px;
  border-radius: 7px;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  transition: background 0.12s ease, color 0.12s ease;
}

.toolbar-tile-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--indigo);
}

.toolbar-tile-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.toolbar-tile-btn.active {
  background: var(--indigo);
  color: #ffffff;
}

.toolbar-tile-btn.danger {
  color: var(--danger);
}

.toolbar-tile-btn.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.toolbar-divider {
  width: 1px;
  height: 18px;
  background: var(--border-color);
  margin: 0 2px;
}

/* PASEK TRYBU ZAZNACZANIA WIELU ELEMENTÓW (Z SUWAKAMI ROZMIAR / OBRÓT DLA GRUPY) */
.multi-select-banner {
  width: 100%;
  max-width: 840px;
  background: var(--indigo);
  color: #ffffff;
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  box-shadow: var(--shadow-card);
  font-size: 11.5px;
  font-weight: 600;
  z-index: 12;
}

.multi-select-banner[hidden] {
  display: none !important;
}

.multi-select-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.multi-select-sliders {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.multi-select-sliders .dock-slider-group {
  color: #ffffff;
  width: 100%;
  min-width: 0;
}

.multi-select-sliders .dock-slider-group input[type="range"] {
  flex: 1 1 40px;
  min-width: 0;
  width: 40px;
  accent-color: #ffffff;
}

.multi-select-sliders .dock-slider-group output {
  color: #ffffff;
  text-align: right;
}

.multi-select-info {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.multi-dot {
  font-size: 13px;
  flex-shrink: 0;
}

.multi-select-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.multi-select-banner .dock-chip {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

.multi-select-banner .dock-chip:hover {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

.multi-select-banner .dock-chip.active {
  background: #ffffff;
  border-color: #ffffff;
  color: var(--indigo);
}

.multi-select-banner .dock-chip.danger-chip:hover {
  background: #e11d48;
  border-color: #f43f5e;
}

.export-res-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--indigo);
  background: var(--indigo-soft);
  border: 1px solid var(--indigo-border);
  border-radius: 999px;
  padding: 1px 8px;
}

/* SLOT NA WYŚRODKOWANY PODGLĄD 2x2 PONIŻEJ NA TABLECIE */
.stage-footer-bar {
  width: 100%;
  max-width: 840px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.stage-footer-bar:has(.dock-preview-slot:empty),
.dock-preview-slot:empty {
  display: none;
}

.stage-zoom-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border-color);
  border-radius: 11px;
  padding: 4px 6px;
  box-shadow: var(--shadow-card);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 700;
  flex-shrink: 0;
  margin-left: auto;
}

.zoom-Readout-btn {
  border: 0;
  background: transparent;
  color: var(--text-primary);
  min-width: 40px;
  height: 26px;
  padding: 0 3px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background 0.12s ease;
}

.zoom-Readout-btn:hover {
  background: var(--bg-hover);
  color: var(--indigo);
}

.stage-placement-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border-color);
  border-radius: 11px;
  padding: 5px 8px;
  box-shadow: var(--shadow-card);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.placement-kicker {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.dock-slider-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
}

.dock-slider-group input[type="range"] {
  width: 70px;
  accent-color: var(--indigo);
  cursor: pointer;
}

.dock-slider-group output {
  min-width: 30px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--indigo);
}

.dock-placement-shortcuts {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
}

.dock-zoom-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 700;
}

.dock-multiply-cluster {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-left: 6px;
  border-left: 1px solid var(--border-color);
}

.multiply-num-input {
  width: 42px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
  padding: 0 3px;
}

.multiply-num-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.dock-chip {
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.dock-chip.primary-chip {
  background: var(--indigo-soft);
  color: var(--indigo);
  border-color: var(--indigo-border);
}

.dock-chip.active {
  background: var(--indigo);
  color: #ffffff;
  border-color: var(--indigo);
}

.dock-chip:hover:not(:disabled) {
  background: var(--indigo-soft);
  color: var(--indigo);
  border-color: var(--indigo-border);
}

.dock-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================================================
   PRAWY PANEL: KROK 3 (TŁO), ZNAK WODNY, KROK 4 (EKSPORT)
   ============================================================================ */

.palette-line {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.swatch-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid rgba(17, 24, 39, 0.16);
  cursor: pointer;
  transition: transform 0.12s;
}

.swatch-circle:hover { transform: scale(1.1); }
.swatch-circle.active { box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--indigo); }

.custom-color-picker-wrap {
  position: relative;
}

.color-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-swatch-trigger {
  width: 38px;
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.13s ease, transform 0.12s ease;
}

.color-swatch-trigger:hover {
  border-color: var(--indigo);
  transform: scale(1.03);
}

.custom-cp-popover {
  margin-top: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 9px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-floating);
}

.custom-cp-popover[hidden] {
  display: none !important;
}

/* PROSTE PIONOWE SUWAKI WYBORU KOLORU TŁA */
.cp-vertical-sliders-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 4px 2px;
}

.cp-v-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.cp-v-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.cp-v-track-wrap {
  width: 28px;
  height: 124px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cp-v-slider {
  width: 118px;
  height: 12px;
  transform: rotate(-90deg);
  -webkit-appearance: none;
  appearance: none;
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

.cp-v-hue {
  background: linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
}

.cp-v-light {
  background: linear-gradient(to right, #141414 0%, #8a8a8a 50%, #ffffff 100%);
  border: 1px solid var(--border-color);
}

.cp-v-sat {
  background: linear-gradient(to right, #d4d4d8 0%, #3b82f6 100%);
}

.cp-v-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--indigo);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.hex-field-input {
  flex: 1;
  height: 36px;
  border: 1px solid var(--border-color);
  border-radius: 9px;
  background: var(--bg-subtle);
  padding: 0 10px;
  font-family: monospace;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.texture-pills {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}

.tex-btn {
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  border-radius: 8px;
  padding: 7px 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.tex-btn.active {
  background: var(--indigo-soft);
  border-color: var(--indigo);
  color: var(--indigo);
  font-weight: 700;
}

.pattern-color-box {
  margin-top: 9px;
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
}

.pattern-color-box[hidden] {
  display: none !important;
}

.recolor-select {
  width: 100%;
  height: 35px;
  border: 1px solid var(--border-color);
  border-radius: 9px;
  background: var(--bg-subtle);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* SEKCJA ZNAKU WODNEGO I COLORWAY PACK WEWNĄTRZ KROKU 3 (EKSPORT) */
.export-watermark-box,
.export-colorways-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.colorways-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.colorways-body[hidden] {
  display: none !important;
}

.colorway-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.colorway-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border-radius: 8px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  font-size: 11px;
  font-family: monospace;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.12s ease;
}

.colorway-chip.active {
  border-color: var(--indigo);
  background: var(--indigo-soft);
}

.colorway-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(15, 23, 42, 0.28);
  flex-shrink: 0;
  cursor: pointer;
  display: inline-block;
  transition: transform 0.12s ease;
}

.colorway-dot:hover {
  transform: scale(1.14);
}

.colorway-hex-btn {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.colorway-hex-btn:hover {
  text-decoration: underline;
}

.cw-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cw-subbox {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 9px;
  padding: 8px 9px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.cw-subbox[hidden] {
  display: none !important;
}

.cw-subbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.cw-add-picker-btn {
  flex: 1;
  min-height: 32px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.cw-summary-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--indigo);
  background: var(--indigo-soft);
  padding: 5px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.colorway-remove {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

.colorway-remove:hover {
  color: var(--danger);
}

/* KARTA ZNAKU WODNEGO */
.watermark-card {
  border-left: 4px solid #f59e0b;
  background: linear-gradient(180deg, #fffdf9 0%, #ffffff 100%);
}

.watermark-badge {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 6px;
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
}

.watermark-body {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-top: 4px;
}

.watermark-body[hidden] {
  display: none !important;
}

.wm-logo-row {
  display: flex;
  gap: 6px;
}

.wm-protection-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 9px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 11px;
  line-height: 1.4;
  font-weight: 600;
}

.wm-shield-ico {
  font-size: 13px;
  line-height: 1.2;
  flex-shrink: 0;
}

/* KROK 4: EKSPORT */
.deliverables-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.deliverable-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-subtle);
  cursor: pointer;
  transition: all 0.14s;
}

.deliverable-item:hover { background: var(--bg-hover); }
.deliverable-item.selected { background: var(--indigo-soft); border-color: var(--indigo); }
.deliverable-item input { margin-top: 2px; accent-color: var(--indigo); }

.deliverable-copy strong { display: block; font-size: 12.5px; font-weight: 600; }
.deliverable-copy small { display: block; font-size: 11px; color: var(--text-muted); }

.dimensions-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.field-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}

.field-input {
  height: 35px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-subtle);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 600;
}

/* MODALE */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
}

.modal-backdrop[hidden] { display: none !important; }

.modal-card {
  width: min(100%, 760px);
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-floating);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-step-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.cropper-stage-box {
  height: 380px;
  background-color: #e5e7eb;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#sheetCropperCanvas {
  max-width: 100%;
  max-height: 100%;
  cursor: crosshair;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* LIVE MOCKUP PREVIEW MODAL */
.mockup-modal-card {
  width: min(100%, 640px);
}

.mockup-modal-body {
  gap: 12px;
}

.mockup-tabs-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.mockup-tab {
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-radius: 9px;
  padding: 8px 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.13s ease;
}

.mockup-tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.mockup-tab.active {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #ffffff;
}

.mockup-stage-box {
  width: min(100%, 60vh);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#mockupPreviewCanvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.mockup-controls-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast-msg {
  background: #111827;
  color: #ffffff;
  padding: 10px 15px;
  border-radius: 11px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow-floating);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================================
   ETYKIETY RESPONSYWNE I PASEK KROKÓW MOBILE (DOMYŚLNIE UKRYTE NA DESKTOPIE)
   ============================================================================ */

.export-btn-short,
.mobile-step-nav {
  display: none;
}

.help-btn-text {
  font-style: normal;
}

/* ============================================================================
   TABLET (769px – 1180px): ELEMENTY PO LEWEJ | PŁÓTNO PO PRAWEJ | TŁO I EKSPORT PONIŻEJ
   ============================================================================ */

@media (max-width: 1180px) {
  html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .atelier-header {
    height: auto;
    min-height: 52px;
    padding: 7px 12px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    position: sticky;
    top: 0;
  }

  /* Na tablecie pasek narzędzi elementu zawsze mieści się wewnątrz płótna */
  .selection-toolbar {
    flex-wrap: wrap;
    justify-content: center;
    max-width: calc(100% - 12px);
    white-space: normal;
    padding: 3px;
    gap: 2px;
  }

  .toolbar-tile-btn {
    height: 26px;
    padding: 0 6px;
    font-size: 10.5px;
  }

  .toolbar-divider {
    display: none;
  }

  .brand-name {
    font-size: 14.5px;
  }

  .btn-help-pill {
    height: 34px;
    padding: 0 10px;
    font-size: 11.5px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .btn-primary-indigo {
    height: 34px;
    padding: 0 13px;
    font-size: 12px;
  }

  .atelier-grid {
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    align-items: stretch;
    height: auto;
    overflow: visible;
  }

  .bento-sidebar {
    overflow-y: visible;
    padding: 10px;
  }

  .bento-sidebar.left {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
  }

  .bento-sidebar.left .step-card {
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .bento-sidebar.left .asset-tray-grid {
    max-height: 240px;
  }

  .atelier-stage {
    grid-column: 2;
    grid-row: 1;
    min-height: auto;
    justify-content: flex-start;
    padding: 10px 12px 12px;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
  }

  .bento-sidebar.right {
    grid-column: 1 / -1;
    grid-row: 2;
    border-left: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    gap: 10px;
    padding: 10px;
  }

  .bento-sidebar.right [data-mstep-card="2"] {
    grid-column: 1;
    grid-row: 1;
  }

  .bento-sidebar.right [data-mstep-card="3"] {
    grid-column: 2;
    grid-row: 1;
  }

  .stage-top-bar {
    max-width: 100%;
    gap: 6px;
  }

  .canvas-mode-segmented {
    width: 100%;
    padding: 3px;
  }

  .mode-tab {
    flex: 1;
    padding: 6px 7px;
    font-size: 11px;
    gap: 4px;
  }

  .mini-pill-btn {
    padding: 5px 10px;
    font-size: 11px;
  }

  .artboard-outer-center {
    flex: none;
    width: 100%;
    max-width: 100%;
    padding: 4px 2px;
    min-height: auto;
    gap: 0;
  }

  /* TABLET: Szybkie ułożenie po lewej + Skala płótna (50-100%) po prawej, Podgląd 2x2 poniżej */
  .stage-under-canvas-row {
    width: 100%;
    max-width: 100%;
    justify-content: space-between;
    gap: 6px;
  }

  .stage-footer-bar {
    max-width: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
  }

  .stage-footer-bar.no-preview,
  .dock-preview-slot:empty {
    display: none;
  }

  .dock-preview-slot {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .dock-preview-slot .mini-preview-2x2-card {
    margin: 0;
  }

  .stage-placement-card {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
    padding: 4px 6px;
    max-width: 100%;
  }

  .placement-kicker {
    font-size: 9.5px;
    color: var(--text-muted);
  }

  .dock-placement-shortcuts {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-wrap: nowrap;
  }

  .dock-placement-shortcuts .dock-chip {
    padding: 4px 5px;
    font-size: 9.5px;
  }

  .stage-zoom-card {
    padding: 3px 5px;
    gap: 2px;
  }

  .dock-zoom-btn {
    width: 24px;
    height: 24px;
    font-size: 13px;
  }

  .zoom-Readout-btn {
    min-width: 36px;
    height: 24px;
    font-size: 10.5px;
  }

  .btn-outline {
    font-size: 11px;
    min-height: 33px;
  }
}

/* ============================================================================
   MOBILE (<= 768px): KOMPAKTOWY UKŁAD MOBILNY Z PRZEŁĄCZNIKIEM KROKÓW 1 / 2 / 3
   ============================================================================ */

@media (max-width: 768px) {
  .export-btn-long,
  .help-btn-text {
    display: none;
  }

  .export-btn-short {
    display: inline;
  }

  .atelier-header {
    width: 100%;
    max-width: 100vw;
    padding: 6px 10px;
    min-height: 46px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 6px;
    overflow: hidden;
  }

  .brand-cluster {
    min-width: 0;
    justify-content: center;
    gap: 6px;
  }

  .brand-titles,
  .brand-name-row {
    min-width: 0;
  }

  .brand-gem {
    width: 24px;
    height: 24px;
    border-radius: 0;
    flex-shrink: 0;
  }

  .brand-gem svg {
    width: 22px;
    height: 22px;
  }

  .brand-name {
    font-size: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-right-actions {
    gap: 4px;
    flex-shrink: 0;
  }

  .btn-help-pill {
    width: 30px;
    height: 30px;
    padding: 0;
    justify-content: center;
    border-radius: 8px;
  }

  .btn-header-subtle {
    height: 30px;
    padding: 0 7px;
    font-size: 10.5px;
    border-radius: 8px;
  }

  .mockup-tabs-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }

  .btn-primary-indigo {
    height: 30px;
    padding: 0 10px;
    font-size: 11.5px;
    border-radius: 8px;
    gap: 4px;
  }

  .atelier-grid {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .atelier-stage {
    order: 1;
    width: 100%;
    max-width: 100%;
    min-height: auto;
    padding: 8px 10px 8px;
    gap: 6px;
    overflow-x: hidden;
  }

  .stage-top-bar {
    width: 100%;
    gap: 5px;
  }

  /* Te same 2 przyciski widoku jak na desktopie i tablecie — dopracowane rozmiary tekstu */
  .canvas-mode-segmented {
    width: 100%;
    max-width: 100%;
    padding: 3px;
    border-radius: 9px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 4px;
  }

  .mode-tab {
    min-width: 0;
    font-size: 10.5px;
    line-height: 1.2;
    padding: 6px 5px;
    gap: 4px;
    flex-direction: row;
    white-space: normal;
  }

  .mode-tab .tab-ico {
    font-size: 11px;
  }

  .stage-quick-switches {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
  }

  .mini-pill-btn {
    padding: 5px 9px;
    font-size: 10.5px;
  }

  .artboard-outer-center {
    flex-direction: column;
    align-items: safe center;
    justify-content: safe center;
    gap: 0;
    width: 100%;
    max-width: 100%;
    min-height: auto;
    padding: 4px 0;
    overflow: auto;
  }

  /* Na telefonie ukrywamy mały podgląd 2x2 pod płótnem (użytkownik ma zakładkę Siatka edytowalna 2x2 nad płótnem) */
  .mini-preview-2x2-card,
  .dock-preview-slot {
    display: none !important;
  }

  /* Większe, wygodne dla palca uchwyty skalowania i obrotu */
  .transform-handle {
    width: 22px;
    height: 22px;
  }

  .transform-handle.nw { top: -11px; left: -11px; }
  .transform-handle.ne { top: -11px; right: -11px; }
  .transform-handle.sw { bottom: -11px; left: -11px; }
  .transform-handle.se { bottom: -11px; right: -11px; }

  .transform-handle.rotate {
    top: -38px;
    left: calc(50% - 14px);
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .transform-handle.rotate::after {
    top: 26px;
    height: 11px;
  }

  /* Pływający pasek narzędzi kompaktowy i wyśrodkowany wewnątrz płótna */
  .selection-toolbar {
    flex-wrap: wrap;
    justify-content: center;
    max-width: calc(100% - 10px);
    white-space: normal;
    padding: 3px;
    gap: 2px;
  }

  .toolbar-tile-btn {
    height: 26px;
    padding: 0 6px;
    font-size: 10.5px;
  }

  .toolbar-divider {
    display: none;
  }

  /* Pasek pod płótnem na mobile: Szybkie ułożenie po lewej + Skala płótna (50-100%) po prawej */
  .stage-under-canvas-row {
    width: 100%;
    max-width: 100%;
    justify-content: space-between;
    align-items: center;
    gap: 5px;
  }

  .stage-placement-card {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: auto;
    max-width: 100%;
    padding: 4px 5px;
    gap: 4px;
    flex-wrap: wrap;
  }

  .placement-kicker {
    display: none;
  }

  .dock-placement-shortcuts {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-wrap: nowrap;
  }

  .dock-placement-shortcuts .dock-chip {
    padding: 4px 4px;
    font-size: 9px;
  }

  .stage-footer-bar {
    display: none;
  }

  /* Pasek zakładek Krok 1 / Krok 2 / Krok 3 bezpośrednio pod płótnem */
  .mobile-step-nav {
    order: 2;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 46px;
    z-index: 20;
  }

  .mobile-step-tab {
    border: 1.5px solid var(--border-color);
    background: var(--bg-subtle);
    color: var(--text-secondary);
    border-radius: 10px;
    padding: 8px 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.14s ease;
  }

  .mobile-step-tab .mstep-badge {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: var(--border-color);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 800;
    display: grid;
    place-items: center;
  }

  .mobile-step-tab.active {
    background: var(--indigo);
    border-color: var(--indigo);
    color: #ffffff;
  }

  .mobile-step-tab.active .mstep-badge {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
  }

  /* Krok 1, Krok 2 (Tło) i Krok 3 (Eksport) wypełniają 100% szerokości na mobile */
  .bento-sidebar,
  .bento-sidebar.left,
  .bento-sidebar.right {
    order: 3;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    padding: 10px;
    border: 0 !important;
    background: var(--bg-workspace);
    grid-column: auto;
    grid-row: auto;
  }

  .bento-sidebar.right [data-mstep-card="2"],
  .bento-sidebar.right [data-mstep-card="3"],
  .bento-sidebar .step-card {
    grid-column: auto;
    grid-row: auto;
    width: 100%;
    max-width: 100%;
  }

  /* Pokazuj tylko aktywny krok na telefonie */
  .atelier-grid[data-mobile-step="1"] .bento-sidebar.right {
    display: none;
  }

  .atelier-grid[data-mobile-step="2"] .bento-sidebar.left,
  .atelier-grid[data-mobile-step="3"] .bento-sidebar.left {
    display: none;
  }

  .atelier-grid[data-mobile-step="2"] [data-mstep-card="3"] {
    display: none;
  }

  .atelier-grid[data-mobile-step="3"] [data-mstep-card="2"] {
    display: none;
  }

  .asset-tray-grid {
    grid-template-columns: repeat(5, 1fr);
    max-height: 210px;
  }

  .btn-outline {
    font-size: 12px;
    min-height: 36px;
  }

  .tex-btn {
    padding: 8px 6px;
    font-size: 11.5px;
  }

  .seg-pill,
  .seg-pill.fmt-btn {
    font-size: 11.5px;
    padding: 7px 6px;
  }

  .pack-chip {
    padding: 8px 6px;
    font-size: 12px;
  }

  .density-preset-btn {
    padding: 6px 6px;
    font-size: 11.5px;
  }

  .dimensions-select-row {
    grid-template-columns: 1fr;
  }

  .multi-select-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 7px 9px;
    font-size: 11px;
  }

  .multi-select-actions {
    justify-content: flex-end;
  }

  .toast-stack {
    left: 12px;
    right: 12px;
    bottom: 12px;
    align-items: center;
  }

  .toast-msg {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 420px) {
  .brand-name {
    font-size: 12.5px;
  }

  .mode-tab {
    font-size: 9.5px;
    padding: 5px 3px;
  }

  .dock-placement-shortcuts .dock-chip {
    font-size: 9.5px;
    padding: 6px 1px;
  }

  .asset-tray-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .auto-layout-row {
    grid-template-columns: 1fr;
  }
}
