:root {
    /* Shop-Tokens (MTN-Prime) – linke Steuerung */
    --bg: #050816;
    --panel: #111827;
    --panel-edge: rgba(148, 163, 184, 0.28);
    --text: #e5e7eb;
    --muted: #9ca3af;
    --accent: #38bdf8;
    --accent-hover: #7dd3fc;
    --accent-2: #22c55e;
    --preview-bg: #e8eef2;
    --danger: #f87171;
    --radius: 14px;
    --font-ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --panel-shadow: 0 18px 45px rgba(15, 23, 42, 0.55);
    --input-bg: rgba(15, 23, 42, 0.92);
    --input-border: rgba(148, 163, 184, 0.45);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    font-family: var(--font-ui);
    color: var(--text);
    background: var(--bg);
}

body.embed .brand {
    display: none;
}

body.etsy-locked {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.etsy-lock {
    max-width: 28rem;
    text-align: center;
    padding: 1.75rem 1.5rem;
    border: 1px solid var(--panel-edge);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--panel-shadow);
}

body.etsy-locked .etsy-lock .brand {
    display: block;
    margin: 0 0 0.75rem;
    font-size: 1.15rem;
}

.etsy-lock__text {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
    font-size: 0.95rem;
}

body.embed {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
}

body.embed .app {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    padding-bottom: 0;
}

/* Im iframe: in den Fluss, damit die Leiste nicht abgeschnitten wird */
body.embed .guide {
    display: none !important;
}

.app {
    display: grid;
    grid-template-columns: minmax(280px, 340px) 1fr;
    height: 100%;
    min-height: 100vh;
    padding-bottom: 0;
}

/* Führung läuft über Piko – keine zweite Leiste */
.guide {
    display: none !important;
}

