/* =================================================================
   GastroPilot v5 – Design System
   ----------------------------------------------------------------
   Aufbau:
     1. CSS-Variablen (Farben, Spacing, Typo)
     2. Reset & Basis
     3. Typografie
     4. Buttons
     5. Forms / Inputs
     6. Karten / Widgets
     7. Tabellen
     8. Layout (Header, Sidebar, Main, Footer)
     9. Login-Overlay
    10. Modal-System
    11. Toast-Notifications
    12. Modul-Views
    13. Utilities
    14. Animationen
    15. Responsive (Mobile)
   ================================================================= */


/* ================= 1. CSS-VARIABLEN ============================ */
:root {
    /* Farbschema */
    --primary: #2C3E50;
    --primary-dark: #1A252F;
    --primary-light: #34495E;
    --accent: #E67E22;
    --accent-dark: #D35400;
    --accent-light: #F39C12;
    --success: #27AE60;
    --warning: #F39C12;
    --danger: #C0392B;
    --danger-dark: #A93226;
    --bg-light: #ECF0F1;
    --bg-white: #FFFFFF;
    --bg-muted: #F8F9FA;
    --text-dark: #2C3E50;
    --text-muted: #7F8C8D;
    --text-light: #BDC3C7;
    --border: #BDC3C7;
    --border-light: #E5E8EA;

    /* Typografie */
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', Menlo, 'Roboto Mono', Consolas, monospace;

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;

    /* Layout */
    --sidebar-w: 240px;
    --header-h: 64px;
    --footer-h: 48px;
    --content-padding: 32px;

    /* Radien */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    /* Schatten */
    --shadow-sm: 0 1px 2px rgba(44, 62, 80, 0.06);
    --shadow-md: 0 4px 12px rgba(44, 62, 80, 0.08);
    --shadow-lg: 0 12px 32px rgba(44, 62, 80, 0.12);
    --shadow-xl: 0 24px 48px rgba(44, 62, 80, 0.18);

    /* Übergänge */
    --transition: 200ms ease;
    --transition-fast: 120ms ease;

    /* Z-Index Skala */
    --z-header: 100;
    --z-sidebar: 90;
    --z-modal: 1000;
    --z-toast: 1100;
    --z-login: 9999;
}


/* ================= 2. RESET & BASIS ============================ */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-dark);
    background: var(--bg-light);
    -webkit-font-smoothing: antialiased;
    font-variant-numeric: tabular-nums;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--accent-dark);
}

hr {
    border: 0;
    border-top: 1px solid var(--border-light);
    margin: var(--space-4) 0;
}

[hidden] {
    display: none !important;
}


/* ================= 3. TYPOGRAFIE =============================== */
h1, h2, h3, h4, h5, h6 {
    margin: 0 0 var(--space-3) 0;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text-dark);
}
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }

p {
    margin: 0 0 var(--space-3) 0;
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--bg-muted);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.text-muted { color: var(--text-muted); }
.text-mono { font-family: var(--font-mono); }
.text-right { text-align: right; }
.text-center { text-align: center; }


/* ================= 4. BUTTONS ================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 8px 16px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-dark);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast),
                border-color var(--transition-fast), box-shadow var(--transition-fast),
                transform var(--transition-fast);
    user-select: none;
    white-space: nowrap;
}
.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
    background: var(--bg-white);
    color: var(--primary);
    border-color: var(--primary);
}
.btn-secondary:hover { background: var(--primary); color: #fff; }

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger-dark); border-color: var(--danger-dark); }

.btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}
.btn-success:hover { filter: brightness(0.92); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}
.btn-ghost:hover {
    background: var(--bg-muted);
    color: var(--text-dark);
}

.btn-block { width: 100%; }
.btn-small { padding: 4px 10px; font-size: 12px; }
.btn-large { padding: 12px 24px; font-size: 16px; }

/* Loading-State: Spinner ersetzt Text */
.btn.is-loading {
    color: transparent !important;
    position: relative;
    pointer-events: none;
}
.btn.is-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 600ms linear infinite;
    color: #fff;
}


/* ================= 5. FORMS / INPUTS =========================== */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 500;
    font-size: 13px;
    color: var(--text-dark);
}

.form-input,
.form-select,
.form-textarea {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-dark);
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.15);
}
.form-input.is-error,
.form-select.is-error,
.form-textarea.is-error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}

.form-input--small { padding: 4px 8px; font-size: 12px; }
.form-input--large { padding: 12px 16px; font-size: 16px; }

.form-error {
    margin-top: var(--space-2);
    color: var(--danger);
    font-size: 12px;
}

.form-hint {
    margin-top: var(--space-2);
    color: var(--text-muted);
    font-size: 12px;
}


/* ================= 6. KARTEN / WIDGETS ========================= */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--space-5);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-light);
}
.card-header h3 { margin: 0; }

