/* ===== VARIÁVEIS ===== */
:root {
    --apae-blue:    #1565C0;
    --apae-blue-d:  #0D47A1;
    --apae-yellow:  #FFC107;
    --sidebar-w:    240px;
}

/* ===== GERAL ===== */
body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: .9rem;
}

/* ===== NAVBAR ===== */
.bg-apae {
    background-color: var(--apae-blue) !important;
}

/* ===== SIDEBAR DESKTOP ===== */
.sidebar-desktop {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-desktop .nav-link {
    border-radius: .375rem;
    transition: background .15s;
    font-size: .875rem;
}
.sidebar-desktop .nav-link:hover {
    background: rgba(255,255,255,.1);
}
.sidebar-desktop .nav-link.active {
    background: var(--apae-blue) !important;
}

/* ===== MAIN ===== */
@media (min-width: 992px) {
    main.flex-grow-1 {
        margin-left: var(--sidebar-w);
    }
}

/* ===== CARDS ===== */
.card {
    border: none;
    border-radius: .75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(0,0,0,.08);
    font-weight: 600;
}

/* ===== STAT CARDS ===== */
.stat-card {
    border-radius: .75rem;
    color: #fff;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.stat-card .icon {
    font-size: 2.5rem;
    opacity: .85;
}
.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}
.stat-card .label {
    font-size: .8rem;
    opacity: .9;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ===== TABELAS ===== */
.table-apae thead th {
    background: var(--apae-blue);
    color: #fff;
    font-weight: 500;
    border: none;
    white-space: nowrap;
}
.table-apae tbody tr:hover {
    background: rgba(21,101,192,.05);
}
.table-responsive { border-radius: .5rem; overflow: hidden; }

/* ===== MODAIS ===== */
.modal-header {
    background: var(--apae-blue);
    color: #fff;
    border-radius: calc(.375rem - 1px) calc(.375rem - 1px) 0 0;
}
.modal-header .btn-close { filter: invert(1); }

/* ===== BADGES HIERARQUIA ===== */
.badge-nacional { background: #C62828; }
.badge-estadual  { background: #1565C0; }
.badge-regional  { background: #F57F17; color:#212529; }
.badge-local     { background: #2E7D32; }

/* ===== LOGIN ===== */
.login-card {
    max-width: 420px;
    width: 100%;
}
.login-brand {
    color: var(--apae-blue);
    font-size: 1.8rem;
    font-weight: 700;
}

/* ===== FORM FEEDBACK ===== */
.field-error { font-size: .8rem; color: #dc3545; margin-top: .25rem; }

/* ===== UTILITÁRIOS ===== */
.cursor-pointer { cursor: pointer; }
.text-apae { color: var(--apae-blue) !important; }
.bg-apae-light { background: rgba(21,101,192,.07); }

/* ===== LOADING OVERLAY ===== */
#loadingOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.7);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
#loadingOverlay.show { display: flex; }

/* ===== PRINT ===== */
@media print {
    .sidebar-desktop, nav.navbar, .btn, .modal { display: none !important; }
    main { margin-left: 0 !important; padding-top: 0 !important; }
}
