.info-diretorio-card.compacto .acoes-totais .btn-outline {
    background: var(--card-bg);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    font-weight: 500;
    min-width: 140px;
    height: 42px;
    border-radius: 8px;
    transition: all 0.2s ease;
}
.info-diretorio-card.compacto .acoes-totais .btn-outline:hover {
    background: var(--primary-color);
    color: #fff;
}
/* Reset e configurações globais */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Garante que o atributo HTML "hidden" sempre esconda o elemento */
[hidden] {
    display: none !important;
}

:root {
    /* Cores principais da empresa (azul) */
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary-color: #1e40af;
    --accent-color: #60a5fa;
    
    /* Cores de status */
    --success-color: #059669;
    --success-hover: #047857;
    --danger-color: #dc2626;
    --danger-hover: #b91c1c;
    --warning-color: #d97706;
    --warning-hover: #b45309;
    
    /* Cores do tema claro */
    --bg-color: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-light: rgba(0, 0, 0, 0.05);
    --card-bg: #ffffff;
    --navbar-bg: #ffffff;
    
    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    --gradient-bg: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

/* Tema escuro */
[data-theme="dark"] {
    /* Cores de status (mantém as mesmas para ambos os temas) */
    --success-color: #10b981;
    --success-hover: #059669;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --warning-color: #f59e0b;
    --warning-hover: #d97706;
    
    --bg-color: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #334155;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-light: rgba(0, 0, 0, 0.2);
    --card-bg: #1e293b;
    --navbar-bg: #1e293b;
    --gradient-bg: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--gradient-bg);
    min-height: 100vh;
    transition: all 0.3s ease;
}

/* === PÁGINA DE LOGIN === */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 50%);    
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    bottom: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(30, 64, 175, 0.05) 0%, transparent 50%);
    animation: float 25s ease-in-out infinite reverse;
    pointer-events: none;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

/* Tema escuro para login */
[data-theme="dark"] .login-page {
    background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #475569 100%);
}

[data-theme="dark"] .login-page::before {
    background: radial-gradient(circle, rgba(59, 130, 246, 0.2) 0%, transparent 50%);
}

[data-theme="dark"] .login-page::after {
    background: radial-gradient(circle, rgba(30, 64, 175, 0.1) 0%, transparent 50%);
}

/* Botão de tema na tela de login */
.theme-toggle-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.theme-toggle-login {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.theme-toggle-login:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

[data-theme="dark"] .theme-toggle-login {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .theme-toggle-login:hover {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 50px 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
}

/* Tema escuro para o card de login */
[data-theme="dark"] .login-card {
    background: rgba(30, 41, 59, 0.8);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.05);
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.login-header i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    display: block;
}

.login-header h1 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1.8rem;
    font-weight: 600;
}

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

.login-form {
    text-align: left;
    margin-top: 35px;
}

/* Cabeçalho do fluxo de reset de senha */
.reset-header {
    margin-top: 25px;
    text-align: center;
}

.reset-header .reset-step {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.18);
    padding: 6px 12px;
    border-radius: 999px;
    margin-bottom: 12px;
}

[data-theme="dark"] .reset-header .reset-step {
    background: rgba(96, 165, 250, 0.12);
    border-color: rgba(96, 165, 250, 0.22);
}

.reset-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.reset-header p {
    color: var(--text-secondary);
    margin-bottom: 10px;
}

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

/* Espaçamento específico entre campo de email e label da senha */
.form-group.email-field {
    margin-bottom: 15px;
}

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

.form-group label i {
    margin-right: 8px;
    color: var(--primary-color);
    width: 16px;
}

.form-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

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

.password-input {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: var(--primary-color);
}

