@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ==========================================================================
   1. VARIÁVEIS (TOKENS DE DESIGN BI)
   ========================================================================== */
:root {
    /* Cores Principais */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --primary: #3b82f6; /* Azul Vibrante */
    --primary-soft: rgba(59, 130, 246, 0.15);

    /* Cores de Texto */
    --text-main: #1e293b;
    --text-light: #64748b;
    --text-sidebar: #94a3b8;

    /* Bordas e Sombras BI */
    --border: #e2e8f0;
    --shadow-sm: 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --shadow-bi: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;

    /* Status Cores e Glows */
    --success: #10b981;
    --bg-success: rgba(16, 185, 129, 0.1);
    --glow-success: 0 0 10px rgba(16, 185, 129, 0.2);

    --warning: #f59e0b;
    --bg-warning: rgba(245, 158, 11, 0.1);
    --glow-warning: 0 0 10px rgba(245, 158, 11, 0.2);

    --danger: #ef4444;
    --bg-danger: rgba(239, 68, 68, 0.1);
    --glow-danger: 0 0 10px rgba(239, 68, 68, 0.2);

    /* Z-indexes organizados */
    --z-sidebar: 1000;
    --z-overlay: 1040;
    --z-modal: 1050;
    --z-toast: 1100;
}

[data-theme='dark'] {
    --primary: #60a5fa;
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --text-main: #e2e8f0;
    --text-light: #94a3b8;
    --border: #334155;
    --input-bg: #0f172a;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-bi: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   BOTÕES (Padrão Global)
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.btn svg,
.btn i {
    width: 18px;
    height: 18px;
}

/* Variações de Cores */
.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2);
}
.btn-primary:hover {
    background-color: #2563eb; /* Azul mais escuro no hover */
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background-color: #f1f5f9;
    color: var(--text-main);
    border-color: var(--border);
}
.btn-secondary:hover {
    background-color: #e2e8f0;
    color: var(--text-main);
}
/* Adaptação do botão secundário para o Tema Escuro */
[data-theme='dark'] .btn-secondary {
    background-color: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}
[data-theme='dark'] .btn-secondary:hover {
    background-color: #334155;
}

.btn-success {
    background-color: var(--success);
    color: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
}
.btn-success:hover {
    background-color: #059669;
    transform: translateY(-1px);
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
    background-color: #dc2626;
    transform: translateY(-1px);
}

/* Tamanhos Menores */
.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 6px;
}

/* Botões de Ícone (Usados nas tabelas de Registros e Lixeira) */
.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-light);
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover {
    background-color: var(--primary-soft);
    color: var(--primary);
}
.btn-icon.btn-trash:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* =========================================
   ESTRUTURA PRINCIPAL (ALINHAMENTO)
   ========================================= */
/* Aplique esta classe na tag <body> da sua página de login */
body.login-page {
    display: flex;
    justify-content: center; /* Centraliza horizontalmente no desktop */
    align-items: center; /* Centraliza verticalmente no desktop */
    min-height: 100vh; /* Ocupa a altura inteira da tela */
    margin: 0;
    background-color: #121212; /* Fundo escuro (Dark Mode) */
    font-family:
        'Inter',
        system-ui,
        -apple-system,
        sans-serif;
    padding: 16px; /* Garante um respiro nas bordas do celular */
    box-sizing: border-box;
}

/* =========================================
   CONTÊINER DO LOGIN (A "CAIXA" MOBILE)
   ========================================= */
.login-container {
    width: 100%;
    max-width: 420px; /* Trava a largura para não esticar no monitor */
    background-color: #1e1e1e; /* Fundo do card ligeiramente mais claro */
    padding: 40px 32px;
    border-radius: 16px; /* Bordas arredondadas modernas */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4); /* Sombra suave para destacar do fundo */
    box-sizing: border-box;
}

/* Textos de Cabeçalho */
.login-container h1 {
    color: #ffffff;
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 8px 0;
    text-align: center;
}

.login-container p {
    color: #a0a0a0;
    font-size: 14px;
    margin: 0 0 32px 0;
    text-align: center;
}
/* ==========================================================================
   2. RESET E TIPOGRAFIA GLOBAL
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-main);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}
h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}
h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}
h3 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.025em;
}

.hidden {
    display: none !important;
}
.no-print {
    display: block;
}

/* Scrollbar Customizada */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--text-light) var(--bg-main);
}
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-light);
}

/* ==========================================================================
   3. LAYOUT BASE E CARDS (UNIFICADO)
   ========================================================================== */
.content,
.main-content {
    margin-left: 260px; /* Compensa sidebar fixa */
    padding: 30px;
    width: calc(100% - 260px);
    transition: margin-left 0.3s ease;
}

.content-inner {
    max-width: 100%; /* Expandirá para toda a tela */
    padding-right: 15px; /* Dá um leve respiro na borda direita */
    margin-left: auto;
    margin-right: auto;
}

#app-screen {
    width: 100%;
    flex: 1;
}

/* Unificação de todos os estilos de Card */
.card,
.bi-card,
.summary-card,
.chart-box,
.login-box,
.card-bi {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-bi);
    transition:
        transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.2s;
}

.card:hover,
.summary-card:hover,
.bi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* Redefinindo os Summary Cards (Dashboard) */
.summary-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    min-height: 100px;
}

/* ==========================================================================
   4. TIPOGRAFIA FINANCEIRA E ÍCONES (BI STYLE)
   ========================================================================== */
/* Títulos dos Cards */
.card-info h3,
.card-title,
.summary-card small {
    margin: 0 0 6px 0;
    font-size: 0.8rem;
    color: var(--text-light);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    display: block;
}

/* Valores Financeiros (Unificação de classes) */
.financial-value,
.valor-financeiro,
.card-info p {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 800; /* Tipografia Inter ExtraBold */
    color: var(--text-main);
    line-height: 1.1;
    letter-spacing: -0.03em;
    word-break: break-word;
}

/* Ícones dos Cards (Dashboard) */
.card-icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    color: var(--primary);
    background: var(--primary-soft);
}
.card-icon svg,
.card-icon i {
    width: 26px;
    height: 26px;
}

/* Temas de cores extras para ícones do Dashboard */
.card-red .card-icon {
    color: var(--danger);
    background: var(--bg-danger);
}
.card-yellow .card-icon {
    color: var(--warning);
    background: var(--bg-warning);
}
.card-green .card-icon {
    color: var(--success);
    background: var(--bg-success);
}

/* ==========================================================================
   5. BADGES E PROGRESS BARS (GLOW SUTIL)
   ========================================================================== */
.badge,
.status-badge {
    padding: 6px 14px;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

/* Padronização de nomes: suporte a ambas as nomenclaturas do seu projeto */
.badge-pago,
.status-pago,
.status-Pago {
    background-color: var(--bg-success);
    color: var(--success);
    box-shadow: var(--glow-success);
}
.badge-pendente,
.status-pendente,
.status-Pendente {
    background-color: var(--bg-warning);
    color: var(--warning);
    box-shadow: var(--glow-warning);
}
.badge-vencido,
.status-vencido,
.status-Vencido {
    background-color: var(--bg-danger);
    color: var(--danger);
    box-shadow: var(--glow-danger);
}

/* Barra de Progresso Unificada */
.progress-container {
    width: 100%;
    background-color: var(--border);
    border-radius: 999px;
    height: 8px;
    margin-top: 12px;
}
.progress-bar {
    background-color: var(--primary);
    height: 100%;
    border-radius: 999px;
    transition: width 0.5s ease-out;
}

/* ==========================================================================
   6. SIDEBAR (CORRIGIDA)
   ========================================================================== */
.sidebar {
    background-color: var(--sidebar-bg);
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: var(--z-sidebar);
}

.sidebar,
.sidebar-menu {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.sidebar::-webkit-scrollbar,
.sidebar-menu::-webkit-scrollbar {
    display: none;
}

.sidebar-menu {
    flex: 1 1 0;
    overflow-y: auto;
    padding: 15px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: #475569;
    margin: 20px 0 10px 12px;
    letter-spacing: 0.05em;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-sidebar);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.menu-item i,
.menu-item svg {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    color: inherit;
    transition: color 0.2s ease;
}

.menu-item:hover {
    background-color: var(--sidebar-hover);
    color: #ffffff;
}

/* Lógica de Item Ativo Consertada (Sem conflitos) */
.menu-item.active {
    background-color: var(--primary-soft);
    color: #ffffff;
}
.menu-item.active i,
.menu-item.active svg {
    color: var(--primary);
}
.menu-item.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    height: 60%;
    width: 4px;
    background-color: var(--primary);
    border-radius: 0 4px 4px 0;
}

/* Perfil e Footer da Sidebar */
.sidebar-user {
    padding: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
    cursor: pointer;
}
.avatar-circle {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
}
.user-info-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.user-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
}
#user-role {
    font-size: 0.75rem;
    color: var(--text-sidebar);
}

.sidebar-footer {
    padding: 10px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}
.menu-item.logout {
    color: var(--text-sidebar);
    margin-top: 5px;
}
.menu-item.logout:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* ==========================================================================
   7. ANIMAÇÃO DE TRANSIÇÃO SPA
   ========================================================================== */
.fadeInSlide {
    animation: fadeInSlideAnim 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes fadeInSlideAnim {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.view-section:not(.hidden) {
    animation: fadeInSlideAnim 0.4s ease-out forwards;
}

/* ==========================================================================
   5. COMPONENTES: FORMULÁRIOS & INPUTS
   ========================================================================== */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.full-width {
    flex: 100%;
}
.half-width {
    flex: 1 1 45%;
}
.three-col .form-group {
    flex: 1;
    min-width: 200px;
}

.form-group {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.input-wrapper {
    position: relative;
    margin-bottom: 20px;
    text-align: left;
}

label {
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

/* Estilo unificado para inputs */
input[type='text'],
input[type='number'],
input[type='date'],
input[type='password'],
input[type='month'],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-card); /* Fundo branco/escuro limpo */
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-main);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15); /* Anel de foco suave */
}

/* Modernização dos campos de Data nativos */
input[type='date'],
input[type='month'] {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
}
input[type='date']::-webkit-calendar-picker-indicator,
input[type='month']::-webkit-calendar-picker-indicator {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%233b82f6" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>');
    cursor: pointer;
    opacity: 0.7;
    transition:
        opacity 0.2s,
        transform 0.2s;
}
input[type='date']::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Input com Ícone (Login, Senha, Busca) */
.input-wrapper.with-icon input {
    padding-left: 45px;
}
.input-wrapper.with-icon .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    width: 20px;
    height: 20px;
    pointer-events: none;
}

/* Botão Toggle de Senha (Olho) */
.toggle-pass {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-light);
    border-radius: 50%;
    transition: all 0.2s;
}
.toggle-pass:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--primary);
}
.toggle-pass svg {
    width: 20px;
    height: 20px;
}

/* Mensagens de Erro */
.error-msg {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 5px;
    display: none;
}
.input-error {
    border-color: var(--danger) !important;
    background-color: rgba(239, 68, 68, 0.05) !important;
}

