/* ==========================================================================
   RootCode Design System — sobrescreve o Bootstrap 5.3 (data-bs-theme)
   Paleta oficial: Azul Elétrico #0049FF · Azul Meia-Noite #001240 · Ciano Claro #E8FAFF
   Tema escuro: cores derivadas (não constam no manual da marca).
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
    --rc-primary: #0049ff;
    --rc-primary-hover: #0041ff;
    --rc-primary-active: #0036cc;
    --rc-primary-rgb: 0, 73, 255;
    --rc-navy: #001240;
    --rc-cyan-50: #e8faff;
    --rc-gradient: linear-gradient(135deg, #0049ff 0%, #001240 100%);

    /* neutros slate: títulos > corpo > label (evita preto/azul puro) */
    --rc-bg: #f8fafc;
    --rc-surface: #ffffff;
    --rc-surface-2: #f1f5f9;
    --rc-border: #e2e8f0;
    --rc-text: #0f172a;
    --rc-body: #475569;
    --rc-muted: #64748b;
    --rc-label: #94a3b8;
    --rc-link: #0049ff;
    --rc-hover-row: #f8fafc;

    /* escala de espaçamento (múltiplos de 4px) e tipografia compacta */
    --rc-sp-1: .25rem; --rc-sp-2: .5rem; --rc-sp-3: .75rem; --rc-sp-4: 1rem; --rc-sp-5: 1.25rem;
    --rc-fs-h1: 1.375rem; --rc-fs-h2: .9375rem; --rc-fs-body: .8125rem; --rc-fs-label: .6875rem;
    --rc-control-h: 32px;      /* botões e campos padrão, inclusive cabeçalho de página */
    --rc-action-h: 28px;       /* botões pequenos e ações de linha/cartão */
    --rc-action-icon: 1rem;    /* ícone das ações de linha */

    --rc-success: #087a4f;
    --rc-danger: #d6304a;
    --rc-warning: #946000;
    --rc-info: #0a7c99;

    --rc-shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
    --rc-shadow: 0 2px 8px rgba(15, 23, 42, .06);
    --rc-shadow-lg: 0 8px 28px rgba(15, 23, 42, .14);
    --rc-radius: 8px;
    --rc-radius-lg: 10px;

    --rc-sidebar-bg: #001240;
    --rc-sidebar-text: #b8c6ea;
    --rc-sidebar-muted: #6f82b3;
    --rc-sidebar-width: 232px;
    --rc-topbar-h: 52px;

    /* paleta categórica dos gráficos (derivada da marca) */
    --rc-chart-1: #0049ff;
    --rc-chart-2: #00b8d9;
    --rc-chart-3: #7c3aed;
    --rc-chart-4: #f59e0b;
    --rc-chart-5: #10b981;
    --rc-chart-6: #ef4444;
    --rc-chart-7: #ec4899;
    --rc-chart-8: #64748b;
    --rc-chart-grid: #e6eefb;

    /* ponte para o Bootstrap */
    --bs-font-sans-serif: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --bs-body-font-family: var(--bs-font-sans-serif);
    --bs-body-font-size: .8125rem;
    --bs-body-color: var(--rc-body);
    --bs-body-color-rgb: 71, 85, 105;
    --bs-body-bg: var(--rc-bg);
    --bs-body-bg-rgb: 248, 250, 252;
    --bs-secondary-color: var(--rc-muted);
    --bs-secondary-bg: var(--rc-surface-2);
    --bs-tertiary-bg: var(--rc-surface-2);
    --bs-border-color: var(--rc-border);
    --bs-border-radius: 8px;
    --bs-border-radius-lg: var(--rc-radius-lg);
    --bs-primary: var(--rc-primary);
    --bs-primary-rgb: var(--rc-primary-rgb);
    --bs-primary-text-emphasis: #002a99;
    --bs-primary-bg-subtle: var(--rc-cyan-50);
    --bs-primary-border-subtle: #b9d3ff;
    --bs-link-color: var(--rc-primary);
    --bs-link-color-rgb: var(--rc-primary-rgb);
    --bs-link-hover-color: var(--rc-primary-hover);
    --bs-link-hover-color-rgb: 0, 65, 255;
    --bs-success: var(--rc-success);
    --bs-success-rgb: 8, 122, 79;
    --bs-danger: var(--rc-danger);
    --bs-danger-rgb: 214, 48, 74;
    --bs-warning: #f2a900;
    --bs-warning-rgb: 242, 169, 0;
    --bs-info: var(--rc-info);
    --bs-info-rgb: 10, 124, 153;
    --bs-focus-ring-color: rgba(0, 73, 255, .28);
    --bs-card-bg: var(--rc-surface);
}

[data-bs-theme='dark'] {
    color-scheme: dark;
    --rc-bg: #000b26;
    --rc-surface: #0a1b45;
    --rc-surface-2: #0f2257;
    --rc-border: #1d3069;
    --rc-text: #e8faff;
    --rc-body: #c3d0ee;
    --rc-muted: #9fb0d6;
    --rc-label: #7f93c4;
    --rc-link: #6c9bff;
    --rc-hover-row: #0d2050;

    --rc-success: #3ddc97;
    --rc-danger: #ff7a8e;
    --rc-warning: #f5b94a;
    --rc-info: #4fd1ee;

    --rc-shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --rc-shadow: 0 2px 8px rgba(0, 0, 0, .35);
    --rc-shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);

    --rc-sidebar-bg: #00081f;
    --rc-chart-3: #a78bfa;
    --rc-chart-8: #94a3b8;
    --rc-chart-grid: #1d3069;

    --bs-body-color: var(--rc-body);
    --bs-body-color-rgb: 195, 208, 238;
    --bs-body-bg: var(--rc-bg);
    --bs-body-bg-rgb: 0, 11, 38;
    --bs-emphasis-color: #ffffff;
    --bs-secondary-color: var(--rc-muted);
    --bs-secondary-bg: var(--rc-surface-2);
    --bs-tertiary-bg: var(--rc-surface-2);
    --bs-border-color: var(--rc-border);
    --bs-primary: #6c9bff;
    --bs-primary-rgb: 108, 155, 255;
    --bs-primary-text-emphasis: #a9c4ff;
    --bs-primary-bg-subtle: #0a2166;
    --bs-primary-border-subtle: #12378f;
    --bs-link-color: var(--rc-link);
    --bs-link-color-rgb: 108, 155, 255;
    --bs-link-hover-color: #9dbcff;
    --bs-success: var(--rc-success);
    --bs-success-rgb: 61, 220, 151;
    --bs-danger: var(--rc-danger);
    --bs-danger-rgb: 255, 122, 142;
    --bs-warning-rgb: 245, 185, 74;
    --bs-info: var(--rc-info);
    --bs-info-rgb: 79, 209, 238;
    --bs-focus-ring-color: rgba(108, 155, 255, .35);
    --bs-card-bg: var(--rc-surface);
}

/* ---------- 2. Base ---------- */
html { scroll-behavior: smooth; }
body {
    font-family: var(--bs-body-font-family);
    background: var(--rc-bg);
    color: var(--rc-body);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-weight: 600; letter-spacing: -.01em; color: var(--rc-text); }
