/* =========================================================
   VALORA CRM | DARK PRO V8
   Tema escuro único e limpo: base slate/ChatGPT, sem azul pesado,
   sem cards brancos perdidos e com contraste profissional.
   Carregar sempre por último, depois dos CSS de cada página.
   ========================================================= */

html[data-theme="dark"] {
  color-scheme: dark;

  /* Base */
  --dark-bg: #212121;
  --dark-bg-soft: #262626;
  --dark-shell: #1b1b1b;
  --dark-panel: #2f2f2f;
  --dark-panel-2: #303030;
  --dark-panel-hover: #383838;
  --dark-input: #303030;
  --dark-input-disabled: #282828;
  --dark-table-head: #262626;

  /* Texto */
  --dark-text: #e5e7eb;
  --dark-text-soft: #cbd5e1;
  --dark-muted: #94a3b8;
  --dark-muted-soft: #64748b;

  /* Bordas e sombras */
  --dark-border: rgba(255, 255, 255, 0.10);
  --dark-border-strong: rgba(255, 255, 255, 0.16);
  --dark-focus: rgba(75, 195, 199, 0.26);
  --dark-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --dark-shadow-md: 0 18px 42px rgba(0, 0, 0, 0.34);
  --dark-shadow-lg: 0 30px 90px rgba(0, 0, 0, 0.58);

  /* Mantém a marca Valora viva, mas discreta */
  --brand: #4bc3c7;
  --brand-hover: #6ed9dd;
  --brand-dark: #6ed9dd;
  --brand-soft: rgba(75, 195, 199, 0.14);
  --blue: #65acde;
  --blue-soft: rgba(101, 172, 222, 0.14);

  /* Sobrescreve variáveis antigas do projeto */
  --navy: var(--dark-shell);
  --navy-dark: #171717;
  --navy-soft: #292929;
  --bg: var(--dark-bg);
  --bg-soft: var(--dark-bg-soft);
  --panel: var(--dark-panel);
  --panel-hover: var(--dark-panel-hover);
  --card-bg: var(--dark-panel);
  --input-bg: var(--dark-input);
  --input-bg-disabled: var(--dark-input-disabled);
  --border: var(--dark-border);
  --border-hover: var(--dark-border-strong);
  --text: var(--dark-text);
  --text-soft: var(--dark-text-soft);
  --muted: var(--dark-muted);
  --muted-soft: var(--dark-muted-soft);

  --danger-soft: rgba(239, 68, 68, 0.14);
  --warning-soft: rgba(245, 158, 11, 0.14);
  --success-soft: rgba(34, 197, 94, 0.14);

  --shadow-sm: var(--dark-shadow-sm);
  --shadow-md: var(--dark-shadow-md);
  --shadow-lg: var(--dark-shadow-lg);

  /* Financeiro usa variáveis próprias */
  --fin-bg: var(--dark-bg);
  --fin-card: var(--dark-panel);
  --fin-text: var(--dark-text);
  --fin-muted: var(--dark-muted);
  --fin-border: var(--dark-border);
  --fin-soft: var(--dark-bg-soft);
  --fin-blue: #8ccbff;
  --fin-shadow: var(--dark-shadow-md);
}

html[data-theme="dark"],
html[data-theme="dark"] body {
  background: var(--dark-bg) !important;
  color: var(--dark-text) !important;
}

html[data-theme="dark"] body {
  background: var(--dark-bg) !important;
  background-image: none !important;
}

html[data-theme="dark"] .layout,
html[data-theme="dark"] .main,
html[data-theme="dark"] main,
html[data-theme="dark"] .page,
html[data-theme="dark"] .content,
html[data-theme="dark"] .app-page,
html[data-theme="dark"] .financeiro-page,
html[data-theme="dark"] .dashboard-page,
html[data-theme="dark"] .config-page,
html[data-theme="dark"] .clientes-page,
html[data-theme="dark"] .fornecedores-page,
html[data-theme="dark"] .produtos-page,
html[data-theme="dark"] .patrimonio-page,
html[data-theme="dark"] .cotacoes-page,
html[data-theme="dark"] .propostas-page,
html[data-theme="dark"] .usuarios-page,
html[data-theme="dark"] .formularios-page {
  background: transparent !important;
  color: var(--dark-text) !important;
}

/* =========================================================
   Texto
   Evita atribuir cor global !important a span/strong/b: esses
   elementos exibem saldos, badges e estados semanticos.
   O texto comum herda a cor do body; subtitulos tem seletores proprios.
   ========================================================= */

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
html[data-theme="dark"] .page-title,
html[data-theme="dark"] .topbar-title h1,
html[data-theme="dark"] .hero-title,
html[data-theme="dark"] .modal-header h2,
html[data-theme="dark"] .modal-header h3,
html[data-theme="dark"] .cliente-modal-topbar h3,
html[data-theme="dark"] .fornecedor-modal-topbar h3,
html[data-theme="dark"] .produto-modal-topbar h3,
html[data-theme="dark"] .patrimonio-modal-topbar h3,
html[data-theme="dark"] .cotacao-modal-topbar h3,
html[data-theme="dark"] .section-card h4,
html[data-theme="dark"] .custom-section-head h4,
html[data-theme="dark"] .custom-fields-head h4,
html[data-theme="dark"] .valora-section-head h4,
html[data-theme="dark"] .proposal-card-head h4,
html[data-theme="dark"] .proposal-section-head h4 {
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .subtle,
html[data-theme="dark"] .muted,
html[data-theme="dark"] .topbar-subtitle,
html[data-theme="dark"] .page-subtitle,
html[data-theme="dark"] .modal-header p,
html[data-theme="dark"] .cliente-modal-topbar p,
html[data-theme="dark"] .fornecedor-modal-topbar p,
html[data-theme="dark"] .produto-modal-topbar p,
html[data-theme="dark"] .patrimonio-modal-topbar p,
html[data-theme="dark"] .cotacao-modal-topbar p,
html[data-theme="dark"] .custom-fields-head p,
html[data-theme="dark"] .custom-section-head p,
html[data-theme="dark"] .valora-section-head p,
html[data-theme="dark"] .field-hint,
html[data-theme="dark"] .field-help,
html[data-theme="dark"] .form-group label,
html[data-theme="dark"] .custom-field-item label,
html[data-theme="dark"] .financeiro-field label {
  color: var(--dark-muted) !important;
}

html[data-theme="dark"] a:not(.btn-primary):not(.btn-secondary):not(.btn-icon) {
  color: inherit;
}

html[data-theme="dark"] .eyebrow,
html[data-theme="dark"] .section-kicker,
html[data-theme="dark"] .modal-kicker,
html[data-theme="dark"] .proposal-kicker,
html[data-theme="dark"] .brand-color,
html[data-theme="dark"] .text-brand {
  color: #8ccbff !important;
}

/* =========================================================
   Cards, painéis e áreas que antes ficavam brancas
   ========================================================= */

html[data-theme="dark"] .panel-card,
html[data-theme="dark"] .hero-card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .config-card,
html[data-theme="dark"] .section-card,
html[data-theme="dark"] .dashboard-panel,
html[data-theme="dark"] .dashboard-kpi-card,
html[data-theme="dark"] .dashboard-graph-card,
html[data-theme="dark"] .dashboard-summary-panel,
html[data-theme="dark"] .panel-card-table,
html[data-theme="dark"] .config-table-panel,
html[data-theme="dark"] .quick-card,
html[data-theme="dark"] .search-box,
html[data-theme="dark"] .table-container,
html[data-theme="dark"] .table-wrapper,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .empty-soft,
html[data-theme="dark"] .history-box,
html[data-theme="dark"] .history-empty,
html[data-theme="dark"] .history-item,
html[data-theme="dark"] .mini-item,
html[data-theme="dark"] .anexo-row,
html[data-theme="dark"] .anexo-item,
html[data-theme="dark"] .campo-card,
html[data-theme="dark"] .custom-fields-info,
html[data-theme="dark"] .intro-card-main,
html[data-theme="dark"] .cliente-resumo,
html[data-theme="dark"] .status-box,
html[data-theme="dark"] .helper-box,
html[data-theme="dark"] .record-meta,
html[data-theme="dark"] .proposta-preview,
html[data-theme="dark"] .anexo-upload-box,
html[data-theme="dark"] .acessos-status,
html[data-theme="dark"] .acesso-ativo-box,
html[data-theme="dark"] .acesso-item,
html[data-theme="dark"] .gerar-acesso-box,
html[data-theme="dark"] .contratos-status,
html[data-theme="dark"] .contrato-item,
html[data-theme="dark"] .anexos-status,
html[data-theme="dark"] .support-card,
html[data-theme="dark"] .support-info,
html[data-theme="dark"] .faq-item,
html[data-theme="dark"] .faq-answer,
html[data-theme="dark"] .user-badge,
html[data-theme="dark"] .valora-toast,
html[data-theme="dark"] .footer-version {
  background: var(--dark-panel) !important;
  color: var(--dark-text-soft) !important;
  border-color: var(--dark-border) !important;
  box-shadow: var(--dark-shadow-sm) !important;
}

html[data-theme="dark"] .panel-card:hover,
html[data-theme="dark"] .stat-card:hover,
html[data-theme="dark"] .quick-card:hover,
html[data-theme="dark"] .campo-card:hover,
html[data-theme="dark"] .mini-item:hover,
html[data-theme="dark"] .anexo-row:hover,
html[data-theme="dark"] .history-item:hover,
html[data-theme="dark"] .acesso-item:hover,
html[data-theme="dark"] .contrato-item:hover,
html[data-theme="dark"] .btn-secondary:hover,
html[data-theme="dark"] .btn-icon:hover {
  background: var(--dark-panel-hover) !important;
  border-color: var(--dark-border-strong) !important;
}

html[data-theme="dark"] .section-card > .form-row,
html[data-theme="dark"] .section-card > .stack,
html[data-theme="dark"] .section-card > .mini-list,
html[data-theme="dark"] .custom-fields-container,
html[data-theme="dark"] .custom-fields-grid,
html[data-theme="dark"] .valora-section-body,
html[data-theme="dark"] .proposal-card-body,
html[data-theme="dark"] .proposal-section-body {
  background: transparent !important;
}

html[data-theme="dark"] .cliente-section-head,
html[data-theme="dark"] .fornecedor-section-head,
html[data-theme="dark"] .produto-section-head,
html[data-theme="dark"] .patrimonio-section-head,
html[data-theme="dark"] .cotacao-section-head,
html[data-theme="dark"] .custom-fields-head,
html[data-theme="dark"] .custom-section-head,
html[data-theme="dark"] .valora-section-head,
html[data-theme="dark"] .proposal-card-head,
html[data-theme="dark"] .proposal-section-head,
html[data-theme="dark"] .section-card > h4 {
  background: transparent !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
}

/* =========================================================
   Inputs, selects e validação
   ========================================================= */

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .form-group input,
html[data-theme="dark"] .form-group select,
html[data-theme="dark"] .form-group textarea,
html[data-theme="dark"] .custom-field-item input,
html[data-theme="dark"] .custom-field-item select,
html[data-theme="dark"] .custom-field-item textarea,
html[data-theme="dark"] .input-group input,
html[data-theme="dark"] .input-group select,
html[data-theme="dark"] .input-group textarea,
html[data-theme="dark"] .financeiro-field input,
html[data-theme="dark"] .financeiro-field select,
html[data-theme="dark"] .financeiro-field textarea,
html[data-theme="dark"] .financeiro-form input,
html[data-theme="dark"] .financeiro-form select,
html[data-theme="dark"] .financeiro-form textarea,
html[data-theme="dark"] .mini-actions input,
html[data-theme="dark"] .mini-item input,
html[data-theme="dark"] .mini-item select,
html[data-theme="dark"] .mini-item textarea {
  background: var(--dark-input) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03) !important;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: var(--dark-muted-soft) !important;
}

html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
  border-color: rgba(75, 195, 199, 0.72) !important;
  box-shadow: 0 0 0 3px var(--dark-focus) !important;
  outline: none !important;
}

html[data-theme="dark"] input:disabled,
html[data-theme="dark"] select:disabled,
html[data-theme="dark"] textarea:disabled,
html[data-theme="dark"] input[readonly],
html[data-theme="dark"] textarea[readonly],
html[data-theme="dark"] .modal-readonly input,
html[data-theme="dark"] .modal-readonly select,
html[data-theme="dark"] .modal-readonly textarea,
html[data-theme="dark"] .modal-readonly .is-readonly-field,
html[data-theme="dark"] .is-readonly-field {
  background: var(--dark-input-disabled) !important;
  color: var(--dark-text-soft) !important;
  border-color: rgba(148, 163, 184, 0.14) !important;
  opacity: 1 !important;
  -webkit-text-fill-color: var(--dark-text-soft) !important;
}

html[data-theme="dark"] select option {
  background: var(--dark-input) !important;
  color: var(--dark-text) !important;
}

html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] input:-webkit-autofill:hover,
html[data-theme="dark"] input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--dark-text) !important;
  box-shadow: 0 0 0 1000px var(--dark-input) inset !important;
  caret-color: var(--dark-text) !important;
}

html[data-theme="dark"] input[type="checkbox"],
html[data-theme="dark"] input[type="radio"] {
  accent-color: var(--brand) !important;
}

html[data-theme="dark"] .field-invalid,
html[data-theme="dark"] .is-invalid,
html[data-theme="dark"] input.is-invalid,
html[data-theme="dark"] select.is-invalid,
html[data-theme="dark"] textarea.is-invalid {
  border-color: rgba(248, 113, 113, 0.75) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14) !important;
}

/* =========================================================
   Tabelas
   ========================================================= */

html[data-theme="dark"] table,
html[data-theme="dark"] .table,
html[data-theme="dark"] .valora-table,
html[data-theme="dark"] .config-table,
html[data-theme="dark"] .financeiro-table {
  background: var(--dark-panel) !important;
  color: var(--dark-text-soft) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] thead,
html[data-theme="dark"] table thead,
html[data-theme="dark"] table th,
html[data-theme="dark"] .valora-table th,
html[data-theme="dark"] .config-table th,
html[data-theme="dark"] .financeiro-table th {
  background: var(--dark-table-head) !important;
  color: var(--dark-muted) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] table td,
html[data-theme="dark"] .valora-table td,
html[data-theme="dark"] .config-table td,
html[data-theme="dark"] .financeiro-table td {
  background: var(--dark-panel) !important;
  color: var(--dark-text-soft) !important;
  border-color: rgba(148, 163, 184, 0.12) !important;
}