.controls {
    padding: 1.25rem 1.35rem 1.5rem;
    background:
        radial-gradient(circle at 10% 0%, rgba(56, 189, 248, 0.12), transparent 45%),
        radial-gradient(circle at 80% 20%, rgba(34, 197, 94, 0.06), transparent 40%),
        linear-gradient(180deg, #0f172a 0%, #050816 100%);
    border-right: 1px solid var(--panel-edge);
    overflow-y: auto;
}

.controls .panel {
    scroll-margin-top: 12px;
    scroll-margin-bottom: 12px;
}

.brand {
    margin: 0 0 1rem;
    font-size: 1.35rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    color: #f8fafc;
}

.panel {
    background: rgba(17, 24, 39, 0.92);
    border: 1px solid var(--panel-edge);
    border-radius: var(--radius);
    padding: 0.95rem 1.05rem 1.05rem;
    margin-bottom: 0.9rem;
    box-shadow: 0 10px 28px rgba(2, 6, 23, 0.35);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.panel.is-active-text {
    border-color: rgba(56, 189, 248, 0.65);
    box-shadow:
        0 0 0 1px rgba(56, 189, 248, 0.35),
        0 12px 32px rgba(2, 6, 23, 0.4);
}

.panel.is-active-text[data-text-panel="2"] {
    border-color: rgba(34, 197, 94, 0.55);
    box-shadow:
        0 0 0 1px rgba(34, 197, 94, 0.3),
        0 12px 32px rgba(2, 6, 23, 0.4);
}

.panel.is-active-text[data-text-panel="date"] {
    border-color: rgba(251, 146, 60, 0.55);
    box-shadow:
        0 0 0 1px rgba(251, 146, 60, 0.3),
        0 12px 32px rgba(2, 6, 23, 0.4);
}

.panel.is-active-text[data-text-panel="svg"] {
    border-color: rgba(234, 179, 8, 0.55);
    box-shadow:
        0 0 0 1px rgba(234, 179, 8, 0.3),
        0 12px 32px rgba(2, 6, 23, 0.4);
}

.panel.is-active-text[data-text-panel="bridge"] {
    border-color: rgba(125, 211, 252, 0.65);
    box-shadow:
        0 0 0 1px rgba(125, 211, 252, 0.35),
        0 12px 32px rgba(2, 6, 23, 0.4);
}

.panel.is-active-text h2 {
    color: #7dd3fc;
}

.panel.is-active-text[data-text-panel="2"] h2 {
    color: #86efac;
}

.panel.is-active-text[data-text-panel="date"] h2 {
    color: #fdba74;
}

.panel.is-active-text[data-text-panel="svg"] h2 {
    color: #fde68a;
}

.panel.is-active-text[data-text-panel="bridge"] h2 {
    color: #7dd3fc;
}

.panel--colors .field + .field {
    margin-top: 0.85rem;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.chip {
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.35);
    color: var(--text);
    border-radius: 0.45rem;
    padding: 0.4rem 0.65rem;
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
}

.chip.is-active {
    border-color: rgba(56, 189, 248, 0.7);
    background: rgba(14, 165, 233, 0.18);
}

.subhead {
    margin: 0.85rem 0 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
}

.b2b-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.b2b-brand[hidden] {
    display: none;
}

.b2b-brand__logo {
    max-height: 36px;
    width: auto;
    object-fit: contain;
}

.b2b-brand__name {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.template-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.template-row .btn-small {
    flex: 0 0 auto;
    white-space: nowrap;
}

.template-row .btn-small:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.file-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.file-btn {
    width: 100%;
    cursor: pointer;
}

.file-btn.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

#btnTemplateAdd {
    width: 100%;
}

.field code {
    font-size: 0.85em;
    color: #cbd5e1;
}

.btn-ghost {
    background: transparent;
    border-color: rgba(148, 163, 184, 0.4);
    color: var(--muted);
    box-shadow: none;
}

.btn-ghost:hover {
    color: #f8fafc;
    border-color: rgba(248, 113, 113, 0.55);
    background: rgba(248, 113, 113, 0.1);
}

.btn-small {
    padding: 0.28rem 0.55rem;
    font-size: 0.72rem;
    border-radius: 7px;
}

.panel h2 {
    margin: 0 0 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.field:last-child {
    margin-bottom: 0;
}

.field span {
    font-size: 0.8rem;
    color: var(--muted);
}

.field em {
    font-style: normal;
    color: var(--text);
    font-weight: 600;
}

.field-num {
    width: 4.2rem;
    margin: 0 0.2rem;
    padding: 0.15rem 0.3rem;
    border: 1px solid var(--input-border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: right;
    -webkit-text-fill-color: var(--text);
    color-scheme: dark;
}

.field-num:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

.field-num:disabled {
    opacity: 0.55;
    background: rgba(15, 23, 42, 0.55);
    color: var(--muted);
    -webkit-text-fill-color: var(--muted);
}

.field .size-actual {
    font-size: 0.9em;
    color: var(--muted);
    font-weight: 400;
}

.field .size-actual em {
    color: var(--text);
}

.field--size-info {
    margin-bottom: 0.55rem;
}

.field--size-info > input[type="range"][hidden],
.field--size-info > [hidden] {
    display: none !important;
}

#padWidth1Field[hidden] {
    display: none !important;
}

.color-note {
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--muted);
}

.field-hint {
    margin: 0.1rem 0 0;
    font-size: 0.72rem;
    line-height: 1.3;
    color: var(--muted);
}

.field input[type="text"],
.field select {
    width: 100%;
    max-width: 100%;
    padding: 0.45rem 1.7rem 0.45rem 0.6rem;
    border: 1px solid var(--input-border);
    border-radius: 0.7rem;
    background: var(--input-bg);
    color: var(--text);
    font: inherit;
    font-size: 0.85rem;
    outline: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: border-color 0.12s ease-out, box-shadow 0.12s ease-out, background 0.12s ease-out;
}

.field input[type="text"]:focus,
.field select:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.8);
    background: rgba(15, 23, 42, 0.98);
}

