:root {
    --primary: #0a2472;      /* Azul profundo - autoridade */
    --primary-light: #1e3a8a;
    --primary-soft: #e8f0fe; /* Azul suave para fundos */
    --secondary: #334155;
    --success: #059669;      /* Verde elegante */
    --success-light: #d1fae5;
    --danger: #b91c1c;
    --danger-light: #fee2e2;
    --warning: #b45309;
    --warning-light: #ffedd5;
    --info: #2563eb;
    --info-light: #dbeafe;
    --dark: #0f172a;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --gradient-primary: linear-gradient(135deg, #0a2472 0%, #1e3a8a 100%);
    --gradient-success: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --gradient-info: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.5;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 30s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 3rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-header img {
    width: 100px;
    height: 100px;
    margin-bottom: 1.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    background: var(--white);
}

.login-header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.login-header p {
    color: var(--gray-600);
    font-size: 1rem;
    font-weight: 400;
}

/* Dashboard */
.dashboard {
    min-height: 100vh;
    background: var(--gray-50);
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 280px;
    background: var(--white);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: all 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--gray-200);
    background: linear-gradient(to right, var(--primary), var(--primary-light));
    margin-bottom: 1rem;
}

.sidebar-header img {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-lg);
    background: var(--white);
    padding: 0.25rem;
}

.sidebar-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--white);
}

.sidebar-header p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.sidebar-nav {
    padding: 1rem 0.5rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    color: var(--gray-700);
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 12px;
    margin: 0.25rem 0;
    font-weight: 500;
    gap: 0.75rem;
}

.sidebar-nav a i {
    width: 24px;
    font-size: 1.25rem;
    color: var(--gray-500);
    transition: all 0.3s ease;
}

.sidebar-nav a:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.sidebar-nav a:hover i {
    color: var(--primary);
}

.sidebar-nav a.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-nav a.active i {
    color: var(--primary);
}

.main-content {
    margin-left: 280px;
    padding: 2rem;
}

/* Top Navbar */
.top-navbar {
    background: var(--white);
    border-radius: 20px;
    padding: 1rem 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
    letter-spacing: -0.02em;
    position: relative;
    padding-left: 1rem;
    border-left: 4px solid var(--primary);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 1rem;
}

.user-role {
    font-size: 0.875rem;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border: 1px solid var(--gray-200);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, transparent 50%, var(--gray-100) 50%);
    border-radius: 0 20px 0 0;
    opacity: 0.5;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--primary-soft);
    color: var(--primary);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.stat-label {
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-success {
    background: var(--gradient-success);
    color: var(--white);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-outline {
    background: var(--white);
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 12px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.form-control.error {
    border-color: var(--danger);
    background: var(--danger-light);
}

.form-control.success {
    border-color: var(--success);
    background: var(--success-light);
}

/* Tables */
.table-container {
    background: var(--white);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 1rem 1rem;
    background: var(--gray-50);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-700);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    animation: slideDown 0.3s ease;
    border: 1px solid transparent;
    font-weight: 500;
}

.alert-success {
    background: var(--success-light);
    border-color: var(--success);
    color: var(--success);
}

.alert-danger {
    background: var(--danger-light);
    border-color: var(--danger);
    color: var(--danger);
}

.alert-warning {
    background: var(--warning-light);
    border-color: var(--warning);
    color: var(--warning);
}

.alert-info {
    background: var(--info-light);
    border-color: var(--info);
    color: var(--info);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--gray-100);
    color: var(--gray-700);
}

.badge-primary {
    background: var(--primary-soft);
    color: var(--primary);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .top-navbar {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .user-menu {
        width: 100%;
        justify-content: space-between;
    }
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Progress Bars */
.progress {
    height: 8px;
    background: var(--gray-200);
    border-radius: 20px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 20px;
    transition: width 0.3s ease;
}

/* Tooltips */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-900);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.75rem;
    white-space: nowrap;
    margin-bottom: 0.5rem;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

/* Tabs */
.tab-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
    color: var(--gray-700);
    transition: all 0.3s ease;
}

.tab-button:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.tab-button.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--white);
    border-radius: 20px;
    border: 2px dashed var(--gray-300);
}

.empty-state i {
    font-size: 3rem;
    color: var(--gray-400);
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--gray-500);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* ========================================
   NOVAS CLASSES PARA O DASHBOARD
   ======================================== */

/* Seção de Título */
.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 2.5rem 0 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: -0.02em;
}

.section-title i {
    font-size: 1.75rem;
    color: var(--primary);
    background: var(--primary-soft);
    padding: 0.5rem;
    border-radius: 12px;
}

