.bottle-editor-ui {
  --ink: #101a2d;
  --muted: #5b6b85;
  --line: #dde4f0;
  --accent: #1f4fd8;
  --accent-dark: #143aa8;
  --bg: #eef2f9;
  --card: #ffffff;
  --radius: 20px;
  --shadow: 0 18px 50px -22px rgba(16, 32, 74, 0.28);
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  color: var(--ink);
}

@scope (.bottle-editor-ui) {

* { box-sizing: border-box; margin: 0; padding: 0; }

:scope {
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #e9effb 0%, #f4f7fc 42%, #e6ecf8 100%);
  min-height: 100vh;
}

/* dekoracyjne tło: poświaty w kolorach marki (stałe przy przewijaniu) */
:scope::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1100px 620px at 88% -12%, rgba(76, 141, 255, 0.36), transparent 62%),
    radial-gradient(950px 680px at -12% 22%, rgba(31, 79, 216, 0.15), transparent 58%),
    radial-gradient(820px 560px at 80% 108%, rgba(215, 25, 32, 0.10), transparent 62%),
    radial-gradient(700px 500px at 10% 106%, rgba(255, 210, 41, 0.14), transparent 60%);
}

/* delikatna siatka kropek, zanika ku dołowi */
:scope::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(rgba(16, 32, 74, 0.06) 1.2px, transparent 1.3px);
  background-size: 26px 26px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.2));
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.2));
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 48px);
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #4c8dff);
  color: #fff; font-weight: 800; font-size: 22px;
  border-radius: 14px;
  box-shadow: 0 10px 24px -10px rgba(31, 79, 216, 0.6);
}
.brand-text strong { display: block; font-size: 17px; }
.brand-text small { color: var(--muted); }

.back-link { color: var(--muted); text-decoration: none; font-weight: 600; }
.back-link:hover { color: var(--accent); }
.admin-nav { display: flex; align-items: center; gap: 18px; }
.admin-nav[hidden] { display: none; }

/* ---------- layout ---------- */
.creator {
  display: grid;
  grid-template-columns: minmax(380px, 520px) minmax(360px, 560px);
  justify-content: center;
  gap: clamp(18px, 3vw, 40px);
  padding: 8px clamp(16px, 4vw, 48px) 72px;
}

/* ---------- stage / preview ---------- */
.preview-column {
  position: sticky;
  top: 20px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.stage-panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 24px 18px;
}

.stage-head { display: flex; justify-content: space-between; align-items: flex-start; }
.panel-label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--accent);
}
.stage-head h1 { font-size: 22px; margin-top: 4px; }

.icon-button {
  border: 1px solid var(--line);
  background: #fff;
  width: 40px; height: 40px;
  border-radius: 12px;
  font: 800 15px/1 "Segoe UI", system-ui, sans-serif;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}
.icon-button:hover { color: var(--accent); border-color: var(--accent); }
.icon-button[hidden] { display: none; }
.icon-button.center-object-button {
  width: auto;
  min-width: 76px;
  padding: 0 12px;
}
.icon-button:disabled {
  color: var(--muted);
  border-color: var(--line);
  cursor: default;
  opacity: .55;
}

.stage { position: relative; margin-top: 6px; }
.stage-glow {
  display:none;
  background:none;
}

#bottleSvg { position: relative; width: 100%; height: auto; display: block; }

#bottleFloat { animation: none; }
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}
#groundShadow { display:none; animation:none; }
@keyframes shadowPulse {
  0%, 100% { transform: scaleX(1); opacity: 0.14; }
  50% { transform: scaleX(0.92); opacity: 0.10; }
}

.part path, .part rect { transition: fill 0.45s ease; }
#bodyPath, #capPath, #capLip, #spoutBase, #spoutTop, #spoutTip,
#glossRect, #shadeRect, #capGlossRect, #spoutGlossRect, #printFrame {
  transition: fill 0.45s ease, d 0.5s ease, x 0.5s ease, y 0.5s ease, width 0.5s ease, height 0.5s ease;
}

.part { transform-box: fill-box; transform-origin: center; }
.part.bump { animation: bump 0.35s ease; }
@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.035); }
  100% { transform: scale(1); }
}

