/* Global statt isoliert: dieselben Feldbausteine des Workflow-Designers stehen in der Leiste und in den großen Bearbeitungsfenstern –
   Syncfusion hängt Dialoge an <body>, dort greift die CSS-Isolation der Leiste nicht. Gilt unter .wfe-scope. */

.wfe-scope .wfe-field {
    margin-top: 0.75rem;
}

/* Abschnitte als abgesetzte Blöcke: Rahmen, Kopf auf color-surface-alt – die Leiste liest sich Block für Block */
.wfe-scope .wfe-section {
    margin-top: 0.9rem;
    padding: 0 0.7rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    background-color: var(--color-surface);
}

    .wfe-scope .wfe-section > .wfe-section-head + * {
        margin-top: 0.6rem;
    }

    .wfe-scope .wfe-section.preview {
        opacity: 0.65;
    }

    .wfe-scope .wfe-section .wfe-section {
        margin-top: 0.6rem;
    }

.wfe-scope .wfe-section-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 -0.7rem;
    padding: 0.35rem 0.7rem;
    border-bottom: 1px solid var(--color-border);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    background-color: var(--color-surface-alt);
}

.wfe-scope .wfe-section.preview .wfe-section-head {
    border-bottom: 0;
}

.wfe-scope .wfe-section-title {
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-bold);
}

/* Dasselbe Symbol wie auf dem Reiter der Leiste */
.wfe-scope .wfe-section-icon {
    width: 16px;
    text-align: center;
    color: var(--color-icon-primary);
}

/* „In Vorbereitung“: umrandet, nicht gefüllt */
.wfe-scope .wfe-badge {
    display: inline-block;
    padding: 0 0.4rem;
    border: 1px solid var(--color-primary-dark);
    border-radius: var(--border-radius);
    color: var(--color-primary-dark);
    font-size: var(--font-size-smaller);
    font-style: normal;
    line-height: 16px;
    white-space: nowrap;
}

.wfe-scope .wfe-hint {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.3rem;
    color: var(--color-text-muted);
    font-size: var(--font-size-smaller);
}

    .wfe-scope .wfe-hint i {
        margin-top: 0.15rem;
    }

    .wfe-scope .wfe-hint.danger {
        color: var(--danger-text);
    }

.wfe-scope .wfe-preview {
    color: var(--color-text-muted);
    font-size: var(--font-size-smaller);
    font-variant-numeric: tabular-nums;
}

.wfe-scope .wfe-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

    .wfe-scope .wfe-group > .wfe-field {
        margin-top: 0.2rem;
    }

.wfe-scope .wfe-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.wfe-scope .wfe-grow {
    flex: 1;
    min-width: 0;
}

.wfe-scope .wfe-number {
    flex: 0 0 64px;
    width: 64px;
    font-variant-numeric: tabular-nums;
}

    .wfe-scope .wfe-number.wide {
        flex-basis: 90px;
        width: 90px;
    }

.wfe-scope .wfe-radios {
    gap: 0.4rem 1rem;
}

    .wfe-scope .wfe-radios.vertical {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }

.wfe-scope .wfe-check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.25rem 0 0;
    font-size: var(--font-size-small);
    cursor: pointer;
}

    .wfe-scope .wfe-check.disabled {
        color: var(--color-text-muted);
        cursor: not-allowed;
    }

.wfe-scope .wfe-areas {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-height: 23px;
}

    .wfe-scope .wfe-areas .wfe-check {
        margin: 0;
    }

/* Zeitgesteuerter Start: Wochentage nebeneinander, Text zwischen Feldern einer Zeile */
.wfe-scope .wfe-weekdays {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.9rem;
}

    .wfe-scope .wfe-weekdays .wfe-check {
        margin: 0;
    }

.wfe-scope .wfe-row-text {
    flex: 0 0 auto;
    font-size: var(--font-size-small);
    color: var(--color-text);
    white-space: nowrap;
}

/* app.css nimmt Textbereichen in Formularen Rahmen und gibt ihnen 160px – in der Leiste ein normales Feld */
.wfe-scope textarea.wfe-textarea {
    width: 100%;
    min-height: 0;
    padding: 0.25rem 0.5rem;
    box-sizing: border-box;
    border: 1px solid var(--color-component-border) !important;
    border-radius: var(--border-radius);
    font-size: var(--font-size-small);
    resize: none;
}

    .wfe-scope textarea.wfe-textarea:focus {
        outline: 1px solid var(--color-primary) !important;
    }

