/* --- 1. VARIABLES & THEMES (Basis für Light & Dark Mode) --- */
:root {
    /* Light Mode (Standard) */
    --primary: #10b981;
    --primary-light: #d1fae5;
    --primary-text: #065f46;
    
    --bg-app: #f9fafb;        /* Hintergrund der gesamten App */
    --bg-surface: #ffffff;    /* Hintergrund von Karten/Boxen/Nav */
    --bg-input: #ffffff;      /* Hintergrund Eingabefelder */
    --bg-alt: #f3f4f6;        /* Alternativer Hintergrund (grau) */
    
    --text-main: #1f2937;     /* Haupttext (fast schwarz) */
    --text-muted: #6b7280;    /* Nebentext (dunkelgrau) */
    --text-light: #9ca3af;    /* Heller Text (hellgrau) */
    
    --border: #e5e7eb;        /* Rahmenfarbe */
    --danger: #ef4444;        /* Rot für Löschen/Fehler */
    --danger-bg: #fef2f2;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-card: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-up: 0 -2px 10px rgba(0,0,0,0.03);
}

/* Dark Mode Override */
[data-theme="dark"] {
    --primary: #34d399;       /* Helleres Grün für Kontrast */
    --primary-light: #064e3b; /* Dunkles Grün Hintergrund */
    --primary-text: #ecfdf5;  /* Heller Text auf Grün */
    
    --bg-app: #111827;        /* Fast Schwarz */
    --bg-surface: #1f2937;    /* Dunkelgrau Karten */
    --bg-input: #374151;      /* Eingabefelder */
    --bg-alt: #374151;        /* Alternativer Hintergrund */
    
    --text-main: #f9fafb;     /* Fast Weiß */
    --text-muted: #d1d5db;    /* Helles Grau */
    --text-light: #9ca3af;
    
    --border: #374151;        /* Dunkle Ränder */
    --danger: #f87171;
    --danger-bg: #450a0a;
    
    --shadow-sm: none;        
    --shadow-card: 0 4px 6px -1px rgba(0,0,0,0.3);
    --shadow-up: 0 -2px 10px rgba(0,0,0,0.5);
}

/* --- 2. GLOBAL RESET & APP SHELL --- */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0; padding: 0; width: 100%; height: 100%; height: var(--sra-viewport-height, 100dvh);
    overflow: hidden; 
    background: var(--bg-app); 
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    position: fixed; top: 0; left: 0; /* Anti-Bounce Fix für iOS */
    transition: background 0.3s, color 0.3s;
}

.sra-app { display: flex; flex-direction: column; height: 100%; width: 100%; position: relative; background: var(--bg-app); }

.sra-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Verteilt Elemente links/mitte/rechts */
    height: 50px; /* Oder deine Höhe */
    padding: 0 10px; /* 10px Abstand links und rechts vom Bildschirmrand */
    background: var(--bg-surface); /* Deine Hintergrundfarbe */
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Der Titel in der Mitte */
.sra-header h1 {
    flex: 1; /* Nimmt allen freien Platz */
    text-align: center; /* Zentriert den Text */
    margin: 0;
    font-size: 16px; /* Oder deine Größe */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Die Buttons links und rechts (Einheitliche Größe für Symmetrie) */
.header-btn-placeholder {
    width: 40px; /* Feste Breite */
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Links: Inhalt linksbündig */
}

.header-btn-right {
    width: 40px; /* Feste Breite */
    display: flex;
    align-items: center;
    justify-content: flex-end; /* Rechts: Zahnrad klebt rechts */
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding: 0;
}

/* Content (Scrollbar) */
.sra-content {
    min-height: 0;
    touch-action: pan-y;
    overscroll-behavior-y: contain;
    flex: 1; overflow-y: auto; padding: 15px;
    padding-bottom: calc(90px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch; width: 100%;
}

/* Navigation (Fixed Bottom) */
.sra-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    display: flex; z-index: 1000;
    height: 60px; 
    height: calc(60px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: var(--shadow-up);
}
.sra-nav a { 
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; 
    text-decoration: none; color: var(--text-light); font-weight: 500; cursor: pointer; 
      font-size: 9px; /* Vorher 10px, etwas kleiner damit 6 Items passen */
    padding: 0 2px; /* Weniger Padding an den Seiten */

}
.sra-nav a.active { color: var(--primary); }
.sra-nav .dashicons { font-size: 24px; margin-bottom: 4px; }

/* Theme Toggle Button */
#theme-toggle-btn {
    background: var(--bg-input); border: 1px solid var(--border); color: var(--text-main);
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 18px;
}

/* --- 3. INPUTS & BUTTONS --- */

input, select, textarea { 
    width: 100%; padding: 12px 14px; 
    border: 1px solid var(--border); border-radius: 10px; 
    background: var(--bg-input); color: var(--text-main);
    margin-bottom: 12px; font-size: 16px; 
    -webkit-appearance: none; appearance: none;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
button:focus-visible, a:focus-visible, [role="button"]:focus-visible,
[role="link"]:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--primary-text);
    outline-offset: 3px;
}
.sra-modal:focus { outline: none; }
.sra-step-dragging { opacity: .75; }
.shop-item.save-failed { outline: 1px solid var(--danger); outline-offset: 2px; }

.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }

.btn-primary { background: var(--primary); color: #fff; border: none; padding: 14px; width: 100%; border-radius: 10px; font-weight: 600; font-size: 16px; text-align: center; display: inline-block; cursor: pointer;}
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); padding: 12px; width: 100%; border-radius: 10px; font-weight: 600; margin-top: 5px; text-align: center; cursor: pointer;}
.btn-small { padding: 8px 14px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-surface); color: var(--text-main); font-size: 13px; cursor: pointer;}
.btn-text { background:none; border:none; padding: 8px; font-size: 20px; color: var(--text-main); display:flex; align-items:center; justify-content:center; cursor: pointer;}
.btn-xs { padding: 4px 8px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 4px; color: var(--text-muted); font-size: 11px; cursor: pointer;}
.text-red { color: var(--danger) !important; }

/* --- 4. FEED & CARDS --- */

.sra-box { background: var(--bg-surface); border-radius: 16px; padding: 16px; margin-bottom: 16px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.sra-box h3 { margin:0 0 12px 0; font-size:13px; font-weight: 700; text-transform:uppercase; color: var(--text-muted); letter-spacing: 0.5px; }

.sra-card { 
    background: var(--bg-surface); border-radius: 16px; padding: 16px; margin-bottom: 12px; 
    display: flex; flex-direction: column; align-items: flex-start; gap: 8px; 
    box-shadow: var(--shadow-card); border: 1px solid var(--border);
    position: relative; transition: transform 0.1s; cursor: pointer;
}
.sra-card:active { transform: scale(0.98); background-color: var(--bg-alt); }

.feed-title { margin: 0; font-size: 18px; font-weight: 800; color: var(--text-main); line-height: 1.3; }
.feed-subtitle { font-size: 13px; color: var(--primary); font-weight: 600; margin-top: -4px; }
.feed-meta-row { display: flex; gap: 10px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); width: 100%; font-size: 12px; color: var(--text-light); }
.meta-item { display: flex; align-items: center; gap: 4px; }

.card-icon-floating { position: absolute; top: 16px; right: 16px; font-size: 20px; opacity: 0.3; }

