/* Karten-Werkzeug auf der Produktseite. Farben folgen dem Shopware-Theme (Bootstrap-Variablen).
   Aufbau = Arbeitsflaeche (Entscheidung 58, ersetzt das Untereinander aus Entscheidung 32 und die klebende Buehne aus 57):
   links die Schritte, in der Mitte EINE grosse Karte (Umschalter Vorder-/Rueckseite; beide Spalten bleiben im DOM),
   rechts das Panel mit dem aktuellen Schritt; die Flaeche ist so hoch wie das Fenster, nur das Panel scrollt.
   Am Handy: Schritte oben, Karte darunter, Panel als Flaeche von unten.
   Ecken (Entscheidung 48): Rahmen, Knoepfe, Kaesten runden mit calc(N * var(--pk-ecken, 1)) – ohne Theme-Wert wie
   bisher, Design 2 setzt --pk-ecken: 0 (eckig). Ausgenommen: Kartenvorschau (echte ISO-Ecken), Kreise. */
.pk-werkzeug {
    display: grid;
    grid-template-columns: minmax(11rem, 13rem) minmax(0, 1fr) minmax(20rem, 24rem);
    grid-template-areas: "schritte flaeche panel";
    /* Untergrenze 24rem statt 36rem: in niedrigen Fenstern (Laptop mit Zoom) lag Zurueck/Weiter sonst unter dem Fenster */
    height: max(24rem, min(calc(100dvh - 1rem), 62rem));
    margin-top: 1rem;
    overflow: hidden;
    /* Rahmenfarbe der Designs (Entscheidung 53, R5), ohne Theme wie bisher */
    border: 1px solid var(--pk2-rahmen, #c4cbd1);
    border-radius: calc(1rem * var(--pk-ecken, 1));
    background: #ffffff;
}

/* ---------- Schritte (links) ---------- */
.pk-leiste {
    grid-area: schritte;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
    padding: 0.75rem 0.6rem;
    background: #f8fafc;
    border-right: 1px solid var(--pk2-rahmen, #c4cbd1);
}

.pk-schrittliste {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pk-schrittliste .pk-schritt-knopf {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
}

/* "Neu beginnen" unter den Schritten (nur bei angefangener Karte) – leise, damit niemand ihn fuer "Weiter" haelt */
.pk-leiste .pk-neustart {
    align-self: flex-start;
    min-height: 2.75rem;
    padding: 0.25rem 0.6rem;
    color: var(--bs-secondary-color, #4a545b);
    font-size: 0.875rem;
    text-decoration: underline;
}

.pk-leiste .pk-neustart:hover {
    color: var(--pk-primaer, #0042a0);
}

/* Entwurf merken (Paket 2, AC-31): leise wie "Neu beginnen"; die Statuszeile meldet nur Probleme beim Speichern */
.pk-leiste .pk-merken-knopf {
    align-self: flex-start;
    min-height: 2.75rem;
    padding: 0.25rem 0.6rem;
    color: var(--bs-secondary-color, #4a545b);
    font-size: 0.875rem;
    text-decoration: underline;
}

.pk-leiste .pk-merken-knopf:hover {
    color: var(--pk-primaer, #0042a0);
}

.pk-merkstand-status {
    margin: 0;
    padding: 0.25rem 0.6rem;
    font-size: 0.875rem;
    color: var(--bs-danger-text-emphasis, #842029);
}

.pk-merkstand-status .pk-merkstand-nochmal {
    min-height: 2.75rem;
    padding: 0 0.25rem;
    vertical-align: baseline;
}

/* Druckverfahren und Kurzpreis unten in der Schritte-Spalte ("ändern" oeffnet das Fenster Druckverfahren, 19.10.);
   der Kurzpreis darf in der schmalen Spalte umbrechen */
.pk-leiste .pk-verfahren {
    margin-top: auto;
}

@media (min-width: 992px) {
    .pk-leiste .pk-kurzpreis {
        white-space: normal;
    }
}

/* ---------- Flaeche (Mitte): eine grosse Karte ---------- */
.pk-flaeche {
    grid-area: flaeche;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    min-height: 0;
    padding: 0.75rem 1.25rem 1rem;
    overflow: auto;
    background: repeating-conic-gradient(#eef1f6 0 25%, #f7f9fc 0 50%) 0 0 / 16px 16px;
    container-type: size;
}

.pk-seitenwahl {
    display: inline-flex;
    flex: none;
    padding: 3px;
    border-radius: calc(999px * var(--pk-ecken, 1));
    border: 1px solid var(--pk2-rahmen, #c4cbd1);
    background: #ffffff;
}

.pk-seitenwahl-knopf {
    min-height: 2.25rem;
    padding: 0 1rem;
    border: 0;
    border-radius: calc(999px * var(--pk-ecken, 1));
    background: none;
    color: #4a545b;
    font-weight: 700;
    font-size: 0.875rem;
}

.pk-seitenwahl-knopf[aria-pressed="true"] {
    background: var(--pk-primaer, #0042a0);
    color: #ffffff;
}

.pk-seitenwahl-knopf:focus-visible {
    outline: 3px solid var(--pk-primaer, #0042a0);
    outline-offset: 2px;
}

.pk-flaeche .pk-buehne {
    width: 100%;
}

/* nur die gewaehlte Seite ist sichtbar */
.pk-werkzeug:not([data-aktive-seite="hinten"]) .pk-seite-spalte[data-seite="hinten"],
.pk-werkzeug[data-aktive-seite="hinten"] .pk-seite-spalte[data-seite="vorne"] {
    display: none;
}

/* ---------- Panel (rechts): der aktuelle Schritt, scrollt allein ---------- */
.pk-panel {
    grid-area: panel;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
    min-height: 0;
    padding: 1rem;
    overflow: auto;
    border-left: 1px solid var(--pk2-rahmen, #c4cbd1);
    /* Zurueck/Weiter klebt unten: ein per Tab fokussiertes Feld darf nicht darunter liegen (WCAG 2.4.11) */
    scroll-padding-bottom: 4.5rem;
}

/* im Panel keine Box in der Box; der Schritt fuellt das Panel, damit Zurueck/Weiter unten steht */
.pk-panel .pk-schritt-panel {
    padding: 0;
    border: 0;
}

.pk-panel .pk-schritt-panel:not([hidden]) {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    gap: 1rem;
}

/* Zurueck/Weiter bleibt unten im Panel stehen */
.pk-panel .pk-navi {
    position: sticky;
    bottom: -1rem;
    z-index: 2;
    margin: auto -1rem -1rem;
    padding: 0.75rem 1rem;
    background: #ffffff;
}

/* eine Zeile: lange Beschriftungen ("Vorschau erzeugen und freigeben") brechen im Knopf um statt den Fuss zweizeilig
   zu machen – am Handy ragte die zweite Zeile mit dem Hauptknopf aus dem Fenster */
.pk-panel .pk-navi {
    flex-wrap: nowrap;
}

.pk-panel .pk-navi .btn {
    white-space: normal;
}

.pk-panel .pk-navi .pk-zurueck {
    flex: none;
}

/* ---------- Handy und Tablet: untereinander. Die Karte heftet oben an, die Einstellungen laufen darunter mit der Seite
   (kein verschachteltes Scrollen; bei fester Hoehe drueckten Karte + Blaettern das Panel in Schritt 4 auf 0 px),
   Zurueck/Weiter klebt unten. ---------- */
@media (max-width: 991.98px) {
    .pk-werkzeug {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto auto;
        grid-template-areas: "schritte" "flaeche" "panel";
        height: auto;
        /* clip statt hidden: kein Scroll-Container, die Flaeche haftet weiter an; die Ecken bleiben rund beschnitten */
        overflow: clip;
    }

    .pk-leiste {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.25rem 0.75rem;
        padding: 0.375rem 0.5rem;
        border-right: 0;
        border-bottom: 1px solid var(--pk2-rahmen, #c4cbd1);
    }

    .pk-schrittliste {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.125rem;
    }

    .pk-schrittliste .pk-schritt-knopf {
        width: auto;
    }

    .pk-leiste .pk-verfahren {
        margin-top: 0;
        margin-left: auto;
    }

    /* am Handy hinter Druckverfahren und Kurzpreis, in eigener Zeile – die Schrittreihe bleibt frei */
    .pk-leiste .pk-neustart {
        order: 5;
        min-height: 2.5rem;
    }

    .pk-leiste .pk-merken-knopf,
    .pk-leiste .pk-merkstand-status {
        order: 5;
        min-height: 2.5rem;
    }

    .pk-flaeche {
        position: sticky;
        top: 0;
        z-index: 5;
        overflow: visible;
        border-bottom: 1px solid var(--pk2-rahmen, #c4cbd1);
        padding: 0.5rem 0.75rem 1.25rem;
        container-type: inline-size;
    }

    /* das Panel laeuft UNTER der angehefteten Flaeche durch (vorher z-index 6: es schob sich ueber die Karte) */
    .pk-panel {
        position: relative;
        overflow: visible;
        padding-top: 1.4rem;
        border-left: 0;
        border-radius: calc(1.1rem * var(--pk-ecken, 1)) calc(1.1rem * var(--pk-ecken, 1)) 0 0;
        background: #ffffff;
    }

    /* Fokus per Tastatur landet unter der angehefteten Karte statt dahinter (WCAG 2.4.11); Hoehe setzt das Script */
    html:has(.pk-werkzeug) {
        scroll-padding-top: var(--pk-flaeche-hoehe, 0px);
        scroll-padding-bottom: 4.5rem; /* ebenso unter dem klebenden Zurueck/Weiter */
    }

    /* offener Gestalter: die Flaeche ist ausgeblendet, ihre Hoehe zaehlt nicht (sonst landete er beim Oeffnen tiefer) */
    html:has(.pk-werkzeug[data-gestalter="offen"]) {
        scroll-padding-top: 0;
        scroll-padding-bottom: 0;
    }

    /* niedriges Fenster (Handy quer, Bildschirmtastatur): eine angeheftete Karte wuerde das ganze Fenster fuellen und die
       Einstellungen verdecken – dann scrollt sie mit (Kalt-Review E3, 844 x 390) */
    @media (max-height: 34rem) {
        .pk-flaeche {
            position: relative;
        }

        html:has(.pk-werkzeug) {
            scroll-padding-top: 0;
        }
    }

    .pk-panel .pk-navi {
        bottom: 0;
        margin: auto -1rem 0;
    }
}

.pk-schritt-knopf {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.25rem 0.7rem 0.25rem 0.35rem;
    border: 0;
    border-radius: calc(999px * var(--pk-ecken, 1));
    background: none;
    color: #4a545b;
    font-weight: 600;
    font-size: 0.875rem;
}

.pk-schritt-knopf:hover {
    background: #f5f7f9;
}

.pk-schritt-nr {
    display: inline-grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: #eef1f4;
    color: #2b3136;
    font-size: 0.8125rem;
}

.pk-schritt-knopf[aria-current="step"] {
    background: var(--pk-primaer-hell, #eef3fb);
    color: var(--pk-primaer, #0042a0);
}

.pk-schritt-knopf[aria-current="step"] .pk-schritt-nr {
    background: var(--pk-primaer, #0042a0);
    color: #ffffff;
}

.pk-schritt-erledigt .pk-schritt-nr {
    background: #1a7f4b;
    color: #ffffff;
}

.pk-schritt-name small {
    font-weight: 400;
    font-size: 0.75rem;
}

.pk-kurzpreis {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Handy: nur Nummern, beim aktuellen Schritt zusaetzlich der Name */
@media (max-width: 767px) {
    .pk-schritt-knopf:not([aria-current="step"]) .pk-schritt-name {
        display: none;
    }

    .pk-schritt-knopf:not([aria-current="step"]) {
        padding-right: 0.35rem;
    }
}

/* ---------- Karte: eine Spalte (die andere Seite ist ausgeblendet, Entscheidung 58) ---------- */
.pk-seiten {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.4rem;
    align-items: start;
}

/* Titel + Karte; beide Spalten teilen sich per Subgrid die Titelzeile (Entscheidung 50: der Aufpreis-Hinweis an der
   Rueckseite kann umbrechen – die Karten beginnen trotzdem auf gleicher Hoehe) */
.pk-seite-spalte {
    display: grid;
    grid-row: span 3;
    grid-template-rows: subgrid;
    min-width: 0;
}

/* ---------- Schritt Motiv (Entscheidung 58): Wahl der zwei Werkzeuge, dann je Seite das Druckdatei-Werkzeug ----------
   Der Weg (data-weg an der Wurzel: "" | datei | gestalten) setzt das Script aus dem Inhalt bzw. der Wahl. */
.pk-werkzeug:not([data-weg=""]) .pk-weg-wahl,
.pk-werkzeug[data-weg=""] .pk-weg-werkzeug,
.pk-werkzeug[data-weg="gestalten"] .pk-motiv-seite:not([data-hat-motiv]) .pk-datei-teil,
.pk-werkzeug[data-weg="gestalten"] .pk-datei-legende {
    display: none;
}

.pk-weg-wahl {
    display: grid;
    gap: 0.75rem;
}

.pk-weg-karte {
    display: grid;
    grid-template-columns: 2.75rem minmax(0, 1fr);
    gap: 0.2rem 0.75rem;
    align-items: start;
    padding: 0.875rem;
    border: 1px solid var(--pk2-rahmen, #c4cbd1);
    border-radius: calc(0.875rem * var(--pk-ecken, 1));
    background: #ffffff;
    color: inherit;
    text-align: left;
}

.pk-weg-karte:hover {
    border-color: var(--pk-primaer, #0042a0);
}

.pk-weg-karte:focus-visible {
    outline: 3px solid var(--pk-primaer, #0042a0);
    outline-offset: 2px;
}

.pk-weg-symbol {
    display: grid;
    grid-row: span 3;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: calc(0.75rem * var(--pk-ecken, 1));
    background: var(--pk-primaer-hell, #eef3fb);
    color: var(--pk-primaer, #0042a0);
}

.pk-weg-symbol svg {
    width: 1.375rem;
    height: 1.375rem;
}

.pk-weg-karte b {
    color: var(--pk-primaer-dunkel, #00367f);
    font-size: 1rem;
}

.pk-weg-karte span:not(.pk-weg-symbol) {
    color: #4a545b;
    font-size: 0.875rem;
}

.pk-weg-karte small {
    color: var(--pk-primaer, #0042a0);
    font-weight: 700;
    font-size: 0.8125rem;
}

.pk-weg-werkzeug {
    display: grid;
    gap: 0.75rem;
}

/* je Seite; sichtbar ist die Seite, die auf der Flaeche gezeigt wird */
.pk-motiv-seite {
    display: grid;
    gap: 0.75rem;
}

.pk-werkzeug:not([data-aktive-seite="hinten"]) .pk-motiv-seite[data-seite="hinten"],
.pk-werkzeug[data-aktive-seite="hinten"] .pk-motiv-seite[data-seite="vorne"] {
    display: none;
}

.pk-datei-teil {
    display: grid;
    gap: 0.6rem;
}

.pk-datei-zeile {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    padding: 0.6rem 0.75rem;
    border-radius: calc(0.75rem * var(--pk-ecken, 1));
    background: #f3f6fa;
    font-size: 0.875rem;
}

.pk-datei-zeile[hidden] {
    display: none;
}

.pk-datei-symbol {
    flex: none;
    width: 1.375rem;
    height: 1.375rem;
    color: var(--pk-primaer, #0042a0);
}

.pk-datei-text {
    display: grid;
    min-width: 0;
}

.pk-datei-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pk-datei-info {
    color: #4a545b;
    font-size: 0.8125rem;
}

.pk-datei-ersetzen {
    margin-left: auto;
    white-space: nowrap;
}

.pk-druckpruefung {
    display: grid;
    gap: 0.375rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pk-druckpunkt {
    display: grid;
    grid-template-columns: 1.375rem minmax(0, 1fr);
    gap: 0.5rem;
    align-items: start;
    padding: 0.5rem 0.625rem;
    border-radius: calc(0.625rem * var(--pk-ecken, 1));
    font-size: 0.8125rem;
}

/* Gruen #1a6b40 bzw. Braun #8a4b00 auf hellem Grund > 4,5:1; die Marke traegt zusaetzlich ✓ bzw. ! (nicht nur Farbe) */
.pk-druckpunkt-ok {
    background: #e6f4ec;
}

.pk-druckpunkt-achtung {
    background: #fff1dc;
}

.pk-druckpunkt-marke {
    display: grid;
    place-items: center;
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 50%;
    color: #ffffff;
    font-weight: 800;
    font-size: 0.75rem;
}

.pk-druckpunkt-ok .pk-druckpunkt-marke {
    background: #1a6b40;
}

.pk-druckpunkt-achtung .pk-druckpunkt-marke {
    background: #8a4b00;
}

.pk-druckpunkt-text {
    display: grid;
}

.pk-druckpunkt-text > span {
    color: #3b434a;
}

.pk-motiv-seite .pk-motiv-werkzeuge {
    width: 100%;
}

.pk-motiv-seite .pk-hinweis:empty,
.pk-motiv-seite .pk-gestaltung-hinweis:empty {
    display: none;
}

.pk-datei-legende {
    margin: 0;
    color: #4a545b;
    font-size: 0.8125rem;
}

.pk-weg-wechsel {
    justify-self: start;
    padding-inline: 0;
}

/* ---------- Schritt-Bereich ---------- */
.pk-schritt-panel {
    display: grid;
    gap: 1rem;
    padding: 1.25rem;
    border: 1px solid #c4cbd1;
    border-radius: calc(0.5rem * var(--pk-ecken, 1));
}

.pk-schritt-panel[hidden] {
    display: none;
}

.pk-schritt-panel .pk-schritt-titel:focus {
    outline: none;
}

.pk-schritt-panel .pk-schritt-titel:focus-visible {
    outline: 3px solid var(--pk-primaer, #0042a0);
    outline-offset: 2px;
}

.pk-navi {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid #c4cbd1;
}

.pk-navi .pk-weiter,
.pk-navi .pk-vorschau-knopf {
    margin-left: auto;
}

/* Schritt 5: Menge links, Preis rechts */
.pk-abschluss {
    display: grid;
    gap: 1rem;
    align-items: start;
}

@media (min-width: 768px) {
    .pk-abschluss {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    }
}

.pk-fehlt {
    padding: 0.75rem 1rem;
    border-radius: calc(0.375rem * var(--pk-ecken, 1));
    background: #fff4e5;
    font-size: 0.9rem;
}

.pk-fehlt[hidden] {
    display: none;
}

.pk-fehlt-titel {
    margin: 0 0 0.25rem;
    font-weight: 600;
}

.pk-fehlt-liste {
    margin: 0;
    padding-left: 1.25rem;
}

.pk-fehlt-sprung {
    padding: 0;
    vertical-align: baseline;
}


.pk-schritt {
    display: grid;
    gap: 0.75rem;
}

.pk-schritt-titel {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
}

.pk-steuerung {
    display: grid;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid #c4cbd1;
    border-radius: calc(0.5rem * var(--pk-ecken, 1));
}

.pk-steuerung-titel {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.pk-intro {
    margin: 0;
    color: var(--bs-secondary-color, #4a545b);
}

/* Kartenflaeche im exakten Format 85,6 : 54 */
.pk-karte {
    position: relative;
    aspect-ratio: 85.6 / 54;
    width: 100%;
    border-radius: 3.5% / 5.5%;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 0 0 1px #8c959c, 0 2px 8px rgba(0, 0, 0, 0.12);
    touch-action: none;
}

/* So gross, wie die Flaeche erlaubt: Breite und Hoehe der Flaeche (Container) begrenzen – darunter bleibt Platz fuer
   Titel, Seitenwahl und (Schritt Motiv) die Werkzeuge unter der Karte */
.pk-seite-spalte .pk-karte {
    width: min(100%, 44rem, calc((100cqh - 7rem) * 85.6 / 54));
    justify-self: center;
}

@media (max-width: 991.98px) {
    /* hoechstens rund ein Drittel der Fensterhoehe (wie Entscheidung 57): darunter bleibt Platz fuer die Einstellungen */
    .pk-seite-spalte .pk-karte {
        width: min(100%, 30rem, calc(34svh * 85.6 / 54));
    }
}

.pk-datei-knopf {
    justify-self: start;
}

.pk-hinweis {
    margin: 0;
    font-size: 0.875rem;
}

.pk-hinweis:empty {
    display: none;
}

.pk-hinweis {
    color: #8a4b00;
}

.pk-menge {
    display: grid;
    gap: 0.25rem;
    max-width: 16rem;
}

/* Freigabe als Modal: Hintergrund ausgegraut, Inhalt scrollt innen */
.pk-freigabe-dialog {
    width: min(56rem, calc(100vw - 2rem));
    max-width: none;
    max-height: 90vh;
    padding: 0;
    border: 0;
    border-radius: calc(0.5rem * var(--pk-ecken, 1));
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

.pk-freigabe-dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

/* Rueckfrage (statt window.confirm) */
.pk-frage-dialog {
    width: min(30rem, calc(100vw - 2rem));
    max-width: none;
    padding: 0;
    border: 0;
    border-radius: calc(0.5rem * var(--pk-ecken, 1));
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

.pk-frage-dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.pk-frage {
    display: grid;
    gap: 1rem;
    padding: 1rem 1.25rem 1.25rem;
}

.pk-frage-text {
    margin: 0;
}

.pk-merken-dialog {
    width: min(32rem, calc(100vw - 2rem));
    max-width: none;
    padding: 0;
    border: 0;
    border-radius: calc(0.5rem * var(--pk-ecken, 1));
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

.pk-merken-dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.pk-merken-teil {
    display: grid;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
}

.pk-merken-teil h3 {
    margin: 0;
}

.pk-merken-form {
    display: grid;
    gap: 0.5rem;
}

.pk-merken-hinweis,
.pk-merken-meldung {
    margin: 0;
    font-size: 0.875rem;
}

.pk-merken-meldung:empty {
    display: none;
}

.pk-merken-teil .btn {
    justify-self: start;
    min-height: 2.75rem;
}

/* Falle fuer Programme: aus dem sichtbaren Bereich, ohne display:none (manche Programme ueberspringen das) */
.pk-merken-falle {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

body:has(.pk-merken-dialog[open]),
body:has(.pk-frage-dialog[open]),
body:has(.pk-freigabe-dialog[open]) {
    overflow: hidden;
}

.pk-freigabe {
    display: grid;
    gap: 1rem;
    padding: 1rem 1.25rem 1.25rem;
}

.pk-freigabe-inhalt {
    display: grid;
    gap: 1rem;
}

.pk-freigabe-inhalt[hidden] {
    display: none;
}

.pk-dialog-kopf {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.pk-dialog-zu {
    flex: none;
    width: 2.75rem;
    height: 2.75rem;
    border: 0;
    border-radius: calc(0.375rem * var(--pk-ecken, 1));
    background: none;
    color: #2b3136;
    font-size: 1.75rem;
    line-height: 1;
}

.pk-dialog-zu:hover {
    background: #eef1f4;
}

.pk-dialog-zu:focus-visible {
    outline: 3px solid var(--pk-primaer, #0042a0);
    outline-offset: 2px;
}

.pk-freigabe-laden {
    margin: 0;
    padding: 2rem 0;
    text-align: center;
    color: #4a545b;
}

.pk-freigabe-laden[hidden] {
    display: none;
}

.pk-dialog-fuss {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.pk-freigabe-bilder {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 1rem;
}

.pk-freigabe-bilder figure {
    margin: 0;
}

.pk-freigabe-bilder img {
    width: 100%;
    height: auto;
    border-radius: 3.5% / 5.5%;
    box-shadow: 0 0 0 1px #8c959c;
}

.pk-freigabe-legende {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin: 0;
    font-size: 0.875rem;
    color: #4a545b;
}

.pk-legende-linie {
    flex: none;
    width: 2rem;
    border-top: 2px dashed #c8007a;
}

.pk-freigabe-bilder figcaption {
    font-size: 0.875rem;
    color: #4a545b;
    margin-top: 0.25rem;
}

/* Grosse Auswahl-Kacheln mit gut sichtbarem Zustand (heute: Personalisierung Ja/Nein; bis Entscheidung 50 auch
   die Druckseiten-Wahl im frueheren Schritt 1) */
.pk-druck-wahl {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.5rem;
}

.pk-druck-option {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    border: 1px solid #8c959c;
    border-radius: calc(0.5rem * var(--pk-ecken, 1));
    cursor: pointer;
    min-height: 3rem;
}

.pk-druck-option:has(input:checked) {
    border: 2px solid var(--pk-primaer, #0042a0);
    background: var(--pk-primaer-hell, #eef3fb);
}

.pk-druck-option:has(input:focus-visible) {
    outline: 3px solid var(--pk-primaer, #0042a0);
    outline-offset: 2px;
}

.pk-druck-option input {
    margin-top: 0.25rem;
    flex: none;
}

.pk-druck-option small,
.pk-lieferzeit {
    color: #4a545b;
}

.pk-lieferzeit {
    margin: 0;
    font-size: 0.875rem;
}

/* Expressproduktion (Entscheidung 59): unter der Lieferzeit, Hinweis eingerueckt wie das Ankreuzfeld */
.pk-express {
    margin-top: 0.5rem;
}

.pk-express-hinweis {
    display: block;
    padding-left: 1.5em;
    font-size: 0.8125rem;
}

/* Entscheidung 50: Aufpreis der bedruckten Rueckseite, klein neben dem Titel "Rueckseite" */
.pk-rueckseite-preis {
    margin-left: 0.4rem;
    color: #4a545b;
    font-size: 0.8125rem;
    font-weight: 400;
}

/* Handy: Hinweis als eigene Zeile unter "Rueckseite" */
@media (max-width: 767px) {
    .pk-rueckseite-preis {
        display: block;
        margin-left: 0;
    }

}

.pk-staffel summary {
    cursor: pointer;
    color: var(--pk-primaer, #0042a0);
    padding: 0.25rem 0;
}

.pk-staffel-tabelle {
    max-width: 20rem;
    margin-top: 0.5rem;
}

/* Preisuebersicht */
.pk-preis {
    display: grid;
    gap: 0.25rem;
    margin: 0;
    padding: 0.75rem 1rem;
    border-radius: calc(0.5rem * var(--pk-ecken, 1));
    background: #f5f7f9;
    max-width: 24rem;
}

.pk-preis > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.pk-preis dt {
    font-weight: 400;
}

.pk-preis dd {
    margin: 0;
    text-align: right;
}

.pk-preis-summe {
    font-weight: 700;
    font-size: 1.125rem;
    border-top: 1px solid #c4cbd1;
    padding-top: 0.25rem;
}

/* ---------- Motiv auf der Buehne: verschieben, drehen, Groesse ---------- */
.pk-motiv-rahmen {
    position: absolute;
    transform-origin: 50% 50%;
    cursor: grab;
    touch-action: none;
}

.pk-motiv-rahmen:active {
    cursor: grabbing;
}

.pk-motiv-rahmen:focus-visible {
    outline: 3px solid var(--pk-primaer, #0042a0);
    outline-offset: 2px;
}

.pk-motiv {
    display: block;
    width: 100%;
    height: 100%;
    user-select: none;
    pointer-events: none;
}

/* Hologrammfolie: gleicher Regenbogen-Schimmer wie in der Freigabe-Vorschau des Renderers (30 % deckend) */
.pk-holo {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.3;
    background: linear-gradient(135deg, #ff5fd2, #ffd36b, #7dffb0, #6bd8ff, #b28bff, #ff5fd2, #7dffb0, #6bd8ff);
}

.pk-legende-holo-muster {
    flex: none;
    width: 2rem;
    height: 0.75rem;
    border-radius: calc(2px * var(--pk-ecken, 1));
    opacity: 0.6;
    background: linear-gradient(135deg, #ff5fd2, #ffd36b, #7dffb0, #6bd8ff, #b28bff);
}

.pk-leer {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #4a545b;
    font-size: 0.875rem;
    pointer-events: none;
}

/* ---------- Schreibfelder (SVG in mm) ---------- */
.pk-felder {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

.pk-feld-form {
    fill: rgba(255, 255, 255, 0.9);
    /* gleiche Signalfarbe wie die Umrandung in der Freigabe-Vorschau (Renderer VORSCHAU_RAND) */
    stroke: #c8007a;
    stroke-width: 1.5px;
    stroke-dasharray: 4 3;
    vector-effect: non-scaling-stroke;
    pointer-events: visiblePainted;
    cursor: move;
    outline: none;
}

.pk-feld-aktiv {
    stroke-width: 2.5px;
    stroke-dasharray: none;
}

.pk-feld-form:focus-visible {
    stroke: var(--pk-primaer, #0042a0);
    stroke-width: 4px;
    stroke-dasharray: none;
}

.pk-zeichnen-linie {
    fill: none;
    stroke: var(--pk-primaer, #0042a0);
    stroke-width: 2px;
    vector-effect: non-scaling-stroke;
}

.pk-karte-zeichnen {
    cursor: crosshair;
}

.pk-griffe {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* Griffe: 24 x 24 px Zielflaeche (WCAG 2.5.8), sichtbarer Punkt in der Mitte */
.pk-griff {
    position: absolute;
    width: 24px;
    height: 24px;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    touch-action: none;
}

.pk-griff::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12px;
    height: 12px;
    transform: translate(-50%, -50%);
    background: var(--pk-primaer, #0042a0);
    border: 2px solid #ffffff;
    border-radius: 2px;
}

.pk-griff-groesse {
    cursor: nwse-resize;
}

.pk-griff-punkt {
    cursor: move;
}

.pk-griff-punkt::after {
    border-radius: 50%;
}

.pk-griff-start::after {
    background: #ffffff;
    border-color: var(--pk-primaer, #0042a0);
    width: 14px;
    height: 14px;
}

.pk-griff-gewaehlt::after {
    background: #c25100;
}

/* ---------- Bedienspalte: Motiv-Werkzeuge und Feldliste ---------- */
.pk-motiv-werkzeuge {
    display: grid;
    gap: 0.5rem;
}

.pk-knopfreihe {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.pk-regler {
    display: grid;
    gap: 0.125rem;
    font-size: 0.875rem;
}

/* Kopfzeile eines Reglers mit Aktion rechts (Groesse und Drehung: "Zuruecksetzen") */
.pk-regler-kopf {
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.5rem;
    align-items: center;
    justify-content: space-between;
}

.pk-regler-null {
    min-height: 1.5rem; /* Zielgroesse 24 px (WCAG 2.5.8) */
    padding: 0 0.25rem;
    font-size: 0.8125rem;
}

.pk-regler-paar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.pk-regler-paar .form-control {
    width: 5.5rem;
    flex: none;
}

.pk-felder-steuerung {
    display: grid;
    gap: 0.5rem;
}

.pk-felder-kopf {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.pk-feldliste {
    display: grid;
    gap: 0.375rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pk-feldeintrag {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    align-items: center;
    padding: 0.375rem 0.5rem;
    border: 1px solid #c4cbd1;
    border-radius: calc(0.375rem * var(--pk-ecken, 1));
    background: #f5f7f9;
}

.pk-feldeintrag-aktiv {
    border-color: var(--pk-primaer, #0042a0);
    background: var(--pk-primaer-hell, #eef3fb);
}

.pk-feldname {
    font-weight: 600;
    font-size: 0.875rem;
}

.pk-feldeintrag .form-select {
    width: auto;
    /* weiss auf getoentem Eintrag: als Auswahlfeld erkennbar, trotzdem ohne Rahmen (Entscheidung 23) */
    background-color: #ffffff;
}

.pk-radius .form-control {
    width: 4.5rem;
    flex: none;
}

.pk-radius {
    display: flex;
    gap: 0.375rem;
    align-items: center;
    font-size: 0.875rem;
}

.pk-radius .form-range {
    width: 5rem;
}

/* Schiene weiss wie das Auswahlfeld daneben – auf dem getoenten Eintrag war sonst nur der Punkt zu sehen */
.pk-radius .form-range::-webkit-slider-runnable-track {
    background-color: #ffffff;
}

.pk-radius .form-range::-moz-range-track {
    background-color: #ffffff;
}

/* Loeschen-Knopf immer rechts aussen, auch wenn die Zeile umbricht */
.pk-feld-weg {
    margin-left: auto;
}

.pk-zeichnen {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem;
    border-radius: calc(0.375rem * var(--pk-ecken, 1));
    background: #fff4e5;
}

.pk-zeichnen-hilfe {
    margin: 0;
    flex-basis: 100%;
    font-size: 0.875rem;
}

/* ---------- Personalisierung: Schriften laedt das Skript bei Bedarf (FontFace; dieselben Dateien wie im Renderer, kein Google Fonts) ---------- */
/* Ebene ueber dem Motiv, unter Hologramm-Schimmer und Schreibfeldern (Druckreihenfolge) */
.pk-perso {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.pk-el-rahmen {
    fill: transparent;
    stroke: var(--pk-primaer, #0042a0);
    stroke-width: 1px;
    stroke-dasharray: 3 2;
    vector-effect: non-scaling-stroke;
    pointer-events: all;
    cursor: move;
    outline: none;
}

.pk-el-aktiv {
    stroke-width: 2px;
    stroke-dasharray: none;
}

.pk-el-rahmen:focus-visible {
    stroke-width: 3px;
    stroke-dasharray: none;
}

/* Wert fuer diese Karte ungueltig (z. B. EAN-Pruefziffer): rot schraffierte Flaeche statt Code */
.pk-el-ungueltig {
    fill: rgba(179, 38, 30, 0.15);
    stroke: #b3261e;
    stroke-width: 1.5px;
    vector-effect: non-scaling-stroke;
}

.pk-perso-griffe {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* ---------- Schritt 4: Personalisierung (Entscheidung 40): A Daten, B Zuordnung ---------- */
.pk-perso-wahl {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    border: 0;
}

.pk-perso-inhalt {
    display: grid;
    gap: 1.5rem;
}

.pk-perso-inhalt[hidden],
.pk-zuordnung[hidden],
.pk-quelle-wahl[hidden],
.pk-daten-fertig[hidden],
.pk-daten-frage[hidden],
.pk-quelle-inhalt[hidden],
.pk-blaettern[hidden] {
    display: none;
}

.pk-perso-teil {
    display: grid;
    gap: 0.75rem;
}

.pk-teil-kopf {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    align-items: baseline;
    justify-content: space-between;
}

.pk-teil-kopf p {
    margin: 0;
    font-size: 0.875rem;
    color: #4a545b;
}

.pk-teil-titel {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.pk-marke {
    display: inline-grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    margin-right: 0.4rem;
    border-radius: 50%;
    background: var(--pk-primaer, #0042a0);
    color: #ffffff;
    font-size: 0.8rem;
    vertical-align: 0.1em;
}

/* A: Datenquelle als zwei grosse Flaechen; immer nur eine offen */
.pk-quelle-wahl {
    display: grid;
    gap: 0.75rem;
}

.pk-quellen {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 0.75rem;
}

.pk-quelle {
    display: grid;
    grid-template-columns: 2.5rem minmax(0, 1fr);
    gap: 0.1rem 0.75rem;
    align-items: start;
    padding: 0.8rem 0.9rem;
    border: 1px solid #8c959c;
    border-radius: calc(0.5rem * var(--pk-ecken, 1));
    background: #ffffff;
    color: #2b3136;
    text-align: left;
    cursor: pointer;
}

.pk-quelle:hover {
    border-color: var(--pk-primaer, #0042a0);
}

.pk-quelle[aria-pressed="true"] {
    border: 2px solid var(--pk-primaer, #0042a0);
    background: var(--pk-primaer-hell, #eef3fb);
}

.pk-quelle-symbol {
    grid-row: span 2;
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: calc(0.4rem * var(--pk-ecken, 1));
    background: #f5f7f9;
    color: var(--pk-primaer, #0042a0);
}

.pk-quelle-symbol svg {
    width: 1.5rem;
    height: 1.5rem;
}

.pk-quelle span:not(.pk-quelle-symbol) {
    font-size: 0.875rem;
    color: #4a545b;
}

.pk-quelle-zurueck {
    justify-self: start;
    padding-inline: 0;
}

.pk-ablage {
    display: grid;
    justify-items: center;
    gap: 0.5rem;
    padding: 1.25rem;
    border: 2px dashed #8c959c;
    border-radius: calc(0.5rem * var(--pk-ecken, 1));
    text-align: center;
}

.pk-ablage small {
    color: #4a545b;
}

.pk-ablage .btn {
    margin: 0;
}

.pk-nummern {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.6rem 0.9rem;
    align-items: end;
    margin: 0;
    padding: 0.9rem;
    border: 0;
    border-radius: calc(0.5rem * var(--pk-ecken, 1));
    background: #f5f7f9;
    font-size: 0.875rem;
}

.pk-nummern label {
    display: grid;
    gap: 0.2rem;
    margin: 0;
    color: #4a545b;
}

.pk-nr-beispiel {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

/* Daten da: gruene Zusammenfassung */
.pk-daten-fertig {
    display: grid;
    gap: 0.6rem;
}

.pk-daten-karte {
    display: grid;
    grid-template-columns: 2.5rem minmax(0, 1fr) auto;
    gap: 0.25rem 0.9rem;
    align-items: center;
    padding: 0.75rem 0.9rem;
    border: 2px solid #1a7f4b;
    border-radius: calc(0.5rem * var(--pk-ecken, 1));
    background: #f1f8f4;
}

.pk-daten-haken {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: #1a7f4b;
    color: #ffffff;
    font-weight: 700;
}

.pk-daten-karte strong,
.pk-daten-spalten {
    display: block;
    overflow-wrap: anywhere;
}

.pk-daten-spalten {
    font-size: 0.875rem;
    color: #4a545b;
}

.pk-daten-aktionen {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-end;
}

.pk-daten-aktionen .btn,
.pk-daten-frage .btn {
    min-height: 2.5rem;
}

.pk-daten-frage {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: center;
    padding: 0.6rem 0.8rem;
    border-radius: calc(0.375rem * var(--pk-ecken, 1));
    background: #fff4e5;
    font-size: 0.9rem;
}

.pk-daten-info {
    display: grid;
    gap: 0.25rem;
}

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

.pk-daten-tabelle-huelle {
    overflow-x: auto;
    border: 1px solid #c4cbd1;
    border-radius: calc(0.375rem * var(--pk-ecken, 1));
}

.pk-daten-tabelle {
    margin: 0;
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
}

.pk-daten-aktuell td {
    background: var(--pk-primaer-hell, #eef3fb);
}

.pk-daten-mehr {
    margin: 0;
    font-size: 0.85rem;
    color: #4a545b;
}

.pk-daten-mehr:empty {
    display: none;
}

/* B: kurze Liste – eine Zeile je Angabe (Entscheidung 41); Einstellungen im Fenster */
.pk-angaben {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pk-angabe {
    display: grid;
    grid-template-columns: 2.5rem minmax(0, 1fr) auto;
    gap: 0.2rem 0.8rem;
    align-items: center;
    padding: 0.65rem 0.8rem;
    border: 1px solid #c4cbd1;
    border-radius: calc(0.5rem * var(--pk-ecken, 1));
    background: #ffffff;
}

.pk-angabe-gedruckt {
    border-color: var(--pk-primaer, #0042a0);
    box-shadow: inset 4px 0 0 var(--pk-primaer, #0042a0);
}

.pk-angabe-symbol {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: calc(0.4rem * var(--pk-ecken, 1));
    background: #f5f7f9;
    color: var(--pk-primaer, #0042a0);
    font-size: 0.8rem;
    font-weight: 700;
}

.pk-angabe-text {
    min-width: 0;
}

.pk-angabe-text strong,
.pk-angabe-text > span {
    display: block;
    overflow-wrap: anywhere;
}

.pk-angabe-text > span {
    font-size: 0.875rem;
    color: #4a545b;
}

.pk-angabe-text .pk-angabe-hinweis {
    display: inline-block;
    margin-top: 0.2rem;
    padding: 0.05rem 0.45rem;
    border-radius: calc(0.25rem * var(--pk-ecken, 1));
    font-size: 0.8rem;
    font-weight: 600;
}

.pk-angabe-text .pk-angabe-ok { background: #eaf5ef; color: #1a7f4b; }
.pk-angabe-text .pk-angabe-warn { background: #fff4e5; color: #6b3a00; }
.pk-angabe-text .pk-angabe-fehler { background: #fdecea; color: #b3261e; }

.pk-angabe-aktionen {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-end;
}

.pk-angabe-aktionen .btn {
    min-height: 2.5rem;
}

.pk-angabe-neu {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.pk-angabe-neu-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.9rem;
    color: #4a545b;
}

.pk-angabe-neu .form-select {
    width: auto;
}

.pk-angabe-neu .btn {
    min-height: 2.5rem;
}

.pk-st-farbe {
    width: 3rem;
    height: 2.5rem;
    padding: 0.125rem;
    border: 1px solid #6b747b;
    border-radius: calc(0.25rem * var(--pk-ecken, 1));
    background: #ffffff;
    cursor: pointer;
}

/* ---------- Fenster "… auf der Karte": feste Groesse, kein Scrollen, Restflaeche weiss ---------- */
/* Offenes Fenster: die Seite dahinter scrollt nicht mit (Entscheidung 42) */
html:has(.pk-angabe-dialog[open]) {
    overflow: hidden;
}

.pk-angabe-dialog {
    overscroll-behavior: contain;
    width: min(68rem, calc(100vw - 2rem));
    height: min(40rem, calc(100dvh - 2rem));
    max-width: none;
    max-height: calc(100dvh - 2rem);
    padding: 0;
    border: 0;
    border-radius: calc(0.75rem * var(--pk-ecken, 1));
    background: #ffffff;
    color: #2b3136;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.pk-angabe-dialog::backdrop {
    background: rgba(20, 25, 30, 0.55);
}

.pk-ad-rahmen {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: 100%;
}

.pk-ad-kopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 1.1rem;
    border-bottom: 1px solid #c4cbd1;
}

.pk-ad-titel {
    margin: 0;
    font-size: 1.15rem;
}

.pk-ad-inhalt {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
    align-content: start;
    padding: 1.1rem;
    overflow: hidden;
}

.pk-ad-vorschau {
    display: grid;
    gap: 0.6rem;
}

.pk-ad-karte {
    position: relative;
}

.pk-ad-kopie .pk-karte {
    box-shadow: 0 0 0 1px #8c959c, 0 4px 14px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

.pk-ad-ebene {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    touch-action: none;
}

.pk-ad-ebene .pk-ad-feld {
    cursor: move;
}

.pk-ad-ebene .pk-ad-griff {
    cursor: nwse-resize;
}

.pk-ad-ebene .pk-ad-kante {
    cursor: ew-resize;
}

.pk-ad-ebene .pk-ad-unten {
    cursor: ns-resize;
}

.pk-ad-ebene .pk-ad-dreh {
    cursor: grab;
}

.pk-ad-blaettern {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.6rem;
    align-items: center;
    font-size: 0.9rem;
}

.pk-ad-blaettern label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    white-space: nowrap;
}

.pk-ad-blaettern .form-control {
    width: 4rem;
    background-color: #ffffff;
}

.pk-ad-blaettern .btn {
    min-width: 2.5rem;
    min-height: 2.5rem;
}

.pk-ad-wert {
    flex-basis: 100%;
    min-width: 0;
    color: #4a545b;
    overflow-wrap: anywhere;
}

.pk-ad-reiter {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid #c4cbd1;
}

.pk-ad-reiter button {
    min-height: 2.75rem;
    margin-bottom: -1px;
    padding: 0.4rem 0.9rem;
    border: 0;
    border-bottom: 3px solid transparent;
    background: none;
    color: #4a545b;
    font-weight: 600;
    cursor: pointer;
}

.pk-ad-reiter button[aria-selected="true"] {
    border-bottom-color: var(--pk-primaer, #0042a0);
    color: var(--pk-primaer, #0042a0);
}

.pk-ad-reiter button:hover {
    color: var(--pk-primaer, #0042a0);
}

.pk-ad-panel {
    display: grid;
    gap: 0.9rem;
    align-content: start;
    padding-top: 0.9rem;
}

.pk-ad-gruppe {
    display: grid;
    gap: 0.45rem;
}

.pk-ad-titel-klein {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #4a545b;
}

.pk-ad-titel-klein small {
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
}

.pk-ad-zeile2 {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem 1.5rem;
}

.pk-ad-regler {
    display: grid;
    grid-template-columns: 8rem minmax(0, 1fr) 4.5rem;
    gap: 0.6rem;
    align-items: center;
    font-size: 0.9rem;
}

.pk-ad-regler label {
    margin: 0;
}

/* Drehung: Beschriftung | 90° links | 90° rechts | Regler | Wert */
.pk-ad-drehzeile {
    display: grid;
    grid-template-columns: 8rem auto auto minmax(0, 1fr) 4.5rem;
    gap: 0.6rem;
    align-items: center;
    font-size: 0.9rem;
}

.pk-ad-drehzeile label {
    margin: 0;
}

.pk-ad-drehzeile output {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.pk-ad-regler output {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.pk-ad-felder {
    display: grid;
    gap: 0.6rem 0.9rem;
}

.pk-ad-felder label {
    display: grid;
    gap: 0.2rem;
    margin: 0;
    font-size: 0.85rem;
    color: #4a545b;
}

.pk-ad-felder .form-control,
.pk-ad-felder .form-select {
    min-width: 0;
    background-color: #ffffff;
}

.pk-ad-felder-schrift {
    grid-template-columns: minmax(0, 1fr) auto;
}

.pk-ad-felder-zwei {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.pk-ad-farbe {
    display: grid;
    gap: 0.2rem;
    margin: 0;
    font-size: 0.85rem;
    color: #4a545b;
}

.pk-ad-trenner {
    width: 0.5rem;
}

.pk-ad-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.5rem;
    margin: 0;
}

.pk-ad-check .form-check-input {
    margin: 0;
}

.pk-ad-status {
    padding: 0.5rem 0.7rem;
    border-radius: calc(0.375rem * var(--pk-ecken, 1));
    font-size: 0.9rem;
}

.pk-ad-status:empty {
    display: none;
}

.pk-ad-ok { background: #eaf5ef; color: #1a7f4b; }
.pk-ad-warn { background: #fff4e5; color: #6b3a00; }
.pk-ad-fehler { background: #fdecea; color: #b3261e; }

.pk-ad-status .btn-link {
    padding: 0 0.15rem;
    color: inherit;
    font-size: inherit;
    font-weight: 700;
    vertical-align: baseline;
}

.pk-ad-wirkung {
    margin: 0;
    font-size: 0.9rem;
}

.pk-ad-wirkung .btn-link {
    padding: 0 0.15rem;
    font-size: inherit;
    vertical-align: baseline;
}

.pk-ad-leise {
    color: #4a545b;
}

.pk-ad-fuss {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.1rem;
    border-top: 1px solid #c4cbd1;
    border-radius: 0 0 calc(0.75rem * var(--pk-ecken, 1)) calc(0.75rem * var(--pk-ecken, 1));
    background: #f5f7f9;
}

.pk-ad-fuss .btn {
    min-height: 2.5rem;
}

/* Handy: Fenster bildschirmfuellend, Vorschau oben, "Inhalt & Lage" auf zwei Reiter verteilt (Skript) */
@media (max-width: 760px) {
    .pk-angabe {
        grid-template-columns: 2.5rem minmax(0, 1fr);
    }

    .pk-angabe-aktionen {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .pk-angabe-dialog {
        width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        margin: 0;
        border-radius: 0;
    }

    .pk-ad-kopf {
        padding: 0.45rem 1rem;
    }

    .pk-ad-titel {
        font-size: 1rem;
    }

    .pk-ad-inhalt {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.9rem;
        padding: 0 1rem 1rem;
    }

    .pk-ad-vorschau {
        gap: 0.4rem;
        padding-top: 0.6rem;
        border-bottom: 1px solid #c4cbd1;
        box-shadow: 0 6px 8px -6px rgba(0, 0, 0, 0.18);
    }

    .pk-ad-karte {
        width: 100%;
        max-width: 14rem;
        margin-inline: auto;
    }

    .pk-ad-blaettern {
        flex-wrap: nowrap;
        gap: 0.35rem;
        padding-bottom: 0.4rem;
    }

    .pk-ad-blaettern .form-control {
        width: 3.25rem;
    }

    .pk-ad-wert,
    .pk-ad-lang-text {
        display: none;
    }

    .pk-ad-regler {
        grid-template-columns: 6.5rem minmax(0, 1fr) 3.75rem;
        gap: 0.4rem;
    }

    .pk-ad-drehzeile {
        grid-template-columns: 6.5rem auto auto minmax(0, 1fr) 3.75rem;
        gap: 0.4rem;
    }

    .pk-ad-reiter button {
        padding: 0.4rem 0.6rem;
        font-size: 0.9rem;
    }

    .pk-ad-panel {
        gap: 0.7rem;
        padding-top: 0.7rem;
    }

    .pk-ad-zeile2 {
        gap: 0.7rem 1rem;
    }

    .pk-ad-fuss {
        padding-top: 0.5rem;
        border-radius: 0;
    }

    /* sehr kleine Handys: lieber innen scrollen als abschneiden */
    @media (max-height: 700px) {
        .pk-ad-inhalt {
            overflow-y: auto;
        }
    }
}

/* sehr schmale Handys: 5 Lage- und 2 Drehknoepfe in einer Zeile (Entscheidung 42) */
@media (max-width: 360px) {
    .pk-ad-steuer .pk-symbol-knopf {
        width: 2.2rem;
    }
}

@media (max-width: 360px) {
    .pk-ad-panel {
        gap: 0.5rem;
        padding-top: 0.55rem;
    }

    .pk-ad-reiter button {
        min-height: 2.5rem;
        padding: 0.3rem 0.5rem;
    }
}

/* Blaettern unter den Karten */
.pk-buehne {
    display: grid;
    gap: 0.5rem;
}

.pk-blaettern {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
    align-items: center;
    padding: 0.4rem 0.6rem;
    border-radius: calc(0.5rem * var(--pk-ecken, 1));
    background: #f5f7f9;
    font-size: 0.9rem;
}

.pk-blaettern-nr {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    font-weight: 600;
}

.pk-blaettern .form-control {
    width: 5rem;
    background-color: #ffffff;
    font-variant-numeric: tabular-nums;
}

.pk-blaettern .btn {
    min-width: 2.75rem;
    min-height: 2.5rem;
}

.pk-blaettern-werte {
    min-width: 0;
    color: #4a545b;
    overflow-wrap: anywhere;
}

/* Handy, Schritt 4 mit Daten: Blaettern kompakt */
@media (max-width: 767px) {
    .pk-werkzeug[data-aktiver-schritt="4"] .pk-buehne-perso .pk-blaettern {
        padding: 0.2rem 0.4rem;
        font-size: 0.8rem;
    }

    .pk-werkzeug[data-aktiver-schritt="4"] .pk-buehne-perso .pk-blaettern-werte {
        display: none;
    }

    /* Blaettern in einer Zeile */
    .pk-werkzeug[data-aktiver-schritt="4"] .pk-buehne-perso .pk-blaettern {
        flex-wrap: nowrap;
        gap: 0.35rem;
    }

    .pk-werkzeug[data-aktiver-schritt="4"] .pk-buehne-perso .pk-blaettern .form-control {
        width: 3.75rem;
        padding-inline: 0.35rem;
    }

    .pk-werkzeug[data-aktiver-schritt="4"] .pk-buehne-perso .pk-blaettern .btn {
        min-width: 2.5rem;
    }

    .pk-daten-karte {
        grid-template-columns: 2.5rem minmax(0, 1fr);
    }

    .pk-daten-aktionen {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

}

/* Ziehen mit dem Finger in Schritt 4: auf der Karte kein Scrollen */
.pk-werkzeug[data-aktiver-schritt="4"] .pk-perso,
.pk-werkzeug[data-aktiver-schritt="4"] .pk-perso-griffe {
    touch-action: none;
}

.pk-karten-navi {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.875rem;
}

.pk-karten-navi label {
    display: inline-flex;
    gap: 0.375rem;
    align-items: center;
    margin: 0;
}

.pk-karten-navi .form-control {
    width: 5.5rem;
}

.pk-karten-navi[hidden] {
    display: none;
}

.pk-karten-navi .btn {
    min-width: 2.75rem;
    min-height: 2.25rem;
}

/* ---------- Freigabe: Pruefung aller Karten ---------- */
.pk-pruefung {
    padding: 0.75rem 1rem;
    border-radius: calc(0.375rem * var(--pk-ecken, 1));
    background: #f5f7f9;
    font-size: 0.875rem;
}

.pk-pruefung-fehler {
    background: #fdeaea;
}

.pk-pruefung-titel {
    margin: 0 0 0.25rem;
    font-weight: 600;
}

.pk-pruefung-liste {
    margin: 0;
    padding-left: 1.25rem;
    max-height: 9rem;
    overflow-y: auto;
}

.pk-pruefung-eintrag-fehler {
    color: #b3261e;
}

/* Ja/Nein der Personalisierung: auf schmalen Bildschirmen untereinander (nebeneinander waeren sie zu schmal) */
.pk-perso-wahl .pk-druck-wahl {
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

/* Im Schritt-Bereich keine Box in der Box: Je-Seite-Bloecke ohne eigenen Rahmen */
.pk-schritt-panel .pk-steuerung {
    padding: 0;
    border: 0;
    border-radius: 0;
}

/* Handy: Schrittleiste kompakt in einer Zeile */
@media (max-width: 767px) {
    .pk-schritt-knopf {
        min-height: 2.5rem;
        padding: 0.125rem 0.5rem 0.125rem 0.25rem;
    }

    .pk-schritt-name small {
        display: none;
    }
}

/* Sehr schmal (320 px): in der Leiste nur Nummern – der Schrittname steht als Ueberschrift im Schritt-Bereich */
@media (max-width: 400px) {
    .pk-schritt-knopf .pk-schritt-name {
        display: none;
    }

    .pk-schritt-knopf {
        padding-right: 0.25rem;
    }
}

/* ---------- Verschieben nur im eigenen Schritt (Entscheidung 33) ----------
   Motiv in Schritt 2, Schreibfelder in 3, Personalisierung in 4. Gesperrte Teile: keine Ereignisse, kein
   Verschiebe-Zeiger, keine Griffe; der Inhalt bleibt sichtbar. ("alle" = Test-Hilfsskript) */
.pk-werkzeug:not([data-aktiver-schritt="2"]):not([data-aktiver-schritt="alle"]) .pk-motiv-rahmen {
    pointer-events: none;
    cursor: default;
}

.pk-werkzeug:not([data-aktiver-schritt="3"]):not([data-aktiver-schritt="alle"]) .pk-feld-form {
    pointer-events: none;
    cursor: default;
}

.pk-werkzeug:not([data-aktiver-schritt="3"]):not([data-aktiver-schritt="alle"]) .pk-griffe,
.pk-werkzeug:not([data-aktiver-schritt="4"]):not([data-aktiver-schritt="alle"]) .pk-perso-griffe {
    display: none;
}

.pk-werkzeug:not([data-aktiver-schritt="4"]):not([data-aktiver-schritt="alle"]) .pk-el-rahmen {
    pointer-events: none;
    stroke: none;
}

/* Noch nicht erreichte Schritte: in der Leiste gesperrt (vorwaerts nur ueber "Weiter") */
.pk-schritt-knopf:disabled {
    color: #8c959c;
    cursor: not-allowed;
}

.pk-schritt-knopf:disabled:hover {
    background: none;
}

.pk-schritt-knopf:disabled .pk-schritt-nr {
    background: #f5f7f9;
    color: #8c959c;
}

/* ---------- Lochung (Entscheidung 34) ---------- */
.pk-loch-ebene {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ---------- Schritt 3: Veredelungs-Zeilen (Entscheidung 35) ---------- */
.pk-schritt-titel small {
    font-weight: 400;
    font-size: 0.875rem;
    color: #4a545b;
}

.pk-ver-liste {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pk-ver {
    border: 1px solid #c4cbd1;
    border-radius: calc(0.5rem * var(--pk-ecken, 1));
    background: #ffffff;
}

.pk-ver-gewaehlt {
    border-color: var(--pk-primaer, #0042a0);
    box-shadow: inset 4px 0 0 var(--pk-primaer, #0042a0);
}

.pk-ver-kopf {
    display: grid;
    grid-template-columns: 2.5rem minmax(0, 1fr) auto auto;
    gap: 0.25rem 0.9rem;
    align-items: center;
    padding: 0.7rem 0.9rem;
}

.pk-ver-symbol {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: calc(0.4rem * var(--pk-ecken, 1));
    background: #f5f7f9;
}

.pk-ver-symbol svg {
    width: 1.6rem;
    height: 1.6rem;
}

.pk-ver-text strong,
.pk-ver-text span {
    display: block;
}

.pk-ver-text [hidden] {
    display: none;
}

.pk-ver-info {
    font-size: 0.875rem;
    color: #4a545b;
}

.pk-ver-kurz {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--pk-primaer, #0042a0);
}

.pk-ver-preis {
    font-size: 0.875rem;
    color: #4a545b;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.pk-ver-auf[hidden] {
    display: none;
}

.pk-ver-inhalt {
    display: grid;
    gap: 0.75rem;
    padding: 0 0.9rem 0.9rem calc(2.5rem + 1.8rem);
}

.pk-ver-inhalt[hidden],
.pk-ver-gruppe[hidden],
.pk-ver-hilfe[hidden],
.pk-ver-aktionen [hidden] {
    display: none;
}

.pk-ver-gruppe {
    display: grid;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    border: 0;
}

.pk-ver-gruppe legend {
    float: left;
    width: 100%;
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #4a545b;
}

.pk-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

/* Auswahl als grosse Flaechen (Zielgroesse 40 px), eckig wie die Shop-Knoepfe (Entscheidung 41).
   Gewaehlt ohne Massaenderung: Rand per inset-Schatten verstaerkt, Schrift bleibt gleich. */
.pk-chip {
    position: relative;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    height: 2.5rem;
    margin: 0;
    padding: 0 0.85rem;
    border: 1px solid #6b747b; /* >= 3:1 gegen Weiss und die hellen Flaechen (WCAG 1.4.11) */
    border-radius: calc(0.25rem * var(--pk-ecken, 1));
    background: #ffffff;
    color: #2b3136;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
}

.pk-chip:hover {
    border-color: var(--pk-primaer, #0042a0);
}

.pk-chip:has(input:checked),
.pk-chip[aria-pressed="true"] {
    border-color: var(--pk-primaer, #0042a0);
    box-shadow: inset 0 0 0 1px var(--pk-primaer, #0042a0);
    background: var(--pk-primaer-hell, #eef3fb);
    color: var(--pk-primaer, #0042a0);
}

.pk-chip:has(input:focus-visible) {
    outline: 3px solid var(--pk-primaer, #0042a0);
    outline-offset: 2px;
}

.pk-chip:has(input:disabled),
.pk-chip:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Auswahl zeigt die Farbe; das Steuerelement bleibt bedienbar (Tastatur, Vorleser), aber unsichtbar */
.pk-chip input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
}

.pk-symbol-knopf {
    width: 2.5rem;
    padding: 0;
    font-size: 1.05rem;
}

.pk-chip small {
    font-weight: 400;
    color: #4a545b;
}

.pk-ver-felder {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 0.75rem;
}

.pk-ver-felder .pk-steuerung {
    padding: 0.6rem 0.75rem;
    border: 0;
    border-radius: calc(0.4rem * var(--pk-ecken, 1));
    background: #f5f7f9;
}

.pk-ver-felder .pk-steuerung-titel {
    font-size: 0.95rem;
}

/* Arbeitsflaeche (Entscheidung 58): die Feldliste gibt es nur fuer die gezeigte Kartenseite; die andere Seite steht
   zusammengeklappt darunter (Titel, Anzahl, "+ Feld" – das zeigt die Seite und legt das Feld dort an) */
.pk-steuerung-anzahl {
    display: none;
    margin-right: auto; /* neben dem Titel, "+ Feld" bleibt rechts */
    color: #4a545b;
    font-size: 0.875rem;
}

.pk-werkzeug:not([data-aktive-seite="hinten"]) .pk-ver-felder .pk-steuerung[data-seite="hinten"],
.pk-werkzeug[data-aktive-seite="hinten"] .pk-ver-felder .pk-steuerung[data-seite="vorne"] {
    order: 1;
    border: 1px solid var(--pk2-rahmen, #c4cbd1);
    background: transparent;
}

.pk-werkzeug:not([data-aktive-seite="hinten"]) .pk-ver-felder .pk-steuerung[data-seite="hinten"] :is(.pk-feldliste, .pk-zeichnen, .pk-feld-hinweis),
.pk-werkzeug[data-aktive-seite="hinten"] .pk-ver-felder .pk-steuerung[data-seite="vorne"] :is(.pk-feldliste, .pk-zeichnen, .pk-feld-hinweis) {
    display: none;
}

.pk-werkzeug:not([data-aktive-seite="hinten"]) .pk-ver-felder .pk-steuerung[data-seite="hinten"] .pk-steuerung-anzahl,
.pk-werkzeug[data-aktive-seite="hinten"] .pk-ver-felder .pk-steuerung[data-seite="vorne"] .pk-steuerung-anzahl {
    display: inline;
}

.pk-ver-hilfe {
    margin: 0;
    font-size: 0.875rem;
    color: #4a545b;
}

.pk-ver-aktionen {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    align-items: center;
    padding-top: 0.25rem;
}

.pk-ver-aktionen .btn-link {
    padding-left: 0;
    padding-right: 0;
}

/* schmal: am Handy und im Panel der Arbeitsflaeche (dort hoechstens 24rem breit, Entscheidung 58) */
.pk-panel .pk-ver-kopf {
    grid-template-columns: 2.5rem minmax(0, 1fr) auto;
}

.pk-panel .pk-ver-kopf .pk-ver-preis {
    grid-column: 2;
    grid-row: 2;
}

.pk-panel .pk-ver-kopf .pk-ver-auf {
    grid-column: 3;
    grid-row: 1 / span 2;
}

.pk-panel .pk-ver-inhalt {
    padding-left: 0.9rem;
}

/* ---------- Freie Form zeichnen (Entscheidung 36) ---------- */
.pk-zeichnen-linie {
    fill: rgba(0, 66, 160, 0.12);
}

polyline.pk-zeichnen-linie {
    fill: none;
}

.pk-zeichnen-gummi {
    stroke: var(--pk-primaer, #0042a0);
    stroke-width: 1.5px;
    stroke-dasharray: 4 3;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

/* Ab 3 Punkten: Startpunkt als "hier schliessen" erkennbar */
.pk-griff-schliessen {
    cursor: pointer;
}

.pk-griff-schliessen::after {
    width: 18px;
    height: 18px;
    border-width: 3px;
    box-shadow: 0 0 0 3px rgba(0, 66, 160, 0.25);
}

.pk-feld-hinweis {
    margin: 0;
    padding: 0.5rem;
    border-radius: calc(0.375rem * var(--pk-ecken, 1));
    background: #fdecea;
    color: #8a1c12;
    font-size: 0.875rem;
}

/* ---------- Zubehoer in Schritt 5 (Entscheidung 38) ---------- */
.pk-zubehoer {
    margin-top: 1.5rem;
}

.pk-zubehoer-titel {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.pk-zubehoer-optional {
    font-weight: 400;
    color: #4a5560;
}

.pk-zubehoer-liste {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.pk-zub {
    display: grid;
    grid-template-columns: 56px 1fr auto auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d5dbe1;
    border-radius: calc(0.5rem * var(--pk-ecken, 1));
    background: #ffffff;
}

.pk-zub-passend {
    border-color: var(--pk-primaer, #0042a0);
    background: var(--pk-primaer-hell, #f2f6fc);
}

.pk-zub-bild {
    width: 56px;
    height: 56px;
    border-radius: calc(0.375rem * var(--pk-ecken, 1));
    background: #eef1f4;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pk-zub-bild img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pk-zub-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pk-zub-name {
    font-weight: 600;
}

.pk-zub-beschr {
    font-size: 0.8125rem;
    color: #4a5560;
}

.pk-zub-passt {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--pk-primaer, #0042a0);
}

.pk-zub-preis {
    white-space: nowrap;
    font-size: 0.875rem;
}

.pk-zub-wahl {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
}

.pk-zub-anzahl {
    width: 5.5rem;
    min-height: 40px;
}

.pk-zub-alle {
    min-height: 40px;
}

.pk-preis-endsumme {
    font-weight: 700;
    font-size: 1.125rem;
    border-top: 1px solid #c4cbd1;
    padding-top: 0.25rem;
}

/* Handy: Bild + Text oben, Preis und Menge darunter */
@media (max-width: 575.98px) {
    .pk-zub {
        grid-template-columns: 48px 1fr;
    }

    .pk-zub-bild {
        width: 48px;
        height: 48px;
    }

    .pk-zub-preis,
    .pk-zub-wahl {
        grid-column: 2;
        justify-content: flex-start;
    }
}

/* Im schmalen Panel der Arbeitsflaeche (Entscheidung 58) immer so: Bild + Text, Preis und Menge darunter */
.pk-panel .pk-zub {
    grid-template-columns: 48px minmax(0, 1fr);
}

.pk-panel .pk-zub-bild {
    width: 48px;
    height: 48px;
}

.pk-panel .pk-zub-preis,
.pk-panel .pk-zub-wahl {
    grid-column: 2;
    justify-content: flex-start;
}

/* Entscheidung 40: Shopwares Knopf "Nach oben" verdeckt auf Seiten mit dem Karten-Werkzeug Bedienelemente
   (u. a. "Weiter"); die Schrittleiste bleibt ohnehin sichtbar. Diese Datei laedt nur auf Werkzeug-Seiten.
   Bewusst hier und nicht im Theme-SCSS: scssphp warnt bei :has() mit Attribut-Selektor. */
body:has([data-pk-werkzeug]) .scroll-up-container {
    display: none;
}

/* Gedrueckte Umriss-Knoepfe im Werkzeug: Shopwares Zustand hat nur ~3:1 (Text auf Grau) – dunklere Flaeche, >= 4,5:1.
   Spezifitaet wie Shopwares Regel (:not(:disabled):not(.disabled):active) plus Werkzeug-Wurzel. */
.pk-werkzeug .btn-outline-secondary:not(:disabled):not(.disabled):active,
.pk-werkzeug .btn-outline-secondary:not(:disabled):not(.disabled).active {
    border-color: #4a545b;
    background-color: #4a545b;
    color: #ffffff;
}

.pk-werkzeug .btn-outline-danger:not(:disabled):not(.disabled):active,
.pk-werkzeug .btn-outline-danger:not(:disabled):not(.disabled).active {
    border-color: #8a1c12;
    background-color: #8a1c12;
    color: #ffffff;
}

/* Knoepfe im Werkzeug ohne Farbuebergang: jeder Zustand (Hover, Fokus, gedrueckt) steht sofort,
   nie ein halbtransparenter Zwischenstand mit schwachem Kontrast */
.pk-werkzeug .btn {
    transition: none;
}

/* "Entfernen" beim Ueberfahren: Shopwares Rot hat mit Weiss nur 4,45:1 */
.pk-werkzeug .btn-outline-danger:not(:disabled):not(.disabled):hover {
    border-color: #b3261e;
    background-color: #b3261e;
    color: #ffffff;
}

/* Fenster "… auf der Karte": sichtbarer Fokus fuer alle Bedienelemente (Reiter, Symbol-Knoepfe, Regler) */
.pk-angabe-dialog :focus-visible {
    outline: 3px solid var(--pk-primaer, #0042a0);
    outline-offset: 2px;
}

/* ---------- Druckverfahren (Entscheidung 44): Chip in der Schrittleiste, Offset-Schnittraender auf der Buehne ---------- */
.pk-verfahren {
    position: relative;
    margin-left: auto;
}

.pk-verfahren-knopf {
    min-height: 2.5rem;
    padding: 0.25rem 0.75rem;
    border: 0;
    border-radius: calc(999px * var(--pk-ecken, 1));
    background: var(--pk-primaer-hell, #eef3fb);
    color: #2b3136;
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
}

.pk-verfahren-knopf:hover {
    background: var(--pk-primaer-hell, #dde8f7);
}

.pk-verfahren-aendern {
    color: var(--pk-primaer, #0042a0);
    text-decoration: underline;
}

.pk-werkzeug[data-verfahren="offset"] .pk-verfahren-knopf {
    background: #fbf0dc;
}

.pk-werkzeug[data-verfahren="offset"] .pk-verfahren-knopf:hover {
    background: #f5e2bf;
}

/* Beschnitt: Band um die Karte in Beschnittbreite (JS setzt --pk-beschnitt-px je Kartengroesse) */
.pk-werkzeug[data-verfahren="offset"] .pk-karte {
    box-shadow: 0 0 0 1px #8c959c, 0 0 0 var(--pk-beschnitt-px, 0px) rgba(196, 43, 28, 0.22), 0 2px 8px rgba(0, 0, 0, 0.12);
}

.pk-schnitt {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

.pk-schnitt rect {
    fill: none;
    stroke-width: 0.3; /* mm (viewBox in mm) */
}

.pk-schnitt .pk-schnitt-grund {
    stroke: rgba(255, 255, 255, 0.85);
    stroke-width: 0.6;
}

.pk-schnitt .pk-schnitt-linie {
    stroke: #c42b1c;
    stroke-dasharray: 1.2 0.8;
}

.pk-schnitt-legende {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: #4a545b;
}

.pk-schnitt-legende p {
    margin: 0;
}

.pk-schnitt-muster {
    display: inline-block;
    width: 1.5rem;
    height: 0.625rem;
    margin-right: 0.375rem;
    vertical-align: middle;
}

.pk-schnitt-muster-beschnitt {
    background: rgba(196, 43, 28, 0.22);
}

.pk-schnitt-muster-sicher {
    margin-left: 0.75rem;
    border-top: 2px dashed #c42b1c;
    height: 0;
}

.pk-schnitt-hinweise {
    margin: 0.375rem 0 0;
    padding-left: 1.25rem;
    color: #8a4b00;
}

.pk-schnitt-hinweise:empty {
    display: none;
}

@media (max-width: 767px) {
    .pk-verfahren-knopf {
        min-height: 2.25rem;
        font-size: 0.8125rem;
    }
}

/* Zweiter Weg ohne Vorlage (Entscheidung 44, Nachtrag): nur mit Plugin-Einstellung designerAnzeigen gerendert */

/* Im Panel der Arbeitsflaeche (hoechstens 24rem, Entscheidung 58) wie am Handy: Knoepfe unter dem Text – sonst nahm die
   Knopfspalte den ganzen Platz und die Zusammenfassung war 0 px breit (Kalt-Review E3) */
.pk-panel .pk-daten-karte,
.pk-panel .pk-angabe {
    grid-template-columns: 2.5rem minmax(0, 1fr);
}

.pk-panel .pk-daten-aktionen,
.pk-panel .pk-angabe-aktionen {
    grid-column: 1 / -1;
    justify-content: flex-start;
}

/* Usability-Test 18.11.2026: am Handy ragte "In den Warenkorb" unter das Fenster – Hoehe nach dem sichtbaren Fenster
   (dvh), Knopfzeile klebt unten im scrollenden Fenster */
.pk-freigabe-dialog {
    max-height: 90dvh;
}
.pk-freigabe-dialog .pk-dialog-fuss {
    position: sticky;
    bottom: 0;
    z-index: 1;
    background: #ffffff;
    margin: 0 -1.25rem -1.25rem;
    padding: 0.75rem 1.25rem 1.25rem;
    border-top: 1px solid #e3e7ec;
}
.pk-freigabe-hinweise ul { margin: 0.25rem 0 0; padding-left: 1.25rem; }
.pk-freigabe-hinweise p { margin: 0; font-weight: 600; }

/* --- Lieferung / Express sichtbar (Eigentuemer 18.11.2026) --- */
/* Leiste links: in jedem Schritt, unter dem Druckverfahren */
.pk-lieferung {
    display: grid;
    gap: 0.25rem;
    margin-top: 0.5rem;
}
.pk-lieferung[hidden] { display: none; }
.pk-lieferung-titel {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #4a545b;
}
.pk-lieferung-wahl {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.pk-lieferung-knopf {
    min-height: 2.25rem;
    padding: 0.25rem 0.625rem;
    border: 1px solid #7a8594; /* Kante mind. 3:1 (WCAG 1.4.11) */
    border-radius: calc(999px * var(--pk-ecken, 1));
    background: #ffffff;
    color: #2b3136;
    font-weight: 600;
    font-size: 0.8125rem;
    white-space: nowrap;
    cursor: pointer;
}
.pk-lieferung-knopf:hover:not(:disabled) { border-color: var(--pk-primaer, #0042a0); }
.pk-lieferung-knopf:focus-visible { outline: 3px solid var(--pk-primaer, #0042a0); outline-offset: 2px; }
.pk-lieferung-knopf[aria-pressed="true"] {
    background: var(--pk-primaer, #0042a0);
    border-color: var(--pk-primaer, #0042a0);
    color: #ffffff;
}
.pk-lieferung-knopf:disabled { opacity: 0.55; cursor: not-allowed; }
.pk-lieferung-zeit, .pk-lieferung-preis { font-weight: 400; }

/* Schritt 4: zwei Kacheln Standard / Express direkt unter der Menge */
.pk-express-wahl {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
    gap: 0.5rem;
    margin: 0.75rem 0 0;
    padding: 0;
    border: 0;
    min-width: 0;
}
.pk-express-wahl[hidden] { display: none; }
.pk-express-titel {
    grid-column: 1 / -1;
    float: none;
    width: auto;
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
}
.pk-lieferkachel {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.125rem 0.5rem;
    align-items: start;
    align-content: start;
    padding: 0.75rem;
    border: 1px solid #7a8594; /* Kante mind. 3:1 */
    border-radius: calc(0.875rem * var(--pk-ecken, 1));
    background: #ffffff;
    cursor: pointer;
}
.pk-lieferkachel input { grid-row: span 3; margin-top: 0.2rem; accent-color: var(--pk-primaer, #0042a0); }
.pk-lieferkachel:hover { border-color: var(--pk-primaer, #0042a0); }
.pk-lieferkachel:has(input:focus-visible) { outline: 3px solid var(--pk-primaer, #0042a0); outline-offset: 2px; }
.pk-lieferkachel:has(input:checked) {
    border: 2px solid var(--pk-primaer, #0042a0);
    padding: calc(0.75rem - 1px);
    background: var(--pk-primaer-hell, #eef3fb);
}
.pk-lieferkachel:has(input:disabled) { opacity: 0.6; cursor: not-allowed; }
.pk-lieferkachel-titel { font-weight: 700; color: var(--pk-primaer-dunkel, #00367f); }
.pk-lieferkachel-zeit { font-size: 0.8125rem; color: #4a545b; }
.pk-lieferkachel-preis { font-weight: 600; font-size: 0.875rem; color: #2b3136; }

/* Staffelpreise: Express-Spalte nur bei angebotenem Express (Digitaldruck) */
.pk-staffel-tabelle:not(.pk-mit-express) .pk-staffel-express { display: none; }
/* Lieferwahl und Staffelpreise ueber die volle Breite des Abschlussbereichs; untereinander (Handy) in der Reihenfolge
   Menge -> Lieferung -> Staffel -> Preis */
.pk-abschluss > .pk-express-wahl,
.pk-abschluss > .pk-staffel { grid-column: 1 / -1; }
/* untereinander in der Reihenfolge Menge -> Lieferung -> Staffel -> Preis: am Handy und im Panel der Arbeitsflaeche
   (351 px breit; zweispaltig war der Preiskasten 183 px schmal und sein Text lief ueber den Rand – gemessen 18.11.,
   auch ohne Express) */
@media (max-width: 767px) {
    .pk-abschluss > .pk-menge { order: 0; }
    .pk-abschluss > .pk-express-wahl { order: 1; }
    .pk-abschluss > .pk-staffel { order: 2; }
    .pk-abschluss > .pk-preis { order: 3; }
}
.pk-panel .pk-abschluss { grid-template-columns: minmax(0, 1fr); }
.pk-panel .pk-abschluss > .pk-menge { order: 0; }
.pk-panel .pk-abschluss > .pk-express-wahl { order: 1; }
.pk-panel .pk-abschluss > .pk-staffel { order: 2; }
.pk-panel .pk-abschluss > .pk-preis { order: 3; max-width: none; }
/* Lieferwahl in der Leiste am Handy/Tablet: eine Zeile (Beschriftung + zwei Knoepfe); schmal ohne "2–5 Tage" (steht in
   Schritt 4), sehr schmal ohne sichtbare Beschriftung (bleibt fuer Vorleser) – Leistenhoehe 320 px ≤ 260 (reflow.mjs) */
@media (max-width: 991.98px) {
    .pk-leiste .pk-lieferung {
        flex-basis: 100%;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        margin-top: 0;
    }
    .pk-leiste .pk-lieferung[hidden] { display: none; }
    .pk-lieferung-wahl { flex-wrap: nowrap; }
}
@media (max-width: 420px) {
    .pk-lieferung-zeit { display: none; }
}
@media (max-width: 359.98px) {
    .pk-lieferung-titel {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}
