/*
 * FiscalHub - tema unico (mesmo visual do sistema principal).
 * Tokens de cor, tipografia e layout: static/css/design-tokens.css (carregado antes deste arquivo).
 * Os aliases abaixo mantem os nomes antigos usados pelas telas do app.
 */
:root {
    /* Escala de cinza (antiga paleta fh-*) */
    --fh-white: #ffffff;
    --fh-slate-50: var(--color-surface-muted);
    --fh-slate-100: var(--color-surface-subtle);
    --fh-slate-200: var(--color-border-light);
    --fh-slate-300: var(--color-border-strong);
    --fh-slate-500: var(--color-text-muted);
    --fh-slate-600: var(--color-text-body);
    --fh-slate-700: var(--color-brand-secondary);
    --fh-slate-800: var(--color-brand-primary);
    --fh-slate-900: #0f172a;

    --fh-green: var(--color-success);
    --fh-green-hover: #1e7e34;
    --fh-red: var(--color-danger);
    --fh-red-hover: #bd2130;
    --fh-amber: var(--color-warning);
    --fh-sky: var(--color-brand-accent);

    --color-bg-page: var(--color-surface);
    --color-bg-gradient-start: var(--color-surface);
    --color-bg-gradient-end: var(--color-surface);
    --color-success-hover: #1e7e34;
    --color-danger-hover: #bd2130;
    --color-warning-ink: var(--color-warning-emphasis);

    /* Botoes */
    --btn-neutral-bg: var(--color-surface);
    --btn-neutral-bg-hover: var(--color-surface-muted);
    --btn-neutral-border: var(--color-border-strong);
    --btn-neutral-text: var(--color-brand-primary);
    --btn-success-bg: var(--color-success);
    --btn-success-bg-hover: var(--color-success-hover);
    --btn-danger-bg: var(--color-danger);
    --btn-danger-bg-hover: var(--color-danger-hover);

    /* Fundos suaves para tags / badges */
    --tag-bg-danger-soft: var(--color-danger-subtle);
    --tag-bg-warning-soft: var(--color-warning-subtle);
    --tag-bg-success-soft: var(--color-success-subtle);
    --tag-bg-muted-soft: var(--color-surface-subtle);
    --tag-bg-accent-soft: var(--color-info-subtle);

    --shadow-card: var(--shadow-md);

    --badge-ok-bg: var(--color-success-subtle);
    --badge-ok-ink: var(--color-success-emphasis);
    --badge-pending-bg: var(--color-warning-subtle);
    --badge-pending-ink: var(--color-warning-emphasis);
    --badge-error-bg: var(--color-danger-subtle);
    --badge-error-ink: var(--color-danger-emphasis);
    --badge-neutral-bg: var(--color-border-light);
    --badge-neutral-ink: var(--color-text-body);

    /* Tipografia e espacamento (escala nova) */
    --font-sans: var(--font-family);
    --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
    --fs-2xs: var(--font-size-xs);
    --fs-xs: var(--font-size-xs);
    --fs-sm: var(--font-size-sm);
    --fs-md: var(--font-size-body);
    --fs-base: var(--font-size-body);
    --fs-lg: var(--font-size-body);
    --fs-xl: var(--font-size-display);
    --fw-medium: 500;
    --fw-semibold: var(--font-weight-title);
    --fw-bold: var(--font-weight-strong);
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
}

/* Tokens: static/css/design-tokens.css (carregado antes deste arquivo) */

/* Utilitarios de margem (templates usam classes estilo Bootstrap) */
.me-1 { margin-right: 0.35rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.me-3 { margin-right: 1rem !important; }
.ms-1 { margin-left: 0.25rem !important; }
.ms-2 { margin-left: 0.5rem !important; }
.ms-3 { margin-left: 1rem !important; }
.mr-3 { margin-right: 1rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }

/* Icone + texto inline (titulos, abas, alertas) */
:is(h1, h2, h3, h4, h5, h6) > i[class*="fa-"]:first-child,
.crm-section-header :is(h5, h6) > i[class*="fa-"]:first-child,
.modal-header :is(h3, h4, h5) > i[class*="fa-"]:first-child,
.tab-button > i[class*="fa-"]:first-child,
.medidas-card-title > i[class*="fa-"]:first-child {
    margin-right: var(--icon-text-gap);
}

.clientes-status-badge > i[class*="fa-"],
.badge-padrao > i[class*="fa-"]:not(:only-child) {
    margin-right: 0.35em;
}

.btn-acao-tabela:not(.btn-acao-tabela--icon) > i[class*="fa-"]:first-child {
    margin-right: 0.35em;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: inherit;
}

html {
    font-family: var(--font-family);
    font-size: var(--font-size-body);
    line-height: var(--line-height-body);
}

body {
    background-color: var(--surface);
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: var(--font-size-body);
    line-height: var(--line-height-body);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    min-height: 100vh;
}

h1,
h2,
h3,
h4,
.page-title {
    font-family: var(--font-family);
    font-weight: var(--font-weight-title);
}

h1,
h2,
.page-title {
    font-size: var(--font-size-title);
}

h3 {
    font-size: var(--font-size-section);
}

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

/* Sidebar */
#sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary-color);
    color: var(--surface);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: all var(--transition-speed);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 10px var(--alpha-shadow-xs);
}

#sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    height: var(--header-height);
    background-color: var(--primary-color);
    border-bottom: 1px solid var(--alpha-on-dark-10);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px 0 16px;
}

.sidebar-logo {
    font-weight: 600;
    font-size: var(--font-size-body);
    white-space: nowrap;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.2s;
}

#sidebar.collapsed .sidebar-logo {
    opacity: 0;
    width: 0;
    display: none;
}

.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--surface);
    cursor: pointer;
    font-size: var(--font-size-body);
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--alpha-on-dark-08);
    outline: 2px solid var(--alpha-on-dark-45);
    outline-offset: -2px;
}

.sidebar-toggle:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.sidebar-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px 0;
}

.sidebar-nav-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 12px 10px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--alpha-shadow-xl);
    border: 1px solid var(--alpha-on-dark-08);
}

.sidebar-nav-search[hidden] {
    display: none !important;
}

.sidebar-nav-search__icon {
    color: var(--alpha-on-dark-45);
    font-size: var(--font-size-xs);
    flex-shrink: 0;
}

.sidebar-nav-search__input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--alpha-on-dark-85);
    font-size: var(--font-size-xs);
    font-family: inherit;
}

.sidebar-nav-search__input::placeholder {
    color: var(--alpha-on-dark-45);
}

.sidebar-nav-hidden {
    display: none !important;
}

#sidebar.collapsed .sidebar-nav-search {
    display: none !important;
}

.sidebar-content:focus-within .sidebar-nav-search:not([hidden]) {
    border-color: var(--alpha-on-dark-20);
}

.sidebar-footer {
    flex-shrink: 0;
    margin-top: auto;
    border-top: 1px solid var(--alpha-on-dark-10);
    background: var(--alpha-shadow-md);
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.sidebar-account {
    flex-shrink: 0;
    padding: 10px 12px 8px;
}

#sidebar.collapsed .sidebar-account {
    padding: 8px 6px;
}

/* Navigation */
/* Navigation & Sidebar UI */
.nav-category {
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    color: var(--alpha-on-dark-20);
    font-weight: 700;
    padding: 20px 20px 8px;
    letter-spacing: 1px;
}

#sidebar.collapsed .nav-category {
    display: none;
}

/* Sidebar Account Section */
.user-info-box {
    display: flex;
    align-items: center;
    background: var(--alpha-on-dark-06);
    margin: 0;
    padding: 10px 10px;
    border-radius: 12px;
    border: 1px solid var(--alpha-on-dark-08);
    gap: 8px;
    transition: background 0.2s ease;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.user-avatar {
    position: relative;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: var(--alpha-on-dark-12);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    color: var(--alpha-on-dark-85);
}

.user-avatar__status {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
    border: 2px solid var(--primary-color);
    box-sizing: content-box;
}

.user-details {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
    gap: 2px;
}

.user-display-name {
    font-size: var(--font-size-sm);
    color: var(--surface);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.03em;
}

.user-group-line {
    font-size: var(--font-size-xs);
    color: var(--alpha-on-dark-55);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-group-line strong {
    color: var(--alpha-on-dark-85);
    font-weight: 700;
}

.sidebar-logout-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--alpha-on-dark-55) !important;
    text-decoration: none !important;
    transition: color 0.2s ease, background 0.2s ease;
}

.sidebar-logout-btn:hover {
    color: var(--surface) !important;
    background: var(--alpha-on-dark-10);
}

.sidebar-logout-btn i {
    font-size: var(--font-size-body);
}

.sidebar-footer__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 7px 10px 10px;
    border-top: 1px solid var(--alpha-on-dark-08);
    box-sizing: border-box;
}

.sidebar-footer__dev {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--font-size-xs);
    color: var(--alpha-on-dark-45);
    line-height: 1.3;
}

.sidebar-footer__version {
    flex: 0 0 auto;
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--alpha-on-dark-12);
    color: var(--surface);
    font-size: var(--font-size-xs);
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

#sidebar.collapsed .sidebar-footer__bottom {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 4px 8px;
}

#sidebar.collapsed .sidebar-footer__dev {
    display: none;
}

#sidebar.collapsed .sidebar-footer__version {
    font-size: var(--font-size-xs);
    padding: 2px 6px;
}

/* Legado: telas de caixa que ocultam credito */
.developer-credit {
    display: none;
}

/* Collapsed Sidebar - apenas botao Sair */
#sidebar.collapsed .user-info-box {
    padding: 6px 4px;
    background: transparent;
    border: none;
    justify-content: center;
    gap: 0;
}

#sidebar.collapsed .user-avatar,
#sidebar.collapsed .user-details {
    display: none !important;
}

#sidebar.collapsed .sidebar-logout-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--alpha-on-dark-70);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-size: var(--font-size-sm);
    white-space: nowrap;
    gap: 4px;
}

.nav-link .nav-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sidebar.collapsed .nav-link {
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    background-color: var(--alpha-on-dark-10);
    color: var(--surface);
    text-decoration: none;
}

.nav-link.active {
    border-left-color: var(--accent-color);
    background-color: var(--alpha-sidebar-panel);
}

.nav-icon {
    width: 24px;
    text-align: center;
    margin-right: 12px;
    font-size: var(--font-size-section);
}

#sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px 10px;
}

#sidebar.collapsed .nav-icon {
    margin-right: 0;
}

#sidebar.collapsed .nav-text {
    display: none;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: var(--page-padding);
    background: var(--surface);
    transition: margin-left var(--transition-speed);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
}

.main-content.expanded {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
}

/* Responsive Layout & Sidebar Sync */
#sidebar.collapsed~.main-content {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
}

@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
    }

    #sidebar.mobile {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 15px;
    }

    .mobile-header {
        display: flex;
        align-items: center;
        background: var(--primary-color);
        color: white;
        padding: 10px 15px;
        margin: -15px -15px 20px -15px;
    }
}

.page-header {
    text-align: center;
    margin-bottom: 30px;
    width: 100%;
}

.page-title {
    color: var(--primary-color);
    font-size: var(--font-size-title);
    font-weight: var(--font-weight-title);
    margin: 0;
}

h2 {
    font-size: var(--font-size-title);
    font-weight: var(--font-weight-title);
    color: var(--primary-color);
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
    padding-bottom: 8px;
    text-align: center;
    line-height: 1.2;
}

h2::after {
    content: "";
    position: absolute;
    width: 42px;
    height: 3px;
    background-color: var(--accent-color);
    bottom: 0;
    left: 0;
    border-radius: 2px;
}

.mobile-header {
    display: none;
}

/* ========== GLOBAL COMPONENTS & TABLES ========== */

.container,
.container-fluid {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

/* If nested, make the inner container transparent */
.container .container,
.container-fluid .container,
.container-fluid .container-fluid {
    background: transparent;
    box-shadow: none;
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    box-shadow: 0 2px 8px var(--alpha-shadow-xs);
    border-radius: 8px;
    overflow: hidden;
    background: white;
    min-width: 800px;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

th,
td {
    border: 1px solid var(--color-border-light);
    padding: 10px 12px;
    text-align: left;
    font-size: var(--font-size-table);
}

th {
    background-color: var(--primary-color);
    color: white;
    font-weight: var(--font-weight-title);
    text-transform: uppercase;
    font-size: var(--font-size-table-head);
    letter-spacing: 0.5px;
}

tr:nth-child(even) {
    background-color: var(--surface-muted);
}

tr:hover {
    background-color: var(--border-color-light);
}

h3 {
    padding-top: 8px;
    color: var(--color-brand-primary);
    font-size: var(--font-size-section);
    margin-bottom: 15px;
    font-weight: var(--font-weight-title);
}

h4 {
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: var(--font-size-section);
    font-weight: 600;
}

/* ========== GLOBAL COMPONENT DEFAULTS ========== */
input[type="text"],
input[type="date"],
input[type="datetime-local"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
select.form-control,
.group-select {
    height: 44px;
    padding: 10px 14px;
    padding-right: 2.5rem;
    border: 2px solid var(--border-color-light);
    border-radius: 8px;
    background-color: var(--surface);
    font-size: var(--font-size-body);
    font-family: inherit;
    color: var(--text-body-secondary);
    width: 100%;
    transition: all 0.2s ease;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: var(--select-chevron);
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px 8px;
}

/* Data: sem chevron de select; o navegador ja exibe o indicador de calendario */
input[type="date"] {
    background-image: none;
    padding-right: 14px;
}

/* Numero: sem chevron de select (spinners nativos do navegador permanecem) */
input[type="number"] {
    background-image: none;
    padding-right: 14px;
}

/* Texto/senha/e-mail: sem chevron de select */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="datetime-local"] {
    background-image: none;
    padding-right: 14px;
}

input:focus,
select:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 3px var(--alpha-accent-25);
}

label,
.filtro-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: var(--font-size-body);
    color: var(--text-body-secondary);
    text-align: left;
}

button:not(.btn-acao-tabela):not(.btn-action):not(.btn-sm):not(.btn-edit):not(.sidebar-toggle):not(.tab-button):not(.close):not(.btn-secundario):not(.func-docs__tab):not(.admissional-btn):not(.stat-item-filtro):not(.btn-confirmar-dia),
.btn-padrao {
    height: var(--btn-height, 44px);
    min-height: var(--btn-height, 44px);
    padding: 0 var(--btn-padding-x, 24px);
    text-transform: none;
    letter-spacing: normal;
    border: none;
    border-radius: 8px;
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    font-size: var(--font-size-body);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

button:not(.btn-acao-tabela):not(.btn-action):not(.btn-sm):not(.btn-edit):not(.sidebar-toggle):not(.tab-button):not(.close):not(.btn-secundario):not(.func-docs__tab):not(.admissional-btn):not(.stat-item-filtro):not(.btn-confirmar-dia):hover,
.btn-padrao:hover {
    background-color: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--alpha-shadow-md);
    color: white;
}

