/* Estilos gerais */
:root {
    /* Paleta principal */
    --color-bg: #0f1430;
    --color-bg-alt: #12183b;
    --color-surface: #ffffff;
    --color-surface-alt: #fbfcff;
    --color-border: #e3e7ef;
    --color-muted: #6b7280;
    --color-text: #1f2937;

    /* Tokens de texto (tema CLARO). dark-mode.css sobrescreve em html[data-theme="dark"].
       Mesmos NOMES nos dois temas => regras de cor podem usar var(--text-strong)
       sem depender do tema. --text-strong = títulos/valores; --text = corpo; --text-soft = labels/muted. */
    --text-strong: #1e293b;   /* slate-800: títulos de página e de card sem fundo colorido */
    --text:        #334155;   /* slate-700: corpo */
    --text-soft:   #64748b;   /* slate-500: muted/labels */

    /* Primária (azul/violeta tecnológica) */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #667eea;
    /* base atual */
    --primary-600: #5866d9;
    --primary-700: #4e5dd1;
    --primary-800: #3f51c6;
    --primary-900: #2f3aa6;

    /* Estados */
    --success: #1fbd6c;
    --danger: #f2545b;
    --warning: #ffb020;
    --info: #17a2b8;

    /* Radius e sombras */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --shadow-sm: 0 2px 6px rgba(16, 24, 40, 0.06);
    --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.10);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.16);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--color-surface-alt);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Links padrão */
a {
    color: var(--primary-700);
    text-decoration: none;
}

a:hover {
    color: var(--primary-600);
    text-decoration: underline;
}

/* Títulos consistentes.
   Default = texto FORTE (escuro no claro / claro no escuro via token).
   Contextos com fundo colorido (card-header.bg-*, modern-panel-header,
   modal-header, sidebar) definem branco EXPLICITAMENTE — não dependem deste
   default. Antes era `#ffffff !important`, o que tornava todo título de página
   "solto" (ex.: <h2> em /admin/vouchers-page) invisível no tema claro. */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-strong) !important;
    margin: 0 0 8px 0;
    font-weight: 700;
}

/* Títulos SOBRE superfície de cor forte permanecem CLAROS.
   Cobre (a) cards com `.text-white` (cards-resumo de relatórios com gradiente
   inline), (b) fundos `.bg-*` escuros, e (c) containers com cor de texto branca
   declarada inline (`style="...color:#fff/white..."` — modais de conciliação,
   tiles do dashboard, header de saldos etc.). Todos antes dependiam do default
   branco e ficariam escuro-no-escuro após a mudança acima. bg-warning fica de
   fora (amarelo claro pede texto escuro). Vale nos dois temas. */
.text-white :is(h1, h2, h3, h4, h5, h6),
.text-bg-primary :is(h1, h2, h3, h4, h5, h6),
.text-bg-dark :is(h1, h2, h3, h4, h5, h6),
.bg-primary :is(h1, h2, h3, h4, h5, h6),
.bg-secondary :is(h1, h2, h3, h4, h5, h6),
.bg-success :is(h1, h2, h3, h4, h5, h6),
.bg-danger :is(h1, h2, h3, h4, h5, h6),
.bg-info :is(h1, h2, h3, h4, h5, h6),
.bg-dark :is(h1, h2, h3, h4, h5, h6),
[style*="color:#fff"] :is(h1, h2, h3, h4, h5, h6),
[style*="color: #fff"] :is(h1, h2, h3, h4, h5, h6),
[style*="color:white"] :is(h1, h2, h3, h4, h5, h6),
[style*="color: white"] :is(h1, h2, h3, h4, h5, h6) {
    color: #ffffff !important;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

/* Header Moderno */
.modern-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    height: 85px;
}

.header-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 1px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 85px;
    min-width: 100%;
    flex-wrap: nowrap;
    overflow: visible;
    gap: 10px;
}

/* Logo */
.header-logo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    margin-right: 0;
    height: 70px;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: white;
    transition: all 0.3s ease;
    gap: 6px;
    height: 70px;
}

.logo-link:hover {
    color: #f8f9fa;
    text-decoration: none;
    transform: translateY(-2px);
}

