/* Variáveis CSS - Identidade Visual PoupaPlus */
:root {
    --primary-dark: #0A2A66;
    --primary-blue: #2563EB;
    --secondary-green: #10B981;
    --white: #FFFFFF;
    --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;
    --danger: #EF4444;
    --warning: #F59E0B;
    --success: #10B981;
    --info: #3B82F6;
    
    --sidebar-width: 240px;
    --header-height: 64px;
    --border-radius: 12px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji';
    background-color: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
    font-size: 14px;
}

#app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar backdrop (mobile) */
.sidebar-backdrop {
    display: none;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary-blue) 100%);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.logo-section {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.logo-img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.logo-circle {
    width: 48px;
    height: 48px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.logo-text {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary-dark);
}

.logo-name {
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: 1px;
    background: linear-gradient(135deg, var(--white) 60%, rgba(255,255,255,0.7));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.slogan {
    font-size: 0.7rem;
    opacity: 0.8;
    letter-spacing: 0.3px;
}

.main-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-menu {
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    border-left-color: var(--secondary-green);
}

.nav-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

.nav-icon-dash { background: #60A5FA; }
.nav-icon-leads { background: #34D399; }
.nav-icon-clientes { background: #A78BFA; }
.nav-icon-propostas { background: #FBBF24; }
.nav-icon-followups { background: #F472B6; }
.nav-icon-vendas { background: #34D399; }
.nav-icon-comissoes { background: #FBBF24; }
.nav-icon-equipa { background: #60A5FA; }
.nav-icon-tarefas { background: #34D399; }
.nav-icon-parceiros { background: #A78BFA; }
.nav-icon-posvenda { background: #F472B6; }
.nav-icon-documentos { background: #FBBF24; }
.nav-icon-campanhas { background: #60A5FA; }
.nav-icon-publicacoes { background: #F472B6; }
.nav-icon-marketing { background: #34D399; }
.nav-icon-scripts { background: #A78BFA; }
.nav-icon-formacao { background: #FBBF24; }
.nav-icon-operadoras { background: #34D399; }
.nav-icon-relatorios { background: #60A5FA; }
.nav-icon-indicacoes { background: #F472B6; }

.nav-text {
    font-size: 0.85rem;
}

.user-section {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.user-role {
    font-size: 0.8rem;
    opacity: 0.8;
}

.logout-btn {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--white);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-bar {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-600);
}

.page-title {
    flex: 1;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.header-actions button {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--gray-100);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.2s ease;
}

.header-actions button:hover {
    background: var(--gray-200);
}

.whatsapp-btn {
    color: #25D366;
    font-size: 1.3rem;
}
.whatsapp-btn a {
    text-decoration: none;
    color: inherit;
}

.content-area {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    max-width: 100%;
}

/* Cards e Containers */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--gray-100);
    transition: all 0.3s ease;
}

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

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

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

/* Botões */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

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

.btn-info:hover {
    background: #1D4ED8;
}

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

.btn-success:hover {
    background: #059669;
}

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

.btn-danger:hover {
    background: #DC2626;
}

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

/* Formulários */
.form-group {
    margin-bottom: 1rem;
}

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

/* Tabelas */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

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

.table th,
.table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    font-size: 0.8rem;
    color: var(--gray-700);
}

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

.table tr:last-child td {
    border-bottom: none;
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: var(--transition);
}

.badge-success {
    background: #D1FAE5;
    color: #065F46;
}

.badge-warning {
    background: #FEF3C7;
    color: #92400E;
}

.badge-danger {
    background: #FEE2E2;
    color: #991B1B;
}

.badge-info {
    background: #DBEAFE;
    color: #1E40AF;
}

.badge-gray {
    background: var(--gray-200);
    color: var(--gray-700);
}

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

.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--gray-100);
    transition: all 0.3s ease;
}

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

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.stat-icon-blue {
    background: linear-gradient(135deg, #DBEAFE 0%, #BFDBFE 100%);
    color: #1D4ED8;
}

.stat-icon-green {
    background: linear-gradient(135deg, #D1FAE5 0%, #A7F3D0 100%);
    color: #047857;
}

.stat-icon-yellow {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    color: #B45309;
}

.stat-icon-red {
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    color: #B91C1C;
}

.stat-icon-purple {
    background: linear-gradient(135deg, #E9D5FF 0%, #D8B4FE 100%);
    color: #7C3AED;
}

.stat-icon-indigo {
    background: linear-gradient(135deg, #C7D2FE 0%, #A5B4FC 100%);
    color: #4338CA;
}

.stat-icon-teal {
    background: linear-gradient(135deg, #CCFBF1 0%, #99F6E4 100%);
    color: #0F766E;
}

.stat-icon-pink {
    background: linear-gradient(135deg, #FCE7F3 0%, #FBCFE8 100%);
    color: #BE185D;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.2;
}

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

/* Modal (Bootstrap overrides) */
.modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: none;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-body {
    padding: 2rem;
}

.modal-header {
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--gray-100);
}

.modal-header .modal-title {
    font-weight: 700;
    color: var(--gray-900);
    font-size: 1.2rem;
}

.modal .btn-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    opacity: 0.5;
}

.modal .btn-close:hover {
    opacity: 1;
}

.modal-backdrop.show {
    opacity: 0.5;
}

@media (max-width: 768px) {
    .modal-body {
        padding: 1rem;
    }
}

/* Responsive */
@media (max-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px;
    }

    .filter-group {
        min-width: 100%;
    }
}

@media (max-width: 768px) {
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 999;
    }

    .sidebar-backdrop.active {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .top-bar {
        padding: 0 1rem;
    }

    .top-bar .page-title {
        font-size: 1rem;
    }

    .header-actions .whatsapp-btn,
    .header-actions .notifications-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .content-area {
        padding: 1rem;
    }

    .card {
        padding: 0.75rem;
    }

    .card-title {
        font-size: 1rem;
    }

    .card-actions .btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.35rem;
    }

    .stat-card .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    .modal-content {
        width: 95%;
        margin: 0.5rem;
        max-height: 85vh;
    }

    .modal-body {
        padding: 1rem;
    }

    .action-buttons {
        flex-wrap: nowrap;
        gap: 0.25rem;
    }

    .action-buttons .btn-sm {
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
    }

    .dashboard-hero {
        padding: 1.25rem;
        gap: 1rem;
    }

    .hero-title {
        font-size: 1.3rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .hero-stats {
        gap: 0.75rem;
    }

    .hero-stat-number {
        font-size: 1.1rem;
    }

    .hero-stat-label {
        font-size: 0.7rem;
    }

    .hero-img {
        width: 80px;
        height: 80px;
    }

    .table th,
    .table td {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    .table th {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .content-area {
        padding: 0.5rem;
    }

    .card {
        padding: 0.75rem;
    }

    .stats-grid {
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .stat-value {
        font-size: 1.15rem;
    }

    .stat-card .stat-icon {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }

    .dashboard-hero {
        padding: 1rem;
    }

    .hero-title {
        font-size: 1.1rem;
    }

    .hero-img {
        width: 80px;
        height: 80px;
    }

    .card-actions {
        flex-direction: column;
        gap: 0.25rem;
    }

    .card-actions .btn {
        width: 100%;
        justify-content: center;
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
    }

    .login-card {
        padding: 1.5rem 1rem;
    }
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state-text {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.empty-state-sub {
    font-size: 0.9rem;
    color: var(--gray-400);
}

/* ==============================
   DARK MODE
   ============================== */
[data-theme="dark"] {
    --primary-dark: #0D1B3E;
    --primary-blue: #3B82F6;
    --secondary-green: #34D399;
    --white: #1E293B;
    --gray-50: #1E293B;
    --gray-100: #334155;
    --gray-200: #475569;
    --gray-300: #64748B;
    --gray-400: #B0C4DE;
    --gray-500: #D6E4F0;
    --gray-600: #E8F0F8;
    --gray-700: #F1F5F9;
    --gray-800: #F8FAFC;
    --gray-900: #FFFFFF;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] body {
    background-color: #0F172A;
}

[data-theme="dark"] .sidebar {
    background: linear-gradient(180deg, #0D1B3E 0%, #1E3A5F 100%);
}

[data-theme="dark"] .top-bar {
    background: var(--white);
    border-bottom-color: var(--gray-100);
}

[data-theme="dark"] .card,
[data-theme="dark"] .stat-card {
    background: var(--white);
    border-color: var(--gray-100);
}

[data-theme="dark"] .card:hover {
    border-color: var(--gray-200);
}

[data-theme="dark"] .table {
    --bs-table-color: #E2E8F0;
    --bs-table-hover-color: #E2E8F0;
    --bs-table-striped-color: #E2E8F0;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .table th {
    background: #334155;
    color: #94A3B8;
    font-weight: 700;
}

[data-theme="dark"] .table td {
    border-bottom-color: #334155;
    color: #E2E8F0;
    font-weight: 500;
}

[data-theme="dark"] .table tr:hover {
    background: #334155;
}

[data-theme="dark"] .table td strong {
    font-weight: 700;
    color: #F1F5F9;
}

[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-textarea {
    background: #0F172A;
    border-color: var(--gray-200);
    color: var(--gray-800);
}

[data-theme="dark"] .btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

[data-theme="dark"] .btn-secondary:hover {
    background: var(--gray-200);
}

[data-theme="dark"] .header-actions button {
    background: var(--gray-100);
    color: var(--gray-500);
}

[data-theme="dark"] .header-actions button:hover {
    background: var(--gray-200);
}

[data-theme="dark"] .modal-content {
    background: var(--white);
}

[data-theme="dark"] .modal-header {
    border-bottom-color: var(--gray-100);
}

[data-theme="dark"] .filters-section {
    background: var(--gray-100);
}

[data-theme="dark"] .detail-row {
    border-bottom-color: var(--gray-100);
}

[data-theme="dark"] .global-search-container {
    background: var(--white);
}

[data-theme="dark"] .global-search-header {
    border-bottom-color: var(--gray-100);
}

[data-theme="dark"] .global-search-input {
    color: var(--gray-900);
}

[data-theme="dark"] .global-search-item:hover,
[data-theme="dark"] .global-search-item.active {
    background: var(--gray-50);
}

[data-theme="dark"] .script-popup {
    background: var(--white);
}

[data-theme="dark"] .loading-overlay {
    background: rgba(15, 23, 42, 0.9);
}

[data-theme="dark"] #loginCard,
[data-theme="dark"] .login-card {
    background: var(--white);
}

[data-theme="dark"] .form-notice {
    background: #1E3A5F;
    border-color: #2563EB;
    color: #93C5FD;
}

[data-theme="dark"] small,
[data-theme="dark"] .text-muted,
[data-theme="dark"] .form-label,
[data-theme="dark"] .detail-label,
[data-theme="dark"] .bar-label,
[data-theme="dark"] .kpi-label,
[data-theme="dark"] .stat-label,
[data-theme="dark"] .ranking-info span,
[data-theme="dark"] .timeline-date,
[data-theme="dark"] .kanban-card-footer small {
    color: var(--gray-500) !important;
}

[data-theme="dark"] .notif-item div[style*="color:var(--gray-500)"] {
    color: var(--gray-400) !important;
}

[data-theme="dark"] .empty-state,
[data-theme="dark"] td[class*="text-center"] {
    color: var(--gray-400) !important;
}

[data-theme="dark"] a:not(.btn) {
    color: #60A5FA;
}

[data-theme="dark"] .sidebar .nav-link {
    color: var(--gray-400);
}

[data-theme="dark"] .sidebar .nav-link:hover,
[data-theme="dark"] .sidebar .nav-link.active {
    color: var(--gray-900);
}

[data-theme="dark"] .kanban-card {
    background: #0F172A;
    border-color: var(--gray-100);
}

[data-theme="dark"] .kanban-column {
    background: var(--gray-50);
}

[data-theme="dark"] .kanban-column-header {
    background: var(--gray-100);
}

[data-theme="dark"] .kanban-card-header strong {
    color: var(--gray-800);
}

[data-theme="dark"] .kanban-card-body small {
    color: var(--gray-400);
}

[data-theme="dark"] .badge-gray {
    background: var(--gray-200);
    color: var(--gray-700);
}

[data-theme="dark"] .report-grid .card .card-header h3 {
    color: var(--gray-700);
}

[data-theme="dark"] .stats-grid .stat-value {
    color: var(--gray-900);
}

[data-theme="dark"] .page-title,
[data-theme="dark"] .top-bar .page-title {
    color: var(--gray-700);
}

[data-theme="dark"] .logo-circle {
    background: #475569;
}

[data-theme="dark"] .logo-text {
    color: var(--gray-900);
}

[data-theme="dark"] .logo-name {
    background: linear-gradient(135deg, #E2E8F0 60%, rgba(255,255,255,0.5));
    -webkit-background-clip: text;
    background-clip: text;
}

[data-theme="dark"] .slogan {
    color: var(--gray-400);
    opacity: 1;
}

[data-theme="dark"] .card-title {
    color: var(--gray-800);
}

[data-theme="dark"] .table th {
    color: var(--gray-700);
}

[data-theme="dark"] .user-name {
    color: var(--gray-700);
}

[data-theme="dark"] .dashboard-hero {
    color: #fff;
}

[data-theme="dark"] .dashboard-hero .hero-title,
[data-theme="dark"] .dashboard-hero .hero-subtitle,
[data-theme="dark"] .dashboard-hero .hero-stat-number,
[data-theme="dark"] .dashboard-hero .hero-stat-label {
    color: #fff;
}

/* ==============================
   SKELETON LOADING
   ============================== */
.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text { height: 14px; margin-bottom: 8px; width: 100%; }
.skeleton-text-sm { height: 10px; width: 60%; }
.skeleton-text-lg { height: 20px; width: 80%; }
.skeleton-circle { width: 48px; height: 48px; border-radius: 50%; }
.skeleton-card { height: 120px; border-radius: var(--border-radius); }

.skeleton-table-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 80px;
    gap: 0.75rem;
    padding: 0.75rem;
    align-items: center;
}
.skeleton-table-row .skeleton { height: 14px; }

/* ==============================
   CUSTOM TOAST
   ============================== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.custom-toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    pointer-events: auto;
    animation: toast-in 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
    max-width: 420px;
}

.custom-toast.toast-out {
    animation: toast-out 0.3s ease forwards;
}

.custom-toast.toast-info { background: rgba(37, 99, 235, 0.95); color: white; }
.custom-toast.toast-success { background: rgba(16, 185, 129, 0.95); color: white; }
.custom-toast.toast-error { background: rgba(239, 68, 68, 0.95); color: white; }
.custom-toast.toast-warning { background: rgba(245, 158, 11, 0.95); color: white; }

.custom-toast .toast-icon { font-size: 1.2rem; flex-shrink: 0; opacity: 0.9; }
.custom-toast .toast-msg { flex: 1; }
.custom-toast .toast-close {
    background: none; border: none; color: inherit; cursor: pointer;
    font-size: 1.1rem; opacity: 0.7; padding: 0; line-height: 1;
}
.custom-toast .toast-close:hover { opacity: 1; }

@keyframes toast-in {
    0% { transform: translateX(120%) scale(0.9); opacity: 0; }
    100% { transform: translateX(0) scale(1); opacity: 1; }
}
@keyframes toast-out {
    0% { transform: translateX(0) scale(1); opacity: 1; }
    100% { transform: translateX(120%) scale(0.9); opacity: 0; }
}

/* Melhorias de Usabilidade */
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.table tr {
    transition: background-color 0.2s ease;
}

/* Page content (substitui .X-page { padding: 0 } em todos os módulos) */
.page-content {
    padding: 0;
}

/* Shared component styles (extraídos dos injected styles dos módulos) */
.filters-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--border-radius);
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.action-buttons {
    display: flex;
    gap: 0.25rem;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

.view-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.detail-row {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-200);
}

.detail-label {
    font-weight: 600;
    min-width: 160px;
    color: var(--gray-600);
}

.detail-value {
    color: var(--gray-900);
}

.form-notice {
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: #1E40AF;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .filters-section {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Table hover improvements */
.table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background: #EEF2FF;
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.hidden {
    display: none;
}

/* Feedback Visual */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Accessibility improvements */
:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* Dashboard Hero Section */
.dashboard-hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-blue) 100%);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 2rem;
    color: var(--white);
}

.hero-content {
    flex: 1;
}

.hero-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

.hero-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.hero-stat {
    text-align: center;
}

.hero-stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    display: block;
}

.hero-stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

.hero-image {
    flex: 0 0 auto;
    max-width: 50%;
}

.hero-img {
    width: 100%;
    max-width: 380px;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .dashboard-hero {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }
    
    .hero-stats {
        justify-content: center;
        gap: 1rem;
    }
    
    .hero-image {
        max-width: 100%;
    }
    
    .hero-img {
        max-width: 280px;
    }
}

/* ── Global Search ─────────────────────────────────── */
#globalSearchOverlay:not(.active) .global-search-backdrop,
#globalSearchOverlay:not(.active) .global-search-container {
    display: none;
}

.global-search-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
}

.global-search-container {
    position: fixed;
    top: 15vh;
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    width: min(680px, 90vw);
    max-height: 70vh;
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: all 0.2s ease;
}

#globalSearchOverlay.active .global-search-container {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.global-search-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}

.global-search-header .bi-search {
    font-size: 1.2rem;
    color: var(--gray-400);
    flex-shrink: 0;
}

.global-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.1rem;
    font-family: inherit;
    color: var(--gray-900);
    background: transparent;
}

.global-search-input::placeholder {
    color: var(--gray-400);
}

.global-search-close {
    background: none;
    border: none;
    color: var(--gray-500);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 8px;
    transition: var(--transition);
}

.global-search-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.global-search-hints {
    display: flex;
    gap: 1.25rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.75rem;
    color: var(--gray-400);
    border-bottom: 1px solid var(--gray-100);
}

.global-search-hints kbd {
    display: inline-block;
    padding: 0.1rem 0.35rem;
    font-size: 0.7rem;
    font-family: inherit;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    margin: 0 0.1rem;
}

.global-search-results {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
    max-height: 50vh;
}

.global-search-empty {
    padding: 2rem 1.25rem;
    text-align: center;
    color: var(--gray-400);
    font-size: 0.9rem;
}

.global-search-group {
    margin-bottom: 0.25rem;
}

.global-search-group-title {
    padding: 0.4rem 1.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.global-search-item {
    padding: 0.6rem 1.25rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.global-search-item:hover,
.global-search-item.active {
    background: var(--gray-50);
    border-left-color: var(--primary-blue);
}

.global-search-item-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-900);
}

.global-search-item-title strong {
    color: var(--primary-blue);
}

.global-search-item-subtitle {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.global-search-item-subtitle strong {
    color: var(--primary-blue);
}

/* ── Call Action Buttons ───────────────────────────── */
.call-actions {
    display: flex;
    gap: 0.35rem;
}

.call-actions .btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 6px;
    line-height: 1;
}

.btn-call {
    background: var(--secondary-green);
    color: white;
    border: none;
}

.btn-call:hover {
    background: #059669;
    color: white;
}

.btn-whatsapp {
    background: #25D366;
    color: white;
    border: none;
}

.btn-whatsapp:hover {
    background: #1DA851;
    color: white;
}

/* ── Notification Badge ────────────────────────────── */
.notifications-btn {
    position: relative;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* ── Script Popup ──────────────────────────────────── */
.script-popup {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 380px;
    max-height: 500px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 1060;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.script-popup.active {
    display: flex;
}

.script-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--primary-blue);
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
}

.script-popup-header button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    font-size: 1rem;
    transition: background 0.2s;
}

.script-popup-header button:hover {
    background: rgba(255,255,255,0.2);
}

.script-popup-body {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre-wrap;
    color: var(--gray-700);
}

/* Backdrop when script popup is open */
.script-popup-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 1059;
    display: none;
}

.script-popup-backdrop.active {
    display: block;
}