.btn-secundario,
a.btn-secundario {
    height: var(--btn-height, 44px);
    min-height: var(--btn-height, 44px);
    padding: 0 var(--btn-padding-x-sm, 16px);
    text-transform: none;
    letter-spacing: normal;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface);
    color: var(--primary-color);
    font-weight: 600;
    font-size: var(--font-size-body);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    text-decoration: none;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.btn-secundario:hover,
a.btn-secundario:hover {
    background: var(--surface);
    border-color: var(--accent-color);
    color: var(--primary-color);
    transform: none;
    box-shadow: none;
    outline: 2px solid var(--accent-color);
    outline-offset: -2px;
}

.btn-padrao--sm,
.btn-secundario.btn-padrao--sm,
a.btn-secundario.btn-padrao--sm {
    height: var(--btn-height-sm, 36px);
    min-height: var(--btn-height-sm, 36px);
    padding: 0 var(--btn-padding-x-sm, 16px);
    font-size: var(--font-size-body);
    text-transform: none;
    letter-spacing: normal;
}

/* Linhas de acao: primario + secundario com a mesma altura */
.form-actions,
.btn-toolbar,
.lmc-form-actions,
.relatorio-toolbar__actions,
.modal-footer,
.header-buttons-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.form-actions > .btn-padrao,
.form-actions > .btn-secundario,
.form-actions > a.btn-padrao,
.form-actions > a.btn-secundario,
.form-actions > button[type="submit"],
.btn-toolbar > .btn-padrao,
.btn-toolbar > .btn-secundario,
.btn-toolbar > a.btn-padrao,
.btn-toolbar > a.btn-secundario,
.btn-toolbar > button,
.lmc-form-actions > .btn-padrao,
.lmc-form-actions > .btn-secundario,
.lmc-form-actions > a.btn-padrao,
.lmc-form-actions > a.btn-secundario,
.lmc-form-actions > button[type="submit"],
.relatorio-toolbar__actions > .btn-padrao,
.relatorio-toolbar__actions > .btn-secundario,
.relatorio-toolbar__actions > a.btn-padrao,
.relatorio-toolbar__actions > a.btn-secundario,
.relatorio-toolbar__actions > button,
.header-buttons-group > .btn-padrao,
.header-buttons-group > .btn-secundario,
.header-buttons-group > .portal-caixa-btn,
.header-buttons-group > a.portal-caixa-btn {
    height: var(--btn-height, 44px);
    min-height: var(--btn-height, 44px);
    margin-bottom: 0;
    box-sizing: border-box;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 600;
}

.modal-footer > .btn-padrao,
.modal-footer > .btn-secundario,
.modal-footer > a.btn-padrao,
.modal-footer > a.btn-secundario,
.modal-footer > button {
    height: var(--btn-height-sm, 36px);
    min-height: var(--btn-height-sm, 36px);
    margin-bottom: 0;
    box-sizing: border-box;
    text-transform: none;
}

.filtro-row--bar .filtro-item--action .btn-padrao,
.filtro-row--bar .filtro-item--action a.btn-padrao,
.filtro-row--bar .filtro-item--action .btn-secundario,
.filtro-row--bar .filtro-item--action button[type="submit"],
.filtro-row--bar .filtro-item:has(.btn-consultar) .btn-consultar {
    height: var(--btn-height, 44px);
    min-height: var(--btn-height, 44px);
    margin-bottom: 0;
    box-sizing: border-box;
}

/* Sobrescreve estilos legados de paginas (caixa, etc.) que forcavam MAIUSCULAS em botoes */
.main-content button:not(.tab-button):not(.sidebar-toggle):not(.close):not(.btn-acao-tabela):not(.func-docs__tab),
.main-content .btn-padrao,
.main-content .btn-secundario,
.main-content .btn-consultar,
.main-content .portal-caixa-btn,
.main-content a.btn-padrao,
.main-content a.btn-secundario {
    text-transform: none !important;
    letter-spacing: normal !important;
}

.btn-login {
    text-transform: none !important;
    letter-spacing: normal !important;
}

.stat-card {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 16px;
    background: var(--surface);
    box-shadow: none;
}

.stat-card__label {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.stat-card__value {
    font-size: var(--font-size-display);
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.1;
}

.badge-padrao {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-sizing: border-box;
    padding: 5px 10px;
    border-radius: var(--badge-radius);
    font-size: var(--font-size-badge);
    font-weight: var(--font-weight-title);
    line-height: 1.35;
    border: 1px solid transparent;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.badge-padrao--info {
    border-color: color-mix(in srgb, var(--color-info) 20%, var(--color-border-light));
    background: color-mix(in srgb, var(--color-info-subtle) 65%, var(--color-surface-muted));
    color: var(--color-info-emphasis);
}

.badge-padrao--success {
    border-color: var(--color-success-subtle);
    background: var(--color-success-subtle);
    color: var(--color-success-emphasis);
}

.badge-padrao--danger {
    border-color: var(--color-danger-subtle);
    background: var(--color-danger-subtle);
    color: var(--color-danger-emphasis);
}

.badge-padrao--neutral {
    border-color: var(--color-border-light);
    background: var(--color-surface-muted);
    color: var(--color-text-body);
}

.badge-padrao--warning {
    border-color: var(--color-warning-subtle);
    background: var(--color-warning-subtle);
    color: var(--color-warning-emphasis);
}

/* Indicadores de texto: formato retangular unico (sem pill) */
.badge-padrao,
.badge-condicao,
.clientes-status-badge,
.funcionarios-status-badge,
.group-badge,
.ag-badge,
.badge-ativo,
.badge-classe,
.pessoa-codigo-badge,
.badge-banco-pix,
.status-badge,
.badge,
.badge-a,
.badge-b,
.badge-c,
.extrato-badge,
.medidas-tipo,
.funcionarios-birthdays__badge,
.clientes-status-badge--liberado,
.clientes-status-badge--bloqueado,
.clientes-status-badge--inativo,
.clientes-status-badge--na {
    border-radius: var(--badge-radius) !important;
}

.snapshot-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.snapshot-nav__btn {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface);
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 700;
    font-size: var(--font-size-body);
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}

.snapshot-nav__btn:hover:not(:disabled) {
    border-color: var(--accent-color);
}

.snapshot-nav__btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.snapshot-nav__label {
    font-size: var(--font-size-body);
    color: var(--text-body-secondary);
    min-width: 180px;
    text-align: center;
}

.overview-card,
.crm-kpi-card {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 16px;
    background: var(--surface);
    box-shadow: none;
}

.crm-kpi-card {
    border-left: 2px solid var(--border-color);
}

.crm-kpi-card:hover,
.overview-card:hover {
    transform: none;
}

.crm-kpi-card .kpi-value,
.overview-value {
    font-size: var(--font-size-display);
}

.crm-kpi-card .kpi-label,
.overview-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.kpi-filter.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--alpha-accent-25);
    transform: none;
}

.crm-kpi-card.kpi-warning { border-color: var(--color-warning-subtle); }
.crm-kpi-card.kpi-danger { border-color: var(--color-danger-subtle); }
.crm-kpi-card.kpi-success { border-color: var(--color-success-subtle); }
.crm-kpi-card.kpi-info { border-color: var(--color-info-subtle); }

.group-badge {
    border-color: color-mix(in srgb, var(--color-info) 20%, var(--color-border-light));
    background: color-mix(in srgb, var(--color-info-subtle) 65%, var(--color-surface-muted));
    color: var(--color-info-emphasis);
    border-radius: var(--badge-radius);
    border-width: 1px;
    border-style: solid;
    padding: 4px 10px;
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.clientes-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border-radius: var(--badge-radius);
    border: 1px solid transparent;
    padding: 5px 10px;
    font-size: var(--font-size-xs);
    line-height: 1.35;
}

.clientes-status-badge--liberado {
    border-color: var(--color-success-subtle);
    background: var(--color-success-subtle);
    color: var(--color-success-emphasis);
}

.clientes-status-badge--bloqueado {
    border-color: var(--color-danger-subtle);
    background: var(--color-danger-subtle);
    color: var(--color-danger-emphasis);
}

.clientes-status-badge--inativo,
.clientes-status-badge--na {
    border-color: var(--color-border-light);
    background: var(--color-surface-muted);
    color: var(--color-text-body);
}

.ag-badge {
    border-radius: var(--badge-radius);
    border: 1px solid transparent;
    padding: 4px 10px;
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.ag-badge--active {
    border-color: var(--color-success-subtle);
    background: var(--color-success-subtle);
    color: var(--color-success-emphasis);
}

.ag-badge--inactive {
    border-color: var(--color-danger-subtle);
    background: var(--color-danger-subtle);
    color: var(--color-danger-emphasis);
}

.ag-badge--disabled {
    border-color: var(--color-border-light);
    background: var(--color-surface-muted);
    color: var(--color-text-body);
}

.badge-ativo {
    border-radius: var(--badge-radius);
    border: 1px solid transparent;
    padding: 4px 10px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    display: inline-flex;
}

.badge-ativo.sim {
    border-color: var(--color-success-subtle);
    background: var(--color-success-subtle);
    color: var(--color-success-emphasis);
}

.badge-ativo.nao {
    border-color: var(--color-danger-subtle);
    background: var(--color-danger-subtle);
    color: var(--color-danger-emphasis);
}

.ag-card {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

.ag-table th {
    background-color: var(--primary-color);
    color: var(--surface);
    font-weight: 600;
    text-transform: uppercase;
    font-size: var(--font-size-sm);
    letter-spacing: 0.5px;
    border-bottom: none;
}

.badge-classe {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: var(--badge-radius);
    font-size: var(--font-size-xs);
    font-weight: 600;
    border: 1px solid transparent;
}

.badge-classe.vip {
    border-color: var(--color-warning-subtle);
    background: var(--color-warning-subtle);
    color: var(--color-warning-emphasis);
}

.badge-classe.normal {
    border-color: var(--color-border-light);
    background: var(--color-surface-muted);
    color: var(--color-text-body);
}

.badge-classe.risco {
    border-color: var(--color-danger-subtle);
    background: var(--color-danger-subtle);
    color: var(--color-danger-emphasis);
}

.main-content .status-card,
.main-content .status-empresas-card,
.main-content .vista-baseline-card,
.main-content .limite-cargo-card {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    box-shadow: none;
    background: var(--surface);
}

.main-content .pending-queue-card {
    border: 2px solid var(--color-warning-subtle);
    border-radius: 8px;
    box-shadow: none;
    background: var(--color-warning-subtle);
}

/* Form Layout */
form {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
}

form button[type="submit"] {
    text-transform: none;
    letter-spacing: normal;
}

.main-content>.container,
.main-content>.container-fluid {
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    min-height: 0;
    width: 100%;
    max-width: none;
}

/* Page Header Centering */
.page-header {
    width: 100%;
    margin-bottom: 35px;
    display: flex;
    justify-content: center;
}

h2 {
    font-size: var(--font-size-title);
    font-weight: var(--font-weight-title);
    color: var(--primary-color);
    margin-bottom: 0;
    position: relative;
    display: inline-block;
    padding-bottom: 12px;
    text-align: center;
    line-height: 1.2;
}

h2::after {
    content: "";
    position: absolute;
    width: 42px;
    height: 3px;
    background-color: var(--accent-color);
    bottom: 0;
    left: 0;
    border-radius: 2px;
}

/* Form & Filter Grid Optimization */
.filtro-row {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    row-gap: 22px;
    width: 100%;
    align-items: flex-end;
    margin-bottom: 25px;
    padding: 12px 0;
}

/* Barra de busca/filtro (layout Consulta IE: sem cartao de contencao) */
.filtro-row--bar {
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 20px;
    row-gap: 16px;
    margin-bottom: 16px;
    padding: 12px 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.filter-sheet .filtro-row--bar,
.tab-shell .filtro-row--bar {
    margin-bottom: 16px;
}

.filtro-row--bar .filtro-item,
form > .filtro-row > .filtro-item {
    flex: 1 1 200px;
    max-width: 350px;
    padding: 0;
    min-width: 0;
}

.filtro-row--bar .filtro-item--doc {
    flex: 1 1 280px;
    max-width: 420px;
}

.filtro-row--bar .filtro-item--uf {
    flex: 0 1 200px;
    max-width: 220px;
}

.filtro-row--bar .filtro-item--action,
form > .filtro-row > .filtro-item--action,
form > .filtro-row > .filtro-item:has(button[type="submit"]),
form > .filtro-row > .filtro-item:has(.btn-padrao),
form > .filtro-row > .filtro-item:has(.btn-consultar) {
    flex: 0 0 auto;
    max-width: none;
}

.filtro-row--bar .filtro-item label,
.filtro-row--bar .filtro-label-spacer,
form > .filtro-row > .filtro-item > label {
    display: block;
    margin-bottom: 6px;
    font-size: var(--font-size-body);
    font-weight: 600;
    color: var(--text-strong);
    min-height: 18px;
}

.filtro-row--bar input:not([type="checkbox"]):not([type="radio"]),
.filtro-row--bar select,
form > .filtro-row input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
form > .filtro-row select {
    width: 100%;
    height: 44px;
}

.filtro-row--bar input[type="checkbox"],
.filtro-row--bar input.negociacoes-switch,
.negociacoes-page input[type="checkbox"].negociacoes-switch {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
    appearance: auto;
    -webkit-appearance: checkbox;
    -moz-appearance: checkbox;
    background-image: none;
    border: 1px solid var(--color-text-disabled);
    border-radius: 3px;
    box-shadow: none;
    cursor: pointer;
    vertical-align: middle;
}

.filtro-row--bar input[type="checkbox"]:focus,
.negociacoes-page input[type="checkbox"].negociacoes-switch:focus {
    outline: 2px solid var(--alpha-accent-25);
    outline-offset: 1px;
    box-shadow: none;
}

.negociacoes-page .filtro-item--multiselect {
    flex: 1 1 200px;
    max-width: 280px;
}

.negociacoes-page .negociacoes-acoes-busca-col .btn-padrao,
.negociacoes-page .negociacoes-acoes-busca-col .btn-negociacoes-pdf {
    height: 44px;
    min-height: 44px;
}

form > .filtro-row {
    justify-content: flex-start;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 20px;
    row-gap: 16px;
    width: 100%;
    flex: 1 1 100%;
    margin-bottom: 16px;
    padding: 12px 0;
}

form > .index-layout-grid,
form > .filter-sheet-results,
form > .summary-box {
    flex: 1 1 100%;
    width: 100%;
}

.filtro-item {
    flex: 1 1 200px;
    max-width: 350px;
    padding: 8px 0;
}

/* Specific fix for checkbox items in filtro-row */
.filtro-item.checkbox-item {
    flex: 0 1 auto;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: 5px;
}

/* Compact button placement */
form button[type="submit"],
.filtro-row button,
.btn-consultar {
    height: var(--btn-height, 44px);
    min-height: var(--btn-height, 44px);
    padding: 0 var(--btn-padding-x, 24px);
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    margin-bottom: 2px;
    width: auto;
    box-sizing: border-box;
}

/* Modal Core Styles - RESTORED */
.modal,
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 10000;
    inset: 0;
    width: 100%;
    height: 100%;
    background-color: var(--alpha-sidebar-scrim);
    backdrop-filter: blur(4px);
    overflow: hidden;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    overscroll-behavior: contain;
}

.modal.is-open,
.modal.active,
.modal-overlay.is-open,
.modal-overlay.active {
    display: flex !important;
}

.modal-box {
    --modal-width: 600px;
    width: min(var(--modal-width), calc(100vw - 48px));
    max-width: min(var(--modal-width), calc(100vw - 48px));
    max-height: min(88vh, calc(100dvh - 48px));
    min-width: 0;
    flex: 0 1 auto;
    align-self: center;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--color-surface, #fff);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
    position: relative;
    box-sizing: border-box;
}

.modal-box.modal-lg {
    --modal-width: 1040px;
}

.modal-box.wider {
    --modal-width: 900px;
}

.modal-box > .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
}

.modal-box > .modal-header .close,
.modal-box > .modal-header > button[onclick*="close"],
.modal-box > .modal-header > button[onclick*="Close"] {
    margin-left: auto;
    position: static;
    flex: 0 0 auto;
}

.modal-box > .modal-header,
.modal-box > .modal-footer {
    flex: 0 0 auto;
    position: relative;
    z-index: 2;
    background: var(--color-surface, #fff);
}

.modal-box > .modal-footer {
    border-top: 1px solid var(--color-border, #e9ecef);
}

#importXmlModal .modal-footer:has(#btnStartXmlImport[style*="display: none"]),
#importXmlModal .modal-footer:has(#btnStartXmlImport[style*="display:none"]) {
    display: none;
}

.modal-box > .modal-body,
.modal-box > .modal-body-content {
    overflow: auto;
    min-height: 0;
    flex: 1 1 auto;
    max-width: 100%;
    max-height: calc(100dvh - 190px);
}

.modal-box table {
    min-width: 0;
    overflow: visible;
}

#docDetailsModal .modal-header,
#docDetailsModal .modal-footer {
    padding: 12px 16px;
}

#docDetailsModal .modal-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: auto;
    padding: 10px 14px 14px;
    scrollbar-gutter: stable;
}

