/* fakturox - Professional Invoice Management System
 * Ultra-Modern 2026 Design with Glassmorphism, Fluent Design & Premium UX
 * Optimized for Desktop, iPad & iPhone
 */

/* ========================================
   PAGE PRELOADER
   ======================================== */
.preloader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary, #f8fafc);
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .preloader {
    background: #0f172a;
}

.preloader.preloader-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    animation: preloaderFadeIn 0.4s ease-out;
}

@keyframes preloaderFadeIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.preloader-logo {
    position: relative;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preloader-logo-img {
    width: 56px;
    height: auto;
    max-height: 56px;
    object-fit: contain;
}

.preloader-logo-fallback {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--color-primary, #18B7C8);
    display: flex;
    align-items: center;
}

.preloader-logo-fallback span {
    color: #6EEB3B;
}

/* Animierte Ringe um das Logo */
.preloader-ring {
    position: absolute;
    width: 90px;
    height: 90px;
    border: 2px solid transparent;
    border-top-color: #18B7C8;
    border-right-color: #18B7C8;
    border-radius: 50%;
    animation: preloaderSpin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.preloader-ring-2 {
    width: 106px;
    height: 106px;
    border-top-color: #6EEB3B;
    border-right-color: transparent;
    border-bottom-color: #6EEB3B;
    border-left-color: transparent;
    animation-duration: 1.8s;
    animation-direction: reverse;
    opacity: 0.5;
}

@keyframes preloaderSpin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Pulsierende Punkte */
.preloader-dots {
    display: flex;
    gap: 0.5rem;
}

.preloader-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #18B7C8;
    animation: preloaderBounce 1.4s ease-in-out infinite;
}

.preloader-dot:nth-child(2) {
    animation-delay: 0.16s;
    background: linear-gradient(135deg, #18B7C8, #6EEB3B);
}

.preloader-dot:nth-child(3) {
    animation-delay: 0.32s;
    background: #6EEB3B;
}

@keyframes preloaderBounce {
    0%, 80%, 100% { 
        transform: scale(0.6); 
        opacity: 0.4; 
    }
    40% { 
        transform: scale(1.2); 
        opacity: 1; 
    }
}

/* ========================================
   CSS VARIABLES (Light Theme Default)
   ======================================== */
:root {
    /* Brand Colors - Enhanced 2026 Edition */
    --color-primary: #18B7C8;
    --color-primary-hover: #14a3b3;
    --color-primary-light: #d4f4f7;
    --color-primary-dark: #0f7a86;
    --color-primary-gradient: linear-gradient(135deg, #1EA7FF 0%, #18B7C8 55%, #6EEB3B 100%);
    --color-primary-gradient-hover: linear-gradient(135deg, #18B7C8 0%, #6EEB3B 100%);
    --color-primary-glow: rgba(24, 183, 200, 0.4);
    
    /* Semantic Colors - Vibrant & Modern */
    --color-success: #10b981;
    --color-success-light: #d1fae5;
    --color-success-glow: rgba(16, 185, 129, 0.4);
    --color-success-gradient: linear-gradient(135deg, #10b981 0%, #34d399 50%, #6EEB3B 100%);
    --color-success-gradient-hover: linear-gradient(135deg, #34d399 0%, #6EEB3B 100%);
    --color-warning: #f59e0b;
    --color-warning-light: #fef3c7;
    --color-warning-glow: rgba(245, 158, 11, 0.4);
    --color-danger: #ef4444;
    --color-danger-light: #fee2e2;
    --color-danger-glow: rgba(239, 68, 68, 0.4);
    --color-info: #3b82f6;
    --color-info-light: #dbeafe;
    --color-info-glow: rgba(59, 130, 246, 0.4);
    
    /* Background - Glassmorphism Ready */
    --bg-body: #fafbfc;
    --bg-body-gradient: linear-gradient(135deg, #fafbfc 0%, #f3f4f6 100%);
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-card-glass: rgba(255, 255, 255, 0.8);
    --bg-sidebar: #ffffff;
    --bg-sidebar-glass: rgba(255, 255, 255, 0.98);
    --bg-input: #ffffff;
    --bg-secondary: #f1f5f9;
    --bg-hover: #f1f5f9;
    --bg-hover-glass: rgba(241, 245, 249, 0.8);
    --bg-table-header: #fafbfc;
    --bg-table-stripe: #f8fafc;
    --bg-overlay: rgba(15, 23, 42, 0.5);
    
    /* Text - Enhanced Hierarchy */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    --text-gradient: linear-gradient(135deg, #1EA7FF 0%, #18B7C8 100%);
    
    /* Borders - Subtle & Modern */
    --border-color: #e2e8f0;
    --border-color-hover: #cbd5e1;
    --border-input: #cbd5e1;
    --border-glow: rgba(24, 183, 200, 0.3);
    
    /* Shadows - Premium Depth */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.04);
    --shadow-sm: 0 2px 4px 0 rgb(0 0 0 / 0.06);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
    --shadow-md: 0 8px 12px -2px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.08);
    --shadow-lg: 0 16px 24px -4px rgb(0 0 0 / 0.12), 0 8px 12px -6px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 24px 48px -12px rgb(0 0 0 / 0.18), 0 12px 24px -8px rgb(0 0 0 / 0.12);
    --shadow-glow: 0 0 20px rgba(24, 183, 200, 0.3);
    --shadow-glow-hover: 0 0 30px rgba(24, 183, 200, 0.5);
    
    /* Glass Effects */
    --glass-backdrop: blur(20px) saturate(180%);
    --glass-backdrop-sm: blur(12px) saturate(160%);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.3);
    
    /* Spacing */
    --sidebar-width: 280px;
    --sidebar-width-collapsed: 80px;
    --header-height: 72px;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;
    --border-radius-pill: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ========================================
   DARK THEME - Premium 2026 Edition
   ======================================== */
[data-theme="dark"] {
    /* Background - Darker & More Depth */
    --bg-body: #0a0f1e;
    --bg-body-gradient: linear-gradient(135deg, #0a0f1e 0%, #1e293b 100%);
    --bg-card: rgba(30, 41, 59, 0.95);
    --bg-card-glass: rgba(30, 41, 59, 0.7);
    --bg-sidebar: #0a0f1e;
    --bg-sidebar-glass: rgba(10, 15, 30, 0.98);
    --bg-input: rgba(30, 41, 59, 0.9);
    --bg-secondary: rgba(30, 41, 59, 0.6);
    --bg-hover: rgba(51, 65, 85, 0.8);
    --bg-hover-glass: rgba(51, 65, 85, 0.6);
    --bg-table-header: rgba(30, 41, 59, 0.5);
    --bg-table-stripe: rgba(30, 41, 59, 0.3);
    --bg-overlay: rgba(0, 0, 0, 0.7);
    
    /* Text - Enhanced Contrast */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --text-inverse: #0f172a;
    
    /* Borders - Subtle Glow */
    --border-color: rgba(51, 65, 85, 0.8);
    --border-color-hover: rgba(71, 85, 105, 0.9);
    --border-input: rgba(71, 85, 105, 0.6);
    --border-glow: rgba(24, 183, 200, 0.4);
    
    /* Semantic Colors - Dark Variations */
    --color-primary-light: rgba(24, 183, 200, 0.15);
    --color-success-light: rgba(16, 185, 129, 0.15);
    --color-warning-light: rgba(245, 158, 11, 0.15);
    --color-danger-light: rgba(239, 68, 68, 0.15);
    --color-info-light: rgba(59, 130, 246, 0.15);
    
    /* Shadows - Enhanced for Dark */
    --shadow-xs: 0 2px 4px 0 rgb(0 0 0 / 0.3);
    --shadow-sm: 0 4px 6px 0 rgb(0 0 0 / 0.4);
    --shadow: 0 8px 12px -2px rgb(0 0 0 / 0.5), 0 4px 8px -4px rgb(0 0 0 / 0.4);
    --shadow-md: 0 12px 20px -4px rgb(0 0 0 / 0.6), 0 6px 12px -6px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 20px 32px -8px rgb(0 0 0 / 0.7), 0 10px 16px -8px rgb(0 0 0 / 0.6);
    --shadow-xl: 0 32px 64px -16px rgb(0 0 0 / 0.8), 0 16px 32px -12px rgb(0 0 0 / 0.7);
    --shadow-glow: 0 0 30px rgba(24, 183, 200, 0.4);
    --shadow-glow-hover: 0 0 40px rgba(24, 183, 200, 0.6);
    
    /* Glass Effects - Dark Mode */
    --glass-backdrop: blur(24px) saturate(200%);
    --glass-backdrop-sm: blur(16px) saturate(180%);
    --glass-bg: rgba(30, 41, 59, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);
}

/* ========================================
   BASE STYLES - 2026 Enhanced
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'SF Pro Display', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-body-gradient);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    width: 100%;
}

/* Premium Background Effect */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(24, 183, 200, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(110, 235, 59, 0.06) 0%, transparent 50%);
    z-index: -1;
    animation: backgroundFlow 30s linear infinite;
    pointer-events: none;
}

@keyframes backgroundFlow {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

/* ========================================
   LAYOUT
   ======================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ========================================
   SIDEBAR - Theme-Aware Premium Design
   Optimized for iPad and iPhone
   ======================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    backdrop-filter: var(--glass-backdrop-sm);
    color: var(--text-primary);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height für iOS */
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    transition: transform var(--transition-base);
    border-right: 2px solid var(--border-color);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* iOS Safe Area für Sidebar */
@supports (padding: env(safe-area-inset-left)) {
    .sidebar {
        padding-left: env(safe-area-inset-left);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Dark Theme - Dunkle Sidebar */
[data-theme="dark"] .sidebar {
    background: var(--bg-sidebar-glass);
    color: var(--text-inverse);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

/* ========================================
   COLLAPSED SIDEBAR (Schmal)
   ======================================== */
.sidebar.collapsed {
    width: var(--sidebar-width-collapsed);
}

/* Logo und Mandantenname komplett verstecken im collapsed state */
.sidebar.collapsed .sidebar-brand {
    display: none;
}

/* Toggle Button zentrieren */
.sidebar.collapsed .sidebar-header {
    justify-content: center;
}

.sidebar.collapsed .sidebar-toggle-btn {
    margin: 0 auto;
}

/* Nav Sections - Titles verstecken */
.sidebar.collapsed .nav-section-title {
    display: none !important;
}

.sidebar.collapsed .nav-section {
    padding: 0.5rem 0.75rem;
}

/* Nav Links - Nur Icons zeigen */
.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.875rem;
    margin: 0.25rem 0.5rem;
}

.sidebar.collapsed .nav-link span {
    display: none !important;
}

.sidebar.collapsed .nav-link::before {
    display: none;
}

/* Tooltip beim Hover in collapsed state */
.sidebar.collapsed .nav-link {
    position: relative;
}

.sidebar.collapsed .nav-link:hover::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0.75rem;
    padding: 0.5rem 0.875rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
    z-index: 1000;
    font-size: 0.875rem;
    color: var(--text-primary);
    pointer-events: none;
}

[data-theme="dark"] .sidebar.collapsed .nav-link:hover::after {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Main Content Anpassung bei collapsed Sidebar */
body:has(.sidebar.collapsed) .main-content,
.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-width-collapsed);
}

/* Initial State für FOUC-Prevention */
.sidebar-collapsed .sidebar {
    width: var(--sidebar-width-collapsed);
}

/* Custom Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--bg-hover);
}

[data-theme="dark"] .sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(24, 183, 200, 0.3);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(24, 183, 200, 0.5);
}

.sidebar-header {
    height: var(--header-height);
    padding: 0 1.5rem;
    border-bottom: 2px solid var(--border-color);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

[data-theme="dark"] .sidebar-header {
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(24, 183, 200, 0.3), transparent);
}

/* Sidebar Toggle Button */
.sidebar-toggle-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background: var(--bg-hover);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    flex-shrink: 0;
}

[data-theme="dark"] .sidebar-toggle-btn {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
}

.sidebar-toggle-btn:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    transform: scale(1.05);
}

.sidebar-toggle-btn svg {
    width: 20px;
    height: 20px;
    transition: transform var(--transition-base);
}

.sidebar.collapsed .sidebar-toggle-btn svg {
    transform: rotate(180deg);
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
    min-width: 0;
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: transform var(--transition-base);
}

[data-theme="dark"] .sidebar-logo {
    color: var(--text-inverse);
}

.sidebar-logo:hover {
    transform: scale(1.02);
}

.sidebar-logo svg {
    width: 32px;
    height: 32px;
}

.sidebar-tenant-name {
    font-size: 0.6875rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    opacity: 0.7;
    padding-left: 2px;
}

.sidebar-nav {
    padding: 1.25rem 0;
}

.nav-section {
    padding: 0.75rem 1.25rem;
    margin-top: 0.75rem;
}

.nav-section-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    padding-left: 0.75rem;
}

[data-theme="dark"] .nav-section-title {
    color: rgba(255,255,255,0.4);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: all var(--transition-base);
    margin: 0.25rem 0;
    position: relative;
    overflow: hidden;
    font-weight: 500;
    font-size: 0.9375rem;
    min-height: 44px; /* Touch Target */
}

[data-theme="dark"] .nav-link {
    color: rgba(255, 255, 255, 0.7);
}

/* Gradient Border Indikator (links) */
.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--color-primary-gradient);
    transform: scaleY(0);
    transition: transform var(--transition-spring);
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: translateX(2px);
}

[data-theme="dark"] .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 1);
}