h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6 { font-size: var(--rc-fs-h2); }
a { text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
::selection { background: rgba(0, 73, 255, .22); }
:focus-visible { outline: 2px solid var(--rc-primary); outline-offset: 2px; border-radius: 6px; }
[data-bs-theme='dark'] :focus-visible { outline-color: #6c9bff; }
.text-muted { color: var(--rc-muted) !important; }
.cursor-pointer { cursor: pointer; }
.tabular, .num, .text-end.fw-bold, td.text-end { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.num { text-align: right; white-space: nowrap; }

/* utilitários estilo Tailwind já usados em algumas views */
.flex-col { flex-direction: column; }
.text-xs { font-size: .75rem; }
.text-wrap-balance { text-wrap: balance; }

/* utilitários que as views já usam, sem cor fixa */
.text-income { color: var(--rc-success) !important; }
.text-expense { color: var(--rc-danger) !important; }
.text-success { color: var(--rc-success) !important; }
.text-danger { color: var(--rc-danger) !important; }
.text-warning { color: var(--rc-warning) !important; }
.text-info { color: var(--rc-info) !important; }
.text-primary { color: var(--rc-link) !important; }
.text-dark { color: var(--rc-text) !important; }
.text-secondary { color: var(--rc-muted) !important; }
.bg-white { background-color: var(--rc-surface) !important; }
.bg-light { background-color: var(--rc-surface-2) !important; }
.border, .border-top, .border-bottom, .border-start, .border-end { border-color: var(--rc-border) !important; }
.shadow-sm { box-shadow: var(--rc-shadow-sm) !important; }

/* ---------- 3. Botões ---------- */
.btn { --bs-btn-font-size: var(--rc-fs-body); font-weight: 500; border-radius: 8px; padding: .375rem .75rem; line-height: 1.4; min-height: var(--rc-control-h); transition: background .15s, border-color .15s, color .15s; }
/* conteúdo sempre centralizado (vertical e horizontal): ícone + texto lado a lado com espaçamento uniforme */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; vertical-align: middle; text-align: center; }
.btn.text-start { justify-content: flex-start; text-align: left; }
.btn.text-end { justify-content: flex-end; text-align: right; }
.btn > .bi { line-height: 1; flex-shrink: 0; }
.btn > .bi[class*="me-"], .btn > span > .bi[class*="me-"] { margin-right: 0 !important; }
.btn > .bi[class*="ms-"] { margin-left: 0 !important; }
.btn.dropdown-toggle::after { margin-left: 0; }
.btn-group > .btn, .btn-group-vertical > .btn { flex: 1 1 auto; }
.btn-group { vertical-align: middle; align-items: stretch; }
.btn-sm, .btn-group-sm > .btn { gap: .3rem; }
.btn-sm > .bi, .btn-group-sm > .btn > .bi { font-size: 1.1em; }
.btn-sm, .btn-group-sm > .btn, .input-group-sm > .btn { --bs-btn-font-size: .75rem; font-size: .75rem; padding: .2rem .55rem; border-radius: 6px; min-height: 28px; }
.btn-group-sm > .btn { gap: .3rem; }
.btn-group > .btn:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.btn-group > .btn:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.btn-lg { --bs-btn-font-size: .875rem; padding: .5rem 1rem; border-radius: 8px; min-height: 38px; }
.btn-primary {
    --bs-btn-bg: var(--rc-primary); --bs-btn-border-color: var(--rc-primary); --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--rc-primary-hover); --bs-btn-hover-border-color: var(--rc-primary-hover); --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--rc-primary-active); --bs-btn-active-border-color: var(--rc-primary-active); --bs-btn-active-color: #fff;
    --bs-btn-disabled-bg: var(--rc-primary); --bs-btn-disabled-border-color: var(--rc-primary);
    --bs-btn-focus-shadow-rgb: 0, 73, 255;
    box-shadow: 0 1px 2px rgba(0, 73, 255, .25);
}
/* botões (inclusive <a class="btn">): sem sublinhado; no hover, brilho difuso (blur) em vez de linha */
.btn, .btn:hover, .btn:focus, .btn:active, a.btn:hover { text-decoration: none !important; }
.btn:hover:not(.btn-link):not([class*="btn-ghost"]):not(.btn-primary):not(.btn-success):not(.btn-danger) { box-shadow: 0 2px 10px rgba(15, 23, 42, .12) !important; } /* !important: vence .shadow-sm das views */
.btn-primary:hover { box-shadow: 0 2px 4px rgba(var(--rc-primary-rgb), .2), 0 4px 14px rgba(var(--rc-primary-rgb), .38) !important; }
.btn-success:hover { box-shadow: 0 4px 14px rgba(8, 122, 79, .35) !important; }
.btn-danger:hover { box-shadow: 0 4px 14px rgba(214, 48, 74, .35) !important; }
.btn-outline-primary {
    --bs-btn-color: var(--rc-link); --bs-btn-border-color: var(--rc-primary);
    --bs-btn-hover-bg: var(--rc-primary); --bs-btn-hover-border-color: var(--rc-primary); --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--rc-primary-active); --bs-btn-active-border-color: var(--rc-primary-active);
}
.btn-outline-secondary {
    --bs-btn-color: var(--rc-muted); --bs-btn-border-color: var(--rc-border);
    --bs-btn-hover-bg: var(--rc-surface-2); --bs-btn-hover-border-color: var(--rc-border); --bs-btn-hover-color: var(--rc-text);
    --bs-btn-active-bg: var(--rc-surface-2); --bs-btn-active-color: var(--rc-text); --bs-btn-active-border-color: var(--rc-border);
}
.btn-light {
    --bs-btn-bg: var(--rc-surface); --bs-btn-border-color: var(--rc-border); --bs-btn-color: var(--rc-text);
    --bs-btn-hover-bg: var(--rc-surface-2); --bs-btn-hover-border-color: var(--rc-border); --bs-btn-hover-color: var(--rc-text);
    --bs-btn-active-bg: var(--rc-surface-2); --bs-btn-active-color: var(--rc-text);
}
.btn-link { color: var(--rc-link); min-height: 0; }
.table .btn { min-height: 0; }
.btn-icon { width: var(--rc-control-h); height: var(--rc-control-h); min-height: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; }
.btn-ghost-secondary, .btn-ghost-primary, .btn-ghost-danger {
    border: 0; background: transparent; color: var(--rc-muted); min-width: 28px; height: 28px; min-height: 0; padding: 0 .5rem; white-space: nowrap;
    display: inline-flex; align-items: center; justify-content: center; border-radius: 6px;
}
.btn-ghost-secondary:not(.btn-sm):not(.btn-icon), .btn-ghost-primary:not(.btn-sm):not(.btn-icon), .btn-ghost-danger:not(.btn-sm):not(.btn-icon) { height: var(--rc-control-h); }
.table .btn-ghost-secondary, .table .btn-ghost-primary, .table .btn-ghost-danger { height: 28px; }
.btn-ghost-secondary:hover { background: var(--rc-surface-2); color: var(--rc-text); }
.btn-ghost-primary:hover { background: rgba(var(--rc-primary-rgb), .1); color: var(--rc-link); }
.btn-ghost-danger:hover { background: rgba(214, 48, 74, .12); color: var(--rc-danger); }
/* ---- padrão de tamanhos (listagens) ----
   cabeçalho de página: 32px | botão pequeno / ação de linha ou cartão: 28px | ícone das ações: 16px
   Vale para qualquer botão só de ícone: rootcode.js marca .btn-icon-only (CSS não enxerga texto), mesmo sem .row-action. */