#docDetailsModal .doc-summary,
#docDetailsModal .doc-parcelas,
#docDetailsModal .doc-items {
    flex: 0 0 auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
}

.doc-summary__grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 5px 14px;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid var(--color-border, #e9ecef);
    border-radius: 8px;
    font-size: 12px;
}

.doc-summary__item {
    display: flex;
    align-items: baseline;
    gap: 5px;
    min-width: 0;
    line-height: 1.3;
}

.doc-summary__item--s3 {
    grid-column: span 3;
}

.doc-summary__item--s4 {
    grid-column: span 4;
}

.doc-summary__item--s6 {
    grid-column: span 6;
}

.doc-summary__item--s9 {
    grid-column: span 9;
}

.doc-summary__item--s12 {
    grid-column: 1 / -1;
}

.doc-summary__label {
    flex: 0 0 96px;
    min-width: 96px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--primary-color);
}

.doc-summary__label::after {
    content: ":";
}

.doc-summary__value {
    flex: 1 1 auto;
    min-width: 0;
    color: #2f3b46;
    overflow-wrap: anywhere;
}

.doc-summary__value--key {
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
    font-size: 11px;
    word-break: break-all;
}

.doc-summary__value--pre {
    white-space: pre-wrap;
    font-size: 11.5px;
}

@media (max-width: 720px) {
    .doc-summary__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .doc-summary__item--s3,
    .doc-summary__item--s4 {
        grid-column: span 1;
    }

    .doc-summary__item--s6,
    .doc-summary__item--s9,
    .doc-summary__item--s12 {
        grid-column: 1 / -1;
    }
}

.doc-numero {
    white-space: nowrap;
}

.badge-parcela {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 6px;
    border: 1px solid #c5d7f2;
    background: #e8f1fb;
    color: #1a4f8b;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    vertical-align: middle;
    white-space: nowrap;
}

.badge-parcela i {
    font-size: 11px;
}

.doc-parcelas {
    border: 1px solid var(--color-border, #e6eaf0);
    border-radius: 8px;
    background: var(--color-surface, #fff);
    overflow: hidden;
}

.doc-parcelas__head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 10px;
    background: #f4f8fc;
    color: var(--primary-color);
    font-size: 13px;
}

.doc-parcelas__head .badge-parcela {
    margin-left: 0;
}

.doc-parcelas__meta {
    color: #5c6b7a;
    font-size: 12px;
    font-weight: 600;
}

.doc-parcelas__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.doc-parcelas__table th,
.doc-parcelas__table td {
    padding: 5px 10px;
    text-align: left;
    border-top: 1px solid #eef2f6;
    white-space: nowrap;
}

.doc-parcelas__table th {
    color: #5c6b7a;
    font-size: 11px;
    font-weight: 700;
    background: #fff;
}

.doc-parcelas__table td.num,
.doc-parcelas__table th:last-child,
.doc-parcelas__table tfoot td.num {
    text-align: right;
}

.doc-parcelas__table tfoot td {
    font-weight: 700;
    background: #f8fafc;
}

.doc-items-wrap {
    overflow-x: auto;
    max-width: 100%;
    border: 1px solid var(--color-border, #eee);
    border-radius: 8px;
}

.modal-box .doc-items-table {
    width: 100%;
    min-width: 720px;
    margin-top: 0;
    font-size: 12px;
    box-shadow: none;
}

.doc-items-table th,
.doc-items-table td {
    white-space: nowrap;
}

.modal-content {
    background-color: white;
    padding: 10px 12px 12px;
    border-radius: 16px;
    width: 100%;
    max-width: 1100px;
    max-height: min(90vh, calc(100dvh - 40px));
    margin: auto;
    box-shadow: 0 20px 50px var(--alpha-shadow-xl);
    animation: slideIn 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    border: 1px solid var(--alpha-on-dark-10);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    isolation: isolate;
}

#modalContent,
.modal-body-content,
.modal-content > div:not(.close) {
    padding: 38px 4px 10px 18px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-light) transparent;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
    border-radius: 10px;
    background-color: white;
}

#modalContent::-webkit-scrollbar,
.modal-body-content::-webkit-scrollbar,
.modal-content > div:not(.close)::-webkit-scrollbar {
    width: 8px;
}

#modalContent::-webkit-scrollbar-track,
.modal-body-content::-webkit-scrollbar-track,
.modal-content > div:not(.close)::-webkit-scrollbar-track {
    background: transparent;
}

#modalContent::-webkit-scrollbar-thumb,
.modal-body-content::-webkit-scrollbar-thumb,
.modal-content > div:not(.close)::-webkit-scrollbar-thumb {
    background-color: var(--color-border-light);
    border-radius: 8px;
    border: 2px solid white;
    background-clip: padding-box;
}

#modalContent::-webkit-scrollbar-thumb:hover,
.modal-body-content::-webkit-scrollbar-thumb:hover,
.modal-content > div:not(.close)::-webkit-scrollbar-thumb:hover {
    background-color: var(--color-text-subtle);
}

.modal-body-content .modal-header h3 {
    margin: 0 0 20px 0;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    font-size: var(--font-size-title);
}

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

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

.close {
    position: absolute;
    right: 14px;
    top: 10px;
    color: var(--color-text-subtle);
    font-size: var(--font-size-display);
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close:hover,
.close:focus {
    color: black;
    background-color: var(--color-surface-muted);
    text-decoration: none;
}

/* ========== LAYOUT PRINCIPAL (ex-base.html da raiz) ========== */
        /* Reset & Core Standards */
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            background-color: var(--surface);
            font-family: var(--font-family, "Segoe UI", Arial, sans-serif);
            font-size: var(--font-size-body, 14px);
            color: var(--text-strong);
            min-height: 100vh;
        }

        /* Loading Overlay Universal */
        .app-loading-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: var(--alpha-on-dark-85);
            backdrop-filter: blur(2px);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 9999;
            transition: opacity 0.2s ease;
        }

        .app-loading-overlay.active {
            display: flex;
        }

        .app-loading-content {
            text-align: center;
            background: white;
            padding: 30px 40px;
            border-radius: 8px;
            box-shadow: 0 4px 20px var(--alpha-shadow-lg);
            min-width: 300px;
        }

        .app-loading-bar-container {
            width: 100%;
            height: 6px;
            background-color: var(--color-border-muted);
            border-radius: 3px;
            overflow: hidden;
            margin-bottom: 15px;
        }

        .app-loading-bar-fill {
            height: 100%;
            background: linear-gradient(90deg,
                    var(--primary-color, var(--primary-color)),
                    var(--secondary-color, var(--accent-color)));
            width: 30%;
            border-radius: 3px;
            animation: app-loading-progress 1.5s ease-in-out infinite;
        }

        @keyframes app-loading-progress {
            0% {
                width: 0%;
                margin-left: 0%;
            }

            50% {
                width: 50%;
                margin-left: 25%;
            }

            100% {
                width: 0%;
                margin-left: 100%;
            }
        }

        .app-loading-text {
            color: var(--color-text-body);
            font-size: var(--font-size-body);
            font-weight: 500;
        }

        /* Bloqueio de botoes durante loading */
        body.app-loading button,
        body.app-loading input[type="submit"],
        body.app-loading .btn,
        body.app-loading [onclick] {
            pointer-events: none;
            opacity: 0.6;
            cursor: not-allowed;
        }

        /* Excecao: botoes do loading, sidebar e modais padronizados */
        body.app-loading .app-loading-overlay button,
        body.app-loading #sidebar button,
        body.app-loading .sidebar-toggle,
        body.app-loading .modal,
        body.app-loading .modal .close,
        body.app-loading .modal button,
        body.app-loading .modal [onclick] {
            pointer-events: auto;
            opacity: 1;
            cursor: pointer;
        }

        /* Global Scrollbar Styling */
        ::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }

        ::-webkit-scrollbar-track {
            background: var(--scrollbar-track);
        }

        ::-webkit-scrollbar-thumb {
            background: var(--scrollbar-thumb);
            border-radius: 10px;
            border: 2px solid var(--scrollbar-track);
        }

        ::-webkit-scrollbar-thumb:hover {
            background: var(--scrollbar-thumb-hover);
        }

        /* Sidebar Scrollbar */
        #sidebar .sidebar-content::-webkit-scrollbar {
            width: 5px;
        }

        #sidebar .sidebar-content::-webkit-scrollbar-track {
            background: var(--primary-color);
        }

        #sidebar .sidebar-content::-webkit-scrollbar-thumb {
            background: var(--alpha-on-dark-20);
            border: none;
        }

        #sidebar .sidebar-content::-webkit-scrollbar-thumb:hover {
            background: var(--alpha-on-dark-20);
        }
    

/* ========== ESTILOS ESPECÍFICOS - INDEX ========== */

.pdv-container {
    grid-column: span 2;
    margin: 10px 0 20px;
    padding: 12px;
    border: 1px solid #dce1e8;
    border-radius: 6px;
    background-color: #f8f9fa;
}

.pdv-all-option {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: center;
}

.pdv-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.pdv-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background-color: white;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    min-width: 120px;
}

.pdv-item label {
    margin: 0;
    font-weight: normal;
    font-size: 13px;
    cursor: pointer;
}

.pdv-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
}

.loading-text,
.sem-pdvs {
    padding: 10px;
    color: #6c757d;
    font-style: italic;
    text-align: center;
}

/* ========== ESTILOS ESPECÍFICOS - PAGAMENTOS ========== */

.tipo-pagamento {
    font-weight: bold;
    color: var(--secondary-color);
}

tfoot tr {
    background: #e9f4ff;
    font-weight: bold;
}

.results-container {
    margin-top: 0;
}

/* Multiselect */
.multiselect-container {
    position: relative;
    width: 100%;
    min-height: 42px;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 14px;
    z-index: 2;
    pointer-events: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

.multiselect-container.has-text .search-icon {
    color: #28a745;
    transform: translateY(-50%) scale(1.1);
}

.multiselect-container.open .search-icon {
    color: var(--primary-color);
}

.multiselect-input {
    width: 100%;
    padding: 10px 35px 10px 32px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    color: #212529;
    background-color: #fff;
    cursor: text;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.multiselect-input:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(44, 62, 80, 0.25);
}

.multiselect-input:placeholder-shown {
    color: #adb5bd;
}

.multiselect-input.typing {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

.multiselect-input::placeholder {
    color: #6c757d;
    font-style: italic;
    font-weight: 400;
}

.multiselect-input::selection {
    background-color: var(--primary-color);
    color: #ffffff;
}

.selected-items {
    position: absolute;
    top: 1px;
    left: 32px;
    right: 35px;
    bottom: 1px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
    pointer-events: none;
    z-index: 1;
}

.selected-item {
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Report Utility Classes */
.row-striped-even {
    background-color: #f8f9fa;
}

.row-striped-odd {
    background-color: white;
}

.row-success-light {
    background-color: #e6ffe6 !important;
}

.text-danger-bold {
    color: #dc3545 !important;
    font-weight: bold !important;
}

.text-success-bold {
    color: #28a745 !important;
    font-weight: bold !important;
}

.selected-item.all-selected {
    background: #28a745;
    font-weight: 600;
}

.multiselect-arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 12px;
    pointer-events: none;
    transition: transform 0.2s ease;
}

.multiselect-container.open .multiselect-arrow {
    transform: translateY(-50%) rotate(180deg);
    color: var(--primary-color);
}

.multiselect-container.open .multiselect-input {
    border-color: var(--primary-color);
    border-bottom-color: #ffffff;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: 0 2px 4px rgba(44, 62, 80, 0.12);
}

.multiselect-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff !important;
    border: 1px solid #ced4da;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: dropdownFadeIn 0.2s ease-out;
    scrollbar-width: thin;
    scrollbar-color: #6c757d #f8f9fa;
}

.multiselect-dropdown::-webkit-scrollbar {
    width: 6px;
}

.multiselect-dropdown::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 3px;
}

.multiselect-dropdown::-webkit-scrollbar-thumb {
    background: #6c757d;
    border-radius: 3px;
}