html[data-theme="dark"] table tbody tr:hover td,
html[data-theme="dark"] .valora-table tbody tr:hover td,
html[data-theme="dark"] .config-table tbody tr:hover td,
html[data-theme="dark"] .financeiro-table tbody tr:hover td {
  background: var(--dark-panel-hover) !important;
}

html[data-theme="dark"] .table-name-link strong {
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .table-name-link:hover strong,
html[data-theme="dark"] .table-name-link:focus-visible strong {
  color: var(--brand) !important;
}

/* =========================================================
   Botões, badges e status
   ========================================================= */

html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .btn-icon,
html[data-theme="dark"] .btn-close,
html[data-theme="dark"] .modal-close,
html[data-theme="dark"] .financeiro-tabs a,
html[data-theme="dark"] .financeiro-tabs button,
html[data-theme="dark"] .financeiro-filter-chip,
html[data-theme="dark"] .financeiro-select-mini,
html[data-theme="dark"] .filter-chip,
html[data-theme="dark"] .action-chip {
  background: var(--dark-input) !important;
  color: var(--dark-text-soft) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] button.btn-primary,
html[data-theme="dark"] a.btn-primary {
  background: linear-gradient(135deg, #4bc3c7 0%, #65acde 100%) !important;
  color: #06111f !important;
  border-color: transparent !important;
  box-shadow: 0 14px 28px rgba(75, 195, 199, 0.18) !important;
}

html[data-theme="dark"] .btn-primary:hover,
html[data-theme="dark"] button.btn-primary:hover,
html[data-theme="dark"] a.btn-primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

html[data-theme="dark"] .badge-status,
html[data-theme="dark"] .status-badge,
html[data-theme="dark"] .badge-tag,
html[data-theme="dark"] .badge-codigo,
html[data-theme="dark"] .badge-tipo,
html[data-theme="dark"] .cliente-status-pill,
html[data-theme="dark"] .status-indicator {
  background: rgba(148, 163, 184, 0.10) !important;
  color: var(--dark-text-soft) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .status-ativo,
html[data-theme="dark"] .badge-tag.brand,
html[data-theme="dark"] .badge-tipo,
html[data-theme="dark"] .status-success,
html[data-theme="dark"] .status-pago,
html[data-theme="dark"] .financeiro-status-pago {
  background: rgba(34, 197, 94, 0.14) !important;
  color: #86efac !important;
  border-color: rgba(34, 197, 94, 0.28) !important;
}

html[data-theme="dark"] .status-pendente,
html[data-theme="dark"] .financeiro-status-pendente,
html[data-theme="dark"] .status-warning {
  background: rgba(245, 158, 11, 0.14) !important;
  color: #fcd34d !important;
  border-color: rgba(245, 158, 11, 0.28) !important;
}

html[data-theme="dark"] .status-cancelado,
html[data-theme="dark"] .status-vencido,
html[data-theme="dark"] .financeiro-status-vencido,
html[data-theme="dark"] .status-danger {
  background: rgba(239, 68, 68, 0.14) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.28) !important;
}

html[data-theme="dark"] .badge-codigo {
  background: rgba(101, 172, 222, 0.14) !important;
  color: #bfdbfe !important;
  border-color: rgba(101, 172, 222, 0.28) !important;
}

/* =========================================================
   Modais gerais e ficha principal
   ========================================================= */

html[data-theme="dark"] .modal-overlay {
  background: rgba(0, 0, 0, 0.68) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .modal-content-large,
html[data-theme="dark"] .proposal-modal-content,
html[data-theme="dark"] .confirm-content,
html[data-theme="dark"] .cotacao-modal,
html[data-theme="dark"] .cliente-modal-content,
html[data-theme="dark"] .fornecedor-modal-content,
html[data-theme="dark"] .produto-modal-content,
html[data-theme="dark"] .patrimonio-modal-content,
html[data-theme="dark"] .cotacao-modal-content {
  background: var(--dark-bg) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
  box-shadow: var(--dark-shadow-lg) !important;
}

html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .proposal-modal-header,
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .proposal-modal-footer,
html[data-theme="dark"] .modal-client-footer,
html[data-theme="dark"] .produto-modal-footer,
html[data-theme="dark"] .patrimonio-modal-footer,
html[data-theme="dark"] .cotacao-modal-footer {
  background: var(--dark-panel) !important;
  border-color: var(--dark-border) !important;
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .modal-body,
html[data-theme="dark"] .proposal-modal-body,
html[data-theme="dark"] .cliente-modal-shell,
html[data-theme="dark"] .fornecedor-modal-shell,
html[data-theme="dark"] .produto-modal-shell,
html[data-theme="dark"] .patrimonio-modal-shell,
html[data-theme="dark"] .cotacao-modal-shell,
html[data-theme="dark"] .cliente-modal-main,
html[data-theme="dark"] .fornecedor-modal-main,
html[data-theme="dark"] .produto-modal-main,
html[data-theme="dark"] .patrimonio-modal-main,
html[data-theme="dark"] .cotacao-modal-main,
html[data-theme="dark"] .cliente-modal-scroll,
html[data-theme="dark"] .fornecedor-modal-scroll,
html[data-theme="dark"] .produto-modal-scroll,
html[data-theme="dark"] .patrimonio-modal-scroll,
html[data-theme="dark"] .cotacao-modal-scroll {
  background: var(--dark-bg) !important;
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .cliente-modal-sidebar,
html[data-theme="dark"] .fornecedor-modal-sidebar,
html[data-theme="dark"] .produto-modal-sidebar,
html[data-theme="dark"] .patrimonio-modal-sidebar,
html[data-theme="dark"] .cotacao-modal-sidebar,
html[data-theme="dark"] #modal-produto-backdrop .cliente-modal-sidebar,
html[data-theme="dark"] #modal-patrimonio .cliente-modal-sidebar,
html[data-theme="dark"] #modal-cotacao-backdrop .cliente-modal-sidebar {
  background: var(--dark-shell) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .cliente-modal-topbar,
html[data-theme="dark"] .fornecedor-modal-topbar,
html[data-theme="dark"] .produto-modal-topbar,
html[data-theme="dark"] .patrimonio-modal-topbar,
html[data-theme="dark"] .cotacao-modal-topbar {
  background: var(--dark-panel) !important;
  border-color: var(--dark-border) !important;
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .cliente-main-card,
html[data-theme="dark"] .fornecedor-main-card,
html[data-theme="dark"] .produto-main-card,
html[data-theme="dark"] .patrimonio-main-card,
html[data-theme="dark"] .cotacao-section-card,
html[data-theme="dark"] .produto-ficha-card,
html[data-theme="dark"] .custom-fields-card,
html[data-theme="dark"] .custom-section-card,
html[data-theme="dark"] .custom-section-card-bitrix,
html[data-theme="dark"] .fields-builder-card,
html[data-theme="dark"] .valora-modal-section,
html[data-theme="dark"] .proposal-card,
html[data-theme="dark"] .proposal-section,
html[data-theme="dark"] .proposal-items-card,
html[data-theme="dark"] #modal-cliente-backdrop .section-card,
html[data-theme="dark"] #modal-fornecedor-backdrop .section-card,
html[data-theme="dark"] #modal-produto-backdrop .section-card,
html[data-theme="dark"] #modal-patrimonio .section-card,
html[data-theme="dark"] #modal-cotacao-backdrop .section-card {
  background: var(--dark-panel) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
  box-shadow: var(--dark-shadow-sm) !important;
}

html[data-theme="dark"] .ficha-principal-code-card,
html[data-theme="dark"] .cliente-ficha-code-card,
html[data-theme="dark"] .fornecedor-ficha-code-card,
html[data-theme="dark"] .produto-ficha-code-card,
html[data-theme="dark"] .patrimonio-ficha-code-card,
html[data-theme="dark"] .cotacao-ficha-code-card,
html[data-theme="dark"] #modal-cliente-backdrop .ficha-principal-code-card,
html[data-theme="dark"] #modal-fornecedor-backdrop .ficha-principal-code-card,
html[data-theme="dark"] #modal-produto-backdrop .ficha-principal-code-card,
html[data-theme="dark"] #modal-patrimonio .ficha-principal-code-card,
html[data-theme="dark"] #modal-cotacao-backdrop .ficha-principal-code-card {
  background: linear-gradient(180deg, rgba(101, 172, 222, 0.08), rgba(75, 195, 199, 0.04)), var(--dark-panel) !important;
  color: var(--dark-text) !important;
  border-color: rgba(101, 172, 222, 0.24) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .ficha-principal-code-card .ficha-principal-system-fields input,
html[data-theme="dark"] .cliente-ficha-code-card .ficha-principal-system-fields input,
html[data-theme="dark"] .fornecedor-ficha-code-card .ficha-principal-system-fields input,
html[data-theme="dark"] .produto-ficha-code-card .ficha-principal-system-fields input,
html[data-theme="dark"] .patrimonio-ficha-code-card .ficha-principal-system-fields input,
html[data-theme="dark"] .cotacao-ficha-code-card .ficha-principal-system-fields input {
  background: var(--dark-input-disabled) !important;
  color: var(--dark-text-soft) !important;
  border-color: var(--dark-border) !important;
  -webkit-text-fill-color: var(--dark-text-soft) !important;
}

/* Abas laterais */
html[data-theme="dark"] .cliente-sidebar-avatar,
html[data-theme="dark"] .fornecedor-sidebar-avatar,
html[data-theme="dark"] .produto-sidebar-avatar,
html[data-theme="dark"] .patrimonio-sidebar-avatar,
html[data-theme="dark"] .cotacao-sidebar-avatar {
  background: rgba(75, 195, 199, 0.12) !important;
  color: var(--brand) !important;
  border-color: rgba(75, 195, 199, 0.26) !important;
}

html[data-theme="dark"] .cliente-sidebar-user strong,
html[data-theme="dark"] .fornecedor-sidebar-user strong,
html[data-theme="dark"] .produto-sidebar-user strong,
html[data-theme="dark"] .patrimonio-sidebar-user strong,
html[data-theme="dark"] .cotacao-sidebar-user strong {
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .cliente-sidebar-user span,
html[data-theme="dark"] .fornecedor-sidebar-user span,
html[data-theme="dark"] .produto-sidebar-user span,
html[data-theme="dark"] .patrimonio-sidebar-user span,
html[data-theme="dark"] .cotacao-sidebar-user span {
  color: var(--dark-muted) !important;
}

html[data-theme="dark"] .cliente-tab-btn,
html[data-theme="dark"] .fornecedor-tab-btn,
html[data-theme="dark"] .produto-tab-btn,
html[data-theme="dark"] .patrimonio-tab-btn,
html[data-theme="dark"] .cotacao-tab-btn,
html[data-theme="dark"] .form-tab-btn,
html[data-theme="dark"] .modal-tab-btn,
html[data-theme="dark"] .financeiro-ficha-tab {
  background: transparent !important;
  color: var(--dark-text-soft) !important;
  border-color: transparent !important;
}

html[data-theme="dark"] .cliente-tab-btn:hover,
html[data-theme="dark"] .fornecedor-tab-btn:hover,
html[data-theme="dark"] .produto-tab-btn:hover,
html[data-theme="dark"] .patrimonio-tab-btn:hover,
html[data-theme="dark"] .cotacao-tab-btn:hover,
html[data-theme="dark"] .form-tab-btn:hover,
html[data-theme="dark"] .modal-tab-btn:hover,
html[data-theme="dark"] .financeiro-ficha-tab:hover {
  background: rgba(148, 163, 184, 0.10) !important;
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .cliente-tab-btn.active,
html[data-theme="dark"] .fornecedor-tab-btn.active,
html[data-theme="dark"] .produto-tab-btn.active,
html[data-theme="dark"] .patrimonio-tab-btn.active,
html[data-theme="dark"] .cotacao-tab-btn.active,
html[data-theme="dark"] .form-tab-btn.active,
html[data-theme="dark"] .modal-tab-btn.active,
html[data-theme="dark"] .financeiro-ficha-tab.active {
  background: rgba(75, 195, 199, 0.14) !important;
  color: var(--brand) !important;
  border-color: rgba(75, 195, 199, 0.28) !important;
}

html[data-theme="dark"] .cliente-tab-icon,
html[data-theme="dark"] .fornecedor-tab-icon,
html[data-theme="dark"] .produto-tab-icon,
html[data-theme="dark"] .patrimonio-tab-icon,
html[data-theme="dark"] .cotacao-tab-icon,
html[data-theme="dark"] .ficha-section-tab-icon,
html[data-theme="dark"] .cliente-sidebar-nav .cliente-tab-btn > i,
html[data-theme="dark"] .fornecedor-sidebar-nav .fornecedor-tab-btn > i,
html[data-theme="dark"] .produto-sidebar-nav .produto-tab-btn > i,
html[data-theme="dark"] .patrimonio-sidebar-nav .patrimonio-tab-btn > i,
html[data-theme="dark"] .cotacao-sidebar-nav .cotacao-tab-btn > i {
  background: rgba(75, 195, 199, 0.12) !important;
  color: var(--brand) !important;
}

html[data-theme="dark"] .cliente-tab-btn.active .cliente-tab-icon,
html[data-theme="dark"] .fornecedor-tab-btn.active .fornecedor-tab-icon,
html[data-theme="dark"] .produto-tab-btn.active .produto-tab-icon,
html[data-theme="dark"] .patrimonio-tab-btn.active .patrimonio-tab-icon,
html[data-theme="dark"] .cotacao-tab-btn.active .cotacao-tab-icon,
html[data-theme="dark"] .cliente-tab-btn.active .ficha-section-tab-icon,
html[data-theme="dark"] .fornecedor-tab-btn.active .ficha-section-tab-icon,
html[data-theme="dark"] .produto-tab-btn.active .ficha-section-tab-icon,
html[data-theme="dark"] .patrimonio-tab-btn.active .ficha-section-tab-icon,
html[data-theme="dark"] .cotacao-tab-btn.active .ficha-section-tab-icon {
  background: linear-gradient(135deg, #4bc3c7, #65acde) !important;
  color: #06111f !important;
}

html[data-theme="dark"] .cliente-sidebar-bottom,
html[data-theme="dark"] .fornecedor-sidebar-bottom,
html[data-theme="dark"] .produto-sidebar-bottom,
html[data-theme="dark"] .patrimonio-sidebar-bottom,
html[data-theme="dark"] .cotacao-sidebar-bottom {
  background: linear-gradient(180deg, rgba(11, 18, 32, 0), var(--dark-shell) 24%) !important;
}

html[data-theme="dark"] .cliente-ficha-toggle,
html[data-theme="dark"] .fornecedor-ficha-toggle,
html[data-theme="dark"] .produto-ficha-toggle,
html[data-theme="dark"] .patrimonio-ficha-toggle,
html[data-theme="dark"] .cotacao-ficha-toggle,
html[data-theme="dark"] .ficha-principal-toggle-bar,
html[data-theme="dark"] .cliente-ficha-toggle-bar,
html[data-theme="dark"] .produto-ficha-toggle-bar,
html[data-theme="dark"] .check-card,
html[data-theme="dark"] .custom-checkbox {
  background: var(--dark-panel) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
}

/* =========================================================
   Dropdowns, multiselect e menus internos
   ========================================================= */

html[data-theme="dark"] .custom-multiselect-panel,
html[data-theme="dark"] .custom-multiselect-menu,
html[data-theme="dark"] .custom-multiselect-option,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .menu-dropdown {
  background: var(--dark-panel) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
  box-shadow: var(--dark-shadow-md) !important;
}

html[data-theme="dark"] .custom-multiselect-option:hover,
html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .menu-dropdown a:hover {
  background: var(--dark-panel-hover) !important;
  color: var(--brand) !important;
}

/* =========================================================
   Financeiro
   ========================================================= */

html[data-theme="dark"] .financeiro-card,
html[data-theme="dark"] .financeiro-panel,
html[data-theme="dark"] .financeiro-saas-metric,
html[data-theme="dark"] .financeiro-saas-card,
html[data-theme="dark"] .financeiro-toolbar--saas,
html[data-theme="dark"] .financeiro-table-wrap,
html[data-theme="dark"] .financeiro-section-card,
html[data-theme="dark"] .financeiro-empty,
html[data-theme="dark"] .financeiro-add-row,
html[data-theme="dark"] .financeiro-chart-wrap,
html[data-theme="dark"] .financeiro-summary-card,
html[data-theme="dark"] .financeiro-dashboard-card,
html[data-theme="dark"] .financeiro-kpi-card {
  background: var(--dark-panel) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
  box-shadow: var(--dark-shadow-sm) !important;
}

html[data-theme="dark"] .financeiro-ficha-sidebar {
  background: var(--dark-shell) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .financeiro-ficha-main,
html[data-theme="dark"] .financeiro-ficha-scroll {
  background: var(--dark-bg) !important;
}

html[data-theme="dark"] .financeiro-tabs a.active,
html[data-theme="dark"] .financeiro-tabs button.active,
html[data-theme="dark"] .financeiro-filter-chip.active {
  background: rgba(75, 195, 199, 0.14) !important;
  color: var(--brand) !important;
  border-color: rgba(75, 195, 199, 0.28) !important;
}

/* =========================================================
   Login, início, ajuda e páginas avulsas
   ========================================================= */

html[data-theme="dark"] .login-page,
html[data-theme="dark"] .login-shell,
html[data-theme="dark"] .inicio-page,
html[data-theme="dark"] .home-page,
html[data-theme="dark"] .help-page {
  background:
    radial-gradient(circle at 10% 0%, rgba(75, 195, 199, 0.10), transparent 28rem),
    radial-gradient(circle at 90% 10%, rgba(101, 172, 222, 0.08), transparent 26rem),
    var(--dark-bg) !important;
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .login-card,
html[data-theme="dark"] .register-form-container,
html[data-theme="dark"] .register-visual,
html[data-theme="dark"] .selected-plan,
html[data-theme="dark"] .token-alert,
html[data-theme="dark"] .inicio-card,
html[data-theme="dark"] .home-card,
html[data-theme="dark"] .help-card,
html[data-theme="dark"] .valora-help-panel,
html[data-theme="dark"] .valora-help-card,
html[data-theme="dark"] .valora-help-close,
html[data-theme="dark"] .valora-floating-help-btn {
  background: var(--dark-panel) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
  box-shadow: var(--dark-shadow-md) !important;
}

/* =========================================================
   Topbar/menu global quando não está no iframe
   ========================================================= */

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .app-topbar,
html[data-theme="dark"] .page-topbar {
  background: var(--dark-shell) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
  box-shadow: 0 1px 0 rgba(148, 163, 184, 0.14) !important;
}


/* Ícones, linhas e divisórias */
html[data-theme="dark"] hr,
html[data-theme="dark"] .divider,
html[data-theme="dark"] .settings-divider,
html[data-theme="dark"] .section-divider {
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] svg,
html[data-theme="dark"] i {
  color: inherit;
}

/* Scrollbar */
html[data-theme="dark"] ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

html[data-theme="dark"] ::-webkit-scrollbar-track {
  background: var(--dark-shell);
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.38);
  border-radius: 999px;
  border: 2px solid var(--dark-shell);
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.58);
}


/* =========================================================
   DARK PRO V10 | Correção final
   Resolve o branco gigante do iframe/menu aberto e deixa o dark
   mais neutro, estilo ChatGPT, sem azul pesado no fundo.
   ========================================================= */

html[data-theme="dark"] {
  color-scheme: dark;

  --dark-bg: #212121;
  --dark-bg-soft: #171717;
  --dark-shell: #0f1117;
  --dark-panel: #2b2b2b;
  --dark-panel-2: #303030;
  --dark-panel-hover: #343434;
  --dark-input: #171717;
  --dark-input-disabled: #202020;
  --dark-table-head: #181818;

  --dark-text: #ececec;
  --dark-text-soft: #d6d6d6;
  --dark-muted: #b4b4b4;
  --dark-muted-soft: #8a8a8a;

  --dark-border: rgba(255, 255, 255, 0.10);
  --dark-border-strong: rgba(255, 255, 255, 0.18);
  --dark-focus: rgba(75, 195, 199, 0.22);
  --dark-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --dark-shadow-md: 0 18px 42px rgba(0, 0, 0, 0.34);
  --dark-shadow-lg: 0 30px 90px rgba(0, 0, 0, 0.54);

  --bg: var(--dark-bg);
  --bg-soft: var(--dark-bg-soft);
  --panel: var(--dark-panel);
  --panel-hover: var(--dark-panel-hover);
  --card-bg: var(--dark-panel);
  --input-bg: var(--dark-input);
  --input-bg-disabled: var(--dark-input-disabled);
  --border: var(--dark-border);
  --border-hover: var(--dark-border-strong);
  --text: var(--dark-text);
  --text-soft: var(--dark-text-soft);
  --muted: var(--dark-muted);
  --muted-soft: var(--dark-muted-soft);
  --navy: var(--dark-shell);
  --navy-dark: #0a0c11;
  --navy-soft: #151821;

  --fin-bg: var(--dark-bg);
  --fin-card: var(--dark-panel);
  --fin-text: var(--dark-text);
  --fin-muted: var(--dark-muted);
  --fin-border: var(--dark-border);
  --fin-soft: var(--dark-bg-soft);
  --fin-shadow: var(--dark-shadow-md);
}

html[data-theme="dark"],
html[data-theme="dark"] body {
  background: var(--dark-bg) !important;
  color: var(--dark-text) !important;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 16% -8%, rgba(75, 195, 199, 0.055), transparent 28rem),
    radial-gradient(circle at 86% 0%, rgba(101, 172, 222, 0.045), transparent 25rem),
    var(--dark-bg) !important;
}

html[data-theme="dark"] .main,
html[data-theme="dark"] main,
html[data-theme="dark"] .layout,
html[data-theme="dark"] .page,
html[data-theme="dark"] .content,
html[data-theme="dark"] .app-page,
html[data-theme="dark"] .dashboard-page,
html[data-theme="dark"] .financeiro-page,
html[data-theme="dark"] .clientes-page,
html[data-theme="dark"] .fornecedores-page,
html[data-theme="dark"] .produtos-page,
html[data-theme="dark"] .patrimonio-page,
html[data-theme="dark"] .cotacoes-page,
html[data-theme="dark"] .propostas-page,
html[data-theme="dark"] .usuarios-page,
html[data-theme="dark"] .formularios-page {
  background: transparent !important;
  color: var(--dark-text) !important;
}

/* Header interno da página: não é o menu, então não deve virar barra pesada. */
html[data-theme="dark"] .main > .topbar,
html[data-theme="dark"] main.main > .topbar,
html[data-theme="dark"] .page-header,
html[data-theme="dark"] .header-page {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .topbar-title h1,
html[data-theme="dark"] .page-title,
html[data-theme="dark"] .panel-head h3,
html[data-theme="dark"] .financeiro-panel-head h2,
html[data-theme="dark"] .financeiro-panel-head h3 {
  color: var(--dark-text) !important;
}

html[data-theme="dark"] .topbar-title p,
html[data-theme="dark"] .topbar-subtitle,
html[data-theme="dark"] .panel-head p,
html[data-theme="dark"] .page-subtitle,
html[data-theme="dark"] .financeiro-panel-head p {
  color: var(--dark-muted) !important;
}

html[data-theme="dark"] .panel-card,
html[data-theme="dark"] .clientes-filter-card,
html[data-theme="dark"] .fornecedores-filter-card,
html[data-theme="dark"] .produtos-filter-card,
html[data-theme="dark"] .patrimonio-filter-card,
html[data-theme="dark"] .cotacoes-filter-card,
html[data-theme="dark"] .propostas-filter-card,
html[data-theme="dark"] .monitoramento-filter-card,
html[data-theme="dark"] .hero-card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .config-card,
html[data-theme="dark"] .section-card,
html[data-theme="dark"] .dashboard-panel,
html[data-theme="dark"] .dashboard-kpi-card,
html[data-theme="dark"] .dashboard-graph-card,
html[data-theme="dark"] .dashboard-summary-panel,
html[data-theme="dark"] .financeiro-card,
html[data-theme="dark"] .financeiro-panel,
html[data-theme="dark"] .config-table-panel,
html[data-theme="dark"] .table-container,
html[data-theme="dark"] .table-wrapper,
html[data-theme="dark"] .valora-table-wrapper,
html[data-theme="dark"] .panel-card-table {
  background: var(--dark-panel) !important;
  color: var(--dark-text-soft) !important;
  border-color: var(--dark-border) !important;
  box-shadow: var(--dark-shadow-sm) !important;
}

html[data-theme="dark"] .panel-card:hover,
html[data-theme="dark"] .stat-card:hover,
html[data-theme="dark"] .quick-card:hover {
  background: var(--dark-panel) !important;
  border-color: var(--dark-border-strong) !important;
}

html[data-theme="dark"] .filters-grid,
html[data-theme="dark"] .form-grid,
html[data-theme="dark"] .cotacoes-filters-grid,
html[data-theme="dark"] .financeiro-filters-grid,
html[data-theme="dark"] .footer-actions,
html[data-theme="dark"] .filter-actions,
html[data-theme="dark"] .table-pagination,
html[data-theme="dark"] .panel-head {
  background: transparent !important;
  color: inherit !important;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .search-box,
html[data-theme="dark"] .input-group,
html[data-theme="dark"] .select-wrap {
  background: var(--dark-input) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] label,
html[data-theme="dark"] .form-group label,
html[data-theme="dark"] .financeiro-field label,
html[data-theme="dark"] .input-label,
html[data-theme="dark"] .counter-text {
  color: var(--dark-muted) !important;
}

html[data-theme="dark"] .valora-table,
html[data-theme="dark"] table,
html[data-theme="dark"] .config-table,
html[data-theme="dark"] .financeiro-table {
  background: var(--dark-panel) !important;
  color: var(--dark-text-soft) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .valora-table thead,
html[data-theme="dark"] table thead,
html[data-theme="dark"] .valora-table th,
html[data-theme="dark"] table th,
html[data-theme="dark"] .config-table th,
html[data-theme="dark"] .financeiro-table th {
  background: var(--dark-table-head) !important;
  color: var(--dark-muted) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .valora-table td,
html[data-theme="dark"] table td,
html[data-theme="dark"] .config-table td,
html[data-theme="dark"] .financeiro-table td {
  background: var(--dark-panel) !important;
  color: var(--dark-text-soft) !important;
  border-color: rgba(255, 255, 255, 0.075) !important;
}

html[data-theme="dark"] .valora-table tbody tr:hover td,
html[data-theme="dark"] table tbody tr:hover td,
html[data-theme="dark"] .financeiro-table tbody tr:hover td {
  background: var(--dark-panel-hover) !important;
}

html[data-theme="dark"] .badge-status,
html[data-theme="dark"] .badge,
html[data-theme="dark"] .tag,
html[data-theme="dark"] .pill,
html[data-theme="dark"] .chip {
  background: rgba(255, 255, 255, 0.07) !important;
  color: var(--dark-text-soft) !important;
  border-color: var(--dark-border) !important;
}

html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .btn-icon,
html[data-theme="dark"] .btn-close,
html[data-theme="dark"] .modal-close {
  background: var(--dark-input) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .btn-secondary:hover,
html[data-theme="dark"] .btn-icon:hover,
html[data-theme="dark"] .modal-close:hover {
  background: #242424 !important;
  border-color: var(--dark-border-strong) !important;
}

html[data-theme="dark"] .modal-overlay {
  background: rgba(0, 0, 0, 0.62) !important;
}

html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .cliente-modal-content,
html[data-theme="dark"] .fornecedor-modal-content,
html[data-theme="dark"] .produto-modal-content,
html[data-theme="dark"] .patrimonio-modal-content,
html[data-theme="dark"] .cotacao-modal-content {
  background: var(--dark-panel) !important;
  color: var(--dark-text) !important;
  border-color: var(--dark-border-strong) !important;
  box-shadow: var(--dark-shadow-lg) !important;
}

html[data-theme="dark"] .cliente-modal-shell,
html[data-theme="dark"] .fornecedor-modal-shell,
html[data-theme="dark"] .produto-modal-shell,
html[data-theme="dark"] .patrimonio-modal-shell,
html[data-theme="dark"] .cotacao-modal-shell {
  background: var(--dark-panel) !important;
}

html[data-theme="dark"] .cliente-modal-sidebar,
html[data-theme="dark"] .fornecedor-modal-sidebar,
html[data-theme="dark"] .produto-modal-sidebar,
html[data-theme="dark"] .patrimonio-modal-sidebar,
html[data-theme="dark"] .cotacao-modal-sidebar,
html[data-theme="dark"] .modal-sidebar {
  background: var(--dark-bg-soft) !important;
  border-color: var(--dark-border) !important;
}



/* =========================================================
   DARK CHATGPT | UNIFICAÇÃO ORÇAMENTOS + LISTAS | 2026-08-08
   Remove o azul restante do módulo de Orçamentos e deixa os
   botões de ação das listas consistentes no tema escuro.
   ========================================================= */
html[data-theme="dark"] {
  --budget-blue: #ececec;
  --budget-aqua: #d1d1d1;
  --budget-navy: #ececec;
  --budget-border: rgba(255, 255, 255, 0.10);
  --budget-soft: #262626;
  --budget-muted: #b4b4b4;
}

html[data-theme="dark"] .budget-kpi,
html[data-theme="dark"] .budget-toolbar,
html[data-theme="dark"] .budget-table-card,
html[data-theme="dark"] .budget-list-pagination,
html[data-theme="dark"] .budget-summary-card,
html[data-theme="dark"] .budget-section-card,
html[data-theme="dark"] .settings-list-card,
html[data-theme="dark"] .settings-editor,
html[data-theme="dark"] .settings-list-item,
html[data-theme="dark"] .template-card,
html[data-theme="dark"] .preview-client-box,
html[data-theme="dark"] .payment-option,
html[data-theme="dark"] .analysis-kpis article,
html[data-theme="dark"] .product-search-box,
html[data-theme="dark"] #produto-search-results,
html[data-theme="dark"] .product-result,
html[data-theme="dark"] .product-empty,
html[data-theme="dark"] .product-load-status,
html[data-theme="dark"] .budget-autocomplete,
html[data-theme="dark"] .autocomplete-load-status,
html[data-theme="dark"] .budget-modal-content,
html[data-theme="dark"] .settings-modal-content,
html[data-theme="dark"] #budget-modal .budget-modal-sidebar,
html[data-theme="dark"] #budget-modal .budget-modal-topbar,
html[data-theme="dark"] #budget-modal .budget-modal-footer,
html[data-theme="dark"] #budget-modal .budget-sidebar-total-card,
html[data-theme="dark"] #budget-modal .budget-section-card,
html[data-theme="dark"] #budget-modal .btn-close,
html[data-theme="dark"] #budget-modal .budget-modal-main,
html[data-theme="dark"] #settings-modal .settings-sidebar,
html[data-theme="dark"] #settings-modal .settings-modal-header,
html[data-theme="dark"] #settings-modal .settings-workspace {
  background: #2f2f2f !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] #budget-modal .budget-modal-main,
html[data-theme="dark"] #settings-modal .settings-workspace,
html[data-theme="dark"] .settings-body,
html[data-theme="dark"] .budget-modal-body {
  background: #212121 !important;
}

html[data-theme="dark"] .budget-tabs,
html[data-theme="dark"] .settings-tabs,
html[data-theme="dark"] .budget-items-table th,
html[data-theme="dark"] #budget-modal .budget-sidebar-nav,
html[data-theme="dark"] #settings-modal .settings-tabs {
  background: #262626 !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
}

html[data-theme="dark"] .budget-items-table td,
html[data-theme="dark"] .budget-items-table tr,
html[data-theme="dark"] .budget-table td,
html[data-theme="dark"] .budget-table th {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme="dark"] .budget-modal-title-wrap h3,
html[data-theme="dark"] .budget-modal-topbar h3,
html[data-theme="dark"] .budget-section-heading h4,
html[data-theme="dark"] .settings-list-header h4,
html[data-theme="dark"] .settings-editor h4,
html[data-theme="dark"] .template-editor h4,
html[data-theme="dark"] .template-card h5,
html[data-theme="dark"] .budget-sidebar-user strong,
html[data-theme="dark"] .budget-sidebar-total-card strong,
html[data-theme="dark"] .budget-kpi strong,
html[data-theme="dark"] .budget-number,
html[data-theme="dark"] .budget-client-cell strong,
html[data-theme="dark"] .budget-title-cell strong,
html[data-theme="dark"] .budget-value-cell,
html[data-theme="dark"] .budget-footer-total strong {
  color: #ececec !important;
}

html[data-theme="dark"] .budget-modal-title-wrap p,
html[data-theme="dark"] .budget-modal-topbar p,
html[data-theme="dark"] .budget-section-heading p,
html[data-theme="dark"] .settings-list-header p,
html[data-theme="dark"] .template-editor p,
html[data-theme="dark"] .template-card p,
html[data-theme="dark"] .template-card-meta span,
html[data-theme="dark"] .budget-sidebar-user span,
html[data-theme="dark"] .budget-sidebar-total-card span,
html[data-theme="dark"] .budget-sidebar-total-card small,
html[data-theme="dark"] .budget-client-cell small,
html[data-theme="dark"] .budget-title-cell small,
html[data-theme="dark"] .form-group label,
html[data-theme="dark"] .budget-filter-field label,
html[data-theme="dark"] .counter-text,
html[data-theme="dark"] .product-list-header {
  color: #b4b4b4 !important;
}

html[data-theme="dark"] .budget-modal-icon,
html[data-theme="dark"] .budget-kpi-icon,
html[data-theme="dark"] #budget-modal .budget-sidebar-avatar,
html[data-theme="dark"] #settings-modal .settings-modal-icon,
html[data-theme="dark"] #settings-modal .settings-tab-icon,
html[data-theme="dark"] .budget-tab span,
html[data-theme="dark"] #budget-modal .budget-sidebar-nav .budget-tab > i {
  background: #383838 !important;
  color: #d1d1d1 !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
}

html[data-theme="dark"] .budget-tab,
html[data-theme="dark"] #budget-modal .budget-sidebar-nav .budget-tab,
html[data-theme="dark"] #settings-modal .settings-tabs button {
  color: #b4b4b4 !important;
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .budget-tab:hover,
html[data-theme="dark"] #budget-modal .budget-sidebar-nav .budget-tab:hover,
html[data-theme="dark"] #settings-modal .settings-tabs button:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #ececec !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme="dark"] .budget-tab.active,
html[data-theme="dark"] #budget-modal .budget-sidebar-nav .budget-tab.active,
html[data-theme="dark"] #settings-modal .settings-tabs button.active {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ececec !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
}

html[data-theme="dark"] .budget-tab.active span,
html[data-theme="dark"] #budget-modal .budget-sidebar-nav .budget-tab.active > i,
html[data-theme="dark"] #settings-modal .settings-tabs button.active .settings-tab-icon {
  background: #ececec !important;
  color: #171717 !important;
}

html[data-theme="dark"] .form-group input,
html[data-theme="dark"] .form-group select,
html[data-theme="dark"] .form-group textarea,
html[data-theme="dark"] .budget-toolbar input,
html[data-theme="dark"] .budget-toolbar select,
html[data-theme="dark"] .summary-edit-line input,
html[data-theme="dark"] .summary-edit-line select,
html[data-theme="dark"] .budget-items-table input,
html[data-theme="dark"] .budget-items-table textarea,
html[data-theme="dark"] .product-result,
html[data-theme="dark"] .autocomplete-item {
  background: #2f2f2f !important;
  color: #ececec !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
}

html[data-theme="dark"] .product-result:hover,
html[data-theme="dark"] .autocomplete-item:hover,
html[data-theme="dark"] #produto-search-results .product-result:hover {
  background: #383838 !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  box-shadow: none !important;
}

/* Botões de ação das listas: mesmo padrão em todo o dark. */
html[data-theme="dark"] .budget-action-btn,
html[data-theme="dark"] #settings-modal .budget-action-btn,
html[data-theme="dark"] #tbody-clientes .cliente-action-btn,
html[data-theme="dark"] .row-actions .btn-icon,
html[data-theme="dark"] td .btn-icon,
html[data-theme="dark"] .template-card-actions .btn-icon,
html[data-theme="dark"] .settings-list-actions .btn-icon,
html[data-theme="dark"] .kit-settings-actions .budget-action-btn,
html[data-theme="dark"] .emitter-list-actions .budget-action-btn,
html[data-theme="dark"] .template-card-actions .budget-action-btn {
  background: #2f2f2f !important;
  color: #d1d1d1 !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .budget-action-btn:hover,
html[data-theme="dark"] #settings-modal .budget-action-btn:hover,
html[data-theme="dark"] #tbody-clientes .cliente-action-btn:hover,
html[data-theme="dark"] .row-actions .btn-icon:hover,
html[data-theme="dark"] td .btn-icon:hover,
html[data-theme="dark"] .template-card-actions .btn-icon:hover,
html[data-theme="dark"] .settings-list-actions .btn-icon:hover,
html[data-theme="dark"] .kit-settings-actions .budget-action-btn:hover,
html[data-theme="dark"] .emitter-list-actions .budget-action-btn:hover,
html[data-theme="dark"] .template-card-actions .budget-action-btn:hover {
  background: #383838 !important;
  color: #ececec !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  box-shadow: none !important;
  transform: none !important;
}

html[data-theme="dark"] .budget-action-btn.danger:hover,
html[data-theme="dark"] #settings-modal .budget-action-btn.danger:hover,
html[data-theme="dark"] #tbody-clientes .cliente-action-btn[data-action="excluir"]:hover,
html[data-theme="dark"] .row-actions .btn-icon.danger:hover,
html[data-theme="dark"] td .btn-icon.danger:hover,
html[data-theme="dark"] .template-card-actions .btn-icon.danger:hover,
html[data-theme="dark"] .settings-list-actions .btn-icon.danger:hover,
html[data-theme="dark"] .kit-settings-actions .budget-action-btn.danger:hover,
html[data-theme="dark"] .emitter-list-actions .budget-action-btn.danger:hover,
html[data-theme="dark"] .template-card-actions .budget-action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.12) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.22) !important;
}

html[data-theme="dark"] #tbody-clientes .cliente-action-btn-whatsapp,
html[data-theme="dark"] .budget-action-btn[data-action="whatsapp"],
html[data-theme="dark"] .row-actions .btn-icon[data-action="whatsapp"] {
  color: #25d366 !important;
}

html[data-theme="dark"] #tbody-clientes .cliente-action-btn-whatsapp:hover,
html[data-theme="dark"] .budget-action-btn[data-action="whatsapp"]:hover,
html[data-theme="dark"] .row-actions .btn-icon[data-action="whatsapp"]:hover {
  background: rgba(37, 211, 102, 0.12) !important;
  color: #25d366 !important;
  border-color: rgba(37, 211, 102, 0.22) !important;
}


/* =========================================================
   DARK CHATGPT | SIDEBAR DO ORÇAMENTO SEM BLOCOS NOS ÍCONES
   Somente aparência/cor no tema escuro; dimensões intactas.
   ========================================================= */
html[data-theme="dark"] #budget-modal .budget-sidebar-nav .budget-tab > i {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #b4b4b4 !important;
}

html[data-theme="dark"] #budget-modal .budget-sidebar-nav .budget-tab:hover > i,
html[data-theme="dark"] #budget-modal .budget-sidebar-nav .budget-tab.active > i {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #ececec !important;
}

html[data-theme="dark"] #budget-modal .budget-sidebar-nav .budget-tab.active::before {
  background: #d1d1d1 !important;
}


/* =========================================================
   DARK CHATGPT | SIDEBAR ORÇAMENTO ÍCONES EXATOS REFERÊNCIA
   Mantém só os ícones/realce do orçamento iguais ao print.
   ========================================================= */
html[data-theme="dark"] #budget-modal .budget-sidebar-nav .budget-tab {
  color: #d1d5db !important;
}

html[data-theme="dark"] #budget-modal .budget-sidebar-nav .budget-tab > i {
  color: #d1d5db !important;
  font-size: 18px !important;
  width: 20px !important;
  min-width: 20px !important;
  height: 20px !important;
  opacity: 1 !important;
}