.row-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: .125rem; flex-shrink: 0; }
.row-actions form { margin: 0; display: inline-flex; }
.btn.btn-icon-only { width: var(--rc-control-h); min-width: var(--rc-control-h); height: var(--rc-control-h); min-height: 0; padding: 0; }
.btn-sm.btn-icon-only, .btn-icon.btn-sm, .table .btn.btn-icon-only, .row-actions .btn, .row-actions .btn.row-action, .card .btn-ghost-secondary.btn-icon-only {
    width: var(--rc-action-h); min-width: var(--rc-action-h); height: var(--rc-action-h); min-height: 0; padding: 0; border-radius: 6px;
}
.btn.btn-icon-only > .bi, .row-actions .btn > .bi { font-size: var(--rc-action-icon); line-height: 1; }
.rc-content .btn-icon.rounded-circle, .rc-content .row-actions .btn { border-radius: 6px !important; }
.row-actions .btn.row-action.btn-ghost-secondary:hover { color: var(--rc-link); background: rgba(var(--rc-primary-rgb), .1); }
.row-actions .btn.btn-success { width: auto; min-width: 0; padding: 0 .6rem; margin-right: .25rem; }
/* botões de texto pequenos dentro de tabelas ("Baixar", "Ver Alterações"...) */
.table .btn-sm:not(.btn-icon-only):not(.row-action) { min-height: var(--rc-action-h); height: var(--rc-action-h); }

/* ---------- 4. Cards, tabelas, formulários ---------- */
.card {
    border: 1px solid var(--rc-border); border-radius: var(--rc-radius-lg);
    background: var(--rc-surface); box-shadow: var(--rc-shadow-sm);
}
.card.border-0 { border: 1px solid var(--rc-border) !important; }
.card-header { background: transparent; border-bottom: 1px solid var(--rc-border); font-weight: 600; font-size: .875rem; color: var(--rc-text); padding: .75rem 1rem; }
.card-footer { padding: .625rem 1rem; }
.card-body { padding: 1rem; }
.card-title { font-size: .875rem; font-weight: 600; }
.card-footer { background: transparent; border-top: 1px solid var(--rc-border); }
.card.hover-shadow:hover, .hover-shadow:hover { box-shadow: var(--rc-shadow); }
.transition-all, .transition-hover { transition: all .2s ease; }

.table { --bs-table-bg: transparent; --bs-table-color: var(--rc-body); --bs-table-border-color: var(--rc-border); --bs-table-hover-bg: var(--rc-hover-row); --bs-table-hover-color: var(--rc-text); }
.table > thead > tr > th, .table > thead.table-light > tr > th {
    --bs-table-bg: var(--rc-surface-2); --bs-table-color: var(--rc-muted);
    background: var(--rc-surface-2); color: var(--rc-muted);
    font-size: var(--rc-fs-label); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--rc-border);
}
.table { font-size: var(--rc-fs-body); --bs-table-color: var(--rc-body); }
.table > :not(caption) > * > * { padding: .5rem .875rem; }
.table > thead > tr > th { padding-top: .5rem; padding-bottom: .5rem; white-space: nowrap; }
.table > tbody > tr > td { color: var(--rc-body); }
.table > tbody > tr > td .fw-medium, .table > tbody > tr > td .text-dark { color: var(--rc-text) !important; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--rc-hover-row); }
/* linhas de destaque (totais/calculadas): mantêm o tamanho normal do texto */
.table > tbody > tr.table-light > * { --bs-table-bg: var(--rc-surface-2); --bs-table-color: var(--rc-text); background: var(--rc-surface-2); color: var(--rc-text); font-weight: 600; }
.table-light { --bs-table-bg: var(--rc-surface-2); --bs-table-color: var(--rc-text); --bs-table-border-color: var(--rc-border); }
.table-responsive { border-radius: var(--rc-radius-lg); }