.logo-icon {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.logo-link:hover .logo-icon {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.logo-icon i {
    font-size: 20px;
    color: white;
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.logo-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.2px;
    margin: 0;
}

.logo-subtitle {
    font-size: 10px;
    opacity: 0.9;
    font-weight: 400;
    letter-spacing: 0.1px;
    margin: 0;
}

/* Informações da Empresa */
.header-company {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 300px;
    max-width: 700px;
    margin: 0 6px;
    height: 70px;
}

.company-card {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    width: 100%;
    min-width: 400px;
    max-width: 100%;
    height: 65px;
}

.company-card:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.company-icon {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.company-card:hover .company-icon {
    background: rgba(255, 255, 255, 0.3);
}

.company-icon i {
    font-size: 20px;
    color: white;
}

.company-info {
    flex: 1;
    min-width: 150px;
    overflow: hidden;
}

.company-name {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
    max-width: 100%;
    display: block;
    line-height: 1.3;
    letter-spacing: 0.2px;
}

.company-details {
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
    margin: 0;
    align-items: center;
    overflow: hidden;
}

.company-type {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 8px;
    border-radius: 4px;
    color: white;
    white-space: nowrap;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.company-card:hover .company-type {
    background: rgba(255, 255, 255, 0.3);
}

.company-doc {
    font-size: 11px;
    opacity: 0.9;
    color: rgba(255, 255, 255, 0.95);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.company-sector {
    font-size: 11px;
    opacity: 0.9;
    color: rgba(255, 255, 255, 0.95);
    white-space: nowrap;
}

.company-sector i {
    margin-right: 2px;
}

/* Informações do Usuário */
.header-user {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: auto;
    margin-left: 0;
    height: 55px;
}

.user-card {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    min-width: 170px;
    max-width: 240px;
    height: 40px;
}

.user-card:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.user-avatar {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.user-card:hover .user-avatar {
    background: rgba(255, 255, 255, 0.3);
}

.user-avatar i {
    font-size: 11px;
    color: white;
}

.user-info {
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 10px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
    margin: 0;
    letter-spacing: 0.2px;
}

.user-role {
    font-size: 8px;
    opacity: 0.9;
    color: rgba(255, 255, 255, 0.95);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.user-role i {
    margin-right: 2px;
}

/* Dropdown do Usuário */
.user-dropdown {
    position: relative;
}

.user-dropdown-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    min-width: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(15px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    padding: 0;
    font-size: 15px;
}

.user-dropdown-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.6s ease;
    opacity: 0;
}

.user-dropdown-btn:hover::before {
    opacity: 1;
    animation: shimmer 1.5s ease-in-out;
}

.user-dropdown-btn {
    /* will-change promove o botao a uma layer propria, evitando que
       transforms no hover causem reflow do header e tremor visual. */
    will-change: transform;
}

.user-dropdown-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.15));
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

.user-dropdown-btn:active {
    transform: translateY(0) scale(0.98);
    transition: all 0.1s ease;
}

.user-dropdown-btn i {
    font-size: 15px;
    transition: all 0.3s ease;
}

.user-dropdown-btn:hover i {
    transform: scale(1.1);
    color: #f8f9fa;
}

/* Dropdown Menu */
.dropdown-menu {
    background: white;
    border: none;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    margin-top: 8px;
    min-width: 200px;
}

.dropdown-header {
    padding: 8px 16px;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.dropdown-user-info {
    text-align: center;
}

.dropdown-user-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.dropdown-user-company {
    font-size: 11px;
    color: #666;
}

.dropdown-item {
    padding: 8px 16px;
    color: #333;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-item:hover {
    background: #f8f9fa;
    color: #667eea;
}

.dropdown-item i {
    width: 16px;
    text-align: center;
}

.dropdown-divider {
    margin: 4px 0;
    border-color: #e9ecef;
}

/* Ajustes para telas grandes */
@media (min-width: 1400px) {
    .header-container {
        max-width: 1800px;
        padding: 0 32px;
        height: 70px;
    }

    .all {
        margin-top: 70px;
        min-height: calc(100vh - 70px);
    }

    .menu {
        top: 70px;
        height: calc(100vh - 70px);
    }

    .conteudo {
        height: calc(100vh - 70px);
    }

    .menu-nav {
        padding-top: 20px;
    }

    .header-company {
        max-width: 700px;
        min-width: 450px;
    }

    .company-card {
        padding: 16px 24px;
        min-width: 400px;
    }

    .company-name {
        font-size: 16px;
    }

    .company-type,
    .company-doc,
    .company-sector {
        font-size: 12px;
    }

    .user-card {
        min-width: 220px;
        max-width: 280px;
        padding: 12px 18px;
    }

    .user-name {
        font-size: 15px;
    }

    .user-role {
        font-size: 12px;
    }
}

/* Responsividade */
@media (max-width: 1200px) {
    .modern-header {
        height: 70px;
    }

    .header-container {
        padding: 0 16px;
        max-width: 100%;
        height: 70px;
    }

    .all {
        margin-top: 70px;
        min-height: calc(100vh - 70px);
    }

    .menu {
        top: 70px;
        height: calc(100vh - 70px);
    }

    .menu-nav {
        padding-top: 70px;
    }

    .conteudo {
        height: calc(100vh - 70px);
    }

    .header-company {
        max-width: 550px;
        min-width: 300px;
    }

    .company-card {
        padding: 8px 12px;
        min-width: 280px;
    }

    .company-name {
        font-size: 11px;
    }

    .company-type,
    .company-doc,
    .company-sector {
        font-size: 8px;
    }

    .user-card {
        min-width: 160px;
        max-width: 220px;
        padding: 8px 10px;
    }

    .user-name {
        font-size: 11px;
    }

    .user-role {
        font-size: 8px;
    }
}

@media (max-width: 992px) {
    .modern-header {
        height: 70px;
    }

    .header-container {
        height: 70px;
        padding: 0 14px;
        flex-wrap: nowrap;
    }

    .all {
        margin-top: 70px;
        min-height: calc(100vh - 70px);
    }

    .menu {
        top: 70px;
        height: calc(100vh - 70px);
    }

    .menu-nav {
        padding-top: 70px;
    }

    .conteudo {
        height: calc(100vh - 70px);
    }

    .header-company {
        flex: 1 1 auto;
        max-width: 450px;
        min-width: 250px;
        margin: 0 6px;
    }

    .logo-title {
        font-size: 18px;
    }

    .logo-subtitle {
        font-size: 10px;
    }

    .company-card {
        padding: 10px 12px;
        min-width: 280px;
        justify-content: center;
    }

    .company-icon {
        width: 32px;
        height: 32px;
    }

    .company-icon i {
        font-size: 14px;
    }

    .company-name {
        font-size: 13px;
    }

    .user-card {
        min-width: 160px;
        max-width: 200px;
        padding: 6px 10px;
    }

    .user-name {
        font-size: 12px;
    }

    .user-role {
        font-size: 9px;
    }
}

@media (max-width: 768px) {
    .modern-header {
        height: 65px;
    }

    .header-container {
        flex-wrap: nowrap;
        height: 65px;
        padding: 0 12px;
        gap: 8px;
    }

    .all {
        margin-top: 65px;
        min-height: calc(100vh - 65px);
    }

    .menu {
        top: 65px;
        height: calc(100vh - 65px);
    }

    .menu-nav {
        padding-top: 60px;
    }

    .conteudo {
        height: calc(100vh - 65px);
    }

    .header-logo {
        flex: 0 0 auto;
        margin-right: 0;
        height: 65px;
    }

    .logo-link {
        height: 65px;
        gap: 6px;
    }

    .header-company {
        flex: 1 1 auto;
        max-width: 400px;
        min-width: 200px;
        margin: 0 4px;
        height: 65px;
    }

    .header-user {
        flex: 0 0 auto;
        gap: 6px;
        height: 65px;
    }

    .logo-icon {
        width: 36px;
        height: 36px;
    }

    .logo-icon i {
        font-size: 16px;
    }

    .logo-title {
        font-size: 12px;
    }

    .logo-subtitle {
        font-size: 8px;
    }

    .company-card {
        padding: 6px 10px;
        min-width: 180px;
        height: 50px;
    }

    .company-icon {
        width: 28px;
        height: 28px;
    }

    .company-icon i {
        font-size: 12px;
    }

    .company-name {
        font-size: 9px;
    }

    .company-details {
        gap: 2px;
    }

    .company-type,
    .company-doc {
        font-size: 7px;
        padding: 1px 4px;
    }

    .user-card {
        flex: 0 0 auto;
        min-width: 130px;
        max-width: 170px;
        padding: 6px 8px;
        height: 50px;
    }

    .user-avatar {
        width: 28px;
        height: 28px;
    }

    .user-avatar i {
        font-size: 12px;
    }

    .user-name {
        font-size: 9px;
    }

    .user-role {
        font-size: 7px;
    }

    .user-dropdown-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

@media (max-width: 576px) {
    .header-container {
        padding: 10px 12px;
    }

    .logo-icon {
        width: 40px;
        height: 40px;
    }

    .logo-icon i {
        font-size: 20px;
    }

    .logo-title {
        font-size: 16px;
    }

    .company-card {
        padding: 8px;
    }

    .company-icon {
        width: 28px;
        height: 28px;
        margin-right: 8px;
    }

    .company-name {
        font-size: 12px;
    }

    .user-card {
        padding: 6px 8px;
    }

    .user-avatar {
        width: 28px;
        height: 28px;
        margin-right: 6px;
    }

    .user-name {
        font-size: 11px;
    }
}

/* Menu lateral */
.all {
    display: flex;
    min-height: calc(100vh - 70px);
    margin-top: 70px;
}

.menu {
    width: 220px;
    background: linear-gradient(180deg, #1b233f 0%, #131a31 100%);
    color: white;
    transition: all 0.3s ease;
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
}

.menu-nav {
    padding: 15px 0;
    padding-top: 20px;
}

.menu-nav .nav-pills {
    border: none;
}

.menu-nav .nav-pills>li>a {
    color: #ecf0f1;
    border-radius: 0;
    padding: 12px 20px;
    margin: 3px 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.menu-nav .nav-pills>li>a:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #fff;
    transform: translateX(6px);
}

.menu-nav .nav-pills>li>a.active {
    background: linear-gradient(90deg, #5866d9, #818cf8);
    color: #fff;
    border-left: 4px solid #c7d2fe;
}

.link-menu {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    width: 100%;
}

.link-menu .icon {
    margin-right: 12px;
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.link-menu .aux-js {
    flex: 1;
    font-weight: 500;
}

/* Itens de menu bloqueados por plano */
.link-menu-locked {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.8);
}
.link-menu-locked:hover {
    color: inherit !important;
    background: transparent !important;
}
.link-menu-locked .lock-badge {
    font-size: 0.6rem;
    opacity: 0.7;
    margin-left: 4px;
}

/* Conteúdo principal */
.conteudo {
    flex: 1;
    padding: 20px;
    background-color: #f8f9fa;
    overflow-y: auto;
    height: calc(100vh - 70px);
    min-width: 0;
    /* Importante para evitar overflow em flex containers */
    display: flex;
    flex-direction: column;
}

/* Ajuste de margens para cards na página de estoque e outras páginas que não usam modern-panel */
.conteudo>.container-fluid>.row>.col-12>.card {
    margin-left: 20px !important;
    margin-right: 20px !important;
    margin-top: 20px !important;
    margin-bottom: 20px !important;
}

/* Garantir margens para modern-panel também */
.modern-panel {
    margin: 20px !important;
    margin-top: 10px !important;
}

.title-row {
    margin-bottom: 15px;
}

/* Ocultar title-row quando vazio */
.title-row:empty {
    display: none !important;
    margin-bottom: 0 !important;
    height: 0 !important;
    padding: 0 !important;
}

/* Ocultar quando o título dentro está vazio */
.title-row .title:empty {
    display: none;
}

.title-row:has(> .title:empty) {
    display: none !important;
    margin-bottom: 0 !important;
    height: 0 !important;
    padding: 0 !important;
}

.title {
    color: #ffffff !important;
    font-weight: 600;
    margin: 0;
}

.title:empty {
    display: none;
}

/* Cards informativos */
.caixinha {
    margin-bottom: 20px;
}

.boxCaixinha {
    background: white;
    border-radius: 10px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    position: relative;
    overflow: hidden;
}

.boxCaixinha:hover {
    transform: translateY(-5px);
}

.boxCaixinha::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.iconeCaixinha {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 15px;
}

.texto {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
}

.subtexto {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

.rodape {
    text-align: center;
    margin-top: 10px;
}

.rodape a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.rodape a:hover {
    color: #5a6fd8;
    text-decoration: underline;
}

/* Cards */
.card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    background: var(--color-surface);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-600) 0%, #6e48aa 100%);
    color: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    border: none;
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    margin: 0;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ffffff !important;
}

.card-body {
    padding: 1rem;
}

/* Cards de estatísticas */
.card.bg-primary,
.card.bg-danger,
.card.bg-success,
.card.bg-warning {
    background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-primary-dark) 100%) !important;
    border: none;
}

.card.bg-danger {
    background: linear-gradient(135deg, var(--bs-danger) 0%, var(--bs-danger-dark) 100%) !important;
}

.card.bg-success {
    background: linear-gradient(135deg, var(--bs-success) 0%, var(--bs-success-dark) 100%) !important;
}

.card.bg-warning {
    background: linear-gradient(135deg, var(--bs-warning) 0%, var(--bs-warning-dark) 100%) !important;
}

/* Estilos específicos para os quadros de estatísticas financeiras */
.card.bg-success.text-white {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
    border: none;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    transition: all 0.3s ease;
}

.card.bg-success.text-white:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.card.bg-danger.text-white {
    background: linear-gradient(135deg, #dc3545 0%, #e74c3c 100%) !important;
    border: none;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
    transition: all 0.3s ease;
}

.card.bg-danger.text-white:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.card.bg-info.text-white {
    background: linear-gradient(135deg, #17a2b8 0%, #20c997 100%) !important;
    border: none;
    box-shadow: 0 4px 15px rgba(23, 162, 184, 0.3);
    transition: all 0.3s ease;
}

.card.bg-info.text-white:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(23, 162, 184, 0.4);
}

.card.bg-warning.text-dark {
    background: linear-gradient(135deg, #ffc107 0%, #ff8c00 100%) !important;
    border: none;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
    transition: all 0.3s ease;
    color: #2c3e50 !important;
}

.card.bg-warning.text-dark:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.4);
}

/* Melhorias nos textos dos quadros de estatísticas */
.card.bg-success.text-white .card-title,
.card.bg-danger.text-white .card-title,
.card.bg-info.text-white .card-title,
.card.bg-warning.text-dark .card-title {
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.card.bg-success.text-white h4,
.card.bg-danger.text-white h4,
.card.bg-info.text-white h4,
.card.bg-warning.text-dark h4 {
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Ícones dos quadros de estatísticas */
.card.bg-success.text-white .fa-arrow-up,
.card.bg-danger.text-white .fa-arrow-down,
.card.bg-info.text-white .fa-balance-scale,
.card.bg-warning.text-dark .fa-clock {
    opacity: 0.9;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* Estilos específicos para colunas de ações em tabelas */
/* Regra opt-out: tabelas com a classe .tabela-livre escapam do
   comportamento sticky/fixed-width da última coluna (usado para tabelas
   onde a última coluna eh dado, nao botoes de acao). */
.table:not(.tabela-livre) th:last-child,
.table:not(.tabela-livre) td:last-child {
    min-width: 120px;
    width: 120px;
    text-align: center;
    white-space: nowrap;
    position: sticky;
    right: 0;
    background: inherit;
    z-index: 10;
}

/* Garantir que a coluna de ações seja sempre visível */
.table-responsive {
    overflow-x: auto;
    position: relative;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Estilos específicos para garantir visibilidade das colunas de ações */
.table:not(.tabela-livre) th:last-child,
.table:not(.tabela-livre) td:last-child {
    min-width: 120px !important;
    width: 120px !important;
    text-align: center !important;
    white-space: nowrap !important;
    position: sticky !important;
    right: 0 !important;
    background: #fff !important;
    z-index: 10 !important;
    border-left: 2px solid #dee2e6 !important;
    display: table-cell !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Estilos específicos para tabelas de compras e lançamentos */
#tabela-compras th:last-child,
#tabela-compras td:last-child,
#tabelaLancamentos th:last-child,
#tabelaLancamentos td:last-child {
    min-width: 150px !important;
    width: 150px !important;
    background: #fff !important;
    border-left: 2px solid #dee2e6 !important;
    display: table-cell !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Garantir que a coluna de ações tenha fundo branco */
.table:not(.tabela-livre) tbody tr:nth-child(even) td:last-child {
    background: #f8f9fa !important;
}

.table:not(.tabela-livre) tbody tr:nth-child(odd) td:last-child {
    background: #fff !important;
}

/* Estilos para botões de ação */
.table .btn-group {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 2px !important;
    justify-content: center !important;
    width: 100% !important;
}

.table .btn-group .btn {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
    border-radius: 4px !important;
    min-width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

.table .btn-group .btn i {
    font-size: 0.75rem !important;
}

/* Melhorar a responsividade das tabelas */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.875rem;
    }

    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
    }

    .table .btn-group .btn {
        min-width: 28px !important;
        height: 28px !important;
        padding: 0.2rem 0.4rem !important;
    }

    /* Garantir que a coluna de ações seja visível em dispositivos móveis */
    .table:not(.tabela-livre) th:last-child,
    .table:not(.tabela-livre) td:last-child {
        min-width: 100px !important;
        width: 100px !important;
    }
}

/* Ajustes para painéis e cards */
.card {
    margin-bottom: 1.5rem;
}

.card-body {
    padding: 1.25rem;
}

/* Melhorar a visualização dos painéis financeiros */
#quadrinhosFinanceiro .caixinha,
#quadrinhosPrevistos .caixinha {
    margin-bottom: 1rem;
}

.boxCaixinha {
    min-height: 120px;
    padding: 1rem;
}

/* Ajustes para tabelas específicas */
#tabela-compras,
#tabelaLancamentos {
    font-size: 0.9rem;
}

#tabela-compras th,
#tabelaLancamentos th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Garantir que todas as colunas sejam visíveis */
.table th,
.table td {
    vertical-align: middle;
    border-top: 1px solid #dee2e6;
}

/* Estilo especial para colunas de status */
.table .badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
}

/* Melhorar a visibilidade dos botões de ação */
.btn-group .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

/* Ajustes para painéis de filtros */
.card.mb-3.border-0.shadow-sm {
    margin-bottom: 1.5rem !important;
}

/* Melhorar espaçamento entre elementos */
.row.g-3>* {
    margin-bottom: 1rem;
}

/* Ajustes para responsividade geral */
@media (max-width: 1200px) {
    .col-md-3 {
        margin-bottom: 1rem;
    }
}

@media (max-width: 992px) {
    .table-responsive {
        font-size: 0.8rem;
    }

    .btn-group .btn {
        min-width: 26px !important;
        height: 26px !important;
        padding: 0.15rem 0.3rem !important;
    }
}

/* Responsividade da tabela */
@media (max-width: 1200px) {
    .table {
        font-size: 0.85rem;
    }

    .table td,
    .table th {
        padding: 0.4rem;
    }
}

/* Estilos para tabelas específicas com melhor visibilidade */
.table.table-striped tbody tr:nth-of-type(odd) td:last-child {
    background: #f8f9fa !important;
}

.table.table-striped tbody tr:nth-of-type(even) td:last-child {
    background: #fff !important;
}

/* Melhorar a visibilidade das bordas da coluna de ações */
.table td:last-child {
    border-left: 2px solid #dee2e6 !important;
    box-shadow: -2px 0 4px rgba(0, 0, 0, 0.1) !important;
}

/* Estilos para hover na coluna de ações */
.table tbody tr:hover td:last-child {
    background: rgba(102, 126, 234, 0.1) !important;
    border-left-color: #667eea !important;
}

/* Garantir que os botões de ação sejam sempre clicáveis */
.table .btn-group .btn {
    position: relative !important;
    z-index: 20 !important;
    cursor: pointer !important;
}

/* Estilos para diferentes tipos de tabelas */
.table.table-hover tbody tr:hover td:last-child {
    background: rgba(102, 126, 234, 0.15) !important;
}

/* Melhorar a visibilidade em modo escuro ou com temas personalizados */
.table td:last-child {
    background: #fff !important;
    color: #333 !important;
}

/* Estilos para colunas de ações em tabelas compactas */
.table.table-sm td:last-child,
.table.table-sm th:last-child {
    padding: 0.3rem !important;
    min-width: 100px !important;
    width: 100px !important;
}

/* Garantir que a coluna de ações seja visível mesmo com scroll */
.table-responsive {
    overflow-x: auto !important;
    overflow-y: visible !important;
}

/* Estilos para colunas de ações em diferentes contextos */
.dashboard-table td:last-child,
.reports-table td:last-child,
.analytics-table td:last-child {
    min-width: 130px !important;
    width: 130px !important;
    background: #fff !important;
    border-left: 2px solid #dee2e6 !important;
}

/* Melhorar a visibilidade em dispositivos touch */
@media (hover: none) and (pointer: coarse) {
    .table .btn-group .btn {
        min-width: 36px !important;
        height: 36px !important;
        padding: 0.3rem 0.6rem !important;
    }

    .table td:last-child,
    .table th:last-child {
        min-width: 140px !important;
        width: 140px !important;
    }
}

/* Estilos para impressão */
@media print {

    .table td:last-child,
    .table th:last-child {
        display: table-cell !important;
        visibility: visible !important;
        background: #fff !important;
        border: 1px solid #000 !important;
    }

    .table .btn-group {
        display: none !important;
    }
}

/* Estilos para cabeçalhos de tabela */
.table thead th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-weight: 600;
}

/* Estilos para linhas alternadas */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(102, 126, 234, 0.05);
}

/* Estilos para badges */
.badge {
    border-radius: 20px;
    padding: 8px 12px;
    font-weight: 500;
    font-size: 0.75em;
}

/* Formulários */
.form-control,
.form-select {
    border-radius: 6px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.form-control-sm,
.form-select-sm {
    font-size: 0.8125rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.form-control:focus,
.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
}

/* Estados de validação */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.15);
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: #198754;
    box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.15);
}

/* Feedback de validação */
.invalid-feedback {
    display: block;
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.valid-feedback {
    display: block;
    color: #198754;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-label.small {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    color: #6c757d;
}

.form-label.fw-bold {
    font-weight: 600 !important;
}

/* Card de filtros */
.card.border-0.shadow-sm {
    background-color: #f8f9fa;
    border-radius: 8px;
}

.card.border-0.shadow-sm .card-body {
    padding: 1rem;
}

/* Input group */
.input-group-sm>.form-control,
.input-group-sm>.input-group-text,
.input-group-sm>.btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
    border-radius: 4px;
}

.input-group .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
}

