/* =========================================================
   TRETR Sticker Configurator — v2.0.0
   Gefuehrter, app-artiger Flow (StickerApp-Stil):
   Stage (sticky) -> Kontext-Werkzeugleiste (nur bei Auswahl)
   -> Einstiegs-Kacheln -> CTA-Leiste. Details in Bottom-Sheets.

   Astra/Elementor erzwingt globale Button-Stile (rot, !important).
   Reset nur innerhalb .tretr-configurator-shell; eigene Klassen
   werden gescopet + wo noetig !important.
   ========================================================= */

/* ---------- 0) THEME-RESET ---------- */
.tretr-configurator-shell button,
.tretr-configurator-shell input,
.tretr-configurator-shell textarea,
.tretr-configurator-shell summary {
  -webkit-appearance: none; appearance: none;
  margin: 0; min-width: 0; min-height: 0; max-width: none;
  line-height: normal; letter-spacing: normal; text-transform: none;
  text-shadow: none; box-shadow: none; background-image: none; filter: none;
}
.tretr-configurator-shell button {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit; font-weight: 600; color: inherit;
  background: transparent; background-color: transparent;
  border: none; border-radius: 0; padding: 0; cursor: pointer;
  transform: none; -webkit-tap-highlight-color: transparent;
}
.tretr-configurator-shell button::before,
.tretr-configurator-shell button::after { content: none; }
.tretr-configurator-shell button:hover,
.tretr-configurator-shell button:focus { background: transparent; color: inherit; box-shadow: none; }

/* ---------- 1) Tokens ---------- */
.tretr-configurator-shell {
  --tretr-black: #0d0d0d;
  --tretr-white: #ffffff;
  --tretr-gray-50: #f6f6f7;
  --tretr-gray-100: #ececed;
  --tretr-gray-200: #dcdcdf;
  --tretr-gray-400: #9a9aa0;
  --tretr-gray-600: #5c5c62;
  --tretr-danger: #c62828;
  --tretr-radius: 14px;
  --tretr-radius-sm: 9px;
  --tretr-sticky-top: 0px;
  --tretr-stage-bar-height: 52px;
  --tretr-stage-height: 200px;
  --tretr-font-ui: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  box-sizing: border-box;
  font-family: var(--tretr-font-ui);
  color: var(--tretr-black);
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  display: block; width: 100%;
  container-type: inline-size; container-name: tretrshell;
}
.tretr-configurator-shell *,
.tretr-configurator-shell *::before,
.tretr-configurator-shell *::after { box-sizing: border-box; }
.tretr-configurator-shell input.tretr-text-input,
.tretr-configurator-shell textarea.tretr-text-input,
.tretr-configurator-shell textarea.tretr-edit-text-input,
.tretr-configurator-shell .tretr-qty-input,
.tretr-configurator-shell .tretr-hex-input {
  font-family: inherit; font-size: 16px; color: var(--tretr-black); background: var(--tretr-white);
}
.tretr-configurator-shell :focus-visible { outline: 2px solid var(--tretr-black); outline-offset: 2px; }

/* Standard-WooCommerce Menge + Add-to-cart komplett ausblenden, sobald der
   Konfigurator aktiv ist. display:none blendet sie zuverlaessig aus; der
   JS-Klick auf den (versteckten) Original-Button funktioniert trotzdem. */
body.tretr-has-configurator form.cart .quantity,
body.tretr-has-configurator form.cart button.single_add_to_cart_button,
body.tretr-has-configurator form.cart .single_add_to_cart_button,
body.tretr-has-configurator form.cart input.qty {
  display: none !important;
}

.tretr-app {
  position: relative; width: 100%; max-width: 1100px; margin: 0 auto;
  background: var(--tretr-white); display: flex; flex-direction: column;
}

