/* ========================================
   SISTEMA GNZ - CSS GLOBAL
   TEMA DINÂMICO (DARK/LIGHT)
   ======================================== */

/* Google Fonts - Poppins */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* Mobile Responsive - CSS Padronizado Global */
@import url('/css/mobile-responsive.css');

/* ========================================
   ESTADO INICIAL - PREVINE FLASH DE TEMA
   O body começa invisível até o tema ser aplicado
   ======================================== */
html.theme-loading {
    visibility: hidden;
}

html.theme-loading body {
    visibility: hidden;
}

/* Fallback robusto: mostrar após 800ms mesmo se JS falhar */
@keyframes theme-fallback-show {
    0% { visibility: hidden; }
    100% { visibility: visible; }
}

html.theme-loading,
html.theme-loading body {
    animation: theme-fallback-show 0.1s 0.8s forwards !important;
}

/* Fallback extra: se classe theme-loading persistir por mais de 2s, forçar visibilidade */
@keyframes theme-emergency-show {
    0% { opacity: 0; visibility: hidden; }
    100% { opacity: 1; visibility: visible; }
}

html.theme-loading {
    animation: theme-fallback-show 0.1s 0.8s forwards, theme-emergency-show 0.3s 2s forwards !important;
}

:root {
    /* Primary Colors - WHATSAPP TEAL */
    --primary: #128C7E;
    --primary-hover: #0e7a6e;
    --primary-dark: #075E54;
    --primary-light: #25D366;
    --primary-gradient: linear-gradient(135deg, #128C7E 0%, #25D366 100%);
    --primary-rgb: 18, 140, 126;
    --secondary: #075E54;
    --accent: #25D366;

    /* Backgrounds - Valores padrão neutros (serão sobrescritos pelo JS) */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --bg-hover: rgba(18, 140, 126, 0.15);
    --bg-chat: #ECE5DD;
    --bg-dark: #075E54;
    --bg-sidebar: #f8f9fa;
    --bg-card: #ffffff;
    --bg-input: #ffffff;

    /* Sidebar/Header Branding */
    --sidebar-bg: #f8f9fa;
    --sidebar-text: #1f2937;
    --sidebar-text-secondary: #4a5568;
    --header-bg: #075E54;
    --header-text: #ffffff;

    /* Cores de texto - Padrão neutro */
    --text-primary: #1a1a2e;
    --text-secondary: #4a5568;
    --text-light: #718096;
    --text-white: #ffffff;
    --text-muted: #a0aec0;

    /* Cores de status */
    --success: #22C55E;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;

    /* Botoes - defaults (sobrescritos pelo branding JS) */
    --btn-primary-bg: #128C7E;
    --btn-primary-text: #ffffff;
    --btn-primary-hover: #0e7a6e;
    --btn-secondary-bg: #6B7280;
    --btn-secondary-text: #ffffff;
    --btn-secondary-hover: #4B5563;
    --btn-success-bg: #22C55E;
    --btn-success-text: #ffffff;
    --btn-success-hover: #16a34a;
    --btn-warning-bg: #F59E0B;
    --btn-warning-text: #ffffff;
    --btn-warning-hover: #d97706;
    --btn-danger-bg: #EF4444;
    --btn-danger-text: #ffffff;
    --btn-danger-hover: #dc2626;
    --btn-info-bg: #3B82F6;
    --btn-info-text: #ffffff;
    --btn-info-hover: #2563eb;
    --link-color: #128C7E;

    /* Shadows - Padrão neutro */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

    /* Bordas - Padrão neutro */
    --border-color: #e2e8f0;
    --border: #e2e8f0;
    --border-radius: 8px;
    --border-radius-lg: 12px;

    /* Transições */
    --transition: all 0.3s ease;

    /* Layout */
    --sidebar-width: 240px;
    --sidebar-collapsed: 60px;
    --header-height: 74px;

    /* Font Scale - REDUZIDO para desktop */
    --font-scale: 1;
    --font-scale-desktop: 1;
    --font-scale-mobile: 1;
    --font-size-xs: 10px;
    --font-size-sm: 12px;
    --font-size-base: 14px;
    --font-size-md: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;

    /* Button Colors - Brandable */
    --btn-primary-bg: #128C7E;
    --btn-primary-hover: #075E54;
    --btn-primary-text: #ffffff;
    --btn-success-bg: #10B981;
    --btn-success-hover: #059669;
    --btn-success-text: #ffffff;
    --btn-danger-bg: #EF4444;
    --btn-danger-hover: #DC2626;
    --btn-danger-text: #ffffff;
    --btn-warning-bg: #F59E0B;
    --btn-warning-hover: #D97706;
    --btn-warning-text: #ffffff;
    --btn-info-bg: #3B82F6;
    --btn-info-hover: #2563EB;
    --btn-info-text: #ffffff;
    --btn-secondary-bg: #6B7280;
    --btn-secondary-hover: #4B5563;
    --btn-secondary-text: #ffffff;

    /* Input Colors */
    --input-bg: #ffffff;
    --input-text: #1a1a2e;
    --input-border: #e2e8f0;
    --input-placeholder: #9ca3af;
    --input-focus-shadow: rgba(18, 140, 126, 0.15);

    /* Gradientes semânticos (seguem branding) */
    --grad-primary: linear-gradient(135deg, var(--primary, #128C7E), var(--primary-dark, #075E54));
    --grad-success: linear-gradient(135deg, var(--btn-success-bg, #10B981), var(--btn-success-hover, #059669));
    --grad-warning: linear-gradient(135deg, var(--btn-warning-bg, #F59E0B), var(--btn-warning-hover, #D97706));
    --grad-danger: linear-gradient(135deg, var(--btn-danger-bg, #EF4444), var(--btn-danger-hover, #DC2626));
    --grad-info: linear-gradient(135deg, var(--btn-info-bg, #3B82F6), var(--btn-info-hover, #2563EB));
    --grad-accent: linear-gradient(135deg, var(--accent, #25D366), var(--primary, #128C7E));
    --grad-secondary: linear-gradient(135deg, var(--btn-secondary-bg, #6B7280), var(--btn-secondary-hover, #4B5563));

    /* Gradientes de paleta extendida (decorativos, fixos) */
    --grad-purple: linear-gradient(135deg, #8B5CF6, #7C3AED);
    --grad-indigo: linear-gradient(135deg, #6366F1, #4F46E5);
    --grad-pink: linear-gradient(135deg, #EC4899, #DB2777);
    --grad-cyan: linear-gradient(135deg, #06B6D4, #0891B2);
    --grad-orange: linear-gradient(135deg, #F97316, #EA580C);

    /* Gradientes de marca (fixos) */
    --grad-whatsapp: linear-gradient(135deg, #25D366, #128C7E);
    --grad-instagram: linear-gradient(135deg, #833AB4, #FD1D1D, #FCB045);

    /* Cores sólidas extendidas */
    --purple: #8B5CF6;
    --purple-hover: #7C3AED;
    --indigo: #6366F1;
    --pink: #EC4899;
    --cyan: #06B6D4;
    --orange: #F97316;
}

/* ========================================
   LIGHT THEME — Forçar cores corretas
   Sobrescreve inline styles do brandingVarsCache
   quando o cache foi salvo em dark mode
   ======================================== */
html.light-theme,
html:not(.dark-theme) {
    --text-primary: #1a1a2e !important;
    --text-secondary: #4a5568 !important;
    --text-light: #718096 !important;
    --text-muted: #a0aec0 !important;
    --bg-primary: #ffffff !important;
    --bg-secondary: #f8fafc !important;
    --bg-tertiary: #f1f5f9 !important;
    --bg-card: #ffffff !important;
    --bg-input: #ffffff !important;
    --bg-hover: rgba(18,140,126,0.08) !important;
    --input-bg: #ffffff !important;
    --input-text: #1a1a2e !important;
    --input-border: #d1d5db !important;
    --input-placeholder: #9ca3af !important;
    --border-color: #e2e8f0 !important;
    --border: #e2e8f0 !important;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08) !important;
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1) !important;
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12) !important;
}

/* Forçar cor de texto do body no tema claro */
html.light-theme body,
html:not(.dark-theme) body {
    color: #1a1a2e !important;
}

/* ========================================
   UTILITY CLASSES - Gradient Buttons
   ======================================== */
.btn-grad-primary { background: var(--grad-primary); color: #fff; border: none; transition: filter 0.2s; }
.btn-grad-success { background: var(--grad-success); color: #fff; border: none; transition: filter 0.2s; }
.btn-grad-warning { background: var(--grad-warning); color: #fff; border: none; transition: filter 0.2s; }
.btn-grad-danger { background: var(--grad-danger); color: #fff; border: none; transition: filter 0.2s; }
.btn-grad-info { background: var(--grad-info); color: #fff; border: none; transition: filter 0.2s; }
.btn-grad-accent { background: var(--grad-accent); color: #fff; border: none; transition: filter 0.2s; }
.btn-grad-secondary { background: var(--grad-secondary); color: #fff; border: none; transition: filter 0.2s; }
.btn-grad-purple { background: var(--grad-purple); color: #fff; border: none; transition: filter 0.2s; }
.btn-grad-pink { background: var(--grad-pink); color: #fff; border: none; transition: filter 0.2s; }
.btn-grad-cyan { background: var(--grad-cyan); color: #fff; border: none; transition: filter 0.2s; }
.btn-grad-orange { background: var(--grad-orange); color: #fff; border: none; transition: filter 0.2s; }
.btn-grad-whatsapp { background: var(--grad-whatsapp); color: #fff; border: none; transition: filter 0.2s; }
.btn-grad-instagram { background: var(--grad-instagram); color: #fff; border: none; transition: filter 0.2s; }
.btn-grad-indigo { background: var(--grad-indigo); color: #fff; border: none; transition: filter 0.2s; }

.btn-grad-primary:hover, .btn-grad-success:hover, .btn-grad-warning:hover,
.btn-grad-danger:hover, .btn-grad-info:hover, .btn-grad-accent:hover,
.btn-grad-secondary:hover, .btn-grad-purple:hover, .btn-grad-pink:hover,
.btn-grad-cyan:hover, .btn-grad-orange:hover, .btn-grad-whatsapp:hover,
.btn-grad-instagram:hover, .btn-grad-indigo:hover {
    filter: brightness(0.9);
}

/* Stat Icons with gradient backgrounds */
.stat-icon.grad-primary { background: var(--grad-primary); color: #fff; }
.stat-icon.grad-success { background: var(--grad-success); color: #fff; }
.stat-icon.grad-warning { background: var(--grad-warning); color: #fff; }
.stat-icon.grad-danger { background: var(--grad-danger); color: #fff; }
.stat-icon.grad-info { background: var(--grad-info); color: #fff; }
.stat-icon.grad-accent { background: var(--grad-accent); color: #fff; }
.stat-icon.grad-purple { background: var(--grad-purple); color: #fff; }
.stat-icon.grad-pink { background: var(--grad-pink); color: #fff; }
.stat-icon.grad-cyan { background: var(--grad-cyan); color: #fff; }
.stat-icon.grad-orange { background: var(--grad-orange); color: #fff; }
.stat-icon.grad-indigo { background: var(--grad-indigo); color: #fff; }
.stat-icon.grad-whatsapp { background: var(--grad-whatsapp); color: #fff; }
.stat-icon.grad-instagram { background: var(--grad-instagram); color: #fff; }

/* Text color utilities */
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-info { color: var(--info) !important; }
.text-primary { color: var(--primary) !important; }
.text-purple { color: var(--purple) !important; }
.text-pink { color: var(--pink) !important; }
.text-cyan { color: var(--cyan) !important; }
.text-orange { color: var(--orange) !important; }
.text-indigo { color: var(--indigo) !important; }
.text-accent { color: var(--accent) !important; }
.text-muted-var { color: var(--text-muted) !important; }

/* Background light utilities */
.bg-success-light { background-color: rgba(34, 197, 94, 0.1) !important; }
.bg-warning-light { background-color: rgba(245, 158, 11, 0.1) !important; }
.bg-danger-light { background-color: rgba(239, 68, 68, 0.1) !important; }
.bg-info-light { background-color: rgba(59, 130, 246, 0.1) !important; }
.bg-primary-light { background-color: rgba(18, 140, 126, 0.1) !important; }
.bg-purple-light { background-color: rgba(139, 92, 246, 0.1) !important; }
.bg-pink-light { background-color: rgba(236, 72, 153, 0.1) !important; }
.bg-cyan-light { background-color: rgba(6, 182, 212, 0.1) !important; }
.bg-orange-light { background-color: rgba(249, 115, 22, 0.1) !important; }
.bg-indigo-light { background-color: rgba(99, 102, 241, 0.1) !important; }

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

html {
    height: 100%;
    overscroll-behavior: none;
    font-size: 14px;
}

body {
    height: 100%;
    width: 100%;
    margin: 0;
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    overscroll-behavior-y: contain;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

#app {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

a {
    text-decoration: none;
    color: inherit;
}

ul, ol {
    list-style: none;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
}

input, textarea, select, button {
    font-family: inherit;
    font-size: var(--font-size-base);
}

/* Escala global de fontes */
* {
    --_font-scale: var(--font-scale, 1);
}

/* ========== SCROLLBAR GLOBAL ========== */

/* Styled scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(18, 140, 126, 0.6) rgba(18, 140, 126, 0.1);
}

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

*::-webkit-scrollbar-track {
    background: rgba(18, 140, 126, 0.1);
    border-radius: 4px;
}

*::-webkit-scrollbar-thumb {
    background: rgba(18, 140, 126, 0.6);
    border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(18, 140, 126, 0.8);
}

/* Hide scrollbar on specific elements that don't need it visible */
.conversations-filters::-webkit-scrollbar,
.kanban-mobile-tabs::-webkit-scrollbar,
.tabs::-webkit-scrollbar {
    display: none;
}

.conversations-filters,
.kanban-mobile-tabs,
.tabs {
    scrollbar-width: none;
}

/* ========== SISTEMA DE ABAS - UNDERLINE ANIMADO ========== */

.tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    background: transparent;
    padding: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tabs::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: var(--tab-indicator-left, 0);
    width: var(--tab-indicator-width, 0);
    height: 3px;
    background: linear-gradient(90deg, #8B5CF6 0%, #A78BFA 50%, #8B5CF6 100%);
    border-radius: 3px 3px 0 0;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 12px rgba(18, 140, 126, 0.5);
}

.tab-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: transparent;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    border-radius: 8px 8px 0 0;
}

.tab-btn i {
    font-size: 16px;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: #A78BFA;
    background: rgba(18, 140, 126, 0.08);
}

.tab-btn:hover i {
    transform: translateY(-2px);
    color: #8B5CF6;
}

.tab-btn.active {
    color: #8B5CF6;
    font-weight: 600;
    background: rgba(18, 140, 126, 0.1);
}

.tab-btn.active i {
    color: #8B5CF6;
    animation: tabIconPulse 2s ease-in-out infinite;
}

@keyframes tabIconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Badge de contagem nas abas */
.tab-btn .badge,
.tab-btn .tab-badge {
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
    margin-left: 4px;
    box-shadow: 0 2px 6px rgba(18, 140, 126, 0.4);
    transition: all 0.3s ease;
}

.tab-btn:hover .badge,
.tab-btn:hover .tab-badge {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(18, 140, 126, 0.5);
}

.tab-btn.active .badge,
.tab-btn.active .tab-badge {
    background: linear-gradient(135deg, #7C3AED 0%, #6D28D9 100%);
}

/* Variante: Tabs em container com fundo */
.tabs-container {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 6px;
    margin-bottom: 20px;
}

.tabs-container .tabs {
    border-bottom: none;
    margin-bottom: 0;
    gap: 4px;
}

.tabs-container .tabs::after {
    display: none;
}

.tabs-container .tab-btn {
    padding: 12px 18px;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.tabs-container .tab-btn::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 80%;
    height: 3px;
    background: linear-gradient(90deg, #8B5CF6, #A78BFA);
    border-radius: 3px;
    transition: transform 0.3s ease;
}

.tabs-container .tab-btn.active::before {
    transform: translateX(-50%) scaleX(1);
}

.tabs-container .tab-btn.active {
    background: rgba(18, 140, 126, 0.15);
}

/* ========== LAYOUT PRINCIPAL ========== */

/* Evitar que o header container cresça dentro do body flex */
#global-header-container {
    flex-shrink: 0;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: var(--app-height, 100vh);
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

/* ========== ESTILOS DO MENU (Usados pelo Menu Flutuante) ========== */
/* Sidebar removido - apenas menu flutuante é usado */

.sidebar-nav {
    flex: 1;
    padding: 15px 10px;
    overflow-y: auto;
}

/* Busca no Sidebar */
.sidebar-search {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-search-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    transition: var(--transition);
}

.sidebar-search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.sidebar-search-input::placeholder {
    color: var(--text-light);
}

.sidebar-search-wrapper {
    position: relative;
}

.sidebar-search-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 14px;
    pointer-events: none;
}

.sidebar-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
    display: none;
}

.sidebar-search-clear:hover {
    color: var(--text-primary);
}

.sidebar-search-wrapper.has-value .sidebar-search-clear {
    display: block;
}

/* Highlight de busca */
.nav-item.search-match {
    background: rgba(249, 115, 22, 0.15);
}

.nav-section.search-hidden,
.nav-isolated-items.search-hidden {
    display: none;
}

/* Resultados de busca de submenus */
.submenu-search-results {
    padding: 12px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.08), rgba(18, 140, 126, 0.08));
    border-radius: 12px;
    margin: 8px 12px;
    border: 1px solid rgba(249, 115, 22, 0.15);
}

.submenu-results-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.submenu-results-header i {
    color: var(--primary);
}

.submenu-results-count {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    margin-left: auto;
}

.submenu-results-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.submenu-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-primary);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
    border: 1px solid transparent;
}

.submenu-result-item:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    transform: translateX(4px);
}

.submenu-result-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.submenu-result-info {
    flex: 1;
    min-width: 0;
}

.submenu-result-info strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.submenu-result-info strong mark {
    background: rgba(249, 115, 22, 0.3);
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

.submenu-result-info span {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.submenu-result-arrow {
    color: var(--text-light);
    font-size: 12px;
    transition: transform 0.2s;
}

.submenu-result-item:hover .submenu-result-arrow {
    color: var(--primary);
    transform: translateX(3px);
}

/* Mensagem de nenhum resultado */
.submenu-search-results.no-results {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.no-results-message {
    text-align: center;
    padding: 20px 10px;
}

.no-results-message i {
    font-size: 32px;
    color: var(--text-light);
    margin-bottom: 12px;
}

.no-results-message p {
    margin: 0 0 4px 0;
    font-size: 13px;
    color: var(--text-primary);
}

.no-results-message span {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Itens raiz em seções com contas (ex: Painel geral) */
.nav-root-item {
    margin-bottom: 8px;
    padding: 10px 12px !important;
    background: rgba(var(--primary-rgb, 37, 99, 235), 0.08);
    border-radius: 8px;
    font-weight: 500;
}

.nav-root-item:hover {
    background: rgba(var(--primary-rgb, 37, 99, 235), 0.15) !important;
}

/* Sub-contas (Bling/PagBank) */
.nav-account-group {
    margin-left: 8px;
    padding-left: 12px;
    border-left: 2px solid var(--border-color);
    margin-bottom: 8px;
}

.nav-account-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
}

.nav-account-header:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text-primary);
}

.nav-account-header i.account-icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: white;
}

.nav-account-header .account-arrow {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.2s ease;
}

.nav-account-group.open .account-arrow {
    transform: rotate(180deg);
}

.nav-account-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.nav-account-group.open .nav-account-items {
    max-height: 800px;
}

.nav-account-items .nav-item {
    padding: 8px 12px;
    font-size: 13px;
}

.nav-account-items .nav-item i {
    font-size: 14px;
    width: 20px;
}

.nav-section {
    margin-bottom: 5px;
}

/* Header do submenu colapsável */
.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    cursor: pointer;
    border-radius: var(--border-radius);
    color: var(--sidebar-text, var(--text-secondary));
    transition: var(--transition);
    user-select: none;
}

.nav-section-header:hover {
    background: rgba(0,0,0,0.05);
    color: var(--sidebar-text, var(--text-primary));
}

.nav-section-header:hover .nav-section-header-left i {
    transform: scale(1.1);
}

/* Borda colorida na seção aberta */
.nav-section.open {
    background: linear-gradient(90deg, var(--section-color, var(--primary)) 0%, var(--section-color, var(--primary)) 3px, transparent 3px);
    border-radius: 0 8px 8px 0;
}

.nav-section-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-section-header-left i {
    width: 20px;
    font-size: 16px;
    text-align: center;
    color: var(--primary);
    transition: transform 0.2s ease;
}

.nav-section-header-left span {
    font-size: 14px;
    font-weight: 600;
}

.nav-section-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
    color: var(--text-light);
}

.nav-section.open .nav-section-arrow {
    transform: rotate(180deg);
}

/* Items do submenu */
.nav-section-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 10px;
}

.nav-section.open .nav-section-items {
    max-height: 1000px;
}

/* Estilo antigo para compatibilidade */
.nav-section-title {
    padding: 8px 15px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-light);
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-radius: var(--border-radius);
    color: var(--sidebar-text, var(--text-secondary));
    opacity: 0.8;
    transition: var(--transition);
    margin-bottom: 4px;
    position: relative;
}

.nav-item:hover {
    background: rgba(249, 115, 22, 0.1);
    color: var(--primary);
    opacity: 1;
}

.nav-item.active {
    background: var(--primary);
    color: var(--text-white);
}

.nav-item i {
    width: 24px;
    font-size: 18px;
    margin-right: 12px;
    text-align: center;
}

/* Itens isolados (sem seção) */
.nav-isolated-items {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-isolated {
    padding-left: 20px !important;
}

.nav-isolated i {
    color: var(--text-secondary);
}

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

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    overflow: visible;
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.user-info:hover {
    background: rgba(128,128,128,0.1);
}

/* Modo escuro - hover mais visivel */
.dark-theme .user-info:hover,

.user-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
    overflow: hidden;
    flex-shrink: 0;
}

/* Quando tem imagem, remover background padrao */
.user-avatar:has(img) {
    background: transparent !important;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    min-width: 40px;
    min-height: 40px;
}

.user-details {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-weight: 600;
    color: var(--sidebar-text, var(--text-primary));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 12px;
    color: var(--sidebar-text-secondary, var(--text-light));
    opacity: 0.7;
}

/* User Info Dropdown - abre para cima no sidebar footer */
.sidebar-footer .user-info {
    position: relative;
}

.sidebar-footer .user-info .dropdown-menu {
    position: absolute;
    bottom: 100%;
    top: auto;
    left: 0;
    right: 0;
    margin-bottom: 8px;
    transform: translateY(10px);
}

.sidebar-footer .user-info.active .dropdown-menu {
    transform: translateY(0);
}

/* Garantir que o icone dos 3 pontinhos seja clicavel */
.user-info .fa-ellipsis-v {
    color: var(--sidebar-text, var(--text-secondary));
    padding: 5px;
    cursor: pointer;
    opacity: 0.6;
}

.user-info:hover .fa-ellipsis-v {
    color: var(--sidebar-text, var(--text-primary));
    opacity: 1;
}

/* ========== SIDEBAR ACTIONS (Notifications, Cache, etc) ========== */

.sidebar-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-action-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-action-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(18, 140, 126, 0.3);
}

.sidebar-action-btn i {
    font-size: 16px;
}

.sidebar-action-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1.2;
}

/* ========== NOTIFICATION MODAL ========== */

.notification-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.notification-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.notification-modal {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    width: 500px;
    max-width: 95vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.notification-modal-overlay.active .notification-modal {
    transform: scale(1) translateY(0);
}

.notification-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.notification-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.notification-modal-header h3 i {
    color: var(--primary);
}

.notification-modal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification-modal-header .btn-mark-all {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.notification-modal-header .btn-mark-all:hover {
    background: var(--primary);
    color: white;
}

.notification-modal-header .btn-close-modal {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-size: 18px;
}

.notification-modal-header .btn-close-modal:hover {
    background: var(--danger);
    color: white;
}

.notification-modal-list {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}

.notification-modal-list .notification-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.notification-modal-list .notification-empty {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-light);
}

.notification-modal-list .notification-empty i {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
    color: var(--text-muted);
}

.notification-modal-list .notification-empty p {
    font-size: 14px;
    margin: 0;
}

.notification-modal-list .notification-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 24px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.notification-modal-list .notification-item:last-child {
    border-bottom: none;
}

.notification-modal-list .notification-item:hover {
    background: var(--bg-hover);
}

.notification-modal-list .notification-item.unread {
    background: rgba(18, 140, 126, 0.08);
}

.notification-modal-list .notification-item.unread:hover {
    background: rgba(18, 140, 126, 0.15);
}

.notification-modal-list .notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.notification-modal-list .notification-icon.info {
    background: rgba(52, 183, 241, 0.15);
    color: #34B7F1;
}

.notification-modal-list .notification-icon.success {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.notification-modal-list .notification-icon.warning {
    background: rgba(245, 159, 0, 0.15);
    color: #f59f00;
}

.notification-modal-list .notification-icon.error {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}

.notification-modal-list .notification-icon.message {
    background: rgba(18, 140, 126, 0.15);
    color: #25D366;
}

.notification-modal-list .notification-content {
    flex: 1;
    min-width: 0;
}

.notification-modal-list .notification-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.notification-modal-list .notification-item.unread .notification-title {
    color: var(--primary);
}

.notification-modal-list .notification-message {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-modal-list .notification-time {
    font-size: 11px;
    color: var(--text-light);
}

.notification-modal-list .notification-unread-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    margin-top: 5px;
}

.notification-modal-footer {
    padding: 16px 24px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

.notification-modal-footer .btn-view-all,
.notification-modal-footer .btn-view-all i,
.notification-modal-footer .btn-view-all * {
    color: #ffffff !important;
}

.notification-modal-footer .btn-view-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.notification-modal-footer .btn-view-all:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(18, 140, 126, 0.3);
}

/* Responsive */

/* ========== MOBILE MENU BUTTON ========== */

.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    margin-right: 12px;
}

.mobile-menu-btn:hover {
    background: var(--primary);
    color: white;
}

.mobile-menu-btn i {
    font-size: 18px;
}

/* ========== MAIN CONTENT ========== */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    margin-left: 0 !important;
    width: 100% !important;
    position: relative;
}

/* Forçar 100% de largura em todos os containers de página */
.page-content,
.content-wrapper,
.dashboard-content,
.page-container,
.main-container,
.content-area {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box;
}

/* Header */
.main-header {
    height: var(--header-height);
    background: var(--header-bg, var(--bg-primary));
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    color: var(--header-text);
}

.header-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--header-text, var(--text-primary));
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition);
    position: relative;
}

.header-btn:hover {
    background: var(--bg-secondary);
    color: var(--primary);
}

.header-btn .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
}

/* Page Content */
.page-content {
    padding: 25px;
}

/* ========== CARDS ========== */

.card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

/* ========== STATS CARDS ========== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.green {
    background: rgba(37, 211, 102, 0.1);
    color: var(--success);
}

.stat-icon.blue {
    background: rgba(52, 183, 241, 0.1);
    color: var(--info);
}

.stat-icon.orange {
    background: rgba(245, 159, 0, 0.1);
    color: var(--warning);
}

.stat-icon.red {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger);
}

.stat-info h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ========== PAGE HEADER PADRONIZADO ========== */

/* ========== PAGE HEADER — Themed Card ========== */
.page-header,
.fiscal-header,
.bling-header,
.scaffold-header,
.calculator-header,
.prec-page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 22px 24px;
    background: var(--accent, #25D366);
    border: none;
    border-radius: 16px;
    margin-bottom: 24px;
    min-height: 70px;
    color: #fff;
    position: relative;
}

.page-header .mobile-menu-btn {
    display: none;
}

.page-header-icon,
.fiscal-header-icon,
.bling-header-icon,
.scaffold-header-icon,
.calculator-header-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.page-header-icon i,
.fiscal-header-icon i,
.bling-header-icon i,
.scaffold-header-icon i,
.calculator-header-icon i {
    font-size: 22px;
    color: #fff;
}

.page-header-info,
.fiscal-header-info,
.bling-header-info,
.scaffold-header-info,
.calculator-header-info {
    flex: 1;
    min-width: 0;
}

.page-header-info h1,
.fiscal-header-info h1,
.bling-header-info h1,
.scaffold-header-info h1,
.calculator-header-info h1,
.prec-page-header h1 {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-header-info p,
.fiscal-header-info p,
.bling-header-info p,
.scaffold-header-info p,
.calculator-header-info p,
.prec-page-header p {
    font-size: 13px;
    color: rgba(255,255,255,0.85);
    margin: 0;
}

.page-header-actions,
.fiscal-header-actions,
.bling-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Botões dentro de page-header */
.page-header-actions .btn,
.page-header-actions button,
.fiscal-header-actions .btn-header,
.fiscal-header-actions button,
.bling-header-actions button,
.bling-header-actions a {
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

/* Icon-only header buttons */
.btn-header-icon {
    padding: 8px 12px !important;
    font-size: 0 !important;
    min-width: 38px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-header-icon i {
    font-size: 15px !important;
}
.page-header-actions .btn:hover,
.page-header-actions button:hover,
.fiscal-header-actions .btn-header:hover,
.fiscal-header-actions button:hover,
.bling-header-actions button:hover,
.bling-header-actions a:hover {
    background: rgba(255,255,255,0.32);
}

/* Fiscal header buttons: icon-only on mobile */
@media (max-width: 768px) {
    .fiscal-header {
        flex-wrap: wrap;
        padding: 14px 16px;
        gap: 10px;
    }
    .fiscal-header-info h1 {
        font-size: 16px;
    }
    .fiscal-header-info p {
        font-size: 11px;
    }
    .fiscal-header-actions {
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
        justify-content: flex-start;
    }
    .fiscal-header-actions button,
    .fiscal-header-actions .btn-header {
        padding: 8px 10px;
        font-size: 0;
        min-width: 36px;
        min-height: 36px;
        justify-content: center;
    }
    .fiscal-header-actions button i,
    .fiscal-header-actions .btn-header i {
        font-size: 14px;
    }
}

/* Period filter buttons inside header */
.page-header-actions .period-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.page-header-actions .period-btn:hover,
.page-header-actions .period-btn.active {
    background: rgba(255,255,255,0.35);
}

/* ========== BUTTONS ========== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    color: var(--text-primary);
}

.btn-primary {
    background: var(--accent, #25D366);
    color: white;
}

.btn-primary:hover {
    filter: brightness(0.88);
}

.btn-secondary {
    background: var(--btn-secondary-bg, #6B7280);
    color: var(--btn-secondary-text, #ffffff);
}

.btn-secondary:hover {
    background: var(--btn-secondary-hover, #4B5563);
}

.btn-danger {
    background: var(--btn-danger-bg, var(--danger));
    color: var(--btn-danger-text, #ffffff);
}

.btn-danger:hover {
    background: var(--btn-danger-hover, #c82333);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary, #1a1a2e);
}

.btn-outline:hover {
    background: var(--bg-secondary);
    color: var(--primary, #128C7E);
    border-color: var(--primary, #128C7E);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
}

/* Ícones dentro de botões herdam cor do texto do botão */
.btn i,
.btn-primary i,
.btn-secondary i,
.btn-success i,
.btn-danger i,
.btn-warning i,
.btn-info i {
    color: inherit !important;
}

/* Botao de resposta automatica IA */
#btn-auto-response {
    transition: all 0.3s ease;
}

#btn-auto-response.active {
    background: var(--primary);
    color: white;
    animation: pulse-ai 2s infinite;
}

#btn-auto-response.active i {
    color: white;
}

#btn-auto-response.loading {
    opacity: 0.6;
    pointer-events: none;
}

@keyframes pulse-ai {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(37, 211, 102, 0);
    }
}

/* ========== FORMS ========== */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--input-border, var(--border-color));
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    transition: var(--transition);
    background: var(--bg-input, var(--bg-primary));
    color: var(--input-text, var(--text-primary));
}

/* Garantir que selects e inputs herdem cores corretas em qualquer tema */
select.form-control,
select {
    background-color: var(--bg-input, var(--bg-primary));
    color: var(--input-text, var(--text-primary));
}

select.form-control option,
select option {
    background-color: var(--bg-input, var(--bg-primary));
    color: var(--input-text, var(--text-primary));
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.2);
}

.form-control::placeholder {
    color: var(--text-light);
}

/* Corrigir autofill do navegador (fundo amarelo com texto ilegível) */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
select:-webkit-autofill,
textarea:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 30px var(--bg-secondary, #1E293B) inset !important;
    -webkit-text-fill-color: var(--text-primary, #F8FAFC) !important;
    box-shadow: 0 0 0 30px var(--bg-secondary, #1E293B) inset !important;
    caret-color: var(--text-primary, #F8FAFC) !important;
}

/* Tema claro - autofill */
/* Estilo para inputs de data e hora */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    color-scheme: dark;
}

/* Garantir que os ícones de calendário/hora sejam visíveis */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(0.5);
    cursor: pointer;
}

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

.form-select {
    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='%23667781' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

/* ========== TABLES ========== */

.table-container {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr:hover {
    background: var(--bg-secondary);
}

/* ========== BADGES ========== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.badge-success {
    background: #10B981 !important;
    color: #ffffff !important;
}

.badge-warning {
    background: #F59E0B !important;
    color: #ffffff !important;
}

.badge-danger {
    background: #EF4444 !important;
    color: #ffffff !important;
}

.badge-info {
    background: #3B82F6 !important;
    color: #ffffff !important;
}

.badge-primary {
    background: var(--primary) !important;
    color: #ffffff !important;
}

.badge-secondary {
    background: #6B7280 !important;
    color: #ffffff !important;
}

/* Garantir texto branco em TODOS os badges/pills/counts com fundo colorido */
[class*="badge"][class*="-"],
.badge-count,
[class*="-pill"],
[class*="-count"]:not(.char-count):not(.results-count),
.unread-badge,
[class*="unread-badge"],
.tag-chip,
.gh-rank-badge,
[class*="rank-badge"] {
    color: #ffffff !important;
}

/* Garantir texto branco em botões/links com fundo colorido */
.btn-view-all,
.btn-mark-all:hover,
.filter-chip.active,
[class*="tab"].active,
[class*="tab"].active .badge,
[class*="tab"].active span {
    color: #ffffff !important;
}

/* ========== MODALS ========== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--danger);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ========== TOAST NOTIFICATIONS ========== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 15px 20px;
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
    pointer-events: auto;
}

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

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast.info {
    border-left: 4px solid var(--info);
}

.toast-icon {
    font-size: 20px;
}

.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--info); }

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ========== DROPDOWN ========== */

.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: 8px 0;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    color: var(--text-primary);
    transition: var(--transition);
}

.dropdown-item:hover {
    background: var(--bg-secondary);
}

.dropdown-item i {
    width: 20px;
    color: var(--text-secondary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

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

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

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

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

/* ========== EMPTY STATE ========== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 64px;
    color: var(--border-color);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* ========== RESPONSIVE ========== */

/* ========================================
   MOBILE RESPONSIVENESS - COMPREHENSIVE
   ======================================== */

/* Mobile First Breakpoint System */

/* Mobile: < 768px */

/* Tablet: 768px - 1023px */

/* Desktop only */
.mobile-menu-btn {
    display: none !important;
}

.sidebar-overlay {
    display: none !important;
}

/* Mobile adjustments for specific page headers */

/* ========================================
   MOBILE OPTIMIZATION - COMPACT MODE
   Fontes menores, botões compactos, dropdowns
   ======================================== */

/* ========================================
   MOBILE ACTION DROPDOWN - Botão com Menu
   ======================================== */

.mobile-actions-dropdown {
    position: relative;
    display: none;
}

/* ========================================
   FLOATING TERMINAL BUTTON
   ======================================== */

.floating-terminal-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent, #25D366);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    transition: all 0.3s ease;
    text-decoration: none;
}

.floating-terminal-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.25);
    color: #fff;
}

.floating-terminal-btn .tooltip {
    position: absolute;
    right: 70px;
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.floating-terminal-btn:hover .tooltip {
    opacity: 1;
}

/* ========================================
   MOBILE FLOATING ACTION BUTTON (FAB)
   ======================================== */

.mobile-fab-group {
    display: none;
}

/* ========================================
   MOBILE BOTTOM TABS (Alternative Navigation)
   ======================================== */

.mobile-bottom-tabs {
    display: none;
}

/* ========================================
   MOBILE COMPACT FILTERS
   ======================================== */

/* ========================================
   MOBILE SWIPE ACTIONS (for lists)
   ======================================== */

/* ========================================
   MOBILE TYPOGRAPHY UTILITY CLASSES
   ======================================== */

/* ========================================
   MOBILE ULTRA COMPACT - DIAGRAMAÇÃO
   Tabelas, Modais, Grids, Forms
   ======================================== */

/* ===== MOBILE LANDSCAPE ESPECÍFICO ===== */

/* ===== MOBILE EXTRA PEQUENO (< 380px) ===== */

/* ========================================
   TEMA CLARO - CORRECOES DE CONTRASTE
   ======================================== */

/* Fundo geral das páginas - Tema Claro */
/* Containers e divs com fundo - Tema Claro */
/* NOTA: NÃO usar seletores genéricos como [style*="background: #0"] pois pegam o header/sidebar */

/* Chat area - Tema Claro */
/* Chat messages background */
/* Preview panel - Tema Claro */
/* Sidebar de conversas - Tema Claro */
/* Inputs e Forms - Tema Claro - TODOS OS INPUTS */
/* Inputs com estilo inline */
/* Inputs dentro de containers escuros */
/* Inputs desabilitados */
/* Cards - Tema Claro */
/* Tabelas - Tema Claro */
/* Modais - Tema Claro */
/* Sidebar - Tema Claro (quando sidebar também é clara) */
/* Labels e Textos - Tema Claro */
/* Dropdowns - Tema Claro */
/* Tabs - Tema Claro */
/* Botões - Tema Claro (gerenciado pelo branding dinâmico) */

/* Page Header - Themed (light/dark ambos usam accent) */

/* Alerts - Tema Claro */
/* Botões secundários - Tema Claro - usar variáveis do sistema */

/* ========================================
   BOTÕES GLOBAIS - CORES VIA CSS VARIABLES
   ======================================== */

/* Botão Primário — usa accent do tema */
.btn-primary,
button.btn-primary,
a.btn-primary {
    background: var(--accent, #25D366) !important;
    background-color: var(--accent, #25D366) !important;
    color: #fff !important;
    border: none !important;
    font-weight: 600 !important;
}

.btn-primary:hover,
button.btn-primary:hover,
a.btn-primary:hover {
    filter: brightness(0.88);
}

/* Botão Success */
.btn-success,
button.btn-success,
a.btn-success {
    background: var(--btn-success-bg, #22C55E) !important;
    background-color: var(--btn-success-bg, #22C55E) !important;
    color: var(--btn-success-text, #ffffff) !important;
    border: none !important;
    font-weight: 600 !important;
}

.btn-success:hover,
button.btn-success:hover,
a.btn-success:hover {
    background: var(--btn-success-hover, #16a34a) !important;
    background-color: var(--btn-success-hover, #16a34a) !important;
}

/* Botão Danger */
.btn-danger,
button.btn-danger,
a.btn-danger {
    background: var(--btn-danger-bg, #EF4444) !important;
    background-color: var(--btn-danger-bg, #EF4444) !important;
    color: var(--btn-danger-text, #ffffff) !important;
    border: none !important;
    font-weight: 600 !important;
}

.btn-danger:hover,
button.btn-danger:hover,
a.btn-danger:hover {
    background: var(--btn-danger-hover, #dc2626) !important;
    background-color: var(--btn-danger-hover, #dc2626) !important;
}

/* Botão Warning */
.btn-warning,
button.btn-warning,
a.btn-warning {
    background: var(--btn-warning-bg, #F59E0B) !important;
    background-color: var(--btn-warning-bg, #F59E0B) !important;
    color: var(--btn-warning-text, #ffffff) !important;
    border: none !important;
    font-weight: 600 !important;
}

.btn-warning:hover,
button.btn-warning:hover,
a.btn-warning:hover {
    background: var(--btn-warning-hover, #d97706) !important;
    background-color: var(--btn-warning-hover, #d97706) !important;
}

/* Botão Info */
.btn-info,
button.btn-info,
a.btn-info {
    background: var(--btn-info-bg, #3B82F6) !important;
    background-color: var(--btn-info-bg, #3B82F6) !important;
    color: var(--btn-info-text, #ffffff) !important;
    border: none !important;
    font-weight: 600 !important;
}

.btn-info:hover,
button.btn-info:hover,
a.btn-info:hover {
    background: var(--btn-info-hover, #2563eb) !important;
    background-color: var(--btn-info-hover, #2563eb) !important;
}

/* Botão Secondary */
.btn-secondary,
button.btn-secondary,
a.btn-secondary {
    background: var(--btn-secondary-bg, #6B7280) !important;
    background-color: var(--btn-secondary-bg, #6B7280) !important;
    color: var(--btn-secondary-text, #ffffff) !important;
    border: none !important;
    font-weight: 600 !important;
}

.btn-secondary:hover,
button.btn-secondary:hover,
a.btn-secondary:hover {
    background: var(--btn-secondary-hover, #4B5563) !important;
    background-color: var(--btn-secondary-hover, #4B5563) !important;
}

/* Botão Outline Primary */
.btn-outline-primary {
    background: transparent !important;
    color: var(--btn-primary-bg) !important;
    border: 2px solid var(--btn-primary-bg) !important;
    font-weight: 600 !important;
}

.btn-outline-primary:hover {
    background: var(--btn-primary-bg) !important;
    color: var(--btn-primary-text) !important;
}

/* Botões pequenos com ícones */
.btn-sm,
button.btn-sm {
    font-weight: 600 !important;
}

/* Botões de ação em cards/tabelas */
.action-btn,
.table-action-btn,
[class*="action-btn"] {
    font-weight: 600 !important;
}

/* Stats Cards - Tema Claro */
/* Settings específico - Tema Claro */
/* Live/Atendimento - Tema Claro */
/* Modal de chat - Tema Claro */
/* Chat input area - Tema Claro */
/* Painéis laterais - Tema Claro */
/* Headers de seções - Tema Claro */
/* Textos em geral - Tema Claro */
/* Forçar fundo claro em containers com var() escuro */
/* Toasts/Notifications - Tema Claro */
/* Menu de contexto - Tema Claro */
/* ========================================
   PROTEGER TEXTO BRANCO EM CONTAINERS COM FUNDO ESCURO/COLORIDO
   ======================================== */
/* Notification banner - sempre texto branco (fundo escuro fixo) */
/* Celebration banner - sempre texto branco */
/* Toast - manter texto legível */
/* ========================================
   CORES VIVAS — BADGES, PILLS, BOTÕES
   Forçar cores sólidas e saturadas, nunca pastéis.
   Texto sempre branco para máximo contraste.
   ======================================== */

/* Badges — cores fortes sólidas + texto branco */
/* Todos badges/pills/chips genéricos — garantir texto branco */
/* bg-*-light — aumentar saturação de 0.1 para 0.22 no tema claro */
/* Stat icons — mais intensos no tema claro */
/* Botões — forçar texto branco em botões coloridos no tema claro */
/* Notification icons — mais intensos */
/* ========================================
   PASTEL → VIVO: Override cores pastéis em badges/pills/chips
   Converte fundos claros (#dcfce7, #D1FAE5, #FEF3C7, etc.)
   em cores vivas sólidas com texto branco.
   ======================================== */

/* --- Green pastels (#dcfce7 / #D1FAE5 / #f0fdf4) → Vivid Emerald #059669 --- */
/* --- Yellow/Amber pastels (#FEF3C7 / #FDE68A) → Vivid Amber #D97706 --- */
/* --- Blue pastels (#DBEAFE / #BFDBFE) → Vivid Blue #2563EB --- */
/* --- Indigo pastels (#E0E7FF) → Vivid Indigo #4F46E5 --- */
/* --- Red pastels (#FEE2E2) → Vivid Red #DC2626 --- */
/* --- Inline style pastel overrides for span badges --- */
/* Discount tags + table headers in catalogo */
/* ========================================
   BADGES SUAVES — FUNDO CLARO + TEXTO COLORIDO
   Padrão moderno: rgba(cor, 0.12) bg + cor viva texto
   Funciona bem em ambos os temas (claro e escuro)
   ======================================== */

/* --- Status badges genéricos (todas as páginas) --- */
.status-new,
.status-novo,
.status-draft { background: rgba(37, 99, 235, 0.12) !important; color: #1d4ed8 !important; }

.status-contacted,
.status-sending,
.status-scheduled,
.status-paused { background: rgba(217, 119, 6, 0.12) !important; color: #b45309 !important; }

.status-qualified,
.status-aguardando { background: rgba(124, 58, 237, 0.12) !important; color: #6d28d9 !important; }

.status-converted,
.status-completed,
.status-confirmed,
.status-sent,
.status-done { background: rgba(5, 150, 105, 0.12) !important; color: #047857 !important; }

.status-lost,
.status-cancelled,
.status-failed,
.status-error { background: rgba(220, 38, 38, 0.12) !important; color: #b91c1c !important; }

/* --- Visita status (leads-business) --- */
.visita-status.pending { background: rgba(217, 119, 6, 0.12) !important; color: #b45309 !important; }
.visita-status.confirmed { background: rgba(37, 99, 235, 0.12) !important; color: #1d4ed8 !important; }
.visita-status.completed { background: rgba(5, 150, 105, 0.12) !important; color: #047857 !important; }
.visita-status.cancelled { background: rgba(220, 38, 38, 0.12) !important; color: #b91c1c !important; }

/* --- Channel badges (campanhas-leads) --- */
.channel-badge.whatsapp { background: rgba(5, 150, 105, 0.12) !important; color: #047857 !important; }
.channel-badge.email { background: rgba(37, 99, 235, 0.12) !important; color: #1d4ed8 !important; }
.channel-badge.instagram { background: rgba(219, 39, 119, 0.12) !important; color: #be185d !important; }

/* --- Status badges genéricos com prefixo (campanhas, pedidos, etc) --- */
.status-badge.draft { background: rgba(107, 114, 128, 0.12) !important; color: #4b5563 !important; }
.status-badge.scheduled { background: rgba(37, 99, 235, 0.12) !important; color: #1d4ed8 !important; }
.status-badge.sending { background: rgba(217, 119, 6, 0.12) !important; color: #b45309 !important; }
.status-badge.sent { background: rgba(5, 150, 105, 0.12) !important; color: #047857 !important; }
.status-badge.paused { background: rgba(217, 119, 6, 0.12) !important; color: #b45309 !important; }
.status-badge.completed { background: rgba(5, 150, 105, 0.12) !important; color: #047857 !important; }
.status-badge.cancelled { background: rgba(220, 38, 38, 0.12) !important; color: #b91c1c !important; }

/* --- Email marketing badges --- */
.em-badge-scheduled { background: rgba(37, 99, 235, 0.12) !important; color: #1d4ed8 !important; }
.em-badge-sending { background: rgba(217, 119, 6, 0.12) !important; color: #b45309 !important; }
.em-badge-sent { background: rgba(5, 150, 105, 0.12) !important; color: #047857 !important; }
.em-badge-paused { background: rgba(220, 38, 38, 0.12) !important; color: #b91c1c !important; }

/* --- HR vacation badges --- */
.vacation-alert-badge { background: rgba(217, 119, 6, 0.12) !important; color: #b45309 !important; }
.vacation-status-badge.status-pendente { background: rgba(217, 119, 6, 0.12) !important; color: #b45309 !important; }
.vacation-status-badge.status-agendado { background: rgba(37, 99, 235, 0.12) !important; color: #1d4ed8 !important; }
.vacation-status-badge.status-em_ferias { background: rgba(5, 150, 105, 0.12) !important; color: #047857 !important; }

/* --- Pago badge --- */
.pago-badge.pago { background: rgba(5, 150, 105, 0.12) !important; color: #047857 !important; }

/* --- Debug step headers (bling-comissoes) --- */
.debug-step-header.running { background: rgba(217, 119, 6, 0.12) !important; color: #b45309 !important; }
.debug-step-header.done { background: rgba(5, 150, 105, 0.12) !important; color: #047857 !important; }
.debug-step-header.error { background: rgba(220, 38, 38, 0.12) !important; color: #b91c1c !important; }

/* --- Quick replies category badges --- */
.qr-category-badge.sugestoes { background: rgba(79, 70, 229, 0.12) !important; color: #4338ca !important; }
.qr-category-badge.importante { background: rgba(220, 38, 38, 0.12) !important; color: #b91c1c !important; }
.qr-category-badge.atendimento { background: rgba(37, 99, 235, 0.12) !important; color: #1d4ed8 !important; }
.qr-category-badge.informacao { background: rgba(217, 119, 6, 0.12) !important; color: #b45309 !important; }
.qr-category-badge.dados { background: rgba(124, 58, 237, 0.12) !important; color: #6d28d9 !important; }
.qr-category-badge.financeiro { background: rgba(5, 150, 105, 0.12) !important; color: #047857 !important; }
.qr-category-badge.vendas { background: rgba(219, 39, 119, 0.12) !important; color: #be185d !important; }

/* --- Kanban badges (om-card-status) --- */
.om-card-status.pending { background: rgba(217, 119, 6, 0.12) !important; color: #b45309 !important; }
.om-card-status.accepted { background: rgba(5, 150, 105, 0.12) !important; color: #047857 !important; }
.om-card-status.rejected { background: rgba(220, 38, 38, 0.12) !important; color: #b91c1c !important; }

/* --- Contact badges --- */
.badge-success[class] { background: rgba(5, 150, 105, 0.12) !important; color: #047857 !important; }
.badge-info[class] { background: rgba(37, 99, 235, 0.12) !important; color: #1d4ed8 !important; }
.badge-warning[class] { background: rgba(217, 119, 6, 0.12) !important; color: #b45309 !important; }

/* --- Notification icons — suave --- */
.notification-icon.system { background: rgba(18, 140, 126, 0.12) !important; color: #0f766e !important; }
.notification-icon.assignment { background: rgba(14, 165, 233, 0.12) !important; color: #0284c7 !important; }
.notification-icon.transfer { background: rgba(20, 184, 166, 0.12) !important; color: #0d9488 !important; }
.notification-icon.payment { background: rgba(16, 185, 129, 0.12) !important; color: #059669 !important; }
.notification-icon.bling { background: rgba(249, 115, 22, 0.12) !important; color: #ea580c !important; }

/* --- Keyword tags / chips / filter chips --- */
.keyword-tag { background: rgba(5, 150, 105, 0.12) !important; color: #047857 !important; }

/* --- Action buttons — fundo suave + texto colorido --- */
.action-btn.chat { background: rgba(5, 150, 105, 0.12) !important; color: #047857 !important; }
.action-btn.edit { background: rgba(37, 99, 235, 0.12) !important; color: #1d4ed8 !important; }
.action-btn.delete { background: rgba(220, 38, 38, 0.12) !important; color: #b91c1c !important; }

/* --- Alerta parcela badge --- */
.alerta-parcela { background: rgba(217, 119, 6, 0.12) !important; color: #b45309 !important; }

/* --- Tag badges (api-docs) --- */
.tag-auth { background: rgba(217, 119, 6, 0.12) !important; color: #b45309 !important; }
.tag-admin { background: rgba(220, 38, 38, 0.12) !important; color: #b91c1c !important; }
.tag-public { background: rgba(5, 150, 105, 0.12) !important; color: #047857 !important; }

/* --- Badge por cor --- */
.badge-red { background: rgba(220, 38, 38, 0.12) !important; color: #b91c1c !important; }
.badge-orange { background: rgba(217, 119, 6, 0.12) !important; color: #b45309 !important; }
.badge-blue { background: rgba(37, 99, 235, 0.12) !important; color: #1d4ed8 !important; }
.badge-green { background: rgba(5, 150, 105, 0.12) !important; color: #047857 !important; }
.badge-purple { background: rgba(124, 58, 237, 0.12) !important; color: #6d28d9 !important; }
.badge-pink { background: rgba(219, 39, 119, 0.12) !important; color: #be185d !important; }
.badge-teal { background: rgba(13, 148, 136, 0.12) !important; color: #0f766e !important; }
.badge-cyan { background: rgba(8, 145, 178, 0.12) !important; color: #0e7490 !important; }

/* --- Stat icons — ícones decorativos (fundo suave + cor) --- */
[class*="stat-icon"].green,
[class*="stat-icon"].teal { background: rgba(5, 150, 105, 0.15) !important; color: #059669 !important; }
[class*="stat-icon"].blue { background: rgba(37, 99, 235, 0.15) !important; color: #2563EB !important; }
[class*="stat-icon"].orange,
[class*="stat-icon"].amber { background: rgba(217, 119, 6, 0.15) !important; color: #D97706 !important; }
[class*="stat-icon"].red { background: rgba(220, 38, 38, 0.15) !important; color: #DC2626 !important; }
[class*="stat-icon"].purple { background: rgba(124, 58, 237, 0.15) !important; color: #7C3AED !important; }
[class*="stat-icon"].cyan { background: rgba(6, 182, 212, 0.15) !important; color: #0891B2 !important; }
[class*="stat-icon"].pink { background: rgba(219, 39, 119, 0.15) !important; color: #DB2777 !important; }

/* --- Stat mini icons (dashboard) --- */
[class*="stat-mini-icon"].green { background: rgba(5, 150, 105, 0.15) !important; color: #059669 !important; }
[class*="stat-mini-icon"].blue { background: rgba(37, 99, 235, 0.15) !important; color: #2563EB !important; }
[class*="stat-mini-icon"].orange { background: rgba(217, 119, 6, 0.15) !important; color: #D97706 !important; }
[class*="stat-mini-icon"].purple { background: rgba(124, 58, 237, 0.15) !important; color: #7C3AED !important; }
[class*="stat-mini-icon"].cyan { background: rgba(8, 145, 178, 0.15) !important; color: #0891B2 !important; }

/* --- Ranking badges (produção) --- */
.ranking-pos.p1 { background: rgba(217, 119, 6, 0.15) !important; color: #b45309 !important; }

/* ========================================
   FORÇAR FUNDO CLARO EM TUDO - TEMA CLARO
   NOTA: NÃO usar seletores genéricos [style*="background: #0"]
   pois pegam o header (.global-header) e previews de tema (.theme-header)
   As cores do header/sidebar são controladas pelo Branding.apply()
   ======================================== */

/* Scrollbar - Tema Claro */
/* ========================================
   BADGES GLOBAIS — FUNDO SUAVE + TEXTO COLORIDO
   ======================================== */

/* Todos os badges com font-weight */
[class*="badge"],
[class*="pill"],
[class*="status-"] {
    font-weight: 600 !important;
}

/* Status badges genéricos */
.status-open, .status-active, .status-online,
[class*="status-open"], [class*="status-active"], [class*="status-online"] {
    background: rgba(16, 185, 129, 0.12) !important;
    color: #047857 !important;
}

.status-pending, .status-waiting,
[class*="status-pending"], [class*="status-waiting"] {
    background: rgba(245, 158, 11, 0.12) !important;
    color: #b45309 !important;
}

.status-closed, .status-inactive, .status-offline,
[class*="status-closed"], [class*="status-inactive"], [class*="status-offline"] {
    background: rgba(107, 114, 128, 0.12) !important;
    color: #4b5563 !important;
}

.status-error, .status-failed,
[class*="status-error"], [class*="status-failed"] {
    background: rgba(239, 68, 68, 0.12) !important;
    color: #b91c1c !important;
}

/* Quote/Order status */
.quote-status, .order-status {
    padding: 3px 8px !important;
    border-radius: 4px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
}

.quote-status.pendente, .order-status.pendente,
.quote-status.em-aberto, .order-status.em-aberto {
    background: rgba(245, 158, 11, 0.12) !important;
    color: #b45309 !important;
}

.quote-status.aprovado, .order-status.aprovado,
.quote-status.aceita, .order-status.aceita {
    background: rgba(16, 185, 129, 0.12) !important;
    color: #047857 !important;
}

.quote-status.enviado, .order-status.enviado {
    background: rgba(59, 130, 246, 0.12) !important;
    color: #1d4ed8 !important;
}

.quote-status.cancelado, .order-status.cancelado,
.quote-status.recusada, .order-status.recusada {
    background: rgba(239, 68, 68, 0.12) !important;
    color: #b91c1c !important;
}

/* Nav badges (notificações — exceção: mantém vermelho sólido para destaque) */
.nav-badge {
    background: #EF4444 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
}

/* Tab badges */
.tab-btn .badge {
    background: rgba(18, 140, 126, 0.12) !important;
    color: var(--primary, #128C7E) !important;
}

/* Contact badges no modal de informações */
.contact-badge {
    padding: 4px 10px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
}

.contact-badge.status-open {
    background: rgba(16, 185, 129, 0.12) !important;
    color: #047857 !important;
}

.contact-badge.status-pending {
    background: rgba(245, 158, 11, 0.12) !important;
    color: #b45309 !important;
}

.contact-badge.status-closed {
    background: rgba(107, 114, 128, 0.12) !important;
    color: #4b5563 !important;
}

.contact-badge.badge-agent {
    background: rgba(139, 92, 246, 0.12) !important;
    color: #7c3aed !important;
}

.contact-badge.badge-queue {
    background: rgba(59, 130, 246, 0.12) !important;
    color: #1d4ed8 !important;
}

.contact-badge.badge-connection {
    background: rgba(16, 185, 129, 0.12) !important;
    color: #047857 !important;
}

/* Conversation pills */
.conv-pill {
    font-weight: 600 !important;
}

/* Header badges */
.header-btn .badge {
    background: #EF4444 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
}

/* ========================================
   CHAT PAGE - SPLIT VIEW STYLES (chat.html)
   ======================================== */

/* Preview message styles for chat page */
.preview-date-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.preview-date-divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: var(--border-color);
}

.preview-date-divider span,
.preview-date-divider {
    display: inline-block;
    padding: 4px 12px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    border-radius: 8px;
    position: relative;
    z-index: 1;
}

/* Chat message bubbles */
.preview-msg {
    display: flex;
    flex-direction: column;
    max-width: 70%;
    margin-bottom: 8px;
    animation: msgFadeIn 0.2s ease;
}

@keyframes msgFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.preview-msg.sent {
    align-self: flex-end;
    margin-left: auto;
}

.preview-msg.received {
    align-self: flex-start;
    margin-right: auto;
}

.preview-msg-content {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.preview-msg.sent .preview-msg-content {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.preview-msg.received .preview-msg-content {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.preview-msg-time {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.preview-msg.sent .preview-msg-time {
    justify-content: flex-end;
}

.preview-msg.received .preview-msg-time {
    justify-content: flex-start;
}

/* Message status icons */
.msg-status {
    font-size: 10px;
    color: var(--text-secondary);
}

.msg-status.read {
    color: #3B82F6;
}

/* Media in messages */
.msg-media {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    object-fit: contain;
}

.msg-audio {
    width: 100%;
    max-width: 250px;
    height: 36px;
}

.msg-document {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(0,0,0,0.1);
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
    font-size: 13px;
}

.msg-document:hover {
    background: rgba(0,0,0,0.15);
}

.msg-sticker {
    max-width: 150px;
    max-height: 150px;
}

.msg-caption {
    margin-top: 6px;
    font-size: 13px;
}

/* Unified chat item styles (for both live.html and chat.html) */
.unified-chat-item {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-card);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.unified-chat-item:hover {
    background: var(--bg-hover);
}

.unified-chat-item.pending {
    border-left: 3px solid #F59E0B;
}

.unified-chat-item.open {
    border-left: 3px solid #10B981;
}

.unified-chat-item.closed {
    border-left: 3px solid #6B7280;
    opacity: 0.8;
}

.unified-chat-avatar {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    color: white;
    background: var(--primary);
    position: relative;
    overflow: hidden;
}

.unified-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.unified-chat-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.unified-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.unified-chat-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unified-chat-time {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.unified-chat-message {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.unified-chat-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.unified-chat-pills .conv-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 500;
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.unified-chat-pills .conv-pill.connection {
    background: rgba(16, 185, 129, 0.15);
    color: #10B981;
}

.unified-chat-pills .conv-pill.agent {
    background: rgba(139, 92, 246, 0.15);
    color: #8B5CF6;
}

.unified-chat-pills .conv-pill i {
    font-size: 9px;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    font-size: 13px;
    font-weight: 500;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: auto;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast i {
    font-size: 16px;
}

.toast-success i { color: #10B981; }
.toast-error i { color: #EF4444; }
.toast-warning i { color: #F59E0B; }
.toast-info i { color: #3B82F6; }

/* ========== MINI-CHAT FLOATING WIDGET ========== */

/* FAB Button */
#mc-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary, #128C7E) 0%, var(--secondary, #075E54) 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    z-index: 99998;
    box-shadow: 0 4px 16px color-mix(in srgb, var(--primary, #128C7E) 40%, transparent);
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
}
#mc-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px color-mix(in srgb, var(--primary, #128C7E) 50%, transparent);
}
#mc-fab.mc-has-unread {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
    animation: mc-fab-pulse 2s ease-in-out infinite;
}
#mc-fab.mc-has-unread:hover {
    box-shadow: 0 6px 24px rgba(245, 158, 11, 0.5);
}
@keyframes mc-fab-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}
#mc-fab .mc-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}
#mc-fab .mc-badge.show { display: flex; }

/* FAB Toast notification */
#mc-fab-toast {
    position: fixed;
    bottom: 90px;
    right: 24px;
    background: var(--bg-primary, #fff);
    border-radius: 14px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.16), 0 0 0 1px rgba(0,0,0,0.05);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 300px;
    z-index: 99999;
    cursor: pointer;
    animation: mcToastIn 0.3s ease;
    transition: transform 0.2s;
}
#mc-fab-toast:hover {
    transform: scale(1.02);
}
.mc-toast-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #F59E0B;
}
.mc-toast-avatar-initial {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    border: 2px solid #F59E0B;
}
.mc-toast-content {
    overflow: hidden;
    flex: 1;
}
.mc-toast-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary, #1e293b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mc-toast-preview {
    font-size: 12px;
    color: var(--text-secondary, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}
@keyframes mcToastIn {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes mcToastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(20px) scale(0.9); }
}

/* Panel */
#mc-panel {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 380px;
    height: 420px;
    background: var(--bg-primary, #fff);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    z-index: 99998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color, #e2e8f0);
}
#mc-panel.open { display: flex; }

/* Mini-chat panel mobile: reduce height so header is visible */
@media (max-width: 768px) {
    #mc-panel {
        bottom: 80px;
        right: 8px;
        left: 8px;
        width: auto;
        height: calc(100dvh - 160px);
        max-height: 480px;
        border-radius: 14px;
    }
    #mc-fab {
        bottom: 16px;
        right: 16px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    #mc-fab-toast {
        bottom: 76px;
        right: 16px;
        max-width: calc(100vw - 32px);
    }
}

/* Panel Header */
.mc-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--primary, #128C7E) 0%, var(--secondary, #075E54) 100%);
    color: #fff;
    gap: 10px;
    min-height: 48px;
}
.mc-header h4 { margin: 0; font-size: 15px; font-weight: 600; flex: 1; }
.mc-header button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: background 0.2s;
}
.mc-header button:hover { background: rgba(255,255,255,0.35); }

/* Tabs */
.mc-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-secondary, #f8f9fa);
}
.mc-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--text-secondary, #4a5568);
    position: relative;
    transition: color 0.2s;
}
.mc-tab:hover { color: var(--text-primary, #1a1a2e); }
.mc-tab.active { color: var(--primary, #128C7E); font-weight: 600; }
.mc-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0; left: 20%; right: 20%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary, #128C7E), var(--secondary, #075E54));
    border-radius: 3px 3px 0 0;
}
.mc-tab .mc-tab-badge {
    display: inline-flex;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    margin-left: 5px;
    vertical-align: middle;
}

/* Body / Content */
.mc-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Channel List */
.mc-channel-list { flex: 1; overflow-y: auto; }
.mc-channel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border-color, rgba(0,0,0,0.04));
}
.mc-channel-item:hover { background: rgba(139,92,246,0.05); }
.mc-channel-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    flex-shrink: 0;
    overflow: hidden;
}
.mc-channel-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mc-channel-info { flex: 1; min-width: 0; }
.mc-channel-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #1a1a2e);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mc-channel-preview {
    font-size: 12px;
    color: var(--text-secondary, #4a5568);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mc-channel-meta { text-align: right; flex-shrink: 0; }
.mc-channel-time {
    font-size: 11px;
    color: var(--text-secondary, #4a5568);
    display: block;
}
.mc-unread {
    display: inline-flex;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: #8B5CF6;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    margin-top: 2px;
}

/* Chat View (inside panel) */
.mc-chat-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-secondary, #f8f9fa);
}
.mc-chat-header .mc-back {
    background: none; border: none;
    color: var(--text-secondary, #4a5568);
    cursor: pointer; font-size: 15px; padding: 4px;
}
.mc-chat-header .mc-chat-name {
    font-size: 13px; font-weight: 600; flex: 1;
    color: var(--text-primary, #1a1a2e);
}
.mc-chat-header .mc-open-full {
    background: none; border: none;
    color: var(--text-secondary, #4a5568);
    cursor: pointer; font-size: 13px; padding: 4px;
    title: "Abrir pagina completa";
}
.mc-chat-header .mc-open-full:hover { color: #8B5CF6; }

.mc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.mc-msg {
    max-width: 85%;
    padding: 7px 11px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
}
.mc-msg.outgoing {
    align-self: flex-end;
    background: linear-gradient(135deg, #8B5CF6, #7C3AED);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.mc-msg.incoming {
    align-self: flex-start;
    background: var(--bg-tertiary, #e9ecef);
    color: var(--text-primary, #1a1a2e);
    border-bottom-left-radius: 4px;
}
.mc-msg .mc-msg-sender {
    font-size: 11px;
    font-weight: 600;
    color: #EC4899;
    margin-bottom: 2px;
}
.mc-msg .mc-msg-time {
    font-size: 10px;
    opacity: 0.7;
    text-align: right;
    margin-top: 2px;
}
.mc-msg.outgoing .mc-msg-time { color: rgba(255,255,255,0.7); }
.mc-msg.incoming .mc-msg-time { color: var(--text-secondary, #4a5568); }

/* Reply quote inside message bubble */
.mc-reply-quote {
    background: rgba(0,0,0,0.08);
    border-left: 3px solid #8B5CF6;
    border-radius: 4px;
    padding: 4px 8px;
    margin-bottom: 5px;
    cursor: pointer;
    font-size: 11px;
    line-height: 1.3;
    max-height: 42px;
    overflow: hidden;
}
.mc-reply-quote b {
    display: block;
    color: #8B5CF6;
    font-size: 10px;
    margin-bottom: 1px;
}
.mc-reply-quote span {
    opacity: 0.8;
}
.mc-msg.outgoing .mc-reply-quote {
    background: rgba(255,255,255,0.15);
    border-left-color: rgba(255,255,255,0.6);
}
.mc-msg.outgoing .mc-reply-quote b {
    color: rgba(255,255,255,0.9);
}

/* Reply button on hover */
.mc-msg {
    position: relative;
}
.mc-reply-btn {
    display: none;
    position: absolute;
    top: 4px;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary, #64748b);
    font-size: 11px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
    z-index: 2;
    transition: background 0.15s;
}
.mc-msg.outgoing .mc-reply-btn { left: -14px; }
.mc-msg.incoming .mc-reply-btn { right: -14px; }
.mc-reply-btn:hover {
    background: var(--accent, #8B5CF6);
    color: #fff;
    border-color: var(--accent, #8B5CF6);
}
.mc-msg:hover .mc-reply-btn {
    display: flex;
}

/* Reply preview bar above input */
.mc-reply-bar {
    display: none;
    align-items: center;
    padding: 6px 10px;
    background: var(--bg-secondary, #f1f5f9);
    border-top: 1px solid var(--border-color, #e2e8f0);
    border-left: 3px solid var(--accent, #8B5CF6);
    gap: 6px;
    font-size: 12px;
}
.mc-reply-bar-content {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
}
.mc-reply-bar-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.mc-reply-bar-text b {
    color: var(--accent, #8B5CF6);
    font-size: 11px;
}
.mc-reply-bar-text span {
    color: var(--text-secondary, #64748b);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mc-reply-bar-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary, #64748b);
    font-size: 14px;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mc-reply-bar-close:hover {
    background: rgba(0,0,0,0.08);
    color: var(--text-primary);
}

/* AI messages in mini-chat */
.mc-msg.ai-assistant {
    align-self: flex-start;
    background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(236,72,153,0.08));
    color: var(--text-primary, #1a1a2e);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(139,92,246,0.15);
}
.mc-msg.ai-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #8B5CF6, #7C3AED);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Input */
.mc-input-area {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 8px 10px;
    border-top: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-primary, #fff);
}
.mc-input-area textarea {
    flex: 1;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13px;
    resize: none;
    outline: none;
    max-height: 80px;
    font-family: inherit;
    background: var(--bg-secondary, #f8f9fa);
    color: var(--text-primary, #1a1a2e);
}
.mc-input-area textarea:focus { border-color: #8B5CF6; }
.mc-input-area button {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    transition: all 0.15s;
}
.mc-btn-send {
    background: linear-gradient(135deg, #8B5CF6, #EC4899);
    color: #fff;
}
.mc-btn-send:hover { transform: scale(1.08); }
.mc-btn-mic {
    background: none;
    color: var(--text-secondary, #4a5568);
}
.mc-btn-mic:hover { color: #8B5CF6; }
.mc-btn-mic.recording { color: #ef4444 !important; }
.mc-btn-attach { color: var(--text-secondary, #4a5568); }
.mc-btn-attach:hover { color: #3B82F6; }
.mc-file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 10px;
    border-top: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-secondary, #f8f9fa);
}
.mc-file-thumb {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color, #e2e8f0);
    background: #f1f5f9;
}
.mc-file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mc-file-thumb .mc-file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 16px;
    color: #64748b;
}
.mc-file-thumb .mc-file-remove {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.mc-msg-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}
.mc-msg-attachments img {
    max-width: 140px;
    max-height: 100px;
    border-radius: 6px;
    cursor: pointer;
}
.mc-att-doc {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    background: rgba(0,0,0,0.06);
    border-radius: 6px;
    font-size: 10px;
    color: inherit;
    text-decoration: none;
}

/* Mini recording bar */
.mc-recording-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: linear-gradient(135deg, #991b1b, #7f1d1d);
    border-radius: 8px;
    margin: 4px 10px;
}
.mc-recording-bar .mc-rec-pulse {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #ef4444;
    animation: mc-rec-pulse 1s ease-in-out infinite;
}
@keyframes mc-rec-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.mc-recording-bar .mc-rec-time {
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    flex: 1;
}
.mc-recording-bar canvas { flex: 1; height: 28px; }
.mc-recording-bar button {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}
.mc-rec-cancel { background: rgba(255,255,255,0.15); color: #fca5a5; }
.mc-rec-confirm { background: #22c55e; color: #fff; }

/* Typing dots in mini chat */
.mc-typing {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    font-size: 12px;
    color: var(--text-secondary, #4a5568);
}
.mc-typing .dot-bounce {
    display: inline-flex; gap: 3px;
}
.mc-typing .dot-bounce span {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: #8B5CF6;
    animation: mc-dot-bounce 1.4s ease-in-out infinite;
}
.mc-typing .dot-bounce span:nth-child(2) { animation-delay: 0.2s; }
.mc-typing .dot-bounce span:nth-child(3) { animation-delay: 0.4s; }
@keyframes mc-dot-bounce {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.2); }
}

/* Transcribing in mini chat */
.mc-transcribing {
    font-size: 12px;
    color: #8B5CF6;
    padding: 4px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Empty state */
.mc-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-secondary, #4a5568);
    font-size: 13px;
    padding: 30px;
}
.mc-empty i { font-size: 32px; opacity: 0.3; }

/* MiniChat Toolbar */
.mc-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-secondary, #f8f9fa);
}
.mc-toolbar .mc-tool-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(139,92,246,0.1);
    color: #8B5CF6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    transition: all 0.15s;
}
.mc-toolbar .mc-tool-btn:hover {
    background: rgba(139,92,246,0.2);
    transform: scale(1.08);
}

/* MiniChat Search Box */
.mc-search-box {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 20px;
    padding: 0 10px;
    min-width: 0;
}
.mc-search-box i {
    font-size: 12px;
    color: var(--text-secondary, #94a3b8);
    flex-shrink: 0;
}
.mc-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: none;
    font-size: 13px;
    padding: 6px 0;
    color: var(--text-primary, #1a1a2e);
    font-family: inherit;
    min-width: 0;
}
.mc-search-input::placeholder {
    color: var(--text-secondary, #94a3b8);
}

/* Online Dot */
.mc-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid var(--bg-primary, #fff);
    z-index: 1;
}

/* User List */
.mc-user-list {
    flex: 1;
    overflow-y: auto;
}
.mc-user-section {
    padding: 8px 14px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary, #94a3b8);
}
.mc-user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.15s;
}
.mc-user-item:hover {
    background: rgba(139,92,246,0.06);
}
.mc-user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary, #1a1a2e);
}

/* Priority Bar (team chat) */
.mc-priority-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-top: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-secondary, #f8f9fa);
}
.mc-pri-btn {
    padding: 3px 10px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    background: var(--bg-primary, #fff);
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary, #64748b);
    font-weight: 500;
}
.mc-pri-btn i { margin-right: 2px; }
.mc-pri-btn.active {
    border-color: #8B5CF6;
    background: rgba(139,92,246,0.1);
    color: #8B5CF6;
}
.mc-pri-btn[data-priority="urgent"].active {
    border-color: #F59E0B;
    background: rgba(245,158,11,0.1);
    color: #b45309;
}
.mc-pri-btn[data-priority="critical"].active {
    border-color: #EF4444;
    background: rgba(239,68,68,0.1);
    color: #dc2626;
}

/* Priority badges in messages */
.mc-priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 3px;
    margin-bottom: 4px;
}
.mc-priority-badge.urgent {
    background: rgba(245,158,11,0.15);
    color: #b45309;
}
.mc-priority-badge.critical {
    background: rgba(239,68,68,0.15);
    color: #dc2626;
}
.mc-msg.mc-priority-urgent {
    border-left: 3px solid #F59E0B;
}
.mc-msg.mc-priority-critical {
    border-left: 3px solid #EF4444;
    animation: mc-critical-glow 2s infinite;
}
@keyframes mc-critical-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
    50% { box-shadow: 0 0 6px 2px rgba(239,68,68,0.25); }
}

/* Attention shake effects on FAB */
#mc-fab.mc-shake-urgent {
    animation: mc-shake-urgent 0.5s ease 3;
    box-shadow: 0 4px 20px rgba(245,158,11,0.6);
}
#mc-fab.mc-shake-critical {
    animation: mc-shake-critical 0.4s ease 4;
    box-shadow: 0 4px 24px rgba(239,68,68,0.7);
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%) !important;
}
@keyframes mc-shake-urgent {
    0%, 100% { transform: translateX(0) rotate(0); }
    15% { transform: translateX(-4px) rotate(-3deg); }
    30% { transform: translateX(4px) rotate(3deg); }
    45% { transform: translateX(-3px) rotate(-2deg); }
    60% { transform: translateX(3px) rotate(2deg); }
    75% { transform: translateX(-2px) rotate(-1deg); }
}
@keyframes mc-shake-critical {
    0%, 100% { transform: translateX(0) rotate(0) scale(1); }
    10% { transform: translateX(-5px) rotate(-5deg) scale(1.1); }
    20% { transform: translateX(5px) rotate(5deg) scale(1.1); }
    30% { transform: translateX(-5px) rotate(-4deg) scale(1.05); }
    40% { transform: translateX(5px) rotate(4deg) scale(1.05); }
    50% { transform: translateX(-4px) rotate(-3deg); }
    60% { transform: translateX(4px) rotate(3deg); }
    70% { transform: translateX(-3px) rotate(-2deg); }
    80% { transform: translateX(3px) rotate(2deg); }
}

/* Sticker message */
.mc-sticker {
    font-size: 42px;
    line-height: 1.2;
    text-align: center;
    padding: 4px 0;
}

/* Emoji Picker */
.mc-emoji-picker {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: 8px;
    margin: 0 8px 4px;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    max-height: 160px;
    overflow-y: auto;
}
.mc-emoji-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 18px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.mc-emoji-btn:hover {
    background: rgba(139,92,246,0.1);
}

/* Sticker Picker */
.mc-sticker-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 8px;
    margin: 0 8px 4px;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    max-height: 200px;
    overflow-y: auto;
}
.mc-sticker-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    border: 1px solid transparent;
    background: none;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s;
}
.mc-sticker-btn:hover {
    background: rgba(139,92,246,0.08);
    border-color: rgba(139,92,246,0.2);
}
.mc-sticker-emoji {
    font-size: 28px;
    line-height: 1.2;
}
.mc-sticker-label {
    font-size: 9px;
    color: var(--text-secondary, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70px;
}

/* Tools Bar (team chat) */
.mc-tools-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 10px;
    border-top: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-secondary, #f8f9fa);
}
.mc-tools-bar .mc-tool-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: none;
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.15s;
}
.mc-tools-bar .mc-tool-btn:hover {
    background: rgba(139,92,246,0.1);
    color: #8B5CF6;
}

/* Dropdowns */
.mc-dropdown {
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    margin: 0 10px 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    max-height: 280px;
    overflow-y: auto;
}
.mc-order-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: linear-gradient(135deg, rgba(139,92,246,0.08), rgba(236,72,153,0.05));
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    position: sticky;
    top: 0;
    z-index: 1;
}
.mc-search-result {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.mc-search-result:hover {
    background: rgba(139,92,246,0.06);
}
.mc-template-item {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
    color: var(--text-primary, #1a1a2e);
    display: flex;
    align-items: center;
}
.mc-template-item:hover {
    background: rgba(139,92,246,0.06);
}
.mc-template-item + .mc-template-item {
    border-top: 1px solid var(--border-color, rgba(0,0,0,0.04));
}

/* ========================================