.input-group .btn i {
    font-size: 0.875rem;
}

/* Botões de ação */
.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: 4px;
}

.btn-group-sm .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
}

/* Espaçamento e alinhamento */
.g-3 {
    gap: 1rem;
}

.mt-3 {
    margin-top: 1rem !important;
}

.ms-2 {
    margin-left: 0.5rem !important;
}

/* Responsividade dos filtros */
@media (max-width: 768px) {
    .card.border-0.shadow-sm .card-body {
        padding: 0.75rem;
    }

    .row.g-3 {
        gap: 0.5rem;
    }

    .col-md-6.text-end {
        text-align: left !important;
        margin-top: 0.5rem;
    }

    .btn-sm {
        width: auto;
    }
}

.input-group-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px 0 0 8px;
}

/* Alertas */
.alert {
    border-radius: 8px;
    border: none;
}

.alert-success {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
    color: #2c3e50;
}

.alert-danger {
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    color: white;
}

.alert-warning {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #2c3e50;
}

.alert-info {
    background: linear-gradient(135deg, #2196F3 0%, #21CBF3 100%);
    color: white;
}

/* Dropdown */
.dropdown-menu {
    border-radius: 8px;
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dropdown-item:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

/* Responsividade - menu mobile ajustado no bloco principal acima */
@media (max-width: 768px) {
    .menu {
        width: 100%;
        position: fixed;
        left: -100%;
        z-index: 1000;
    }

    .menu.active {
        left: 0;
    }

    .conteudo {
        margin-left: 0;
        padding: 15px;
    }

    .caixinha {
        margin-bottom: 15px;
    }

    .boxCaixinha {
        padding: 20px;
    }

    .iconeCaixinha {
        font-size: 2em;
    }

    .texto {
        font-size: 14px;
    }

    .subtexto {
        font-size: 20px;
    }
}

/* Animações */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card,
.boxCaixinha {
    animation: fadeIn 0.5s ease-out;
}

/* Estados de hover */
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

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

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

/* Estilos específicos para a página de lançamentos */
.sticky-top {
    position: sticky;
    top: 0;
    z-index: 1020;
}

/* FIX CLS: removido transform: scale(1.01) - causava tremor visivel ao
   passar o mouse pelas linhas (cada linha empurrava a do lado, e o thead
   re-renderizava). So muda background no hover - feedback visual igual,
   sem layout shift. */
.table-hover tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.1) !important;
    transition: background-color 0.15s ease;
}

.lancamento-row {
    transition: all 0.3s ease;
}

.lancamento-row.selected {
    background-color: rgba(102, 126, 234, 0.2) !important;
    border-left: 4px solid #667eea;
}

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

.form-check-input:checked {
    background-color: #667eea;
    border-color: #667eea;
}

.form-check-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Animações para os cards de estatísticas */
.card {
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* Estilos para botões desabilitados */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Estilos para a tabela responsiva */
.table-responsive {
    border-radius: 8px;
    overflow: hidden;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

/* Estilos para badges */
.badge {
    font-size: 0.75em;
    padding: 0.5em 0.75em;
}

/* CORREÇÃO CRÍTICA: Garantir que modais fiquem acima de TUDO */
.modal {
    z-index: 1060 !important;
    /* Muito acima do backdrop (1050) e header (1000) */
}

.modal.show {
    display: block !important;
    opacity: 1 !important;
}

.modal.fade.show {
    opacity: 1 !important;
}

.modal-backdrop {
    z-index: 1050 !important;
    /* Abaixo do modal mas acima de outros elementos */
    background-color: transparent !important;
    /* Sem tela escurecida */
    pointer-events: none !important;
    /* NÃO bloquear cliques - permitir que passem para o modal */
}

/* CRÍTICO: Quando o modal estiver aberto, o backdrop não deve bloquear NADA */
body.modal-open .modal-backdrop {
    pointer-events: none !important;
}

.modal-backdrop.show {
    opacity: 0 !important;
    /* Totalmente transparente */
}

/* Hierarquia z-index do modal (gap de 5 entre camadas permite dropdowns
   internos com z-index intermediario sem conflito):
     backdrop: 1050 | dialog: 1055 | content: 1060 | dropdown-in-modal: ate 1075 */
.modal-dialog {
    position: relative !important;
    z-index: 1055 !important;
    margin: 1.75rem auto !important;
    pointer-events: auto !important;
}

.modal-content {
    position: relative !important;
    z-index: 1060 !important;
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    pointer-events: auto !important;
}

/* Garantir que botões dentro do modal sejam clicáveis */
.modal-content button,
.modal-content .btn,
.modal-content input,
.modal-content select,
.modal-content textarea,
.modal-content a,
.modal-content .btn-close {
    pointer-events: auto !important;
    position: relative;
    z-index: 1058 !important;
    /* Acima de tudo no modal */
    cursor: pointer !important;
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
    pointer-events: auto !important;
    z-index: 1058 !important;
}

.modal-header .btn-close {
    filter: invert(1);
    pointer-events: auto !important;
    z-index: 1059 !important;
    cursor: pointer !important;
}

.modal-body {
    pointer-events: auto !important;
    z-index: 1058 !important;
}

.modal-footer {
    pointer-events: auto !important;
    z-index: 1058 !important;
}

/* Garantir que quando o modal estiver aberto, o body não bloqueie interações.
   FIX CLS: scrollbar-gutter reserva o espaco da scrollbar SEMPRE, evitando
   que o body "salte" ~15px para a direita quando o modal abre e a scrollbar
   some (overflow: hidden). */
html {
    scrollbar-gutter: stable;
}
body.modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
}

body.modal-open .modal.show {
    display: block !important;
}

/* CRÍTICO: Garantir que elementos de layout não bloqueiem o modal */
body.modal-open .all,
body.modal-open .menu {
    z-index: auto !important;
    pointer-events: auto !important;
}

/* Garantir que o header não bloqueie o modal */
body.modal-open .modern-header {
    z-index: 1000 !important;
    /* Manter abaixo do modal */
    pointer-events: auto !important;
}

/* Estilos para inputs de busca */
.input-group-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

/* Estilos para botões de visualização */
.btn-outline-secondary.active {
    background-color: #667eea;
    border-color: #667eea;
    color: white;
}

/* Estilos para contador */
#contadorLancamentos {
    font-size: 0.8em;
    padding: 0.3em 0.6em;
}

/* Estilos para ícones nas células */
.lancamento-row td i {
    transition: transform 0.15s ease;
    will-change: transform;
    display: inline-block;  /* permite transform sem reflow do td */
}

.lancamento-row:hover td i {
    transform: scale(1.2);
}

/* Estilos para valores */
.fw-bold {
    font-weight: 600 !important;
}

/* Estilos para estados de hover dos botões de ação */
.btn-group-sm .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Estilos para filtros específicos de mês e ano */
#filtroMesEspecifico,
#filtroAnoEspecifico {
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Melhorar aparência dos filtros específicos */
#filtroMesEspecifico .form-select,
#filtroAnoEspecifico .form-select {
    border-color: #667eea;
    background-color: rgba(102, 126, 234, 0.05);
}

#filtroMesEspecifico .form-select:focus,
#filtroAnoEspecifico .form-select:focus {
    border-color: #5a6fd8;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    background-color: white;
}

/* Indicador visual quando filtros específicos estão ativos */
#filtroMesEspecifico:not([style*="display: none"]) .form-label,
#filtroAnoEspecifico:not([style*="display: none"]) .form-label {
    color: #667eea;
    font-weight: 600;
}

/* Estilos para o filtro de período melhorado */
.card.border-primary {
    border-width: 2px !important;
}

.card.border-primary .card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-bottom: none;
}

.card.border-primary .alert-info {
    background-color: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.3);
    color: #495057;
}

/* Animação para os campos específicos */
#filtroMesEspecifico.show,
#filtroAnoEspecifico.show {
    display: block !important;
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover effects para os selects */
.card.border-primary .form-select:hover {
    border-color: #5a6fd8;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

/* Responsividade para o filtro de período */
@media (max-width: 768px) {
    .card.border-primary .row>div {
        margin-bottom: 1rem;
    }

    .card.border-primary .alert {
        font-size: 0.9rem;
    }
}

/* Estilos para os campos de data */
.card.border-primary input[type="date"] {
    border: 2px solid #e9ecef;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
}

.card.border-primary input[type="date"]:focus {
    border-color: #5a6fd8;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.card.border-primary input[type="date"]:hover {
    border-color: #5a6fd8;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

/* Estilos para o botão Filtrar */
#btnFiltrar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    transition: all 0.3s ease;
    font-weight: 600;
}

#btnFiltrar:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4c93 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

#btnFiltrar:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

/* Responsividade para os campos de data */
@media (max-width: 768px) {
    .card.border-primary input[type="date"] {
        font-size: 0.9rem;
    }

    #btnFiltrar {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
}

/* ===== MELHORIAS IMPLEMENTADAS - PAINÉIS FINANCEIROS ===== */

/* ===== 1. GARANTIA DE FUNCIONAMENTO DE TODOS OS BOTÕES ===== */

/* Botões principais - Garantir funcionamento */
.btn {
    position: relative !important;
    overflow: visible !important;
    cursor: pointer !important;
    user-select: none !important;
    touch-action: manipulation !important;
    transition: all 0.2s ease-in-out !important;
    border: 1px solid transparent !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    vertical-align: middle !important;
    line-height: 1.5 !important;
    font-weight: 400 !important;
    text-align: center !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 1rem !important;
    border-radius: 0.375rem !important;
    min-height: 38px !important;
    min-width: 80px !important;
}

/* Garantir que botões não sejam cortados */
.btn:not(:disabled) {
    pointer-events: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Estados dos botões */
.btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
    z-index: 5 !important;
}

.btn:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.btn:focus {
    outline: 2px solid #667eea !important;
    outline-offset: 2px !important;
    z-index: 10 !important;
}

/* Botões de ação nas tabelas - GARANTIR FUNCIONAMENTO */
.table .btn-group .btn {
    position: relative !important;
    z-index: 15 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    min-width: 36px !important;
    height: 36px !important;
    padding: 0.375rem 0.5rem !important;
    font-size: 0.875rem !important;
    border-radius: 6px !important;
    margin: 0 1px !important;
    transition: all 0.2s ease !important;
    border: 1px solid #dee2e6 !important;
    background: #fff !important;
    color: #495057 !important;
}

.table .btn-group .btn:hover {
    background: #667eea !important;
    color: #fff !important;
    border-color: #667eea !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 3px 6px rgba(102, 126, 234, 0.3) !important;
}

.table .btn-group .btn:active {
    transform: translateY(0) !important;
    box-shadow: 0 1px 3px rgba(102, 126, 234, 0.3) !important;
}

/* Botões específicos por tipo */
.btn-primary {
    background: #667eea !important;
    border-color: #667eea !important;
    color: #fff !important;
}

.btn-primary:hover {
    background: #5a6fd8 !important;
    border-color: #5a6fd8 !important;
}

.btn-success {
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: #fff !important;
}

.btn-success:hover {
    background: #218838 !important;
    border-color: #218838 !important;
}

.btn-danger {
    background: #dc3545 !important;
    border-color: #dc3545 !important;
    color: #fff !important;
}

.btn-danger:hover {
    background: #c82333 !important;
    border-color: #c82333 !important;
}

.btn-warning {
    background: #ffc107 !important;
    border-color: #ffc107 !important;
    color: #212529 !important;
}

.btn-warning:hover {
    background: #e0a800 !important;
    border-color: #e0a800 !important;
}

.btn-info {
    background: #17a2b8 !important;
    border-color: #17a2b8 !important;
    color: #fff !important;
}

.btn-info:hover {
    background: #138496 !important;
    border-color: #138496 !important;
}

.btn-secondary {
    background: #6c757d !important;
    border-color: #6c757d !important;
    color: #fff !important;
}

.btn-secondary:hover {
    background: #5a6268 !important;
    border-color: #5a6268 !important;
}

/* ===== 2. PAINÉIS COM TAMANHO ADEQUADO E SEM CORTES ===== */

/* Cards e painéis principais */
.card {
    margin-bottom: 1.5rem !important;
    border: 1px solid #e9ecef !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    overflow: visible !important;
    position: relative !important;
    background: #fff !important;
    min-height: 200px !important;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
    transform: translateY(-2px) !important;
    transition: all 0.3s ease !important;
}

.card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border-bottom: 1px solid #e9ecef !important;
    border-radius: 12px 12px 0 0 !important;
    padding: 1.25rem 1.5rem !important;
    min-height: 60px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.card-body {
    padding: 1.5rem !important;
    min-height: 140px !important;
    overflow: visible !important;
}

.card-title {
    margin: 0 !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    line-height: 1.4 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Painéis financeiros específicos */
#quadrinhosFinanceiro,
#quadrinhosPrevistos {
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
}

#quadrinhosFinanceiro .caixinha,
#quadrinhosPrevistos .caixinha {
    margin-bottom: 1.5rem !important;
    min-height: 140px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
}

.boxCaixinha {
    min-height: 140px !important;
    padding: 1.5rem !important;
    border-radius: 12px !important;
    border: 1px solid #e9ecef !important;
    background: #fff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    transition: all 0.3s ease !important;
    overflow: hidden !important;
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.boxCaixinha:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15) !important;
}