.font-select-wrap {
    position: relative;
    width: 100%;
}

.font-select-wrap .font-select {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Fett / Kursiv – Schalter wie in einer Textverarbeitung */
.font-style {
    display: flex;
    gap: 0.35rem;
    margin-top: -0.35rem;
}

.field--spacing {
    margin-top: -0.15rem;
}

.field--spacing .size-actual {
    margin-left: 0.35rem;
}

.font-style__btn {
    min-width: 2.2rem;
    min-height: 2.2rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--input-border);
    border-radius: 0.55rem;
    background: var(--input-bg);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.font-style__btn--italic {
    font-style: italic;
    font-weight: 500;
}

.font-style__btn:hover:not(:disabled) {
    border-color: #38bdf8;
}

.font-style__btn[aria-pressed='true'] {
    background: var(--accent);
    border-color: var(--accent);
    color: #04170f;
}

.font-style__btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.font-select-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 2.35rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--input-border);
    border-radius: 0.7rem;
    background: var(--input-bg);
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    outline: none;
    overflow: hidden;
    transition: border-color 0.12s ease-out, box-shadow 0.12s ease-out, background 0.12s ease-out;
}

.font-select-btn:focus,
.font-select-wrap.is-open .font-select-btn {
    border-color: #38bdf8;
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.8);
    background: rgba(15, 23, 42, 0.98);
}

.font-select-btn:disabled,
.font-select-wrap.is-disabled .font-select-btn {
    opacity: 0.45;
    cursor: not-allowed;
}

.font-select-btn__label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.font-select-list {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 0.25rem);
    z-index: 50;
    max-height: 16rem;
    overflow-y: auto;
    margin: 0;
    padding: 0.2rem;
    list-style: none;
    border: 1px solid var(--input-border);
    border-radius: 0.7rem;
    background: #0f172a;
    box-shadow: 0 14px 36px rgba(2, 6, 23, 0.55);
}

.font-select-list li {
    overflow: hidden;
}

.font-select-opt {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    padding: 0.38rem 0.6rem;
    border-radius: 0.4rem;
    font-size: 0.88rem;
    line-height: 1.35;
    overflow: hidden;
    cursor: pointer;
}

.font-select-opt:hover,
.font-select-opt.is-active {
    background: rgba(14, 165, 233, 0.18);
}

.field input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.field-check {
    flex-direction: row;
    align-items: flex-start;
    gap: 0.55rem;
    cursor: pointer;
}

.field-check input {
    margin-top: 0.2rem;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.field-check span {
    line-height: 1.35;
}

#dateFields {
    padding-left: 1.65rem;
}

.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.15rem;
}

.color-swatch {
    width: 1.35rem;
    height: 1.35rem;
    padding: 0;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.18);
    background-color: var(--swatch, #888);
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.color-swatch--light {
    border-color: rgba(255, 255, 255, 0.55);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.32);
}

.color-swatch--metallic {
    background-image: linear-gradient(
        125deg,
        rgba(255, 255, 255, 0.85) 0%,
        rgba(255, 255, 255, 0.25) 22%,
        transparent 45%,
        rgba(0, 0, 0, 0.22) 70%,
        rgba(0, 0, 0, 0.45) 100%
    );
    background-color: var(--swatch, #888);
    background-blend-mode: soft-light;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.45),
        inset 0 -2px 5px rgba(0, 0, 0, 0.3),
        inset 0 2px 3px rgba(255, 255, 255, 0.25);
}

.color-swatch--metallic-boost {
    background-image: linear-gradient(
        118deg,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(255, 255, 255, 0.35) 18%,
        transparent 40%,
        rgba(0, 0, 0, 0.25) 68%,
        rgba(0, 0, 0, 0.55) 100%
    );
    background-blend-mode: soft-light;
}

.color-swatch:hover {
    transform: scale(1.06);
}

