/* ==========================================================
   KANTINVOICE PREMIUM DESIGN SYSTEM
   Modern, Clean, Professional with Dark Mode
   Primary: Indigo (#6366f1) | Secondary: Slate
   ========================================================== */

/* ============================================
   CSS VARIABLES - LIGHT THEME (DEFAULT)
   ============================================ */
:root {
    /* Primary Palette - Sky Blue */
    --primary-50: #f0f9ff;
    --primary-100: #e0f2fe;
    --primary-200: #bae6fd;
    --primary-300: #7dd3fc;
    --primary-400: #38bdf8;
    --primary-500: #0ea5e9;
    --primary-600: #0284c7;
    --primary-700: #0369a1;
    --primary-800: #075985;
    --primary-900: #0c4a6e;
    
    /* Secondary Palette - Teal/Cyan */
    --secondary-50: #f0fdfa;
    --secondary-100: #ccfbf1;
    --secondary-200: #99f6e4;
    --secondary-300: #5eead4;
    --secondary-400: #2dd4bf;
    --secondary-500: #14b8a6;
    --secondary-600: #0d9488;
    --secondary-700: #0f766e;
    
    /* Neutral Palette - Slate */
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    --slate-950: #020617;
    
    /* Semantic Colors */
    --success-50: #f0fdf4;
    --success-100: #dcfce7;
    --success-300: #86efac;
    --success-400: #4ade80;
    --success-500: #22c55e;
    --success-600: #16a34a;
    --success-700: #15803d;
    
    --warning-50: #fffbeb;
    --warning-100: #fef3c7;
    --warning-300: #fcd34d;
    --warning-400: #fbbf24;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --warning-700: #b45309;
    
    --danger-50: #fef2f2;
    --danger-100: #fee2e2;
    --danger-300: #fca5a5;
    --danger-400: #f87171;
    --danger-500: #ef4444;
    --danger-600: #dc2626;
    --danger-700: #b91c1c;
    
    --info-50: #eff6ff;
    --info-100: #dbeafe;
    --info-300: #93c5fd;
    --info-400: #60a5fa;
    --info-500: #3b82f6;
    --info-600: #2563eb;
    --info-700: #1d4ed8;
    
    /* Theme Variables */
    --bg-body: var(--slate-50);
    --bg-surface: #ffffff;
    --bg-surface-elevated: #ffffff;
    --bg-hover: var(--slate-100);
    --bg-active: var(--primary-50);
    
    --text-primary: var(--slate-900);
    --text-secondary: var(--slate-600);
    --text-muted: var(--slate-400);
    --text-inverse: #ffffff;
    
    --border-color: var(--slate-200);
    --border-color-strong: var(--slate-300);
    
    /* Sidebar */
    --sidebar-bg: linear-gradient(180deg, var(--slate-900) 0%, var(--slate-800) 100%);
    --sidebar-text: var(--slate-300);
    --sidebar-text-active: #ffffff;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.08);
    --sidebar-active-bg: var(--primary-600);
    
    /* Duotone Icon Colors */
    --fa-primary-color: #0284c7;
    --fa-secondary-color: #7dd3fc;
    --fa-primary-opacity: 1;
    --fa-secondary-opacity: 0.6;
    
    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* Spacing */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --topbar-height: 64px;
}

/* ============================================
   DARK THEME
   ============================================ */