.nav-link:hover::before {
    transform: scaleY(1);
}

.nav-link.active {
    background: var(--color-primary-gradient);
    color: white;
    box-shadow: 
        0 4px 12px var(--color-primary-glow),
        0 0 20px rgba(24, 183, 200, 0.2);
    font-weight: 600;
}

.nav-link.active::before {
    transform: scaleY(1);
}

.nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform var(--transition-base);
}

/* Sidebar Badge (z.B. offene Kommunikationen) */
.sidebar-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    font-size: 0.6875rem;
    font-weight: 700;
    border-radius: 9999px;
    background: var(--color-danger, #ef4444);
    color: #fff;
    margin-left: auto;
    line-height: 1;
    flex-shrink: 0;
}

.nav-link.active .sidebar-badge {
    background: #fff;
    color: var(--color-primary, #18b7c8);
}

.sidebar-badge-pulse {
    animation: badge-pulse 2s ease-in-out infinite;
}

.nav-link.active .sidebar-badge-pulse {
    animation: badge-pulse-light 2s ease-in-out infinite;
}

@keyframes badge-pulse-light {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5);
    }
    70% {
        box-shadow: 0 0 0 5px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

/* Sidebar collapsed: Badge als Dot am Icon */
.sidebar.collapsed .sidebar-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 0.625rem;
    height: 0.625rem;
    padding: 0;
    font-size: 0;
}

.nav-link:hover svg,
.nav-link.active svg {
    transform: scale(1.1);
}

/* ========================================
   MAIN CONTENT - Modern Layout
   ======================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    min-width: 0;
    position: relative;
    display: flex;
    flex-direction: column;
}

.main-header {
    height: var(--header-height);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-backdrop-sm);
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

[data-theme="dark"] .main-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.main-header:hover {
    box-shadow: var(--shadow-md);
}

.main-body {
    padding: 2rem;
    max-width: 1800px;
    margin: 0 auto;
    min-width: 0;
    width: 100%;
    flex: 1;
}

.main-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    font-size: 0.6875rem;
    color: var(--text-muted);
    opacity: 0.4;
    border-top: 1px solid var(--border-color);
}

/* ========================================
   COMPONENTS - Premium Edition
   ======================================== */

/* Cards - Glassmorphism & Depth */
.card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-backdrop-sm);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: all var(--transition-base);
    position: relative;
    overflow: visible; /* Erlaubt Dropdowns außerhalb der Card */
}

.card:hover {
    box-shadow: var(--shadow); /* NICHT vergrößern */
    transform: none; /* KEIN translateY */
    border-color: var(--border-color-hover);
}

.card-header {
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.75rem;
    overflow: clip;
}

/* Card-Body mit padding:0 (fuer Tabellen) - horizontales Scrollen erlauben */
.card-body[style*="padding:0"],
.card-body.card-body-no-padding {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.card-body[style*="padding:0"]::-webkit-scrollbar,
.card-body.card-body-no-padding::-webkit-scrollbar {
    height: 4px;
}

.card-body[style*="padding:0"]::-webkit-scrollbar-track,
.card-body.card-body-no-padding::-webkit-scrollbar-track {
    background: transparent;
}

.card-body[style*="padding:0"]::-webkit-scrollbar-thumb,
.card-body.card-body-no-padding::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
}

.card-body[style*="padding:0"]:hover::-webkit-scrollbar-thumb,
.card-body.card-body-no-padding:hover::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

.card-body[style*="padding:0"]:hover,
.card-body.card-body-no-padding:hover {
    scrollbar-width: thin;
}

/* Detail Rows - Für Detailansichten wie Kunden, Prospects */
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
    transition: all var(--transition-fast);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row:hover {
    background: var(--bg-hover);
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    border-radius: var(--border-radius);
}

.detail-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    min-width: 140px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-icon {
    width: 18px;
    height: 18px;
    color: var(--color-primary);
    opacity: 0.7;
    transition: all var(--transition-base);
    flex-shrink: 0;
}

.detail-row:hover .detail-icon {
    opacity: 1;
    transform: scale(1.1);
}

.detail-row > span:not(.detail-label),
.detail-row > a,
.detail-row > strong {
    text-align: right;
    flex: 1;
    white-space: nowrap;
}

/* Links in Detail Rows */
.detail-row a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.detail-row a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

/* Action Links mit Icon */
.detail-action-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-base);
    padding: 0.375rem 0.75rem;
    margin: -0.375rem -0.75rem;
    border-radius: var(--border-radius);
    justify-content: flex-end;
}

.detail-action-link:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
    text-decoration: none;
}