.multiselect-dropdown::-webkit-scrollbar-thumb:hover {
    background: #495057;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

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

.multiselect-container.open .multiselect-dropdown {
    display: block;
}

.multiselect-option {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f1f1f1;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.4;
    background-color: #ffffff;
}

.multiselect-option:hover,
.multiselect-option.hover {
    background-color: #f8f9fa !important;
}

.multiselect-container.open .multiselect-option:hover,
.multiselect-container.open .multiselect-option.hover {
    background-color: #e3f2fd;
}

.multiselect-option.selected {
    background-color: #e3f2fd;
}

.multiselect-option:last-child {
    border-bottom: none;
}

.option-checkbox {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.option-main {
    font-weight: 600;
    flex: 1;
    color: #212529;
}

.option-code {
    font-size: 11px;
    font-weight: 600;
    color: #495057;
    background: #e9ecef;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.option-type {
    font-size: 11px;
    font-weight: 500;
    color: #6c757d;
    font-style: italic;
}

.option-text {
    font-weight: 600;
    color: #212529;
}

/* Autocomplete de cliente */
.cliente-autocomplete-container {
    position: relative;
    width: 100%;
}

.cliente-autocomplete-input {
    width: 100%;
    padding: 10px 35px 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.cliente-autocomplete-input:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(44, 62, 80, 0.25);
}

.cliente-autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #ced4da;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cliente-autocomplete-container.open .cliente-autocomplete-dropdown {
    display: block;
}

.cliente-option {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f1f1f1;
    transition: background-color 0.2s ease;
}

.cliente-option:hover,
.cliente-option.hover {
    background-color: #f8f9fa;
}

.cliente-option:last-child {
    border-bottom: none;
}

.cliente-codigo {
    font-weight: 600;
    color: var(--primary-color);
    margin-right: 8px;
}

.cliente-nome {
    color: #212529;
}

/* ========== ESTILOS ESPECÍFICOS - VENDAS FUNCIONÁRIOS ========== */

.funcionario-select {
    padding: 12px;
    border-radius: 5px;
    border: 1px solid #cce5ff;
    background-color: #f0f7ff;
    margin-bottom: 20px;
}

select.funcionario-dropdown {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    background-color: white;
    font-family: 'Consolas', 'Courier New', monospace;
}

select.funcionario-dropdown optgroup {
    font-weight: bold;
    color: #495057;
}

select.funcionario-dropdown option {
    padding: 8px;
}

select.funcionario-dropdown option::before {
    content: attr(value);
    font-weight: bold;
    color: var(--primary-color);
    margin-right: 8px;
}

.funcionario-bloco {
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    background: #fafafa;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.funcionario-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}

.funcionario-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.funcionario-nome {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    min-width: 300px;
}

.funcionario-total {
    font-size: 16px;
    color: var(--primary-color);
    font-weight: 600;
    min-width: 200px;
    text-align: right;
}

.expandir-btn {
    padding: 8px 20px;
    border-radius: 6px;
    border: 1px solid var(--primary-color);
    background: #f0f7ff;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 100px;
}

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

/* ========== ESTILOS ESPECÍFICOS - CHECAGEM PIX ========== */

.summary-box {
    background-color: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
    padding: 15px;
    margin: 20px 0;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.stat-item {
    text-align: center;
    padding: 10px;
    background-color: white;
    border-radius: 4px;
    border: 1px solid #dce1e8;
}

.stat-item.pendente {
    border-left: 4px solid #dc3545;
}

.stat-item.ok {
    border-left: 4px solid #28a745;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-item.pendente .stat-value {
    color: #dc3545;
}

.stat-item.ok .stat-value {
    color: #28a745;
}

.stat-label {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid var(--primary-color);
    background-color: white;
    color: var(--primary-color);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background-color: #f8f9fa;
}

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

.filter-btn.pendente.active {
    background-color: #dc3545;
    border-color: #dc3545;
}

.filter-btn.ok.active {
    background-color: #28a745;
    border-color: #28a745;
}

.filter-btn.nao-vinculadas.active {
    background-color: #dc3545;
    border-color: #dc3545;
}

.side-by-side-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.side-panel {
    border: 2px solid #dce1e8;
    border-radius: 8px;
    padding: 15px;
    background-color: #f8f9fa;
    max-height: 700px;
    overflow-y: auto;
}

.side-panel.pdv-pendentes,
.side-panel.banco-nao-vinculadas {
    border-color: #dce1e8;
    border-left: 5px solid #dce1e8;
}

.side-panel h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #dce1e8;
    color: #333;
    font-size: 18px;
}

.side-panel.pdv-pendentes h3,
.side-panel.banco-nao-vinculadas h3 {
    color: #333;
    border-bottom-color: #dce1e8;
}

/* Estilo padronizado para todos os itens - PDV e Banco */
.side-item,
.side-item.pdv-item,
.side-item.banco-item {
    display: block;
    background-color: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
    cursor: pointer;
    box-sizing: border-box;
    width: 100%;
}

.side-item:hover,
.side-item.pdv-item:hover,
.side-item.banco-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.side-item.selected,
.side-item.pdv-item.selected,
.side-item.banco-item.selected {
    border: 3px solid var(--primary-color) !important;
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.25);
    background-color: #f0f7ff;
}

/* Estilos padronizados para header, valor, data e detalhes */
.side-item-header,
.side-item.pdv-item .side-item-header,
.side-item.banco-item .side-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    width: 100%;
}

.side-item-header>div:first-child {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.side-item-header>div:first-child strong {
    font-size: 14px;
    font-weight: 600;
}

.side-item-header>div:last-child {
    display: block;
    margin-left: 10px;
    flex-shrink: 0;
}

.side-item-valor,
.side-item.pdv-item .side-item-valor,
.side-item.banco-item .side-item-valor {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
}

.side-item-data,
.side-item.pdv-item .side-item-data,
.side-item.banco-item .side-item-data {
    font-size: 12px;
    color: #6c757d;
    display: block;
    margin-bottom: 0;
}

.side-item-detalhes,
.side-item.pdv-item .side-item-detalhes,
.side-item.banco-item .side-item-detalhes {
    font-size: 13px;
    color: #495057;
    margin-top: 5px;
    display: block;
}

.btn-associar {
    margin-top: 8px;
    padding: 6px 12px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.btn-associar:hover {
    background-color: #218838;
}

.badge-manual {
    background-color: #17a2b8;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    margin-left: 5px;
}

.date-nav-btn {
    transition: all 0.2s ease;
}

.date-nav-btn:hover {
    background-color: #ffb300 !important;
    transform: scale(1.1);
}

.date-nav-btn:active {
    transform: scale(0.95);
}

.date-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
}

.date-nav-btn.hidden {
    visibility: hidden;
    opacity: 0 !important;
}

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.loading-spinner {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.btn-salvar {
    background-color: #28a745;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.btn-salvar:hover {
    background-color: #218838;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
    margin: 20px 0;
}

.banco-data-indicador {
    background: #fff3cd;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #ffc107;
}

.data-texto {
    font-size: 16px;
    color: #333;
    font-weight: bold;
}



.total-banco-valor {
    font-size: 16px;
    color: #495057;
}

@media (max-width: 1200px) {
    .side-by-side-container {
        grid-template-columns: 1fr;
    }
}

/* ========== ESTILOS ESPECÍFICOS - AFERIÇÃO FECHAMENTO ========== */

.afericao-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 14px;
}

.afericao-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #dee2e6;
}

.afericao-table td {
    padding: 10px 8px;
    text-align: center;
    border: 1px solid #dee2e6;
    vertical-align: middle;
}

.afericao-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.afericao-table tbody tr:hover {
    background-color: #e3f2fd;
}

.valor-monetario {
    font-weight: 600;
    text-align: right;
}

.valor-positivo {
    color: #28a745;
}

.valor-negativo {
    color: #dc3545;
}

.valor-neutro {
    color: #6c757d;
}

.status-ok {
    background-color: #d4edda;
    color: #155724;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.status-divergente {
    background-color: #f8d7da;
    color: #721c24;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.resumo-totais {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.resumo-item {
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.resumo-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.resumo-valor {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
}

/* ========== ESTILOS ESPECÍFICOS - RELATÓRIOS ========== */

.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.report-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.report-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.report-icon {
    width: 48px;
    height: 48px;
    background: #f0f7ff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: var(--primary-color);
}

.report-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #212529;
}

.report-description {
    font-size: 14px;
    color: #6c757d;
    line-height: 1.5;
}

.portal-caixa-btn {
    background-color: #28a745;
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color .2s ease, box-shadow .2s ease, transform .2s ease;
    position: absolute;
    right: 0;
}

.portal-caixa-btn:hover {
    background-color: #218838 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3) !important;
}

.total {
    font-size: 18px;
    font-weight: bold;
    margin: 0;
    padding: 15px;
    background-color: #e9f4ff;
    border-radius: 6px;
    border-left: 4px solid var(--primary-color);
    text-align: left;
}

.total-wrapper {
    width: 100%;
    margin-top: 20px;
    margin-bottom: 20px;
}

.table-container {
    overflow-x: auto;
}

/* Estilos de tabela para pix_troco */
.table-container table {
    width: 100%;
    border-collapse: collapse;
}

.table-container th,
.table-container td {
    padding: 10px 12px;
    border-bottom: 1px solid #e9ecef;
    text-align: left;
}

.table-container thead th {
    background: var(--primary-color);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 1;
}

.table-container tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.color-legend {
    margin: 14px 0;
}

.color-legend-content {
    display: flex;
    gap: 16px;
    align-items: center;
}

.color-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #495057;
}

.green {
    color: #198754;
}

.red {
    color: #dc3545;
}

.checkbox-pago {
    text-align: center;
}

/* Valor cell para pix_troco */
.valor-cell {
    font-weight: 600;
}

#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background-color: #28a745;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    font-weight: 600;
    font-size: 14px;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
    white-space: nowrap;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

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

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.badge-a {
    background: #e8eaed;
    color: var(--primary-color);
}

.badge-b {
    background: #e8f5e9;
    color: #198754;
}

.badge-c {
    background: #fff3cd;
    color: #856404;
}

.editable-cell {
    position: relative;
    transition: background-color .3s ease;
}

.editable-cell:hover {
    background-color: #f8f9fa;
}

.editable-cell::after {
    content: '✏️';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    opacity: 0;
    transition: opacity .2s ease;
}

.editable-cell:hover::after {
    opacity: 0.5;
}

.tab-content#tab-C .editable-cell {
    background-color: #f8f9fa;
    color: #6c757d;
}

.tab-content#tab-C .editable-cell::after {
    content: '🔒';
    opacity: 0.3;
}

.tab-content#tab-C .editable-cell:hover {
    background-color: #e9ecef;
}

/* General button reset - only for buttons without specific classes */

/* ========== BUTTON FIXES ========== */

/* General button style - only for plain buttons */

/* Specific button classes */
.btn-nova, button.btn-nova {
    background: #2c3e50 !important;
    color: #ffffff !important;
    border: none !important;
    padding: 0.5rem 1rem !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
}
.btn-nova:hover, button.btn-nova:hover {
    background: #34495e !important;
    color: #ffffff !important;
}

.btn-sm, button.btn-sm {
    background: var(--btn-neutral-bg) !important;
    color: var(--btn-neutral-text) !important;
    border: 1px solid var(--btn-neutral-border) !important;
    padding: 0.35rem 0.75rem !important;
    font-size: 0.8rem !important;
    border-radius: 6px !important;
    cursor: pointer !important;
}
.btn-sm:hover, button.btn-sm:hover {
    background: var(--btn-neutral-bg-hover) !important;
    color: var(--color-text) !important;
}

.btn-edit, button.btn-edit {
    background: #2c3e50 !important;
    color: #ffffff !important;
    border: none !important;
    font-weight: 600 !important;
}
.btn-edit:hover, button.btn-edit:hover {
    background: #34495e !important;
    color: #ffffff !important;
}

/* ========== MODAL HELPERS ========== */
.modal-box input:not([type="checkbox"]):not([type="radio"]),
.modal-box select,
.modal-box textarea {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

/* Override for buttons inside modals to ensure dark text */
.modal-box button:not(.btn-nova):not(.btn-edit):not(.btn-primary):not(.btn-secondary):not(.btn-sm):not(.btn-padrao) {
    color: var(--btn-neutral-text);
    background: var(--btn-neutral-bg);
    border: 1px solid var(--btn-neutral-border);
    height: auto;
}

/* Garante botao CONSULTAR/Filtrar/Buscar dos formularios com cor padrao */
.main-content form button[type="submit"],
.main-content .container-fluid form button[type="submit"],
.container-fluid form button[type="submit"] {
    background: var(--primary-color);
    color: var(--fh-white);
    height: 44px;
}

.main-content form button[type="submit"]:hover,
.main-content .container-fluid form button[type="submit"]:hover,
.container-fluid form button[type="submit"]:hover {
    background: var(--secondary-color);
}

/* Link estilizado como botao (padrao azul, igual ao submit) */
.btn-padrao {
    display: inline-block;
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .2s ease;
    height: 44px;
    line-height: 24px;
    box-sizing: border-box;
}

.btn-padrao:hover {
    background: var(--secondary-color);
    color: #fff;
}

/* ========== MEDIA QUERIES ========== */

@media (max-width: 1200px) {

    .filtro-row {
        flex-wrap: wrap;
        gap: 14px;
    }

    .filtro-item {
        flex: 1 1 calc(33.333% - 14px);
        min-width: 140px;
    }

    .filtro-item select,
    .filtro-item input[type="date"] {
        width: 100%;
        padding: 10px 12px;
        border: 2px solid #e9ecef;
        border-radius: 8px;
        background: #fff;
        color: #495057;
        height: 44px;
        box-sizing: border-box;
        font-size: 14px;
        font-family: inherit;
    }

    .checkbox-item {
        flex: 1 1 100%;
        justify-content: flex-start;
        margin-left: 0;
    }

    .toast {
        max-width: 300px;
        font-size: 12px;
        padding: 12px 16px;
    }
}

@media (max-width: 900px) {
    .filtro-row {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .filtro-item {
        flex: 1 1 calc(50% - 12px);
        min-width: 120px;
    }

    .filtro-item select,
    .filtro-item input[type="date"] {
        width: 100%;
        padding: 10px 12px;
        border: 2px solid #e9ecef;
        border-radius: 8px;
        background: #fff;
        color: #495057;
        height: 44px;
        box-sizing: border-box;
        font-size: 14px;
        font-family: inherit;
    }

    .checkbox-item {
        flex: 1 1 100%;
        justify-content: flex-start;
        margin-left: 0;
    }

    .toast {
        max-width: 300px;
        font-size: 12px;
        padding: 12px 16px;
    }
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 10px auto;
        padding: 15px;
        max-height: 95vh;
    }

    .close {
        right: 10px;
        top: 10px;
        font-size: 28px;
        width: 28px;
        height: 28px;
    }

    .afericao-table {
        font-size: 12px;
    }

    .afericao-table th,
    .afericao-table td {
        padding: 8px 4px;
    }

    .resumo-totais {
        grid-template-columns: 1fr;
    }

    .portal-caixa-btn {
        position: static !important;
        display: block;
        margin: 10px auto 0 auto;
        text-align: center;
        width: fit-content;
    }
}

@media (max-width: 600px) {
    .filtro-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .filtro-item {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .filtro-item select,
    .filtro-item input[type="date"] {
        width: 100%;
        padding: 10px 12px;
        border: 2px solid #e9ecef;
        border-radius: 8px;
        background: #fff;
        color: #495057;
        height: 44px;
        box-sizing: border-box;
        font-size: 14px;
        font-family: inherit;
    }

    .checkbox-item {
        flex: 1 1 100%;
        justify-content: flex-start;
        margin-left: 0;
    }

    .toast {
        max-width: 250px;
        font-size: 11px;
        padding: 10px 12px;
    }
}

/* ========== ESTILOS ESPECÍFICOS - DASHBOARD ========== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.dashboard-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

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

.dashboard-card.pix-abertos {
    border-left-color: var(--success-color);
}

.dashboard-card.pix-baixados {
    border-left-color: var(--warning-color);
}

.dashboard-card.pix-conciliados {
    border-left-color: #17a2b8;
}

.dashboard-card.vendas-hoje {
    border-left-color: var(--danger-color);
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 5px;
}

.card-count {
    font-size: 11px;
    color: #6c757d;
    margin-bottom: 15px;
}

.card-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-link:hover {
    color: var(--secondary-color);
    text-decoration: none;
}

.dashboard-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.status-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: center;
    position: relative;
    padding-bottom: 10px;
}

.section-title::after {
    content: '';
    position: absolute;
    width: 50px;
    height: 2px;
    background-color: var(--primary-color);
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 1px;
}

.status-table {
    width: 100%;
    border-collapse: collapse;
}

.status-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #ebeef2;
    font-size: 12px;
}

.status-table tr:hover {
    background-color: #f8f9fa;
}

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

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

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

.status-badge.integrando {
    background-color: #fff3cd;
    color: #856404;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.summary-item {
    text-align: center;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 6px;
}

.summary-number {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 2px;
}

.summary-label {
    font-size: 11px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Ensure data containers have white background since main container is transparent */
.tab-content,
.table-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-top: 15px;
}

/* Remove duplicate padding/shadow if nested */
.tab-content .table-container {
    padding: 0;
    box-shadow: none;
    margin-top: 0;
    background: transparent;
}


/* ========== APP SHELL (ex-base.html inline) ========== */
/* body e .container: definidos pelo tema unico acima (fundo branco, containers transparentes). */

.app-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(2px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.2s ease;
}

.app-loading-overlay.active { display: flex; }

.app-loading-content {
    text-align: center;
    background: var(--color-surface);
    padding: 30px 40px;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 300px;
}

.app-loading-bar-container {
    width: 100%;
    height: 6px;
    background-color: var(--fh-slate-200);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 15px;
}

.app-loading-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    width: 30%;
    border-radius: 3px;
    animation: app-loading-progress 1.5s ease-in-out infinite;
}

