/* === DATEI: public/style.css === */

:root { 
    --primary: #6B4C9A;      /* Mystisches Violett (Zaubern) */
    --success: #5A8B73;      /* Salbeigrün (Bestätigungen, Vorrat da) */
    --danger: #D96C6C;       /* Etwas wärmeres Rot (Fehler) */
    --warning: #D97746;      /* Terrakotta/Kürbis (Rette mich, fehlt) */
    --neutral: #bebebe; 
    --bg-desktop: #E5E0D8;   /* Sanftes Beige für den Rand am PC */
    --bg-app: #FAF8F5;       /* Cremiges Buchseiten-Weiß */
    --text: #2D2825;         /* Dunkles Auberginen-Grau (weicher als Schwarz) */
    --border: #E8E2D9;       /* Wärmeres Rahmen-Grau */
    --placeholder: #8C847D;  /* Wärmeres Placeholder-Grau */
    --grey-box: #F2EFE9;     /* Sanft abgesetzte Kästen, passend zu Creme */    
    /* NEU: Schriftart-Definitionen */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Nunito', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { background: var(--bg-desktop); height: 100%; }

body {
    font-family: var(--font-body);
    background-color: var(--bg-app);
    color: var(--text);
    margin: 0 auto;
    padding: 0;
    max-width: 480px; /* Zwingt die App auf Smartphone-Breite */
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0,0,0,0.1); /* Sanfter Schatten an den Rändern für Desktop */
    position: relative;
    overflow-x: hidden;
}
/* Globale Typografie-Regeln */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
}

/* Verhindert, dass Browser bei Formularen und Buttons auf Systemschriften zurückfallen */
input, button, select, textarea {
    font-family: var(--font-body);
}

@media (max-width: 480px) { body { box-shadow: none; max-width: 100%; } }

.app-header {
    display:flex; align-items:center; padding: calc(12px + env(safe-area-inset-top, 0px)) 15px 12px;
    min-height: calc(58px + env(safe-area-inset-top, 0px));
    border-bottom:1px solid var(--border); flex-shrink:0; background:var(--bg-app); position:relative; z-index:1000; 
}
.app-header .header-spacer, .app-header .header-actions { flex:1; min-width:0; }
.header-actions { display:flex; justify-content:flex-end; align-items:center; }
.logout-btn { background:none; color:var(--placeholder); padding:8px 0; width:auto; height:auto; font-size:0.75rem; font-weight:800; letter-spacing:1px; }
.logout-btn:hover, .logout-btn:focus { background:transparent; transform:none; box-shadow:none; }

header { flex-shrink: 0; padding: 12px 15px; text-align: center; border-bottom: 1px solid var(--border); }

nav { display: flex; gap: 4px; background: var(--grey-box); padding: 4px; border-radius: 10px; height: 42px; border: 1px solid var(--border); }
nav button { flex: 1; height: 32px; background: transparent; border: none; border-radius: 6px; color: #64748b; font-weight: bold; font-size: 0.65rem; text-transform: uppercase; display: flex; align-items: center; justify-content: center; }
nav button:hover, nav button:focus, button.active-nav { background: white; color: var(--primary); box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
button.active-nav { font-weight: bold; border: 2px solid var(--primary); }

main { flex-grow: 1; display: flex; flex-direction: column; overflow-y: auto; padding: 12px; }
.card { 
    background: #FFFFFF; 
    padding: 16px; 
    border-radius: 12px; 
    border: none; 
    box-shadow: 0 4px 20px rgba(107, 76, 154, 0.08); 
    margin-bottom: 15px; 
    transition: transform 0.2s, box-shadow 0.2s; 
}

.list-container { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.item { 
    background: #FFFFFF; 
    padding: 12px; 
    border-radius: 12px; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    border: none; 
    border-left: 4px solid var(--primary); 
    box-shadow: 0 4px 15px rgba(107, 76, 154, 0.05); 
    margin-bottom: 8px; 
    transition: transform 0.2s, box-shadow 0.2s; 
}
.item:active { transform: translateY(1px); box-shadow: 0 2px 8px rgba(107, 76, 154, 0.05); }

.empty-state { text-align: center; padding: 25px 15px; color: var(--placeholder); background: var(--grey-box); border-radius: 12px; border: 1px dashed var(--border); font-size: 0.9rem; margin-bottom: 15px;}

input, select, textarea { 
    width: 100%; 
    min-height: 44px; 
    padding: 10px 15px; 
    border: 1px solid var(--border); 
    border-radius: 8px; 
    font-size: 1rem; 
    background: #FFFFFF; 
    color: var(--text); 
    font-family: var(--font-body); 
    outline: none; 
    transition: border-color 0.3s, box-shadow 0.3s; 
}
input:focus, textarea:focus, select:focus { 
    border-color: var(--primary); 
    box-shadow: 0 0 0 3px rgba(107, 76, 154, 0.15); 
}

button { border: none; cursor: pointer; font-weight: bold; text-transform: uppercase; font-size: 0.75rem; display: flex; align-items: center; justify-content: center; color: white; border-radius: 8px; height: 38px; transition: transform 0.1s ease, opacity 0.1s ease; }
button:active { transform: scale(0.97); opacity: 0.8; }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 10000; padding: 15px; }
.modal-card { background: var(--bg-app); padding: 0 0 25px 0; border-radius: 15px; width: 100%; max-width: 380px; box-shadow: 0 15px 40px rgba(107, 76, 154, 0.15); display: flex; flex-direction: column; max-height: 90vh; overflow-y: auto;}
.modal-card-inner { padding: 0 20px; display: flex; flex-direction: column; gap: 15px; }
.modal-card h3 { margin: 20px 20px 0; }

/* Sprint 66f: Rezeptmodal oben stabil verankern, damit wechselnde Tag-Gruppen das Modal nicht vertikal springen lassen. */
#rezept-manuell-modal {
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}
#rezept-manuell-modal .modal-card {
    margin: 0 auto;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
@supports not (height: 100dvh) {
    #rezept-manuell-modal .modal-card {
        max-height: calc(100vh - 24px);
    }
}

/* Runtime-Dialoge: kompakte Auswahlfelder und lesbare Konfliktkarten */
.quantity-modal-card {
    padding: 22px 18px 18px;
    max-width: 420px;
}
.quantity-modal-card h3 {
    margin: 0 0 10px 0;
    font-size: 1.15rem;
}
.quantity-modal-card .modal-help {
    margin: 0 0 14px 0;
    line-height: 1.4;
    color: var(--placeholder);
}
.quantity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 58vh;
    overflow-y: auto;
    padding-right: 2px;
}
.quantity-row {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
}
.unit-conflict-title {
    font-weight: 800;
    color: var(--primary);
    line-height: 1.25;
    margin-bottom: 8px;
}
.unit-conflict-meta {
    font-size: 0.85rem;
    line-height: 1.35;
    color: var(--text);
    margin-bottom: 10px;
}
.runtime-choice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--grey-box);
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1.3;
}
.runtime-choice + .runtime-choice { margin-top: 8px; }
.runtime-choice input[type="radio"],
.runtime-choice input[type="checkbox"],
.quantity-row input[type="radio"],
.quantity-row input[type="checkbox"] {
    width: 18px;
    min-height: 18px;
    height: 18px;
    padding: 0;
    margin: 0;
    flex: 0 0 auto;
    accent-color: var(--primary);
}
.runtime-choice input[type="number"] {
    width: 72px;
    min-height: 34px;
    height: 34px;
    padding: 4px 8px;
    text-align: center;
}
.runtime-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}
.runtime-modal-actions button {
    flex: 1;
}


.modal-block { background: white; border-radius: 12px; padding: 15px; border: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.03); }

/* Premium Rezept-Cover in Modals */
.modal-cover-upload { width: 100%; aspect-ratio: 16/9; background: #e2e8f0; border-radius: 15px 15px 0 0; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; border-bottom: 1px solid var(--border); margin-bottom: 10px; flex-shrink: 0;}
.modal-cover-img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.modal-cover-icon { position: absolute; background: rgba(0,0,0,0.6); color: white; padding: 8px 16px; border-radius: 20px; font-weight: bold; font-size: 0.85rem; backdrop-filter: blur(4px); cursor: pointer; }

/* STABILE Akkordeon Textareas (Zwingt die Basis-Regel in die Knie) */
.accordion-textarea { 
    height: 48px !important; 
    min-height: 48px !important; 
    transition: height 0.3s cubic-bezier(0.2, 0, 0, 1) !important; 
    resize: none !important; 
    overflow-y: hidden !important; 
    line-height: 1.4 !important; 
    padding-top: 12px !important; 
}
.accordion-textarea.expanded { 
    height: 180px !important; 
    overflow-y: auto !important; 
    border-color: var(--primary) !important; 
}

body.is-loading { cursor: progress; }
body.is-loading::after { content: "Lade…"; position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: var(--primary); color: white; padding: 8px 16px; border-radius: 20px; font-weight: bold; z-index: 9999; box-shadow: 0 4px 12px rgba(0,0,0,0.2); animation: pulse 0.8s infinite alternate; }
@keyframes pulse { from { opacity: 0.8; transform: translateX(-50%) scale(0.95); } to { opacity: 1; transform: translateX(-50%) scale(1.05); } }

.collapsible-header { display: flex; align-items: center; gap: 15px; background: var(--grey-box); padding: 10px 15px; border-radius: 8px; border: 1px solid var(--border); font-weight: 800; font-size: 0.85rem; cursor: pointer; margin-bottom: 8px; color: var(--text); }
.collapsible-header span:first-child { flex-grow: 1; }

.btn-icon { background: transparent; border: none; font-size: 1.2rem; padding: 0; margin: 0; color: var(--text); width: auto; height: auto; box-shadow: none; display: flex; align-items: center; justify-content: center; }
.btn-icon:hover, .btn-icon:focus { background: transparent; transform: scale(1.1); box-shadow: none; }
.btn-secondary { background: var(--placeholder); color: white; }

/* Kochbuch-Modal: ISBN-Aktionen klar beschriften statt kryptischer Icon-Buttons */
.field-label {
    display: block;
    margin: 0 0 6px;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--placeholder);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.book-isbn-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}
.book-isbn-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.book-isbn-action {
    width: 100%;
    min-height: 42px;
    height: auto;
    padding: 9px 10px;
    line-height: 1.15;
    text-align: center;
}
.book-isbn-action-primary {
    background: var(--primary);
    color: #fff;
}
@media (max-width: 360px) {
    .book-isbn-actions { grid-template-columns: 1fr; }
}
.generator-area { margin-bottom: 20px; }

/* FAB bleibt immer sichtbar */
#main-fab { display: flex !important; }
.fab { position: fixed; bottom: 25px; right: 25px; width: 60px; height: 60px; background-color: var(--primary); color: white; border-radius: 50%; align-items: center; justify-content: center; box-shadow: 0 4px 15px rgba(0,0,0,0.3); z-index: 900; cursor: pointer; border: none; transition: transform 0.2s, background-color 0.2s; }
.fab:active { transform: scale(0.95); }