.wfe-scope input.wfe-invalid {
    outline: 1px solid var(--color-danger);
}

/* Kleiner Symbolknopf neben Feldern (Datenpunkt einfügen, Umschalten, Entfernen) */
.wfe-scope .wfe-icon-button {
    flex: 0 0 23px;
    width: 23px;
    height: 23px;
    padding: 0;
    border: 1px solid var(--color-component-border);
    border-radius: var(--border-radius);
    background-color: var(--color-surface);
    color: var(--color-icon-primary);
    font-size: var(--font-size-smaller);
    cursor: pointer;
    transition: color 0.12s ease, border-color 0.12s ease;
}
.wfe-icon-button i {
    line-height: 23px;
}

    .wfe-scope .wfe-icon-button:hover,
    .wfe-scope .wfe-icon-button.active {
        border-color: var(--color-primary-dark);
        color: var(--color-primary-dark);
    }

.wfe-scope .wfe-link-button {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-primary-dark);
    font-size: var(--font-size-smaller);
    font-style: normal;
    cursor: pointer;
}

    .wfe-scope .wfe-link-button:hover {
        text-decoration: underline;
    }

/* Datenpunkt-Feld: sieht aus wie ein Eingabefeld und öffnet die Auswahl */
.wfe-scope .wfe-dp {
    display: flex;
    gap: 0.3rem;
    min-width: 0;
}

.wfe-scope .wfe-dp-value {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    height: 23px;
    padding: 0 0.5rem;
    border: 1px solid var(--color-component-border);
    border-radius: var(--border-radius);
    background-color: var(--color-surface);
    color: var(--color-text);
    font-size: var(--font-size-small);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.12s ease;
}

    .wfe-scope .wfe-dp-value > i {
        color: var(--color-icon-primary);
        font-size: var(--font-size-smaller);
    }

    .wfe-scope .wfe-dp-value:hover:not(:disabled) {
        border-color: var(--color-primary-dark);
    }

    .wfe-scope .wfe-dp-value:focus-visible {
        outline: 1px solid var(--color-primary-dark);
    }

    .wfe-scope .wfe-dp-value.empty .wfe-dp-text {
        color: var(--color-text-muted);
    }

    .wfe-scope .wfe-dp-value:disabled {
        background-color: var(--color-surface-alt);
        cursor: default;
    }

.wfe-scope .wfe-dp.invalid .wfe-dp-value {
    border-color: var(--color-danger);
}

.wfe-scope .wfe-dp-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wfe-scope .wfe-dp-warn {
    color: var(--color-danger) !important;
}

.wfe-scope .wfe-text,
.wfe-scope .wfe-vor {
    display: flex;
    align-items: flex-start;
    gap: 0.3rem;
    min-width: 0;
}

.wfe-scope .wfe-vor-input {
    flex: 1;
    min-width: 0;
}

/* Inline-Listen (Hotkeys über data-list / data-list-row / data-remove-item / data-new-item) */
.wfe-scope .wfe-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.wfe-scope .wfe-list-row {
    display: flex;
    align-items: flex-start;
    gap: 0.3rem;
    min-width: 0;
}

    .wfe-scope .wfe-list-row.wfe-card {
        padding: 0.4rem;
        border: 1px solid var(--color-border);
        border-radius: var(--border-radius);
        background-color: var(--color-surface);
    }

.wfe-scope .wfe-list-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

/* Überschrift einer Karte („Stufe 1“) */
.wfe-scope .wfe-card-title {
    font-size: var(--font-size-small);
    font-weight: 500;
}

.wfe-scope .wfe-list-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.3rem 0.5rem;
    border-radius: var(--border-radius);
    font-size: var(--font-size-small);
}

.wfe-scope .wfe-stale {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--color-text-muted);
    font-size: var(--font-size-smaller);
}

    .wfe-scope .wfe-stale > i {
        color: var(--color-warning);
    }

/* Mailtext schreibgeschützt: nur die Vorschau */
.wfe-scope .wfe-richtext.readonly {
    min-height: 60px;
    max-height: 240px;
    overflow: auto;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--color-component-border);
    border-radius: var(--border-radius);
    background-color: var(--color-surface-alt);
    font-size: var(--font-size-small);
}

/* Großer Knopf unter einem Block: öffnet das Bearbeitungsfenster */
.wfe-scope .wfe-wide-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    margin-top: 0.75rem;
}