@keyframes app-loading-progress {
    0% { width: 0%; margin-left: 0%; }
    50% { width: 50%; margin-left: 25%; }
    100% { width: 0%; margin-left: 100%; }
}

.app-loading-text {
    color: var(--fh-slate-600);
    font-size: var(--fs-lg);
    font-weight: var(--fw-medium);
}

body.app-loading button,
body.app-loading input[type="submit"],
body.app-loading .btn,
body.app-loading [onclick] {
    pointer-events: none;
    opacity: 0.6;
    cursor: not-allowed;
}

body.app-loading .app-loading-overlay button,
body.app-loading #sidebar button,
body.app-loading .sidebar-toggle {
    pointer-events: auto;
    opacity: 1;
    cursor: pointer;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--fh-slate-100); }
::-webkit-scrollbar-thumb {
    background: var(--fh-slate-300);
    border-radius: 10px;
    border: 2px solid var(--fh-slate-100);
}
::-webkit-scrollbar-thumb:hover { background: var(--fh-slate-500); }

#sidebar .sidebar-content::-webkit-scrollbar { width: 5px; }
#sidebar .sidebar-content::-webkit-scrollbar-track { background: var(--primary-color); }
#sidebar .sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border: none;
}
#sidebar .sidebar-content::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.4); }

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.app-toast {
    min-width: 280px;
    max-width: 400px;
    background: var(--color-surface);
    color: var(--fh-slate-800);
    padding: 12px 20px;
    border-radius: var(--radius-lg);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: auto;
    border-left: 5px solid var(--primary-color);
}

.app-toast.active { transform: translateX(0); }
.app-toast--success { border-left-color: var(--success-color); }
.app-toast--error { border-left-color: var(--danger-color); }
.app-toast--warning { border-left-color: var(--warning-color); }
.app-toast--info { border-left-color: var(--primary-color); }
.app-toast-icon { font-size: 1.2rem; }
.app-toast--success .app-toast-icon { color: var(--success-color); }
.app-toast--error .app-toast-icon { color: var(--danger-color); }
.app-toast--warning .app-toast-icon { color: var(--warning-color); }
.app-toast--info .app-toast-icon { color: var(--primary-color); }
.app-toast-message { font-size: var(--fs-lg); font-weight: var(--fw-medium); line-height: 1.4; }
.app-toast-close { margin-left: auto; cursor: pointer; opacity: 0.5; transition: opacity 0.2s; }
.app-toast-close:hover { opacity: 1; }

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    margin-bottom: 18px;
}

.header-container > h2 {
    margin: 0;
    text-align: left;
    flex: 1 1 auto;
    min-width: 0;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-left: auto;
    flex: 0 0 auto;
}

.header-actions .btn + .btn { margin-left: 0; }

@media (max-width: 768px) {
    .header-container {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
    }
}

.sidebar-logo-img,
.sidebar-logo-icon {
    height: 24px;
    vertical-align: middle;
    margin-right: var(--space-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo-icon {
    width: 24px;
    font-size: 1.1rem;
}


/* ========== BOTOES OPT-IN ========== */
.btn,
.btn-padrao,
.btn-consultar,
.btn-filtrar,
.btn-primary,
.btn-secondary,
.btn-nova,
.btn-sm,
.btn-edit,
.btn-action,
.btn-icon,
.btn-login,
.tab-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-family: var(--font-sans);
    font-weight: var(--fw-semibold);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    text-decoration: none;
    box-sizing: border-box;
}

.btn,
.btn-padrao,
.btn-consultar {
    height: 44px;
    padding: 0 24px;
    border: none;
    border-radius: var(--radius-lg);
    background-color: var(--primary-color);
    color: var(--fh-white);
    font-size: var(--fs-lg);
}

.btn:hover,
.btn-padrao:hover,
.btn-consultar:hover {
    background-color: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    color: var(--fh-white);
}

.btn-primary {
    background: var(--primary-color);
    color: var(--fh-white);
    border: none;
    border-radius: var(--radius-lg);
    padding: 9px 20px;
    font-size: var(--fs-lg);
    height: auto;
}

.btn-primary:hover { background: var(--secondary-color); color: var(--fh-white); }

.btn-secondary {
    background: var(--btn-neutral-bg);
    color: var(--btn-neutral-text);
    border: 1px solid var(--btn-neutral-border);
    border-radius: var(--radius-lg);
    padding: 9px 20px;
    font-size: var(--fs-lg);
    height: auto;
}

.btn-secondary:hover {
    background: var(--btn-neutral-bg-hover);
    color: var(--fh-slate-800);
}

.btn-filtrar {
    background: var(--primary-color);
    color: var(--fh-white);
    border: none;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: var(--fs-lg);
    height: auto;
}

.btn-filtrar:hover { background: var(--secondary-color); color: var(--fh-white); }

.btn-filtrar:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-nova {
    background: var(--primary-color);
    color: var(--fh-white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
    font-size: var(--fs-lg);
    height: auto;
}

.btn-nova:hover { background: var(--secondary-color); color: var(--fh-white); }

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: var(--fs-md);
    border: 1px solid var(--btn-neutral-border);
    background: var(--btn-neutral-bg);
    color: var(--btn-neutral-text);
    border-radius: var(--radius-md);
    height: auto;
}

.btn-sm:hover {
    background: var(--btn-neutral-bg-hover);
    color: var(--fh-slate-800);
}

.btn-edit {
    background: var(--primary-color);
    color: var(--fh-white);
    border: 1px solid var(--primary-color);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: var(--fs-md);
    height: auto;
}

.btn-edit:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--fh-white);
}

button.btn-action {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    padding: 0;
    border: 1px solid var(--color-border-strong);
    background: var(--color-surface);
    border-radius: 6px;
    color: var(--primary-color);
    font-size: 12px;
    line-height: 1;
    gap: 0;
    box-shadow: none;
    flex: 0 0 28px;
}

button.btn-action:hover {
    background: var(--fh-slate-100);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: none;
    box-shadow: none;
}

button.btn-action.btn-action--danger {
    color: var(--color-danger);
    border-color: #f0c2c7;
}

button.btn-action.btn-action--danger:hover {
    background: var(--color-danger-subtle, #fdecee);
    color: var(--color-danger-hover);
    border-color: var(--color-danger-hover);
}

.btn-icon {
    background: none;
    border: 1px solid var(--btn-neutral-border);
    border-radius: var(--radius-md);
    color: var(--btn-neutral-text);
    padding: 5px 8px;
    font-size: var(--fs-md);
    height: auto;
    line-height: 1;
    margin-right: 4px;
}

.btn-icon:hover {
    background: var(--fh-slate-100);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-icon.danger:hover {
    background: var(--tag-bg-danger-soft);
    border-color: var(--color-danger-hover);
    color: var(--color-danger-hover);
}

.btn-login {
    width: auto;
    min-width: 200px;
    padding: 12px 30px;
    background-color: var(--primary-color);
    color: var(--fh-white);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    margin: 20px auto 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-login i { margin-left: var(--space-2); }

.btn-login:hover {
    background-color: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    color: var(--fh-white);
}

.boleto-actions-stack button.btn-sm.boleto-btn-branco,
.boleto-actions-stack a.btn-sm.boleto-btn-branco {
    background: var(--btn-neutral-bg);
    border: 1px solid var(--btn-neutral-border);
    color: var(--btn-neutral-text);
}

.boleto-actions-stack button.btn-sm.boleto-btn-branco:hover,
.boleto-actions-stack a.btn-sm.boleto-btn-branco:hover {
    background: var(--btn-neutral-bg-hover);
    border-color: var(--fh-slate-500);
    color: var(--fh-slate-800);
}

.boleto-actions-stack button.btn-sm.boleto-btn-verde {
    background: var(--btn-success-bg);
    border: 1px solid var(--btn-success-bg);
    color: var(--fh-white);
}

.boleto-actions-stack button.btn-sm.boleto-btn-verde:hover {
    background: var(--btn-success-bg-hover);
    border-color: var(--btn-success-bg-hover);
    color: var(--fh-white);
}

.boleto-actions-stack button.btn-sm.boleto-btn-vermelho {
    background: var(--btn-danger-bg);
    border: 1px solid var(--btn-danger-bg);
    color: var(--fh-white);
}

.boleto-actions-stack button.btn-sm.boleto-btn-vermelho:hover {
    background: var(--btn-danger-bg-hover);
    border-color: var(--btn-danger-bg-hover);
    color: var(--fh-white);
}

.bi-file-link,
a.bi-file-link {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    color: #1e40af;
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    height: auto;
    min-width: 0;
}

.bi-file-link:hover { color: #2563eb; text-decoration: underline; }
.bi-file-link i { color: var(--color-danger-hover); font-size: var(--fs-md); flex-shrink: 0; }

.boleto-ben-hit {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    height: auto;
    min-height: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: none;
    transform: none;
}

.boleto-ben-hit:hover {
    background: transparent;
    color: inherit;
    transform: none;
    box-shadow: none;
}


/* ========== CHROME DE LISTAGENS (documentos / boletos) ========== */
.filtros-bar {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
    align-items: flex-end;
}

.filtro-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filtro-group label {
    font-size: var(--fs-xs);
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: var(--fw-semibold);
    letter-spacing: 0.5px;
}

.filtro-group select,
.filtro-group input[type="text"],
.filtro-group input[type="date"] {
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    font-size: var(--fs-md);
    min-width: 140px;
    max-width: 280px;
    background: var(--color-surface);
    color: var(--color-text);
}

.filtro-group input[type="text"] {
    min-width: 160px;
    max-width: 220px;
}

.filtro-group input[type="date"] {
    min-width: 130px;
}

.tabs {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-5);
    margin-bottom: 0;
    border-bottom: 2px solid var(--badge-neutral-bg);
    overflow-x: auto;
    scrollbar-width: none;
    background: transparent;
    padding: 0;
    flex-wrap: nowrap;
}

.tabs::-webkit-scrollbar { display: none; }

.tabs .tab-button,
.tab-button {
    padding: 9px 16px;
    border: 2px solid var(--badge-neutral-bg);
    background: var(--fh-slate-50);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    cursor: pointer;
    font-weight: var(--fw-semibold);
    color: var(--badge-neutral-ink);
    transition: all 0.3s ease;
    position: relative;
    margin-bottom: -2px;
    white-space: nowrap;
    font-size: var(--fs-md);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: auto;
    box-shadow: none;
    text-transform: none;
    line-height: 1;
}

.tabs .tab-button:hover:not(.active),
.tab-button:hover:not(.active) {
    background: var(--badge-neutral-bg);
    border-color: var(--fh-slate-300);
    color: var(--primary-color);
}

.tabs .tab-button.active,
.tab-button.active {
    background: var(--color-surface);
    border-color: var(--primary-color);
    border-bottom-color: var(--color-surface);
    color: var(--primary-color);
    z-index: 1;
}

.tabs .tab-button .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    min-width: 22px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: var(--fs-sm);
    font-weight: var(--fw-bold);
    margin-left: 5px;
}

.tab-content {
    display: none;
    background: var(--color-surface);
    padding: 25px 0;
    border-top: none;
}

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

.badge-ok { background: var(--badge-ok-bg); color: var(--badge-ok-ink); }
.badge-pending { background: var(--badge-pending-bg); color: var(--badge-pending-ink); }
.badge-error { background: var(--badge-error-bg); color: var(--badge-error-ink); }
.badge-neutral { background: var(--badge-neutral-bg); color: var(--badge-neutral-ink); }

.monitor-content-container {
    background: var(--color-surface);
    border: 2px solid var(--badge-neutral-bg);
    border-top: none;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-top: 0;
}

.docs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-base);
    margin-top: 0;
}

.docs-table th {
    background: var(--primary-color);
    padding: 12px 15px;
    text-align: left;
    font-weight: var(--fw-semibold);
    color: var(--fh-white);
    border-bottom: 2px solid var(--color-border-strong);
    text-transform: uppercase;
    font-size: var(--fs-md);
    letter-spacing: 0.5px;
}

.status-dot {
    height: 8px;
    width: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.dot-success { background-color: var(--color-success); }
.dot-warning { background-color: var(--color-warning); }
.dot-danger { background-color: var(--color-danger); }

.btn-action-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
}

.docs-table td:has(.btn-action-group),
.empresas-table td:has(.btn-action-group) {
    white-space: nowrap;
    width: 1%;
    vertical-align: middle;
}

.table-wrapper { overflow-x: auto; }

.checkbox-cell {
    width: 40px;
    text-align: center;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: var(--color-surface);
    min-width: 220px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--color-border);
}

/* Fora da tabela: overflow:hidden da table recorta o menu e prende o z-index na celula */
.dropdown-content.is-floating {
    display: block;
    position: fixed;
    right: auto;
    z-index: 6000;
    margin: 0;
}

#bulkActionsDropdown .dropdown-content { z-index: 2000; }

.dropdown:hover .dropdown-content { display: block; }

