body { background-color: #f4f7f6; font-family: 'Inter', 'Segoe UI', sans-serif; margin: 0; color: #333; overflow-x: hidden; }
.admin-layout { display: flex; min-height: 100vh; overflow-x: hidden; }
.sidebar { width: 250px; background: #2b3990; color: white; padding: 30px 20px; box-shadow: 2px 0 5px rgba(0,0,0,0.1); z-index: 10; }
.sidebar h2 { margin-top: 0; font-size: 24px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 15px; }
.sidebar a { display: block; padding: 12px 15px; border-radius: 8px; transition: background 0.2s; margin-bottom: 10px; font-weight: 500; }
.sidebar a:hover { background: rgba(255,255,255,0.1); }

/* O Segredo dos 900px */
.main-wrapper { flex: 1; display: flex; justify-content: center; padding: 40px 20px; overflow-y: auto; }
.main-content { width: 100%; max-width: 900px; display: flex; flex-direction: column; gap: 24px; }

/* Cards Flat Design */
.card { background: #ffffff; border-radius: 12px; padding: 30px; box-shadow: 0 4px 15px rgba(0,0,0,0.03); border: 1px solid #eef0f2; }
.card h3 { margin-top: 0; color: #2b3990; font-size: 20px; margin-bottom: 20px; }

/* Inputs Modernos (Sem aparência nativa) */
input[type="text"], input[type="number"], input[type="date"], select {
    width: 100%; padding: 14px; border: 1px solid #ddd; border-radius: 8px; font-size: 15px; outline: none; transition: border-color 0.2s; box-sizing: border-box; background: #fdfdfd; appearance: none;
}
input:focus, select:focus { border-color: #f39200; background: #fff; box-shadow: 0 0 0 3px rgba(243, 146, 0, 0.1); }

/* Botões */
button, .btn-primary { background: #f39200; color: white; border: none; padding: 14px 24px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 15px; transition: background 0.2s; width: auto; }
button:hover, .btn-primary:hover { background: #d88100; }

/* Tabela Limpa */
table { width: 100%; border-collapse: collapse; margin-top: 15px; }
th, td { padding: 15px; text-align: left; border-bottom: 1px solid #eee; }
th { background: #f9fbfd; color: #555; font-weight: 600; border-radius: 8px 8px 0 0; }

/* Botão Relatório */
.btn-relatorio { background-color: #f4f7f6; color: #2b3990; border: 1px solid #cdd4e0; font-weight: bold; cursor: pointer; padding: 10px; border-radius: 8px; transition: background 0.2s; }
.btn-relatorio:hover { background-color: #e2e8f0; }

.modal-btn { padding: 14px; border-radius: 8px; font-weight: 600; border: none; cursor: pointer; transition: 0.2s; width: 100%; text-align: center; margin-bottom: 10px; font-size: 15px; display: block; }
.btn-salvar { background: #00b894; color: white; }
.btn-salvar:hover { background: #00a080; }
.btn-emitir { background: #f39200; color: white; }
.btn-emitir:hover { background: #d88100; }
.btn-excluir { background: #ffebee; color: #d63031; border: 1px solid #ffccd5; }
.btn-excluir:hover { background: #ffccd5; }

/* Toast Notifications */
.toast {
    visibility: hidden; min-width: 250px; background-color: #333; color: #fff; text-align: center; border-radius: 8px;
    padding: 16px; position: fixed; z-index: 9999; left: 50%; bottom: 30px; transform: translateX(-50%); font-size: 15px; font-weight: bold;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2); transition: visibility 0s, opacity 0.5s linear; opacity: 0;
}
.toast.show { visibility: visible; opacity: 1; }

.sidebar-logo { max-width: 80%; margin-bottom: 30px; filter: brightness(0) invert(1); }

.sidebar ul { list-style: none; padding: 0; margin: 0; }
.sidebar li { margin-bottom: 12px; }
.sidebar a { display: flex; align-items: center; padding: 12px 18px; color: #fff; text-decoration: none; font-weight: 600; border-radius: 8px; transition: all 0.3s ease; background: rgba(255,255,255,0.05); }
.sidebar a:hover { background: rgba(255,255,255,0.2); transform: translateX(5px); }
.btn-logout { background: rgba(255, 77, 77, 0.2) !important; color: #ffcccc !important; border: 1px solid rgba(255, 77, 77, 0.3); }
.btn-logout:hover { background: rgba(255, 77, 77, 0.4) !important; color: #fff !important; }


/* Modal de Despacho Fix */
#modal-despacho .card { max-width: 500px; width: 90%; }
#modal-despacho select,
#modal-despacho input[type="text"],
#modal-despacho textarea {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    margin-bottom: 16px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    box-sizing: border-box;
    background-color: #f9f9fc;
}
#modal-despacho textarea { min-height: 100px; resize: vertical; }
#dossie-texto { background-color: #e9ecef; color: #495057; border: 1px dashed #adb5bd; }
.botoes-acao-despacho { display: flex; justify-content: space-between; margin-bottom: 15px; }
.btn-whatsapp, .btn-email { width: 48%; color: white;}
.btn-whatsapp { background-color: #25D366;}
.btn-email { background-color: #007bff;}

/* ========================================= */
/* RESPONSIVIDADE MOBILE                     */
/* ========================================= */
@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column;
    }

    /* Barra inferior (Bottom Navigation) */
    .sidebar {
        width: 100%;
        height: 60px;
        position: fixed;
        bottom: 0;
        left: 0;
        padding: 0;
        z-index: 1000;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }
    
    .sidebar-logo, .sidebar h2 {
        display: none;
    }

    .sidebar nav {
        width: 100%;
    }

    .sidebar ul {
        display: flex;
        width: 100%;
        justify-content: space-around;
        align-items: center;
        height: 100%;
        margin: 0;
    }

    .sidebar li {
        margin: 0;
        flex: 1;
        display: flex;
        justify-content: center;
    }

    .sidebar a {
        padding: 10px;
        margin: 0;
        width: 100%;
        justify-content: center;
        border-radius: 0;
        background: transparent !important;
        border: none !important;
        flex-direction: column;
        gap: 5px;
    }
    
    .sidebar a i {
        font-size: 20px;
    }

    .sidebar a span {
        display: none; /* Oculta o texto conforme solicitado */
    }

    /* Ajuste do conteúdo principal para não ficar sob a barra inferior */
    .main-wrapper {
        padding: 20px 10px 80px 10px; /* 80px de padding-bottom para a barra */
    }
    
    /* Tabelas responsivas (rolagem horizontal) */
    table {
        display: block !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
    }

    /* Ajuste de grids (BI, etc) */
    .card {
        padding: 15px;
    }
    
    .bloco-filtros-bi {
        flex-direction: column;
        align-items: stretch !important;
    }
    
    .bloco-filtros-bi button, .bloco-filtros-bi select {
        width: 100%;
    }
}