/* Mail: was je Sprache hinterlegt ist */
.wfe-scope .wfe-mail-preview {
    margin-top: 0.6rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    background-color: var(--color-background);
    font-size: var(--font-size-smaller);
}

.wfe-scope .wfe-mail-preview-head {
    margin-bottom: 0.2rem;
    font-size: var(--font-size-small);
    font-weight: 500;
}

.wfe-scope .wfe-mail-preview-line {
    display: flex;
    gap: 0.5rem;
    min-width: 0;
    line-height: 1.5;
}

.wfe-scope .wfe-mail-preview-label {
    flex: 0 0 4.5rem;
    color: var(--color-text-muted);
}

.wfe-scope .wfe-mail-preview-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wfe-scope .wfe-mail-preview-line.empty .wfe-mail-preview-value {
    color: var(--color-text-muted);
}

.wfe-scope .wfe-mail-preview-line.missing .wfe-mail-preview-value {
    color: var(--danger-text);
}

.wfe-scope .wfe-mail-preview .wfe-richtext.readonly {
    margin-top: 0.3rem;
}

/* Hochgeladene Datei eines Anhangs */
.wfe-scope .wfe-file {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    font-size: var(--font-size-small);
}

    .wfe-scope .wfe-file > i {
        color: var(--color-icon-primary);
    }

.wfe-scope .wfe-file-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wfe-scope .wfe-file-size {
    color: var(--color-text-muted);
    font-size: var(--font-size-smaller);
    font-variant-numeric: tabular-nums;
}

.wfe-scope .wfe-upload {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    cursor: pointer;
}

.wfe-scope .wfe-time {
    flex: 0 0 110px;
    width: 110px;
}

/* Große Bearbeitungsfenster (Mail, Aufgabe, Nachricht) */
.wfe-scope.wfe-dialog-body {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.wfe-scope .wfe-dialog-columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

    .wfe-scope .wfe-dialog-columns.two {
        grid-template-columns: 1fr 1fr;
    }

.wfe-scope .wfe-dialog-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 0 0.75rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
}

.wfe-scope .wfe-dialog-column-head {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin: 0 -0.75rem;
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-surface-alt);
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-bold);
}

.wfe-scope .wfe-dialog-column-hint {
    color: var(--color-text-muted);
    font-size: var(--font-size-smaller);
    font-weight: 400;
}

/* WhatsApp-Vorlage im Fenster „Inhalt bearbeiten“: Hinweis und Vorschau als Sprechblase. */
.wfe-scope .wfe-whatsapp-hint {
    margin-top: 0.25rem;
    color: var(--color-text-muted);
    font-size: var(--font-size-smaller);
}

.wfe-scope .wfe-whatsapp-preview {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.wfe-scope .wfe-whatsapp-preview-label {
    color: var(--color-text-muted);
    font-size: var(--font-size-smaller);
}

.wfe-scope .wfe-whatsapp-bubble {
    align-self: flex-start;
    max-width: 90%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 0.6rem 0.6rem 0.6rem 0.15rem;
    background-color: var(--color-surface-alt);
    color: var(--color-text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.wfe-scope .wfe-dialog-rte .editor {
    height: auto;
    min-height: 38vh;
}

.wfe-dialog-body .wfe-richtext.readonly {
    max-height: none;
    min-height: 38vh;
}

.wfe-dialog-body textarea.wfe-textarea {
    min-height: 40vh;
}

/* Variablen, die eine Aufgabe mit Formular liefert */
.wfe-scope .wfe-vars {
    display: flex;
    flex-direction: column;
    padding: 0.3rem 0.55rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    background-color: var(--color-background);
    font-size: var(--font-size-small);
}

.wfe-scope .wfe-vars-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    min-width: 0;
    line-height: 1.6;
}

.wfe-scope .wfe-vars-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wfe-scope .wfe-vars-key {
    color: var(--color-text-muted);
    font-size: var(--font-size-smaller);
    white-space: nowrap;
}

/* „Wert setzen“ in der Leiste: was gesetzt wird, wie auf der Karte */
.wfe-scope .wfe-assignments {
    display: flex;
    flex-direction: column;
    padding: 0.1rem 0.55rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    background-color: var(--color-background);
}

.wfe-scope .wfe-assignment {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 0.3rem 0;
    line-height: 1.4;
}

    .wfe-scope .wfe-assignment + .wfe-assignment {
        border-top: 1px solid var(--color-border);
    }

.wfe-scope .wfe-assignment-name,
.wfe-scope .wfe-assignment-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wfe-scope .wfe-assignment-name {
    font-size: var(--font-size-small);
    font-weight: 500;
}

.wfe-scope .wfe-assignment-value {
    color: var(--color-text-muted);
    font-size: var(--font-size-smaller);
}

.wfe-scope .wfe-assignment-name.missing,
.wfe-scope .wfe-assignment-value.missing {
    color: var(--danger-text);
}

.wfe-scope .wfe-assignment.empty {
    color: var(--color-text-muted);
    font-size: var(--font-size-small);
}

/* Listenmodus (Hinzufügen/Entfernen/Ersetzen) neben dem Feld */
.wfe-scope .wfe-assign-mode {
    flex: 0 0 9rem;
    min-width: 0;
}

/* „Wert setzen“ im großen Fenster: feste Höhe, nur die Zeilen scrollen (Kopf bleibt stehen) */
.wfe-scope.wfe-assign-dialog {
    height: min(62vh, 640px);
}

.wfe-scope .wfe-dialog-toolbar {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.wfe-scope .wfe-assign-table {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
}

.wfe-scope .wfe-assign-head,
.wfe-scope .wfe-assign-row {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr) 25px;
    gap: 1rem;
    align-items: start;
    padding: 0.55rem 0.75rem;
}

.wfe-scope .wfe-assign-head {
    position: sticky;
    top: 0;
    z-index: 2;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--color-border);
    background-color: var(--color-surface-alt);
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-bold);
}