/* ---------- 2) STAGE ---------- */
.tretr-stage {
  position: sticky; top: var(--tretr-sticky-top); z-index: 5;
  background: var(--tretr-gray-50); border: 1px solid var(--tretr-gray-200);
  border-radius: var(--tretr-radius); overflow: hidden;
}
.tretr-stage-bar { position: relative; z-index: 4; display: flex; align-items: center; gap: 8px; height: var(--tretr-stage-bar-height); padding: 0 12px; background: var(--tretr-gray-50); }
.tretr-stage-title { flex: 1 1 auto; font-weight: 700; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tretr-stage-title-sub { font-weight: 400; color: var(--tretr-gray-600); }

.tretr-configurator-shell .tretr-btn-icon {
  width: 36px; height: 36px; flex: 0 0 auto; border-radius: 999px;
  border: 1px solid var(--tretr-gray-200); background: var(--tretr-white); color: var(--tretr-black);
}
.tretr-btn-icon svg { width: 17px; height: 17px; display: block; }
.tretr-btn-icon:disabled { opacity: 0.35; cursor: not-allowed; }

.tretr-configurator-shell .tretr-preview-toggle {
  gap: 6px; height: 36px; padding: 0 14px; flex: 0 0 auto; border-radius: 999px;
  border: 1px solid var(--tretr-black); background: var(--tretr-white); color: var(--tretr-black);
  font-weight: 700; font-size: 12.5px;
}
.tretr-preview-toggle svg { width: 16px; height: 16px; display: block; }
.tretr-configurator-shell .tretr-preview-toggle.active { background: var(--tretr-black) !important; color: var(--tretr-white) !important; }

.tretr-canvas-area {
  position: relative; min-height: var(--tretr-stage-height); overflow: visible;
  display: flex; align-items: center; justify-content: center; padding: 14px 22px 24px;
}
.tretr-composed-preview-img { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: calc(100% - 16px); height: calc(100% - 16px); object-fit: contain; object-position: center center; background: var(--tretr-gray-50); display: none; }
.tretr-configurator-shell.is-preview-mode .tretr-canvas-area { min-height: var(--tretr-stage-height); }
.tretr-configurator-shell.is-preview-mode .tretr-canvas-wrapper { opacity: 0; pointer-events: none; }
.tretr-configurator-shell.is-preview-mode .tretr-composed-preview-img { display: block; }

.tretr-canvas-wrapper {
  position: relative; width: min(340px, 100%); height: auto; max-width: 100%; aspect-ratio: 2 / 1;
  background: repeating-conic-gradient(var(--tretr-gray-100) 0% 25%, var(--tretr-white) 0% 50%) 0 0/14px 14px;
  border-radius: var(--tretr-radius-sm); box-shadow: 0 0 0 1px var(--tretr-gray-200), 0 6px 16px rgba(0,0,0,0.08);
}
.tretr-canvas-wrapper canvas { width: 100% !important; height: 100% !important; border-radius: var(--tretr-radius-sm); }
.tretr-safe-zone { position: absolute; inset: 6%; border: 1px dashed rgba(0,0,0,0.22); border-radius: 4px; pointer-events: none; }
.tretr-size-badge { position: absolute; transform: translate(-50%, -100%); background: var(--tretr-black); color: var(--tretr-white); font-size: 11px; padding: 3px 7px; border-radius: 6px; white-space: nowrap; display: none; z-index: 3; pointer-events: none; }
.tretr-measure { position: absolute; font-size: 10px; color: var(--tretr-gray-600); pointer-events: none; }
.tretr-measure-w { bottom: 4px; left: 50%; transform: translateX(-50%); }
.tretr-measure-h { top: 50%; right: 2px; transform: translateY(-50%) rotate(90deg); }

/* Kontext-Werkzeugleiste */
.tretr-context-tools {
  display: flex; flex-wrap: nowrap; justify-content: space-between; gap: 1px;
  padding: 8px 6px; background: var(--tretr-white); border-top: 1px solid var(--tretr-gray-200);
}
.tretr-context-tools[hidden] { display: none; }
.tretr-configurator-shell .tretr-ctx-btn {
  flex: 1 1 0; min-width: 0;
  flex-direction: column; gap: 3px; padding: 6px 1px; border-radius: 8px;
  background: transparent; color: var(--tretr-black); font-size: 9px; font-weight: 600;
}
.tretr-ctx-btn svg { width: 19px; height: 19px; display: block; }
/* Aktiver Kontext-Knopf (z. B. Flaggen-Kontur an) sichtbar markieren. */
.tretr-configurator-shell .tretr-ctx-btn.is-active {
  background: var(--tretr-black);
  color: var(--tretr-white);
}
.tretr-configurator-shell .tretr-ctx-btn.is-active svg { color: var(--tretr-white); }
.tretr-configurator-shell .tretr-ctx-btn:active { background: var(--tretr-gray-100); }
.tretr-configurator-shell .tretr-ctx-danger { color: var(--tretr-danger); }

/* ---------- 3) EINSTIEGS-KACHELN (immer 4 in einer Reihe) ----------
   Bewusst FLEX statt Grid: wenn ein Theme display:flex erzwingt, bleiben
   Grid-Angaben zwar gesetzt, wirken aber nicht -> Umbruch zu 2x2. Mit Flex +
   nowrap + 25% Breite sitzen die Kacheln in jedem Fall nebeneinander. */
.tretr-configurator-shell .tretr-entry-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
  padding: 12px 0 4px; width: 100%; max-width: 100%; box-sizing: border-box;
}
.tretr-configurator-shell .tretr-entry {
  display: flex !important; flex-direction: column !important; align-items: center !important; justify-content: center !important;
  flex: 1 1 0 !important; width: 25% !important; max-width: 25% !important; min-width: 0 !important;
  gap: 6px; padding: 12px 2px; border-radius: var(--tretr-radius); box-sizing: border-box;
  border: 1px solid var(--tretr-gray-200) !important; background: var(--tretr-white) !important; color: var(--tretr-black) !important;
  font-size: 11px; font-weight: 700; min-height: 0; margin: 0 !important; float: none !important;
}
.tretr-entry-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 999px; background: var(--tretr-gray-50); flex: 0 0 auto; }
.tretr-entry-icon svg { width: 17px; height: 17px; }
.tretr-entry span:not(.tretr-entry-icon) { text-align: center; line-height: 1.2; word-break: break-word; }
.tretr-configurator-shell .tretr-entry:active { border-color: var(--tretr-black) !important; }

