:root {
  color-scheme: light;
  --ink: #18202a;
  --muted: #657283;
  --line: #d7dde5;
  --soft-line: #e8edf2;
  --panel: #ffffff;
  --page: #f5f7f9;
  --accent: #d8a414;
  --accent-strong: #b77c00;
  --steel: #6f7881;
  --green: #226857;
  --danger: #b94832;
  --shadow: 0 18px 42px rgba(24, 32, 42, 0.11);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 360px) minmax(620px, 1fr);
  height: 100vh;
  min-height: 620px;
}

.panel {
  position: relative;
  z-index: 2;
  overflow: hidden;
  background: var(--panel);
  border-color: var(--line);
}

.module-panel {
  overflow-y: auto;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--soft-line);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border: 3px solid var(--steel);
  border-radius: 8px;
  background: linear-gradient(135deg, #f1bd19, #f5d86d);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.55);
}

.brand h1 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.tool-section {
  padding: 10px 16px;
  border-bottom: 1px solid var(--soft-line);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tool-section h2 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.pricing-section {
  padding-top: 9px;
  padding-bottom: 9px;
  background: #fbfcfd;
}

.pricing-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.pricing-heading h2 {
  margin: 0;
}

.pricing-heading > span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pricing-equation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 12px minmax(0, 1fr) 12px minmax(0, 1.05fr);
  align-items: stretch;
  gap: 3px;
}

.pricing-part {
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 48px;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.pricing-part span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.pricing-part strong {
  overflow: hidden;
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pricing-total {
  border-color: #e6c536;
  background: #fff7c9;
}

.pricing-total span {
  color: #735d00;
}

.pricing-total strong {
  color: #463900;
}

.pricing-operator {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.module-palette {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.module-button {
  display: grid;
  gap: 4px;
  width: 100%;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: center;
  user-select: none;
}

.module-button:active {
  cursor: grabbing;
}

.module-button:hover,
.preset-card:hover,
.sequence-item:hover {
  border-color: #aab4c0;
  box-shadow: 0 8px 18px rgba(24, 32, 42, 0.08);
}

.module-thumb {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 6px;
  background: #eef2f5;
}

.module-thumb img,
.module-thumb svg {
  width: 100%;
  height: 100%;
}

.module-thumb img {
  object-fit: contain;
  object-position: center;
}

.module-thumb svg {
  display: block;
  padding: 4px;
}

.module-tile-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.module-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-size,
.module-type {
  color: var(--muted);
  font-size: 12px;
}

.preset-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-height: 248px;
}

.preset-categories {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 7px;
}

.preset-category {
  width: 100%;
  min-height: 48px;
  padding: 8px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  white-space: normal;
}

.preset-category.is-active {
  border-color: #1d2731;
  background: #1d2731;
  color: #fff;
}

.preset-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 8px;
  max-height: 300px;
  padding-right: 3px;
  overflow-y: auto;
}

.preset-card {
  display: block;
  min-width: 0;
  width: 100%;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.preset-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center;
  border-radius: 6px;
  background: #fff;
}

.workspace {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.18)),
    #edf1f4;
}

#sceneCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.viewport-toolbar {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.view-actions,
.toolbar-button {
  display: flex;
  align-items: center;
  height: 54px;
  box-sizing: border-box;
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(140, 151, 163, 0.34);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  pointer-events: auto;
}

.ghost-button,
.toolbar-button,
.icon-button,
.primary-button,
.danger-button,
.sequence-control {
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
}

.toolbar-button {
  min-width: 94px;
  justify-content: center;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 800;
}

.toolbar-button[aria-pressed="true"] {
  border-color: rgba(240, 189, 23, 0.72);
  background: rgba(255, 244, 194, 0.92);
}

.icon-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  aspect-ratio: 1;
  border-color: var(--soft-line);
  background: #fff;
  font-size: 20px;
  line-height: 1;
}

.icon-button::after {
  position: absolute;
  top: calc(100% + 9px);
  left: 50%;
  z-index: 10;
  width: max-content;
  max-width: 120px;
  padding: 6px 9px;
  border: 1px solid rgba(140, 151, 163, 0.3);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px rgba(27, 36, 45, 0.14);
  color: var(--ink);
  content: attr(data-tooltip);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -3px);
  transition:
    opacity 120ms ease,
    transform 120ms ease,
    visibility 0s linear 120ms;
  visibility: hidden;
  white-space: nowrap;
}

