/* ============================================================================
   MODULO 04/8 - app/04-componentes-telas.css (ex-app.css linhas 5095-8074). Status badges/dots, telas (modulos, produto, clientes, financeiro), form generico, dark PrimeFaces (combos/datepicker/botoes). A ORDEM DE INCLUSAO 01->08 E CRITICA - nao reordenar.
   ============================================================================ */
/* ============================= */
/* STATUS BADGES - SIM / NÃO     */
/* ============================= */

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    min-width: 44px;
    padding: 4px 9px;

    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;

    border: 1px solid transparent;
    white-space: nowrap;
}

.status-badge::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

/* SIM */
.status-badge.status-sim {
    color: #166534;
    background: #dcfce7;
    border-color: #86efac;
}

.status-badge.status-sim::before {
    background: #22c55e;
}

/* NÃO */
.status-badge.status-nao {
    color: #991b1b;
    background: #fee2e2;
    border-color: #fca5a5;
}

.status-badge.status-nao::before {
    background: #ef4444;
}


/* ============================= */
/* DARK MODE                     */
/* ============================= */

.theme-dark .status-badge.status-sim,
.theme-dark .status-badge.status-sim,
.theme-dark .status-badge.status-sim {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.16);
    border-color: rgba(34, 197, 94, 0.35);
}

.theme-dark .status-badge.status-sim::before,
.theme-dark .status-badge.status-sim::before,
.theme-dark .status-badge.status-sim::before {
    background: #22c55e;
}

.theme-dark .status-badge.status-nao,
.theme-dark .status-badge.status-nao,
.theme-dark .status-badge.status-nao {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.35);
}

.theme-dark .status-badge.status-nao::before,
.theme-dark .status-badge.status-nao::before,
.theme-dark .status-badge.status-nao::before {
    background: #ef4444;
}

/* ============================= */
/* STATUS DOT - SIM / NÃO        */
/* ============================= */

.status-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    min-width: 54px;
    padding: 5px 10px;

    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;

    border: 1px solid transparent;
    white-space: nowrap;
}

.status-dot::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex: 0 0 auto;
}

/* Light - Sim */
.status-dot.status-active {
    color: #166534;
    background: #dcfce7;
    border-color: #86efac;
}

.status-dot.status-active::before {
    background: #22c55e;
}

/* Light - Não */
.status-dot.status-inactive {
    color: #991b1b;
    background: #fee2e2;
    border-color: #fca5a5;
}

.status-dot.status-inactive::before {
    background: #ef4444;
}

/* Dark - Sim */
.theme-dark .status-dot.status-active,
.theme-dark .status-dot.status-active,
.theme-dark .status-dot.status-active,
.theme-dark .status-dot.status-active,
.theme-dark .status-dot.status-active {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.16);
    border-color: rgba(34, 197, 94, 0.38);
}

/* Dark - Não */
.theme-dark .status-dot.status-inactive,
.theme-dark .status-dot.status-inactive,
.theme-dark .status-dot.status-inactive,
.theme-dark .status-dot.status-inactive,
.theme-dark .status-dot.status-inactive {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.38);
}

/* ============================= */
/* MODULE ICON PREVIEW           */
/* ============================= */

.module-icon-preview {
    margin-top: 8px;
}

.module-icon-preview-box {
    display: inline-flex;
    align-items: center;
    gap: 12px;

    padding: 10px 14px;
    border-radius: 14px;

    background: rgba(39, 55, 127, 0.06);
    border: 1px solid rgba(39, 55, 127, 0.12);
}

.module-icon-preview-box i {
    width: 34px;
    height: 34px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 12px;
    background: #ffffff;
    color: #2B2F6E;
    border: 1px solid rgba(39, 55, 127, 0.14);

    font-size: 16px;
}

.module-icon-preview-box strong {
    display: block;
    font-size: 13px;
    font-weight: 800;
    color: #111827;
}

.module-icon-preview-box span {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: #64748b;
}

/* Dark */
.theme-dark .module-icon-preview-box,
.theme-dark .module-icon-preview-box,
.theme-dark .module-icon-preview-box,
.theme-dark .module-icon-preview-box,
.theme-dark .module-icon-preview-box {
    background: rgba(96, 165, 250, 0.08);
    border-color: rgba(148, 163, 184, 0.18);
}

.theme-dark .module-icon-preview-box i,
.theme-dark .module-icon-preview-box i,
.theme-dark .module-icon-preview-box i,
.theme-dark .module-icon-preview-box i,
.theme-dark .module-icon-preview-box i {
    background: rgba(15, 23, 42, 0.8);
    color: #bfdbfe;
    border-color: rgba(148, 163, 184, 0.22);
}

.theme-dark .module-icon-preview-box strong,
.theme-dark .module-icon-preview-box strong,
.theme-dark .module-icon-preview-box strong,
.theme-dark .module-icon-preview-box strong,
.theme-dark .module-icon-preview-box strong {
    color: #e5e7eb;
}

.theme-dark .module-icon-preview-box span,
.theme-dark .module-icon-preview-box span,
.theme-dark .module-icon-preview-box span,
.theme-dark .module-icon-preview-box span,
.theme-dark .module-icon-preview-box span {
    color: #94a3b8;
}

.detail-tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.detail-tab-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
}

.detail-tab-header span {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    color: #64748b;
}

.empty-detail-message {
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(39, 55, 127, 0.06);
    border: 1px solid rgba(39, 55, 127, 0.12);
    color: #475569;
    font-weight: 600;
    margin-bottom: 14px;
}

.dialog-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}

.theme-dark .detail-tab-header span,
.theme-dark .detail-tab-header span,
.theme-dark .detail-tab-header span {
    color: #94a3b8;
}

.theme-dark .empty-detail-message,
.theme-dark .empty-detail-message,
.theme-dark .empty-detail-message {
    background: rgba(96, 165, 250, 0.08);
    border-color: rgba(148, 163, 184, 0.18);
    color: #cbd5e1;
}

/* Ajuste dos botoes de detalhe dentro das abas/dialogs */
.detail-tab-header .ui-button.btn-primary,
.detail-tab-header .ui-commandlink.btn-primary,
.detail-tab-header .btn-primary.ui-button {
    min-height: 44px;
    padding: 0 18px;
    border-radius: 12px;
}

.detail-tab-header .ui-button.btn-primary .ui-button-text,
.detail-tab-header .btn-primary.ui-button .ui-button-text,
.detail-tab-header .ui-button.btn-primary .ui-icon,
.detail-tab-header .btn-primary.ui-button .ui-icon,
.detail-tab-header .ui-button.btn-primary .pi,
.detail-tab-header .btn-primary.ui-button .pi {
    color: #ffffff !important;
}

.detail-tab-header .ui-button.btn-primary.ui-state-disabled,
.detail-tab-header .btn-primary.ui-button.ui-state-disabled,
.detail-tab-header .ui-button.btn-primary:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.theme-dark .detail-tab-header .ui-button.btn-primary .ui-button-text,
.theme-dark .detail-tab-header .ui-button.btn-primary .ui-button-text,
.theme-dark .detail-tab-header .ui-button.btn-primary .ui-button-text,
.theme-dark .detail-tab-header .ui-button.btn-primary .pi,
.theme-dark .detail-tab-header .ui-button.btn-primary .pi,
.theme-dark .detail-tab-header .ui-button.btn-primary .pi {
    color: #ffffff !important;
}

/* ============================= */
/* PRODUCT LIST SUMMARY          */
/* ============================= */

.money-value {
    font-weight: 800;
    color: #111827;
    white-space: nowrap;
}

.table-total-label {
    display: block;
    text-align: right;
    font-weight: 800;
    color: #475569;
}

.table-total-value {
    display: block;
    text-align: right;
    font-size: 13px;
}

.badge.badge-soft {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(39, 55, 127, 0.08);
    color: #2B2F6E;
    border: 1px solid rgba(39, 55, 127, 0.14);
    font-weight: 800;
}

.theme-dark .money-value,
.theme-dark .money-value,
.theme-dark .money-value {
    color: #e5e7eb;
}

.theme-dark .table-total-label,
.theme-dark .table-total-label,
.theme-dark .table-total-label {
    color: #cbd5e1;
}

.theme-dark .badge.badge-soft,
.theme-dark .badge.badge-soft,
.theme-dark .badge.badge-soft {
    background: rgba(96, 165, 250, 0.10);
    color: #bfdbfe;
    border-color: rgba(148, 163, 184, 0.20);
}

/* ============================= */
/* CLIENTES - RESUMOS E DETALHES */
/* ============================= */

.table-main-text {
    font-weight: 800;
    color: #111827;
}

.table-sub-text {
    margin-top: 3px;
    font-size: 12px;
    color: #64748b;
}

.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(39, 55, 127, 0.10);
    color: #2B2F6E;
    font-size: 12px;
    font-weight: 800;
}