.color-swatch.is-active {
    box-shadow:
        0 0 0 2px #0f172a,
        0 0 0 4px var(--accent),
        inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.color-swatch:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.info-note {
    margin: 0.15rem 0 0;
    padding: 0.55rem 0.7rem;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--muted);
    background: var(--color-primary-soft, rgba(56, 189, 248, 0.12));
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 0.7rem;
}

.info-note[hidden] {
    display: none;
}

.hint {
    margin: 0 0 0.75rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    background: rgba(15, 23, 42, 0.6);
    color: #e2e8f0;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.12s ease-out, box-shadow 0.12s ease-out, background 0.15s ease, border-color 0.15s ease;
}

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

.btn:hover {
    color: #f8fafc;
    border-color: rgba(56, 189, 248, 0.5);
    background: rgba(56, 189, 248, 0.12);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-primary {
    background: linear-gradient(to right, #38bdf8, #22c55e);
    border-color: transparent;
    color: #0b1120;
    font-weight: 600;
    box-shadow: 0 16px 40px rgba(56, 189, 248, 0.45);
}

.btn-primary:hover {
    background: linear-gradient(to right, #38bdf8, #22c55e);
    transform: translateY(-1px);
    box-shadow: 0 22px 55px rgba(56, 189, 248, 0.7);
}

.btn-primary:disabled:hover {
    transform: none;
    box-shadow: 0 16px 40px rgba(56, 189, 248, 0.45);
}

.status {
    min-height: 1.25rem;
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.status.error {
    color: var(--danger);
}

.status.ok {
    color: #4ade80;
}

.status.warn {
    color: #fbbf24;
}

.cost-row--total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    color: var(--text);
    font-size: 1rem;
}

.cost-row--total strong {
    color: #7dd3fc;
    font-size: 1.25rem;
    font-weight: 700;
}

.cost-row--size {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.cost-row--size strong {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.preview-wrap {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #d8dee4;
}

.preview {
    flex: 1;
    position: relative;
    background: var(--preview-bg);
    min-height: 320px;
    cursor: grab;
}

.plate-menu {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 7;
    width: 168px;
    max-height: calc(100% - 96px);
    overflow-y: auto;
    padding: 0.55rem 0.5rem 0.65rem;
    border: 1px solid #c5ced6;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 2px 12px rgba(30, 40, 50, 0.14);
    color: #1e293b;
}

.plate-menu__title {
    margin: 0.45rem 0 0.4rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
}

.plate-menu__title:first-child {
    margin-top: 0;
}

.plate-menu__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.3rem;
    margin-bottom: 0.35rem;
}

.plate-menu__row {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 0.3rem;
}

.plate-btn {
    appearance: none;
    flex: 1;
    min-height: 28px;
    padding: 0.2rem 0.25rem;
    border: 1px solid #c5ced6;
    border-radius: 6px;
    background: #f8fafc;
    color: #0f172a;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.1;
}

.plate-btn:hover {
    border-color: #38bdf8;
    background: #e0f2fe;
}

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

.plate-btn--wide {
    width: 100%;
    flex: 1 1 auto;
}

.plate-btn--accent {
    background: linear-gradient(90deg, #38bdf8, #22c55e);
    border-color: transparent;
    color: #0b1120;
}

.plate-btn.is-active {
    border-color: #f59e0b;
    background: #fef3c7;
    color: #92400e;
    box-shadow: inset 0 0 0 1px #f59e0b;
}

.btn.is-active {
    border-color: #38bdf8;
    background: #e0f2fe;
    color: #0c4a6e;
}

.measure-result {
    margin: 0 0 0.45rem;
    padding: 0.4rem 0.45rem;
    border-radius: 6px;
    border: 1px solid #f59e0b;
    background: #fffbeb;
    color: #78350f;
    font-size: 0.72rem;
    line-height: 1.35;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.measure-result strong {
    font-size: 0.95rem;
    font-weight: 700;
    color: #92400e;
}

.measure-result__xyz {
    opacity: 0.85;
    font-variant-numeric: tabular-nums;
}

.preview.is-measuring,
.preview.is-measuring canvas {
    cursor: crosshair;
}

.preview.is-drawing-bridge,
.preview.is-drawing-bridge canvas {
    cursor: crosshair;
}

.preview.is-editing-bridge,
.preview.is-editing-bridge canvas {
    cursor: grab;
}

.preview.is-scaling,
.preview.is-scaling canvas {
    cursor: nwse-resize;
}

.preview.is-rotating,
.preview.is-rotating canvas {
    cursor: grab;
}

.selection-badge[data-role="scale"] {
    border-color: #f59e0b;
    color: #fde68a;
}

.selection-badge[data-role="rotate"] {
    border-color: #22d3ee;
    color: #a5f3fc;
}

.plate-menu__hint {
    margin: 0.15rem 0 0.4rem;
    font-size: 0.65rem;
    line-height: 1.25;
    color: #64748b;
}

.motiv-list-wrap {
    margin: 0.45rem 0 0.8rem;
    padding: 0.45rem 0.5rem 0.5rem;
    border: 1px solid var(--panel-edge);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.4);
}

.motiv-list-wrap .field-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

.motiv-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.32rem;
}

.motiv-list__item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.25rem 0.2rem 0.3rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.55);
}

.motiv-list__item.is-selected {
    border-color: rgba(56, 189, 248, 0.7);
    background: rgba(14, 165, 233, 0.16);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.18);
}

.motiv-list__item:last-child {
    border-bottom-color: rgba(148, 163, 184, 0.22);
}

.motiv-list__name {
    appearance: none;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.08rem;
    margin: 0;
    padding: 0.2rem 0.3rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.motiv-list__title {
    max-width: 100%;
    font-size: 0.78rem;
    font-weight: 600;
    color: #f1f5f9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.motiv-list__meta {
    font-size: 0.65rem;
    line-height: 1.2;
    color: var(--muted);
}

.motiv-list__name:hover {
    background: rgba(56, 189, 248, 0.1);
}

.motiv-list__del {
    appearance: none;
    flex: 0 0 auto;
    width: 1.55rem;
    height: 1.55rem;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-radius: 6px;
    background: rgba(127, 29, 29, 0.28);
    color: #fca5a5;
    font: inherit;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
}

.motiv-list__del:hover {
    background: rgba(185, 28, 28, 0.45);
    border-color: rgba(248, 113, 113, 0.7);
    color: #fecaca;
}


.size-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 12;
    transform: translate(-50%, -50%);
    width: min(260px, calc(100% - 2rem));
    padding: 0.9rem 1rem;
    border: 1px solid #c5ced6;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.25);
    color: #0f172a;
}

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

.size-dialog__title {
    margin: 0 0 0.65rem;
    font-size: 0.9rem;
    font-weight: 700;
}

.size-dialog__field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.45rem;
    font-size: 0.82rem;
    color: #475569;
}