.wfe-scope .wfe-assign-row + .wfe-assign-row {
    border-top: 1px solid var(--color-border);
}

.wfe-scope .wfe-assign-cell {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

/* Eigene Felder einer Zeile so hoch wie die Syncfusion-Auswahl (23px Feld + Rahmen) */
.wfe-scope.wfe-assign-dialog .wfe-assign-line > input,
.wfe-scope.wfe-assign-dialog .wfe-vor-input > input,
.wfe-scope.wfe-assign-dialog input.wfe-number,
.wfe-scope.wfe-assign-dialog .wfe-dp-value {
    height: 25px;
}

.wfe-scope.wfe-assign-dialog .wfe-icon-button {
    flex-basis: 25px;
    width: 25px;
    height: 25px;
}

/* Umschalter, Datenfeld bzw. Schlüssel, Bezeichnung und Typ auf einer Linie mit dem Wert */
.wfe-scope .wfe-assign-line {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

    .wfe-scope .wfe-assign-line > input,
    .wfe-scope .wfe-assign-type {
        flex: 1 1 0;
        min-width: 0;
    }

.wfe-scope .wfe-assign-rows > .wfe-list-add {
    margin: 0.2rem 0.75rem 0.45rem;
}

/* Zwei Symbolknöpfe als ein Umschalter; der gewählte ist umrandet und hinterlegt */
.wfe-scope .wfe-toggle {
    display: inline-flex;
    flex: none;
}

    .wfe-scope .wfe-toggle > .wfe-icon-button {
        border-radius: 0;
    }

        .wfe-scope .wfe-toggle > .wfe-icon-button:first-child {
            border-radius: var(--border-radius) 0 0 var(--border-radius);
        }

        .wfe-scope .wfe-toggle > .wfe-icon-button:last-child {
            border-radius: 0 var(--border-radius) var(--border-radius) 0;
        }

        .wfe-scope .wfe-toggle > .wfe-icon-button + .wfe-icon-button {
            margin-left: -1px;
        }

        .wfe-scope .wfe-toggle > .wfe-icon-button.active {
            position: relative;
            background-color: var(--color-surface-alt);
        }

        .wfe-scope .wfe-toggle > .wfe-icon-button:disabled {
            cursor: default;
        }

@media (max-width: 760px) {
    .wfe-scope .wfe-assign-head {
        display: none;
    }

    .wfe-scope .wfe-assign-row {
        grid-template-columns: minmax(0, 1fr) 25px;
        gap: 0.5rem;
    }

    .wfe-scope .wfe-assign-row > .wfe-assign-cell {
        grid-column: 1;
    }

    .wfe-scope .wfe-assign-row > .wfe-list-remove {
        grid-column: 2;
        grid-row: 1;
    }

    .wfe-scope .wfe-assign-line {
        flex-wrap: wrap;
    }
}