/* Badges */
.feed-badges-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.feed-badge { 
    font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px; 
    display: inline-flex; align-items: center; 
    background: var(--bg-alt); border: 1px solid var(--border); color: var(--text-muted);
}
.badge-device { background: #fffbeb; color: #b45309; border-color: #fcd34d; }
[data-theme="dark"] .badge-device { background: #451a03; color: #fcd34d; border-color: #78350f; }
.badge-variant { background: var(--primary-light); color: var(--primary-text); border: none; }
.badge-author { background: var(--bg-input); color: var(--text-muted); border: 1px solid var(--border); }

/* --- 5. REZEPT DETAILS (Steps) --- */

.step-view { display: flex; gap: 15px; margin-bottom: 20px; position: relative; }
.step-num { 
    font-weight: 800; background: var(--primary); color: #fff; 
    width: 32px; height: 32px; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; 
    font-size: 14px; flex-shrink: 0; z-index: 2; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.step-body { 
    background: var(--bg-surface); border: 1px solid var(--border); 
    border-radius: 0 16px 16px 16px; padding: 16px; flex: 1; box-shadow: var(--shadow-sm);
}
.step-body p { color: var(--text-main); margin: 0; line-height: 1.6; font-size: 15px; }
.step-view:not(:last-child)::after { 
    content: ''; position: absolute; top: 32px; left: 15px; 
    width: 2px; height: calc(100% + 15px); background: var(--border); z-index: 1; 
}
.step-badge { font-size: 11px; padding: 3px 8px; border-radius: 6px; background: var(--primary-light); color: var(--primary-text); font-weight: 600; margin-right: 5px; display:inline-block; margin-bottom: 5px;}

/* --- 6. SHOPPING LIST & DASHBOARD --- */

/* Karte (Row Layout) */
.sra-card.shopping-card { flex-direction: row; align-items: center; justify-content: space-between; padding: 14px 16px; gap: 15px; }
.shopping-card .card-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.shopping-card .card-body { display: flex; flex-direction: column; }
.shopping-card h3 { font-size: 16px; margin-bottom: 4px; color: var(--text-main); margin-top:0; }
.meta { color: var(--text-muted); font-size: 12px; }

.sra-create-list-trigger { width: auto; min-height: 44px; margin-bottom: 16px; }
.sra-create-list-dialog.sra-modal-content { max-width: 480px; }
.sra-create-list-dialog h3 { padding-inline-end: 44px; }
.sra-create-list-dialog .modal-close-icon { width: 44px; height: 44px; top: 12px; right: 12px; }
.sra-create-list-dialog .form-group { margin: 12px 0; }
.sra-create-list-dialog label { display: block; margin-bottom: 4px; }
.sra-create-list-dialog input, .sra-create-list-dialog select { width: 100%; min-height: 44px; }
.sra-create-list-dialog .modal-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 8px; }
.sra-create-list-dialog .modal-actions button { min-height: 44px; overflow-wrap: anywhere; }
#new-list-share-help, #new-list-status { font-size: 0.875rem; margin: 6px 0; }
#new-list-share-help { color: var(--text-muted); }
.sra-create-list-suggestions { max-height: 180px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.sra-create-list-suggestions p { margin: 0; padding: 8px; font-size: 0.875rem; }
.new-list-user-option, .new-list-remove-user { background: var(--bg-alt); color: var(--text-main); border: 0; min-height: 44px; cursor: pointer; }
.new-list-user-option { display: block; width: 100%; padding: 6px 10px; text-align: start; overflow-wrap: anywhere; }
.new-list-user-option + .new-list-user-option { border-top: 1px solid var(--border); }
.new-list-user-option:hover, .new-list-remove-user:hover { color: var(--primary); }
.sra-create-list-people { display: grid; gap: 4px; margin: 8px 0 0; padding: 0; list-style: none; }
.sra-create-list-people[hidden] { display: none; }
.sra-create-list-people li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-inline-start: 10px; border-radius: 8px; background: var(--bg-alt); overflow-wrap: anywhere; }
.new-list-remove-user { flex: 0 0 44px; border-radius: 8px; }

/* Filter Tabs */
.filter-tabs { display: flex; background: var(--bg-alt); padding: 4px; border-radius: 12px; margin-bottom: 20px; border: 1px solid var(--border); }
.filter-tab { flex: 1; text-align: center; padding: 8px; font-size: 13px; font-weight: 600; border-radius: 8px; color: var(--text-muted); text-decoration: none; }
.filter-tab.active { background: var(--bg-surface); color: var(--primary); box-shadow: var(--shadow-sm); }

/* List Items */
.shop-item { display:flex; align-items:center; gap:12px; padding:14px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; transition: background .2s, opacity .2s; }
.shop-item.unchecked { border-left: 4px solid var(--primary); }
.shop-item.checked { border-left: 4px solid var(--border); background: var(--bg-alt); opacity: 0.85; }
.shop-item.is-saving { opacity:0.5; pointer-events:none; }
.item-check-toggle { display:flex; align-items:center; }
.item-check-toggle input { appearance:none; width:22px; height:22px; border:2px solid var(--border); border-radius:6px; background:var(--bg-surface); cursor:pointer; position:relative; }
.item-check-toggle input:checked { background:var(--primary); border-color:var(--primary); }
.item-check-toggle input:checked::after { content:'✓'; position:absolute; color:#fff; font-size:14px; top:-1px; left:4px; }
.item-body { flex:1; min-width:0; }
.item-title { font-size:15px; font-weight:600; color:var(--text-main); margin-bottom:4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.item-qty-input { width:100%; border:1px solid var(--border); border-radius:8px; padding:6px 10px; font-size:13px; background:var(--bg-input); }
.item-price-box { display:flex; align-items:center; gap:6px; }
.item-price-box .currency { font-size:12px; color:var(--text-muted); }
.item-price-input { width:80px; border:1px solid var(--border); border-radius:8px; padding:6px 8px; font-size:13px; text-align:right; background:var(--bg-input); }
.item-actions button { border:none; background:transparent; font-size:18px; cursor:pointer; color:var(--danger); }
.price-tag { background: var(--primary-light); color: var(--primary-text); padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: bold; margin-top: 4px; display: inline-block; }

.cost-preview { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.cost-badge { font-size: 10px; background: var(--bg-alt); color: var(--text-muted); border: 1px solid var(--border); padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.shop-list-items { display:flex; flex-direction:column; }
.list-block { margin-bottom:15px; }

.shopping-actions-box { margin-bottom: 16px; }
.shopping-actions-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.action-chip {
    min-height: 42px;
    margin: 0;
    border-radius: 10px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.action-chip--close {
    border-color: var(--primary);
    color: var(--primary);
    background: linear-gradient(180deg, var(--bg-surface) 0%, var(--primary-light) 100%);
}
.action-chip--scan {
    border-color: var(--text-main);
    background: var(--text-main);
    color: var(--bg-surface);
}
.action-chip--pantry {
    background: var(--bg-alt);
}
.action-chip--disabled {
    opacity: 0.65;
    cursor: not-allowed;
}
.shopping-action-hint {
    display: block;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

.shopping-quickadd-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.shopping-quickadd-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    box-shadow: var(--shadow-sm);
}
.shopping-quickadd-card--payment {
    background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-alt) 100%);
}
.shopping-quickadd-head {
    margin-bottom: 10px;
}
.shopping-quickadd-head h4 {
    margin: 0;
    font-size: 14px;
    color: var(--text-main);
}
.shopping-quickadd-head p {
    margin: 3px 0 0;
    font-size: 12px;
    color: var(--text-muted);
}
.shopping-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.shopping-input-row input { margin: 0; }
.shopping-input-row--item input {
    flex: 1;
    min-width: 180px;
}
.shopping-inline-btn {
    margin: 0;
    width: auto;
    min-height: 42px;
    padding: 0 16px;
}
.shopping-input-stack {
    display: grid;
    gap: 8px;
}
.shopping-field-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}
.shopping-input-stack input {
    margin: 0;
}
.shopping-payment-btn {
    margin: 2px 0 0;
    width: 100%;
    min-height: 42px;
}

@media (max-width: 640px) {
    .shopping-actions-row {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 900px) {
    .shopping-quickadd-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.list-block {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    box-shadow: var(--shadow-sm);
}
.list-block-title {
    margin: 2px 2px 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}
.shop-list-items { gap: 8px; }
.shop-item { margin-bottom: 0; gap: 10px; padding: 12px; border-radius: 10px; }
.shop-item.unchecked { border-left-width: 3px; }
.shop-item.checked { border-left-width: 3px; opacity: 1; }
.item-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.item-qty-input { margin-bottom: 0; }
.item-price-box {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 3px 8px;
}
.item-price-input {
    border: none;
    background: transparent;
    margin: 0;
    width: 72px;
    padding: 4px 0;
}
.item-price-input:focus { border: none; }
.item-check-toggle input[disabled] { opacity: 0.55; cursor: not-allowed; }
.cost-legend {
    margin-top: 12px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-alt);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.cost-legend[hidden], .cost-pill[hidden] { display: none; }
.sra-list-members { margin-top: 8px; }
.sra-list-members summary { min-height: 44px; display: list-item; align-content: center; cursor: pointer; font-weight: 600; }
.sra-list-members-content { color: var(--text-muted); font-size: .875rem; }
.sra-list-share-roster { list-style: none; margin: 0; padding: 0; }
.sra-list-share-roster li { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; padding: 4px 0; border-top: 1px solid var(--border); }
.sra-list-share-roster strong { display: block; color: var(--text-main); overflow-wrap: anywhere; }
.sra-list-unshare, .sra-item-write-feedback button { min-height: 44px; }
.sra-list-share-feedback { margin: 8px 0 0; font-size: .875rem; }
.sra-item-write-feedback { flex: 1 0 100%; padding: 8px 0 0; font-size: .875rem; color: var(--text-main); }
.sra-item-write-feedback > div { display: flex; gap: 8px; flex-wrap: wrap; }
.shop-item:has(.sra-item-write-feedback) { flex-wrap: wrap; }
.cost-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-surface);
}

#receipt-review-modal { bottom: auto; height: var(--sra-viewport-height, 100dvh); }
#receipt-review-modal .receipt-dialog {
    display: flex;
    flex-direction: column;
    width: min(720px, calc(100% - 24px));
    max-width: none;
    max-height: min(760px, calc(var(--sra-viewport-height, 100dvh) - 24px));
    padding: 0;
    overflow: hidden;
}
.receipt-dialog-header, .receipt-dialog-footer { padding: 12px 16px; }
.receipt-dialog-header h3 { margin: 0 0 8px; }
.receipt-dialog-body { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 16px 12px; }
.receipt-dialog-footer { border-top: 1px solid var(--border); }
.receipt-dialog-footer .modal-actions { display: flex; gap: 8px; }
.receipt-dialog-footer button { min-height: 44px; }
.receipt-dialog-footer .btn-primary { flex: 1; }
.receipt-summary-head { border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; background: var(--bg-alt); }
.summary-total-line { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
#receipt-summary-printed, #receipt-readability, #receipt-scan-status, #receipt-adjustments { font-size: 0.875rem; color: var(--text-muted); }
#receipt-readability, #receipt-summary-difference, #receipt-review-feedback, #receipt-scan-status { margin: 5px 0 0; }
#receipt-summary-difference, #receipt-review-feedback { font-size: 0.875rem; color: var(--text-main); }
#receipt-review-feedback:empty { display: none; }
#receipt-confirm-difference:not([hidden]) { display: flex; align-items: center; gap: 8px; min-height: 44px; }
#receipt-confirm-partial { width: auto; margin: 0; accent-color: var(--primary); }
#receipt-adjustments { margin: 4px 0 12px; }
#receipt-adjustments summary { min-height: 44px; line-height: 44px; cursor: pointer; color: var(--text-main); }
#receipt-adjustments ul { padding-inline-start: 16px; }
#receipt-adjustments li { padding: 4px 0; overflow-wrap: anywhere; }
#receipt-adjustments select { width: 100%; margin: 4px 0 8px; min-height: 44px; }
#scan-review-area { display: grid; gap: 8px; }
.receipt-row-heading, .receipt-row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.receipt-row-heading > label, .receipt-row-actions > label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.receipt-row-heading strong, .receipt-row-actions button { overflow-wrap: anywhere; }
.receipt-row-heading input, .receipt-row-actions input { width: auto; margin: 0; accent-color: var(--primary); }
.receipt-row-note, .receipt-row-actions, .receipt-review-fields > label { color: var(--text-muted); font-size: 0.875rem; }
.receipt-review-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(80px, .7fr); gap: 8px; align-items: end; }
.receipt-review-fields .db-mapper { grid-column: 1 / -1; }
.receipt-review-fields input, .receipt-review-fields button, .receipt-row-actions button, .receipt-row-actions select { min-height: 44px; max-width: 100%; }
.receipt-review-fields input { margin: 2px 0 0; }
.receipt-row-actions .receipt-assign { white-space: normal; text-align: start; }
@media (min-width: 560px) {
    .receipt-review-fields { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(100px, .7fr); }
    .receipt-review-fields .db-mapper { grid-column: auto; }
}

/* --- 7. STATISTIK (Die fehlten vorher) --- */
.stat-month-card { 
    display: flex; justify-content: space-between; align-items: center;
    background: var(--bg-surface); padding: 15px; border-radius: 12px; margin-bottom: 8px;
    border: 1px solid var(--border); cursor: pointer;
}
.stat-month-card strong { color: var(--text-main); }
.stat-bar-bg { height: 6px; background: var(--bg-alt); border-radius: 3px; width: 100%; margin-top: 5px; overflow: hidden; }
.stat-bar-fill { height: 100%; background: var(--primary); border-radius: 3px; }
.stat-detail-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text-main); }

/* --- 8. MODALS --- */
.sra-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 2000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.sra-modal-content { background: var(--bg-surface); width: 92%; max-width: 360px; padding: 24px; border-radius: 16px; max-height: min(85vh, calc(var(--sra-viewport-height, 100dvh) - 30px)); overflow-y: auto; position: relative; color: var(--text-main); box-shadow: var(--shadow-up); }
.sra-modal-content.slide-up { position: absolute; bottom: 0; width: 100%; max-width: 100%; border-radius: 20px 20px 0 0; padding-bottom: calc(30px + env(safe-area-inset-bottom)); }
.sra-cook-open { width: auto; min-height: 44px; margin-bottom: 16px; }
.sra-cook-dialog.sra-modal-content { display: flex; flex-direction: column; max-width: 560px; overflow: hidden; padding: 16px clamp(16px, 4vw, 24px); }
.sra-cook-dialog header { padding-inline-end: 48px; }
.sra-cook-dialog h3 { margin: 0 0 14px; }
.sra-cook-dialog .modal-close-icon { width: 44px; height: 44px; top: 8px; right: 8px; }
.sra-cook-step { min-height: 0; overflow: auto; padding-block: 4px 12px; scroll-padding-block: 8px; }
.sra-cook-step h4 { margin: 0 0 12px; }
.sra-cook-ingredients { margin: 0 0 12px; padding-inline-start: 1.2em; }
.sra-cook-instruction { line-height: 1.55; font-size: clamp(1rem, 3vw, 1.25rem); white-space: pre-wrap; overflow-wrap: anywhere; }
.sra-cook-dialog footer { border-top: 1px solid var(--border); padding-top: 8px; }
.sra-offline-row-status { color: var(--text-muted); font-size: .8rem; }
.sra-offline-row-status button { min-height: 32px; }
.sra-cook-timer summary { display: list-item; cursor: pointer; padding: 10px 0; }
.sra-cook-timer > div { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding-bottom: 8px; }
.sra-cook-timer label { display: flex; align-items: center; gap: 6px; }
.sra-cook-timer input { width: 4.6rem; }
.sra-cook-timer-status:not(:empty) { flex-basis: 100%; }
.sra-cook-controls { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.sra-cook-controls button { min-height: 48px; }
.modal-close-icon { position: absolute; top: 16px; right: 16px; background: var(--bg-alt); border: none; width: 32px; height: 32px; border-radius: 50%; color: var(--text-muted); display:flex; align-items:center; justify-content:center; cursor: pointer;}

/* Modal Internals */
.toggle-row { background: var(--bg-alt); padding: 4px; border-radius: 10px; display: flex; gap: 0; }
.toggle-btn { background: transparent; border: none; padding: 10px; border-radius: 8px; color: var(--text-muted); font-weight: 500; flex: 1; font-size: 14px; cursor: pointer;}
.toggle-btn.active { background: var(--bg-surface); color: var(--primary); box-shadow: var(--shadow-sm); }

.list-select-item { padding: 16px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; color: var(--text-main); cursor: pointer;}
.list-select-item:hover { border-color: var(--primary); }
.list-select-item small { color: var(--text-muted); }

.sra-recipe-list-dialog h3 { padding-inline-end: 44px; }
.sra-recipe-list-dialog .modal-close-icon { width: 44px; height: 44px; top: 12px; right: 12px; }
.sra-recipe-list-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-block: 10px; }
.sra-recipe-list-modes button { min-height: 44px; margin: 0; padding: 7px 8px; color: var(--primary-text); overflow-wrap: anywhere; }
.sra-recipe-list-modes button[aria-pressed="true"] { background: var(--primary-light); border-color: var(--primary-text); }
.sra-recipe-list-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(84px, 110px);
    gap: 8px;
    align-items: center;
    padding-block: 4px;
    border-bottom: 1px solid var(--border);
}
.sra-recipe-list-check { display: flex; gap: 8px; align-items: center; min-height: 44px; overflow-wrap: anywhere; cursor: pointer; }
.sra-recipe-list-check input[type="checkbox"] { flex: 0 0 18px; width: 18px; height: 18px; padding: 0; margin: 0; appearance: auto; accent-color: var(--primary-text); }
.sra-recipe-list-check small { display: block; margin-top: 2px; color: var(--text-muted); font-size: 0.78rem; }
.sra-recipe-list-row input[type="text"] { min-width: 0; min-height: 44px; margin: 0; padding: 8px; text-align: start; }
.sra-recipe-list-row.is-unselected input[type="text"] { background: var(--bg-alt); }
#recipe-list-selection-status, #recipe-list-error { font-size: 0.875rem; margin-block: 10px; }
#recipe-list-selection-status { color: var(--text-muted); }
#recipe-list-error { color: #9f1239; }
[data-theme="dark"] #recipe-list-error { color: #fda4af; }
.sra-recipe-list-dialog :is(.list-select-item, #btn-create-list-modal) {
    width: 100%;
    min-height: 44px;
    gap: 8px;
    text-align: start;
    overflow-wrap: anywhere;
}
.sra-recipe-list-dialog :is(.list-select-item, #btn-create-list-modal):disabled { cursor: default; }

/* User Search */
.user-suggestions, .ing-suggestions { background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-main); position: absolute; width: 100%; z-index: 100; box-shadow: var(--shadow-card); border-radius: 8px; margin-top: 5px; max-height: 200px; overflow-y: auto; }
.user-sugg-item, .sugg-item { padding: 12px; border-bottom: 1px solid var(--border); cursor: pointer; color: var(--text-main); }
.user-sugg-item:hover, .sugg-item:hover { background: var(--bg-alt); }

