:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #dbeafe;
    --accent: #3b82f6;
    --sidebar-bg: #0f172a;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --bg: #f1f5f9;
    --surface: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.10);

    --bs-success: #2563eb;
    --bs-success-rgb: 37, 99, 235;
    --bs-success-text-emphasis: #1e40af;
    --bs-success-bg-subtle: #dbeafe;
    --bs-success-border-subtle: #93c5fd;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 0.875rem;
}

/* ====== Layout ====== */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: #cbd5e1;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.35);
}

.brand-name {
    font-weight: 700;
    color: #fff;
    font-size: 0.95rem;
    letter-spacing: 0.2px;
}

.brand-sub {
    font-size: 0.64rem;
    color: #94a3b8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar .menu-label {
    padding: 14px 16px 5px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #64748b;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    margin: 2px 8px;
    border-radius: 8px;
    color: #cbd5e1;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.sidebar .nav-link i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
    transform: translateX(2px);
}

.sidebar .nav-link.active {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.sidebar .nav-item {
    width: 100%;
}

.sidebar .submenu-toggle span {
    flex: 1;
}

.sidebar .submenu-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.sidebar .submenu-toggle[aria-expanded="true"] .submenu-arrow {
    transform: rotate(180deg);
}

.sidebar .submenu-link {
    margin-left: 14px;
    margin-right: 4px;
    padding-left: 14px;
    font-size: 0.8rem;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 8px 8px 0;
}

.sidebar .submenu-link:hover {
    border-left-color: #2563eb;
}

.sidebar .submenu-link.active {
    background: rgba(37, 99, 235, 0.16);
    color: var(--primary-soft);
    border-left-color: var(--accent);
    box-shadow: none;
}

.sidebar .sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    font-size: 0.7rem;
    color: #64748b;
    margin-top: auto;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar .topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
}

.page-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
}

.topbar .user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 50px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 0.85rem;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.72rem;
}

.app-content {
    padding: 20px 24px;
    flex: 1;
}

@media (max-width: 991.98px) {
    .sidebar-static { display: none; }
    .app-content { padding: 16px 12px; }
}

/* ====== Telas pequenas (celulares) ====== */
@media (max-width: 575.98px) {
    .topbar .topbar-inner { padding: 8px 12px; }
    .topbar .user-chip .fw-semibold { display: none; }
    .page-title {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 50vw;
        font-size: 0.95rem;
    }
    .app-content h1 { font-size: 1.15rem; }

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

    /* Abas (relatórios etc.): quebram em várias linhas no celular para nenhuma aba
       ficar escondida fora da tela (rolar na horizontal escondia Produtos ABC e Notas) */
    .nav-tabs { flex-wrap: wrap; }
    .nav-tabs .nav-item { white-space: nowrap; }

    /* Cards de estatísticas da home: empilham no celular (ícone em cima, número abaixo)
       para o valor caber em uma linha sem estourar nem quebrar feio.
       !important porque os utilitários .align-items-center/.gap-3 do Bootstrap usam !important */
    .stat-card {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }
    .stat-card > div:last-child { width: 100%; }

    /* Valores dos cards da home cabem na largura do celular */
    .stat-card .stat-value { font-size: 1.05rem !important; }
    .stat-card .stat-icon { width: 38px; height: 38px; font-size: 1rem; }
}