.size-dialog__field input {
    width: 5.5rem;
    padding: 0.35rem 0.45rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font: inherit;
}

.size-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(2, 6, 23, 0.58);
}

.confirm-overlay[hidden] {
    display: none !important;
}

.confirm-dialog {
    width: min(26rem, 100%);
    padding: 1.05rem 1.15rem 1.1rem;
    border: 1px solid var(--panel-edge);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: var(--panel-shadow);
    color: var(--text);
}

.confirm-dialog__title {
    margin: 0 0 0.55rem;
    font-size: 1rem;
    font-weight: 650;
    color: #f8fafc;
}

.confirm-dialog__text {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--muted);
    white-space: pre-wrap;
}

.confirm-dialog__actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 1rem;
}

.selection-bar {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    z-index: 8;
    max-width: min(520px, calc(100% - 24px));
    width: max-content;
    padding: 0.45rem 0.55rem 0.5rem;
    border-radius: 10px;
    border: 1px solid #c5ced6;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 2px 12px rgba(30, 40, 50, 0.14);
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.selection-bar__top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.selection-badge {
    position: static;
    top: auto;
    left: auto;
    z-index: auto;
    padding: 0.2rem 0.35rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    pointer-events: none;
    border: 1px solid transparent;
    background: rgba(30, 37, 44, 0.9);
    color: #e8eef4;
    text-align: center;
}

.selection-badge[data-role="1"] {
    border-color: #3d8bfd;
    color: #b8d4ff;
}

.selection-badge[data-role="2"] {
    border-color: #e0a020;
    color: #f5d48a;
}

.selection-badge[data-role="svg"] {
    border-color: #eab308;
    color: #fde68a;
}

.selection-badge[data-role="bridge"] {
    border-color: #64748b;
    color: #e2e8f0;
}

.selection-badge[data-role="multi"] {
    border-color: #94a3b8;
    color: #e2e8f0;
}

.selection-size {
    margin: 0;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #334155;
}

.selection-chips {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    justify-content: center;
    max-height: 4.5rem;
    overflow-y: auto;
}

.selection-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.2rem 0.15rem 0.45rem;
    border-radius: 999px;
    border: 1px solid #c5ced6;
    background: #f8fafc;
    color: #1e293b;
    font-size: 0.72rem;
    font-weight: 600;
}

