/**
 * ConWawi - Zentrale Styles
 * ================================
 * Diese Datei enthält alle wiederverwendbaren Styles für das gesamte Projekt.
 * Neue Seiten sollten NUR diese Datei einbinden + page-spezifische Styles minimal halten.
 *
 * Struktur:
 * 1. CSS Variablen (Farben, Spacing, etc.)
 * 2. Reset & Base Styles
 * 3. Layout (Sidebar, Main Content, Footer)
 * 4. Navigation (Sidebar, Topbar)
 * 5. Komponenten (Cards, Tables, Forms, Buttons, Badges, etc.)
 * 6. Utilities
 * 7. Responsive
 */

/* =============================================================================
   1. CSS VARIABLEN
   ============================================================================= */

:root {
    /* Farben - Haupt */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --bg-card: #ffffff;

    /* Farben - Text */
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --text-white: #ffffff;

    /* Farben - Borders */
    --border-color: #dee2e6;
    --border-light: #e9ecef;

    /* Farben - Akzente */
    --accent-green: #22c55e;
    --accent-green-light: #dcfce7;
    --accent-green-dark: #166534;

    --accent-red: #ef4444;
    --accent-red-light: #fee2e2;
    --accent-red-dark: #991b1b;

    --accent-yellow: #eab308;
    --accent-yellow-light: #fef9c3;
    --accent-yellow-dark: #854d0e;

    --accent-blue: #3b82f6;
    --accent-blue-light: #dbeafe;
    --accent-blue-dark: #1d4ed8;

    --accent-purple: #8b5cf6;
    --accent-purple-light: #ede9fe;
    --accent-purple-dark: #6d28d9;

    --accent-orange: #f97316;
    --accent-orange-light: #ffedd5;
    --accent-orange-dark: #c2410c;

    /* Status-Farben */
    --status-beobachtet: #1565c0;
    --status-geboten: #e65100;
    --status-gewonnen: #2e7d32;
    --status-verloren: #c62828;
    --status-verkauft: #7b1fa2;
    --status-in-stock: #22c55e;
    --status-listed: #3b82f6;
    --status-reserved: #eab308;
    --status-sold: #8b5cf6;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-xxl: 3rem;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --sidebar-bg: #1a1a2e;
    --sidebar-text: #a0aec0;
    --sidebar-text-active: #ffffff;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.08);
    --sidebar-active-bg: rgba(59, 130, 246, 0.2);
    --sidebar-border: rgba(255, 255, 255, 0.1);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;

    /* Z-Index */
    --z-sidebar: 100;
    --z-topbar: 90;
    --z-modal: 1000;
    --z-tooltip: 1100;
}

/* =============================================================================
   DARK THEME (System Preference)
   ============================================================================= */