/* ---------- 4) CTA-Leiste ----------
   align-self am Kind schlaegt align-items am Container. Themes setzen das gern
   auf baseline/stretch -> die Elemente "treppen" sich vertikal. Deshalb hier
   align-self ausdruecklich auf jedem Kind. */
.tretr-configurator-shell .tretr-cta-bar {
  position: sticky; bottom: 0; z-index: 6;
  display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important;
  align-items: center !important; align-content: center !important;
  gap: 10px; height: auto !important; min-height: 0 !important;
  padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--tretr-white); border-top: 1px solid var(--tretr-gray-200); box-shadow: 0 -6px 16px rgba(0,0,0,0.06);
  margin-top: 10px;
}
.tretr-configurator-shell .tretr-cta-bar > * { align-self: center !important; vertical-align: middle !important; margin: 0 !important; }
.tretr-configurator-shell .tretr-qty-stepper { display: flex !important; align-items: center !important; border: 1px solid var(--tretr-gray-200); border-radius: 999px; height: 46px !important; flex: 0 0 auto !important; overflow: hidden; }
.tretr-configurator-shell .tretr-qty-btn { width: 40px; height: 46px !important; font-size: 18px; color: var(--tretr-black); background: var(--tretr-white); align-self: center !important; }
.tretr-configurator-shell .tretr-qty-input { width: 34px; height: 44px; border: none; text-align: center; font-weight: 700; background: transparent; padding: 0; }
.tretr-configurator-shell .tretr-btn-action {
  flex: 1 1 auto !important; height: 46px !important; border-radius: 999px; font-weight: 700; font-size: 14px;
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
  position: relative !important; top: auto !important; left: auto !important; right: auto !important; bottom: auto !important;
  float: none !important; align-self: center !important; order: 0 !important;
}
.tretr-configurator-shell .tretr-btn-primary { background: var(--tretr-black) !important; color: var(--tretr-white) !important; }
.tretr-btn-primary.is-loading .tretr-btn-label { opacity: 0; }
.tretr-btn-primary .tretr-btn-spinner { display: none; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.35); border-top-color: var(--tretr-white); animation: tretr-spin .7s linear infinite; }
.tretr-btn-primary.is-loading .tretr-btn-spinner { display: block; }
.tretr-configurator-shell .tretr-btn-secondary-icon {
  width: 46px !important; height: 46px !important; flex: 0 0 auto !important;
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
  align-self: center !important; border-radius: 999px;
  border: 1px solid var(--tretr-gray-200); background: var(--tretr-white); color: var(--tretr-black);
  position: relative !important; top: auto !important; float: none !important;
}
.tretr-btn-secondary-icon svg { width: 18px; height: 18px; display: block; }
@keyframes tretr-spin { to { transform: rotate(360deg); } }