.card-placeholder {
    color: var(--text-muted);
    text-align: center;
    border: 2px dashed var(--border-light);
    box-shadow: none;
    background: var(--bg-muted);
}


/* ================= 7. TABELLEN ================================ */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    background: var(--bg-white);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-muted);
    color: var(--text-muted);
    font-weight: 600;
    text-align: left;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-light);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.04em;
}

.table th.sortable {
    cursor: pointer;
    user-select: none;
}
.table th.sortable::after {
    content: " ⇅";
    color: var(--text-light);
    font-size: 10px;
}
.table th.sortable.sort-asc::after  { content: " ↑"; color: var(--text-dark); }
.table th.sortable.sort-desc::after { content: " ↓"; color: var(--text-dark); }

.table tbody td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}
.table tbody tr:nth-child(even) { background: var(--bg-muted); }
.table tbody tr:hover { background: rgba(230, 126, 34, 0.06); }

/* alpha.136 — Zahl-Spalten: rechts-bündig (Header UND Werte), monospace für tabellarische Ziffern,
   width:1% + white-space:nowrap zwingt Spalte auf minimal benötigte Breite damit Werte nicht
   "verloren in der Mitte" wirken. Restliche Breite geht an Text-Spalten (z.B. Gericht-Name). */
.table .col-num,
.table thead th.col-num,
.table tbody td.col-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
    white-space: nowrap;
    width: 1%;
}


/* ================= 8. LAYOUT (Shell) =========================== */
.app-shell {
    display: grid;
    grid-template-areas:
        "header header"
        "sidebar main"
        "footer footer";
    grid-template-rows: var(--header-h) 1fr var(--footer-h);
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

/* --- Header --- */
.app-header {
    grid-area: header;
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 var(--space-5);
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-md);
}
.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.header-right { justify-content: flex-end; }
.header-center { text-align: center; }

.header-logo { font-size: 24px; }
.header-brand { display: flex; flex-direction: column; line-height: 1.1; }
.header-title { font-weight: 700; font-size: 16px; }
.header-version { font-size: 11px; opacity: 0.65; font-family: var(--font-mono); }
.header-betrieb { font-weight: 500; font-size: 14px; opacity: 0.9; }

/* app.221 — Betriebs-Umschalter als klar tippbare Pille (damit sofort sichtbar ist, in welchem Betrieb man ist). */
.betrieb-switcher-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    padding: 5px 12px;
    font-size: inherit;
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    max-width: 100%;
    transition: background 0.15s;
}
.betrieb-switcher-btn:hover, .betrieb-switcher-btn:active { background: rgba(255, 255, 255, 0.24); }
.betrieb-switcher-btn .bs-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.drive-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    font-size: 12px;
    cursor: pointer;
    transition: background var(--transition-fast);
}
.drive-status:hover { background: rgba(255, 255, 255, 0.16); }

.drive-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.drive-status-dot--on  { background: var(--success); box-shadow: 0 0 6px var(--success); }
.drive-status-dot--off { background: var(--danger); }

.user-menu-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    transition: background var(--transition-fast);
}
.user-menu-btn:hover { background: rgba(255, 255, 255, 0.16); }


/* --- Sidebar --- */
.app-sidebar {
    grid-area: sidebar;
    position: sticky;
    top: var(--header-h);
    align-self: start;
    z-index: var(--z-sidebar);
    height: calc(100vh - var(--header-h) - var(--footer-h));
    background: var(--bg-white);
    border-right: 1px solid var(--border-light);
    padding: var(--space-4) 0;
    overflow-y: auto;
}

.sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px var(--space-5);
    color: var(--text-dark);
    font-size: 14px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background var(--transition-fast), color var(--transition-fast),
                border-color var(--transition-fast);
}
.sidebar-link:hover {
    background: var(--bg-muted);
    color: var(--accent-dark);
}
.sidebar-link.active {
    background: rgba(230, 126, 34, 0.10);
    color: var(--accent-dark);
    border-left-color: var(--accent);
}
.sidebar-link--disabled {
    color: var(--text-light);
    cursor: not-allowed;
    pointer-events: none;
}

.sidebar-icon { font-size: 18px; width: 22px; text-align: center; }
.sidebar-label { flex: 1; }

.sidebar-badge {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--bg-light);
    color: var(--text-muted);
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-divider {
    margin: var(--space-3) var(--space-5);
    border-top: 1px solid var(--border-light);
}