.selection-chip.is-focused {
    border-color: #f59e0b;
    background: #fff7ed;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.45);
    color: #9a3412;
}

.selection-chip.is-focused .selection-chip__label {
    font-weight: 700;
}

.selection-chip__label {
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    margin: 0;
}

.selection-chip__label:hover {
    text-decoration: underline;
}

.selection-chip__x {
    appearance: none;
    border: 0;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
}

.selection-chip__x:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.preview.is-dragging {
    cursor: grabbing;
}

.preview canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.preview-hint {
    margin: 0;
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
    color: #4a5560;
    background: #e8eef2;
    border-top: 1px solid #c8d0d8;
}

.plate-helper {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 8;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
    max-width: min(400px, calc(100% - 16px));
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.plate-helper__bubble,
.plate-helper__avatar {
    pointer-events: auto;
}

.plate-helper__bubble {
    position: relative;
    padding: 0.6rem 0.85rem 0.7rem;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.96);
    box-shadow: 0 8px 24px rgba(2, 6, 23, 0.35);
    color: #cbd5e1;
}

.plate-helper__bubble::after {
    content: '';
    position: absolute;
    right: 28px;
    bottom: -7px;
    width: 12px;
    height: 12px;
    background: inherit;
    border-right: 1px solid rgba(148, 163, 184, 0.45);
    border-bottom: 1px solid rgba(148, 163, 184, 0.45);
    transform: rotate(45deg);
}

.plate-helper[data-open="false"] .plate-helper__bubble {
    display: none;
}

.plate-helper__close {
    position: absolute;
    top: 4px;
    right: 5px;
    width: 1.4rem;
    height: 1.4rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    font: inherit;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
}

.plate-helper__close:hover {
    color: #f8fafc;
    background: rgba(148, 163, 184, 0.18);
}

.plate-helper__meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 1.4rem 0.35rem 0;
}

.plate-helper__badge {
    flex: none;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.16);
    color: #7dd3fc;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.plate-helper[data-mood='warn'] .plate-helper__badge {
    background: rgba(251, 191, 36, 0.18);
    color: #fcd34d;
}

.plate-helper[data-mood='error'] .plate-helper__badge {
    background: rgba(248, 113, 113, 0.18);
    color: #fca5a5;
}

.plate-helper[data-mood='ok'] .plate-helper__badge {
    background: rgba(52, 211, 153, 0.18);
    color: #6ee7b7;
}

.plate-helper__count {
    margin-left: auto;
    color: #64748b;
    font-size: 0.62rem;
    font-variant-numeric: tabular-nums;
}

