/**
 * Shell flutuante (padrão novagrafica): menu fora do fluxo, revelado na borda esquerda.
 * Arquivo separado do app.css para não ser engolido pela otimização do @tailwindcss/vite.
 */

.app-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 100vh;
    gap: 0.9rem;
    padding: 0.9rem;
}

.sidebar-toggle {
    display: none;
}

.sidebar-backdrop {
    display: none;
}

.sidebar-reveal-zone {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 45;
    width: 14px;
    cursor: ew-resize;
}

.sidebar-reveal-zone::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 3px;
    width: 3px;
    height: 56px;
    border-radius: 999px;
    background: rgba(196, 163, 90, 0.35);
    transform: translateY(-50%);
    transition: background 0.2s ease, height 0.2s ease;
}

.sidebar-reveal-zone:hover::after,
body.is-sidebar-revealed .sidebar-reveal-zone::after {
    height: 72px;
    background: rgba(196, 163, 90, 0.7);
}

.sidebar {
    position: fixed;
    top: 0.9rem;
    bottom: 0.9rem;
    left: 0.9rem;
    z-index: 50;
    width: min(250px, calc(100vw - 1.8rem));
    overflow-y: auto;
    background: var(--navy, #1b2437);
    color: #f4efe6;
    border-radius: 28px;
    padding: 1.4rem 1rem 1.3rem;
    box-shadow: 0 18px 40px rgba(18, 24, 38, 0.18);
    transform: translate3d(-110%, 0, 0);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    will-change: transform;
}

body.is-sidebar-revealed .sidebar {
    transform: translate3d(0, 0, 0);
    box-shadow: 18px 0 48px rgba(18, 24, 38, 0.28);
}

.main {
    background: var(--cream, #fbf7f0);
    border-radius: 28px;
    padding: 1.4rem 1.6rem 2rem;
    box-shadow: 0 18px 40px rgba(18, 24, 38, 0.06);
    overflow-x: hidden;
    overflow-y: auto;
    min-width: 0;
    max-width: 100%;
    width: 100%;
}

.mobile-menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--navy, #1b2437);
    color: #fff;
    border-radius: 12px;
    padding: 0.45rem 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.main-toolbar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
}

.desktop-menu-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--muted, #6b6258);
    font-size: 0.82rem;
}

.desktop-menu-hint kbd {
    display: inline-block;
    padding: 0.15rem 0.45rem;
    border: 1px solid var(--line, #ddd4c6);
    border-radius: 8px;
    background: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

.card {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.table-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.table-scroll.bimestral-scroll {
    display: block;
    border: 1px solid var(--line, #ddd4c6);
    border-radius: 12px;
    background: #fff;
    margin: 0 0 0.75rem;
}

.table-scroll.bimestral-scroll > table.data {
    width: max-content;
    min-width: 100%;
    max-width: none;
    margin: 0;
}

.table-scroll.bimestral-scroll th,
.table-scroll.bimestral-scroll td {
    white-space: nowrap;
    font-size: 0.82rem;
}

.table-scroll.bimestral-scroll th {
    max-width: 9.5rem;
    white-space: normal;
    line-height: 1.25;
    vertical-align: bottom;
}

.table-scroll.bimestral-scroll th:first-child,
.table-scroll.bimestral-scroll td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
    min-width: 12rem;
    max-width: 16rem;
    white-space: normal;
    box-shadow: 6px 0 10px -8px rgba(18, 24, 38, 0.35);
}

.table-scroll.bimestral-scroll thead th:first-child {
    z-index: 3;
}

.table-scroll.bimestral-scroll td:not(:first-child) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
    .sidebar-reveal-zone {
        display: none;
    }

    .desktop-menu-hint {
        display: none;
    }

    .main-toolbar {
        display: flex;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 40;
        background: rgba(18, 24, 38, 0.42);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    .sidebar-toggle:checked ~ .sidebar-backdrop {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar {
        transform: translate3d(-110%, 0, 0);
    }

    .sidebar-toggle:checked ~ .app-shell .sidebar,
    body.is-sidebar-revealed .sidebar {
        transform: translate3d(0, 0, 0);
    }
}

@media print {
    .sidebar,
    .sidebar-reveal-zone,
    .sidebar-backdrop,
    .mobile-menu-button,
    .main-toolbar,
    .no-print,
    .flash {
        display: none !important;
    }

    .main {
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        background: #fff;
    }
}
