:root {
    /* Brand Colors (from new design) */
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #3498db;
    --bg-color: #f4f7f6;
    --text-color: #333;
    --border-color: #ddd;
    --white: #ffffff;

    /* Legacy/Bootstrap Variable Overrides */
    --brand: var(--accent-color);
    --brand-contrast: var(--white);
    --brand-light: #5dade2;
    --brand-dark: #2980b9;
    
    /* Background & Surface */
    --bg: var(--bg-color);
    --bg-secondary: #ebedef;
    --surface: var(--white);
    --surface-elevated: var(--white);
    
    /* Text Colors */
    --text-primary: var(--text-color);
    --text-secondary: var(--secondary-color);
    --text-muted: #7f8c8d;
    --text-light: #bdc3c7;

    /* Status Colors */
    --status-draft: #95a5a6;
    --status-submitted: var(--accent-color);
    --status-approved: #27ae60;
    --status-rejected: #e74c3c;
    --status-changes-requested: #f39c12;
    --status-pending: #8e44ad;

    /* Category Colors */
    --category-primary: var(--accent-color);
    --category-success: #2ecc71;
    --category-warning: #f1c40f;
    --category-danger: #e74c3c;
    --category-info: #1abc9c;
    --category-purple: #9b59b6;
    --category-pink: #e91e63;
    
    /* Borders & Shadows */
    --border-radius: 4px;
    --border-radius-sm: 4px;
    --border-radius-lg: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    
    /* Typography */
    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-size-base: 1rem;
    --font-size-sm: 0.875rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    
    /* Email Template Tabs */
    --email-tab-bg: #e2e8f0;
    --email-tab-color: #1e293b;
    --email-tab-active-bg: var(--accent-color);
    --email-tab-active-color: var(--white);
    --email-tab-hover-bg: #cbd5e1;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --header-height: 72px;
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 84px;

}

/* Dashboard Components */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-content {
    flex-grow: 1;
}

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

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.form-card-grid {
    display: grid;
    /* reduce minimum card size so more fit on a row */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

/* slightly tighter cards to save space */
.form-card {
    padding: 1rem;
}

.form-card {
    background: var(--surface);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

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

.form-card-accent {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
}

.form-card-title {
    font-weight: 700;
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.form-card-description {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.form-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
}

/* Dashboard Header refinements */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    margin-top: 2rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Compact Table refinements */
.table-container {
    background: var(--surface);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 2rem;
}

.table thead th {
    background: #f8fafc;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: #64748b;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.table tbody td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

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

.table-hover tbody tr:hover {
    background-color: #f8fafc;
}

/* Badge Refinements */
.status-badge {
    padding: 4px 10px;
    font-size: 0.75rem;
    letter-spacing: 0.01em;
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: var(--font-size-base);
    line-height: 1.6;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Main Container Adjustment */
.container {
    width: 98%;
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 10px;
}

/* Typography & Headings */
h1, h2, h3, h4, h5, h6 {
    color: var(--primary-color);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); margin-bottom: 1.5rem; }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: 1.25rem; margin-top: 1.5rem; }

p { 
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
}

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.muted { color: var(--text-muted); }
.small { font-size: 0.875rem; }

/* Modern Navigation (Matching new design) */
.navbar {
    background-color: var(--brand) !important;
    padding: 0.75rem 0;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    z-index: 4000;
    border-bottom: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    position: relative;
}

/* Email Template Tabs Styling */
#templateTabs .nav-link {
    background-color: var(--email-tab-bg);
    color: var(--email-tab-color);
    border: 1px solid #cbd5e1;
    border-radius: var(--border-radius-lg);
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

#templateTabs .nav-link:hover {
    background-color: var(--email-tab-hover-bg);
    color: var(--text-primary);
}

#templateTabs .nav-link.active {
    background-color: var(--email-tab-active-bg) !important;
    color: var(--email-tab-active-color) !important;
    border-color: var(--email-tab-active-bg);
    box-shadow: var(--shadow-sm);
}

/* Submission View Spacing Fixes */
.answers-list .bg-light {
    padding: 1.5rem !important;
}

.table-container {
    padding: 2rem;
}

@media (max-width: 768px) {
    .table-container {
        padding: 1rem;
    }
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--white) !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    max-height: 40px;
    width: auto;
    object-fit: contain;
}