.form-label { font-weight: 500; font-size: .75rem; color: var(--rc-body); margin-bottom: .25rem; }
.form-control, .form-select {
    background-color: var(--rc-surface); border: 1px solid var(--rc-border); color: var(--rc-text);
    border-radius: 8px; padding: .375rem .625rem; font-size: var(--rc-fs-body); min-height: var(--rc-control-h);
}
.form-select { min-width: 5.5rem; }
.form-control-sm, .form-select-sm { padding: .2rem .5rem; border-radius: 6px; font-size: .75rem; min-height: 28px; }
textarea.form-control { min-height: 0; }
.form-control::placeholder { color: color-mix(in srgb, var(--rc-muted) 70%, transparent); }
.form-control:focus, .form-select:focus { border-color: var(--rc-primary); box-shadow: 0 0 0 .18rem var(--bs-focus-ring-color); background-color: var(--rc-surface); color: var(--rc-text); }
.form-control:disabled, .form-control[readonly] { background-color: var(--rc-surface-2); }
.input-group-text { background: var(--rc-surface-2); border-color: var(--rc-border); color: var(--rc-muted); }
.form-check-input { border-color: #9db3dd; }
.form-check-input:checked { background-color: var(--rc-primary); border-color: var(--rc-primary); }
.form-check-input:focus { box-shadow: 0 0 0 .22rem var(--bs-focus-ring-color); border-color: var(--rc-primary); }
.form-switch .form-check-input:checked { background-color: var(--rc-primary); }
.form-control-color { padding: .25rem; height: var(--rc-control-h); }

/* ---------- 5. Navegação e overlays ---------- */
.dropdown-menu {
    border: 1px solid var(--rc-border); border-radius: 10px; box-shadow: var(--rc-shadow-lg);
    background: var(--rc-surface); padding: .25rem; font-size: var(--rc-fs-body); --bs-dropdown-link-active-bg: var(--rc-primary);
}
.dropdown-item { border-radius: 6px; padding: .35rem .6rem; font-size: var(--rc-fs-body); color: var(--rc-text); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--rc-surface-2); color: var(--rc-text); }
.dropdown-item.active { background: var(--rc-primary); color: #fff; }
.dropdown-divider { border-color: var(--rc-border); }
.dropdown-header { color: var(--rc-label); font-size: var(--rc-fs-label); text-transform: uppercase; letter-spacing: .06em; }
.modal-content { border: 1px solid var(--rc-border); border-radius: var(--rc-radius-lg); box-shadow: var(--rc-shadow-lg); background: var(--rc-surface); }
.modal-header, .modal-footer { border-color: var(--rc-border); }

/* Modal de exclusão: ícone fixo, botões lado a lado no desktop e empilhados (largura total) no celular */
.rc-delete-modal { max-width: 420px; }
.rc-delete-modal-icon { width: 60px; height: 60px; }
.rc-delete-modal .modal-body { overflow-wrap: anywhere; }
.rc-delete-modal-actions { display: flex; justify-content: center; gap: .5rem; }
.rc-delete-modal-actions .btn { min-width: 110px; min-height: 44px; } /* alvo de toque >= 44px */
@media (max-width: 575.98px) {
    .rc-delete-modal { max-width: none; }
    .rc-delete-modal .modal-body { padding-left: 1.25rem !important; padding-right: 1.25rem !important; padding-bottom: max(1.25rem, env(safe-area-inset-bottom)) !important; }
    .rc-delete-modal-actions { flex-direction: column-reverse; } /* Excluir em cima, Cancelar embaixo */
    .rc-delete-modal-actions .btn { width: 100%; }
}
.nav-pills { --bs-nav-pills-link-active-bg: var(--rc-primary); }
.nav-tabs { --bs-nav-tabs-link-active-border-color: var(--rc-border) var(--rc-border) var(--rc-surface); --bs-nav-tabs-border-color: var(--rc-border); }
.nav-tabs .nav-link.active { color: var(--rc-link); background: var(--rc-surface); }
.page-link { color: var(--rc-link); background: var(--rc-surface); border-color: var(--rc-border); }
.page-item.active .page-link { background: var(--rc-primary); border-color: var(--rc-primary); color: #fff; }
.page-link:hover { background: var(--rc-surface-2); }
.progress { background: var(--rc-surface-2); border-radius: 999px; }
.progress-bar { background-color: var(--rc-primary); }
.alert { border-radius: 8px; border-width: 1px; padding: .625rem .875rem; font-size: var(--rc-fs-body); }
.list-group-item { background: var(--rc-surface); border-color: var(--rc-border); color: var(--rc-text); }
.breadcrumb-item a { color: var(--rc-link); }
.badge { font-weight: 500; letter-spacing: .01em; font-size: var(--rc-fs-label); padding: .25em .6em; }
.badge.bg-primary:not([class*="bg-opacity"]) { background-color: var(--rc-primary) !important; color: #fff; }
.badge.bg-primary[class*="bg-opacity"] { color: var(--rc-link) !important; }
kbd { background: var(--rc-surface-2); color: var(--rc-muted); border: 1px solid var(--rc-border); border-radius: 6px; box-shadow: none; }

/* paginacao */
.page-link.hover-primary { background: var(--rc-surface); color: var(--rc-muted); border-radius: 8px !important; transition: all .15s; }
.page-link.hover-primary:hover { background: var(--rc-surface-2) !important; color: var(--rc-link) !important; transform: translateY(-1px); }
.page-item.disabled .page-link { background: transparent; color: var(--rc-muted); opacity: .6; }

/* badges "suaves" (status) */
.badge-soft { padding: .25em .6em; border-radius: 999px; font-weight: 500; font-size: var(--rc-fs-label); }
.badge-soft-primary { background: rgba(var(--rc-primary-rgb), .12); color: var(--rc-link); }
.badge-soft-success { background: rgba(8, 122, 79, .14); color: var(--rc-success); }
.badge-soft-danger { background: rgba(214, 48, 74, .13); color: var(--rc-danger); }
.badge-soft-warning { background: rgba(242, 169, 0, .18); color: var(--rc-warning); }
.badge-soft-info { background: rgba(10, 124, 153, .14); color: var(--rc-info); }
.badge-soft-secondary { background: var(--rc-surface-2); color: var(--rc-muted); }

/* ---------- 6. Shell da aplicação ---------- */
#wrapper { min-height: 100vh; }
#sidebar-wrapper {
    position: fixed; inset: 0 auto 0 0; width: var(--rc-sidebar-width); z-index: 1045;
    background: var(--rc-sidebar-bg); color: var(--rc-sidebar-text);
    overflow-y: auto; transition: transform .25s ease; border-right: 1px solid rgba(255, 255, 255, .05);
    scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .15) transparent;
}
#sidebar-wrapper::before { /* brilho sutil de marca no topo */
    content: ''; position: absolute; inset: 0 0 auto 0; height: 220px; pointer-events: none;
    background: radial-gradient(120% 100% at 0% 0%, rgba(0, 73, 255, .28), transparent 70%);
}
.sidebar-heading { position: relative; height: var(--rc-topbar-h); display: flex; align-items: center; padding: 0 1rem; }
.sidebar-heading img { height: 24px; width: auto; }
.sidebar-group { position: relative; padding: .9rem 1.1rem .3rem; font-size: .625rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--rc-sidebar-muted); }
.sidebar-link {
    position: relative; display: flex; align-items: center; gap: .6rem; margin: 1px .5rem; padding: .4rem .7rem;
    color: var(--rc-sidebar-text); font-size: var(--rc-fs-body); font-weight: 500; border-radius: 8px; text-decoration: none !important;
    transition: background .15s, color .15s;
}
.sidebar-link > span { display: flex; align-items: center; gap: .6rem; }
.sidebar-link i.bi:first-child, .sidebar-link span > i.bi:first-child { font-size: .95rem; width: 1.1rem; text-align: center; opacity: .9; margin-right: 0; }
.sidebar-link > i.bi:last-child:not(:first-child) { margin-left: auto; font-size: .75rem; opacity: .6; }
.sidebar-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar-link.active { background: var(--rc-primary); color: #fff; }
.sidebar-submenu { margin: 1px .5rem 3px 1.6rem; padding-left: .5rem; border-left: 1px solid rgba(255, 255, 255, .1); }
.submenu-link { display: block; padding: .3rem .6rem; border-radius: 6px; font-size: .78rem; color: var(--rc-sidebar-text); text-decoration: none !important; }
.submenu-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.submenu-link.active { color: #fff; font-weight: 600; background: rgba(0, 73, 255, .35); }
#sidebar-backdrop { display: none; position: fixed; inset: 0; z-index: 1040; background: rgba(0, 8, 31, .55); backdrop-filter: blur(2px); }

#page-content-wrapper { flex: 1; min-width: 0; min-height: 100vh; margin-left: var(--rc-sidebar-width); display: flex; flex-direction: column; transition: margin-left .25s ease; }
body.sb-sidenav-toggled #sidebar-wrapper { transform: translateX(-100%); }
body.sb-sidenav-toggled #page-content-wrapper { margin-left: 0; }

.top-navbar {
    position: sticky; top: 0; z-index: 1030; height: var(--rc-topbar-h); padding: 0 1rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    background: color-mix(in srgb, var(--rc-surface) 88%, transparent); backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--rc-border);
}
.top-navbar .btn-link { color: var(--rc-text); }
.rc-search-trigger {
    min-width: 200px; height: 30px; display: flex; align-items: center; gap: .5rem; padding: 0 .5rem 0 .65rem;
    background: var(--rc-surface-2); border: 1px solid var(--rc-border); border-radius: 8px; color: var(--rc-muted); font-size: .75rem;
}
.rc-search-trigger:hover { border-color: var(--rc-primary); color: var(--rc-text); }
.rc-avatar {
    width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: var(--rc-gradient); color: #fff; font-weight: 600; font-size: .7rem; text-transform: uppercase; flex-shrink: 0;
}
.rc-theme-toggle .rc-icon-dark { display: none; }
[data-bs-theme='dark'] .rc-theme-toggle .rc-icon-light { display: none; }
[data-bs-theme='dark'] .rc-theme-toggle .rc-icon-dark { display: inline; }
.rc-content { flex: 1; padding: 1.25rem clamp(1rem, 2vw, 1.5rem) 1.5rem; }
/* o espaçamento lateral é do layout: as views não precisam (nem devem) somar o seu (px-3, px-4...) */
.rc-content > .container-fluid, .rc-content > .container-fluid.px-4, .rc-content > .container-fluid.px-3 { padding-left: 0 !important; padding-right: 0 !important; }
.rc-footer { padding: .625rem 1rem; color: var(--rc-label); font-size: .7rem; border-top: 1px solid var(--rc-border); display: flex; align-items: center; justify-content: center; gap: .6rem; }
.rc-footer img { height: 16px; opacity: .85; }

@media (max-width: 991.98px) {
    #sidebar-wrapper { transform: translateX(-100%); }
    #page-content-wrapper { margin-left: 0; }
    body.sb-sidenav-toggled #sidebar-wrapper { transform: none; box-shadow: var(--rc-shadow-lg); }
    body.sb-sidenav-toggled #page-content-wrapper { margin-left: 0; }
    body.sb-sidenav-toggled #sidebar-backdrop { display: block; }
    .top-navbar { padding: 0 1rem; }
}

/* topbar responsiva: a esquerda encolhe (nome da empresa com reticencias), a direita nunca encolhe */
.top-navbar > div { min-width: 0; }
.top-navbar > div:first-child { flex: 1 1 0; }
.top-navbar > div:last-child { flex: 0 0 auto; }
.top-navbar > div:first-child > .dropdown { min-width: 0; flex: 0 1 auto; }
.top-navbar > div:first-child > .dropdown > .btn { max-width: 100%; min-width: 0; }
.rc-tenant-name { display: block; min-width: 0; max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#page-content-wrapper { overflow-x: clip; } /* rede de seguranca: nunca gera rolagem lateral na pagina */
@media (max-width: 575.98px) {
    .rc-tenant-name { max-width: none; }
    .top-navbar { gap: .25rem; }
    .top-navbar .position-relative.me-3 { margin-right: .25rem !important; }
    .top-navbar .dropdown-toggle::after { display: none; }
    .top-navbar .btn { padding-left: .5rem; padding-right: .5rem; }
    .top-navbar > div:first-child > .btn { margin-right: .35rem !important; }
}

/* ---------- 7. Padrões de página ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-header h1, .page-header .page-title { font-size: var(--rc-fs-h1); font-weight: 600; margin: 0; }
.page-header .page-subtitle { color: var(--rc-muted); font-size: .78rem; margin: .1rem 0 0; }
.kpi-card { padding: .875rem 1rem; display: flex; flex-direction: row; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.kpi-card .kpi-label { color: var(--rc-muted); font-size: var(--rc-fs-label); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.kpi-card .kpi-value { font-size: 1.375rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; color: var(--rc-text); font-variant-numeric: tabular-nums; }
.kpi-delta { display: inline-flex; align-items: center; gap: .2rem; font-size: .72rem; font-weight: 500; color: var(--rc-muted); font-variant-numeric: tabular-nums; }
.kpi-delta.up { color: var(--rc-success); }
.kpi-delta.down { color: var(--rc-danger); }
.kpi-icon { width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; background: rgba(var(--rc-primary-rgb), .1); color: var(--rc-link); }
.kpi-icon.success { background: rgba(8, 122, 79, .13); color: var(--rc-success); }
.kpi-icon.danger { background: rgba(214, 48, 74, .12); color: var(--rc-danger); }
.kpi-icon.info { background: rgba(10, 124, 153, .13); color: var(--rc-info); }
.kpi-icon.warning { background: rgba(242, 169, 0, .16); color: var(--rc-warning); }
.icon-square, .icon-shape { border-radius: 8px; }
.rc-hero { background: var(--rc-gradient); color: #fff; border: 0; border-radius: var(--rc-radius-lg); box-shadow: var(--rc-shadow); }
.rc-hero h1, .rc-hero h2, .rc-hero h3, .rc-hero h4, .rc-hero h5, .rc-hero .h1, .rc-hero .h2 { color: #fff; }
.filter-bar { background: var(--rc-surface); border: 1px solid var(--rc-border); border-radius: var(--rc-radius-lg); padding: .625rem .875rem; box-shadow: var(--rc-shadow-sm); }
.empty-state { text-align: center; padding: 2rem 1rem; color: var(--rc-muted); }
.empty-state > .bi { font-size: 1.75rem; color: var(--rc-primary); opacity: .55; display: block; margin-bottom: .75rem; }
.empty-state > h2 { font-size: .875rem; font-weight: 600; color: var(--rc-text); }
.empty-state > p { font-size: .8125rem; max-width: 46ch; margin-left: auto !important; margin-right: auto !important; }
.empty-state > .btn { margin-top: .75rem; }
.form-section { background: var(--rc-surface); border: 1px solid var(--rc-border); border-radius: var(--rc-radius-lg); padding: 1rem; box-shadow: var(--rc-shadow-sm); }
.form-section + .form-section { margin-top: .75rem; }
.hover-bg-light:hover { background: var(--rc-surface-2) !important; }
.tracking-wide { letter-spacing: .06em; }

/* cartões de escolha (radio) — antes duplicado em tenants/create e edit */
.custom-card-radio { cursor: pointer; transition: all .2s; background-color: var(--rc-surface); }
.custom-card-radio:hover { background-color: var(--rc-surface-2); border-color: var(--rc-primary) !important; }
.custom-card-radio:has(:checked) { border-color: var(--rc-primary) !important; background-color: var(--rc-cyan-50); box-shadow: 0 0 0 3px rgba(var(--rc-primary-rgb), .12); }
[data-bs-theme='dark'] .custom-card-radio:has(:checked) { background-color: #0a2166; }
.hover-primary:hover { color: var(--rc-link) !important; }
.list-group { scrollbar-width: thin; scrollbar-color: var(--rc-border) transparent; }

/* títulos de página consistentes em todas as telas (as views usam h1.h2/h3 + fw-bold) */
.rc-content h1, .rc-content .h1 { font-size: var(--rc-fs-h1) !important; font-weight: 600 !important; letter-spacing: -.02em; }
.rc-content h1 + p, .rc-content h1 + .text-muted { font-size: .78rem; }
.rc-content .h4, .rc-content .h5, .rc-content h4, .rc-content h5 { font-size: .875rem; }

/* densidade: utilitários legados das views (p-4, rounded-4, rounded-pill...) que vencem os tokens */
.rc-content .card-body.p-4, .rc-content .card-body.p-5, .rc-content .card-body.p-md-5 { padding: 1rem !important; }
.rc-content .card-body.p-3 { padding: .75rem !important; }
.rc-content .card-header.py-3 { padding-top: .75rem !important; padding-bottom: .75rem !important; }
.rc-content .rounded-4, .rc-content .card.rounded-4 { border-radius: var(--rc-radius-lg) !important; }
.rc-content .btn.rounded-pill, .rc-content .form-control.rounded-pill, .rc-content .form-select.rounded-pill,
.rc-content .input-group .rounded-start-pill, .rc-content .input-group .rounded-end-pill { border-radius: 8px !important; }
.rc-content .input-group > .rounded-start-pill { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
.rc-content .input-group > .rounded-end-pill { border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; }
.rc-content .btn.px-4, .rc-content .btn.px-5 { padding-left: .875rem !important; padding-right: .875rem !important; }
.rc-content .shadow, .rc-content .shadow-lg { box-shadow: var(--rc-shadow-sm) !important; }
.rc-content .dropdown-menu.shadow, .rc-content .dropdown-menu.shadow-lg { box-shadow: var(--rc-shadow-lg) !important; }
/* células de tabela: px-4/py-3 inline não vencem a densidade global */
.rc-content .table > :not(caption) > * > .px-4, .rc-content .table > :not(caption) > * > .px-3 { padding-left: .875rem !important; padding-right: .875rem !important; }
.rc-content .table > :not(caption) > * > .py-3, .rc-content .table > :not(caption) > * > .py-2 { padding-top: .5rem !important; padding-bottom: .5rem !important; }
.rc-content .table th.text-xs, .rc-content .table th.small, .rc-content .table th.text-uppercase { font-size: var(--rc-fs-label) !important; }

/* ---------- 8. Autenticação (layout guest) ---------- */
.rc-auth { min-height: 100vh; display: grid; grid-template-columns: 1fr; background: var(--rc-bg); }
.rc-auth-panel { display: none; position: relative; overflow: hidden; background: var(--rc-gradient); color: #fff; padding: 3rem; }
.rc-auth-panel::before {
    content: ''; position: absolute; width: 640px; height: 640px; right: -220px; bottom: -220px; border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 191, 255, .35), transparent 65%);
}
.rc-auth-panel::after {
    content: ''; position: absolute; inset: 0; opacity: .5;
    background-image: radial-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px); background-size: 26px 26px;
    mask-image: linear-gradient(135deg, transparent 20%, #000 100%);
}
.rc-auth-panel > * { position: relative; z-index: 1; }
.rc-auth-panel h2 { color: #fff; font-size: 2rem; font-weight: 600; line-height: 1.25; max-width: 24ch; }
.rc-auth-panel p { color: rgba(232, 250, 255, .8); max-width: 40ch; }
.rc-auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1.25rem; position: relative; }
.rc-auth-main .rc-auth-logo { height: 34px; margin-bottom: 2rem; }
.rc-auth-logo-link { display: block; text-align: center; }
.auth-card { width: 100%; max-width: 420px; margin: 0 auto; border-radius: var(--rc-radius-lg); box-shadow: var(--rc-shadow); }
.rc-auth-theme { position: absolute; top: 1rem; right: 1rem; }
@media (min-width: 992px) {
    .rc-auth { grid-template-columns: 1.05fr 1fr; }
    .rc-auth-panel { display: flex; flex-direction: column; justify-content: space-between; }
    .rc-auth-logo-link { display: none; }
}

/* ---------- 9. Logo conforme o tema ---------- */
.rc-logo-on-light { display: inline-block; }
.rc-logo-on-dark { display: none; }
[data-bs-theme='dark'] .rc-logo-on-light { display: none; }
[data-bs-theme='dark'] .rc-logo-on-dark { display: inline-block; }

/* ---------- 10. Ajustes do tema escuro para classes do Bootstrap com cor fixa ---------- */
[data-bs-theme='dark'] .alert-success { --bs-alert-bg: rgba(61, 220, 151, .1); --bs-alert-border-color: rgba(61, 220, 151, .3); --bs-alert-color: #8ff0c4; }
[data-bs-theme='dark'] .alert-danger { --bs-alert-bg: rgba(255, 122, 142, .1); --bs-alert-border-color: rgba(255, 122, 142, .3); --bs-alert-color: #ffb3bf; }
[data-bs-theme='dark'] .alert-warning { --bs-alert-bg: rgba(245, 185, 74, .1); --bs-alert-border-color: rgba(245, 185, 74, .3); --bs-alert-color: #ffd98f; }
[data-bs-theme='dark'] .alert-info { --bs-alert-bg: rgba(79, 209, 238, .1); --bs-alert-border-color: rgba(79, 209, 238, .3); --bs-alert-color: #9ae6f7; }
[data-bs-theme='dark'] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
[data-bs-theme='dark'] .form-check-input:not(:checked) { background-color: var(--rc-surface-2); }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
    #sidebar-wrapper, .top-navbar, .rc-footer, #sidebar-backdrop { display: none !important; }
    #page-content-wrapper { margin-left: 0 !important; }
}

/* ---------- 11. Páginas de erro ---------- */
.rc-error { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 2rem 1.25rem; }
.rc-error-code { margin: 2rem 0 .5rem; font-size: clamp(4rem, 14vw, 7.5rem); font-weight: 700; line-height: 1; letter-spacing: -.04em; background: var(--rc-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
[data-bs-theme='dark'] .rc-error-code { background: linear-gradient(135deg, #6c9bff 0%, #00bfff 100%); -webkit-background-clip: text; background-clip: text; }

/* ---------- 11b. Tabelas -> cartões empilhados no mobile (.table-stack) ----------
   Uso: <table class="table table-stack">. O rótulo de cada célula vem do <thead> (rootcode.js -> data-label).
   Opções no <th>: data-stack="title" (célula de destaque, largura total, sem rótulo; padrão = 1ª coluna)
                   data-stack="hide"  (coluna oculta no mobile). Coluna "Ações" vira rodapé do cartão. */
@media (max-width: 991.98px) {
    .table-responsive:has(> .table-stack) { overflow: visible; }
    .table-stack, .table-stack > tbody { display: block; width: 100%; }
    .table-stack > thead { display: none; }
    .table-stack > tbody { display: grid; gap: .5rem; padding: .5rem; }
    .table-stack > tbody > tr {
        display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem .75rem;
        padding: .625rem .75rem; background: var(--rc-surface); border: 1px solid var(--rc-border); border-radius: var(--rc-radius-lg);
        box-shadow: var(--rc-shadow-sm);
    }
    .table-stack > tbody > tr.bg-danger { background: rgba(var(--bs-danger-rgb), .06) !important; }
    .rc-content .table.table-stack > tbody > tr > td {
        display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: .1rem;
        min-width: 0; padding: 0 !important; border: 0; background: transparent; text-align: left !important;
        white-space: normal !important; overflow-wrap: anywhere;
    }
    .table-stack > tbody > tr > td[data-label]::before {
        content: attr(data-label); color: var(--rc-label); font-size: var(--rc-fs-label); font-weight: 600;
        letter-spacing: .04em; text-transform: uppercase; line-height: 1.2;
    }
    .table-stack > tbody > tr > td.stack-title,
    .table-stack > tbody > tr > td.stack-actions,
    .table-stack > tbody > tr > td[colspan] { grid-column: 1 / -1; }
    .table-stack > tbody > tr > td.stack-title { order: -1; flex-direction: row; align-items: center; font-weight: 500; color: var(--rc-text); font-size: .875rem; }
    .table-stack > tbody > tr > td.stack-title .d-flex { min-width: 0; width: 100%; }
    .table-stack > tbody > tr > td.stack-title .text-truncate { max-width: none !important; white-space: normal !important; }
    .rc-content .table.table-stack > tbody > tr > td.stack-actions {
        flex-direction: row; justify-content: flex-end; align-items: center; gap: .5rem;
        padding-top: .5rem !important; border-top: 1px solid var(--rc-border);
    }
    .table-stack > tbody > tr > td .rounded-circle { flex-shrink: 0; }
    .table-stack > tbody > tr > td .text-truncate { white-space: normal !important; overflow: visible; text-overflow: clip; max-width: none !important; min-width: 0; }
    .table-stack > tbody > tr > td .tabular { white-space: nowrap; }
    .table-stack > tbody > tr > td .badge { max-width: 100%; white-space: normal !important; text-align: left; }
    .table-stack > tbody > tr > td.stack-hide { display: none !important; }
    .table-stack > tbody > tr > td[colspan] { align-items: center; text-align: center !important; }
    .table-stack.table-hover > tbody > tr:hover > * { --bs-table-bg-state: transparent; }
}

/* ---------- 12. Mobile (≤ 575px) ---------- */
@media (max-width: 575.98px) {
    :root { --bs-body-font-size: .8125rem; }

    /* campos com 16px evitam o zoom automatico do iOS ao focar */
    .form-control, .form-select { font-size: 1rem; padding: .5rem .75rem; }
    .form-control-sm, .form-select-sm { font-size: .95rem; }
    .form-label { font-size: .8rem; }

    /* botoes compactos (as views usam px-4, btn-lg, rounded-pill) */
    .btn { --bs-btn-font-size: .85rem; padding: .375rem .85rem; }
    .btn.px-3, .btn.px-4, .btn.px-5 { padding-left: .9rem !important; padding-right: .9rem !important; }
    .btn-lg { --bs-btn-font-size: .95rem; padding: .55rem 1.1rem; }
    .btn-sm, .btn-group-sm > .btn { padding: .2rem .6rem; }
    .btn-icon, .btn-ghost-secondary, .btn-ghost-primary, .btn-ghost-danger { height: 34px; min-width: 34px; }
    .btn-icon { width: 34px; padding: 0; }

    /* botoes irmaos nunca estouram o card: quebram de linha e dividem a largura */
    .rc-content .d-flex:has(> .btn + .btn), .rc-content .d-flex:has(> .btn + .btn-group), .rc-content .d-flex:has(> .btn-group + .btn) { flex-wrap: wrap; }
    .rc-content .d-flex:has(> .btn + .btn) > .btn { flex: 1 1 auto; }
    .rc-content .d-flex:is(.gap-1, .gap-2, .gap-3):has(.btn) { flex-wrap: wrap; }
    .rc-content .btn { white-space: nowrap; max-width: 100%; }
    .rc-content .btn-group { flex-wrap: wrap; }

    /* cabecalhos de pagina: titulo em cima, acoes embaixo */
    .rc-content .d-flex.justify-content-between:has(> .d-flex > .btn, > .btn, > a.btn) { flex-wrap: wrap; gap: .75rem; }
    .page-header { gap: .75rem; margin-bottom: 1rem; }
    .page-header > div:last-child:not(:first-child) { width: 100%; }
    .rc-content h1, .rc-content .h1 { font-size: 1.2rem !important; }

    /* respiro menor: cards, paddings utilitarios e container */
    .rc-content { padding: 1rem 1rem 1.5rem; }
    .card-body.p-4, .card-body.p-5, .card-body.p-md-5, .form-section { padding: .875rem !important; }
    .card-header { padding: .625rem .875rem; }
    .kpi-card { padding: .75rem .875rem; }
    .kpi-card .kpi-value { font-size: 1.2rem; }
    .kpi-icon { width: 30px; height: 30px; font-size: .95rem; }
    .filter-bar { padding: .625rem .875rem; }
    .empty-state { padding: 2rem .75rem; }

    /* tabelas: mais densas (rolagem horizontal fica dentro do card) */
    .table { font-size: .8rem; }
    .table > :not(caption) > * > * { padding: .6rem .65rem; }
    .table > thead > tr > th { font-size: .66rem; }
    .table-responsive { -webkit-overflow-scrolling: touch; }
    .rc-content .table > :not(caption) > * > .px-4, .rc-content .table > :not(caption) > * > .px-3 { padding-left: .65rem !important; padding-right: .65rem !important; }

    /* demais */
    .dropdown-menu { max-width: calc(100vw - 2rem); }
    .modal-dialog { margin: .75rem; }
    .alert { padding: .75rem 1rem; font-size: .85rem; }
    .rc-footer { flex-wrap: wrap; text-align: center; padding: .75rem 1rem; }
    .auth-card .card-body { padding: 1.5rem !important; }
}

/* telas muito estreitas (≤ 399px): colunas de filtro em largura total, para o texto dos selects caber */
@media (max-width: 399.98px) {
    .filter-bar [class*="col-6"], .rc-content .row > [class*="col-6"]:has(> .form-select, > .form-control, > label + .form-select) { flex: 0 0 100%; width: 100%; max-width: 100%; }
    .form-select { min-width: 0; }
}

/* ---------- 12b. Botões do cabeçalho de página: sempre 32px, com ou sem .btn-sm (inclui o cabeçalho antigo: flex com h1) ---------- */
.page-header .btn:not(.btn-icon-only), .page-header .btn-group > .btn,
.rc-content .d-flex:has(> div > h1) .btn:not(.btn-icon-only), .rc-content .d-flex:has(> div > h1) .btn-group > .btn,
.rc-content .d-flex:has(> h1) .btn:not(.btn-icon-only) {
    min-height: var(--rc-control-h) !important; font-size: var(--rc-fs-body) !important; padding: .375rem .75rem !important; gap: .4rem;
}
.page-header .btn > .bi, .rc-content .d-flex:has(> div > h1) .btn > .bi, .rc-content .d-flex:has(> h1) .btn > .bi { font-size: 1em !important; }

/* ---------- 12c. Padronização geral (as views misturam utilitários; aqui há uma única medida por componente) ---------- */
/* badges: 11px, peso 500, pílula */
.rc-content .badge, .modal .badge { font-size: var(--rc-fs-label) !important; font-weight: 500 !important; padding: .25em .6em !important; border-radius: 999px !important; line-height: 1.3; }

/* cabeçalho de página: mesmo espaçamento no padrão novo (.page-header) e no antigo (flex com h1) */
.rc-content h1 { margin-bottom: 0 !important; }
.rc-content h1 + p, .rc-content h1 + .text-muted, .rc-content .page-subtitle { margin: .1rem 0 0 !important; font-size: .78rem !important; }
.rc-content .d-flex:has(> div > h1), .rc-content .d-flex:has(> h1) {
    padding-top: 0 !important; padding-bottom: 0 !important; margin-top: 0 !important; margin-bottom: 1rem !important;
    flex-wrap: wrap; gap: .75rem; align-items: center !important;
}

/* cards: cabeçalho e título iguais em todas as telas */
.rc-content .card-header:not([class*="bg-primary"]):not([class*="bg-dark"]) { background: transparent !important; padding: .75rem 1rem !important; }
.rc-content .card-header :is(h1, h2, h3, h4, h5, h6), .rc-content .card-title { font-size: .875rem !important; font-weight: 600 !important; color: var(--rc-text); }

/* rótulos de formulário: sem caixa-alta/negrito */
.rc-content .form-label, .modal .form-label { font-size: .75rem !important; font-weight: 500 !important; text-transform: none !important; letter-spacing: 0 !important; color: var(--rc-body); }

/* campos: 32px (igual aos botões); -sm 28px; -lg 36px */
.form-control:not(textarea):not([type="file"]):not([type="color"]):not(.form-control-sm):not(.form-control-lg),
.form-select:not(.form-select-sm):not(.form-select-lg) { height: var(--rc-control-h); padding-top: .25rem; padding-bottom: .25rem; }
.form-control-sm, .form-select-sm { height: var(--rc-action-h); padding-top: .15rem; padding-bottom: .15rem; }
.form-control-lg, .form-select-lg, .input-group-lg > .form-control, .input-group-lg > .form-select, .input-group-lg > .input-group-text {
    height: 36px; font-size: .875rem; padding: .25rem .75rem; min-height: 0;
}
.input-group > .input-group-text { font-size: var(--rc-fs-body); padding-top: 0; padding-bottom: 0; }

/* modais: mesma moldura, cabeçalho, corpo e rodapé (exceto o modal de exclusão, que tem layout próprio) */
.modal-content { border: 1px solid var(--rc-border) !important; border-radius: var(--rc-radius-lg) !important; box-shadow: var(--rc-shadow-lg) !important; }
.modal-dialog:not(.rc-delete-modal) .modal-header { padding: .75rem 1rem !important; border-bottom: 1px solid var(--rc-border) !important; }
.modal-dialog:not(.rc-delete-modal) .modal-body { padding: 1rem !important; }
.modal-dialog:not(.rc-delete-modal) .modal-footer { padding: .75rem 1rem !important; gap: .5rem; border-top: 1px solid var(--rc-border) !important; }
.modal-title { font-size: .9375rem !important; font-weight: 600 !important; }
.modal .btn.rounded-pill, .modal .form-control.rounded-pill, .modal .form-select.rounded-pill { border-radius: 8px !important; }
.modal .btn.px-3, .modal .btn.px-4, .modal .btn.px-5 { padding-left: .875rem !important; padding-right: .875rem !important; }

/* paginação: mesma altura das ações pequenas */
.page-link { font-size: var(--rc-fs-body); padding: .25rem .6rem; min-width: var(--rc-action-h); text-align: center; }

/* ---------- 13. Central de ajuda (FAQ) ---------- */
.faq-layout { display: grid; grid-template-columns: 1fr; gap: 1.5rem; align-items: start; }
@media (min-width: 992px) { .faq-layout { grid-template-columns: 250px minmax(0, 1fr); } }
.faq-toc { position: sticky; top: calc(var(--rc-topbar-h) + 1rem); max-height: calc(100vh - var(--rc-topbar-h) - 2rem); overflow-y: auto; }
.faq-toc a { display: flex; align-items: center; gap: .6rem; padding: .5rem .75rem; border-radius: 10px; color: var(--rc-muted); font-size: .85rem; font-weight: 500; text-decoration: none !important; }
.faq-toc a:hover { background: var(--rc-surface-2); color: var(--rc-text); }
.faq-toc a.active { background: rgba(var(--rc-primary-rgb), .1); color: var(--rc-link); }
.faq-toc a[hidden] { display: none !important; }
@media (max-width: 991.98px) {
    .faq-toc { position: static; max-height: none; display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: thin; }
    .faq-toc a { white-space: nowrap; background: var(--rc-surface); border: 1px solid var(--rc-border); flex: 0 0 auto; }
}

.faq-hero { padding: 1.5rem; display: flex; flex-direction: row; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; }
.faq-hero h1 { color: #fff; margin: 0; }
.faq-hero p { color: rgba(232, 250, 255, .85); margin: .25rem 0 0; }
.faq-search { position: relative; flex: 0 0 auto; width: 100%; max-width: 460px; }
.faq-search .bi { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--rc-muted); pointer-events: none; }
.faq-search input { padding-left: 2.5rem; border: 0; height: 46px; box-shadow: var(--rc-shadow); }
.faq-aud-switch { display: inline-flex; background: rgba(255, 255, 255, .14); border-radius: 12px; padding: 3px; gap: 2px; }
.faq-aud-switch button { white-space: nowrap; border: 0; background: transparent; color: rgba(232, 250, 255, .85); font-size: .8rem; font-weight: 500; padding: .4rem .85rem; border-radius: 9px; }
.faq-aud-switch button.active { background: #fff; color: var(--rc-navy); }

.faq-section { margin-bottom: 2rem; scroll-margin-top: calc(var(--rc-topbar-h) + 1rem); }
.faq-section[hidden] { display: none !important; }
.faq-section > h2 { display: flex; align-items: center; gap: .75rem; font-size: 1.15rem; margin-bottom: .35rem; }
.faq-section > h2 .kpi-icon { width: 36px; height: 36px; font-size: 1.05rem; border-radius: 10px; }
.faq-section > .faq-lead { color: var(--rc-muted); margin-bottom: 1rem; }

.faq-item { background: var(--rc-surface); border: 1px solid var(--rc-border); border-radius: var(--rc-radius); margin-bottom: .6rem; scroll-margin-top: calc(var(--rc-topbar-h) + 1rem); transition: box-shadow .15s; }
.faq-item[open] { box-shadow: var(--rc-shadow-sm); border-color: color-mix(in srgb, var(--rc-primary) 35%, var(--rc-border)); }
.faq-item > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .75rem; padding: .9rem 1.1rem; font-weight: 500; }
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary:hover .faq-q { color: var(--rc-link); }
.faq-q { flex: 1; }
.faq-chevron { color: var(--rc-muted); transition: transform .2s; flex-shrink: 0; }
.faq-item[open] .faq-chevron { transform: rotate(180deg); color: var(--rc-link); }
.faq-aud { font-size: .65rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: .15rem .5rem; border-radius: 999px; flex-shrink: 0; }
.faq-aud-pf { background: rgba(var(--rc-primary-rgb), .12); color: var(--rc-link); }
.faq-aud-pj { background: rgba(124, 58, 237, .13); color: #6d28d9; }
[data-bs-theme='dark'] .faq-aud-pj { color: #c4b5fd; }
.faq-body { padding: 0 1.1rem 1.1rem; color: var(--rc-text); line-height: 1.65; }
.faq-body p { margin-bottom: .75rem; }
.faq-body ul, .faq-body ol { padding-left: 1.25rem; margin-bottom: .75rem; }
.faq-body li { margin-bottom: .25rem; }
.faq-body h3 { font-size: .95rem; margin: 1rem 0 .4rem; }
.faq-body .table { font-size: .85rem; margin-bottom: .75rem; }
.faq-body code, .faq-body .faq-ui { background: var(--rc-surface-2); border: 1px solid var(--rc-border); border-radius: 6px; padding: .05rem .4rem; font-size: .85em; color: var(--rc-text); font-family: inherit; font-weight: 500; white-space: nowrap; }

.faq-steps { list-style: none; padding-left: 0 !important; counter-reset: step; }
.faq-steps > li { counter-increment: step; position: relative; padding-left: 2.4rem; margin-bottom: .6rem; }
.faq-steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--rc-primary); color: #fff; font-size: .78rem; font-weight: 600; display: flex; align-items: center; justify-content: center; }

.faq-callout { border-radius: 12px; padding: .8rem 1rem; margin: .75rem 0; border-left: 4px solid; font-size: .9rem; }
.faq-callout > :last-child { margin-bottom: 0; }
.faq-callout.tip { background: rgba(var(--rc-primary-rgb), .07); border-color: var(--rc-primary); }
.faq-callout.warn { background: rgba(242, 169, 0, .12); border-color: #f2a900; }
.faq-callout.example { background: var(--rc-surface-2); border-color: var(--rc-success); }
.faq-callout strong:first-child { display: block; margin-bottom: .15rem; }
.faq-empty { text-align: center; padding: 2.5rem 1rem; color: var(--rc-muted); }
.faq-empty[hidden] { display: none !important; }
@media (max-width: 575.98px) {
    .faq-body { overflow-x: auto; }
    .faq-body code, .faq-body .faq-ui { white-space: normal; word-break: break-word; }
    .faq-body .table > :not(caption) > * > * { padding: .45rem .5rem; }
    .faq-hero { padding: 1.1rem; }
    .faq-aud-switch { display: flex; width: 100%; }
    .faq-aud-switch button { flex: 1 1 auto; padding: .4rem .5rem; font-size: .78rem; }
    .faq-aud-switch button .bi { display: none; }
    .faq-item > summary { padding: .8rem .9rem; }
    .faq-body { padding: 0 .9rem .9rem; }
    .faq-aud { display: none; }
}