/* Estilos para o card de resumo do período */
.resumo-item {
    transition: all 0.3s ease;
    height: 100%;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.resumo-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.resumo-item h2,
.resumo-item h3 {
    font-weight: 700;
    line-height: 1.2;
}

.resumo-item h6 {
    font-weight: 600;
}

@media (max-width: 768px) {
    .resumo-item {
        min-height: 160px;
        margin-bottom: 1rem;
    }
}

/* ===== 3. MELHORIAS VISUAIS E DE PERFORMANCE ===== */

/* Animações e transições */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* Aplicar animações */
.card,
.boxCaixinha {
    animation: fadeInUp 0.6s ease-out !important;
}

.btn {
    animation: slideInRight 0.4s ease-out !important;
}

/* Hover effects aprimorados */
.card:hover .card-title {
    color: #667eea !important;
    transition: color 0.3s ease !important;
}

.boxCaixinha:hover .iconeCaixinha {
    animation: pulse 1s ease-in-out !important;
}

/* ===== 4. RESPONSIVIDADE COMPLETA ===== */

/* Desktop grande */
@media (min-width: 1400px) {
    .card {
        min-height: 220px !important;
    }

    .card-body {
        padding: 2rem !important;
        min-height: 160px !important;
    }

    .boxCaixinha {
        min-height: 160px !important;
        padding: 2rem !important;
    }

    .table .btn-group .btn {
        min-width: 40px !important;
        height: 40px !important;
        font-size: 0.9rem !important;
    }
}

/* Desktop */
@media (max-width: 1399px) and (min-width: 992px) {
    .card {
        min-height: 200px !important;
    }

    .card-body {
        padding: 1.5rem !important;
        min-height: 140px !important;
    }

    .boxCaixinha {
        min-height: 140px !important;
        padding: 1.5rem !important;
    }
}

/* Tablet */
@media (max-width: 991px) and (min-width: 768px) {
    .card {
        min-height: 180px !important;
        margin-bottom: 1rem !important;
    }

    .card-body {
        padding: 1.25rem !important;
        min-height: 120px !important;
    }

    .boxCaixinha {
        min-height: 120px !important;
        padding: 1.25rem !important;
    }

    .table .btn-group .btn {
        min-width: 34px !important;
        height: 34px !important;
        font-size: 0.8rem !important;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .card {
        min-height: 160px !important;
        margin-bottom: 1rem !important;
        border-radius: 8px !important;
    }

    .card-header {
        padding: 1rem !important;
        min-height: 50px !important;
        border-radius: 8px 8px 0 0 !important;
    }

    .card-body {
        padding: 1rem !important;
        min-height: 100px !important;
    }

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

    .boxCaixinha {
        min-height: 100px !important;
        padding: 1rem !important;
        border-radius: 8px !important;
    }

    .table .btn-group .btn {
        min-width: 32px !important;
        height: 32px !important;
        font-size: 0.75rem !important;
        padding: 0.25rem 0.4rem !important;
    }

    /* Garantir que botões não sejam cortados em mobile */
    .table-responsive {
        margin-bottom: 1rem !important;
    }

    .table th:last-child,
    .table td:last-child {
        min-width: 90px !important;
        width: 90px !important;
    }
}

/* Dispositivos muito pequenos */
@media (max-width: 575px) {
    .card {
        min-height: 140px !important;
        margin-bottom: 0.75rem !important;
    }

    .card-header {
        padding: 0.75rem !important;
        min-height: 45px !important;
    }

    .card-body {
        padding: 0.75rem !important;
        min-height: 80px !important;
    }

    .boxCaixinha {
        min-height: 80px !important;
        padding: 0.75rem !important;
    }

    .table .btn-group .btn {
        min-width: 30px !important;
        height: 30px !important;
        font-size: 0.7rem !important;
        padding: 0.2rem 0.3rem !important;
    }

    .table th:last-child,
    .table td:last-child {
        min-width: 80px !important;
        width: 80px !important;
    }
}

/* ===== 5. OTIMIZAÇÕES DE PERFORMANCE ===== */

/* Lazy loading para imagens */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-image.loaded {
    opacity: 1;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Otimizações de renderização */
.card,
.btn,
.table {
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* ===== 6. MELHORIAS ESPECÍFICAS PARA TABELAS ===== */

/* Garantir que todas as colunas sejam visíveis */
.table {
    width: 100% !important;
    table-layout: auto !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

.table th,
.table td {
    padding: 0.75rem 0.5rem !important;
    vertical-align: middle !important;
    border-top: 1px solid #dee2e6 !important;
    word-wrap: break-word !important;
    max-width: 300px !important;
}

/* Coluna de ações sempre visível e funcional */
.table th:last-child,
.table td:last-child {
    min-width: 150px !important;
    width: 150px !important;
    text-align: center !important;
    white-space: nowrap !important;
    position: sticky !important;
    right: 0 !important;
    background: #fff !important;
    z-index: 20 !important;
    border-left: 3px solid #667eea !important;
    box-shadow: -3px 0 6px rgba(0, 0, 0, 0.1) !important;
    display: table-cell !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Hover na linha da tabela */
.table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05) !important;
    transition: background 0.2s ease !important;
}

.table tbody tr:hover td:last-child {
    background: rgba(102, 126, 234, 0.1) !important;
    border-left-color: #5a6fd8 !important;
}

/* ===== 7. MELHORIAS PARA FORMULÁRIOS ===== */

/* Campos de formulário */
.form-control,
.form-select {
    border: 2px solid #e9ecef !important;
    border-radius: 8px !important;
    padding: 0.75rem 1rem !important;
    font-size: 1rem !important;
    transition: all 0.3s ease !important;
    min-height: 45px !important;
}

.form-control:focus,
.form-select:focus {
    border-color: #667eea !important;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25) !important;
    outline: none !important;
}

.form-control:hover,
.form-select:hover {
    border-color: #adb5bd !important;
}

/* Labels */
.form-label {
    font-weight: 600 !important;
    color: #495057 !important;
    margin-bottom: 0.5rem !important;
    font-size: 0.95rem !important;
}

/* ===== 8. MELHORIAS PARA MODAIS ===== */

.modal-content {
    border-radius: 16px !important;
    border: none !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2) !important;
}

.modal-header {
    border-bottom: 1px solid #e9ecef !important;
    border-radius: 16px 16px 0 0 !important;
    padding: 1.5rem !important;
}

.modal-body {
    padding: 1.5rem !important;
}

.modal-footer {
    border-top: 1px solid #e9ecef !important;
    border-radius: 0 0 16px 16px !important;
    padding: 1.5rem !important;
}

/* ===== 9. MELHORIAS PARA ALERTAS ===== */

.alert {
    border-radius: 12px !important;
    border: none !important;
    padding: 1rem 1.25rem !important;
    margin-bottom: 1rem !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%) !important;
    color: #155724 !important;
    border-left: 4px solid #28a745 !important;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%) !important;
    color: #721c24 !important;
    border-left: 4px solid #dc3545 !important;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%) !important;
    color: #856404 !important;
    border-left: 4px solid #ffc107 !important;
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%) !important;
    color: #0c5460 !important;
    border-left: 4px solid #17a2b8 !important;
}

/* ===== 10. MELHORIAS PARA PAGINAÇÃO ===== */

.pagination {
    margin: 1.5rem 0 0 0 !important;
    justify-content: center !important;
}

.page-link {
    border-radius: 8px !important;
    margin: 0 2px !important;
    border: 1px solid #dee2e6 !important;
    color: #667eea !important;
    padding: 0.5rem 0.75rem !important;
    transition: all 0.2s ease !important;
}

.page-link:hover {
    background: #667eea !important;
    color: #fff !important;
    border-color: #667eea !important;
    transform: translateY(-1px) !important;
}

.page-item.active .page-link {
    background: #667eea !important;
    border-color: #667eea !important;
    color: #fff !important;
}

/* ===== 11. GARANTIA FINAL DE FUNCIONAMENTO ===== */

/* Forçar visibilidade de elementos importantes.
   IMPORTANTE: .table NÃO pode ser display:block — isso anula table-layout e
   width:100%, fazendo a tabela "encolher para o conteúdo" e deixar metade do
   card vazia (bug clássico de listagens fora de tela cheia). Tabela mantém
   display:table; só garantimos visibilidade/opacidade. */
.btn,
.card,
.form-control,
.form-select {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}
.table {
    display: table !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Garantir que botões sejam clicáveis */
.btn:not(:disabled) {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Garantir que tabelas sejam responsivas */
.table-responsive {
    overflow-x: auto !important;
    overflow-y: visible !important;
    position: relative !important;
}

/* Garantir que painéis não sejam cortados */
.card,
.boxCaixinha {
    overflow: visible !important;
    position: relative !important;
}

/* ===== 12. MELHORIAS DE ACESSIBILIDADE ===== */

/* Foco visível para navegação por teclado */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
    outline: 3px solid #667eea !important;
    outline-offset: 2px !important;
}

/* Contraste melhorado */
.text-muted {
    color: #6c757d !important;
}

/* Indicadores visuais para estados */
.btn:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

/* ===== 13. ANIMAÇÕES ESPECIAIS ===== */

@keyframes shimmer {
    0% {
        transform: rotate(45deg) translateX(-100%);
    }

    100% {
        transform: rotate(45deg) translateX(100%);
    }
}

/* ===== FIM DAS MELHORIAS ===== */

/* ===== TEMA MODERNO E TECNOLÓGICO COM BACKGROUND PROFISSIONAL ===== */

/* Background tecnológico - ANIMACAO INFINITE REMOVIDA (causava tremor visual
   no hover por disputa de GPU com transforms de hover). Mantemos so o
   gradient estatico - visual identico, sem custo de animacao perpetua. */
body {
    background: linear-gradient(135deg, #1a1f3a 0%, #2d3561 50%, #1a1f3a 100%);
    background-size: 400% 400%;
    background-position: 0% 50%;
    position: relative;
    min-height: 100vh;
}

/* Efeito de padrão de grade tecnológica */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(102, 126, 234, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(102, 126, 234, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

/* Efeito de partículas/circulos flutuantes */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(118, 75, 162, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(102, 126, 234, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
    /* animation: float 20s ease-in-out infinite -- REMOVIDA por causar
       tremor no hover em telas com baixa GPU. Particulas ficam estaticas. */
}

/* Animação para o gradiente */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Animação para partículas flutuantes */
@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    50% {
        transform: translateY(-20px) rotate(5deg);
        opacity: 0.8;
    }
}

/* Conteúdo sobre o background animado - ajuste de background */
.conteudo {
    background: transparent;
    position: relative;
    z-index: 1;
}

/* Painel principal mais destacado, mantendo estrutura */
.card.listagem-principal,
.card:has(#tabelaLancamentos),
.card:has(#tabela-compras) {
    border-color: #e3e7ef !important;
    box-shadow: 0 6px 18px rgba(25, 42, 70, 0.06) !important;
    background: #ffffff !important;
}

/* Cabeçalho das tabelas fixo e com melhor leitura */
.table-responsive thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #ffffff !important;
    border-bottom: 2px solid #e3e7ef !important;
    color: #3a4151 !important;
}

/* Linhas com zebra suave e hover sutil */
.table tbody tr:nth-child(odd) td {
    background: #fbfcfe !important;
}

.table tbody tr:nth-child(even) td {
    background: #ffffff !important;
}

.table tbody tr:hover td {
    background: #f2f5ff !important;
}

/* Títulos e ícones com melhor contraste, sem mudar layout */
.title,
.card-title {
    color: #ffffff !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.iconeCaixinha {
    color: #5866d9;
}

/* Paleta consistente nos botões */
.btn-primary {
    background-color: #5866d9 !important;
    border-color: #5866d9 !important;
}

.btn-primary:hover {
    background-color: #4e5dd1 !important;
    border-color: #4e5dd1 !important;
}

.btn-outline-secondary {
    color: #4b5565 !important;
    border-color: #c9cfdb !important;
}

.btn-outline-secondary:hover {
    background-color: #eef1f6 !important;
}

/* Badges com cores suaves e legíveis */
.badge.bg-success,
.badge.text-bg-success {
    background-color: #1fbd6c !important;
}

.badge.bg-danger,
.badge.text-bg-danger {
    background-color: #f2545b !important;
}

.badge.bg-warning,
.badge.text-bg-warning {
    background-color: #ffb020 !important;
    color: #2c2c2c !important;
}

/* Campo de busca e filtros com fundo leve */
.input-group-text,
.form-control,
.form-select {
    background-color: #ffffff;
}

/* Bloco da listagem com realce sutil (bordas verdes como referência do print) */
.table-responsive {
    border: 2px solid #cfe8d6 !important;
    box-shadow: 0 0 0 4px #eff7f1 inset !important;
    background: #ffffff;
}

/* Coluna de ações permanece visível e separada */
.table td:last-child,
.table th:last-child {
    background: #ffffff !important;
    border-left: 3px solid #e3e7ef !important;
}

/* Scrollbars sempre visíveis (preferência do usuário) */
* {
    scrollbar-width: thin;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #e9edf3;
}

::-webkit-scrollbar-thumb {
    background: #c4cbe0;
}

::-webkit-scrollbar-thumb:hover {
    background: #aeb7d6;
}

/* ===== ESTILOS PARA COLUNAS DE STATUS, SALDOS E TOTALIZADORES EM RELATÓRIOS ===== */

/* Coluna de Status - última coluna das tabelas (geralmente onde fica Status) */
table.table thead th:last-child,
table.table tbody td:last-child {
    background-color: #f0f4f8 !important;
}

/* ===================== AJUSTES FINOS DO CARRINHO ===================== */
/* Suavizar coluna de ações e impedir faixa vertical alta */
#tabela-itens-venda tbody td:last-child,
#tabela-itens-compra tbody td:last-child,
#tabela-itens-lanc tbody td:last-child {
    border-left: 0 !important;
    padding: 0 8px !important;
    background: #fff;
}

/* Header da coluna ações: largura fixa e central */
#tabela-itens-venda thead th:last-child,
#tabela-itens-compra thead th:last-child,
#tabela-itens-lanc thead th:last-child {
    width: 60px !important;
    min-width: 60px !important;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #fff;
}

/* Botão remover com contraste e feedback */
.cart-remove-btn.btn {
    width: 36px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #f1c2c2;
    color: #e03131;
    background: #fff;
    transition: .15s ease;
}

.cart-remove-btn.btn:hover {
    background: #fff5f5;
    border-color: #e7a1a1;
    color: #b02323;
}

/* Alinhamento fino dos input-groups (badge R$ + input) */
.table .input-group.input-group-sm {
    display: flex;
    align-items: center;
    gap: 0;
}

.table .input-group.input-group-sm .input-group-text {
    height: 36px;
    display: inline-flex;
    align-items: center;
}

.table .input-group.input-group-sm>.form-control {
    height: 36px;
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

/* Observações mais discretas e sem esticar a linha */
#tabela-itens-venda .item-row-venda small.text-muted,
#tabela-itens-compra .item-row-compra small.text-muted,
#tabela-itens-lanc .item-row-lanc small.text-muted {
    font-size: 12px;
    margin-top: 4px;
    display: inline-block;
}

#tabela-itens-venda .item-row-venda input[name="item_obs[]"],
#tabela-itens-compra .item-row-compra input[name="item_obs[]"],
#tabela-itens-lanc .item-row-lanc input[name="item_obs[]"] {
    width: 70%;
}

@media (max-width: 992px) {

    #tabela-itens-venda .item-row-venda input[name="item_obs[]"],
    #tabela-itens-compra .item-row-compra input[name="item_obs[]"],
    #tabela-itens-lanc .item-row-lanc input[name="item_obs[]"] {
        width: 100%;
    }
}

/* Botão "X" de limpar centralizado */
.input-clear-btn.btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

/* Rodapé "Itens" enxuto e alinhado */
#tabela-itens-venda tfoot td,
#tabela-itens-venda tfoot th,
#tabela-itens-compra tfoot td,
#tabela-itens-compra tfoot th,
#tabela-itens-lanc tfoot td,
#tabela-itens-lanc tfoot th {
    padding-top: 4px;
    padding-bottom: 4px;
}