@media (prefers-color-scheme: dark) {
    :root {
        /* Farben - Haupt (Dark) */
        --bg-primary: #1a1a2e;
        --bg-secondary: #0f0f1a;
        --bg-tertiary: #2d2d4a;
        --bg-card: #252540;

        /* Farben - Text (Dark) */
        --text-primary: #ffffff;
        --text-secondary: #a0a0b0;
        --text-muted: #6c6c7c;

        /* Farben - Borders (Dark) */
        --border-color: rgba(255, 255, 255, 0.1);
        --border-light: rgba(255, 255, 255, 0.05);

        /* Farben - Akzente (Dark) - etwas heller fuer Kontrast */
        --accent-green-light: rgba(34, 197, 94, 0.2);
        --accent-red-light: rgba(239, 68, 68, 0.2);
        --accent-yellow-light: rgba(234, 179, 8, 0.2);
        --accent-blue-light: rgba(59, 130, 246, 0.2);
        --accent-purple-light: rgba(139, 92, 246, 0.2);
        --accent-orange-light: rgba(249, 115, 22, 0.2);

        /* Shadows (Dark) - heller auf dunklem Hintergrund */
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    }

    /* Body Scrollbar Dark */
    body::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
    body::-webkit-scrollbar-track {
        background: var(--bg-secondary);
    }
    body::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 4px;
    }
    body::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.3);
    }

    /* Links (Dark) */
    a {
        color: var(--accent-blue);
    }
    a:hover {
        color: #60a5fa;
    }

    /* Bootstrap Overrides - Cards */
    .card {
        background-color: var(--bg-card);
        border-color: var(--border-color);
    }
    .card-header {
        background-color: rgba(255, 255, 255, 0.03);
        border-bottom-color: var(--border-color);
        color: var(--text-primary);
    }
    .card-footer {
        background-color: rgba(255, 255, 255, 0.03);
        border-top-color: var(--border-color);
    }
    .card-title {
        color: var(--text-primary);
    }
    .card-text {
        color: var(--text-secondary);
    }
    h1, h2, h3, h4, h5, h6 {
        color: var(--text-primary);
    }
    .fw-semibold, .fw-bold, .fw-bolder {
        color: var(--text-primary);
    }

    /* Bootstrap Overrides - Tables */
    .table {
        --bs-table-bg: transparent;
        --bs-table-color: var(--text-primary);
        --bs-table-border-color: var(--border-color);
        --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
        --bs-table-hover-bg: rgba(255, 255, 255, 0.05);
    }
    .table thead th {
        background-color: rgba(255, 255, 255, 0.03);
        color: var(--text-secondary);
        border-bottom-color: var(--border-color);
    }
    .table td, .table th {
        border-color: var(--border-color);
    }

    /* Bootstrap Overrides - Forms */
    .form-control,
    .form-select {
        background-color: var(--bg-tertiary);
        border-color: var(--border-color);
        color: var(--text-primary);
    }
    .form-control:focus,
    .form-select:focus {
        background-color: var(--bg-tertiary);
        border-color: var(--accent-blue);
        color: var(--text-primary);
        box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
    }
    .form-control::placeholder {
        color: var(--text-muted);
    }
    .form-control:disabled,
    .form-select:disabled {
        background-color: rgba(255, 255, 255, 0.05);
        color: var(--text-muted);
    }
    .form-label {
        color: var(--text-secondary);
    }
    .form-text {
        color: var(--text-muted);
    }
    .form-check-input {
        background-color: var(--bg-tertiary);
        border-color: var(--border-color);
    }
    .form-check-input:checked {
        background-color: var(--accent-blue);
        border-color: var(--accent-blue);
    }
    .input-group-text {
        background-color: var(--bg-tertiary);
        border-color: var(--border-color);
        color: var(--text-secondary);
    }

    /* Bootstrap Overrides - Modals */
    .modal-content {
        background-color: var(--bg-card);
        border-color: var(--border-color);
    }
    .modal-header {
        border-bottom-color: var(--border-color);
    }
    .modal-footer {
        border-top-color: var(--border-color);
    }
    .modal-title {
        color: var(--text-primary);
    }
    .btn-close {
        filter: invert(1) grayscale(100%) brightness(200%);
    }

    /* Bootstrap Overrides - Dropdowns */
    .dropdown-menu {
        background-color: var(--bg-card);
        border-color: var(--border-color);
        box-shadow: var(--shadow-lg);
    }
    .dropdown-item {
        color: var(--text-primary);
    }
    .dropdown-item:hover,
    .dropdown-item:focus {
        background-color: rgba(255, 255, 255, 0.08);
        color: var(--text-primary);
    }
    .dropdown-item.active,
    .dropdown-item:active {
        background-color: var(--accent-blue);
    }
    .dropdown-divider {
        border-color: var(--border-color);
    }

    /* Bootstrap Overrides - Alerts */
    .alert-info {
        background-color: rgba(59, 130, 246, 0.15);
        border-color: rgba(59, 130, 246, 0.3);
        color: #93c5fd;
    }
    .alert-success {
        background-color: rgba(34, 197, 94, 0.15);
        border-color: rgba(34, 197, 94, 0.3);
        color: #86efac;
    }
    .alert-warning {
        background-color: rgba(234, 179, 8, 0.15);
        border-color: rgba(234, 179, 8, 0.3);
        color: #fde047;
    }
    .alert-danger {
        background-color: rgba(239, 68, 68, 0.15);
        border-color: rgba(239, 68, 68, 0.3);
        color: #fca5a5;
    }

    /* Bootstrap Overrides - Nav Tabs */
    .nav-tabs {
        border-bottom-color: var(--border-color);
    }
    .nav-tabs .nav-link {
        color: var(--text-secondary);
    }
    .nav-tabs .nav-link:hover {
        border-color: var(--border-color);
        color: var(--text-primary);
    }
    .nav-tabs .nav-link.active {
        background-color: var(--bg-card);
        border-color: var(--border-color);
        border-bottom-color: var(--bg-card);
        color: var(--text-primary);
    }

    /* Bootstrap Overrides - Nav Pills */
    .nav-pills .nav-link {
        color: var(--text-secondary);
    }
    .nav-pills .nav-link:hover {
        background-color: rgba(255, 255, 255, 0.05);
        color: var(--text-primary);
    }
    .nav-pills .nav-link.active {
        background-color: var(--accent-blue);
        color: white;
    }

    /* Bootstrap Overrides - List Groups */
    .list-group-item {
        background-color: var(--bg-card);
        border-color: var(--border-color);
        color: var(--text-primary);
    }
    .list-group-item:hover {
        background-color: rgba(255, 255, 255, 0.05);
    }
    .list-group-item.active {
        background-color: var(--accent-blue);
        border-color: var(--accent-blue);
    }

    /* Bootstrap Overrides - Pagination */
    .page-link {
        background-color: var(--bg-card);
        border-color: var(--border-color);
        color: var(--text-primary);
    }
    .page-link:hover {
        background-color: rgba(255, 255, 255, 0.08);
        border-color: var(--border-color);
        color: var(--text-primary);
    }
    .page-item.active .page-link {
        background-color: var(--accent-blue);
        border-color: var(--accent-blue);
    }
    .page-item.disabled .page-link {
        background-color: rgba(255, 255, 255, 0.03);
        color: var(--text-muted);
    }

    /* Bootstrap Overrides - Badges */
    .badge.bg-light {
        background-color: rgba(255, 255, 255, 0.1) !important;
        color: var(--text-primary) !important;
    }
    .badge.bg-secondary {
        background-color: rgba(255, 255, 255, 0.15) !important;
    }
    .badge.text-dark {
        color: var(--text-primary) !important;
    }

    /* Bootstrap Overrides - Toasts */
    .toast {
        background-color: var(--bg-card);
        border-color: var(--border-color);
    }
    .toast-header {
        background-color: rgba(255, 255, 255, 0.03);
        border-bottom-color: var(--border-color);
        color: var(--text-primary);
    }
    .toast-body {
        color: var(--text-primary);
    }

    /* Bootstrap Overrides - Accordion */
    .accordion-item {
        background-color: var(--bg-card);
        border-color: var(--border-color);
    }
    .accordion-button {
        background-color: var(--bg-card);
        color: var(--text-primary);
    }
    .accordion-button:not(.collapsed) {
        background-color: rgba(59, 130, 246, 0.1);
        color: var(--accent-blue);
    }
    .accordion-button::after {
        filter: invert(1);
    }

    /* Bootstrap Overrides - Progress */
    .progress {
        background-color: rgba(255, 255, 255, 0.1);
    }

    /* Bootstrap Overrides - Offcanvas */
    .offcanvas {
        background-color: var(--bg-card);
        color: var(--text-primary);
    }
    .offcanvas-header {
        border-bottom-color: var(--border-color);
    }

    /* Bootstrap Overrides - Popover */
    .popover {
        background-color: var(--bg-card);
        border-color: var(--border-color);
    }
    .popover-header {
        background-color: rgba(255, 255, 255, 0.03);
        border-bottom-color: var(--border-color);
        color: var(--text-primary);
    }
    .popover-body {
        color: var(--text-primary);
    }

    /* Bootstrap Overrides - Breadcrumb */
    .breadcrumb {
        background-color: transparent;
    }
    .breadcrumb-item a {
        color: var(--accent-blue);
    }
    .breadcrumb-item.active {
        color: var(--text-secondary);
    }

    /* Bootstrap Overrides - Buttons (Picking-Style) */

    /* Primary Buttons - Blau */
    .btn-primary {
        background: var(--accent-blue) !important;
        border-color: var(--accent-blue) !important;
        color: white !important;
        font-weight: 600;
        border-radius: 8px;
        transition: all 0.2s;
    }
    .btn-primary:hover, .btn-primary:focus {
        background: #2563eb !important;
        border-color: #2563eb !important;
        color: white !important;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    }
    .btn-primary:active {
        transform: translateY(0);
    }

    /* Success Buttons - Grün */
    .btn-success {
        background: var(--accent-green) !important;
        border-color: var(--accent-green) !important;
        color: white !important;
        font-weight: 600;
        border-radius: 8px;
        transition: all 0.2s;
    }
    .btn-success:hover, .btn-success:focus {
        background: #16a34a !important;
        border-color: #16a34a !important;
        color: white !important;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
    }

    /* Danger Buttons - Rot */
    .btn-danger {
        background: var(--accent-red) !important;
        border-color: var(--accent-red) !important;
        color: white !important;
        font-weight: 600;
        border-radius: 8px;
        transition: all 0.2s;
    }
    .btn-danger:hover, .btn-danger:focus {
        background: #dc2626 !important;
        border-color: #dc2626 !important;
        color: white !important;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    }

    /* Warning Buttons - Orange/Gelb */
    .btn-warning {
        background: var(--accent-orange) !important;
        border-color: var(--accent-orange) !important;
        color: white !important;
        font-weight: 600;
        border-radius: 8px;
        transition: all 0.2s;
    }
    .btn-warning:hover, .btn-warning:focus {
        background: #d97706 !important;
        border-color: #d97706 !important;
        color: white !important;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    }

    /* Info Buttons - Cyan */
    .btn-info {
        background: #06b6d4 !important;
        border-color: #06b6d4 !important;
        color: white !important;
        font-weight: 600;
        border-radius: 8px;
        transition: all 0.2s;
    }
    .btn-info:hover, .btn-info:focus {
        background: #0891b2 !important;
        border-color: #0891b2 !important;
        color: white !important;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
    }

    /* Secondary Buttons - Neutral dunkel */
    .btn-secondary {
        background: var(--bg-tertiary) !important;
        border-color: var(--border-color) !important;
        color: var(--text-primary) !important;
        font-weight: 600;
        border-radius: 8px;
        transition: all 0.2s;
    }
    .btn-secondary:hover, .btn-secondary:focus {
        background: rgba(255, 255, 255, 0.15) !important;
        border-color: rgba(255, 255, 255, 0.2) !important;
        color: var(--text-primary) !important;
        transform: translateY(-1px);
    }

    /* Light Buttons */
    .btn-light {
        background-color: var(--bg-tertiary) !important;
        border-color: var(--border-color) !important;
        color: var(--text-primary) !important;
        font-weight: 600;
        border-radius: 8px;
        transition: all 0.2s;
    }
    .btn-light:hover, .btn-light:focus {
        background-color: rgba(255, 255, 255, 0.15) !important;
        border-color: rgba(255, 255, 255, 0.2) !important;
        color: var(--text-primary) !important;
        transform: translateY(-1px);
    }

    /* Outline Buttons */
    .btn-outline-primary {
        color: var(--accent-blue) !important;
        border-color: var(--accent-blue) !important;
        background: transparent !important;
        font-weight: 600;
        border-radius: 8px;
        border-width: 2px;
        transition: all 0.2s;
    }
    .btn-outline-primary:hover, .btn-outline-primary:focus {
        background: var(--accent-blue) !important;
        border-color: var(--accent-blue) !important;
        color: white !important;
        transform: translateY(-1px);
    }

    .btn-outline-success {
        color: var(--accent-green) !important;
        border-color: var(--accent-green) !important;
        background: transparent !important;
        font-weight: 600;
        border-radius: 8px;
        border-width: 2px;
        transition: all 0.2s;
    }
    .btn-outline-success:hover, .btn-outline-success:focus {
        background: var(--accent-green) !important;
        border-color: var(--accent-green) !important;
        color: white !important;
        transform: translateY(-1px);
    }

    .btn-outline-danger {
        color: var(--accent-red) !important;
        border-color: var(--accent-red) !important;
        background: transparent !important;
        font-weight: 600;
        border-radius: 8px;
        border-width: 2px;
        transition: all 0.2s;
    }
    .btn-outline-danger:hover, .btn-outline-danger:focus {
        background: var(--accent-red) !important;
        border-color: var(--accent-red) !important;
        color: white !important;
        transform: translateY(-1px);
    }

    .btn-outline-warning {
        color: var(--accent-orange) !important;
        border-color: var(--accent-orange) !important;
        background: transparent !important;
        font-weight: 600;
        border-radius: 8px;
        border-width: 2px;
        transition: all 0.2s;
    }
    .btn-outline-warning:hover, .btn-outline-warning:focus {
        background: var(--accent-orange) !important;
        border-color: var(--accent-orange) !important;
        color: white !important;
        transform: translateY(-1px);
    }

    .btn-outline-secondary {
        color: var(--text-secondary) !important;
        border-color: var(--border-color) !important;
        background: transparent !important;
        font-weight: 600;
        border-radius: 8px;
        border-width: 2px;
        transition: all 0.2s;
    }
    .btn-outline-secondary:hover, .btn-outline-secondary:focus {
        background-color: var(--bg-tertiary) !important;
        border-color: var(--text-secondary) !important;
        color: var(--text-primary) !important;
        transform: translateY(-1px);
    }
    .btn-outline-secondary.active {
        background-color: var(--bg-tertiary) !important;
        border-color: var(--text-secondary) !important;
        color: var(--text-primary) !important;
    }

    .btn-outline-primary.active {
        background: var(--accent-blue) !important;
        border-color: var(--accent-blue) !important;
        color: white !important;
    }

    .btn-outline-info {
        color: #06b6d4 !important;
        border-color: #06b6d4 !important;
        background: transparent !important;
        font-weight: 600;
        border-radius: 8px;
        border-width: 2px;
        transition: all 0.2s;
    }
    .btn-outline-info:hover, .btn-outline-info:focus {
        background: #06b6d4 !important;
        border-color: #06b6d4 !important;
        color: white !important;
        transform: translateY(-1px);
    }

    .btn-outline-dark {
        color: var(--text-primary) !important;
        border-color: var(--border-color) !important;
        background: transparent !important;
        font-weight: 600;
        border-radius: 8px;
        border-width: 2px;
        transition: all 0.2s;
    }
    .btn-outline-dark:hover, .btn-outline-dark:focus {
        background-color: var(--bg-tertiary) !important;
        border-color: var(--text-primary) !important;
        color: var(--text-primary) !important;
        transform: translateY(-1px);
    }

    .btn-outline-light {
        color: var(--text-primary) !important;
        border-color: rgba(255, 255, 255, 0.3) !important;
        background: transparent !important;
        font-weight: 600;
        border-radius: 8px;
        border-width: 2px;
        transition: all 0.2s;
    }
    .btn-outline-light:hover, .btn-outline-light:focus {
        background-color: rgba(255, 255, 255, 0.1) !important;
        border-color: rgba(255, 255, 255, 0.5) !important;
        color: var(--text-primary) !important;
        transform: translateY(-1px);
    }

    /* Link Buttons */
    .btn-link {
        color: var(--accent-blue) !important;
        background: transparent !important;
        border: none !important;
    }
    .btn-link:hover, .btn-link:focus {
        color: #60a5fa !important;
    }
    .btn-link.text-danger {
        color: var(--accent-red) !important;
    }
    .btn-link.text-muted {
        color: var(--text-secondary) !important;
    }

    /* Disabled Buttons */
    .btn:disabled, .btn.disabled {
        background: rgba(255, 255, 255, 0.1) !important;
        border-color: rgba(255, 255, 255, 0.05) !important;
        color: var(--text-muted) !important;
        cursor: not-allowed;
        transform: none !important;
        box-shadow: none !important;
    }

    /* Platform-specific Buttons */
    .btn-ebay {
        background-color: #e53238 !important;
        border-color: #e53238 !important;
        color: white !important;
        font-weight: 600;
        border-radius: 8px;
    }
    .btn-ebay:hover {
        background-color: #cc2d32 !important;
        border-color: #cc2d32 !important;
        color: white !important;
    }

    .btn-bricklink {
        background-color: #D01012 !important;
        border-color: #D01012 !important;
        color: white !important;
        font-weight: 600;
        border-radius: 8px;
    }
    .btn-bricklink:hover {
        background-color: #b00e10 !important;
        border-color: #b00e10 !important;
        color: white !important;
    }

    .btn-purple {
        background-color: #7f54b3 !important;
        border-color: #7f54b3 !important;
        color: white !important;
        font-weight: 600;
        border-radius: 8px;
    }
    .btn-purple:hover {
        background-color: #6b46a1 !important;
        border-color: #6b46a1 !important;
        color: white !important;
    }

    .btn-outline-purple {
        color: #7f54b3 !important;
        border-color: #7f54b3 !important;
        background: transparent !important;
        font-weight: 600;
        border-radius: 8px;
        border-width: 2px;
    }
    .btn-outline-purple:hover {
        background: #7f54b3 !important;
        border-color: #7f54b3 !important;
        color: white !important;
    }

    /* Close Button */
    .btn-close {
        filter: invert(1) grayscale(100%) brightness(200%);
    }

    /* Helper Classes */
    .bg-white {
        background-color: var(--bg-card) !important;
    }
    .bg-light {
        background-color: var(--bg-tertiary) !important;
    }
    .text-dark {
        color: var(--text-primary) !important;
    }
    .text-black {
        color: var(--text-primary) !important;
    }
    .text-muted {
        color: var(--text-secondary) !important;
    }
    .text-body {
        color: var(--text-primary) !important;
    }
    .border {
        border-color: var(--border-color) !important;
    }
    .border-top, .border-bottom, .border-start, .border-end {
        border-color: var(--border-color) !important;
    }
    .border-secondary {
        border-color: var(--border-color) !important;
    }
    .shadow, .shadow-sm, .shadow-lg {
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3) !important;
    }

    /* Custom Dark overrides for ConWawi components */
    .stat-card {
        background: var(--bg-card);
        border-color: var(--border-color);
    }
    .stat-card:hover {
        border-color: rgba(255, 255, 255, 0.2);
    }

    /* Search Inputs */
    .search-input {
        background-color: var(--bg-tertiary);
        border-color: var(--border-color);
        color: var(--text-primary);
    }

    /* Status Badges Dark */
    .status-badge {
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Empty States */
    .empty-state {
        color: var(--text-secondary);
    }

    /* KPI Icons - Dark mode versions with better contrast */
    .kpi-icon[style*="background: #ffe5d0"],
    .kpi-icon[style*="background:#ffe5d0"],
    .stat-icon[style*="background: rgba(234, 179, 8"],
    .finance-icon[style*="background: rgba(234, 179, 8"] {
        background: rgba(234, 179, 8, 0.2) !important;
        color: #fbbf24 !important;
    }
    .kpi-icon[style*="background: rgba(59, 130, 246"],
    .stat-icon[style*="background: rgba(59, 130, 246"],
    .finance-icon[style*="background: rgba(59, 130, 246"] {
        background: rgba(59, 130, 246, 0.2) !important;
        color: #60a5fa !important;
    }
    .kpi-icon[style*="background: rgba(34, 197, 94"],
    .stat-icon[style*="background: rgba(34, 197, 94"],
    .finance-icon[style*="background: rgba(34, 197, 94"] {
        background: rgba(34, 197, 94, 0.2) !important;
        color: #4ade80 !important;
    }
    .kpi-icon[style*="background: rgba(139, 92, 246"],
    .stat-icon[style*="background: rgba(139, 92, 246"],
    .finance-icon[style*="background: rgba(139, 92, 246"] {
        background: rgba(139, 92, 246, 0.2) !important;
        color: #a78bfa !important;
    }

    /* List Group */
    .list-group-item {
        background-color: var(--bg-card);
        border-color: var(--border-color);
        color: var(--text-primary);
    }
    .list-group-item:hover {
        background-color: var(--bg-tertiary);
    }

    /* Small text and labels */
    small, .small {
        color: var(--text-secondary);
    }
    label {
        color: var(--text-secondary);
    }
}