#fab-menu-modal { align-items: flex-end; padding: 0; }
.action-menu-container { background: white; width: 100%; max-width: 420px; border-radius: 20px 20px 0 0; padding: 25px 20px 35px 20px; box-shadow: 0 -5px 20px rgba(0,0,0,0.15); display: flex; flex-direction: column; gap: 12px; animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.action-btn { background: var(--grey-box); color: var(--text); padding: 16px; border-radius: 12px; display: flex; align-items: center; gap: 15px; font-size: 1rem; font-weight: bold; border: 1px solid var(--border); text-transform: none; justify-content: flex-start; }
.action-btn:active { background: #e2e8f0; }
.action-btn span.icon { font-size: 1.5rem; }

.recipe-card { flex-direction: column; align-items: flex-start; padding: 0; overflow: hidden; }
.recipe-card-header { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; cursor: pointer; padding: 10px 12px; }

.recipe-title, .book-title { font-weight: 500; font-size: 0.95rem; line-height: 1.3; pointer-events: none; flex: 1; min-width: 0; padding-right: 5px; word-break: break-word; }
.recipe-card-meta { display:flex; align-items:center; gap:6px; pointer-events:auto; flex-shrink:0; }

.availability-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; height: 24px; padding: 0 8px; border: 1px solid currentColor; border-radius: 999px; font-size: 0.72rem; font-weight: 800; background: white; cursor:help; pointer-events:auto; }
.recipe-ingredients-heading {
    margin: 12px 0 6px;
}
.recipe-ingredients-heading h4 {
    margin: 0 0 4px;
    font-family: var(--font-heading);
    color: var(--text);
    font-size: 1rem;
}
.recipe-ingredients-heading p {
    margin: 0;
    color: var(--placeholder);
    font-size: 0.78rem;
    line-height: 1.35;
}
.ingredient-summary-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    margin: 0;
}
.ingredient-summary-part {
    font-weight: 750;
    white-space: nowrap;
}
.ingredient-summary-separator {
    color: var(--placeholder);
    opacity: 0.7;
}
.summary-available { color: var(--success); }
.summary-planned { color: var(--primary); }
.summary-missing { color: var(--warning); }
.summary-unclear { color: #64748b; }
.recipe-ingredients {
    padding-left: 1.15rem;
    margin: 0 0 10px;
}
.recipe-ingredients li.ingredient-row {
    margin-bottom: 4px;
    line-height: 1.35;
    color: var(--text);
}
.ingredient-text {
    color: var(--text);
}
.ingredient-inline-status {
    display: inline;
    margin-left: 10px;
    padding: 0;
    border-radius: 0;
    font-size: 0.76rem;
    font-weight: 750;
    vertical-align: baseline;
    white-space: nowrap;
    background: transparent;
}
.ingredient-planned .ingredient-inline-status {
    color: var(--primary);
}
.ingredient-missing .ingredient-inline-status {
    color: var(--warning);
}
.ingredient-unclear .ingredient-inline-status {
    color: #64748b;
}
.ingredient-planned::marker,
.ingredient-missing::marker,
.ingredient-unclear::marker { color: var(--text); }

.shopping-hint { display:inline-flex; align-items:center; justify-content:center; height:24px; padding:0 8px; border-radius:999px; font-size:0.72rem; font-weight:750; background:var(--grey-box); color:#64748b; border:1px solid var(--border); cursor:help; pointer-events:auto; }
.active-recipe-card { background:#ffffff; border-color:#cbd5e1; box-shadow:0 8px 24px rgba(15,23,42,0.12); outline:2px solid rgba(112,158,237,0.28); transform:translateY(-1px); }
.active-recipe-card .recipe-card-header { background:#f8fafc; border-bottom:1px solid var(--border); }

.staples-scroller { display: flex; overflow-x: auto; gap: 12px; padding: 10px 0 20px; margin-bottom: 15px; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.staples-scroller::-webkit-scrollbar { display: none; }
.staple-card { flex: 0 0 auto; background: var(--bg-app); padding: 12px 15px; border-radius: 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 90px; text-align: center; border: 2px solid var(--border); box-shadow: 0 2px 5px rgba(0,0,0,0.05); transition: transform 0.1s; }
.staple-card:active { transform: scale(0.95); }
.staple-card.green { border-color: var(--success); }
.staple-card.yellow { border-color: var(--warning); background: #fffdf5; }
.staple-card.red { border-color: var(--danger); background: #fef2f2; opacity: 0.8; }
.staple-indicator { width: 14px; height: 14px; border-radius: 50%; margin-bottom: 8px; }
.staple-indicator.green { background: var(--success); box-shadow: 0 0 8px rgba(153,186,69,0.5); }
.staple-indicator.yellow { background: var(--warning); box-shadow: 0 0 8px rgba(237,195,110,0.5); }
.staple-indicator.red { background: var(--danger); box-shadow: 0 0 8px rgba(240,151,137,0.5); }

.recipe-header-image-container { position: relative; width: calc(100% + 24px); margin: 0 -12px 15px -12px; height: 200px; background: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; border-bottom: 1px solid var(--border); }
.recipe-header-image { width: 100%; height: 100%; object-fit: cover; opacity: 0.9; }

.tag-category-title { font-size: 0.7rem; color: var(--placeholder); text-transform: uppercase; margin-bottom: 4px; font-weight: 800; margin-top: 5px;}
.tag-chip-container { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag-chip { padding: 6px 12px; border-radius: 16px; background: var(--grey-box); border: 1px solid var(--border); cursor: pointer; font-size: 0.75rem; font-weight: 600; color: var(--placeholder); transition: all 0.2s ease; user-select: none; -webkit-user-select: none; flex-shrink: 0;}
.tag-chip.active { background: var(--primary); color: white; border-color: var(--primary); }

.modal-tag-row-prioritized {
    display: block !important;
    overflow-x: visible !important;
    padding-top: 4px !important;
}
.modal-tag-priority-section {
    min-width: 0;
    margin-bottom: 10px;
}
.modal-tag-priority-section:last-child {
    margin-bottom: 0;
}
.modal-tag-section-label {
    font-size: 0.66rem;
    font-weight: 850;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 2px 0 6px;
}
.modal-tag-section-label-secondary {
    color: var(--placeholder);
    margin-top: 8px;
}
.modal-tag-priority-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.modal-tag-priority-row::-webkit-scrollbar {
    display: none;
}


.modal-tag-review-section {
    border: 1px solid rgba(245, 158, 11, 0.28);
    background: rgba(245, 158, 11, 0.06);
    border-radius: 14px;
    padding: 9px 10px 10px;
}
.modal-tag-section-label-warning {
    color: #92400e;
}
.modal-tag-review-note {
    color: var(--placeholder);
    font-size: 0.72rem;
    line-height: 1.35;
    margin: -2px 0 8px;
}


.modal-legacy-review-panel {
    flex: 1 0 100%;
    border: 1px solid rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.08);
    border-radius: 14px;
    padding: 10px 12px;
    margin-bottom: 8px;
    color: var(--text);
    font-size: 0.75rem;
    line-height: 1.4;
}
.modal-legacy-review-panel strong {
    display: block;
    margin-bottom: 4px;
    color: #92400e;
    font-size: 0.78rem;
}
.modal-legacy-review-panel ul {
    margin: 7px 0 0 16px;
    padding: 0;
}
.modal-legacy-review-panel li {
    margin-bottom: 4px;
}
.modal-legacy-review-panel li:last-child {
    margin-bottom: 0;
}

textarea { height: auto !important; min-height: 100px; padding: 10px !important; line-height: 1.4; }

.recipe-list-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: #e2e8f0; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; border: 1px solid var(--border); overflow: hidden; }
.recipe-list-info { display: flex; flex-direction: column; flex: 1; min-width: 0; padding-right: 5px; }
.recipe-list-subtitle { font-size: 0.75rem; color: var(--placeholder); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.search-category-btn { display: inline-flex; align-items: center; gap: 6px; }
.search-category-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: rgba(15,23,42,0.08); color: inherit; font-size: 0.65rem; font-weight: 900; line-height: 1; }
.category-btn.active-category .search-category-count, .category-btn.has-filters .search-category-count { background: rgba(255,255,255,0.28); color: inherit; }

.dashboard-placeholder { border: 2px dashed var(--border); border-radius: 12px; padding: 20px; text-align: center; color: var(--placeholder); font-size: 0.85rem; background: #fdfdfd; margin-bottom: 15px; }

.app-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: white;
    padding: 10px 14px;
    border-radius: 24px;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.3s ease;
    pointer-events: auto;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    max-width: calc(100vw - 28px);
}

.app-toast-text { line-height: 1.25; }
.app-toast-action {
    border: 1px solid rgba(255,255,255,0.65);
    background: rgba(255,255,255,0.18);
    color: inherit;
    height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    box-shadow: none;
    font-size: 0.78rem;
    font-weight: 850;
    white-space: nowrap;
}
.app-toast-action:active { transform: scale(0.98); }

.toast-warning {
    background: var(--warning);
    color: #fff;
}

.recipe-detail-actions {
    display: flex;
    gap: 8px;
    margin: 15px 0 8px;
}

.recipe-detail-action {
    flex: 1;
}

.recipe-detail-action.shopping-action {
    background: var(--warning);
    color: #fff;
}

.recipe-detail-action.cook-action {
    background: var(--primary);
    color: #fff;
}

.recipe-detail-action:disabled {
    background: #d7d2cb !important;
    color: rgba(35, 31, 32, 0.48) !important;
    box-shadow: none !important;
    cursor: not-allowed;
    transform: none !important;
}

.recipe-action-hint {
    margin: -2px 0 14px;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.35;
}


/* --- MEGA-DROPDOWN SUCHE --- */
#search-backdrop {
    display: none; position: absolute; top: 58px; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(3px); z-index: 998;
    opacity: 0; transition: opacity 0.3s ease;
}
#search-backdrop.active { display: block; opacity: 1; }

#search-panel {
    position: absolute; top: 58px; left: 0; right: 0; background: var(--bg-app);
    z-index: 999; border-bottom: 1px solid var(--border); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    max-height: calc(100% - 58px); display: flex; flex-direction: column;
    transform: translateY(-110%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#search-panel.active { transform: translateY(0); }

.mobile-search-close {
    display: none;
}

.search-tab {
    background: var(--grey-box); border: 1px solid var(--border); border-radius: 20px;
    padding: 6px 14px; font-size: 0.8rem; font-weight: bold; color: var(--placeholder);
    white-space: nowrap; cursor: pointer; transition: all 0.2s;
}
.search-tab.active { background: var(--primary); color: white; border-color: var(--primary); }

.search-group-title {
    font-size: 0.75rem; font-weight: 800; color: var(--placeholder);
    text-transform: uppercase; margin: 15px 0 10px; letter-spacing: 0.5px;
}

.search-highlight { background: rgba(112,158,237,0.25); color: var(--primary); font-weight: 800; border-radius: 2px; padding: 0 2px; }
.quick-action-btn { width: 32px; height: 32px; border-radius: 8px; font-size: 1.1rem; font-weight: bold; background: #e2e8f0; color: var(--text); border: 1px solid var(--border); display:flex; align-items:center; justify-content:center; }
.quick-action-btn:active { background: #cbd5e1; }

/* Zwei-Ebenen Kategorie-Buttons */
.category-btn {
    background: transparent; border: 1px solid var(--border); border-radius: 20px;
    padding: 6px 12px; font-size: 0.75rem; font-weight: bold; color: var(--placeholder);
    white-space: nowrap; cursor: pointer; transition: all 0.2s; flex-shrink: 0;
}
.category-btn.active-category {
    border-color: var(--primary); color: var(--primary); background: rgba(112,158,237,0.1);
}
.category-btn.has-filters {
    background: var(--primary); color: white; border-color: var(--primary);
}
.category-btn.has-filters.active-category {
    box-shadow: 0 0 0 2px var(--bg-app), 0 0 0 4px var(--primary);
}
.scroll-row { -webkit-overflow-scrolling: touch; }
.scroll-row::-webkit-scrollbar { display: none; }

#grundnahrungsmittel-container, #basis-vorrat-container {
    display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none;
}
#grundnahrungsmittel-container button, #basis-vorrat-container button {
    background: var(--grey-box); border: 1px solid var(--border); border-radius: 16px;
    padding: 8px 14px; font-size: 0.85rem; font-weight: bold; color: var(--text);
    white-space: nowrap; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
    transition: transform 0.1s;
}
#grundnahrungsmittel-container button:active, #basis-vorrat-container button:active {
    transform: scale(0.95);
}
/* --- BRAND IDENTITY (LOGO & UNTERTITEL) --- */

/* Login-Popup */
.brand-header-login {
    text-align: center;
    margin-bottom: 15px;
}

.brand-title-login {
    margin: 0 0 5px 0;
    font-weight: 900;
    letter-spacing: 1.5px;
    font-size: 1.6rem;
    color: var(--text);
}

.brand-subtitle-login {
    font-size: 0.9rem;
    color: var(--placeholder);
    font-weight: 400;
    text-wrap: balance; /* NEU: Balanciert die Zeilenlängen optisch aus */
}

.login-message-text {
    text-align: center;
    font-size: 0.85rem;
    color: var(--placeholder);
    margin-bottom: 20px;
    line-height: 1.4;
    transition: color 0.3s;
    text-wrap: balance; /* NEU: Verhindert auch hier unschöne Umbrüche */
}

/* Haupt-Header (Startseite) */
.brand-header-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
}

.brand-title-main {
    margin: 0;
    padding: 0;
    font-weight: 900;
    letter-spacing: 1.5px;
    font-size: 1.3rem;
    line-height: 1.1;
    color: var(--text);
}

.brand-subtitle-main {
    font-size: 0.65rem;
    color: var(--placeholder);
    font-weight: 400;
    letter-spacing: 0.3px;
    margin-top: 4px;
    text-transform: none; /* Verhindert ungewollte Grossbuchstaben */
}
.btn-magic {
    width: 100%;
    padding: 16px 0;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.15rem;
    font-weight: bold;
    letter-spacing: 0.5px;
    /* Neuer Schatten: Leicht violett eingefärbt für mehr Magie, statt hart schwarz */
    box-shadow: 0 8px 20px rgba(107, 76, 154, 0.3);
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.btn-magic:active {
    transform: translateY(2px);
    box-shadow: 0 4px 10px rgba(107, 76, 154, 0.2);
}
/* --- HORIZONTALE SCROLL-LANES (KARUSSELLS) --- */

.horizontal-scroll-container {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    /* Etwas Padding unten, damit der weiche Kartenschatten nicht abgeschnitten wird */
    padding: 5px 15px 20px 15px; 
    scroll-snap-type: x mandatory; /* Sorgt für ein sanftes Einrasten der Karten */
    -webkit-overflow-scrolling: touch; /* Flüssiges Scrollen auf Apple-Geräten */
    scrollbar-width: none; /* Versteckt die unschöne Scrollbar in Firefox */
}

/* Versteckt die Scrollbar in Chrome, Safari und Edge */
.horizontal-scroll-container::-webkit-scrollbar {
    display: none; 
}

/* Regeln für die Karten innerhalb der Swipe-Lane */
.horizontal-scroll-container .card {
    min-width: 240px; /* Die Karten behalten ihre Breite und werden nicht gestaucht */
    max-width: 240px;
    scroll-snap-align: start; /* Karte rastet linksbündig ein */
    margin-bottom: 0; /* Überschreibt unser Standard-Margin von vorhin */
    display: flex;
    flex-direction: column;
}
/* Schritt 10: Zaubergrad / Erklärbarkeit der Dashboard-Karten */
.magic-score-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border-radius: 999px;
    color: white;
    font-weight: 800;
    font-size: 0.72rem;
    line-height: 1;
    padding: 6px 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.16);
}
.dashboard-card-meta {
    font-size: 0.74rem;
    color: var(--text);
    font-weight: 650;
    line-height: 1.25;
}
.dashboard-card-missing {
    font-size: 0.72rem;
    color: var(--warning);
    font-weight: 800;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.magic-factor-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 7px;
}
.magic-factor-chip {
    border-radius: 999px;
    background: var(--grey-box);
    color: var(--placeholder);
    font-size: 0.66rem;
    font-weight: 750;
    padding: 3px 7px;
    line-height: 1.1;
}
.match-reason-box {
    font-size: 0.72rem;
    color: var(--placeholder);
    margin-top: 8px;
    line-height: 1.32;
    background: rgba(0,0,0,0.035);
    border-radius: 10px;
    padding: 7px 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.match-reason-box strong {
    color: var(--text);
}

/* Schritt 10b: Dashboard-Karten entlasten */
.dashboard-recipe-card {
    width: 260px !important;
}
.dashboard-recipe-card .match-reason-box {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.dashboard-recipe-card .dashboard-card-missing {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Schritt 10c: Dashboard-Karten kontextsensitiv entrümpeln */
.dashboard-card-note {
    font-size: 0.72rem;
    color: var(--placeholder);
    margin-top: 8px;
    line-height: 1.32;
    background: rgba(0,0,0,0.035);
    border-radius: 10px;
    padding: 7px 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.dashboard-card-note strong {
    color: var(--text);
}


/* Schritt 11: aktiver Zauber-Modus im Dashboard */
.dashboard-mode-card {
    margin: 0 15px 12px 15px;
    padding: 13px 15px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(107, 76, 154, 0.10), rgba(244, 168, 75, 0.12));
    border: 1px solid rgba(107, 76, 154, 0.18);
}
.dashboard-mode-card h3 {
    margin: 2px 0 4px 0;
    font-size: 1rem;
    color: var(--text);
}
.dashboard-mode-card p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--placeholder);
    line-height: 1.35;
}
.dashboard-mode-eyebrow {
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary);
    font-weight: 800;
}


/* Schritt 11b: Zauber-Modus als expliziten Ansichtsmodus darstellen */
#generator-btn.magic-active {
    background: linear-gradient(135deg, var(--primary), #4d3574);
}
.dashboard-mode-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}
.dashboard-mode-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.dashboard-mode-btn {
    appearance: none;
    border: 1px solid rgba(107, 76, 154, 0.22);
    background: rgba(255,255,255,0.72);
    color: var(--primary);
    border-radius: 12px;
    padding: 9px 10px;
    font-weight: 800;
    font-size: 0.75rem;
    min-height: 38px;
    flex: 1;
    box-shadow: none;
}
.dashboard-mode-btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.dashboard-mode-btn:active {
    transform: translateY(1px);
}


/* Schritt 11c Option 1: Hero-CTA im aktiven Zauber-Modus ausblenden.
   Die Modus-Steuerung liegt dann ausschliesslich in der Ergebnis-Toolbar. */
#generator-btn.is-hidden-while-magic-active {
    display: none !important;
}

.dashboard-mode-actions {
    align-items: center;
}


/* Kompakte, kontextsensitive Ergebnis-Summary im aktiven Zauber-Modus. */
.dashboard-mode-summary-block {
    margin-top: 10px;
}
.dashboard-mode-summary-label {
    color: var(--text);
    font-size: 0.74rem;
    font-weight: 800;
    margin-bottom: 5px;
}
.dashboard-mode-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.dashboard-mode-summary span {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(107, 76, 154, 0.12);
    color: var(--placeholder);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.1;
}
.dashboard-mode-summary b {
    color: var(--text);
    margin-right: 3px;
}

/* Schritt 12: Lager als Aktions-Treiber */
.lager-section-label {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--placeholder);
    margin-bottom: 8px;
    padding-left: 5px;
    text-transform: uppercase;
}

.lager-tabs {
    display: flex;
    gap: 8px;
    margin: 4px 0 10px;
    padding: 3px;
    background: var(--grey-box);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.lager-tab {
    flex: 1;
    height: 36px;
    border-radius: 9px;
    background: transparent;
    color: var(--placeholder);
    box-shadow: none;
    font-size: 0.72rem;
    gap: 6px;
}

.lager-tab span {
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    background: rgba(255,255,255,0.75);
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
}

.lager-tab.active {
    background: #fff;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.lager-hint {
    color: var(--placeholder);
    font-size: 0.82rem;
    line-height: 1.35;
    margin: 0 4px 12px;
}

.lager-item {
    align-items: stretch;
    gap: 10px;
    border-left-color: var(--success);
    padding: 10px 12px;
}

.lager-item.is-soon {
    border-left-color: var(--warning);
}

.lager-item.is-expired {
    border-left-color: var(--danger);
}

.lager-item-main {
    flex: 1;
    min-width: 0;
    cursor: pointer;
    padding: 2px 0;
}

.lager-item-title {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 5px;
}

.lager-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.lager-quantity {
    color: var(--text);
    font-weight: 800;
    font-size: 0.9rem;
}

.lager-expiry-badge {
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 0.68rem;
    font-weight: 800;
    background: var(--grey-box);
    color: var(--placeholder);
}

.lager-expiry-badge.soon,
.lager-expiry-badge.today {
    background: #fff3e8;
    color: var(--warning);
}

.lager-expiry-badge.expired {
    background: #fee2e2;
    color: var(--danger);
}

.lager-expiry-badge.ok {
    background: #eef7f1;
    color: var(--success);
}

.lager-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.lager-rescue-btn {
    height: 32px;
    width: auto;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--grey-box);
    color: var(--primary);
    box-shadow: none;
    font-size: 0.65rem;
    white-space: nowrap;
}

.lager-rescue-btn.is-urgent {
    background: var(--warning);
    color: #fff;
}

.lager-delete-btn {
    color: var(--danger);
    background: transparent;
    width: 34px;
    min-width: 34px;
    padding: 0;
    font-size: 1.05rem;
}

@media (max-width: 380px) {
    .lager-item {
        flex-direction: column;
    }
    .lager-item-actions {
        justify-content: space-between;
    }
    .lager-rescue-btn {
        flex: 1;
    }
}

/* Schritt 12d: Summary als Text, Lane-Chips als reine Navigation.
   Keine gemischten klickbaren/nicht-klickbaren Summary-Pillen mehr. */
.dashboard-mode-summary-text {
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.35;
    margin-top: 8px;
}
.dashboard-lane-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 10px;
}
.dashboard-lane-nav button {
    appearance: none;
    border: 1px solid rgba(107, 76, 154, 0.16);
    background: rgba(255, 255, 255, 0.74);
    color: var(--primary);
    border-radius: 999px;
    padding: 6px 10px;
    min-height: 30px;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    box-shadow: none;
}
.dashboard-lane-nav button::after {
    content: '›';
    margin-left: 5px;
    opacity: 0.65;
}
.dashboard-lane-nav button:active {
    transform: translateY(1px);
}