#printPlaceholder {
  font-size: 21px; font-weight: 800; letter-spacing: 0.14em;
  opacity: 0.85;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.65);
  stroke-width: 5px;
  stroke-linejoin: round;
}

/* ---------- szablon produkcyjny (prawdziwa makieta) ---------- */
.tpl-stage { position: relative; padding: 10px 0 4px; animation:none; }
.tpl-stage[hidden] { display: none; }
.tpl-stage svg {
  width: 100%; height: auto; max-height: 600px; display: block;
  filter:none;
}
.tpl-stage .part-bottle, .tpl-stage .part-cap, .tpl-stage .part-spout {
  transform-box: fill-box; transform-origin: center;
}
.tpl-stage .bump { animation: tplBump 0.35s ease; }
@keyframes tplBump {
  0% { transform: scale(1); }
  40% { transform: scale(1.015); }
  100% { transform: scale(1); }
}
.tpl-stage .tpl-zone { outline: none; }
.tpl-stage .tpl-zone rect { transition: stroke-opacity 0.15s, stroke-width 0.15s, fill-opacity 0.15s; }
.tpl-labels {
  position: relative;
  height: 20px;
  margin-top: 8px;
}
.tpl-stage .tpl-label {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  color: #8494ad;
  font: 700 12px "Segoe UI", system-ui, Arial, sans-serif;
  letter-spacing: 0.24em;
  white-space: nowrap;
}

/* ---------- summary chips ---------- */
.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.summary .chip { text-align: center; font-size: 11.5px; color: var(--muted); }
.summary .chip strong { display: block; font-size: 12.5px; color: var(--ink); margin-top: 3px; }
.summary .dot {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.12); vertical-align: -1px; margin-right: 4px;
  transition: background 0.45s;
}

/* ---------- controls ---------- */
.controls { display: flex; flex-direction: column; gap: 18px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
}

.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-head h2 { font-size: 17px; }
.step {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #4c8dff);
  color: #fff; font-size: 14px; font-weight: 700;
  border-radius: 10px;
}