.money-value {
    font-weight: 800;
    color: #166534;
    white-space: nowrap;
}

.table-footer-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 8px 4px;
}

.table-footer-summary strong {
    font-weight: 900;
}

.export-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.detail-action-button,
.detail-action-button .ui-button-text,
.detail-action-button .ui-icon,
.detail-action-button .pi {
    color: #ffffff !important;
}

.summary-card.money-summary-card {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 16px;
    padding: 18px 20px;
    border-radius: 18px;
    background: rgba(39, 55, 127, 0.06);
    border: 1px solid rgba(39, 55, 127, 0.12);
}

.summary-card.money-summary-card span {
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
}

.summary-card.money-summary-card strong {
    font-size: 28px;
    font-weight: 900;
    color: #166534;
}

.summary-card.money-summary-card small {
    font-size: 13px;
    color: #64748b;
}

.record-navigation {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.04);
}

.record-navigation span {
    min-width: 62px;
    text-align: center;
    font-size: 12px;
    font-weight: 800;
    color: #475569;
}

.theme-dark .table-main-text,
.theme-dark .table-main-text,
.theme-dark .table-main-text {
    color: #e5e7eb;
}

.theme-dark .table-sub-text,
.theme-dark .table-sub-text,
.theme-dark .table-sub-text,
.theme-dark .summary-card.money-summary-card span,
.theme-dark .summary-card.money-summary-card span,
.theme-dark .summary-card.money-summary-card span,
.theme-dark .summary-card.money-summary-card small,
.theme-dark .summary-card.money-summary-card small,
.theme-dark .summary-card.money-summary-card small {
    color: #94a3b8;
}

.theme-dark .count-badge,
.theme-dark .count-badge,
.theme-dark .count-badge {
    background: rgba(96, 165, 250, 0.14);
    color: #bfdbfe;
}

.theme-dark .money-value,
.theme-dark .money-value,
.theme-dark .money-value,
.theme-dark .summary-card.money-summary-card strong,
.theme-dark .summary-card.money-summary-card strong,
.theme-dark .summary-card.money-summary-card strong {
    color: #bbf7d0;
}

.theme-dark .summary-card.money-summary-card,
.theme-dark .summary-card.money-summary-card,
.theme-dark .summary-card.money-summary-card {
    background: rgba(96, 165, 250, 0.08);
    border-color: rgba(148, 163, 184, 0.18);
}

.theme-dark .record-navigation,
.theme-dark .record-navigation,
.theme-dark .record-navigation {
    background: rgba(148, 163, 184, 0.10);
}

.theme-dark .record-navigation span,
.theme-dark .record-navigation span,
.theme-dark .record-navigation span {
    color: #cbd5e1;
}

/* ============================= */
/* CLIENTES - CREDENCIAIS API    */
/* ============================= */

.api-credentials-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.api-field-card {
    padding: 18px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(255, 255, 255, 0.72);
}

.api-field-card-full {
    grid-column: 1 / -1;
}

.api-field-card label,
.api-field-card .ui-outputlabel {
    display: block;
    margin-bottom: 8px;
    font-weight: 800;
}