/* Grid de Unidades */
.units-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Card de Unidade */
.unit-card {
    background: var(--white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border: 1px solid var(--gray-200);
}

.unit-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.unit-header {
    padding: 1.5rem;
    text-align: center;
    color: white;
}

.unit-header img {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    margin-bottom: 1rem;
    background: white;
    padding: 0.5rem;
    box-shadow: var(--shadow-lg);
}

.unit-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.unit-stats {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.unit-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--gray-200);
}

.unit-stat-label {
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
}

.unit-stat-value {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--gray-900);
}

.unit-actions {
    padding: 1rem 1.5rem 1.5rem;
    display: flex;
    gap: 0.75rem;
}

.btn-unit {
    flex: 1;
    padding: 0.625rem;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.875rem;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-unit.primary {
    background: var(--primary);
    color: white;
}

.btn-unit.primary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-unit.secondary {
    background: var(--white);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-unit.secondary:hover {
    background: var(--primary-soft);
    transform: translateY(-2px);
}

/* Grid de Gráficos */
.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.chart-card {
    background: var(--white);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
}

.chart-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--gray-300);
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-header {
    margin-bottom: 1.5rem;
}

.chart-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-header i {
    font-size: 1.25rem;
}

.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
}

/* Stats Cards com Trend */
.stat-trend {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-trend.positive {
    background: var(--success-light);
    color: var(--success);
}

.stat-trend.negative {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-trend.neutral {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* Responsividade */
@media (max-width: 768px) {
    .charts-row {
        grid-template-columns: 1fr;
    }
    
    .unit-actions {
        flex-direction: column;
    }
    
    .chart-container {
        height: 200px;
    }
}

/* Tooltips personalizados */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1rem;
    background: var(--gray-900);
    color: white;
    font-size: 0.75rem;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

[data-tooltip]:hover:before {
    opacity: 1;
    visibility: visible;
    bottom: 120%;
}

/* Loading overlay para gráficos */
.chart-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    backdrop-filter: blur(5px);
}

/* ========================================
   FILTRO GLOBAL
   ======================================== */

.filter-container {
    margin-bottom: 2rem;
}

.filter-box {
    background: var(--white);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.filter-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-soft);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.25rem;
}

.filter-form {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    flex: 1;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.filter-select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 10px;
    font-size: 0.875rem;
    color: var(--gray-800);
    background: var(--white);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 16px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.btn-filter {
    padding: 0.5rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-filter:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-filter-reset {
    width: 36px;
    height: 36px;
    background: var(--gray-100);
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid var(--gray-300);
}

.btn-filter-reset:hover {
    background: var(--gray-200);
    color: var(--gray-800);
    transform: translateY(-2px);
}

.filter-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary-soft);
    border-radius: 30px;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.875rem;
}

.filter-info i {
    font-size: 1rem;
}

/* Responsividade do filtro */
@media (max-width: 768px) {
    .filter-box {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .filter-icon {
        display: none;
    }
    
    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .btn-filter {
        width: 100%;
        justify-content: center;
    }
    
    .filter-info {
        justify-content: center;
    }
}

/* ========================================
   MINI MAPA INTERATIVO
   ======================================== */

.map-container {
    background: var(--white);
    border-radius: 24px;
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.map-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.map-title i {
    font-size: 1.75rem;
    color: var(--primary);
    background: var(--primary-soft);
    padding: 0.75rem;
    border-radius: 16px;
}

.map-title h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

.map-stats {
    display: flex;
    gap: 1.5rem;
    background: var(--gray-100);
    padding: 0.75rem 1.5rem;
    border-radius: 40px;
}

.map-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.map-stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
}

.map-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.map-preview {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    height: 300px;
    border: 2px solid var(--gray-200);
    transition: all 0.3s ease;
}

.map-preview:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.map-static {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.5s ease;
}

.map-preview:hover .map-static {
    transform: scale(1.05);
}

.map-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(10, 36, 114, 0.8) 0%, rgba(30, 58, 138, 0.8) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.map-preview:hover .map-overlay {
    opacity: 1;
}

.map-overlay-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem 2rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.map-preview:hover .map-overlay-content {
    transform: translateY(0);
}

.map-overlay-content i {
    font-size: 1.5rem;
    color: var(--primary);
}

.map-overlay-content span {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}

.map-fallback {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #0a2472 0%, #1e3a8a 100%);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    gap: 1rem;
    z-index: 1;
}

.map-fallback i {
    font-size: 3rem;
    color: var(--success);
}

.map-fallback span {
    font-size: 1.1rem;
    font-weight: 500;
}

.map-legend {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    display: flex;
    gap: 1rem;
    box-shadow: var(--shadow-md);
    z-index: 3;
    border: 1px solid var(--gray-200);
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-700);
}

.map-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

/* Responsividade */
@media (max-width: 768px) {
    .map-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .map-stats {
        width: 100%;
        justify-content: space-around;
    }
    
    .map-preview {
        height: 250px;
    }
    
    .map-legend {
        bottom: 0.5rem;
        right: 0.5rem;
        flex-direction: column;
        gap: 0.25rem;
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .map-stats {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .map-preview {
        height: 200px;
    }
}

/* ========================================
   NOVAS CLASSES PARA O CPM
   ======================================== */

/* ========================================
   DASHBOARD DOS CPAMS
   ======================================== */

.cpam-dashboard {
    background: var(--gray-50);
    min-height: 100vh;
}

.cpam-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 2rem;
    border-radius: 20px;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.cpam-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.cpam-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.cpam-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.cpam-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

/* ========================================
   CARDS DE UNIDADES DO CPAM
   ======================================== */

.unit-card-cpam {
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
}

.unit-card-cpam:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.unit-card-cpam .unit-header {
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.unit-card-cpam .unit-header img {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: white;
    padding: 0.25rem;
}

.unit-card-cpam .unit-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.unit-card-cpam .unit-body {
    padding: 1.5rem;
}

.unit-card-cpam .unit-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.unit-card-cpam .unit-stat {
    text-align: center;
    padding: 0.75rem;
    background: var(--gray-50);
    border-radius: 12px;
}

.unit-card-cpam .unit-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.unit-card-cpam .unit-stat-label {
    font-size: 0.75rem;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   LOGIN COM SELEÇÃO DE TIPO
   ======================================== */

.login-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: var(--gray-100);
    padding: 0.5rem;
    border-radius: 16px;
}

.login-tab {
    flex: 1;
    padding: 0.75rem;
    text-align: center;
    background: transparent;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
    color: var(--gray-600);
    transition: all 0.3s ease;
}

.login-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.login-tab:hover:not(.active) {
    background: var(--gray-200);
}

/* ========================================
   RELATÓRIOS
   ======================================== */

.relatorio-filters {
    background: var(--white);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.relatorio-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.relatorio-filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
}

.relatorio-filter-group select,
.relatorio-filter-group input {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.875rem;
}

.relatorio-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

/* ========================================
   MAPA E STATS
   ======================================== */

.stats-cvli {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-cvli-card {
    background: var(--white);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border-left: 4px solid;
    transition: all 0.3s ease;
}

.stat-cvli-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-cvli-card h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.stat-cvli-card .value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-cvli-card .trend {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Cores específicas para tipos de crime */
.stat-cvli-card.homicidio { border-left-color: #ef4444; }
.stat-cvli-card.feminicidio { border-left-color: #ec4899; }
.stat-cvli-card.latrocinio { border-left-color: #f59e0b; }
.stat-cvli-card.total { border-left-color: var(--primary); }

/* ========================================
   BOTÕES DE AÇÃO
   ======================================== */

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.btn-icon-sm {
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
}

/* ========================================
   TABELAS RESPONSIVAS
   ======================================== */

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table thead th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

/* ========================================
   PAGINAÇÃO
   ======================================== */

.pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 2rem;
}

.pagination-item {
    padding: 0.5rem 1rem;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-item:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
}

.pagination-item.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   LOADING STATES
   ======================================== */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ========================================
   MENSAGENS FLASH
   ======================================== */

.flash-message {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   GRÁFICOS E CHARTS
   ======================================== */

.chart-wrapper {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.chart-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* ========================================
   NOVOS ELEMENTOS CPM
   ======================================== */

/* Badge de unidade no header */
.unidade-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* Indicador de CPAM no dashboard */
.cpam-indicator {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Stats cards para CPAM */
.stats-cpam {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-cpam-card {
    background: var(--white);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.stat-cpam-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-cpam-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-cpam-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-top: 0.25rem;
}

/* Lista de unidades do CPAM */
.unidades-list {
    background: var(--white);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.unidade-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.unidade-item:last-child {
    border-bottom: none;
}

.unidade-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.unidade-info img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.unidade-nome {
    font-weight: 600;
    color: var(--gray-800);
}

.unidade-stats {
    display: flex;
    gap: 1rem;
}

.unidade-stat {
    text-align: center;
    min-width: 60px;
}

.unidade-stat-number {
    font-weight: 700;
    color: var(--primary);
}

.unidade-stat-label {
    font-size: 0.7rem;
    color: var(--gray-500);
}