/* Botões Switch/Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}
.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: 0.4s;
    border-radius: 34px;
}
.slider:before {
    position: absolute;
    content: '';
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
input:checked + .slider {
    background-color: var(--primary);
}
input:checked + .slider:before {
    transform: translateX(24px);
}

/* ==========================================================================
   6. COMPONENTES: CARDS (Layout System)
   ========================================================================== */
/* Estilo Base Compartilhado (DRY) */
.card,
.summary-card,
.chart-box,
.login-box {
    background: var(--bg-card);
    border-radius: var(--border-radius);

    /* MUDANÇA PRINCIPAL: Remover borda sólida e usar sombra */
    border: 1px solid rgba(226, 232, 240, 0.6);
    border-color: rgba(226, 232, 240, 0.6);

    transition:
        transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Comportamento de Hover (Elevação) */
.summary-card:hover,

/* -- Variações de Cards -- */

/* 1. Summary Card (Dashboard) */
.summary-card {
    min-height: 44px;
    padding: 20px 20px 20px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    overflow: hidden;
}
/* Barra lateral colorida via pseudo-elemento */
.summary-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 4px 0 0 4px;
}
.card-blue::before {
    background: var(--primary);
}
.card-red::before {
    background: var(--danger);
}
.card-yellow::before {
    background: var(--warning);
}
.card-green::before {
    background: var(--success);
}

/* ESTILIZAÇÃO ESPECÍFICA DE DADOS (DASHBOARD) */
.card-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0; /* Permite que o flex item comprima abaixo do conteúdo */
    flex: 1;
}

/* TÍTULO DO CARD (Rótulo) */
.card-info h3 {
    margin: 0 0 5px 0;
    font-size: 0.7rem;
    color: var(--text-light);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    line-height: 1.3;
}

/* VALOR DO CARD (O Dado Principal) */
.card-info p {
    margin: 0;
    font-size: 1.25rem; /* Tamanho equilibrado: legível e cabe "R$ 3.854,00" */
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.15;
    letter-spacing: -0.02em;
    word-break: break-word; /* Quebra em casos extremos, sem truncar */
}

/* SUBTEXTO (Detalhes) */
.card-info small {
    margin-top: 6px;
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

/* 2. Chart Box */
.chart-box {
    flex: 1;
    min-width: 350px;
    padding: 25px;
    display: flex;
    flex-direction: column;
}

/* 3. Generic Card Padding */
.card {
    padding: 25px;
    margin-bottom: 25px;
}
.card > h3:first-child,
.card > h3:first-of-type {
    margin-bottom: 16px;
}

/* Ícones dentro dos cards */
.card-icon {
    /* Dimensões fixas */
    width: 52px;
    height: 52px;
    flex-shrink: 0; /* Impede que o ícone esmague se o texto for longo */
    border-radius: 14px;

    /* Centralização Absoluta (Flexbox) */
    display: flex;
    justify-content: center;
    align-items: center;

    /* Tipografia para Emojis (Correção da imagem 2) */
    font-size: 1.7rem; /* Define tamanho grande para emojis */
    line-height: 1; /* Remove espaçamento extra acima/abaixo do emoji */

    background: var(--bg-body);
    color: var(--text-main);
}

/* Correção específica para ícones SVG (Lucide - Imagem 1) */
.card-icon svg {
    width: 26px;
    height: 26px;
    stroke-width: 2px;
    display: block; /* Remove "ghost space" de elementos inline */
}

/* Temas de ícones */
.card-blue .card-icon {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
}
.card-red .card-icon {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}
.card-yellow .card-icon {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}
.card-green .card-icon {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

/* Tipografia interna dos cards */
.card-info h3 {
    margin: 0 0 5px;
    font-size: 0.85rem;
    color: var(--text-light);
    text-transform: uppercase;
    font-weight: 600;
}
.card-info p {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.15;
    letter-spacing: -0.02em;
    word-break: break-word;
}
.card-info small {
    margin-top: 5px;
    display: block;
    font-size: 0.8rem;
}

/* ==========================================================================
   7. LAYOUT: SIDEBAR
   ========================================================================== */
/* --- SIDEBAR REESTILIZADA --- */
.sidebar {
    background-color: var(--sidebar-bg);
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1000;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 20px 15px;
    scrollbar-width: none; /* Oculta scroll no Firefox */
}
.sidebar-menu::-webkit-scrollbar {
    display: none; /* Oculta scroll no Chrome/Safari */
}
.avatar-circle {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: 1.1rem;
}

.user-info-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}
.user-name {
    font-size: 0.9rem;
    font-weight: 700;
}
#user-role {
    font-size: 0.75rem;
    color: var(--text-light);
}

.sidebar-menu {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    justify-content: flex-start;
}
.sidebar-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    margin-top: 0;
}

.menu-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: #475569;
    margin: 20px 0 10px 12px;
    letter-spacing: 0.05em;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 4px;
    border-radius: 8px;
    color: var(--text-sidebar);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.menu-item i,
.menu-item svg {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    color: inherit;
    transition: color 0.2s ease;
}

/* Efeito de Hover e Ativo na Sidebar */
.menu-item:hover {
    background-color: var(--sidebar-hover);
    color: #ffffff;
}
.menu-item:hover svg,
.menu-item:hover i {
    color: #ffffff;
}

/* Estado Ativo: Elegante, sem fundo destacado, focando na barra e na cor da fonte */
.menu-item.active {
    background-color: var(--primary-soft); /* Usa a sua variável correta de fundo translúcido */
    color: #ffffff;
}

.menu-item.active i,
.menu-item.active svg {
    color: var(--primary);
}

/* O indicador de aba ativa ( ▌ ) encostado na extrema esquerda */
.menu-item.active::before {
    content: '';
    position: absolute;
    left: -12px; /* Compensa a margem para colar na borda esquerda da sidebar */
    top: 50%;
    transform: translateY(-50%);
    height: 50%; /* Ocupa apenas metade da altura do item para ficar mais sofisticado */
    width: 4px;
    background-color: var(--primary);
    border-radius: 0 4px 4px 0; /* Arredondado apenas do lado direito */
}

/* Ajustes no botão de Logout para manter o padrão moderno */
.menu-item.logout {
    color: var(--text-sidebar);
    margin-top: 5px;
}
.menu-item.logout:hover {
    background-color: rgba(239, 68, 68, 0.05);
    color: var(--danger);
}
.menu-item.logout:hover svg {
    color: var(--danger);
}

/* ==========================================================================
   8. LAYOUT: CONTEÚDO PRINCIPAL
   ========================================================================== */

/* --- DASHBOARD CARDS & TYPOGRAPHY --- */
.card-bi {
    background: var(--card-white);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.financial-value,
.valor-financeiro,
.card-info p {
    font-size: 1.8rem;
    font-weight: 800; /* Peso 800 solicitado */
    color: var(--text-main);
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin: 0;
}

/* --- BADGES COM GLOW SUTIL --- */
.status-badge {
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pago {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.15);
}

.status-pendente {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.15);
}

.status-vencido {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.15);
}

/* --- ANIMAÇÕES --- */
.fadeInSlide {
    animation: fadeInSlideAnim 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeInSlideAnim {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.content,
.main-content {
    margin-left: 260px; /* Compensa a sidebar fixa */
    padding: 30px;
    width: calc(100% - 260px);
    transition: margin-left 0.3s ease;
}
/* Unificando a classe de Cards (Pode usar .card ou .bi-card) */
.card,
.bi-card,
.summary-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-bi);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}
.card:hover,
.bi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 20px -5px rgba(0, 0, 0, 0.08); /* Sombra mais intensa no hover */
}
/* Wrapper interno que limita a largura máxima do conteúdo */
.content-inner {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 15px;
}
.header-flex h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

.btn-toggle {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-main);
    cursor: pointer;
    margin-right: 15px;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

#card-saida-geral {
    background-color: rgba(239, 68, 68, 0.05); /* Um tom de vermelho muito suave */
}

#card-saldo-geral {
    opacity: 0.9;
}

.charts-row {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Toolbar de Filtros */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    padding: 15px;
    background: var(--bg-body);
    border-radius: 12px;
    border: 1px solid var(--border);
}
.search-box {
    flex: 2;
    min-width: 250px;
}
.filters {
    flex: 3;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.filters > * {
    flex: 1;
    min-width: 130px;
}
.mobile-filter-row {
    display: flex;
    flex-direction: row;
    gap: 10px;
    flex: 2;
}
.mobile-filter-row select {
    flex: 1;
    min-width: 0;
}

/* ==========================================================================
   10. MÓDULO: TABELAS E BADGES
   ========================================================================== */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
th {
    padding: 18px 20px; /* Mais respiro vertical */
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: var(--text-light);
}
td {
    padding: 18px 20px;
    font-size: 0.95rem;
    font-weight: 500; /* Levemente mais peso que regular */
}
tr:hover td {
    background-color: var(--bg-body);
}
td:nth-child(4) {
    /* Assumindo que a coluna 4 é Valor */
    font-weight: 600;
    font-variant-numeric: tabular-nums; /* Alinha números em tabelas */
    letter-spacing: -0.02em;
}

/* Badges e Status */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}
.status-Pago {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}
.status-Pendente {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}
.status-Vencido {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* Semântica em Linhas */
tr.row-vencido td {
    background-color: rgba(239, 68, 68, 0.05) !important;
}
tr.row-proximo td {
    background-color: rgba(245, 158, 11, 0.05) !important;
}

/* Filter Tags */
.filter-tag {
    background-color: var(--bg-body);
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-main);
}

/* ==========================================================================
   11. OVERLAYS (MODAIS E TOASTS)
   ========================================================================== */
/* Toast Notification */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    min-width: 300px;
    padding: 16px;
    border-radius: 12px;
    color: white;
    box-shadow: var(--shadow-lg);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
}
.toast-success {
    background: var(--success);
}
.toast-error {
    background: var(--danger);
}
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Modais */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    display: flex;
    justify-content: center;
    align-items: center;
}
.modal-content {
    background: var(--bg-card);
    width: 95%;
    max-width: 600px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
    overflow: hidden;
    overscroll-behavior: contain;
}
.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-body {
    padding: 25px;
    max-height: 80vh;
    overflow-y: auto;
}
.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

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

/* ==========================================================================
   12. RESPONSIVIDADE E PRINT
   ========================================================================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
    }

    .content {
        margin-left: 0;
        width: 100%;
        padding: 15px;
    }
    .btn-toggle {
        display: block !important;
    }

    .header-flex {
        flex-wrap: wrap;
        gap: 12px;
        align-items: center;
    }
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .dashboard-cards {
        grid-template-columns: 1fr;
    }

    #mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: var(--z-overlay);
    }
}

@media print {
    .sidebar,
    .btn,
    .toolbar,
    .no-print {
        display: none !important;
    }
    .content {
        margin: 0;
        padding: 0;
    }
    .card {
        border: none;
        box-shadow: none;
        padding: 0;
    }
    body {
        background: white;
        color: black;
    }
}

/* --- Toggle Switch (Aparência) --- */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1; /* Cor desativado (cinza claro) */
    transition: 0.4s;
}

