/* ==========================================================================
   FDfx Kochbuch – Stylesheet
   Farbmodus: ohne data-theme folgt die Seite dem System, data-theme="light"
   bzw. "dark" auf <html> erzwingt einen Modus (Schalter im Seitenkopf).
   Kopf-Farben und Titel-Schrift kommen aus config.php (?action=theme-css).
   ========================================================================== */

:root {
    --green: #2f7d32;
    --green-dark: #1f5a22;
    --green-soft: #e7f2e7;
    --bg: #f6f5f1;
    --surface: #ffffff;
    --surface-alt: #f0f0eb;
    --text: #1f2421;
    --muted: #66706a;
    --border: #dcdcd4;
    --danger: #b3261e;
    --warn-bg: #fff4d6;
    --warn-text: #6b4e00;
    --ok-bg: #e5f4e6;
    --err-bg: #fde8e7;
    --on-primary: #ffffff;
    --icon-filter: none;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .04);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
    /* Standardwerte, werden durch das Theme-Stylesheet überschrieben */
    --header-from: #2f7d32;
    --header-to: #1f5a22;
    --header-angle: 180deg;
    --header-text: #ffffff;
    --title-color: #ffffff;
    --title-font: var(--font-serif);
    --title-size: 1.5rem;
    --title-weight: bold;
    --title-style: italic;
    --title-transform: none;
    --title-spacing: normal;
    --title-shadow: none;
    color-scheme: light;
}

/* Dunkle Palette – zweimal identisch: Systemeinstellung bzw. Schalter */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --green: #6dbb70;
        --green-dark: #8fd092;
        --green-soft: #1f3321;
        --bg: #151816;
        --surface: #1e2220;
        --surface-alt: #262b28;
        --text: #e6e9e6;
        --muted: #9aa49d;
        --border: #343a36;
        --danger: #ff8a80;
        --warn-bg: #3a3014;
        --warn-text: #f3d98b;
        --ok-bg: #1f3321;
        --err-bg: #3d1f1d;
        --on-primary: #0f1a10;
        --icon-filter: invert(1) brightness(.9);
        --header-from: #24502a;
        --header-to: #183a1b;
        --shadow: none;
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --green: #6dbb70;
    --green-dark: #8fd092;
    --green-soft: #1f3321;
    --bg: #151816;
    --surface: #1e2220;
    --surface-alt: #262b28;
    --text: #e6e9e6;
    --muted: #9aa49d;
    --border: #343a36;
    --danger: #ff8a80;
    --warn-bg: #3a3014;
    --warn-text: #f3d98b;
    --ok-bg: #1f3321;
    --err-bg: #3d1f1d;
    --on-primary: #0f1a10;
    --icon-filter: invert(1) brightness(.9);
    --header-from: #24502a;
    --header-to: #183a1b;
    --shadow: none;
    color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font: 16px/1.55 var(--font);
    color: var(--text);
    background: var(--bg);
}

img { max-width: 100%; height: auto; }
a { color: var(--green-dark); }
a:hover { color: var(--green); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-family: var(--font-serif); font-size: clamp(1.6rem, 4vw, 2.3rem); }
h2 { font-size: 1.2rem; }
[hidden] { display: none !important; }

.wrap { max-width: 1180px; margin: 0 auto; padding-inline: 16px; }
.muted { color: var(--muted); }
.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}
.print-only { display: none; }

/* --- Kopfzeile ------------------------------------------------------------ */
.site-header {
    background: var(--header-from) linear-gradient(var(--header-angle), var(--header-from) 0%, var(--header-to) 100%);
    color: var(--header-text);
    margin-bottom: 24px;
}
.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 8px 16px; padding-block: 10px;
}
.brand {
    display: flex; align-items: center; gap: 12px;
    color: var(--title-color); text-decoration: none;
    font-family: var(--title-font); font-style: var(--title-style); font-weight: var(--title-weight);
    font-size: var(--title-size); text-transform: var(--title-transform);
    letter-spacing: var(--title-spacing); text-shadow: var(--title-shadow);
}
.brand:hover { color: var(--title-color); }
.brand img { width: 48px; height: 48px; object-fit: contain; background: #fff; border-radius: 50%; padding: 3px; }
.main-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; }
.main-nav a, .main-nav .btn-link { color: var(--header-text); text-decoration: none; }
.main-nav a:hover, .main-nav .btn-link:hover { text-decoration: underline; color: var(--header-text); }
.main-nav .btn-primary { background: var(--header-text); color: var(--header-to); border-color: var(--header-text); }
.main-nav .btn-primary:hover { background: color-mix(in srgb, var(--header-text) 85%, var(--header-from)); color: var(--header-to); text-decoration: none; }