/* --- 9. CREATE HELPER --- */
.step-row { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; display: flex; margin-bottom: 10px; overflow: hidden; }
.handle { background: var(--bg-alt); color: var(--text-light); padding: 10px; display: flex; align-items: center; cursor: grab; width: 40px; justify-content: center; touch-action: none; user-select: none; }
.row-del { color: var(--danger); display: flex; align-items: center; padding: 10px; cursor: pointer; border-left: 1px solid var(--border); width: 40px; justify-content: center; }
.step-desc { border: none; margin: 0; background: transparent; resize: none; color: var(--text-main); }
.step-desc:focus { border: none; box-shadow: none; }

.sra-recipe-variant-dialog.sra-modal-content { max-width: 420px; }
.sra-recipe-variant-dialog h3 { margin: 0 0 8px; }
.sra-recipe-variant-dialog p { margin: 0 0 16px; color: var(--text-muted); line-height: 1.5; }
.sra-recipe-variant-actions { display: grid; gap: 8px; }
.sra-recipe-variant-actions button {
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 10px 12px;
    font: inherit;
    font-weight: 600;
    overflow-wrap: anywhere;
}
.sra-recipe-variant-actions .btn-primary { color: var(--text-main); }
[data-theme="dark"] .sra-recipe-variant-actions .btn-primary { color: var(--bg-app); }
.sra-recipe-variant-actions .btn-outline { color: var(--primary-text); border-color: currentColor; }