/* =============================================================================
   2. RESET & BASE STYLES
   ============================================================================= */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

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

a:hover {
    color: var(--accent-blue-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* =============================================================================
   3. LAYOUT
   ============================================================================= */

/* App Container - mit Sidebar */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-normal);
}

/* Wenn Sidebar collapsed */
.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Content Container */
.content-wrapper {
    flex: 1;
    padding: var(--spacing-lg);
    max-width: 1600px;
    width: 100%;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
}

.page-actions {
    display: flex;
    gap: var(--spacing-sm);
}

/* Footer */
.app-footer {
    flex-shrink: 0;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* =============================================================================
   4. NAVIGATION
   ============================================================================= */

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: var(--z-sidebar);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-normal);
    overflow: hidden;
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

/* Sidebar Header/Brand */
.sidebar-header {
    padding: var(--spacing-sm);
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.sidebar-logo-full {
    width: 100%;
    height: auto;
    display: block;
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--sidebar-text-active);
    white-space: nowrap;
}

.sidebar-brand-icon {
    font-size: 1.5rem;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md) 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--sidebar-border);
    border-radius: var(--radius-full);
}

/* Nav Section (Gruppe) */
.nav-section {
    margin-bottom: var(--spacing-sm);
}

.nav-section-title {
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--sidebar-text);
    opacity: 0.6;
}