[data-theme="dark"] {
    --bg-body: var(--slate-950);
    --bg-surface: var(--slate-900);
    --bg-surface-elevated: var(--slate-800);
    --bg-hover: var(--slate-800);
    --bg-active: rgba(20, 184, 166, 0.15);
    
    --text-primary: var(--slate-100);
    --text-secondary: var(--slate-400);
    --text-muted: var(--slate-500);
    
    --border-color: var(--slate-700);
    --border-color-strong: var(--slate-600);
    
    --sidebar-bg: linear-gradient(180deg, #0a0a0f 0%, var(--slate-900) 100%);
    
    --fa-primary-color: #7dd3fc;
    --fa-secondary-color: #0f766e;
    
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

/* ============================================
   BASE STYLES
   ============================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition-base), color var(--transition-base);
}

a {
    color: var(--primary-600);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-700);
}

[data-theme="dark"] a {
    color: var(--primary-400);
}

[data-theme="dark"] a:hover {
    color: var(--primary-300);
}

/* ============================================
   LAYOUT
   ============================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Collapsed sidebar main content adjustment */
.sidebar.collapsed ~ .main-content {
    margin-left: 72px;
}

.content-wrapper {
    flex: 1;
    padding: 1.5rem;
}

@media (max-width: 991.98px) {
    .main-content {
        margin-left: 0;
    }
    
    .sidebar.collapsed ~ .main-content {
        margin-left: 0;
    }
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1030;
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Collapsed Sidebar */
.sidebar.collapsed {
    width: 72px;
}

.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed .sidebar-theme-toggle,
.sidebar.collapsed .user-dropdown {
    opacity: 0;
    visibility: hidden;
    width: 0;
    height: 0;
    overflow: hidden;
    position: absolute;
    pointer-events: none;
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;
    padding: 1.25rem 0;
}

.sidebar.collapsed .sidebar-brand-icon {
    margin: 0;
}

.sidebar.collapsed .sidebar-nav {
    padding: 0.5rem;
}

.sidebar.collapsed .nav-item {
    margin-bottom: 4px;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.875rem;
    margin: 0;
    gap: 0;
}

.sidebar.collapsed .nav-link .nav-icon {
    font-size: 1.25rem;
    width: auto;
    height: auto;
}

.sidebar.collapsed .sidebar-footer {
    padding: 0.5rem;
}

.sidebar.collapsed .sidebar-user {
    justify-content: center;
    padding: 0.75rem;
    gap: 0;
}

.sidebar.collapsed .sidebar-user-avatar {
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
}

.sidebar.collapsed .nav-section {
    padding: 0.25rem 0;
}

/* Collapsed state active indicator */
.sidebar.collapsed .nav-link.active::before {
    width: 3px;
    height: 50%;
    left: 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Sidebar Collapse Toggle Button */
.sidebar-collapse-btn {
    position: absolute;
    top: 50%;
    right: -12px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1040;
    color: var(--text-secondary);
    font-size: 0.75rem;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    opacity: 0;
}

.sidebar:hover .sidebar-collapse-btn {
    opacity: 1;
}

.sidebar-collapse-btn:hover {
    background: var(--primary-500);
    color: white;
    border-color: var(--primary-500);
    transform: translateY(-50%) scale(1.1);
}

.sidebar.collapsed .sidebar-collapse-btn {
    opacity: 1;
}

.sidebar.collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}

/* Sidebar Mobile Close Button - hidden by default on desktop */
.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-md);
    color: var(--sidebar-text);
    font-size: 1.25rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    transition: all 0.2s ease;
}

.sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Sidebar Brand */
.sidebar-brand {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
}

.sidebar-brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--secondary-500) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
}

.sidebar-brand-text {
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sidebar-brand-text span {
    background: linear-gradient(135deg, var(--primary-400) 0%, var(--secondary-400) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
}

.nav-section-title {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--slate-500);
    padding: 0.75rem 0.75rem 0.5rem;
    margin-top: 0.5rem;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    color: var(--sidebar-text);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    position: relative;
}

.nav-link:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text-active);
}

.nav-link:hover .nav-icon {
    --fa-primary-color: var(--primary-400);
    --fa-secondary-color: var(--primary-300);
}

.nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-active);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: white;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    --fa-primary-color: var(--slate-400);
    --fa-secondary-color: var(--slate-500);
    transition: all var(--transition-fast);
}

.nav-link.active .nav-icon {
    --fa-primary-color: #fff;
    --fa-secondary-color: rgba(255, 255, 255, 0.7);
}

.nav-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s, width 0.3s;
}

.nav-badge {
    margin-left: auto;
    padding: 0.125rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 600;
    background: var(--primary-500);
    color: white;
    border-radius: var(--radius-full);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
    cursor: pointer;
}

.sidebar-user:hover {
    background: var(--sidebar-hover-bg);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--secondary-500) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    color: var(--sidebar-text-active);
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    color: var(--slate-500);
    font-size: 0.75rem;
}

.sidebar-theme-toggle {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--slate-400);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sidebar-theme-toggle:hover {
    background: var(--sidebar-hover-bg);
    color: var(--primary-400);
}

/* Mobile Sidebar */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: 85%;
        max-width: 320px;
        box-shadow: none;
    }
    
    .sidebar.show {
        transform: translateX(0);
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar.collapsed {
        width: 85%;
        max-width: 320px;
    }
    
    /* Ensure brand area has room for close button */
    .sidebar-brand {
        padding-right: 3.5rem;
    }
    
    .sidebar.collapsed .sidebar-brand-text,
    .sidebar.collapsed .nav-section-title,
    .sidebar.collapsed .nav-text,
    .sidebar.collapsed .sidebar-user-info,
    .sidebar.collapsed .sidebar-theme-toggle {
        opacity: 1;
        visibility: visible;
        width: auto;
        height: auto;
        position: static;
        pointer-events: auto;
    }
    
    .sidebar.collapsed .nav-link {
        justify-content: flex-start;
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }
    
    .sidebar.collapsed .sidebar-brand {
        justify-content: flex-start;
        padding: 1.25rem;
    }
    
    .sidebar.collapsed .sidebar-user {
        justify-content: flex-start;
        gap: 0.75rem;
    }
    
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 1025;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .sidebar-backdrop.show {
        opacity: 1;
        visibility: visible;
    }
    
    /* Hide collapse button on mobile */
    .sidebar-collapse-btn {
        display: none;
    }
    
    /* Mobile close button */
    .sidebar-close-btn {
        display: flex;
    }
}