.sra-recipe-conflict-warning > p { margin: 0; }
.sra-recipe-conflict-dialog.sra-modal-content { max-width: 620px; display: flex; flex-direction: column; overflow: hidden; }
.sra-recipe-conflict-dialog h3 { margin: 0 0 12px; padding-inline-end: 44px; }
.sra-recipe-conflict-dialog .modal-close-icon { width: 44px; height: 44px; top: 12px; right: 12px; }
#recipe-conflict-status { margin: 4px 0; color: var(--text-muted); }
#recipe-conflict-comparison { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
#recipe-conflict-comparison:focus-visible { outline: 2px solid var(--primary-text); outline-offset: -2px; }
.sra-recipe-conflict-field { padding: 8px 0 12px; border-bottom: 1px solid var(--border); }
.sra-recipe-conflict-field h4 { margin: 0 0 8px; font-size: 0.94rem; }
.sra-recipe-conflict-versions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sra-recipe-conflict-version { min-width: 0; padding: 8px 10px; border-radius: 8px; background: var(--bg-alt); }
.sra-recipe-conflict-version:last-child { background: var(--primary-light); color: var(--primary-text); }
.sra-recipe-conflict-version strong { font-size: 0.81rem; }
.sra-recipe-conflict-version p { margin: 4px 0 0; font-size: 0.94rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.sra-recipe-conflict-check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 0.875rem; cursor: pointer; }
.sra-recipe-conflict-check input[type="checkbox"] { flex: 0 0 18px; width: 18px; height: 18px; padding: 0; margin: 0; appearance: auto; accent-color: var(--primary-text); }
.sra-recipe-conflict-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.sra-recipe-conflict-actions[hidden] { display: none; }
.sra-recipe-conflict-actions p { grid-column: 1 / -1; margin: 0; font-size: 0.81rem; color: var(--text-muted); }
.sra-recipe-conflict-actions button { min-height: 44px; margin: 0; padding: 8px; overflow-wrap: anywhere; }
.sra-recipe-conflict-actions .btn-primary { color: var(--text-main); }
[data-theme="dark"] .sra-recipe-conflict-actions .btn-primary { color: var(--bg-app); }
.sra-recipe-conflict-actions .btn-outline { color: var(--primary-text); }
@media (max-width: 520px) {
    .sra-recipe-conflict-versions, .sra-recipe-conflict-actions { grid-template-columns: minmax(0, 1fr); }
}