/* Schritt 13: Option 3 - Start-Hero und Ergebnis-Hero trennen */
.recipe-hero {
    margin: 20px 15px 28px;
    text-align: center;
    transition: background 0.2s ease, border-color 0.2s ease, padding 0.2s ease;
}
.recipe-hero h2 {
    margin: 0 0 12px 0;
    font-size: 1.35rem;
    line-height: 1.3;
    color: var(--text);
    text-wrap: balance;
}
.recipe-hero p {
    font-size: 0.95rem;
    color: var(--placeholder);
    margin: 0;
    line-height: 1.5;
    text-wrap: balance;
}
.recipe-hero .generator-area {
    margin: 26px 0 0;
    padding: 0;
}
.recipe-hero-result {
    text-align: left;
    padding: 14px 15px 15px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(107, 76, 154, 0.10), rgba(244, 168, 75, 0.12));
    border: 1px solid rgba(107, 76, 154, 0.18);
}
.recipe-hero-result h2 {
    margin-bottom: 5px;
    font-size: 1.18rem;
}
.recipe-hero-result p {
    font-size: 0.84rem;
    line-height: 1.35;
}
.recipe-hero-result .generator-area {
    margin-top: 12px;
}
.recipe-result-controls[hidden] {
    display: none !important;
}
.recipe-result-summary {
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.35;
    margin-top: 4px;
}
#scan-status {
    margin-top: 12px;
    font-size: 0.85rem;
    text-align: center;
    color: var(--placeholder);
}
.recipe-hero-result #scan-status {
    text-align: left;
}