/* ============================================
   TOP BAR
   ============================================ */
.top-bar {
    height: var(--topbar-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color var(--transition-base), border-color var(--transition-base);
}

.topbar-toggle {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.topbar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

@media (max-width: 991.98px) {
    .topbar-toggle {
        display: flex;
    }
}

.topbar-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.topbar-breadcrumb a {
    color: var(--text-secondary);
}

.topbar-breadcrumb a:hover {
    color: var(--primary-600);
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.topbar-btn:hover {
    background: var(--bg-hover);
    color: var(--primary-600);
}

.topbar-btn .notification-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger-500);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-surface);
}

/* Topbar User Dropdown */
.topbar-user-dropdown {
    position: relative;
}

.topbar-user-btn {
    width: auto !important;
    padding: 0 12px;
    gap: 8px;
}

.topbar-username {
    font-size: 0.875rem;
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-user-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    min-width: 200px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    z-index: 1000;
}

.topbar-user-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.topbar-user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.topbar-user-menu-item:hover {
    background: var(--bg-hover);
    color: var(--primary-600);
}

.topbar-user-menu-item.text-danger {
    color: var(--danger-500);
}

.topbar-user-menu-item.text-danger:hover {
    background: var(--danger-50);
}

.topbar-user-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* Mobile adjustments for topbar */
@media (max-width: 767.98px) {
    .top-bar {
        padding: 0 1rem;
        gap: 0.5rem;
    }
    
    .topbar-breadcrumb span:not(:first-child) {
        display: none;
    }
    
    .topbar-actions {
        gap: 0.25rem;
    }
    
    /* Hide search and some buttons on mobile */
    .topbar-search {
        display: none;
    }
    
    .topbar-user-name {
        display: none;
    }
    
    .topbar-user-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        min-width: 100%;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        transform: translateY(100%);
        max-height: 50vh;
        overflow-y: auto;
    }
    
    .topbar-user-menu.show {
        transform: translateY(0);
    }
    
    .topbar-user-menu-item {
        padding: 1rem 1.25rem;
        font-size: 1rem;
    }
    
    .topbar-btn {
        width: 36px;
        height: 36px;
    }
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title .fa-duotone {
    --fa-primary-color: var(--primary-500);
    --fa-secondary-color: var(--primary-300);
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-hover);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Stat Cards */
.stat-card {
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-icon.primary {
    background: var(--primary-100);
    color: var(--primary-600);
    --fa-primary-color: var(--primary-600);
    --fa-secondary-color: var(--primary-400);
}

.stat-icon.success {
    background: var(--success-100);
    color: var(--success-600);
    --fa-primary-color: var(--success-600);
    --fa-secondary-color: var(--success-500);
}

.stat-icon.warning {
    background: var(--warning-100);
    color: var(--warning-600);
    --fa-primary-color: var(--warning-600);
    --fa-secondary-color: var(--warning-500);
}

.stat-icon.danger {
    background: var(--danger-100);
    color: var(--danger-600);
    --fa-primary-color: var(--danger-600);
    --fa-secondary-color: var(--danger-500);
}

.stat-icon.info {
    background: var(--info-100);
    color: var(--info-600);
    --fa-primary-color: var(--info-600);
    --fa-secondary-color: var(--info-500);
}

[data-theme="dark"] .stat-icon.primary {
    background: rgba(20, 184, 166, 0.15);
}

[data-theme="dark"] .stat-icon.success {
    background: rgba(34, 197, 94, 0.15);
}

[data-theme="dark"] .stat-icon.warning {
    background: rgba(245, 158, 11, 0.15);
}

[data-theme="dark"] .stat-icon.danger {
    background: rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] .stat-icon.info {
    background: rgba(59, 130, 246, 0.15);
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.25rem;
}

.stat-change.positive {
    color: var(--success-600);
}

.stat-change.negative {
    color: var(--danger-600);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.25);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.625rem 1.25rem;
    font-size: 1rem;
}

/* Primary Button */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    color: white;
    border-color: var(--primary-600);
    box-shadow: 0 2px 4px rgba(20, 184, 166, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    box-shadow: 0 4px 8px rgba(20, 184, 166, 0.3);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Secondary Button */
.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-color-strong);
}

/* Outline Buttons */
.btn-outline-primary {
    background: transparent;
    color: var(--primary-500);
    border: 1px solid var(--primary-300);
}

.btn-outline-primary:hover {
    background: var(--primary-50);
    border-color: var(--primary-500);
    color: var(--primary-600);
}