/* Nav Item (Parent mit Untermenü) */
.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    color: var(--sidebar-text);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    text-decoration: none;
}

/* Nav Toggle (klickbarer Parent) */
.nav-toggle {
    user-select: none;
}

.nav-link:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text-active);
}

.nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-active);
}

.nav-link-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-link-text {
    flex: 1;
    white-space: nowrap;
}

.nav-link-arrow {
    transition: transform var(--transition-fast);
}

.nav-item.open .nav-link-arrow {
    transform: rotate(90deg);
}

/* Submenu */
.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal);
    background: rgba(0, 0, 0, 0.15);
}

.nav-item.open .nav-submenu {
    max-height: 500px;
}

.nav-submenu .nav-link {
    padding-left: calc(var(--spacing-lg) + 28px);
    font-size: 0.8125rem;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--sidebar-border);
}

.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    color: var(--sidebar-text);
    font-size: 0.85rem;
}

.sidebar-footer .user-info span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-active);
}

/* Topbar (optional, für Mobile oder alternative Layouts) */
.topbar {
    position: sticky;
    top: 0;
    z-index: var(--z-topbar);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

/* API Indicator */
.api-indicator {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* API Indicator in Sidebar (dunkler Hintergrund) */
.sidebar-footer .api-indicator {
    background: rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text);
}

.api-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--accent-green);
}

.api-dot.warning { background: var(--accent-yellow); }
.api-dot.danger { background: var(--accent-red); }

/* =============================================================================
   5. KOMPONENTEN
   ============================================================================= */

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
}

.card-header {
    padding: var(--spacing-md) var(--spacing-lg);
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: var(--spacing-lg);
}

.card-footer {
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Dashboard Card */
.dashboard-card {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
}

.dashboard-card-title {
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-md);
    font-weight: 600;
}

/* KPI Card - Modern Flat Design */
.kpi-card {
    text-align: center;
    padding: var(--spacing-md) var(--spacing-sm);
    border: none;
    background: var(--bg-primary);
    box-shadow: none;
    border-radius: var(--radius-md);
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
}