/* Step 13b: sichtbarer Zustand bei bereits aktivem Rette-mich-Filter */
.rescue-filter-action,
.rescue-filter-active {
    width: 100%;
    height: 34px;
    padding: 0;
    font-size: 0.72rem;
    box-shadow: none;
}

.rescue-filter-action {
    background: var(--warning);
    color: #fff;
}

.rescue-filter-active,
.rescue-filter-active:disabled {
    background: rgba(83, 132, 111, 0.14);
    color: var(--success);
    border: 1px solid rgba(83, 132, 111, 0.28);
    cursor: default;
    opacity: 1;
}


/* --- Einkauf aus Rezeptkarten: sichtbares Feedback --- */
button.is-loading {
    opacity: 0.72;
    cursor: progress !important;
}

button.shopping-added,
button.shopping-added:hover {
    background: var(--success) !important;
    color: #fff !important;
    opacity: 0.95;
    cursor: default !important;
}

button.shopping-planned,
button.shopping-planned:hover {
    background: rgba(83, 132, 111, 0.14) !important;
    color: var(--success) !important;
    border: 1px solid rgba(83, 132, 111, 0.28);
    box-shadow: none !important;
}

.shopping-planned-inline {
    color: var(--success);
    font-weight: 850;
    white-space: nowrap;
}

/* Step 15: KI-Scanner Review-UX */
.scan-review-banner {
    margin: 0 0 14px 0;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.12);
    color: var(--text);
    line-height: 1.35;
}
.scan-review-banner strong {
    display: block;
    font-weight: 900;
    margin-bottom: 3px;
    color: #92400e;
}
.scan-review-banner span {
    display: block;
    font-size: 0.88rem;
    color: var(--muted, #6b7280);
}
body.scan-is-busy #scan-status {
    display: block;
    padding: 9px 12px;
    margin-top: 10px;
    border-radius: 12px;
    background: rgba(112, 74, 163, 0.08);
    font-weight: 800;
}
button.is-busy,
button:disabled.is-busy {
    opacity: 0.72;
    cursor: wait;
}


.dashboard-card-cooked {
    font-size: 0.7rem;
    color: var(--placeholder);
    font-weight: 700;
    margin-top: 3px;
}
.magic-factor-chip:nth-child(n) {
    white-space: nowrap;
}

/* Schritt 16c: Rezeptbibliothek zeigt Vorratsabdeckung und Kochhistorie stabil */
.recipe-list-status {
    margin-top: 2px;
    font-size: 0.72rem;
    color: var(--placeholder);
    font-weight: 750;
}
.availability-badge {
    min-width: 70px;
    white-space: nowrap;
}

/* --- Haushaltsprofil / Einstellungen --- */
.settings-hero h2 { margin: 0 0 6px; font-size: 1.35rem; }
.settings-hero p { margin: 0; color: var(--placeholder); font-size: 0.92rem; line-height: 1.45; }
.settings-form { display: flex; flex-direction: column; gap: 10px; padding-bottom: 70px; }
.settings-card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 15px rgba(107, 76, 154, 0.05);
    padding: 14px;
}
.settings-card label { display: block; font-weight: 850; color: var(--text); margin-bottom: 8px; }
.settings-card p { margin: 4px 0 0; color: var(--placeholder); font-size: 0.82rem; line-height: 1.35; }
.settings-help { margin-top: 8px !important; }
.settings-toggle-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.settings-toggle-row > div { flex: 1; min-width: 0; }
.settings-toggle-row input[type="checkbox"] { width: 24px; min-height: 24px; height: 24px; flex: 0 0 24px; accent-color: var(--primary); }
.settings-save-btn { width: 100%; background: var(--primary); color: #fff; height: 44px; }
.settings-status { min-height: 20px; color: var(--placeholder); font-size: 0.84rem; text-align: center; }
.settings-status-success { color: var(--success); font-weight: 800; }
.settings-status-danger { color: var(--danger); font-weight: 800; }

/* --- Schritt 17b: Header, global search and menu --- */
.app-header {
    gap: 8px;
}
.header-menu-wrap,
.header-actions {
    flex: 0 0 48px;
    display: flex;
    align-items: center;
}
.header-menu-wrap { justify-content: flex-start; position: relative; }
.header-actions { justify-content: flex-end; }
.header-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: var(--grey-box);
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
    box-shadow: none;
}
.header-icon-btn:hover,
.header-icon-btn:focus {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(107, 76, 154, 0.10);
}
.main-menu-popover {
    position: absolute;
    top: 46px;
    left: 0;
    min-width: 210px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(45, 40, 37, 0.16);
    padding: 8px;
    z-index: 1500;
}
.main-menu-popover[hidden] { display: none; }
.main-menu-item {
    width: 100%;
    height: 42px;
    justify-content: flex-start;
    background: transparent;
    color: var(--text);
    text-transform: none;
    font-size: 0.9rem;
    font-weight: 800;
    padding: 0 12px;
    border-radius: 10px;
}
.main-menu-item:hover,
.main-menu-item:focus {
    background: var(--grey-box);
    color: var(--primary);
    transform: none;
    box-shadow: none;
}
.main-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 4px;
}
.main-menu-logout { color: var(--danger); }
.main-nav button { font-size: 0.72rem; }

/* --- Schritt 17b: Haushaltsprofil Portionen --- */
.settings-portion-picker {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 2px 0 4px;
    scrollbar-width: none;
}
.settings-portion-picker::-webkit-scrollbar { display: none; }
.settings-portion-picker button {
    flex: 0 0 auto;
    min-width: 42px;
    height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--grey-box);
    color: var(--text);
    text-transform: none;
    font-size: 0.88rem;
    font-weight: 850;
}
.settings-portion-picker button.active,
.settings-portion-picker button[aria-pressed="true"] {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.settings-portion-input {
    margin-top: 10px;
}
.settings-portion-input[hidden] { display: none !important; }


/* --- Schritt 17c: Header-Zentrierung und Profil-Erklärtexte --- */
.app-header {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    align-items: center;
    gap: 8px;
}
.app-header .brand-header-main {
    grid-column: 2;
    justify-self: center;
    width: 100%;
    min-width: 0;
}
.app-header .header-menu-wrap {
    grid-column: 1;
    justify-self: start;
}
.app-header .header-actions {
    grid-column: 3;
    justify-self: end;
}
.settings-dynamic-help {
    margin-top: 8px !important;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--grey-box);
    border: 1px solid var(--border);
    color: var(--text) !important;
    font-size: 0.84rem !important;
}

/* Schritt 18e: ausgeschlossene Rette-mich-Karten ruhig und handlungsfähig */
.rescue-excluded-note {
    margin-top: 8px;
    padding: 8px 9px;
    border-radius: 11px;
    background: rgba(217, 119, 70, 0.10);
    border: 1px solid rgba(217, 119, 70, 0.18);
    color: var(--text);
    font-size: 0.74rem;
    line-height: 1.28;
}
.rescue-excluded-title {
    color: var(--warning);
    font-weight: 800;
    font-size: 0.74rem;
}
.rescue-excluded-count,
.rescue-muted-note {
    color: var(--placeholder);
    font-size: 0.71rem;
    margin-top: 3px;
}
.rescue-muted-note {
    margin-top: 5px;
    line-height: 1.3;
}
.rescue-override-action {
    background: var(--warning) !important;
    color: #fff !important;
    font-size: 0.75rem !important;
}
.rescue-excluded-pill {
    display: block;
    text-align: center;
    width: 100%;
    padding: 9px 10px;
    border-radius: 12px;
    background: rgba(217, 119, 70, 0.12);
    border: 1px solid rgba(217, 119, 70, 0.22);
    color: var(--warning);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}
.dashboard-exclusion-override {
    margin: 7px 0 10px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(217, 119, 70, 0.10);
    color: var(--text);
    font-size: 0.76rem;
    line-height: 1.35;
}

/* Schritt 21: Lager-Datumstyp (MHD vs. Verbrauchsdatum) */
.lager-date-type-toggle {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
    margin-bottom: 4px;
}
.lager-date-type-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}
.lager-date-type-toggle input[type="radio"] {
    width: 18px;
    min-height: 18px;
    height: 18px;
    padding: 0;
    margin: 0;
    accent-color: var(--success);
    flex-shrink: 0;
}

/* Barcode-Scanner Lager */
.barcode-modal-card {
    max-width: 380px;
}
.barcode-reader {
    width: 100%;
    min-height: 210px;
    border-radius: 14px;
    overflow: hidden;
    background: #111827;
    margin-top: 12px;
}
.barcode-status {
    margin-top: 10px;
    font-size: 0.82rem;
    line-height: 1.35;
    color: var(--placeholder);
    background: var(--grey-box);
    border-radius: 10px;
    padding: 10px 12px;
}
.barcode-status.is-loading {
    color: var(--primary);
}
.barcode-status.is-danger {
    color: var(--danger);
}


/* --- Globale Suche: gruppierte Ergebnisdarstellung --- */
.search-results-summary {
    margin: 0 0 14px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.search-results-summary strong {
    font-family: var(--font-head);
    font-size: 1rem;
    color: var(--text);
}
.search-results-summary span {
    font-size: 0.78rem;
    color: var(--placeholder);
    line-height: 1.35;
}
.search-result-section {
    margin: 0 0 16px;
}
.search-section-title {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 6px 0 8px;
    color: var(--placeholder);
    text-transform: uppercase;
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.45px;
}
.search-section-title em {
    margin-left: auto;
    font-style: normal;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.68rem;
    color: var(--primary);
}
.search-section-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.search-result-card {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 18px rgba(0,0,0,0.045);
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 68px;
}
.search-result-card.search-result-recipe { border-left: 4px solid var(--primary); cursor: pointer; }
.search-result-card.search-result-inventory { border-left: 4px solid var(--success); }
.search-result-card.search-result-shopping { border-left: 4px solid var(--warning); }
.search-result-thumb {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--grey-box);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--placeholder);
    font-size: 1.3rem;
}
.search-result-main {
    flex: 1;
    min-width: 0;
}
.search-result-kicker {
    color: var(--placeholder);
    text-transform: uppercase;
    font-size: 0.62rem;
    font-weight: 850;
    letter-spacing: 0.35px;
    margin-bottom: 2px;
}
.search-result-title {
    color: var(--text);
    font-weight: 850;
    font-size: 0.93rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.search-result-meta {
    color: var(--placeholder);
    font-size: 0.75rem;
    line-height: 1.25;
    margin-top: 3px;
}
.search-result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}
.search-result-tags span {
    font-size: 0.67rem;
    font-weight: 800;
    color: var(--success);
    background: rgba(92, 147, 119, 0.10);
    border-radius: 999px;
    padding: 3px 7px;
}
.search-result-tags span.search-availability {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 70px;
    height: 24px;
    padding: 0 8px;
    border: 1px solid currentColor;
    border-radius: 999px;
    background: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}