.api-input-action {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.api-input-action .ui-inputfield,
.api-input-action .ui-password,
.api-input-action .ui-password input {
    width: 100% !important;
}

.api-field-card small {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #64748b;
}

.btn-icon-primary.ui-button {
    width: 52px !important;
    height: 42px !important;
    min-width: 52px !important;
    border-radius: 14px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.theme-dark .api-field-card,
.theme-dark .api-field-card,
.theme-dark .api-field-card,
.theme-dark .api-field-card,
.theme-dark .api-field-card {
    background: rgba(15, 23, 42, 0.54);
    border-color: rgba(148, 163, 184, 0.18);
}

.theme-dark .api-field-card small,
.theme-dark .api-field-card small,
.theme-dark .api-field-card small,
.theme-dark .api-field-card small,
.theme-dark .api-field-card small {
    color: #94a3b8;
}

@media (max-width: 900px) {
    .api-credentials-grid {
        grid-template-columns: 1fr;
    }
}

.brand-preview-wrapper {
    margin-top: 22px;
}

.brand-preview-card {
    display: flex;
    align-items: center;
    gap: 16px;

    max-width: 560px;
    padding: 16px 18px;

    border-radius: 18px;
    border: 1px solid rgba(39, 55, 127, 0.14);
    background: rgba(39, 55, 127, 0.04);
}

.brand-preview-logo {
    width: 72px;
    height: 52px;

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

    border-radius: 14px;
    background: #ffffff;
    border: 1px solid rgba(39, 55, 127, 0.14);
    overflow: hidden;
}

.brand-preview-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.brand-preview-logo span {
    font-size: 12px;
    font-weight: 900;
    color: #2B2F6E;
    text-align: center;
}

.brand-preview-info {
    flex: 1;
    min-width: 0;
}

.brand-preview-info strong {
    display: block;
    font-size: 15px;
    font-weight: 900;
    color: #111827;
}

.brand-preview-info small {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    color: #64748b;
}

.brand-preview-colors {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-preview-colors span {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12);
}

/* Dark */
.theme-dark .brand-preview-card,
.theme-dark .brand-preview-card,
.theme-dark .brand-preview-card {
    background: rgba(96, 165, 250, 0.08);
    border-color: rgba(148, 163, 184, 0.18);
}

.theme-dark .brand-preview-logo,
.theme-dark .brand-preview-logo,
.theme-dark .brand-preview-logo {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(148, 163, 184, 0.22);
}

.theme-dark .brand-preview-info strong,
.theme-dark .brand-preview-info strong,
.theme-dark .brand-preview-info strong {
    color: #e5e7eb;
}

.theme-dark .brand-preview-info small,
.theme-dark .brand-preview-info small,
.theme-dark .brand-preview-info small {
    color: #94a3b8;
}

/* Ajuste da prévia de identidade visual da empresa */
.brand-preview-wrapper {
    margin-top: 22px;
}

.brand-preview-clean-card {
    width: 100%;
    max-width: 760px;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid rgba(39, 55, 127, 0.14);
    background: rgba(39, 55, 127, 0.035);
}

.brand-preview-clean-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.brand-preview-clean-header strong {
    display: block;
    font-size: 15px;
    font-weight: 900;
    color: #0f172a;
}

.brand-preview-clean-header span {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    color: #64748b;
}

.brand-preview-clean-body {
    display: grid;
    grid-template-columns: 145px 145px 105px minmax(220px, 1fr);
    gap: 14px;
    align-items: stretch;
}

.brand-preview-logo-box,
.brand-preview-icon-box {
    min-height: 110px;
    padding: 10px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    overflow: hidden;
}

.brand-preview-logo-box > span,
.brand-preview-icon-box > span {
    font-size: 11px;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .03em;
    text-align: center;
}

.brand-preview-logo-box.light {
    background: #ffffff;
}

.brand-preview-logo-box.theme-dark,
.brand-preview-icon-box {
    background: #0f172a;
}

.brand-preview-logo-img {
    display: block;
    max-width: 112px;
    max-height: 46px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.brand-preview-icon-img {
    display: block;
    max-width: 50px;
    max-height: 50px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.brand-preview-initial {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(39, 55, 127, 0.10);
    color: #2B2F6E;
    font-size: 18px;
    font-weight: 900;
}

.brand-preview-logo-box.theme-dark .brand-preview-initial,
.brand-preview-icon-box .brand-preview-initial {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.brand-preview-clean-info {
    min-width: 0;
    padding: 14px 16px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.22);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-preview-clean-info strong {
    display: block;
    font-size: 15px;
    font-weight: 900;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-preview-clean-info span {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-preview-color-dots {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.brand-preview-color-dots i {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.14);
}

.theme-dark .brand-preview-clean-card,
.theme-dark .brand-preview-clean-card,
.theme-dark .brand-preview-clean-card {
    background: rgba(96, 165, 250, 0.08);
    border-color: rgba(148, 163, 184, 0.18);
}

.theme-dark .brand-preview-clean-header strong,
.theme-dark .brand-preview-clean-header strong,
.theme-dark .brand-preview-clean-header strong {
    color: #e5e7eb;
}

.theme-dark .brand-preview-clean-header span,
.theme-dark .brand-preview-clean-header span,
.theme-dark .brand-preview-clean-header span {
    color: #94a3b8;
}

.theme-dark .brand-preview-clean-info,
.theme-dark .brand-preview-clean-info,
.theme-dark .brand-preview-clean-info {
    background: rgba(15, 23, 42, 0.82);
    border-color: rgba(148, 163, 184, 0.22);
}

.theme-dark .brand-preview-clean-info strong,
.theme-dark .brand-preview-clean-info strong,
.theme-dark .brand-preview-clean-info strong {
    color: #e5e7eb;
}

.theme-dark .brand-preview-clean-info span,
.theme-dark .brand-preview-clean-info span,
.theme-dark .brand-preview-clean-info span {
    color: #94a3b8;
}

@media (max-width: 900px) {
    .brand-preview-clean-body {
        grid-template-columns: 1fr 1fr;
    }

    .brand-preview-clean-info {
        grid-column: 1 / -1;
    }
}

/* ============================= */
/* FINANCEIRO                    */
/* ============================= */

.financeiro-totals {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.financeiro-totals span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.input-readonly,
.input-readonly input {
    background: rgba(39, 55, 127, 0.06) !important;
    font-weight: 800 !important;
    color: #1e2a6d !important;
    cursor: not-allowed;
}

.status-badge.status-warning,
.status-dot.status-warning {
    color: #92400e;
    background: #fef3c7;
    border-color: #fbbf24;
}

.status-badge.status-warning::before,
.status-dot.status-warning::before {
    background: #f59e0b;
}

.status-badge.status-neutral,
.status-dot.status-neutral {
    color: #475569;
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.status-badge.status-neutral::before,
.status-dot.status-neutral::before {
    background: #64748b;
}

.theme-dark .financeiro-totals,
.theme-dark .financeiro-totals,
.theme-dark .financeiro-totals {
    color: #e5e7eb;
}

.theme-dark .input-readonly,
.theme-dark .input-readonly input,
.theme-dark .input-readonly,
.theme-dark .input-readonly input,
.theme-dark .input-readonly,
.theme-dark .input-readonly input {
    background: rgba(96, 165, 250, 0.10) !important;
    color: #bfdbfe !important;
}

.theme-dark .status-badge.status-warning,
.theme-dark .status-badge.status-warning,
.theme-dark .status-badge.status-warning,
.theme-dark .status-dot.status-warning,
.theme-dark .status-dot.status-warning,
.theme-dark .status-dot.status-warning {
    color: #fde68a;
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(245, 158, 11, 0.38);
}

.theme-dark .status-badge.status-neutral,
.theme-dark .status-badge.status-neutral,
.theme-dark .status-badge.status-neutral,
.theme-dark .status-dot.status-neutral,
.theme-dark .status-dot.status-neutral,
.theme-dark .status-dot.status-neutral {
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.14);
    border-color: rgba(148, 163, 184, 0.28);
}

/* ============================= */
/* GENERIC FORM STRUCTURE        */
/* ============================= */

.form-card {
    padding: 24px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: var(--surface-card, #ffffff);
}

.form-card + .form-card {
    margin-top: 18px;
}

.form-card-header {
    margin-bottom: 22px;
}

.form-card-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 900;
    color: #0f172a;
}

.form-card-header span {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: #64748b;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 24px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px 24px;
}

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

.form-field-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-field-block label,
.form-field-block .ui-outputlabel {
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
}

.form-field-help {
    font-size: 12px;
    line-height: 1.4;
    color: #64748b;
}

.form-inline-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================= */
/* GENERIC PREVIEW / INFO CARD   */
/* ============================= */

.form-preview-card {
    display: flex;
    align-items: center;
    gap: 14px;

    padding: 16px 18px;
    border-radius: 16px;

    background: rgba(39, 55, 127, 0.04);
    border: 1px solid rgba(39, 55, 127, 0.12);
}

.form-preview-icon {
    width: 42px;
    height: 42px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 14px;
    background: rgba(39, 55, 127, 0.10);
    color: var(--bm-blue, #2B2F6E);
    font-size: 18px;
    flex: 0 0 auto;
}

.form-preview-content {
    flex: 1;
    min-width: 0;
}

.form-preview-content strong {
    display: block;
    font-size: 14px;
    font-weight: 900;
    color: #0f172a;
}

.form-preview-content span {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #64748b;
}

/* ============================= */
/* GENERIC FINANCIAL INDICATORS  */
/* ============================= */

.indicator-entry {
    color: #047857;
    background: rgba(16, 185, 129, 0.10);
    border-color: rgba(16, 185, 129, 0.24);
}

.indicator-exit {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.10);
    border-color: rgba(239, 68, 68, 0.24);
}

.indicator-neutral {
    color: #475569;
    background: rgba(100, 116, 139, 0.10);
    border-color: rgba(100, 116, 139, 0.24);
}

/* ============================= */
/* RESPONSIVE                   */
/* ============================= */

@media (max-width: 900px) {
    .form-grid-2,
    .form-grid-3 {
        grid-template-columns: 1fr;
    }
}

/* ============================= */
/* DARK MODE                    */
/* ============================= */

.theme-dark .form-card,
.theme-dark .form-card,
.theme-dark .form-card {
    background: rgba(15, 23, 42, 0.78);
    border-color: rgba(148, 163, 184, 0.18);
}

.theme-dark .form-card-header h3,
.theme-dark .form-card-header h3,
.theme-dark .form-card-header h3,
.theme-dark .form-field-block label,
.theme-dark .form-field-block label,
.theme-dark .form-field-block label,
.theme-dark .form-field-block .ui-outputlabel,
.theme-dark .form-field-block .ui-outputlabel,
.theme-dark .form-field-block .ui-outputlabel {
    color: #e5e7eb;
}

.theme-dark .form-card-header span,
.theme-dark .form-card-header span,
.theme-dark .form-card-header span,
.theme-dark .form-field-help,
.theme-dark .form-field-help,
.theme-dark .form-field-help {
    color: #94a3b8;
}
.theme-dark .form-preview-card,
.theme-dark .form-preview-card,
.theme-dark .form-preview-card {
    background: rgba(96, 165, 250, 0.08);
    border-color: rgba(148, 163, 184, 0.18);
}

.theme-dark .form-preview-icon,
.theme-dark .form-preview-icon,
.theme-dark .form-preview-icon {
    background: rgba(96, 165, 250, 0.14);
    color: #bfdbfe;
}

.theme-dark .form-preview-content strong,
.theme-dark .form-preview-content strong,
.theme-dark .form-preview-content strong {
    color: #e5e7eb;
}

.theme-dark .form-preview-content span,
.theme-dark .form-preview-content span,
.theme-dark .form-preview-content span {
    color: #94a3b8;
}

.form-grid-1 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px 24px;
    max-width: 720px;
}

/* ========================================================= */
/* FINANCIAL DASHBOARD / MANAGEMENT SUMMARY                 */
/* ========================================================= */

.management-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 18px 0;
}

.management-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 18px 0;
}

.management-grid-analytics {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 16px;
    margin: 18px 0;
}

.management-card {
    position: relative;
    overflow: hidden;

    min-height: 124px;
    padding: 20px;

    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: #ffffff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

.management-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at top right, rgba(39, 55, 127, 0.08), transparent 42%);
}

.management-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    position: relative;
    z-index: 1;
}

.management-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #475569;
    font-size: 13px;
    font-weight: 800;
}

.management-card-icon {
    width: 46px;
    height: 46px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 16px;
    font-size: 20px;
    flex: 0 0 auto;
}

.management-card-value {
    display: block;
    margin-top: 16px;
    position: relative;
    z-index: 1;

    font-size: 26px;
    line-height: 1.1;
    font-weight: 950;
    letter-spacing: -0.04em;
    color: #0f172a;
}

.management-card-subtitle {
    display: block;
    margin-top: 7px;
    position: relative;
    z-index: 1;

    font-size: 12px;
    font-weight: 700;
    color: #64748b;
}

.management-trend {
    margin-top: 12px;
    height: 34px;

    display: flex;
    align-items: flex-end;
    gap: 4px;

    position: relative;
    z-index: 1;
}

.management-trend span {
    display: block;
    width: 8px;
    min-height: 7px;
    border-radius: 999px 999px 0 0;
    opacity: 0.85;
}

/* Receita */
.management-card-income {
    border-color: rgba(34, 197, 94, 0.22);
}

.management-card-income .management-card-icon {
    background: rgba(34, 197, 94, 0.14);
    color: #059669;
}

.management-card-income .management-card-value {
    color: #059669;
}

.management-card-income .management-trend span {
    background: #22c55e;
}

/* Despesa */
.management-card-expense {
    border-color: rgba(239, 68, 68, 0.24);
}

.management-card-expense .management-card-icon {
    background: rgba(239, 68, 68, 0.14);
    color: #dc2626;
}

.management-card-expense .management-card-value {
    color: #dc2626;
}

.management-card-expense .management-trend span {
    background: #ef4444;
}

/* Resultado */
.management-card-result {
    border-color: rgba(37, 99, 235, 0.22);
}

.management-card-result .management-card-icon {
    background: rgba(37, 99, 235, 0.13);
    color: #2563eb;
}

.management-card-result .management-card-value {
    color: #2563eb;
}

.management-card-result .management-trend span {
    background: #2563eb;
}

/* Cards operacionais */
.summary-tile {
    display: flex;
    align-items: center;
    gap: 14px;

    min-height: 86px;
    padding: 17px 18px;

    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.045);
}

.summary-tile-icon {
    width: 44px;
    height: 44px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 15px;
    font-size: 19px;
    flex: 0 0 auto;
}

.summary-tile-content {
    flex: 1;
    min-width: 0;
}

.summary-tile-label {
    display: block;
    font-size: 12px;
    font-weight: 850;
    color: #475569;
}

.summary-tile-value {
    display: block;
    margin-top: 4px;
    font-size: 18px;
    font-weight: 950;
    letter-spacing: -0.03em;
    color: #0f172a;
}

.summary-tile-subtitle {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: #64748b;
}

.summary-tile-arrow {
    color: #94a3b8;
    font-size: 14px;
}

.summary-tile-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), #ffffff);
    border-color: rgba(245, 158, 11, 0.22);
}