/* ====== Tablets e celulares (listagens ficam utilizáveis) ====== */
@media (max-width: 767.98px) {
    /* Botões de ação dos cabeçalhos das páginas dividem a largura */
    .app-content .d-flex.gap-2 .btn { flex: 1 1 auto; }
    /* Linhas de botões (ex.: filtros dos relatórios) quebram em vez de espremer */
    .app-content .d-flex.gap-2 { flex-wrap: wrap; }

    /* DataTables: busca ocupa a largura toda e paginação com alvo de toque maior */
    .dataTables_wrapper .dataTables_filter { width: 100%; margin-bottom: 8px; }
    .dataTables_wrapper .dataTables_filter label {
        display: flex;
        align-items: center;
        gap: 6px;
        width: 100%;
    }
    .dataTables_wrapper .dataTables_filter input {
        flex: 1;
        min-width: 0;
        width: 100%;
        margin-left: 0;
    }
    .dataTables_wrapper .dataTables_paginate .page-link {
        padding: 6px 12px;
        min-width: 34px;
    }

    /* Botões de ação das linhas maiores para toque */
    .btn-ico { width: 36px; height: 36px; }

    /* Menos respiro nas bordas dos cards */
    .card-body { padding: 0.9rem; }

    /* Células DataTables com mais respiro: no celular as colunas de menor
       prioridade colapsam (child row) e as que ficam ganham fôlego */
    .table-responsive table.dataTable thead th,
    .table-responsive table.dataTable tbody td {
        padding: 0.75rem 0.85rem;
    }
    .table-responsive table.dataTable thead th { font-size: 0.72rem; }
    .dataTables_info { padding-top: 10px; }

    /* Dropdown do usuário nunca estoura a tela */
    .dropdown-menu { max-width: calc(100vw - 24px); }
    .dropdown-menu .dropdown-item { white-space: normal; }

    /* Tabelas estáticas (não-DataTables) viram cards empilhados: cada célula
       vira uma linha com o rótulo da coluna à esquerda (data-label injetado
       pelo app.js) e o valor à direita. DataTables Responsive cuida das listagens. */
    .table-responsive table.table:not(.dataTable) {
        display: block;
        width: 100%;
    }
    .table-responsive table.table:not(.dataTable) > thead { display: none; }
    .table-responsive table.table:not(.dataTable) > tbody {
        display: block;
        width: 100%;
    }
    .table-responsive table.table:not(.dataTable) > tbody > tr {
        display: block;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--surface);
        padding: 4px 6px;
        margin-bottom: 10px;
    }
    .table-responsive table.table:not(.dataTable) > tbody > tr > td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        border: none;
        padding: 7px 10px;
        text-align: right;
    }
    .table-responsive table.table:not(.dataTable) > tbody > tr > td::before {
        content: attr(data-label);
        font-size: 0.68rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        color: var(--muted);
        flex-shrink: 0;
        text-align: left;
    }
    /* Linha de "nenhum registro" ocupa a largura toda, sem rótulo */
    .table-responsive table.table:not(.dataTable) td[colspan] {
        display: block;
        text-align: center;
    }
    .table-responsive table.table:not(.dataTable) td[colspan]::before { content: none; }

    /* Tabelas DataTables vazias não têm linhas para rolar: sem barra horizontal
       e a mensagem de "nenhum registro" fica centralizada, sem estourar o card */
    .table-responsive:has(table.dataTable td.dataTables_empty) {
        overflow-x: hidden;
    }
    .table-responsive table.dataTable tbody td.dataTables_empty {
        white-space: normal;
    }

    /* No mobile, células DataTables quebram tokens longos (CNPJ, números)
       para a tabela caber no card sem barra de rolagem */
    .table-responsive table.dataTable thead th,
    .table-responsive table.dataTable tbody td {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    /* Paginação do DataTables quebra linha em vez de estourar o card */
    .table-responsive .dataTables_wrapper .row {
        margin-left: 0;
        margin-right: 0;
    }
    .table-responsive .dataTables_wrapper .row > [class*="col-"] {
        padding-left: 0;
        padding-right: 0;
    }
    .table-responsive .dataTables_paginate {
        float: none;
    }
    .table-responsive .dataTables_paginate ul.pagination {
        display: flex;
        flex-wrap: wrap;
        margin-bottom: 0;
    }
}

/* ====== Cards ====== */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.stat-card {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    background: var(--surface);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    /* Preenche a coluna do grid: cards da mesma linha com altura uniforme,
       mesmo quando um rótulo quebra em 2 linhas (ex.: "Movimentações no mês") */
    height: 100%;
}

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

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #fff;
    flex-shrink: 0;
    line-height: 1;
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: #fff;
}

.stat-card > div:last-child {
    min-width: 0;
}