.detail-action-icon {
    width: 16px;
    height: 16px;
    color: var(--color-primary);
    opacity: 0;
    transform: translateX(4px);
    transition: all var(--transition-base);
    flex-shrink: 0;
    order: -1;
}

.detail-action-link:hover .detail-action-icon {
    opacity: 1;
    transform: translateX(0);
}

/* In Tabellen: Linksbündig statt rechtsbündig */
.table .detail-action-link {
    justify-content: flex-start;
    margin: -0.375rem 0;
    padding: 0.375rem 0.5rem;
}

/* In Ansprechpartner-Karten: Linksbündig und kompakt */
.contact-detail .detail-action-link {
    justify-content: flex-start;
    margin: 0;
    padding: 0.25rem 0.5rem;
}

/* Dark Mode für Detail Rows */
[data-theme="dark"] .detail-action-link:hover {
    background: rgba(24, 183, 200, 0.2);
}

[data-theme="dark"] .detail-row:hover {
    background: rgba(51, 65, 85, 0.4);
}

/* ========================================
   CONTACT CARDS - Ansprechpartner Grid
   ======================================== */

.contacts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
    padding: 1.5rem;
}

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

.contact-card {
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    transition: all var(--transition-base);
    overflow: hidden;
}

.contact-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.contact-card-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    min-height: 140px;
}

.contact-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.contact-avatar svg {
    width: 28px;
    height: 28px;
    color: white;
}

.contact-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.contact-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
    min-height: 1.25rem;
}

.contact-badge-container {
    min-height: 1.5rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: flex-start;
}

.contact-position,
.contact-department {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact-separator {
    color: var(--text-muted);
}

.contact-actions {
    display: flex;
    gap: 0.375rem;
    flex-shrink: 0;
}

.contact-card-body {
    padding: 1rem 1.25rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.contact-detail {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.9375rem;
}

.contact-detail-icon {
    width: 18px;
    height: 18px;
    color: var(--color-primary);
    flex-shrink: 0;
    opacity: 0.8;
}

.contact-detail a {
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--transition-fast);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact-detail a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

/* Icon Button Styles */
.btn-icon {
    padding: 0.5rem;
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-sm {
    padding: 0.375rem;
    min-width: 32px;
    min-height: 32px;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn-icon-sm svg {
    width: 16px;
    height: 16px;
}

.btn-icon-primary {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border: 1px solid transparent;
}

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

.btn-icon-success {
    background: var(--color-success-light);
    color: var(--color-success);
    border: 1px solid transparent;
}

.btn-icon-success:hover {
    background: var(--color-success);
    color: white;
}

.btn-icon-danger {
    background: var(--color-danger-light);
    color: var(--color-danger);
    border: 1px solid transparent;
}

.btn-icon-danger:hover {
    background: var(--color-danger);
    color: white;
}

/* Dark Mode für Contact Cards */
[data-theme="dark"] .contact-card {
    background: rgba(30, 41, 59, 0.6);
}

[data-theme="dark"] .contact-card:hover {
    background: rgba(30, 41, 59, 0.8);
}

[data-theme="dark"] .contact-card-header {
    background: rgba(30, 41, 59, 0.9);
}

/* Buttons - Modern & Interactive */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn svg {
    width: 18px;
    height: 18px;
    transition: transform var(--transition-base);
}

.btn:hover svg {
    transform: scale(1.1);
}

.btn-primary {
    background: var(--color-primary-gradient);
    color: #ffffff !important;
    box-shadow: 0 4px 12px var(--color-primary-glow);
}

.btn-primary:hover {
    background: var(--color-primary-gradient-hover);
    box-shadow: 0 4px 12px var(--color-primary-glow); /* NICHT vergrößern */
    transform: none; /* KEIN translateY */
    filter: brightness(1.05);
}

.btn-primary:active {
    transform: scale(0.98);
}

/* Icon-Only Buttons (für Tabellen) - Kein Gradient */
.btn-icon {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    box-shadow: none;
    padding: 0.5rem;
    border-radius: var(--border-radius); /* Runde Ecken wie alle anderen Buttons */
}

.btn-icon:hover {
    background: var(--bg-hover);
    border-color: currentColor;
    transform: none; /* KEIN scale - kann auch Scrollbars verursachen */
    box-shadow: none;
    filter: brightness(1.05);
}

.btn-icon svg {
    width: 16px;
    height: 16px;
}

.btn-icon.btn-icon-success {
    color: var(--color-success);
}

.btn-icon.btn-icon-success:hover {
    background: var(--color-success-light);
    border-color: var(--color-success);
}

.btn-icon.btn-icon-danger {
    color: var(--color-danger);
}

.btn-icon.btn-icon-danger:hover {
    background: var(--color-danger-light);
    border-color: var(--color-danger);
}

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

.btn-icon.btn-icon-primary:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-color-hover);
    box-shadow: var(--shadow-sm); /* Bleibt gleich */
    transform: none; /* KEIN translateY */
}

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

.btn-outline:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-color-hover);
    transform: none;
}

.btn-success {
    background: var(--color-success-gradient);
    color: var(--text-inverse);
    box-shadow: 0 4px 12px var(--color-success-glow);
}

.btn-success:hover {
    background: var(--color-success-gradient-hover);
    box-shadow: 0 4px 12px var(--color-success-glow);
    transform: none;
    filter: brightness(1.05);
}

.btn-danger {
    background: var(--color-danger);
    color: white;
    box-shadow: 0 4px 12px var(--color-danger-glow);
}

.btn-danger:hover {
    box-shadow: 0 4px 12px var(--color-danger-glow); /* Bleibt gleich */
    transform: none;
    filter: brightness(1.1);
}

.btn-outline-danger {
    background: transparent;
    color: var(--color-danger);
    border: 1px solid var(--color-danger);
    box-shadow: none;
}

.btn-outline-danger:hover {
    background: var(--color-danger);
    color: var(--text-inverse);
    box-shadow: 0 4px 12px var(--color-danger-glow);
}

.btn-warning {
    background: var(--color-warning);
    color: var(--text-inverse);
    box-shadow: 0 4px 12px var(--color-warning-glow);
}

.btn-warning:hover {
    box-shadow: 0 4px 12px var(--color-warning-glow); /* Bleibt gleich */
    transform: none;
    filter: brightness(1.1);
}

.btn-sm {
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
}

.btn-lg {
    padding: 1rem 1.75rem;
    font-size: 1.0625rem;
    font-weight: 600;
}

/* Tabellen-Aktionszelle mit Buttons */
.action-cell {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.btn-disabled,
.btn:disabled,
button.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(40%);
    box-shadow: none !important;
}

.btn:disabled:hover,
button.btn:disabled:hover {
    transform: none !important;
    filter: grayscale(40%) !important;
}

/* Forms - Modern & Polished */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
    transition: color var(--transition-fast);
}

/* Label wird hervorgehoben, wenn das zugehörige Feld fokussiert ist */
.form-group:focus-within .form-label {
    color: var(--color-primary);
}

.form-control,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 2px solid var(--border-input);
    border-radius: var(--border-radius);
    transition: all var(--transition-base);
    font-family: inherit;
}

.form-control:hover {
    border-color: var(--border-color-hover);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px var(--color-primary-light), var(--shadow-sm);
    transform: none; /* KEIN translateY */
}

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

/* ========================================
   SELECT DROPDOWN - Wird durch Custom Dropdown ersetzt
   Native Select-Elemente werden versteckt und durch JS ersetzt
   ======================================== */

/* Native Select-Elemente werden von dropdown.js automatisch versteckt */
select {
    /* Basis-Styles falls JS nicht lädt (Fallback) */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    accent-color: var(--color-primary);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

/* Input Groups */
.form-control-icon {
    position: relative;
}

.form-control-icon input {
    padding-left: 2.75rem;
}

.form-control-icon svg {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
}


/* Tables - Modern & Responsive */
.table-container {
    overflow: visible; /* Erlaubt Dropdowns außerhalb des Containers */
    border-radius: var(--border-radius-lg);
}

/* Runde Ecken fuer Tabellen in Cards - horizontales Scrollen erlauben */
.card .table-container {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none; /* Firefox: Scrollbar versteckt */
}

.card .table-container::-webkit-scrollbar {
    height: 4px; /* Chromium: Schmale Scrollbar */
}

.card .table-container::-webkit-scrollbar-track {
    background: transparent;
}

.card .table-container::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
}

.card .table-container:hover::-webkit-scrollbar-thumb {
    background: var(--border-color);
}

.card .table-container:hover {
    scrollbar-width: thin; /* Firefox: Nur bei Hover sichtbar */
}

.card .table-container .table,
.card .table-responsive .table {
    border-radius: 0;
}

.card .table-container .table thead tr:first-child th:first-child,
.card .table-responsive .table thead tr:first-child th:first-child {
    border-top-left-radius: var(--border-radius-lg);
}

.card .table-container .table thead tr:first-child th:last-child,
.card .table-responsive .table thead tr:first-child th:last-child {
    border-top-right-radius: var(--border-radius-lg);
}