.summary-tile-warning .summary-tile-icon {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.summary-tile-warning .summary-tile-value {
    color: #d97706;
}

.summary-tile-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), #ffffff);
    border-color: rgba(239, 68, 68, 0.22);
}

.summary-tile-danger .summary-tile-icon {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.summary-tile-danger .summary-tile-value {
    color: #dc2626;
}

.summary-tile-success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), #ffffff);
    border-color: rgba(34, 197, 94, 0.22);
}

.summary-tile-success .summary-tile-icon {
    background: rgba(34, 197, 94, 0.15);
    color: #059669;
}

.summary-tile-success .summary-tile-value {
    color: #059669;
}

.summary-tile-info {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), #ffffff);
    border-color: rgba(37, 99, 235, 0.22);
}

.summary-tile-info .summary-tile-icon {
    background: rgba(37, 99, 235, 0.13);
    color: #2563eb;
}

.summary-tile-info .summary-tile-value {
    color: #2563eb;
}

/* Analytics */
.analytics-card {
    min-height: 250px;
    padding: 18px;

    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.analytics-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.analytics-title {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #475569;
    padding-bottom: 6px;
    border-bottom: 1px solid #eef2f7;
}

.analytics-subtitle {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #64748b;
}

.fake-chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 165px;
    padding: 12px 2px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.fake-chart-month {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    height: 100%;
}

.fake-chart-month span {
    width: 9px;
    border-radius: 999px 999px 0 0;
}

.fake-chart-income {
    background: #22c55e;
}

.fake-chart-expense {
    background: #ef4444;
}

.fake-chart-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 10px;
    color: #64748b;
}

.donut-placeholder {
    width: 138px;
    height: 138px;
    border-radius: 50%;
    background:
        conic-gradient(
            #22c55e 0 42%,
            #2563eb 42% 62%,
            #8b5cf6 62% 78%,
            #f59e0b 78% 88%,
            #ef4444 88% 96%,
            #94a3b8 96% 100%
        );
    position: relative;
    flex: 0 0 auto;
}

.donut-placeholder::after {
    content: "";
    position: absolute;
    inset: 31px;
    border-radius: 50%;
    background: #ffffff;
}

.donut-layout {
    display: flex;
    align-items: center;
    gap: 18px;
}

.analytics-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.analytics-list-row {
    display: grid;
    grid-template-columns: 10px 1fr auto;
    gap: 8px;
    align-items: center;
    font-size: 12px;
}

.analytics-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
}

.analytics-row-label {
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.analytics-row-value {
    font-weight: 850;
    color: #0f172a;
}

.rank-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rank-row {
    display: grid;
    grid-template-columns: 150px 1fr auto;
    gap: 10px;
    align-items: center;
    font-size: 12px;
}

.rank-label {
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-bar {
    height: 10px;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.12);
    overflow: hidden;
}

.rank-bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: #ef4444;
}

.rank-value {
    color: #0f172a;
    font-weight: 850;
}

/* Table value emphasis */
.money-income {
    color: #059669;
    font-weight: 950;
}

.money-expense {
    color: #dc2626;
    font-weight: 950;
}

.fin-type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 5px 10px;
    border-radius: 999px;

    font-size: 11px;
    font-weight: 900;
}

.fin-type-income {
    color: #047857;
    background: rgba(34, 197, 94, 0.13);
}

.fin-type-expense {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.13);
}

/* Responsive */
@media (max-width: 1100px) { /* breakpoint canônico: era 1180px */
    .management-grid-3,
    .management-grid-analytics {
        grid-template-columns: 1fr;
    }

    .management-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) { /* breakpoint canônico: era 720px */
    .management-grid-4 {
        grid-template-columns: 1fr;
    }

    .donut-layout {
        flex-direction: column;
        align-items: flex-start;
    }

    .rank-row {
        grid-template-columns: 1fr;
    }
}

/* Dark mode */
.theme-dark .management-card,
.theme-dark .management-card,
.theme-dark .management-card,
.theme-dark .summary-tile,
.theme-dark .summary-tile,
.theme-dark .summary-tile,
.theme-dark .analytics-card,
.theme-dark .analytics-card,
.theme-dark .analytics-card {
    background: rgba(15, 23, 42, 0.84);
    border-color: rgba(148, 163, 184, 0.18);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
}

.theme-dark .management-card-title,
.theme-dark .management-card-title,
.theme-dark .management-card-title,
.theme-dark .management-card-subtitle,
.theme-dark .management-card-subtitle,
.theme-dark .management-card-subtitle,
.theme-dark .summary-tile-label,
.theme-dark .summary-tile-label,
.theme-dark .summary-tile-label,
.theme-dark .summary-tile-subtitle,
.theme-dark .summary-tile-subtitle,
.theme-dark .summary-tile-subtitle,
.theme-dark .analytics-subtitle,
.theme-dark .analytics-subtitle,
.theme-dark .analytics-subtitle,
.theme-dark .analytics-row-label,
.theme-dark .analytics-row-label,
.theme-dark .analytics-row-label,
.theme-dark .rank-label,
.theme-dark .rank-label,
.theme-dark .rank-label {
    color: #94a3b8;
}

.theme-dark .analytics-title,
.theme-dark .analytics-title,
.theme-dark .analytics-title,
.theme-dark .summary-tile-value,
.theme-dark .summary-tile-value,
.theme-dark .summary-tile-value,
.theme-dark .analytics-row-value,
.theme-dark .analytics-row-value,
.theme-dark .analytics-row-value,
.theme-dark .rank-value,
.theme-dark .rank-value,
.theme-dark .rank-value {
    color: #e5e7eb;
}

.theme-dark .donut-placeholder::after,
.theme-dark .donut-placeholder::after,
.theme-dark .donut-placeholder::after {
    background: #0f172a;
}

/* ========================================================= */
/* MOVIMENTAÇÃO FINANCEIRA - FILTROS AVANÇADOS               */
/* ========================================================= */

.bm-filter-card.mf-filter-card {
    display: block !important;
    align-items: initial !important;
    justify-content: initial !important;
    gap: 0 !important;
    padding: 22px 24px !important;
}

.mf-filter-header {
    margin-bottom: 18px;
}

.mf-filter-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 950;
    color: #0f172a;
}

.mf-filter-header span {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.35;
    color: #64748b;
}

.mf-filter-rows {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mf-filter-row {
    display: grid;
    gap: 14px;
    align-items: end;
}

.mf-filter-row-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mf-filter-row-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mf-filter-row-5 {
    grid-template-columns: 1fr 1fr 1fr 0.85fr 0.95fr;
}

.mf-filter-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.mf-filter-field label,
.mf-filter-field .ui-outputlabel {
    margin: 0;
    font-size: 12px;
    font-weight: 850;
    color: #0f172a;
}

.mf-filter-field .ui-selectonemenu,
.mf-filter-field .ui-inputfield {
    width: 100% !important;
}

/* Ações em linha separada */
.mf-filter-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
}

.mf-filter-actions .ui-button {
    height: 46px;
    min-width: 126px;
}

.mf-filter-actions .btn-primary {
    min-width: 205px;
}

/* DatePicker */
.mf-date-field {
    display: flex !important;
    width: 100% !important;
}

.mf-date-field input,
.mf-date-field .ui-inputfield {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
}

.mf-date-field .ui-button,
.mf-date-field button {
    flex: 0 0 44px !important;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 42px !important;
    min-height: 42px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 12px !important;
}

.mf-date-field > span,
.mf-date-field .ui-datepicker,
.mf-date-field .ui-inputgroup {
    display: flex !important;
    width: 100% !important;
}

/* Responsivo */
@media (max-width: 1320px) {
    .mf-filter-row-4,
    .mf-filter-row-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mf-filter-row-5 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .mf-filter-row-4,
    .mf-filter-row-5,
    .mf-filter-row-3 {
        grid-template-columns: 1fr;
    }

    .mf-filter-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .mf-filter-actions .ui-button,
    .mf-filter-actions .btn-primary {
        width: 100%;
        min-width: 0;
    }
}