.search-result-tags span.search-availability.availability-full {
    color: var(--success);
    background: #fff;
}
.search-result-tags span.search-availability.availability-partial {
    color: var(--warning);
    background: #fff;
}
.search-result-tags span.search-availability.availability-none {
    color: var(--placeholder);
    background: #fff;
}
.search-result-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-self: stretch;
    justify-content: center;
    flex-shrink: 0;
}
.search-action-btn {
    height: 30px;
    min-width: 78px;
    padding: 0 10px;
    font-size: 0.66rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    box-shadow: none;
}
.search-action-btn.secondary {
    background: var(--grey-box);
    color: var(--primary);
}
.search-action-btn.success {
    background: var(--success);
    color: #fff;
}
.search-result-chevron {
    color: var(--placeholder);
    font-size: 1.4rem;
    font-weight: 300;
    padding-left: 2px;
}
.search-empty-state {
    margin-top: 24px;
    background: #fff;
    border: 1px dashed var(--border);
    border-radius: 18px;
    padding: 22px 16px;
    text-align: center;
    color: var(--placeholder);
}
.search-empty-icon { font-size: 2rem; margin-bottom: 8px; }
.search-empty-state h3 {
    font-family: var(--font-head);
    color: var(--text);
    margin: 0 0 6px;
    font-size: 1.2rem;
}
.search-empty-state p {
    margin: 0 auto 14px;
    font-size: 0.84rem;
    line-height: 1.35;
    max-width: 300px;
}
.search-empty-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}
.search-empty-actions .btn-secondary {
    justify-content: center;
    color: var(--primary);
    background: var(--grey-box);
}

/* Schritt 24b: Rezeptdetail-Kurzzusammenfassung */
.recipe-glance-box {
    margin: 0 0 14px;
    padding: 12px 13px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(107, 76, 154, 0.07), rgba(237, 195, 110, 0.08));
    border: 1px solid rgba(107, 76, 154, 0.12);
}
.recipe-glance-box h4 {
    margin: 0 0 6px;
    font-family: var(--font-heading);
    color: var(--text);
    font-size: 1rem;
}
.recipe-glance-box p {
    margin: 0;
    color: var(--text);
    font-size: 0.86rem;
    line-height: 1.45;
}
.recipe-glance-legend {
    margin: 0 0 8px;
    font-size: 0.8rem;
    line-height: 1.35;
}
.recipe-admin-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin: 18px 0 0;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.recipe-admin-actions button {
    height: 30px;
    padding: 0 10px;
    font-size: 0.7rem;
    color: var(--text);
    background: var(--grey-box);
    border: 1px solid var(--border);
    box-shadow: none;
}
.recipe-admin-actions .danger-action {
    color: var(--danger);
}



/* Schritt 26: Ersatzprodukte / Generika */

.ingredient-substitution-hint {
    margin: 3px 0 2px 0;
    padding-left: 0;
    color: var(--success);
    font-size: 0.76rem;
    line-height: 1.35;
}
.ingredient-substitution-note {
    display: block;
    color: var(--placeholder);
    font-weight: 400;
    margin-top: 2px;
}
.recipe-glance-box .ingredient-summary-line + p {
    margin-top: 8px;
}

.recipe-preparation {
    margin-top: 16px;
}
.recipe-preparation h4 {
    margin: 0 0 4px;
    font-family: var(--font-heading);
    color: var(--text);
    font-size: 1rem;
}
.recipe-preparation p {
    white-space: pre-wrap;
    line-height: 1.5;
    font-size: 0.9rem;
    margin: 0;
}
.ingredient-substitution-note {
    display: block;
    margin-top: 2px;
}


/* --- HILFE / INFO --- */
.help-hero {
    margin: 10px 15px 12px;
    padding: 18px 18px;
}
.help-hero h2 {
    margin: 0 0 6px;
    font-family: var(--font-serif);
    font-size: 1.25rem;
    color: var(--text);
}
.help-hero p {
    margin: 0;
    color: var(--placeholder);
    line-height: 1.35;
}
.help-card {
    margin: 10px 15px;
    padding: 15px 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}
.help-card h3 {
    margin: 0 0 7px;
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--text);
}
.help-card p {
    margin: 0;
    color: #5f5a55;
    font-size: 0.88rem;
    line-height: 1.45;
}
.help-card strong {
    color: var(--text);
}


/* Schritt 28: freundlichere Empty States */
.empty-state-rich {
    padding: 22px 18px;
    text-align: center;
    background: linear-gradient(180deg, #fff 0%, var(--grey-box) 100%);
}
.empty-state-icon,
.lane-empty-icon {
    font-size: 1.45rem;
    line-height: 1;
    margin-bottom: 8px;
}
.empty-state-rich h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    margin: 0 0 6px;
    color: var(--text);
}
.empty-state-rich p {
    margin: 0;
    color: var(--placeholder);
    font-size: 0.88rem;
    line-height: 1.4;
}
.empty-state-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 14px;
}
.empty-state-action {
    min-width: 152px;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 0.76rem;
    letter-spacing: 0.01em;
}
.empty-state-action.btn-empty-primary {
    background: var(--primary);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(107, 76, 154, 0.18);
}
.empty-state-action.btn-empty-secondary {
    background: #fff;
    color: var(--primary) !important;
    border: 1px solid rgba(107, 76, 154, 0.22);
}
.lane-empty-card {
    width: 100%;
    min-width: 240px;
    margin: 0;
    padding: 18px 16px;
    color: var(--placeholder);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    border-style: dashed;
    box-shadow: none;
}
.lane-empty-card strong {
    color: var(--text);
    font-family: var(--font-heading);
    font-size: 1rem;
}
.lane-empty-card span {
    font-size: 0.82rem;
    line-height: 1.35;
}


/* Schritt 31b: Lagerartikel als Grundstock markieren */
.lager-checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--grey-box);
    color: var(--text);
    font-weight: 750;
    font-size: 0.9rem;
}
.lager-checkbox-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--success);
}
.lager-grundstock-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(90, 139, 115, 0.10);
    border: 1px solid rgba(90, 139, 115, 0.22);
    color: var(--success);
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.2;
}

/* Sprint 33B: Cover-KI als klar beschriftete Buch-Aktion */
.book-cover-ai-actions {
    display: grid;
    gap: 6px;
    margin: -4px 0 15px;
}
.book-cover-ai-btn {
    width: 100%;
    min-height: 42px;
    height: auto;
    background: #f4efe8;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 12px;
    line-height: 1.15;
    text-align: center;
}
.book-cover-ai-actions small {
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.35;
}

/* Sprint 35 Hotfix: Internetquellen dezent und hexenküche-konform darstellen */
.internet-source-field .field-hint {
    display: block;
    margin-top: 6px;
    color: var(--placeholder);
    font-size: 0.78rem;
    line-height: 1.35;
}

.recipe-source-inline {
    color: var(--primary);
    font-weight: 800;
    text-decoration: none;
}

.recipe-source-inline:hover,
.recipe-source-inline:focus {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Sprint 36B: Rezeptdetail-Metadaten, Tags und Kochstatus */
.recipe-detail-meta-line {
    font-size: 0.8rem;
    color: var(--text);
    font-weight: 800;
    margin-bottom: 12px;
    line-height: 1.45;
}

.recipe-detail-timestamp {
    margin-top: 20px;
    font-size: 0.7rem;
    color: var(--placeholder);
    text-align: center;
}

.recipe-detail-meta-section {
    margin-top: 14px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.62);
}

.recipe-detail-meta-section h4 {
    margin: 0 0 8px;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    color: var(--text);
}

.recipe-detail-tag-group { margin-top: 8px; }
.recipe-detail-tag-group:first-of-type { margin-top: 0; }
.recipe-detail-tag-group-title { font-size: 0.68rem; font-weight: 850; color: var(--placeholder); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 5px; }
.recipe-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.recipe-detail-tag-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(107, 76, 154, 0.08);
    border: 1px solid rgba(107, 76, 154, 0.16);
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.25;
}
.recipe-detail-tag-main { background: rgba(112,158,237,0.12); border-color: rgba(112,158,237,0.30); color: var(--primary); }
.recipe-detail-tag-legacy { background: rgba(237,195,110,0.16); border-color: rgba(237,195,110,0.35); color: #8a5b00; }

.recipe-cook-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.recipe-cook-status-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    font-size: 0.82rem;
    color: var(--text);
    font-weight: 700;
}

.recipe-cook-status-text span + span {
    color: var(--placeholder);
    font-weight: 600;
    font-size: 0.76rem;
}

.recipe-reset-status-btn {
    flex-shrink: 0;
    height: 30px;
    padding: 0 10px;
    font-size: 0.7rem;
    color: var(--primary);
    background: var(--grey-box);
    border: 1px solid var(--border);
    box-shadow: none;
}

@media (max-width: 420px) {
    .recipe-cook-status-row {
        align-items: stretch;
        flex-direction: column;
    }
    .recipe-reset-status-btn {
        width: 100%;
    }
}

/* Sprint 36C: reduzierte Detail-Tags und Inline-Validierung für Internetquelle */
.recipe-detail-tags-text {
    margin: 0;
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.45;
}

.internet-source-field.has-error input {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(210, 74, 74, 0.12);
}

.internet-source-field .field-error {
    display: block;
    margin-top: 6px;
    color: var(--danger);
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.35;
}


/* Sprint 36E: gefüllte Terrakotta-Flächen immer mit weisser Schrift */
.toast-warning,
.recipe-detail-action.shopping-action,
.lager-rescue-btn.is-urgent,
.rescue-filter-action,
.rescue-override-action {
    color: #fff !important;
}

/* Sprint 37: Internet-Link-Import im Rezeptformular */
.internet-import-btn {
    margin-top: 10px;
    width: 100%;
    justify-content: center;
}

.internet-import-btn[disabled] {
    opacity: 0.65;
    cursor: wait;
}

.internet-import-status {
    display: block;
    margin-top: 8px;
    white-space: pre-line;
}

.internet-import-status.status-success {
    color: var(--success);
}

.internet-import-status.status-warning {
    color: var(--terracotta, #d97745);
}

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

.internet-import-status.status-primary {
    color: var(--primary);
}

/* Sprint 38: kontextbasierter FAB und Internet-Link-Import im Rezeptmodal */
.internet-import-panel {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(112, 77, 151, 0.04);
}

.internet-import-panel input {
    margin-top: 0 !important;
}

.internet-import-panel .field-hint {
    margin-top: 0;
    line-height: 1.4;
}

.internet-import-btn {
    margin-top: 4px;
    width: 100%;
    min-height: 42px;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    border-radius: 12px;
}

.internet-import-btn[disabled] {
    opacity: 0.72;
    cursor: wait;
}

.internet-import-status {
    display: block;
    margin-top: 2px;
    white-space: pre-line;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.78rem;
    line-height: 1.4;
    font-weight: 700;
    border: 1px solid transparent;
}

.internet-import-status.status-success {
    color: var(--success);
    background: rgba(95, 143, 97, 0.10);
    border-color: rgba(95, 143, 97, 0.22);
}

.internet-import-status.status-warning {
    color: var(--terracotta, #d97745);
    background: rgba(217, 119, 69, 0.10);
    border-color: rgba(217, 119, 69, 0.22);
}

.internet-import-status.status-danger {
    color: var(--danger);
    background: rgba(185, 77, 77, 0.10);
    border-color: rgba(185, 77, 77, 0.22);
}

.internet-import-status.status-primary {
    color: var(--primary);
    background: rgba(112, 77, 151, 0.10);
    border-color: rgba(112, 77, 151, 0.22);
}

/* Sprint 38B: Status-/Prüfhinweise nur sichtbar, wenn aktiv */

.internet-import-status[hidden] {
    display: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border-width: 0 !important;
}

.scan-review-banner[hidden] {
    display: none !important;
}

/* Sprint 39: FAB temporär links/rechts umschaltbar per Long-Press */
.fab {
    touch-action: manipulation;
}
.fab.fab--left {
    left: 25px;
    right: auto;
}
#fab-menu-modal.fab-menu-left {
    justify-content: flex-start;
}
#fab-menu-modal.fab-menu-right {
    justify-content: flex-end;
}
@media (max-width: 480px) {
    #fab-menu-modal.fab-menu-left,
    #fab-menu-modal.fab-menu-right {
        justify-content: center;
    }
}

/* Sprint 40: QR-Code als Link-Einstieg */
.internet-import-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 8px;
}

.internet-import-actions .internet-import-btn,
.internet-import-actions .internet-qr-btn {
    margin-top: 0;
    min-height: 42px;
    justify-content: center;
    border-radius: 12px;
}