[data-theme="dark"] .btn-outline-primary {
    color: var(--primary-400);
    border-color: var(--primary-500);
}

[data-theme="dark"] .btn-outline-primary:hover {
    background: rgba(20, 184, 166, 0.1);
    color: var(--primary-400);
}

.btn-outline-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-outline-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-color-strong);
}

/* Outline Info Button */
.btn-outline-info,
.btn.btn-outline-info {
    background: transparent !important;
    color: var(--info-600) !important;
    border: 1px solid var(--info-400) !important;
}

.btn-outline-info:hover,
.btn.btn-outline-info:hover {
    background: var(--info-50) !important;
    border-color: var(--info-500) !important;
    color: var(--info-700) !important;
}

[data-theme="dark"] .btn-outline-info,
[data-theme="dark"] .btn.btn-outline-info {
    color: var(--info-400) !important;
    border-color: var(--info-500) !important;
}

[data-theme="dark"] .btn-outline-info:hover,
[data-theme="dark"] .btn.btn-outline-info:hover {
    background: rgba(14, 165, 233, 0.15) !important;
    color: var(--info-300) !important;
}

/* Outline Success Button */
.btn-outline-success,
.btn.btn-outline-success {
    background: transparent !important;
    color: var(--success-600) !important;
    border: 1px solid var(--success-400) !important;
}

.btn-outline-success:hover,
.btn.btn-outline-success:hover {
    background: var(--success-50) !important;
    border-color: var(--success-500) !important;
    color: var(--success-700) !important;
}

[data-theme="dark"] .btn-outline-success,
[data-theme="dark"] .btn.btn-outline-success {
    color: var(--success-400) !important;
    border-color: var(--success-500) !important;
}

[data-theme="dark"] .btn-outline-success:hover,
[data-theme="dark"] .btn.btn-outline-success:hover {
    background: rgba(34, 197, 94, 0.15) !important;
    color: var(--success-300) !important;
}

/* Outline Danger Button */
.btn-outline-danger,
.btn.btn-outline-danger {
    background: transparent !important;
    color: var(--danger-600) !important;
    border: 1px solid var(--danger-400) !important;
}

.btn-outline-danger:hover,
.btn.btn-outline-danger:hover {
    background: var(--danger-50) !important;
    border-color: var(--danger-500) !important;
    color: var(--danger-700) !important;
}

[data-theme="dark"] .btn-outline-danger,
[data-theme="dark"] .btn.btn-outline-danger {
    color: var(--danger-400) !important;
    border-color: var(--danger-500) !important;
}

[data-theme="dark"] .btn-outline-danger:hover,
[data-theme="dark"] .btn.btn-outline-danger:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: var(--danger-300) !important;
}

/* Outline Warning Button */
.btn-outline-warning,
.btn.btn-outline-warning {
    background: transparent !important;
    color: var(--warning-600) !important;
    border: 1px solid var(--warning-400) !important;
}

.btn-outline-warning:hover,
.btn.btn-outline-warning:hover {
    background: var(--warning-50) !important;
    border-color: var(--warning-500) !important;
    color: var(--warning-700) !important;
}

[data-theme="dark"] .btn-outline-warning,
[data-theme="dark"] .btn.btn-outline-warning {
    color: var(--warning-400) !important;
    border-color: var(--warning-500) !important;
}

[data-theme="dark"] .btn-outline-warning:hover,
[data-theme="dark"] .btn.btn-outline-warning:hover {
    background: rgba(245, 158, 11, 0.15) !important;
    color: var(--warning-300) !important;
}

/* Success Button */
.btn-success {
    background: linear-gradient(135deg, var(--success-500) 0%, var(--success-600) 100%);
    color: white;
    border-color: var(--success-600);
}

.btn-success:hover {
    background: linear-gradient(135deg, var(--success-600) 0%, var(--success-700) 100%);
}

/* Danger Button */
.btn-danger {
    background: linear-gradient(135deg, var(--danger-500) 0%, var(--danger-600) 100%);
    color: white;
    border-color: var(--danger-600);
}

.btn-danger:hover {
    background: linear-gradient(135deg, var(--danger-600) 0%, var(--danger-700) 100%);
}

/* Warning Button */
.btn-warning {
    background: linear-gradient(135deg, var(--warning-500) 0%, var(--warning-600) 100%);
    color: white;
    border-color: var(--warning-600);
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0.5rem;
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Icon Button */
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
}

/* ============================================
   FORMS
   ============================================ */
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:disabled {
    background-color: var(--bg-hover);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Form Select */
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
}

/* Input Group */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-radius: 0;
}

.input-group .form-control:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group .form-control:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    background-color: var(--bg-hover);
    border: 1px solid var(--border-color);
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.375rem 0;
    padding-left: 0;
    min-height: unset;
    margin-bottom: 0.25rem;
}