.dropdown-content a {
    color: var(--fh-slate-800);
    padding: 10px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    white-space: nowrap;
    font-size: var(--fs-base);
    transition: background 0.2s;
}

.dropdown-content a:hover { background-color: var(--fh-slate-100); }

.dropdown-content i {
    width: 20px;
    margin-right: 8px;
    color: var(--primary-color);
}

.dropdown-divider {
    height: 1px;
    background: var(--color-border);
    margin: 4px 0;
}

/**
 * Estilos compartilhados dos relatorios em /relatorios.
 * Padrao de botoes: texto primeiro, icone a direita (ms-2), como em analytics e PDV.
 */

.relatorio-page {
    width: 100%;
}

/* Barra de filtros + acoes (uma linha em telas largas) */
.relatorio-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    width: 100%;
}

.relatorio-toolbar--nowrap {
    flex-wrap: nowrap;
}

@media (max-width: 992px) {
    .relatorio-toolbar--nowrap {
        flex-wrap: wrap;
    }
}

.relatorio-toolbar__field {
    flex: 1 1 160px;
    min-width: 0;
}

.relatorio-toolbar__field > label {
    display: block;
    margin-bottom: 4px;
}

.relatorio-toolbar__field--actions {
    flex: 0 0 auto;
}

.relatorio-toolbar__actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: center;
}

.relatorio-toolbar__label-spacer {
    visibility: hidden;
}

@media (max-width: 992px) {
    .relatorio-toolbar__field--actions {
        flex: 1 1 100%;
    }

    .relatorio-toolbar__actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Links PDF: usar a classe global .btn-padrao (igual ao botao Buscar). */

/* Faixa de metadados (ex.: melhores clientes) */
.relatorio-meta-box {
    margin-top: 1rem;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    line-height: 1.5;
}

.relatorio-meta-box__sep {
    margin: 0 0.35rem;
    color: #adb5bd;
}

@media (max-width: 768px) {
    .relatorio-meta-box span {
        display: block;
    }

    .relatorio-meta-box__sep {
        display: none;
    }
}

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

/* Podium / ranking (melhores clientes) */
.relatorio-tabela--rank .first-place {
    color: #b8860b;
}

.relatorio-tabela--rank .second-place {
    color: #6c757d;
}

.relatorio-tabela--rank .third-place {
    color: #8b4513;
}

/* Ocultar na impressao (toolbar, intro) */
@media print {
    .relatorio-no-print {
        display: none !important;
    }

    .relatorio-tabela-wrap {
        overflow: visible !important;
    }
}


/* ========== PAGE: monitor.html ========== */
/* Dropdown styles */

  /* Especificidade maior para o dropdown de ações em massa no topo */

  .dot-danger {
    background-color: #e74c3c;
  }


/* ========== PAGE: nfse_recebidas.html ========== */
.dropdown-divider {
    height: 1px;
    background: #eee;
    margin: 4px 0;
  }


/* ========== PAGE: boletos_email.html ========== */
.boleto-badge { display:inline-flex; align-items:center; padding:4px 10px; border-radius:999px; font-size:11px; font-weight:700; }
  .badge-vencido { background: var(--tag-bg-danger-soft); color: var(--color-danger-hover); }
  .badge-hoje { background: var(--tag-bg-warning-soft); color: var(--color-warning-ink); }
  .badge-futuro { background: var(--tag-bg-success-soft); color: var(--color-success-hover); }
  .badge-pago { background: var(--tag-bg-accent-soft); color: var(--fh-slate-700); }
  .boleto-table { width:100%; border-collapse:collapse; font-size:14px; }
  .boleto-table th { background: var(--fh-slate-50); padding:10px 8px; text-align:left; font-size:11px; text-transform:uppercase; color: var(--fh-slate-600); border-bottom:1px solid var(--color-border); }
  .boleto-table td { padding:10px 8px; border-bottom:1px solid var(--color-border); vertical-align:middle; }
  .boleto-table tr:hover td { background: var(--fh-slate-50); }
  .monitor-content-container .boleto-table { margin-top: 0 ; }
  .monitor-content-container .boleto-table th {
    background: var(--primary-color, #2c3e50) ;
    color: #ffffff ;
    border-bottom: 2px solid #dee2e6 ;
    letter-spacing: 0.5px;
  }
  .xml-meta { font-size:11px; color: var(--color-text-muted); max-width:220px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .chave-cell { font-family: ui-monospace, monospace; font-size: 11px; word-break: break-all; min-width: 160px; max-width: 220px; line-height: 1.4; color: var(--fh-slate-700); }
  .xml-actions-col { min-width: 118px; text-align: right; vertical-align: middle; white-space: nowrap; }
  a.xml-download-btn,
  button.xml-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    line-height: 1.25;
  }
  a.xml-download-btn i,
  button.xml-download-btn i { flex-shrink: 0; width: 1em; text-align: center; }
  .boleto-actions-cell {
    text-align: right;
    vertical-align: middle;
  }
  /* Coluna alinhada: Copiar largura total; PDF + acao em duas colunas iguais. */
  .boleto-actions-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-left: auto;
    width: min(100%, 268px);
  }
  .boleto-actions-stack-top {
    width: 100%;
  }
  .boleto-actions-stack-top button.btn-sm {
    width: 100%;
    justify-content: center;
  }
  .boleto-actions-stack-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
    align-items: stretch;
  }
  /* Mesma altura (styles.css força .btn-sm branco; precisamos especificidade maior). */
  .boleto-actions-stack .btn,
  .boleto-actions-stack a.btn {
    box-sizing: border-box;
    min-height: 36px;
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
    display: inline-flex ;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    width: 100%;
  }
  /* Branco / verde / vermelho — selector composto vence button.btn-sm do styles.css */
  .boleto-actions-stack button.btn-sm.boleto-btn-branco,
  .boleto-actions-stack a.btn-sm.boleto-btn-branco {
    background: var(--btn-neutral-bg) ;
    border: 1px solid var(--btn-neutral-border) ;
    color: var(--btn-neutral-text) ;
  }
  .boleto-actions-stack button.btn-sm.boleto-btn-branco:hover,
  .boleto-actions-stack a.btn-sm.boleto-btn-branco:hover {
    background: var(--btn-neutral-bg-hover) ;
    border-color: var(--fh-slate-500) ;
    color: var(--fh-slate-800) ;
  }
  .boleto-actions-stack button.btn-sm.boleto-btn-verde {
    background: var(--btn-success-bg) ;
    border: 1px solid var(--btn-success-bg) ;
    color: var(--fh-white) ;
  }
  .boleto-actions-stack button.btn-sm.boleto-btn-verde:hover {
    background: var(--btn-success-bg-hover) ;
    border-color: var(--btn-success-bg-hover) ;
    color: var(--fh-white) ;
  }
  .boleto-actions-stack button.btn-sm.boleto-btn-vermelho {
    background: var(--btn-danger-bg) ;
    border: 1px solid var(--btn-danger-bg) ;
    color: var(--fh-white) ;
  }
  .boleto-actions-stack button.btn-sm  .boleto-btn-vermelho:hover {
    background: var(--btn-danger-bg-hover) ;
    border-color: var(--btn-danger-bg-hover) ;
    color: var(--fh-white) ;
  }
  .boleto-badge-sem-data { background: var(--tag-bg-muted-soft); color: var(--color-text-muted); }
  .boleto-xml-badge-sim { background: var(--tag-bg-success-soft); color: var(--color-success-hover); }
  .boleto-xml-badge-pend { background: var(--tag-bg-warning-soft); color: var(--color-warning-ink); }
  .boleto-empty-msg { text-align: center; color: var(--color-text-muted); padding: 32px; }
  .boleto-error-msg { text-align: center; color: var(--color-danger); }
  /* Beneficiário: linha forte + arquivo em cinza (referência visual da listagem). */
  .boleto-ben-cell {
    vertical-align: top;
    min-width: 280px;
    max-width: 480px;
  }
  /* Sobrescreve styles.css (botão genérico = fundo primário): célula como texto normal. */
  .boleto-ben-hit {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0 ;
    height: auto ;
    min-height: 0 ;
    border: none ;
    border-radius: 0 ;
    background: transparent ;
    background-color: transparent ;
    color: var(--color-text) ;
    cursor: pointer;
    text-align: left;
    font: inherit;
    box-shadow: none ;
    transform: none ;
    align-items: stretch ;
    justify-content: flex-start ;
    gap: 0 ;
  }
  .boleto-ben-hit:hover,
  .boleto-ben-hit:focus,
  .boleto-ben-hit:focus-visible {
    background: transparent ;
    background-color: transparent ;
    color: var(--color-text) ;
    box-shadow: none ;
    transform: none ;
  }
  .boleto-ben-hit:hover strong {
    color: var(--primary-color) ;
  }
  .boleto-ben-hit strong {
    display: block;
    font-weight: 700;
    font-size: 14px;
    color: var(--fh-slate-900) ;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
  }
  .boleto-filename {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 4px;
    word-break: break-all;
    line-height: 1.35;
  }
  .xml-pending-msg {
    font-size: 12px;
    color: var(--color-text-muted);
    cursor: help;
  }
  .boleto-modal-stack label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--fh-slate-700);
  }
  .boleto-modal-stack input[type="text"],
  .boleto-modal-stack input[type="file"],
  .boleto-modal-stack textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--btn-neutral-border);
    border-radius: 8px;
    margin-bottom: 14px;
    box-sizing: border-box;
    font-size: 14px;
  }
  .boleto-modal-stack textarea { resize: vertical; min-height: 44px; font-family: ui-monospace, monospace; font-size: 12px; }
  .boleto-modal-hint { font-size: 12px; color: var(--color-text-muted); margin: 0 0 14px; line-height: 1.4; }