/* Dezente Farben für KPI-Werte */
.kpi-value.text-primary { color: var(--text-primary) !important; }
.kpi-value.text-success { color: #16a34a !important; }
.kpi-value.text-danger { color: #dc2626 !important; }
.kpi-value.text-warning { color: #ca8a04 !important; }
.kpi-value.text-info { color: #0284c7 !important; }
.kpi-value.text-secondary { color: var(--text-secondary) !important; }

.kpi-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 4px;
    font-weight: 500;
}

.kpi-trend {
    font-size: 0.75rem;
    margin-top: var(--spacing-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
}

.kpi-trend.positive { color: #16a34a; }
.kpi-trend.negative { color: #dc2626; }

/* --- Tables --- */
.table {
    width: 100%;
    margin-bottom: 0;
    border-collapse: collapse;
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 2px solid var(--border-color);
    text-align: left;
}

.table td {
    padding: var(--spacing-sm) var(--spacing-md);
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background-color: var(--bg-secondary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Table Responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* --- Forms --- */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent-blue);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control-sm {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8125rem;
}

.form-control-lg {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 1rem;
}

.form-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

/* Input Group */
.input-group {
    display: flex;
}

.input-group .form-control {
    flex: 1;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* Checkbox / Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.form-check-input {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

.form-check-label {
    cursor: pointer;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    font-weight: 500;
    font-size: 0.875rem;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: #000;
    border-color: #000;
}

.btn-secondary {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-tertiary);
}

.btn-success {
    background-color: var(--accent-green);
    border-color: var(--accent-green);
    color: var(--text-white);
}

.btn-success:hover:not(:disabled) {
    background-color: var(--accent-green-dark);
    border-color: var(--accent-green-dark);
}

.btn-danger {
    background-color: var(--accent-red);
    border-color: var(--accent-red);
    color: var(--text-white);
}

.btn-danger:hover:not(:disabled) {
    background-color: var(--accent-red-dark);
    border-color: var(--accent-red-dark);
}

.btn-warning {
    background-color: var(--accent-yellow);
    border-color: var(--accent-yellow);
    color: var(--text-primary);
}

.btn-outline-primary {
    background-color: transparent;
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.btn-outline-primary:hover:not(:disabled) {
    background-color: var(--text-primary);
    color: var(--text-white);
}

.btn-outline-secondary {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover:not(:disabled) {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent-blue);
    padding: 0;
}

.btn-link:hover {
    color: var(--accent-blue-dark);
    text-decoration: underline;
}

.btn-sm {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8125rem;
}

.btn-lg {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 1rem;
}

.btn-icon {
    padding: var(--spacing-sm);
    width: 36px;
    height: 36px;
}

.btn-icon.btn-sm {
    width: 28px;
    height: 28px;
    padding: var(--spacing-xs);
}

/* Button Group */
.btn-group {
    display: inline-flex;
}

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.btn-group .btn:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 500;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
}

.badge-primary {
    background-color: var(--accent-blue-light);
    color: var(--accent-blue-dark);
}

.badge-success {
    background-color: var(--accent-green-light);
    color: var(--accent-green-dark);
}

.badge-danger {
    background-color: var(--accent-red-light);
    color: var(--accent-red-dark);
}

.badge-warning {
    background-color: var(--accent-yellow-light);
    color: var(--accent-yellow-dark);
}

.badge-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
}

/* Status Badges */
.badge-beobachtet {
    background-color: #e3f2fd;
    color: var(--status-beobachtet);
}

.badge-geboten {
    background-color: #fff3e0;
    color: var(--status-geboten);
}

.badge-gewonnen {
    background-color: #e8f5e9;
    color: var(--status-gewonnen);
}

.badge-verloren {
    background-color: #ffebee;
    color: var(--status-verloren);
}

.badge-verkauft {
    background-color: #f3e5f5;
    color: var(--status-verkauft);
}

.badge-in-stock {
    background-color: var(--accent-green-light);
    color: var(--accent-green-dark);
}

.badge-listed {
    background-color: var(--accent-blue-light);
    color: var(--accent-blue-dark);
}

.badge-reserved {
    background-color: var(--accent-yellow-light);
    color: var(--accent-yellow-dark);
}

.badge-sold {
    background-color: var(--accent-purple-light);
    color: var(--accent-purple-dark);
}

/* Status Dots */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    display: inline-block;
}

.dot-beobachtet { background: var(--status-beobachtet); }
.dot-geboten { background: var(--status-geboten); }
.dot-gewonnen { background: var(--status-gewonnen); }
.dot-verloren { background: var(--status-verloren); }
.dot-verkauft { background: var(--status-verkauft); }
.dot-success { background: var(--accent-green); }
.dot-warning { background: var(--accent-yellow); }
.dot-danger { background: var(--accent-red); }

/* --- Alerts --- */
.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
}

.alert-success {
    background-color: var(--accent-green-light);
    color: var(--accent-green-dark);
    border: 1px solid var(--accent-green);
}

.alert-danger {
    background-color: var(--accent-red-light);
    color: var(--accent-red-dark);
    border: 1px solid var(--accent-red);
}

.alert-warning {
    background-color: var(--accent-yellow-light);
    color: var(--accent-yellow-dark);
    border: 1px solid var(--accent-yellow);
}

.alert-info {
    background-color: var(--accent-blue-light);
    color: var(--accent-blue-dark);
    border: 1px solid var(--accent-blue);
}

/* --- Modals (Custom, nicht Bootstrap) --- */
.custom-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
}

.custom-modal {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

/* Bootstrap Modal Overrides */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
}

.modal-header {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-weight: 600;
    font-size: 1.125rem;
}

.modal-body {
    padding: var(--spacing-lg);
}

.modal-footer {
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

/* Bootstrap Fullscreen Modal - Keine Einschränkungen */
.modal-fullscreen .modal-content {
    border-radius: 0;
}

/* Custom Modal Sizes (nicht Bootstrap) */
.custom-modal-sm { max-width: 400px; }
.custom-modal-lg { max-width: 800px; }
.custom-modal-xl { max-width: 1140px; }

/* --- Images --- */
.minifig-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
}

.minifig-img-sm { width: 32px; height: 32px; }
.minifig-img-lg { width: 60px; height: 60px; }
.minifig-img-xl { width: 100px; height: 100px; }

.minifig-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 1.25rem;
}

/* --- Dropdown --- */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 100;
    min-width: 180px;
    padding: var(--spacing-xs) 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    display: none;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--bg-secondary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--spacing-xs) 0;
}

/* --- Tabs --- */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--spacing-lg);
}

.tab {
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}

/* --- Loading / Spinner --- */
.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

.spinner-sm { width: 16px; height: 16px; }
.spinner-lg { width: 40px; height: 40px; border-width: 3px; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: var(--spacing-xxl) var(--spacing-lg);
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.empty-state-text {
    font-size: 0.875rem;
    margin-bottom: var(--spacing-lg);
}

/* --- Price Display --- */
.price {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.price-positive { color: var(--accent-green); }
.price-negative { color: var(--accent-red); }
.price-lg { font-size: 1.25rem; }
.price-xl { font-size: 1.5rem; }

/* --- Activity / List Items --- */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border-color);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background: var(--bg-secondary);
    margin: 0 calc(-1 * var(--spacing-md));
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
    border-radius: var(--radius-sm);
}

.list-item-title {
    font-weight: 500;
}

.list-item-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* --- Stat Item --- */
.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 600;
    font-size: 1.125rem;
}

/* --- Charts --- */
.chart-container {
    position: relative;
    height: 300px;
}

.chart-container-sm { height: 200px; }
.chart-container-lg { height: 400px; }

/* =============================================================================
   6. UTILITIES
   ============================================================================= */

/* Display */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.d-grid { display: grid !important; }

/* Flexbox */
.flex-column { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-1 { flex: 1 !important; }
.align-items-center { align-items: center !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-end { align-items: flex-end !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-end { justify-content: flex-end !important; }

/* Gap */
.gap-1 { gap: var(--spacing-xs) !important; }
.gap-2 { gap: var(--spacing-sm) !important; }
.gap-3 { gap: var(--spacing-md) !important; }
.gap-4 { gap: var(--spacing-lg) !important; }

/* Margin */
.m-0 { margin: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--spacing-xs) !important; }
.mb-2 { margin-bottom: var(--spacing-sm) !important; }
.mb-3 { margin-bottom: var(--spacing-md) !important; }
.mb-4 { margin-bottom: var(--spacing-lg) !important; }
.mt-2 { margin-top: var(--spacing-sm) !important; }
.mt-3 { margin-top: var(--spacing-md) !important; }
.mt-4 { margin-top: var(--spacing-lg) !important; }
.me-2 { margin-right: var(--spacing-sm) !important; }
.ms-2 { margin-left: var(--spacing-sm) !important; }
.ms-auto { margin-left: auto !important; }

/* Padding */
.p-0 { padding: 0 !important; }
.p-2 { padding: var(--spacing-sm) !important; }
.p-3 { padding: var(--spacing-md) !important; }
.p-4 { padding: var(--spacing-lg) !important; }

/* Width */
.w-100 { width: 100% !important; }
.w-auto { width: auto !important; }

/* Text */
.text-center { text-align: center !important; }
.text-end { text-align: right !important; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-success { color: var(--accent-green) !important; }
.text-danger { color: var(--accent-red) !important; }
.text-warning { color: var(--accent-yellow) !important; }
.text-primary-color { color: var(--accent-blue) !important; }
.fw-bold { font-weight: 700 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-medium { font-weight: 500 !important; }
.fs-sm { font-size: 0.875rem !important; }
.fs-xs { font-size: 0.75rem !important; }

/* Background */
.bg-light { background-color: var(--bg-secondary) !important; }
.bg-white { background-color: var(--bg-primary) !important; }

/* Border */
.border { border: 1px solid var(--border-color) !important; }
.border-0 { border: 0 !important; }
.rounded { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }

/* Cursor */
.cursor-pointer { cursor: pointer !important; }
.cursor-not-allowed { cursor: not-allowed !important; }

/* Overflow */
.overflow-hidden { overflow: hidden !important; }
.overflow-auto { overflow: auto !important; }

/* Position */
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }

/* Visibility */
.invisible { visibility: hidden !important; }
.visible { visibility: visible !important; }

/* =============================================================================
   7. RESPONSIVE
   ============================================================================= */

/* Sidebar Overlay - Default hidden */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-sidebar) - 1);
    display: none;
}

/* Mobile Sidebar */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar.show ~ .sidebar-overlay {
        display: block;
    }
}

