@media print {
    /* Hide non-essential elements */
    .account-details,
    .navbar-nav,
    .main-nav-wrapper,
    .site-navigation,
    .breadcrumb,
    .site-footer,
    .menu-bars,
    .menu-trigger,
    .banner-alert,
    .upper-nav-search,
    footer,
    .btn-large,
    .container-fluid {
        display: none !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Keep and center the logo */
    .site-header {
        text-align: center;
        padding: 20px 0;
        margin: 0;
    }

    .upper-nav {
        text-align: center;
    }

    .brand {
        display: block;
        margin: 0 auto;
    }

    #logo {
        width: 200px;
        height: auto;
    }

    /* Reset page styling */
    body {
        margin: 0;
        padding: 20px;
        background: white;
        color: black;
    }

    /* Remove top spacing */
    form {
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Ensure content takes full width */
    .container,
    .row,
    #content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Force title to have consistent spacing */
    .title:first-of-type,
    h4.title {
        margin-top: 20px !important;
        margin-bottom: 10px !important;
        padding-top: 0 !important;
        page-break-after: avoid;
    }

    /* Prevent page break before first table */
    table:first-of-type {
        page-break-before: avoid;
    }

    /* Table styling for print */
    table {
        width: 100% !important;
        border-collapse: collapse;
        margin-top: 0 !important;
    }

    th, td {
        border: 1px solid #000;
        padding: 8px;
        text-align: left;
    }

        /* Remove borders from parent cells containing nested tables */
        td table {
            margin: 0 !important;
        }

        td:has(table) {
            border: none !important;
            padding: 0 !important;
        }

    /* Ensure nested tables take full width */
    table table {
        width: 100% !important;
        margin: 0 !important;
    }

    /* Remove background colors */
    * {
        background: white !important;
        color: black !important;
    }

    /* Ensure headings are bold */
    h3, h4, strong, th {
        font-weight: bold !important;
    }

    /* Page breaks */
    h3 {
        page-break-after: avoid;
    }

    tr {
        page-break-inside: avoid;
    }
}