/* Reequilíbrio do grid: menos "Tipo", mais "Total" */
#tabela-itens-venda colgroup col:nth-child(1),
#tabela-itens-compra colgroup col:nth-child(1),
#tabela-itens-lanc colgroup col:nth-child(1) {
    width: 8%;
}

#tabela-itens-venda colgroup col:nth-child(6),
#tabela-itens-compra colgroup col:nth-child(6),
#tabela-itens-lanc colgroup col:nth-child(6) {
    width: 12%;
}

/* Hover sutil da linha */
#tabela-itens-venda tbody tr:hover td,
#tabela-itens-compra tbody tr:hover td,
#tabela-itens-lanc tbody tr:hover td {
    background: #f7f9ff !important;
}

/* Células com badges (status) */
table.table tbody td:has(.badge) {
    background-color: #f0f4f8 !important;
}

/* Colunas de Saldos - quando a última coluna contém valores monetários */
table.table tbody td[class*="text-end"]:last-child,
table.table tbody td:last-child[class*="text-end"] {
    background-color: #f0f9ff !important;
}

/* Colunas de Totalizadores - rodapé das tabelas */
table.table tfoot td,
table.table tfoot th {
    background-color: #f1f5f9 !important;
    font-weight: 600 !important;
}

/* Colunas específicas - Status em tabelas de relatórios (7ª coluna) */
table.table-striped thead th:nth-child(7),
table.table-striped tbody td:nth-child(7) {
    background-color: #f0f4f8 !important;
}

/* Alternância de cores para linhas pares/ímpares com colunas destacadas */
table.table-striped tbody tr:nth-child(even) td:last-child {
    background-color: #e8eff5 !important;
}

table.table-striped tbody tr:nth-child(odd) td:last-child {
    background-color: #f8fafc !important;
}

/* Hover nas colunas destacadas */
table.table tbody tr:hover td:last-child {
    background-color: #e0e8f0 !important;
}

/* Colunas de valores monetários */
table.table thead th.text-end,
table.table tbody td.text-end {
    background-color: #f8fafc !important;
}

/* REGRAS REFORÇADAS PARA COLUNAS DE STATUS, SALDOS E TOTALIZADORES */
/* Status column - última coluna das tabelas */
table.table thead th:last-child,
table.table tbody td:last-child {
    background-color: #f0f4f8 !important;
}

/* Saldo columns - valores monetários */
table.table thead th.text-end:last-child,
table.table tbody td.text-end:last-child {
    background-color: #f0f9ff !important;
}

/* Totalizadores - rodapé das tabelas */
table.table tfoot td,
table.table tfoot th {
    background-color: #f1f5f9 !important;
    font-weight: 600 !important;
}

/* Hover nas colunas destacadas */
table.table tbody tr:hover td:last-child {
    background-color: #e0e8f0 !important;
}

/* Alternância de cores para linhas */
table.table-striped tbody tr:nth-child(even) td:last-child {
    background-color: #e8eff5 !important;
}

table.table-striped tbody tr:nth-child(odd) td:last-child {
    background-color: #f8fafc !important;
}

/* Aplicar estilos específicos para relatórios */
.report-table thead th:last-child,
.report-table tbody td:last-child {
    background-color: #f0f4f8 !important;
}

/* ===== ESTILOS DO CARRINHO (Vendas, Compras, Lançamentos) ===== */
#tabela-itens-venda,
#tabela-itens-compra,
#tabela-itens-lanc {
    border: 1px solid #e6eaf2;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 6px 18px rgba(25, 42, 70, 0.06);
    width: 100% !important;
    table-layout: auto !important;
}

#tabela-itens-venda thead th,
#tabela-itens-compra thead th,
#tabela-itens-lanc thead th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #fff;
    border: none;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.6rem 0.5rem;
    width: auto !important;
}

#tabela-itens-venda tbody td,
#tabela-itens-compra tbody td,
#tabela-itens-lanc tbody td {
    padding: 0.55rem 0.45rem !important;
    vertical-align: middle !important;
    background: #fff;
    width: auto !important;
}

#tabela-itens-venda tfoot th,
#tabela-itens-venda tfoot td,
#tabela-itens-compra tfoot th,
#tabela-itens-compra tfoot td,
#tabela-itens-lanc tfoot th,
#tabela-itens-lanc tfoot td {
    background: #f7f9fc;
    font-weight: 600;
    border-top: 2px solid #e6eaf2;
}

/* Corrigir expansão total do painel (sem coluna fantasma à direita) */
.card .table-responsive {
    width: 100% !important;
    display: block !important;
}

/* Desabilitar coluna sticky especificamente nas tabelas do carrinho para evitar espaço em branco lateral */
#tabela-itens-venda th:last-child,
#tabela-itens-venda td:last-child,
#tabela-itens-compra th:last-child,
#tabela-itens-compra td:last-child,
#tabela-itens-lanc th:last-child,
#tabela-itens-lanc td:last-child {
    position: static !important;
    right: auto !important;
    background: #fff !important;
    border-left: none !important;
    /* Largura corrigida para 150px - removido 56px conflitante */
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
}

/* Preenchimento total do espaço do formulário dentro do carrinho */
#tabela-itens-venda .form-control,
#tabela-itens-venda .form-select,
#tabela-itens-venda .input-group,
#tabela-itens-compra .form-control,
#tabela-itens-compra .form-select,
#tabela-itens-compra .input-group,
#tabela-itens-lanc .form-control,
#tabela-itens-lanc .form-select,
#tabela-itens-lanc .input-group {
    width: 100% !important;
    max-width: 100% !important;
}

/* Células de valor com input-group não estourarem */
#tabela-itens-venda .input-group-text,
#tabela-itens-compra .input-group-text,
#tabela-itens-lanc .input-group-text {
    flex: 0 0 auto;
}

#tabela-itens-venda .input-group>.form-control,
#tabela-itens-compra .input-group>.form-control,
#tabela-itens-lanc .input-group>.form-control {
    flex: 1 1 auto;
    min-width: 0;
}

/* Linha de ações compacta e sem quebra forçada */
#tabela-itens-venda td:last-child .btn,
#tabela-itens-compra td:last-child .btn,
#tabela-itens-lanc td:last-child .btn {
    width: 100%;
}

/* Evitar espaços extras dentro do .table-responsive do carrinho */
.card .table-responsive {
    width: 100% !important;
    display: block !important;
    overflow-x: auto;
}

/* ====================== HARMONIZAÇÃO VISUAL DOS CARRINHOS ====================== */
/* Grid proporcional via colgroup - DESABILITADO - usando table-layout: fixed com larguras fixas em px */
/* As larguras agora são controladas pelas regras .carrinho-table acima */

/* Header harmônico */
#tabela-itens-venda thead th,
#tabela-itens-compra thead th,
#tabela-itens-lanc thead th {
    line-height: 1.15;
    letter-spacing: .2px;
    white-space: nowrap !important;
    overflow: visible !important;
}

/* Inputs nivelados e compactos */
#tabela-itens-venda .form-control,
#tabela-itens-compra .form-control,
#tabela-itens-lanc .form-control,
#tabela-itens-venda .form-select,
#tabela-itens-compra .form-select,
#tabela-itens-lanc .form-select {
    height: 36px;
    min-height: 36px;
}

/* Alinhamento consistente dos input-groups */
#tabela-itens-venda .input-group-text,
#tabela-itens-compra .input-group-text,
#tabela-itens-lanc .input-group-text {
    height: 36px;
    border-radius: 6px 0 0 6px;
    display: inline-flex;
    align-items: center;
}

/* Remover excesso de altura e dar respiro equilibrado */
#tabela-itens-venda tbody tr,
#tabela-itens-compra tbody tr,
#tabela-itens-lanc tbody tr {
    height: auto;
}

#tabela-itens-venda tbody td,
#tabela-itens-compra tbody td,
#tabela-itens-lanc tbody td {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
}

/* Coluna Total - ajustada para 150px e alinhada à direita */
#tabela-itens-venda td:last-child,
#tabela-itens-compra td:last-child,
#tabela-itens-lanc td:last-child {
    text-align: right !important;
    vertical-align: middle !important;
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
}

#tabela-itens-venda td:last-child .btn,
#tabela-itens-compra td:last-child .btn,
#tabela-itens-lanc td:last-child .btn {
    width: 36px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Observações com respiro correto */
#tabela-itens-venda .item-row-venda .form-control.form-control-sm.mt-1,
#tabela-itens-compra .item-row-compra .form-control.form-control-sm.mt-1,
#tabela-itens-lanc .item-row-lanc .form-control.form-control-sm.mt-1 {
    margin-top: .35rem !important;
}

/* Rodapé enxuto e alinhado */
#tabela-itens-venda tfoot th,
#tabela-itens-venda tfoot td,
#tabela-itens-compra tfoot th,
#tabela-itens-compra tfoot td,
#tabela-itens-lanc tfoot th,
#tabela-itens-lanc tfoot td {
    padding-top: 8px;
    padding-bottom: 8px;
}

/* Responsividade: manter larguras fixas mesmo em telas menores */
@media (max-width: 992px) {

    /* Larguras fixas mantidas - usar scroll horizontal se necessário */
    .carrinho-card .carrinho-table {
        table-layout: fixed !important;
        width: 100% !important;
    }
}

@media (max-width: 768px) {

    #tabela-itens-venda .form-control,
    #tabela-itens-compra .form-control,
    #tabela-itens-lanc .form-control {
        height: 34px;
    }

    #tabela-itens-venda .input-group-text,
    #tabela-itens-compra .input-group-text,
    #tabela-itens-lanc .input-group-text {
        height: 34px;
    }
}

/* Inputs compactos e alinhados */
#tabela-itens-venda .form-control,
#tabela-itens-compra .form-control,
#tabela-itens-lanc .form-control,
#tabela-itens-venda .form-select,
#tabela-itens-compra .form-select,
#tabela-itens-lanc .form-select {
    height: 36px;
    min-height: 36px !important;
    padding: 0.35rem 0.5rem !important;
    font-size: 0.88rem !important;
}

#tabela-itens-venda .input-group-text,
#tabela-itens-compra .input-group-text,
#tabela-itens-lanc .input-group-text {
    height: 36px;
    padding: 0 0.5rem;
    border-radius: 6px 0 0 6px;
}

/* Botão remover discreto */
.btn-remover-item-venda,
.btn-remover-item-compra,
.btn-remover-item-lanc {
    border-color: #e6eaf2 !important;
    color: #dc3545 !important;
    background: #fff !important;
}

.btn-remover-item-venda:hover,
.btn-remover-item-compra:hover,
.btn-remover-item-lanc:hover {
    background: #fff1f2 !important;
    border-color: #ffc9cf !important;
}

/* Hover nas linhas do carrinho */
#tabela-itens-venda tbody tr:hover,
#tabela-itens-compra tbody tr:hover,
#tabela-itens-lanc tbody tr:hover {
    background-color: #f7f9ff !important;
}

/* Botão Adicionar item discreto */
#btn-adicionar-item-venda,
#btn-adicionar-item-compra,
#btn-adicionar-item-lanc {
    border-color: #cfd6ea;
    color: #4b5565;
    background: #fff;
}