.card .table-container .table tbody tr:last-child td:first-child,
.card .table-responsive .table tbody tr:last-child td:first-child {
    border-bottom-left-radius: var(--border-radius-lg);
}

.card .table-container .table tbody tr:last-child td:last-child,
.card .table-responsive .table tbody tr:last-child td:last-child {
    border-bottom-right-radius: var(--border-radius-lg);
}

/* Overflow hidden für table-responsive in Cards */
.card .table-responsive {
    overflow: hidden;
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

/* Letzte Tabellenzeile: Kein Border-Bottom */
.card .table-container .table tbody tr:last-child td,
.card .table-responsive .table tbody tr:last-child td {
    border-bottom: none;
}

/* Sortable Table Headers */
.table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 2rem;
}

.table th.sortable:hover {
    background: var(--bg-hover);
}

.table th.sortable .sort-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
}

/* ========================================
   RESPONSIVE TABLE TO CARDS PATTERN
   Enhanced for iPad and iPhone
   ======================================== */

/* Tablet: Kompaktere Tabellen, aber noch als Tabelle */
@media (min-width: 769px) and (max-width: 1024px) {
    .table th,
    .table td {
        padding: 0.75rem 0.625rem;
        font-size: 0.8125rem;
    }
    
    /* Verstecke weniger wichtige Spalten auf Tablet */
    .table .hide-tablet {
        display: none;
    }
    
    /* Horizontal Scroll für sehr breite Tabellen */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -0.5rem;
        padding: 0 0.5rem;
    }
}

/* Mobile: Tabelle zu Cards transformieren */
@media (max-width: 768px) {
    /* Tabelle zu Cards - gilt für alle .table-responsive und .table-container */
    .table-responsive .table,
    .table-container .table {
        display: block;
    }
    
    .table-responsive .table thead,
    .table-container .table thead {
        display: none;
    }
    
    .table-responsive .table tbody,
    .table-container .table tbody {
        display: flex;
        flex-direction: column;
        gap: 0.875rem;
        padding: 0.875rem;
    }
    
    .table-responsive .table tbody tr,
    .table-container .table tbody tr {
        display: flex;
        flex-direction: column;
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius);
        padding: 1rem;
        gap: 0;
        box-shadow: var(--shadow-sm);
        transition: all var(--transition-base);
    }
    
    .table-responsive .table tbody tr:hover,
    .table-container .table tbody tr:hover {
        background: var(--bg-hover);
        box-shadow: var(--shadow);
        transform: none;
    }
    
    .table-responsive .table td,
    .table-container .table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.625rem 0;
        border-bottom: 1px solid var(--border-color);
        gap: 1rem;
        min-height: 44px; /* Touch-Target */
    }
    
    .table-responsive .table td:last-child,
    .table-container .table td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .table-responsive .table td:first-child,
    .table-container .table td:first-child {
        padding-top: 0;
        font-weight: 600;
        font-size: 1rem;
        color: var(--text-primary);
    }
    
    /* Labels als pseudo-element */
    .table-responsive .table td::before,
    .table-container .table td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.6875rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-muted);
        flex-shrink: 0;
        min-width: 90px;
        max-width: 110px;
    }
    
    /* Werte rechtsbündig */
    .table-responsive .table td > *,
    .table-container .table td > * {
        text-align: right;
    }
    
    .table-responsive .table td.text-right,
    .table-container .table td.text-right {
        text-align: right !important;
    }
    
    /* Links in Cards */
    .table-responsive .table td a,
    .table-container .table td a {
        color: var(--color-primary);
        font-weight: 600;
    }
    
    /* Badges in Cards */
    .table-responsive .table td .badge,
    .table-container .table td .badge {
        margin-left: auto;
    }
    
    /* Aktionen in Card-Modus */
    .table-responsive .table td[data-label=""],
    .table-container .table td[data-label=""],
    .table-responsive .table td[data-label="Aktionen"],
    .table-container .table td[data-label="Aktionen"] {
        justify-content: flex-end;
        padding-top: 0.75rem;
        margin-top: 0.25rem;
        border-top: 1px solid var(--border-color);
        border-bottom: none;
    }
    
    .table-responsive .table td[data-label=""]::before,
    .table-container .table td[data-label=""]::before,
    .table-responsive .table td[data-label="Aktionen"]::before,
    .table-container .table td[data-label="Aktionen"]::before {
        display: none;
    }
    
    /* Action Buttons nebeneinander */
    .table-responsive .table td .flex,
    .table-container .table td .flex,
    .table-responsive .table td .action-buttons,
    .table-container .table td .action-buttons {
        width: 100%;
        justify-content: flex-end;
    }
    
    /* Empty State */
    .table-responsive .table tbody tr:only-child td[colspan],
    .table-container .table tbody tr:only-child td[colspan] {
        text-align: center;
        justify-content: center;
        padding: 2rem 1rem;
        border: none;
    }
    
    .table-responsive .table tbody tr:only-child td[colspan]::before,
    .table-container .table tbody tr:only-child td[colspan]::before {
        display: none;
    }
    
    /* Beträge hervorheben */
    .table-responsive .table td[data-label*="Betrag"],
    .table-responsive .table td[data-label*="Netto"],
    .table-responsive .table td[data-label*="Brutto"],
    .table-container .table td[data-label*="Betrag"],
    .table-container .table td[data-label*="Netto"],
    .table-container .table td[data-label*="Brutto"] {
        font-weight: 600;
        font-variant-numeric: tabular-nums;
    }
    
    /* Status Badge als erstes Element visuell */
    .table-responsive .table td .badge,
    .table-container .table td .badge {
        order: 1;
    }
}

/* Invoice Items Tabelle - Spezielle Mobile-Behandlung */
@media (max-width: 768px) {
    /* Invoice Items: Horizontal Scroll statt Card-Pattern */
    .table-invoice-items {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Container braucht min-width */
    .card:has(.table-invoice-items) .card-body {
        padding: 0;
        overflow-x: auto;
    }
    
    .table-invoice-items {
        min-width: 800px;
    }
    
    .table-invoice-items th,
    .table-invoice-items td {
        padding: 0.625rem 0.5rem;
        font-size: 0.8125rem;
    }
    
    .table-invoice-items .form-control {
        padding: 0.5rem;
        font-size: 0.875rem !important;
        min-height: 40px;
    }
    
    /* Scroll-Hinweis */
    .card:has(.table-invoice-items)::after {
        content: '';
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 40px;
        height: 100%;
        background: linear-gradient(to left, var(--bg-card), transparent);
        pointer-events: none;
        opacity: 0.8;
    }
}

/* Sehr kleine Screens: Noch kompakter */
@media (max-width: 375px) {
    .table-responsive .table tbody,
    .table-container .table tbody {
        padding: 0.625rem;
        gap: 0.75rem;
    }
    
    .table-responsive .table tbody tr,
    .table-container .table tbody tr {
        padding: 0.875rem;
    }
    
    .table-responsive .table td::before,
    .table-container .table td::before {
        min-width: 75px;
        max-width: 90px;
        font-size: 0.625rem;
    }
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

/* Buttons in Cards und Tabellen: KEIN Transform, KEIN größerer Shadow - verhindert Scrollbars */
.card .btn,
.card .btn-primary,
.card .btn-secondary,
.card .btn-warning,
.card .btn-danger,
.card .btn-success,
.table .btn,
.table .btn-primary,
.table .btn-secondary,
.card-header .btn {
    box-shadow: 0 2px 4px rgba(24, 183, 200, 0.2) !important; /* Kleinerer fester Shadow */
}

.card .btn:hover,
.card .btn-primary:hover,
.card .btn-secondary:hover,
.card .btn-warning:hover,
.card .btn-danger:hover,
.card .btn-success:hover,
.table .btn:hover,
.table .btn-primary:hover,
.table .btn-secondary:hover,
.card-header .btn:hover {
    transform: none !important;
    box-shadow: 0 2px 4px rgba(24, 183, 200, 0.2) !important; /* GLEICHER Shadow wie default */
    filter: brightness(1.08) !important; /* Nur Aufhellen */
}

/* Active State: Nur Scale */
.card .btn:active,
.card .btn-primary:active,
.card .btn-secondary:active,
.table .btn:active,
.table .btn-primary:active,
.table .btn-secondary:active,
.card-header .btn:active {
    transform: scale(0.96) !important;
    filter: brightness(0.95) !important;
}

.table th,
.table td {
    padding: 1rem 1.25rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Badges in Tabellenzellen: Keine min-width, damit Spalten nicht ueberlaufen */
.table td .badge {
    min-width: unset;
}

.table th {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    background: var(--bg-table-header);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

/* Rechtsbündige Ausrichtung für Tabellenzellen mit .text-right Klasse */
.table th.text-right,
.table td.text-right {
    text-align: right !important;
}

.table tbody tr {
    transition: all var(--transition-base);
}

.table tbody tr:hover {
    background: var(--bg-hover-glass);
    transform: none; /* KEIN scale - verhindert Dehnung */
    box-shadow: none; /* KEIN shadow */
}

.table tbody tr:hover td {
    border-color: var(--border-color); /* Keine Änderung */
}

.table-striped tbody tr:nth-child(even) {
    background: var(--bg-table-stripe);
}

.table a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    transition: all var(--transition-fast);
    position: relative;
}

/* Gradienten-Unterstreichung NUR für normale Links, NICHT für detail-action-link */
.table a:not(.detail-action-link)::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-primary-gradient);
    transition: width var(--transition-base);
}

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

.table a:not(.detail-action-link):hover::after {
    width: 100%;
}

/* Badges - Pill Style with Glow */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.875rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--border-radius-pill);
    border: 1px solid transparent;
    letter-spacing: 0.02em;
    transition: all var(--transition-base);
    min-width: 100px;
    text-align: center;
}