.stat-card .stat-value {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.1;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.stat-card .stat-label {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 500;
}

.bg-grad-blue { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.bg-grad-cyan { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
.bg-grad-indigo { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.bg-grad-slate { background: linear-gradient(135deg, #475569, #334155); }

/* ====== Botões ====== */
.btn { border-radius: var(--radius-sm); font-weight: 600; }
.btn-sm { border-radius: 6px; }
.btn-success {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border: none;
}
.btn-success:hover { background: linear-gradient(135deg, #1d4ed8, #1e40af); }
.btn-outline-success { --bs-btn-color: var(--primary-dark); --bs-btn-border-color: #93c5fd; }
.btn-outline-success:hover { background: var(--primary); border-color: var(--primary); }

/* Painel administrativo (dev): azul-escuro/navy para leitura confortável */
.btn-admin {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: none;
    color: #fff;
}
.btn-admin:hover {
    background: linear-gradient(135deg, #0f172a, #020617);
    color: #fff;
}

/* ====== Tabelas / DataTables ====== */
.table thead th {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 700;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.table tbody tr { transition: background 0.1s ease; }

/* Substitui o preto do Bootstrap (table-dark / bg-dark) pelas cores da paleta */
.table-dark {
    --bs-table-color: #334155;
    --bs-table-bg: #f8fafc;
    --bs-table-border-color: var(--border);
    --bs-table-hover-color: #334155;
    --bs-table-hover-bg: #f1f5f9;
}

.bg-dark {
    background-color: #0f172a !important;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    font-size: 0.8rem;
    color: var(--muted);
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    margin-left: 6px;
}

.dataTables_wrapper .dataTables_paginate .pagination {
    gap: 4px;
    margin: 0;
}

.dataTables_wrapper .dataTables_paginate .page-item {
    margin: 0;
}

.dataTables_wrapper .dataTables_paginate .page-link {
    border: 1px solid var(--border);
    border-radius: 6px !important;
    padding: 3px 9px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text);
    background: var(--surface);
    min-width: 28px;
    text-align: center;
    box-shadow: none;
    transition: all 0.15s ease;
}

.dataTables_wrapper .dataTables_paginate .page-link:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}

.dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link {
    background: #f8fafc;
    border-color: var(--border);
    color: #cbd5e1;
    opacity: 1;
}

.badge { border-radius: 50px; font-weight: 600; padding: 4px 8px; }

/* ====== Botões de ação em ícone ====== */
.btn-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--muted);
    transition: all 0.15s ease;
    font-size: 0.9rem;
    line-height: 1;
    vertical-align: middle;
}

.btn-ico:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

.btn-ico-info:hover {
    background: #e0f2fe;
    border-color: #7dd3fc;
    color: #0369a1;
}

.btn-ico-success:hover {
    background: var(--primary-soft);
    border-color: #93c5fd;
    color: var(--primary-dark);
}

.btn-ico-pdf:hover {
    background: #fce7f3;
    border-color: #f9a8d4;
    color: #be185d;
}

.btn-ico-danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #b91c1c;
}

/* ====== Login ====== */
.login-body {
    min-height: 100vh;
}

.login-wrap {
    display: flex;
    min-height: 100vh;
}

.login-brand {
    flex: 0 0 42%;
    background:
        radial-gradient(800px 500px at 0% 0%, rgba(37, 99, 235, 0.25), transparent 55%),
        linear-gradient(165deg, #0f172a 0%, #172554 100%);
    color: #cbd5e1;
    padding: 44px 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
}

.login-brand .brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-brand-copy h2 {
    color: #fff;
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 14px;
}

.login-brand-copy p {
    color: #94a3b8;
    font-size: 0.92rem;
    max-width: 360px;
    margin: 0;
}

.login-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 16px;
}

.login-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #e2e8f0;
    font-size: 0.92rem;
    font-weight: 500;
}

.login-features i {
    font-size: 1.15rem;
    color: #60a5fa;
}

.login-form-side {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: #f8fafc;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 36px 32px;
}

.login-card h4 {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 0.2px;
}

.login-card .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.login-card .form-control {
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-size: 0.9rem;
    border: 1px solid var(--border);
}

.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.login-card .btn-success {
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.22);
}

.login-card--wide {
    max-width: 460px;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
}

/* Itens de seleção de empresa */
.empresa-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.empresa-item:hover {
    border-color: #93c5fd;
    background: var(--primary-soft);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.10);
}

.empresa-item .empresa-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    font-size: 1.05rem;
}

.empresa-item .empresa-icon-admin {
    background: linear-gradient(135deg, #475569, #1e293b);
}

.empresa-item .empresa-nome {
    display: block;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text);
}

.empresa-item .empresa-cnpj {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
}

.empresa-item > i {
    color: #94a3b8;
    transition: color 0.15s ease, transform 0.15s ease;
}

.empresa-item:hover > i {
    color: var(--primary);
    transform: translateX(2px);
}

.empresa-item-admin:hover {
    border-color: #94a3b8;
    background: #f1f5f9;
}

@media (max-width: 991.98px) {
    .login-brand { display: none; }
    .login-form-side { padding: 24px 16px; }
}

.login-credits {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    white-space: nowrap;
    font-size: 0.72rem;
    color: #94a3b8;
}

/* ====== Dropzone ====== */
.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius);
    background: #f8fafc;
    transition: all 0.2s ease;
    cursor: pointer;
    padding: 28px 16px;
    text-align: center;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.dropzone .dz-icon {
    font-size: 2.2rem;
    color: var(--primary);
}

/* ====== Detalhe venda ====== */
.info-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

.info-box .info-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
    font-weight: 600;
}