.form-check-input {
    width: 1.125rem;
    height: 1.125rem;
    margin: 0 !important;
    margin-top: 0 !important;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--primary-500);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    position: relative !important;
    float: none !important;
}

.form-check-input:checked {
    background-color: var(--primary-500);
    border-color: var(--primary-500);
}

.form-check-label {
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    line-height: 1.4;
    user-select: none;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* Form Text */
.form-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Validation */
.is-invalid {
    border-color: var(--danger-500) !important;
}

.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.invalid-feedback {
    font-size: 0.75rem;
    color: var(--danger-600);
    margin-top: 0.25rem;
}

/* ============================================
   TABLES - MODERN CARD-STYLE ROWS
   ============================================ */
.table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
    padding: 0 0.25rem;
    /* Remove border and border-radius - rows are now cards */
    border: none;
    border-radius: 0;
    background: transparent;
}

/* Dropdown in Tabellen soll nicht abgeschnitten werden */
.table-wrapper .dropdown-menu {
    position: fixed !important;
    z-index: 1050;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.25rem;
    margin-top: -0.25rem;
    font-size: 0.875rem;
    --bs-table-bg: transparent;
}

.table thead tr {
    background: transparent !important;
}

.table th {
    padding: 0.375rem 0.75rem;
    text-align: left;
    font-weight: 500;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    background: transparent !important;
    border: none !important;
    white-space: nowrap;
}

.table th:first-child {
    padding-left: 1rem;
}

.table th:last-child {
    padding-right: 1rem;
}

.table tbody tr {
    background: var(--bg-surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: all 0.15s ease;
}

.table tbody tr:hover {
    background: var(--bg-surface);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.table td {
    padding: 0.625rem 0.75rem;
    vertical-align: middle;
    border: none !important;
    color: var(--text-primary);
    background: transparent;
}

.table tbody tr td:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    padding-left: 1rem;
}

.table tbody tr td:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding-right: 1rem;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Table sm - even more compact */
.table-sm th {
    padding: 0.375rem 0.75rem;
}

.table-sm td {
    padding: 0.5rem 0.75rem;
}

/* Remove table footer */
.table tfoot {
    display: none;
}

/* Overdue row styling */
.table tbody tr.table-danger-subtle {
    background-color: #fff5f5;
}

.table tbody tr.table-danger-subtle:hover {
    background-color: #ffefef;
}

[data-theme="dark"] .table tbody tr.table-danger-subtle {
    background-color: rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] .table tbody tr.table-danger-subtle:hover {
    background-color: rgba(239, 68, 68, 0.25);
}

/* Skeleton rows should not have card styling */
.table tbody tr.skeleton-row {
    background: transparent;
    box-shadow: none;
}

.table tbody tr.skeleton-row:hover {
    transform: none;
    box-shadow: none;
}

/* Card containing table - make transparent */
.card:has(.table-wrapper),
.card:has(.table) {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.card:has(.table-wrapper) > .card-header,
.card:has(.table) > .card-header {
    background: transparent !important;
    border-bottom: none !important;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.card:has(.table-wrapper) > .card-body,
.card:has(.table) > .card-body {
    padding: 0 !important;
}

.card:has(.table-wrapper) > .card-footer,
.card:has(.table) > .card-footer {
    background: transparent !important;
    border-top: none !important;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.table-striped tbody tr:nth-child(odd) {
    background-color: var(--bg-hover);
}

.table-striped tbody tr:nth-child(odd):hover {
    background-color: var(--slate-100);
}

[data-theme="dark"] .table-striped tbody tr:nth-child(odd):hover {
    background-color: var(--slate-800);
}

/* Table Actions */
.table-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    line-height: 1.2;
}

.badge-primary {
    background: var(--primary-100);
    color: var(--primary-700);
}

.badge-success {
    background: var(--success-100);
    color: var(--success-700);
}

.badge-warning {
    background: var(--warning-100);
    color: var(--warning-600);
}

.badge-danger {
    background: var(--danger-100);
    color: var(--danger-700);
}

.badge-info {
    background: var(--info-100);
    color: var(--info-600);
}

.badge-secondary {
    background: var(--slate-100);
    color: var(--slate-600);
}

[data-theme="dark"] .badge-primary {
    background: rgba(20, 184, 166, 0.2);
    color: var(--primary-300);
}

[data-theme="dark"] .badge-success {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success-500);
}

[data-theme="dark"] .badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning-500);
}

[data-theme="dark"] .badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-500);
}

[data-theme="dark"] .badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info-500);
}