@media (max-width: 767.98px) {
    html {
        font-size: 14px;
    }

    .content-wrapper {
        padding: var(--spacing-md);
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .kpi-value {
        font-size: 1.25rem;
    }

    .kpi-label {
        font-size: 0.65rem;
    }

    .card-body {
        padding: var(--spacing-md);
    }

    .table th,
    .table td {
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .custom-modal {
        margin: var(--spacing-md);
        max-height: calc(100vh - 2rem);
    }

    .btn {
        padding: var(--spacing-sm);
    }

    /* Hide text on small screens for icon buttons */
    .btn-responsive-icon .btn-text {
        display: none;
    }
}

/* =============================================================================
   GLOBAL SEARCH
   ============================================================================= */

.sidebar-search {
    padding: var(--spacing-sm) var(--spacing-md);
    position: relative;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--sidebar-text);
    font-size: 14px;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 8px 70px 8px 36px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--sidebar-text-active);
    font-size: 13px;
    transition: all 0.2s;
}

.search-input::placeholder {
    color: var(--sidebar-text);
    opacity: 0.7;
}

.search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--accent-blue);
}

.search-shortcut {
    position: absolute;
    right: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-family: inherit;
    border: none;
}

.search-results {
    position: absolute;
    top: 100%;
    left: var(--spacing-md);
    right: var(--spacing-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    margin-top: 4px;
}

.search-results.show {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    transition: background 0.15s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item.active {
    background: var(--bg-secondary);
}

.search-result-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: 16px;
}

.search-result-image {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.search-result-type {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-result-price {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-green);
}

.search-no-results {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    color: var(--text-muted);
    font-size: 13px;
}

.search-no-results i {
    font-size: 18px;
}

/* =============================================================================
   7b. KPI CARDS - FLAT DESIGN
   ============================================================================= */

/* KPI Card Container */
.kpi-card {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Farbige Bordüre links */
.kpi-border {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.kpi-border-green { background: var(--accent-green); }
.kpi-border-blue { background: var(--accent-blue); }
.kpi-border-yellow { background: var(--accent-yellow); }
.kpi-border-purple { background: var(--accent-purple); }
.kpi-border-red { background: var(--accent-red); }
.kpi-border-orange { background: var(--accent-orange); }

/* Neutrales Icon */
.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* KPI Wert - neutral dunkel */
.kpi-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

/* KPI Label */
.kpi-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* =============================================================================
   7c. STAT CARDS - FLAT DESIGN
   ============================================================================= */

.stat-card {
    text-align: center;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* =============================================================================
   8. MOBILE OPTIMIZATIONS
   ============================================================================= */

/* Touch-friendly button sizing */
@media (max-width: 767.98px) {
    /* Larger touch targets */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    .btn-sm {
        min-height: 36px;
        min-width: 36px;
    }

    /* Form elements */
    .form-control,
    .form-select {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom */
    }

    /* Navigation links */
    .nav-link {
        padding: var(--spacing-md) var(--spacing-lg);
        min-height: 48px;
    }

    /* Hide non-essential columns on mobile */
    .table .hide-mobile {
        display: none !important;
    }

    /* Stack table cells */
    .table-mobile-stack {
        display: block;
    }

    .table-mobile-stack thead {
        display: none;
    }

    .table-mobile-stack tbody,
    .table-mobile-stack tr,
    .table-mobile-stack td {
        display: block;
        width: 100%;
    }

    .table-mobile-stack tr {
        margin-bottom: var(--spacing-md);
        background: var(--bg-card);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
        padding: var(--spacing-md);
    }

    .table-mobile-stack td {
        padding: var(--spacing-xs) 0;
        border: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .table-mobile-stack td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        color: var(--text-secondary);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        flex-shrink: 0;
        margin-right: var(--spacing-md);
    }

    /* Modal fullscreen on mobile */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100vh;
    }

    .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }

    /* Floating action button for mobile */
    .fab {
        position: fixed;
        bottom: var(--spacing-lg);
        right: var(--spacing-lg);
        width: 56px;
        height: 56px;
        border-radius: var(--radius-full);
        box-shadow: var(--shadow-lg);
        z-index: 50;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Page actions stack vertically */
    .page-actions {
        width: 100%;
        flex-direction: column;
    }

    .page-actions .btn {
        width: 100%;
    }

    /* Horizontal scroll for KPI cards */
    .kpi-row {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        gap: var(--spacing-md);
        padding-bottom: var(--spacing-sm);
    }

    .kpi-row::-webkit-scrollbar {
        display: none;
    }

    .kpi-row > .col {
        flex: 0 0 auto;
        width: 140px;
        scroll-snap-align: start;
    }
}

/* Small phones */
@media (max-width: 374.98px) {
    html {
        font-size: 13px;
    }

    .content-wrapper {
        padding: var(--spacing-sm);
    }

    .page-title {
        font-size: 1.25rem;
    }

    .kpi-value {
        font-size: 1.1rem;
    }
}

/* Tablet specific */
@media (min-width: 768px) and (max-width: 991.98px) {
    .content-wrapper {
        padding: var(--spacing-md);
    }

    /* Two-column grid for KPIs on tablet */
    .kpi-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }
}

/* Desktop hide mobile-only elements */
@media (min-width: 992px) {
    .show-mobile-only {
        display: none !important;
    }
}

/* Mobile show mobile-only elements */
@media (max-width: 991.98px) {
    .hide-mobile-only {
        display: none !important;
    }
}

/* Safe area insets for modern devices (notch, home indicator) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .app-footer {
        padding-bottom: calc(var(--spacing-md) + env(safe-area-inset-bottom));
    }

    .fab {
        bottom: calc(var(--spacing-lg) + env(safe-area-inset-bottom));
    }

    .sidebar {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* =============================================================================
   9. ACCESSIBILITY IMPROVEMENTS
   ============================================================================= */

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000;
        --text-secondary: #333;
    }

    .btn {
        border-width: 2px;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .topbar,
    .app-footer,
    .btn,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* =============================================================================
   10. ERWEITERTE MOBILE OPTIMIERUNGEN
   ============================================================================= */

/* KRITISCH: Globale Mobile Overflow-Fixes */
@media (max-width: 767.98px) {
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    /* Alle Container begrenzen */
    .app-container,
    .main-content,
    .content-wrapper,
    .container,
    .container-fluid,
    .row {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    /* Content-Wrapper Padding reduzieren */
    .content-wrapper {
        padding: var(--spacing-sm) !important;
        width: 100% !important;
    }

    /* Rows dürfen nicht über Container hinaus */
    .row,
    .row.g-1, .row.g-2, .row.g-3, .row.g-4, .row.g-5 {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        --bs-gutter-x: 0.5rem !important;
    }

    /* Columns padding anpassen */
    [class*="col-"] {
        padding-left: 0.25rem !important;
        padding-right: 0.25rem !important;
    }

    /* Bootstrap Gutter Fixes für Mobile */
    .g-3 > [class*="col-"],
    .g-4 > [class*="col-"] {
        padding-left: 0.25rem !important;
        padding-right: 0.25rem !important;
    }

    /* col-6 auf Mobile bleibt 50% aber ohne overflow */
    .col-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        box-sizing: border-box !important;
    }

    /* KPI Cards auf Mobile kompakter */
    .kpi-card {
        width: 100%;
    }

    .kpi-card .card-body {
        padding: 0.5rem !important;
    }

    .kpi-card .d-flex {
        gap: 0.5rem !important;
    }

    /* d-flex mit gap begrenzen */
    .d-flex {
        flex-wrap: wrap;
        max-width: 100%;
    }

    .d-flex.gap-2,
    .d-flex.gap-3 {
        gap: 0.5rem !important;
    }

    /* Page Header mobile */
    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem !important;
    }

    .page-title {
        font-size: 1.25rem !important;
    }

    /* Buttons auf volle Breite */
    .page-header .btn,
    .page-header .btn-group {
        width: 100%;
    }

    /* Tabellen scrollbar machen */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        max-width: 100vw;
    }
}

/* Mobile Topbar Sticky */
@media (max-width: 991.98px) {
    .topbar {
        position: sticky;
        top: 0;
        z-index: var(--z-topbar);
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
        padding: var(--spacing-sm) var(--spacing-md);
        min-height: 56px;
    }

    .topbar .btn-icon {
        width: 40px;
        height: 40px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .topbar .btn-icon i {
        font-size: 1.25rem;
    }
}

/* Mobile-freundliche KPI-Grid */
@media (max-width: 767.98px) {
    /* KPI Cards 2x2 Grid auf Mobile */
    .row.g-3 > [class*="col-6"] {
        padding: 0.375rem;
    }

    .kpi-card .card-body {
        padding: var(--spacing-sm);
    }

    .kpi-card .kpi-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .kpi-card .kpi-number {
        font-size: 1.1rem;
    }

    .kpi-card .kpi-label {
        font-size: 0.65rem;
    }

    /* Cards kompakter */
    .card {
        margin-bottom: var(--spacing-md);
    }

    .card-header {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.875rem;
    }

    .card-body {
        padding: var(--spacing-md);
    }

    /* Tabellen-Optimierung */
    .table {
        font-size: 0.8125rem;
    }

    .table th {
        font-size: 0.65rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .table td {
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    /* Bilder in Tabellen kleiner */
    .table .minifig-img,
    .table img[width="40"],
    .table img[width="50"] {
        width: 32px !important;
        height: 32px !important;
    }

    /* Aktions-Buttons in Tabellen */
    .table .btn-group {
        display: flex;
        flex-wrap: nowrap;
    }

    .table .btn-sm {
        padding: 0.25rem 0.4rem;
        font-size: 0.75rem;
        min-width: 32px;
        min-height: 32px;
    }

    /* Badges kleiner */
    .badge {
        font-size: 0.65rem;
        padding: 0.15rem 0.4rem;
    }

    /* Select/Dropdown in Tabellen */
    .table select.form-select-sm {
        font-size: 0.75rem;
        padding: 0.2rem 1.5rem 0.2rem 0.4rem;
        min-height: 32px;
    }
}

/* Mobile Card-basierte Tabellen-Alternative */
@media (max-width: 767.98px) {
    /* Card-Style für mobile Tabellenzeilen */
    .mobile-card-row {
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: var(--spacing-md);
        margin-bottom: var(--spacing-sm);
    }

    .mobile-card-row .row-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: var(--spacing-sm);
    }

    .mobile-card-row .row-title {
        font-weight: 600;
        font-size: 0.9rem;
    }

    .mobile-card-row .row-details {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-xs);
        font-size: 0.8rem;
        color: var(--text-secondary);
    }

    .mobile-card-row .row-detail {
        display: flex;
        flex-direction: column;
    }

    .mobile-card-row .detail-label {
        font-size: 0.65rem;
        text-transform: uppercase;
        color: var(--text-muted);
        letter-spacing: 0.3px;
    }

    .mobile-card-row .detail-value {
        font-weight: 500;
        color: var(--text-primary);
    }

    .mobile-card-row .row-actions {
        display: flex;
        gap: var(--spacing-sm);
        margin-top: var(--spacing-sm);
        padding-top: var(--spacing-sm);
        border-top: 1px solid var(--border-light);
    }

    .mobile-card-row .row-actions .btn {
        flex: 1;
    }
}

/* Modals auf Mobile: Fullscreen-Style */
@media (max-width: 767.98px) {
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }

    .modal-content {
        border-radius: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .modal-header {
        flex-shrink: 0;
        padding: var(--spacing-md);
        position: sticky;
        top: 0;
        background: var(--bg-primary);
        z-index: 10;
    }

    .modal-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-footer {
        flex-shrink: 0;
        padding: var(--spacing-md);
        position: sticky;
        bottom: 0;
        background: var(--bg-primary);
        border-top: 1px solid var(--border-color);
    }

    /* Footer-Buttons volle Breite */
    .modal-footer .btn {
        flex: 1;
    }

    /* Form-Rows im Modal einspaltiger */
    .modal-body .row > [class*="col-md-"],
    .modal-body .row > [class*="col-lg-"] {
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    .modal-body .row {
        margin-left: 0;
        margin-right: 0;
    }

    .modal-body .row > div {
        margin-bottom: var(--spacing-sm);
    }
}

/* Sticky Filter/Search Bars auf Mobile */
@media (max-width: 767.98px) {
    .filter-bar,
    .search-bar {
        position: sticky;
        top: 56px; /* Nach Topbar */
        z-index: 80;
        background: var(--bg-secondary);
        padding: var(--spacing-sm) var(--spacing-md);
        margin: 0 calc(-1 * var(--spacing-md));
        margin-bottom: var(--spacing-md);
    }

    .filter-bar .input-group,
    .search-bar .input-group {
        flex-wrap: nowrap;
    }

    .filter-bar .btn,
    .search-bar .btn {
        white-space: nowrap;
    }
}

/* Pull-to-Refresh Visual Hint */
@media (max-width: 767.98px) {
    .pull-indicator {
        text-align: center;
        padding: var(--spacing-md);
        color: var(--text-muted);
        font-size: 0.8rem;
        display: none;
    }

    .pull-indicator.show {
        display: block;
    }
}

/* Swipe-Actions für Listen (CSS-only Hint) */
@media (max-width: 767.98px) {
    .swipeable-row {
        position: relative;
        overflow: hidden;
    }

    .swipe-actions {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        display: flex;
        transform: translateX(100%);
        transition: transform 0.2s ease;
    }

    .swipe-actions .btn {
        border-radius: 0;
        min-width: 60px;
    }
}

/* Empty States kompakter auf Mobile */
@media (max-width: 767.98px) {
    .empty-state {
        padding: var(--spacing-lg);
    }

    .empty-state-icon {
        font-size: 2rem;
    }

    .empty-state-title {
        font-size: 1rem;
    }

    .empty-state-text {
        font-size: 0.8rem;
    }
}

/* Charts responsive */
@media (max-width: 767.98px) {
    .chart-container {
        height: 180px;
    }

    .chart-container-lg {
        height: 250px;
    }
}

/* Bottom Navigation Bar (optional, für wichtige Aktionen) */
.bottom-nav {
    display: none;
}

@media (max-width: 767.98px) {
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        border-top: 1px solid var(--border-color);
        padding: var(--spacing-sm);
        padding-bottom: calc(var(--spacing-sm) + env(safe-area-inset-bottom, 0px));
        z-index: 90;
        gap: var(--spacing-xs);
    }

    .bottom-nav .nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: var(--spacing-xs);
        color: var(--text-secondary);
        text-decoration: none;
        font-size: 0.65rem;
        border-radius: var(--radius-sm);
        transition: all 0.15s;
    }

    .bottom-nav .nav-item i {
        font-size: 1.25rem;
        margin-bottom: 2px;
    }

    .bottom-nav .nav-item.active,
    .bottom-nav .nav-item:active {
        color: var(--accent-blue);
        background: var(--accent-blue-light);
    }

    /* Content braucht Platz für Bottom-Nav */
    body.has-bottom-nav .content-wrapper {
        padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    }

    body.has-bottom-nav .app-footer {
        display: none;
    }
}

/* Utility: Hide-Klassen für responsive */
@media (max-width: 575.98px) {
    .hide-xs { display: none !important; }
}

@media (max-width: 767.98px) {
    .hide-sm { display: none !important; }
}

@media (max-width: 991.98px) {
    .hide-md { display: none !important; }
}

/* Show-Klassen */
@media (min-width: 768px) {
    .show-mobile { display: none !important; }
}

@media (max-width: 767.98px) {
    .show-mobile { display: block !important; }
    .show-mobile.d-flex { display: flex !important; }
}

/* Touch-optimierte Checkboxen und Radio-Buttons */
@media (max-width: 767.98px) {
    .form-check {
        padding: var(--spacing-sm) 0;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .form-check-input {
        width: 22px;
        height: 22px;
        margin-right: var(--spacing-sm);
    }

    .form-check-label {
        font-size: 0.9rem;
        line-height: 1.4;
    }
}

/* Bessere Tap-Targets für Links in Listen */
@media (max-width: 767.98px) {
    .list-group-item,
    .list-item {
        padding: var(--spacing-md);
        min-height: 56px;
    }

    .list-group-item a,
    .list-item a {
        display: block;
        margin: calc(-1 * var(--spacing-md));
        padding: var(--spacing-md);
    }
}

/* Textarea auf Mobile */
@media (max-width: 767.98px) {
    textarea.form-control {
        min-height: 100px;
    }
}

/* Toast/Notification auf Mobile */
@media (max-width: 767.98px) {
    .toast-container {
        bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
        left: var(--spacing-md) !important;
        right: var(--spacing-md) !important;
    }

    .alert.position-fixed {
        left: var(--spacing-md) !important;
        right: var(--spacing-md) !important;
        top: 70px !important;
    }
}

/* =============================================================================
   TODO/NOTIZEN WIDGET
   ============================================================================= */

/* Quick Actions Container in Sidebar Footer */
.sidebar-quick-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

/* Quick Action Buttons (Notizen + Aufgaben) */
.btn-quick-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    flex: 1;
    padding: 0.55rem 0.75rem;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: var(--radius-md);
    color: #93c5fd;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    position: relative;
}

.btn-quick-action:hover {
    background: rgba(59, 130, 246, 0.22);
    color: #bfdbfe;
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.btn-quick-action:active {
    transform: translateY(0);
}

.btn-quick-action i {
    font-size: 0.95rem;
}

.btn-quick-action span:not(.quick-action-badge) {
    white-space: nowrap;
}

/* Badge fuer offene Aufgaben */
.quick-action-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--success);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 9px;
    margin-left: 2px;
}

