/* Kalkulierbare Garnituren */

.garnish-cost-form {
    display: grid;
    gap: 1rem;
}

.garnish-form-heading p {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    line-height: 1.5;
}

.garnish-form-grid {
    display: grid;
    grid-template-columns:
        minmax(12rem, 1fr)
        minmax(13rem, 0.9fr)
        minmax(13rem, 1fr);
    gap: 0.8rem;
}

.garnish-component-editor {
    display: grid;
    gap: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    padding: 0.85rem;
    background: rgba(0, 0, 0, 0.08);
}

.garnish-component-editor[hidden] {
    display: none;
}

.garnish-component-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.garnish-component-rows {
    display: grid;
    gap: 0.65rem;
}

.garnish-component-row {
    display: grid;
    grid-template-columns:
        minmax(12rem, 1.35fr)
        minmax(6rem, 0.55fr)
        minmax(6rem, 0.55fr)
        minmax(9rem, 0.8fr)
        auto;
    align-items: end;
    gap: 0.65rem;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

.garnish-component-row:first-child {
    border-top: 0;
    padding-top: 0;
}

.garnish-remove-component {
    min-height: 2.7rem;
}

.garnish-admin-list {
    display: grid;
    gap: 0.8rem;
}

.garnish-admin-card {
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    padding: 0.75rem;
    background: var(--surface-soft);
}

.garnish-admin-card > details > summary {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.35rem;
    list-style: none;
}

.garnish-admin-card > details > summary::-webkit-details-marker {
    display: none;
}

.garnish-admin-card > details[open] > summary {
    margin-bottom: 0.9rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.85rem;
}

.garnish-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.45rem;
}

.garnish-summary-action {
    flex: 0 0 auto;
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 800;
}

.garnish-delete-form {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

.ingredient-usage-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

@media (max-width: 980px) {.garnish-form-grid {
        grid-template-columns: 1fr 1fr;
    }

    .garnish-note-field {
        grid-column: 1 / -1;
    }

    .garnish-component-row {
        grid-template-columns:
            minmax(12rem, 1fr)
            minmax(6rem, 0.5fr)
            minmax(6rem, 0.5fr);
    }

    .garnish-component-row .field:nth-of-type(4) {
        grid-column: 1 / -2;
    }
}

@media (max-width: 680px) {.garnish-form-grid,
    .garnish-component-row {
        grid-template-columns: 1fr;
    }

    .garnish-note-field,
    .garnish-component-row .field:nth-of-type(4) {
        grid-column: auto;
    }

    .garnish-component-heading,
    .garnish-admin-card > details > summary {
        align-items: stretch;
        flex-direction: column;
    }

    .garnish-component-heading button,
    .garnish-remove-component,
    .garnish-delete-form,
    .garnish-delete-form button {
        width: 100%;
    }
}

/* Layout-Korrektur für Garniturformulare */

.garnish-cost-form > .button-primary {
    justify-self: start;
    width: auto;
    min-width: 12rem;
}

.garnish-component-editor {
    min-width: 0;
}

.garnish-component-rows,
.garnish-component-row {
    min-width: 0;
}

.garnish-component-row > .field {
    min-width: 0;
}

.garnish-component-row input,
.garnish-component-row select {
    width: 100%;
    min-width: 0;
}

.garnish-remove-component {
    align-self: end;
    width: auto;
    white-space: nowrap;
}

@media (max-width: 1180px) {.garnish-component-row {
        grid-template-columns:
            minmax(12rem, 1.4fr)
            minmax(7rem, 0.6fr)
            minmax(7rem, 0.6fr)
            minmax(10rem, 1fr);
    }

    .garnish-remove-component {
        grid-column: 1 / -1;
        justify-self: end;
    }
}

@media (max-width: 760px) {.garnish-cost-form > .button-primary {
        justify-self: stretch;
        width: 100%;
    }

    .garnish-remove-component {
        justify-self: stretch;
        width: 100%;
    }
}

/* Garniturformular: einspaltiges Layout und gemeinsame Aktionsleiste */

.admin-create-form.garnish-cost-form {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
}

.garnish-component-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-width: 0;
}

.garnish-component-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.65rem;
}

.garnish-component-actions .button-primary,
.garnish-component-actions .button-secondary {
    width: auto;
    min-width: 0;
    white-space: nowrap;
}

@media (max-width: 680px) {.garnish-component-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .garnish-component-actions {
        display: grid;
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .garnish-component-actions .button-primary,
    .garnish-component-actions .button-secondary {
        width: 100%;
        white-space: normal;
    }
}

@media (max-width: 460px) {.garnish-component-actions {
        grid-template-columns: 1fr;
    }
}