.btn-login {
    width: 100%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 15px 20px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.login-links {
    margin-top: 14px;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.link-button {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease;
}

.link-button:hover {
    background: rgba(37, 99, 235, 0.08);
}

[data-theme="dark"] .link-button:hover {
    background: rgba(96, 165, 250, 0.14);
}

.link-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.reset-links {
    margin-top: 0;
}



.login-footer {
    margin-top: 40px;
    text-align: center;
    position: relative;
    z-index: 10;
}

.login-footer p {
    color: rgba(71, 85, 105, 0.8);
    font-size: 14px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .login-footer p {
    color: rgba(255, 255, 255, 0.6);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* === DASHBOARD E PÁGINAS INTERNAS === */
.dashboard-page,
.admin-page {
    background: var(--bg-color);
    min-height: 100vh;
}

/* === LISTAGEM DE ARQUIVOS XML === */
.arquivos-acoes {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 10px 0 18px;
}

.tabela-wrapper {
    width: 100%;
    overflow-x: auto;
}

.tabela-arquivos {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 4px;
    font-size: 0.85rem;
}

.tabela-arquivos thead th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    padding: 10px 14px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.tabela-arquivos tbody td {
    background: var(--card-bg);
    padding: 10px 14px;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.tabela-arquivos tbody tr.tr-dia td {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    border: 1px solid var(--border-color);
    padding: 8px 14px;
}

.tabela-arquivos tbody tr.tr-dia td:first-child {
    width: 36px;
    text-align: center;
}

.tabela-arquivos tbody tr:hover td {
    background: var(--bg-secondary);
}

.tabela-arquivos tbody tr td:first-child {
    border-left: 1px solid var(--border-color);
}

.tabela-arquivos tbody tr td:last-child {
    border-right: 1px solid var(--border-color);
}

.tabela-arquivos .arquivo-nome {
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    letter-spacing: 0.6px;
    display: inline-block;
    white-space: nowrap;
}

/* Alinhamentos específicos das colunas */
.tabela-arquivos td.td-status { text-align: center; }
.tabela-arquivos td.td-tamanho { text-align: right; font-variant-numeric: tabular-nums; }
.tabela-arquivos td.td-data { text-align: right; font-size: 0.74rem; color: var(--text-muted); }
.tabela-arquivos td.td-acao { text-align: center; }

/* Badge de status */
.badge-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}
.badge-status.normal { background: #e6fffa; color: #047857; border: 1px solid #99f6e4; }
.badge-status.cancelada { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-status.inutilizada { background: #fff7ed; color: #b45309; border: 1px solid #fed7aa; }

.btn-download-inline,
.btn-download-small {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    border: none;
    padding: 6px 11px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    transition: background .2s ease, transform .15s ease;
    box-shadow: 0 2px 4px var(--shadow-light);
}

.btn-download-inline:hover,
.btn-download-small:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-download-inline:active,
.btn-download-small:active {
    transform: translateY(0);
}

.chk-arquivo { width: 16px; height: 16px; cursor: pointer; }
.chk-dia { width: 16px; height: 16px; cursor: pointer; }

/* Paginação da tabela de arquivos */
.paginacao {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0 4px;
}

.paginacao-info {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.paginacao-botoes {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.paginacao-ellipsis {
    color: var(--text-muted);
    padding: 0 6px;
}

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

.btn-outline:hover {
    background: var(--bg-secondary);
}

.btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Badge de contagem no botão Baixar Selecionados */
.badge-count {
    display: inline-block;
    background: var(--primary-color);
    color: #fff;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    margin-left: 6px;
}

/* Card de diretório vazio (quando não encontrado) */
.info-diretorio-card.vazio {
    border: 1px dashed var(--border-color);
    background: var(--bg-secondary);
}

/* Totais compactos (mini-cards) dentro do diretório */
.info-diretorio-card.compacto .cards-totais {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.info-diretorio-card.compacto .mini-card {
    flex: 1 1 110px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 4px var(--shadow-light);
    min-width: 100px;
}
.info-diretorio-card.compacto .mini-card .valor {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
}
.info-diretorio-card.compacto .mini-card .rotulo {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}
.info-diretorio-card.compacto .mini-card.total { border-color: var(--primary-color); }
.info-diretorio-card.compacto .mini-card.total .valor { color: var(--primary-color); }
.info-diretorio-card.compacto .mini-card.normais { border-color: var(--success-color); }
.info-diretorio-card.compacto .mini-card.normais .valor { color: var(--success-color); }
.info-diretorio-card.compacto .mini-card.canceladas { border-color: var(--danger-color); }
.info-diretorio-card.compacto .mini-card.canceladas .valor { color: var(--danger-color); }
.info-diretorio-card.compacto .mini-card.inutilizadas { border-color: var(--warning-color); }
.info-diretorio-card.compacto .mini-card.inutilizadas .valor { color: var(--warning-color); }

@media (max-width: 600px) {
    .info-diretorio-card.compacto .cards-totais { gap: 8px; }
    .info-diretorio-card.compacto .mini-card { flex: 1 1 calc(50% - 8px); padding: 10px 8px; }
    .info-diretorio-card.compacto .mini-card .valor { font-size: 1.2rem; }
}

/* Filtro de nome na listagem de arquivos */
.filtro-nome-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-secondary);
    padding: 4px 6px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    flex: 1 1 420px;
}
.filtro-nome-wrapper .input-filtro-nome {
    border: none;
    background: transparent;
    outline: none;
    padding: 6px 4px;
    min-width: 200px;
    width: 100%;
    font-size: 12px;
    color: var(--text-primary);
}
.filtro-nome-wrapper .input-filtro-nome::placeholder { color: var(--text-muted); }
.filtro-nome-wrapper .btn { min-width: 34px; padding: 6px 8px; }
@media (max-width: 900px) {
    .filtro-nome-wrapper { flex: 1 1 100%; order: 3; }
    .filtro-nome-wrapper .input-filtro-nome { min-width: 100px; width: 100%; }
}

.arquivo-estatisticas { margin-bottom: 8px; font-size: .75rem; color: var(--text-muted); }

/* Cabeçalho da listagem de Arquivos XML */
.lista-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.lista-header .titulo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}
.lista-header .titulo i { color: var(--primary-color); }
.lista-header .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.lista-header .meta-item {
    color: var(--text-secondary);
    font-size: 0.8rem;
}
.lista-header .meta-item strong { color: var(--text-primary); }
@media (max-width: 768px) {
    .lista-header { flex-direction: column; align-items: flex-start; gap: 6px; }
}

.lista-vazia {
    padding: 10px 0 4px;
}

@media (max-width: 900px) {
    .tabela-arquivos thead { display: none; }
    .tabela-arquivos tbody td { display: block; padding: 6px 10px; border: none; }
    .tabela-arquivos tbody tr { margin-bottom: 10px; box-shadow: 0 2px 6px var(--shadow-light); border:1px solid var(--border-color); border-radius:8px; }
    .tabela-arquivos .arquivo-nome { max-width: 100%; }
    .tabela-arquivos tbody td:last-child { text-align: right; }
}

.navbar {
    background: var(--navbar-bg);
    box-shadow: 0 2px 10px var(--shadow-color);
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.navbar-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.2rem;
}

.navbar-brand i {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
}

/* Botão de toggle tema */
.theme-toggle {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--primary-color);
}

.btn-logout {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.btn-logout:hover {
    background: #c82333;
}

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    margin-top: 70px; /* Compensa a altura do header fixo */
}

.page-header {
    margin-bottom: 40px;
}

.page-header h1 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 2rem;
    font-weight: 600;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 15px;
    box-shadow: 0 5px 15px var(--shadow-color);
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.card h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h2 i {
    color: var(--primary-color);
}

/* Formulários */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-row.full-width {
    grid-template-columns: 1fr;
}

/* Botões e informações lado a lado */
.form-group.buttons-and-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    gap: 20px;
}

.buttons-container {
    display: flex;
    gap: 15px;
}

/* Toggle "Somente Fora do Mês" alinhado na mesma linha dos botões */
#containerSomenteForaMes {
    display: none; /* controlado via JS */
    margin-left: auto;
    align-items: center;
    padding-left: 10px;
}

#containerSomenteForaMes label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.70rem;
    color: var(--text-secondary);
    line-height: 1.1;
    white-space: nowrap;
}

#containerSomenteForaMes input[type="checkbox"] {
    cursor: pointer;
}

#containerSomenteForaMes span {
    white-space: nowrap;
    max-width: none;
}

/* Botões principais com largura uniforme */
.btn-uniform {
    min-width: 190px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

@media (max-width: 780px) {
    .btn-uniform {
        width: 100%;
        min-width: unset;
    }
}

.buttons-container .btn {
    min-width: 160px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.directory-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--bg-secondary);
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.directory-info .stat-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.directory-info .stat-inline .numero {
    font-weight: 600;
    color: var(--primary-color);
}

.directory-info .stat-inline .label {
    color: var(--text-secondary);
}

.directory-info .separator {
    color: var(--border-color);
}

.info-help {
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.info-help small {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

.info-help i {
    color: var(--primary-color);
    margin-right: 5px;
}

.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
}

.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Botões */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.3);
}

.btn-success {
    background: #28a745;
    color: white;
}

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

.btn-danger {
    background: #dc3545;
    color: white;
}

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

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Campo de Busca e Filtros */
.search-and-filters {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
    align-items: flex-end;
}

.search-container {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
}

.search-container .form-group {
    margin-bottom: 0;
}

.status-filter {
    flex-shrink: 0;
}

.status-filter .form-group {
    margin-bottom: 0;
}

.filter-buttons {
    display: flex;
    gap: 8px;
}

.filter-btn {
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.filter-btn i {
    font-size: 12px;
}

/* Responsividade para busca e filtros */
@media (max-width: 768px) {
    .search-and-filters {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-container {
        max-width: none;
        min-width: auto;
    }
    
    .filter-buttons {
        justify-content: center;
    }
    
    .filter-btn {
        flex: 1;
        justify-content: center;
    }
    
    /* Responsividade para botões e informações */
    .form-group.buttons-and-info {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .buttons-container {
        justify-content: center;
    }
    
    .directory-info {
        justify-content: center;
        flex-wrap: wrap;
    }
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper input[type="text"] {
    width: 100%;
    padding-right: 70px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3ccircle cx='11' cy='11' r='8'%3e%3c/circle%3e%3cpath d='m21 21-4.35-4.35'%3e%3c/path%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 40px center;
    background-size: 16px;
}

.clear-search-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.clear-search-btn i {
    font-size: 14px;
}

/* Tabelas */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px var(--shadow-color);
}

.table th {
    background: var(--bg-secondary);
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

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

/* Alertas e mensagens */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #cce7ff;
    color: #004085;
    border: 1px solid #a6d3ff;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Loading spinner */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--primary-color);
}

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

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

/* Lista de arquivos */
.arquivo-item {
    display: flex;
    align-items: center;
    justify-content: between;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    background: var(--bg-secondary);
}

.arquivo-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.arquivo-info i {
    color: #28a745;
    font-size: 1.2rem;
}

.arquivo-nome {
    font-weight: 500;
    color: var(--text-primary);
}

.arquivo-detalhes {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.arquivo-acoes {
    display: flex;
    gap: 10px;
}

/* Estatísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px var(--shadow-color);
    text-align: center;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.stat-number-ultimoAcesso {
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 25px;
}

.stat-number-ultimoAcesso .stat-subline {
    margin-top: 6px;
    font-size: 0.85rem;
    line-height: 1.2;
    color: var(--text-secondary);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Responsividade */
@media (max-width: 768px) {
    .navbar-content {
        flex-direction: column;
        height: auto;
        padding: 15px 0;
        gap: 15px;
    }

    .main-content {
        padding: 20px 15px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 30px 20px;
    }

    .table-container {
        font-size: 14px;
    }

    .arquivo-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .arquivo-acoes {
        justify-content: center;
    }
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 30px;
}

.tab-button {
    background: none;
    border: none;
    padding: 15px 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 3px solid transparent;
}

.tab-button:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 0;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px var(--shadow-color);
    border: 1px solid var(--border-color);
}

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

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.3rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

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

.modal form {
    padding: 30px;
}

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

/* Badge */
.badge {
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 10px;
}

/* Textarea */
textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--card-bg);
}

/* Status badge */
.status-badge {
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-ativo {
    background: #d4edda;
    color: #155724;
}

.status-inativo {
    background: #f8d7da;
    color: #721c24;
}

/* Button small */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Text utilities */
.text-center {
    text-align: center;
}

.text-muted {
    color: #666;
}

/* Action buttons in table */
.action-buttons {
    display: flex;
    gap: 5px;
}

.action-buttons .btn {
    padding: 4px 8px;
    font-size: 12px;
}

@media (max-width: 768px) {
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-button {
        flex: 1;
        justify-content: center;
        padding: 12px 15px;
        font-size: 13px;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .modal form {
        padding: 20px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 10px;
    }
    
    .btn {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
}

/* Validação de CNPJ */
.validation-message {
    margin-top: 5px;
    padding: 8px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
}

.validation-message.success {
    background-color: rgba(34, 197, 94, 0.1);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.validation-message.error {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.input-help {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ==================================================
   Seção de CNPJs - Nova Gestão
   ================================================== */

.form-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px var(--shadow-light);
}

.form-section h4 {
    margin: 0 0 16px 0;
    color: var(--text-primary);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.cnpj-form {
    margin-bottom: 25px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px dashed var(--border-color);
}

.cnpjs-table-header {
    margin-bottom: 10px;
    margin-top: 20px;
}

.cnpjs-table-header h5 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cnpjs-count {
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.cnpjs-table-container {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
}

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

.cnpjs-table thead {
    background: var(--primary-color);
}

.cnpjs-table thead th {
    color: white;
    padding: 10px 12px;
    font-weight: 600;
    text-align: left;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.cnpjs-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

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

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

.cnpjs-table tbody tr.no-cnpjs td {
    padding: 20px 15px;
    color: var(--text-muted);
    font-style: italic;
}

.cnpjs-table tbody td {
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 13px;
    vertical-align: middle;
}

.cnpj-formatted {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 13px;
}

.empresa-nome {
    font-weight: 500;
    color: var(--text-primary);
}

.btn-remover-cnpj {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-remover-cnpj:hover {
    background: var(--danger-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

.cnpj-contador {
    background: var(--success-color);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 10px;
}

/* Responsividade para tabela de CNPJs */
@media (max-width: 768px) {
    .cnpjs-table-container {
        overflow-x: auto;
    }
    
    .cnpjs-table {
        min-width: 500px;
    }
    
    .form-section {
        padding: 15px;
    }
    
    .cnpj-form {
        padding: 15px;
    }
    
    .form-row .form-group:last-child {
        margin-top: 15px;
    }
}

/* Layout compacto para aba Novo Contador */
#tab-novo-contador .form-row {
    gap: 12px;
    margin-bottom: 12px;
}

#tab-novo-contador .form-group {
    margin-bottom: 14px;
}

#tab-novo-contador h2 {
    margin-bottom: 16px;
    font-size: 22px;
}

#tab-novo-contador .form-section {
    padding: 14px;
    margin-bottom: 16px;
}

#tab-novo-contador .form-section h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
    padding-bottom: 8px;
}

#tab-novo-contador input[type="text"],
#tab-novo-contador input[type="email"],
#tab-novo-contador input[type="password"] {
    padding: 8px 12px;
    font-size: 13px;
}

#tab-novo-contador .input-help {
    font-size: 11px;
    margin-top: 3px;
}

#tab-novo-contador .btn {
    padding: 8px 16px;
    font-size: 13px;
}

/* ==================================================
   CNPJ Dropdown Inteligente
   ================================================== */

.cnpj-search-container {
    position: relative;
}

.cnpj-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px var(--shadow-medium);
}

.cnpj-dropdown.show {
    display: block;
}

.cnpj-dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.2s ease;
}

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

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

.cnpj-item-cnpj {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 14px;
}

.cnpj-item-empresa {
    color: var(--text-primary);
    font-size: 13px;
    margin-top: 2px;
}

.dropdown-loading,
.dropdown-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

.dropdown-empty {
    color: var(--danger-color);
}

/* ==================================================
   Mensagens Flash no Topo
   ================================================== */

.flash-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 9999;
    transform: translateX(100%);
    transition: all 0.3s ease;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.flash-message.show {
    transform: translateX(0);
}

.flash-message.success {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.flash-message.error {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
}

.flash-message.info {
    background: linear-gradient(135deg, #17a2b8, #3498db);
}

.flash-message.warning {
    background: linear-gradient(135deg, #ffc107, #f39c12);
    color: #212529;
}

/* ==================================================
   Categorias de Arquivos XML
   ================================================== */

.arquivo-categoria {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 8px;
    letter-spacing: 0.5px;
}

.categoria-normal {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.categoria-cancelada {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
    color: white;
}

.categoria-inutilizada {
    background: linear-gradient(135deg, #ffc107, #f39c12);
    color: #212529;
}

.arquivo-item .fas.fa-file-excel {
    color: #dc3545;
}

.arquivo-item .fas.fa-file-code {
    color: #28a745;
}

.arquivo-item .fas.fa-file-times {
    color: #ffc107;
}

/* Estilos para Info do Diretório */
.info-diretorio-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 8px var(--shadow-light);
}

.info-diretorio-card h4 {
    color: var(--text-primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-diretorio-card h4 i {
    color: var(--primary-color);
}

.estatisticas {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    min-width: 100px;
}

.stat .numero {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.stat .label {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 4px;
}

.acoes-diretorio {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Estilos para Busca Específica */
#buscaContainer {
    margin-top: 20px;
}

#buscaInput {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

#buscaInput:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Estilos para Resultados da Busca */
.resultados-busca-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.resultados-busca-header h4 {
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.resultados-busca-header p {
    margin: 0;
    color: var(--text-secondary);
}

.resultados-busca-header small {
    color: var(--text-muted);
    display: block;
    margin-top: 4px;
}

.lista-arquivos-busca {
    padding: 0;
}

.arquivo-item-busca {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

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

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

.arquivo-item-busca .arquivo-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.arquivo-item-busca .arquivo-info i {
    font-size: 20px;
    min-width: 24px;
}

.arquivo-item-busca .arquivo-nome {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.arquivo-item-busca .arquivo-detalhes {
    color: var(--text-secondary);
    font-size: 13px;
}

.arquivo-acoes {
    display: flex;
    gap: 8px;
}

.busca-vazia {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.busca-vazia i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.busca-vazia p {
    font-size: 16px;
    margin: 0;
}

/* Layout Compacto */
.painel-principal {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    align-items: flex-start;
}

.selecao-arquivos {
    flex: 1;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px var(--shadow-light);
}

.selecao-arquivos h2 {
    margin: 0 0 15px 0;
    color: var(--text-primary);
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.selecao-arquivos h2 i {
    color: var(--primary-color);
}

.form-compacto {
    margin: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 15px;
    align-items: end;
}

.form-group {
    margin: 0;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group label i {
    margin-right: 4px;
    color: var(--primary-color);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

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

.botoes-acao {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-compacto {
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.stats-compactas {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 120px;
}

.stat-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 4px var(--shadow-light);
}

.stat-numero {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.stat-item small {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
    display: block;
}

/* Melhorias para tabela de contadores */
.cnpjs-lista {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cnpjs-lista .badge {
    align-self: flex-start;
    margin-bottom: 2px;
}

.cnpjs-lista .text-muted {
    font-size: 11px;
    line-height: 1.3;
}

.badge-secondary {
    background-color: var(--text-muted);
    color: white;
}

/* Botões de filtro melhorados */
.filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.filter-btn i {
    font-size: 12px;
}

/* Responsive */
@media (max-width: 1024px) {
    .form-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .botoes-acao {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .painel-principal {
        flex-direction: column;
    }
    
    .stats-compactas {
        flex-direction: row;
        justify-content: center;
        min-width: auto;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .botoes-acao {
        flex-direction: column;
    }
    
    .estatisticas {
        justify-content: center;
    }
    
    .stat {
        min-width: 80px;
        padding: 12px;
    }
    
    .acoes-diretorio {
        flex-direction: column;
    }
    
    .arquivo-item-busca {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .arquivo-acoes {
        align-self: flex-end;
    }
}

/* === MODAL DE PROGRESSO === */
.progress-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.progress-modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    min-width: 500px;
    max-width: 600px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
}

.progress-header {
    text-align: center;
    margin-bottom: 25px;
}

.progress-header h3 {
    color: var(--text-primary);
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.progress-header i {
    color: var(--primary-color);
    margin-right: 10px;
}

.progress-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.progress-info {
    text-align: center;
}



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

.progress-percentage {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 45px;
    text-align: right;
}

.progress-file-info {
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
    border: 1px solid var(--border-color);
    word-break: break-all;
}

/* Tema escuro para modal de progresso */
[data-theme="dark"] .progress-modal-content {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Responsividade do modal */
@media (max-width: 768px) {
    .progress-modal-content {
        min-width: auto;
        width: 90%;
        padding: 20px;
    }
    
    .progress-header h3 {
        font-size: 1.1rem;
    }
    
    .progress-message {
        font-size: 1rem;
    }
    
    .progress-bar-container {
        gap: 10px;
    }
}

/* Estilos para listagem horizontal compacta */
.arquivo-linha-compacta {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 3px;
    background: var(--card-bg);
    transition: all 0.2s ease;
    min-height: 40px;
    font-size: 0.9rem;
}

.arquivo-linha-compacta:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px var(--shadow-light);
    background: var(--bg-secondary);
}

.chave-nf {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
    margin-right: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.tamanho-arquivo {
    color: var(--text-secondary);
    font-weight: 500;
    margin-right: 12px;
    min-width: 65px;
    text-align: right;
    font-size: 0.85rem;
}

.data-arquivo {
    color: var(--text-secondary);
    margin-right: 12px;
    min-width: 130px;
    font-size: 0.85rem;
}

.status-arquivo {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-right: 12px;
    min-width: 80px;
    text-align: center;
}

.status-arquivo.categoria-normal {
    background: #e3f2fd;
    color: #1976d2;
}

.status-arquivo.categoria-cancelada {
    background: #ffebee;
    color: #d32f2f;
}

.status-arquivo.categoria-inutilizada {
    background: #fff3e0;
    color: #f57c00;
}

.btn-download-inline {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    min-width: 36px;
    height: 32px;
}

.btn-download-inline:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

/* Tema escuro para listagem compacta */
[data-theme="dark"] .arquivo-linha-compacta {
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .arquivo-linha-compacta:hover {
    border-color: var(--primary-light);
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .status-arquivo.categoria-normal {
    background: rgba(25, 118, 210, 0.2);
    color: #64b5f6;
}

[data-theme="dark"] .status-arquivo.categoria-cancelada {
    background: rgba(211, 47, 47, 0.2);
    color: #ef5350;
}

[data-theme="dark"] .status-arquivo.categoria-inutilizada {
    background: rgba(245, 124, 0, 0.2);
    color: #ffb74d;
}

/* Responsividade para mobile */
@media (max-width: 768px) {
    .arquivo-linha-compacta {
        font-size: 0.8rem;
        padding: 6px 8px;
        min-height: 36px;
    }
    
    .chave-nf {
        font-size: 0.8rem;
        margin-right: 8px;
    }
    
    .tamanho-arquivo, .data-arquivo {
        font-size: 0.75rem;
        margin-right: 8px;
        min-width: auto;
    }
    
    .status-arquivo {
        font-size: 0.65rem;
        padding: 2px 6px;
        margin-right: 8px;
        min-width: 60px;
    }
    
    .btn-download-inline {
        padding: 4px 8px;
        font-size: 0.75rem;
        min-width: 32px;
        height: 28px;
    }
}

/* === Ações Totais do Diretório === */
.info-diretorio-card.compacto .acoes-totais {
    display: block;
    padding-top: 12px;
    margin-top: 4px;
    border-top: 1px solid var(--border-color);
}
.info-diretorio-card.compacto .acoes-totais.compacta .linha-compacta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}
.info-diretorio-card.compacto .acoes-totais .select-padrao {
    min-width: 140px;
    height: 42px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    margin-right: 4px;
}
.info-diretorio-card.compacto .acoes-totais .select-padrao:focus {
    outline: none;
    border-color: var(--primary-color);
}
.info-diretorio-card.compacto .acoes-totais .btn {
    min-width: 140px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 6px var(--shadow-light);
}
.info-diretorio-card.compacto .acoes-totais .btn-warning {
    margin-right: 8px;
}
.info-diretorio-card.compacto .acoes-totais #containerSomenteForaMes {
    margin-left: 0;
    align-items: center;
    max-width: 260px;
    display: flex;
}
.info-diretorio-card.compacto .acoes-totais #containerSomenteForaMes label {
    white-space: normal;
    flex-direction: row;
    align-items: center;
    font-size: 0.78rem;
    gap: 8px;
}
.info-diretorio-card.compacto .acoes-totais .btn {
    min-width: 180px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 6px var(--shadow-light);
}
.info-diretorio-card.compacto .acoes-totais .grupo-listagem,
.info-diretorio-card.compacto .acoes-totais .grupo-download {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.info-diretorio-card.compacto .acoes-totais .grupo-listagem select#statusFiltro {
    min-width: 160px;
    height: 42px;
    padding: 8px 10px;
}
.info-diretorio-card.compacto .acoes-totais .label-inline {
    color: var(--text-secondary);
}
.info-diretorio-card.compacto .acoes-totais .btn:hover {
    transform: translateY(-2px);
}
.info-diretorio-card.compacto .acoes-totais .btn:active {
    transform: translateY(0);
}
.info-diretorio-card.compacto .acoes-totais .divergentes-toggle-inline {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.info-diretorio-card.compacto .acoes-totais #toggleDivergentes {
    transform: scale(1.1);
    cursor: pointer;
    accent-color: var(--warning-color);
}
.badge-divergentes {
    display: inline-block;
    background: var(--warning-color);
    color: #fff;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    margin-left: 6px;
}
/* Destacar data de upload fora do mês da pasta */
.upload-fora-mes {
    background: linear-gradient(90deg, #fff7ed 0%, #ffedd5 100%);
    color: #9a3412 !important;
    font-weight: 600;
    position: relative;
}
.upload-fora-mes .flag-fora-mes {
    font-size: 0.65rem;
    vertical-align: middle;
    margin-left: 4px;
    color: #b45309;
}
@media (max-width: 780px) {
    .info-diretorio-card.compacto .acoes-totais {
        flex-direction: column;
        align-items: stretch;
    }
    .info-diretorio-card.compacto .acoes-totais .btn {
        width: 100%;
        min-width: unset;
    }
    .info-diretorio-card.compacto .acoes-totais .divergentes-toggle-inline {
        width: 100%;
        justify-content: center;
        margin-left: 0;
    }
}

/* === REFINOS DO MODAL DE DOWNLOAD (layout mais limpo) === */
#downloadProgressModal .progress-modal-content {
    width: min(620px, 92vw);
    min-width: auto;
    padding: 34px 32px;
    border-top: 4px solid var(--primary-color);
}

#downloadProgressModal .progress-header {
    margin-bottom: 20px;
}

#downloadProgressModal .download-progress-title {
    font-size: 1.75rem;
    font-weight: 500;
    line-height: 1.2;
}

#downloadProgressModal .download-progress-body {
    gap: 20px;
}

#downloadProgressModal .download-progress-message {
    font-size: 1.3rem;
    font-weight: 500;
    margin-bottom: 10px;
}

#downloadProgressModal .download-progress-details {
    font-size: 1.05rem;
    font-weight: 400;
}

#downloadProgressModal .download-progress-indeterminate {
    justify-content: center;
}

#downloadProgressModal .download-progress-loading {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px 12px;
}

#downloadProgressModal .download-progress-spinner {
    width: 86px;
    height: 86px;
    border-width: 9px;
    border-color: var(--border-color);
    border-top-color: var(--primary-color);
    margin-right: 0;
}

#downloadProgressModal .download-progress-status {
    font-weight: 500;
    font-size: 1.25rem;
    color: var(--primary-color);
    text-align: center;
}

#downloadProgressModal.progress-modal {
    background: rgba(0, 0, 0, 0.82);
}

#downloadProgressModal .download-progress-file-info {
    text-align: center;
}

/* === Filtro avançado (período de upload) === */
.advanced-filter-toggle {
    margin-top: 10px;
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    text-align: right;
}

.advanced-filter-panel {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
}

.advanced-filter-title {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.advanced-filter-title-content {
    flex: 1;
    min-width: 0;
}

.advanced-filter-title i {
    color: var(--primary-color);
    margin-top: 2px;
}

.advanced-filter-title-main {
    font-weight: 750;
    font-size: 0.98rem;
    line-height: 1.2;
}

.advanced-filter-title-sub {
    font-size: 0.82rem;
    line-height: 1.35;
    color: var(--text-secondary);
}

.advanced-filter-title-sub-row {
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.advanced-filter-inline-inputs {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.advanced-filter-inline-inputs .form-group {
    margin-bottom: 0;
}

.advanced-filter-inline-inputs .form-group label {
    margin-bottom: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.advanced-filter-inline-inputs input[type="date"] {
    width: 140px;
    padding: 6px 8px;
    font-size: 0.86rem;
    border-radius: 8px;
}

.advanced-filter-hint {
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.advanced-filter-inline-inputs .btn.btn-sm {
    height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .advanced-filter-toggle {
        width: 100%;
        justify-content: flex-end;
    }
    .advanced-filter-inline-inputs {
        width: 100%;
        justify-content: flex-start;
    }
    .advanced-filter-inline-inputs input[type="date"] {
        width: 100%;
        max-width: 220px;
    }
}