.nav-link {
    color: var(--white) !important;
    font-weight: 500;
    font-size: 0.9375rem;
    padding: 0.5rem 1rem !important;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--accent-color) !important;
    background: transparent;
}

.nav-link.active {
    color: var(--accent-color) !important;
    background: transparent;
}

/* Modern Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.card h3 {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
}

.card .value {
    font-size: 2rem;
    font-weight: bold;
    margin: 10px 0;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 5px;
    color: var(--primary-color);
}

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

/* Question Cards */
.question-card {
    border: 1px solid var(--border-color);
    background: var(--surface);
    border-radius: var(--border-radius-lg);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-align: left;
}

.question-card:hover {
    transform: none;
    box-shadow: var(--shadow-md);
}

/* Form Controls */
.form-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    margin-bottom: 0.5rem;
    display: block;
}

.form-control, .form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    background: var(--surface);
    color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
    outline: none;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.btn:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

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

.btn-secondary {
    background: var(--secondary-color);
    color: var(--white);
}

.btn-success { background: var(--category-success); color: white; }
.btn-danger { background: var(--category-danger); color: white; }
.btn-warning { background: var(--category-warning); color: white; }

.btn-outline-primary {
    background: transparent;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
}

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

/* Tables */
.table-container {
    background: var(--white);
    padding: 15px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 25px;
    overflow-x: auto;
}

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

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 1px solid var(--border-color);
    color: var(--secondary-color);
    font-size: var(--font-size-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 12px;
    text-align: left;
}

.table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    vertical-align: middle;
}

/* Badges & Tags */
.status-badge, .badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid #ddd;
    text-transform: capitalize;
}

.status-approved {
    background-color: #d4edda !important;
    color: #155724 !important;
    border-color: #c3e6cb !important;
}

.status-rejected {
    background-color: #f8d7da !important;
    color: #721c24 !important;
    border-color: #f5c6cb !important;
}

.status-submitted, .status-pending {
    background-color: #e2d9f3 !important;
    color: #553c7b !important;
    border-color: #d1c4e9 !important;
}

.status-draft {
    background-color: #e9ecef !important;
    color: #495057 !important;
    border-color: #dee2e6 !important;
}

.status-changes-requested, .status-requested-changes {
    background-color: #fff3cd !important;
    color: #856404 !important;
    border-color: #ffeeba !important;
}

.status-info {
    background-color: #e7f3ff !important;
    color: #007bff !important;
    border-color: #b8daff !important;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 15px;
    margin-top: 10px;
}