/* Dark mode */
.theme-dark .mf-filter-header h3,
.theme-dark .mf-filter-header h3,
.theme-dark .mf-filter-header h3,
.theme-dark .mf-filter-field label,
.theme-dark .mf-filter-field label,
.theme-dark .mf-filter-field label,
.theme-dark .mf-filter-field .ui-outputlabel,
.theme-dark .mf-filter-field .ui-outputlabel,
.theme-dark .mf-filter-field .ui-outputlabel {
    color: #e5e7eb;
}

.theme-dark .mf-filter-header span,
.theme-dark .mf-filter-header span,
.theme-dark .mf-filter-header span {
    color: #94a3b8;
}

/* ========================================================= */
/* MOVIMENTAÇÃO FINANCEIRA - KPI CARDS                      */
/* ========================================================= */

.finance-kpi-row {
    display: grid;
    /* 4 cards por linha no desktop (8 cards = 2 linhas de 4). Telas menores caem para 2/1 via @media abaixo. */
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 14px 0;
}

/* Painéis analíticos (fluxo projetado, DRE, aging, gráficos) tilados lado a lado e responsivos:
   acaba com o desperdício de espaço dos painéis full-width esparsos. */
.mf-analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;  /* 2 painéis por linha (ex.: DRE + Aging juntos) */
    gap: 16px;
    align-items: start;
    margin-bottom: 16px;
}
@media (max-width: 820px) {
    .mf-analytics-grid { grid-template-columns: 1fr; } /* 1 por linha no mobile */
}
/* Painel analítico = CARTÃO EM BLOCO (título em cima, conteúdo usando a largura toda).
   NÃO usar .bm-filter-card aqui: aquele é um grid de 3 colunas da barra de busca. */
.mf-panel {
    background: #fff;
    border: 1px solid var(--bm-border, #eef2f7);
    border-radius: 14px;
    box-shadow: var(--shadow-soft, 0 6px 18px rgba(15,23,42,.05));
    padding: 16px 18px;
    display: block;
    min-width: 0;
    overflow: hidden;
}
.mf-analytics-grid .mf-wide { grid-column: 1 / -1; } /* gráficos de barras ocupam a linha inteira */
/* Inputs das grades bespoke (Mov. Financeira) ocupam 100% SEM ui-fluid (assim os botões de ação
   não esticam para a largura toda). Só campos diretos do bm-dyn-field; não afeta o dicionário. */
.bm-dyn-field .ui-inputfield,
.bm-dyn-field .ui-selectonemenu,
.bm-dyn-field .ui-inputnumber,
.bm-dyn-field .ui-calendar,
.bm-dyn-field .ui-inputtextarea,
.bm-dyn-field > textarea { width: 100%; }

/* Faixa de resumo do form (uma linha, destaques) — estilo Demandas */
.mf-resumo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 20px;
    margin: 0 0 14px;
    padding: 9px 14px;
    background: #f8fafc;
    border: 1px solid #eef2f7;
    border-radius: 10px;
    font-size: 13px;
}
.mf-resumo-item { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.mf-resumo-item > span { color: #64748b; font-size: 11px; text-transform: uppercase; letter-spacing: .02em; }
.mf-resumo-item > strong { color: #0f172a; font-weight: 800; }
/* datePicker no rail de filtros: input + ícone na MESMA linha (o ícone não pula) */
.bm-rail-field .ui-calendar { display: flex; flex-wrap: nowrap; width: 100%; }
.bm-rail-field .ui-calendar > input { flex: 1 1 auto; min-width: 0; }
.bm-rail-field .ui-calendar > .ui-datepicker-trigger { flex: 0 0 auto; }

.finance-kpi-card {
    display: grid;
    grid-template-columns: 42px 1fr; /* ícone + conteúdo (sem a 3ª coluna morta de 180px) */
    align-items: center;
    gap: 12px;

    min-height: 72px;
    padding: 12px 14px;

    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.finance-kpi-icon {
    width: 40px;
    height: 40px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;
    font-size: 17px;
}

.finance-kpi-title {
    display: flex;
    align-items: center;
    gap: 6px;

    font-size: 11.5px;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.finance-kpi-title i {
    font-size: 11px;
    color: #94a3b8;
}

.finance-kpi-value {
    margin-top: 3px;
    /* escala com a largura: nunca gigante em tela pequena, confortável em tela grande */
    font-size: clamp(14px, 1.25vw, 18px);
    line-height: 1.15;
    font-weight: 900;
    letter-spacing: -0.03em;
    white-space: nowrap;          /* nunca quebra o valor em duas linhas */
    overflow: hidden;
    text-overflow: ellipsis;
}
/* o conteúdo pode encolher dentro do card sem empurrar/quebrar o valor */
.finance-kpi-content { min-width: 0; }

.finance-kpi-variation {
    margin-top: 2px;
    font-size: 11px;
    font-weight: 700;
}

.finance-kpi-variation span {
    margin-right: 4px;
}

.finance-kpi-chart {
    position: relative;
    height: 82px;
    min-width: 160px;
}

.finance-kpi-chart svg {
    position: absolute;
    right: 0;
    bottom: 10px;
    width: 138px;
    height: 58px;
    overflow: visible;
}

.finance-kpi-chart line {
    stroke: rgba(148, 163, 184, 0.18);
    stroke-width: 1;
}

.finance-kpi-chart polyline {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.finance-kpi-chart-scale {
    position: absolute;
    left: 0;
    font-size: 9px;
    font-weight: 700;
    color: #94a3b8;
}

.finance-kpi-chart-top {
    top: 5px;
}

.finance-kpi-chart-mid {
    top: 25px;
}

.finance-kpi-chart-low {
    top: 45px;
}

.finance-kpi-chart-month {
    position: absolute;
    right: 0;
    bottom: 0;
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
}

/* Receita */
.finance-kpi-income .finance-kpi-icon {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.finance-kpi-income .finance-kpi-value,
.finance-kpi-income .finance-kpi-variation {
    color: #16a34a;
}

.finance-kpi-income .finance-kpi-chart polyline {
    stroke: #16a34a;
}

/* Despesa */
.finance-kpi-expense .finance-kpi-icon {
    background: rgba(239, 68, 68, 0.16);
    color: #dc2626;
}

.finance-kpi-expense .finance-kpi-value,
.finance-kpi-expense .finance-kpi-variation {
    color: #dc2626;
}

.finance-kpi-expense .finance-kpi-chart polyline {
    stroke: #ef4444;
}

/* Resultado */
.finance-kpi-result .finance-kpi-icon {
    background: rgba(37, 99, 235, 0.14);
    color: #2563eb;
}

.finance-kpi-result .finance-kpi-value,
.finance-kpi-result .finance-kpi-variation {
    color: #2563eb;
}

.finance-kpi-result .finance-kpi-chart polyline {
    stroke: #2563eb;
}

/* Responsivo */
@media (max-width: 1320px) {
    .finance-kpi-row {
        grid-template-columns: 1fr;
    }

    .finance-kpi-card {
        grid-template-columns: 74px 1fr 180px;
    }
}

@media (max-width: 768px) { /* breakpoint canônico: era 720px */
    .finance-kpi-card {
        grid-template-columns: 1fr;
    }

    .finance-kpi-chart {
        width: 100%;
    }
}

/* Dark */
.theme-dark .finance-kpi-card,
.theme-dark .finance-kpi-card,
.theme-dark .finance-kpi-card {
    background: rgba(15, 23, 42, 0.86);
    border-color: rgba(148, 163, 184, 0.18);
}

.theme-dark .finance-kpi-title,
.theme-dark .finance-kpi-title,
.theme-dark .finance-kpi-title {
    color: #e5e7eb;
}

.real-chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 22px;
    height: 170px;
    padding: 14px 8px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.real-chart-month {
    flex: 1;
    height: 100%;

    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
}

.real-chart-month span {
    width: 10px;
    min-height: 0;
    border-radius: 999px 999px 0 0;
}

.real-chart-income {
    background: #22c55e;
}

.real-chart-expense {
    background: #ef4444;
}

.real-chart-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    padding: 0 6px;

    font-size: 11px;
    color: #64748b;
}

.analytics-empty {
    display: block;
    padding: 18px 0;
    font-size: 13px;
    color: #64748b;
}

/* ========================================================= */
/* FINANCEIRO - DARK MODE FORÇADO / FINAL                    */
/* Colocar SEMPRE no final do app.css                        */
/* ========================================================= */

/* Detecta vários padrões possíveis de tema dark */
.theme-dark .finance-kpi-card,
.theme-dark .finance-kpi-card,
.theme-dark .finance-kpi-card,
body.theme-dark .finance-kpi-card,
.theme-dark .finance-kpi-card,
.theme-dark .finance-kpi-card,
.theme-dark .finance-kpi-card,
.theme-dark .finance-kpi-card,
html.theme-dark .finance-kpi-card,
html.theme-dark .finance-kpi-card,
body[class*="dark"] .finance-kpi-card,
html[class*="dark"] .finance-kpi-card,

.theme-dark .summary-tile,
.theme-dark .summary-tile,
.theme-dark .summary-tile,
body.theme-dark .summary-tile,
.theme-dark .summary-tile,
.theme-dark .summary-tile,
.theme-dark .summary-tile,
.theme-dark .summary-tile,
html.theme-dark .summary-tile,
html.theme-dark .summary-tile,
body[class*="dark"] .summary-tile,
html[class*="dark"] .summary-tile,

.theme-dark .analytics-card,
.theme-dark .analytics-card,
.theme-dark .analytics-card,
body.theme-dark .analytics-card,
.theme-dark .analytics-card,
.theme-dark .analytics-card,
.theme-dark .analytics-card,
.theme-dark .analytics-card,
html.theme-dark .analytics-card,
html.theme-dark .analytics-card,
body[class*="dark"] .analytics-card,
html[class*="dark"] .analytics-card {
    background: #111827 !important;
    background-image: none !important;
    border-color: rgba(148, 163, 184, 0.22) !important;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34) !important;
}

/* Remove os gradientes claros dos cards operacionais */
body[class*="dark"] .summary-tile-warning,
html[class*="dark"] .summary-tile-warning,
.theme-dark .summary-tile-warning,
.theme-dark .summary-tile-warning,
.theme-dark .summary-tile-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), #111827 55%) !important;
    border-color: rgba(245, 158, 11, 0.35) !important;
}

body[class*="dark"] .summary-tile-danger,
html[class*="dark"] .summary-tile-danger,
.theme-dark .summary-tile-danger,
.theme-dark .summary-tile-danger,
.theme-dark .summary-tile-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.18), #111827 55%) !important;
    border-color: rgba(239, 68, 68, 0.35) !important;
}

body[class*="dark"] .summary-tile-success,
html[class*="dark"] .summary-tile-success,
.theme-dark .summary-tile-success,
.theme-dark .summary-tile-success,
.theme-dark .summary-tile-success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), #111827 55%) !important;
    border-color: rgba(34, 197, 94, 0.35) !important;
}