#btn-adicionar-item-venda:hover,
#btn-adicionar-item-compra:hover,
#btn-adicionar-item-lanc:hover {
    background: #eef1f7;
    border-color: #bfc7e3;
}

/* ===== AUTOCOMPLETE MODERNO (inputs de Produto) ===== */
.autocomplete-container {
    position: relative;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e6eaf2;
    box-shadow: 0 12px 28px rgba(22, 34, 58, 0.14);
    border-radius: 10px;
    padding: 6px;
    margin-top: 6px;
    z-index: 1055;
    /* acima da tabela */
    max-height: 280px;
    overflow-y: auto;
    display: none;
}

.input-clear-btn.btn {
    padding: 0.25rem 0.45rem;
    line-height: 1;
}

@media (max-width: 768px) {
    .autocomplete-suggestions {
        max-height: 220px;
    }
}

@media (max-width: 576px) {
    .autocomplete-suggestions {
        max-height: 160px;
    }
}

.autocomplete-suggestion {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.06s ease;
}

.autocomplete-suggestion:hover {
    background: #f4f6fb;
}

.autocomplete-suggestion:active {
    transform: scale(0.995);
}

.autocomplete-suggestion strong {
    color: #2a2f3a;
    font-weight: 600;
}

.autocomplete-suggestion small {
    color: #6b7280;
}

/* Badgezinho para estoque/infos à direita */
.autocomplete-suggestion .badge-pill {
    background: #eef2ff;
    color: #4e5dd1;
    border: 1px solid #dee3ff;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 999px;
}

/* Estado selecionado via teclas */
.autocomplete-suggestion.selected {
    background: #eef2ff;
}

/* Scrollbar do menu mais discreta */
.autocomplete-suggestions::-webkit-scrollbar {
    width: 8px;
}

.autocomplete-suggestions::-webkit-scrollbar-thumb {
    background: #cfd6ea;
    border-radius: 8px;
}

.autocomplete-suggestions::-webkit-scrollbar-thumb:hover {
    background: #b7c1df;
}

/* Garantir que o menu não fique "cortado" pela tabela */
.table .autocomplete-suggestions {
    overflow: auto;
    z-index: 1060;
}

/* Layout de item com ícone e meta à direita */
.autocomplete-suggestion .sugg-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.autocomplete-suggestion .sugg-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #eef2ff;
    color: #4e5dd1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.autocomplete-suggestion .sugg-title {
    display: block;
    line-height: 1.2;
}

.autocomplete-suggestion .sugg-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Loading/skeleton */
.autocomplete-loading {
    padding: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.autocomplete-loading .skel {
    height: 10px;
    background: #e9edf6;
    border-radius: 999px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.autocomplete-loading .skel::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .6), transparent);
    transform: translateX(-100%);
    animation: skel 1.2s infinite;
}

@keyframes skel {
    100% {
        transform: translateX(100%);
    }
}

/* ===== CARRINHO PADRONIZADO (Vendas, Compras, Lançamentos) ===== */
.carrinho-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.carrinho-card .card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 1rem;
}

.carrinho-card .card-body {
    padding: 0;
}

.carrinho-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 0 !important;
    table-layout: fixed !important;
}

.carrinho-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

.carrinho-table thead th {
    color: white !important;
    font-weight: 600 !important;
    padding: 0.75rem 0.5rem !important;
    text-align: left !important;
    border: none !important;
    font-size: 0.875rem !important;
    white-space: nowrap !important;
    overflow: visible !important;
}

.carrinho-table thead th:first-child {
    padding-left: 1rem !important;
    width: 140px !important;
    min-width: 140px !important;
    max-width: 140px !important;
}

.carrinho-table thead th:nth-child(2) {
    width: auto !important;
    min-width: 230px !important;
}

.carrinho-table thead th:nth-child(3) {
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
    text-align: right !important;
}

.carrinho-table thead th:nth-child(4) {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
    text-align: center !important;
    white-space: nowrap !important;
}

.carrinho-table thead th:nth-child(5) {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
    text-align: right !important;
}

.carrinho-table thead th:nth-child(6) {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
    text-align: right !important;
    padding-right: 1rem !important;
}

.carrinho-table tbody td {
    padding: 0.75rem 0.5rem !important;
    vertical-align: middle !important;
    border-bottom: 1px solid #f0f0f0 !important;
}

.carrinho-table tbody td:first-child {
    padding-left: 1rem !important;
    width: 140px !important;
    min-width: 140px !important;
    max-width: 140px !important;
}

.carrinho-table tbody td:nth-child(2) {
    width: auto !important;
    min-width: 230px !important;
}

.carrinho-table tbody td:nth-child(3) {
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
}

.carrinho-table tbody td:nth-child(4) {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

.carrinho-table tbody td:nth-child(5) {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

.carrinho-table tbody td:last-child {
    padding-right: 2.5rem !important;
    padding-bottom: 2.5rem !important;
    position: relative !important;
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
}

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

.carrinho-table tfoot {
    background: #f8f9fa !important;
}

.carrinho-table tfoot td,
.carrinho-table tfoot th {
    padding: 0.75rem 0.5rem !important;
    border-top: 2px solid #e9ecef !important;
    font-weight: 600 !important;
    color: #495057 !important;
}

.carrinho-table tfoot td:first-child,
.carrinho-table tfoot th:first-child {
    padding-left: 1rem !important;
}

.carrinho-table tfoot td:last-child,
.carrinho-table tfoot th:last-child {
    padding-right: 1rem !important;
    text-align: right !important;
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
}

.carrinho-table tbody .form-control-sm,
.carrinho-table tbody .form-select-sm {
    border: 1px solid #dee2e6 !important;
    border-radius: 6px !important;
    padding: 0.375rem 0.5rem !important;
    font-size: 0.8125rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.carrinho-table tbody .form-control-sm:focus,
.carrinho-table tbody .form-select-sm:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
}

/* O botão de remover é position:absolute. Seu bloco-contêiner PRECISA ser cada
   LINHA do carrinho — senão todos os botões se ancoram no mesmo ancestral
   posicionado (o .card) e EMPILHAM no mesmo ponto, deixando só o último clicável
   (bug: "só consigo apagar o último item"). Atenção: position:relative em
   <td>/table-cell é IGNORADO pelo Blink para fins de bloco-contêiner — por isso
   ancoramos no <tr> (table-row), que funciona. */
.carrinho-table tbody tr {
    position: relative;
}

.carrinho-remove-btn {
    color: #dc3545;
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    opacity: 0.5;
    transition: all 0.2s ease;
    position: absolute;
    right: 0.5rem;
    top: 0.35rem;
    z-index: 10;
}

.carrinho-remove-btn:hover {
    color: #c82333;
    opacity: 1;
}

.carrinho-remove-btn:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
    opacity: 1;
}

/*
 * Fix: o botão de remover é position:absolute. Sem um containing block na
 * própria célula, todos os botões das linhas ancoravam no mesmo ponto e
 * empilhavam — só o último ficava clicável (clicar em qualquer linha removia
 * a última). Tornar a célula do botão position:relative ancora cada botão à
 * sua própria linha. Cobre compras, vendas e lançamentos (novo e editar).
 */
.item-row-compra > td:last-child,
.item-row-venda > td:last-child,
.vendas_linhaItem > td:last-child,
.item-row-lanc > td:last-child {
    position: relative;
}

/* Validação de estoque */
.carrinho-table tbody td input.estoque-invalido {
    border-color: #dc3545 !important;
    background-color: #fff5f5 !important;
}

.carrinho-table tbody td input.estoque-invalido:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.estoque-error-message {
    font-size: 0.75rem;
    color: #dc3545;
    margin-top: 0.25rem;
    display: block;
}

.btn-adicionar-item {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    border: 1px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-adicionar-item:hover {
    background: #f8f9ff;
    border-color: #5866d9;
    color: #5866d9;
}

@media (max-width: 768px) {
    .carrinho-table {
        font-size: 0.8125rem;
    }

    .carrinho-table thead th,
    .carrinho-table tbody td {
        padding: 0.5rem 0.25rem;
    }

    .carrinho-table thead th:first-child,
    .carrinho-table tbody td:first-child {
        padding-left: 0.5rem;
    }

    .carrinho-table thead th:last-child,
    .carrinho-table tbody td:last-child {
        padding-right: 0.5rem;
        padding-bottom: 2.5rem !important;
    }
}

/* REGRAS ESPECÍFICAS PARA CARRINHO - ALTA PRIORIDADE - FORÇAR LARGURAS */
.carrinho-card .carrinho-table {
    table-layout: fixed !important;
    width: 100% !important;
}

.carrinho-card .carrinho-table thead th:first-child {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

.carrinho-card .carrinho-table thead th:nth-child(2) {
    width: auto !important;
    min-width: 250px !important;
}

.carrinho-card .carrinho-table thead th:nth-child(3) {
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
}

.carrinho-card .carrinho-table thead th:nth-child(4) {
    width: 90px !important;
    min-width: 90px !important;
    max-width: 90px !important;
}

.carrinho-card .carrinho-table thead th:nth-child(5) {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

.carrinho-card .carrinho-table thead th:nth-child(6) {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
}

.carrinho-card .carrinho-table tbody td:first-child {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

.carrinho-card .carrinho-table tbody td:nth-child(2) {
    width: auto !important;
    min-width: 250px !important;
}

.carrinho-card .carrinho-table tbody td:nth-child(3) {
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
}

.carrinho-card .carrinho-table tbody td:nth-child(4) {
    width: 90px !important;
    min-width: 90px !important;
    max-width: 90px !important;
}

.carrinho-card .carrinho-table tbody td:nth-child(5) {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

.carrinho-card .carrinho-table tbody td:last-child {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
}

.carrinho-card .carrinho-table tfoot td:last-child,
.carrinho-card .carrinho-table tfoot th:last-child {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
}

/* Forçar largura nas células do tbody também */
.carrinho-card .carrinho-table tbody>tr>td {
    overflow: visible !important;
    text-overflow: ellipsis !important;
}

.carrinho-card .carrinho-table tbody>tr>td:last-child {
    overflow: visible !important;
}

/* Garantir que dropdowns apareçam corretamente */
.carrinho-card .carrinho-table tbody td .dropdown-menu {
    z-index: 1060 !important;
    position: absolute !important;
}

.carrinho-card .carrinho-table tbody td {
    position: relative !important;
    overflow: visible !important;
}

.carrinho-card .carrinho-table {
    overflow: visible !important;
}

.carrinho-card .card-body {
    overflow: visible !important;
}

/* Garantir que inputs não quebrem o layout */
.carrinho-card .carrinho-table tbody td input[type="text"],
.carrinho-card .carrinho-table tbody td input[type="number"] {
    max-width: 100% !important;
    min-width: 0 !important;
}

.carrinho-card .carrinho-table tbody td:last-child input {
    width: calc(100% - 2.5rem) !important;
    max-width: calc(150px - 2.5rem) !important;
}

/* ========== REGRAS FINAIS COM MÁXIMA PRIORIDADE - SOBRESCREVER TUDO ========== */
/* Forçar larguras fixas em todas as colunas usando IDs específicos */
.carrinho-card #tabela-itens-venda,
.carrinho-card #tabela-itens-compra,
.carrinho-card #tabela-itens-lanc {
    table-layout: fixed !important;
    width: 100% !important;
}

/* Coluna 1 - Tipo */
.carrinho-card #tabela-itens-venda th:nth-child(1),
.carrinho-card #tabela-itens-compra th:nth-child(1),
.carrinho-card #tabela-itens-lanc th:nth-child(1),
.carrinho-card #tabela-itens-venda td:nth-child(1),
.carrinho-card #tabela-itens-compra td:nth-child(1),
.carrinho-card #tabela-itens-lanc td:nth-child(1) {
    width: 140px !important;
    min-width: 140px !important;
    max-width: 140px !important;
}

/* Coluna 2 - Produto ou serviço */
.carrinho-card #tabela-itens-venda th:nth-child(2),
.carrinho-card #tabela-itens-compra th:nth-child(2),
.carrinho-card #tabela-itens-lanc th:nth-child(2),
.carrinho-card #tabela-itens-venda td:nth-child(2),
.carrinho-card #tabela-itens-compra td:nth-child(2),
.carrinho-card #tabela-itens-lanc td:nth-child(2) {
    width: auto !important;
    min-width: 230px !important;
}

/* Coluna 3 - Preço unitário */
.carrinho-card #tabela-itens-venda th:nth-child(3),
.carrinho-card #tabela-itens-compra th:nth-child(3),
.carrinho-card #tabela-itens-lanc th:nth-child(3),
.carrinho-card #tabela-itens-venda td:nth-child(3),
.carrinho-card #tabela-itens-compra td:nth-child(3),
.carrinho-card #tabela-itens-lanc td:nth-child(3) {
    width: 110px !important;
    min-width: 110px !important;
    max-width: 110px !important;
}

/* Coluna 4 - Quantidade */
.carrinho-card #tabela-itens-venda th:nth-child(4),
.carrinho-card #tabela-itens-compra th:nth-child(4),
.carrinho-card #tabela-itens-lanc th:nth-child(4),
.carrinho-card #tabela-itens-venda td:nth-child(4),
.carrinho-card #tabela-itens-compra td:nth-child(4),
.carrinho-card #tabela-itens-lanc td:nth-child(4) {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

/* Coluna 5 - Desconto */
.carrinho-card #tabela-itens-venda th:nth-child(5),
.carrinho-card #tabela-itens-compra th:nth-child(5),
.carrinho-card #tabela-itens-lanc th:nth-child(5),
.carrinho-card #tabela-itens-venda td:nth-child(5),
.carrinho-card #tabela-itens-compra td:nth-child(5),
.carrinho-card #tabela-itens-lanc td:nth-child(5) {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

/* Coluna 6 - Total */
.carrinho-card #tabela-itens-venda th:nth-child(6),
.carrinho-card #tabela-itens-compra th:nth-child(6),
.carrinho-card #tabela-itens-lanc th:nth-child(6),
.carrinho-card #tabela-itens-venda td:nth-child(6),
.carrinho-card #tabela-itens-compra td:nth-child(6),
.carrinho-card #tabela-itens-lanc td:nth-child(6),
.carrinho-card #tabela-itens-venda th:last-child,
.carrinho-card #tabela-itens-compra th:last-child,
.carrinho-card #tabela-itens-lanc th:last-child,
.carrinho-card #tabela-itens-venda td:last-child,
.carrinho-card #tabela-itens-compra td:last-child,
.carrinho-card #tabela-itens-lanc td:last-child {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
}

/* ============================================
   ESTILOS RESPONSIVOS PARA DASHBOARD
   ============================================ */

/* Container de conteúdo responsivo */
.conteudo-row {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    min-height: 0 !important;
    box-sizing: border-box !important;
}

/* Garantir que o container-fluid use todo o espaço disponível */
.conteudo .container-fluid {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
}

.conteudo-row {
    overflow-x: hidden !important;
    max-width: 100% !important;
}

/* Responsividade para cards do dashboard */
.conteudo-row .card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
}