.tab-link {
    padding: 8px 20px;
    text-decoration: none;
    color: var(--secondary-color);
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-link.active {
    border-bottom-color: var(--accent-color);
    color: var(--accent-color);
}

/* Overview Grid */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Dashboard Row/Col */
.dashboard-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.dashboard-col {
    flex: 1;
    min-width: 450px;
}

/* Progress Bar */
.progress-track {
    height: 8px;
    background-color: #eee;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), #2ecc71);
    border-radius: 4px;
    transition: width 0.5s ease-in-out;
}

/* Alerts */
.alert {
    padding: 12px 20px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 20px;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.alert-info { background-color: #d1ecf1; color: #0c5460; border-color: #bee5eb; }
.alert-success { background-color: #d4edda; color: #155724; border-color: #c3e6cb; }
.alert-warning { background-color: #fff3cd; color: #856404; border-color: #ffeeba; }
.alert-danger { background-color: #f8d7da; color: #721c24; border-color: #f5c6cb; }

/* Utility Classes */
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }

/* Responsive */
@media (max-width: 768px) {
    .dashboard-col { min-width: 100%; }
    .btn { width: 100%; justify-content: center; margin-right: 0; }
}

/* Fix for tab text visibility (overriding nav-link white color) */
.nav-tabs .nav-link {
    color: var(--primary-color) !important;
    background-color: transparent;
    border: 1px solid transparent;
}

.nav-tabs .nav-link:hover {
    color: var(--accent-color) !important;
    background-color: rgba(0,0,0,0.05);
    border-color: transparent transparent var(--border-color);
}

.nav-tabs .nav-link.active {
    color: var(--primary-color) !important;
    background-color: var(--white) !important;
    border-color: var(--border-color) var(--border-color) var(--white);
    font-weight: 600;
}

/* ========================================
   SIDEBAR NAVIGATION STYLES
   ======================================== */

.main-content-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.sidebar-header {
    background-color: var(--brand);
    color: var(--brand-contrast);
    border-bottom: 1px solid color-mix(in srgb, var(--brand) 80%, black);
    min-height: var(--header-height);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.sidebar-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

.sidebar-header .btn-close:hover {
    opacity: 1;
}

.sidebar-title {
    margin: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    color: var(--brand-contrast);
}

.sidebar-title i,
.sidebar-title-text {
    color: inherit;
}

.sidebar-collapse-btn {
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: var(--brand-contrast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.sidebar-body {
    overflow-y: auto;
    padding: 1rem 0;
    flex: 1 1 auto;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-section {
    margin: 0;
}

.sidebar-section:not(:last-child) {
    margin-bottom: 0.5rem;
}

.sidebar-item-group {
    margin: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    background-color: transparent;
    border: none;
    width: 100%;
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
    position: relative;
}

.sidebar-link::after {
    display: none !important;
}

.sidebar-link i:first-child {
    width: 20px;
    min-width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-text {
    flex: 1;
    text-align: left;
    user-select: none;
}

.sidebar-link:hover {
    background-color: color-mix(in srgb, var(--brand) 12%, white);
    color: var(--brand);
}

.sidebar-link.active {
    background-color: color-mix(in srgb, var(--brand) 16%, white);
    color: var(--brand);
    border-left: 3px solid var(--brand);
    padding-left: calc(1rem - 3px);
    font-weight: 600;
}

.sidebar-chevron {
    font-size: 0.75rem;
    margin-left: auto;
    transition: transform 0.3s ease;
}

.sidebar-link[aria-expanded="true"] .sidebar-chevron {
    transform: rotate(180deg);
}

.sidebar-submenu {
    background-color: rgba(0, 0, 0, 0.02);
    padding: 0.5rem 0;
    margin: 0;
    list-style: none;
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 400;
    transition: color 0.2s ease, background-color 0.2s ease;
    cursor: pointer;
}

.sidebar-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    display: inline-block;
}

.sidebar-sublink:hover {
    color: var(--brand);
    background-color: color-mix(in srgb, var(--brand) 10%, white);
}

.sidebar-sublink.active {
    color: var(--brand);
    font-weight: 600;
}

.sidebar-sublink.active .sidebar-dot {
    background-color: var(--brand);
    width: 6px;
    height: 6px;
}

.sidebar-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.75rem 0;
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-color);
    padding: 1rem;
    margin-top: auto;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--brand);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

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

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

.sidebar-user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

.sidebar-user-menu-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.25rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
}

.sidebar-user-menu-btn:hover {
    color: var(--brand);
}

.sidebar-user-menu {
    min-width: 180px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
}

.sidebar-user-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

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

.sidebar-user-menu .dropdown-item i {
    width: 18px;
    min-width: 18px;
    text-align: center;
}

.navbar-top {
    background-color: var(--brand) !important;
    border-bottom: 1px solid color-mix(in srgb, var(--brand) 80%, black);
    box-shadow: var(--shadow-sm);
    padding: 0.75rem 1rem !important;
    margin-bottom: 0;
    z-index: 1030;
    min-height: var(--header-height);
}

.navbar-top .container-fluid {
    min-height: calc(var(--header-height) - 1.5rem);
    display: flex;
    align-items: center;
}

.navbar-top .navbar-brand {
    color: var(--brand-contrast) !important;
    font-weight: 700;
    font-size: 1.25rem;
}

.navbar-top .nav-link {
    color: var(--brand-contrast) !important;
    font-weight: 500;
    font-size: 0.9375rem;
}

.navbar-top .nav-link:hover {
    color: var(--brand-contrast) !important;
    opacity: 0.85;
}

@media (min-width: 992px) {
    body.has-sidebar .main-content-wrapper {
        margin-left: var(--sidebar-width);
    }

    .sidebar {
        position: fixed !important;
        left: 0;
        top: 0;
        bottom: 0;
        width: var(--sidebar-width);
        height: 100vh;
        visibility: visible !important;
        transform: none !important;
        z-index: 1000;
        border-right: 1px solid var(--border-color);
        background-color: var(--white);
        box-shadow: var(--shadow-sm);
        overflow-y: auto;
        transition: width 0.3s ease;
    }

    .sidebar.offcanvas-start {
        --bs-offcanvas-width: var(--sidebar-width) !important;
    }

    .offcanvas-backdrop {
        display: none !important;
    }

    .sidebar-toggle,
    .sidebar .btn-close {
        display: none !important;
    }

    body.has-sidebar .navbar-top {
        margin-left: var(--sidebar-width);
        width: calc(100% - var(--sidebar-width));
    }

    body.has-sidebar.sidebar-collapsed .main-content-wrapper {
        margin-left: var(--sidebar-collapsed-width);
    }

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

    body.has-sidebar.sidebar-collapsed .navbar-top {
        margin-left: var(--sidebar-collapsed-width);
        width: calc(100% - var(--sidebar-collapsed-width));
    }

    body.has-sidebar.sidebar-collapsed .sidebar-header {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        justify-content: center;
    }

    body.has-sidebar.sidebar-collapsed .sidebar-title {
        flex: 0 0 auto;
        gap: 0;
    }

    body.has-sidebar.sidebar-collapsed .sidebar-title-text,
    body.has-sidebar.sidebar-collapsed .sidebar-text,
    body.has-sidebar.sidebar-collapsed .sidebar-chevron,
    body.has-sidebar.sidebar-collapsed .sidebar-divider,
    body.has-sidebar.sidebar-collapsed .sidebar-user-info,
    body.has-sidebar.sidebar-collapsed .sidebar-user-menu-btn {
        display: none !important;
    }

    body.has-sidebar.sidebar-collapsed .sidebar-link,
    body.has-sidebar.sidebar-collapsed .sidebar-sublink {
        justify-content: center;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    body.has-sidebar.sidebar-collapsed .sidebar-link i:first-child,
    body.has-sidebar.sidebar-collapsed .sidebar-user-avatar {
        margin: 0;
    }

    body.has-sidebar.sidebar-collapsed .sidebar-item-group .collapse {
        display: none !important;
    }

    body.has-sidebar.sidebar-collapsed .sidebar-footer {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    body.has-sidebar.sidebar-collapsed .sidebar-user {
        justify-content: center;
    }

    body.has-sidebar.sidebar-collapsed .sidebar-collapse-btn i {
        transform: rotate(180deg);
    }
}

@media (max-width: 991.98px) {
    .sidebar {
        width: 100% !important;
        max-width: var(--sidebar-width) !important;
        --bs-offcanvas-width: var(--sidebar-width);
    }

    .sidebar.offcanvas {
        --bs-offcanvas-width: var(--sidebar-width);
    }

    .navbar-top {
        padding-right: 60px;
    }

    .sidebar-toggle {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background-color: var(--brand);
        color: var(--white);
        border: none;
        box-shadow: var(--shadow-md);
        font-size: 1.25rem;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1040;
        cursor: pointer;
        transition: background-color 0.2s ease;
    }

    .sidebar-toggle:hover {
        background-color: color-mix(in srgb, var(--brand) 85%, black);
    }
}