.theme-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; padding: 0; cursor: pointer;
    border-radius: 50%; border: 1px solid color-mix(in srgb, var(--header-text) 45%, transparent);
    background: color-mix(in srgb, var(--header-text) 12%, transparent); color: var(--header-text);
}
.theme-toggle:hover { background: color-mix(in srgb, var(--header-text) 25%, transparent); }
.theme-toggle:focus-visible { outline: 3px solid color-mix(in srgb, var(--header-text) 60%, transparent); outline-offset: 2px; }
/* Symbole als CSS-Masken (data:-URIs, CSP-konform) */
.theme-icon, .view-icon { display: inline-block; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.theme-toggle[data-mode="system"] .theme-icon { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm0 2v16a8 8 0 0 1 0-16z'/%3E%3C/svg%3E"); }
.theme-toggle[data-mode="light"] .theme-icon { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3Cg stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 1.5v2.5M12 20v2.5M1.5 12H4M20 12h2.5M4.6 4.6l1.8 1.8M17.6 17.6l1.8 1.8M4.6 19.4l1.8-1.8M17.6 6.4l1.8-1.8'/%3E%3C/g%3E%3C/svg%3E"); }
.theme-toggle[data-mode="dark"] .theme-icon { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 14.5A9 9 0 0 1 9.5 3a9 9 0 1 0 11.5 11.5z'/%3E%3C/svg%3E"); }
.view-icon-grid { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='3' width='8' height='8' rx='1.5'/%3E%3Crect x='13' y='3' width='8' height='8' rx='1.5'/%3E%3Crect x='3' y='13' width='8' height='8' rx='1.5'/%3E%3Crect x='13' y='13' width='8' height='8' rx='1.5'/%3E%3C/svg%3E"); }
.view-icon-list { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='4' width='5' height='4' rx='1'/%3E%3Crect x='10' y='5' width='11' height='2' rx='1'/%3E%3Crect x='3' y='10' width='5' height='4' rx='1'/%3E%3Crect x='10' y='11' width='11' height='2' rx='1'/%3E%3Crect x='3' y='16' width='5' height='4' rx='1'/%3E%3Crect x='10' y='17' width='11' height='2' rx='1'/%3E%3C/svg%3E"); }
.inline-form { display: inline; margin: 0; }

.site-footer { color: var(--muted); padding-block: 32px; text-align: center; }

/* --- Bausteine ------------------------------------------------------------ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
}
.narrow { max-width: 440px; margin: 24px auto; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; }
.label { display: block; font-weight: 600; margin-bottom: 4px; }
.hint { color: var(--muted); font-size: .9rem; margin: 0 0 10px; }
fieldset { margin: 0; min-width: 0; }
fieldset.card { padding-top: 8px; }
legend { font-weight: 700; padding: 0 6px; font-size: 1.05rem; }

.alert { border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-success { background: var(--ok-bg); border-color: var(--green); }
.alert-info { background: var(--green-soft); }
.alert-warning { background: var(--warn-bg); color: var(--warn-text); }
.alert-error { background: var(--err-bg); border-color: var(--danger); }

.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: .85rem; }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); }

/* --- Formulare ------------------------------------------------------------ */
input[type="text"], input[type="search"], input[type="password"], input[type="number"], select, textarea {
    font: inherit; color: inherit;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 7px 10px;
    width: 100%;
    max-width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--green) 45%, transparent);
    outline-offset: 1px;
    border-color: var(--green);
}
textarea { resize: vertical; }
textarea.mono { font-family: ui-monospace, Consolas, monospace; font-size: .95rem; line-height: 1.5; }
.input-lg { font-size: 1.3rem; font-weight: 600; }
.input-sm { width: 6em; }
.input-xs { width: 4.5em; }
select { width: auto; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 1.1em; height: 1.1em; accent-color: var(--green); }
.radio-row { border: 0; padding: 0; display: flex; gap: 16px; }
.radio-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.radio-row input { accent-color: var(--green); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    font: inherit; font-weight: 600; line-height: 1.2;
    padding: 8px 14px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    min-height: 40px;
}
.btn:hover { border-color: var(--green); color: var(--text); }
.btn-primary { background: var(--green); border-color: var(--green); color: var(--on-primary); }
.btn-primary:hover { background: var(--green-dark); border-color: var(--green-dark); color: var(--on-primary); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-link { background: none; border: 0; padding: 0; min-height: 0; font-weight: normal; cursor: pointer; font: inherit; }
.btn-sm { padding: 5px 10px; min-height: 32px; font-size: .9rem; }
.btn-icon { width: 36px; height: 36px; min-height: 36px; padding: 0; font-size: 1.05rem; }

.chip-group { display: flex; flex-wrap: wrap; gap: 6px; padding-block: 6px; border-bottom: 1px dashed var(--border); }
.chip-group:last-child { border-bottom: 0; }
.chip { position: relative; display: inline-flex; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span, .chip-link {
    display: inline-block; padding: 4px 11px; border-radius: 99px;
    border: 1px solid var(--border); background: var(--surface);
    font-size: .88rem; user-select: none; text-decoration: none; color: var(--text);
}
.chip input:checked + span { background: var(--green); border-color: var(--green); color: var(--on-primary); }
.chip input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--green) 45%, transparent); }
.chip-link:hover { border-color: var(--green); }

/* --- Übersicht ------------------------------------------------------------ */
.overview { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; }
.filters { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 12px); }
.filter-more summary { cursor: pointer; font-weight: 600; padding-block: 4px; }
.filter-more[open] summary { margin-bottom: 10px; }
.result-count { color: var(--muted); margin: 0 0 8px; }
.letter-nav { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.letter-nav a {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; height: 32px; border-radius: 6px; text-decoration: none;
    background: var(--surface); border: 1px solid var(--border); font-weight: 600;
}
.letter-nav a:hover { border-color: var(--green); }
.letter { font-family: var(--font-serif); color: var(--green-dark); border-bottom: 2px solid var(--green-soft); padding-bottom: 4px; margin-top: 20px; scroll-margin-top: 12px; }
.recipe-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.recipe-card {
    display: flex; flex-direction: column; height: 100%;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; text-decoration: none; color: var(--text); box-shadow: var(--shadow);
    transition: transform .12s ease, border-color .12s ease;
}
.recipe-card:hover { transform: translateY(-2px); border-color: var(--green); color: var(--text); }
.recipe-card img, .recipe-card .placeholder { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--green-soft); }
.recipe-card .placeholder { display: flex; align-items: center; justify-content: center; font-size: 2.5rem; opacity: .6; }
.recipe-card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.recipe-card-title { font-weight: 650; line-height: 1.3; }
.recipe-card-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: .85rem; }
.empty { text-align: center; color: var(--muted); padding: 32px; }

.results-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.results-head .result-count { margin: 0; }
.view-switch { display: inline-flex; }
.view-switch .btn { border-radius: 0; color: var(--muted); }
.view-switch .btn:first-child { border-radius: 7px 0 0 7px; }
.view-switch .btn:last-child { border-radius: 0 7px 7px 0; margin-left: -1px; }
.view-switch .btn[aria-pressed="true"] { background: var(--green-soft); border-color: var(--green); color: var(--green-dark); position: relative; }

/* Listenansicht: gleiche Karten, als Zeilen mit kleinem Vorschaubild */
.view-list .recipe-grid { grid-template-columns: 1fr; gap: 6px; }
.view-list .recipe-card { flex-direction: row; align-items: center; }
.view-list .recipe-card:hover { transform: none; }
.view-list .recipe-card img, .view-list .recipe-card .placeholder {
    width: 72px; height: 54px; aspect-ratio: auto; flex: none; font-size: 1.4rem;
}
.view-list .recipe-card-body { flex: 1 1 auto; min-width: 0; padding: 6px 12px; flex-direction: row; align-items: center; justify-content: space-between; gap: 4px 16px; flex-wrap: wrap; }
.view-list .recipe-card-title { overflow-wrap: anywhere; }
.view-list .recipe-card-meta { flex: none; }

/* --- Detailansicht -------------------------------------------------------- */
.recipe-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.recipe-head h1 { margin: 0; }
.recipe-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.recipe-top { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; margin-bottom: 24px; }
.recipe-intro { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.description { font-size: 1.05rem; }
.description p { margin: 0; }
.recipe-side { display: flex; flex-direction: column; gap: 16px; }

.ingredients-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.ingredients-head h2 { margin: 0; }
.scaler { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper-label { font-size: .85rem; color: var(--muted); margin-right: 4px; }
.stepper input { width: 4.5em; text-align: center; padding: 6px 4px; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.ingredient-table { width: 100%; border-collapse: collapse; }
.ingredient-table td, .ingredient-table th { padding: 6px 6px; border-bottom: 1px solid var(--border); vertical-align: top; text-align: left; }
.ingredient-table tr:last-child td { border-bottom: 0; }
.ingredient-table .qty { text-align: right; white-space: nowrap; width: 4.5em; font-variant-numeric: tabular-nums; font-weight: 600; }
.ingredient-table .unit { white-space: nowrap; width: 4em; color: var(--muted); }
.ingredient-table .separator th { padding-top: 14px; color: var(--green-dark); border-bottom: 2px solid var(--green-soft); }
.note { font-size: .85em; font-style: italic; color: var(--muted); }
.amt.changed { color: var(--green-dark); }

.gallery { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--green-soft); aspect-ratio: 4 / 3; }
.gallery-item { display: none; width: 100%; height: 100%; }
.gallery-item.active { display: block; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.gallery-empty { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; font-size: 4rem; opacity: .5; }
.gallery-nav, .lightbox-nav, .lightbox-close {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; border-radius: 50%; border: 0;
    background: rgba(0, 0, 0, .55); color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.gallery-nav:hover, .lightbox-nav:hover, .lightbox-close:hover { background: rgba(0, 0, 0, .8); }
.gallery-nav.prev, .lightbox-nav.prev { left: 8px; }
.gallery-nav.next, .lightbox-nav.next { right: 8px; }
.gallery-dots { position: absolute; bottom: 8px; right: 8px; background: rgba(0, 0, 0, .55); color: #fff; font-size: .8rem; padding: 2px 8px; border-radius: 99px; }

.facts { margin: 0; display: grid; gap: 8px; }
.facts > div { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: right; }
.facts .icons { display: flex; gap: 2px; }
.facts .icons img { width: 20px; height: 20px; }
.facts .icons img { filter: var(--icon-filter); }

.qr { margin: 0; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; }
.qr-code { width: 96px; height: 96px; background: #fff; padding: 4px; border-radius: 6px; flex: none; }
.qr-code:empty { display: none; }
.qr-code img { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.qr:has(.qr-code:empty) { display: none; }

.preparation { margin-bottom: 16px; }
.prep-text { font-size: 1.05rem; max-width: 75ch; }
.prep-text p { margin: 0 0 .9em; }
.prep-text ul { margin: 0 0 .9em; padding-left: 1.4em; }
.prep-text li { margin-bottom: .3em; }
.ing { font-weight: 600; color: var(--green-dark); }
.ing-u { text-decoration: underline; text-decoration-color: var(--green); }
.categories { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.categories .label { margin: 0 4px 0 0; }

.lightbox {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(0, 0, 0, .92);
    display: flex; align-items: center; justify-content: center;
    padding: 56px 16px;
}
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.lightbox-close { top: calc(env(safe-area-inset-top, 0px) + 28px); right: 12px; }

/* --- Bearbeiten ----------------------------------------------------------- */
.edit-form { display: flex; flex-direction: column; gap: 16px; }
.edit-head { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.edit-actions, .edit-footer { display: flex; gap: 8px; }
.edit-footer {
    position: sticky; bottom: 0; justify-content: flex-end;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    border-top: 1px solid var(--border);
    margin-inline: -16px;
}
.edit-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.facts-edit { display: flex; flex-direction: column; gap: 10px; }
.time-input { display: inline-flex; align-items: center; gap: 4px; }

.ing-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ing-row {
    display: grid;
    grid-template-columns: 3.6em 5.5em 7.5em minmax(8em, 1fr) auto;
    gap: 6px; align-items: center;
    padding: 6px; border-radius: 8px; background: var(--bg);
}
.ing-row select { width: 100%; padding-inline: 6px; }
.ing-handle { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; color: var(--muted); text-align: center; }
.ing-buttons { display: flex; gap: 3px; }
.ing-row.is-deleted { opacity: .5; }
.ing-row.is-deleted .ing-name, .ing-row.is-deleted .ing-amount { text-decoration: line-through; }
.ing-row.is-new { outline: 2px solid var(--green-soft); }

.toolbar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.toolbar-sep { width: 1px; background: var(--border); margin-inline: 4px; }
details.hint { margin-top: 8px; }
details.hint summary { cursor: pointer; }
details.hint code { background: var(--bg); padding: 1px 4px; border-radius: 4px; }

.image-list { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 8px; }
.image-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.image-list img { width: 90px; height: 68px; object-fit: cover; border-radius: 6px; }
.image-list label { display: flex; align-items: center; gap: 6px; }
.check.danger { color: var(--danger); }
.upload-preview { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.upload-preview img { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; }

.danger-zone { display: flex; justify-content: space-between; align-items: center; margin-top: 32px; border-color: var(--danger); }

.error-details { white-space: pre-wrap; overflow-x: auto; font-size: .8rem; background: var(--bg); padding: 10px; border-radius: 6px; }

/* --- Admin-Bereich -------------------------------------------------------- */
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-section { margin-bottom: 40px; scroll-margin-top: 16px; }
.admin-section > h2 { font-size: 1.4rem; font-family: var(--font-serif); }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 16px; }
.admin input[type="color"] { width: 100%; height: 40px; padding: 2px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); cursor: pointer; }
.admin input[type="range"] { width: 100%; accent-color: var(--green); }
.admin input[type="url"] { font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 7px; padding: 7px 10px; width: 100%; }
.admin code { background: var(--surface-alt); padding: 1px 5px; border-radius: 4px; font-size: .9em; overflow-wrap: anywhere; }
.sep { border: 0; border-top: 1px dashed var(--border); margin: 4px 0; width: 100%; }
.error-list { margin: 6px 0 0; padding-left: 1.2em; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .82rem; font-weight: 700; line-height: 1.4; }
.pill-error { background: var(--err-bg); color: var(--danger); }
.pill-warn { background: var(--warn-bg); color: var(--warn-text); }
.pill-ok { background: var(--ok-bg); color: var(--green-dark); }
.pill-info { background: var(--surface-alt); color: var(--muted); }
.admin-tabs .pill { margin-left: 4px; }

.check-summary { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.check-counts { display: flex; flex-wrap: wrap; gap: 6px; }
.check-deep { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.check-deep .hint { flex: 1 1 300px; margin: 0; }
.check-group { margin-bottom: 16px; }
.check-group h3 { margin: 0 0 8px; font-size: 1.05rem; }
.check-list { list-style: none; margin: 0; padding: 0; }
.check-item { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.check-item:last-child { border-bottom: 0; }
.check-detail { display: block; color: var(--muted); font-size: .93rem; }
.check-sublist { margin: 6px 0 0; padding-left: 1.1em; font-size: .88rem; }
.check-sublist li { margin-bottom: 2px; }
.st-icon {
    width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: .85rem; line-height: 1;
}
.st-ok .st-icon { background: var(--ok-bg); color: var(--green-dark); }
.st-ok .st-icon::before { content: "✓"; }
.st-warn .st-icon { background: var(--warn-bg); color: var(--warn-text); }
.st-warn .st-icon::before { content: "!"; }
.st-error .st-icon { background: var(--danger); color: #fff; }
.st-error .st-icon::before { content: "✕"; }
.st-info .st-icon { background: var(--surface-alt); color: var(--muted); }
.st-info .st-icon::before { content: "i"; font-style: italic; font-family: Georgia, serif; }

.archive-toc { columns: 260px; padding-left: 1.2em; }
.archive-entry { margin-top: 16px; }

/* --- Responsiv ------------------------------------------------------------ */
@media (max-width: 900px) {
    .overview, .recipe-top, .edit-grid { grid-template-columns: 1fr; }
    .filters { position: static; }
    .recipe-side { order: -1; }
    .qr { display: none; }
}
@media (max-width: 560px) {
    body { font-size: 15px; }
    .brand { font-size: 1.15rem; }
    .brand img { width: 38px; height: 38px; }
    .recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .view-list .recipe-grid { grid-template-columns: 1fr; gap: 6px; }
    .view-list .recipe-card img, .view-list .recipe-card .placeholder { width: 60px; height: 60px; }
    .view-label { display: none; }
    .header-inner { gap: 8px 12px; }
    .ing-row { grid-template-columns: 5em minmax(0, 1fr); }
    .ing-row .ing-handle { grid-column: 1 / -1; text-align: left; }
    .ing-row .ing-name { grid-column: 1 / -1; }
    .ing-row .ing-buttons { grid-column: 1 / -1; justify-content: flex-end; }
    .edit-actions { width: 100%; justify-content: flex-end; }
}

/* --- Druck ---------------------------------------------------------------- */
@media print {
    /* :not(#…) erhöht die Spezifität, damit Druck immer hell ist */
    :root:not(#print) { --text: #000; --muted: #444; --bg: #fff; --surface: #fff; --border: #bbb; --green-dark: #000; --icon-filter: none; color-scheme: light; }
    body { font-size: 11pt; background: #fff; }
    .site-header, .site-footer, .no-print, .alert, .lightbox, .gallery-nav, .categories { display: none !important; }
    .print-only { display: block; }
    .card { border: 0; box-shadow: none; padding: 0; }
    .recipe-top { grid-template-columns: 1fr 6.5cm; gap: 1cm; }
    .recipe-side { order: 0; }
    .gallery { aspect-ratio: auto; background: none; }
    .gallery-item { display: none !important; }
    .gallery-item.active { display: block !important; }
    .qr { display: flex !important; }
    .ing { color: #000; }
    a { color: #000; text-decoration: none; }
    .prep-text { max-width: none; }
}