/* alpha.209 — Back-Navigation Bar (sichtbar wenn vom Dashboard zu Sub-Modul) */
.back-nav-bar {
    background: linear-gradient(90deg, var(--bg-muted, #F8F9FA) 0%, transparent 60%);
    border-bottom: 1px solid var(--border-light);
    padding: 8px var(--space-5);
    margin: calc(-1 * var(--space-5)) calc(-1 * var(--space-5)) var(--space-4);
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background-color: rgba(255, 255, 255, 0.85);
}
.back-nav-bar[hidden] { display: none; }
.back-nav-bar .btn {
    color: var(--accent, #E67E22);
    font-weight: 600;
    padding: 4px 10px;
    font-size: 13px;
}
.back-nav-bar .btn:hover {
    background: var(--bg-muted, #F8F9FA);
    color: var(--accent-dark, #D35400);
}

/* alpha.207 — Sidebar-Gruppen-Header */
.sidebar-group-header {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: var(--space-3) var(--space-5) 4px;
    margin-top: var(--space-2);
    border-top: 1px solid var(--border-light);
    user-select: none;
}
.sidebar-group-header:first-of-type {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
}
.sidebar-nav > .sidebar-list {
    margin-bottom: 2px;
}


/* --- Main --- */
.app-main {
    grid-area: main;
    padding: var(--content-padding);
    overflow-y: auto;
    min-width: 0;
}


/* --- Footer --- */
.app-footer {
    grid-area: footer;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 var(--space-5);
    background: var(--bg-white);
    border-top: 1px solid var(--border-light);
    font-size: 12px;
    color: var(--text-muted);
}
.footer-center { text-align: center; }
.footer-right { text-align: right; display: flex; gap: var(--space-4); justify-content: flex-end; }
.footer-link { color: var(--text-muted); }
.footer-link:hover { color: var(--accent); }


/* ================= 9. LOGIN-OVERLAY ============================ */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-login);
    display: grid;
    place-items: center;
    padding: var(--space-5);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: var(--space-7) var(--space-6);
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    text-align: center;
}

.login-logo {
    font-size: 56px;
    margin-bottom: var(--space-3);
}

.login-title {
    margin: 0 0 var(--space-2) 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.login-subtitle {
    margin: 0 0 var(--space-6) 0;
    color: var(--text-muted);
    font-size: 14px;
}

.login-form { text-align: left; }

.login-footer-text {
    margin: var(--space-6) 0 0 0;
    color: var(--text-light);
    font-size: 11px;
    font-family: var(--font-mono);
}

/* Shake-Animation bei falschem Passwort */
.login-card.is-shaking {
    animation: shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}


/* ================= 10. MODAL-SYSTEM ============================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: grid;
    place-items: center;
    padding: var(--space-5);
    background: rgba(44, 62, 80, 0.55);
    backdrop-filter: blur(2px);
    animation: fadeIn var(--transition);
}

.modal {
    width: 100%;
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalIn var(--transition);
}
.modal--small  { max-width: 400px; }
.modal--medium { max-width: 640px; }
.modal--large  { max-width: 960px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-light);
}
.modal-title { margin: 0; font-size: 18px; }

.modal-close {
    background: transparent;
    border: 0;
    font-size: 18px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast), color var(--transition-fast);
}
.modal-close:hover { background: var(--bg-muted); color: var(--text-dark); }

.modal-body {
    padding: var(--space-5);
    overflow-y: auto;
    flex: 1 1 auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-light);
    background: var(--bg-muted);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}
.modal-footer:empty { display: none; }


/* ================= 11. TOAST-NOTIFICATIONS ===================== */
.toast-container {
    position: fixed;
    top: calc(var(--header-h) + var(--space-4));
    right: var(--space-5);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
    max-width: calc(100% - 2 * var(--space-5));
}

.toast {
    pointer-events: auto;
    min-width: 280px;
    max-width: 420px;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-white);
    border-left: 4px solid var(--text-muted);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    animation: slideInRight var(--transition);
    font-size: 13px;
}
.toast.is-dismissing { animation: slideOutRight var(--transition) forwards; }

.toast-icon { font-size: 18px; line-height: 1; }
.toast-message { flex: 1; color: var(--text-dark); }
.toast-close {
    background: transparent;
    border: 0;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 2px;
}
.toast-close:hover { color: var(--text-dark); }

.toast--success { border-left-color: var(--success); }
.toast--error   { border-left-color: var(--danger); }
.toast--warning { border-left-color: var(--warning); }
.toast--info    { border-left-color: var(--primary); }


/* ================= 12. MODUL-VIEWS ============================= */
.module-view { display: none; }
.module-view--active { display: block; }

.module-header {
    margin-bottom: var(--space-5);
}
.module-title { margin: 0; }

/* Welcome */
.welcome-hero {
    text-align: center;
    padding: var(--space-7) var(--space-5);
    margin-bottom: var(--space-6);
}
.welcome-icon { font-size: 56px; margin-bottom: var(--space-3); }
.welcome-title { font-size: 28px; margin-bottom: var(--space-3); }
.welcome-text { color: var(--text-muted); max-width: 520px; margin: 0 auto; font-size: 15px; }

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-4);
}
.module-card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
    cursor: pointer;
}
.module-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.module-card-icon { font-size: 32px; margin-bottom: var(--space-2); }
.module-card-title { margin: 0 0 var(--space-2) 0; font-size: 16px; }
.module-card-text { color: var(--text-muted); font-size: 13px; margin-bottom: var(--space-3); }
.module-card-status {
    display: inline-block;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-light);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.status-pending { background: #FEF3E2; color: var(--accent-dark); }


/* ================= 12b. MODUL: SPEISEKARTEN ==================== */

/* Header mit Titel + Action-Buttons */
.sk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}
.sk-actions {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* Listen-Zeile als Speisekarten-Eintrag */
.sk-row { cursor: pointer; }
.sk-row:hover { background: rgba(230, 126, 34, 0.06); }

/* Empty-State */
.sk-empty {
    text-align: center;
    padding: var(--space-7) var(--space-5);
}
.sk-empty-icon {
    font-size: 56px;
    opacity: 0.4;
    margin-bottom: var(--space-3);
}
.sk-empty h3 {
    margin-bottom: var(--space-2);
    color: var(--text-dark);
}
.sk-empty p {
    color: var(--text-muted);
    margin: 0;
}

/* Source-Badge in Tabelle */
.sk-source-badge {
    display: inline-block;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-muted);
    color: var(--text-muted);
    white-space: nowrap;
}