[data-theme="dark"] .badge-secondary {
    background: var(--slate-800);
    color: var(--slate-400);
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.alert-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.alert-success {
    background: var(--success-50);
    border: 1px solid var(--success-200);
    color: var(--success-700);
}

.alert-warning {
    background: var(--warning-50);
    border: 1px solid var(--warning-200);
    color: var(--warning-700);
}

.alert-danger {
    background: var(--danger-50);
    border: 1px solid var(--danger-200);
    color: var(--danger-700);
}

.alert-info {
    background: var(--info-50);
    border: 1px solid var(--info-200);
    color: var(--info-700);
}

[data-theme="dark"] .alert-success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

[data-theme="dark"] .alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

/* ============================================
   MODAL
   ============================================ */
.modal-backdrop {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ============================================
   DROPDOWN
   ============================================ */
.dropdown-menu {
    min-width: 180px;
    padding: 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--primary-600);
}

.dropdown-item i {
    font-size: 0.875rem;
    color: var(--text-secondary);
    width: 16px;
    text-align: center;
}

.dropdown-divider {
    height: 1px;
    margin: 0.5rem 0;
    background: var(--border-color);
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.page-item .page-link:hover {
    background: var(--bg-hover);
    border-color: var(--border-color-strong);
    color: var(--text-primary);
}

.page-item.active .page-link {
    background: var(--primary-500);
    border-color: var(--primary-500);
    color: white;
}

.page-item.disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: var(--bg-hover);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--text-muted);
    --fa-primary-color: var(--slate-400);
    --fa-secondary-color: var(--slate-300);
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ============================================
   AVATAR
   ============================================ */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--secondary-500) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 1.25rem;
}

.avatar-group {
    display: flex;
}

.avatar-group .avatar {
    margin-left: -8px;
    border: 2px solid var(--bg-surface);
}

.avatar-group .avatar:first-child {
    margin-left: 0;
}

/* ============================================
   PROGRESS
   ============================================ */
.progress {
    height: 8px;
    background: var(--slate-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

[data-theme="dark"] .progress {
    background: var(--slate-700);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-500) 0%, var(--secondary-500) 100%);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.progress-bar.success {
    background: linear-gradient(90deg, var(--success-500) 0%, var(--success-600) 100%);
}

.progress-bar.warning {
    background: linear-gradient(90deg, var(--warning-500) 0%, var(--warning-600) 100%);
}

.progress-bar.danger {
    background: linear-gradient(90deg, var(--danger-500) 0%, var(--danger-600) 100%);
}

/* ============================================
   UTILITIES
   ============================================ */
.text-primary { color: var(--primary-600) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success-600) !important; }
.text-warning { color: var(--warning-600) !important; }
.text-danger { color: var(--danger-600) !important; }

.bg-primary { background-color: var(--primary-500) !important; }
.bg-primary-light { background-color: var(--primary-100) !important; }
.bg-success { background-color: var(--success-500) !important; }
.bg-warning { background-color: var(--warning-500) !important; }
.bg-danger { background-color: var(--danger-500) !important; }

.rounded { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-xl { border-radius: var(--radius-xl) !important; }
.rounded-full { border-radius: var(--radius-full) !important; }

.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Transition utilities */
.transition-all { transition: all var(--transition-base); }
.transition-colors { transition: background-color var(--transition-base), color var(--transition-base), border-color var(--transition-base); }
.transition-opacity { transition: opacity var(--transition-base); }
.transition-transform { transition: transform var(--transition-base); }

/* Spacing utilities */
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 767.98px) {
    .content-wrapper {
        padding: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .table-wrapper {
        margin: 0 -1rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
        overflow-y: visible;
    }
    
    /* Mobile: Stack table cells */
    .table-responsive-stack thead {
        display: none;
    }
    
    .table-responsive-stack tbody tr {
        display: block;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    .table-responsive-stack td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border: none !important;
    }
    
    .table-responsive-stack td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 0.75rem;
        text-transform: uppercase;
    }
    
    /* Mobile filter/search adjustments */
    .card-header .d-flex {
        flex-wrap: wrap;
    }
    
    .card-header select,
    .card-header input {
        width: 100% !important;
        min-width: unset !important;
    }
}

/* ============================================
   DROPDOWN IMPROVEMENTS
   ============================================ */
.dropdown-menu {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem 0;
    min-width: 180px;
    z-index: 1050;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    transition: all 0.15s ease;
}

.dropdown-item:hover {
    background: var(--bg-hover);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
}

.dropdown-divider {
    margin: 0.25rem 0;
    border-color: var(--border-color);
}

/* ============================================
   MOBILE RESPONSIVE IMPROVEMENTS
   ============================================ */

