:root {
    --primary: #0F172A;
    --secondary: #1E293B;
    --accent: #3B82F6;
    --accent-hover: #2563EB;
    --bg: #F8FAFC;
    --panel: #FFFFFF;
    --text: #0F172A;
    --text-light: #64748B;
    --border: #E2E8F0;
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}
/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout de Login */
.login-container {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    position: relative;
    overflow: hidden;
}

.login-left {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 60px;
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    border-radius: 50%;
}

.login-left::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
    bottom: -150px;
    left: -150px;
    border-radius: 50%;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    z-index: 1;
}

.brand-icon {
    width: 48px;
    height: 48px;
    background: var(--accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-name {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.login-hero {
    z-index: 1;
    max-width: 480px;
}

.login-hero h1 {
    font-size: 42px;
    font-weight: 800;
    color: white;
    margin-bottom: 24px;
    line-height: 1.2;
    letter-spacing: -0.03em;
}

.login-hero p {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.7;
    margin-bottom: 40px;
}

.features {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(8px);
}

.feature-icon {
    width: 44px;
    height: 44px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.feature-content h3 {
    color: white;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.feature-content p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    margin: 0;
}

.login-footer {
    z-index: 1;
}

.login-footer p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

.developer-badge {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
}

.developer-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.developer-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.developer-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.developer-name {
    font-size: 18px;
    color: white;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.login-right {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    background: var(--panel);
}

.login-form-wrapper {
    width: 100%;
    max-width: 440px;
}

.login-header {
    margin-bottom: 40px;
}

.login-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.login-header p {
    color: var(--text-light);
    font-size: 16px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-light);
}

.form-control {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    color: var(--text);
    background: var(--panel);
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.form-control::placeholder {
    color: var(--text-light);
}

.btn-primary {
    width: 100%;
    padding: 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 32px 0;
    color: var(--text-light);
    font-size: 14px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.divider span {
    padding: 0 16px;
}

.alternative-links {
    text-align: center;
}

.alternative-links a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: color 0.2s ease;
}

.alternative-links a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: #111827; color: white; padding: 20px; }
.sidebar h3 { margin-top: 0; }
.sidebar ul { list-style: none; padding: 0; }
.sidebar li { margin: 10px 0; }
.sidebar a { color: white; }
.content { flex: 1; padding: 24px; background: var(--bg); }

/* Alertas */
.alert {
    padding: 16px 20px;
    border-radius: 10px;
    margin-bottom: 24px;
    border-left: 4px solid;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.alert-success {
    background: #ECFDF5;
    border-color: var(--success);
    color: #065F46;
}

.alert-error {
    background: #FEF2F2;
    border-color: var(--error);
    color: #991B1B;
}

.alert-warning {
    background: #FFFBEB;
    border-color: var(--warning);
    color: #92400E;
}

.alert-info {
    background: #EFF6FF;
    border-color: #3B82F6;
    color: #1E40AF;
}

/* Credenciais de teste */
.test-credentials {
    margin-top: 32px;
    padding: 20px;
    background: #F8FAFC;
    border: 2px solid var(--border);
    border-radius: 12px;
}

.test-credentials summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
    padding: 8px;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.test-credentials summary::-webkit-details-marker {
    display: none;
}

.test-credentials summary::after {
    content: '▼';
    font-size: 12px;
    color: var(--text-light);
    transition: transform 0.2s ease;
}

.test-credentials[open] summary::after {
    transform: rotate(-180deg);
}

.credentials-list {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.credential-item {
    padding: 16px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.credential-item strong {
    color: var(--accent);
    font-size: 13px;
    display: block;
    margin-bottom: 8px;
}

.credential-item p {
    margin: 4px 0;
    font-size: 13px;
    color: var(--text-light);
    font-family: 'Consolas', 'Monaco', monospace;
}

/* Responsive */
@media (max-width: 1024px) {
    .login-container {
        grid-template-columns: 1fr;
    }
    
    .login-left {
        display: none;
    }
    
    .login-right {
        padding: 40px 24px;
    }
}

@media (max-width: 640px) {
    .login-right {
        padding: 32px 20px;
    }
    
    .login-form-wrapper {
        max-width: 100%;
    }
    
    .login-header h2 {
        font-size: 28px;
    }
    
    .form-control {
        padding: 12px 16px 12px 44px;
    }
    
    .btn-primary {
        padding: 14px;
    }
}

/* Tabelas */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}
th {
    background: #f9fafb;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}
td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
}
tr:hover {
    background: #f9fafb;
}

/* Cards */
.card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}
.card h3 {
    margin-top: 0;
    color: var(--accent);
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-error { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }



/* ============================================
   DASHBOARD E SISTEMA GERAL
   ============================================ */

/* Layout Principal */
.layout { 
    display: flex; 
    min-height: 100vh;
    background: var(--bg);
}

/* Sidebar - Design Moderno Recolhível */
/* ==============================================================================
   SIDEBAR ULTRA CLEAN & PRO - WHITE EDITION COM SUBMENU EXPANSÍVEL
   ============================================================================== */

.sidebar { 
    width: 280px; 
    background: #FFFFFF;
    color: #0F172A; 
    padding: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    border-right: 1px solid #E5E7EB;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.04);
}

/* Nav Section com Accordion - CORRIGIDO */
.nav-section {
    margin-bottom: 12px;
}

.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    border-radius: 8px;
    margin: 0 12px;
}

.nav-section-header:hover {
    background: #F9FAFB;
}

.nav-section-header:active {
    background: #F1F5F9;
    transform: scale(0.98);
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #94A3B8;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.25s ease;
    flex: 1;
}

.nav-section-icon {
    width: 10px;
    height: 10px;
    color: #94A3B8;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    stroke-width: 2.5;
}

.nav-section.expanded .nav-section-icon {
    transform: rotate(180deg);
}

.nav-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
}

.nav-section.expanded .nav-section-content {
    max-height: 1000px;
    opacity: 1;
}

.nav-section-content ul {
    padding-top: 4px;
}

.sidebar.collapsed .nav-section-header {
    justify-content: center;
    padding: 10px 16px;
    margin: 0 8px;
}

.sidebar.collapsed .nav-section-title {
    opacity: 0;
    width: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
}

.sidebar.collapsed .nav-section-icon {
    display: none;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.12);
}

.sidebar.collapsed {
    width: 72px;
}

/* Toggle Button - Ultra Clean White */
.sidebar-toggle {
    position: absolute;
    right: -14px;
    top: 28px;
    width: 28px;
    height: 28px;
    background: #FFFFFF;
    border: 2px solid #E5E7EB;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.sidebar-toggle:hover {
    background: #3B82F6;
    border-color: #3B82F6;
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.sidebar-toggle:hover svg {
    color: white;
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

.sidebar-toggle svg {
    width: 14px;
    height: 14px;
    color: #64748B;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* Header - Minimalist White */
.sidebar-header {
    padding: 28px 24px;
    border-bottom: 1px solid #F1F5F9;
    position: relative;
    background: #FAFBFC;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.25);
    transition: all 0.3s ease;
}

.sidebar-brand:hover .sidebar-brand-icon {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.35);
}

.sidebar-brand-icon svg {
    width: 22px;
    height: 22px;
    color: white;
}

.sidebar-brand-text {
    overflow: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.sidebar.collapsed .sidebar-brand-text {
    opacity: 0;
    transform: translateX(-12px);
    pointer-events: none;
}

.sidebar-brand-name {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 2px;
    color: #0F172A;
}

.sidebar-user {
    font-size: 12px;
    color: #64748B;
    font-weight: 500;
}

/* Navigation - Clean & Modern White */
.sidebar-nav {
    padding: 16px 0;
    flex: 1;
    background: #FFFFFF;
}

.sidebar ul { 
    list-style: none; 
    padding: 0;
    margin: 0;
}

.sidebar li { 
    margin: 0;
    position: relative;
}

.sidebar a { 
    color: #64748B;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 24px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: 500;
    position: relative;
    margin: 0 12px;
    border-radius: 10px;
}

.sidebar a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    border-radius: 0 3px 3px 0;
    transition: all 0.2s ease;
}

.sidebar a:hover {
    background: #F8FAFC;
    color: #0F172A;
}

.sidebar a:hover::before {
    background: #3B82F6;
}

.sidebar a.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(37, 99, 235, 0.08) 100%);
    color: #3B82F6;
    font-weight: 600;
}

.sidebar a.active::before {
    background: #3B82F6;
}

.sidebar a.active .nav-icon {
    color: #3B82F6;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.nav-icon svg {
    width: 20px;
    height: 20px;
}

.sidebar a:hover .nav-icon {
    transform: scale(1.08);
}

.nav-text {
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    transform: translateX(-8px);
}

/* Tooltip para sidebar recolhida - Clean White */
.sidebar.collapsed a {
    justify-content: center;
    position: relative;
    margin: 0 8px;
    padding: 11px;
}

.sidebar.collapsed a::before {
    display: none;
}

.sidebar.collapsed a::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(12px);
    background: #0F172A;
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 1001;
}

.sidebar.collapsed a:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(16px);
}

/* Footer - Ultra Pro */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid #F1F5F9;
    background: transparent;
}

.btn-logout {
    width: 100%;
    padding: 11px 24px;
    background: transparent;
    color: #64748B;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    position: relative;
    margin: 0;
}

.btn-logout::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    border-radius: 0 3px 3px 0;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: #FEF2F2;
    color: #DC2626;
    transform: none;
}