/* ---------- 5) BOTTOM-SHEETS ---------- */
.tretr-sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); opacity: 0; z-index: 100000;
  transition: opacity .2s ease;
}
.tretr-sheet-backdrop.is-open { opacity: 1; }
.tretr-sheet-backdrop[hidden] { display: none; }

.tretr-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100001;
  background: var(--tretr-white); border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.18);
  transform: translateY(100%); transition: transform .22s ease;
  max-height: 82vh; display: flex; flex-direction: column;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.tretr-sheet.is-open { transform: translateY(0); }
.tretr-sheet[hidden] { display: none; }
.tretr-sheet-head { position: relative; display: flex; align-items: center; gap: 8px; padding: 18px 16px 10px; border-bottom: 1px solid var(--tretr-gray-100); }
.tretr-sheet-head::before { content: ''; position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 40px; height: 4px; border-radius: 999px; background: var(--tretr-gray-200); }
.tretr-sheet-title { flex: 1 1 auto; font-weight: 700; font-size: 15px; }
.tretr-configurator-shell .tretr-sheet-close { width: 34px; height: 34px; border-radius: 999px; font-size: 22px; color: var(--tretr-black); background: var(--tretr-gray-50); }
.tretr-sheet-body { padding: 14px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tretr-sheet-foot { padding: 10px 16px 4px; border-top: 1px solid var(--tretr-gray-100); }
.tretr-configurator-shell .tretr-sheet-primary { width: 100%; }
.tretr-sheet-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--tretr-gray-600); margin: 16px 0 8px; }
.tretr-sheet-section-title:first-child { margin-top: 2px; }

.tretr-configurator-shell .tretr-text-input,
.tretr-configurator-shell .tretr-edit-text-input {
  width: 100%; resize: none; padding: 12px 14px; min-height: 60px;
  border: 1px solid var(--tretr-gray-200); border-radius: var(--tretr-radius-sm);
}

.tretr-grid-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tretr-configurator-shell .tretr-font-btn {
  height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--tretr-gray-200) !important; background: var(--tretr-white) !important; color: var(--tretr-black) !important; font-size: 16px;
}
.tretr-configurator-shell .tretr-font-btn.is-active { border-color: var(--tretr-black) !important; box-shadow: 0 0 0 1px var(--tretr-black) inset; }

.tretr-configurator-shell .tretr-color-btn { width: 42px; height: 42px; padding: 0; border-radius: 999px; border: 1px solid var(--tretr-gray-200); }
.tretr-configurator-shell .tretr-color-btn[data-hex="#ffffff"] { box-shadow: 0 0 0 1px var(--tretr-gray-200) inset; }
.tretr-hex-row { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 12px; font-weight: 700; color: var(--tretr-gray-600); }
.tretr-configurator-shell .tretr-hex-input { flex: 1 1 auto; height: 44px; padding: 0 14px; border: 1px solid var(--tretr-gray-200); border-radius: var(--tretr-radius-sm); font-family: monospace; }

.tretr-align-row { display: flex; gap: 8px; }
.tretr-configurator-shell .tretr-btn-tool { height: 44px; flex: 1 1 0; border-radius: var(--tretr-radius-sm); border: 1px solid var(--tretr-gray-200) !important; background: var(--tretr-white) !important; color: var(--tretr-black) !important; font-size: 12px; font-weight: 600; }
.tretr-align-icon svg { width: 24px; height: 16px; display: block; }
.tretr-align-icon svg rect { fill: var(--tretr-black); }
.tretr-configurator-shell .tretr-btn-tool.is-active {
  border-color: var(--tretr-black) !important;
  box-shadow: 0 0 0 1px var(--tretr-black) inset;
}
.tretr-range-label { display: block; font-size: 12px; font-weight: 600; margin-top: 16px; }
.tretr-configurator-shell .tretr-lineheight-range { width: 100%; margin-top: 8px; background: transparent; border: none; }
    .tretr-configurator-shell .tretr-curvature-range { width: 100%; margin-top: 8px; background: transparent; border: none; }