.icon-button:hover::after,
.icon-button:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
  transition-delay: 1s;
  visibility: visible;
}

.ghost-button {
  padding: 6px 9px;
  border-color: var(--line);
  color: var(--muted);
  font-size: 12px;
}

.primary-button {
  width: 100%;
  margin-top: 10px;
  padding: 11px 12px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
}

.secondary-button {
  padding: 9px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.secondary-button:disabled,
.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.danger-button {
  padding: 8px 12px;
  background: var(--danger);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.selection-hud {
  position: absolute;
  top: 18px;
  left: 50%;
  bottom: auto;
  z-index: 4;
  display: flex;
  align-items: center;
  height: 54px;
  box-sizing: border-box;
  gap: 8px;
  max-width: calc(100% - 36px);
  padding: 6px 6px 6px 14px;
  border: 1px solid rgba(140, 151, 163, 0.34);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
}

.selection-hud.is-hidden {
  display: none;
}

.edge-add-button {
  display: none;
  border-color: rgba(34, 104, 87, 0.22);
  background: rgba(34, 104, 87, 0.08);
  color: var(--green);
}

.edge-add-button.is-visible {
  display: inline-grid;
  place-items: center;
}

.rotate-action-button {
  display: none;
  border-color: rgba(34, 104, 87, 0.22);
  background: rgba(34, 104, 87, 0.08);
  color: var(--green);
}

.rotate-action-button.is-visible {
  display: inline-grid;
  place-items: center;
}

.selection-hud span {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-hud .secondary-button,
.selection-hud .danger-button {
  height: 40px;
  padding: 0 12px;
  font-size: 13px;
}

.loading-state {
  position: absolute;
  left: 50%;
  bottom: 78px;
  z-index: 3;
  transform: translateX(-50%);
  padding: 10px 14px;
  border: 1px solid rgba(140, 151, 163, 0.26);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  box-shadow: var(--shadow);
}

.loading-state.is-hidden {
  display: none;
}

.action-toast {
  position: absolute;
  left: 50%;
  top: 88px;
  z-index: 120;
  max-width: min(420px, calc(100% - 40px));
  transform: translateX(-50%);
  padding: 12px 18px;
  border: 1px solid rgba(162, 53, 31, 0.28);
  border-radius: 6px;
  background: rgba(255, 247, 244, 0.96);
  color: #9f2f1d;
  box-shadow: 0 12px 30px rgba(58, 28, 20, 0.16);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}

.action-toast.is-hidden {
  display: none;
}

.drop-hint {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.drop-hint.is-hidden {
  display: none;
}

.drop-hint div {
  position: absolute;
  display: grid;
  place-items: center;
  min-width: 110px;
  min-height: 44px;
  padding: 10px 14px;
  border: 2px dashed rgba(34, 104, 87, 0.22);
  border-radius: 8px;
  background: rgba(34, 104, 87, 0.06);
  color: var(--green);
  font-size: 14px;
  font-weight: 900;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  transform: translate(-50%, -50%);
}

.drop-hint [data-drop-side="left"],
.drop-hint [data-drop-side="right"] {
  display: none;
}

.drop-hint [data-drop-side="left"].is-active,
.drop-hint [data-drop-side="right"].is-active {
  display: grid;
}

.drop-hint [data-drop-side="replace"] {
  left: 50%;
  top: 50%;
  display: none;
  min-width: 180px;
  min-height: 76px;
  padding: 18px 24px;
  border-radius: 8px;
  transform: translate(-50%, -50%);
}

.drop-hint.is-replace {
  display: block;
}

.drop-hint.is-replace [data-drop-side="left"],
.drop-hint.is-replace [data-drop-side="right"] {
  display: none;
}

.drop-hint.is-replace [data-drop-side="replace"] {
  display: grid;
}

.drop-hint div.is-active {
  border-color: rgba(34, 104, 87, 0.74);
  background: rgba(34, 104, 87, 0.13);
}

.file-warning {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  display: grid;
  gap: 7px;
  width: min(440px, calc(100% - 48px));
  padding: 18px 20px;
  border: 1px solid #e2b756;
  border-radius: 8px;
  background: rgba(255, 248, 224, 0.96);
  box-shadow: var(--shadow);
  color: #4b3911;
  transform: translate(-50%, -50%);
}

.file-warning.is-hidden {
  display: none;
}

.is-file-mode .file-warning {
  display: grid;
}

.is-file-mode .loading-state {
  display: none;
}

.file-warning strong {
  font-size: 16px;
}

.file-warning span {
  font-size: 13px;
  line-height: 1.6;
}

.sequence-list {
  display: grid;
  gap: 9px;
}

.empty-state {
  padding: 18px;
  border: 1px dashed #bdc6cf;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.sequence-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.sequence-item strong {
  display: block;
  font-size: 13px;
}

.sequence-item span {
  color: var(--muted);
  font-size: 12px;
}

.sequence-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sequence-control {
  display: grid;
  place-items: center;
  width: 28px;
  aspect-ratio: 1;
  border-color: var(--soft-line);
  background: #f8fafb;
  color: var(--muted);
  line-height: 1;
}

.sequence-control.remove {
  color: var(--danger);
}

textarea {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: #26313c;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.color-palette {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.color-button {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 5px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.color-button.is-active {
  border-color: #17202a;
  box-shadow: inset 0 0 0 2px #17202a;
}

.color-swatch {
  width: 100%;
  aspect-ratio: 2.2;
  border: 1px solid rgba(24, 32, 42, 0.16);
  border-radius: 5px;
}

.fabric-swatch {
  background-image:
    linear-gradient(35deg, rgba(255, 255, 255, 0.24), transparent 38%),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.18) 0 1px, rgba(0, 0, 0, 0.08) 1px 3px);
  background-blend-mode: soft-light, multiply;
}

.fabric-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 8px;
}

.fabric-tier-tabs {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.fabric-tier {
  width: 100%;
  min-height: 48px;
  padding: 8px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  white-space: normal;
}

.fabric-tier.is-active {
  border-color: #17202a;
  background: #17202a;
  color: #fff;
}

.fabric-selected {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--muted);
  font-weight: 800;
}

.fabric-selected-preview {
  display: block;
  width: 58px;
  aspect-ratio: 1.25;
  border: 1px solid rgba(24, 32, 42, 0.14);
  border-radius: 6px;
  background-color: #d5d8da;
  background-position: center;
  background-size: cover;
  filter: brightness(1.18) contrast(0.92) saturate(1.04);
}

.fabric-selected small {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.fabric-selected strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fabric-categories {
  display: grid;
  grid-template-columns: 1fr;
  height: calc(var(--fabric-tier-row-count, 18) * 38px - 5px);
  align-content: start;
  gap: 5px;
}

.fabric-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-width: 0;
  min-height: 33px;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
}

.fabric-category span {
  overflow: visible;
  line-height: 1.25;
  text-align: left;
  white-space: normal;
  word-break: normal;
}

.fabric-category small {
  color: var(--muted);
  font-size: 9px;
}

.fabric-category.is-active {
  border-color: #17202a;
  background: #17202a;
  color: #fff;
}

.fabric-category.is-active small {
  color: rgba(255, 255, 255, 0.72);
}

.fabric-grid {
  height: calc(var(--fabric-tier-row-count, 18) * 38px - 5px);
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.fabric-grid-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.fabric-button {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.fabric-button.is-active {
  border-color: #17202a;
  box-shadow: inset 0 0 0 2px #17202a;
}

.fabric-preview {
  display: block;
  width: 100%;
  aspect-ratio: 1.08;
  border: 1px solid rgba(24, 32, 42, 0.12);
  border-radius: 6px;
  background-color: #d5d8da;
  background-position: center;
  background-size: cover;
  filter: brightness(1.18) contrast(0.92) saturate(1.04);
}

.fabric-button span:last-child {
  overflow: hidden;
  font-size: 11px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.color-button span:last-child {
  overflow: hidden;
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-panel {
  display: grid;
  gap: 10px;
}

.selected-info {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.selected-info.has-selection {
  border-color: rgba(34, 104, 87, 0.32);
  background: rgba(34, 104, 87, 0.07);
  color: var(--ink);
}

.select-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.select-field select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.edit-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .panel {
    max-height: none;
    border: 0;
  }

  .workspace {
    height: 62vh;
    min-height: 420px;
    order: -1;
  }

  .viewport-toolbar {
    flex-wrap: wrap;
  }

  .selection-hud {
    top: 76px;
  }
}

.add-to-cart-button {
  width: 100%;
  margin-top: 10px;
  padding: 11px 12px;
  background: #111827;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.add-to-cart-button:hover { background: #000; }
.add-to-cart-button:active { transform: translateY(1px); }

/* Kontextmenü am Auswahlpunkt */
#hlSelDot {
  position: absolute;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #ffd400;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  cursor: pointer;
  z-index: 40;
  display: none;
  transition: transform 0.15s ease;
  padding: 0;
}
#hlSelDot:hover { transform: scale(1.25); }
#hlSelDot.hl-puls { animation: hlAtem 1.6s ease-in-out infinite; }
@keyframes hlAtem {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 212, 0, 0.55); transform: scale(1); }
  50% { box-shadow: 0 0 0 14px rgba(255, 212, 0, 0); transform: scale(1.12); }
}
#hlSelMenu {
  position: absolute;
  display: none;
  z-index: 41;
  width: 292px;
  box-sizing: border-box;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
  padding: 12px;
}
.hl-menu-titel { font-size: 13px; font-weight: 600; letter-spacing: 0.02em; color: #374151; margin: 2px 2px 10px; }
.hl-menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.hl-menu-thumb {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  padding: 4px 2px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.hl-menu-thumb:hover { border-color: #111827; }
.hl-menu-thumb img { width: 74px; height: 74px; object-fit: contain; display: block; }
.hl-menu-thumb span { font-size: 13px; font-weight: 600; color: #111827; text-align: center; line-height: 1.2; }
.hl-menu-aktionen { display: flex; gap: 8px; margin-top: 10px; }
.hl-menu-btn {
  flex: 1;
  padding: 8px 6px;
  border-radius: 9px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.hl-menu-btn:hover { border-color: #111827; }
.hl-menu-btn--rot { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.hl-menu-btn--rot:hover { background: #991b1b; }
/* Aktionen wandern ins Kontextmenü */
#rotateModuleBtn, #deleteSelectedBtn { display: none !important; }

/* Aufgeräumte UI: Brand-Kopf, Modul-Palette (im HTML hidden) und Auswahl-Statusleiste entfallen */
.brand { display: none !important; }
#selectionHud { display: none !important; }

/* Feinschliff v2 */
#clearBtn, #dimensionToggleBtn { display: none !important; }


.fabric-button { position: relative; }
.hl-zoom {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(255,255,255,0.92);
  border: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #111827;
  cursor: zoom-in;
  z-index: 2;
}
.hl-zoom:hover { background: #fff; border-color: #111827; }
#hlFabricLightbox, #hlModulInfo {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(15,23,42,0.66);
  align-items: center;
  justify-content: center;
}
.hl-lb-inner { position: relative; max-width: min(860px, 92vw); }
.hl-lb-inner img { width: 100%; max-height: 78vh; object-fit: contain; border-radius: 12px; display: block; background: #fff; }
.hl-lb-name { color: #fff; text-align: center; margin-top: 10px; font-size: 14px; }
.hl-lb-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #fff;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
  z-index: 2;
}
.hl-info-card {
  position: relative;
  background: #fff;
  border-radius: 14px;
  max-width: 560px;
  width: calc(100% - 40px);
  max-height: 84vh;
  overflow: auto;
  padding: 28px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
}
.hl-info-card h3 { margin: 0 0 14px; font-size: 18px; }
.hl-info-block { margin-bottom: 14px; }
.hl-info-block strong { display: block; font-size: 14px; margin-bottom: 3px; }
.hl-info-block p { margin: 0; font-size: 13px; line-height: 1.65; color: #374151; }
.hl-info-card .hl-lb-close { top: 12px; right: 12px; }

/* Einheitliche Icon-Leiste */
.icon-button svg { width: 19px; height: 19px; display: block; }
#hlDimBtn { transition: background 0.12s ease, box-shadow 0.12s ease; }
#hlDimBtn.hl-on {
  background: #111827;
  color: #fff;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.35);
}
.hl-lb-inner { max-width: 94vw; }
.hl-lb-inner img { max-height: 74vh; width: auto; max-width: 94vw; margin: 0 auto; }
.hl-lb-name { font-size: 15px; }
.hl-lb-info { font-size: 13px; color: #d1d5db; margin-top: 6px; font-weight: 400; }


/* ===== HAUS Lab Theme-Angleichung (Jost, Pill-Buttons, Shop-Farben) — Max 2026-07-30 ===== */
@font-face {
  font-family: "Jost";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("https://www.haus-lab.de/cdn/fonts/jost/jost_n4.d47a1b6347ce4a4c9f437608011273009d91f2b7.woff2") format("woff2");
}
@font-face {
  font-family: "Jost";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("https://www.haus-lab.de/cdn/fonts/jost/jost_n5.7c8497861ffd15f4e1284cd221f14658b0e95d61.woff2") format("woff2");
}
@font-face {
  font-family: "Jost";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("https://www.haus-lab.de/cdn/fonts/jost/jost_n7.921dc18c13fa0b0c94c5e2517ffe06139c3615a3.woff2") format("woff2");
}

html,
body {
  color: #111827;
  font-family: "Jost", Inter, Arial, sans-serif;
}

:root {
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --soft-line: #eef0f3;
  --page: #f7f8fa;
  --shadow: 0 18px 42px rgba(17, 24, 39, 0.10);
}

/* Titel wie im Shop: Versalien, normales Gewicht */
.tool-section h2,
.pricing-heading h2,
.section-title h2 {
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.05em;
}

/* Haupt-Button als Theme-Pill */
.add-to-cart-button {
  border-radius: 60px;
  background: #111827;
  color: #fff;
  text-transform: uppercase;
  font-weight: 400;
  letter-spacing: 0.06em;
  font-size: 15px;
  padding: 15px 22px;
  border: none;
  transition: background 0.15s ease;
}
.add-to-cart-button:hover { background: #1f3a5f; }

/* Icon-Leiste rund wie Theme-Elemente */
.icon-button { border-radius: 999px; }
#hlDimBtn.hl-on { background: #111827; }

/* Sitztiefen-Umschalter + Kollektionszeilen */
.preset-category { border-radius: 60px; text-transform: uppercase; letter-spacing: 0.03em; }
.preset-category.is-active { background: #111827; color: #fff; }
.fabric-category { border-radius: 10px; }
.fabric-category.is-active { background: #111827; }

/* Gesamtpreis-Feld: Shop-Blau statt Gelb */
.pricing-total { border-color: #1f3a5f; background: #eef2f7; }
.pricing-total span { color: #1f3a5f; }
.pricing-total strong { color: #1f3a5f; }

/* Karten/Kontextmenü weicher, Shop-Schatten */
#hlSelMenu, .hl-lb-inner, .hl-info-card { font-family: "Jost", Inter, Arial, sans-serif; }
.preset-card { border-radius: 12px; }


/* ===== Theme-Angleichung v2: Buttons/Toolbar/Auswahl exakt wie Produktseiten (Max 2026-07-31) ===== */

/* Haupt-CTA wie Shop-Kaufbutton: Blau gefuellt, Hover = weisser Kreis-Fill von oben */
.add-to-cart-button {
  position: relative;
  overflow: hidden;
  z-index: 0;
  background: #1f3a5f;
  border: 1px solid #1f3a5f;
  color: #fff;
  transition: color 0.5s cubic-bezier(0.3, 1, 0.3, 1);
}
.add-to-cart-button::before {
  content: "";
  position: absolute;
  display: block;
  width: 150%;
  height: 200%;
  top: -50%;
  left: -25%;
  border-radius: 50%;
  background: #fff;
  transform: translate3d(0, -76%, 0);
  transition: transform 0.5s cubic-bezier(0.3, 1, 0.3, 1);
  z-index: -1;
}
.add-to-cart-button:hover { background: #1f3a5f; color: #1f3a5f; }
.add-to-cart-button:hover::before { transform: translate3d(0, 0, 0); }
.add-to-cart-button:disabled { opacity: 0.65; }
.add-to-cart-button:disabled::before { display: none; }

/* Icon-Toolbar: gleicher Stil + Fill-Effekt (Fill in Shop-Blau, Icon wird weiss) */
.icon-button {
  position: relative;
  overflow: hidden;
  z-index: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #111827;
  transition: color 0.5s cubic-bezier(0.3, 1, 0.3, 1), border-color 0.5s cubic-bezier(0.3, 1, 0.3, 1);
}
.icon-button::before {
  content: "";
  position: absolute;
  display: block;
  width: 150%;
  height: 200%;
  top: -50%;
  left: -25%;
  border-radius: 50%;
  background: #1f3a5f;
  transform: translate3d(0, -76%, 0);
  transition: transform 0.5s cubic-bezier(0.3, 1, 0.3, 1);
  z-index: -1;
}
.icon-button:hover { color: #fff; border-color: #1f3a5f; }
.icon-button:hover::before { transform: translate3d(0, 0, 0); }
#hlDimBtn.hl-on { background: #1f3a5f; border-color: #1f3a5f; color: #fff; box-shadow: none; }

/* Auswahl-Hervorhebung wie Shop-Variantenpicker: weiss + 1px hellgrau, aktiv doppelter dunkler Rand */
.fabric-category,
.preset-category,
.color-button,
.preset-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  color: #111827;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.fabric-category:hover,
.preset-category:hover,
.color-button:hover,
.preset-card:hover {
  border-color: #111827;
}
.fabric-category.is-active,
.preset-category.is-active,
.color-button.is-active,
.preset-card.is-active {
  background: #fff;
  color: #111827;
  border-color: #111827;
  box-shadow: 0 0 0 1px #111827;
}
.fabric-category.is-active small { color: #6b7280; }
.preset-category { text-transform: uppercase; letter-spacing: 0.03em; }

/* Zurueck zum Origin Sofa (links oben, schwebend) */
#hlBackBtn {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 30;
  width: 42px;
  height: 42px;
  box-shadow: 0 6px 18px rgba(17, 24, 39, 0.10);
}

/* cart21: Zurueck-Button mit Label + Info-Block statt Preset-Palette */
#hlBackBtn {
  aspect-ratio: auto;
  width: auto;
  padding: 0 18px 0 14px;
  gap: 9px;
  display: inline-flex;
  align-items: center;
}
#hlBackBtn .hl-back-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-transform: uppercase;
}
#hlBackBtn svg { flex: 0 0 auto; }
.hl-info-section {
  background: #f6f7f9;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 18px;
}
.hl-info-text {
  margin: 8px 0 14px;
  font-size: 13px;
  line-height: 1.55;
  color: #4b5563;
}
.hl-info-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 0 20px;
  height: 52px;
  border-radius: 999px;
  background: #1F3A5F;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
}
.hl-info-link:hover { background: #16304f; }
.hl-info-link svg { width: 16px; height: 16px; flex: 0 0 auto; }

/* cart21f: Desktop = Innen-Scroll im Panel; Mobil = ausgerollt, Seite scrollt (iframe-Hoehe dynamisch via postMessage) */
.hl-info-section h2 { display: none; }
.hl-info-text { margin-top: 0; }
.hl-info-section { padding-bottom: 26px; }

@media (min-width: 981px) {
  html, body { height: 100%; }
  body { overflow: hidden; }
  .app-shell { height: 100%; min-height: 0; }
  .panel { max-height: none; }
  .module-panel { min-height: 0; overflow-y: auto; }
}

@media (max-width: 980px) {
  html, body { height: auto; }
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 0; grid-template-columns: 1fr; grid-template-rows: none; }
  .workspace { height: 450px; min-height: 450px; order: -1; }
  .panel { max-height: none; }
  .module-panel { overflow: visible; }
  #hlBackBtn { display: none; }
}

/* cart21j: Info-Modal mobil = grosses Popup MIT grauem Overlay-Rand, innen scrollbar; Modul-Menue kompakt am Punkt (2 Spalten) */
@media (max-width: 980px) {
  #hlModulInfo { align-items: flex-start; justify-content: center; }
  #hlModulInfo .hl-info-card {
    width: calc(100% - 40px);
    max-width: none;
    margin-top: 20px;
    max-height: none;
    border-radius: 14px;
    padding: 22px 18px 36px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  #hlModulInfo .hl-lb-close { position: sticky; top: 8px; float: right; }
  #hlSelMenu {
    width: 232px;
    max-height: calc(100% - 16px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  #hlSelMenu .hl-menu-grid { grid-template-columns: repeat(2, 1fr); }
  #hlSelMenu .hl-menu-thumb img { width: 62px; height: 62px; }
}

/* cart21j: linke Spalte schliesst unten buendig mit dem 3D-Fenster ab (sichtbare Kante) */
@media (min-width: 981px) {
  .module-panel { border-bottom: 1px solid var(--line); }
}

/* cart21k: Stoffe-Block fuellt auf Desktop die restliche Panelhoehe (mehr Stoffbilder sichtbar) */
@media (min-width: 981px) {
  .module-panel { display: flex; flex-direction: column; }
  .module-panel section:last-of-type { flex: 1 1 auto; min-height: 700px; display: flex; flex-direction: column; }
  .module-panel section:last-of-type h2 { flex: 0 0 auto; }
  #fabricPalette { flex: 1 1 auto; min-height: 0; }
  #fabricPalette .fabric-picker { height: 100%; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  #fabricPalette .fabric-categories { height: 100%; align-content: stretch; grid-auto-rows: minmax(33px, 1fr); overflow-y: auto; }
  #fabricPalette .fabric-grid { height: 100%; }
  .fabric-category span { font-size: 13px; }
  .fabric-category small { font-size: 11px; }
}

/* cart21h: Titel "Origin Sofa – Konfigurator" fett */
.pricing-heading h2 { font-weight: 700; }

/* cart22a: Stoffart in Klammern hinter dem Stoffnamen */
.fabric-button span:last-child { white-space: normal; }
.hl-art { font-style: normal; font-weight: 600; color: #6b7280; font-size: 10px; }
.fabric-button.is-active .hl-art { color: #4b5563; }

/* cart21z: Stoff-Lightbox — Sofortbild + Lade-Badge + Klick-Lupe */
.hl-lb-bild { position: relative; overflow: hidden; border-radius: 12px; }
#hlFabricLightbox .hl-lb-bild img { border-radius: 0; cursor: zoom-in; transition: transform 0.25s ease; }
#hlFabricLightbox .hl-lb-bild img.hl-lb-zoomed { transform: scale(2.4); cursor: zoom-out; }
.hl-lb-lade {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.88);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 11px 24px;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

/* cart22b: Lightbox mobil an der Scroll-Position des Nutzers verankern */
@media (max-width: 980px) {
  #hlFabricLightbox { align-items: flex-start; }
  #hlFabricLightbox .hl-lb-inner { max-width: calc(100% - 34px); }
}

/* cart21m: Auswahl-Rahmen einheitlich (innenliegender Ring, wird nie abgeschnitten); Mobil-Zurueck-Icon in der Leiste */
.fabric-category.is-active { box-shadow: inset 0 0 0 1px #111827; }
.fabric-button.is-active { border-color: #111827; box-shadow: inset 0 0 0 1px #111827; }
#hlBackBtnM { display: none; }
@media (max-width: 980px) {
  #hlBackBtnM { display: inline-flex; align-items: center; justify-content: center; }
}


/* Stoffe-Kopfzeile mit Link zur Stoff-Kollektion (cart22e) */
.fabric-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.fabric-head h2 { margin: 0; }
.fabric-link {
  display: inline-block;
  padding: 6px 2px 6px 8px;
  margin: -6px -2px -6px 0;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(31, 58, 95, 0.85);
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.fabric-link:hover { color: rgb(31, 58, 95); }
@media (max-width: 980px) {
  .fabric-link { font-size: 10.5px; }
}