/* Detail-Header: Back-Btn + Titel + Source nebeneinander */
.sk-detail-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}
.sk-detail-title .module-title { margin: 0; }

.sk-karte-desc {
    margin-top: -8px;
    margin-bottom: var(--space-3);
}
.sk-karte-meta {
    font-size: 12px;
    margin-bottom: var(--space-4);
}

/* Kategorie-Überschrift in der Detail-Ansicht */
.sk-cat-title {
    margin: var(--space-5) 0 var(--space-2);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-dark);
    font-weight: 600;
}
.sk-cat-title:first-child { margin-top: 0; }

.sk-gericht-table {
    margin-bottom: var(--space-4);
}

.sk-gericht-name {
    font-weight: 500;
    color: var(--text-dark);
}
.sk-gericht-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.4;
}

/* Grid für 2-spaltige Form-Reihen (Kategorie + Preis nebeneinander) */
.sk-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

/* PDF-Import Status-Box */
.sk-status {
    padding: var(--space-3);
    background: var(--bg-muted);
    border-radius: var(--radius-sm);
    margin-top: var(--space-3);
    font-size: 13px;
    color: var(--text-muted);
    border-left: 3px solid var(--accent);
}
.sk-status--error {
    border-left-color: var(--danger);
    color: var(--danger);
    background: rgba(192, 57, 43, 0.05);
}


/* ================= 12c. MODUL: RECHNUNGEN ====================== */