.plate-helper__text {
    margin: 0 0 0.6rem;
    max-width: 46ch;
    font-size: 0.82rem;
    line-height: 1.55;
    text-wrap: pretty;
}

.plate-helper__text p {
    margin: 0;
}

.plate-helper__text p + p,
.plate-helper__text ul + p,
.plate-helper__text p + ul {
    margin-top: 0.6em;
}

.plate-helper__title {
    color: #f8fafc;
    font-size: 0.92rem;
    font-weight: 650;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.plate-helper__title + p,
.plate-helper__title + ul {
    margin-top: 0.3em !important;
}

.plate-helper__list {
    margin: 0;
    padding-left: 1.05rem;
    list-style: disc;
}

.plate-helper__list li {
    margin-top: 0.2em;
}

.plate-helper__list li::marker {
    color: #64748b;
}

.plate-helper__ui {
    color: #e0f2fe;
    font-weight: 650;
    white-space: nowrap;
}

.plate-helper__ui.is-wrapping {
    white-space: normal;
}

.plate-helper__tip {
    margin-top: 0.65em !important;
    padding: 0.4em 0.6em;
    border-radius: 8px;
    border-left: 3px solid #38bdf8;
    background: rgba(14, 165, 233, 0.14);
    color: #e0f2fe;
}

.plate-helper__cue {
    color: #94a3b8;
    font-size: 0.74rem;
}

.plate-helper__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.plate-helper__btn {
    appearance: none;
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 999px;
    padding: 0.26rem 0.65rem;
    background: rgba(15, 23, 42, 0.5);
    color: #e2e8f0;
    font: inherit;
    font-size: 0.72rem;
    cursor: pointer;
}

.plate-helper__btn:hover {
    border-color: #7dd3fc;
    color: #fff;
}

.plate-helper__btn--accent {
    background: #0ea5e9;
    border-color: #38bdf8;
    color: #0f172a;
    font-weight: 650;
}

.plate-helper__avatar {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    color: #e2e8f0;
    font: inherit;
}

.plate-helper__svg {
    width: 72px;
    height: 92px;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(2, 6, 23, 0.35));
    transform-origin: 50% 90%;
    animation: helper-bob 2.8s ease-in-out infinite;
}

.plate-helper__name {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #0f172a;
    background: rgba(255, 255, 255, 0.88);
    border-radius: 999px;
    padding: 0.05rem 0.45rem;
}

.plate-helper__shadow {
    fill: rgba(15, 23, 42, 0.28);
    animation: helper-shadow 2.8s ease-in-out infinite;
}

.plate-helper__eye {
    transform-box: fill-box;
    transform-origin: center;
    animation: helper-blink 4.2s step-end infinite;
}

.plate-helper__arm--right {
    transform-box: fill-box;
    transform-origin: 0% 50%;
}

.plate-helper[data-mood="hint"] .plate-helper__arm--right,
.plate-helper[data-mood="idle"] .plate-helper__arm--right {
    animation: helper-wave 2.4s ease-in-out infinite;
}

.plate-helper[data-mood="warn"] .plate-helper__arm--right,
.plate-helper.is-alerting .plate-helper__arm--right {
    animation: helper-wave 0.85s ease-in-out infinite;
}

.plate-helper[data-mood="ok"] .plate-helper__svg {
    animation: helper-cheer 0.7s ease-in-out 3;
}

.plate-helper[data-mood="error"] .plate-helper__svg {
    animation: helper-shake 0.45s ease-in-out 2;
}

.plate-helper.is-alerting .plate-helper__name {
    background: #fbbf24;
    color: #0f172a;
}

.plate-helper__ping {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f59e0b;
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    animation: helper-ping 1.4s ease-out infinite;
    pointer-events: none;
}

.plate-helper[data-mood="error"] .plate-helper__bubble {
    border-color: #f87171;
}

.plate-helper[data-mood="warn"] .plate-helper__bubble {
    border-color: #fbbf24;
}