body[class*="dark"] .summary-tile-info,
html[class*="dark"] .summary-tile-info,
.theme-dark .summary-tile-info,
.theme-dark .summary-tile-info,
.theme-dark .summary-tile-info {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), #111827 55%) !important;
    border-color: rgba(37, 99, 235, 0.35) !important;
}

/* Textos principais */
body[class*="dark"] .finance-kpi-title,
html[class*="dark"] .finance-kpi-title,
.theme-dark .finance-kpi-title,
.theme-dark .finance-kpi-title,
.theme-dark .finance-kpi-title,
body[class*="dark"] .analytics-title,
html[class*="dark"] .analytics-title,
.theme-dark .analytics-title,
.theme-dark .analytics-title,
.theme-dark .analytics-title,
body[class*="dark"] .summary-tile-label,
html[class*="dark"] .summary-tile-label,
.theme-dark .summary-tile-label,
.theme-dark .summary-tile-label,
.theme-dark .summary-tile-label {
    color: #f8fafc !important;
}

/* Textos secundários */
body[class*="dark"] .analytics-subtitle,
html[class*="dark"] .analytics-subtitle,
.theme-dark .analytics-subtitle,
.theme-dark .analytics-subtitle,
.theme-dark .analytics-subtitle,
body[class*="dark"] .summary-tile-subtitle,
html[class*="dark"] .summary-tile-subtitle,
.theme-dark .summary-tile-subtitle,
.theme-dark .summary-tile-subtitle,
.theme-dark .summary-tile-subtitle,
body[class*="dark"] .finance-kpi-title i,
html[class*="dark"] .finance-kpi-title i,
.theme-dark .finance-kpi-title i,
.theme-dark .finance-kpi-title i,
.theme-dark .finance-kpi-title i,
body[class*="dark"] .real-chart-labels,
html[class*="dark"] .real-chart-labels,
.theme-dark .real-chart-labels,
.theme-dark .real-chart-labels,
.theme-dark .real-chart-labels,
body[class*="dark"] .analytics-row-label,
html[class*="dark"] .analytics-row-label,
.theme-dark .analytics-row-label,
.theme-dark .analytics-row-label,
.theme-dark .analytics-row-label,
body[class*="dark"] .rank-label,
html[class*="dark"] .rank-label,
.theme-dark .rank-label,
.theme-dark .rank-label,
.theme-dark .rank-label {
    color: #cbd5e1 !important;
}

/* Valores e labels fortes */
body[class*="dark"] .analytics-row-value,
html[class*="dark"] .analytics-row-value,
.theme-dark .analytics-row-value,
.theme-dark .analytics-row-value,
.theme-dark .analytics-row-value,
body[class*="dark"] .rank-value,
html[class*="dark"] .rank-value,
.theme-dark .rank-value,
.theme-dark .rank-value,
.theme-dark .rank-value {
    color: #f8fafc !important;
}

/* Linhas dos gráficos dos cards principais */
body[class*="dark"] .finance-kpi-chart line,
html[class*="dark"] .finance-kpi-chart line,
.theme-dark .finance-kpi-chart line,
.theme-dark .finance-kpi-chart line,
.theme-dark .finance-kpi-chart line {
    stroke: rgba(148, 163, 184, 0.22) !important;
}

body[class*="dark"] .finance-kpi-chart-scale,
html[class*="dark"] .finance-kpi-chart-scale,
.theme-dark .finance-kpi-chart-scale,
.theme-dark .finance-kpi-chart-scale,
.theme-dark .finance-kpi-chart-scale,
body[class*="dark"] .finance-kpi-chart-month,
html[class*="dark"] .finance-kpi-chart-month,
.theme-dark .finance-kpi-chart-month,
.theme-dark .finance-kpi-chart-month,
.theme-dark .finance-kpi-chart-month {
    color: #94a3b8 !important;
}

/* Donut no dark */
body[class*="dark"] .donut-placeholder::after,
html[class*="dark"] .donut-placeholder::after,
.theme-dark .donut-placeholder::after,
.theme-dark .donut-placeholder::after,
.theme-dark .donut-placeholder::after {
    background: #111827 !important;
}

/* Linha base do gráfico de barras */
body[class*="dark"] .real-chart-bars,
html[class*="dark"] .real-chart-bars,
.theme-dark .real-chart-bars,
.theme-dark .real-chart-bars,
.theme-dark .real-chart-bars {
    border-bottom-color: rgba(148, 163, 184, 0.25) !important;
}

/* Barras top gastos */
body[class*="dark"] .rank-bar,
html[class*="dark"] .rank-bar,
.theme-dark .rank-bar,
.theme-dark .rank-bar,
.theme-dark .rank-bar {
    background: rgba(239, 68, 68, 0.18) !important;
}

/* ========================================================= */
/* PRIMEFACES SELECTONEMENU - DARK MODE                     */
/* Corrige overlay/dropdown dos combos no tema dark          */
/* ========================================================= */

body[class*="dark"] .ui-selectonemenu-panel,
html[class*="dark"] .ui-selectonemenu-panel,
.theme-dark .ui-selectonemenu-panel,
.theme-dark .ui-selectonemenu-panel,
.theme-dark .ui-selectonemenu-panel,
.theme-dark .ui-selectonemenu-panel {
    background: #0f172a !important;
    border: 1px solid rgba(148, 163, 184, 0.24) !important;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45) !important;
    color: #e5e7eb !important;
}

/* Área branca onde fica o filtro */
body[class*="dark"] .ui-selectonemenu-panel .ui-selectonemenu-filter-container,
html[class*="dark"] .ui-selectonemenu-panel .ui-selectonemenu-filter-container,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-filter-container,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-filter-container,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-filter-container,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-filter-container {
    background: #0f172a !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18) !important;
    padding: 8px !important;
}

/* Input de busca do combo */
body[class*="dark"] .ui-selectonemenu-panel .ui-selectonemenu-filter,
html[class*="dark"] .ui-selectonemenu-panel .ui-selectonemenu-filter,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-filter,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-filter,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-filter,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-filter {
    background: #111827 !important;
    border: 1px solid rgba(148, 163, 184, 0.25) !important;
    color: #e5e7eb !important;
    border-radius: 12px !important;
    box-shadow: none !important;
}

/* Ícone da lupa no filtro */
body[class*="dark"] .ui-selectonemenu-panel .ui-selectonemenu-filter-container .ui-icon,
html[class*="dark"] .ui-selectonemenu-panel .ui-selectonemenu-filter-container .ui-icon,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-filter-container .ui-icon,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-filter-container .ui-icon,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-filter-container .ui-icon,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-filter-container .ui-icon {
    color: #94a3b8 !important;
}

/* Lista de opções */
body[class*="dark"] .ui-selectonemenu-panel .ui-selectonemenu-items,
html[class*="dark"] .ui-selectonemenu-panel .ui-selectonemenu-items,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-items,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-items,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-items,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-items {
    background: #0f172a !important;
    color: #e5e7eb !important;
}