/* Summary-Bar oberhalb der Liste */
.rg-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}
.rg-summary-item {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.rg-summary-item--accent {
    background: var(--primary);
    color: #fff;
}
.rg-summary-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.rg-summary-item--accent .rg-summary-label { color: rgba(255,255,255,0.7); }
.rg-summary-value {
    font-size: 18px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Meta-Grid in der Detail-Ansicht (Datum, Nr., Σ Netto, Σ USt, Σ Brutto) */
.rg-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.rg-meta-item {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.rg-meta-item--accent {
    background: var(--accent);
    color: #fff;
}
.rg-meta-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.rg-meta-item--accent .rg-meta-label { color: rgba(255,255,255,0.85); }
.rg-meta-value {
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Typ-Badges in der Listen-/Detailansicht */
.rg-typ-rechnung    { background: #E8F5E9; color: #1B5E20; }
.rg-typ-preisliste  { background: #FFF3E0; color: #E65100; }
.rg-typ-lieferschein { background: #E3F2FD; color: #0D47A1; }
.rg-typ-gutschrift  { background: #E0F2F1; color: #00695C; }

.rg-summary-sub {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}


/* ================= 12d. MODUL: REZEPTE ========================= */

.rz-row { cursor: pointer; }
.rz-row:hover { background: rgba(230, 126, 34, 0.06); }

/* Ampel-Punkte für die Liste */
.rz-ampel-green   { color: var(--success); font-size: 18px; }
.rz-ampel-yellow  { color: var(--warning); font-size: 18px; }
.rz-ampel-red     { color: var(--danger);  font-size: 18px; }
.rz-ampel-gray    { color: var(--text-light); font-size: 18px; }

/* Ampel-Karte (Detail-View, Meta-Grid) */
.rz-ampel-card {
    color: #fff;
}
.rz-ampel-card-green  { background: var(--success); }
.rz-ampel-card-yellow { background: var(--warning); }
.rz-ampel-card-red    { background: var(--danger);  }
.rz-ampel-card-gray   { background: var(--text-muted); }
.rz-ampel-card .rg-meta-label { color: rgba(255,255,255,0.85); }
.rz-ampel-card .rz-ampel-dot { margin-left: var(--space-2); font-size: 14px; }

/* alpha.127 — WE-Karte klickbar (öffnet Marge-Analyse-Modal) */
.rz-we-card { transition: transform 0.12s ease, box-shadow 0.12s ease; }
.rz-we-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    filter: brightness(1.05);
}
.rz-we-card:active { transform: translateY(0); }

.rz-status-empty {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}
.rz-status-partial {
    font-size: 11px;
    color: var(--warning);
    font-weight: 500;
}

.rz-lieferant {
    font-size: 11px;
    color: var(--text-muted);
}

/* Quellen-Badges (Lieferant / KI / Demo / manuell) */
.rz-quelle {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-muted);
    color: var(--text-muted);
    font-weight: 500;
}
.rz-q-pdf    { background: #E8F5E9; color: #1B5E20; }
.rz-q-ai     { background: #FFF3E0; color: #E65100; }
.rz-q-demo   { background: #F3E5F5; color: #6A1B9A; }
.rz-q-manual { background: #E3F2FD; color: #0D47A1; }
.rz-q-est    { background: var(--bg-muted); color: var(--text-muted); }

/* Preis-Override-Bereich im Zutat-Modal */
.rz-priceoverride {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px dashed var(--border-light);
}

/* Zutat-Label-System: Bezeichnung oben groß, Artikel-Mapping klein darunter */
.rz-zutat-label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
    margin-bottom: 2px;
}
.rz-zutat-artikel {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    padding-left: var(--space-1);
}

/* Inline-Dropdown für schnelles Artikel-Umverlinken in der Zutaten-Tabelle */
.rz-inline-edit {
    display: inline-block;
    max-width: 360px;
    min-width: 200px;
}
.rz-inline-input {
    border: 1px dashed var(--border-light);
    background: transparent;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: inherit;
    font-family: inherit;
    color: inherit;
    width: 100%;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.rz-inline-input:hover {
    border-color: var(--accent);
    background: rgba(230, 126, 34, 0.04);
}
.rz-inline-input:focus {
    outline: none;
    border-color: var(--accent);
    border-style: solid;
    background: var(--bg-white);
    box-shadow: 0 0 0 2px rgba(230, 126, 34, 0.12);
}


/* ================= 12e. MODUL: KALKULATION ===================== */

.kalk-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}
.kalk-card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-left: 4px solid var(--border-light);
}
.kalk-card-green  { border-left-color: var(--success); }
.kalk-card-yellow { border-left-color: var(--warning); }
.kalk-card-red    { border-left-color: var(--danger);  }
.kalk-card-gray   { border-left-color: var(--text-light); }
.kalk-card-warn   { border-left-color: var(--accent); }

/* Klickbare Filter-Cards (Dashboard) */
.kalk-card.kalk-filter {
    transition: transform 0.1s, box-shadow 0.15s, border-left-width 0.15s;
}
.kalk-card.kalk-filter:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.08));
}
.kalk-card.kalk-filter.is-active {
    border-left-width: 8px;
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.12));
}

/* === Dashboard-Layout (alpha.64) === */
.kalk-dash-header-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-3);
    align-items: stretch;
    margin-bottom: var(--space-3);
}
.kalk-dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-2);
}

