       /* --- RESET E TEMA --- */
  

        .dark-mode body {
            background-color: #0f172a;
        }

        #empresa-module-root {
            font-family: 'Lato', sans-serif !important;
            width: 100% !important;
            min-height: 100vh !important;
            padding: 0px 0 60px 0 !important;
            display: flex !important;
            flex-direction: column !important;
            align-items: center !important; 
            justify-content: flex-start !important;
        }

        #empresa-module-root .module-container {
            width: 95% !important;
            max-width: 1200px;
            margin: 0 auto !important;
            position: relative !important;
        }

        /* --- TÍTULOS --- */
        #empresa-module-root h1#page-title {
            all: unset !important;
            display: flex !important;
            align-items: center !important;
            gap: 0.5rem !important;
            font-family: 'Lato', sans-serif !important;
            font-size: 1.75rem !important;
            font-weight: 900 !important;
            color: #0f172a !important;
            line-height: 1.2 !important;
        }

        .dark-mode #empresa-module-root h1#page-title { color: #f8fafc !important; }

        #empresa-module-root h2 {
            all: unset !important;
            display: block !important;
            font-family: 'Lato', sans-serif !important;
            font-size: 0.85rem !important;
            font-weight: 800 !important;
            text-transform: uppercase !important;
            letter-spacing: 0.05em !important;
            margin-bottom: 2px !important;
        }

        #empresa-module-root .text-blue-h2 { color: #1d4ed8 !important; }
        #empresa-module-root .text-purple-h2 { color: #7e22ce !important; }
        #empresa-module-root .text-emerald-h2 { color: #047857 !important; }
        .dark-mode #empresa-module-root h2 { color: #ffffff !important; }

        /* --- CABEÇALHO FIXO --- */
        #empresa-module-root .sticky-header-wrapper {
            position: sticky !important;
            top: 57px !important; 
            z-index: 1000 !important;
            background-color: #f8fafc !important; 
            margin-bottom: -0.5rem !important;
            padding: 20px 30px 15px 30px !important;
            border-bottom: 2px solid #e2e8f0 !important;
            border-radius: 0 0 1rem 1rem !important;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
            width: 100% !important;
        }

        .dark-mode #empresa-module-root .sticky-header-wrapper {
            background-color: #1e293b !important;
            border-bottom-color: #334155 !important;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3) !important;
        }

        /* --- CARDS --- */
        #empresa-module-root .form-section {
            background-color: #ffffff;
            border-radius: 1rem !important; 
            padding: 1.75rem;
            border: 1px solid #e2e8f0;
            margin-bottom: 1.5rem;
            box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.05);
            width: 100% !important;
        }

        .dark-mode #empresa-module-root .form-section {
            background-color: #1e293b;
            border-color: #334155;
        }

        /* --- INPUTS --- */
        #empresa-module-root .input-container { position: relative !important; width: 100% !important; display: block !important; }
        #empresa-module-root .input-icon { position: absolute !important; left: 14px !important; top: 50% !important; transform: translateY(-50%) !important; color: #94a3b8 !important; z-index: 50 !important; font-size: 14px !important; pointer-events: none !important; }
        #empresa-module-root .input-field {
             padding-left: 42px !important;
             height: 42px !important;
              width: 100% !important;
               border-radius: 0.6rem !important;
                border: 1px solid #e2e8f0;
              background-color: #ffffff;
               color: #0f172a !important; transition: all 0.2s ease; position: relative !important;
               z-index: 10 !important; font-size: 1.1rem !important;
            text-transform: uppercase;
            }