.badge-primary {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-color: rgba(24, 183, 200, 0.3);
}

.badge-primary:hover {
    box-shadow: 0 0 12px var(--color-primary-glow);
    transform: scale(1.05);
}

.badge-success {
    background: var(--color-success-light);
    color: var(--color-success);
    border-color: rgba(16, 185, 129, 0.3);
}

.badge-success:hover {
    box-shadow: 0 0 12px var(--color-success-glow);
    transform: scale(1.05);
}

.badge-warning {
    background: var(--color-warning-light);
    color: var(--color-warning);
    border-color: rgba(245, 158, 11, 0.3);
}

.badge-warning:hover {
    box-shadow: 0 0 12px var(--color-warning-glow);
    transform: scale(1.05);
}

.badge-danger,
.badge-error {
    background: var(--color-danger-light);
    color: var(--color-danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.badge-danger:hover,
.badge-error:hover {
    box-shadow: 0 0 12px var(--color-danger-glow);
    transform: scale(1.05);
}

.badge-info {
    background: var(--color-info-light);
    color: var(--color-info);
    border-color: rgba(59, 130, 246, 0.3);
}

.badge-info:hover {
    box-shadow: 0 0 12px var(--color-info-glow);
    transform: scale(1.05);
}

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

.badge-secondary:hover {
    box-shadow: 0 0 8px rgba(128, 128, 128, 0.3);
    transform: scale(1.05);
}

/* Badge Truncate - fuer lange Texte in Badges (z.B. Mandantennamen) */
.badge-truncate {
    display: inline-block;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

/* Alerts - Premium with Icons */
.alert {
    padding: 1.25rem 1.5rem;
    border-radius: var(--border-radius-lg);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    border-left: 4px solid;
    backdrop-filter: blur(8px);
    transition: all var(--transition-base);
    animation: slideInDown var(--transition-base) ease-out;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.alert svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.alert-success {
    background: var(--color-success-light);
    color: var(--color-success);
    border-left-color: var(--color-success);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

.alert-danger {
    background: var(--color-danger-light);
    color: var(--color-danger);
    border-left-color: var(--color-danger);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
}

.alert-warning {
    background: var(--color-warning-light);
    color: var(--color-warning);
    border-left-color: var(--color-warning);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.15);
}

.alert-info {
    background: var(--color-info-light);
    color: var(--color-info);
    border-left-color: var(--color-info);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}

.alert-error {
    background: var(--color-danger-light);
    color: var(--color-danger);
    border-left-color: var(--color-danger);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
}

/* Stats Grid - Layout Only (Styles in components.css) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Stats Grid 4-2-1: Explizit 4 Spalten Desktop, 2 Tablet, 1 Mobil */
.stats-grid.stats-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
    .stats-grid.stats-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .stats-grid.stats-grid-4 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .stats-grid .stat-card,
    .stats-grid .stat-card-content {
        padding: 0.875rem;
    }
    
    .stats-grid .stat-value {
        font-size: 1.25rem;
    }
    
    .stats-grid .stat-label {
        font-size: 0.625rem;
        letter-spacing: 0.03em;
        word-break: break-word;
        hyphens: auto;
        line-height: 1.3;
    }
    
    .stat-card {
        min-height: auto;
        padding: 0.875rem;
    }
    
    .stat-card-content {
        padding: 0;
    }
    
    /* Page Header - flex-wrap für Buttons */
    .page-header {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .page-header .page-actions,
    .page-header .page-header-right {
        flex-wrap: wrap;
    }
    
    .page-header .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* Page Header - Premium Layout */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.page-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 80px;
    height: 2px;
    background: var(--color-primary-gradient);
    z-index: 1;
}

.page-header-left,
.page-header-content {
    flex: 1;
}

.page-header-right,
.page-header-actions,
.page-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.page-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    background: var(--text-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.page-subtitle {
    margin-top: 0.5rem;
    font-size: 0.9375rem;
    color: var(--text-muted);
}

.page-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Search - Enhanced with Clear Button */
.search-box {
    position: relative;
    width: 100%;
    flex: 1;
}

.search-box input {
    width: 100%;
    padding-left: 3rem;
    padding-right: 3rem;
    background: var(--bg-input);
    backdrop-filter: blur(8px);
}

.search-box > svg:first-child {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    transition: color var(--transition-fast);
    pointer-events: none;
}

.search-box input:focus ~ svg:first-child,
.search-box:hover > svg:first-child {
    color: var(--color-primary);
}

.search-box .search-clear-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
    z-index: 10;
}

.search-box .search-clear-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.search-box .search-clear-btn svg {
    width: 16px;
    height: 16px;
}

/* Theme Toggle - Modern Switch */
.theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--color-primary-gradient);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--color-primary);
    border-color: var(--border-glow);
    transform: rotate(180deg) scale(1.05);
}

.theme-toggle:hover::before {
    opacity: 0.1;
}

.theme-toggle svg {
    width: 22px;
    height: 22px;
    position: relative;
    z-index: 1;
}

/* User Menu - Enhanced with Dropdown */
.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* User Dropdown Container */
.user-dropdown {
    position: relative;
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9375rem;
    box-shadow: 0 4px 12px var(--color-primary-glow);
    border: 2px solid transparent;
    transition: all var(--transition-base);
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.user-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 50%;
    z-index: 2;
}

.user-avatar span {
    position: relative;
    z-index: 1;
}

/* Wenn Bild vorhanden, kein Gradient-Background */
.user-avatar:has(.user-avatar-image) {
    background: none;
    border: 2px solid var(--border-color);
}

.user-avatar:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 20px var(--color-primary-glow);
    border-color: var(--color-primary);
}

.user-dropdown.open .user-avatar {
    box-shadow: 0 8px 24px var(--color-primary-glow);
    transform: scale(1.05);
}

/* Dropdown Menu */
.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: 0;
    width: 280px;
    background: var(--bg-card);
    backdrop-filter: var(--glass-backdrop);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-base);
    z-index: 1000;
}

[data-theme="dark"] .user-dropdown-menu {
    background: rgba(30, 41, 59, 0.98);
    border-color: rgba(255, 255, 255, 0.1);
}

.user-dropdown.open .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown Arrow */
.user-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 18px;
    width: 12px;
    height: 12px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
    transform: rotate(45deg);
}

[data-theme="dark"] .user-dropdown-menu::before {
    background: rgba(30, 41, 59, 0.98);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Dropdown Header */
.user-dropdown-header {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-hover);
}

[data-theme="dark"] .user-dropdown-header {
    background: rgba(255, 255, 255, 0.03);
}

.user-dropdown-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--color-primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
    position: relative;
}

.user-dropdown-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
}

.user-dropdown-info {
    flex: 1;
    min-width: 0;
}

.user-dropdown-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown-email {
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Dropdown Divider */
.user-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

/* Dropdown Items */
.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--transition-fast);
    font-size: 0.9375rem;
    font-weight: 500;
}

.user-dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--color-primary);
}

[data-theme="dark"] .user-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-dropdown-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.user-dropdown-item-danger {
    color: var(--color-danger);
}