.btn-logout:hover::before {
    background: #DC2626;
}

.btn-logout svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.btn-logout span {
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.sidebar.collapsed .btn-logout {
    padding: 11px;
    justify-content: center;
    margin: 0;
}

.sidebar.collapsed .btn-logout span {
    opacity: 0;
    transform: translateX(-8px);
}

.sidebar.collapsed .btn-logout::before {
    display: none;
}

.sidebar.collapsed .btn-logout::after {
    content: 'Sair';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(12px);
    background: #0F172A;
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 1001;
}

.sidebar.collapsed .btn-logout:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(16px);
}

/* Content Area Adjustments */
.content { 
    flex: 1; 
    padding: 0;
    margin-left: 280px;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-collapsed .content {
    margin-left: 72px;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 260px;
    }
    
    .sidebar.collapsed {
        width: 68px;
    }
    
    .content {
        margin-left: 260px;
    }
    
    .sidebar-collapsed .content {
        margin-left: 68px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }
    
    .sidebar.collapsed {
        width: 280px;
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .content {
        margin-left: 0 !important;
    }
}
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--accent);
    border-radius: 50%;
    border: none;
    color: white;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    z-index: 999;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(59, 130, 246, 0.5);
}

.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Overlay para mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
}

@media (max-width: 768px) {
    .sidebar-overlay {
        display: block;
    }
}

/* Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ==============================================================================
   SISTEMA DE TOAST (MENSAGENS)
   ============================================================================== */

.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    min-width: 320px;
    max-width: 480px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    z-index: 10000;
    animation: toastSlideIn 0.3s ease-out;
    border-left: 4px solid var(--accent);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

.toast.hiding {
    animation: toastSlideOut 0.3s ease-in forwards;
}

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.toast-icon svg {
    width: 100%;
    height: 100%;
}

.toast-content {
    flex: 1;
}

.toast-message {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.5;
}

.toast-close {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

.toast-close svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-light);
}

/* Toast Success */
.toast-success {
    border-left-color: var(--success);
}

.toast-success .toast-icon svg {
    stroke: var(--success);
}

/* Toast Error */
.toast-error {
    border-left-color: var(--error);
}

.toast-error .toast-icon svg {
    stroke: var(--error);
}

/* Toast Warning */
.toast-warning {
    border-left-color: var(--warning);
}

.toast-warning .toast-icon svg {
    stroke: var(--warning);
}

/* Toast Info */
.toast-info {
    border-left-color: var(--accent);
}

.toast-info .toast-icon svg {
    stroke: var(--accent);
}

/* Responsivo */
@media (max-width: 768px) {
    .toast {
        top: 16px;
        right: 16px;
        left: 16px;
        min-width: auto;
        max-width: none;
    }
}