.slider:before {
    position: absolute;
    content: '';
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* Isso faz com que o label "Senha" não ocupe espaço, corrigindo o alinhamento */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

#tabela-registros td:last-child {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px; /* O editor vai reclamar disso, ignore! */
    padding: 18px 20px;
    border-bottom: 1px solid #e2e8f0; /* Usando cor direta pra evitar erro do editor */
}

/* 2. Remove margens extras dos botões apenas nessa coluna */
#tabela-registros td:last-child .btn-icon {
    margin: 0 !important;
    transform: none !important; /* Reseta posições estranhas */
}

/* 3. Ajuste fino para os ícones SVG dentro dos botões */
#tabela-registros td:last-child .btn-icon svg {
    display: block;
    margin: auto;
}

table td:last-child {
    vertical-align: middle !important;
    text-align: right; /* Garante que fiquem à direita */
    white-space: nowrap; /* Impede que os botões quebrem linha */
}

/* 2. Ajusta o tamanho da área de clique do botão */
table td:last-child .btn-icon {
    width: 40px; /* Um pouco maior para caber o ícone */
    height: 40px;
    margin-left: 5px; /* Espacinho entre um botão e outro */
}

/* 3. Aumenta o desenho do ícone (SVG) dentro do botão */
table td:last-child .btn-icon svg {
    width: 20px; /* Aumentei para ficar mais visível */
    height: 20px;
    stroke-width: 2px; /* Espessura da linha */
    display: inline-block; /* Garante que o tamanho seja respeitado */
    vertical-align: middle;
}

/* 4. (Opcional) Destaque extra só para a lixeira (btn-trash) */
table td:last-child .btn-trash svg {
    width: 24px; /* A lixeira fica levemente maior */
    height: 24px;
    color: var(--danger); /* Garante que fique vermelha */
}
/* ==========================================================================
   13. MOBILE — BOTTOM TAB BAR & DRAWER
   ========================================================================== */

/* Bottom Tab Bar */
.mobile-tab-bar {
    display: none;
}

/* Camera scan button for barcode field */
.barcode-field-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.barcode-field-wrapper input {
    flex: 1;
}
.btn-camera-scan {
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-light);
    flex-shrink: 0;
}
.btn-camera-scan svg {
    width: 22px;
    height: 22px;
}

/* Date filter accordion */
.date-filter-accordion {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.date-filter-toggle {
    display: none; /* Esconde o botão de "Filtrar por data" no Desktop */
}
.date-filter-body {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ==========================================================================
   14. MOBILE — @media (max-width: 640px)
   ========================================================================== */
@media (max-width: 640px) {
    /* --- GLOBAL FIXES --- */
    .no-mobile {
        display: none !important;
    }

    /* Prevent iOS zoom on inputs */
    input[type='text'],
    input[type='number'],
    input[type='date'],
    input[type='password'],
    input[type='month'],
    .input-wrapper input,
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Body adjustments */
    body {
        padding-bottom: 70px;
    }

    /* --- SIDEBAR — hidden on mobile, replaced by bottom bar --- */
    .sidebar {
        display: none !important;
    }
    #mobile-overlay {
        display: none !important;
    }
    .btn-toggle {
        display: none !important;
    }

    /* --- CONTENT --- */
    .content {
        margin-left: 0 !important;
        padding: 16px 14px;
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }

    /* --- HEADER --- */
    .header-flex {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 18px;
        padding-bottom: 14px;
    }
    .header-flex > div:first-child {
        gap: 8px;
    }
    h1 {
        font-size: 1.35rem;
    }
    .header-flex h1 {
        font-size: 1.35rem;
    }

    /* --- BOTTOM TAB BAR --- */
    .mobile-tab-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: calc(62px + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: var(--bg-card);
        border-top: 1px solid var(--border);
        /* Substitua a linha do z-index por esta: */
        z-index: calc(var(--z-sidebar) + 20);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
        align-items: stretch;
    }
    .tab-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        background: transparent;
        border: none;
        cursor: pointer;
        color: var(--text-light);
        font-size: 0.65rem;
        font-weight: 600;
        padding: 6px 4px 8px;
        min-height: 44px;
        transition: color 0.2s;
        font-family: 'Inter', sans-serif;
    }
    .tab-item svg {
        width: 22px;
        height: 22px;
        stroke-width: 2px;
    }
    .tab-item.active {
        color: var(--primary);
    }
    .tab-item.active svg {
        stroke-width: 2.5px;
    }

    /* --- MOBILE MENU DRAWER --- */
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.45);
        z-index: calc(var(--z-sidebar) + 5);
        backdrop-filter: blur(2px);
    }
    .mobile-menu-drawer {
        position: fixed;
        bottom: calc(62px + env(safe-area-inset-bottom));
        left: 0;
        width: 100%;
        background: var(--bg-card);
        border-radius: 20px 20px 0 0;
        z-index: calc(var(--z-sidebar) + 10);
        padding: 0 0 12px;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
        animation: slideUpDrawer 0.28s ease;
    }
    @keyframes slideUpDrawer {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    .mobile-menu-handle {
        width: 40px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
        margin: 12px auto 8px;
    }
    .mobile-menu-user {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 20px 14px;
        border-bottom: 1px solid var(--border);
        margin-bottom: 8px;
    }
    .mobile-menu-items {
        display: flex;
        flex-direction: column;
    }
    .mobile-menu-item {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 14px 22px;
        background: transparent;
        border: none;
        cursor: pointer;
        color: var(--text-main);
        font-size: 0.98rem;
        font-weight: 500;
        font-family: 'Inter', sans-serif;
        text-align: left;
        min-height: 52px;
        transition: background 0.15s;
    }
    .mobile-menu-item:hover,
    .mobile-menu-item:active {
        background: var(--bg-body);
    }
    .mobile-menu-item svg {
        width: 20px;
        height: 20px;
        color: var(--text-light);
    }
    .mobile-menu-logout {
        color: var(--danger) !important;
    }
    .mobile-menu-logout svg {
        color: var(--danger) !important;
    }

    /* --- DASHBOARD --- */
    .dashboard-cards {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px;
        margin-bottom: 20px;
    }
    .summary-card {
        padding: 14px 12px;
        gap: 10px;
    }
    .summary-card:hover {
        transform: none;
    }
    .card-icon {
        width: 44px;
        height: 44px;
        border-radius: 10px;
        font-size: 1.4rem;
        flex-shrink: 0;
    }
    .card-icon svg {
        width: 22px;
        height: 22px;
    }
    .card-info h3,
    .card-title {
        font-size: 0.85rem;
        color: var(--text-light);
        text-transform: uppercase;
        font-weight: 600;
        letter-spacing: 0.05em;
        margin-bottom: 8px;
    }
    .card-info p {
        font-size: 1.1rem;
        line-height: 1.2;
    }
    #view-fluxo .summary-card .card-info p {
        font-size: 1.3rem;
        line-height: 1.2;
    }
    .card-info small {
        font-size: 0.7rem;
        margin-top: 3px;
    }
    .card-value-row {
        display: flex;
        align-items: center;
        gap: 4px;
        flex-wrap: wrap;
    }
    .bullet-separator {
        font-size: 0.6rem;
        color: var(--text-light);
    }
    .qty-indicator {
        font-size: 0.8rem;
        font-weight: 700;
    }

    /* Filter chips (period buttons) horizontal scroll */
    #view-dashboard > div:nth-child(2),
    .filter-chips-row {
        display: flex !important;
        gap: 8px !important;
        overflow-x: auto !important;
        padding-bottom: 6px !important;
        margin-bottom: 16px !important;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    #view-dashboard > div:nth-child(2)::-webkit-scrollbar {
        display: none;
    }
    .filter-btn {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 7px 14px;
        font-size: 0.8rem;
        border-radius: 20px;
    }
    .filter-btn.active {
        background: var(--primary) !important;
        color: white !important;
        border-color: var(--primary) !important;
    }

    /* Charts stacked vertically */
    .charts-row {
        flex-direction: column;
        gap: 16px;
        margin-bottom: 20px;
    }
    .chart-box {
        background-color: var(--bg-card) !important;
        border: 1px solid var(--border) !important; /* Borda clara e definida */
        border-radius: var(--border-radius) !important;
        box-shadow: var(--shadow-bi) !important; /* Sombra padrão para "descolar" do fundo */
        transition:
            transform 0.2s ease,
            box-shadow 0.2s ease !important;
    }

    .chart-box:hover {
        transform: translateY(-4px) !important;
        box-shadow: 0 15px 25px -5px rgba(0, 0, 0, 0.1) !important; /* Sombra mais destacada ao passar o mouse */
        border-color: transparent !important;
    }

    /* Títulos maiores e mais modernos */
    .chart-box h3 {
        font-size: 1.15rem;
        font-weight: 700;
        color: var(--text-main);
        margin-bottom: 25px;
        display: flex;
        align-items: center;
        gap: 10px;
        letter-spacing: -0.01em;
    }

    .chart-container {
        position: relative;
        height: 320px; /* Gráficos levemente mais altos */
        width: 100%;
        flex-grow: 1;
    }

    /* Correção para o Dark Mode nas linhas de grid */
    [data-theme='dark'] .chart-box {
        border: 1px solid var(--border);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    }

    /* Calendar accordion — listWeek on mobile (JS handles view, CSS collapses by default) */
    #calendar-wrapper {
        overflow: hidden;
    }

    /* --- NOVO LANÇAMENTO FORM --- */
    #form-boleto {
        max-width: 100% !important;
        padding: 16px;
    }
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    .half-width,
    .full-width,
    .three-col .form-group {
        flex: none !important;
        width: 100% !important;
        min-width: unset !important;
    }
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    .form-actions .btn {
        width: 100%;
        height: 50px;
    }
    .barcode-field-wrapper {
        align-items: center;
    }

    /* --- REGISTROS — TABLE TO CARDS --- */
    /* Hide the table header on mobile */
    #tabela-registros thead {
        display: none !important;
    }
    /* Each row becomes a card */
    #tabela-registros tbody tr {
        display: block;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 12px;
        margin-bottom: 12px;
        padding: 14px;
        box-shadow: var(--shadow-sm);
    }
    #tabela-registros tbody tr:hover td {
        background: transparent;
    }
    /* Hide individual TDs default layout */
    #tabela-registros tbody td {
        display: block;
        padding: 2px 0;
        border: none;
        font-size: 0.9rem;
    }
    /* Vencimento column - small top label */
    #tabela-registros tbody td:nth-child(1) {
        font-size: 0.75rem;
        color: var(--text-light);
        order: 3;
        display: inline;
    }
    /* Descrição - main title */
    #tabela-registros tbody td:nth-child(2) {
        font-size: 0.95rem;
        font-weight: 700;
        color: var(--text-main);
        order: 1;
        display: block;
        margin-bottom: 6px;
    }
    /* Categoria badge */
    #tabela-registros tbody td:nth-child(3) {
        font-size: 0.75rem;
        color: var(--text-light);
        order: 2;
        display: inline;
        margin-right: 8px;
    }
    /* Valor - highlighted right */
    #tabela-registros tbody td:nth-child(4) {
        font-size: 1.1rem;
        font-weight: 800;
        color: var(--text-main);
        order: 1;
        display: block;
        text-align: right;
        margin-top: -26px;
        margin-bottom: 4px;
    }
    /* Status badge */
    #tabela-registros tbody td:nth-child(5) {
        display: inline-block !important;
        order: 2;
    }
    /* Actions row */
    #tabela-registros tbody td:last-child {
        display: flex !important;
        justify-content: flex-end !important;
        gap: 6px !important;
        padding: 8px 0 0 !important;
        margin-top: 8px;
        border-top: 1px solid var(--border) !important;
    }
    #tabela-registros tbody td:last-child .btn-icon {
        width: 44px !important;
        height: 44px !important;
    }

    /* Toolbar — 2 rows on mobile */
    .toolbar {
        flex-direction: column;
        padding: 12px;
        gap: 10px;
    }
    .search-box {
        min-width: unset;
        width: 100%;
        flex: none;
    }
    .search-box input {
        width: 100%;
    }
    .filters {
        width: 100%;
        flex-direction: column;
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 8px;
    }
    .filters > * {
        min-width: unset;
        flex: none;
        width: 100%;
    }
    .mobile-filter-row {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 10px;
        flex: 2;
    }

    .mobile-filter-row select {
        flex: 1;
        margin: 0;
    }

    /* Date filter accordion on mobile */
    .date-filter-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 10px 14px;
        background: var(--bg-body);
        border: 1px solid var(--border);
        border-radius: 10px;
        color: var(--text-main);
        font-size: 0.85rem;
        font-weight: 600;
        cursor: pointer;
        font-family: 'Inter', sans-serif;
    }
    .date-filter-body {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    .date-filter-body.hidden {
        display: none !important;
    }

    /* Pagination simplified */
    .pagination {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 12px;
        padding: 12px 0 4px;
    }
    #info-paginas {
        font-size: 0.9rem;
    }

    /* --- FLUXO DE CAIXA --- */
    /* Summary cards: compact vertical stack */
    #view-fluxo .dashboard-cards {
        grid-template-columns: 1fr !important;
        gap: 10px;
        margin-bottom: 16px;
    }
    #view-fluxo .summary-card {
        padding: 12px 16px;
    }

    /* Forms as tabs */
    .fluxo-forms-wrapper {
        flex-direction: column !important;
        gap: 0 !important;
    }
    .fluxo-tab-btns {
        display: flex;
        gap: 0;
        border-bottom: 2px solid var(--border);
        margin-bottom: 0;
    }
    .fluxo-tab-btn {
        flex: 1;
        padding: 12px;
        background: var(--bg-body);
        border: none;
        border-bottom: 2px solid transparent;
        font-size: 0.9rem;
        font-weight: 600;
        cursor: pointer;
        color: var(--text-light);
        margin-bottom: -2px;
        font-family: 'Inter', sans-serif;
        transition:
            color 0.2s,
            border-color 0.2s;
    }
    .fluxo-tab-btn.active {
        color: var(--primary);
        border-bottom-color: var(--primary);
        background: var(--bg-card);
    }
    .fluxo-form-panel {
        display: none;
    }
    .fluxo-form-panel.active {
        display: block;
    }

    /* Header actions on fluxo - icon only */
    .fluxo-header-actions .btn span {
        display: none;
    }

    /* Fluxo table also cards */
    #tabela-fluxo thead {
        display: none !important;
    }
    #tabela-fluxo tbody tr {
        display: flex;
        flex-wrap: wrap;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 10px;
        margin-bottom: 10px;
        padding: 12px 14px;
        gap: 4px;
        align-items: center;
    }
    #tabela-fluxo tbody td {
        display: inline-block;
        padding: 2px 4px;
        border: none;
    }
    #tabela-fluxo tbody td:nth-child(1) {
        /* Data */
        font-size: 0.75rem;
        color: var(--text-light);
        width: 100%;
    }
    #tabela-fluxo tbody td:nth-child(2) {
        /* Descrição */
        font-weight: 600;
        font-size: 0.9rem;
        flex: 1;
    }
    #tabela-fluxo tbody td:nth-child(4) {
        /* Valor */
        font-weight: 800;
        font-size: 1rem;
        margin-left: auto;
    }

    /* Extrato full width on mobile */
    #view-fluxo [style*='flex: 2'] {
        min-width: unset !important;
        width: 100% !important;
    }
    #view-fluxo > div[style*='display: flex'] {
        flex-direction: column !important;
    }
    #view-fluxo [style*='min-width: 300px'],
    #view-fluxo [style*='min-width: 400px'] {
        min-width: unset !important;
    }

    /* --- MODAIS — Bottom Sheet --- */
    .modal-overlay {
        align-items: flex-end;
        /* Garante cobertura total da tab bar (z-index: 1020) */
        z-index: calc(var(--z-modal) + 50);
    }
    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 20px 20px 0 0;
        max-height: 90vh;
        overflow-y: auto;
        animation: slideUpModal 0.3s ease;
    }
    @keyframes slideUpModal {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    .modal-header {
        padding: 16px 20px;
    }
    .modal-body {
        padding: 16px 20px 24px;
        max-height: none;
    }
    .close-btn {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.6rem;
    }
    /* Modal form rows also stack */
    .modal-body .form-row {
        flex-direction: column;
        gap: 0;
    }
    .modal-body .half-width {
        flex: none !important;
        width: 100% !important;
    }

    /* --- CONFIGURAÇÕES — Accordions --- */
    #view-config .card {
        padding: 0;
        overflow: hidden;
        margin-bottom: 12px;
    }
    .config-accordion-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px 18px;
        cursor: pointer;
        font-weight: 600;
        font-size: 0.95rem;
        user-select: none;
    }
    .config-accordion-body {
        padding: 0 18px 16px;
    }
    .config-accordion-body.collapsed {
        display: none;
    }
    #view-config .card .form-row {
        flex-direction: column;
        gap: 0;
    }
    #view-config .card .half-width {
        flex: none !important;
        width: 100% !important;
    }
    /* Config header */
    #view-config > .header-flex {
        display: none;
    }

    /* User table in config → cards */
    #tabela-usuarios-config tr {
        display: block;
        border-bottom: 1px solid var(--border);
        padding: 10px 0;
    }
    #tabela-usuarios-config td {
        display: inline-block;
        padding: 2px 4px;
    }
    #tabela-usuarios-config th {
        display: none;
    }
    #tabela-usuarios-config td:last-child {
        display: flex !important;
        gap: 6px;
        flex-wrap: wrap;
        margin-top: 4px;
    }

    /* Toast position adjustment */
    #toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        align-items: stretch;
    }
    .toast {
        min-width: unset;
        width: 100%;
    }

    /* Logs table adjustments */
    #tabela-logs thead th:nth-child(4),
    #tabela-logs tbody td:nth-child(4) {
        display: none;
    }
    #tabela-logs td,
    #tabela-logs th {
        padding: 10px 8px;
        font-size: 0.8rem;
    }

    /* Fluxo header buttons icon-only */
    #view-fluxo .header-flex > div:last-child .btn {
        padding: 8px 10px;
    }
    #view-fluxo .header-flex .btn-success span,
    #view-fluxo .header-flex [onclick*='print'] span {
        display: none;
    }

    /* Period select month input */
    .periodo-select {
        font-size: 14px !important;
        padding: 8px 10px;
    }
}