/* Gesamtampel rechts oben */
.kalk-gesamtampel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    background: #1A1F2E;
    color: #fff;
    border-radius: var(--radius-md);
    min-width: 180px;
}
.kalk-gesamtampel-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.75;
}
.kalk-gesamtampel-lights {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.kalk-gesamtampel-light {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2A2F3E;
    border: 2px solid #1A1F2E;
}
.kalk-gesamtampel-light.is-on.green  { background: #34C759; box-shadow: 0 0 16px rgba(52, 199, 89, 0.7); }
.kalk-gesamtampel-light.is-on.yellow { background: #FFCC00; box-shadow: 0 0 16px rgba(255, 204, 0, 0.7); }
.kalk-gesamtampel-light.is-on.red    { background: #FF3B30; box-shadow: 0 0 16px rgba(255, 59, 48, 0.7); }
.kalk-gesamtampel-status {
    font-size: 12px;
    text-align: center;
    opacity: 0.85;
}

/* 2-Spalten-Grid für Bewertung + Balken / Top + Schlechte */
.kalk-dash-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}
@media (max-width: 900px) {
    .kalk-dash-2col { grid-template-columns: 1fr; }
}
.kalk-dash-panel {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    box-shadow: var(--shadow-sm);
}
.kalk-dash-panel-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 var(--space-3) 0;
    color: var(--text);
}

/* WES-Balken-Diagramm */
.kalk-bars {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.kalk-bar-row {
    display: grid;
    grid-template-columns: 100px 1fr 56px;
    gap: var(--space-2);
    align-items: center;
    font-size: 12px;
}
.kalk-bar-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kalk-bar-track {
    height: 14px;
    background: var(--bg-muted);
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
}
.kalk-bar-fill {
    height: 100%;
    border-radius: var(--radius-sm);
    transition: width 0.3s;
}
.kalk-bar-fill.green  { background: var(--success); }
.kalk-bar-fill.yellow { background: var(--warning); }
.kalk-bar-fill.red    { background: var(--danger); }
.kalk-bar-fill.gray   { background: var(--text-light); }
.kalk-bar-val {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.kalk-bar-scale {
    display: grid;
    grid-template-columns: 100px 1fr 56px;
    gap: var(--space-2);
    margin-top: var(--space-2);
    font-size: 10px;
    color: var(--text-muted);
}
.kalk-bar-scale-ticks {
    display: flex;
    justify-content: space-between;
    padding: 0 2px;
}
.kalk-bar-legend {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-3);
    font-size: 11px;
    flex-wrap: wrap;
}
.kalk-bar-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.kalk-bar-legend-dot {
    width: 10px; height: 10px; border-radius: 2px;
}

/* Top/Bottom-Listen kompakter */
.kalk-rank-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.kalk-rank-item {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border-light);
    align-items: center;
    font-size: 13px;
}
.kalk-rank-item:last-child { border-bottom: none; }
.kalk-rank-num {
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
}
.kalk-rank-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kalk-rank-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}
.kalk-rank-val {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
}
.kalk-rank-val.good  { color: var(--success); }
.kalk-rank-val.bad   { color: var(--danger); }

.kalk-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.kalk-value {
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.kalk-hint {
    margin-top: var(--space-5);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-muted);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-muted);
    border-left: 3px solid var(--accent);
}

.kalk-demo-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
    padding: var(--space-4) var(--space-5);
    background: linear-gradient(135deg, #FFF3E0 0%, #FFE0B2 100%);
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
}
.kalk-demo-text {
    flex: 1 1 280px;
    color: var(--text-dark);
    font-size: 14px;
    line-height: 1.5;
}
.kalk-demo-text strong { color: var(--accent-dark); }

/* Bulk-Fortschritts-Balken */
.bulk-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-muted);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: var(--space-3) 0;
}
.bulk-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
    transition: width 0.3s ease;
}

/* alpha.138 — Slide-in für Log-Einträge (Rechnungen-Bulk) */
@keyframes gp-log-slide-in {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}


/* ================= DROP-ZONE (Drag & Drop für PDFs) ============ */

.dropzone {
    display: block;
    padding: var(--space-7) var(--space-5);
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-muted);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
}
.dropzone:hover {
    border-color: var(--accent);
    background: rgba(230, 126, 34, 0.05);
}
.dropzone--over {
    border-color: var(--accent);
    border-style: solid;
    background: rgba(230, 126, 34, 0.15);
    transform: scale(1.01);
    box-shadow: 0 4px 16px rgba(230, 126, 34, 0.18);
}
.dropzone-icon {
    font-size: 40px;
    opacity: 0.6;
    margin-bottom: var(--space-2);
    pointer-events: none;
}
.dropzone--over .dropzone-icon {
    opacity: 1;
    transform: scale(1.1);
    transition: transform var(--transition);
}
.dropzone-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: var(--space-1);
    pointer-events: none;
}
.dropzone-sub {
    font-size: 13px;
    color: var(--text-muted);
    pointer-events: none;
}

/* Datei-Liste nach Drop / Auswahl */
.dropzone-list {
    margin-top: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
}
.dropzone-list-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--space-2);
    font-size: 13px;
}
.dropzone-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 180px;
    overflow-y: auto;
}
.dropzone-list li {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
}
.dropzone-list li:last-child { border-bottom: 0; }
.dropzone-list-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone-list-remove {
    background: transparent;
    border: 0;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    line-height: 1;
}
.dropzone-list-remove:hover {
    background: rgba(192, 57, 43, 0.1);
    color: var(--danger);
}


/* ================= 12f. MODUL: STATISTIK ======================= */

/* Bar-Chart-Zelle in Tabellen (CSS-only) */
.st-bar-cell {
    width: 30%;
    min-width: 100px;
    vertical-align: middle;
}
.st-bar {
    height: 8px;
    background: var(--primary-light);
    border-radius: var(--radius-full);
    min-width: 4px;
    transition: width 200ms ease;
}
.st-bar--accent {
    background: var(--accent);
}

/* Trend-Pfeile (Preis-Trends) */
.st-trend-up {
    color: var(--danger);   /* steigende Preise = schlecht für Gastro */
}
.st-trend-down {
    color: var(--success);  /* fallende Preise = gut */
}