html[data-theme="dark"] #budget-modal .budget-sidebar-nav .budget-tab:hover {
  background: rgba(255,255,255,0.03) !important;
  color: #e5e7eb !important;
}
html[data-theme="dark"] #budget-modal .budget-sidebar-nav .budget-tab:hover > i {
  color: #e5e7eb !important;
}

html[data-theme="dark"] #budget-modal .budget-sidebar-nav .budget-tab.active {
  background: rgba(96, 165, 250, 0.09) !important;
  color: #f3f4f6 !important;
  border-color: rgba(96, 165, 250, 0.10) !important;
}
html[data-theme="dark"] #budget-modal .budget-sidebar-nav .budget-tab.active > i {
  color: #60a5fa !important;
}
html[data-theme="dark"] #budget-modal .budget-sidebar-nav .budget-tab.active::before {
  background: #60a5fa !important;
}


/* =========================================================
   DARK CHATGPT | STATUS DOS ORÇAMENTOS NA LISTA
   Remove as pills claras no dark e padroniza todos os status.
   ========================================================= */
html[data-theme="dark"] .budget-status {
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .budget-status.status-rascunho {
  color: #d1d5db !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

html[data-theme="dark"] .budget-status.status-enviado {
  color: #93c5fd !important;
  background: rgba(59, 130, 246, 0.14) !important;
  border-color: rgba(59, 130, 246, 0.24) !important;
}

html[data-theme="dark"] .budget-status.status-em_negociacao {
  color: #fcd34d !important;
  background: rgba(245, 158, 11, 0.14) !important;
  border-color: rgba(245, 158, 11, 0.24) !important;
}

html[data-theme="dark"] .budget-status.status-aprovado {
  color: #86efac !important;
  background: rgba(34, 197, 94, 0.14) !important;
  border-color: rgba(34, 197, 94, 0.24) !important;
}

html[data-theme="dark"] .budget-status.status-recusado,
html[data-theme="dark"] .budget-status.status-cancelado {
  color: #fca5a5 !important;
  background: rgba(239, 68, 68, 0.14) !important;
  border-color: rgba(239, 68, 68, 0.24) !important;
}

html[data-theme="dark"] .budget-status.status-expirado {
  color: #c4b5fd !important;
  background: rgba(139, 92, 246, 0.14) !important;
  border-color: rgba(139, 92, 246, 0.24) !important;
}

/* =========================================================
   DARK CHATGPT | FICHAS CADASTRAIS SEM AZUL | FINAL GLOBAL
   Cliente, Fornecedor, Produto, Patrimônio e Cotação.
   Apenas tema escuro. Não altera layout nem o tema claro.
   O módulo Orçamentos permanece com o destaque azul solicitado
   especificamente no sidebar dele.
   ========================================================= */
html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) {
  --brand: #d1d1d1;
  --brand-hover: #ececec;
  --brand-dark: #d1d1d1;
  --brand-soft: rgba(255, 255, 255, 0.07);
  --blue: #b4b4b4;
  --blue-soft: rgba(255, 255, 255, 0.07);
  --primary: #d1d1d1;
  --primary-soft: rgba(255, 255, 255, 0.07);
}

/* Estrutura geral dos modais cadastrais. */
html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .cliente-modal-content,
  .fornecedor-modal-content,
  .produto-modal-content,
  .patrimonio-modal-content,
  .cotacao-modal-content,
  .cliente-modal-shell,
  .fornecedor-modal-shell,
  .produto-modal-shell,
  .patrimonio-modal-shell,
  .cotacao-modal-shell,
  .cliente-modal-main,
  .fornecedor-modal-main,
  .produto-modal-main,
  .patrimonio-modal-main,
  .cotacao-modal-main
) {
  border-color: rgba(255, 255, 255, 0.10) !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .cliente-modal-sidebar,
  .fornecedor-modal-sidebar,
  .produto-modal-sidebar,
  .patrimonio-modal-sidebar,
  .cotacao-modal-sidebar
) {
  background: #171717 !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .cliente-modal-main,
  .fornecedor-modal-main,
  .produto-modal-main,
  .patrimonio-modal-main,
  .cotacao-modal-main,
  .cliente-modal-scroll,
  .fornecedor-modal-scroll,
  .produto-modal-scroll,
  .patrimonio-modal-scroll,
  .cotacao-modal-scroll
) {
  background: #212121 !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .cliente-modal-topbar,
  .fornecedor-modal-topbar,
  .produto-modal-topbar,
  .patrimonio-modal-topbar,
  .cotacao-modal-topbar
) {
  background: #2f2f2f !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
}