/* Barra de Progresso no Toast */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    animation: toastProgress 5s linear forwards;
}

@keyframes toastProgress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}


/* ==============================================================================
   HEADER PROFISSIONAL
   ============================================================================== */

.header {
    position: fixed;
    top: 0;
    left: 280px;
    right: 0;
    height: 70px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 900;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-collapsed .header {
    left: 72px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

.header-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.header-menu-btn:hover {
    background: var(--bg);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent) 0%, #2563EB 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.header-brand-icon svg {
    width: 22px;
    height: 22px;
}

.header-brand-text {
    display: flex;
    flex-direction: column;
}

.header-brand-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.header-brand-subtitle {
    font-size: 12px;
    color: var(--text-light);
    display: none;
}

/* Welcome Section */
.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.welcome-text {
    font-size: 15px;
    color: var(--text);
}

.welcome-text strong {
    color: var(--accent);
}

.welcome-date {
    font-size: 13px;
    color: var(--text-light);
}

/* Busca Global */
.header-center {
    flex: 2;
    max-width: 600px;
    display: flex;
    justify-content: center;
}

.header-search {
    position: relative;
    width: 100%;
}

.header-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none;
}

.header-search-input {
    width: 100%;
    height: 42px;
    padding: 0 16px 0 44px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    transition: all 0.2s;
}

.header-search-input:focus {
    outline: none;
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.header-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.search-loading {
    padding: 16px;
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
}

.search-result-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
}

.search-result-item:hover {
    background: var(--bg);
}

.search-result-item svg {
    color: var(--text-light);
    flex-shrink: 0;
}

/* Header Right */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Indicador de Tempo Real no Header */
.header-realtime {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    transition: all 0.3s;
    margin-right: 4px;
}

.header-realtime.updating {
    background: #EFF6FF;
    border-color: #BFDBFE;
    color: var(--accent);
}

.realtime-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: realtimePulse 2s infinite;
}

@keyframes realtimePulse {
    0%, 100% { 
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% { 
        opacity: 0.5;
        box-shadow: 0 0 0 4px rgba(16, 185, 129, 0);
    }
}

.realtime-dot.updating {
    background: var(--accent);
    animation: realtimeSpin 1s linear infinite;
}

@keyframes realtimeSpin {
    from { transform: rotate(0deg) scale(1.2); }
    to { transform: rotate(360deg) scale(1.2); }
}

.realtime-dot.error {
    background: var(--error);
    animation: none;
}

/* Botão de Ícone */
.header-icon-btn {
    position: relative;
    width: 42px;
    height: 42px;
    border: none;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.header-icon-btn:hover {
    background: var(--bg);
}

.header-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    background: var(--error);
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid white;
}

/* Botão de Usuário */
.header-user-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.header-user-btn:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.header-user-avatar {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--accent) 0%, #2563EB 100%);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.header-user-avatar.large {
    width: 48px;
    height: 48px;
    font-size: 16px;
    border-radius: 10px;
}

.header-user-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.header-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
}

.header-user-role {
    font-size: 12px;
    color: var(--text-light);
}

/* Dropdown */
.header-dropdown {
    position: relative;
}

.header-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.header-dropdown.active .header-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header-dropdown-menu-right {
    right: 0;
    left: auto;
}

.header-dropdown-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-dropdown-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.header-dropdown-body {
    max-height: 400px;
    overflow-y: auto;
}

.header-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.header-dropdown-item:last-child {
    border-bottom: none;
}