/* Grid responsivo para os quadrinhos financeiros */
#quadrinhosFinanceiro,
#quadrinhosPrevistos {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
    display: block !important;
}

#quadrinhosFinanceiro .caixinha,
#quadrinhosPrevistos .caixinha {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

#quadrinhosFinanceiro>[class*="col-"],
#quadrinhosPrevistos>[class*="col-"] {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    box-sizing: border-box !important;
    max-width: 100% !important;
    width: 100% !important;
}

#quadrinhosFinanceiro .boxCaixinha,
#quadrinhosPrevistos .boxCaixinha {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Responsividade para formulários de filtro */
.conteudo-row .row.g-3 {
    margin-left: 0;
    margin-right: 0;
}

.conteudo-row .row.g-3>[class*="col-"] {
    padding-left: 10px;
    padding-right: 10px;
    margin-bottom: 15px;
}

/* Ajustes para telas pequenas */
@media (max-width: 768px) {
    .conteudo-row {
        padding-left: 0;
        padding-right: 0;
    }

    .conteudo .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }

    #quadrinhosFinanceiro .caixinha,
    #quadrinhosPrevistos .caixinha {
        flex: 1 1 100%;
        max-width: 100%;
        margin-bottom: 15px;
    }

    .conteudo-row .row.g-3>[class*="col-"] {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .conteudo-row .card-body .row>[class*="col-"] {
        margin-bottom: 15px;
    }
}

/* Ajustes para telas médias */
@media (min-width: 769px) and (max-width: 992px) {

    #quadrinhosFinanceiro .caixinha,
    #quadrinhosPrevistos .caixinha {
        flex: 1 1 50%;
        max-width: 50%;
    }

    .conteudo-row .row.g-3>[class*="col-md-3"] {
        flex: 1 1 50%;
        max-width: 50%;
    }
}

/* Ajustes para telas grandes */
@media (min-width: 993px) {

    #quadrinhosFinanceiro .caixinha,
    #quadrinhosPrevistos .caixinha {
        flex: 1 1 50%;
        max-width: 50%;
    }
}

/* Garantir que todas as rows dentro de conteudo-row sejam responsivas */
.conteudo-row .row {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.conteudo-row .row>[class*="col-"] {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    box-sizing: border-box !important;
    max-width: 100% !important;
}

/* Ajustes específicos para o card de resumo financeiro */
.conteudo-row .row.mt-4 .col-md-8,
.conteudo-row .row.mt-4 .col-md-6 {
    margin-bottom: 15px;
}

@media (max-width: 768px) {

    .conteudo-row .row.mt-4 .col-md-8,
    .conteudo-row .row.mt-4 .col-md-6 {
        flex: 1 1 100%;
        max-width: 100%;
    }
}

/* Garantir que o conteúdo preencha o espaço vertical disponível */
.conteudo .container-fluid {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.conteudo-row {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Scrollbar sempre visível conforme preferência do usuário */
.conteudo {
    overflow-y: auto;
}

.conteudo::-webkit-scrollbar {
    width: 8px;
    display: block;
}

.conteudo::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.conteudo::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

.conteudo::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

/* ===== GARANTIR VISIBILIDADE DOS TÍTULOS DOS CARDS ===== */
/* Regras globais para garantir que todos os títulos dos cards sejam visíveis e não transparentes */
.card-title,
.card-header .card-title,
h5.card-title,
h6.card-title {
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
    align-items: center !important;
}

/* Garantir que títulos em card-headers com cores específicas sejam visíveis */
.card-header.bg-warning .card-title,
.card-header.bg-warning .card-title.text-dark {
    color: #000000 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.card-header.bg-success .card-title,
.card-header.bg-danger .card-title,
.card-header.bg-info .card-title,
.card-header.bg-primary .card-title {
    color: #ffffff !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Garantir que títulos em card-headers padrão sejam visíveis */
.card-header .card-title {
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
    align-items: center !important;
}

/* Garantir que títulos dentro de conteudo-row sejam visíveis */
.conteudo-row .card-title,
.conteudo-row .card-header .card-title {
    opacity: 1 !important;
    visibility: visible !important;
    color: inherit !important;
}

/* ===== RESPONSIVIDADE COMPLETA - TODOS OS ELEMENTOS ===== */

/* Extra pequeno (xs) - até 480px */
@media (max-width: 480px) {

    /* Header responsivo */
    .modern-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
    }

    .header-container {
        height: 70px;
        padding: 0 12px;
        flex-wrap: wrap;
    }

    .logo-link {
        font-size: 14px;
    }

    .logo-link i {
        font-size: 18px;
        margin-right: 6px;
    }

    /* Sidebar responsivo */
    .sidebar {
        width: 60px;
        position: fixed;
        left: 0;
        top: 70px;
        height: calc(100vh - 70px);
        overflow-y: auto;
        z-index: 999;
    }

    .sidebar .nav-link {
        padding: 12px 8px;
        text-align: center;
        font-size: 11px;
    }

    .sidebar .nav-link i {
        font-size: 20px;
        margin-bottom: 4px;
        display: block;
    }

    .sidebar .nav-link span {
        display: none;
    }

    /* Conteúdo principal */
    .conteudo {
        margin-left: 60px;
        margin-top: 70px;
        padding: 12px;
    }

    /* Tabelas responsivas */
    .modern-table {
        font-size: 12px;
    }

    .modern-table thead {
        display: none;
    }

    .modern-table tbody tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        padding: 12px;
    }

    .modern-table tbody td {
        display: block;
        text-align: right;
        padding: 8px 0;
        border: none;
        position: relative;
        padding-left: 50%;
    }

    .modern-table tbody td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        font-weight: bold;
        width: 48%;
        text-align: left;
    }

    /* Painéis modernos */
    .modern-panel {
        border-radius: var(--radius-md);
        padding: 12px;
        margin-bottom: 12px;
    }

    .modern-panel-header {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 12px;
    }

    .modern-panel-title {
        font-size: 16px;
    }

    .modern-panel-actions {
        width: 100%;
    }

    .modern-panel-actions .btn {
        width: 100%;
        font-size: 12px;
        padding: 8px 12px;
    }

    /* Filtros responsivos */
    .modern-filters {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 12px;
    }

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

    .modern-filter-input,
    .modern-filter-label {
        width: 100%;
        font-size: 12px;
    }

    /* Cards responsivos */
    .card {
        margin-bottom: 12px;
        border-radius: var(--radius-md);
    }

    .card-body {
        padding: 12px;
    }

    .card-title {
        font-size: 14px;
        margin-bottom: 8px;
    }

    /* Botões responsivos */
    .btn {
        font-size: 12px;
        padding: 8px 12px;
        margin: 4px 2px;
    }

    .btn-sm {
        font-size: 11px;
        padding: 6px 10px;
    }

    /* Ícones responsivos */
    i {
        font-size: 16px;
    }

    i.fa-2x {
        font-size: 24px;
    }

    /* Inputs responsivos */
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        font-size: 14px;
        padding: 8px 10px;
        width: 100%;
        box-sizing: border-box;
    }

    /* Modais responsivos */
    .modal-content {
        border-radius: var(--radius-md);
    }

    .modal-header {
        padding: 12px;
    }

    .modal-body {
        padding: 12px;
        font-size: 13px;
    }

    .modal-footer {
        padding: 12px;
    }

    /* Paginação responsiva */
    .modern-pagination-info {
        font-size: 11px;
    }

    .modern-pagination-controls {
        gap: 4px;
    }

    .modern-pagination-btn {
        padding: 6px 8px;
        font-size: 12px;
    }

    /* Totais responsivos */
    .modern-totals {
        flex-direction: column;
        gap: 8px;
        font-size: 12px;
    }

    .modern-total-label {
        display: block;
        font-size: 11px;
    }

    .modern-total-value {
        display: block;
        font-size: 13px;
        font-weight: bold;
    }

    /* Badges responsivas */
    .modern-status-badge {
        font-size: 11px;
        padding: 4px 8px;
    }

    /* Ações em lote */
    .modern-batch-actions {
        flex-direction: column;
        gap: 8px;
        padding: 12px;
    }

    .modern-batch-info {
        font-size: 12px;
    }

    .modern-batch-btn {
        width: 100%;
        font-size: 12px;
        padding: 10px;
    }
}

/* Pequeno (sm) - 481px a 768px */
@media (min-width: 481px) and (max-width: 768px) {

    /* Header responsivo */
    .header-container {
        height: 80px;
        padding: 0 16px;
    }

    .logo-link {
        font-size: 16px;
    }

    /* Sidebar responsivo */
    .sidebar {
        width: 70px;
        top: 80px;
        height: calc(100vh - 80px);
    }

    .sidebar .nav-link {
        padding: 14px 10px;
        font-size: 12px;
    }

    .sidebar .nav-link i {
        font-size: 22px;
        margin-bottom: 6px;
    }

    /* Conteúdo principal */
    .conteudo {
        margin-left: 70px;
        margin-top: 80px;
        padding: 16px;
    }

    /* Tabelas responsivas */
    .modern-table {
        font-size: 13px;
    }

    .modern-table tbody tr {
        margin-bottom: 16px;
        padding: 16px;
    }

    .modern-table tbody td {
        padding: 10px 0;
        padding-left: 45%;
    }

    /* Painéis */
    .modern-panel {
        padding: 16px;
        margin-bottom: 16px;
    }

    .modern-panel-header {
        flex-direction: row;
        justify-content: space-between;
        margin-bottom: 16px;
    }

    .modern-panel-title {
        font-size: 18px;
    }

    /* Filtros */
    .modern-filters {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
        margin-bottom: 16px;
    }

    .modern-filter-group {
        flex: 1 1 calc(50% - 6px);
        min-width: 150px;
    }

    /* Botões */
    .btn {
        font-size: 13px;
        padding: 10px 14px;
    }

    /* Inputs */
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        font-size: 13px;
        padding: 10px 12px;
    }

    /* Cards */
    .card {
        margin-bottom: 16px;
    }

    .card-body {
        padding: 16px;
    }

    .card-title {
        font-size: 16px;
    }

    /* Totais */
    .modern-totals {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 16px;
        font-size: 13px;
    }

    /* Ações em lote */
    .modern-batch-actions {
        flex-direction: row;
        gap: 12px;
        padding: 16px;
    }

    .modern-batch-btn {
        flex: 1;
        font-size: 13px;
        padding: 12px;
    }
}

/* Médio (md) - 769px a 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
    .header-container {
        height: 85px;
        padding: 0 20px;
    }

    .sidebar {
        width: 80px;
        top: 85px;
        height: calc(100vh - 85px);
    }

    .sidebar .nav-link {
        padding: 16px 12px;
        font-size: 13px;
    }

    .conteudo {
        margin-left: 80px;
        margin-top: 85px;
        padding: 20px;
    }

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

    .modern-panel {
        padding: 20px;
        margin-bottom: 20px;
    }

    .modern-filters {
        gap: 16px;
    }

    .modern-filter-group {
        flex: 1 1 calc(50% - 8px);
    }

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

    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        font-size: 14px;
        padding: 11px 14px;
    }

    .card {
        margin-bottom: 20px;
    }

    .card-body {
        padding: 20px;
    }

    .card-title {
        font-size: 17px;
    }
}

/* Grande (lg) - 1025px a 1440px */
@media (min-width: 1025px) and (max-width: 1440px) {
    .header-container {
        height: 90px;
        padding: 0 24px;
    }

    .sidebar {
        width: 90px;
        top: 90px;
        height: calc(100vh - 90px);
    }

    .sidebar .nav-link {
        padding: 18px 14px;
        font-size: 14px;
    }

    .conteudo {
        margin-left: 90px;
        margin-top: 90px;
        padding: 24px;
    }

    .modern-table {
        font-size: 15px;
    }

    .modern-panel {
        padding: 24px;
        margin-bottom: 24px;
    }

    .modern-filters {
        gap: 18px;
    }

    .modern-filter-group {
        flex: 1 1 calc(33.333% - 12px);
    }

    .btn {
        font-size: 15px;
        padding: 12px 18px;
    }

    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        font-size: 15px;
        padding: 12px 16px;
    }

    .card {
        margin-bottom: 24px;
    }

    .card-body {
        padding: 24px;
    }

    .card-title {
        font-size: 18px;
    }
}