/* --- PERIOD FILTER ROW (chips) --- */
.period-filter-row {
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px !important;

    /* ADICIONE ESTAS LINHAS: Cria o efeito de esmaecimento (Fade) na direita */
    -webkit-mask-image: linear-gradient(to right, black 80%, transparent 100%);
    mask-image: linear-gradient(to right, black 80%, transparent 100%);
    padding-right: 30px !important; /* Adiciona espaço extra no fim para o scroll ir até o fim visível */
}
.period-filter-row::-webkit-scrollbar {
    display: none;
}

/* --- CONFIG MOBILE HEADER --- */
.mobile-config-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
}
.mobile-config-header h1 {
    margin: 0;
}

/* --- BARCODE field fix (desktop: side by side) --- */
.barcode-field-wrapper {
    flex-direction: row;
    align-items: center;
}

/* --- FLUXO header action buttons: show text on desktop --- */
.fluxo-header-actions .btn span {
    display: inline;
}

/* --- ENSURE TABLE ROW CARD layout correctness --- */
#tabela-registros tbody tr td {
    vertical-align: top;
}

/* dark mobile → movido para bloco [data-theme="dark"] principal */

/* Config mobile header — hidden on desktop, visible mobile */
.mobile-config-header {
    display: none;
}

@media (max-width: 640px) {
    .mobile-config-header {
        display: flex !important;
        margin-bottom: 12px;
        padding-bottom: 14px;
        border-bottom: 1px solid var(--border);
    }

    /* Fluxo forms wrapper min-width reset */
    .fluxo-forms-wrapper > .card {
        min-width: unset !important;
        margin-bottom: 0 !important;
    }
    .fluxo-forms-wrapper {
        gap: 0 !important;
    }

    /* Remove gap between cards in forms wrapper */
    .fluxo-forms-wrapper .card + .card {
        border-top: none;
    }

    /* Card value row for dashboard cards — allow value + qty on same row */
    .card-value-row {
        display: flex;
        align-items: baseline;
        gap: 4px;
        flex-wrap: nowrap;
    }
    .card-value-row p {
        font-size: 1.05rem !important;
    }

    /* Ensure period filter row has proper scrolling */
    .period-filter-row {
        margin-left: -14px;
        margin-right: -14px;
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    /* Audit page — simplified for mobile */
    #view-logs .card {
        padding: 16px 12px;
        overflow-x: auto;
    }

    /* Fluxo extrato card full-width */
    #view-fluxo .card[style*='flex: 2'] {
        flex: none !important;
        width: 100% !important;
        min-width: unset !important;
    }

    /* Search input placeholder size */
    #filtro-busca::placeholder {
        font-size: 14px;
    }
}

/* ==========================================================================
   CUSTOM DROPDOWN (Unidades)
   ========================================================================== */
.custom-dropdown-wrapper {
    padding: 10px 14px;
    border-top: 3px solid var(--primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05); /* Borda mais discreta para o fundo escuro */
    flex-shrink: 0;
    background: transparent; /* Remove o fundo translúcido anterior */
}

.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    /* Alteração da cor: um azul levemente mais claro que a sidebar (#0f172a) */
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    color: #f8fafc; /* Texto claro para leitura no fundo azul */
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.dropdown-toggle:hover {
    background: #2d3748; /* Um pouco mais claro ao passar o mouse */
    border-color: var(--primary);
    color: #ffffff;
}