.header-dropdown-item:hover {
    background: var(--bg);
}

.header-dropdown-item.text-danger {
    color: var(--error);
}

.header-dropdown-item.text-danger:hover {
    background: #FEF2F2;
}

.header-dropdown-item svg {
    flex-shrink: 0;
    color: var(--text-light);
}

.header-dropdown-item.text-danger svg {
    color: var(--error);
}

.header-dropdown-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-light);
}

.header-dropdown-empty svg {
    margin-bottom: 12px;
    color: var(--text-light);
}

.header-dropdown-empty p {
    font-size: 14px;
    margin: 0;
}

.header-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

/* Notificações */
.notif-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notif-icon.notif-warning {
    background: #FEF3C7;
    color: var(--warning);
}

.notif-icon.notif-info {
    background: #DBEAFE;
    color: var(--accent);
}

.notif-icon.notif-success {
    background: #D1FAE5;
    color: var(--success);
}

.notif-content {
    flex: 1;
}

.notif-content h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 4px 0;
}

.notif-content p {
    font-size: 13px;
    color: var(--text-light);
    margin: 0;
}

/* Perfil de Usuário no Dropdown */
.user-profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-profile-header h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 4px 0;
}

.user-profile-header p {
    font-size: 13px;
    color: var(--text-light);
    margin: 0;
}

/* Ajuste do layout principal com header */
.layout {
    display: flex;
    min-height: 100vh;
}

.content {
    margin-left: 280px;
    margin-top: 70px;
    flex: 1;
    padding: 32px;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-collapsed .content {
    margin-left: 72px;
}

/* Responsive */
@media (max-width: 1024px) {
    .header {
        left: 0;
    }
    
    .header-realtime span {
        display: none;
    }
    
    .header-realtime {
        padding: 10px;
        min-width: 42px;
        justify-content: center;
    }
    
    .header-menu-btn {
        display: flex;
    }
    
    .header-brand-text .header-brand-name {
        display: block;
    }
    
    .header-user-info {
        display: none;
    }
    
    .content {
        margin-left: 0;
        margin-top: 70px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 16px;
    }
    
    .header-center {
        display: none;
    }
    
    .header-brand-text {
        display: none;
    }
    
    .header-brand-icon {
        width: 36px;
        height: 36px;
    }
    
    .header-brand-icon svg {
        width: 18px;
        height: 18px;
    }
    
    .header-dropdown-menu {
        width: 280px;
    }
}


/* ==============================================================================
   PAGE LOADER - ULTRA PRO
   ============================================================================== */

.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.4s ease;
}

.page-loader.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.loader-spinner {
    position: relative;
    width: 60px;
    height: 60px;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top-color: #3B82F6;
    border-radius: 50%;
    animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring:nth-child(1) {
    animation-delay: -0.45s;
    border-top-color: #3B82F6;
}

.spinner-ring:nth-child(2) {
    animation-delay: -0.3s;
    border-top-color: #60A5FA;
}

.spinner-ring:nth-child(3) {
    animation-delay: -0.15s;
    border-top-color: #93C5FD;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loader-text {
    font-size: 14px;
    font-weight: 600;
    color: #64748B;
    letter-spacing: 0.05em;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Loader alternativo - Dots */
.loader-dots {
    display: flex;
    gap: 8px;
}

.loader-dot {
    width: 10px;
    height: 10px;
    background: #3B82F6;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.loader-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loader-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Loader inline para botões */
.btn-loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn-primary.btn-loading::after {
    border-top-color: white;
}

.btn-secondary.btn-loading::after {
    border-top-color: var(--accent);
}

/* Skeleton loader para conteúdo */
.skeleton {
    background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 6px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 16px;
}

.skeleton-card {
    height: 120px;
    margin-bottom: 16px;
}

/* Overlay loader para seções */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: inherit;
}

.loading-overlay .loader-spinner {
    width: 40px;
    height: 40px;
}

.loading-overlay .spinner-ring {
    border-width: 2px;
}