.internet-qr-btn {
    background: var(--grey-box);
    color: var(--primary);
    border: 1px solid var(--border);
    box-shadow: none;
}

@media (max-width: 380px) {
    .internet-import-actions {
        grid-template-columns: 1fr;
    }
}

/* Sprint 40B: Live-QR-Scanner */
.qr-live-overlay {
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.qr-live-card {
    width: min(92vw, 420px);
    background: var(--card-bg, #fffaf4);
    border-radius: 22px;
    padding: 22px;
    box-shadow: 0 18px 60px rgba(0,0,0,0.24);
    color: var(--text);
}

.qr-live-card h3 {
    margin: 0 0 8px 0;
    text-align: center;
    font-family: var(--font-heading, inherit);
    color: var(--primary);
}

.qr-live-intro {
    margin: 0 0 16px 0;
    text-align: center;
    color: var(--muted, var(--placeholder));
    font-size: 0.95rem;
    line-height: 1.4;
}

.qr-video-frame {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 18px;
    background: #17151a;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.qr-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.qr-scan-frame {
    position: absolute;
    inset: 18%;
    border: 3px solid rgba(255,255,255,0.9);
    border-radius: 18px;
    box-shadow: 0 0 0 999px rgba(0,0,0,0.24);
}

.qr-scan-frame::before,
.qr-scan-frame::after {
    content: '';
    position: absolute;
    left: 12%;
    right: 12%;
    height: 2px;
    background: rgba(255,255,255,0.75);
}
.qr-scan-frame::before { top: 50%; }
.qr-scan-frame::after { display: none; }

.qr-live-status {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--grey-box);
    color: var(--text);
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
}

.qr-live-status.status-warning {
    background: rgba(224, 116, 77, 0.12);
    color: var(--warning);
    border: 1px solid rgba(224, 116, 77, 0.35);
}

.qr-live-status.status-danger {
    background: rgba(180, 48, 48, 0.12);
    color: var(--danger);
    border: 1px solid rgba(180, 48, 48, 0.32);
}

.qr-live-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.qr-live-actions .btn-secondary {
    min-height: 44px;
    border-radius: 12px;
}

@media (max-width: 380px) {
    .qr-live-actions {
        grid-template-columns: 1fr;
    }
}

/* Sprint 41: Duplikatvergleich */
.duplicate-modal-card {
    width: min(94vw, 680px);
}

.duplicate-compare-list {
    margin: 15px 0;
    max-height: min(65vh, 540px);
    overflow-y: auto;
    border: 1px solid var(--border);
    padding: 10px;
    border-radius: 14px;
    background: rgba(255,255,255,0.55);
}

.duplicate-compare-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items: stretch;
}

.duplicate-compare-pair + .duplicate-compare-pair {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.duplicate-compare-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card-bg, #fff);
    padding: 10px;
    min-width: 0;
}

.duplicate-compare-existing {
    border-left: 4px solid var(--grey, #9a948f);
}

.duplicate-compare-new {
    border-left: 4px solid var(--primary);
}

.duplicate-compare-label {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--placeholder);
    margin-bottom: 8px;
}

.duplicate-compare-head {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.duplicate-compare-image,
.duplicate-compare-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    flex: 0 0 auto;
    object-fit: cover;
    background: var(--soft-bg, #f4f1ed);
}

.duplicate-compare-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.duplicate-compare-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.duplicate-compare-title-wrap strong {
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.2;
}

.duplicate-compare-title-wrap span,
.duplicate-compare-muted {
    color: var(--placeholder);
    font-size: 0.78rem;
    line-height: 1.25;
}

.duplicate-compare-block {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}

.duplicate-compare-block > span {
    display: block;
    margin-bottom: 4px;
    color: var(--placeholder);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.duplicate-compare-block p {
    margin: 0;
    color: var(--text);
    font-size: 0.82rem;
    line-height: 1.35;
}

@media (max-width: 620px) {
    .duplicate-compare-pair {
        grid-template-columns: 1fr;
    }
}

/* Sprint 64: Taxonomie-Audit mobil lesbar halten */
.taxonomy-audit-card {
    margin-top: 12px;
    margin-bottom: 70px;
}

.taxonomy-audit-header {
    display: block;
    min-width: 0;
}

.taxonomy-audit-header h3 {
    margin: 0 0 5px;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    color: var(--text);
}

.taxonomy-audit-header p {
    max-width: 58ch;
}

.taxonomy-audit-action-scroller {
    margin-top: 14px;
    margin-inline: -2px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.taxonomy-audit-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: max-content;
    min-width: 100%;
    padding: 2px 2px 4px;
}

.taxonomy-audit-btn {
    flex: 0 0 auto;
    min-width: 112px;
    height: 38px;
    border-radius: 999px;
    text-transform: none;
    font-size: 0.78rem;
    font-weight: 850;
    white-space: nowrap;
}

.taxonomy-audit-status {
    margin-top: 12px;
}

.taxonomy-audit-status:empty {
    display: none;
}


.taxonomy-audit-filters {
    margin-top: 10px;
    display: grid;
    gap: 9px;
}

.taxonomy-audit-filters[hidden] {
    display: none;
}

.taxonomy-audit-search {
    display: grid;
    gap: 5px;
    max-width: 360px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
}

.taxonomy-audit-search input {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255,255,255,0.78);
    color: var(--text);
    padding: 0 14px;
    font: inherit;
    font-size: 0.86rem;
    outline: none;
}

.taxonomy-audit-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(111, 79, 154, 0.14);
}

.taxonomy-audit-filter-scroller {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    margin-inline: -2px;
}

.taxonomy-audit-filter-pills {
    display: flex;
    align-items: center;
    gap: 7px;
    width: max-content;
    min-width: 100%;
    padding: 2px 2px 5px;
}

.taxonomy-audit-filter-pill {
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255,255,255,0.72);
    color: var(--muted);
    padding: 8px 12px;
    font-size: 0.74rem;
    font-weight: 850;
    white-space: nowrap;
    cursor: pointer;
}

.taxonomy-audit-filter-pill.active,
.taxonomy-audit-filter-pill:hover,
.taxonomy-audit-filter-pill:focus-visible {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.taxonomy-audit-empty-card {
    border: 1px dashed var(--border);
    border-radius: 18px;
    background: rgba(255,255,255,0.62);
    padding: 14px;
    display: grid;
    gap: 4px;
    color: var(--muted);
}

.taxonomy-audit-empty-card strong {
    color: var(--text);
}

.taxonomy-audit-results {
    margin-top: 14px;
    max-width: 100%;
    overflow-x: hidden;
}


.taxonomy-progress-card {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255,255,255,0.92), var(--grey-box));
    padding: 14px;
    margin-bottom: 14px;
    box-shadow: 0 10px 26px rgba(28, 27, 24, 0.05);
}

.taxonomy-progress-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.taxonomy-progress-head strong {
    display: block;
    color: var(--text);
    font-size: 1rem;
    font-weight: 950;
}

.taxonomy-progress-head span {
    display: block;
    margin-top: 4px;
    color: var(--placeholder);
    font-size: 0.78rem;
    font-weight: 760;
}

.taxonomy-progress-head em {
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    padding: 5px 10px;
    font-size: 0.84rem;
    font-style: normal;
    font-weight: 950;
}

.taxonomy-progress-bar {
    height: 10px;
    margin-top: 12px;
    border-radius: 999px;
    background: rgba(28, 27, 24, 0.09);
    overflow: hidden;
}

.taxonomy-progress-bar span {
    display: block;
    height: 100%;
    min-width: 0;
    border-radius: inherit;
    background: var(--primary);
}

.taxonomy-progress-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.taxonomy-progress-stats div {
    border: 1px solid var(--border);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.72);
    padding: 9px 10px;
}

.taxonomy-progress-stats strong {
    display: block;
    color: var(--primary);
    font-size: 1.05rem;
    line-height: 1;
    font-weight: 950;
}

.taxonomy-progress-stats span {
    display: block;
    margin-top: 5px;
    color: var(--placeholder);
    font-size: 0.68rem;
    font-weight: 820;
    line-height: 1.15;
}

.taxonomy-progress-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 12px;
}

.taxonomy-progress-breakdown span {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid var(--border);
    color: var(--placeholder);
    padding: 5px 8px;
    font-size: 0.7rem;
    font-weight: 820;
}

.taxonomy-progress-breakdown strong {
    color: var(--text);
}

.taxonomy-audit-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

.taxonomy-audit-stat {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--grey-box);
    padding: 11px;
}

.taxonomy-audit-stat strong {
    display: block;
    font-size: 1.22rem;
    line-height: 1;
    color: var(--primary);
}

.taxonomy-audit-stat span {
    display: block;
    margin-top: 5px;
    color: var(--placeholder);
    font-size: 0.72rem;
    font-weight: 780;
    line-height: 1.18;
}

.taxonomy-audit-columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.taxonomy-audit-panel {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.74);
    padding: 12px;
    margin-top: 10px;
}

.taxonomy-audit-panel h4,
.taxonomy-audit-review summary span {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text);
    font-weight: 900;
}

.taxonomy-audit-panel h4 {
    margin-bottom: 10px;
}

.taxonomy-audit-list,
.taxonomy-audit-review-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.taxonomy-audit-candidate {
    border: 1px solid var(--border);
    border-radius: 15px;
    background: #fff;
    padding: 11px;
    box-shadow: 0 6px 18px rgba(28, 27, 24, 0.04);
}

.taxonomy-audit-candidate-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.taxonomy-audit-candidate-head strong {
    display: block;
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.15;
}

.taxonomy-audit-candidate-head span {
    display: block;
    margin-top: 3px;
    color: var(--placeholder);
    font-size: 0.72rem;
    font-weight: 760;
}

.taxonomy-audit-candidate-head em {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 4px 8px;
    background: var(--grey-box);
    color: var(--placeholder);
    font-size: 0.68rem;
    font-weight: 900;
    font-style: normal;
}

.taxonomy-confidence-high .taxonomy-audit-candidate-head em {
    background: rgba(39, 174, 96, 0.13);
    color: var(--success);
}

.taxonomy-confidence-medium .taxonomy-audit-candidate-head em {
    background: rgba(237, 195, 110, 0.20);
    color: #8a5b00;
}

.taxonomy-confidence-low .taxonomy-audit-candidate-head em {
    background: rgba(217, 119, 70, 0.13);
    color: var(--danger);
}

.taxonomy-audit-suggestion-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin: 10px 0 0;
}

.taxonomy-audit-suggestion-grid div {
    display: grid;
    grid-template-columns: 82px 1fr;
    gap: 8px;
    align-items: baseline;
    padding: 6px 8px;
    border-radius: 11px;
    background: var(--grey-box);
}

.taxonomy-audit-suggestion-grid dt,
.taxonomy-audit-suggestion-grid dd {
    margin: 0;
    font-size: 0.74rem;
    line-height: 1.25;
}

.taxonomy-audit-suggestion-grid dt {
    color: var(--placeholder);
    font-weight: 850;
}

.taxonomy-audit-suggestion-grid dd {
    color: var(--text);
    font-weight: 800;
}

.taxonomy-audit-candidate-suggestion {
    margin-top: 8px;
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 750;
}

.taxonomy-audit-warning,
.taxonomy-audit-empty,
.taxonomy-audit-more,
.taxonomy-audit-note {
    margin: 8px 0 0;
    color: var(--placeholder);
    font-size: 0.74rem;
    line-height: 1.38;
}

.taxonomy-audit-warning {
    padding: 8px 9px;
    border-radius: 12px;
    background: rgba(237, 195, 110, 0.15);
    color: #6d520f;
}

.taxonomy-audit-examples-block {
    margin-top: 10px;
}