.tretr-item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; }
.tretr-configurator-shell .tretr-flag-btn {
  aspect-ratio: 5 / 3;
  padding: 0 !important;
  border-radius: 5px;
  border: 1px solid var(--tretr-gray-200) !important;
  overflow: hidden;
  background: var(--tretr-white) !important;
  box-shadow: none !important;
  display: block !important;
  width: 100% !important;
  height: auto !important;
  line-height: 0 !important;
}
/* fill (nicht cover/contain): die 4:3-Quelle wird auf 5:3 GESTRECKT - genau so,
   wie die Flagge auch auf dem Canvas landet. Mit "contain" blieben Raender,
   mit "cover" wuerde beschnitten - beides wuerde nicht dem Ergebnis entsprechen. */
.tretr-configurator-shell .tretr-flag-btn img {
  width: 100% !important;
  height: 100% !important;
  object-fit: fill !important;
  display: block !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
  padding: 0 !important;
  max-width: none !important;
}
.tretr-configurator-shell .tretr-sym-btn { aspect-ratio: 1; padding: 0; border-radius: 8px; border: 1px solid var(--tretr-gray-200) !important; background: var(--tretr-white) !important; color: var(--tretr-black) !important; font-size: 26px; }

/* ---------- Farbwähler ---------- */
.tretr-colorpicker-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 12px; padding: 10px 12px;
  border: 1px solid var(--tretr-gray-200); border-radius: var(--tretr-radius);
}
.tretr-colorpicker-label { font-size: 13px; font-weight: 600; color: var(--tretr-black); }
.tretr-colorpicker-wrap {
  position: relative; width: 44px; height: 32px; flex: 0 0 auto;
  border-radius: 8px; overflow: hidden; border: 1px solid var(--tretr-gray-200);
}
.tretr-color-picker {
  position: absolute; top: -6px; left: -6px;
  width: calc(100% + 12px); height: calc(100% + 12px);
  border: none; padding: 0; margin: 0; cursor: pointer; background: none;
}
.tretr-color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.tretr-color-picker::-webkit-color-swatch { border: none; border-radius: 0; }
.tretr-color-picker::-moz-color-swatch { border: none; }

/* Zeilenabstand-Regler: auf dem Desktop nicht ueber die ganze Breite ziehen -
   dort wirkte der lange Weg im Verhaeltnis zur kleinen Aenderung "kaputt". */
.tretr-lineheight-range { width: 100%; max-width: 260px; margin: 6px auto 0; display: block; }
.tretr-curvature-range { width: 100%; max-width: 260px; margin: 6px auto 0; display: block; }
.tretr-help-intro {
  margin: 0 0 4px; font-size: 13.5px; line-height: 1.45; color: var(--tretr-black);
}
.tretr-help-steps {
  margin: 0; padding: 0 0 0 20px; list-style: decimal;
}
.tretr-help-steps li {
  font-size: 13px; line-height: 1.45; margin-bottom: 8px; color: var(--tretr-gray-600);
}
.tretr-help-steps li strong { color: var(--tretr-black); }

.tretr-help-legend { margin: 0; padding: 0; list-style: none; }
.tretr-help-legend li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 7px 0; font-size: 13px; line-height: 1.4; color: var(--tretr-gray-600);
  border-bottom: 1px solid var(--tretr-gray-100);
}
.tretr-help-legend li:last-child { border-bottom: none; }
.tretr-help-legend li strong { color: var(--tretr-black); font-weight: 700; }
.tretr-help-icon {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 999px;
  background: var(--tretr-gray-50); color: var(--tretr-black);
}
.tretr-help-icon svg { width: 16px; height: 16px; display: block; }

.tretr-help-tips { margin: 0; padding: 0 0 0 18px; list-style: disc; }
.tretr-help-tips li {
  font-size: 12.5px; line-height: 1.45; margin-bottom: 6px; color: var(--tretr-gray-600);
}