/* Card Código do sistema: sem gradiente, borda azul ou turquesa. */
html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .ficha-principal-code-card,
  .cliente-ficha-code-card,
  .fornecedor-ficha-code-card,
  .produto-ficha-code-card,
  .patrimonio-ficha-code-card,
  .cotacao-ficha-code-card
) {
  background: #2f2f2f !important;
  background-image: none !important;
  color: #ececec !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .ficha-principal-code-card,
  .cliente-ficha-code-card.ficha-principal-code-card,
  .fornecedor-ficha-code-card.ficha-principal-code-card,
  .produto-ficha-code-card.ficha-principal-code-card,
  .patrimonio-ficha-code-card.ficha-principal-code-card,
  .cotacao-ficha-code-card.ficha-principal-code-card
) > div:first-child::before {
  background: #383838 !important;
  color: #d1d1d1 !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .ficha-principal-code-card,
  .cliente-ficha-code-card,
  .fornecedor-ficha-code-card,
  .produto-ficha-code-card,
  .patrimonio-ficha-code-card,
  .cotacao-ficha-code-card
) .section-kicker {
  color: #b4b4b4 !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .ficha-principal-system-fields label,
  .ficha-principal-code-field label,
  .ficha-principal-date-field label
) {
  color: #8e8e8e !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) .ficha-principal-system-fields :is(input, select, textarea) {
  background: #262626 !important;
  color: #d1d1d1 !important;
  -webkit-text-fill-color: #d1d1d1 !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
}