.dropdown-toggle i {
    width: 18px;
    height: 18px;
}

.dropdown-arrow {
    margin-left: auto;
    transition: transform 0.3s ease;
}

.dropdown-toggle i,
.dropdown-toggle .dropdown-arrow {
    color: inherit;
}

.custom-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    overflow: hidden;
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--text-main);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.9rem;
    font-weight: 500;
}

.dropdown-item:hover {
    background: rgba(37, 99, 235, 0.05);
    color: var(--primary);
}

.dropdown-item.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    font-weight: 700;
}
/* Animação para o Loading do Código de Barras */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Correção de fundo preto em dispositivos móveis e tablets */
@media (max-width: 992px) {
    html,
    body {
        background-color: var(--bg-body);
        min-height: 100vh;
        height: auto;
    }
    .main-content,
    .app-container {
        background-color: var(--bg-body);
        min-height: 100vh;
    }
}

/* ==========================================================================
   MODERNIZAÇÃO DOS CAMPOS DE DATA (NATIVOS)
   ========================================================================== */

/* 1. Melhoria da tipografia e espaçamento interno */
input[type='date'],
input[type='month'] {
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text-main);
    text-transform: uppercase; /* Deixa a formatação dd/mm/aaaa visualmente mais limpa */
    letter-spacing: 0.5px;
    position: relative;
    cursor: pointer;
}

/* 2. Substituir o ícone padrão antigo por um SVG moderno do Lucide (Azul) */
input[type='date']::-webkit-calendar-picker-indicator,
input[type='month']::-webkit-calendar-picker-indicator {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%232563eb" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>');
    background-position: right center;
    background-repeat: no-repeat;
    background-size: 18px;
    cursor: pointer;
    padding-left: 10px; /* Aumenta a área de clique para o utilizador */
    opacity: 0.7;
    transition: all 0.2s ease;
}

/* 3. Efeito de hover (animação suave) */
input[type='date']::-webkit-calendar-picker-indicator:hover,
input[type='month']::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* 4. Versão do ícone para o Tema Escuro (Azul mais claro para contraste) */
[data-theme='dark'] input[type='date']::-webkit-calendar-picker-indicator,
[data-theme='dark'] input[type='month']::-webkit-calendar-picker-indicator {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%2360a5fa" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>');
}

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

.view-section:not(.hidden) {
    animation: fadeInSlide 0.4s ease-out forwards;
    will-change: transform, opacity;
}
/* Remove will-change após animação para liberar memória GPU */
.view-section:not(.hidden).anim-done {
    will-change: auto;
}

/* ==========================================================================
   MÓDULO DE CÂMERA (CONTROLES E FOCO)
   ========================================================================== */
.scanner-controls input[type='range'] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    height: 6px;
    border-radius: 4px;
    background-color: var(--border);
    outline: none;
    border: none;
    box-shadow: none;
}

.scanner-controls input[type='range']::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Anel de Animação de Foco na Câmera */
.focus-ring {
    position: absolute;
    width: 60px;
    height: 60px;
    border: 2px solid var(--success);
    border-radius: 50%;
    pointer-events: none;
    transform: scale(1.5);
    opacity: 0;
    transition:
        transform 0.3s ease-out,
        opacity 0.3s ease-out;
    z-index: 100;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}
.focus-ring.active {
    transform: scale(1);
    opacity: 1;
}

/* ==========================================================================
   TELA DE LOGIN (MODERNA SaaS)
   ========================================================================== */

#login-screen {
    /* MUDANÇA: Força o ecrã a usar Flexbox de forma fixa no topo/esquerda */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999; /* Garante que fique por cima de tudo enquanto estiver visível */

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    padding: 20px;
    box-sizing: border-box; /* Garante que o padding não adicione scroll */
}

/* Quando estiver oculto, desativa a exibição do flex */
#login-screen.hidden {
    display: none !important;
}

/* O Cartão do Formulário de Login */
.login-box {
    background: var(--bg-card);
    padding: 40px 30px;
    border-radius: 16px;
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.2),
        0 10px 10px -5px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
    position: relative;
    z-index: 10;
    box-sizing: border-box;
}

/* 1️⃣ Logo no topo */
.login-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 220px; /* Ajuste este valor para aumentar ou diminuir a logo */
    height: auto; /* Deixa a altura livre para respeitar a proporção da imagem */
    margin: 0 auto 25px;
    background: transparent; /* Remove o fundo circular */
    border-radius: 0; /* Remove o formato de círculo */
    box-shadow: none; /* Remove a sombra interna */
}

.login-logo img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* 8️⃣ Melhor alinhamento e proporções */
.login-box h2 {
    margin: 0 0 5px 0;
    color: var(--text-main);
    font-size: 1.8rem;
    font-weight: 700;
}

.login-subtitle {
    color: var(--text-light);
    margin-bottom: 30px;
    font-size: 0.95rem;
}

/* 3️⃣ Inputs com Ícones */
.input-wrapper.with-icon {
    position: relative;
    margin-bottom: 20px;
    width: 100%; /* Garante que não passe da caixa */
}

.input-wrapper.with-icon input {
    padding-left: 45px;
    padding-right: 40px; /* Espaço para o ícone de olho da senha não encavalar */
    height: 52px;
    font-size: 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    width: 100%;
    box-sizing: border-box; /* 👈 ESSENCIAL: impede o input de vazar pra direita */
    transition: all 0.2s ease;
}

.input-wrapper.with-icon .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8; /* Cor cinza clara para o ícone */
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.input-wrapper.with-icon input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.input-wrapper.with-icon .toggle-pass {
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    position: absolute;
    color: #94a3b8;
}

/* 6️⃣ Link "Esqueceu sua senha?" */
.forgot-password {
    text-align: right;
    margin-bottom: 25px;
    margin-top: -5px;
}

.forgot-password a {
    color: var(--primary);
    font-size: 0.85rem;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.forgot-password a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* 2️⃣ Botão mais destacado */
.btn-login {
    width: 100%;
    height: 52px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-login:hover {
    background: #1d4ed8;
    transform: translateY(-2px); /* Efeito de elevação ao passar o mouse */
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

/* 7️⃣ Rodapé */
.login-footer {
    margin-top: 30px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    text-align: center;
    letter-spacing: 0.5px;
}
/* ==========================================================================
   OCULTAR SCROLLBAR DA SIDEBAR
   ========================================================================== */

/* Para Firefox e IE/Edge */
.sidebar,
.sidebar-menu {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Para Chrome, Safari e Opera */
.sidebar::-webkit-scrollbar,
.sidebar-menu::-webkit-scrollbar {
    display: none;
}

/* ==========================================================================
   CORREÇÃO: TOGGLE DE UNIDADES NA SIDEBAR (SEMPRE ESCURO)
   ========================================================================== */
.sidebar-unit-selector .dropdown-toggle {
    background-color: #1e293b !important; /* Fundo azul escuro */
    color: #f8fafc !important; /* Texto branco */
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.sidebar-unit-selector .dropdown-toggle:hover {
    background-color: #2d3748 !important; /* Levemente mais claro no hover */
    border-color: var(--primary) !important;
    color: #ffffff !important;
}

.sidebar-unit-selector .dropdown-toggle i,
.sidebar-unit-selector .dropdown-toggle svg,
.sidebar-unit-selector .dropdown-toggle .dropdown-arrow {
    color: #f8fafc !important; /* Garante que os ícones fiquem brancos */
}

/* ==========================================================================
   CAIXA MODERNA DE DATA (FLUXO DE CAIXA)
   ========================================================================== */
.modern-filter-container {
    display: flex;
    justify-content: flex-start;
    width: 100%;
    margin-bottom: 25px; /* Espaço antes dos cards de resumo */
}

.modern-date-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 20px;
    display: inline-flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease-in-out;
    cursor: pointer; /* Indica que toda a caixa é clicável */
}

.modern-date-box:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

/* Estilo do Ícone (Fundo azul claro e ícone azul escuro) */
.modern-date-box i {
    color: var(--primary);
    width: 24px;
    height: 24px;
    background: rgba(37, 99, 235, 0.1);
    padding: 8px;
    border-radius: 10px;
    box-sizing: content-box;
}

.date-box-content {
    display: flex;
    flex-direction: column;
}

.date-box-content .date-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-light);
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

/* Remover as bordas padrão do input e fundi-lo com o design da caixa */
.periodo-select-modern {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    color: var(--text-main) !important;
    box-shadow: none !important;
    cursor: pointer;
    outline: none;
    font-family: 'Inter', sans-serif;
    width: 140px; /* Largura suficiente para o texto do mês/ano */
}

.periodo-select-modern:focus {
    box-shadow: none !important;
    background: transparent !important;
}

/* Ajustes para Dispositivos Móveis */
@media (max-width: 640px) {
    .modern-filter-container {
        justify-content: stretch;
    }
    .modern-date-box {
        width: 100%; /* Ocupa toda a largura no ecrã do telemóvel */
    }
    .periodo-select-modern {
        width: 100%;
    }
}
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
/* ============================================================
   FLUXO — DATE RANGE BAR
   ============================================================ */
.fluxo-daterange-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 14px 18px;
}
.fluxo-dr-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.fluxo-dr-dates {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.fluxo-dr-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.fluxo-dr-field label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1;
}
.fluxo-dr-field input[type='date'] {
    width: 148px;
    height: 36px;
    padding: 0 8px;
    font-size: 0.88rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-body);
    color: var(--text-primary);
    box-sizing: border-box;
}
.fluxo-dr-sep {
    font-size: 0.9rem;
    color: var(--text-light);
    padding-top: 18px; /* alinha com o input após o label */
    flex-shrink: 0;
}
.fluxo-dr-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}
.fluxo-quick-btn {
    padding: 0 14px;
    height: 36px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition:
        background 0.15s,
        color 0.15s,
        border-color 0.15s;
    white-space: nowrap;
}
.fluxo-quick-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.fluxo-quick-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    font-weight: 700;
}

/* ============================================================
   FINANCEIRO GERAL — 5 cards em grid flexível
   ============================================================ */