/* ================= TEST-MODUS-HINT (Bulk-KI) =================== */
.kalk-test-hint {
    margin-top: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: #E8F5E9;
    border-radius: var(--radius-md);
    border-left: 3px solid var(--success);
    color: var(--text-dark);
    font-size: 13px;
}
.kalk-test-hint strong { color: #1B5E20; }


/* ================= 12g. MODUL: ARTIKEL ========================= */

.art-toolbar {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
    flex-wrap: wrap;
    align-items: center;
}
.art-toolbar #art-suche {
    flex: 1 1 280px;
    min-width: 200px;
}
.art-toolbar #art-quelle-filter,
.art-toolbar #art-sort {
    flex: 0 0 auto;
    width: auto;
    min-width: 180px;
}

/* Lieferant-Tiles: quadratische Kästchen oberhalb der Toolbar */
.art-lieferant-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}
.art-lieferant-tile {
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: var(--space-2);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-white);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    user-select: none;
}
.art-lieferant-tile:hover {
    border-color: var(--primary);
    background: #F5FAFF;
}
.art-lieferant-tile.is-active {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--bg-white);
}
.art-lieferant-tile .tile-name {
    font-weight: 600;
    font-size: 13px;
    line-height: 1.2;
    word-break: break-word;
    max-width: 100%;
}
.art-lieferant-tile .tile-count {
    font-size: 11px;
    opacity: 0.75;
    margin-top: var(--space-1);
}
.art-lieferant-tile.is-active .tile-count {
    opacity: 0.95;
}