/* modele */
.model-card { padding: 18px 20px; }
.model-card .card-head { margin-bottom: 12px; }
.model-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 132px));
  justify-content: center;
  justify-items: stretch;
  gap: 10px;
}
.model-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 2px solid var(--line);
  background: #fbfcff;
  border-radius: 16px;
  padding: 12px 8px 10px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  font: inherit;
}
.model-option:hover { border-color: #b9c8ea; transform: translateY(-2px); }
.model-option.active {
  border-color: var(--accent);
  background: #f0f5ff;
  box-shadow: 0 8px 20px -12px rgba(31, 79, 216, 0.5);
}
.model-option .model-thumb {
  width: 64px;
  height: 104px;
  display: block;
  margin: 0 auto 6px;
  align-self: center;
  flex: none;
  overflow: hidden;
  pointer-events: none;
}
.model-option .model-thumb svg { display: block; width: 100%; height: 100%; overflow: hidden; }
.model-option .mini-part-bottle { fill: var(--c-bottle, #f7f7f2); stroke: rgba(0, 0, 0, 0.22); stroke-width: 2; }
.model-option .mini-part-cap { fill: var(--c-cap, #d71920); stroke: rgba(0, 0, 0, 0.22); stroke-width: 2; }
.model-option .mini-part-spout { fill: var(--c-spout, #15161a); stroke: rgba(0, 0, 0, 0.22); stroke-width: 2; }
.model-option .mini-part-bottle,
.model-option .mini-part-cap,
.model-option .mini-part-spout { transition: fill 0.45s ease; }
.model-option .mini-grips { fill: none; stroke: rgba(0, 0, 0, 0.12); stroke-width: 5; stroke-linecap: round; }
.model-option .mini-gloss { fill: rgba(255, 255, 255, 0.3); }
.model-option strong { display: block; font-size: 15px; }
.model-option span { font-size: 11.5px; color: var(--muted); }
.model-option em { display: block; min-height: 30px; font-style: normal; font-size: 10.5px; line-height: 1.35; color: var(--muted); margin-top: 5px; }

.project-objects-card { margin-top: 12px; }
.project-object-list { display: grid; gap: 6px; }
.project-object-item {
  width: 100%; min-width: 0; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--ink); cursor: pointer; text-align: left;
}
.project-object-item strong,
.project-object-item span {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.project-object-item strong { font-size: 13px; }
.project-object-item span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.project-object-item:hover,
.project-object-item.active { border-color: var(--accent); background: #eef3ff; }

/* kolory */
.color-group { margin-bottom: 14px; }
.color-group:last-child { margin-bottom: 0; }
.color-label {
  font-size: 13px; font-weight: 700; margin-bottom: 8px;
  display: flex; justify-content: space-between; align-items: baseline;
}
.color-name { font-weight: 600; color: var(--muted); font-size: 12px; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.1);
  cursor: pointer;
  position: relative;
  transition: transform 0.15s;
  flex: none;
  padding: 0;
}
.swatch:hover { transform: scale(1.16); }
.swatch.active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4.5px var(--accent);
  transform: scale(1.08);
}
.swatch.active::after {
  content: "✓";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #fff; font-size: 15px; font-weight: 800;
  text-shadow: 0 1px 3px rgba(0,0,0,0.55);
}
.swatch.light.active::after { color: #223; text-shadow: none; }

/* upload */
.zone-instruction {
  margin: -4px 0 14px;
  padding: 10px 12px;
  border: 1px solid #cdd9f3;
  border-radius: 10px;
  background: #f3f7ff;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.zone-instruction strong { color: var(--accent); }
.zone-instruction #zoneActionStatus { display: block; margin-top: 4px; color: #b4232a; font-weight: 700; }
.small-zone-choices {
  margin: -4px 0 14px;
  padding: 14px;
  border: 1px solid #cdd9f3;
  border-radius: 12px;
  background: #f7f9ff;
}
.small-zone-choices[hidden] { display: none; }
.small-zone-choices > strong { display: block; margin-bottom: 10px; font-size: 13px; }
.small-zone-choices > div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.small-zone-choices button {
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: #fff;
  color: var(--accent);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.small-zone-choices button:hover { background: #edf3ff; }
.small-zone-choices button:disabled { border-color: #c7cfdd; color: #8c97aa; cursor: not-allowed; background: #f0f2f6; }
.small-zone-choices > span { display: block; margin-top: 8px; color: var(--muted); font-size: 11.5px; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 2px dashed #c3cfe6;
  border-radius: 16px;
  background: #fafbff;
  padding: 20px 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  margin-bottom: 12px;
}
.dropzone[hidden] { display: none; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: #f0f5ff; }
.dropzone input { display: none; }
.drop-icon {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: #e7eeff; color: var(--accent);
  border-radius: 50%; font-size: 18px; margin-bottom: 4px;
}
.dropzone span { font-size: 12.5px; color: var(--muted); }
.dropzone strong { font-size: 14.5px; }

.logo-row[hidden] { display: none; }
.logo-row {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; gap: 6px;
  background: #f0f5ff; border-radius: 12px;
  padding: 8px 14px; margin-bottom: 12px; font-size: 13px;
}
.logo-row #logoFileName {
  grid-column: 1 / -1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.logo-row button {
  min-width: 0; min-height: 32px; padding: 4px 7px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #c22; font-weight: 700;
  cursor: pointer; font-size: 12px;
}
.logo-row #rotateLogo,
.logo-row #decreaseLogo,
.logo-row #increaseLogo,
.logo-row #duplicateLogo { color: #2457d6; }
.logo-row button:disabled { cursor: not-allowed; opacity: 0.45; }
.original-logo-preview {
  margin: 10px 0 14px; padding: 10px;
  border: 1px solid var(--line); border-radius: 10px; background: #f8fafc;
}
.original-logo-preview img {
  display: block; width: 100%; max-height: 180px;
  object-fit: contain; background: #fff;
}
.original-logo-preview figcaption {
  margin-top: 7px; color: var(--muted);
  font-size: 11px; font-weight: 700; text-align: center;
}

/* ---------- napisy (własne teksty na bidonie) ---------- */
.text-add {
  display: grid; grid-template-columns: minmax(0, 1fr) 42px;
  margin-top: 12px;
}
.text-add input,
.text-add textarea { grid-column: 1 / -1; }
.text-add textarea { min-height: 62px; resize: vertical; }
.text-add #addText { min-width: 0; }
.text-add #clearLiveTextBtn {
  width: 42px; padding: 0; color: #b4232a; background: #fff0f1;
  font-size: 22px; line-height: 1;
}
.text-add #clearLiveTextBtn:hover { background: #ffe0e3; }
.text-item {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; align-items: center;
  margin-top: 8px;
}
.text-item input,
.text-item textarea {
  grid-column: 1 / -1; min-width: 0;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font-size: 13px;
}
.text-item textarea { min-height: 54px; resize: vertical; }
.font-picker { position: relative; grid-column: 1 / -1; min-width: 0; }
.text-item .font-picker-current {
  width: 100%; padding: 5px 9px; overflow: hidden; font-size: 13px; text-overflow: ellipsis;
}
.font-picker-menu {
  position: absolute; z-index: 40; top: calc(100% + 5px); left: 0;
  width: 210px; max-height: 280px; padding: 5px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 11px; background: #fff;
  box-shadow: 0 14px 34px rgba(22, 32, 42, 0.18);
}
.font-picker-menu[hidden] { display: none; }
.text-item .font-picker-option {
  display: block; width: 100%; min-height: 38px; padding: 5px 9px;
  border: 0; border-radius: 7px; font-size: 15px; text-align: left;
}
.text-item .font-picker-option:hover,
.text-item .font-picker-option[aria-selected="true"] { color: var(--accent); background: #eef3ff; }
.text-item button {
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  min-width: 32px; min-height: 32px; cursor: pointer;
  font-weight: 700; font-size: 13px; white-space: nowrap;
}
.text-add button:disabled, .text-add input:disabled { cursor: not-allowed; opacity: 0.55; }
.signature-action {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 8px;
  padding: 10px;
  border: 1px dashed #aebbd0;
  border-radius: 12px;
  background: #f7f9fd;
}
.signature-action button {
  flex: none;
  min-height: 46px;
  border: none;
  border-radius: 10px;
  padding: 0 16px;
  background: var(--ink);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 5px 14px rgba(20, 38, 73, 0.18);
}
.signature-action button:active,
.signature-action button.is-dragging { cursor: grabbing; transform: scale(0.98); }
.signature-action button span { margin-right: 5px; font-size: 17px; }
.signature-action button:disabled {
  background: #aab4c5;
  cursor: not-allowed;
  opacity: 0.72;
}
.signature-action > span { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.signature-strip-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfcff;
  color: var(--muted);
  font-size: 12px;
}
.signature-strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.signature-strip-item button { border: none; background: none; color: #b4232a; font-weight: 700; cursor: pointer; }
.text-item button.del { color: #c22; }
#printTexts text { user-select: none; }
#printTexts text,
#signatureStrips rect { touch-action: none; }
.tpl-stage.is-strip-drop-mode .tpl-zone:not(.is-drop-target) rect { fill-opacity: 0.08; }
.tpl-stage .tpl-zone.is-drop-target rect {
  stroke: #19a66a !important;
  stroke-width: 150 !important;
  stroke-opacity: 1 !important;
  fill: #19a66a !important;
  fill-opacity: 0.2 !important;
}

.pantone-row { display: flex; gap: 8px; margin-top: 12px; }
.pantone-row input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  font: inherit; font-size: 14px;
}
.pantone-row input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.pantone-row button {
  border: none; border-radius: 12px;
  background: var(--ink); color: #fff;
  padding: 0 20px; font-weight: 700; font-size: 14px;
  cursor: pointer; transition: background 0.2s;
}
.pantone-row button:hover { background: var(--accent); }

.hint { font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.5; }

.stroke-width-warning {
  margin: 8px 0;
  padding: 9px 11px;
  border: 1px solid #f0c36a;
  border-radius: 9px;
  color: #7a4b00;
  background: #fff8e7;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

/* wycena */
.qty-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.qty-row label { font-size: 13px; font-weight: 700; }
.qty-row input {
  width: 110px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
  font: inherit; font-size: 15px; font-weight: 700;
  text-align: right;
}

#quantityRange { width: 100%; accent-color: var(--accent); margin: 4px 0 8px; }

.tier-strip { display: flex; gap: 6px; margin-bottom: 16px; }
.tier-strip span {
  flex: 1; text-align: center;
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  background: #f3f6fc; border-radius: 10px; padding: 6px 2px;
  transition: all 0.2s;
}
.tier-strip span em { font-style: normal; color: #178a4c; }
.tier-strip span.on { background: var(--accent); color: #fff; }
.tier-strip span.on em { color: #bff3d4; }

.price-box {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  background: linear-gradient(135deg, #101a2d, #1c2e52);
  border-radius: 16px;
  padding: 18px 20px;
  color: #fff;
}
.price-box span { font-size: 12px; opacity: 0.75; }
.price-box strong { display: block; font-size: 26px; margin: 2px 0; }
.price-box small { font-size: 12.5px; opacity: 0.75; }

.cta {
  flex: none;
  background: linear-gradient(135deg, #37b45f, #23994b);
  color: #fff; text-decoration: none;
  font-weight: 700; font-size: 14.5px;
  padding: 13px 20px;
  border-radius: 13px;
  box-shadow: 0 10px 24px -10px rgba(35, 153, 75, 0.7);
  transition: transform 0.15s, box-shadow 0.15s;
  text-align: center;
}
.cta:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -10px rgba(35, 153, 75, 0.8); }

/* ---------- eksport i udostepnianie ---------- */
.export-description { margin: -4px 0 16px; font-size: 13px; }
.export-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.export-button,
.share-result button,
.share-result a {
  min-height: 44px;
  border: none;
  border-radius: 12px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), #4c8dff);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.export-button.secondary { background: var(--ink); }
.export-button.clear-project { background: #eef1f6; color: #a1262f; }
.export-button.clear-project:hover { background: #feecef; }
.share-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  margin-top: 12px;
}
.share-result[hidden] { display: none; }
.share-result input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  font: inherit;
}
.share-result button,
.share-result a { min-height: 40px; background: #eef3ff; color: var(--accent); }
.export-status { min-height: 18px; margin: 10px 0 0; color: var(--muted); font-size: 12px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .creator { grid-template-columns: 1fr; }
  .preview-column { position: static; }
  .price-box { flex-direction: column; align-items: stretch; text-align: center; }
}

@media (max-width: 520px) {
  .model-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .export-actions { grid-template-columns: 1fr; }
  .share-result { grid-template-columns: 1fr 1fr; }
  .share-result input { grid-column: 1 / -1; min-height: 42px; }
}
}

[data-bottle-editor-config][data-readonly="true"] ~ .bottle-editor-ui .model-card,
[data-bottle-editor-config][data-readonly="true"] ~ .bottle-editor-ui .project-objects-card,
[data-bottle-editor-config][data-readonly="true"] ~ .bottle-editor-ui .controls,
[data-bottle-editor-config][data-readonly="true"] ~ .bottle-editor-ui .icon-button { display:none!important; }
[data-bottle-editor-config][data-readonly="true"] ~ .bottle-editor-ui .panel-label { display:none!important; }
[data-bottle-editor-config][data-readonly="true"] ~ .bottle-editor-ui .tpl-zone {
  pointer-events:none!important;
}
[data-bottle-editor-config][data-readonly="true"] ~ .bottle-editor-ui .tpl-zone rect {
  fill:none!important;
  stroke:none!important;
  pointer-events:none!important;
}
[data-bottle-editor-config][data-readonly="true"] ~ .bottle-editor-ui.creator { display:block;max-width:920px;padding:0; }
.tn2-creator-left-panel .bottle-editor-ui { padding:12px; }
.tn2-creator-left-panel .bottle-editor-ui .model-grid { grid-template-columns:1fr; }
.tn2-creator-left-panel .bottle-editor-ui .model-option { grid-template-columns:76px minmax(0,1fr);text-align:left;align-items:center; }
.tn2-creator-left-panel .bottle-editor-ui .model-option .model-thumb { height:92px; }
.tn2-creator-left-panel .bottle-editor-ui .project-objects-card { border-top:1px solid var(--card-border); }
.tn2-creator-right-panel .bottle-editor-ui .controls { gap:12px; }
.tn2-creator-right-panel,
.tn2-creator-right-panel [data-creator-sidebar-host="right"],
.tn2-creator-right-panel .bottle-editor-ui,
.tn2-creator-right-panel .bottle-editor-ui .controls,
.tn2-creator-right-panel .bottle-editor-ui .card { min-width:0;max-width:100%;overflow-x:hidden; }
.tn2-creator-right-panel .bottle-editor-ui .card { border-radius:12px;padding:14px;box-shadow:none; }
.tn2-creator-right-panel .bottle-editor-ui .export-actions { grid-template-columns:1fr; }
.tn2-creator-right-panel .bottle-editor-ui .swatches { gap:6px; }
.tn2-creator-right-panel .bottle-editor-ui .swatch { width:30px;height:30px; }

/* Integracja z CRM: mechanika i wizualizacja bidonu zostają własne,
   natomiast cała otoczka interfejsu dziedziczy aktywny motyw TN2. */
body.tn2-creator-mode .bottle-editor-ui {
  --ink: var(--main-text);
  --muted: color-mix(in srgb, var(--main-text) 62%, transparent);
  --line: var(--card-border);
  --accent: inherit;
  --bg: var(--main-bg);
  --card: var(--card-bg);
  --radius: var(--ui-radius);
  --shadow: none;
  min-height: 0;
  background: transparent;
  color: var(--main-text);
  font-family: inherit;
  font-size: inherit;
}
body.tn2-creator-mode .bottle-editor-ui::before,
body.tn2-creator-mode .bottle-editor-ui::after { display:none; }
body.tn2-creator-mode .bottle-editor-ui .stage-panel,
body.tn2-creator-mode .bottle-editor-ui .card {
  border:1px solid var(--card-border);
  border-radius:var(--ui-radius);
  background:var(--card-bg);
  color:var(--main-text);
  box-shadow:none;
}
body.tn2-creator-mode .bottle-editor-ui .model-option,
body.tn2-creator-mode .bottle-editor-ui .project-object-item,
body.tn2-creator-mode .bottle-editor-ui .zone-instruction,
body.tn2-creator-mode .bottle-editor-ui .small-zone-choices,
body.tn2-creator-mode .bottle-editor-ui .dropzone,
body.tn2-creator-mode .bottle-editor-ui .logo-row,
body.tn2-creator-mode .bottle-editor-ui .signature-action,
body.tn2-creator-mode .bottle-editor-ui .signature-strip-item,
body.tn2-creator-mode .bottle-editor-ui .tier-strip span,
body.tn2-creator-mode .bottle-editor-ui .export-button.clear-project {
  border-color:var(--card-border);
  border-radius:var(--ui-radius);
  background:color-mix(in srgb, var(--card-bg) 88%, var(--main-bg));
  color:var(--main-text);
  box-shadow:none;
}
body.tn2-creator-mode .bottle-editor-ui .model-option:hover,
body.tn2-creator-mode .bottle-editor-ui .model-option.active,
body.tn2-creator-mode .bottle-editor-ui .project-object-item:hover,
body.tn2-creator-mode .bottle-editor-ui .project-object-item.active,
body.tn2-creator-mode .bottle-editor-ui .dropzone:hover,
body.tn2-creator-mode .bottle-editor-ui .dropzone.drag,
body.tn2-creator-mode .bottle-editor-ui .text-item .font-picker-option:hover,
body.tn2-creator-mode .bottle-editor-ui .text-item .font-picker-option[aria-selected="true"] {
  border-color:var(--accent);
  background:color-mix(in srgb, var(--accent) 12%, var(--card-bg));
  color:var(--main-text);
}
body.tn2-creator-mode .bottle-editor-ui input,
body.tn2-creator-mode .bottle-editor-ui select,
body.tn2-creator-mode .bottle-editor-ui textarea,
body.tn2-creator-mode .bottle-editor-ui .icon-button,
body.tn2-creator-mode .bottle-editor-ui .small-zone-choices button,
body.tn2-creator-mode .bottle-editor-ui .text-item button,
body.tn2-creator-mode .bottle-editor-ui .font-picker-menu,
body.tn2-creator-mode .bottle-editor-ui .share-result button,
body.tn2-creator-mode .bottle-editor-ui .share-result a {
  border-color:var(--card-border);
  border-radius:var(--ui-radius);
  background:var(--card-bg);
  color:var(--main-text);
  font-family:inherit;
}
body.tn2-creator-mode .bottle-editor-ui .step,
body.tn2-creator-mode .bottle-editor-ui .export-button,
body.tn2-creator-mode .bottle-editor-ui .tier-strip span.on {
  border-radius:var(--ui-radius);
  background:var(--accent);
  color:#fff;
  box-shadow:none;
}
body.tn2-creator-mode .bottle-editor-ui .drop-icon {
  background:color-mix(in srgb, var(--accent) 14%, var(--card-bg));
  color:var(--accent);
}
body.tn2-creator-mode .bottle-editor-ui .stage-glow {
  display:none;
  background:none;
}
body.tn2-creator-mode .bottle-editor-ui .price-box,
body.tn2-creator-mode .bottle-editor-ui .signature-action button,
body.tn2-creator-mode .bottle-editor-ui .pantone-row button,
body.tn2-creator-mode .bottle-editor-ui .export-button.secondary {
  border-radius:var(--ui-radius);
  background:var(--main-bg);
  color:var(--main-text);
  box-shadow:none;
}

/* Te same proporcje komponentów co w pozostałych kreatorach CRM. */
body.tn2-creator-mode .bottle-editor-ui .card,
body.tn2-creator-mode .bottle-editor-ui .stage-panel { padding:1rem; }
body.tn2-creator-mode .tn2-creator-left-panel .bottle-editor-ui { padding:0; }
body.tn2-creator-mode .tn2-creator-left-panel .bottle-editor-ui .card {
  border:0;
  border-radius:0;
  padding:.75rem;
  background:transparent;
}
body.tn2-creator-mode .bottle-editor-ui .card-head {
  gap:0;
  margin-bottom:.75rem;
}
body.tn2-creator-mode .bottle-editor-ui .card-head h2 {
  color:var(--main-text);
  font-size:1rem;
  font-weight:600;
}
body.tn2-creator-mode .bottle-editor-ui .step { display:none; }
body.tn2-creator-mode .bottle-editor-ui .panel-label {
  color:var(--main-text);
  font-size:.75rem;
  font-weight:400;
  letter-spacing:0;
  text-transform:none;
  opacity:.55;
}
body.tn2-creator-mode .bottle-editor-ui .stage-head h1 {
  color:var(--main-text);
  font-size:1.125rem;
  font-weight:600;
}
body.tn2-creator-mode .bottle-editor-ui .tpl-stage .tpl-label { font-family:inherit; }
body.tn2-creator-mode .bottle-editor-ui .model-option {
  border-width:1px;
  border-radius:var(--ui-radius);
  padding:.5rem;
  transition:opacity .15s, border-color .15s, background .15s;
}
body.tn2-creator-mode .bottle-editor-ui .model-option:hover {
  transform:none;
  opacity:.9;
}
body.tn2-creator-mode .bottle-editor-ui .model-option.active { box-shadow:none; }
body.tn2-creator-mode .bottle-editor-ui .model-option strong { font-size:.875rem; }
body.tn2-creator-mode .bottle-editor-ui .model-option span,
body.tn2-creator-mode .bottle-editor-ui .model-option em,
body.tn2-creator-mode .bottle-editor-ui .hint,
body.tn2-creator-mode .bottle-editor-ui .color-name,
body.tn2-creator-mode .bottle-editor-ui .zone-instruction,
body.tn2-creator-mode .bottle-editor-ui .signature-action > span { color:var(--muted); }
body.tn2-creator-mode .bottle-editor-ui .zone-instruction,
body.tn2-creator-mode .bottle-editor-ui .small-zone-choices,
body.tn2-creator-mode .bottle-editor-ui .dropzone,
body.tn2-creator-mode .bottle-editor-ui .logo-row,
body.tn2-creator-mode .bottle-editor-ui .signature-action,
body.tn2-creator-mode .bottle-editor-ui .signature-strip-item {
  border-radius:var(--ui-radius);
  box-shadow:none;
}
body.tn2-creator-mode .bottle-editor-ui .dropzone { padding:1rem .75rem; }
body.tn2-creator-mode .bottle-editor-ui .drop-icon {
  width:2rem;
  height:2rem;
  border-radius:var(--ui-radius);
}
body.tn2-creator-mode .bottle-editor-ui .pantone-row input,
body.tn2-creator-mode .bottle-editor-ui .qty-row input,
body.tn2-creator-mode .bottle-editor-ui .text-item input {
  border-radius:var(--ui-radius);
  font:inherit;
}
body.tn2-creator-mode .bottle-editor-ui .export-actions { gap:.5rem; }
body.tn2-creator-mode .bottle-editor-ui .export-button,
body.tn2-creator-mode .bottle-editor-ui .share-result button,
body.tn2-creator-mode .bottle-editor-ui .share-result a {
  min-height:2.25rem;
  border-radius:var(--ui-radius);
  padding:.5rem .75rem;
  font-size:.75rem;
  font-weight:600;
}
body.tn2-creator-mode .bottle-editor-ui .export-button.secondary {
  border:1px solid var(--card-border);
  background:var(--card-bg);
  color:var(--accent);
}
body.tn2-creator-mode .bottle-editor-ui .export-button.clear-project {
  border:0;
  background:transparent;
  color:#dc2626;
}

.bottle-public-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  max-width:920px;
  margin:0 auto 16px;
  padding:18px 20px;
  border-bottom:1px solid var(--line);
  background:var(--card);
}
.bottle-public-header h1 { font-size:20px;font-weight:700; }
.bottle-public-header nav { display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end; }
.bottle-public-header nav .bottle-variant-option {
  display:flex;
  flex-direction:column;
  gap:5px;
  align-items:center;
  padding:7px 10px;
  border:1px solid var(--line);
  border-radius:8px;
  color:var(--ink);
  font-size:12px;
  font-weight:700;
}
.bottle-public-header nav a {
  color:inherit;
  text-decoration:none;
}
.bottle-variant-thumbnail,
.bottle-project-thumbnail-preview {
  position:relative;
  display:block;
  width:128px;
  height:92px;
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:7px;
  background:#fff;
}
.bottle-variant-thumbnail iframe,
.bottle-project-thumbnail-preview iframe {
  width:100%;
  height:100%;
  border:0;
  pointer-events:none;
}
.bottle-project-thumbnail { width:146px; background:var(--card-bg, #fff); }
.bottle-project-thumbnail-preview { width:128px; margin:0 auto; }
.bottle-project-thumbnail > div { min-width:0; }
.bottle-project-thumbnail > div > a { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bottle-public-header nav .bottle-variant-option.active {
  border-color:var(--accent);
  background:var(--accent);
  color:#fff;
}
body.bottle-public-page {
  min-height:100vh;
  margin:0;
  background:#eef2f9;
}
body.bottle-editor-pending > .creator {
  visibility:hidden;
}
.bottle-editor-ui.bottle-editor-pending {
  visibility:hidden;
}
body.bottle-public-page > .bottle-editor-ui {
  min-height:0;
  background:transparent;
}
body.bottle-public-page > .bottle-editor-ui::before,
body.bottle-public-page > .bottle-editor-ui::after {
  display:none;
}
body.bottle-public-page > .bottle-public-header {
  background:transparent;
}
body.bottle-public-page > .creator {
  margin:0 auto;
}
body.bottle-miniature-page {
  width:128px;
  height:92px;
  min-height:0;
  overflow:hidden;
  background:#fff;
}
body.bottle-miniature-page > .creator {
  display:block;
  width:128px;
  height:92px;
  margin:0;
  padding:0;
}
body.bottle-miniature-page .preview-column,
body.bottle-miniature-page .stage-panel {
  width:128px;
  height:92px;
  margin:0;
  padding:0;
  border:0;
  box-shadow:none;
}
body.bottle-miniature-page .stage-head,
body.bottle-miniature-page .summary,
body.bottle-miniature-page .tpl-labels { display:none!important; }
body.bottle-miniature-page .stage {
  width:128px;
  height:92px;
  min-height:92px;
  padding:0;
}
body.bottle-miniature-page .tpl-stage,
body.bottle-miniature-page .tpl-stage svg {
  width:128px;
  height:92px;
  max-width:none;
  max-height:none;
}
@media(max-width:700px){
  .bottle-public-header{align-items:flex-start;flex-direction:column}
  .bottle-public-header nav{justify-content:flex-start}
}
