body {
    background: #f4f6fb;
    font-family: 'Segoe UI', sans-serif;
    overflow-x: hidden;
    margin: 0;
}

/* ================= LAYOUT ================= */

.wrapper {
    display: flex;
    width: 100%;
}

#content {
    width: 100%;
    min-height: 100vh;
    transition: all .3s;
}

/* 👉 MODO FULL (REMOVE SIDEBAR AUTOMATICAMENTE) */
.full-dashboard #sidebar {
    display: none !important;
}

.full-dashboard #content {
    margin-left: 0 !important;
    width: 100% !important;
}

/* ================= SIDEBAR ================= */

#sidebar {
    width: 240px;
    min-height: 100vh;
    background: linear-gradient(180deg, #217556, #174f3c);
    color: #fff;
    transition: all .3s;
}

#sidebar.collapsed {
    width: 70px;
}

#sidebar.collapsed .menu-text,
#sidebar.collapsed .sidebar-header h5 {
    display: none;
}

#sidebar .sidebar-header {
    padding: 20px;
    background: #0f3b2d;
    text-align: center;
}

#sidebar ul {
    padding: 0;
    margin: 0;
    list-style: none;
}

#sidebar ul li {
    padding: 12px 15px;
}

#sidebar ul li a {
    color: #d1d5db;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    transition: .2s;
}

#sidebar ul li a:hover {
    background: #307c4f;
    color: #fff;
    border-radius: 6px;
}

/* ================= TOPBAR ================= */

.topbar {
    background: #fff;
    padding: 10px 20px;
    box-shadow: 0 2px 10px rgba(52, 150, 83, .05);
}

/* ================= LOADING ================= */

#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, .85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ================= KPI ================= */

.kpi-card {
    border-radius: 10px;
    color: #fff;
    padding: 18px;
    text-align: center;
}

.kpi-card h6 {
    opacity: .85;
    font-size: 14px;
}

.kpi-card h3 {
    font-weight: 700;
    margin-top: 5px;
    font-size: 22px;
}

.kpi-1 { background: linear-gradient(135deg, #4f46e5, #6366f1); }
.kpi-2 { background: linear-gradient(135deg, #059669, #10b981); }
.kpi-3 { background: linear-gradient(135deg, #d97706, #f59e0b); }
.kpi-4 { background: linear-gradient(135deg, #dc2626, #ef4444); }
.kpi-5 { background: linear-gradient(135deg, #0ea5a4, #0f766e); }

/* ================= FILTRO ================= */

.filtro-box {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, .05);
}

/* ================= FULLSCREEN ================= */

.fullscreen {
    position: fixed !important;
    inset: 0;
    width: 100vw !important;
    height: 100vh !important;
    background: #fff;
    z-index: 9999;
    padding: 20px;
    overflow: hidden;
}

.fullscreen .card-body {
    height: calc(100vh - 80px);
    overflow: auto;
}

/* ================= TABELA ================= */

.tabela-container {
    width: 100%;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
}

/* wrapper */
.dataTables_wrapper {
    width: 100%;
    overflow-x: auto; /* 🔥 importante */
}

/* scroll interno */
.dataTables_scrollBody {
    max-height: 65vh !important;
}

/* tabela */
#tabelaHoras {
    width: 100% !important;
    border-collapse: collapse;
}

/* header fixo */
#tabelaHoras thead th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 10;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
}

/* células */
#tabelaHoras th,
#tabelaHoras td {
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 13px;
    text-align: center;

    /* 🔥 CONTROLE DE LARGURA */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#tabelaHoras {
    table-layout: fixed;
}

/* primeira coluna */
#tabelaHoras td:first-child {
    font-weight: 600;
    text-align: left;
    max-width: 220px;
}

/* zebra */
#tabelaHoras tbody tr:nth-child(even) {
    background: #fafafa;
}

/* hover */
#tabelaHoras tbody tr:hover {
    background: #eef6ff;
    transition: .15s;
}

/* paginação */
.dataTables_paginate {
    margin-top: 10px;
}

#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(6px);
    transition: opacity 0.3s ease;
}

.loading-hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-box {
    text-align: center;
    color: #fff;
    max-width: 400px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255,255,255,0.2);
    border-top: 5px solid #38bdf8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loadingTitulo {
    font-size: 22px;
    margin-bottom: 10px;
}

#loadingFrase {
    font-size: 14px;
    opacity: 0.8;
}

/* ================= RESPONSIVO ================= */

@media (max-width:768px) {

    #sidebar {
        position: fixed;
        left: -240px;
        z-index: 1000;
    }

    #sidebar.active {
        left: 0;
    }

    #sidebar.collapsed {
        width: 240px;
    }

    #sidebar.collapsed .menu-text {
        display: inline;
    }

    .kpi-destaque {
    border: 2px solid #dc3545;
    transform: scale(1.05);
    transition: 0.2s;
}

.badge {
    font-size: 12px;
    padding: 5px 8px;
}

    /* tabela melhor no mobile */
    #tabelaHoras th {
        white-space: normal;
    }

    #tabelaHoras td {
        white-space: nowrap;
    }

    #tabelaHoras {
        table-layout: auto;
    }
}