/* Sidebar: ícones e tabs neutros em todos os cadastros. */
html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .cliente-sidebar-avatar,
  .fornecedor-sidebar-avatar,
  .produto-sidebar-avatar,
  .patrimonio-sidebar-avatar,
  .cotacao-sidebar-avatar
) {
  background: #2f2f2f !important;
  color: #d1d1d1 !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .cliente-tab-btn,
  .fornecedor-tab-btn,
  .produto-tab-btn,
  .patrimonio-tab-btn,
  .cotacao-tab-btn,
  .ficha-section-tab-btn
) {
  background: transparent !important;
  color: #b4b4b4 !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .cliente-tab-btn,
  .fornecedor-tab-btn,
  .produto-tab-btn,
  .patrimonio-tab-btn,
  .cotacao-tab-btn,
  .ficha-section-tab-btn
):hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #ececec !important;
  border-color: transparent !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .cliente-tab-btn,
  .fornecedor-tab-btn,
  .produto-tab-btn,
  .patrimonio-tab-btn,
  .cotacao-tab-btn,
  .ficha-section-tab-btn
).active,
html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .cliente-tab-btn.active,
  .fornecedor-tab-btn.active,
  .produto-tab-btn.active,
  .patrimonio-tab-btn.active,
  .cotacao-tab-btn.active,
  .ficha-section-tab-btn.active
) {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ececec !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .cliente-tab-btn,
  .fornecedor-tab-btn,
  .produto-tab-btn,
  .patrimonio-tab-btn,
  .cotacao-tab-btn,
  .ficha-section-tab-btn
)::before {
  background: transparent !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .cliente-tab-btn.active,
  .fornecedor-tab-btn.active,
  .produto-tab-btn.active,
  .patrimonio-tab-btn.active,
  .cotacao-tab-btn.active,
  .ficha-section-tab-btn.active
)::before {
  background: #d1d1d1 !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .cliente-sidebar-nav .cliente-tab-btn > i,
  .fornecedor-sidebar-nav .fornecedor-tab-btn > i,
  .produto-sidebar-nav .produto-tab-btn > i,
  .patrimonio-sidebar-nav .patrimonio-tab-btn > i,
  .cotacao-sidebar-nav .cotacao-tab-btn > i,
  .cliente-tab-icon,
  .fornecedor-tab-icon,
  .produto-tab-icon,
  .patrimonio-tab-icon,
  .cotacao-tab-icon,
  .ficha-section-tab-icon
) {
  background: rgba(255, 255, 255, 0.07) !important;
  color: #d1d1d1 !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .cliente-tab-btn.active .cliente-tab-icon,
  .fornecedor-tab-btn.active .fornecedor-tab-icon,
  .produto-tab-btn.active .produto-tab-icon,
  .patrimonio-tab-btn.active .patrimonio-tab-icon,
  .cotacao-tab-btn.active .cotacao-tab-icon,
  .cliente-tab-btn.active .ficha-section-tab-icon,
  .fornecedor-tab-btn.active .ficha-section-tab-icon,
  .produto-tab-btn.active .ficha-section-tab-icon,
  .patrimonio-tab-btn.active .ficha-section-tab-icon,
  .cotacao-tab-btn.active .ficha-section-tab-icon,
  .cliente-sidebar-nav .cliente-tab-btn.active > i,
  .fornecedor-sidebar-nav .fornecedor-tab-btn.active > i,
  .produto-sidebar-nav .produto-tab-btn.active > i,
  .patrimonio-sidebar-nav .patrimonio-tab-btn.active > i,
  .cotacao-sidebar-nav .cotacao-tab-btn.active > i
) {
  background: rgba(255, 255, 255, 0.10) !important;
  color: #ececec !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

/* Seções e campos personalizados: nada de ícone turquesa/azul. */
html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .section-kicker,
  .modal-kicker,
  .brand-color,
  .text-brand
) {
  color: #b4b4b4 !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .custom-section-icon,
  .custom-fields-info > div,
  .custom-fields-info > span
) {
  background: #383838 !important;
  color: #d1d1d1 !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .section-card,
  .custom-fields-card,
  .custom-section-card,
  .custom-section-card-bitrix,
  .cliente-main-card,
  .fornecedor-main-card,
  .produto-main-card,
  .patrimonio-main-card,
  .cotacao-main-card
) {
  background: var(--valora-form-surface, #1B1B1B) !important;
  border-color: var(--valora-form-border, #383838) !important;
  box-shadow: none !important;
}

/* Ações de topo e botões: neutros no dark; status semântico continua verde/vermelho. */
html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .agenda-fixed-top-btn,
  .cliente-top-icon-action.btn-secondary,
  .btn-close,
  .modal-close,
  .btn-secondary
) {
  background: #2f2f2f !important;
  color: #d1d1d1 !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .agenda-fixed-top-btn,
  .cliente-top-icon-action.btn-secondary,
  .btn-close,
  .modal-close,
  .btn-secondary
):hover {
  background: #383838 !important;
  color: #ececec !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .btn-primary,
  .cliente-budget-action.btn-primary
) {
  background: #ececec !important;
  color: #171717 !important;
  border-color: #ececec !important;
  box-shadow: none !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(input, select, textarea):focus {
  border-color: rgba(255, 255, 255, 0.30) !important;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08) !important;
  outline: none !important;
}



/* =========================================================
   DARK CHATGPT | ORÇAMENTO — ABAS INTERNAS FINAL | 2026-08-08
   Fecha Analise, Pagamento, Documento e Historico no dark.
   O preview da folha continua branco por representar o PDF real.
   ========================================================= */

/* ---------- Analise financeira ---------- */
html[data-theme="dark"] #budget-modal .margin-alert,
html[data-theme="dark"] #budget-modal .missing-cost-alert {
  background: rgba(245, 158, 11, 0.10) !important;
  color: #e5c07b !important;
  border-color: rgba(245, 158, 11, 0.24) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] #budget-modal .margin-alert strong,
html[data-theme="dark"] #budget-modal .margin-alert p,
html[data-theme="dark"] #budget-modal .missing-cost-alert strong,
html[data-theme="dark"] #budget-modal .missing-cost-alert p {
  color: inherit !important;
}

html[data-theme="dark"] #budget-modal .margin-alert i,
html[data-theme="dark"] #budget-modal .missing-cost-alert i {
  color: #d6a84f !important;
}

html[data-theme="dark"] #budget-modal .analysis-missing-cost {
  color: #f0b5ab !important;
}

/* ---------- Pagamento ---------- */
html[data-theme="dark"] #budget-modal #btn-adicionar-pagamento {
  background: #383838 !important;
  color: #ececec !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] #budget-modal #btn-adicionar-pagamento:hover {
  background: #444444 !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  transform: none !important;
}

html[data-theme="dark"] #budget-modal .payment-option {
  background: #2f2f2f !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] #budget-modal .payment-option-head input[type="radio"] {
  accent-color: #d1d1d1 !important;
}

html[data-theme="dark"] #budget-modal .payment-option-head .payment-name,
html[data-theme="dark"] #budget-modal .payment-option-grid input,
html[data-theme="dark"] #budget-modal .payment-option-grid select {
  background: #2f2f2f !important;
  color: #ececec !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
}

html[data-theme="dark"] #budget-modal .summary-line,
html[data-theme="dark"] #budget-modal .summary-edit-line {
  border-color: rgba(255, 255, 255, 0.10) !important;
  color: #b4b4b4 !important;
}

html[data-theme="dark"] #budget-modal .summary-line strong {
  color: #ececec !important;
}

html[data-theme="dark"] #budget-modal .summary-total {
  background: #262626 !important;
  color: #ececec !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] #budget-modal .summary-total span {
  color: #b4b4b4 !important;
  opacity: 1 !important;
}

html[data-theme="dark"] #budget-modal .summary-total strong {
  color: #ececec !important;
}

/* ---------- Documento / escala ---------- */
html[data-theme="dark"] #budget-modal .document-scale-slider input[type="range"] {
  accent-color: #d1d1d1 !important;
}

html[data-theme="dark"] #budget-modal .document-scale-slider output {
  background: #2f2f2f !important;
  color: #ececec !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
}

html[data-theme="dark"] #budget-modal .document-preview-shell {
  background: #171717 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: none !important;
}

/* A folha e o conteudo do preview sao deliberadamente claros: representam o PDF. */
html[data-theme="dark"] #budget-modal .document-preview,
html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active,
html[data-theme="dark"] #budget-modal .document-preview .dav-document {
  background: #ffffff !important;
  color: #000000 !important;
}

html[data-theme="dark"] #budget-modal .document-preview .dav-client-table,
html[data-theme="dark"] #budget-modal .document-preview .dav-items-table,
html[data-theme="dark"] #budget-modal .document-preview .dav-totals-table {
  background: #ffffff !important;
  color: #000000 !important;
  border-color: #000000 !important;
}

html[data-theme="dark"] #budget-modal .document-preview .dav-client-table th,
html[data-theme="dark"] #budget-modal .document-preview .dav-client-table td,
html[data-theme="dark"] #budget-modal .document-preview .dav-items-table th,
html[data-theme="dark"] #budget-modal .document-preview .dav-items-table td,
html[data-theme="dark"] #budget-modal .document-preview .dav-totals-table th,
html[data-theme="dark"] #budget-modal .document-preview .dav-totals-table td {
  background: #ffffff !important;
  color: #000000 !important;
  border-color: #000000 !important;
}

html[data-theme="dark"] #budget-modal .document-preview .dav-document :is(
  h1, h2, h3, h4, h5, h6, strong, b, span, p, label, small, div
) {
  color: inherit;
}

html[data-theme="dark"] #budget-modal .document-preview .dav-footer {
  background: #edf7fc !important;
  color: #000000 !important;
  border-color: #000000 !important;
}

/* Preview do modelo visual comum tambem deve parecer uma folha impressa. */
html[data-theme="dark"] #budget-modal .document-preview:not(.dav-preview-active) {
  background: #ffffff !important;
  color: #263746 !important;
}

html[data-theme="dark"] #budget-modal .document-preview:not(.dav-preview-active) .preview-client-box,
html[data-theme="dark"] #budget-modal .document-preview:not(.dav-preview-active) .preview-section {
  background: #f8fafb !important;
  color: #263746 !important;
  border-color: #dfe6ea !important;
}

html[data-theme="dark"] #budget-modal .document-preview:not(.dav-preview-active) .preview-items td {
  background: #ffffff !important;
  color: #263746 !important;
  border-color: #e2e8eb !important;
}

html[data-theme="dark"] #budget-modal .document-preview:not(.dav-preview-active) .preview-items th {
  background: #365465 !important;
  color: #ffffff !important;
  border-color: #365465 !important;
}

/* ---------- Historico ---------- */
html[data-theme="dark"] #budget-modal .budget-history {
  color: #d1d1d1 !important;
}

html[data-theme="dark"] #budget-modal .history-item {
  border-left-color: rgba(255, 255, 255, 0.14) !important;
}