:is(.step-row.sra-step-review, .sra-recipe-review-summary) {
    --sra-review-bg: #fffbeb;
    --sra-review-border: #a15c07;
    --sra-review-text: #78350f;
    --sra-review-pulse-bg: #fef3c7;
    --sra-review-pulse-border: #b45309;
    background: var(--sra-review-bg);
    border-color: var(--sra-review-border);
}
[data-theme="dark"] :is(.step-row.sra-step-review, .sra-recipe-review-summary) {
    --sra-review-bg: #302210;
    --sra-review-border: #d7a34c;
    --sra-review-text: #fde68a;
    --sra-review-pulse-bg: #433216;
    --sra-review-pulse-border: #fbbf24;
}
.step-row.sra-step-review { scroll-margin-block: 12px; }
.step-row.sra-step-review .step-content { flex: 1; min-width: 0; }
.sra-step-review-note,
.sra-recipe-review-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    color: var(--sra-review-text);
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.sra-step-review-note { margin: 4px 10px 10px; }
.sra-recipe-review-summary {
    padding: 8px 12px;
    margin-bottom: 10px;
    border: 1px solid var(--sra-review-border);
    border-radius: 8px;
}
.sra-step-review-note[hidden], .sra-recipe-review-summary[hidden] { display: none; }
.sra-step-review-done,
.sra-recipe-review-summary :is(a, button) {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    min-width: 0;
    width: auto;
    margin: 0;
    padding: 6px 10px;
    border: 1px solid var(--sra-review-border);
    border-radius: 8px;
    background: var(--bg-surface);
    color: var(--sra-review-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
@media (prefers-reduced-motion: no-preference) {
    .step-row.sra-step-review.sra-step-review-pulse { animation: sra-step-review-highlight 1.35s ease-in-out 2; }
}
@keyframes sra-step-review-highlight {
    50% { background-color: var(--sra-review-pulse-bg); border-color: var(--sra-review-pulse-border); }
}
@media (forced-colors: active) {
    .step-row.sra-step-review, .sra-recipe-review-summary { background: Canvas; border-color: CanvasText; }
    .step-row.sra-step-review.sra-step-review-pulse { animation: none; }
    .sra-step-review-note, .sra-recipe-review-summary { color: CanvasText; }
    .sra-step-review-done, .sra-recipe-review-summary :is(a, button) {
        background: ButtonFace;
        border-color: ButtonText;
        color: ButtonText;
    }
}

/* Check Ingredients Modal */
.check-item { margin-bottom: 10px; padding: 10px; background: var(--bg-alt); border: 1px solid var(--border); border-radius:4px; color: var(--text-main); }
.opt-btn { font-size: 12px; padding: 6px 10px; border: 1px solid var(--border); background: var(--bg-surface); cursor: pointer; border-radius: 4px; margin-right:5px; margin-top:5px; color: var(--text-muted); }
.opt-btn.selected { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Ingredient Selection (Step Modal) */
.step-modal-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ing-select-btn { background: var(--bg-alt); border: 1px solid var(--border); padding: 15px; border-radius: 8px; cursor: pointer; color: var(--text-main); }
.ing-select-btn small { color: var(--text-muted); display: block; }

/* Device Tiles */
.device-select-item input { display:none; }
.device-select-item span { 
    display:inline-block; padding:10px 14px; 
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius:20px; font-size:13px; font-weight: 500; color: var(--text-muted);
    cursor:pointer; margin-bottom: 6px; 
}
.device-select-item input:checked + span { background: var(--primary); color: #fff; border-color: var(--primary); }
/* --- FAVORITES --- */
.btn-toggle-fav {
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.btn-toggle-fav.active {
    color: #e11d48 !important; /* Kräftigeres Rot für Favoriten */
    transform: scale(1.2);
}
.btn-toggle-fav:active {
    transform: scale(0.9);
}

/* WICHTIG: Wrapper muss relative sein, damit absolute Kinder sich daran orientieren */
.ing-input-wrapper {
    position: relative;
    width: 100%;
}

.ing-suggestions {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-main);
    position: absolute;
    top: 100%; /* Direkt unter dem Input */
    left: 0;
    width: 100%;
    z-index: 1000; /* Sehr hoch, damit es über allem liegt */
    box-shadow: var(--shadow-card);
    border-radius: 8px;
    margin-top: 2px;
    max-height: 200px;
    overflow-y: auto;
    display: none; /* Standardmäßig ausgeblendet */
}

/* Damit das Inputfeld im Wrapper gut aussieht */
.ing-input-wrapper input {
    margin-bottom: 0; /* Margin im Wrapper entfernen */
}

/* Container für eine Zutat-Zeile */
.ing-row {
    display: flex;           /* Zwingt Elemente nebeneinander */
    align-items: center;     /* Zentriert sie vertikal */
    gap: 8px;                /* Abstand zwischen den Elementen */
    margin-bottom: 10px;
    width: 100%;
}

/* Der Wrapper für den Namen (muss relative sein für die Vorschlagsliste) */
.ing-input-wrapper {
    flex: 6;                 /* Nimmt ca. 60% der Breite */
    position: relative;
    margin: 0;
}

/* Das Mengen-Feld */
.ing-amount {
    flex: 3;                 /* Nimmt ca. 30% der Breite */
    margin-bottom: 0 !important; /* Verhindert Umbruch durch Margin */
}

/* Das Löschen-Kreuz */
.row-del {
    flex: 1;                 /* Nimmt den Rest */
    display: flex;
    justify-content: center;
    font-size: 24px;
    color: var(--danger);
    cursor: pointer;
    line-height: 1;
    padding-bottom: 2px;     /* Feinjustierung */
}

/* WICHTIG: Inputs innerhalb der Wrapper dürfen keinen eigenen Außenabstand haben */
.ing-input-wrapper input {
    margin-bottom: 0 !important;
}

/* --- RATING --- */
.rating-ui { display: flex; flex-direction: column; align-items: center; margin-bottom: 10px; }
.stars-container { font-size: 28px; cursor: pointer; color: #d1d5db; /* Grau inaktiv */ }
.star { transition: color 0.2s; padding: 0 2px; }
.star.active { color: #fbbf24; /* Gold aktiv */ }
.star:hover, .star:hover ~ .star { opacity: 0.8; } /* Einfacher Hover Effekt */
.rating-meta { font-size: 13px; color: var(--text-muted); font-weight: 600; margin-top: 2px; }

/* --- OVERLAY BUTTONS (HEADER) --- */
.btn-icon-overlay {
    position: absolute; width: 36px; height: 36px; 
    border-radius: 50%; background: rgba(0,0,0,0.5); 
    backdrop-filter: blur(4px);
    color: #fff; border: none; 
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 10;
    font-size: 18px;
}
.photo-upload-btn { top: 15px; right: 15px; }
.fav-overlay { top: 15px; right: 60px; /* Neben dem Upload Button */ }
.fav-overlay.active { color: #f87171; background: rgba(255,255,255,0.9); }

/* --- GALLERY --- */
.gallery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 10px; }
.gallery-item { aspect-ratio: 1/1; overflow: hidden; border-radius: 8px; background: var(--bg-alt); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }

/* --- FEED CARD THUMBNAIL --- */
.card-thumb {
    width: 100%; height: 160px; /* Feste Höhe für Einheitlichkeit */
    background-size: cover; background-position: center;
    border-radius: 16px 16px 0 0;
    margin: -16px -16px 10px -16px; /* Negativer Margin um Padding der Karte auszugleichen */
    width: calc(100% + 32px);
}
/* Wenn Thumbnail da ist, runden wir unten nicht ab */
.sra-card:has(.card-thumb) { padding-top: 16px; } 

/* Anpassung Header Bild im Single View */
.recipe-main-img { cursor: zoom-in; }

/* ... deine existierenden Gallery Styles ... */

/* Delete Button in der Galerie (kleines X oben rechts) */
.gallery-del-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9); /* Rot */
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    z-index: 5;
    line-height: 1;
    padding-bottom: 2px;
}

/* Hover Effekt */
.gallery-del-btn:hover, .btn-delete-photo:hover {
    transform: scale(1.1);
}

/* --- FEED LIST LAYOUT (Neu) --- */

/* Die Karte im Feed wird jetzt horizontal ausgerichtet */
.sra-card.feed-layout {
    flex-direction: row; /* Nebeneinander */
    align-items: center; /* Vertikal mittig */
    padding: 12px;
    gap: 15px; /* Abstand Bild zu Text */
    min-height: 100px;
}

/* Das neue kleine Vorschaubild */
.feed-thumb {
    width: 85px;
    height: 85px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0; /* Verhindert, dass das Bild gequetscht wird */
    background-color: var(--bg-alt); /* Fallback Farbe */
    border: 1px solid var(--border);
}

/* Fallback-Icon, wenn kein Foto da ist */
.feed-icon-placeholder {
    width: 85px;
    height: 85px;
    border-radius: 12px;
    background: var(--bg-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

/* Anpassungen für den Textbereich */
.feed-layout .card-body {
    flex: 1; /* Nimmt den restlichen Platz ein */
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: auto; /* Reset width */
}

/* Titel etwas kompakter */
.feed-layout .feed-title {
    font-size: 16px;
    margin-bottom: 2px;
    /* Schneidet Text nach 2 Zeilen ab (optional) */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.feed-layout .feed-badges-row {
    margin-top: 6px;
}

/* --- MODERN TABS (Segmented Control) --- */
.view-switch {
    display: flex;
    background: var(--bg-surface); /* Weißer Hintergrund */
    padding: 6px;
    border-radius: 16px; /* Rundere Ecken */
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    gap: 6px;
    margin-top: 15px;
}

.switch-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 10px 4px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

/* Icons in den Tabs (optional per CSS Pseudo-Element oder direkt im HTML) */
/* Hover Effekt */
.switch-btn:hover {
    background: var(--bg-alt);
    color: var(--text-main);
}

/* Aktiver Zustand */
.switch-btn.active {
    background: var(--primary-light); /* Hellgrüner Hintergrund */
    color: var(--primary-text); /* Dunkelgrüner Text */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Dark Mode Anpassung */
[data-theme="dark"] .switch-btn.active {
    background: var(--primary-light); /* Dunkelgrün */
    color: var(--primary-text); /* Weißer Text */
}

/* --- RECEIPT SCAN UI --- */

/* Lade-Overlay */
.sra-loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    z-index: 9999;
    backdrop-filter: blur(5px);
}
.sra-loading-overlay div {
    font-size: 40px;
    margin-bottom: 15px;
    animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.2); } }


/* Review Modal Layout */
.review-grid {
    display: flex;
    gap: 15px;
    flex-direction: column; /* Für mobile Ansicht */
}
@media (min-width: 600px) {
    .review-grid { flex-direction: row; }
}

.review-column {
    flex: 1;
    background: var(--bg-alt);
    border-radius: 12px;
    padding: 10px;
}
.review-column h4 {
    margin: 5px 5px 15px 5px;
    font-size: 13px;
    color: var(--text-muted);
}

.review-list {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.review-item {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-sm);
}

.review-item .handle {
    cursor: grab;
    color: var(--text-light);
}
.review-item .item-content {
    display: flex;
    flex-direction: column;
}
.review-item .item-content strong {
    font-size: 14px;
    color: var(--text-main);
}
.review-item .item-content small {
    font-size: 12px;
    color: var(--text-muted);
}

/* Stil für das gezogene Element */
.sortable-ghost {
    opacity: 0.4;
    background: var(--primary-light);
}

/* --- RECEIPT SCAN UI (V2) --- */

/* Das 3-Spalten Grid */
.review-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mobile: eine Spalte */
    gap: 15px;
}

@media (min-width: 768px) {
    .review-grid {  /* <--- Diese Zeile hat gefehlt! */
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Die Ziel-Karten für Listen-Items */
.review-target-item {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
}
.target-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-main);
    display: block;
    margin-bottom: 8px;
}

/* Die Drop-Zone */
.drop-zone {
    background: rgba(0,0,0,0.02);
    border: 2px dashed var(--border);
    border-radius: 6px;
    min-height: 50px;
    padding: 5px;
}
/* Wenn ein Item drin ist, verschwindet der Rahmen */
.drop-zone.has-item {
    border: none;
    background: transparent;
    padding: 0;
    min-height: auto;
}

/* Die gezogenen Scan-Items */
.review-item.scanned-item {
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
}

/* Visuelles Feedback beim Ziehen */
.sortable-ghost {
    opacity: 0.5;
    background: var(--primary-light);
}
.drop-zone.sortable-ghost {
    border-color: var(--primary);
}

/* --- LADE OVERLAY --- */
.sra-loading-overlay {
    position: fixed;
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0;
    background: rgba(0,0,0,0.85); /* Dunkler Hintergrund */
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    z-index: 99999; /* Sehr hoch, damit es über allem liegt */
    backdrop-filter: blur(5px);
    text-align: center;
}

.sra-loading-overlay div {
    font-size: 50px;
    margin-bottom: 20px;
    animation: pulse 1.5s infinite;
}

/* Pulsierende Animation für das Emoji */
@keyframes pulse { 
    0% { transform: scale(1); opacity: 1; } 
    50% { transform: scale(1.2); opacity: 0.8; } 
    100% { transform: scale(1); opacity: 1; } 
}

/* --- SCAN PREVIEW THUMBS (Falls noch nicht drin) --- */
.scan-thumb-item {
    width: 70px; 
    height: 70px; 
    border-radius: 8px; 
    border: 1px solid var(--border); 
    background-size: cover; 
    background-position: center;
    flex-shrink: 0;
    position: relative;
    background-color: var(--bg-surface);
}

.ai-import-box {
    background: var(--bg-alt);
    border: 1px dashed var(--primary);
}
.ai-import-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}
.ai-import-head h3 {
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
    font-size: 14px;
}
.ai-import-sub {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--text-muted);
}
.ai-import-note {
    margin-bottom: 12px;
    background: var(--primary-light);
    color: var(--primary-text);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--primary);
    font-size: 12px;
    line-height: 1.4;
}
.recipe-upload-trigger {
    display: block;
    text-align: center;
    cursor: pointer;
    background: var(--bg-surface);
    margin-top: 0;
}
.recipe-scan-confirm {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}
.recipe-scan-head {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.scan-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}
.scan-slot {
    aspect-ratio: 1 / 1;
    border: 1px dashed var(--border);
    border-radius: 10px;
    background: var(--bg-surface);
    position: relative;
}
.scan-slot.has-image {
    border-style: solid;
    background-size: cover;
    background-position: center;
}
.scan-slot-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-muted);
    cursor: pointer;
}
.scan-slot-empty .scan-slot-plus {
    font-size: 22px;
    line-height: 1;
    color: var(--primary);
}
.scan-slot-empty small {
    font-size: 11px;
    color: var(--text-muted);
}
.recipe-thumb-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 999px;
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}
.recipe-scan-actions {
    display: flex;
    gap: 10px;
}
.recipe-scan-actions .btn-small,
.recipe-scan-actions .btn-primary {
    margin: 0;
}