/* ========== PAGE: boletos_import.html ========== */
  .bi-summary { font-size:11px; color:#475569; margin-bottom:10px; }
  .bi-summary strong { color:var(--primary-color,#2c3e50); }

  .bi-drop-toggle {
    display:flex; align-items:center; justify-content:space-between; padding:8px 12px;
    background:#f1f5f9; border:1px solid #e2e8f0; border-radius:6px; cursor:pointer;
    margin-bottom:8px; user-select:none;
  }
  .bi-drop-toggle span { font-size:11px; font-weight:600; color:#475569; }
  .bi-drop-panel { display:none; margin-bottom:10px; }
  .bi-drop-panel.open { display:block; }
  .bi-drop { border:2px dashed var(--primary-color,#2c3e50); border-radius:8px; padding:14px;
    text-align:center; color:var(--primary-color,#2c3e50); font-weight:600; font-size:11px;
    background:#fbfdff; cursor:pointer; }
  .bi-drop.dragover { background:#eef5ff; border-color:#2563eb; }
  .bi-drop i { font-size:20px; display:block; margin-bottom:4px; }

  /* Cards Grid */
  .bi-cards-toolbar {
    display:flex;
    align-items:center;
    gap:8px;
    margin-bottom:10px;
    padding:6px 12px;
    background:#f8fafc;
    border:1px solid #e2e8f0;
    border-radius:6px;
    font-size:11px;
    color:#475569;
    font-weight:500;
  }

  .bi-cards-grid {
    display:grid;
    grid-template-columns:repeat(auto-fill, minmax(330px, 1fr));
    gap:12px;
    max-height:64vh;
    overflow-y:auto;
    padding:2px 2px 10px;
  }

  .bi-card {
    border:1px solid #e2e8f0;
    border-radius:8px;
    background:#ffffff;
    padding:10px;
    display:flex;
    flex-direction:column;
    gap:8px;
    box-shadow:0 1px 3px rgba(0,0,0,0.04);
    transition:border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    position:relative;
  }

  .bi-card:hover {
    border-color:#cbd5e1;
    box-shadow:0 3px 10px rgba(0,0,0,0.06);
  }

  .bi-card.selected {
    border-color:#3b82f6 ;
    background:#f0f7ff ;
    box-shadow:0 0 0 1px #3b82f6 ;
  }

  .bi-card.sem-suporte {
    border-color:#fca5a5 ;
    background:#fff8f8 ;
  }

  .bi-card.origem-email {
    border-left:3.5px solid #3b82f6 ;
  }

  .bi-card.importado {
    border-left:3.5px solid #10b981 ;
  }

  /* Card Head */
  .bi-card-head {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    padding-bottom:6px;
    border-bottom:1px solid #f1f5f9;
  }

  .bi-card-check-label {
    display:flex;
    align-items:center;
    gap:7px;
    flex:1;
    min-width:0;
    margin:0;
    cursor:pointer;
  }

  .bi-card-check-label input[type="checkbox"] {
    width:15px;
    height:15px;
    cursor:pointer;
    margin:0;
    flex-shrink:0;
    accent-color:#2563eb;
  }

  .bi-card-title-wrap {
    flex:1;
    min-width:0;
  }

  .bi-file-link,
  a.bi-file-link {
    background:transparent ;
    border:none ;
    padding:0 ;
    margin:0 ;
    color:#1e40af ;
    cursor:pointer ;
    font-size:11px ;
    font-weight:600 ;
    text-decoration:none ;
    display:inline-flex ;
    align-items:center ;
    gap:4px ;
    max-width:100% ;
    height:auto ;
    min-width:0 ;
  }

  .bi-file-link:hover {
    color:#2563eb ;
    text-decoration:underline ;
  }

  .bi-file-link i {
    color:#dc2626 ;
    font-size:12px ;
    flex-shrink:0 ;
  }

  .bi-file-name {
    font-size:11px;
    font-weight:600;
    color:#475569;
    display:inline-flex;
    align-items:center;
    gap:4px;
    max-width:100%;
  }

  .bi-file-text {
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    display:inline-block;
    max-width:190px;
  }

  /* Status Badges */
  .bi-status {
    display:inline-flex;
    align-items:center;
    gap:4px;
    padding:2px 7px;
    border-radius:999px;
    font-size:9.5px;
    font-weight:700;
    text-transform:uppercase;
    letter-spacing:0.3px;
    flex-shrink:0;
    line-height:1.3;
  }

  .bi-status-pendente {
    background:#fef3c7;
    color:#92400e;
    border:1px solid #fde68a;
  }

  .bi-status-erro {
    background:#fee2e2;
    color:#991b1b;
    border:1px solid #fecaca;
  }

  .bi-status-ok {
    background:#dcfce7;
    color:#166534;
    border:1px solid #bbf7d0;
  }

  /* Summary Box */
  .bi-card-summary {
    background:#f8fafc;
    border:1px solid #edf2f7;
    border-radius:6px;
    padding:6px 8px;
    display:flex;
    flex-direction:column;
    gap:4px;
  }

  .bi-card-fornecedor {
    font-size:11px;
    color:#475569;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  .bi-card-fornecedor strong {
    color:#1e293b;
    font-weight:600;
  }

  .bi-card-meta-row {
    display:flex;
    justify-content:space-between;
    align-items:flex-end;
    gap:6px;
    border-top:1px dashed #e2e8f0;
    padding-top:4px;
    margin-top:2px;
  }

  .bi-meta-item {
    display:flex;
    flex-direction:column;
    gap:1px;
  }

  .bi-meta-item.right {
    text-align:right;
    align-items:flex-end;
  }

  .bi-meta-label {
    font-size:8.5px;
    text-transform:uppercase;
    font-weight:700;
    color:#64748b;
    letter-spacing:0.3px;
  }

  .bi-meta-val {
    font-weight:700;
    color:#1e293b;
    font-size:12px;
  }

  .bi-val-venc {
    color:#0f172a;
  }

  .bi-val-money {
    color:var(--primary-color,#2c3e50);
    font-size:14px;
  }

  /* Form Fields Grid */
  .bi-card-form {
    display:flex;
    flex-direction:column;
    gap:5px;
  }

  .bi-form-row {
    display:grid;
    gap:5px;
  }

  .bi-form-row.col-4 {
    grid-template-columns:repeat(4, 1fr);
  }

  .bi-field {
    display:flex;
    flex-direction:column;
    gap:2px;
    min-width:0;
  }

  .bi-field.col-1 { grid-column:span 1; }
  .bi-field.col-2 { grid-column:span 2; }
  .bi-field.col-3 { grid-column:span 3; }
  .bi-field.col-4 { grid-column:span 4; }

  .bi-field label {
    font-size:8.5px;
    text-transform:uppercase;
    color:#64748b;
    font-weight:700;
    letter-spacing:0.2px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    margin:0;
  }

  .bi-field input,
  .bi-field select {
    height:24px ;
    padding:2px 6px ;
    border:1px solid #cbd5e1 ;
    border-radius:4px ;
    font-size:10px ;
    background:#ffffff ;
    color:#1e293b ;
    box-shadow:none ;
    width:100% ;
    box-sizing:border-box ;
    min-width:0 ;
  }

  .bi-field input:focus,
  .bi-field select:focus {
    border-color:#3b82f6 ;
    outline:none ;
    box-shadow:0 0 0 1px #3b82f6 ;
  }

  .bi-field input.mono {
    font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace ;
    font-size:9px ;
  }

  .mono {
    font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace ;
  }

  /* Importados details */
  .bi-card-info-box {
    font-size:9.5px;
    color:#475569;
    background:#f8fafc;
    border:1px solid #f1f5f9;
    border-radius:4px;
    padding:4px 6px;
    word-break:break-all;
  }

  .bi-info-line {
    display:flex;
    gap:4px;
  }

  .bi-info-label {
    font-weight:600;
    color:#64748b;
    flex-shrink:0;
  }

  .bi-card-footer {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:6px;
    font-size:9.5px;
    color:#64748b;
    margin-top:auto;
    padding-top:4px;
    border-top:1px solid #f1f5f9;
  }

  .bi-empty {
    text-align:center;
    color:#94a3b8;
    padding:30px 0;
    font-style:italic;
    font-size:11px;
    grid-column:1 / -1;
  }


/* ========== PAGE: index.html ========== */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
  }
  .dashboard-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: transform 0.2s;
    border-left: 5px solid #ccc;
  }
  .dashboard-card:hover { transform: translateY(-3px); }
  
  /* Cores dos cards */
  .card-companies { border-left-color: #3498db; }
  .card-nfe { border-left-color: #2ecc71; }
  .card-cte { border-left-color: #f1c40f; }
  .card-mdfe { border-left-color: #9b59b6; }
  .card-today { border-left-color: #e67e22; }
  .card-pending { border-left-color: #e74c3c; }

  .dashboard-card h3 {
    font-size: 12px;
    color: #888;
    margin-bottom: 10px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
  }
  .dashboard-card .value {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
  }
  .dashboard-card .subtitle {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
  }
  
  .dashboard-main-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 20px;
    margin-top: 20px;
  }
  @media (max-width: 992px) {
    .dashboard-main-row { grid-template-columns: 1fr; }
  }

  .content-box {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  }
  .content-box h3 {
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .recent-docs-table {
    width: 100%;
    border-collapse: collapse;
  }
  .recent-docs-table th {
    background: #f8f9fa;
    padding: 12px 10px;
    text-align: left;
    font-size: 11px;
    color: #7f8c8d;
    text-transform: uppercase;
    border-bottom: 2px solid #edf2f7;
  }
  .recent-docs-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #f1f4f6;
    font-size: 13px;
    color: #34495e;
  }
  .badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
  }
  .badge-nfe { background: #e1f5fe; color: #0288d1; }
  .badge-cte { background: #fff3e0; color: #f57c00; }
  .badge-mdfe { background: #e8f5e9; color: #2e7d32; }
  .badge-pending { background: #ffebee; color: #c62828; }
  .badge-ok { background: #e8f5e9; color: #2e7d32; }


/* ========== PAGE: logs.html ========== */
.logs-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border: 2px solid #e9ecef;
    overflow: hidden;
  }

  .logs-header {
    padding: 20px 25px;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
  }

  .logs-table-wrapper {
    padding: 0;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
  }

  .logs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
  }

  .logs-table th {
    background: var(--primary-color, #2c3e50);
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .logs-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f1f1f1;
    color: #495057;
  }

  .logs-table tr:hover {
    background: #f8f9fa;
  }

  .log-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .log-badge-info {
    background: #e3f2fd;
    color: #1565c0;
  }

  .log-badge-warning {
    background: #fff3e0;
    color: #e65100;
  }

  .log-badge-error {
    background: #fdecea;
    color: #d32f2f;
  }

  .log-badge-debug {
    background: #f5f5f5;
    color: #616161;
  }

  .log-ts {
    color: #6c757d;
    font-family: monospace;
    white-space: nowrap;
  }

  .log-msg {
    line-height: 1.4;
    word-break: break-all;
  }


/* ========== PAGE: monitor_empresas.html ========== */
/* Checkbox labels - FORÇA COR PRETA */
  .checkbox-item {
    display: flex !important;
    align-items: center !important;
    flex-direction: row !important;
    gap: 6px;
  }

  .checkbox-item,
  .checkbox-item * {
    color: #333333 !important;
  }

  .checkbox-item input[type="checkbox"] {
    accent-color: #2c3e50;
    width: 16px;
    height: 16px;
    cursor: pointer;
    margin: 0;
  }

  .checkbox-item label {
    color: #333333 !important;
    font-weight: 400 !important;
    cursor: pointer;
    margin-left: 6px;
    display: inline;
  }

  .checkbox-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
  }

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

  .form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }

  .form-group.full {
    grid-column: 1 / -1;
  }

  .nsu-fields-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  @media (max-width: 768px) {
    .nsu-fields-grid {
      grid-template-columns: 1fr;
    }
  }

  .empresas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
  }

  .btn-nova {
    background: var(--primary-color, #2c3e50);
    color: #ffffff !important;
    height: 38px;
    padding: 0 0.85rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    white-space: nowrap;
  }

  .btn-nova:hover {
    background: var(--secondary-color, #34495e);
  }

  .header-actions .bulk-empresas-dropdown {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
  }

  .header-actions .bulk-empresas-dropdown.is-disabled:hover .dropdown-content {
    display: none;
  }

  .header-actions .btn-bulk-compact {
    height: 38px;
    padding: 0 0.7rem;
    font-size: 0.85rem;
    white-space: nowrap;
    gap: 0.35rem;
  }

  .header-actions .btn-bulk-compact:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
  }

  .header-actions .bulk-count:not(:empty)::before {
    content: "(";
  }

  .header-actions .bulk-count:not(:empty)::after {
    content: ")";
  }

  .header-actions .bulk-empresas-dropdown .dropdown-content {
    min-width: 180px;
    z-index: 2000;
  }

  .header-actions .bulk-empresas-dropdown .dropdown-content a {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .empresas-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
  }

  .empresas-table th {
    background: #f8f9fa;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
  }

  .empresas-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #dee2e6;
  }

  .empresas-table tbody tr:hover {
    background: #f8f9fa;
  }

  /* Alinha com .table-container / monitor: respiro lateral padronizado */
  .empresas-table-wrap {
    margin-top: 0;
    overflow-x: auto;
  }

  .badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
  }

  .badge-active {
    background: #d4edda;
    color: #155724;
  }

  .badge-inactive {
    background: #f8d7da;
    color: #721c24;
  }

  .badge-monitor {
    background: #cce5ff;
    color: #004085;
  }

  .btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border: 1px solid #dee2e6;
    background: white;
    color: #495057;
    border-radius: 6px;
    cursor: pointer;
  }

  .btn-sm:hover {
    background: #f8f9fa;
  }

  .btn-edit {
    background: var(--primary-color, #2c3e50);
    color: #ffffff !important;
    border-color: var(--primary-color, #2c3e50);
    font-weight: 600;
  }

  .btn-edit:hover {
    background: var(--secondary-color, #34495e);
    border-color: var(--secondary-color, #34495e);
    color: #ffffff !important;
  }

  .btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border: 1px solid #dee2e6;
    background: #ffffff;
    color: #495057 !important;
    border-radius: 6px;
    cursor: pointer;
  }

  .btn-sm:hover {
    background: #f8f9fa;
    color: #212529 !important;
  }

  /* Modal styles inherited from global modal system */

  .form-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 1fr 1fr;
  }

  .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
  }

  .form-group.full {
    grid-column: 1 / -1;
  }

  .form-group label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #333333 !important;
    font-weight: 600;
  }

  .form-group input,
  .form-group select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #333333 !important;
    background: white !important;
  }

  .form-group input:focus,
  .form-group select:focus {
    border-color: #2c3e50;
    outline: none;
  }

  .form-group input::placeholder {
    color: #6c757d;
    font-size: 0.95rem;
    opacity: 1;
  }

  .checkbox-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
  }


/* ========== PAGE: usuarios.html ========== */
.users-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
  }

  .overview-card {
    background: #fff;
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    border: 1px solid #eaecf0;
  }

  .overview-label {
    font-size: 12px;
    color: #667085;
    margin-bottom: 6px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .overview-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
  }

  .panel-card {
    background: #fff;
    border-radius: 12px;
    padding: 22px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    border: 1px solid #eaecf0;
    margin-bottom: 24px;
  }

  .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
  }

  .panel-header h3 {
    margin: 0 0 4px;
    font-size: 1.1rem;
    color: var(--primary-color);
  }

  .panel-header p {
    margin: 0;
    color: #667085;
    font-size: 13px;
  }

  .search-box {
    min-width: 240px;
  }

  .search-box label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #444;
    text-transform: uppercase;
  }

  .search-box input {
    width: 100%;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    height: auto;
  }

  .users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-top: 0;
    box-shadow: none;
  }

  .users-table th {
    background: #f8fafc;
    color: #475467;
    padding: 10px 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid #eaecf0;
  }

  .users-table td {
    padding: 12px 12px;
    border-bottom: 1px solid #eaecf0;
    vertical-align: middle;
    color: #344054;
    background: white;
  }

  .users-table tr:hover td {
    background: #f9fafb;
  }

  .users-table tfoot td {
    background: #fafbfc;
    padding: 14px 12px;
    border-top: 1px solid #eaecf0;
    border-bottom: none;
  }

  .role-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
  }

  .role-admin {
    background: #fef3c7;
    color: #92400e;
  }

  .role-operador {
    background: #e0f2fe;
    color: #0369a1;
  }

  .role-viewer {
    background: #f0fdf4;
    color: #15803d;
  }

  .badge-monitor-local {
    display: inline-block;
    margin-left: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border-radius: 4px;
    background: #e0e7ff;
    color: #3730a3;
    vertical-align: middle;
  }

  .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
  }

  .status-ativo {
    background: #dcfce7;
    color: #166534;
  }

  .status-inativo {
    background: #fee2e2;
    color: #991b1b;
  }

  .btn-icon {
    background: none;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    color: #344054;
    cursor: pointer;
    padding: 5px 8px;
    font-size: 12px;
    height: auto;
    line-height: 1;
    transition: all 0.15s;
    margin-right: 4px;
  }

  .btn-icon:hover {
    background: #f1f5f9;
    border-color: var(--primary-color);
    color: var(--primary-color);
  }

  .btn-icon.danger:hover {
    background: #fee2e2;
    border-color: #dc2626;
    color: #dc2626;
  }

  .modal-box h3 {
    margin: 0 0 20px;
    font-size: 1.1rem;
    color: var(--primary-color);
  }

  .modal-box h3 i {
    margin-right: 8px;
  }

  .form-field {
    margin-bottom: 16px;
  }

  .form-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #344054;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .form-field input,
  .form-field select {
    width: 100%;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    height: auto;
    transition: border-color 0.2s;
  }

  .form-field input:focus,
  .form-field select:focus {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.12);
  }

  .modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eaecf0;
  }

  .btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 9px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    height: auto;
    transition: all 0.2s;
  }

  .btn-primary:hover {
    background: var(--secondary-color);
  }

  .btn-secondary {
    background: white;
    color: #344054;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    padding: 9px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    height: auto;
    transition: all 0.2s;
  }

  .btn-secondary:hover {
    background: #f9fafb;
  }

  .empty-state {
    text-align: center;
    color: #667085;
    padding: 40px;
    font-size: 14px;
  }

  .user-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
  }

  .user-tab-btn {
    border: 1px solid #d0d5dd;
    background: #fff;
    color: #344054;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
  }

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

  .user-tab-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
  }

  .profile-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr));
    gap: 8px;
    margin-top: 8px;
    min-width: 0;
  }

  .profile-check-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    min-width: 0;
    line-height: 1.35;
  }

  .profile-check-item input[type='checkbox'] {
    flex-shrink: 0;
    margin-top: 2px;
  }

  .perm-matrix-wrap {
    overflow: visible;
    border: 1px solid #eaecf0;
    border-radius: 10px;
  }

  /* styles.css define table { min-width: 800px } — quebra colunas Ver/Editar no modal */
  #profileModal table.perm-matrix,
  table.perm-matrix {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-top: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    background: #fff !important;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
  }

  #profileModal table.perm-matrix col.col-page {
    width: auto;
  }

  #profileModal table.perm-matrix col.col-ck {
    width: 88px;
  }

  #profileModal table.perm-matrix th {
    background: #f8fafc !important;
    color: #475467 !important;
    padding: 8px 8px !important;
    text-align: left;
    border: none !important;
    border-bottom: 1px solid #eaecf0 !important;
    text-transform: none !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    letter-spacing: normal !important;
  }

  #profileModal table.perm-matrix td {
    padding: 8px 8px !important;
    border: none !important;
    border-bottom: 1px solid #f2f4f7 !important;
    font-size: 13px !important;
  }

  #profileModal table.perm-matrix tr:nth-child(even) td {
    background: transparent !important;
  }

  #profileModal table.perm-matrix th.col-narrow {
    text-align: center !important;
  }

  .perm-matrix th.col-narrow,
  .perm-matrix td.col-narrow {
    width: 88px;
    max-width: 88px;
    min-width: 72px;
    text-align: center !important;
    padding-left: 6px !important;
    padding-right: 6px !important;
    vertical-align: middle;
  }

  .perm-matrix th:first-child,
  .perm-matrix td:first-child {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .perm-matrix tr:last-child td {
    border-bottom: none;
  }

  .perm-matrix input[type='checkbox'] {
    width: 16px;
    height: 16px;
    margin: 0 auto;
    display: block;
  }

  .hint-help {
    font-size: 12px;
    color: #667085;
    margin: 6px 0 10px;
  }

  .modal-box.wider {
    --modal-width: 900px;
    max-height: min(88vh, calc(100dvh - 48px));
    overflow: hidden;
  }

  /* Sobrepõe estilos globais de modal para esta página: sem rolagem horizontal */
  #userModal.modal-overlay,
  #localMonitorUserModal.modal-overlay,
  #profileModal.modal-overlay {
    overflow-x: hidden;
  }

  #userModal .modal-box,
  #localMonitorUserModal .modal-box {
    --modal-width: 520px;
    max-width: min(520px, calc(100vw - 48px));
    min-width: 0;
  }

  #profileModal .modal-box,
  #profileModal .modal-box.wider {
    --modal-width: 900px;
    width: min(900px, calc(100vw - 48px)) !important;
    max-width: min(900px, calc(100vw - 48px)) !important;
    min-width: 0;
  }