/* Bebilderte Beispiele (Ausrichtung / Zeilenabstand) */
.tretr-help-examples {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.tretr-help-example { margin: 0; text-align: center; }
.tretr-help-example svg {
  width: 100%; height: auto; display: block;
  color: var(--tretr-black);
  background: var(--tretr-gray-50);
  border-radius: 8px;
}
.tretr-help-example figcaption {
  margin-top: 5px; font-size: 11px; font-weight: 600; color: var(--tretr-gray-600);
}
.tretr-help-note {
  margin: 8px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--tretr-gray-600);
}
.tretr-toast {
  position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 12px);
  background: var(--tretr-black); color: var(--tretr-white); padding: 10px 16px; border-radius: 999px;
  font-size: 12.5px; max-width: 88vw; text-align: center; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; z-index: 100002;
}
.tretr-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 7) DESKTOP (breite Spalte): Werkzeuge direkt vor Ort ----------
   Auf dem Desktop wollen wir die Werkzeuge NICHT als Bottom-Sheet, sondern
   fest in der rechten Spalte sehen. Dazu wird ein geoeffnetes Sheet zu einem
   statischen Panel im Fluss, der Backdrop entfaellt, und die Kontext-Leiste
   sitzt direkt unter der Vorschau. */
@container tretrshell (min-width: 820px) {
  .tretr-app {
    display: grid;
    grid-template-columns: 400px minmax(0, 1fr);
    grid-template-areas:
      "stage   entries"
      "stage   tools"
      "stage   cta";
    grid-template-rows: auto 1fr auto;
    align-items: start; gap: 20px; padding: 8px 0;
  }
  .tretr-stage { grid-area: stage; grid-row: 1 / span 3; position: sticky; top: var(--tretr-sticky-top); }
  .tretr-canvas-area { --tretr-stage-height: 300px; height: 300px; }
  .tretr-configurator-shell .tretr-entry-row { grid-area: entries; padding: 0; }
  .tretr-cta-bar {
    grid-area: cta; position: sticky; bottom: 12px;
    border: 1px solid var(--tretr-gray-200); border-radius: 999px; box-shadow: 0 8px 22px rgba(0,0,0,0.08);
    margin-top: 0;
  }

  /* Kein abdunkelnder Backdrop auf Desktop */
  .tretr-sheet-backdrop { display: none !important; }

  /* Geoeffnetes Sheet wird zum statischen Panel in der Werkzeug-Zone */
  .tretr-sheet {
    position: static; grid-area: tools;
    left: auto; right: auto; bottom: auto; width: 100%; max-height: none;
    transform: none !important; box-shadow: none;
    border: 1px solid var(--tretr-gray-200); border-radius: var(--tretr-radius);
    padding-bottom: 4px;
  }
  .tretr-sheet[hidden] { display: none; }
  .tretr-sheet-head::before { display: none; }         /* kein Drag-Griff */
  .tretr-sheet-body { max-height: 46vh; }

  /* Wenn KEIN Sheet offen ist, zeigt die tools-Zone einen dezenten Hinweis */
  .tretr-tools-hint { grid-area: tools; }
}

@supports not (container-type: inline-size) {
  @media (min-width: 1040px) {
    .tretr-app {
      display: grid; grid-template-columns: 400px minmax(0, 1fr);
      grid-template-areas: "stage entries" "stage tools" "stage cta";
      grid-template-rows: auto 1fr auto; align-items: start; gap: 20px; padding: 8px 0;
    }
    .tretr-stage { grid-area: stage; grid-row: 1 / span 3; position: sticky; top: var(--tretr-sticky-top); }
    .tretr-canvas-area { --tretr-stage-height: 300px; height: 300px; }
    .tretr-configurator-shell .tretr-entry-row { grid-area: entries; padding: 0; }
    .tretr-cta-bar { grid-area: cta; bottom: 12px; border: 1px solid var(--tretr-gray-200); border-radius: 999px; box-shadow: 0 8px 22px rgba(0,0,0,0.08); margin-top: 0; }
    .tretr-sheet-backdrop { display: none !important; }
    .tretr-sheet { position: static; grid-area: tools; left: auto; right: auto; bottom: auto; width: 100%; max-height: none; transform: none !important; box-shadow: none; border: 1px solid var(--tretr-gray-200); border-radius: var(--tretr-radius); }
    .tretr-sheet[hidden] { display: none; }
    .tretr-sheet-head::before { display: none; }
    .tretr-sheet-body { max-height: 46vh; }
  }
}
