:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #475569;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #3b82f6;
    --sidebar-text: #cbd5e1;
    --content-bg: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
}

body {
    background-color: var(--content-bg);
    color: #1e293b;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Wrapper Layout */
#app-wrapper {
    display: flex;
    flex: 1;
    min-height: calc(100vh - 56px);
}

/* Sidebar */
#sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    transition: all 0.3s ease;
    flex-shrink: 0;
    overflow-y: auto;
    border-right: 1px solid #1e293b;
}

#sidebar.collapsed {
    margin-left: -260px;
}

#sidebar .sidebar-heading {
    padding: 12px 18px 6px;
    font-size: 0.72rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #64748b;
}

#sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 9px 18px;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 6px;
    margin: 2px 8px;
    transition: all 0.2s ease;
    text-decoration: none;
}

#sidebar .nav-link i {
    width: 18px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.95rem;
}

#sidebar .nav-link:hover {
    background-color: var(--sidebar-hover);
    color: #ffffff;
}

#sidebar .nav-link:hover i {
    color: #60a5fa;
}

#sidebar .nav-link.active {
    background-color: var(--sidebar-active);
    color: #ffffff;
    font-weight: 600;
}

#sidebar .nav-link.active i {
    color: #ffffff;
}

/* Main Content Area */
#main-content {
    flex: 1;
    padding: 24px 30px;
    overflow-x: hidden;
}

/* Top Navbar */
.top-navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    z-index: 1000;
}

.brand-badge {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #ffffff;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    font-size: 1.05rem;
}

/* Modern Card */
.modern-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    margin-bottom: 20px;
    transition: box-shadow 0.2s ease;
}

.modern-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
}

.modern-card .card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 600;
    font-size: 1.05rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modern-card .card-body {
    padding: 20px;
}

/* Stat Widgets */
.stat-widget {
    display: flex;
    align-items: center;
    padding: 18px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    gap: 16px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-icon.primary { background: #eff6ff; color: #2563eb; }
.stat-icon.success { background: #f0fdf4; color: #16a34a; }
.stat-icon.warning { background: #fffbeb; color: #d97706; }
.stat-icon.danger { background: #fef2f2; color: #dc2626; }
.stat-icon.info { background: #f0fdfa; color: #0d9488; }

.stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.82rem;
    color: #64748b;
    font-weight: 500;
}

/* Custom Table Styles */
.table thead th {
    background-color: #f1f5f9;
    color: #475569;
    font-weight: 600;
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid #cbd5e1;
    white-space: nowrap;
    vertical-align: middle;
}

.table tbody td {
    vertical-align: middle;
    font-size: 0.88rem;
}

/* Status Badges */
.badge-status {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 600;
}

.badge-status.active { background-color: #dcfce7; color: #15803d; }
.badge-status.closed { background-color: #fee2e2; color: #b91c1c; }
.badge-status.pending { background-color: #fef3c7; color: #b45309; }

/* Filter Bar */
.filter-bar {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 18px;
}

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

.table-responsive:has(.dropdown-menu.show) {
    overflow-y: visible;
}

.modern-card,
.modern-card .card-body {
    overflow: visible;
}

.dropdown-menu {
    z-index: 1080 !important;
}

/* Select2 Enhancements & Bootstrap 5 Compatibility */
.select2-container--bootstrap-5 .select2-selection {
    font-size: 0.9rem;
    min-height: 38px;
    border-color: #dee2e6;
    border-radius: 0.375rem;
}

.input-group .select2-container--bootstrap-5 {
    flex-grow: 1;
}

.input-group .select2-container--bootstrap-5 .select2-selection {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.select2-container--bootstrap-5 .select2-dropdown {
    border-color: #dee2e6;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
}

.select2-container--bootstrap-5 .select2-search__field {
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.select2-container--bootstrap-5 .select2-results__option--highlighted[aria-selected] {
    background-color: var(--primary-color, #2563eb);
}