/* Extra grande (xl) - acima de 1441px */
@media (min-width: 1441px) {
    .header-container {
        height: 95px;
        padding: 0 28px;
    }

    .sidebar {
        width: 100px;
        top: 95px;
        height: calc(100vh - 95px);
    }

    .sidebar .nav-link {
        padding: 20px 16px;
        font-size: 15px;
    }

    .conteudo {
        margin-left: 100px;
        margin-top: 95px;
        padding: 28px;
    }

    .modern-table {
        font-size: 16px;
    }

    .modern-panel {
        padding: 28px;
        margin-bottom: 28px;
    }

    .modern-filters {
        gap: 20px;
    }

    .modern-filter-group {
        flex: 1 1 calc(25% - 15px);
    }

    .btn {
        font-size: 16px;
        padding: 13px 20px;
    }

    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px;
        padding: 13px 18px;
    }

    .card {
        margin-bottom: 28px;
    }

    .card-body {
        padding: 28px;
    }

    .card-title {
        font-size: 19px;
    }
}

/* ===== RESPONSIVIDADE PARA ELEMENTOS ESPECÍFICOS ===== */

/* Tabelas com scroll horizontal em telas pequenas */
@media (max-width: 768px) {
    .modern-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modern-table {
        min-width: 100%;
    }

    /* Checkbox responsivo */
    .modern-checkbox {
        width: 18px;
        height: 18px;
        cursor: pointer;
    }

    /* Ícones de ação responsivos */
    .modern-action-btn {
        padding: 6px;
        font-size: 14px;
    }

    .modern-action-btn i {
        font-size: 14px;
    }
}

/* Imagens responsivas */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

.img-thumbnail {
    max-width: 100%;
    height: auto;
}

/* Listas responsivas */
ul,
ol {
    padding-left: 20px;
}

@media (max-width: 480px) {

    ul,
    ol {
        padding-left: 16px;
    }
}

/* Espaçamento responsivo */
@media (max-width: 480px) {

    .mt-3,
    .mt-md-3 {
        margin-top: 8px !important;
    }

    .mb-3,
    .mb-md-3 {
        margin-bottom: 8px !important;
    }

    .p-3,
    .p-md-3 {
        padding: 8px !important;
    }
}

@media (min-width: 481px) and (max-width: 768px) {

    .mt-3,
    .mt-md-3 {
        margin-top: 12px !important;
    }

    .mb-3,
    .mb-md-3 {
        margin-bottom: 12px !important;
    }

    .p-3,
    .p-md-3 {
        padding: 12px !important;
    }
}

@media (min-width: 769px) {

    .mt-3,
    .mt-md-3 {
        margin-top: 16px !important;
    }

    .mb-3,
    .mb-md-3 {
        margin-bottom: 16px !important;
    }

    .p-3,
    .p-md-3 {
        padding: 16px !important;
    }
}

/* Visibilidade responsiva */
@media (max-width: 768px) {
    .d-none-mobile {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .d-none-desktop {
        display: none !important;
    }
}

/* Flexibilidade de layout */
.flex-responsive {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

@media (max-width: 480px) {
    .flex-responsive>* {
        flex: 1 1 100%;
        min-width: 0;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .flex-responsive>* {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
    }
}

@media (min-width: 769px) {
    .flex-responsive>* {
        flex: 1 1 calc(33.333% - 8px);
        min-width: 0;
    }
}

/* Garantir que elementos não saiam da tela */
* {
    box-sizing: border-box;
}

body,
html {
    width: 100%;
    overflow-x: hidden;
}

.conteudo {
    width: 100%;
    overflow-x: hidden;
}

/* Prevenir overflow horizontal */
@media (max-width: 768px) {

    .modern-panel,
    .card,
    .modern-table-container {
        max-width: 100vw;
        overflow-x: hidden;
    }
}

/* ============================================
   ESTILOS MODERNOS PARA PAINÉIS - DESIGN ATUALIZADO
   ============================================ */

/* Cabeçalho Azul Escuro dos Painéis */
.modern-panel-header {
    background: #2c5282 !important;
    color: white !important;
    padding: 16px 24px !important;
    border-radius: 8px 8px 0 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.modern-panel-title {
    color: white !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.modern-panel-title i {
    font-size: 20px !important;
}

.modern-panel-actions {
    display: flex !important;
    gap: 10px !important;
}

.modern-panel-actions .btn {
    font-size: 14px !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    font-weight: 500 !important;
}

/* Área de Filtros com Fundo Cinza Claro */
.modern-filters {
    background: #f7fafc !important;
    padding: 16px 24px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    align-items: flex-end !important;
}

.modern-filter-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
}

.modern-filter-label {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #4a5568 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.modern-filter-input {
    padding: 8px 12px !important;
    border: 1px solid #cbd5e0 !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    background: white !important;
    transition: all 0.2s ease !important;
    min-width: 150px !important;
}

.modern-filter-input:focus {
    outline: none !important;
    border-color: #2c5282 !important;
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1) !important;
}

/* Seção de Busca */
.search-section {
    padding: 16px 24px !important;
    background: white !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

.search-input-group {
    display: flex !important;
    gap: 8px !important;
    max-width: 600px !important;
}

.search-input {
    flex: 1 !important;
    padding: 10px 16px !important;
    border: 1px solid #cbd5e0 !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    transition: all 0.2s ease !important;
}

.search-input:focus {
    outline: none !important;
    border-color: #2c5282 !important;
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1) !important;
}

.search-btn {
    padding: 10px 20px !important;
    background: #2c5282 !important;
    color: white !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.search-btn:hover {
    background: #1e3a5f !important;
}

/* Controles de Paginação */
.modern-panel-controls {
    padding: 12px 24px !important;
    background: white !important;
    border-bottom: 1px solid #e2e8f0 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

.modern-pagination-info {
    font-size: 13px !important;
    color: #718096 !important;
}

.modern-pagination-controls {
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
}

.modern-pagination-btn {
    padding: 6px 12px !important;
    background: white !important;
    border: 1px solid #cbd5e0 !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    color: #4a5568 !important;
}

.modern-pagination-btn:hover {
    background: #f7fafc !important;
    border-color: #2c5282 !important;
}

.modern-page-selector {
    padding: 6px 12px !important;
    font-weight: 600 !important;
    color: #2c5282 !important;
}

/* Tabela Moderna */
.modern-table-container {
    background: white !important;
    overflow-x: auto !important;
}

.modern-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 14px !important;
}

.modern-table thead {
    background: #f7fafc !important;
    border-bottom: 2px solid #e2e8f0 !important;
}

.modern-table th {
    padding: 12px 16px !important;
    text-align: left !important;
    font-weight: 600 !important;
    color: #2d3748 !important;
    font-size: 13px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.modern-table tbody tr {
    border-bottom: 1px solid #e2e8f0 !important;
    transition: all 0.2s ease !important;
}

.modern-table tbody tr:hover {
    background: #f7fafc !important;
}

.modern-table td {
    padding: 14px 16px !important;
    color: #4a5568 !important;
}

/* Colunas específicas */
.modern-checkbox-col {
    width: 40px !important;
    text-align: center !important;
}

.modern-date-col {
    width: 100px !important;
    white-space: nowrap !important;
}

.modern-data-col {
    max-width: 200px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.modern-value-col {
    width: 120px !important;
    text-align: right !important;
    font-weight: 600 !important;
}

.modern-value-col.positive {
    color: #48bb78 !important;
}

.modern-value-col.negative {
    color: #f56565 !important;
}

.modern-status-col {
    width: 120px !important;
    text-align: center !important;
}

.modern-actions-col {
    width: 140px !important;
    text-align: center !important;
}

/* Badges de Status */
.modern-status-badge {
    padding: 6px 12px !important;
    border-radius: 12px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    display: inline-block !important;
}

.modern-status-badge.completed {
    background: #c6f6d5 !important;
    color: #22543d !important;
}

.modern-status-badge.pending {
    background: #fef5e7 !important;
    color: #975a16 !important;
}

.modern-status-badge.overdue {
    background: #fed7d7 !important;
    color: #742a2a !important;
}

.modern-status-badge.scheduled {
    background: #bee3f8 !important;
    color: #2c5282 !important;
}

/* Botões de Ação */
.modern-action-btn {
    padding: 6px 10px !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    margin: 0 2px !important;
    font-size: 14px !important;
}

.modern-action-btn.edit {
    background: #bee3f8 !important;
    color: #2c5282 !important;
}

.modern-action-btn.edit:hover {
    background: #90cdf4 !important;
}

.modern-action-btn.delete {
    background: #fed7d7 !important;
    color: #c53030 !important;
}

.modern-action-btn.delete:hover {
    background: #fc8181 !important;
}

.modern-action-btn.check {
    background: #c6f6d5 !important;
    color: #22543d !important;
}

.modern-action-btn.check:hover {
    background: #9ae6b4 !important;
}

.modern-action-btn.times {
    background: #fef5e7 !important;
    color: #975a16 !important;
}

.modern-action-btn.times:hover {
    background: #fbd38d !important;
}

/* Rodapé Azul Escuro */
.modern-panel-footer {
    background: #2c5282 !important;
    color: white !important;
    padding: 20px 24px !important;
    border-radius: 0 0 8px 8px !important;
}

.modern-totals {
    display: flex !important;
    justify-content: space-around !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 20px !important;
}

.modern-total-label {
    font-size: 12px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    opacity: 0.9 !important;
    display: block !important;
    margin-bottom: 4px !important;
}

.modern-total-value {
    font-size: 20px !important;
    font-weight: 700 !important;
    color: white !important;
}

.modern-total-value.positive {
    color: #9ae6b4 !important;
}

.modern-total-value.negative {
    color: #fc8181 !important;
}

/* Checkbox Moderno */
.modern-checkbox {
    width: 18px !important;
    height: 18px !important;
    cursor: pointer !important;
    border-radius: 4px !important;
}

/* Responsividade */
@media (max-width: 768px) {
    .modern-panel-header {
        flex-direction: column !important;
        gap: 12px !important;
        align-items: flex-start !important;
    }

    .modern-filters {
        flex-direction: column !important;
    }

    .modern-filter-input {
        width: 100% !important;
    }

    .modern-totals {
        flex-direction: column !important;
        gap: 16px !important;
    }
}

/* ===== FIX: CONCILIAÇÃO BANCÁRIA GRID LAYOUT =====
   The generic .conteudo-row .row rule was removing Bootstrap's negative margins
   (used for gutter alignment), pushing the OFX panel grid off-screen to x~1973px.
   This block restores proper Bootstrap grid behavior for the side-by-side panels. */
.conteudo-row .row.g-4 {
    margin-left: calc(-0.5 * var(--bs-gutter-x, 1.5rem)) !important;
    margin-right: calc(-0.5 * var(--bs-gutter-x, 1.5rem)) !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Restore proper column widths — do NOT force 100% on OFX panel columns */
.conteudo-row .row.g-4>.col-lg-6 {
    max-width: 50% !important;
    flex: 0 0 50% !important;
    padding-left: calc(0.5 * var(--bs-gutter-x, 1.5rem)) !important;
    padding-right: calc(0.5 * var(--bs-gutter-x, 1.5rem)) !important;
}

@media (max-width: 991px) {

    /* On small screens, stack columns full width */
    .conteudo-row .row.g-4>.col-lg-6 {
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
}

/* ============================================================
   RESET DA ULTIMA COLUNA: tabelas com classe .tabela-livre
   ============================================================
   Sobrescreve todas as regras globais que assumem que a ultima
   coluna eh de Acoes (sticky, width fixo, text-align center, etc).
   Use em tabelas onde a ultima coluna eh DADO (input, valor, status,
   codigo, descricao, etc) para preencher edge-to-edge no card.
   ============================================================ */
.table.tabela-livre th:last-child,
.table.tabela-livre td:last-child {
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
    text-align: inherit !important;
    white-space: normal !important;
    position: static !important;
    right: auto !important;
    background: transparent !important;
    background-color: transparent !important;
    color: inherit !important;
    z-index: auto !important;
    border-left: 0 !important;
    box-shadow: none !important;
    display: table-cell !important;
}

.table.tabela-livre thead th:last-child {
    background-color: inherit !important;
}

.table.tabela-livre tbody tr:hover td:last-child,
.table.tabela-livre.table-hover tbody tr:hover td:last-child {
    background: transparent !important;
    background-color: transparent !important;
    border-left: 0 !important;
}

.table.tabela-livre.table-striped tbody tr:nth-child(odd) td:last-child,
.table.tabela-livre.table-striped tbody tr:nth-of-type(odd) td:last-child {
    background-color: transparent !important;
}

.table.tabela-livre.table-striped tbody tr:nth-child(even) td:last-child,
.table.tabela-livre.table-striped tbody tr:nth-of-type(even) td:last-child {
    background-color: rgba(0, 0, 0, 0.025) !important;
}

/* Garante que a tabela ocupa 100% do card e que a celula com input
   permita o input form-control crescer pra largura toda */
.table.tabela-livre {
    width: 100% !important;
    table-layout: auto !important;
}

.table.tabela-livre td .form-control,
.table.tabela-livre td .form-select,
.table.tabela-livre th .form-control,
.table.tabela-livre th .form-select {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
}