/* --- FRIDGE TAGS --- */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}
.fridge-tag {
    background: var(--bg-surface);
    border: 1px solid var(--primary);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: default;
}
.fridge-tag .del {
    color: var(--danger);
    cursor: pointer;
    font-weight: bold;
    padding: 0 2px;
}

/* --- MATCH RESULTS --- */
.match-badge {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* --- HIGHLIGHT IN RECIPE --- */
/* --- HIGHLIGHT IN RECIPE (Verbessert) --- */
.ingredient-has {
    background-color: rgba(16, 185, 129, 0.15); /* Zartes Grün */
    border-radius: 6px;
    padding: 4px 8px;
    margin: 2px 0;
    border-left: 4px solid var(--primary);
    transition: all 0.3s ease;
}

/* Ein kleines Häkchen davor */
.ingredient-has::before {
    content: '✅ ';
    font-size: 12px;
    margin-right: 5px;
}

/* Delete Button auf dem Thumbnail */
.thumb-remove {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    line-height: 1;
    padding-bottom: 2px;
}

#sra-dynamic-content {
    transition: opacity 0.2s ease-in-out;
}

/* WICHTIG für SPA: Der Wrapper muss Flexbox nutzen */
#sra-app-container {
    display: flex;
    flex-direction: column;
    height: var(--sra-viewport-height, 100dvh);
    overflow: hidden;
}

#sra-dynamic-content {
    flex: 1; /* Nimmt den restlichen Platz ein */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Verhindert Scrollen auf dem Wrapper selbst */
    position: relative;
    min-height: 0; /* Wichtig für Firefox/Flexbox Scrolling */
}