/* Opções normais */
body[class*="dark"] .ui-selectonemenu-panel .ui-selectonemenu-item,
html[class*="dark"] .ui-selectonemenu-panel .ui-selectonemenu-item,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-item,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-item,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-item,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-item {
    background: transparent !important;
    color: #e5e7eb !important;
    border: 0 !important;
}

/* Hover */
body[class*="dark"] .ui-selectonemenu-panel .ui-selectonemenu-item.ui-state-hover,
body[class*="dark"] .ui-selectonemenu-panel .ui-selectonemenu-item:hover,
html[class*="dark"] .ui-selectonemenu-panel .ui-selectonemenu-item.ui-state-hover,
html[class*="dark"] .ui-selectonemenu-panel .ui-selectonemenu-item:hover,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-item.ui-state-hover,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-item:hover,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-item.ui-state-hover,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-item:hover,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-item.ui-state-hover,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-item:hover,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-item.ui-state-hover,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-item:hover {
    background: rgba(59, 130, 246, 0.16) !important;
    color: #ffffff !important;
}

/* Item selecionado */
body[class*="dark"] .ui-selectonemenu-panel .ui-selectonemenu-item.ui-state-highlight,
html[class*="dark"] .ui-selectonemenu-panel .ui-selectonemenu-item.ui-state-highlight,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-item.ui-state-highlight,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-item.ui-state-highlight,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-item.ui-state-highlight,
.theme-dark .ui-selectonemenu-panel .ui-selectonemenu-item.ui-state-highlight {
    background: rgba(37, 99, 235, 0.30) !important;
    color: #ffffff !important;
}

/* Scrollbar do painel */
body[class*="dark"] .ui-selectonemenu-panel ::-webkit-scrollbar,
html[class*="dark"] .ui-selectonemenu-panel ::-webkit-scrollbar,
.theme-dark .ui-selectonemenu-panel ::-webkit-scrollbar,
.theme-dark .ui-selectonemenu-panel ::-webkit-scrollbar,
.theme-dark .ui-selectonemenu-panel ::-webkit-scrollbar,
.theme-dark .ui-selectonemenu-panel ::-webkit-scrollbar {
    width: 10px;
}

body[class*="dark"] .ui-selectonemenu-panel ::-webkit-scrollbar-track,
html[class*="dark"] .ui-selectonemenu-panel ::-webkit-scrollbar-track,
.theme-dark .ui-selectonemenu-panel ::-webkit-scrollbar-track,
.theme-dark .ui-selectonemenu-panel ::-webkit-scrollbar-track,
.theme-dark .ui-selectonemenu-panel ::-webkit-scrollbar-track,
.theme-dark .ui-selectonemenu-panel ::-webkit-scrollbar-track {
    background: #0f172a;
}

body[class*="dark"] .ui-selectonemenu-panel ::-webkit-scrollbar-thumb,
html[class*="dark"] .ui-selectonemenu-panel ::-webkit-scrollbar-thumb,
.theme-dark .ui-selectonemenu-panel ::-webkit-scrollbar-thumb,
.theme-dark .ui-selectonemenu-panel ::-webkit-scrollbar-thumb,
.theme-dark .ui-selectonemenu-panel ::-webkit-scrollbar-thumb,
.theme-dark .ui-selectonemenu-panel ::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.45);
    border-radius: 999px;
}

/* ========================================================= */
/* PRIMEFACES DATEPICKER - DARK MODE                         */
/* Corrige calendário no tema dark                            */
/* ========================================================= */

body[class*="dark"] .ui-datepicker,
html[class*="dark"] .ui-datepicker,
.theme-dark .ui-datepicker,
.theme-dark .ui-datepicker,
.theme-dark .ui-datepicker,
.theme-dark .ui-datepicker,
body[class*="dark"] .ui-datepicker-panel,
html[class*="dark"] .ui-datepicker-panel,
.theme-dark .ui-datepicker-panel,
.theme-dark .ui-datepicker-panel,
.theme-dark .ui-datepicker-panel,
.theme-dark .ui-datepicker-panel {
    background: #0f172a !important;
    border: 1px solid rgba(148, 163, 184, 0.24) !important;
    color: #e5e7eb !important;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45) !important;
}

/* Cabeçalho do calendário */
body[class*="dark"] .ui-datepicker .ui-datepicker-header,
html[class*="dark"] .ui-datepicker .ui-datepicker-header,
.theme-dark .ui-datepicker .ui-datepicker-header,
.theme-dark .ui-datepicker .ui-datepicker-header,
.theme-dark .ui-datepicker .ui-datepicker-header,
.theme-dark .ui-datepicker .ui-datepicker-header {
    background: #111827 !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18) !important;
    color: #f8fafc !important;
}

/* Mês/Ano */
body[class*="dark"] .ui-datepicker .ui-datepicker-title,
html[class*="dark"] .ui-datepicker .ui-datepicker-title,
.theme-dark .ui-datepicker .ui-datepicker-title,
.theme-dark .ui-datepicker .ui-datepicker-title,
.theme-dark .ui-datepicker .ui-datepicker-title,
.theme-dark .ui-datepicker .ui-datepicker-title {
    color: #f8fafc !important;
    font-weight: 900 !important;
}

/* Setas anterior/próximo */
body[class*="dark"] .ui-datepicker .ui-datepicker-prev,
body[class*="dark"] .ui-datepicker .ui-datepicker-next,
html[class*="dark"] .ui-datepicker .ui-datepicker-prev,
html[class*="dark"] .ui-datepicker .ui-datepicker-next,
.theme-dark .ui-datepicker .ui-datepicker-prev,
.theme-dark .ui-datepicker .ui-datepicker-next,
.theme-dark .ui-datepicker .ui-datepicker-prev,
.theme-dark .ui-datepicker .ui-datepicker-next,
.theme-dark .ui-datepicker .ui-datepicker-prev,
.theme-dark .ui-datepicker .ui-datepicker-next,
.theme-dark .ui-datepicker .ui-datepicker-prev,
.theme-dark .ui-datepicker .ui-datepicker-next {
    color: #cbd5e1 !important;
    background: transparent !important;
    border-radius: 10px !important;
}

body[class*="dark"] .ui-datepicker .ui-datepicker-prev:hover,
body[class*="dark"] .ui-datepicker .ui-datepicker-next:hover,
html[class*="dark"] .ui-datepicker .ui-datepicker-prev:hover,
html[class*="dark"] .ui-datepicker .ui-datepicker-next:hover,
.theme-dark .ui-datepicker .ui-datepicker-prev:hover,
.theme-dark .ui-datepicker .ui-datepicker-next:hover,
.theme-dark .ui-datepicker .ui-datepicker-prev:hover,
.theme-dark .ui-datepicker .ui-datepicker-next:hover,
.theme-dark .ui-datepicker .ui-datepicker-prev:hover,
.theme-dark .ui-datepicker .ui-datepicker-next:hover,
.theme-dark .ui-datepicker .ui-datepicker-prev:hover,
.theme-dark .ui-datepicker .ui-datepicker-next:hover {
    background: rgba(59, 130, 246, 0.16) !important;
    color: #ffffff !important;
}

/* Dias da semana */
body[class*="dark"] .ui-datepicker table th,
html[class*="dark"] .ui-datepicker table th,
.theme-dark .ui-datepicker table th,
.theme-dark .ui-datepicker table th,
.theme-dark .ui-datepicker table th,
.theme-dark .ui-datepicker table th {
    color: #e5e7eb !important;
    font-weight: 900 !important;
}

/* Células dos dias */
body[class*="dark"] .ui-datepicker table td,
html[class*="dark"] .ui-datepicker table td,
.theme-dark .ui-datepicker table td,
.theme-dark .ui-datepicker table td,
.theme-dark .ui-datepicker table td,
.theme-dark .ui-datepicker table td {
    background: transparent !important;
    border: 0 !important;
}

/* Links dos dias */
body[class*="dark"] .ui-datepicker table td > a,
body[class*="dark"] .ui-datepicker table td > span,
html[class*="dark"] .ui-datepicker table td > a,
html[class*="dark"] .ui-datepicker table td > span,
.theme-dark .ui-datepicker table td > a,
.theme-dark .ui-datepicker table td > span,
.theme-dark .ui-datepicker table td > a,
.theme-dark .ui-datepicker table td > span,
.theme-dark .ui-datepicker table td > a,
.theme-dark .ui-datepicker table td > span,
.theme-dark .ui-datepicker table td > a,
.theme-dark .ui-datepicker table td > span {
    background: transparent !important;
    border: 0 !important;
    color: #cbd5e1 !important;
    border-radius: 10px !important;
    text-align: center !important;
}