/* Small screens - phone */
@media (max-width: 575.98px) {
    .content-wrapper {
        padding: 0.75rem;
    }
    
    /* Page headers - stack vertically */
    .d-flex.align-items-center.justify-content-between {
        flex-direction: column;
        align-items: stretch !important;
        gap: 1rem;
    }
    
    /* Action buttons in page header */
    .d-flex.align-items-center.justify-content-between > .d-flex.gap-2 {
        flex-direction: column;
        width: 100%;
    }
    
    .d-flex.align-items-center.justify-content-between > .d-flex.gap-2 > a,
    .d-flex.align-items-center.justify-content-between > .d-flex.gap-2 > button {
        width: 100%;
        justify-content: center;
    }
    
    .d-flex.align-items-center.justify-content-between > a,
    .d-flex.align-items-center.justify-content-between > button {
        width: 100%;
    }
    
    /* Headings smaller on mobile */
    .h4, h4 {
        font-size: 1.125rem;
    }
    
    /* Stat cards - 2 columns on mobile */
    .row.g-3.mb-4 > [class*="col-"] {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .stat-card {
        padding: 0.75rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    /* Table actions on mobile */
    .table-actions {
        flex-direction: row;
        gap: 0.25rem;
    }
    
    .table td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .table th {
        padding: 0.5rem;
        font-size: 0.7rem;
    }
    
    /* Hide less important columns on mobile */
    .table .hide-mobile {
        display: none;
    }
    
    /* Avatar smaller on mobile */
    .avatar {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }
    
    /* Card header - stack on mobile */
    .card-header {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.75rem;
    }
    
    .card-header .d-flex.gap-2 {
        width: 100%;
    }
    
    .card-header input.form-control {
        width: 100% !important;
    }
    
    /* Table wrapper horizontal scroll */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-wrapper table {
        min-width: 600px;
    }
    
    /* Badges smaller */
    .badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
    
    /* Form improvements */
    .card-body {
        padding: 1rem;
    }
    
    .row.g-3 > [class*="col-md-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Modal full width on mobile */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
}

/* Medium screens - tablet */
@media (min-width: 576px) and (max-width: 991.98px) {
    .content-wrapper {
        padding: 1rem;
    }
    
    /* 2 column layout for forms */
    .row.g-3 > .col-md-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .row.g-3 > .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Touch-friendly buttons */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .btn-sm {
        min-height: 36px;
        min-width: 36px;
    }
    
    .btn-icon {
        min-height: 40px;
        min-width: 40px;
    }
    
    .dropdown-item {
        padding: 0.75rem 1rem;
    }
    
    .form-control,
    .form-select {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Better tap targets for mobile nav */
    .nav-link {
        min-height: 48px;
    }
    
    .sidebar-close-btn {
        min-width: 44px;
        min-height: 44px;
    }
}

/* ============================================
   SMOOTH MOBILE ANIMATIONS
   ============================================ */
@media (max-width: 991.98px) {
    /* Smooth sidebar slide animation */
    .sidebar {
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* Fade in backdrop */
    .sidebar-backdrop {
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    /* Prevent body scroll when menu is open */
    body.sidebar-open {
        overflow: hidden;
    }
}

/* ============================================
   GLOBAL SEARCH STYLES
   ============================================ */

/* Search Overlay */
.global-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.global-search-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Search Container */
.global-search-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: all 0.2s ease;
    pointer-events: none;
}

.global-search-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Search Wrapper */
.global-search-wrapper {
    width: 100%;
    max-width: 640px;
    background: var(--bg-surface);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* Input Wrapper */
.global-search-input-wrapper {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    gap: 0.75rem;
}

.global-search-icon {
    font-size: 1.25rem;
    color: var(--text-muted);
}

.global-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1.125rem;
    color: var(--text-primary);
    outline: none;
}

.global-search-input::placeholder {
    color: var(--text-muted);
}

.global-search-shortcut {
    display: flex;
    gap: 0.25rem;
}

.global-search-shortcut kbd {
    padding: 0.25rem 0.6rem;
    background: var(--slate-100);
    border: 1px solid var(--border-color-strong);
    border-bottom: 2px solid var(--border-color-strong);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: system-ui, -apple-system, sans-serif;
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .global-search-shortcut kbd {
    background: var(--slate-700);
    border-color: var(--slate-600);
    color: var(--slate-200);
}

/* Search Results */
.global-search-results {
    display: none;
    max-height: 60vh;
    overflow-y: auto;
}

.global-search-results::-webkit-scrollbar {
    width: 8px;
}

.global-search-results::-webkit-scrollbar-track {
    background: transparent;
}

.global-search-results::-webkit-scrollbar-thumb {
    background: var(--border-color-strong);
    border-radius: 4px;
}

/* Search Category */
.search-category {
    padding: 0.5rem 0;
}

.search-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.search-category-header .badge {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
}

/* Search Result Item */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s ease;
}

.search-result-item:hover,
.search-result-item.selected {
    background: var(--bg-hover);
}

.search-result-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 1rem;
    color: white;
    flex-shrink: 0;
}

.search-result-icon.bg-primary {
    background: var(--primary-500);
}

.search-result-icon.bg-success {
    background: var(--success-500);
}

.search-result-icon.bg-warning {
    background: var(--warning-500);
}

.search-result-icon.bg-info {
    background: var(--info-500);
}

.search-result-icon.bg-secondary {
    background: var(--slate-500);
}

.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-extra {
    color: var(--text-muted);
    margin-left: 0.5rem;
}

.search-result-arrow {
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.search-result-item:hover .search-result-arrow,
.search-result-item.selected .search-result-arrow {
    opacity: 1;
}

/* Search Hint */
.search-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-hover);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.search-hint kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    padding: 0.2rem 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color-strong);
    border-bottom: 2px solid var(--border-color-strong);
    border-radius: 4px;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0.2rem;
}

[data-theme="dark"] .search-hint kbd {
    background: var(--slate-700);
    border-color: var(--slate-600);
    color: var(--slate-200);
}

/* Search Loading */
.search-loading,
.search-error,
.search-no-results {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.search-error {
    color: var(--danger-500);
}

/* ============================================
   NOTIFICATION DROPDOWN
   ============================================ */
.notification-dropdown-wrapper {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    color: white;
    background: var(--danger-500);
    border-radius: 9px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    max-height: 500px;
    background: #ffffff !important;
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.notification-dropdown.show {
    display: flex;
}

.notification-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-secondary);
}

.notification-dropdown-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.notification-mark-all-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
    color: var(--primary-600);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.notification-mark-all-btn:hover {
    background: var(--primary-50);
}

.notification-dropdown-body {
    flex: 1;
    overflow-y: auto;
    max-height: 350px;
}

.notification-dropdown-footer {
    padding: 0.75rem;
    text-align: center;
    border-top: 1px solid var(--border-primary);
    background: var(--bg-secondary);
}

.notification-dropdown-footer a {
    font-size: 0.85rem;
    color: var(--primary-600);
    text-decoration: none;
    font-weight: 500;
}

.notification-dropdown-footer a:hover {
    text-decoration: underline;
}

/* Notification Item */
.notification-item {
    display: flex;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.2s;
}

.notification-item:hover {
    background: var(--bg-tertiary);
}

.notification-item.unread {
    background: var(--primary-50);
}

.notification-item.unread:hover {
    background: var(--primary-100);
}

.notification-item-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    margin-right: 0.75rem;
    font-size: 0.9rem;
}

.notification-item-icon.invoice-due { background: var(--warning-100); color: var(--warning-600); }
.notification-item-icon.invoice-overdue { background: var(--danger-100); color: var(--danger-600); }
.notification-item-icon.invoice-created { background: var(--success-100); color: var(--success-600); }
.notification-item-icon.invoice-paid { background: var(--success-100); color: var(--success-600); }
.notification-item-icon.quote-expiring { background: var(--warning-100); color: var(--warning-600); }
.notification-item-icon.quote-expired { background: var(--slate-200); color: var(--slate-600); }
.notification-item-icon.reminder-sent { background: var(--warning-100); color: var(--warning-600); }
.notification-item-icon.info { background: var(--primary-100); color: var(--primary-600); }
.notification-item-icon.warning { background: var(--warning-100); color: var(--warning-600); }
.notification-item-icon.error { background: var(--danger-100); color: var(--danger-600); }

.notification-item-content {
    flex: 1;
    min-width: 0;
}

.notification-item-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-item.unread .notification-item-title {
    font-weight: 600;
}

.notification-item-message {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-item-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.notification-item-badge {
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.notification-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

.notification-empty i {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.notification-loading {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
}

/* Dark Mode für Notification Dropdown */
[data-theme="dark"] .notification-dropdown {
    background: #1e293b;
    background-color: var(--slate-800);
    border-color: var(--slate-700);
}

[data-theme="dark"] .notification-dropdown-header,
[data-theme="dark"] .notification-dropdown-footer {
    background: var(--slate-900);
}

[data-theme="dark"] .notification-item:hover {
    background: var(--slate-700);
}

[data-theme="dark"] .notification-item.unread {
    background: rgba(14, 165, 233, 0.1);
}

[data-theme="dark"] .notification-item.unread:hover {
    background: rgba(14, 165, 233, 0.15);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .notification-dropdown {
        width: 100vw;
        right: -60px;
        max-height: 70vh;
        border-radius: 0 0 12px 12px;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .global-search-container {
        padding: 1rem;
        padding-top: 5vh;
    }
    
    .global-search-wrapper {
        max-width: 100%;
        border-radius: 12px;
    }
    
    .global-search-input {
        font-size: 1rem;
    }
    
    .global-search-shortcut {
        display: none;
    }
    
    .search-hint {
        display: none;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .sidebar,
    .top-bar,
    .btn,
    .topbar-actions {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