/* ========== PAGE: login.html ========== */
body:has(.login-card),
body.login-body {
    background-color: var(--color-surface-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    font-family: var(--font-family);
}

.login-card {
    background: var(--color-surface);
    width: 100%;
    max-width: 420px;
    padding: 40px 28px;
    border-radius: var(--radius-xl);
    box-shadow: 0 10px 25px var(--alpha-shadow-md);
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

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

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

.login-logo {
    margin-bottom: 20px;
    color: var(--color-brand-primary);
    font-size: var(--font-size-display);
}

.login-title {
    color: var(--color-brand-primary);
    margin-bottom: 28px;
    font-weight: var(--font-weight-title);
    font-size: var(--font-size-title);
}

.form-group {
    margin-bottom: 18px;
    text-align: left;
    width: 100%;
}

form.login-form {
    display: block;
    width: 100%;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--color-text-body);
    font-size: var(--font-size-body);
    font-weight: 600;
    text-transform: none;
}

.form-group label i {
    color: var(--color-brand-primary);
    font-size: var(--font-size-body);
}

.form-control {
    width: 100%;
    height: var(--btn-height);
    padding: 10px 14px;
    border: 2px solid var(--color-border-light);
    border-radius: 8px;
    font-size: var(--font-size-body);
    font-family: inherit;
    color: var(--color-text-strong);
    transition: all 0.2s ease;
    line-height: 1.5;
    background-color: var(--color-surface);
}

.form-control::placeholder {
    color: var(--color-text-subtle);
}

.form-control:focus {
    border-color: var(--color-brand-accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--alpha-accent-25);
}

.btn-login {
    width: auto;
    min-width: 200px;
    height: var(--btn-height);
    padding: 0 var(--btn-padding-x);
    background-color: var(--color-brand-primary);
    color: var(--color-text-inverse);
    border: none;
    border-radius: 8px;
    font-size: var(--font-size-body);
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 20px auto 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-login:hover {
    background-color: var(--color-brand-secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--alpha-shadow-md);
}

.alert {
    padding: 12px 14px;
    margin-bottom: 20px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-body);
    background-color: var(--color-danger-subtle);
    color: var(--color-danger-emphasis);
    border: 1px solid var(--color-danger);
    text-align: left;
}

.alert i {
    margin-right: 8px;
}

.footer-text {
    margin-top: 28px;
    color: var(--color-text-subtle);
    font-size: var(--font-size-xs);
    line-height: 1.6;
}

.login-credential-hint {
    margin: -10px 0 24px;
    padding: 10px 12px;
    background: var(--color-surface-raised);
    border-radius: 8px;
    border-left: 3px solid var(--color-brand-primary);
    color: var(--color-text-body);
    font-size: var(--font-size-sm);
    line-height: 1.5;
    text-align: left;
}

.login-credential-hint i {
    color: var(--color-brand-primary);
    margin-right: 6px;
}


/* ========== PAGE: 403.html ========== */
.permission-denied-card {
          max-width: 560px;
          margin: 24px auto;
          padding: 32px;
          border-radius: 12px;
          background: #fff;
          box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
          text-align: center;
      }

      .permission-denied-card h3 {
          margin-bottom: 12px;
          color: #c0392b;
      }

      .permission-denied-card p {
          margin-bottom: 20px;
          color: var(--fh-slate-600);
          line-height: 1.5;
      }

/* ========== PAGE: settings.html ========== */
.settings-panel {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    max-width: 1300px;
}

.settings-title {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.settings-loading {
    color: var(--color-text-muted);
}

.settings-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr 1fr;
}

.settings-grid-full {
    grid-column: 1 / -1;
}

.settings-section-title {
    margin: 0 0 0.75rem 0;
    color: var(--primary-color);
}

.settings-section-title-spaced {
    margin: 0.5rem 0 0.75rem 0;
    color: var(--primary-color);
}

.settings-toggle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.settings-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    background: var(--fh-slate-50);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
    gap: var(--space-2);
}

.settings-toggle-title {
    font-size: var(--fs-base);
    font-weight: var(--fw-semibold);
}

.settings-toggle-desc {
    font-size: var(--fs-sm);
    color: var(--color-text-muted);
}

.settings-checkbox-lg {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.settings-field-readonly {
    background: var(--fh-slate-100);
}

.text-error { color: var(--color-danger); }
.text-success { color: var(--color-success); font-weight: var(--fw-semibold); }
.text-muted-sm { color: var(--color-text-muted); font-size: var(--fs-md); }

.oauth-step { margin-bottom: var(--space-2); }
.oauth-code {
    font-size: 24px;
    font-weight: var(--fw-bold);
    letter-spacing: 4px;
    background: var(--color-surface);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
}

.assistente-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

html:has(.assistente-container),
body:has(.assistente-container) {
    height: 100%;
    overflow: hidden;
}

.app-wrapper:has(.assistente-container) {
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
}

.main-content:has(.assistente-container) {
    height: 100vh;
    overflow: hidden;
    padding: 10px 16px 10px;
    display: flex;
    flex-direction: column;
}

.main-content > .container-fluid:has(.assistente-container) {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0 !important;
    height: auto;
    width: 100%;
    max-width: none;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

.main-content > .container-fluid:has(.assistente-container) .header-container {
    flex: 0 0 auto;
    margin-bottom: 8px;
    margin-top: 0;
}

.assistente-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.assistente-status-badge .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    display: inline-block;
}

.assistente-status-badge.is-online {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

.assistente-status-badge.is-online .status-dot {
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.assistente-status-badge.is-offline {
    background: #fffbeb;
    color: #92400e;
    border-color: #fde68a;
}

.assistente-status-badge.is-offline .status-dot {
    background: #f59e0b;
}

.assistente-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.assistente-drop-notice {
    position: absolute;
    inset: 12px;
    z-index: 50;
    background: rgba(240, 249, 255, 0.94);
    border: 2px dashed var(--fh-sky);
    border-radius: var(--radius-lg);
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    backdrop-filter: blur(2px);
}

.assistente-drop-notice.is-active {
    display: flex;
}

.assistente-drop-box {
    text-align: center;
    color: #0369a1;
    padding: 24px;
}

.assistente-drop-box i {
    font-size: 42px;
    color: #0284c7;
    margin-bottom: 12px;
}

.assistente-drop-box h4 {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 600;
}

.assistente-drop-box p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.assistente-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #f8fafc;
    scroll-behavior: smooth;
}

.assistente-bubble {
    display: flex;
    flex-direction: column;
    max-width: 82%;
    border-radius: 14px;
    padding: 12px 18px;
    line-height: 1.5;
    font-size: 13.5px;
    word-break: break-word;
    animation: assistenteFadeIn 0.2s ease-out;
}

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

.assistente-bubble--assistant {
    align-self: flex-start;
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.assistente-bubble--user {
    align-self: flex-end;
    background: var(--primary-color);
    color: var(--fh-white);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
    border-bottom-right-radius: 4px;
}

.assistente-bubble--error {
    align-self: flex-start;
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
}

.assistente-bubble-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.assistente-bubble--assistant .assistente-bubble-header {
    color: #0284c7;
}

.assistente-bubble--user .assistente-bubble-header {
    color: #93c5fd;
}

.assistente-bubble-content {
    display: flex;
    flex-direction: column;
}

.assistente-rich-paragraph {
    margin: 0 0 6px 0;
    line-height: 1.5;
}

.assistente-rich-paragraph:last-child {
    margin-bottom: 0;
}

.assistente-rich-list {
    margin: 4px 0 8px 18px;
    padding: 0;
    line-height: 1.5;
}

.assistente-rich-list li {
    margin-bottom: 3px;
}

.assistente-inline-code {
    background: #f1f5f9;
    color: #0f172a;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12.5px;
    font-family: Consolas, monospace;
}

.assistente-doc-files-wrap {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.assistente-doc-files-title {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
}

.assistente-doc-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0;
}

.assistente-doc-file--inline {
    margin: 4px 4px 4px 0;
}

.assistente-doc-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #dbe4ee;
    color: #0f4c81;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.assistente-doc-file:hover {
    background: #eef6ff;
    border-color: #9ec5e8;
}

.assistente-doc-file i {
    color: #c0392b;
}

.assistente-doc-file .fa-file-code {
    color: #1f6f4a;
}

.assistente-bubble--user .assistente-inline-code {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.assistente-attachment-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 8px;
}

.assistente-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    background: #e2e8f0;
    border-radius: 18px;
    font-size: 12px;
    color: #1e293b;
    max-width: 100%;
}

.assistente-bubble--user .assistente-chip {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.assistente-chip-thumb {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.assistente-chip-icon {
    font-size: 16px;
    color: #dc2626;
}

.assistente-bubble--user .assistente-chip-icon {
    color: #fca5a5;
}

.assistente-chip-name {
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.assistente-chip-size {
    font-size: 11px;
    opacity: 0.75;
}

.assistente-chip-remove {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0 3px;
    font-size: 12px;
    opacity: 0.7;
    transition: opacity 0.15s, color 0.15s;
    line-height: 1;
}

.assistente-chip-remove:hover {
    opacity: 1;
    color: #ef4444;
}

.assistente-msg-image-wrap {
    margin: 4px 0 8px;
}

.assistente-msg-image {
    display: block;
    max-width: min(320px, 100%);
    max-height: 220px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.35);
    object-fit: contain;
    background: rgba(0, 0, 0, 0.08);
}

.assistente-footer {
    padding: 10px 16px 8px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.assistente-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.assistente-composer {
    width: 100%;
}

.assistente-composer-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
}

.assistente-input-wrap {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    padding: 0 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.assistente-input-wrap:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

.assistente-btn-attach {
    width: 44px;
    height: 44px;
    margin: 0;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--btn-neutral-bg);
    color: var(--color-text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.assistente-btn-attach:hover {
    background: var(--btn-neutral-bg-hover);
    color: var(--primary-color);
    border-color: var(--color-border-strong);
}

#assistenteInput {
    width: 100%;
    border: 0;
    outline: none;
    background: transparent;
    resize: none;
    font-size: var(--fs-md);
    line-height: 1.45;
    color: var(--color-text);
    padding: 10px 0;
    min-height: 24px;
    max-height: 140px;
    font-family: inherit;
    box-sizing: border-box;
}

#assistenteInput::placeholder {
    color: var(--color-text-muted);
}

.assistente-btn-send {
    min-height: 44px;
    height: 44px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0 1.25rem;
}

.assistente-btn-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.assistente-footer-hints {
    font-size: var(--fs-xs);
    color: var(--color-text-muted);
    padding: 0 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 900px) {
    .main-content:has(.assistente-container) {
        padding: 8px 8px 8px;
    }

    .assistente-bubble {
        max-width: 95%;
    }

    .assistente-send-label {
        display: none;
    }

    .assistente-btn-send {
        min-width: 44px;
        padding: 0 12px;
    }
}

.assistente-debug-panel {
    margin: 8px 12px 12px;
    padding: 10px 12px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.04);
    font-size: 12px;
    color: var(--color-text-muted);
}

.assistente-debug-panel summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--color-text);
    user-select: none;
}

.assistente-debug-list {
    margin: 8px 0 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.assistente-debug-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
}

.assistente-debug-name {
    font-family: var(--font-mono, monospace);
    color: var(--color-text);
}

.assistente-debug-ms {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

.assistente-debug-item--erro .assistente-debug-name {
    color: #dc2626;
}

.assistente-debug-detail {
    flex-basis: 100%;
    opacity: 0.85;
    word-break: break-word;
}


/* ========== NAVEGACAO MOBILE (gaveta) ========== */
.sidebar-backdrop[hidden] { display: none; }

@media (max-width: 768px) {
    /* Estas regras vem depois de .mobile-header{display:none} para vencer a cascata. */
    .mobile-header {
        display: flex;
        align-items: center;
        gap: 12px;
        position: sticky;
        top: 0;
        z-index: 900;
        min-height: 52px;
        padding: 6px 12px;
        margin: -15px -15px 16px -15px;
        box-shadow: 0 2px 8px var(--alpha-shadow-xs);
    }

    .mobile-menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: inherit;
        font-size: 1.25rem;
        cursor: pointer;
    }

    .mobile-menu-btn:focus-visible {
        outline: 2px solid var(--accent-color);
        outline-offset: 2px;
    }

    #sidebar {
        width: min(var(--sidebar-width), 86vw);
        z-index: 1100;
        overscroll-behavior: contain;
    }

    #sidebar:not(.mobile) { visibility: hidden; box-shadow: none; }
    #sidebar.mobile { box-shadow: 8px 0 24px rgba(0, 0, 0, 0.25); }

    .header-actions { display: flex; flex-wrap: wrap; gap: 8px; }
    .header-actions .btn { flex: 1 1 calc(50% - 8px); min-height: 44px; }

    .sidebar-toggle { width: 44px; height: 44px; }
    #sidebar .nav-link { min-height: 44px; }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1050;
        background: rgba(15, 23, 42, 0.5);
    }

    body.drawer-open { overflow: hidden; }

    /* Alvos de toque: acoes de linha e checkboxes maiores que o padrao desktop. */
    .btn-action { min-width: 40px; min-height: 40px; }
    input.doc-check,
    input.empresa-check,
    td input[type="checkbox"] { width: 24px; height: 24px; }

    /* Formularios com colunas fixas inline (ex.: IMAP em Configuracoes) empilham. */
    div[style*="grid-template-columns: 1fr 100px 100px"] { grid-template-columns: 1fr !important; }

    .monitor-content-container > [role="tabpanel"] { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Telas com tabela/larga: rolagem horizontal dentro do bloco, nunca na pagina. */
    .content-box,
    .table-responsive,
    .table-container {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    /* Grades inline de Configuracoes: uma coluna em telas muito estreitas. */
    .settings-panel div[style*="display: grid"] { grid-template-columns: 1fr !important; }
}
