/* ==========================================================================
   AURA · OCI-ALIGNED · v1
   --------------------------------------------------------------------------
   Drop-In-Ersatz für aura.css. Alle bestehenden Klassen bleiben gültig
   (.app-card, .app-btn-main, .aura-status-cell, …). Nur Tokens, Hintergrund
   und Typografie wurden an das OCI-Print-Designsystem angeglichen:

   • Primär:        OCI Bordeaux  #7B1A2E   (statt Calm Indigo #4F46E5)
   • Akzent:        Senf-Gold     #B8762A
   • Tinte:         Anthrazit     #14161B
   • Papier:        Warmes Off-White #F7F5F0 mit Bordeaux/Senf-Schimmer
   • Typo:          Inter Tight   (statt Inter)
   • Glas-Effekt:   voll behalten
   ========================================================================== */

/* --- 1. VARIABLEN & FARBPALETTE (OCI-Aligned) --- */
:root {
    /* Hintergrund & Oberflächen */
    --bg-app: #F7F5F0;
    --bg-app-fade: rgba(247, 245, 240, 0.85);
    --bg-surface: rgba(255, 255, 255, 0.65);
    --bg-surface-solid: #ffffff;
    --bg-gradient:
        radial-gradient(ellipse 80% 60% at 12% 8%, rgba(123,26,46,0.10) 0%, rgba(247,245,240,0) 55%),
        radial-gradient(ellipse 70% 60% at 92% 92%, rgba(184,118,42,0.10) 0%, rgba(247,245,240,0) 55%),
        linear-gradient(180deg, #F7F5F0 0%, #F2EEE5 100%);

    /* Text */
    --text-primary: #14161B;
    --text-secondary: #4F4D54;
    --text-muted: #7C7983;
    --border-color: rgba(20, 22, 27, 0.12);
    --rule: rgba(20, 22, 27, 0.10);
    --rule-soft: rgba(20, 22, 27, 0.06);

    /* Primär — OCI Bordeaux */
    --primary-color: #7B1A2E;
    --primary-hover: #5C1322;
    --primary-light: #F5E4E7;

    /* Akzent — Senf-Gold (NEU) */
    --accent-color: #B8762A;
    --accent-hover: #8E5A1F;
    --accent-soft: rgba(184, 118, 42, 0.10);

    /* Anthrazit — zweiter Pol für Headlines, Nav-Active, Ink-Buttons (NEU) */
    --ink: #14161B;
    --ink-2: #2A2C33;
    --ink-3: #4F4D54;

    /* Statusfarben (gedeckt, OCI-Welt) */
    --success-color: #4F6B3F;   /* Salbei */
    --danger-color:  #A8364B;   /* Bordeaux-nah */
    --warning-color: #F59E0B;   /* Amber-500 (auffällig für Status "Nachbestellbar") */
    --info-color:    #3E5C6B;   /* Fjord */

    /* Kategorie-Farben — OCI-Welt */
    --cat-1: #7B1A2E; /* Bordeaux */
    --cat-2: #B8762A; /* Senf */
    --cat-3: #14161B; /* Anthrazit */
    --cat-4: #C0593A; /* Terracotta */
    --cat-5: #3E5C6B; /* Fjord-Blau */
    --cat-6: #6B7B4F; /* Salbei */

    /* Formen & Abstände */
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-pill: 9999px;
    --shadow-sm: 0 2px 8px rgba(20, 22, 27, 0.05);
    --shadow-md: 0 8px 24px rgba(20, 22, 27, 0.08);

    /* Glass-Effekt (voll behalten) */
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-bg-strong: rgba(255, 255, 255, 0.78);
    --glass-border: 1px solid rgba(20, 22, 27, 0.10);
    --glass-blur: blur(20px);

    /* Brand-Gradient (Login-Logo, Bottom-Bar-Home, Markenakzente) */
    --gradient-brand: linear-gradient(135deg, #7B1A2E 0%, #4A0E1A 100%);
    --shadow-brand-sm: 0 4px 12px rgba(123, 26, 46, 0.30);
    --shadow-brand-md: 0 6px 20px rgba(123, 26, 46, 0.30);

    /* Primary-Tints (Hover-Borders, Focus-Ringe, weiche Backgrounds) */
    --primary-edge: rgba(123, 26, 46, 0.30);
    --primary-glow: rgba(123, 26, 46, 0.15);
    --primary-soft: rgba(123, 26, 46, 0.08);

    /* Light-Veil-Tints — jetzt warm (Papier-Roséschimmer) statt Lavendel */
    --light-veil-15: rgba(245, 228, 231, 0.30);
    --light-veil-30: rgba(245, 228, 231, 0.50);
    --light-veil-40: rgba(245, 228, 231, 0.65);
    --light-veil-50: rgba(245, 228, 231, 0.75);

    /* Status-Tints (Alert-Hintergründe + Edges) */
    --success-soft: rgba(79, 107, 63, 0.12);
    --warning-soft: rgba(245, 158, 11, 0.20);
    --danger-soft:  rgba(168, 54, 75, 0.12);
    --info-soft:    rgba(62, 92, 107, 0.12);
    --success-edge: rgba(79, 107, 63, 0.30);
    --warning-edge: rgba(245, 158, 11, 0.55);
    --danger-edge:  rgba(168, 54, 75, 0.30);
    --info-edge:    rgba(62, 92, 107, 0.30);

    /* Status-Text-Töne (lesbar auf den Soft-Hintergründen) */
    --success-ink: #2F4226;
    --warning-ink: #78350F;
    --danger-ink:  #6E1E2C;
    --info-ink:    #28414C;

    /* Placeholder-Gradient (Bestand-Cards ohne Foto) — warmer Verlauf */
    --gradient-placeholder: linear-gradient(135deg, #F5E4E7 0%, #E8C9CF 50%, #C99AA2 100%);

    /* Bootstrap Overrides */
    --bs-primary: var(--primary-color);
    --bs-success: var(--success-color);
    --bs-danger: var(--danger-color);
    --bs-warning: var(--warning-color);
    --bs-info: var(--info-color);
    --bs-body-bg: var(--bg-app);
    --bs-body-color: var(--text-primary);
    --bs-border-radius: var(--radius-sm);
}

/* --- 2. BASIS STYLES --- */
body {
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'Inter Tight', system-ui, -apple-system, sans-serif;
    line-height: 1.55;
    letter-spacing: -0.005em;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.022em;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

    a:hover {
        color: var(--primary-hover);
    }

/* --- 3. UI KOMPONENTEN --- */

/* Navigation (Glass) */
.navbar {
    background: var(--glass-bg) !important;
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border-bottom: var(--glass-border);
    box-shadow: none;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.navbar-logo { height: 35px; }

.navbar-brand {
    color: var(--ink) !important;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
}

.navbar-light .navbar-nav .nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
}

    .navbar-light .navbar-nav .nav-link:hover,
    .navbar-light .navbar-nav .nav-link.active {
        color: var(--ink) !important;
    }

/* CARDS (Glass) */
.card {
    background: var(--glass-bg);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.card-header {
    background: var(--light-veil-30);
    color: var(--text-primary);
    border-bottom: var(--glass-border);
    padding: 1rem 1.5rem;
    font-weight: 600;
}

.card-body { padding: 1.5rem; }

/* --- 4. HILFSKLASSEN (Helpers) --- */

.bg-light { background: var(--light-veil-15) !important; }
.bg-primary { background-color: var(--primary-color) !important; }
.bg-accent  { background-color: var(--accent-color)  !important; color: #fff; }
.bg-ink     { background-color: var(--ink) !important; color: #fff; }
.text-primary { color: var(--primary-color) !important; }
.text-accent  { color: var(--accent-color)  !important; }
.text-ink     { color: var(--ink) !important; }
.border-primary { border-color: var(--primary-color) !important; }

/* Eigene Farbklassen für Kategorien (OCI-Welt) */
.cat-bg-1 { background-color: var(--cat-1) !important; color: white !important; }
.cat-bg-2 { background-color: var(--cat-2) !important; color: white !important; }
.cat-bg-3 { background-color: var(--cat-3) !important; color: white !important; }
.cat-bg-4 { background-color: var(--cat-4) !important; color: white !important; }
.cat-bg-5 { background-color: var(--cat-5) !important; color: white !important; }
.cat-bg-6 { background-color: var(--cat-6) !important; color: white !important; }

.cat-text-1 { color: var(--cat-1) !important; }
.cat-text-2 { color: var(--cat-2) !important; }
.cat-text-3 { color: var(--cat-3) !important; }
.cat-text-4 { color: var(--cat-4) !important; }
.cat-text-5 { color: var(--cat-5) !important; }
.cat-text-6 { color: var(--cat-6) !important; }

.cat-border-1 { border-left: 4px solid var(--cat-1) !important; }
.cat-border-2 { border-left: 4px solid var(--cat-2) !important; }
.cat-border-3 { border-left: 4px solid var(--cat-3) !important; }
.cat-border-4 { border-left: 4px solid var(--cat-4) !important; }
.cat-border-5 { border-left: 4px solid var(--cat-5) !important; }
.cat-border-6 { border-left: 4px solid var(--cat-6) !important; }

/* Transparente Kategorie-Hintergründe (8% Opacity) */
.cat-light-1 { background-color: rgba(123, 26, 46, 0.08)  !important; }
.cat-light-2 { background-color: rgba(184, 118, 42, 0.08) !important; }
.cat-light-3 { background-color: rgba(20, 22, 27, 0.06)   !important; }
.cat-light-4 { background-color: rgba(192, 89, 58, 0.08)  !important; }
.cat-light-5 { background-color: rgba(62, 92, 107, 0.08)  !important; }
.cat-light-6 { background-color: rgba(107, 123, 79, 0.08) !important; }

/* --- 5. BUTTONS --- */
.btn {
    border-radius: var(--radius-sm);
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.25s ease;
    border: none;
    box-shadow: none;
    letter-spacing: -0.005em;
}

.btn-lg { padding: 0.9rem 1.5rem; font-size: 1.1rem; }

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

    .btn-primary:hover {
        background-color: var(--primary-hover);
        transform: translateY(-1px);
        box-shadow: var(--shadow-md);
        color: #fff;
    }

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

.btn-ink {
    background-color: var(--ink);
    color: #fff;
}
    .btn-ink:hover {
        background-color: #000;
        transform: translateY(-1px);
        color: #fff;
    }

.btn-success {
    background-color: var(--success-color);
    color: white;
}
    .btn-success:hover { background-color: #3F5532; color: #fff; }

.btn-outline-secondary {
    background-color: transparent;
    border: 1px solid var(--rule);
    color: var(--text-secondary);
    box-shadow: none;
}
    .btn-outline-secondary:hover {
        background-color: rgba(20, 22, 27, 0.04);
        color: var(--ink);
        border-color: var(--ink);
    }

/* --- 6. INPUTS --- */
.form-control, .form-select {
    background: var(--glass-bg);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 16px;
    color: var(--text-primary);
    box-shadow: none;
}

    .form-control:focus, .form-select:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 4px var(--primary-glow);
        outline: none;
    }

.form-label {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.input-group-text {
    background-color: transparent;
    border: 1px solid var(--rule);
    border-right: none;
    color: var(--text-secondary);
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-group .form-control {
    border-left: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
}

.input-group:focus-within .input-group-text {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-glow);
    z-index: 2;
}

/* --- 7. FOOTER STYLE --- */
.footer {
    background: transparent;
    border-top: var(--glass-border);
    color: var(--text-secondary);
    padding: 1rem 0;
    text-align: center;
    width: 100%;
    font-size: 0.9rem;
}
    .footer a {
        color: var(--text-secondary);
        text-decoration: underline;
    }

/* --- 8. MOBILE --- */
@media (max-width: 768px) {
    .container { padding-left: 1rem; padding-right: 1rem; }
    .btn { width: 100%; margin-bottom: 0.5rem; display: flex; justify-content: center; align-items: center; }
    .btn-sm { width: auto; margin-bottom: 0; }
}

/* =========================================================
   9. APP-SPEZIFISCHE KOMPONENTEN
========================================================= */

/* A. Standard-Karte (Glass) */
.app-card {
    background: var(--glass-bg);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

/* B. Große mobile Buttons (Daumen-freundlich) */
.app-btn-main {
    border-radius: var(--radius-sm);
    font-weight: 700;
    padding: 14px 20px;
    box-shadow: var(--shadow-sm);
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* C. Formular-Felder */
.app-input {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    background-color: var(--bg-surface);
}

/* D. Softe Badges (Glass-Stil) */
.app-badge-soft {
    background: var(--light-veil-40);
    color: var(--text-secondary);
    border-radius: var(--radius-pill);
    padding: 4px 10px;
    font-weight: 600;
    font-size: 0.75rem;
    border: 1px solid var(--rule);
}

.app-badge-soft-success {
    background: var(--success-soft);
    color: var(--success-ink);
    border: 1px solid var(--success-edge);
    border-radius: var(--radius-pill);
    padding: 4px 10px;
    font-weight: 600;
    font-size: 0.75rem;
}

/* E. Hover-Effekt für anklickbare Karten */
.app-card-hover {
    transition: all 0.3s ease;
    border: 1px solid transparent;
}
    .app-card-hover:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md) !important;
        border-color: var(--primary-edge);
    }

/* F. Großer Toggle-Switch */
.app-switch-lg {
    transform: scale(1.5);
    margin-top: 0.25rem !important;
}

/* G. Login-Logo (Bordeaux-Gradient) */
.app-login-logo-container {
    width: 85px;
    height: 85px;
    min-width: 85px;
    min-height: 85px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-left: auto;
    margin-right: auto;
    background: var(--gradient-brand) !important;
    box-shadow: var(--shadow-brand-md) !important;
}
    .app-login-logo-container i {
        font-size: 2.8rem;
        line-height: 0;
        color: #ffffff !important;
    }

/* H. Icon-Boxen */
.app-icon-box {
    width: 70px; height: 70px; min-width: 70px; min-height: 70px;
    flex-shrink: 0;
}
.app-icon-box-sm {
    width: 50px; height: 50px; min-width: 50px; min-height: 50px;
    flex-shrink: 0;
}

/* I. Delete-Button (44px Touch Target) */
.app-btn-delete {
    width: 44px; height: 44px; min-width: 44px; min-height: 44px;
    background-color: var(--danger-soft);
    border: none;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    color: var(--danger-ink);
}
    .app-btn-delete:hover { background-color: rgba(168, 54, 75, 0.20); }

/* J. Foto-Lösch-Button */
.app-btn-delete-foto {
    width: 24px; height: 24px; min-width: 24px; min-height: 24px;
    padding: 0; font-size: 0.75rem; line-height: 1;
}

/* K. Thumbnails */
.app-thumb {
    width: 65px; height: 65px;
    border-radius: 8px; overflow: hidden; flex-shrink: 0;
}
    .app-thumb img { width: 100%; height: 100%; object-fit: cover; }

.app-thumb-sm {
    width: 55px; height: 55px;
    border-radius: 8px; overflow: hidden; flex-shrink: 0;
}
    .app-thumb-sm img { width: 100%; height: 100%; object-fit: cover; }

/* L. Foto-Upload-Buttons */
.app-btn-upload {
    width: 65px; height: 65px;
    border-radius: 8px;
    border-style: dashed !important;
    cursor: pointer;
    background-color: var(--bg-surface);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 4px; margin: 0;
}
    .app-btn-upload span { font-size: 0.55rem; font-weight: 700; }

.app-btn-upload-sm {
    width: 55px; height: 55px;
    border-radius: 8px;
    border-style: dashed !important;
    cursor: pointer;
    background-color: var(--bg-surface);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 0; margin: 0;
}

/* M. Bottom-Bar (Glass Pill Navigation) */
.app-bottom-bar-wrapper {
    background: linear-gradient(to top, var(--bg-app-fade) 60%, transparent);
    pointer-events: none;
    z-index: 1040;
}

.app-bottom-bar {
    pointer-events: auto;
    border-radius: var(--radius-pill);
    background: var(--glass-bg) !important;
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border) !important;
}
    .app-bottom-bar .card-body { height: 65px; }

.app-bottom-bar-item {
    width: 60px;
    text-decoration: none;
    text-align: center;
    display: flex; flex-direction: column; align-items: center;
}
    .app-bottom-bar-item span { font-size: 0.65rem; font-weight: 700; }

.app-bottom-bar-home {
    width: 55px; height: 55px;
    margin-top: -30px;
    border: 4px solid rgba(255, 255, 255, 0.85);
    background: var(--gradient-brand) !important;
    box-shadow: var(--shadow-brand-sm);
}

/* N. Versteckte File-Inputs */
.app-file-hidden { display: none; }

/* O. Status-Dropdown */
.app-status-select { max-width: 200px; }

/* P. Auftragskachel im Dashboard */
.app-stat-card {
    min-height: 90px;
    padding: 0.75rem;
    border-radius: 0.5rem;
}

/* --- MOBILE: body padding nur auf Mobile --- */
@media (max-width: 767.98px) { body { padding-bottom: 80px; } }
@media (min-width: 768px)   { body { padding-bottom: 0; } }

/* --- AURA GLASS OVERRIDES --- */
.alert {
    background: var(--glass-bg);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--radius-sm);
}
.alert-success { background: var(--success-soft) !important; border-left: 3px solid var(--success-color) !important; color: var(--success-ink); }
.alert-warning { background: var(--warning-soft) !important; border-left: 3px solid var(--warning-color) !important; color: var(--warning-ink); }
.alert-danger  { background: var(--danger-soft)  !important; border-left: 3px solid var(--danger-color)  !important; color: var(--danger-ink); }
.alert-info    { background: var(--info-soft)    !important; border-left: 3px solid var(--info-color)    !important; color: var(--info-ink); }
.alert-light   { background: var(--glass-bg)     !important; }

.list-group-item {
    background: var(--glass-bg);
    border-color: rgba(20, 22, 27, 0.10);
}

.modal-content {
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--radius-md);
}

/* Form-Check (Switches): Bordeaux statt Indigo */
.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Pill-Badges */
.badge {
    border-radius: var(--radius-pill);
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* --- AURA TYPOGRAFIE OVERRIDES --- */
.text-primary { color: var(--primary-color) !important; }
.text-dark    { color: var(--ink) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-body    { color: var(--text-primary) !important; }

a.text-primary:hover { color: var(--primary-hover) !important; }

::placeholder { color: #B4B0BA !important; opacity: 1; }
::selection { background: var(--primary-soft); color: var(--ink); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(20, 22, 27, 0.20); border-radius: var(--radius-pill); }

/* Page Header — große, dunkle Überschriften */
h1, h2 { color: var(--ink) !important; letter-spacing: -0.022em; }
h2.text-primary { color: var(--ink) !important; }

.container { background: transparent; }
.input-group-text { background: transparent; border-color: var(--rule); }

/* --- AURA: Globale Cleanups --- */
.aura-title    { font-size: 1.75rem; letter-spacing: -0.022em; font-weight: 700; color: var(--ink); }
.aura-title-lg { font-size: 2rem;     letter-spacing: -0.025em; font-weight: 700; color: var(--ink); }

/* Aura Pastell-Kreise — auf OCI-Welt umgestellt */
.aura-icon-circle {
    width: 48px; height: 48px; min-width: 48px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
}
.aura-icon-circle-bordeaux { background: var(--primary-soft); color: var(--primary-color); }
.aura-icon-circle-mustard  { background: var(--accent-soft);  color: var(--accent-color);  }
.aura-icon-circle-fjord    { background: var(--info-soft);    color: var(--info-color);    }
.aura-icon-circle-sage     { background: var(--success-soft); color: var(--success-color); }
/* Legacy-Aliasse — alte Mockups/Pages laufen weiter, nur in OCI-Tönen */
.aura-icon-circle-lavender { background: var(--light-veil-40); color: var(--ink-3); }
.aura-icon-circle-sky      { background: var(--info-soft);     color: var(--info-color); }
.aura-icon-circle-mint     { background: var(--success-soft);  color: var(--success-ink); }
.aura-icon-circle-peach    { background: rgba(192, 89, 58, 0.10); color: var(--cat-4); }

/* Buttons: keine Schatten global */
.btn { box-shadow: none !important; }
.btn:hover { box-shadow: none !important; }
.btn-primary:hover { transform: translateY(-1px); }

.shadow-lg { box-shadow: var(--shadow-md) !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }

.card-header { background: transparent !important; }

/* ==============================================
   AURA STATUS CELL — unverändert in Logik, neue Farben
   ============================================== */
.aura-status-cell {
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-solid);
    text-align: center;
    line-height: 1.15;
}
.aura-status-cell--available   { background: var(--success-soft); border-color: var(--success-edge); color: var(--success-ink); }
.aura-status-cell--orderable   { background: var(--warning-soft); border-color: var(--warning-edge); color: var(--warning-ink); }
.aura-status-cell--unavailable { background: var(--danger-soft);  border-color: var(--danger-edge);  color: var(--danger-ink); }

.aura-status-cell--amount-high  { border-width: 2px; font-weight: 700; }
.aura-status-cell--amount-low   { border-width: 1px; border-style: solid; }
.aura-status-cell--amount-empty { border-style: dashed; opacity: 0.85; }

.aura-status-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid;
    font-weight: 600;
    font-size: 0.72rem;
}
.aura-status-chip--available   { background: var(--success-soft); border-color: var(--success-edge); color: var(--success-ink); }
.aura-status-chip--orderable   { background: var(--warning-soft); border-color: var(--warning-edge); color: var(--warning-ink); }
.aura-status-chip--unavailable { background: var(--danger-soft);  border-color: var(--danger-edge);  color: var(--danger-ink); }

/* ==============================================
   OFFLINE / PWA — unverändert (System-Farben sind hier sinnvoll)
   ============================================== */
.offline-banner {
    display: none;
    align-items: center; justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    z-index: 1050;
}
.offline-banner.show { display: flex; }
.offline-banner-dark  { background-color: #343a40; color: #fff; }
.offline-banner-blue  { background-color: #0d6efd; color: #fff; }
.offline-banner-green { background-color: #198754; color: #fff; }
.offline-banner-red   { background-color: #dc3545; color: #fff; }

.offline-sync-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background-color: rgba(255, 193, 7, 0.15);
    color: #856404;
    font-size: 0.75rem;
    font-weight: 600;
}

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin { display: inline-block; animation: spin 1s linear infinite; }

.offline-toggle {
    position: fixed;
    top: 12px; right: 12px;
    z-index: 1060;
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.8);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}
.offline-toggle-online  { background-color: #198754; color: #fff; }
.offline-toggle-offline { background-color: #fd7e14; color: #fff; animation: pulse-orange 2s infinite; }

@keyframes pulse-orange {
    0%, 100% { box-shadow: 0 2px 8px rgba(253,126,20,0.3); }
    50%      { box-shadow: 0 2px 16px rgba(253,126,20,0.6); }
}

.offline-hint-bar {
    background-color: #fd7e14; color: #fff;
    text-align: center;
    padding: 0.3rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.offline-cache-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}

/* ==============================================
   OCI MATRIX — Bestandsmatrix-Komponente
   Doku: DESIGN.oci.md §8
   ============================================== */

:root {
  /* Schriften */
  --matrix-cell-num-size: 18px;
  --matrix-cell-sub-size: 12px;
  --matrix-rowhead-size: 14px;
  --matrix-colhead-size: 12px;
  --matrix-fmt-size: 13px;

  /* Layout */
  --matrix-cell-pad: 10px 8px;
  --matrix-cell-minh: 56px;
  --matrix-thumb-size: 44px;
  --matrix-gap: 4px;
  --matrix-rowhead-min-width: 110px;

  /* Format-Trennzeile (Senf-Akzent — bewusst entkoppelt von --warning-*,
     damit die Statusfarbe "Nachbestellbar" auffälliger sein kann ohne die
     Format-Trennzeile mit zu verändern.) */
  --matrix-fmt-bg: rgba(184, 118, 42, 0.10);
  --matrix-fmt-color: #6E4615;
  --matrix-fmt-accent: #B8762A;

  /* Sticky-Spalte */
  --matrix-sticky-bg: var(--bg-surface-solid);
  --matrix-sticky-shadow: 2px 0 4px rgba(20, 22, 27, 0.08);
}

/* Wrapper + Scroll-Container.
   max-height + overflow-y machen den Wrapper zur vertikalen Scroll-Box: bei vielen
   Groessen scrollt die Matrix in sich, und die Farb-Spaltenkoepfe (sticky top) bleiben
   oben stehen. Kurze Matrizen (Inhalt < max-height) scrollen nicht -> kein Effekt. */
.oci-matrix {
  background: var(--bg-surface-solid);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 14px;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 70vh;
  box-shadow: var(--shadow-sm);
}

.oci-matrix-grid {
  display: grid;
  gap: var(--matrix-gap);
  min-width: max-content;
}

/* Spalten-Header (Farb-Thumbnails + Label) — sticky oben beim vertikalen Scrollen.
   Hintergrund opak (Tint ueber Surface), damit gescrollte Zellen nicht durchscheinen. */
.oci-matrix-colhead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(rgba(20,22,27,0.06), rgba(20,22,27,0.06)), var(--bg-surface-solid);
  font-weight: 600;
  padding: 8px 6px;
  border-radius: 6px;
  text-align: center;
  font-size: var(--matrix-colhead-size);
}
.oci-matrix-colhead-thumb {
  width: var(--matrix-thumb-size);
  height: var(--matrix-thumb-size);
  border-radius: 0;
  margin: 0 auto 6px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}
.oci-matrix-colhead-label {
  font-size: var(--matrix-colhead-size);
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.2;
}
.oci-matrix-colhead-sublabel {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 2px;
}
.oci-matrix-cell-artnr {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.oci-matrix-cell-sub--muted {
  opacity: 0.75;
  font-size: 11px;
}

/* Sticky-Corner (oben links) + Sticky-Spalte.
   top:0 zusaetzlich zu left:0 -> bleibt beim gleichzeitigen vertikalen + horizontalen
   Scrollen in der Ecke; z-index 3 = ueber Farb-Header (1) und Groessen-Spalte (2). */
.oci-matrix-corner {
  position: sticky;
  left: 0;
  top: 0;
  background: var(--matrix-sticky-bg);
  box-shadow: var(--matrix-sticky-shadow);
  z-index: 3;
}
.oci-matrix-rowhead {
  position: sticky;
  left: 0;
  background: var(--matrix-sticky-bg);
  box-shadow: var(--matrix-sticky-shadow);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: var(--matrix-rowhead-size);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  min-width: var(--matrix-rowhead-min-width);
  z-index: 2;
}

/* Format-Trennzeile (β Senf-Akzent) */
.oci-matrix-fmt {
  grid-column: 1 / -1;
  padding: 9px 14px;
  font-size: var(--matrix-fmt-size);
  font-weight: 600;
  border-radius: 6px;
  background: var(--matrix-fmt-bg);
  color: var(--matrix-fmt-color);
  border-left: 4px solid var(--matrix-fmt-accent);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Zelle (Layout-Schicht — Status-Farben kommen aus .aura-status-cell--*) */
.oci-matrix-cell {
  padding: var(--matrix-cell-pad);
  min-height: var(--matrix-cell-minh);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

/* Zell-Body Helper */
.oci-matrix-cell-num {
  font-size: var(--matrix-cell-num-size);
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
}
.oci-matrix-cell-sub {
  font-size: var(--matrix-cell-sub-size);
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.1;
}

/* Input-Variante */
.oci-matrix-input {
  width: 100%;
  max-width: 70px;
  height: 36px;
  border: 1.5px solid var(--rule);
  border-radius: 6px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  background: var(--bg-surface-solid);
  padding: 0;
}
.oci-matrix-input:focus {
  outline: 2px solid var(--success-edge);
  border-color: var(--success-color);
}

/* Hint-Texte (Bestand-Lage) */
.oci-matrix-hint { font-size: 11px; margin-top: 2px; }
.oci-matrix-hint--low  { color: var(--warning-color); font-weight: 600; }
.oci-matrix-hint--zero { color: var(--danger-color);  font-weight: 600; }
.oci-matrix-hint--ok   { color: var(--text-muted); }

/* Inventur-Icon */
.oci-matrix-inv-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}
.oci-matrix-inv-icon--yes { background: var(--success-soft); color: var(--success-color); }
.oci-matrix-inv-icon--no  { background: rgba(20,22,27,0.05); color: rgba(20,22,27,0.3); }

/* Legende */
.oci-matrix-legend {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--rule-soft);
}

/* Mobile (≤ 576px) */
@media (max-width: 576px) {
  :root {
    --matrix-cell-num-size: 16px;
    --matrix-cell-minh: 50px;
    --matrix-thumb-size: 32px;
    --matrix-cell-pad: 8px 5px;
  }
}

/* Print */
@media screen {
  .oci-matrix-print { display: none; }
}
@media print {
  /* Außenbox der Matrix-Komponente unsichtbar — die Tabelle selbst hat ihre Borders */
  .oci-matrix { box-shadow: none !important; border: 0 !important; overflow: visible !important; max-height: none !important; padding: 0 !important; background: transparent !important; }
  .oci-matrix-corner, .oci-matrix-rowhead, .oci-matrix-colhead { position: static !important; box-shadow: none; }
  .oci-matrix-cell { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* Bildschirm-Variante komplett aus, Print-Tabelle übernimmt */
  .oci-matrix-grid,
  .oci-matrix-legend { display: none !important; }

  .oci-matrix-print {
    display: table;
    width: auto;             /* schmal bei wenigen Spalten → linksbündig statt zentriert */
    max-width: 100%;
    border-collapse: collapse;
    font-size: 8pt;
    line-height: 1.15;
    table-layout: fixed;
    color: #000;
  }
  .oci-matrix-print thead {
    /* table-header-group weggelassen (mit table-row-group überschrieben), weil
       Chromium beim Layout-Berechnen sonst Platz für thead-Wiederholung auf
       Folgeseiten reserviert und früher bricht — bei knappen Tabellen wie
       FAV01/BES04 (24 Zeilen) lässt das Seite 1 mit ungenutztem Platz und
       schiebt die letzte Zeile auf Seite 2. Bei aktuellen Daten passt jedes
       Dessin (max 24 Zeilen) auf 1 Seite, daher keine Wiederholung nötig. */
    display: table-row-group;
  }

  /* Corner-Label (Dessin-Code) in der wiederholten thead-Corner-Cell, für die
     Identifikation der Tabelle auf Folgeseiten. Page-Title und Subtitle selbst
     werden als externe Block-Elemente in voller Seitenbreite gerendert
     (siehe site.css → .print-page-title / .print-page-subtitle). */
  .oci-matrix-print th.corner .corner-label {
    display: block;
    font-size: 7pt;
    color: #666;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1.1;
  }
  .oci-matrix-print tbody { display: table-row-group; }
  .oci-matrix-print tr { break-inside: avoid; page-break-inside: avoid; }
  .oci-matrix-print tr.fmt {
    break-after: avoid;
    page-break-after: avoid;
    background: #f0f0f0;
    font-weight: 600;
    text-align: left;
  }
  .oci-matrix-print tr.fmt td { padding: 3px 6px; text-align: left; border-color: #aaa; }
  .oci-matrix-print th,
  .oci-matrix-print td {
    border: 0.5pt solid #999;
    padding: 2.5px 3px;
    text-align: center;
    vertical-align: top;
    overflow: hidden;
    word-break: break-word;
    width: 14mm;             /* Farbspalten fest 14mm */
  }
  .oci-matrix-print thead th {
    background-color: #e8e8e8;
    background-repeat: no-repeat;
    background-position: center top;
    background-size: 9mm 9mm;
    font-weight: 600;
    vertical-align: top;
    height: 15mm;
  }
  .oci-matrix-print thead th.with-thumb {
    padding-top: 10mm;       /* Platz für 9mm Background-Thumbnail */
  }
  .oci-matrix-print thead th .lbl {
    font-size: 7.5pt;
    line-height: 1.1;
  }
  .oci-matrix-print th.size {
    text-align: left;
    width: 22mm;
    font-weight: 500;
    background: #f6f6f6;
    vertical-align: middle;
    height: auto;
    background-image: none;
    padding-top: 2px;
  }
  .oci-matrix-print th.corner {
    width: 22mm;
    background: #e8e8e8;
    background-image: none;
    padding-top: 2px;
  }
  .oci-matrix-print thead th .lbl {
    font-size: 7.5pt;
    line-height: 1.1;
    font-weight: 600;
  }
  .oci-matrix-print thead th .sub {
    font-size: 6.5pt;
    color: #555;
    font-weight: 400;
  }
  .oci-matrix-print td.c-ok        { background: #d8f5d8; }
  .oci-matrix-print td.c-orderable { background: #fff4d8; }
  .oci-matrix-print td.c-unavailable { color: #999; background: #fafafa; }
  .oci-matrix-print td .num   { display: block; font-weight: 600; line-height: 1.15; }
  .oci-matrix-print td .artnr { display: block; font-size: 6.5pt; color: #666; line-height: 1.05; margin-top: 1px; }

  /* Adaptive: Tabellen MIT ArtNr (2-zeilige Zellen, z.B. FAV01, NVI08, LS001) sind
     vertikal voller — Header und Zellen kompakter, damit alles auf eine Seite passt.
     Tabellen OHNE ArtNr (z.B. BES04 — Meterware) behalten die großzügigen Defaults. */
  .oci-matrix-print:has(.artnr) {
    line-height: 1.05;
  }
  .oci-matrix-print:has(.artnr) thead th {
    height: 12mm;
    background-size: 7mm 7mm;
  }
  .oci-matrix-print:has(.artnr) thead th.with-thumb {
    padding-top: 7mm;
  }
  .oci-matrix-print:has(.artnr) thead th .lbl {
    font-size: 7pt;
    line-height: 1.05;
  }
  .oci-matrix-print:has(.artnr) th,
  .oci-matrix-print:has(.artnr) td {
    padding: 1.5px 3px;
  }
  .oci-matrix-print:has(.artnr) td .num   { line-height: 1; }
  .oci-matrix-print:has(.artnr) td .artnr { line-height: 1; }

  .oci-matrix-print,
  .oci-matrix-print * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Print-Legende unter der Tabelle */
  .oci-matrix-print-legend {
    margin-top: 3mm;
    display: flex !important;
    gap: 8mm;
    font-size: 8pt;
    align-items: center;
  }
  .oci-matrix-print-legend .l {
    display: inline-flex; align-items: center;
    padding: 1mm 3mm;
    border: 0.5pt solid #999;
    border-radius: 1mm;
    font-weight: 500;
  }
  .oci-matrix-print-legend .l.c-ok        { background: #d8f5d8; }
  .oci-matrix-print-legend .l.c-orderable { background: #fff4d8; }
  .oci-matrix-print-legend .l.c-unavailable { background: #fafafa; color: #555; }
}
/* Print-Legende immer im Markup, aber nur im Print sichtbar */
.oci-matrix-print-legend { display: none; }