html[data-theme="dark"] #budget-modal .history-item:last-child {
  border-left-color: transparent !important;
}

html[data-theme="dark"] #budget-modal .history-item::before {
  background: #d1d1d1 !important;
  box-shadow: 0 0 0 2px #212121 !important;
}

html[data-theme="dark"] #budget-modal .history-item strong {
  color: #ececec !important;
}

html[data-theme="dark"] #budget-modal .history-item p,
html[data-theme="dark"] #budget-modal .history-item small {
  color: #b4b4b4 !important;
}

html[data-theme="dark"] #budget-modal .history-details {
  background: #2f2f2f !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] #budget-modal .history-details summary {
  color: #d1d1d1 !important;
}

html[data-theme="dark"] #budget-modal .history-details summary:hover {
  color: #ececec !important;
}

html[data-theme="dark"] #budget-modal .history-change {
  border-color: rgba(255, 255, 255, 0.10) !important;
}

html[data-theme="dark"] #budget-modal .history-change > strong {
  color: #d1d1d1 !important;
}

html[data-theme="dark"] #budget-modal .history-change i {
  color: #8e8e8e !important;
}


/* =========================================================
   DARK CHATGPT | DAV/PDF SEM HERANÇA DO TEMA ESCURO
   A folha é uma representação de impressão: tudo dentro dela
   mantém as cores reais do documento, independentemente do tema.
   ========================================================= */
html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active,
html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active .dav-document {
  background: #ffffff !important;
  color: #000000 !important;
  color-scheme: light !important;
}

/* As regras globais do dark usam !important em span/p/label/etc.;
   por isso a folha precisa neutralizá-las também com !important. */
html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active .dav-document,
html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active .dav-document * {
  color: #000000 !important;
  -webkit-text-fill-color: #000000 !important;
}

html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active .dav-document table,
html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active .dav-document thead,
html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active .dav-document tbody,
html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active .dav-document tr,
html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active .dav-document th,
html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active .dav-document td {
  background: #ffffff !important;
  color: #000000 !important;
  -webkit-text-fill-color: #000000 !important;
}

html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active .dav-header,
html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active .dav-company-title > strong,
html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active .dav-client-table td,
html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active .dav-reference-line,
html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active .dav-items-table th,
html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active .dav-items-table tbody tr:last-child td,
html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active .dav-totals-table td,
html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active .dav-observations,
html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active .dav-footer {
  border-color: #000000 !important;
}

html[data-theme="dark"] #budget-modal .document-preview.dav-preview-active .dav-footer {
  background: #edf7fc !important;
  color: #000000 !important;
}

/* Modelo visual padrão: mesma proteção contra a tipografia clara do dark. */
html[data-theme="dark"] #budget-modal .document-preview:not(.dav-preview-active),
html[data-theme="dark"] #budget-modal .document-preview:not(.dav-preview-active) * {
  -webkit-text-fill-color: currentColor !important;
}

html[data-theme="dark"] #budget-modal .document-preview:not(.dav-preview-active) h1,
html[data-theme="dark"] #budget-modal .document-preview:not(.dav-preview-active) h2,
html[data-theme="dark"] #budget-modal .document-preview:not(.dav-preview-active) h3,
html[data-theme="dark"] #budget-modal .document-preview:not(.dav-preview-active) h4,
html[data-theme="dark"] #budget-modal .document-preview:not(.dav-preview-active) strong {
  color: #263746 !important;
}

html[data-theme="dark"] #budget-modal .document-preview:not(.dav-preview-active) p,
html[data-theme="dark"] #budget-modal .document-preview:not(.dav-preview-active) span,
html[data-theme="dark"] #budget-modal .document-preview:not(.dav-preview-active) label,
html[data-theme="dark"] #budget-modal .document-preview:not(.dav-preview-active) small,
html[data-theme="dark"] #budget-modal .document-preview:not(.dav-preview-active) li {
  color: #5f6f79 !important;
}


/* =========================================================
   DARK | AÇÕES PRIMÁRIAS UNIFICADAS | 2026-08-08
   Sem gradiente, glow, sombra, brilho ou deslocamento.
   Somente tema escuro. Ações destrutivas permanecem separadas.
   ========================================================= */
