/* style.css - Clean Version */

/* 1. VARIABLEN & GRUNDEINSTELLUNGEN */
:root {
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-muted: #666666;
    --border-color: #dddddd;
    --primary: #007bff;
    --primary-hover: #0056b3;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
}

body {
    margin: 0;
    padding: 20px;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    /* WICHTIG: Kein display:flex hier, damit die Seite normal von oben nach unten fließt */
}

h1 { margin-bottom: 1.5rem; font-weight: 300; }
h2 { margin-top: 0; font-weight: 400; border-bottom: 1px solid var(--border-color); padding-bottom: 15px;}
h3 { margin-top: 0; font-weight: 600; color: var(--text-color); }
a { text-decoration: none; color: inherit; }

/* 2. NAVIGATION */
.nav { 
    background: var(--card-bg); 
    padding: 15px 25px; 
    border-radius: 12px; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    margin-bottom: 30px;
}
.nav-left, .nav-right { display: flex; align-items: center; gap: 20px; }
.nav a { font-weight: 600; color: #555; transition: 0.2s; }
.nav a:hover { color: #000; }

.btn-logout { color: var(--danger) !important; cursor: pointer; }
.btn-login { background: var(--primary); color: white !important; padding: 8px 15px; border-radius: 6px; }

/* 3. GRID & CARDS */
.finance-container { max-width: 1400px; margin: 0 auto; }
.finance-grid { display: grid; grid-template-columns: 3fr 1fr; gap: 20px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 30px; }

.card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border: 1px solid transparent;
    /* transition: transform 0.2s;  <-- HIER GELÖSCHT (Globale Bewegung aus) */
}

/* Neuer Block: Nur klickbare Karten (Links) dürfen sich bewegen */
a.card {
    transition: transform 0.2s, box-shadow 0.2s;
    display: block; /* Stellt sicher, dass der Link wie eine Box wirkt */
}

a.card:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 6px 15px rgba(0,0,0,0.1); 
}

/* Card Content Styles */
.card-icon { font-size: 2.5rem; color: var(--primary); margin-bottom: 10px; }
.card-title { font-weight: bold; font-size: 1.1em; display: block; margin-bottom: 5px; }
.card-desc { color: var(--text-muted); font-size: 0.9em; }