.taxonomy-audit-example-label {
    display: block;
    margin-bottom: 5px;
    color: var(--placeholder);
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.taxonomy-audit-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.taxonomy-audit-examples span {
    display: inline-flex;
    max-width: 100%;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(107, 76, 154, 0.07);
    color: var(--primary);
    font-size: 0.69rem;
    line-height: 1.15;
    font-weight: 780;
}

.taxonomy-audit-review {
    display: block;
}

.taxonomy-audit-review summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    list-style: none;
}

.taxonomy-audit-review summary::-webkit-details-marker {
    display: none;
}

.taxonomy-audit-review summary em {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 4px 8px;
    background: var(--grey-box);
    color: var(--placeholder);
    font-size: 0.68rem;
    font-weight: 850;
    font-style: normal;
}

.taxonomy-audit-review-list {
    margin-top: 10px;
}

.taxonomy-audit-review-list li {
    border: 1px solid var(--border);
    border-radius: 13px;
    background: #fff;
    padding: 9px;
}

.taxonomy-audit-review-list strong {
    display: block;
    color: var(--text);
    font-size: 0.82rem;
    line-height: 1.22;
}

.taxonomy-audit-review-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 7px;
}

.taxonomy-audit-review-chips span {
    border-radius: 999px;
    padding: 4px 7px;
    background: var(--grey-box);
    color: var(--placeholder);
    font-size: 0.68rem;
    font-weight: 780;
    line-height: 1.1;
}


.taxonomy-audit-panel,
.taxonomy-audit-candidate,
.taxonomy-audit-candidate-head,
.taxonomy-audit-suggestion-grid,
.taxonomy-audit-examples,
.taxonomy-audit-review-list li {
    min-width: 0;
}

.taxonomy-audit-suggestion-grid dd,
.taxonomy-audit-examples span,
.taxonomy-audit-review-list strong {
    overflow-wrap: anywhere;
}

@media (max-width: 979px) {
    .taxonomy-audit-columns {
        display: flex;
        flex-direction: column;
    }

    .taxonomy-audit-panel {
        width: 100%;
    }

    .taxonomy-audit-suggestion-grid div {
        grid-template-columns: 1fr;
        gap: 3px;
        align-items: start;
    }

    .taxonomy-audit-suggestion-grid dt {
        font-size: 0.68rem;
    }

    .taxonomy-audit-suggestion-grid dd {
        font-size: 0.78rem;
        line-height: 1.2;
    }
}

@media (max-width: 520px) {
    .taxonomy-audit-card {
        margin-left: -2px;
        margin-right: -2px;
    }

    .taxonomy-audit-action-scroller {
        margin-top: 12px;
        margin-inline: -6px;
        padding-inline: 6px;
    }

    .taxonomy-audit-header-actions {
        min-width: max-content;
        padding-bottom: 6px;
    }

    .taxonomy-audit-btn {
        min-width: max-content;
        height: 34px;
        padding-inline: 13px;
        font-size: 0.72rem;
    }

    .taxonomy-audit-search {
        max-width: none;
    }

    .taxonomy-audit-filter-scroller {
        margin-inline: -6px;
        padding-inline: 6px;
    }

    .taxonomy-audit-filter-pills {
        min-width: max-content;
    }

    .taxonomy-audit-filter-pill {
        padding-inline: 11px;
        font-size: 0.71rem;
    }

    .taxonomy-progress-card {
        padding: 12px;
        border-radius: 16px;
    }

    .taxonomy-progress-head {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
    }

    .taxonomy-progress-head em {
        align-self: flex-start;
    }

    .taxonomy-progress-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .taxonomy-audit-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .taxonomy-audit-stat {
        padding: 9px 8px;
        border-radius: 12px;
    }

    .taxonomy-audit-stat strong {
        font-size: 1.05rem;
    }

    .taxonomy-audit-stat span {
        font-size: 0.65rem;
    }

    .taxonomy-audit-panel {
        padding: 10px;
        border-radius: 15px;
    }

    .taxonomy-audit-candidate {
        padding: 10px;
    }

    .taxonomy-audit-candidate-head {
        gap: 8px;
    }
}

@media (min-width: 521px) {
    .taxonomy-audit-summary {
        grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
    }
}

@media (min-width: 980px) {
    .taxonomy-audit-columns { grid-template-columns: 1fr; }
    .taxonomy-audit-suggestion-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* Sprint 65: Sichere Taxonomie-Migration */
.taxonomy-migration-panel {
    margin-top: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(107, 76, 154, 0.045);
    padding: 12px;
}

.taxonomy-migration-panel h4 {
    margin: 0 0 5px;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 900;
}

.taxonomy-migration-panel p {
    margin: 0;
    color: var(--placeholder);
    font-size: 0.76rem;
    line-height: 1.35;
}

.taxonomy-migration-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.taxonomy-migration-execute-btn {
    min-height: 38px;
    border-radius: 999px;
    padding: 0 14px;
    font-size: 0.76rem;
    font-weight: 850;
    white-space: normal;
    line-height: 1.15;
}

.taxonomy-migration-results {
    margin-top: 10px;
}

.taxonomy-migration-result-head {
    border-radius: 13px;
    background: #fff;
    border: 1px solid var(--border);
    padding: 10px;
}

.taxonomy-migration-result-head strong,
.taxonomy-migration-result-head span {
    display: block;
}

.taxonomy-migration-result-head strong {
    color: var(--text);
    font-size: 0.88rem;
}

.taxonomy-migration-result-head span {
    margin-top: 4px;
    color: var(--placeholder);
    font-size: 0.74rem;
    line-height: 1.3;
    font-weight: 760;
}

.taxonomy-migration-by-tag {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.taxonomy-migration-by-tag span {
    display: block;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--border);
    padding: 8px 9px;
    color: var(--text);
    font-size: 0.76rem;
    line-height: 1.3;
}

.taxonomy-migration-by-tag strong {
    color: var(--primary);
}

.taxonomy-migration-details {
    margin-top: 8px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--border);
    padding: 9px;
}

.taxonomy-migration-details summary {
    cursor: pointer;
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 850;
}

.taxonomy-migration-details ul {
    list-style: none;
    margin: 9px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.taxonomy-migration-details li {
    border-radius: 10px;
    background: var(--grey-box);
    padding: 7px 8px;
}

.taxonomy-migration-details li strong,
.taxonomy-migration-details li span {
    display: block;
}

.taxonomy-migration-details li strong {
    color: var(--text);
    font-size: 0.75rem;
    line-height: 1.22;
}

.taxonomy-migration-details li span {
    margin-top: 3px;
    color: var(--placeholder);
    font-size: 0.7rem;
    line-height: 1.25;
}

@media (max-width: 520px) {
    .taxonomy-migration-actions {
        flex-direction: column;
    }

    .taxonomy-migration-actions .taxonomy-audit-btn,
    .taxonomy-migration-execute-btn {
        width: 100%;
    }
}


/* Mobile Suche: konsolidierter Vollbild-Modus */
#search-panel .search-content,
#search-panel #search-overlay-results {
    min-height: 0;
}

#search-panel .search-hint-row {
    background: transparent !important;
    min-height: 0 !important;
    margin: 0 15px 8px !important;
    padding: 0 2px !important;
    border-radius: 0 !important;
}

#search-panel #search-dynamic-hint {
    font-size: 0.74rem !important;
    color: var(--text-muted) !important;
    line-height: 1.35 !important;
}

#search-panel.has-query:not(.has-filters) .search-hint-row {
    display: none !important;
}

#search-panel.has-query.has-filters #search-dynamic-hint {
    display: none !important;
}

@media (max-width: 700px), (hover: none) and (pointer: coarse) {
    #search-backdrop.active {
        top: 0;
        z-index: 1001;
    }

    #search-panel.active,
    #search-panel.keyboard-active {
        position: fixed;
        top: var(--search-panel-mobile-top, 0);
        left: 0;
        right: 0;
        height: var(--search-panel-mobile-height, 100dvh);
        max-height: var(--search-panel-mobile-height, 100dvh);
        z-index: 1002;
        border-bottom: none;
        border-radius: 0;
        box-shadow: none;
        background: var(--bg-app);
        overscroll-behavior: contain;
    }

    #search-panel .search-input-area,
    #search-panel.keyboard-active .search-input-area {
        padding: max(10px, env(safe-area-inset-top)) 10px 8px !important;
        border-bottom: 0 !important;
        background: var(--bg-app);
        flex-shrink: 0;
    }

    #search-panel .mobile-search-close,
    #search-panel.keyboard-active .mobile-search-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 38px;
        width: 38px;
        height: 38px;
        margin-right: 6px;
        border: 1px solid var(--border);
        border-radius: 999px;
        background: white;
        color: var(--text);
        font-size: 1.8rem;
        line-height: 1;
        font-weight: 500;
        padding: 0 0 3px;
    }

    #search-panel .search-input-wrap {
        min-width: 0;
    }

    #search-panel .search-input,
    #search-panel.keyboard-active .search-input {
        height: 44px !important;
        border-radius: 12px !important;
        font-size: 0.95rem !important;
    }

    #search-panel .search-hint-row,
    #search-panel.keyboard-active .search-hint-row {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin: 0 15px 8px !important;
        padding: 0 2px !important;
        flex-shrink: 0;
    }

    #search-panel.has-query:not(.has-filters) .search-hint-row,
    #search-panel.keyboard-active.has-query:not(.has-filters) .search-hint-row {
        display: none !important;
    }

    #search-panel .search-tabs,
    #search-panel.keyboard-active .search-tabs {
        display: flex !important;
        gap: 8px !important;
        padding: 0 15px 10px !important;
        overflow-x: auto !important;
        border-bottom: 1px solid var(--border) !important;
        align-items: center !important;
        flex-shrink: 0;
        scrollbar-width: none;
    }

    #search-panel .search-tabs::-webkit-scrollbar {
        display: none;
    }

    #search-panel .search-tab {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    #search-panel .search-tags-container,
    #search-panel.keyboard-active .search-tags-container {
        display: flex !important;
        flex-direction: column !important;
        border-bottom: 1px solid var(--border) !important;
        background: #fafafa !important;
        flex: 0 0 auto;
    }

    #search-panel #search-category-row,
    #search-panel.keyboard-active #search-category-row,
    #search-panel #search-tag-row,
    #search-panel.keyboard-active #search-tag-row {
        display: flex !important;
        gap: 8px !important;
        overflow-x: auto !important;
        scrollbar-width: none;
    }

    #search-panel #search-category-row,
    #search-panel.keyboard-active #search-category-row {
        padding: 10px 15px !important;
    }

    #search-panel #search-tag-row,
    #search-panel.keyboard-active #search-tag-row {
        padding: 0 15px 10px !important;
    }

    #search-panel #search-category-row::-webkit-scrollbar,
    #search-panel #search-tag-row::-webkit-scrollbar {
        display: none;
    }

    #search-panel #search-category-row .category-btn,
    #search-panel.keyboard-active #search-category-row .category-btn,
    #search-panel #search-tag-row .tag-chip,
    #search-panel.keyboard-active #search-tag-row .tag-chip {
        padding: 6px 12px !important;
        font-size: 0.75rem !important;
    }

    #search-panel .search-content,
    #search-panel.keyboard-active .search-content {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    #search-panel #search-overlay-results,
    #search-panel.keyboard-active #search-overlay-results {
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
        max-height: none;
        overflow-y: auto;
        padding: 12px 15px max(22px, env(safe-area-inset-bottom)) !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    #search-panel .search-results-summary,
    #search-panel.keyboard-active .search-results-summary {
        margin-bottom: 10px;
        padding: 10px 12px;
    }

    #search-panel .search-result-section,
    #search-panel.keyboard-active .search-result-section {
        margin-bottom: 12px;
    }

    #search-panel .search-section-title,
    #search-panel.keyboard-active .search-section-title {
        margin: 4px 0 7px;
    }

    #search-panel .search-result-card,
    #search-panel.keyboard-active .search-result-card {
        min-height: 64px;
        padding: 10px;
        gap: 10px;
        border-radius: 16px;
    }

    #search-panel .search-result-thumb,
    #search-panel.keyboard-active .search-result-thumb {
        width: 48px;
        height: 48px;
    }

    #search-panel.keyboard-active .search-result-tags {
        display: flex;
    }
}