.quick-action-badge.urgent {
    background: var(--danger);
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Legacy Support - alte Klasse */
.btn-todo-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 1rem;
    margin-bottom: 0.75rem;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius-md);
    color: #93c5fd;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-todo-toggle:hover {
    background: rgba(59, 130, 246, 0.25);
    color: #bfdbfe;
}

.btn-todo-toggle i {
    font-size: 1rem;
}

/* Todo Widget */
.todo-widget {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 340px;
    height: 400px;
    min-width: 280px;
    min-height: 200px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    overflow: hidden;
}

.todo-widget.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Widget Header */
.todo-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--sidebar-bg);
    color: white;
    cursor: move;
    user-select: none;
    flex-shrink: 0;
}

.todo-widget-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.todo-widget-title i {
    font-size: 1rem;
    opacity: 0.8;
}

.todo-widget-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 0.25rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.todo-widget-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Widget Body */
.todo-widget-body {
    padding: 0.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Todo Input Row */
.todo-input-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.todo-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: border-color var(--transition-fast);
}

.todo-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.todo-input::placeholder {
    color: var(--text-muted);
}

.todo-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
    flex-shrink: 0;
}

.todo-add-btn:hover {
    background: var(--accent-blue-dark);
}

/* Todo List */
.todo-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.todo-item:hover {
    background: var(--bg-secondary);
}