/* 4. ALERTS & FORMULARE */
.alert { padding: 15px; margin-bottom: 20px; border-radius: 8px; background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

input, select, textarea {
    display: block; width: 100%; padding: 12px; margin: 8px 0 20px;
    border: 1px solid var(--border-color); border-radius: 6px;
    background: #fff; color: var(--text-color); font-size: 1rem; box-sizing: border-box;
}

button.btn, .btn {
    display: inline-block; padding: 10px 20px; border-radius: 6px;
    background-color: var(--primary); color: white; border: none;
    font-weight: 600; cursor: pointer; font-size: 1rem;
}
button:hover, .btn:hover { background-color: var(--primary-hover); }

/* 5. TABELLEN & MOBILE */
.table-responsive { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.95em; }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid #eee; }
th { background-color: #f8f9fa; color: var(--text-muted); font-weight: 600; }

.nav-scroll {
    display: flex; gap: 5px; overflow-x: auto; padding-bottom: 5px; white-space: nowrap;
    scrollbar-width: none;
}
.btn-group { background: white; padding: 5px; border-radius: 8px; display: flex; gap: 5px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }

/* Switch Toggle */
.switch { position: relative; display: inline-block; width: 40px; height: 20px; margin-right:10px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 20px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 2px; bottom: 2px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--warning); }
input:checked + .slider:before { transform: translateX(20px); }

@media (max-width: 768px) {
    .finance-grid { grid-template-columns: 1fr; }
    .nav { flex-direction: column; gap: 15px; text-align: center; }
    .nav-left, .nav-right { flex-direction: column; gap: 10px; }
}
.inventory-card {
        background: #fff;
        border: 1px solid #dae0e5;
        border-radius: 8px;
        margin: 15px 0;
        overflow: hidden;
        transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Der Header: Eine Zeile, Flexbox */
.inventory-header {
    padding: 12px 15px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Text links, Toggle rechts */
    cursor: pointer;
    user-select: none;
}

.inventory-header:hover {
    background: #e9ecef;
}

/* Der Inhalt: Standardmäßig versteckt */
.inventory-body {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, opacity 0.4s ease-in-out, padding 0.4s ease;
    padding: 0 15px; /* Kein Padding wenn zu */
    background: #fff;
}

/* Aktiv-Status (wird per JS gesetzt) */
.inventory-card.active {
    border-color: #0d6efd;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.08);
}

.inventory-card.active .inventory-header {
    background: #e7f1ff; /* Leichtes Blau im Header wenn aktiv */
    color: #052c65;
}

.inventory-card.active .inventory-body {
    padding: 20px 15px; /* Padding kommt dazu beim Öffnen */
    max-height: 400px; /* Genug Platz zum Ausfahren */
    opacity: 1;
    border-top: 1px solid #dae0e5;
}

/* Kleiner Text im Header */
.header-label {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}
.split-card {
    background: #fff;
    border: 1px solid #dae0e5;
    border-radius: 8px;
    margin-bottom: 20px; /* Abstand nach unten */
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.split-header {
    padding: 12px 15px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.split-header:hover {
    background: #e9ecef;
}

.split-body {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, opacity 0.4s ease-in-out, padding 0.4s ease;
    padding: 0 15px;
    background: #fff;
}

/* Aktiv-Status */
.split-card.active {
    border-color: #17a2b8; /* Ein Cyan/Teal Ton zur Unterscheidung, oder #0d6efd für Blau */
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.15);
}

.split-card.active .split-header {
    background: #e0f7fa; /* Ganz leichtes Cyan */
    color: #006064;
}

.split-card.active .split-body {
    padding: 20px 15px;
    max-height: 1000px; /* Genug Platz für viele Zeilen */
    opacity: 1;
    border-top: 1px solid #dae0e5;
}    
/* Styles für die Aktions-Buttons oben */
.top-actions-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 16px; border-radius: 20px; text-decoration: none;
    font-weight: 600; font-size: 0.9em; transition: transform 0.1s, box-shadow 0.2s;
    border: 1px solid transparent; cursor: pointer;
}
.top-actions-btn:hover { transform: translateY(-1px); box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.btn-outline-info { background: white; color: #17a2b8; border-color: #17a2b8; }
.btn-outline-info:hover { background: #17a2b8; color: white; }
.btn-outline-primary { background: white; color: #007bff; border-color: #007bff; }
.btn-outline-primary:hover { background: #007bff; color: white; }
.btn-outline-danger { background: white; color: #dc3545; border-color: #dc3545; }
.btn-outline-danger:hover { background: #dc3545; color: white; }

/* Styles für den Privat/Business Toggle */
.scope-toggle-container {
    display: inline-flex; background: #e9ecef; padding: 4px; border-radius: 8px;
    position: relative; margin-bottom: 20px;
}
.scope-radio { display: none; } /* Versteckt die echten Radio-Buttons */
.scope-label {
    padding: 8px 20px; cursor: pointer; border-radius: 6px;
    font-weight: 600; color: #6c757d; user-select: none;
    display: flex; align-items: center; gap: 8px; transition: all 0.2s;
}
.scope-label:hover { color: #495057; }

/* Wenn Radio gecheckt ist, style das Label danach */
.scope-radio:checked + .scope-label {
    background: white; color: #212529;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
/* Farbakzente für Aktiv-Status */
#radioPrivate:checked + .scope-label { color: #28a745; }
#radioBusiness:checked + .scope-label { color: #007bff; }
/* Glocken-Icon Container */
.nav-notification {
    position: relative;
    cursor: pointer;
    margin-right: 15px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    color: #555; /* Farbe anpassen falls nötig */
    text-decoration: none;
}
.nav-notification:hover { color: #007bff; }

/* Der rote Punkt (Badge) */
.nav-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background: #dc3545;
    color: white;
    font-size: 0.6em;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 50%;
    min-width: 15px;
    text-align: center;
    border: 1px solid white;
}

/* Modal Hintergrund */
.modal-overlay {
    display: none; /* Standardmäßig versteckt */
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
}

/* Modal Inhalt */
.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 0;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px; /* Breite begrenzen */
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
}

.modal-close {
    position: absolute;
    right: 15px;
    top: 10px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
}
    /* Basis für Details (Aufklappbare Elemente) */
    details > summary { list-style: none; outline: none; }
    details > summary::-webkit-details-marker { display: none; }
    details[open] summary ~ * { animation: sweep .2s ease-in-out; }
    @keyframes sweep { 0% {opacity: 0; transform: translateY(-10px)} 100% {opacity: 1; transform: translateY(0)} }
    
    .depot-header, .order-header {
        display: flex; justify-content: space-between; align-items: center;
        background: white; padding: 15px; border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05); cursor: pointer;
        transition: background 0.2s;
    }
    .depot-header { border-left: 5px solid #6610f2; }
    .order-header { border-top: 5px solid #6610f2; margin-bottom: 0; font-weight: bold; font-size: 1.1em; }
    
    .depot-header:hover, .order-header:hover { background: #f8f9fa; }
    .depot-arrow { transition: transform 0.2s; font-size: 1.2em; color: #666; }
    details[open] .depot-arrow { transform: rotate(180deg); }

    /* Grid Layout standardmäßig (Desktop) */
/* Input Grid im Order Formular */
.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* MOBILE OPTIMIERUNG */
@media (max-width: 768px) {
    /* Grid auf 1 Spalte zwingen */
    .finance-grid, .input-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }
    
    /* Action Bar umbrechen lassen */
    .action-bar {
        flex-direction: column;
        align-items: stretch !important;
    }
    .action-bar > * {
        margin-bottom: 10px;
        width: 100%;
        text-align: center;
        display: block;
    }
    
    /* Summary Header kompakter */
    .depot-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .depot-header > div:last-child {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    /* Card Padding verringern */
    .card { padding: 15px !important; }
    
    /* Tabellen Scrollbar sichtbar machen */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* * MOBILE KARTENANSICHT FÜR TABELLEN
     * Dies transformiert die Tabelle auf kleinen Bildschirmen in eine Kartenansicht
     */
    .mobile-table, 
    .mobile-table tbody, 
    .mobile-table tr, 
    .mobile-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    /* Tabellenkopf ausblenden */
    .mobile-table thead {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    /* Jede Zeile wird eine Karte */
    .mobile-table tr {
        margin-bottom: 15px;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

    /* Gruppen-Header etwas anders stylen */
    .mobile-table tr.group-header {
        background: #e9ecef;
        border: none;
        box-shadow: none;
        margin-bottom: 5px;
        margin-top: 20px;
    }
    .mobile-table tr.group-header td {
        padding: 5px 10px;
        color: #555;
        text-transform: uppercase;
        font-size: 0.85em;
        letter-spacing: 1px;
    }

    /* Die erste Zelle (Asset Name) als Kopf der Karte */
    .mobile-table td.asset-cell {
        background: #f8f9fa;
        border-bottom: 1px solid #eee;
        padding: 12px 15px !important;
        text-align: left !important;
    }

    /* Alle anderen Zellen: Flexbox Layout */
    .mobile-table td:not(.asset-cell):not([colspan]) {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 15px !important;
        border-bottom: 1px solid #f9f9f9;
        text-align: right;
    }

    /* Das Label (Menge, Wert, etc.) links anzeigen */
    .mobile-table td:not(.asset-cell):not([colspan]):before {
        content: attr(data-label);
        font-weight: bold;
        color: #666;
        font-size: 0.9em;
        margin-right: 15px;
        text-align: left;
    }
    
    /* Letzte Zeile ohne Border */
    .mobile-table td:last-child {
        border-bottom: none;
    }
}
.modal-close:hover { color: black; }
/* MOBILE OPTIMIERUNG */
    @media (max-width: 768px) {
        /* Vorhandene Styles behalten ... */
        .finance-grid, .input-grid { grid-template-columns: 1fr !important; gap: 10px; }
        /* ... (Dein existierender Code für Action Bar, Header etc.) ... */

        /* NEU: Hilfsklasse zum Ausblenden von Spalten auf dem Handy */
        .hide-mobile { display: none !important; }
        
        /* NEU: Kompaktere Zellen für Listenansicht */
        .compact-cell { 
            padding: 8px 5px !important; 
            font-size: 0.85em; 
        }
        
        /* Den Asset-Namen etwas größer lassen */
        .asset-name-cell {
            max-width: 140px; /* Verhindert, dass lange Namen alles sprengen */
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
    }
/* --- Notification Bell & Badge --- */
.notification-icon {
    position: relative;
    cursor: pointer;
    font-size: 1.4rem; /* Größe der Glocke */
    margin-right: 20px; /* Abstand zum Logout-Button */
    transition: transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-icon:hover {
    transform: scale(1.1); /* Leichter Zoom beim Drüberfahren */
}

.badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background-color: var(--danger); /* Nutzt dein definiertes Rot (#dc3545) */
    color: white;
    border-radius: 10px; /* Macht es rund/oval */
    padding: 2px 6px;
    font-size: 0.75rem;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
    line-height: 1.2;
    border: 2px solid var(--primary); /* Optional: Kleiner Rand in Farbe der Nav-Bar für Kontrast */
}    
/* MOBILE KARTEN-ANSICHT FÜR HISTORIE */
@media (max-width: 768px) {
    /* Tabelle wird zur Kartenliste */
    .history-table, .history-table tbody, .history-table tr, .history-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Tabellenkopf verstecken */
    .history-table thead { display: none; }

    /* Karten-Container (ehemalige Zeile) */
    .history-table tr {
        margin-bottom: 15px;
        background: #fff;
        border: 1px solid #e9ecef;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.03);
        overflow: hidden;
    }

    /* Datum & Typ als Karten-Header hervorheben */
    .history-table td:first-child {
        background: #f8f9fa;
        border-bottom: 1px solid #eee;
        font-weight: bold;
        display: flex; 
        justify-content: space-between;
        align-items: center;
    }
    
    /* Flexbox für die anderen Zellen (Label links, Wert rechts) */
    .history-table td {
        padding: 10px 15px;
        text-align: right;
        border-bottom: 1px solid #f5f5f5;
        position: relative;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    /* Das Label (via data-label Attribut) einblenden */
    .history-table td:before {
        content: attr(data-label);
        font-weight: 600;
        color: #666;
        font-size: 0.9em;
        text-align: left;
    }
    
    /* Letzte Linie weg */
    .history-table td:last-child { border-bottom: none; }
}

/* SCROLLBARE BUTTONS FÜR CHART (Mobile) */
.chart-controls-scroll {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 5px;
    -webkit-overflow-scrolling: touch; /* Flüssiges Scrollen auf iOS */
    scrollbar-width: none; /* Firefox Scrollbar weg */
}
.chart-controls-scroll::-webkit-scrollbar { display: none; /* Chrome/Safari Scrollbar weg */ }

/* Grundlayout */
.mail-container {
    display: flex;
    gap: 20px;
    height: calc(100vh - 140px); /* Füllt den Screen minus Header */
    min-height: 500px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Sidebar (Konten) */
.mail-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    color: #444;
}

.account-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.account-item {
    display: block;
    padding: 12px;
    margin-bottom: 6px;
    border-radius: 6px;
    text-decoration: none;
    color: #555;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.account-item:hover { background: #f1f3f5; }

.account-item.active {
    background: #e7f1ff;
    color: #007bff;
    border-left-color: #007bff;
}

.account-name { font-weight: 600; display: block; margin-bottom: 2px; }
.account-email { font-size: 0.85em; opacity: 0.8; display: block; }
.account-badge { font-size: 0.8em; float: right; opacity: 0.5; }

/* Hauptbereich (Inbox) */
.mail-content {
    flex: 1;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.inbox-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.inbox-list {
    flex: 1;
    overflow-y: auto;
}

/* Mail Zeile (als Flexbox statt Tabelle für Mobile) */
.mail-row {
    display: flex;
    padding: 15px;
    border-bottom: 1px solid #f1f1f1;
    cursor: pointer;
    transition: background 0.1s;
    text-decoration: none;
    color: inherit;
    align-items: center;
}

.mail-row:hover { background: #fafafa; }

.mail-row.unread {
    background: #fff; 
    font-weight: 600;
    border-left: 3px solid #007bff;
}
.mail-row.read {
    background: #fdfdfd;
    color: #666;
}

.mail-sender { width: 25%; padding-right: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-subject { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-date { width: 100px; text-align: right; font-size: 0.85em; color: #999; }

/* Modal Styling */
.mail-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 2000;
    backdrop-filter: blur(2px);
    display: flex; justify-content: center; align-items: center;
}

.mail-modal {
    background: #fff;
    width: 800px;
    height: 85%;
    max-width: 95%;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    overflow: hidden;
}

.modal-header { padding: 15px 20px; border-bottom: 1px solid #eee; background: #f8f9fa; display: flex; justify-content: space-between; align-items: flex-start; }
.modal-body { flex: 1; padding: 30px; overflow-y: auto; line-height: 1.6; color: #333; }
.modal-footer { padding: 15px 20px; border-top: 1px solid #eee; background: #fff; }

/* MOBILE ANPASSUNGEN */
@media (max-width: 768px) {
    .mail-container {
        flex-direction: column;
        height: auto;
        display: block; /* Stack block elements */
    }

    /* Sidebar wird zum horizontalen Slider */
    .mail-sidebar {
        width: 100%;
        margin-bottom: 15px;
        overflow: visible;
        background: transparent;
        box-shadow: none;
        border-radius: 0;
    }
    
    .sidebar-header { display: none; } /* Braucht man mobil nicht zwingend */

    .account-list {
        display: flex;
        overflow-x: auto;
        padding: 5px;
        gap: 10px;
        /* Scrollbar verstecken */
        -ms-overflow-style: none; scrollbar-width: none;
    }
    .account-list::-webkit-scrollbar { display: none; }

    .account-item {
        min-width: 220px;
        background: #fff;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        margin-bottom: 0;
        border: 1px solid #eee;
    }

    /* Mail Zeile auf Handy: Untereinander */
    .mail-row {
        flex-wrap: wrap;
        padding: 12px;
    }
    .mail-sender { width: 100%; margin-bottom: 4px; font-size: 0.9em; }
    .mail-subject { width: 100%; font-size: 1em; margin-bottom: 4px; }
    .mail-date { width: 100%; text-align: left; font-size: 0.75em; }

    /* Modal auf Handy */
    .mail-modal { height: 100%; width: 100%; max-width: 100%; border-radius: 0; }
}

/* --- DESIGN SYSTEM VARIABLEN --- */
:root {
    --c-primary: #007bff;
    --c-primary-soft: rgba(0, 123, 255, 0.1);
    --c-success: #28a745;
    --c-success-soft: rgba(40, 167, 69, 0.1);
    --c-danger: #dc3545;
    --c-danger-soft: rgba(220, 53, 69, 0.1);
    --c-text: #2c3e50;
    --c-muted: #95a5a6;
    --c-bg: #f8f9fa;
    --c-card-bg: #ffffff;
    --c-border: #e9ecef;
    --radius: 12px;
    --shadow: 0 4px 12px rgba(0,0,0,0.03);
}

/* --- LAYOUT UTILS --- */
.action-bar { margin-bottom: 25px; }
.back-btn {
    text-decoration: none; display: inline-flex; align-items: center; 
    color: var(--c-text); font-weight: 600; background: white;
    padding: 8px 16px; border-radius: 30px; box-shadow: var(--shadow);
    transition: transform 0.2s ease;
}
.back-btn:active { transform: scale(0.98); }

/* --- KPI CARDS --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.kpi-card {
    background: var(--c-card-bg);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 5px solid transparent;
    display: flex; flex-direction: column;
}
.kpi-card.green { border-left-color: var(--c-success); }
.kpi-card.red { border-left-color: var(--c-danger); }

.kpi-label { font-size: 0.85em; color: var(--c-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; font-weight: 600; }
.kpi-value { font-size: 1.6em; font-weight: 700; color: var(--c-text); }

/* --- MAIN CONTENT CARD --- */
.content-card {
    background: var(--c-card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    overflow: hidden; /* Wichtig für Border-Radius */
}

/* --- FILTER BAR --- */
.filter-bar {
    display: flex; align-items: center; gap: 15px;
    background: var(--c-bg); padding: 10px 15px;
    border-radius: 8px; margin-bottom: 25px;
    border: 1px solid var(--c-border);
}
.filter-input {
    border: none; background: transparent; flex-grow: 1;
    font-size: 1em; padding: 5px; outline: none; color: var(--c-text);
}

/* --- TABS (Scrollable on Mobile) --- */
.tabs-nav {
    display: flex; gap: 10px; margin-bottom: 25px;
    border-bottom: 2px solid var(--c-border);
    overflow-x: auto; /* Scrollbar auf Mobile */
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}
/* Scrollbar verstecken aber Funktion behalten */
.tabs-nav::-webkit-scrollbar { height: 0px; background: transparent; }

.tab-btn {
    background: none; border: none; padding: 12px 15px;
    font-size: 1em; font-weight: 600; color: var(--c-muted);
    cursor: pointer; white-space: nowrap; position: relative;
    transition: color 0.3s ease;
    border-bottom: 3px solid transparent;
    margin-bottom: -4px; /* Überlappt die Border-Linie */
}
.tab-btn.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }
.tab-btn:hover:not(.active) { color: var(--c-text); }

/* --- RESPONSIVE TABLE --- */
.table-responsive { width: 100%; overflow-x: auto; }
.custom-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.95em; }

.custom-table th {
    text-align: left; padding: 15px;
    background: var(--c-bg); color: var(--c-muted);
    font-weight: 600; cursor: pointer; user-select: none;
    border-bottom: 2px solid var(--c-border);
}
.custom-table th:hover { background: #e2e6ea; color: var(--c-text); }

.custom-table td { padding: 15px; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
.custom-table tr:last-child td { border-bottom: none; }
.sort-icon::after { content: ' ↕'; font-size: 0.8em; opacity: 0.3; margin-left: 5px; }

/* --- MOBILE OPTIMIZATION (CARD VIEW) --- */
@media (max-width: 768px) {
    .kpi-grid { grid-template-columns: 1fr; } /* KPIs untereinander */
    
    /* Tabelle in Karten umwandeln */
    .custom-table thead { display: none; }
    .custom-table, .custom-table tbody, .custom-table tr, .custom-table td { display: block; width: 100%; }
    
    .custom-table tr {
        margin-bottom: 20px;
        border: 1px solid var(--c-border);
        border-radius: 12px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.02);
        overflow: visible; /* Verhindert das Abschneiden von Inhalten wie Schatten oder Buttons */
    }
    
    .custom-table td {
        display: flex; justify-content: space-between; align-items: flex-start; /* Ausrichtung oben für mehrzeilige Inhalte */
        gap: 10px;
        border-bottom: 1px solid #f1f1f1;
        padding: 12px 15px;
    }
    
    /* Das data-label Attribut wird hier zur Beschriftung */
    .custom-table td::before {
        content: attr(data-label);
        font-weight: 600; color: var(--c-muted); font-size: 0.85em;
        text-align: left;
        flex-shrink: 0; /* Label behält seine Breite */
    }
    
    /* Spezielles Styling für Asset-Name (erste Zeile) */
    .custom-table td[data-label="Asset"] {
        background: var(--c-bg); font-weight: bold; color: var(--c-text);
        justify-content: flex-start; /* Linksbuendig */
    }
    .custom-table td[data-label="Asset"]::before { display: none; } /* Label 'Asset' ausblenden */
}
/* --- GLOBAL APP GRID --- */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.app-grid .card {
    background: var(--card-bg, #ffffff);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid var(--border-color, #dddddd);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    display: flex;
    align-items: center;
    height: 100%;
    box-sizing: border-box;
}

.app-grid a.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
    border-color: var(--primary, #007bff);
}

@media (max-width: 768px) {
    .app-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}
