    /* Reset and Base Styles */
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    html {
        position: relative;
        min-height: 100%;
    }

    body {
        /* Use Bootstrap's default font stack if available, otherwise fallback */
        font-family: var(--bs-body-font-family, Arial, sans-serif);
        background-color: var(--bs-light, #f8f9fa); /* Use Bootstrap light background */
        color: var(--bs-body-color, #212529); /* Use Bootstrap body text color */
        padding-top: 60px; /* Match fixed navbar height */
        margin-left: 250px; /* Default margin for sidebar */
        transition: margin-left 0.3s ease-in-out;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }

    /* Navbar */
    .modern-navbar {
        background: var(--bs-white, #ffffff); /* Use Bootstrap white */
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        padding: 0 1.5rem;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 1030;
        height: 60px;
        display: flex;
        align-items: center;
        flex-shrink: 0;
        border-bottom: 1px solid var(--bs-border-color, #dee2e6); /* Optional: Add subtle border */
    }

    .modern-navbar .navbar-brand {
        color: var(--bs-primary, #0d6efd); /* Use Bootstrap primary color */
        font-weight: var(--bs-body-font-weight, 600); /* Use Bootstrap font weight */
        font-size: 1.5rem;
        display: flex;
        align-items: center;
        margin-right: 1rem;
    }

    .modern-navbar .navbar-brand i {
        margin-right: 0.6rem;
    }

    .modern-navbar .nav-link {
        color: var(--bs-nav-link-color, #495057); /* Use Bootstrap nav link color */
        font-weight: 500;
        padding: 0.5rem 1rem;
        transition: color 0.2s ease-in-out;
    }

    .modern-navbar .nav-link:hover,
    .modern-navbar .nav-link:focus {
        color: var(--bs-primary, #0d6efd); /* Use Bootstrap primary color on hover */
    }

    /* Toggler buttons */
    .navbar-toggler, .sidebar-toggle {
        border: none;
        background: transparent;
        padding: 0.5rem;
        color: var(--bs-dark, #343a40); /* Use Bootstrap dark color */
        font-size: 1.25rem;
        line-height: 1;
    }
     .navbar-toggler:focus, .sidebar-toggle:focus {
         outline: none;
         box-shadow: none;
     }

    .navbar-toggler-icon {
         /* Using Bootstrap's variables for the SVG stroke color if possible */
         /* Note: Direct variable injection into background-image URL might not work everywhere, fallback provided */
         background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(var(--bs-dark-rgb, 33, 37, 41), 0.75)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    }


    /* Sidebar */
    .modern-sidebar {
        width: 250px;
        background: var(--bs-dark, #212529); /* Use Bootstrap dark background */
        color: var(--bs-gray-400, #adb5bd); /* Use Bootstrap gray color */
        position: fixed;
        top: 60px;
        left: 0;
        height: calc(100vh - 60px);
        padding: 1.5rem 0;
        transform: translateX(0);
        transition: transform 0.3s ease-in-out;
        z-index: 1020;
        overflow-y: auto;
        flex-shrink: 0;
        border-right: 1px solid var(--bs-border-color-translucent, rgba(0,0,0,0.1)); /* Optional: Subtle border */
    }

    .modern-sidebar:not(.active) {
         transform: translateX(-250px);
    }

    .modern-sidebar .nav-link {
        color: var(--bs-gray-400, #ced4da); /* Use Bootstrap gray */
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
        display: flex;
        align-items: center;
        transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, border-left-color 0.2s ease-in-out;
        border-left: 3px solid transparent;
        white-space: nowrap;
    }

    .modern-sidebar .nav-link:hover {
        background-color: var(--bs-gray-800, #343a40); /* Use Bootstrap darker gray */
        color: var(--bs-white, #ffffff);
        border-left-color: var(--bs-gray-600, #495057);
    }

    .modern-sidebar .nav-link.active {
        background-color: var(--bs-primary, #0d6efd); /* Use Bootstrap primary */
        color: var(--bs-white, #ffffff);
        font-weight: 500;
        border-left-color: var(--bs-white, #ffffff);
    }

    .modern-sidebar .nav-link i.fa-fw {
        margin-right: 0.75rem;
        width: 1.25em;
        text-align: center;
    }

    .modern-sidebar .submenu-toggle {
        font-size: 0.75rem;
        transition: transform 0.2s ease-in-out;
        margin-left: auto;
    }

    .modern-sidebar .nav-link[aria-expanded="true"] .submenu-toggle {
        transform: rotate(180deg);
    }

    /* Submenu */
    .modern-sidebar .submenu {
        background-color: rgba(var(--bs-black-rgb), 0.15); /* Use Bootstrap black with alpha */
        padding-left: 0;
        margin: 0.5rem 0 0.5rem 1.5rem;
        list-style: none;
        border-left: 3px solid var(--bs-gray-700, #495057); /* Use Bootstrap gray */
        overflow: hidden;
    }

    .modern-sidebar .submenu .nav-item {
         margin-left: 0;
    }

    .modern-sidebar .submenu-link {
        padding: 0.6rem 1.5rem 0.6rem 1rem;
        font-size: 0.9rem;
        color: var(--bs-gray-500, #adb5bd); /* Use Bootstrap gray */
        display: flex;
        align-items: center;
        transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
        position: relative;
        border-left: 3px solid transparent;
        white-space: nowrap;
    }

    .modern-sidebar .submenu-link:hover {
        background-color: var(--bs-gray-700, #495057); /* Use Bootstrap gray */
        color: var(--bs-white, #ffffff);
        border-left-color: var(--bs-gray-500, #6c757d);
    }

    .modern-sidebar .submenu-link.active {
        background-color: var(--bs-primary, #0d6efd); /* Use Bootstrap primary */
        color: var(--bs-white, #ffffff);
        font-weight: 500;
        border-left-color: var(--bs-white, #ffffff);
    }

    .modern-sidebar .submenu-link i.fa-fw {
        margin-right: 0.5rem;
         width: 1.1em;
         text-align: center;
    }

    /* Main Content Area */
    .main-content {
        padding: var(--bs-spacer, 1rem) * 1.5; /* Use Bootstrap spacer variable */
        width: 100%;
        background-color: var(--bs-light, #f8f9fa); /* Use Bootstrap light */
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        overflow-y: auto;
    }

    .main-content-wrapper {
        background-color: var(--bs-body-bg, #ffffff); /* Use Bootstrap body background */
        padding: var(--bs-spacer, 1rem) * 1.5; /* Use Bootstrap spacer */
        border-radius: var(--bs-border-radius-lg, 8px); /* Use Bootstrap border radius */
        box-shadow: var(--bs-box-shadow-sm, 0 1px 3px rgba(0,0,0,0.1)); /* Use Bootstrap shadow */
        width: 100%;
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        border: 1px solid var(--bs-border-color, #dee2e6); /* Use Bootstrap border color */

        /* *** ADDED: Constrain width and center on large screens *** */
        max-width: 1200px; /* Adjust this value as needed */
        margin-left: auto;
        margin-right: auto;
        /* ********************************************************** */
    }

    /* Style for cards inside the wrapper */
    .main-content-wrapper .card {
        width: 100%;
        /* flex-grow: 1; */ /* Uncomment if one card should fill height */
        margin-bottom: var(--bs-spacer, 1rem) * 1.5; /* Use Bootstrap spacer */
        display: flex;
        flex-direction: column;
        /* Inherit border settings from Bootstrap card defaults or override */
        border: 1px solid var(--bs-border-color, #dee2e6);
        border-radius: var(--bs-card-border-radius, var(--bs-border-radius));
    }

    .main-content-wrapper .card .card-body {
        flex-grow: 1;
        padding: var(--bs-card-spacer-y, 1rem) var(--bs-card-spacer-x, 1rem); /* Use Bootstrap card padding */
    }

    .main-content-wrapper .card:last-child {
        margin-bottom: 0;
    }


    /* Footer */
    .modern-footer {
        background: var(--bs-tertiary-bg, #f8f9fa); /* Use Bootstrap tertiary background */
        color: var(--bs-secondary-color, #6c757d); /* Use Bootstrap secondary text color */
        text-align: center;
        padding: var(--bs-spacer, 1rem); /* Use Bootstrap spacer */
        border-top: 1px solid var(--bs-border-color, #dee2e6);
        height: 57px;
        flex-shrink: 0;
    }

    /* Overlay for mobile sidebar */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        height: calc(100vh - 60px);
        background-color: rgba(var(--bs-black-rgb), 0.5); /* Use Bootstrap black with alpha */
        z-index: 1010;
        cursor: pointer;
    }

    /* Responsive adjustments */
    @media (max-width: 991.98px) {
        body {
            margin-left: 0;
        }

        .modern-sidebar {
            box-shadow: 0 0 15px rgba(0,0,0,0.2);
        }

        .modern-sidebar.active ~ .sidebar-overlay {
             display: block;
         }

         /* Remove max-width constraint on smaller screens */
         .main-content-wrapper {
            max-width: none;
         }
    }

    /* Print styles (optional) */
    @media print {
        body {
            margin-left: 0 !important; padding-top: 0 !important; padding-bottom: 0 !important; display: block !important; min-height: auto !important; background-color: var(--bs-white) !important; color: var(--bs-black) !important;
        }
        .modern-navbar, .modern-sidebar, .modern-footer, .sidebar-overlay, .sidebar-toggle, .navbar-toggler { display: none !important; }
        .main-content { padding: 0 !important; width: 100% !important; min-height: auto !important; display: block !important; overflow-y: visible !important; background-color: transparent !important; }
        .main-content-wrapper { max-width: none !important; margin-left: 0 !important; margin-right: 0 !important; box-shadow: none !important; border: 1px solid #dee2e6 !important; padding: 1rem !important; border-radius: 0 !important; flex-grow: 0 !important; display: block !important; background-color: var(--bs-white) !important; }
        .main-content-wrapper .card { margin-bottom: 1rem !important; display: block !important; border: 1px solid #dee2e6 !important; border-radius: 0 !important; }
        .main-content-wrapper .card .card-body { flex-grow: 0 !important; }
        .modern-footer { position: static !important; flex-shrink: 1 !important; color: var(--bs-black) !important; background-color: transparent !important; border-top: 1px solid #dee2e6 !important; }
    }
    