/* alpha.141 — Drag & Drop für Lieferanten-Merge */
.art-lieferant-tile.is-draggable {
    cursor: grab;
}
.art-lieferant-tile.is-draggable:active {
    cursor: grabbing;
}
.art-lieferant-tile.is-dragging {
    opacity: 0.4;
    transform: scale(0.97);
    cursor: grabbing;
}
.art-lieferant-tile.is-drop-target {
    border-color: var(--success, #2e7d32) !important;
    border-style: dashed !important;
    border-width: 3px !important;
    background: linear-gradient(135deg, rgba(76,175,80,0.18), rgba(76,175,80,0.08)) !important;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(76,175,80,0.25);
}
.art-lieferant-tile.is-drop-target::after {
    content: "🔀 hier zusammenführen";
    position: absolute;
    bottom: -22px; left: 50%;
    transform: translateX(-50%);
    background: var(--success, #2e7d32);
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.art-lieferant-tile { position: relative; }

/* Tag-Style für Aliase */
.art-tag {
    display: inline-block;
    padding: 2px 8px;
    margin: 2px 4px 2px 0;
    background: #E3F2FD;
    color: #0D47A1;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}
.art-tag--removable {
    padding-right: 4px;
}
.art-tag-remove {
    background: transparent;
    border: 0;
    color: #0D47A1;
    cursor: pointer;
    font-size: 11px;
    padding: 0 4px;
    margin-left: 2px;
    border-radius: 50%;
}
.art-tag-remove:hover {
    background: rgba(13, 71, 161, 0.15);
}

.art-tags-input {
    min-height: 36px;
    padding: var(--space-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
}


/* ================= 13. UTILITIES =============================== */
.is-hidden { display: none !important; }
.is-flex { display: flex; }
.is-grid { display: grid; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }


/* ================= 14. ANIMATIONEN ============================= */
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-8px); }
    40%, 60% { transform: translateX(8px); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes slideInRight {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(110%); opacity: 0; }
}


/* ================= 15. RESPONSIVE (Mobile) ===================== */
@media (max-width: 768px) {
    :root {
        --content-padding: 16px;
    }

    /* Header kompakt */
    .app-header {
        grid-template-columns: auto 1fr auto;
        padding: 0 var(--space-3);
    }
    /* app.221 — Betriebs-Umschalter am Handy PROMINENT ganz oben zeigen (statt ausblenden).
       Marken-Text + Status-Labels weichen, damit der Betriebs-Name Platz hat (Punkte bleiben). */
    .header-center { display: block; min-width: 0; }
    .header-brand { display: none; }
    .header-version { display: none; }
    .header-betrieb { font-size: 15px; }
    .betrieb-switcher-btn { padding: 7px 14px; font-weight: 700; max-width: 100%; }
    .betrieb-switcher-btn .bs-name { max-width: 46vw; }
    .header-right .drive-status-label { display: none; }

    /* Sidebar wird zur Bottom-Navigation */
    .app-shell {
        grid-template-areas:
            "header"
            "main"
            "sidebar";
        grid-template-rows: var(--header-h) 1fr auto;
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        height: auto;
        border-right: 0;
        border-top: 1px solid var(--border-light);
        padding: var(--space-2) 0;
        z-index: var(--z-header);
        box-shadow: 0 -4px 12px rgba(44, 62, 80, 0.08);
    }
    .sidebar-nav { display: flex; justify-content: space-around; }
    .sidebar-list {
        display: flex;
        flex: 1;
        justify-content: space-around;
    }
    .sidebar-link {
        flex-direction: column;
        gap: 2px;
        padding: var(--space-2);
        border-left: 0;
        border-top: 3px solid transparent;
        font-size: 10px;
        text-align: center;
    }
    .sidebar-link.active {
        border-left-color: transparent;
        border-top-color: var(--accent);
    }
    .sidebar-label { font-size: 10px; }
    .sidebar-divider { display: none; }
    /* alpha.207 — Gruppen-Header auf Mobile ausblenden (Bottom-Navi-Layout) */
    .sidebar-group-header { display: none; }
    .sidebar-nav > .sidebar-list { margin-bottom: 0; }
    .sidebar-badge { display: none; }

    .app-main { padding-bottom: calc(var(--content-padding) + 80px); }
    .app-footer { display: none; }

    /* Tabellen werden zu Karten */
    .table thead { display: none; }
    .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tbody tr {
        margin-bottom: var(--space-3);
        background: var(--bg-white) !important;
        border-radius: var(--radius-md);
        padding: var(--space-3);
        box-shadow: var(--shadow-sm);
    }
    .table tbody td {
        border: 0;
        padding: var(--space-1) 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: var(--space-3);
    }
    /* Nur Zellen mit data-label bekommen das "Label: "-Prefix */
    .table tbody td[data-label]::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        margin-right: var(--space-2);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }
    /* Action-Cell (ohne data-label, rechtsbündig): Buttons rechts ausrichten */
    .table tbody td:not([data-label]) {
        justify-content: flex-end;
        padding-top: var(--space-2);
        border-top: 1px solid var(--border-light);
        margin-top: var(--space-2);
    }

    /* Modals nehmen mehr Platz */
    .modal { max-height: 95vh; }

    /* Speisekarten-Modul: 2-Spalten-Form-Reihen einspaltig */
    .sk-form-grid { grid-template-columns: 1fr; gap: 0; }
    .sk-header { flex-direction: column; align-items: stretch; }
    .sk-actions { justify-content: stretch; }
    .sk-actions .btn { flex: 1; }

    /* Toasts schmaler */
    .toast-container { right: var(--space-3); left: var(--space-3); }
    .toast { min-width: 0; }
}

/* ===================================================================
   alpha.276 — PHONE-APP-ENTWURF: Bottom-Tab-Leiste + „Mehr"-Schublade
   Nur am Handy (≤768px). Desktop bleibt unverändert. Nutzt dieselbe App
   (= gekoppelt): die Tabs rufen activateModule(), „Mehr" zeigt die volle
   Sidebar als Slide-up.
   =================================================================== */
.mobile-tabs { display: none; }

@media (max-width: 768px) {
    .mobile-tabs {
        display: flex;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 1300;
        background: var(--bg-white, #fff);
        border-top: 1px solid var(--border-light, #eee);
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
        padding: 4px 0 calc(4px + env(safe-area-inset-bottom, 0px));
    }
    .mobile-tab {
        flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
        background: none; border: 0; cursor: pointer; padding: 6px 2px;
        font-size: 10px; font-weight: 600; color: var(--text-muted, #888);
    }
    .mobile-tab .mt-ic { font-size: 22px; line-height: 1; }
    .mobile-tab.active { color: var(--primary, #2196F3); }
    .mobile-tab:active { transform: scale(0.94); }

    /* Die vorhandene Sidebar wird zur „Mehr"-Schublade (Slide-up von unten) */
    .app-sidebar {
        position: fixed; left: 0; right: 0; bottom: 0; top: auto;
        height: 76vh; max-height: 76vh; overflow-y: auto;
        transform: translateY(110%); transition: transform 0.28s ease;
        z-index: 1400; border-top: 0; border-radius: 18px 18px 0 0;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25); padding-bottom: 90px;
    }
    body.mobile-menu-open .app-sidebar { transform: translateY(0); }
    body.mobile-menu-open::after {
        content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 1350;
    }
    /* Sidebar im Overlay = saubere vertikale Liste mit Gruppen */
    .app-sidebar .sidebar-nav,
    .app-sidebar .sidebar-list { display: block; }
    .app-sidebar .sidebar-link {
        flex-direction: row; justify-content: flex-start; gap: 12px;
        font-size: 15px; padding: 13px 20px; text-align: left;
        border-top: 0; border-left: 3px solid transparent;
    }
    .app-sidebar .sidebar-link.active { border-left-color: var(--accent); border-top-color: transparent; }
    .app-sidebar .sidebar-label { font-size: 15px; }
    .app-sidebar .sidebar-group-header { display: block; padding: 12px 20px 4px; }

    /* Platz für die Tab-Leiste unter dem Inhalt; Footer am Handy weg */
    .app-main { padding-bottom: 74px; }
    .app-footer { display: none; }
}