.user-dropdown-item-danger:hover {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

/* Logout Form im Dropdown */
.user-dropdown-logout-form {
    margin: 0;
    padding: 0;
}

.user-dropdown-logout-form button.user-dropdown-item {
    width: 100%;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
}

/* ========================================
   RESPONSIVE - Mobile & Tablet Optimized
   2026 Edition with iOS/iPadOS Support
   ======================================== */

/* 
   BREAKPOINT REFERENCE:
   - 320px:  iPhone SE, small phones
   - 375px:  iPhone Standard (6/7/8/X/11/12/13/14)
   - 414px:  iPhone Plus/Max models
   - 640px:  Small tablets, large phones landscape
   - 768px:  iPad Mini, iPad Portrait
   - 1024px: iPad, iPad Air Portrait/Landscape
   - 1180px: iPad Air Landscape
   - 1366px: iPad Pro 12.9"
*/

/* ========================================
   iOS SAFE AREA INSETS
   Support for iPhone X+ notch and home indicator
   ======================================== */
@supports (padding: max(0px)) {
    .sidebar {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
    
    .main-content {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .main-header {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    .modal-overlay {
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    }
}

/* ========================================
   TOUCH OPTIMIZATION
   Minimum 44px touch targets (Apple HIG)
   ======================================== */
@media (pointer: coarse) {
    /* Alle interaktiven Elemente mindestens 44px */
    .btn,
    .btn-sm,
    .btn-icon,
    .nav-link,
    .theme-toggle,
    .user-avatar,
    .sidebar-toggle-btn,
    select,
    input[type="checkbox"],
    input[type="radio"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Links in Tabellen brauchen mehr Padding */
    .table a {
        padding: 0.5rem 0.25rem;
        margin: -0.5rem -0.25rem;
        display: inline-block;
    }
    
    /* Badges klickbar machen */
    .badge {
        min-height: 32px;
        display: inline-flex;
        align-items: center;
    }
    
    /* Form Controls größer */
    .form-control,
    select.form-control {
        min-height: 48px;
        font-size: 16px !important; /* Verhindert iOS Zoom */
    }
    
    /* Custom Dropdown größer */
    .custom-dropdown-selected {
        min-height: 48px;
    }
    
    .custom-dropdown-option {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Checkbox/Radio größer */
    input[type="checkbox"],
    input[type="radio"] {
        width: 22px;
        height: 22px;
    }
    
    /* Action Buttons in Tabellen */
    .btn-icon {
        padding: 0.625rem;
    }
    
    /* Nav Links größer */
    .nav-link {
        padding: 1rem 1rem;
    }
    
    /* User Dropdown Items */
    .user-dropdown-item {
        min-height: 48px;
        padding: 1rem 1.25rem;
    }
}

/* iOS Scroll Optimization */
@supports (-webkit-overflow-scrolling: touch) {
    .sidebar,
    .table-container,
    .table-responsive,
    .modal-body,
    .custom-dropdown-options {
        -webkit-overflow-scrolling: touch;
    }
}

/* Prevent iOS zoom on input focus */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    input[type="search"],
    input[type="date"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* Prevent overscroll bounce */
html {
    overscroll-behavior: none;
}

.main-content {
    overscroll-behavior-y: contain;
}

/* Mobile Menu Button */
#mobile-menu-toggle {
    display: none;
}

/* ========================================
   iPAD PRO / LARGE TABLETS (1366px+)
   ======================================== */
@media (min-width: 1366px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
    
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .grid-4 {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
}

/* ========================================
   iPAD / TABLET LANDSCAPE (1024px - 1365px)
   ======================================== */
@media (min-width: 1024px) and (max-width: 1365px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 1.25rem;
    }
    
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-2-1 {
        grid-template-columns: 1.5fr 1fr;
    }
    
    /* Dashboard Period Form auf Tablet wrappen */
    .dashboard-period-form {
        flex-wrap: wrap;
    }
    
    .dashboard-period-form select,
    .dashboard-period-form .custom-dropdown {
        min-width: 200px;
    }
}

/* ========================================
   iPAD PORTRAIT / TABLET (768px - 1023px)
   ======================================== */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 280px;
        --header-height: 64px;
    }
    
    /* Sidebar als Overlay */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-xl);
        z-index: 1000;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    /* Main Content volle Breite */
    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
    }
    
    /* Sidebar Overlay */
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: var(--bg-overlay);
        backdrop-filter: blur(4px);
        z-index: 999;
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--transition-base);
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: all;
    }
    
    #mobile-menu-toggle {
        display: inline-flex;
    }
    
    /* Collapsed State auf Tablet/Mobile überschreiben (höhere Spezifität nötig!) */
    body:has(.sidebar.collapsed) .main-content,
    .sidebar-collapsed .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .sidebar.collapsed,
    .sidebar-collapsed .sidebar {
        transform: translateX(-100%);
        width: 85vw;
        max-width: 320px;
    }
    
    .sidebar.collapsed.open,
    .sidebar-collapsed .sidebar.open {
        transform: translateX(0);
    }
    
    /* Wenn Sidebar im Collapsed-State auf Mobile geöffnet wird: vollen Inhalt zeigen */
    .sidebar.collapsed.open .sidebar-brand {
        display: flex;
    }
    
    .sidebar.collapsed.open .nav-section-title {
        display: block !important;
    }
    
    .sidebar.collapsed.open .nav-link {
        justify-content: flex-start;
        padding: 1rem 1rem;
        margin: 0.125rem 0.5rem;
    }
    
    .sidebar.collapsed.open .nav-link span {
        display: inline !important;
    }
    
    .sidebar.collapsed.open .sidebar-header {
        justify-content: space-between;
    }
    
    .sidebar.collapsed.open .sidebar-toggle-btn {
        margin: 0;
    }
    
    /* Page Header */
    .page-header {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .page-actions {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    /* Grid Layouts */
    .grid-2 {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
    
    .grid-2-1,
    .grid-3-1 {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    /* Main Body */
    .main-body {
        padding: 1.25rem;
    }
    
    .page-title {
        font-size: 1.75rem;
    }
    
    /* Tabellen */
    .table th,
    .table td {
        padding: 0.75rem 0.875rem;
        font-size: 0.875rem;
    }
    
    /* Cards */
    .card-header {
        padding: 1rem 1.25rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .card-header .btn {
        flex-shrink: 0;
    }
    
    .card-body {
        padding: 1.25rem;
    }
}

/* ========================================
   iPAD PORTRAIT SPECIFIC (768px - 1023px)
   ======================================== */
@media (min-width: 768px) and (max-width: 1023px) {
    /* Zwei Spalten für Stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Risk Classification Grid */
    .risk-classification-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .risk-classification-grid > :last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }
    
    /* Page Actions nebeneinander */
    .page-actions {
        justify-content: flex-end;
    }
    
    .page-actions .btn {
        flex: 0 1 auto;
    }
    
    /* Formular Grids */
    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Contact Grid */
    .contacts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Quick Actions */
    .quick-actions-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   SMALL TABLETS / LARGE PHONES (640px - 767px)
   ======================================== */
@media (min-width: 640px) and (max-width: 767px) {
    .main-body {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.875rem;
    }
    
    .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .risk-classification-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .page-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .page-actions .btn {
        flex: 1 1 calc(50% - 0.375rem);
        min-width: 140px;
    }
}

/* ========================================
   MOBILE PORTRAIT - iPHONE (max-width: 640px)
   ======================================== */
@media (max-width: 640px) {
    :root {
        --header-height: 60px;
        --border-radius: 10px;
        --border-radius-lg: 14px;
    }
    
    /* Body */
    body {
        font-size: 15px;
    }
    
    /* Main Layout */
    .main-body {
        padding: 1rem;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    }
    
    .main-header {
        padding: 0 1rem;
        gap: 0.5rem;
    }
    
    /* Page Header - Vollständig vertikal */
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding-bottom: 1rem;
        margin-bottom: 1.25rem;
    }
    
    .page-header-left,
    .page-header-content {
        width: 100%;
    }
    
    .page-title {
        font-size: 1.375rem;
        line-height: 1.2;
    }
    
    .page-subtitle {
        font-size: 0.875rem;
    }
    
    /* Page Actions - Volle Breite Buttons */
    .page-actions,
    .page-header-actions,
    .page-header-right {
        width: 100%;
        flex-direction: column;
        gap: 0.625rem;
    }
    
    .page-actions .btn,
    .page-header-actions .btn {
        width: 100%;
        justify-content: center;
        min-height: 48px;
    }
    
    /* Bei mehreren Buttons: 2 pro Zeile wenn möglich */
    .page-actions {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 0.625rem;
    }
    
    /* Primary Button immer volle Breite */
    .page-actions .btn-primary {
        grid-column: 1 / -1;
    }
    
    /* Stats Grid - Eine Spalte */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.875rem;
    }
    
    /* Stat Cards kompakter */
    .stat-card {
        padding: 1.25rem 1.5rem;
        min-height: 140px;
    }
    
    .stat-label {
        font-size: 0.6875rem;
    }
    
    .stat-value {
        font-size: 1.75rem;
    }
    
    .stat-info,
    .stat-change {
        font-size: 0.8125rem;
    }
    
    /* Grid Layouts - Alles eine Spalte */
    .grid-2,
    .grid-3,
    .grid-4,
    .grid-2-1,
    .grid-3-1 {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    
    /* Risk Classification */
    .risk-classification-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .risk-class-card {
        padding: 1.25rem;
    }
    
    .risk-class-amount {
        font-size: 1.5rem;
    }
    
    /* Cards */
    .card {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
        border-radius: var(--border-radius);
        border-left: none;
        border-right: none;
    }
    
    .card-header {
        padding: 1rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .card-header .card-title {
        font-size: 1rem;
    }
    
    .card-header .btn {
        width: 100%;
        justify-content: center;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Detail Rows - Vertikal */
    .detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        padding: 0.75rem 0;
    }
    
    .detail-label {
        min-width: unset;
        font-size: 0.75rem;
    }
    
    .detail-row > span:not(.detail-label),
    .detail-row > a,
    .detail-row > strong {
        text-align: left;
        font-size: 0.9375rem;
    }
    
    /* Breadcrumb */
    .breadcrumb {
        font-size: 0.8125rem;
        gap: 0.25rem;
        flex-wrap: wrap;
    }
    
    .breadcrumb > * + *::before {
        margin: 0 0.25rem;
    }
    
    /* Search Box */
    .search-box {
        max-width: 100%;
        width: 100%;
    }
    
    /* Filter Forms */
    .card-body form.flex {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .card-body form.flex .search-box {
        min-width: 100%;
    }
    
    .card-body form.flex select.form-control {
        width: 100% !important;
    }
    
    .card-body form.flex .btn {
        width: 100%;
    }
    
    /* User Menu */
    .user-menu {
        gap: 0.5rem;
    }
    
    .user-avatar {
        width: 40px;
        height: 40px;
    }
    
    .theme-toggle {
        width: 40px;
        height: 40px;
    }
    
    /* Contact Cards */
    .contacts-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }
    
    .contact-card-header {
        min-height: auto;
        padding: 1rem;
    }
    
    /* Quick Actions */
    .quick-actions-grid {
        grid-template-columns: 1fr;
        gap: 0.625rem;
    }
    
    .quick-action-btn {
        padding: 0.875rem 1rem;
    }
    
    /* Action Button Groups */
    .action-button-groups {
        flex-direction: column;
        gap: 1rem;
    }
    
    .action-group-buttons {
        flex-direction: column;
    }
    
    .action-group-buttons .btn {
        width: 100%;
        min-width: unset;
    }
    
    /* Amounts Summary */
    .amounts-summary {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .amount-item {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--border-color);
    }
    
    .amount-item:last-child {
        border-bottom: none;
    }
}

/* ========================================
   iPHONE SE / SMALL PHONES (max-width: 375px)
   ======================================== */
@media (max-width: 375px) {
    .main-body {
        padding: 0.75rem;
    }
    
    .page-title {
        font-size: 1.25rem;
    }
    
    .stat-card {
        padding: 1rem 1.25rem;
        min-height: 130px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
    
    .card-body {
        padding: 0.875rem;
    }
    
    .card-header {
        padding: 0.875rem;
    }
    
    /* User Dropdown anpassen */
    .user-dropdown-menu {
        width: calc(100vw - 2rem);
        right: -0.5rem;
    }
}

/* ========================================
   LANDSCAPE MOBILE
   ======================================== */
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
    :root {
        --header-height: 52px;
    }
    
    .sidebar {
        width: 240px;
    }
    
    .sidebar-header {
        height: 52px;
        padding: 0 1rem;
    }
    
    .sidebar-logo {
        font-size: 1.25rem;
    }
    
    .nav-section {
        padding: 0.375rem 1rem;
    }
    
    .nav-link {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
    }
    
    .main-body {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.75rem;
    }
    
    .stat-card {
        min-height: 100px;
        padding: 0.875rem 1rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .page-header {
        flex-direction: row;
        align-items: center;
    }
    
    .page-actions {
        flex-direction: row;
    }
}

/* ========================================
   iPAD SPLIT VIEW / MULTITASKING
   ======================================== */
@media (min-width: 320px) and (max-width: 640px) and (min-height: 600px) {
    /* iPad Split View (1/3 Bildschirm) */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   LOADING STATES & SKELETON SCREENS
   ======================================== */

/* Loading Spinner */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-hover) 0%,
        var(--bg-card) 50%,
        var(--bg-hover) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--border-radius);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5rem;
}

.skeleton-card {
    height: 200px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* Pulse Animation */
.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Fade In Animation */
.animate-fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide In Animation */
.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   UTILITIES - Enhanced
   ======================================== */
.text-primary { color: var(--color-primary) !important; }
.text-success { color: var(--color-success) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-info { color: var(--color-info) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.text-left { text-align: left !important; }

/* Text Link - Modern Inline Link */
.text-link {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.text-link:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

.text-link:active {
    transform: scale(0.98);
}

/* Numeric Input Fields - Rechts ausgerichtet für Beträge */
input[type="number"].text-right {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Font Weight */
.font-weight-500 {
    font-weight: 500;
}

.font-weight-600 {
    font-weight: 600;
}

/* Spacing */
.m-0 { margin: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.5rem !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mb-3 { margin-bottom: 1.5rem !important; }
.mb-4 { margin-bottom: 2rem !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mt-3 { margin-top: 1.5rem !important; }
.mt-4 { margin-top: 2rem !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: 0.5rem !important; }
.p-2 { padding: 1rem !important; }
.p-3 { padding: 1.5rem !important; }

/* Display */
.flex { display: flex !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-col { flex-direction: column !important; }
.items-center { align-items: center !important; }
.items-start { align-items: flex-start !important; }
.items-end { align-items: flex-end !important; }
.justify-between { justify-content: space-between !important; }
.justify-center { justify-content: center !important; }
.justify-end { justify-content: flex-end !important; }
.gap-1 { gap: 0.5rem !important; }
.gap-2 { gap: 1rem !important; }
.gap-3 { gap: 1.5rem !important; }
.gap-4 { gap: 2rem !important; }

.hidden { display: none !important; }
.block { display: block !important; }
.inline-block { display: inline-block !important; }
.grid { display: grid !important; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr) !important; }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr) !important; }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr) !important; }

/* Width */
.w-full { width: 100% !important; }
.w-auto { width: auto !important; }
.max-w-md { max-width: 28rem !important; }
.max-w-lg { max-width: 32rem !important; }
.max-w-xl { max-width: 36rem !important; }
.max-w-2xl { max-width: 42rem !important; }

/* Font */
.font-bold { font-weight: 700 !important; }
.font-semibold { font-weight: 600 !important; }
.font-medium { font-weight: 500 !important; }
.text-sm { font-size: 0.875rem !important; }
.text-xs { font-size: 0.75rem !important; }
.text-lg { font-size: 1.125rem !important; }
.text-xl { font-size: 1.25rem !important; }

/* Border Radius */
.rounded { border-radius: var(--border-radius) !important; }
.rounded-lg { border-radius: var(--border-radius-lg) !important; }
.rounded-full { border-radius: 9999px !important; }

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

/* ========================================
   ADDITIONAL MOBILE/TABLET ENHANCEMENTS
   Final Touch-ups for iPad and iPhone
   ======================================== */

/* Sidebar auf Mobile - Volle Höhe mit Safe Area */
@media (max-width: 1024px) {
    .sidebar {
        width: 85vw;
        max-width: 320px;
        box-shadow: var(--shadow-xl);
    }
    
    .sidebar.open {
        box-shadow: 
            var(--shadow-xl),
            0 0 60px rgba(0, 0, 0, 0.3);
    }
    
    /* Sidebar Navigation größere Touch-Targets */
    .sidebar-nav {
        padding: 0.75rem 0;
    }
    
    .nav-section {
        padding: 0.5rem 1rem;
    }
    
    .nav-link {
        padding: 1rem 1rem;
        margin: 0.125rem 0.5rem;
        font-size: 0.9375rem;
    }
    
    .nav-link svg {
        width: 22px;
        height: 22px;
    }
}

/* User Dropdown auf Mobile */
@media (max-width: 640px) {
    .user-dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        border-radius: var(--border-radius-xl) var(--border-radius-xl) 0 0;
        transform: translateY(100%);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    
    .user-dropdown.open .user-dropdown-menu {
        transform: translateY(0);
    }
    
    .user-dropdown-menu::before {
        display: none;
    }
    
    /* Drag Handle */
    .user-dropdown-menu::after {
        content: '';
        position: absolute;
        top: 0.5rem;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: var(--border-color);
        border-radius: 2px;
    }
    
    .user-dropdown-header {
        padding-top: 1.75rem;
    }
    
    .user-dropdown-item {
        min-height: 52px;
        padding: 1rem 1.5rem;
    }
}

/* Alerts auf Mobile */
@media (max-width: 640px) {
    .alert {
        padding: 1rem;
        font-size: 0.875rem;
        border-radius: var(--border-radius);
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }
    
    .alert svg {
        width: 20px;
        height: 20px;
    }
}

/* Badges auf Mobile - Größer für Touch */
@media (max-width: 640px) {
    .badge {
        padding: 0.5rem 0.875rem;
        font-size: 0.75rem;
        min-width: 80px;
    }
}

/* Hide auf bestimmten Breakpoints */
.hide-mobile {
    /* Sichtbar auf Desktop, versteckt auf Mobile via Media Query */
}

.show-mobile-only {
    display: none;
}

.hide-tablet {
    display: inherit;
}

.hide-desktop {
    display: none;
}

@media (max-width: 900px) {
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile-only {
        display: inherit !important;
    }
}

@media (max-width: 640px) {
    .hide-desktop {
        display: inherit;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .hide-tablet {
        display: none !important;
    }
}

@media (min-width: 1025px) {
    .hide-desktop {
        display: none !important;
    }
}

/* Print Styles - Keine Mobile Anpassungen */
@media print {
    .sidebar,
    .main-header,
    #mobile-menu-toggle,
    .sidebar-overlay {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .main-body {
        padding: 0 !important;
    }
}

/* iOS Bounce-Effekt: overscroll-behavior auf html reicht aus (Zeile ~2491) */

/* Verbesserte Scroll-Performance */
.sidebar,
.table-container,
.table-responsive,
.modal-body,
.custom-dropdown-options {
    will-change: scroll-position;
    transform: translateZ(0);
}

/* ========================================
   CUSTOM CHECKBOX & RADIO
   ======================================== */

/* Custom Checkbox */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-input);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    flex-shrink: 0;
}

input[type="checkbox"]:hover {
    border-color: var(--color-primary);
    background: var(--bg-hover);
}

input[type="checkbox"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

input[type="checkbox"]:checked {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 6px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Custom Radio */
input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    background: var(--bg-input);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    flex-shrink: 0;
}

input[type="radio"]:hover {
    border-color: var(--color-primary);
    background: var(--bg-hover);
}

input[type="radio"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

input[type="radio"]:checked {
    border-color: var(--color-primary);
    background: var(--bg-input);
}

input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-primary);
}

input[type="radio"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Dark Theme Adjustments */
[data-theme="dark"] input[type="checkbox"],
[data-theme="dark"] input[type="radio"] {
    border-color: var(--border-input);
    background: var(--bg-input);
}

[data-theme="dark"] input[type="checkbox"]:hover,
[data-theme="dark"] input[type="radio"]:hover {
    border-color: var(--color-primary);
    background: var(--bg-hover);
}

/* ========================================
   CUSTOM SCROLLBAR
   ======================================== */

/* Webkit Scrollbar (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-hover);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
    border: 2px solid var(--bg-hover);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

::-webkit-scrollbar-corner {
    background: var(--bg-hover);
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-hover);
}

/* Dark Theme Scrollbar */
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--bg-card);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-color: var(--bg-card);
}

[data-theme="dark"] ::-webkit-scrollbar-corner {
    background: var(--bg-card);
}

[data-theme="dark"] * {
    scrollbar-color: var(--border-color) var(--bg-card);
}

/* ========================================
   BROWSER AUTOFILL OVERRIDE
   ======================================== */

/* Browser Autofill - Dark Theme */
[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover,
[data-theme="dark"] input:-webkit-autofill:focus,
[data-theme="dark"] input:-webkit-autofill:active,
[data-theme="dark"] textarea:-webkit-autofill,
[data-theme="dark"] select:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    border-color: var(--border-input) !important;
    caret-color: var(--text-primary) !important;
    transition: background-color 5000s ease-in-out 0s;
}

[data-theme="dark"] input:-internal-autofill-selected {
    appearance: none !important;
    background-image: none !important;
    background-color: var(--bg-input) !important;
    -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset !important;
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary) !important;
}

/* Browser Autofill - Light Theme */
[data-theme="light"] input:-webkit-autofill,
[data-theme="light"] input:-webkit-autofill:hover,
[data-theme="light"] input:-webkit-autofill:focus,
[data-theme="light"] input:-webkit-autofill:active,
[data-theme="light"] textarea:-webkit-autofill,
[data-theme="light"] select:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    border-color: var(--border-input) !important;
    caret-color: var(--text-primary) !important;
    transition: background-color 5000s ease-in-out 0s;
}

[data-theme="light"] input:-internal-autofill-selected {
    appearance: none !important;
    background-image: none !important;
    background-color: var(--bg-input) !important;
    -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset !important;
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary) !important;
}

/* ========================================
   KPI STATUS STYLES (IFRS 9 Dashboard)
   ======================================== */

/* Background Status */
.kpi-status-success {
    background: var(--color-success-bg) !important;
}

.kpi-status-warning {
    background: var(--color-warning-bg) !important;
}

.kpi-status-danger {
    background: var(--color-danger-bg) !important;
}

/* Text Status */
.kpi-text-success {
    color: var(--color-success) !important;
}

.kpi-text-warning {
    color: var(--color-warning) !important;
}

.kpi-text-danger {
    color: var(--color-danger) !important;
}

/* Box Status (with border) */
.kpi-box-success {
    background: var(--color-success-bg) !important;
    border: 2px solid var(--color-success) !important;
}

.kpi-box-warning {
    background: var(--color-warning-bg) !important;
    border: 2px solid var(--color-warning) !important;
}

.kpi-box-danger {
    background: var(--color-danger-bg) !important;
    border: 2px solid var(--color-danger) !important;
}

/* ==========================================
   DANGER ZONE
   ========================================== */

.danger-zone {
    border: 1px solid var(--color-danger);
    border-radius: var(--border-radius);
}

.danger-zone-header {
    background: var(--color-danger-bg);
    border-bottom: 1px solid var(--color-danger);
}

.danger-zone-header .card-title {
    color: var(--color-danger);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.danger-zone-header .card-title svg {
    color: var(--color-danger);
}

.danger-zone-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.danger-zone-info {
    flex: 1;
}

.danger-zone-info h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.danger-zone-info p {
    margin: 0;
    font-size: 0.875rem;
}

.danger-zone-action {
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .danger-zone-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .danger-zone-action {
        width: 100%;
        margin-top: 1rem;
    }
    
    .danger-zone-action .btn {
        width: 100%;
    }
}


/* ============================================
   Dashboard Zeitraum-Auswahl
   ============================================ */

.dashboard-period-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dashboard-period-form select {
    min-width: 260px;
}

/* Custom-Dropdown (ersetzt das Select) – gleiche Mindestbreite */
.dashboard-period-form .custom-dropdown,
.dashboard-period-form .custom-dropdown-control {
    min-width: 260px;
}

.dashboard-period-form .custom-dropdown .custom-dropdown-selected {
    min-width: 0;
}

/* Geöffnete Options-Liste des Zeitraum-Dropdowns – keine Textumbrüche */
.custom-dropdown-options.dashboard-period-options {
    min-width: 260px;
}

.custom-date-range {
    display: none;
    align-items: center;
    gap: 0.5rem;
}

.custom-date-range.visible {
    display: flex;
}

.custom-date-range input[type="date"] {
    width: auto;
    min-width: 140px;
}

.custom-date-range .date-separator {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.custom-date-range .btn {
    align-self: stretch;
}

@media (max-width: 768px) {
    .dashboard-period-form {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .dashboard-period-form select,
    .dashboard-period-form .custom-dropdown {
        width: 100%;
        min-width: 0;
    }
    
    .custom-date-range {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .custom-date-range.visible {
        display: flex;
    }
    
    .custom-date-range input[type="date"] {
        width: 100%;
    }
    
    .custom-date-range .date-separator {
        display: none;
    }
    
    .custom-date-range .btn {
        width: 100%;
    }
}


/* ============================================
   PDF Drop-Zone
   ============================================ */

.alert-info-box {
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.pdf-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
}

.pdf-drop-zone:hover {
    border-color: var(--color-primary);
    background: var(--bg-tertiary);
}

.pdf-drop-zone.drag-over {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.pdf-drop-zone.has-file {
    border-color: var(--color-success);
    background: var(--color-success-light);
}

.pdf-drop-zone.has-file svg {
    color: var(--color-success);
}

/* Shortcut Info Box */
.shortcut-info-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.25rem;
}

.shortcut-info-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.shortcut-info-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.shortcut-item kbd {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .shortcut-info-box {
        display: none;
    }
}

/* Batch Progress Dots */
.batch-progress-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    position: relative;
}

.batch-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.batch-progress-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

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

.batch-progress-dots {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 0.75rem;
}

.batch-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}

.batch-dot:hover {
    transform: scale(1.3);
}

/* Tooltip */
.batch-dot[data-tooltip] {
    position: relative;
}

.batch-dot[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    transform: none;
    background: var(--bg-tooltip, #1f2937);
    color: var(--text-tooltip, #fff);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 50;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

.batch-dot[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 6px;
    transform: none;
    border: 5px solid transparent;
    border-top-color: var(--bg-tooltip, #1f2937);
    z-index: 50;
    pointer-events: none;
}

/* Dot-Status-Farben */
.batch-dot-completed {
    background: var(--color-success);
}

.batch-dot-paid {
    background: #166534;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.batch-dot-skipped {
    background: var(--text-muted);
    opacity: 0.5;
}

.batch-dot-current {
    background: var(--color-primary);
    width: 16px;
    height: 16px;
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb, 59, 130, 246), 0.3);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(59, 130, 246, 0.2);
    }
}

.batch-dot-pending {
    background: transparent;
    border: 2px solid var(--border-color);
}

/* Legende */
.batch-progress-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-dot-completed {
    background: var(--color-success);
}

.legend-dot-paid {
    background: #166534;
}

.legend-dot-skipped {
    background: var(--text-muted);
    opacity: 0.5;
}

.legend-dot-current {
    background: var(--color-primary);
}

.legend-dot-pending {
    background: transparent;
    border: 1.5px solid var(--border-color);
}

@media (max-width: 768px) {
    .batch-progress-legend {
        display: none;
    }
    
    .batch-dot {
        width: 10px;
        height: 10px;
    }
    
    .batch-dot-current {
        width: 14px;
        height: 14px;
    }
}