/* ── Fingeral Cards: layout compacto para 6 KPIs na mesma linha ── */
.fingeral-cards {
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

/* Entre 769px e 1199px: 3 colunas */
@media (min-width: 769px) and (max-width: 1199px) {
    .fingeral-cards {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .fingeral-cards .summary-card {
        flex-direction: row !important;
        align-items: center;
        padding: 14px 16px 14px 18px;
    }
    .fingeral-cards .card-info p {
        font-size: 1.15rem !important;
    }
}

/* Nos fingeral-cards, o card fica vertical (ícone em cima, valor embaixo) */
.fingeral-cards .summary-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 16px 14px 18px;
    gap: 8px;
}

/* Ícone menor e sem destaque exagerado */
.fingeral-cards .card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Label (h3) do card: mais compacto */
.fingeral-cards .card-info h3 {
    font-size: 0.68rem;
    margin-bottom: 2px;
}

/* Valor principal: tamanho fixo legível, sem truncar */
.fingeral-cards .card-info p {
    font-size: 1.15rem !important;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    letter-spacing: -0.03em;
}

/* Subtexto */
.fingeral-cards .card-info small {
    font-size: 0.72rem;
    margin-top: 2px;
}

/* ============================================================
   RESPONSIVO
   ============================================================ */
@media (max-width: 640px) {
    /* Date range → empilha em coluna no mobile */
    .fluxo-dr-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .fluxo-dr-dates {
        flex-wrap: wrap;
    }
    .fluxo-dr-field input[type='date'] {
        width: 100%;
    }
    .fluxo-dr-btns {
        justify-content: stretch;
    }
    .fluxo-quick-btn {
        flex: 1;
        text-align: center;
        min-width: 70px;
    }

    /* Tabelas Financeiro Geral → card style */
    #tabela-fg-caixa thead,
    #tabela-fg-boletos thead {
        display: none !important;
    }

    #tabela-fg-caixa tbody tr,
    #tabela-fg-boletos tbody tr {
        display: flex;
        flex-wrap: wrap;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 10px;
        margin-bottom: 8px;
        padding: 10px 12px;
        gap: 4px;
        align-items: center;
    }
    #tabela-fg-caixa tbody td,
    #tabela-fg-boletos tbody td {
        display: inline-block;
        padding: 2px 4px;
        border: none;
    }

    #tabela-fg-caixa tbody td:nth-child(1),
    #tabela-fg-boletos tbody td:nth-child(1) {
        width: 100%;
        font-size: 0.75rem;
        color: var(--text-light);
    }
    #tabela-fg-caixa tbody td:nth-child(2),
    #tabela-fg-boletos tbody td:nth-child(2) {
        font-weight: 600;
        font-size: 0.9rem;
        flex: 1;
    }
    #tabela-fg-caixa tbody td:nth-child(4),
    #tabela-fg-boletos tbody td:nth-child(4) {
        font-weight: 800;
        font-size: 1rem;
        margin-left: auto;
    }

    /* Financeiro Geral — header actions ícone só */
    #view-fin-geral .fluxo-header-actions .btn span {
        display: none;
    }
}

/* ============================================================
   FINANCEIRO GERAL — BARRA DE COMPROMETIMENTO
   ============================================================ */
.fg-progress-track {
    width: 100%;
    height: 10px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}
.fg-progress-bar {
    height: 100%;
    border-radius: 99px;
    transition:
        width 0.6s cubic-bezier(0.4, 0, 0.2, 1),
        background 0.3s;
}

/* ============================================================
   FINANCEIRO GERAL — LINHA DO TEMPO
   ============================================================ */
.fg-tl-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 10px 6px;
    border-radius: 6px;
    margin-bottom: 2px;
    margin-top: 6px;
    color: #fff;
}
.fg-tl-group-header:first-child {
    margin-top: 0;
}

.fg-tl-header-vencido {
    background: rgba(239, 68, 68, 0.85);
}
.fg-tl-header-hoje {
    background: rgba(245, 158, 11, 0.85);
}
.fg-tl-header-semana {
    background: rgba(234, 179, 8, 0.78);
    color: #1a1a1a;
}
.fg-tl-header-mes {
    background: rgba(59, 130, 246, 0.7);
}

.fg-tl-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    transition: background 0.15s;
}
.fg-tl-item:last-child {
    border-bottom: none;
}
.fg-tl-item:hover {
    background: var(--bg-body);
    border-radius: 6px;
}

/* ============================================================
   FINANCEIRO GERAL — BADGES DE URGÊNCIA NA TABELA
   ============================================================ */
.urg-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}
.urg-vencido {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.urg-hoje {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.urg-semana {
    background: rgba(234, 179, 8, 0.12);
    color: #b45309;
    border: 1px solid rgba(234, 179, 8, 0.3);
}
.urg-normal {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-light);
    border: 1px solid var(--border);
}

/* Botão de filtro ativo */
.fg-filter-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ============================================================
   RESPONSIVO — Financeiro Geral
   ============================================================ */
@media (max-width: 640px) {
    .fg-tl-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .fg-tl-item > div:last-child {
        align-self: flex-end;
    }
}

/* ============================================================
   FINANCEIRO GERAL — COMPARATIVO MÊS ANTERIOR (deltas)
   ============================================================ */
.fg-delta {
    display: block;
    margin-top: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.3;
}
.fg-delta-up {
    color: #22c55e;
}
.fg-delta-down {
    color: #ef4444;
}
.fg-delta-neutro {
    color: var(--text-light);
    font-weight: 400;
}

/* ============================================================
   FINANCEIRO GERAL — FILTRO DE CATEGORIA (select inline)
   ============================================================ */
.fg-cat-select {
    height: 30px;
    padding: 0 8px;
    font-size: 0.78rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    max-width: 180px;
    transition: border-color 0.15s;
}
.fg-cat-select:focus {
    outline: none;
    border-color: var(--primary);
}
.fg-cat-separator {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 2px;
}

/* ============================================================
   RESPONSIVO — deltas e select
   ============================================================ */
@media (max-width: 640px) {
    .fg-cat-select {
        max-width: 100%;
    }
    .fg-cat-separator {
        display: none;
    }
}

/* ============================================================
   FINANCEIRO GERAL — RESUMO POR CATEGORIA
   ============================================================ */
.fg-cat-row {
    display: grid;
    grid-template-columns: 1fr 1.4fr auto;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}
.fg-cat-row:last-child {
    border-bottom: none;
}

.fg-cat-row-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.fg-cat-name {
    font-size: 0.85rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fg-cat-meta {
    font-size: 0.72rem;
    color: var(--text-light);
}
.fg-cat-row-bar-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
.fg-cat-bar-track {
    flex: 1;
    height: 7px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}
.fg-cat-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 99px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.fg-cat-pct {
    font-size: 0.72rem;
    color: var(--text-light);
    width: 28px;
    text-align: right;
    flex-shrink: 0;
}
.fg-cat-valor {
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
    text-align: right;
}

/* ============================================================
   FINANCEIRO GERAL — BOTÃO BAIXA INLINE
   ============================================================ */
.fg-btn-baixa {
    opacity: 0.65;
    transition:
        opacity 0.15s,
        color 0.15s;
    color: var(--success);
}
.fg-btn-baixa:hover {
    opacity: 1;
}

/* ============================================================
   RESPONSIVO — resumo cat
   ============================================================ */
@media (max-width: 640px) {
    .fg-cat-row {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
    }
    .fg-cat-row-bar-wrap {
        grid-column: 1 / -1;
    }
}

/* ============================================================
   FORMULÁRIO BOLETO — Botão "Já está Pago"
   ============================================================ */
.btn-pago-confirm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ============================================================
   FLUXO — GRID DE FORMAS (Corrigido para 3 colunas)
   ============================================================ */
.fluxo-formas-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    align-items: start;
    margin-bottom: 4px;
}

.fluxo-forma-grupo {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}

/* Garante que a retirada escondida não empurre o layout */
.retirada-oculta {
    display: none !important;
}

/* (duplicado removido: .fluxo-forma-grupo) */
.fluxo-forma-grupo:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}
.fluxo-forma-titulo {
    display: flex; /* Alinha o ícone e o texto na mesma linha */
    align-items: center; /* Centraliza verticalmente o ícone com o texto */
    gap: 8px; /* Espaço entre o ícone e o texto */
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.01em;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.fluxo-forma-linha {
    display: flex;
    align-items: center;
    gap: 8px;
}
.fluxo-forma-linha label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    width: 88px;
    flex-shrink: 0;
    white-space: nowrap;
}
.fluxo-forma-linha input {
    flex: 1;
    min-width: 0;
    height: 34px;
    padding: 0 10px;
    font-size: 0.88rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-card);
    color: var(--text-primary);
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.fluxo-forma-linha input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* Em telas médias (Tablets), divide em 2 colunas */
@media (max-width: 1024px) {
    .fluxo-formas-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Em telas pequenas (Celulares), fica 1 abaixo do outro */
@media (max-width: 640px) {
    .fluxo-formas-grid {
        grid-template-columns: 1fr;
    }
}
/* ============================================================
   FLUXO — PILLS DE TIPO (Entrada / Saída)
   ============================================================ */
.fluxo-tipo-toggle {
    display: flex;
    gap: 6px;
}
.fluxo-tipo-pill {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 6px 16px;
    border-radius: 99px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid var(--border);
    background: var(--bg-body);
    color: var(--text-light);
    transition:
        background 0.15s,
        color 0.15s,
        border-color 0.15s;
    user-select: none;
    min-height: 36px;
}
/* Radio nativo oculto */
.fluxo-tipo-pill input[type='radio'] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
/* Estado ativo via JS (.active) */
.fluxo-tipo-entrada.active {
    background: rgba(16, 185, 129, 0.12);
    border-color: var(--success);
    color: var(--success);
}
.fluxo-tipo-saida.active {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}
/* Fallback CSS puro via :has (progressivo) */
.fluxo-tipo-entrada:has(input:checked) {
    background: rgba(16, 185, 129, 0.12);
    border-color: var(--success);
    color: var(--success);
}
.fluxo-tipo-saida:has(input:checked) {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}
@media (max-width: 640px) {
    .fluxo-tipo-pill {
        flex: 1;
        justify-content: center;
    }
}

/* ============================================================
   EXTRATO — BADGES DE TIPO COLORIDOS
   ============================================================ */
.category-badge.badge-entrada {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.25);
}
.category-badge.badge-saida {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ============================================================
   FLUXO — CARD RETIRADA (variante do grupo padrão)
   ============================================================ */
.fluxo-formas-grid {
    /* 4 colunas quando há espaço, senão auto-fill */
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}
.fluxo-forma-grupo-retirada {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.03);
}
.fluxo-forma-grupo-retirada .fluxo-forma-titulo {
    color: var(--danger);
    border-bottom-color: rgba(239, 68, 68, 0.2);
}
.fluxo-forma-grupo-retirada:focus-within {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* ============================================================
   EXTRATO — TFOOT DE SALDO
   ============================================================ */
#tabela-fluxo tfoot tr:first-child td {
    border-top: 2px solid var(--border);
}
#tabela-fluxo tfoot {
    font-weight: 700;
}
.extrato-tfoot-saldo {
    font-size: 1rem;
    letter-spacing: -0.01em;
}

/* ============================================================
   FLUXO — ANIMAÇÃO DO CARD RETIRADA
   ============================================================ */
.fluxo-forma-grupo-retirada {
    overflow: hidden;
    max-height: 200px;
    opacity: 1;
    transition:
        max-height 0.28s ease,
        opacity 0.2s ease,
        margin 0.25s ease;
}
.fluxo-forma-grupo-retirada.retirada-oculta {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
    /* Remove do flow sem quebrar o grid */
    pointer-events: none;
}

/* ============================================================
   FLUXO — DETALHE DE ENTRADAS (spans em coluna)
   ============================================================ */
.detalhe-entradas-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
}
.detalhe-entradas-wrap span {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: var(--text-light);
    line-height: 1.4;
}
.det-icone {
    font-size: 0.75rem;
    line-height: 1;
}