.taxonomy-audit-example-btn {
    display: inline-flex;
    max-width: 100%;
    border: 0;
    border-radius: 999px;
    padding: 5px 8px;
    background: rgba(107, 76, 154, 0.07);
    color: var(--primary);
    font: inherit;
    font-size: 0.69rem;
    line-height: 1.15;
    font-weight: 780;
    cursor: pointer;
    text-align: left;
    overflow-wrap: anywhere;
}

.taxonomy-audit-example-btn:hover,
.taxonomy-audit-example-btn:focus-visible {
    background: rgba(107, 76, 154, 0.14);
    outline: none;
}

/* Sprint 66p: Arbeitsliste für alte/unklare Tags im Taxonomie-Audit */
.taxonomy-audit-help {
    margin: 9px 0 0;
    color: var(--placeholder);
    font-size: 0.76rem;
    line-height: 1.42;
}

.taxonomy-legacy-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 12px;
}

.taxonomy-legacy-counts span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    border-radius: 999px;
    padding: 5px 8px;
    background: rgba(237, 195, 110, 0.16);
    color: #6d520f;
    font-size: 0.7rem;
    font-weight: 820;
    line-height: 1.12;
}

.taxonomy-legacy-counts strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--text);
    font-size: 0.66rem;
    line-height: 1;
}

.taxonomy-chip-legacy {
    background: rgba(237, 195, 110, 0.18) !important;
    color: #6d520f !important;
}

.taxonomy-chip-unknown {
    background: rgba(217, 119, 70, 0.14) !important;
    color: var(--danger) !important;
}

.taxonomy-legacy-review-list li {
    border-color: rgba(237, 195, 110, 0.42);
}

/* Sprint 66s: Taxonomie-Audit Erfolgszustand */
.taxonomy-audit-success {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 2px 0 14px;
    padding: 12px 14px;
    border: 1px solid rgba(39, 174, 96, 0.24);
    border-radius: 16px;
    background: rgba(39, 174, 96, 0.09);
    color: var(--text);
}

.taxonomy-audit-success strong {
    color: var(--success);
    font-size: 0.92rem;
    font-weight: 900;
    line-height: 1.2;
}

.taxonomy-audit-success span {
    color: var(--text);
    font-size: 0.76rem;
    font-weight: 720;
    line-height: 1.35;
}

@media (max-width: 520px) {
    .taxonomy-audit-success {
        padding: 11px 12px;
        border-radius: 14px;
    }
}

/* Sprint 67c: Plausibilitätsfälle im Taxonomie-Audit */
.taxonomy-plausibility-review-list li {
    border-color: rgba(112, 158, 237, 0.38);
}

.taxonomy-plausibility-issue {
    margin-top: 8px;
    padding: 8px;
    border-radius: 11px;
    background: rgba(112, 158, 237, 0.08);
}

.taxonomy-plausibility-issue:first-child {
    margin-top: 7px;
}

.taxonomy-plausibility-issue > strong {
    color: var(--primary);
    font-size: 0.76rem;
}

.taxonomy-plausibility-issue p {
    margin: 6px 0 0;
    color: var(--placeholder);
    font-size: 0.72rem;
    line-height: 1.35;
}

.taxonomy-plausibility-counts span {
    background: rgba(112, 158, 237, 0.13);
    color: var(--primary);
}

/* Sprint 68a: KI-gestützter Taxonomie-Vorschlag */
.modal-taxonomy-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 15px;
}
.modal-taxonomy-header label {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--placeholder);
    text-transform: uppercase;
}
.btn-taxonomy-ai {
    border: 1px solid rgba(112,158,237,0.45);
    background: rgba(112,158,237,0.12);
    color: var(--primary);
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 0.72rem;
    font-weight: 850;
    cursor: pointer;
}
.btn-taxonomy-ai:disabled {
    opacity: 0.65;
    cursor: wait;
}
.taxonomy-suggestion-panel {
    padding: 8px 15px 0;
}
.taxonomy-suggestion-card {
    border: 1px solid rgba(112,158,237,0.28);
    background: rgba(112,158,237,0.08);
    border-radius: 16px;
    padding: 12px;
    color: var(--text);
}
.taxonomy-suggestion-title {
    font-weight: 900;
    color: var(--primary);
    margin-bottom: 4px;
}
.taxonomy-suggestion-card p {
    margin: 0 0 10px;
    color: var(--placeholder);
    font-size: 0.78rem;
    line-height: 1.35;
}
.taxonomy-suggestion-list {
    display: grid;
    gap: 6px;
}
.taxonomy-suggestion-row {
    display: grid;
    grid-template-columns: minmax(110px, 0.36fr) 1fr;
    gap: 8px;
    align-items: start;
    font-size: 0.8rem;
}
.taxonomy-suggestion-row span {
    color: var(--placeholder);
    font-weight: 800;
}
.taxonomy-suggestion-row strong {
    color: var(--text);
    font-weight: 800;
}

.taxonomy-diff-row {
    border: 1px solid rgba(112,158,237,0.18);
    background: rgba(255,255,255,0.42);
    border-radius: 13px;
    padding: 9px 10px;
}
.taxonomy-diff-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}
.taxonomy-diff-label {
    color: var(--primary);
    font-weight: 900;
    font-size: 0.78rem;
}
.taxonomy-diff-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--placeholder);
    font-size: 0.72rem;
    font-weight: 850;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.taxonomy-diff-toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}
.taxonomy-diff-row-sensitive {
    border-color: rgba(237,195,110,0.45);
    background: rgba(237,195,110,0.10);
}
.taxonomy-diff-values {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.taxonomy-diff-values div {
    min-width: 0;
}
.taxonomy-diff-values span {
    display: block;
    color: var(--placeholder);
    font-weight: 850;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 2px;
}
.taxonomy-diff-values strong {
    display: block;
    color: var(--text);
    font-weight: 850;
    font-size: 0.82rem;
    line-height: 1.28;
    overflow-wrap: anywhere;
}
.taxonomy-suggestion-save-note {
    margin-top: 10px !important;
    color: var(--placeholder) !important;
    font-size: 0.76rem !important;
}
.taxonomy-suggestion-empty {
    color: var(--placeholder);
    font-size: 0.8rem;
}
.taxonomy-suggestion-notes {
    margin: 10px 0 0;
    padding-left: 18px;
    color: var(--placeholder);
    font-size: 0.78rem;
    line-height: 1.35;
}
.taxonomy-suggestion-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}
.taxonomy-suggestion-actions button {
    flex: 1;
    border: none;
    border-radius: 12px;
    padding: 10px;
    font-weight: 850;
}
.taxonomy-suggestion-actions button:not(.btn-secondary) {
    background: var(--primary);
    color: white;
}

@media (max-width: 520px) {
    .modal-taxonomy-header {
        align-items: flex-start;
        flex-direction: column;
    }
    .btn-taxonomy-ai {
        width: 100%;
    }
    .taxonomy-suggestion-row {
        grid-template-columns: 1fr;
        gap: 2px;
    }
    .taxonomy-diff-values {
        grid-template-columns: 1fr;
    }
    .taxonomy-suggestion-actions {
        flex-direction: column;
    }
}

.taxonomy-audit-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 10px;
}

.taxonomy-audit-action-row .taxonomy-audit-edit-btn,
.taxonomy-audit-action-row .taxonomy-audit-ai-btn {
    flex: 0 0 auto;
}

.taxonomy-audit-ai-btn,
.taxonomy-audit-example-ai-btn {
    border-color: rgba(112, 158, 237, 0.45);
    background: rgba(112, 158, 237, 0.10);
}

.taxonomy-audit-example-actions {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
    max-width: 100%;
}

.taxonomy-audit-example-ai-btn {
    border: 1px solid rgba(112, 158, 237, 0.45);
    border-radius: 999px;
    padding: 4px 7px;
    font-size: 0.68rem;
    font-weight: 850;
    color: var(--text);
    cursor: pointer;
}

@media (max-width: 520px) {
    .taxonomy-audit-action-row {
        justify-content: stretch;
    }
    .taxonomy-audit-action-row .taxonomy-audit-edit-btn,
    .taxonomy-audit-action-row .taxonomy-audit-ai-btn {
        flex: 1 1 140px;
    }
}

/* Sprint 68f: Audit-Rückkehr visuell bestätigen */
.taxonomy-audit-review-list li.taxonomy-audit-next,
.taxonomy-audit-list li.taxonomy-audit-next {
    border-color: rgba(112, 158, 237, 0.7);
    box-shadow: 0 10px 28px rgba(112, 158, 237, 0.16);
    background: linear-gradient(180deg, rgba(112, 158, 237, 0.08), #fff 42%);
}

.taxonomy-audit-next-label {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin: 0 0 7px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(112, 158, 237, 0.14);
    color: var(--primary);
    font-size: 0.68rem;
    font-weight: 900;
    line-height: 1.1;
}

/* Sprint 68g: KI-Taxonomie-Review Validierungshinweise */
.taxonomy-suggestion-warnings {
    margin-top: 10px;
    border: 1px solid rgba(237, 195, 110, 0.55);
    background: rgba(237, 195, 110, 0.12);
    border-radius: 12px;
    padding: 9px 10px;
    color: var(--text);
    font-size: 0.78rem;
    line-height: 1.35;
}
.taxonomy-suggestion-warnings strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text);
    font-weight: 900;
}
.taxonomy-suggestion-warnings ul {
    margin: 0;
    padding-left: 18px;
}
.taxonomy-suggestion-warnings li + li {
    margin-top: 3px;
}

/* Sprint 68i: Taxonomie-Audit Review-Status */
.taxonomy-review-status-panel {
    margin: 8px 15px 0;
    padding: 12px;
    border: 1px solid rgba(112, 158, 237, 0.25);
    border-radius: 14px;
    background: rgba(112, 158, 237, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.taxonomy-review-status-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--text);
}

.taxonomy-review-status-copy strong {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--primary);
}

.taxonomy-review-status-copy span {
    color: var(--placeholder);
}

.taxonomy-review-done-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.taxonomy-review-done-btn:disabled {
    opacity: 0.65;
    cursor: default;
}

@media (max-width: 640px) {
    .taxonomy-review-status-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .taxonomy-review-done-btn {
        width: 100%;
    }
}

.taxonomy-reviewed-panel {
    border-style: dashed;
}

.taxonomy-reviewed-list .taxonomy-reviewed-item {
    align-items: flex-start;
}

.taxonomy-reviewed-meta {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.85rem;
    color: var(--muted-text, #667085);
}

.taxonomy-reviewed-note {
    margin: 0.45rem 0 0;
    padding: 0.55rem 0.7rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.72);
    color: var(--text, #1f2937);
    font-size: 0.9rem;
}

.taxonomy-reviewed-actions {
    flex-wrap: wrap;
}

.taxonomy-review-reset-btn {
    border-color: rgba(185, 28, 28, 0.24);
    color: #991b1b;
}

.taxonomy-reviewed-chips span {
    background: rgba(34, 197, 94, 0.12);
}

@media (max-width: 640px) {
    .taxonomy-reviewed-actions {
        width: 100%;
    }

    .taxonomy-reviewed-actions button {
        flex: 1 1 100%;
    }
}