/* Nav fixieren */
.sra-nav {
    flex-shrink: 0; /* Darf nicht schrumpfen */
    position: relative; /* Nicht mehr fixed, da im Flex-Container */
    bottom: auto; left: auto; right: auto;
}


/* Vorrat Liste */
.pantry-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid var(--border);
    gap: 10px;
}
.pi-info { flex: 1; display: flex; gap: 5px; }
.pi-name { margin: 0 !important; font-weight: 500; }
.pi-amount { margin: 0 !important; width: 80px; font-size: 13px; color: var(--text-muted); }
.pi-actions { display: flex; gap: 2px; }
.btn-icon { background: none; border: none; font-size: 16px; cursor: pointer; padding: 5px; }

/* Rezept Highlighting */
.ing-chk {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    color: #fff;
    font-size: 11px;
    text-align: center;
    line-height: 18px;
    margin-right: 8px;
    vertical-align: middle;
}
.ing-chk.green { background: #10b981; } /* Grün */
.ing-chk.yellow { background: #f59e0b; } /* Gelb */

.ing-has-full { background: rgba(16, 185, 129, 0.05); } /* Ganz leichtes Grün im Hintergrund */
.ing-has-part { background: rgba(245, 158, 11, 0.05); } /* Ganz leichtes Gelb */


/* Vorrat Liste & Maske Fixes */
.pantry-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    gap: 8px;
}

.pi-info { 
    flex: 1; 
    display: flex; 
    gap: 5px; 
    min-width: 0; /* Verhindert Overflow bei Flexbox */
}

/* Inputs in der Liste */
.pi-name { 
    margin: 0 !important; 
    font-weight: 500; 
    flex: 2;
    min-width: 0;
    background: transparent;
    border: 1px solid transparent;
}
.pi-name:focus, .pi-amount:focus {
    border-color: var(--primary);
    background: var(--bg-surface);
}

.pi-amount { 
    margin: 0 !important; 
    width: 70px; /* Feste Breite für Menge */
    font-size: 13px; 
    color: var(--text-muted); 
    background: transparent;
    border: 1px solid transparent;
}

.pi-actions { 
    display: flex; 
    gap: 2px; 
    flex-shrink: 0;
}

.btn-icon { 
    background: none; 
    border: none; 
    font-size: 16px; 
    cursor: pointer; 
    padding: 5px; 
    line-height: 1;
}

.btn-match-status {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    color: white;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    margin-right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.status-green { background-color: #10b981; }
.status-yellow { background-color: #f59e0b; }

.ing-has-full { background-color: rgba(16, 185, 129, 0.1); }
.ing-has-part { background-color: rgba(245, 158, 11, 0.1); }
.pi-name-clickable {
    flex: 2;
    font-weight: 600;
    color: var(--primary); /* Oder eine andere Akzentfarbe */
    cursor: pointer;
    align-self: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pi-name-clickable:hover {
    text-decoration: underline;
    opacity: 0.8;
}

/* Custom Checkbox im Import Modal */
.custom-checkbox {
    display: block;
    position: relative;
    padding-left: 25px;
    margin-bottom: 0;
    cursor: pointer;
    font-size: 22px;
    user-select: none;
}

/* Hide default browser checkbox */
.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Create a custom checkbox */
.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 4px;
}

/* When the checkbox is checked, add a blue background */
.custom-checkbox input:checked ~ .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* Create the checkmark/indicator (hidden when not checked) */
.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

/* Show the checkmark when checked */
.custom-checkbox input:checked ~ .checkmark:after {
    display: block;
}

/* Style the checkmark/indicator */
.custom-checkbox .checkmark:after {
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* --- CHECKBOX FIX (Brutal Force) --- */
input[type="checkbox"].imp-check {
    -webkit-appearance: checkbox !important;
    -moz-appearance: checkbox !important;
    appearance: checkbox !important;
    display: inline-block !important;
    width: 20px !important;
    height: 20px !important;
    opacity: 1 !important;
    position: static !important;
    margin-right: 10px !important;
    accent-color: var(--primary); /* Modern browsers */
    cursor: pointer;
    z-index: 100;
}

/* --- SCAN REVIEW GRID (3 Spalten) --- */
/* review header hidden */
.review-header { display:none; }
.review-row {
    display:flex;
    flex-direction:column;
    gap:10px;
    padding:12px;
    background:var(--bg-alt);
    border-radius:10px;
    border:1px solid transparent;
}
.review-row.row-new { border-left: 3px solid #f59e0b; }
.review-row.row-matched { border-left: 3px solid #10b981; }
.review-top-line {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    border-bottom:1px solid var(--border);
    padding-bottom:6px;
}
.review-top-line strong {
    font-size:13px;
    color:var(--text-main);
    flex:1;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}
.price-box {
    display:flex;
    align-items:center;
    gap:4px;
    padding-left:12px;
    border-left:1px solid var(--border);
}
.price-box .currency-symbol {
    font-weight:600;
    color:var(--text-main);
}
.price-box .review-price-input {
    width:80px;
    border:1px solid var(--border);
    border-radius:6px;
    padding:4px 8px;
    font-size:14px;
    background:var(--bg-surface);
    text-align:right;
}
.review-bottom-line {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    flex-wrap:wrap;
}
.review-bottom-left { flex:1; min-width:0; }
.review-bottom-right {
    display:flex;
    align-items:center;
    gap:8px;
}
.amount-chip {
    font-size:11px;
    background:var(--bg-surface);
    padding:2px 8px;
    border-radius:999px;
    color:var(--text-muted);
    border:1px solid var(--border);
}
.db-mapper {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    color: var(--text-main); 
}
.db-mapper:hover { border-color: var(--primary); }
.db-mapper .db-val {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 5px;
    color: inherit; 
}
.edit-icon { 
    font-size: 12px; 
    opacity: 0.5; 
    flex-shrink: 0;
    color: inherit; 
}
.status-badge {
    font-size: 10px;
    padding: 4px 6px;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
    white-space: nowrap;
    display: inline-block;
}
.status-badge.matched { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.status-badge.new { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }

/* --- SCAN REVIEW GRID (Layout Fix) --- */

.smart-review-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden; /* Kein horizontales Scrollen */
}

/* Definition der Spaltenbreiten für Header UND Zeilen */
.review-header { display:none; }
.review-row {
    display:flex;
    flex-direction:column;
    gap:10px;
    padding:12px;
    background:var(--bg-alt);
    border-radius:10px;
    border:1px solid transparent;
}
.review-card-main { display:flex; flex-direction:column; gap:8px; }
.review-top-line { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.review-top-line strong { font-size:13px; color:var(--text-main); flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.amount-chip { font-size:11px; background:var(--bg-surface); padding:2px 6px; border-radius:999px; color:var(--text-muted); border:1px solid var(--border); }
.review-map-row { display:flex; align-items:center; gap:10px; }
.review-map-row .status-badge { margin-left:auto; }
.review-price-edit { display:flex; flex-direction:column; gap:4px; }
.review-price-edit label { font-size:11px; color:var(--text-muted); }
.review-price-input { border:1px solid var(--border); border-radius:6px; padding:6px 10px; font-size:14px; width:100%; background:var(--bg-surface); }

.db-mapper {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    /* WICHTIG: Standardfarbe setzen, die überschrieben werden kann */
    color: var(--text-main); 
}

.db-mapper:hover { border-color: var(--primary); }

/* Der Text in der Box */
.db-mapper .db-val {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 5px;
    /* WICHTIG: Erbt die Farbe vom Eltern-Element (.db-mapper). 
       Wenn JS sagt "color: #000", wird es hier schwarz. */
    color: inherit; 
}

/* Edit Icon */
.edit-icon { 
    font-size: 12px; 
    opacity: 0.5; 
    flex-shrink: 0;
    /* Auch das Icon soll erben (damit es auf Gelb dunkel ist) */
    color: inherit; 
}

/* Status Badges (Rechts) */
.col-list { text-align: right; }

.status-badge {
    font-size: 10px;
    padding: 4px 6px;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
    white-space: nowrap; /* Kein Umbruch im Badge */
    display: inline-block;
}

/* Farbcodierung */
.review-row.row-new { border-left: 3px solid #f59e0b; }
.review-row.row-matched { border-left: 3px solid #10b981; }

.status-badge.matched { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.status-badge.new { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }

/* Sicherstellen, dass das Modal schick aussieht */
.setting-group input[type="checkbox"] {
    accent-color: var(--primary);
}

/* --- TOGGLE SWITCH CSS --- */
.sra-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.sra-switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc; /* Farbe wenn AUS (Light Mode) */
  transition: .4s;
}

/* Dunklerer Hintergrund für den Slider im Dark Mode (inaktiv) */
[data-theme="dark"] .slider {
    background-color: #4b5563; 
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Wenn aktiviert (checked) */
input:checked + .slider {
  background-color: var(--primary); /* Deine Hauptfarbe (Grün/Orange/etc.) */
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--primary);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* Runde Ecken */
.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}



/* --- BALANCE CARD (DASHBOARD) --- */
.balance-card {
    background: var(--bg-surface);
    border-radius: 16px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow-card);
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.1s;
}
.balance-card:active { transform: scale(0.98); }

/* Positive Bilanz (Ich bekomme Geld) */
.balance-card.positive {
    background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 100%);
    border-color: #10b981;
}
.balance-card.positive .bal-icon { background: #d1fae5; }
.balance-card.positive .bal-total { color: #047857; }

/* Negative Bilanz (Ich schulde Geld) */
.balance-card.negative {
    background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%);
    border-color: #ef4444;
}
.balance-card.negative .bal-icon { background: #fee2e2; }
.balance-card.negative .bal-total { color: #b91c1c; }

/* Dark Mode Anpassung */
[data-theme="dark"] .balance-card.positive { background: #064e3b; border-color: #059669; }
[data-theme="dark"] .balance-card.positive .bal-icon { background: rgba(255,255,255,0.1); }
[data-theme="dark"] .balance-card.positive .bal-total { color: #6ee7b7; }

[data-theme="dark"] .balance-card.negative { background: #7f1d1d; border-color: #b91c1c; }
[data-theme="dark"] .balance-card.negative .bal-icon { background: rgba(255,255,255,0.1); }
[data-theme="dark"] .balance-card.negative .bal-total { color: #fca5a5; }

/* Inhalte */
.bal-icon {
    width: 45px; height: 45px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.bal-info {
    flex: 1;
    display: flex; flex-direction: column;
}
.bal-label { font-size: 11px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; letter-spacing: 0.5px; }
.bal-total { font-size: 18px; font-weight: 800; margin-top: 2px; }
.bal-hint { font-size: 10px; color: var(--text-light); margin-top: 2px; }
.bal-arrow { font-size: 24px; color: var(--text-muted); font-weight: 300; }

/* Abrechnungsverlauf und zugehörige Dialoge */
.sra-finance-dialog {
    height: var(--sra-viewport-height, 100dvh);
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
}
.sra-finance-panel {
    display: flex;
    flex-direction: column;
    padding: 0;
    width: 100%;
    max-width: 560px;
    max-height: 100%;
    min-width: 0;
    overflow: hidden;
}
.sra-finance-panel-header, .sra-finance-panel-footer {
    flex: 0 0 auto;
    padding: 10px 16px;
    background: var(--bg-surface);
}
.sra-finance-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}
.sra-finance-panel-header h3 { margin: 0; min-width: 0; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.25; }
.sra-finance-panel-header .modal-close-icon { position: static; flex: 0 0 44px; width: 44px; height: 44px; font-size: 1.4rem; }
.sra-finance-panel-scroll {
    min-height: 0;
    padding: 0 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
}
#settlement-payment-content { padding-block: 16px; }
.sra-finance-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.sra-finance-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) fit-content(50%);
    align-items: center;
    gap: 12px;
    padding-block: 12px;
    border-bottom: 1px solid var(--border);
}
.sra-finance-line:last-child { border-bottom: 0; }
.sra-finance-line > div { min-width: 0; overflow-wrap: anywhere; }
.sra-finance-line-money { text-align: end; }
.sra-finance-line small { display: block; margin-top: 4px; color: var(--text-muted); }
.sra-finance-currency { white-space: nowrap; font-variant-numeric: tabular-nums; }
:is(.sra-finance-panel, .balance-list) [data-sra-sign="1"] { color: var(--primary-text); }
:is(.sra-finance-panel, .balance-list) [data-sra-sign="-1"] {
    color: var(--text-main);
    color: color-mix(in srgb, var(--danger) 80%, var(--text-main));
}
.sra-finance-panel-footer { border-top: 1px solid var(--border); }
.sra-finance-total { margin-bottom: 8px; font-weight: 700; }
.sra-finance-total strong { font-variant-numeric: tabular-nums; }
.sra-finance-panel-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sra-finance-panel-actions button { min-height: 44px; min-width: 0; margin: 0; padding: 6px 8px; overflow-wrap: anywhere; }
.sra-finance-panel-actions .btn-outline { color: var(--primary-text); }
@media (max-width: 600px) {
    .sra-finance-dialog { align-items: flex-end; padding-inline: 0; padding-bottom: 0; }
    .sra-finance-panel { max-width: none; border-radius: 20px 20px 0 0; }
    .sra-finance-panel > :last-child { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}

/* --- BALANCE LIST (Übersicht) --- */
.balance-list {
    background: var(--bg-surface);
}

.balance-row {
    display: flex;
    align-items: center;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text-main);
    text-align: start;
    padding: 15px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
}
.balance-row:last-child { border-bottom: none; }
.balance-row:active { background: var(--bg-alt); }
.sra-balance-details { font-size: 12px; color: var(--text-light); margin-inline-start: 8px; }

.bal-user-icon {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: bold;
    margin-right: 12px;
    flex-shrink: 0;
}

.bal-user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.bal-user-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.bal-user-amt {
    font-size: 16px;
    font-weight: 700;
}

.share-modal .share-link-box {
    display:flex;
    gap:8px;
    margin-top:10px;
}
.share-modal .share-link-box input {
    flex:1;
    border:1px solid var(--border);
    border-radius:8px;
    padding:8px;
    font-size:13px;
    background:var(--bg-input);
}
.share-modal .share-options {
    display:flex;
    gap:10px;
    margin-top:20px;
}
.share-modal .share-option {
    flex:1;
    border:1px solid var(--border);
    border-radius:10px;
    padding:10px;
    background:var(--bg-surface);
    cursor:pointer;
    font-weight:600;
    text-align:center;
}
.share-modal .share-option[data-network="whatsapp"] { border-color:#22c55e; color:#22c55e; }
.share-modal .share-option[data-network="telegram"] { border-color:#0ea5e9; color:#0ea5e9; }
.share-modal .share-option[data-network="mail"] { border-color:#d97706; color:#d97706; }
.btn-icon-only {
    display:flex !important;
    align-items:center;
    justify-content:center;
    font-size:18px;
    font-weight:600;
}
.sra-pantry-import-heading { margin: 10px 8px 4px; color: var(--primary); font-size: 0.8125rem; font-weight: 650; }
.sra-pantry-import-note { margin: 5px 8px 10px; font-size: 0.875rem; color: var(--text-muted); }
#pantry-import-feedback:empty { display: none; }
.sra-pantry-imported { padding: 0 8px; border-top: 1px solid var(--border); }
.sra-pantry-imported summary { min-height: 44px; padding-block: 11px; cursor: pointer; font-weight: 650; }
.sra-pantry-correction { display: grid; gap: 5px; padding: 8px 0 12px; border-top: 1px solid var(--border); }
.sra-pantry-correction p, .sra-pantry-correction input { margin: 0; }
.sra-pantry-correction label { font-size: 0.875rem; color: var(--text-muted); }
.sra-pantry-correction-button { min-height: 44px; }