.plate-helper[data-mood="ok"] .plate-helper__bubble {
    border-color: #34d399;
}

@keyframes helper-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes helper-shadow {
    0%, 100% { transform: scaleX(1); opacity: 0.28; }
    50% { transform: scaleX(0.86); opacity: 0.16; }
}

@keyframes helper-blink {
    0%, 92%, 100% { transform: scaleY(1); }
    94% { transform: scaleY(0.12); }
}

@keyframes helper-wave {
    0%, 100% { transform: rotate(0deg); }
    40% { transform: rotate(-22deg); }
    70% { transform: rotate(12deg); }
}

@keyframes helper-cheer {
    0%, 100% { transform: translateY(0) rotate(0); }
    40% { transform: translateY(-8px) rotate(-6deg); }
    70% { transform: translateY(-3px) rotate(5deg); }
}

@keyframes helper-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

@keyframes helper-ping {
    0% { transform: scale(0.85); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
    100% { transform: scale(0.85); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

@media (max-width: 800px) {
    .plate-helper {
        right: 6px;
        bottom: 6px;
        max-width: min(320px, calc(100% - 16px));
    }
    .plate-helper__svg {
        width: 54px;
        height: 70px;
    }
    .plate-helper__text {
        font-size: 0.76rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .plate-helper__svg,
    .plate-helper__shadow,
    .plate-helper__eye,
    .plate-helper[data-mood="hint"] .plate-helper__arm--right,
    .plate-helper[data-mood="idle"] .plate-helper__arm--right,
    .plate-helper[data-mood="warn"] .plate-helper__arm--right,
    .plate-helper.is-alerting .plate-helper__arm--right,
    .plate-helper[data-mood="ok"] .plate-helper__svg,
    .plate-helper[data-mood="warn"] .plate-helper__svg,
    .plate-helper[data-mood="error"] .plate-helper__svg,
    .plate-helper__ping {
        animation: none;
    }
}

/* Ansichtswürfel (Slicer-Stil) */
.view-cube {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    width: 72px;
    padding: 8px 6px 6px;
    border: 1px solid #c5ced6;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 10px rgba(30, 40, 50, 0.12);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font: inherit;
    color: #2a3540;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.view-cube:hover {
    background: #fff;
    border-color: #2f8f6b;
}

.view-cube__box {
    width: 44px;
    height: 44px;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-28deg) rotateY(38deg);
    transition: transform 0.35s ease;
    margin: 4px 0;
}

.view-cube.is-top .view-cube__box {
    transform: rotateX(-88deg) rotateY(0deg);
}

.view-cube__face {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #1a1f24;
    border: 1px solid rgba(30, 40, 50, 0.35);
    backface-visibility: hidden;
}

.view-cube__face--front {
    background: #d5dde4;
    transform: translateZ(22px);
}

.view-cube__face--top {
    background: #2f8f6b;
    color: #fff;
    transform: rotateX(90deg) translateZ(22px);
}

.view-cube__face--right {
    background: #9aabba;
    transform: rotateY(90deg) translateZ(22px);
}

.view-cube__label {
    font-size: 0.7rem;
    font-weight: 650;
    color: #4a5560;
}

@media (max-width: 800px) {
    .app {
        grid-template-columns: 1fr;
        /* Steuerung nutzt den Platz; Vorschau fest klein darunter */
        grid-template-rows: minmax(0, 1fr) auto;
    }

    .controls {
        border-right: none;
        border-bottom: 1px solid var(--panel-edge);
        max-height: none;
        min-height: 0;
    }

    .preview-wrap {
        flex: 0 0 auto;
        max-height: min(34vh, 280px);
    }

    .preview {
        flex: none;
        min-height: 160px;
        height: min(30vh, 240px);
        max-height: 240px;
    }

    .preview-hint {
        padding: 0.3rem 0.65rem;
        font-size: 0.72rem;
    }
}
