:root {
    --atepro-primary-bg: #1e293b;
    --atepro-sidebar-width: 260px;
    --atepro-mobile-header-height: 56px;
    --atepro-sidebar-mobile-width: 280px;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--atepro-sidebar-width);
    min-width: var(--atepro-sidebar-width);
    max-width: var(--atepro-sidebar-width);
    min-height: 100vh;
    height: 100vh;
    background: var(--atepro-primary-bg);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 1030;
}

.sidebar a,
.sidebar .nav-link,
.sidebar .btn {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar .nav-link {
    color: #cbd5e1;
    border-radius: .375rem;
    margin-bottom: .25rem;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: #334155;
    color: #fff;
}

.sidebar-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
}

.sidebar-logo img {
    max-height: 52px;
    max-width: 180px;
    object-fit: contain;
}

.sidebar-close {
    position: absolute;
    top: .5rem;
    right: .5rem;
    z-index: 1;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: none;
    border-radius: .375rem;
    background: transparent;
    color: #cbd5e1;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
}

.sidebar-close:hover {
    background: #334155;
    color: #fff;
}

.main-content {
    margin-left: var(--atepro-sidebar-width);
    width: calc(100% - var(--atepro-sidebar-width));
    min-height: 100vh;
    background: #f8fafc;
}

.mobile-header {
    display: none;
}

.sidebar-overlay {
    display: none;
}

/* Tabelas: scroll horizontal sem quebrar a página */
.main-content .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.main-content .table-responsive > .table {
    margin-bottom: 0;
    min-width: 36rem;
}

/* Cards do dashboard */
.dashboard-stat-card .card-body {
    word-break: normal;
    overflow-wrap: break-word;
}

.page-header {
    flex-wrap: wrap;
    gap: .75rem;
}

.auth-page {
    background: var(--atepro-primary-bg);
}

@media (max-width: 991.98px) {
    .mobile-header {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: var(--atepro-mobile-header-height);
        z-index: 1040;
        background: var(--atepro-primary-bg);
        align-items: center;
        padding: 0 1rem;
        gap: .75rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
    }

    .mobile-menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.5rem;
        height: 2.5rem;
        padding: 0;
        border: none;
        border-radius: .375rem;
        background: transparent;
        color: #fff;
        font-size: 1.5rem;
        line-height: 1;
        cursor: pointer;
        flex-shrink: 0;
    }

    .mobile-menu-btn:hover {
        background: #334155;
        color: #fff;
    }

    .mobile-header-logo {
        max-height: 36px;
        max-width: 140px;
        object-fit: contain;
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1035;
        background: rgba(15, 23, 42, .55);
        opacity: 0;
        visibility: hidden;
        transition: opacity .25s ease, visibility .25s ease;
    }

    body.sidebar-open .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .sidebar {
        width: var(--atepro-sidebar-mobile-width);
        max-width: 85vw;
        min-width: 0;
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 1045;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar .sidebar-logo {
        padding-right: 2rem;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding-top: calc(var(--atepro-mobile-header-height) + 1rem) !important;
    }
}

@media (min-width: 992px) {
    .sidebar-close {
        display: none !important;
    }
}

@media (max-width: 575.98px) {
    .dashboard-stat-card .display-6 {
        font-size: 2rem;
    }

    .main-content {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}