/* Exceção para E-mails: sempre minúsculos */
#empresa-module-root .input-field[type="email"] {
    text-transform: lowercase !important;
}
        .dark-mode #empresa-module-root .input-field { background-color: #0f172a !important; border-color: #475569 !important; color: #ffffff !important; }

        /* SETINHAS DE SELEÇÃO */
        #empresa-module-root select.input-field {
            appearance: none !important;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E") !important;
            background-repeat: no-repeat !important;
            background-position: right 14px center !important;
            background-size: 16px !important;
        }

        #empresa-module-root label { color: #475569 !important; font-weight: 700 !important; font-size: 0.7rem !important; text-transform: uppercase; margin-bottom: 0.3rem; display: block; }
        .dark-mode #empresa-module-root label { color: #cbd5e1 !important; }

        /* LUPA DE PESQUISA */
        .search-btn-cnpj {
            position: absolute !important;
            right: 6px !important;
            top: 50% !important;
            transform: translateY(-50%) !important;
            z-index: 100 !important;
            background: #2563eb;
            color: white;
            border: none;
            width: 30px;
            height: 30px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s;
            font-size: 12px;
        }
        .search-btn-cnpj:hover { background: #1d4ed8; }

        /* --- LOGOTIPO COMPACTO --- */
        .premium-logo-area {
            position: relative;
            height: 100%;
            min-height: 208px;
            background: #ffffff;
            border: 2px dashed #cbd5e1 !important;
            border-radius: 0.75rem;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 10px;
            gap: 8px;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            overflow: hidden;
            max-width: 198px;
        }
        .dark-mode .premium-logo-area { background: #0f172a; border-color: #475569 !important; }
        .premium-logo-area:hover { border-color: #3b82f6 !important; background: #f8fafc; }
        .dark-mode .premium-logo-area:hover { background: #1e293b; border-color: #60a5fa; }
        
        .logo-slot-icon { width: 40px; height: 40px; border-radius: 8px; background: #f1f5f9; display: flex; align-items: center; justify-content: center; color: #94a3b8; flex-shrink: 0; border: 1px solid #e2e8f0; }
        .dark-mode .logo-slot-icon { background: #1e293b; border-color: #334155; }
        
        .logo-img-preview { 
            width: 100%; 
            height: 100%; 
            object-fit: contain; 
            position: absolute; 
            top: 0; 
            left: 0; 
            padding: 12px; 
            background: white; 
            z-index: 10; 
        }
        .dark-mode .logo-img-preview { background: #0f172a; }

        .logo-info-text { display: flex; flex-direction: column; align-items: center; text-align: center; }
        .logo-label-action { font-size: 10px; font-weight: 800; color: #1e293b; line-height: 1.2; }
        .dark-mode .logo-label-action { color: #f8fafc; }
        .logo-sub-text { font-size: 8px; color: #94a3b8; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        
        .btn-premium-delete { 
            position: absolute; 
            top: 8px; 
            right: 8px; 
            width: 28px; 
            height: 28px; 
            border-radius: 6px; 
            display: flex; 
            align-items: center; 
            justify-content: center; 
            color: #fff; 
            background: #ef4444; 
            transition: all 0.2s ease; 
            z-index: 50; 
            border: none; 
            cursor: pointer;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        .btn-premium-delete:hover { background: #dc2626; transform: scale(1.1); }
        .btn-premium-delete i { font-size: 14px; pointer-events: none; }

        /* --- FISCAL CARDS: NEUTRO PADRÃO / COLORIDO ATIVO --- */
        .fiscal-card { 
            transition: all 0.3s ease; 
            border-radius: 0.75rem; 
            border: 1px solid #e2e8f0; 
            border-bottom-width: 4px !important; 
            border-bottom-color: #cbd5e1 !important; /* Cor Neutra Padrão */
            padding: 1.25rem; 
            position: relative; 
            box-shadow: 0 1px 3px rgba(0,0,0,0.05); 
            background-color: #ffffff;
        }
        .dark-mode .fiscal-card { 
            background-color: #1e293b; 
            border-color: #334155; 
            border-bottom-color: #475569 !important; /* Cor Neutra Dark */
        }

        /* Cores APENAS quando ativado (.active-state) */
        .card-nfe.active-state { 
            background-color: #eff6ff !important; 
            border-color: #bfdbfe !important; 
            border-bottom-color: #3b82f6 !important; 
            box-shadow: 0 4px 15px rgba(59, 130, 246, 0.15) !important;
            transform: translateY(-2px);
        }
        .dark-mode .card-nfe.active-state { 
            background-color: rgba(30, 58, 138, 0.2) !important; 
            border-color: rgba(59, 130, 246, 0.3) !important; 
            border-bottom-color: #3b82f6 !important;
        }
        
        .card-nfce.active-state { 
            background-color: #ecfdf5 !important; 
            border-color: #d1fae5 !important; 
            border-bottom-color: #10b981 !important; 
            box-shadow: 0 4px 15px rgba(16, 185, 129, 0.15) !important;
            transform: translateY(-2px);
        }
        .dark-mode .card-nfce.active-state { 
            background-color: rgba(6, 78, 59, 0.2) !important; 
            border-color: rgba(16, 185, 129, 0.3) !important; 
            border-bottom-color: #10b981 !important;
        }
        
        .card-nfse.active-state { 
            background-color: #f5f3ff !important; 
            border-color: #ede9fe !important; 
            border-bottom-color: #8b5cf6 !important; 
            box-shadow: 0 4px 15px rgba(139, 92, 246, 0.15) !important;
            transform: translateY(-2px);
        }
        .dark-mode .card-nfse.active-state { 
            background-color: rgba(88, 28, 135, 0.2) !important; 
            border-color: rgba(168, 85, 247, 0.3) !important; 
            border-bottom-color: #a855f7 !important;
        }
        
        .card-csc { background-color: #f8fafc; border-color: #e2e8f0; }
        .dark-mode .card-csc { background-color: rgba(30, 41, 59, 0.6); border-color: #334155; }

        /* Inputs de Série (Ícones Fixos) */
        #empresa-module-root .series-input-container { position: relative !important; display: block !important; width: 100% !important; margin-top: 2px; }
        #empresa-module-root .series-input-icon { position: absolute !important; left: 12px !important; top: 50% !important; transform: translateY(-50%) !important; font-size: 12px !important; color: #94a3b8 !important; z-index: 60 !important; pointer-events: none !important; }
        #empresa-module-root .series-input-field { padding-left: 32px !important; height: 38px !important; width: 100% !important; border-radius: 0.6rem !important; }

        /* --- CONTINGÊNCIA --- */
        .contingencia-panel { background: #f8fafc; border: 2px solid #e2e8f0; transition: all 0.4s ease; border-radius: 0.75rem; padding: 1.25rem; position: relative; overflow: hidden; }
        .dark-mode .contingencia-panel { background: rgba(30, 41, 59, 0.6); border-color: #334155; }
        .contingencia-panel.active { border-color: #f59e0b !important; background: #fffbeb !important; box-shadow: 0 0 15px rgba(245, 158, 11, 0.15); }
        .dark-mode .contingencia-panel.active { background: rgba(245, 158, 11, 0.15) !important; border-color: #f59e0b !important; }
        
        .pulse-warning { animation: pulse-emergency 2s infinite !important; }
        @keyframes pulse-emergency {
            0% { box-shadow: 0 0 0 0px rgba(245, 158, 11, 0.4); }
            70% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
            100% { box-shadow: 0 0 0 0px rgba(245, 158, 11, 0); }
        }

        #empresa-module-root .contingencia-textarea { padding-left: 48px !important; padding-top: 12px !important; height: 100px !important; font-size: 13px !important; border-radius: 0.75rem !important; border: 1px solid #e2e8f0; background: #fff; resize: none !important; width: 100%; transition: all 0.2s; color: #0f172a; }
        .dark-mode #empresa-module-root .contingencia-textarea { background: #0f172a; border-color: #334155; color: white; }

        /* --- SWITCH --- */
        .switch { position: relative; display: inline-block; width: 40px; height: 22px; }
        .switch input { opacity: 0; width: 0; height: 0; }
        .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .4s; border-radius: 34px; }
        .slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
        input:checked + .slider { background-color: #10b981; }
        input:checked + .slider:before { transform: translateX(18px); }

        .status-text-label { font-size: 8px; font-weight: 900; margin-top: 2px; text-align: right; text-transform: uppercase; }
        .text-deactivated { color: #94a3b8; }
        .text-activated { color: #10b981; }

        .section-content-collapse { max-height: 0; overflow: hidden; transition: max-height 0.5s ease-in-out, opacity 0.3s ease; opacity: 0; }
        .section-content-collapse.is-open { max-height: 5000px; opacity: 1; padding-top: 1.5rem; overflow: visible; margin-top: 0.5rem; border-top: 1px dashed #e2e8f0; }
        .dark-mode .section-content-collapse.is-open { border-top-color: #334155; }
        
        .chevron-icon { transition: transform 0.3s ease; }
        .chevron-icon.is-rotated { transform: rotate(180deg); }

        .status-badge { font-size: 10px; font-weight: 800; padding: 3px 10px; border-radius: 20px; text-transform: uppercase; }
        .status-open { background-color: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
        .status-closed { background-color: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }

        #custom-message { position: fixed; top: 20px; right: 20px; z-index: 9999; padding: 1rem 2rem; border-radius: 0.75rem; background: white; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); display: none; border-left: 4px solid #2563eb; }
/* --- CORES ESPECÍFICAS DOS SELECTS --- */

/* 1. CRT (Vamos usar azul para combinar com a seção de identificação) */
#empresa-module-root #crt_select {
    color: #2563eb !important; /* Blue 600 */
    font-weight: 900 !important;
}

/* 2. Ambiente NF-e / NFC-e (Emerald/Verde) */
#empresa-module-root select[name="emissao_nfce_nfe"] {
    color: #059669 !important; /* Emerald 600 */
    font-weight: 900 !important;
}

/* 3. Ambiente NFS-e (Roxo) */
#empresa-module-root select[name="emissao_nfse"] {
    color: #7c3aed !important; /* Purple 600 */
    font-weight: 900 !important;
}

/* --- AJUSTE PARA O MODO ESCURO (DARK MODE) --- */
/* No modo escuro, precisamos clarear as cores para dar leitura */

.dark-mode #empresa-module-root #crt_select {
    color: #60a5fa !important; /* Blue 400 */
}

.dark-mode #empresa-module-root select[name="emissao_nfce_nfe"] {
    color: #34d399 !important; /* Emerald 400 */
}

.dark-mode #empresa-module-root select[name="emissao_nfse"] {
    color: #a78bfa !important; /* Purple 400 */
}
/* --- CORREÇÃO: Remover maiúsculo forçado dos SELECTS --- */
#empresa-module-root select.input-field {
    text-transform: none !important;
}

/* --- AUMENTAR ALTURA DOS CARDS FISCAIS --- */
/* --- 1. O CARD (PAI) PRECISA DISSO --- */
#empresa-module-root .fiscal-card {
    /* Garante que o absoluto (engrenagem) obedeça aos limites deste card */
    position: relative !important; 
    
    /* Configuração de altura que fizemos antes */
    min-height: 220px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    
    /* Estilos visuais base */
    transition: all 0.3s ease;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    border-bottom-width: 4px !important;
    border-bottom-color: #cbd5e1 !important;
    background-color: #ffffff;
    padding: 1.25rem;
}

/* --- CONFIGURAÇÃO DA ENGRENAGEM (POSIÇÃO + ANIMAÇÃO 180º) --- */

#empresa-module-root .fiscal-card .fa-cog {
    /* POSICIONAMENTO: Fixa no canto superior direito */
    position: absolute !important;
    top: 15px !important;    /* Distância do teto */
    right: 15px !important;  /* Distância da parede direita */
    z-index: 50 !important;  /* Fica na frente de tudo */

    /* ESTRUTURA PARA O GIRO NÃO PULAR */
    width: 32px !important;
    height: 32px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    
    /* Limpeza */
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    
    /* ANIMAÇÃO SUAVE */
    transform-origin: center center;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s ease;
    color: #cbd5e1;
}

/* 4. HOVER (O efeito que você escolheu) */
#empresa-module-root .fiscal-card .fa-cog:hover {
    transform: rotate(180deg); /* Gira meia volta */
    color: #2563eb; /* Fica azul */
    cursor: pointer;
}


/* --- CORREÇÃO DEFINITIVA: CARDS NO MODO ESCURO --- */

/* 1. ESTADO PADRÃO (INATIVO/DESLIGADO) */
/* Isso conserta o visual "feio" quando o card está desligado */
.dark-mode #empresa-module-root .fiscal-card {
    background-color: #1e293b !important; /* Fundo Cinza Escuro */
    border-color: #334155 !important;     /* Borda Discreta */
    color: #e2e8f0 !important;            /* Texto Claro */
    box-shadow: none !important;
}

/* Conserta os inputs dentro dos cards inativos */
.dark-mode #empresa-module-root .fiscal-card .input-field {
    background-color: #0f172a !important; 
    border-color: #475569 !important;     
    color: #ffffff !important;           
}

/* --- 2. ESTADO ATIVO (LIGADO) --- */
/* Aqui forçamos as cores voltarem quando você clica no botão */
/* Aumentei a especificidade do seletor para garantir que funcione */

/* NF-e ATIVA (Azul) */
.dark-mode #empresa-module-root .fiscal-card.card-nfe.active-state {
    background-color: rgba(30, 58, 138, 0.5) !important; /* Azul translúcido mais visível */
    border-color: #3b82f6 !important; /* Azul Brilhante */
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2) !important;
}

/* NFC-e ATIVA (Verde) */
.dark-mode #empresa-module-root .fiscal-card.card-nfce.active-state {
    background-color: rgba(6, 78, 59, 0.5) !important; /* Verde translúcido */
    border-color: #10b981 !important; /* Verde Brilhante */
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.2) !important;
}

/* NFS-e ATIVA (Roxo) */
.dark-mode #empresa-module-root .fiscal-card.card-nfse.active-state {
    background-color: rgba(88, 28, 135, 0.5) !important; /* Roxo translúcido */
    border-color: #a855f7 !important; /* Roxo Brilhante */
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.2) !important;
}
/* --- DESTAQUE TOTAL PARA CARDS ATIVOS (Borda + Brilho + Pulo) --- */

/* 1. Comportamento Geral quando ATIVO */
#empresa-module-root .fiscal-card.active-state {
    border-bottom-width: 6px !important; /* Borda bem grossa */
    transform: translateY(-5px) !important; /* Faz o card "subir" */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 20; /* Garante que fique acima dos outros */
}

/* --- CORES ESPECÍFICAS (Borda + Sombra Colorida) --- */

/* NF-e (AZUL) */
#empresa-module-root .fiscal-card.card-nfe.active-state {
    border-bottom-color: #1d4ed8 !important; /* Azul Forte */
    box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.4) !important; /* Sombra Azul */
}
/* Modo Noturno NF-e */
.dark-mode #empresa-module-root .fiscal-card.card-nfe.active-state {
    border-bottom-color: #3b82f6 !important; /* Azul Neon */
    box-shadow: 0 10px 30px -5px rgba(59, 130, 246, 0.3) !important;
}


/* NFC-e (VERDE) */
#empresa-module-root .fiscal-card.card-nfce.active-state {
    border-bottom-color: #047857 !important; /* Verde Forte */
    box-shadow: 0 10px 25px -5px rgba(5, 150, 105, 0.4) !important; /* Sombra Verde */
}
/* Modo Noturno NFC-e */
.dark-mode #empresa-module-root .fiscal-card.card-nfce.active-state {
    border-bottom-color: #10b981 !important; /* Verde Neon */
    box-shadow: 0 10px 30px -5px rgba(16, 185, 129, 0.3) !important;
}


/* NFS-e (ROXO) */
#empresa-module-root .fiscal-card.card-nfse.active-state {
    border-bottom-color: #7e22ce !important; /* Roxo Forte */
    box-shadow: 0 10px 25px -5px rgba(126, 34, 206, 0.4) !important; /* Sombra Roxa */
}
/* Modo Noturno NFS-e */
.dark-mode #empresa-module-root .fiscal-card.card-nfse.active-state {
    border-bottom-color: #a855f7 !important; /* Roxo Neon */
    box-shadow: 0 10px 30px -5px rgba(168, 85, 247, 0.3) !important;
}

/* --- CORREÇÃO: POSIÇÃO DO BOTÃO NO CARD DE CONTINGÊNCIA --- */

/* Seleciona o contêiner que segura o switch e o texto dentro do painel de contingência */
#cont_panel .flex.flex-col.items-end {
    /* Adiciona uma margem à direita para afastar do canto */
    margin-right: 3.5rem !important; 
    
    /* Segurança extra: garante que o switch fique na frente de tudo (z-index) */
    position: relative;
    z-index: 60; 
}