/* Dias de outro mês / desabilitados */
body[class*="dark"] .ui-datepicker table td.ui-datepicker-other-month > a,
body[class*="dark"] .ui-datepicker table td.ui-datepicker-other-month > span,
body[class*="dark"] .ui-datepicker table td.ui-state-disabled > a,
body[class*="dark"] .ui-datepicker table td.ui-state-disabled > span,
html[class*="dark"] .ui-datepicker table td.ui-datepicker-other-month > a,
html[class*="dark"] .ui-datepicker table td.ui-datepicker-other-month > span,
html[class*="dark"] .ui-datepicker table td.ui-state-disabled > a,
html[class*="dark"] .ui-datepicker table td.ui-state-disabled > span,
.theme-dark .ui-datepicker table td.ui-datepicker-other-month > a,
.theme-dark .ui-datepicker table td.ui-datepicker-other-month > span,
.theme-dark .ui-datepicker table td.ui-state-disabled > a,
.theme-dark .ui-datepicker table td.ui-state-disabled > span,
.theme-dark .ui-datepicker table td.ui-datepicker-other-month > a,
.theme-dark .ui-datepicker table td.ui-datepicker-other-month > span,
.theme-dark .ui-datepicker table td.ui-state-disabled > a,
.theme-dark .ui-datepicker table td.ui-state-disabled > span {
    color: #64748b !important;
    opacity: 0.65 !important;
}

/* Hover nos dias */
body[class*="dark"] .ui-datepicker table td > a:hover,
html[class*="dark"] .ui-datepicker table td > a:hover,
.theme-dark .ui-datepicker table td > a:hover,
.theme-dark .ui-datepicker table td > a:hover,
.theme-dark .ui-datepicker table td > a:hover,
.theme-dark .ui-datepicker table td > a:hover {
    background: rgba(59, 130, 246, 0.18) !important;
    color: #ffffff !important;
}

/* Dia selecionado */
body[class*="dark"] .ui-datepicker table td.ui-datepicker-current-day > a,
body[class*="dark"] .ui-datepicker table td .ui-state-active,
html[class*="dark"] .ui-datepicker table td.ui-datepicker-current-day > a,
html[class*="dark"] .ui-datepicker table td .ui-state-active,
.theme-dark .ui-datepicker table td.ui-datepicker-current-day > a,
.theme-dark .ui-datepicker table td .ui-state-active,
.theme-dark .ui-datepicker table td.ui-datepicker-current-day > a,
.theme-dark .ui-datepicker table td .ui-state-active,
.theme-dark .ui-datepicker table td.ui-datepicker-current-day > a,
.theme-dark .ui-datepicker table td .ui-state-active,
.theme-dark .ui-datepicker table td.ui-datepicker-current-day > a,
.theme-dark .ui-datepicker table td .ui-state-active {
    background: #4f63ff !important;
    color: #ffffff !important;
    font-weight: 900 !important;
}

/* Hoje */
body[class*="dark"] .ui-datepicker table td.ui-datepicker-today > a,
html[class*="dark"] .ui-datepicker table td.ui-datepicker-today > a,
.theme-dark .ui-datepicker table td.ui-datepicker-today > a,
.theme-dark .ui-datepicker table td.ui-datepicker-today > a,
.theme-dark .ui-datepicker table td.ui-datepicker-today > a,
.theme-dark .ui-datepicker table td.ui-datepicker-today > a {
    border: 1px solid rgba(79, 99, 255, 0.65) !important;
    color: #ffffff !important;
}

/* Rodapé / botões Today e Clear, caso existam */
body[class*="dark"] .ui-datepicker .ui-datepicker-buttonbar,
html[class*="dark"] .ui-datepicker .ui-datepicker-buttonbar,
.theme-dark .ui-datepicker .ui-datepicker-buttonbar,
.theme-dark .ui-datepicker .ui-datepicker-buttonbar,
.theme-dark .ui-datepicker .ui-datepicker-buttonbar,
.theme-dark .ui-datepicker .ui-datepicker-buttonbar {
    background: #111827 !important;
    border-top: 1px solid rgba(148, 163, 184, 0.18) !important;
}

body[class*="dark"] .ui-datepicker .ui-datepicker-buttonbar button,
html[class*="dark"] .ui-datepicker .ui-datepicker-buttonbar button,
.theme-dark .ui-datepicker .ui-datepicker-buttonbar button,
.theme-dark .ui-datepicker .ui-datepicker-buttonbar button,
.theme-dark .ui-datepicker .ui-datepicker-buttonbar button,
.theme-dark .ui-datepicker .ui-datepicker-buttonbar button {
    background: rgba(79, 99, 255, 0.16) !important;
    border: 1px solid rgba(79, 99, 255, 0.28) !important;
    color: #ffffff !important;
    border-radius: 10px !important;
}

/* ========================================================= */
/* DARK MODE - FORM ACTION BUTTONS REFINEMENT                */
/* ========================================================= */

body[class*="dark"] .form-header-actions .btn-primary,
html[class*="dark"] .form-header-actions .btn-primary,
.theme-dark .form-header-actions .btn-primary,
.theme-dark .form-header-actions .btn-primary {
    background: #3347c6 !important;
    border-color: #4055d6 !important;
    color: #ffffff !important;
    box-shadow: 0 10px 24px rgba(51, 71, 198, 0.28) !important;
}

body[class*="dark"] .form-header-actions .btn-primary:hover,
html[class*="dark"] .form-header-actions .btn-primary:hover,
.theme-dark .form-header-actions .btn-primary:hover,
.theme-dark .form-header-actions .btn-primary:hover {
    background: #4358e8 !important;
    border-color: #5b6fff !important;
}

/* Botões secundários: Voltar, Duplicar, Operações */
body[class*="dark"] .form-header-actions .btn-secondary,
html[class*="dark"] .form-header-actions .btn-secondary,
.theme-dark .form-header-actions .btn-secondary,
.theme-dark .form-header-actions .btn-secondary,
body[class*="dark"] .form-header-actions .btn-soft-primary,
html[class*="dark"] .form-header-actions .btn-soft-primary,
.theme-dark .form-header-actions .btn-soft-primary,
.theme-dark .form-header-actions .btn-soft-primary {
    background: rgba(15, 23, 42, 0.92) !important;
    border: 1px solid rgba(148, 163, 184, 0.24) !important;
    color: #e5e7eb !important;
    box-shadow: none !important;
}

body[class*="dark"] .form-header-actions .btn-secondary:hover,
html[class*="dark"] .form-header-actions .btn-secondary:hover,
.theme-dark .form-header-actions .btn-secondary:hover,
.theme-dark .form-header-actions .btn-secondary:hover,
body[class*="dark"] .form-header-actions .btn-soft-primary:hover,
html[class*="dark"] .form-header-actions .btn-soft-primary:hover,
.theme-dark .form-header-actions .btn-soft-primary:hover,
.theme-dark .form-header-actions .btn-soft-primary:hover {
    background: rgba(30, 41, 59, 0.98) !important;
    border-color: rgba(148, 163, 184, 0.38) !important;
    color: #ffffff !important;
}

/* Botão de excluir no dark */
body[class*="dark"] .form-header-actions .btn-danger,
html[class*="dark"] .form-header-actions .btn-danger,
.theme-dark .form-header-actions .btn-danger,
.theme-dark .form-header-actions .btn-danger {
    background: rgba(127, 29, 29, 0.72) !important;
    border: 1px solid rgba(239, 68, 68, 0.35) !important;
    color: #fecaca !important;
    box-shadow: none !important;
}

body[class*="dark"] .form-header-actions .btn-danger:hover,
html[class*="dark"] .form-header-actions .btn-danger:hover,
.theme-dark .form-header-actions .btn-danger:hover,
.theme-dark .form-header-actions .btn-danger:hover {
    background: rgba(185, 28, 28, 0.88) !important;
    border-color: rgba(248, 113, 113, 0.55) !important;
    color: #ffffff !important;
}

/* Paginação do form no dark */
body[class*="dark"] .form-navigation-bar,
html[class*="dark"] .form-navigation-bar,
.theme-dark .form-navigation-bar,
.theme-dark .form-navigation-bar {
    background: rgba(15, 23, 42, 0.92) !important;
    border: 1px solid rgba(148, 163, 184, 0.22) !important;
    color: #e5e7eb !important;
    box-shadow: none !important;
}

body[class*="dark"] .form-navigation-bar .ui-button,
html[class*="dark"] .form-navigation-bar .ui-button,
.theme-dark .form-navigation-bar .ui-button,
.theme-dark .form-navigation-bar .ui-button {
    background: transparent !important;
    border: 0 !important;
    color: #cbd5e1 !important;
}

body[class*="dark"] .form-navigation-bar .ui-button:hover,
html[class*="dark"] .form-navigation-bar .ui-button:hover,
.theme-dark .form-navigation-bar .ui-button:hover,
.theme-dark .form-navigation-bar .ui-button:hover {
    background: rgba(59, 130, 246, 0.14) !important;
    color: #ffffff !important;
}