/* ============================================================
   FLUXO — WRAPPER FORMULÁRIO + EXTRATO
   ============================================================ */
.fluxo-content-wrap {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 16px;
    align-items: flex-start;
}

/* ============================================================
   FINANCEIRO GERAL — AJUSTES DE FORMATAÇÃO
   ============================================================ */

/* 3. Card Saldo Projetado */
.card-projected {
    border: 1px dashed var(--primary) !important;
    background: var(--bg-body);
}
[data-theme='dark'] .card-projected {
    background: rgba(37, 99, 235, 0.06);
    border-color: rgba(99, 151, 255, 0.5) !important;
}

/* ============================================================
   FINANCEIRO GERAL — CORREÇÕES DE FORMATAÇÃO
   ============================================================ */

/* 4. fg-delta vazio não ocupa espaço */
.fg-delta:empty,
.fg-delta.fg-delta-hidden {
    display: none;
    margin: 0;
}

/* 5. fg-detalhe-formas — spans em coluna, sem overflow */
#fg-detalhe-formas {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 3px;
}
#fg-detalhe-formas span {
    font-size: 0.72rem;
    color: var(--text-light);
    white-space: nowrap;
}

/* 6. Barra de comprometimento — animação de entrada/saída */
#fg-comprometimento-wrap {
    overflow: hidden;
    max-height: 200px;
    opacity: 1;
    transition:
        max-height 0.3s ease,
        opacity 0.22s ease,
        margin-bottom 0.25s ease,
        padding 0.25s ease;
}
#fg-comprometimento-wrap.fg-oculto {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
}

/* ============================================================
   FINANCEIRO GERAL — ESPAÇAMENTO E GRÁFICO
   ============================================================ */
.fg-comprometimento-card,
.fg-resumo-cat-card {
    margin-bottom: 16px;
}

/* Garante mínimo para o gráfico em mobile */
#fg-chart-semanas {
    min-height: 220px;
}

/* ============================================================
   FINANCEIRO GERAL — CORREÇÕES TABELA E FILTROS
   ============================================================ */

/* 10. Oculta coluna Urgência em desktop (redundante com Status) */
@media (min-width: 1024px) {
    .col-urgencia {
        display: none;
    }
}

/* 11. Alinha altura de fg-filter-btn com fg-cat-select */
.fg-filter-btn {
    height: 32px;
    padding: 0 12px;
    line-height: 32px;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition:
        background 0.15s,
        color 0.15s,
        border-color 0.15s;
    white-space: nowrap;
}
.fg-filter-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.fg-cat-select {
    height: 32px;
}

/* ============================================================
   FINANCEIRO GERAL — CARD MAIOR DESPESA + LINHAS DE LAYOUT
   ============================================================ */

/* 13. Nome da maior despesa — respeita o container */
.fg-maior-nome {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 14. Linhas de layout com espaçamento consistente */
.fg-section-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* ============================================================
   SIDEBAR — ADAPTATIVA POR ALTURA DE TELA
   ============================================================ */

/* Telas de altura média (laptops ~768px) */
@media (max-height: 800px) {
    .sidebar-brand {
        padding: 12px 20px;
    }
    .sidebar-brand h2 {
        font-size: 1.2rem;
    }
    .sidebar-user {
        padding: 8px 16px;
    }
    .avatar-circle {
        width: 30px;
        height: 30px;
        font-size: 0.95rem;
    }
    .sidebar-menu {
        padding: 6px 10px;
        gap: 1px;
    }
    .sidebar-footer {
        padding: 6px 10px;
    }
    .menu-item {
        padding: 7px 10px;
        margin: 1px 6px;
        font-size: 0.88rem;
    }
    .menu-item svg {
        width: 17px;
        height: 17px;
    }
    .menu-label {
        margin: 7px 0 3px 10px;
        font-size: 0.65rem;
    }
    #seletor-unidade-wrapper {
        padding: 6px 10px;
    }
}

/* Telas muito baixas (~600px, ex: monitores antigos ou landscape mobile) */
@media (max-height: 620px) {
    .sidebar-brand {
        display: none;
    } /* oculta logo para ganhar espaço */
    .sidebar-user {
        padding: 6px 14px;
    }
    .menu-item {
        padding: 6px 10px;
        font-size: 0.84rem;
    }
    .menu-label {
        display: none;
    } /* oculta separadores de seção */
}

/* ============================================================
   SIDEBAR — SELETOR DE UNIDADE SEMPRE VISÍVEL
   ============================================================ */

/* Garante que o seletor apareça independente do JS */
/* Seletor de unidade: visível por padrão, JS oculta se só 1 unidade */
#seletor-unidade-wrapper {
    display: block;
}

/* Se o dropdown não tiver unidades ainda, mostra estado vazio elegante */
#seletor-unidade-wrapper .dropdown-toggle {
    font-size: 0.85rem;
}

/* Empurra o footer para a base sem deixar espaço vazio no meio */
.sidebar-footer {
    margin-top: auto;
}

/* ============================================================
   LAYOUT GERAL — CLASSES REUTILIZÁVEIS (extraídas do inline)
   ============================================================ */

/* Wrapper de duas colunas — substitui display:flex;gap:20px;flex-wrap:wrap inline */
.two-col-wrap {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-start;
}

/* ============================================================
   BREAKPOINT INTERMEDIÁRIO — 768px (tablet portrait)
   ============================================================ */
@media (max-width: 768px) {
    /* Content: padding menor */
    .content {
        padding: 16px;
    }

    /* Header flex: empilha em coluna */
    .header-flex {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }

    /* Dashboard cards: 2 colunas */
    .dashboard-cards {
        margin-bottom: 30px !important;
    }

    /* Wrappers de duas colunas: empilha */
    .two-col-wrap,
    .fluxo-content-wrap,
    .fg-section-row {
        flex-direction: column;
        gap: 12px;
    }

    /* Cards filhos de wrappers: largura total */
    .two-col-wrap > .card,
    .fluxo-content-wrap > .card,
    .fg-section-row > .card {
        min-width: unset !important;
        width: 100%;
    }

    /* Fingeral cards: 2 colunas */
    .fingeral-cards {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    /* No mobile, cards fingeral voltam ao layout horizontal padrão */
    .fingeral-cards .summary-card {
        flex-direction: row;
        align-items: center;
        padding: 12px 14px 12px 16px;
    }
    .fingeral-cards .card-info p {
        font-size: 1.05rem !important;
    }

    /* Formulário de fluxo */
    .fluxo-formas-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Data range bar: linha por linha */
    .fluxo-dr-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .fluxo-dr-dates {
        flex-wrap: wrap;
    }
    .fluxo-dr-field input[type='date'] {
        width: 100%;
    }
    .fluxo-dr-btns {
        justify-content: stretch;
    }
    .fluxo-quick-btn {
        flex: 1;
    }
}

/* Card filho de wrapper de duas colunas */
.two-col-card {
    flex: 1;
    min-width: 300px;
}
@media (max-width: 768px) {
    .two-col-card {
        min-width: unset;
        width: 100%;
        flex: none;
    }
}

/* ============================================================
   DRE / ORÇAMENTO — Estilos do Módulo
   Adicione ao final do seu style.css
   ============================================================ */

/* ── Scroll wrapper da tabela ─────────────────────────────── */
.dre-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
    border: 1px solid var(--border);
}

/* ── Tabela principal ─────────────────────────────────────── */
.dre-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    white-space: nowrap;
    min-width: 1100px;
}

.dre-table thead tr:first-child th {
    background: var(--bg-card);
    color: var(--text-light);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 10px 6px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 2;
}

.dre-table .dre-subheader th {
    background: var(--bg-body);
    color: var(--text-light);
    font-size: 0.68rem;
    padding: 4px 5px;
    text-align: right;
    border-bottom: 2px solid var(--border);
}

.dre-table .dre-sub.plan {
    color: var(--primary);
}
.dre-table .dre-sub.real {
    color: var(--text-main);
}

/* Coluna de categoria */
.dre-col-cat {
    min-width: 150px;
    max-width: 180px;
    text-align: left !important;
    padding-left: 16px !important;
    position: sticky;
    left: 0;
    background: var(--bg-card);
    z-index: 3;
    border-right: 2px solid var(--border);
}

.dre-col-cat-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    font-weight: 500;
    position: sticky;
    left: 0;
    background: inherit;
    z-index: 1;
    border-right: 1px solid var(--border);
}

.dre-cat-icon {
    font-size: 0.95rem;
}

/* Colunas de meses e total */
.dre-col-mes {
    min-width: 110px;
    text-align: center !important;
}
.dre-col-total {
    min-width: 120px;
}

/* Células de valor */
.dre-cel-plan,
.dre-cel-real {
    padding: 9px 8px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
    font-size: 0.76rem;
}

.dre-cel-plan {
    color: var(--text-light);
}
.dre-cel-real {
    color: var(--text-main);
    font-weight: 500;
}

.dre-total-col {
    font-weight: 700;
    background: rgba(var(--primary-rgb, 37, 99, 235), 0.04);
}

/* Adaptação da Tabela DRE para telas menores */
.dre-table th,
.dre-table td {
    padding: 6px 8px;
    font-size: 0.7rem;
}
.dre-col-cat,
.dre-col-cat-label {
    min-width: 120px !important;
    max-width: 120px !important;
    padding-left: 8px !important;
}
.dre-sub {
    font-size: 0.6rem; /* Compacta os cabeçalhos de Orç./Real. */
}

/* ── Status de células (Orçamento vs Realizado) ─────────────  */
.dre-status-ok {
    color: var(--success) !important;
}
.dre-status-warn {
    color: var(--danger) !important;
    background: rgba(239, 68, 68, 0.06);
}

/* ── Linhas de totalizadores ─────────────────────────────── */
.dre-row-total td {
    background: var(--bg-body) !important;
    font-weight: 700 !important;
    border-top: 2px solid var(--border) !important;
    border-bottom: 2px solid var(--border) !important;
    font-size: 0.8rem !important;
}

.dre-row-resultado td {
    background: rgba(var(--primary-rgb, 37, 99, 235), 0.07) !important;
    font-weight: 700 !important;
    border-top: 2px solid var(--primary) !important;
    font-size: 0.8rem !important;
}

/* ── Positivo/Negativo ───────────────────────────────────── */
.dre-positivo {
    color: var(--success) !important;
}
.dre-negativo {
    color: var(--danger) !important;
}
.dre-zero {
    color: var(--text-light);
    opacity: 0.5;
    font-size: 0.9em;
}

/* ── Hover nas linhas ────────────────────────────────────── */
.dre-table tbody tr:hover td {
    background: rgba(var(--primary-rgb, 37, 99, 235), 0.04);
}
.dre-table tbody tr:hover .dre-col-cat-label {
    background: rgba(var(--primary-rgb, 37, 99, 235), 0.06);
}

/* ── Barra superior da tabela ────────────────────────────── */
.dre-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.dre-legenda {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--text-light);
}

