/* ================= RESET ================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* ================= BASE ================= */
html, body {
    width: 100%;
    min-height: 100%;
    font-family: "Segoe UI", Arial, sans-serif;
    background: #020617;
    color: #f8fafc;
    overflow-x: hidden;
}

/* ================= OVERLAY (MOBILE) ================= */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1999;
    display: none;
}
.overlay.active { display: block; }

/* ================= SIDEBAR ================= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: #020617;
    padding: 24px 18px;
    z-index: 2000;
    transform: translateX(0);
    transition: transform .35s ease;
}

/* LOGO */
.logo { text-align: center; margin-bottom: 30px; }
.logo img { max-width: 90px; margin-bottom: 8px; }
.logo div { font-weight: 700; font-size: 15px; }

/* MENU */
.menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 6px;
    border-radius: 12px;
    color: #cbd5f5;
    text-decoration: none;
}
.menu a:hover { background: rgba(56,189,248,.15); color: #38bdf8; }
.logout { color: #fca5a5 !important; }

/* ================= MAIN ================= */
.main {
    margin-left: 300px;
    padding: 28px;
    min-height: 100vh;
}

/* ================= TOPBAR ================= */
.topbar {
    background: rgba(255,255,255,.06);
    padding: 16px 22px;
    border-radius: 16px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 18px;
    font-weight: 600;
}

/* BOTÃO MOBILE */
.mobile-menu-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255,255,255,.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
}

/* ================= CONTENT ================= */
.content {
    background: rgba(255,255,255,.05);
    padding: 26px;
    border-radius: 18px;
}

/* ================= CARDS ================= */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 22px;
    margin-bottom: 30px;
}
.card {
    background: linear-gradient(160deg, rgba(56,189,248,.25), rgba(255,255,255,.05));
    padding: 26px;
    border-radius: 22px;
}
.card h3 { font-size: 14px; margin-bottom: 6px; }
.card p { font-size: 32px; font-weight: 700; color: #38bdf8; }

/* ================= TABLE ================= */
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 14px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
tr.alerta { background: rgba(239,68,68,.25); }

/* ================= BUTTONS ================= */
.btn {
    padding: 8px 14px;
    background: #38bdf8;
    color: #020617;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
}
.btn-danger { background: #ef4444; color: #fff; }

/* ================= LOGIN ================= */
.auth-page {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-box {
    background: #f8fafc;
    color: #020617;
    padding: 32px;
    border-radius: 22px;
    width: 360px;
}

/* ================= MOBILE ================= */
@media (max-width: 900px) {

    /* ESCONDE MENU NO MOBILE */
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.active {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
        padding: 20px;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* ESCONDE BOTÃO NO DESKTOP */
@media (min-width: 901px) {
    .mobile-menu-btn { display: none; }
}
/* ================= SAFARI FIX ================= */

/* Altura real no iOS */
.sidebar {
    height: 100%;
    min-height: 100vh;
}

/* Força transform no Safari */
.sidebar {
    -webkit-transform: translateX(0);
    transform: translateX(0);
    -webkit-transition: -webkit-transform .35s ease;
    transition: transform .35s ease;
}

@media (max-width: 900px) {
    .sidebar {
        -webkit-transform: translateX(-100%);
        transform: translateX(-100%);
    }

    .sidebar.active {
        -webkit-transform: translateX(0);
        transform: translateX(0);
    }
}

/* Garante clique no Safari */
.mobile-menu-btn {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Overlay clicável no Safari */
.overlay {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
