:root { 
    --primary-color: #0056b3; 
    --secondary-color: #f4f7f6; 
    --text-color: #333; 
    --border-color: #ddd; 
    --sidebar-bg: #003d82; 
    --sidebar-hover: #0056b3;
    --card-bg: #ffffff;
}

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background-color: var(--secondary-color); 
    color: var(--text-color); 
    margin: 0; 
    padding: 20px; 
}

body.has-sidebar { 
    padding: 0; 
    background-color: var(--secondary-color); 
}

/* ======== MENU LATERAL ======== */
.sidebar { 
    width: 250px; 
    background-color: var(--sidebar-bg); 
    color: white; 
    position: fixed; 
    top: 0; 
    left: 0; 
    height: 100vh; 
    display: flex; 
    flex-direction: column; 
    box-shadow: 2px 0 10px rgba(0,0,0,0.15); 
    z-index: 1000; 
    transition: width 0.3s ease; 
    overflow-x: hidden; 
    white-space: nowrap; 
}
.sidebar-header { 
    background-color: #002b5e; 
    padding: 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    font-size: 16px; 
    font-weight: bold; 
    color: #fff; 
    border-bottom: 1px solid rgba(255,255,255,0.1); 
}
.sidebar a { 
    padding: 15px 20px; 
    color: #e0e0e0; 
    text-decoration: none; 
    border-bottom: 1px solid rgba(255,255,255,0.05); 
    display: flex; 
    align-items: center; 
    font-size: 14px; 
    transition: all 0.2s; 
    border-left: 4px solid transparent; 
}
.sidebar a:hover { 
    background-color: var(--sidebar-hover); 
    color: white; 
    border-left: 4px solid #ffc107; 
}
.sidebar .menu-label { 
    font-size: 11px; 
    text-transform: uppercase; 
    color: #a0c4ff; 
    padding: 20px 20px 5px 20px; 
    font-weight: bold; 
    letter-spacing: 1px; 
    transition: opacity 0.3s, height 0.3s, padding 0.3s; 
}

/* ======== DROPDOWN SUBMENU ======== */
.sidebar .dropdown-btn { 
    padding: 15px 20px; 
    text-decoration: none; 
    font-size: 14px; 
    color: #e0e0e0; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    border: none; 
    background: none; 
    width: 100%; 
    text-align: left; 
    cursor: pointer; 
    outline: none; 
    border-bottom: 1px solid rgba(255,255,255,0.05); 
    border-left: 4px solid transparent; 
    transition: all 0.2s; 
    font-family: inherit; 
}
.sidebar .dropdown-btn:hover, .sidebar .dropdown-btn.active { 
    background-color: var(--sidebar-hover); 
    color: white; 
    border-left: 4px solid #ffc107; 
}
.sidebar .dropdown-container { display: none; background-color: #00224a; }
.sidebar .dropdown-container a { padding: 12px 20px 12px 40px; font-size: 13px; border-bottom: none; }

.main-content { 
    margin-left: 250px; 
    padding: 30px; 
    transition: margin-left 0.3s ease; 
}
.main-content .header { 
    background-color: transparent; 
    box-shadow: none; 
    padding: 0 0 20px 0; 
    margin-bottom: 20px; 
    border-bottom: 2px solid var(--border-color); 
    border-radius: 0; 
}

/* === MODO RECOLHIDO (COLLAPSED) === */
.sidebar.collapsed { width: 70px; }
.sidebar.collapsed .sidebar-header .logo-text { display: none; }
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 20px 0; }
.sidebar.collapsed .menu-label { opacity: 0; pointer-events: none; height: 0; padding: 0; margin: 0; overflow: hidden; }
.sidebar.collapsed .link-text { display: none; }
.sidebar.collapsed .seta { display: none; }
.sidebar.collapsed a, .sidebar.collapsed .dropdown-btn, .sidebar.collapsed .dropdown-container a { padding: 15px 0; justify-content: center; }
.sidebar.collapsed .dropdown-btn div { display: flex; justify-content: center; width: 100%; }
.main-content.expanded { margin-left: 70px; }
.toggle-btn { background: none; border: none; color: white; font-size: 22px; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; transition: color 0.2s; }
.toggle-btn:hover { color: #ffc107; }

/* ======== ESTILOS GERAIS ======== */
.header { display: flex; justify-content: space-between; align-items: center; background-color: white; padding: 15px 30px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin-bottom: 20px; }
h1 { margin: 0; color: var(--primary-color); font-size: 24px; }
.btn-group { display: flex; gap: 10px; align-items: center; }
button, .btn, .btn-link { background-color: var(--primary-color); color: white; border: none; padding: 8px 15px; border-radius: 5px; cursor: pointer; font-weight: bold; text-decoration: none; transition: background 0.3s; font-size: 14px; text-align: center; }
button:hover, .btn:hover, .btn-link:hover { background-color: #004494; }
.btn-success { background-color: #28a745; } .btn-success:hover { background-color: #218838; }
.btn-warning { background-color: #ffc107; color: black; } .btn-warning:hover { background-color: #e0a800; }
.btn-danger { background-color: #dc3545; } .btn-danger:hover { background-color: #c82333; }
.btn-info { background-color: #17a2b8; } .btn-info:hover { background-color: #138496; }
.btn-purple { background-color: #6f42c1; } .btn-purple:hover { background-color: #5a32a3; }

.card { background-color: var(--card-bg); padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin-bottom: 20px; }

/* ======== DASHBOARD GRID (NOVO) ======== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.module-card {
    background-color: var(--card-bg);
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    border-top: 4px solid var(--primary-color);
}
.module-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}
.module-card h3 {
    margin-top: 0;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}
.module-card p {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
}
.module-card .btn {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    box-sizing: border-box;
}

table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
th, td { padding: 10px; text-align: left; border-bottom: 1px solid var(--border-color); }
th { background-color: #f8f9fa; color: #555; font-weight: 600; }
tr:hover { background-color: #f1f1f1; }
input, select { padding: 8px; border: 1px solid var(--border-color); border-radius: 4px; width: 100%; box-sizing: border-box; margin-bottom: 10px;}
.form-row { display: flex; gap: 15px; }
.form-group { flex: 1; }

.kpi-container { display: flex; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.kpi-card { flex: 1; min-width: 200px; background: white; padding: 20px; border-radius: 8px; text-align: center; box-shadow: 0 2px 4px rgba(0,0,0,0.1); border-left: 4px solid var(--primary-color); }
.kpi-title { font-size: 14px; color: #666; text-transform: uppercase; letter-spacing: 1px; }
.kpi-value { font-size: 32px; font-weight: bold; margin: 10px 0; color: #333; }

.badge { padding: 4px 8px; border-radius: 12px; font-size: 12px; font-weight: bold; color: white; }
.bg-success { background-color: #28a745; }
.bg-danger { background-color: #dc3545; }
.bg-info { background-color: #17a2b8; }
.bg-warning { background-color: #ffc107; color: black; }
.bg-purple { background-color: #6f42c1; }

dialog { border: none; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); padding: 20px; width: 80%; max-width: 800px; }
dialog::backdrop { background: rgba(0,0,0,0.5); }