.todo-item.done {
    opacity: 0.6;
}

.todo-item.done .todo-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.todo-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: color var(--transition-fast);
}

.todo-checkbox:hover {
    color: var(--accent-blue);
}

.todo-item.done .todo-checkbox {
    color: var(--accent-green);
}

.todo-text {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word;
}

.todo-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    opacity: 0;
    transition: all var(--transition-fast);
}

.todo-item:hover .todo-delete {
    opacity: 1;
}

.todo-delete:hover {
    color: var(--accent-red);
}

/* Widget Footer */
.todo-widget-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.todo-save-status {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.todo-save-status.saved {
    color: var(--accent-green);
}

.todo-save-status i {
    font-size: 0.8rem;
}

.todo-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Resize Handle */
.todo-resize-handle {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 16px;
    height: 16px;
    cursor: se-resize;
    background: linear-gradient(135deg, transparent 50%, var(--border-color) 50%);
    border-radius: 0 0 var(--radius-lg) 0;
}

.todo-resize-handle:hover {
    background: linear-gradient(135deg, transparent 50%, var(--accent-blue) 50%);
}

/* Spin Animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

/* Mobile Anpassungen */
@media (max-width: 767.98px) {
    .todo-widget {
        right: 10px;
        bottom: 80px;
        left: 10px;
        width: auto;
        height: 350px;
        max-width: none;
    }
}

/* =============================================================================
   AUFGABEN POPUP WIDGET (Kanban-Style)
   ============================================================================= */

.tasks-popup {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 420px;
    height: 500px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.25s ease;
}

.tasks-popup.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.tasks-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    background: var(--sidebar-bg);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    cursor: move;
    user-select: none;
}

.tasks-popup-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: #fff;
}

.tasks-popup-title i {
    color: var(--accent-blue);
}

.tasks-popup-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tasks-popup-actions button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tasks-popup-actions button:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.tasks-popup-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Tabs */
.tasks-popup-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    padding: 0 0.5rem;
}

.tasks-popup-tab {
    flex: 1;
    padding: 0.625rem 0.5rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.tasks-popup-tab:hover {
    color: var(--text-primary);
}

.tasks-popup-tab.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.tasks-popup-tab .badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
}

/* Quick Add */
.tasks-popup-quickadd {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.tasks-popup-quickadd input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-primary);
}

.tasks-popup-quickadd input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.tasks-popup-quickadd input::placeholder {
    color: var(--text-muted);
}

.tasks-popup-quickadd button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--accent-blue);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tasks-popup-quickadd button:hover {
    background: var(--accent-blue-dark);
}

/* Task List */
.tasks-popup-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.tasks-popup-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.tasks-popup-empty i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* Task Item */
.task-popup-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.task-popup-item:hover {
    border-color: var(--border-color);
    transform: translateX(2px);
}

.task-popup-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.task-popup-item[data-priority="high"]::before { background: var(--accent-red); }
.task-popup-item[data-priority="medium"]::before { background: var(--accent-yellow); }
.task-popup-item[data-priority="low"]::before { background: var(--accent-blue); }

.task-popup-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    margin-top: 1px;
}

.task-popup-checkbox:hover {
    color: var(--accent-green);
}

.task-popup-content {
    flex: 1;
    min-width: 0;
}

.task-popup-item-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
    word-break: break-word;
}

.task-popup-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.task-popup-meta-item {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.task-popup-meta-item.overdue {
    color: var(--accent-red);
    font-weight: 600;
}

.task-popup-meta-item.today {
    color: var(--accent-yellow);
    font-weight: 600;
}

/* Task item done state */
.task-popup-item.done {
    opacity: 0.6;
}

.task-popup-item.done .task-popup-item-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-popup-item.done .task-popup-checkbox {
    color: var(--accent-green);
}

/* Footer */
.tasks-popup-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.tasks-popup-footer a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
}

.tasks-popup-footer a:hover {
    text-decoration: underline;
}

/* Resize Handle */
.tasks-popup-resize {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 16px;
    height: 16px;
    cursor: se-resize;
    background: linear-gradient(135deg, transparent 50%, var(--border-color) 50%);
    border-radius: 0 0 var(--radius-lg) 0;
}

.tasks-popup-resize:hover {
    background: linear-gradient(135deg, transparent 50%, var(--accent-blue) 50%);
}

/* Mobile */
@media (max-width: 767.98px) {
    .tasks-popup {
        right: 10px;
        bottom: 80px;
        left: 10px;
        width: auto;
        height: 400px;
    }
}