.info-box .info-value {
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 2px;
    word-break: break-all;
}

/* ====== Links ====== */
a { text-decoration: none; }

/* ====== Tipografia interna ====== */
.app-content h1 { font-size: 1.35rem; }
.app-content h2 { font-size: 1.2rem; }
.app-content h3 { font-size: 1.1rem; }
.app-content h4 { font-size: 1rem; }

/* ====== Utilitários ====== */
.text-muted { color: var(--muted) !important; }

/* Identidade corporativa: o "success" do Bootstrap assume o azul da marca
   (as views usam text-success/bg-success-subtle em ícones, valores e badges) */
.text-success { color: var(--primary) !important; }
.bg-success-subtle { background-color: var(--primary-soft) !important; }

/* ====== Polish / refinamentos ====== */
::selection { background: #bfdbfe; color: #1e3a8a; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.app-content .card,
.app-content .stat-card,
.app-content .dropzone {
    animation: fadeUp 0.28s ease both;
}

.login-card { animation: fadeUp 0.35s ease both; }

/* Formulários: foco sutil azul em todo o sistema */
.form-control:focus,
.form-select:focus,
.form-check-input:focus,
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn:focus-visible,
.btn-ico:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

/* Labels levemente mais definidos */
.form-label { color: #334155; }

/* Scrollbar fina na sidebar */
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: #475569; }

/* Hover de linha em tabelas */
.table-hover tbody tr:hover { background-color: #f8fafc; }

/* Card header com fundo suave */
.card-header { background: #f8fafc; }

/* Dropdown refinado */
.dropdown-menu {
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}
.dropdown-menu .dropdown-item { border-radius: 8px; }
.dropdown-menu .dropdown-item:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

/* ====== Menu mobile (offcanvas) ======
   O offcanvas não carrega a classe .sidebar, então os itens do menu
   herdam o nav-link padrão do Bootstrap. Estilo dedicado com alvos de
   toque maiores e respiro entre os itens. */
.sidebar-mobile .offcanvas-header {
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.sidebar-mobile .offcanvas-body { padding: 8px 0 16px; }

.sidebar-mobile .menu-label {
    padding: 20px 20px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #64748b;
}

.sidebar-mobile .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    margin: 3px 10px;
    border-radius: 10px;
    color: #cbd5e1;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.15s ease;
}

.sidebar-mobile .nav-link i {
    font-size: 1.05rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-mobile .nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.sidebar-mobile .nav-link.active {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.sidebar-mobile .submenu-toggle span { flex: 1; }
.sidebar-mobile .submenu-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}
.sidebar-mobile .submenu-toggle[aria-expanded="true"] .submenu-arrow {
    transform: rotate(180deg);
}

.sidebar-mobile .submenu-link {
    margin-left: 20px;
    margin-right: 6px;
    padding-left: 16px;
    font-size: 0.9rem;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 10px 10px 0;
}

.sidebar-mobile .submenu-link:hover {
    border-left-color: #2563eb;
}

.sidebar-mobile .submenu-link.active {
    background: rgba(37, 99, 235, 0.16);
    color: var(--primary-soft);
    border-left-color: var(--accent);
    box-shadow: none;
}

/* ====== Impressão (relatórios) ====== */
@media print {
    body {
        background: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Fora do conteúdo: sidebar, topbar, offcanvas, filtros, controles da tabela */
    .sidebar, .topbar, .sidebar-mobile, .offcanvas, .offcanvas-backdrop,
    form, .nav-tabs, .dtr-details, tr.child, .dataTables_filter,
    .dataTables_length, .dataTables_info, .dataTables_paginate,
    .dataTables_processing, .btn { display: none !important; }

    .app-main, .app-content { padding: 0 !important; margin: 0 !important; max-width: 100% !important; }
    .app-content { display: block !important; }

    .card {
        box-shadow: none !important;
        border: 1px solid #d1d5db !important;
        break-inside: avoid;
    }
    .card-header {
        background: #fff !important;
        color: #111 !important;
        border-bottom: 1px solid #d1d5db !important;
    }

    /* Tabelas: largura total, todas as colunas visíveis (reverte o Responsive) */
    .table-responsive { overflow: visible !important; }
    table.dataTable { width: 100% !important; }
    table.dataTable th, table.dataTable td {
        display: table-cell !important;
        white-space: normal !important;
    }
    table.dataTable td.dtr-control::before { content: none !important; }
    table.dataTable thead th { background: #f1f5f9 !important; color: #111 !important; }

    tr { break-inside: avoid; }
}