.dre-leg-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dre-badge {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.dre-badge-plan {
    background: var(--primary);
    opacity: 0.4;
}
.dre-badge-real {
    background: var(--text-main);
    opacity: 0.6;
}
.dre-badge-ok {
    background: var(--success);
}
.dre-badge-warn {
    background: var(--danger);
}

/* ── Skeleton de carregamento ────────────────────────────── */
.dre-skeleton {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 0;
}

.dre-skel-row {
    display: flex;
    gap: 4px;
    height: 32px;
    opacity: 0.7;
    animation: dre-pulse 1.4s ease-in-out infinite;
}

.dre-skel-cat {
    min-width: 150px;
    background: var(--border);
    border-radius: 6px;
    flex-shrink: 0;
}

.dre-skel-cel {
    flex: 1;
    background: var(--border);
    border-radius: 4px;
    min-width: 40px;
    opacity: 0.5;
}

@keyframes dre-pulse {
    0%,
    100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* ── Estado vazio / erro ─────────────────────────────────── */
.dre-empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-light);
}
.dre-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}
.dre-loading {
    padding: 32px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ── Cards de resumo anual ───────────────────────────────── */
.dre-summary-cards {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
}

/* ══════════════════════════════════════════════════════════
   ORÇAMENTO — Grid de edição de metas
   ══════════════════════════════════════════════════════════ */

.orc-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 16px 0;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.orc-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
    font-size: 0.82rem;
}

.orc-table thead th {
    background: var(--bg-body);
    padding: 10px 8px;
    text-align: center;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-light);
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
}

.orc-table thead th:first-child {
    text-align: left;
    padding-left: 16px;
    min-width: 130px;
}

.orc-table tbody td {
    padding: 6px 5px;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.orc-cat-label {
    text-align: left !important;
    padding-left: 16px !important;
    font-weight: 600;
    color: var(--text-main);
    position: sticky;
    left: 0;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
}

.orc-input {
    width: 80px;
    padding: 5px 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-body);
    color: var(--text-main);
    text-align: right;
    font-size: 0.78rem;
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}
.orc-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}
.orc-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.orc-grid-info {
    padding: 0 4px 8px;
    font-size: 0.82rem;
    color: var(--text-light);
    line-height: 1.6;
}
.orc-info-tip {
    background: rgba(37, 99, 235, 0.07);
    padding: 8px 12px;
    border-radius: 8px;
    border-left: 3px solid var(--primary);
    margin-top: 6px;
    color: var(--text-main);
}

.orc-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 4px 4px;
    flex-wrap: wrap;
}

.orc-status {
    font-size: 0.8rem;
    color: var(--warning, #f59e0b);
    margin-right: auto;
}

/* ══════════════════════════════════════════════════════════
   RECORRÊNCIAS — Tabela de regras
   ══════════════════════════════════════════════════════════ */

.badge-cat {
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-tipo {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-despesa {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-receita {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.rec-inativa td {
    opacity: 0.45;
    text-decoration: line-through;
}

.rec-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

.dre-empty-msg {
    padding: 32px;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* ── Drill-down modal ────────────────────────────────────── */
.dre-cel-drillable {
    text-decoration: underline dotted;
    text-underline-offset: 3px;
    cursor: pointer;
}
.dre-cel-drillable:hover {
    background: rgba(var(--primary-rgb, 37, 99, 235), 0.08) !important;
}

.dre-drill-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(2px);
}
.dre-drill-overlay.hidden {
    display: none;
}

.dre-drill-box {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 760px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dre-drill-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.dre-drill-head h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.dre-drill-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-light);
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
}
.dre-drill-close:hover {
    background: var(--border);
    color: var(--text-main);
}

.dre-drill-body {
    overflow-y: auto;
    padding: 16px 20px;
    flex: 1;
}

.dre-drill-table-wrap {
    overflow-x: auto;
}

.dre-drill-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.dre-drill-table th {
    text-align: left;
    padding: 8px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border);
    background: var(--bg-body);
}
.dre-drill-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.dre-drill-table tbody tr:hover td {
    background: rgba(var(--primary-rgb, 37, 99, 235), 0.04);
}
.dre-drill-table tfoot td {
    padding: 10px;
    border-top: 2px solid var(--border);
    border-bottom: none;
    background: rgba(var(--primary-rgb, 37, 99, 235), 0.03);
}

/* ── Linhas subtotais calculadas ────────────────────────── */
.dre-row-subtotal td {
    background: rgba(var(--primary-rgb, 37, 99, 235), 0.035);
    font-weight: 600;
    font-size: 0.88rem;
    border-top: 1px solid var(--border);
}
.dre-row-subtotal .dre-col-cat-label {
    padding-left: 12px;
}

.dre-calc-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-light);
    background: var(--border);
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: 6px;
    vertical-align: middle;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* ── Regime badge na legenda ────────────────────────────── */
.dre-leg-regime {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-light);
    font-style: italic;
}

/* ── Chart card ─────────────────────────────────────────── */
.dre-card-chart {
    overflow: hidden;
}

/* ── Responsivo mobile ───────────────────────────────────── */
@media (max-width: 640px) {
    .dre-header-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    .dre-legenda {
        gap: 8px;
    }
    .orc-input {
        width: 64px;
        font-size: 0.7rem;
        padding: 4px;
    }
    .dre-leg-regime {
        margin-left: 0;
    }
    .dre-drill-box {
        max-height: 90vh;
    }
}
/* ==========================================================================
   MÓDULO: CONFIGURAÇÕES CONTEXTUAIS (DROPDOWN)
   ========================================================================== */
.module-settings-wrapper {
    position: relative;
    display: inline-block;
}

.btn-icon-settings {
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon-settings:hover {
    background: var(--bg-body);
    color: var(--primary);
    transform: rotate(30deg); /* Pequeno efeito visual */
}

.module-settings-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 5px);
    width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.module-settings-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    color: var(--text-main);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
    transition: background 0.2s;
}

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

.module-settings-dropdown .dropdown-item:hover {
    background: rgba(37, 99, 235, 0.05);
    color: var(--primary);
}

.module-settings-dropdown .dropdown-item i {
    width: 16px;
    height: 16px;
}

/* O card ocupa 2 colunas e usa as cores padrão dos seus cards */
.prefeitura-card {
    grid-column: span 2;
}
/* Aumenta o espaço do texto para que os nomes longos não quebrem a linha */
.prefeitura-card .fluxo-forma-linha label {
    width: 280px !important; /* Ajuste a largura conforme necessário */
    display: flex; /* Permite alinhar o texto e o span interno */
    align-items: center; 
    gap: 6px;
    white-space: nowrap;
}

/* Mantém as cores que você já definiu */
.badge-nao-conta {
    color: #e67e22;
}

.badge-entrada {
    color: #2ecc71;
}

/* Espaçamento dentro do card */
.prefeitura-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 15px; /* Espaço entre a linha de cima e a linha de baixo */
    padding: 15px;
    height: 100%;
}

/* A MÁGICA: Coloca o texto na esquerda e o input na direita, na MESMA linha */
.prefeitura-linha {
    display: flex;
    align-items: center; /* Centraliza na vertical */
    justify-content: space-between; /* Empurra o texto pra esquerda e input pra direita */
    width: 100%;
    gap: 15px;
}

/* Estilo do texto à esquerda */
.prefeitura-label {
    display: flex;
    flex-direction: column; /* Coloca o aviso embaixo do título */
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    flex: 1; /* Permite que o texto ocupe o espaço necessário */
}

/* Textos coloridos embaixo do título */
.badge-nao-conta {
    color: #e67e22; /* Laranja */
    font-size: 0.75rem;
    font-weight: 400;
}

.badge-entrada {
    color: #2ecc71; /* Verde */
    font-size: 0.75rem;
    font-weight: 400;
}

/* FORMATANDO O INPUT E O R$ LADO A LADO */
.input-group-custom {
    display: flex;
    align-items: stretch;
    width: 180px; /* Define uma largura fixa pro input não ficar esticado demais */
}

.input-group-text-custom {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.7rem;
    font-size: 0.95rem;
    color: #495057;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-right: none;
    border-radius: 4px 0 0 4px;
    white-space: nowrap;
}

.input-group-custom .form-control {
    flex: 1;
    border: 1px solid #ced4da;
    border-radius: 0 4px 4px 0;
    padding: 0.4rem;
    margin: 0;
    font-size: 0.95rem;
}

/* Responsividade: No celular a tela é pequena, então volta a ficar um embaixo do outro */
@media (max-width: 768px) {
    .prefeitura-card {
        grid-column: span 1;
    }
    .prefeitura-linha {
        flex-direction: column; /* Quebra a linha no celular */
        align-items: flex-start;
        gap: 5px;
    }
    .input-group-custom {
        width: 100%; /* No celular o input usa a largura toda */
    }
}
/* Remove as setinhas dos campos de número da prefeitura */
.prefeitura-linha input[type='number']::-webkit-outer-spin-button,
.prefeitura-linha input[type='number']::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
/* ==========================================================================
   CABEÇALHO DO CALENDÁRIO (TOGGLE)
   ========================================================================== */
.toggle-header {
    display: flex;
    justify-content: space-between; /* Empurra a seta para a direita */
    align-items: center; /* Alinha tudo no meio verticalmente */
    padding: 20px 24px; /* Adiciona o respiro interno padrão dos cards */
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    cursor: pointer; /* Faz a "mãozinha" aparecer na barra toda */
    transition: background-color 0.2s ease;
    user-select: none; /* Evita selecionar o texto sem querer ao clicar */
}

/* Efeito de hover ao passar o mouse na barra */
.toggle-header:hover {
    background-color: var(--bg-body);
}

/* Padronização do ícone da setinha */
.toggle-header .arrow-icon {
    font-size: 0.85rem;
    color: var(--text-light);
    transition: transform 0.3s ease;
    display: inline-block;
}

/* Padronização da cor do ícone do calendário para acompanhar o texto */
.toggle-header i {
    color: var(--primary);
}

/* ==========================================================================
   MÓDULO: RH E SALÁRIOS (INTEGRAÇÃO)
   ========================================================================== */

/* Abas de Navegação do RH */
.rh-tabs-container {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--border);
    flex-wrap: wrap;
}

.rh-tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--text-light);
    cursor: pointer;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
}

.rh-tab-btn:hover {
    color: var(--primary);
    background: var(--bg-body);
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.rh-tab-btn.active {
    font-weight: 700;
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Tabelas do RH (Padronização) */
.rh-table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.rh-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    min-width: 800px;
}

.rh-table th {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    background-color: var(--bg-body);
    color: var(--text-light);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.rh-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.rh-table tbody tr:hover td {
    background-color: var(--primary-soft);
}

/* Cards de Funcionários e Ocorrências */
.rh-grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.rh-card-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.rh-card-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-bi);
}

.rh-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.rh-card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
}

.rh-card-subtitle {
    color: var(--text-light);
    font-size: 0.85rem;
    margin: 4px 0 12px 0;
}