html[data-theme="dark"] :is(
  button.btn-primary,
  a.btn-primary,
  .btn.btn-primary
):not(.btn-danger):not(.danger-action):not(.btn-danger-soft) {
  background: var(--valora-ui-cta, #176DC6) !important;
  background-color: var(--valora-ui-cta, #176DC6) !important;
  background-image: none !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  border-color: var(--valora-ui-cta, #176DC6) !important;
  box-shadow: none !important;
  filter: none !important;
  transform: none !important;
  text-shadow: none !important;
}

html[data-theme="dark"] :is(
  button.btn-primary,
  a.btn-primary,
  .btn.btn-primary
):not(.btn-danger):not(.danger-action):not(.btn-danger-soft):is(:hover, :focus, :focus-visible, :active) {
  background: var(--valora-ui-cta, #176DC6) !important;
  background-color: var(--valora-ui-cta, #176DC6) !important;
  background-image: none !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  border-color: var(--valora-ui-cta, #176DC6) !important;
  box-shadow: none !important;
  filter: none !important;
  transform: none !important;
  text-shadow: none !important;
  outline: none !important;
}

/* Fichas que antes possuíam uma regra branca específica no dark. */
html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(.btn-primary, .cliente-budget-action.btn-primary):not(.btn-danger):not(.danger-action) {
  background: var(--valora-ui-cta, #176DC6) !important;
  background-image: none !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  border-color: var(--valora-ui-cta, #176DC6) !important;
  box-shadow: none !important;
  filter: none !important;
  transform: none !important;
}


/* =========================================================
   DARK | SEM EFEITINHO EM BOTÕES/CHIPS AZUIS | 2026-08-08
   Remove glow, blur, sombra, gradiente e pseudo-elementos.
   Ação primária usa um único destaque teal no tema escuro.
   ========================================================= */
html[data-theme="dark"] :is(
  .btn,
  .btn-primary,
  button.btn-primary,
  a.btn-primary,
  .btn-secondary,
  .filter-chip,
  .filter-chip.active,
  .financeiro-filter-chip,
  .financeiro-filter-chip.active,
  .action-chip,
  .financeiro-tabs a,
  .financeiro-tabs a.active,
  .financeiro-tabs button,
  .financeiro-tabs button.active
) {
  box-shadow: none !important;
  filter: none !important;
  text-shadow: none !important;
  transform: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background-image: none !important;
}

html[data-theme="dark"] :is(
  .btn-primary,
  button.btn-primary,
  a.btn-primary,
  .filter-chip.active,
  .financeiro-filter-chip.active,
  .financeiro-tabs a.active,
  .financeiro-tabs button.active
):not(.btn-danger):not(.danger):not(.danger-action):not(.btn-danger-soft) {
  background: var(--valora-ui-cta, #176DC6) !important;
  background-color: var(--valora-ui-cta, #176DC6) !important;
  border-color: var(--valora-ui-cta, #176DC6) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

html[data-theme="dark"] :is(
  .btn-primary,
  button.btn-primary,
  a.btn-primary,
  .filter-chip.active,
  .financeiro-filter-chip.active,
  .financeiro-tabs a.active,
  .financeiro-tabs button.active
):not(.btn-danger):not(.danger):not(.danger-action):not(.btn-danger-soft):is(:hover, :focus, :focus-visible, :active) {
  background: var(--valora-ui-cta, #176DC6) !important;
  background-color: var(--valora-ui-cta, #176DC6) !important;
  border-color: var(--valora-ui-cta, #176DC6) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  box-shadow: none !important;
  filter: none !important;
  transform: none !important;
  outline: none !important;
}

html[data-theme="dark"] :is(
  .btn-primary,
  button.btn-primary,
  a.btn-primary,
  .filter-chip.active,
  .financeiro-filter-chip.active,
  .financeiro-tabs a.active,
  .financeiro-tabs button.active
)::before,
html[data-theme="dark"] :is(
  .btn-primary,
  button.btn-primary,
  a.btn-primary,
  .filter-chip.active,
  .financeiro-filter-chip.active,
  .financeiro-tabs a.active,
  .financeiro-tabs button.active
)::after {
  content: none !important;
  display: none !important;
  box-shadow: none !important;
  filter: none !important;
  background-image: none !important;
}


/* =========================================================
   DARK | FUNDO SEM AURA/GRADIENTE NA HOME/INÍCIO | 2026-08-08
   Remove o brilho radial restante do fundo no tema escuro.
   ========================================================= */
html[data-theme="dark"] .login-page,
html[data-theme="dark"] .login-shell,
html[data-theme="dark"] .inicio-page,
html[data-theme="dark"] .home-page,
html[data-theme="dark"] .help-page {
  background: var(--dark-bg) !important;
  background-image: none !important;
}


/* =========================================================
   DARK | FUNDO GLOBAL CHAPADO SEM MANCHAS/AURAS | 2026-08-08
   Remove qualquer glow/gradiente radial restante da página.
   ========================================================= */
html[data-theme="dark"],
html[data-theme="dark"] body,
html[data-theme="dark"] .layout,
html[data-theme="dark"] .main,
html[data-theme="dark"] main,
html[data-theme="dark"] .page,
html[data-theme="dark"] .content,
html[data-theme="dark"] .app-page,
html[data-theme="dark"] .dashboard-page,
html[data-theme="dark"] .inicio-page,
html[data-theme="dark"] .home-page {
  background-image: none !important;
}

/* =========================================================
   CLIENTE | AGENDA/HISTÓRICO NO DARK DO VALORA | v43
   Escopo intencional: somente a agenda embutida no modal de cliente.
   Não altera a Agenda global nem o tema claro.
   ========================================================= */
html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente {
  --agenda-brand: #1A7EEE;
  --agenda-aqua: #1A7EEE;
  --agenda-text: #ececec;
  --agenda-muted: #a3a3a3;
  --agenda-border: rgba(255, 255, 255, 0.10);
  --agenda-surface: #2b2b2b;
  --agenda-soft: #242424;
}

html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .valora-agenda-entity {
  background: transparent !important;
}

html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .valora-agenda-card {
  background: #2b2b2b !important;
  background-image: none !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .valora-agenda-heading h3,
html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .valora-agenda-heading h4,
html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-item-main strong,
html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-item-extra strong,
html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .valora-agenda-form label,
html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-item-editor label {
  color: #ececec !important;
  -webkit-text-fill-color: currentColor !important;
}

html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .valora-agenda-heading p,
html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-item-main p,
html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-item-meta,
html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-item-extra,
html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-empty,
html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-loading,
html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-unsaved {
  color: #a3a3a3 !important;
  -webkit-text-fill-color: currentColor !important;
}

html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .valora-agenda-form :is(input, select, textarea),
html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-item-editor :is(input, select, textarea) {
  background: #303030 !important;
  background-image: none !important;
  color: #ececec !important;
  -webkit-text-fill-color: #ececec !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .valora-agenda-form :is(input, select, textarea):focus,
html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-item-editor :is(input, select, textarea):focus {
  border-color: #1A7EEE !important;
  box-shadow: none !important;
  outline: none !important;
}

html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .valora-agenda-form :is(input, textarea)::placeholder,
html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-item-editor :is(input, textarea)::placeholder {
  color: #858585 !important;
  opacity: 1 !important;
}

html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .valora-agenda-item {
  background: #242424 !important;
  background-image: none !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-item-editor {
  background: #2b2b2b !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
}

html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-chip {
  background: #303030 !important;
  color: #d7d7d7 !important;
  border-color: rgba(255, 255, 255, 0.11) !important;
}

html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-chip.overdue {
  background: rgba(239, 68, 68, 0.10) !important;
  color: #ff8b8b !important;
  border-color: rgba(239, 68, 68, 0.25) !important;
}

html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-item-icon {
  background: rgba(26, 126, 238, 0.12) !important;
  color: #66aaff !important;
}

html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-primary {
  background: #1A7EEE !important;
  background-image: none !important;
  border-color: #1A7EEE !important;
  color: #ffffff !important;
  box-shadow: none !important;
  filter: none !important;
}

html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-primary:hover {
  background: #1874dc !important;
  border-color: #1874dc !important;
  box-shadow: none !important;
}

html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-secondary {
  background: #2f2f2f !important;
  color: #ececec !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-secondary:hover {
  background: #353535 !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
}

html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-link-btn {
  color: #66aaff !important;
  background: transparent !important;
  box-shadow: none !important;
}

html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-empty,
html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-loading,
html[data-theme="dark"] #modal-cliente-backdrop #agenda-cliente .agenda-unsaved {
  background: #242424 !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
}

/* Ação principal do cabeçalho do cliente também segue o azul oficial. */
html[data-theme="dark"] #modal-cliente-backdrop .cliente-budget-action.btn-primary {
  background: #1A7EEE !important;
  background-image: none !important;
  border-color: #1A7EEE !important;
  color: #ffffff !important;
  box-shadow: none !important;
  filter: none !important;
}

html[data-theme="dark"] #modal-cliente-backdrop .cliente-budget-action.btn-primary:hover {
  background: #1874dc !important;
  border-color: #1874dc !important;
  color: #ffffff !important;
  box-shadow: none !important;
}


/* =========================================================
   CLIENTES | FICHA PRINCIPAL | DARK | ÍCONE IGUAL AO NATIVO
   Garante que os itens personalizados não recebam fundo no dark.
   ========================================================= */
html[data-theme="dark"] #modal-cliente-backdrop .cliente-sidebar-nav .cliente-tab-btn[data-ficha-section] .ficha-section-tab-icon,
html[data-theme="dark"] .cliente-sidebar-nav .cliente-tab-btn[data-ficha-section] .ficha-section-tab-icon {
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  border: 0 !important;
  color: #b8bdc7 !important;
}

html[data-theme="dark"] #modal-cliente-backdrop .cliente-sidebar-nav .cliente-tab-btn[data-ficha-section]:hover .ficha-section-tab-icon,
html[data-theme="dark"] .cliente-sidebar-nav .cliente-tab-btn[data-ficha-section]:hover .ficha-section-tab-icon {
  background: transparent !important;
  color: #e4e7ec !important;
}

html[data-theme="dark"] #modal-cliente-backdrop .cliente-sidebar-nav .cliente-tab-btn[data-ficha-section].active .ficha-section-tab-icon,
html[data-theme="dark"] .cliente-sidebar-nav .cliente-tab-btn[data-ficha-section].active .ficha-section-tab-icon {
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  color: #1A7EEE !important;
}

/* =========================================================
   FORNECEDORES | PARIDADE VISUAL COM CLIENTES | DARK | v37
   ========================================================= */
html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-sidebar-nav .fornecedor-tab-btn .fornecedor-native-icon,
html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-sidebar-nav .fornecedor-tab-btn[data-ficha-section] .ficha-section-tab-icon {
  border: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  color: #b8bdc7 !important;
}

html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-sidebar-nav .fornecedor-tab-btn:hover .fornecedor-native-icon,
html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-sidebar-nav .fornecedor-tab-btn[data-ficha-section]:hover .ficha-section-tab-icon {
  color: #e4e7ec !important;
}

html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-sidebar-nav .fornecedor-tab-btn.active .fornecedor-native-icon,
html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-sidebar-nav .fornecedor-tab-btn[data-ficha-section].active .ficha-section-tab-icon,
html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-sidebar-nav .fornecedor-tab-btn[data-ficha-section].active .ficha-section-tab-label {
  color: #69d4dc !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .fornecedor-sidebar-bottom .fornecedor-ficha-toggle {
  border-color: rgba(255, 255, 255, .08) !important;
  background: rgba(255, 255, 255, .02) !important;
}

html[data-theme="dark"] .fornecedor-sidebar-bottom .fornecedor-ficha-toggle:hover {
  background: rgba(255, 255, 255, .035) !important;
}

html[data-theme="dark"] .fornecedor-sidebar-bottom .fornecedor-ficha-toggle-check {
  border-color: rgba(255, 255, 255, .10) !important;
  background: rgba(255, 255, 255, .03) !important;
}

html[data-theme="dark"] .fornecedor-sidebar-bottom .fornecedor-ficha-toggle strong {
  color: #f5f7fb !important;
}

html[data-theme="dark"] .fornecedor-sidebar-bottom .fornecedor-ficha-toggle small {
  color: #aab4c5 !important;
}

html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-ficha-code-card.ficha-principal-code-card {
  box-shadow: none !important;
}

html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-actions-trigger {
  border-color: #334554 !important;
  background: #17232d !important;
  color: #e4edf4 !important;
}
html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-actions-trigger:hover {
  border-color: #415566 !important;
  background: #1b2a35 !important;
}
html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-actions-menu {
  border-color: #334554 !important;
  background: #17232d !important;
  box-shadow: 0 18px 34px rgba(2, 8, 16, .46) !important;
}
html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-actions-menu-item {
  color: #dbe7f0 !important;
}
html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-actions-menu-item:hover {
  border-color: #31414e !important;
  background: rgba(255, 255, 255, .04) !important;
  color: #ffffff !important;
}


/* =========================================================
   FORNECEDORES | PARIDADE REAL COM CLIENTES | DARK | v38
   ========================================================= */
html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-sidebar-nav .fornecedor-tab-btn[data-ficha-section] {
  background: transparent !important;
  border-color: transparent !important;
}

html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-sidebar-nav .fornecedor-tab-btn[data-ficha-section] .ficha-section-tab-icon {
  border: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  color: #b8bdc7 !important;
}

html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-sidebar-nav .fornecedor-tab-btn[data-ficha-section] .ficha-section-tab-label {
  color: #b8c5d1 !important;
}

html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-sidebar-nav .fornecedor-tab-btn[data-ficha-section]:hover .ficha-section-tab-icon,
html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-sidebar-nav .fornecedor-tab-btn[data-ficha-section]:hover .ficha-section-tab-label {
  color: #e4e7ec !important;
  background: transparent !important;
}

html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-sidebar-nav .fornecedor-tab-btn[data-ficha-section].active {
  background: transparent !important;
}

html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-sidebar-nav .fornecedor-tab-btn[data-ficha-section].active .ficha-section-tab-icon {
  color: #1A7EEE !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

html[data-theme="dark"] #modal-fornecedor-backdrop .fornecedor-sidebar-nav .fornecedor-tab-btn[data-ficha-section].active .ficha-section-tab-label {
  color: #69d4dc !important;
  font-weight: 500 !important;
}

/* =========================================================
   VALORA | CORREÇÃO FINAL DE CASCATA DARK | 2026-09-09
   Este bloco é deliberadamente o último do tema escuro.
   Corrige CSS claro/azul antigo que ainda vencia por ordem ou
   especificidade nos modais de cadastro e comercial.
   ========================================================= */
html[data-theme="dark"] {
  --valora-dark-canvas: #212121;
  --valora-dark-surface: #2f2f2f;
  --valora-dark-surface-soft: #262626;
  --valora-dark-surface-hover: #383838;
  --valora-dark-border: rgba(255, 255, 255, 0.10);
  --valora-dark-border-strong: rgba(255, 255, 255, 0.16);
  --valora-dark-text: #ececec;
  --valora-dark-text-soft: #d1d1d1;
  --valora-dark-muted: #a6a6a6;
}

/* Canvas principal dos modais. */
html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop,
  #budget-modal,
  #proposal-modal
) :is(
  .cliente-modal-main,
  .fornecedor-modal-main,
  .produto-modal-main,
  .patrimonio-modal-main,
  .cotacao-modal-main,
  .budget-modal-main,
  .proposal-modal-main,
  .cliente-modal-scroll,
  .fornecedor-modal-scroll,
  .produto-modal-scroll,
  .patrimonio-modal-scroll,
  .cotacao-modal-scroll,
  .budget-modal-scroll,
  .proposal-modal-scroll
) {
  background: var(--valora-dark-canvas) !important;
  background-image: none !important;
  color: var(--valora-dark-text) !important;
}

/* Topo, barra Ctrl+S e rodapé no mesmo cinza do tema atual. */
html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop,
  #budget-modal,
  #proposal-modal
) :is(
  .cliente-modal-topbar,
  .fornecedor-modal-topbar,
  .produto-modal-topbar,
  .patrimonio-modal-topbar,
  .cotacao-modal-topbar,
  .budget-modal-topbar,
  .proposal-modal-topbar,
  .cliente-modal-workbar,
  .fornecedor-modal-workbar,
  .produto-modal-workbar,
  .patrimonio-modal-workbar,
  .cotacao-modal-workbar,
  .budget-modal-workbar,
  .proposal-modal-workbar,
  .cliente-modal-footer,
  .fornecedor-modal-footer,
  .produto-modal-footer,
  .patrimonio-modal-footer,
  .cotacao-modal-footer,
  .budget-modal-footer,
  .proposal-modal-footer
) {
  background: var(--valora-dark-surface) !important;
  background-image: none !important;
  border-color: var(--valora-dark-border) !important;
  color: var(--valora-dark-text) !important;
  box-shadow: none !important;
}

/* Sidebars continuam um nível mais profundo, sem o azul legado. */
html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop,
  #budget-modal,
  #proposal-modal
) :is(
  .cliente-modal-sidebar,
  .fornecedor-modal-sidebar,
  .produto-modal-sidebar,
  .patrimonio-modal-sidebar,
  .cotacao-modal-sidebar,
  .budget-modal-sidebar,
  .proposal-modal-sidebar
) {
  background: #171717 !important;
  background-image: none !important;
  border-color: var(--valora-dark-border) !important;
}

/* Card Código/Data: impede qualquer regra clara de voltar a vencer. */
html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .ficha-principal-code-card,
  .cliente-ficha-code-card.ficha-principal-code-card,
  .fornecedor-ficha-code-card.ficha-principal-code-card,
  .produto-ficha-code-card.ficha-principal-code-card,
  .patrimonio-ficha-code-card.ficha-principal-code-card,
  .cotacao-ficha-code-card.ficha-principal-code-card
) {
  background: var(--valora-dark-surface) !important;
  background-image: none !important;
  border-color: var(--valora-dark-border) !important;
  color: var(--valora-dark-text) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .ficha-principal-code-card,
  .cliente-ficha-code-card.ficha-principal-code-card,
  .fornecedor-ficha-code-card.ficha-principal-code-card,
  .produto-ficha-code-card.ficha-principal-code-card,
  .patrimonio-ficha-code-card.ficha-principal-code-card,
  .cotacao-ficha-code-card.ficha-principal-code-card
) :is(.ficha-principal-system-fields, .ficha-principal-code-field, .ficha-principal-date-field) label {
  color: var(--valora-dark-muted) !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .ficha-principal-code-card,
  .cliente-ficha-code-card.ficha-principal-code-card,
  .fornecedor-ficha-code-card.ficha-principal-code-card,
  .produto-ficha-code-card.ficha-principal-code-card,
  .patrimonio-ficha-code-card.ficha-principal-code-card,
  .cotacao-ficha-code-card.ficha-principal-code-card
) .ficha-principal-system-fields :is(input, select, textarea) {
  background: var(--valora-dark-surface-soft) !important;
  background-image: none !important;
  border-color: var(--valora-dark-border) !important;
  color: var(--valora-dark-text-soft) !important;
  -webkit-text-fill-color: var(--valora-dark-text-soft) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .ficha-principal-code-card,
  .cliente-ficha-code-card.ficha-principal-code-card,
  .fornecedor-ficha-code-card.ficha-principal-code-card,
  .produto-ficha-code-card.ficha-principal-code-card,
  .patrimonio-ficha-code-card.ficha-principal-code-card,
  .cotacao-ficha-code-card.ficha-principal-code-card
) .ficha-principal-system-fields :is(input, select, textarea):disabled,
html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop
) :is(
  .ficha-principal-code-card,
  .cliente-ficha-code-card.ficha-principal-code-card,
  .fornecedor-ficha-code-card.ficha-principal-code-card,
  .produto-ficha-code-card.ficha-principal-code-card,
  .patrimonio-ficha-code-card.ficha-principal-code-card,
  .cotacao-ficha-code-card.ficha-principal-code-card
) .ficha-principal-system-fields :is(input, select, textarea)[readonly] {
  background: var(--valora-dark-surface-soft) !important;
  color: #bdbdbd !important;
  -webkit-text-fill-color: #bdbdbd !important;
  opacity: 1 !important;
}

/* Atalho Ctrl+S: remove os tons azulados dos CSS antigos. */
html[data-theme="dark"] :is(
  #modal-cliente-backdrop .cliente-save-shortcut,
  #modal-fornecedor-backdrop .fornecedor-save-shortcut,
  #modal-produto-backdrop .produto-save-shortcut,
  #modal-patrimonio .patrimonio-save-shortcut,
  #modal-cotacao-backdrop .cotacao-save-shortcut,
  #budget-modal .budget-save-shortcut,
  #proposal-modal .proposal-save-shortcut
) {
  color: var(--valora-dark-muted) !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop .cliente-save-shortcut kbd,
  #modal-fornecedor-backdrop .fornecedor-save-shortcut kbd,
  #modal-produto-backdrop .produto-save-shortcut kbd,
  #modal-patrimonio .patrimonio-save-shortcut kbd,
  #modal-cotacao-backdrop .cotacao-save-shortcut kbd,
  #budget-modal .budget-save-shortcut kbd,
  #proposal-modal .proposal-save-shortcut kbd
) {
  background: var(--valora-dark-surface-soft) !important;
  border-color: var(--valora-dark-border-strong) !important;
  border-bottom-color: var(--valora-dark-border-strong) !important;
  color: var(--valora-dark-text-soft) !important;
  box-shadow: none !important;
}

/* Menus de ações/toggles dos mesmos modais. */
html[data-theme="dark"] :is(
  #modal-cliente-backdrop,
  #modal-fornecedor-backdrop,
  #modal-produto-backdrop,
  #modal-patrimonio,
  #modal-cotacao,
  #modal-cotacao-backdrop,
  #budget-modal,
  #proposal-modal
) :is(
  .cliente-actions-trigger,
  .fornecedor-actions-trigger,
  .produto-actions-trigger,
  .patrimonio-actions-trigger,
  .cotacao-actions-trigger,
  .budget-actions-trigger,
  .proposal-actions-trigger,
  .cliente-actions-menu,
  .fornecedor-actions-menu,
  .produto-actions-menu,
  .patrimonio-actions-menu,
  .cotacao-actions-menu,
  .budget-actions-menu,
  .proposal-actions-menu,
  .cliente-ficha-toggle,
  .fornecedor-ficha-toggle,
  .produto-ficha-toggle,
  .patrimonio-ficha-toggle,
  .cotacao-ficha-toggle
) {
  background: var(--valora-dark-surface) !important;
  background-image: none !important;
  border-color: var(--valora-dark-border) !important;
  color: var(--valora-dark-text) !important;
}

/* Propostas possui um card de código próprio. */
html[data-theme="dark"] #proposal-modal .proposal-code-card {
  background: var(--valora-dark-surface) !important;
  background-image: none !important;
  border-color: var(--valora-dark-border) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] #proposal-modal .proposal-code-field label {
  color: var(--valora-dark-muted) !important;
}

html[data-theme="dark"] #proposal-modal .proposal-code-field input {
  background: var(--valora-dark-surface-soft) !important;
  border-color: var(--valora-dark-border) !important;
  color: var(--valora-dark-text-soft) !important;
  -webkit-text-fill-color: var(--valora-dark-text-soft) !important;
}


/* =========================================================
   VALORA | DARK | AÇÕES DE TOPO UNIFICADAS | v40
   Ações, maximizar e fechar usam a mesma superfície neutra.
   Status permanecem semânticos (verde/amarelo/vermelho/cinza).
   ========================================================= */
html[data-theme="dark"] {
  --valora-top-action-bg: #2f2f2f;
  --valora-top-action-bg-hover: #383838;
  --valora-top-action-border: #424242;
  --valora-top-action-border-hover: #525252;
  --valora-top-action-text: #e5e5e5;
  --valora-top-action-text-hover: #ffffff;
}

/* Botão Ações de todos os cadastros/comercial. */
html[data-theme="dark"] :is(
  #modal-cliente-backdrop .cliente-actions-trigger,
  #modal-fornecedor-backdrop .fornecedor-actions-trigger,
  #modal-produto-backdrop .produto-actions-trigger,
  #modal-patrimonio .patrimonio-actions-trigger,
  #modal-cotacao-backdrop .cotacao-actions-trigger,
  #budget-modal .budget-actions-trigger,
  #proposal-modal .proposal-actions-trigger
) {
  background: var(--valora-top-action-bg) !important;
  background-image: none !important;
  border: 1px solid var(--valora-top-action-border) !important;
  color: var(--valora-top-action-text) !important;
  box-shadow: none !important;
  filter: none !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop .cliente-actions-trigger,
  #modal-fornecedor-backdrop .fornecedor-actions-trigger,
  #modal-produto-backdrop .produto-actions-trigger,
  #modal-patrimonio .patrimonio-actions-trigger,
  #modal-cotacao-backdrop .cotacao-actions-trigger,
  #budget-modal .budget-actions-trigger,
  #proposal-modal .proposal-actions-trigger
):hover {
  background: var(--valora-top-action-bg-hover) !important;
  border-color: var(--valora-top-action-border-hover) !important;
  color: var(--valora-top-action-text-hover) !important;
}

/* Maximizar: botão global injetado pelo app + versões próprias de orçamento/proposta. */
html[data-theme="dark"] :is(
  #modal-cliente-backdrop .cliente-modal-top-actions > .valora-window-size-toggle,
  #modal-fornecedor-backdrop .fornecedor-modal-top-actions > .valora-window-size-toggle,
  #modal-produto-backdrop .produto-modal-top-actions > .valora-window-size-toggle,
  #modal-patrimonio .patrimonio-modal-top-actions > .valora-window-size-toggle,
  #modal-cotacao-backdrop .cotacao-modal-top-actions > .valora-window-size-toggle,
  #budget-modal .budget-maximize-action,
  #proposal-modal #btn-maximizar-proposta
) {
  width: 40px !important;
  min-width: 40px !important;
  height: 40px !important;
  min-height: 40px !important;
  flex: 0 0 40px !important;
  padding: 0 !important;
  border-radius: 11px !important;
  background: var(--valora-top-action-bg) !important;
  background-image: none !important;
  border: 1px solid var(--valora-top-action-border) !important;
  color: var(--valora-top-action-text) !important;
  box-shadow: none !important;
  filter: none !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop .cliente-modal-top-actions > .valora-window-size-toggle,
  #modal-fornecedor-backdrop .fornecedor-modal-top-actions > .valora-window-size-toggle,
  #modal-produto-backdrop .produto-modal-top-actions > .valora-window-size-toggle,
  #modal-patrimonio .patrimonio-modal-top-actions > .valora-window-size-toggle,
  #modal-cotacao-backdrop .cotacao-modal-top-actions > .valora-window-size-toggle,
  #budget-modal .budget-maximize-action,
  #proposal-modal #btn-maximizar-proposta
):hover {
  background: var(--valora-top-action-bg-hover) !important;
  border-color: var(--valora-top-action-border-hover) !important;
  color: var(--valora-top-action-text-hover) !important;
}

/* Fechar: neutro em repouso, vermelho somente no hover/foco. */
html[data-theme="dark"] :is(
  #modal-cliente-backdrop #btn-fechar-modal-cliente,
  #modal-fornecedor-backdrop #btn-fechar-modal-fornecedor,
  #modal-produto-backdrop #btn-fechar-modal-produto,
  #modal-patrimonio #btn-fechar-modal-patrimonio,
  #modal-cotacao-backdrop #btn-fechar-modal-cotacao,
  #budget-modal #btn-fechar-budget-modal,
  #proposal-modal #btn-fechar-modal
) {
  width: 40px !important;
  min-width: 40px !important;
  height: 40px !important;
  min-height: 40px !important;
  flex: 0 0 40px !important;
  padding: 0 !important;
  border-radius: 11px !important;
  background: var(--valora-top-action-bg) !important;
  background-image: none !important;
  border: 1px solid var(--valora-top-action-border) !important;
  color: var(--valora-top-action-text) !important;
  box-shadow: none !important;
  filter: none !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop #btn-fechar-modal-cliente,
  #modal-fornecedor-backdrop #btn-fechar-modal-fornecedor,
  #modal-produto-backdrop #btn-fechar-modal-produto,
  #modal-patrimonio #btn-fechar-modal-patrimonio,
  #modal-cotacao-backdrop #btn-fechar-modal-cotacao,
  #budget-modal #btn-fechar-budget-modal,
  #proposal-modal #btn-fechar-modal
):hover,
html[data-theme="dark"] :is(
  #modal-cliente-backdrop #btn-fechar-modal-cliente,
  #modal-fornecedor-backdrop #btn-fechar-modal-fornecedor,
  #modal-produto-backdrop #btn-fechar-modal-produto,
  #modal-patrimonio #btn-fechar-modal-patrimonio,
  #modal-cotacao-backdrop #btn-fechar-modal-cotacao,
  #budget-modal #btn-fechar-budget-modal,
  #proposal-modal #btn-fechar-modal
):focus-visible {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
  color: #f87171 !important;
  outline: none !important;
}

/* Mantém o status Ativo como único destaque cromático do cabeçalho. */
html[data-theme="dark"] :is(
  #modal-cliente-backdrop .cliente-top-status,
  #modal-fornecedor-backdrop .fornecedor-status-pill,
  #modal-produto-backdrop .produto-status-pill
):not(.is-inativo):not(.is-bloqueado) {
  background: rgba(34, 197, 94, 0.10) !important;
  border-color: rgba(34, 197, 94, 0.30) !important;
  color: #86efac !important;
  box-shadow: none !important;
}

/* Ícones dos três controles neutros herdam exatamente a mesma cor. */
html[data-theme="dark"] :is(
  #modal-cliente-backdrop .cliente-modal-top-actions,
  #modal-fornecedor-backdrop .fornecedor-modal-top-actions,
  #modal-produto-backdrop .produto-modal-top-actions,
  #modal-patrimonio .patrimonio-modal-top-actions,
  #modal-cotacao-backdrop .cotacao-modal-top-actions,
  #budget-modal .budget-modal-top-actions,
  #proposal-modal .proposal-modal-top-actions
) :is(.valora-window-size-toggle, .btn-close, .proposal-top-icon-btn, .budget-maximize-action) :is(i, svg) {
  color: inherit !important;
  stroke: currentColor !important;
}


/* =========================================================
   2026-11-02 | OVERRIDE FINAL — Paleta azul do dark
   Verde fica reservado para estados realmente positivos
   como pago/recebido/concluído. Status ativos/tipos/tags
   decorativos passam a usar azul.
   ========================================================= */
html[data-theme="dark"] {
  --valora-dark-accent-blue: #59A9F5;
  --valora-dark-accent-blue-border: rgba(89, 169, 245, 0.32);
  --valora-dark-accent-blue-bg: rgba(89, 169, 245, 0.12);
  --valora-dark-accent-blue-ring: rgba(89, 169, 245, 0.14);
}

/* Tipos, categorias e status ativos nas listas */
html[data-theme="dark"] :is(
  .badge-tipo,
  .badge-tag,
  .badge-tag.brand,
  .status-ativo,
  .badge-status.ativo,
  .badge-status.habilitado,
  .badge-status.aberto,
  .badge-status.pendente,
  .status-active,
  .status-enabled,
  .tag,
  .pill.blue,
  .chip.is-blue
) {
  background: var(--valora-dark-accent-blue-bg) !important;
  color: var(--valora-dark-accent-blue) !important;
  border-color: var(--valora-dark-accent-blue-border) !important;
}

/* Status de cabeçalho e pills de modal que NÃO são erro/inativo */
html[data-theme="dark"] :is(
  #modal-cliente-backdrop .cliente-status-pill,
  #modal-cliente-backdrop .cliente-top-status,
  #modal-fornecedor-backdrop .fornecedor-status-pill,
  #modal-produto-backdrop .produto-status-pill,
  #modal-patrimonio .patrimonio-status-pill,
  #modal-cotacao-backdrop .cliente-status-pill,
  .financeiro-top-status,
  .financeiro-modal-chip
):not(.is-inativo):not(.is-bloqueado):not(.is-baixado):not(.is-extraviado):not(.is-manutencao):not(.danger):not(.is-danger) {
  background: var(--valora-dark-accent-blue-bg) !important;
  color: var(--valora-dark-accent-blue) !important;
  border-color: var(--valora-dark-accent-blue-border) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] :is(
  #modal-cliente-backdrop .cliente-top-status-dot,
  #modal-fornecedor-backdrop .fornecedor-status-dot,
  #modal-produto-backdrop .produto-top-status-dot,
  #modal-patrimonio .patrimonio-top-status-dot,
  #modal-cotacao-backdrop .cliente-top-status-dot,
  .financeiro-top-status-dot
) {
  background: currentColor !important;
  box-shadow: 0 0 0 4px var(--valora-dark-accent-blue-ring) !important;
}

/* Ícones decorativos/selos que estavam herdando verde */
html[data-theme="dark"] :is(
  .cliente-status-pill i,
  .fornecedor-status-pill i,
  .produto-status-pill i,
  .patrimonio-status-pill i
):not(.fa-circle-check):not(.fa-check) {
  color: currentColor !important;
}

/* Preserva cinza e vermelho onde realmente precisam continuar distintos */
html[data-theme="dark"] :is(
  .badge-status.inativo,
  .badge-status.desabilitado,
  .badge-status.cancelada,
  .status-inativo,
  .status-disabled
) {
  background: rgba(148, 163, 184, 0.12) !important;
  color: #cbd5e1 !important;
  border-color: rgba(148, 163, 184, 0.24) !important;
}

html[data-theme="dark"] :is(
  .badge-status.bloqueado,
  .badge-status.suspenso,
  .status-bloqueado,
  .status-suspenso
) {
  background: rgba(239, 68, 68, 0.12) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.24) !important;
}


/* ==============================================================
   VALORA | Dark - Toggle "Usar ficha principal" (2026-11-03)
   Um único padrão para Clientes, Fornecedores, Produtos,
   Patrimônio e Cotações. Só visual: não muda input/estado/JS.
   ============================================================= */
html[data-theme="dark"] body :is(
  #modal-cliente-backdrop .cliente-ficha-toggle,
  #modal-fornecedor-backdrop .fornecedor-ficha-toggle,
  #modal-produto-backdrop .produto-ficha-toggle,
  #modal-patrimonio .patrimonio-ficha-toggle,
  #modal-cotacao-backdrop .cotacao-ficha-toggle
) {
  background: #242424 !important;
  border: 1px solid #454545 !important;
  color: #F4F4F4 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] body :is(
  #modal-cliente-backdrop .cliente-ficha-toggle,
  #modal-fornecedor-backdrop .fornecedor-ficha-toggle,
  #modal-produto-backdrop .produto-ficha-toggle,
  #modal-patrimonio .patrimonio-ficha-toggle,
  #modal-cotacao-backdrop .cotacao-ficha-toggle
):hover {
  background: #2B2B2B !important;
  border-color: #5A5A5A !important;
}

html[data-theme="dark"] body :is(
  #modal-cliente-backdrop .cliente-ficha-toggle,
  #modal-fornecedor-backdrop .fornecedor-ficha-toggle,
  #modal-produto-backdrop .produto-ficha-toggle,
  #modal-patrimonio .patrimonio-ficha-toggle,
  #modal-cotacao-backdrop .cotacao-ficha-toggle
):focus-within {
  border-color: #59A9F5 !important;
  outline: 2px solid rgba(89,169,245,.36) !important;
  outline-offset: 2px;
}

html[data-theme="dark"] body :is(
  #modal-cliente-backdrop .cliente-ficha-toggle-copy,
  #modal-fornecedor-backdrop .fornecedor-ficha-toggle-copy,
  #modal-produto-backdrop .produto-ficha-toggle-copy,
  #modal-patrimonio .patrimonio-ficha-toggle-copy,
  #modal-cotacao-backdrop .cotacao-ficha-toggle-copy
) {
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: break-word;
}

html[data-theme="dark"] body :is(
  #modal-cliente-backdrop .cliente-ficha-toggle-copy strong,
  #modal-fornecedor-backdrop .fornecedor-ficha-toggle-copy strong,
  #modal-produto-backdrop .produto-ficha-toggle-copy strong,
  #modal-patrimonio .patrimonio-ficha-toggle-copy strong,
  #modal-cotacao-backdrop .cotacao-ficha-toggle-copy strong
) {
  color: #F4F4F4 !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
}

/* Texto secundário, inclusive com checkbox marcado. */
html[data-theme="dark"] body :is(
  #modal-cliente-backdrop .cliente-ficha-toggle-copy small,
  #modal-fornecedor-backdrop .fornecedor-ficha-toggle-copy small,
  #modal-produto-backdrop .produto-ficha-toggle-copy small,
  #modal-patrimonio .patrimonio-ficha-toggle-copy small,
  #modal-cotacao-backdrop .cotacao-ficha-toggle-copy small
) {
  color: #CDD1D6 !important;
  font-size: 11.5px !important;
  line-height: 1.35 !important;
  font-weight: 400 !important;
}

/* Desmarcado: contorno nítido, sem sugerir opção ativa. */
html[data-theme="dark"] body :is(
  #modal-cliente-backdrop .cliente-ficha-toggle input:not(:checked) + .cliente-ficha-toggle-check,
  #modal-fornecedor-backdrop .fornecedor-ficha-toggle input:not(:checked) + .fornecedor-ficha-toggle-check,
  #modal-produto-backdrop .produto-ficha-toggle input:not(:checked) + .produto-ficha-toggle-check,
  #modal-patrimonio .patrimonio-ficha-toggle input:not(:checked) + .patrimonio-ficha-toggle-check,
  #modal-cotacao-backdrop .cotacao-ficha-toggle input:not(:checked) + .cotacao-ficha-toggle-check
) {
  background: #1B1B1B !important;
  border-color: #707070 !important;
  color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

/* Marcado: azul do Valora, com check branco legível. */
html[data-theme="dark"] body :is(
  #modal-cliente-backdrop .cliente-ficha-toggle input:checked + .cliente-ficha-toggle-check,
  #modal-fornecedor-backdrop .fornecedor-ficha-toggle input:checked + .fornecedor-ficha-toggle-check,
  #modal-produto-backdrop .produto-ficha-toggle input:checked + .produto-ficha-toggle-check,
  #modal-patrimonio .patrimonio-ficha-toggle input:checked + .patrimonio-ficha-toggle-check,
  #modal-cotacao-backdrop .cotacao-ficha-toggle input:checked + .cotacao-ficha-toggle-check
) {
  background: #2387E8 !important;
  background-image: none !important;
  border-color: #59A9F5 !important;
  color: #FFFFFF !important;
  box-shadow: 0 0 0 2px rgba(89,169,245,.16) !important;
}
