/* Superfícies do sistema — acabamento dos campos de acesso, sem alterar layout. */
:root {
  --rdx-surface: rgba(255, 255, 255, 0.94);
  --rdx-surface-hover: #ffffff;
  --rdx-surface-border: rgba(0, 113, 227, 0.16);
  --rdx-surface-border-hover: rgba(0, 113, 227, 0.24);
  --rdx-surface-border-focus: rgba(0, 113, 227, 0.42);
  --rdx-surface-selected: #eef6ff;
  --rdx-surface-ink: #1d1d1f;
  --rdx-surface-muted: #6e6e73;
  --rdx-surface-accent: #0071e3;
  --rdx-surface-shadow: 0 6px 16px rgba(0, 0, 0, 0.07);
  --rdx-surface-shadow-hover: 0 8px 18px rgba(0, 0, 0, 0.09);
  --rdx-surface-focus-ring: 0 0 0 3px rgba(0, 113, 227, 0.09);
  --rdx-surface-transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

html[data-theme="dark"] {
  --rdx-surface: #181b22;
  --rdx-surface-hover: #20242d;
  --rdx-surface-border: rgba(94, 168, 255, 0.26);
  --rdx-surface-border-hover: rgba(94, 168, 255, 0.38);
  --rdx-surface-border-focus: rgba(94, 168, 255, 0.56);
  --rdx-surface-selected: #1c3048;
  --rdx-surface-ink: #f5f5f7;
  --rdx-surface-muted: #a4a7ae;
  --rdx-surface-accent: #5ea8ff;
  --rdx-surface-shadow: 0 6px 16px rgba(0, 0, 0, 0.24);
  --rdx-surface-shadow-hover: 0 8px 18px rgba(0, 0, 0, 0.30);
  --rdx-surface-focus-ring: 0 0 0 3px rgba(94, 168, 255, 0.12);
}

/* Indicadores dos cabeçalhos: mesmo acabamento do Painel principal do Início. */
html #app :is(.home-badge, .stats-badge, .crm-badge, .cash-badge),
html .crediario-overlay :is(.home-badge, .stats-badge, .crm-badge),
html .trade-in-page-overlay :is(.home-badge, .stats-badge, .crm-badge) {
  height: auto;
  padding: 9px 14px;
  border: 1px solid var(--rdx-surface-border);
  border-radius: 999px;
  background: var(--rdx-surface);
  color: var(--rdx-surface-ink);
  box-shadow: var(--rdx-surface-shadow);
  font-size: 12px;
  font-weight: 300;
  white-space: nowrap;
}

/* Painéis de conteúdo, resumos e cards de acesso das páginas.
   Clientes e os contêineres .rel-panel mantêm o fundo transparente. */
html #app :is(
  .stats-panel:not(.clients-panel), .inicio-card, .stats-metric, .stats-crm-card,
  .home-operation-metric, .home-panel-count,
  .cash-card, .cash-centered-card, .cash-status-card, .cash-previous-row,
  .cp-summary, .rep-card, .rel-kpi, .pix-main-card,
  .config-doc-card, .config-fiscal-card, .config-operation-card,
  .config-local-crm-panel, .config-fin-crm-card, .main .card
) {
  border: 1px solid var(--rdx-surface-border);
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
}

html #app :is(.stats-panel:not(.clients-panel), .inicio-card, .cash-card, .cash-centered-card) {
  border-radius: 24px;
}

/* Primeiros passos: contraste do roteiro sobre a superfície clara do Início. */
html:not([data-theme="dark"]) #app .home-first-steps-card {
  color: var(--rdx-surface-ink);
}

html:not([data-theme="dark"]) #app .home-first-steps-card :is(
  .home-panel-heading h2, .first-step-text b
) {
  color: var(--rdx-surface-ink);
}

html:not([data-theme="dark"]) #app .home-first-steps-card :is(
  .first-steps-summary, .first-step-text > span
) {
  color: var(--rdx-surface-muted);
}

html:not([data-theme="dark"]) #app .home-first-steps-card :is(
  .home-panel-kicker, .first-steps-count, .first-step-go
) {
  color: var(--rdx-surface-accent);
}

html:not([data-theme="dark"]) #app .home-first-steps-card :is(
  .first-steps-count, .first-steps-progress, .first-step-ic
) {
  background: var(--rdx-surface-selected);
}

html:not([data-theme="dark"]) #app .home-first-steps-card .first-steps-count {
  border-color: var(--rdx-surface-border);
}

html:not([data-theme="dark"]) #app .home-first-steps-card .first-step {
  border-color: var(--rdx-surface-border);
  background: var(--rdx-surface);
  color: var(--rdx-surface-ink);
  box-shadow: var(--rdx-surface-shadow);
}

html:not([data-theme="dark"]) #app .home-first-steps-card .first-step:not(.done):hover {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html:not([data-theme="dark"]) #app .home-first-steps-card .first-step:focus-visible {
  outline-color: var(--rdx-surface-accent);
}

html:not([data-theme="dark"]) #app .home-first-steps-card .first-step-ic {
  color: var(--rdx-surface-accent);
}

html:not([data-theme="dark"]) #app .home-first-steps-card .first-step.done {
  border-color: rgba(19, 160, 101, 0.24);
  background: rgba(19, 160, 101, 0.10);
}

html:not([data-theme="dark"]) #app .home-first-steps-card .first-step.done :is(
  .first-step-ic, .first-step-text b
) {
  color: #087348;
}

html:not([data-theme="dark"]) #app .home-first-steps-card .first-step.done .first-step-ic {
  background: rgba(19, 160, 101, 0.12);
}

html:not([data-theme="dark"]) #app .home-first-steps-card .first-step.done .first-step-text > span {
  color: #52675d;
}

html:not([data-theme="dark"]) #app .home-first-steps-card.is-entering {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

html:not([data-theme="dark"]) #app .home-first-steps-card.is-entering::before {
  border-color: var(--rdx-surface-border);
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
}

/* Estatísticas: estados de carregamento, mensagens e tabelas do painel. */
html #app .stats-project-control .stats-empty {
  border-color: var(--rdx-surface-border);
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
}

html #app .stats-project-control .stats-empty:not(.danger) {
  color: var(--rdx-surface-muted);
}

html #app .stats-project-control .stats-empty:not(.danger) > .icon {
  color: var(--rdx-surface-accent);
}

html #app .stats-project-control .stats-table-wrap {
  border: 1px solid var(--rdx-surface-border-hover);
  border-radius: 18px;
  background: var(--rdx-surface);
}

html #app .stats-project-control .stats-table {
  background: var(--rdx-surface);
}

html #app .stats-project-control .stats-table th {
  background: var(--rdx-surface-selected);
  color: var(--rdx-surface-accent);
}

html #app .stats-project-control .stats-table :is(th, td) {
  border-color: var(--rdx-surface-border-hover);
}

html #app .stats-project-control :is(
  .stats-project-legend-row,
  .stats-project-progress-list .stats-progress-row
) {
  border-color: var(--rdx-surface-border);
}

/* A sombra da tabela fiscal fica fora do conteúdo recortado pela rolagem. */
html #app .notas-page .notas-table-scroll {
  border-radius: 18px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.055);
}

html #app .notas-page #notas-list-wrap {
  box-shadow: none;
}

html[data-theme="dark"] #app .notas-page .notas-table-scroll {
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

/* Ícones dos títulos de seções, como Categorias, Marcas e Fornecedores. */
html #app :is(.prod-subhead-icon, .stats-panel-title > .icon) {
  border: 1px solid var(--rdx-surface-border);
  background: var(--rdx-surface);
  color: var(--rdx-surface-accent);
  box-shadow: var(--rdx-surface-shadow);
}

/* Mantém as áreas de imagem e as cores informativas dos cards de produto. */
html #app :is(.prod-card, .prod-entity-tile) {
  border-color: var(--rdx-surface-border);
  box-shadow: var(--rdx-surface-shadow);
}

html #app .rep-card:hover {
  border-color: var(--rdx-surface-border-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

/* Cadastro de produto em página. As regras antigas desta tela usam !important;
   o escopo próprio mantém compras, vendedores e formulários em modal separados. */
html #app :is([data-prod-form-page], [data-purchase-form-page]) {
  border-color: var(--rdx-surface-border) !important;
  background: var(--rdx-surface) !important;
  box-shadow: var(--rdx-surface-shadow) !important;
}

html #app [data-prod-form-page] :is(
  .stats-modal-field, .prod-product-id-field, .stats-filter-field,
  .prod-toggle-row, .prod-tool-btn, .prod-form-preview-box,
  .prod-stock-moves-panel, .prod-image-suggestion-card
) {
  border: 1px solid var(--rdx-surface-border) !important;
  border-radius: 14px !important;
  background: var(--rdx-surface) !important;
  box-shadow: var(--rdx-surface-shadow) !important;
  transition: var(--rdx-surface-transition);
}

html #app [data-prod-form-page] :is(.prod-picker-inner, .prod-picker-btn:hover .prod-picker-inner) {
  background: transparent !important;
}

html #app [data-prod-form-page] :is(
  .stats-modal-field, .prod-product-id-field, .stats-filter-field,
  .prod-tool-btn, .prod-image-suggestion-card
):hover:not(:disabled):not(.selected):not(:focus-within) {
  border-color: var(--rdx-surface-border-hover) !important;
  background: var(--rdx-surface-hover) !important;
  box-shadow: var(--rdx-surface-shadow-hover) !important;
}

html #app [data-prod-form-page] :is(.stats-modal-field, .prod-product-id-field):focus-within,
html #app [data-prod-form-page] :is(.stats-filter-field, .prod-tool-btn, .prod-image-suggestion-card):focus-visible {
  border-color: var(--rdx-surface-border-focus) !important;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover) !important;
}

html #app [data-prod-form-page] :is(.stats-filter-field, .prod-tool-btn, .prod-image-suggestion-card):focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
}

html #app [data-prod-form-page] .prod-form-preview-box {
  border-radius: 20px !important;
}

html #app [data-prod-form-page] :is(.prod-form-preview-box > .icon, .prod-form-empty-label, .prod-form-preview-label) {
  color: var(--rdx-surface-muted) !important;
}

html #app [data-prod-form-page] :is(.prod-tool-btn, .prod-tool-btn .icon, .prod-picker-btn .prod-btn-chip .icon, .prod-picker-chevron) {
  color: var(--rdx-surface-accent) !important;
}

html #app [data-prod-form-page] .prod-image-suggestion-card.selected {
  border-color: var(--rdx-surface-border-focus) !important;
  background: var(--rdx-surface-selected) !important;
}

html #app [data-prod-form-page] .prod-image-suggestion-card.selected .prod-image-suggestion-name {
  color: var(--rdx-surface-accent) !important;
}

/* Formulários fiscais e da O.S. alinhados à faixa superior no computador. */
@media (min-width: 941px) {
  html #app .main.stats-main > .notas-editor-screen:has(> :is([data-os-editor], [data-notas-editor-page])) {
    padding: 0 0 72px;
  }
}

/* Relatórios: tema dos pop-ups e tabela isolada dos estilos do Relaciona. */
html .stats-modal-card.pos-dialog.rel-report-dialog {
  --pop-surface: var(--rdx-surface);
  --pop-surface-alt: var(--rdx-surface);
  --pop-hover: var(--rdx-surface-hover);
  --pop-foot: var(--rdx-surface);
  --pop-border: var(--rdx-surface-border);
  --pop-border-soft: var(--rdx-surface-border);
  --pop-ink: var(--rdx-surface-ink);
  --pop-muted: var(--rdx-surface-muted);
  --pop-accent: var(--rdx-surface-accent);
  --pop-accent-soft: var(--rdx-surface-selected);
  --pop-close-ink: var(--rdx-surface-accent);
  border-radius: 24px;
}

html .stats-modal-card.pos-dialog.rel-report-dialog > :is(.stats-modal-head, .stats-modal-foot) {
  flex: 0 0 auto;
}

html .stats-modal-card.pos-dialog.rel-report-dialog > .stats-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

html .stats-modal-card.pos-dialog.rel-report-dialog :is(
  .rel-kpi, .rel-period-btn, .rel-table-wrap, .rel-empty, .rel-loading
) {
  border: 1px solid var(--rdx-surface-border);
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
}

html .stats-modal-card.pos-dialog.rel-report-dialog .rel-kpi.accent {
  border-color: var(--rdx-surface-border-focus);
  background: var(--rdx-surface-selected);
}

html .stats-modal-card.pos-dialog.rel-report-dialog :is(.rel-empty, .rel-loading) {
  border-radius: 14px;
}

html .stats-modal-card.pos-dialog.rel-report-dialog .rel-period-btn {
  color: var(--rdx-surface-accent);
  transition: var(--rdx-surface-transition);
}

html .stats-modal-card.pos-dialog.rel-report-dialog .rel-period-btn:hover:not(:disabled) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html .stats-modal-card.pos-dialog.rel-report-dialog .rel-period-btn:focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

/* .rel-table também é uma lista flexível no Relaciona; aqui é uma tabela HTML. */
html .stats-modal-card.pos-dialog.rel-report-dialog table.rel-table {
  display: table;
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  border: 0;
  border-radius: 0;
  overflow: visible;
}

html .stats-modal-card.pos-dialog.rel-report-dialog table.rel-table th {
  background: var(--rdx-surface-selected);
  color: var(--rdx-surface-accent);
}

html .stats-modal-card.pos-dialog.rel-report-dialog table.rel-table td {
  border-color: var(--rdx-surface-border);
}

html .stats-modal-card.pos-dialog.rel-report-dialog table.rel-table tbody tr:hover td {
  background: var(--rdx-surface-selected);
}

/* Nova/Editar O.S.: acabamento dos cadastros, restrito ao editor da O.S. */
html #app [data-os-editor] {
  border-color: var(--rdx-surface-border);
  background: var(--rdx-surface);
  color: var(--rdx-surface-ink);
  box-shadow: var(--rdx-surface-shadow);
}

html #app [data-os-editor] :is(
  .notas-page-field, .notas-draft-item, .notas-page-total-grid > div,
  .os-ed-checklist-box, .os-ed-pay-chip,
  .os-ed-outline-btn:not(.green, .danger),
  .notas-page-save:not(.os-ed-save-primary), .notas-draft-actions > button
) {
  border: 1px solid var(--rdx-surface-border);
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition);
}

html #app [data-os-editor] :is(
  h1, h2, .notas-page-field input, .notas-page-field textarea,
  .notas-draft-item strong, .notas-draft-item b,
  .notas-page-total-grid strong, .os-ed-pay-chip
) {
  color: var(--rdx-surface-ink);
}

html #app [data-os-editor] :is(
  .notas-page-field > span, .notas-draft-item > div > span,
  .notas-page-total-grid > div > span, .os-ed-hint
),
html #app [data-os-editor] :is(.notas-page-field input, .notas-page-field textarea)::placeholder {
  color: var(--rdx-surface-muted);
}

html #app [data-os-editor] :is(
  .os-ed-outline-btn:not(.green, .danger),
  .notas-page-save:not(.os-ed-save-primary), .notas-draft-actions > button
) {
  color: var(--rdx-surface-accent);
}

html #app [data-os-editor] .notas-page-field:hover:not(:focus-within):not(:has(input:disabled, textarea:disabled)),
html #app [data-os-editor] :is(
  .os-ed-outline-btn:not(.green, .danger),
  .notas-page-save:not(.os-ed-save-primary), .notas-draft-actions > button
):hover:not(:disabled):not(:focus-visible) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html #app [data-os-editor] .notas-page-field:focus-within {
  border-color: var(--rdx-surface-border-focus);
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html #app [data-os-editor] :is(
  .os-ed-outline-btn, .notas-page-back, .notas-page-save,
  .notas-draft-actions > button
):focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

/* Voltar preserva o vermelho compartilhado com as notas fiscais. */
html #app [data-os-editor] .notas-page-back {
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition);
}

html #app [data-os-editor] .os-ed-save-primary {
  border: 1px solid var(--rdx-surface-accent);
  box-shadow: var(--rdx-surface-shadow);
}

html #app [data-os-editor] .os-ed-pay-chip .icon {
  color: var(--rdx-surface-accent);
}

html #app [data-os-editor] input[type="datetime-local"] {
  color-scheme: light;
}

html[data-theme="dark"] #app [data-os-editor] input[type="datetime-local"] {
  color-scheme: dark;
}

/* Pop-ups da O.S., de Contas a Receber, do Caixa e de Vender, incluindo os seletores.
   O contexto da página limita o acabamento aos fluxos dessas abas. */
html body:has(.pos-page) .stats-modal-card.pos-item-edit-dialog,
html body:has(#app :is(.os-page, [data-os-editor], #cr-panel-body, .cash-page), .pos-page) .stats-modal-card.pos-dialog {
  --pop-surface: var(--rdx-surface);
  --pop-surface-alt: var(--rdx-surface);
  --pop-hover: var(--rdx-surface-hover);
  --pop-foot: var(--rdx-surface);
  --pop-border: var(--rdx-surface-border);
  --pop-border-soft: var(--rdx-surface-border);
  --pop-ink: var(--rdx-surface-ink);
  --pop-muted: var(--rdx-surface-muted);
  --pop-accent: var(--rdx-surface-accent);
  --pop-accent-soft: var(--rdx-surface-selected);
  --pop-close-ink: var(--rdx-surface-accent);
}

html body:has(#app :is(.os-page, [data-os-editor], #cr-panel-body, .cash-page), .pos-page) .stats-modal-card.pos-dialog :is(
  .stats-modal-field, .stats-filter-field, .stats-period-choice,
  .stats-option-tile, .os-pick-search-wrap, .os-event,
  .pos-dialog-search, .pos-picker-item, .pos-pay-row,
  .stats-modal-secondary, .stats-modal-danger:not(.prod-danger-btn)
) {
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition);
}

html body:has(#app :is(.os-page, [data-os-editor], #cr-panel-body, .cash-page), .pos-page) .stats-modal-card.pos-dialog :is(
  .stats-modal-field, .stats-filter-field, .stats-period-choice,
  .stats-option-tile, .os-pick-search-wrap, .pos-dialog-search,
  .pos-picker-item, .pos-pay-row, .stats-modal-secondary
):hover:not(:disabled):not(:focus-within):not(.selected, .has-value, .is-current) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html body:has(#app :is(.os-page, [data-os-editor], #cr-panel-body, .cash-page), .pos-page) .stats-modal-card.pos-dialog :is(
  .stats-modal-field, .os-pick-search-wrap, .pos-dialog-search, .pos-pay-row
):focus-within {
  border-color: var(--rdx-surface-border-focus);
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html body:has(#app :is(.os-page, [data-os-editor], #cr-panel-body, .cash-page), .pos-page) .stats-modal-card.pos-dialog :is(
  .stats-filter-field, .stats-period-choice, .stats-option-tile,
  .pos-picker-item, .stats-modal-secondary, .stats-modal-danger
):focus-visible {
  border-color: var(--rdx-surface-border-focus);
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 2px;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html body:has(#app :is(.os-page, [data-os-editor], #cr-panel-body, .cash-page), .pos-page) .stats-modal-card.pos-dialog :is(
  .stats-period-choice.selected, .stats-option-tile.selected, .pos-picker-item.selected
) {
  border-color: var(--rdx-surface-border-focus);
  background: var(--rdx-surface-selected);
}

/* Contas a Receber: cadastro, crédito, detalhe, pagamento e regras. */
html body:has(#app #cr-panel-body) .stats-modal-card.pos-dialog {
  border-radius: 24px;
}

html body:has(#app #cr-panel-body) .stats-modal-card.pos-dialog :is(
  .stats-modal-field, .stats-filter-field, .stats-option-tile:not(.danger),
  .cr-seg-btn, .stats-modal-foot > button
) {
  border-radius: 14px;
}

html body:has(#app #cr-panel-body) .stats-modal-card.pos-dialog :is(
  .cr-seg-btn, .cr-cust-summary, .cr-cust-name, .cr-cust-receive,
  .cr-cust-value, .cr-cust-actbtns > button, .crd-tile, .crd-person,
  .crd-plan, .crd-r-field input, .crd-r-field select, .rel-c-field textarea,
  .crd-r-option, .crd-r-example, .crd-stage, .rel-c-preview
) {
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition);
}

html body:has(#app #cr-panel-body) .stats-modal-card.pos-dialog :is(
  .cr-seg-btn:not(.active), .cr-cust-value, .cr-cust-actbtns > button,
  .crd-r-field input, .crd-r-field select, .rel-c-field textarea,
  .crd-r-option:not(.active)
):hover:not(:disabled):not(:focus-within) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html body:has(#app #cr-panel-body) .stats-modal-card.pos-dialog :is(
  .cr-cust-value, .crd-r-field input, .crd-r-field select, .rel-c-field textarea
):focus-within {
  border-color: var(--rdx-surface-border-focus);
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html body:has(#app #cr-panel-body) .stats-modal-card.pos-dialog :is(
  .cr-seg-btn, .cr-cust-actbtns > button, .crd-seg > button,
  .crd-add-btn, .crd-icon-btn, .crd-r-option, .rel-strategy-chip,
  .stats-modal-foot > button
):focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html body:has(#app #cr-panel-body) .stats-modal-card.pos-dialog :is(
  .cr-cust-actbtns > button, .cr-seg-btn.active, .cr-cust-tab.active
) {
  color: var(--rdx-surface-accent);
}

html body:has(#app #cr-panel-body) .stats-modal-card.finance-new-menu-dialog .stats-option-list {
  margin: -12px;
  padding: 12px 12px 24px;
}

html body:has(#app #cr-panel-body) .stats-modal-card.pos-dialog input[type="date"] {
  color-scheme: light;
}

html[data-theme="dark"] body:has(#app #cr-panel-body) .stats-modal-card.pos-dialog input[type="date"] {
  color-scheme: dark;
}

/* Caixa: abertura, lançamentos, conferência e detalhes dos movimentos. */
html body:has(#app .cash-page) .stats-modal-card.pos-dialog {
  border-radius: 24px;
}

html body:has(#app .cash-page) .stats-modal-card.pos-dialog :is(
  .cash-action-list button, .stats-filter-field, .stats-modal-foot > button
) {
  border-radius: 14px;
}

html body:has(#app .cash-page) .stats-modal-card.pos-dialog .stats-modal-field {
  border-radius: 14px !important;
}

html body:has(#app .cash-page) .stats-modal-card.pos-dialog :is(
  .cash-action-list button, .cash-close-table, .cash-sale-seller,
  .cash-sale-item, .cash-sale-notes p, .cash-entry-detail-amount,
  .cash-entry-detail-grid > div, .cash-entry-detail-lock
) {
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition);
}

html body:has(#app .cash-page) .stats-modal-card.pos-dialog .cash-action-list button:hover:not(:disabled):not(:focus-visible) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html body:has(#app .cash-page) .stats-modal-card.pos-dialog :is(
  .stats-modal-field, .cash-close-row input
):hover:not(:disabled):not(:focus-within) {
  border-color: var(--rdx-surface-border-hover) !important;
}

html body:has(#app .cash-page) .stats-modal-card.pos-dialog :is(
  .stats-modal-field, .cash-close-row input
):focus-within {
  border-color: var(--rdx-surface-border-focus) !important;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover) !important;
}

html body:has(#app .cash-page) .stats-modal-card.pos-dialog :is(
  .cash-action-list button, .stats-modal-foot > button, .cash-autofill
):focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html body:has(#app .cash-page) .stats-modal-card.pos-dialog.cash-close-dialog .cash-close-table {
  padding: 0;
}

html body:has(#app .cash-page) .stats-modal-card.pos-dialog.cash-close-dialog :is(
  .cash-close-head, .cash-close-row, .cash-close-total
) {
  padding-inline: 12px;
}

html body:has(#app .cash-page) .stats-modal-card.pos-dialog.cash-close-dialog .cash-close-head {
  background: var(--rdx-surface-selected);
  color: var(--rdx-surface-accent) !important;
}

html body:has(#app .cash-page) .stats-modal-card.pos-dialog.cash-close-dialog .cash-close-row input:not(:focus) {
  box-shadow: var(--rdx-surface-shadow) !important;
}

/* Vender: catálogo e resumo preservam o layout e os raios dos cards. */
html .pos-overlay .pos-page {
  --ink: var(--rdx-surface-ink);
  --muted: var(--rdx-surface-muted);
  --line: var(--rdx-surface-border);
  --card: var(--rdx-surface);
  --card-soft: var(--rdx-surface-selected);
  --card-hover: var(--rdx-surface-hover);
  --field: var(--rdx-surface);
  --blue: var(--rdx-surface-accent);
  --blue-rgb: 0, 113, 227;
  --blue-soft: var(--rdx-surface-selected);
}

html[data-theme="dark"] .pos-overlay .pos-page {
  --blue-rgb: 94, 168, 255;
}

html .pos-overlay .pos-page :is(
  .prod-search, .pos-search, .pos-tool-btn, .pos-cat-arrow,
  .pos-card, .pos-row, .pos-summary, .pos-client-btn, .pos-row-add,
  .pos-qty-btn, .pos-ghost-btn, .pos-finalize-btn,
  .pos-seller-card, .pos-theme, .pos-mb-more, .pos-mb-pay, .pos-empty
) {
  border: 1px solid var(--rdx-surface-border);
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition), transform 150ms ease;
}

html .pos-overlay .pos-page :is(
  .prod-search > .icon, .pos-search-ic, .pos-tool-btn, .pos-cat-arrow,
  .pos-client-btn, .pos-client-btn .icon, .pos-row-add,
  .pos-qty-btn, .pos-ghost-btn, .pos-seller-card > .icon, .pos-mb-more
) {
  color: var(--rdx-surface-accent);
}

html .pos-overlay .pos-page :is(
  .pos-tool-btn, .pos-client-btn, .pos-row-add, .pos-qty-btn,
  .pos-ghost-btn, .pos-finalize-btn, .pos-mb-more, .pos-mb-pay
) {
  border-radius: 14px;
}

html .pos-overlay .pos-page :is(
  .prod-search, .pos-search, .pos-tool-btn, .pos-cat-arrow,
  .pos-card, .pos-row, .pos-client-btn, .pos-row-add, .pos-qty-btn,
  .pos-ghost-btn, .pos-seller-card, .pos-theme, .pos-mb-more
):hover:not(:disabled):not(:focus-within) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html .pos-overlay .pos-page :is(.prod-search, .pos-search):focus-within {
  border-color: var(--rdx-surface-border-focus);
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html .pos-overlay .pos-page :is(
  .pos-tool-btn, .pos-cat-arrow, .pos-card, .pos-client-btn,
  .pos-row-add, .pos-qty-btn, .pos-ghost-btn, .pos-finalize-btn,
  .pos-seller-card, .pos-theme, .pos-mb-more, .pos-mb-pay
):focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html .pos-overlay .pos-page .pos-cat-chip {
  color: var(--rdx-surface-muted);
}

html .pos-overlay .pos-page .pos-cat-chip:is(:hover, .active) {
  color: var(--rdx-surface-accent);
}

html .pos-overlay .pos-page .pos-cat-chip.active {
  border-bottom-color: var(--rdx-surface-accent);
}

html .pos-overlay .pos-page :is(.pos-finalize-btn, .pos-mb-pay):not(:disabled) {
  border-color: var(--rdx-surface-accent);
  background: #1d1d1f;
  color: #ffffff;
}

html .pos-overlay .pos-page :is(.pos-finalize-btn, .pos-mb-pay):hover:not(:disabled) {
  background: #000000;
  box-shadow: var(--rdx-surface-shadow-hover);
}

html .pos-overlay .pos-page :is(.pos-finalize-btn, .pos-mb-pay):disabled {
  color: var(--rdx-surface-muted);
}

html .pos-overlay .pos-page .pos-empty {
  grid-column: 1 / -1;
  border-radius: 14px;
}

/* Os pop-ups do PDV continuam compartilhando a lógica de edição e pagamento. */
html body:has(.pos-page) .stats-modal-card:is(.pos-dialog, .pos-item-edit-dialog) {
  border-color: var(--rdx-surface-border);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html body:has(.pos-page) .stats-modal-card:is(.pos-dialog, .pos-item-edit-dialog) :is(
  .stats-modal-field, .stats-filter-field, .pos-item-edit-field,
  .pos-step-btn, .pos-stepper input, .pos-dialog-search, .pos-picker-item,
  .pos-pay-method, .pos-review-row, .pos-review-pay, .pos-option-row,
  .pos-client-btn, .pos-qty-btn, .pos-ghost-btn, .pos-finalize-btn,
  .trade-in-field input, .trade-in-field select, .trade-in-field textarea,
  .trade-in-rule, .notas-page-field
) {
  border: 1px solid var(--rdx-surface-border);
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition);
}

html body:has(.pos-page) .stats-modal-card:is(.pos-dialog, .pos-item-edit-dialog) :is(
  .stats-modal-field, .stats-filter-field, .pos-item-edit-field,
  .pos-step-btn, .pos-stepper input, .pos-dialog-search, .pos-pay-method,
  .pos-review-row, .pos-review-pay, .pos-client-btn, .pos-qty-btn,
  .pos-ghost-btn, .pos-finalize-btn, .stats-modal-foot > button,
  .trade-in-field input, .trade-in-field select, .trade-in-field textarea,
  .notas-page-field
) {
  border-radius: 14px !important;
}

html body:has(.pos-page) .stats-modal-card:is(.pos-dialog, .pos-item-edit-dialog) :is(
  .pos-item-edit-field, .pos-step-btn, .pos-review-row, .pos-review-pay,
  .pos-option-row, .pos-pay-method, .pos-client-btn, .pos-qty-btn, .pos-ghost-btn
):hover:not(:disabled):not(:focus-within):not(.active, .selected) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html body:has(.pos-page) .stats-modal-card:is(.pos-dialog, .pos-item-edit-dialog) :is(
  .pos-item-edit-field, .pos-stepper input, .trade-in-field input,
  .trade-in-field select, .trade-in-field textarea, .notas-page-field
):focus-within {
  border-color: var(--rdx-surface-border-focus);
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html body:has(.pos-page) .stats-modal-card.pos-dialog .pos-pay-method.active,
html body:has(.pos-page) .stats-modal-card.trade-in-dialog .trade-in-rule:not(.block):has(input:checked) {
  border-color: var(--rdx-surface-border-focus);
  background: var(--rdx-surface-selected);
}

html body:has(.pos-page) .stats-modal-card.trade-in-dialog .trade-in-rule:not(.block) input:checked + .trade-in-check {
  border-color: var(--rdx-surface-accent);
  background: var(--rdx-surface-accent);
  color: #ffffff;
}

html body:has(.pos-page) .stats-modal-card:is(.pos-dialog, .pos-item-edit-dialog) :is(
  .pos-client-btn, .pos-qty-btn, .pos-ghost-btn,
  .pos-step-btn, .pos-option-row .icon, .pos-pay-method .icon,
  .notas-select-caret
) {
  color: var(--rdx-surface-accent);
}

html body:has(.pos-page) .stats-modal-card:is(.pos-dialog, .pos-item-edit-dialog) :is(
  .pos-stepper input, .trade-in-field input,
  .trade-in-field select, .trade-in-field textarea
) {
  color: var(--rdx-surface-ink);
}

html body:has(.pos-page) .stats-modal-card.pos-dialog .pos-finalize-btn:not(:disabled) {
  border-color: var(--rdx-surface-accent);
  background: var(--pop-primary-bg);
  color: var(--pop-primary-ink);
}

html body:has(.pos-page) .stats-modal-card:is(.pos-dialog, .pos-item-edit-dialog) :is(
  .pos-step-btn, .pos-pay-method, .pos-review-row, .pos-qty-btn,
  .pos-ghost-btn, .pos-finalize-btn, .stats-modal-foot > button
):focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html body:has(.pos-page) .stats-modal-card.pos-item-edit-dialog .pos-item-edit-cancel {
  border: 1px solid var(--rdx-surface-border);
  background: var(--rdx-surface);
  color: var(--rdx-surface-accent);
  box-shadow: var(--rdx-surface-shadow);
}

/* Avaliar aparelho abre fora de #app e mantém a geometria própria da avaliação. */
html .trade-in-page-overlay .trade-in-evaluation-page .trade-in-evaluation-panel {
  border: 1px solid var(--rdx-surface-border);
  background: var(--rdx-surface);
  color: var(--rdx-surface-ink);
  box-shadow: var(--rdx-surface-shadow);
}

html .trade-in-page-overlay .trade-in-evaluation-page :is(
  .trade-in-field input, .trade-in-field select, .trade-in-field textarea,
  .notas-page-field, .trade-in-rule, .trade-in-empty-rules,
  .trade-in-page-loading, .trade-in-page-retry
) {
  border: 1px solid var(--rdx-surface-border);
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition);
}

html .trade-in-page-overlay .trade-in-evaluation-page :is(
  .trade-in-field input, .trade-in-field select, .trade-in-field textarea,
  .notas-page-field, .trade-in-page-loading, .trade-in-page-retry
) {
  border-radius: 14px;
}

html .trade-in-page-overlay .trade-in-evaluation-page :is(
  .trade-in-field input, .trade-in-field select, .trade-in-field textarea,
  .notas-page-field,
  .trade-in-field > label, .trade-in-rules-head b, .trade-in-rule-copy b,
  .trade-in-form > .notas-page-field > span:first-child,
  .notas-select-trigger, [data-notas-select-label]
) {
  color: var(--rdx-surface-ink);
}

html .trade-in-page-overlay :is(
  .trade-in-optional, .trade-in-suffix > span, .trade-in-rules-head span,
  .trade-in-rule-copy small, .trade-in-empty-rules, .trade-in-page-loading,
  .trade-in-page-retry p
),
html .trade-in-page-overlay .trade-in-field :is(input, textarea)::placeholder {
  color: var(--rdx-surface-muted);
}

html .trade-in-page-overlay .trade-in-evaluation-page :is(
  .trade-in-field input, .trade-in-field select, .trade-in-field textarea,
  .notas-page-field:not(.is-disabled), .trade-in-rule
):hover:not(:disabled):not(:focus-within):not(:has(input:checked)) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html .trade-in-page-overlay .trade-in-evaluation-page :is(
  .trade-in-field input, .trade-in-field select, .trade-in-field textarea,
  .notas-page-field
):focus-within,
html .trade-in-page-overlay .trade-in-rule:has(input:focus-visible) {
  border-color: var(--rdx-surface-border-focus);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html .trade-in-page-overlay .trade-in-rule:has(input:checked) {
  border-color: var(--rdx-surface-border-focus);
  background: var(--rdx-surface-selected);
}

html .trade-in-page-overlay .trade-in-check {
  border-color: var(--rdx-surface-border);
  background: var(--rdx-surface);
}

html .trade-in-page-overlay .trade-in-rule:not(.block) input:checked + .trade-in-check {
  border-color: var(--rdx-surface-accent);
  background: var(--rdx-surface-accent);
  color: #ffffff;
}

html .trade-in-page-overlay .trade-in-rule.block:has(input:checked) {
  border-color: var(--red, #e5484d);
  background: color-mix(in srgb, var(--red, #e5484d) 8%, var(--rdx-surface));
}

html .trade-in-page-overlay .trade-in-evaluation-page :is(.notas-select-caret, .sim-panel-head > .icon) {
  color: var(--rdx-surface-accent);
}

html .trade-in-page-overlay .trade-in-evaluation-page .sim-panel-head > .icon {
  border: 1px solid var(--rdx-surface-border);
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
}

html .trade-in-page-overlay .notas-select-pop {
  border-color: var(--rdx-surface-border);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html .trade-in-page-overlay .notas-select-option {
  color: var(--rdx-surface-ink);
}

html .trade-in-page-overlay .notas-select-option:is(:hover, .is-active) {
  background: var(--rdx-surface-selected);
  color: var(--rdx-surface-accent);
}

html .trade-in-page-overlay .trade-in-offer {
  border: 1px solid var(--rdx-surface-border);
  box-shadow: var(--rdx-surface-shadow);
}

html .trade-in-page-overlay .trade-in-eligibility.waiting {
  border: 1px solid var(--rdx-surface-border);
  background: var(--rdx-surface-selected);
  color: var(--rdx-surface-accent);
}

html .trade-in-page-overlay :is(.trade-in-page-loading, .trade-in-page-retry) {
  flex: 1;
  padding: 20px;
}

html .trade-in-page-overlay :is(.trade-in-page-footer .stats-modal-primary, [data-tools-trade-in]) {
  border: 1px solid var(--rdx-surface-accent);
  border-radius: 14px;
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition);
}

html .trade-in-page-overlay :is(.notas-select-option, .trade-in-page-footer > button, [data-tools-trade-in]):focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

/* CRM: centrais, conexão e diálogos na camada própria da central. */
html .main.rdx-crm-overlay .rdx-crm-page:not(.is-ready) {
  --crm-surface: var(--rdx-surface);
  --crm-soft: var(--rdx-surface-selected);
  --crm-line: var(--rdx-surface-border);
  --crm-text: var(--rdx-surface-ink);
  --crm-muted: var(--rdx-surface-muted);
  --crm-blue: var(--rdx-surface-accent);
  --crm-blue-soft: var(--rdx-surface-selected);
}

html .main.rdx-crm-overlay .rdx-crm-page:not(.is-ready) .rdx-crm-workspace {
  border-color: var(--rdx-surface-border);
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
}

html .main.rdx-crm-overlay .rdx-crm-page-header .rdx-crm-state {
  border-color: var(--rdx-surface-border);
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
  font-weight: 300;
}

html .main.rdx-crm-overlay .rdx-crm-page-header .rdx-crm-state:not(.online, .waiting, .error) {
  color: var(--rdx-surface-ink);
}

html .main.rdx-crm-overlay :is(.rdx-crm-eyebrow, .rdx-crm-create-mark) {
  color: var(--rdx-surface-accent);
}

html .main.rdx-crm-overlay :is(
  .rdx-crm-profile-card, .rdx-crm-create-profile, .rdx-crm-profile-name-card,
  .rdx-crm-shared-card, .rdx-crm-profile-empty, .rdx-crm-loader-card,
  .rdx-crm-error-card, .rdx-crm-secondary-button, .rdx-crm-legacy-link,
  .rdx-crm-search, .rdx-crm-conversation-search-field, .rdx-crm-filters button
) {
  border: 1px solid var(--rdx-surface-border);
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition), transform 150ms ease;
}

html .main.rdx-crm-overlay :is(.rdx-crm-loader-card, .rdx-crm-error-card) {
  box-sizing: border-box;
  padding: 24px;
  border-radius: 24px;
}

html .main.rdx-crm-overlay :is(
  .rdx-crm-secondary-button, .rdx-crm-legacy-link, .rdx-crm-search,
  .rdx-crm-conversation-search-field, .rdx-crm-filters button
) {
  border-radius: 14px;
  color: var(--rdx-surface-accent);
}

html .main.rdx-crm-overlay :is(.rdx-crm-profile-card, .rdx-crm-create-profile) {
  color: var(--rdx-surface-ink);
}

html .main.rdx-crm-overlay :is(
  .rdx-crm-profile-card, .rdx-crm-create-profile, .rdx-crm-secondary-button,
  .rdx-crm-legacy-link, .rdx-crm-filters button
):hover:not(:disabled):not(:focus-visible):not(.active, [aria-current="true"]) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html .main.rdx-crm-overlay :is(.rdx-crm-profile-card[aria-current="true"], .rdx-crm-filters button.active) {
  border-color: var(--rdx-surface-border-focus);
  background: var(--rdx-surface-selected);
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow);
}

html .main.rdx-crm-overlay :is(.rdx-crm-dialog-layer, .rdx-crm-popover) {
  --wa-panel: var(--rdx-surface);
  --wa-dialog: var(--rdx-surface);
  --wa-elevated: var(--rdx-surface);
  --wa-input: var(--rdx-surface);
  --wa-line: var(--rdx-surface-border);
  --wa-text: var(--rdx-surface-ink);
  --wa-muted: var(--rdx-surface-muted);
  --wa-icon: var(--rdx-surface-accent);
  --wa-accent: var(--rdx-surface-accent);
  --wa-hover: var(--rdx-surface-selected);
  --crm-surface: var(--rdx-surface);
  --crm-soft: var(--rdx-surface-selected);
  --crm-line: var(--rdx-surface-border);
  --crm-text: var(--rdx-surface-ink);
  --crm-muted: var(--rdx-surface-muted);
  --crm-blue: var(--rdx-surface-accent);
  --crm-blue-soft: var(--rdx-surface-selected);
}

html .main.rdx-crm-overlay :is(.rdx-crm-popover, .rdx-crm-new-chat, .rdx-crm-delete-dialog) {
  border-color: var(--rdx-surface-border);
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html .main.rdx-crm-overlay .rdx-crm-new-chat {
  border-radius: 24px;
}

html .main.rdx-crm-overlay .rdx-crm-new-chat > header {
  border-bottom: 1px solid var(--rdx-surface-border);
  background: var(--rdx-surface);
  box-shadow: none;
}

html .main.rdx-crm-overlay :is(
  .rdx-crm-primary-button, .rdx-crm-profile-name-save, .rdx-crm-group-submit
) {
  border: 1px solid var(--rdx-surface-accent);
  border-radius: 14px;
  background: #1d1d1f;
  color: #ffffff;
  box-shadow: var(--rdx-surface-shadow);
}

html .main.rdx-crm-overlay .rdx-crm-confirm-cancel {
  border: 1px solid var(--rdx-surface-border);
  border-radius: 14px;
  background: var(--rdx-surface);
  color: var(--rdx-surface-accent);
  box-shadow: var(--rdx-surface-shadow);
}

html .main.rdx-crm-overlay :is(
  .rdx-crm-profile-name-card, .rdx-crm-shared-card, .rdx-crm-dialog-layer
) :is(input:not([type="checkbox"], [type="radio"]), textarea, select) {
  border-color: var(--rdx-surface-border);
  border-radius: 14px;
  background: var(--rdx-surface);
  color: var(--rdx-surface-ink);
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition);
}

html .main.rdx-crm-overlay :is(.rdx-crm-search, .rdx-crm-conversation-search-field) input {
  background: transparent;
  color: var(--rdx-surface-ink);
  box-shadow: none;
}

html .main.rdx-crm-overlay :is(
  .rdx-crm-profile-name-card, .rdx-crm-shared-card, .rdx-crm-dialog-layer
) :is(input:not([type="checkbox"], [type="radio"]), textarea, select):focus,
html .main.rdx-crm-overlay :is(.rdx-crm-search, .rdx-crm-conversation-search-field):focus-within {
  border-color: var(--rdx-surface-border-focus);
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html .main.rdx-crm-overlay :is(
  .rdx-crm-profile-card, .rdx-crm-create-profile, .rdx-crm-profile-options,
  .rdx-crm-primary-button, .rdx-crm-secondary-button, .rdx-crm-profile-name-save,
  .rdx-crm-legacy-link, .rdx-crm-filters button, .rdx-crm-popover button,
  .rdx-crm-dialog-layer button
):focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

/* Configurações e ações das centrais usam os pop-ups compartilhados do app. */
html body:has(.rdx-crm-overlay) .stats-modal-card {
  --pop-surface: var(--rdx-surface);
  --pop-surface-alt: var(--rdx-surface);
  --pop-hover: var(--rdx-surface-hover);
  --pop-foot: var(--rdx-surface);
  --pop-border: var(--rdx-surface-border);
  --pop-border-soft: var(--rdx-surface-border);
  --pop-ink: var(--rdx-surface-ink);
  --pop-muted: var(--rdx-surface-muted);
  --pop-accent: var(--rdx-surface-accent);
  --pop-accent-soft: var(--rdx-surface-selected);
  --pop-close-ink: var(--rdx-surface-accent);
}

html body:has(.rdx-crm-overlay) .stats-modal-card:is(.crm-profile-settings-dialog, .crm-reactions-dialog) {
  border-color: var(--rdx-surface-border);
  background: var(--rdx-surface);
  color: var(--rdx-surface-ink);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html body:has(.rdx-crm-overlay) .crm-profile-settings-dialog :is(.stats-modal-head, .stats-modal-foot) {
  border-color: var(--rdx-surface-border);
  background: var(--rdx-surface);
}

html body:has(.rdx-crm-overlay) .crm-profile-settings-dialog :is(
  .stats-modal-head h3, .crm-profile-settings-copy strong,
  .crm-profile-settings-section h4, .crm-profile-settings-option strong
) {
  color: var(--rdx-surface-ink);
}

html body:has(.rdx-crm-overlay) .crm-profile-settings-dialog :is(
  .crm-profile-settings-copy p, .crm-profile-settings-option small
) {
  color: var(--rdx-surface-muted);
}

html body:has(.rdx-crm-overlay) :is(
  .crm-profile-settings-list, .crm-profile-settings-dialog .stats-modal-secondary,
  .crm-profile-actions-list .stats-option-tile
) {
  border: 1px solid var(--rdx-surface-border);
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition);
}

html body:has(.rdx-crm-overlay) .crm-profile-actions-list .stats-option-tile {
  color: var(--rdx-surface-ink);
}

html body:has(.rdx-crm-overlay) .crm-profile-actions-list .stats-option-tile:not(.danger) .icon {
  color: var(--rdx-surface-accent);
}

html body:has(.rdx-crm-overlay) .crm-profile-settings-option + .crm-profile-settings-option {
  border-color: var(--rdx-surface-border);
}

html body:has(.rdx-crm-overlay) :is(
  .crm-profile-settings-option:hover,
  .crm-profile-settings-dialog .stats-modal-secondary:hover,
  .crm-profile-actions-list .stats-option-tile:hover:not(:disabled)
) {
  background: var(--rdx-surface-selected);
}

html body:has(.rdx-crm-overlay) .crm-profile-settings-option input[type="checkbox"] {
  border-color: var(--rdx-surface-border-focus);
  background: var(--rdx-surface-selected);
}

html body:has(.rdx-crm-overlay) .crm-profile-settings-option input[type="checkbox"]:checked {
  border-color: var(--rdx-surface-accent);
  background: var(--rdx-surface-accent);
}

html body:has(.rdx-crm-overlay) .crm-profile-settings-dialog .stats-modal-close {
  border-color: var(--rdx-surface-border);
  background: var(--rdx-surface);
  color: var(--rdx-surface-accent);
}

html body:has(.rdx-crm-overlay) .crm-profile-settings-dialog .stats-modal-secondary {
  border-radius: 14px;
  color: var(--rdx-surface-accent);
}

html body:has(.rdx-crm-overlay) .crm-profile-settings-dialog .stats-modal-primary {
  border-color: var(--rdx-surface-accent);
  border-radius: 14px;
  background: #1d1d1f;
  color: #ffffff;
}

html body:has(.rdx-crm-overlay) .crm-profile-settings-dialog :is(button, input):focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html body:has(.rdx-crm-overlay) .crm-profile-settings-error {
  border-color: rgba(214, 48, 59, 0.25);
  background: rgba(214, 48, 59, 0.07);
  color: #b4232b;
}

html[data-theme="dark"] body:has(.rdx-crm-overlay) .crm-profile-settings-error {
  border-color: rgba(255, 117, 117, 0.35);
  background: rgba(255, 117, 117, 0.10);
  color: #ffb4b4;
}

/* Atraso por faixa abre fora de #app, na camada própria de Contas a Receber. */
html .crd-aging-overlay .crd-aging-page {
  --ink: var(--rdx-surface-ink);
  --muted: var(--rdx-surface-muted);
  --line: var(--rdx-surface-border);
  --card: var(--rdx-surface);
  --card-soft: var(--rdx-surface-selected);
}

html .crd-aging-overlay .crd-aging-page :is(
  .crd-ag-card, .sim-panel, .crd-ag-search,
  .crd-ag-toolbar .cred-btn, .crd-ag-scroll
) {
  border: 1px solid var(--rdx-surface-border);
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
}

html .crd-aging-overlay .crd-aging-page :is(
  .crd-ag-card, .crd-ag-search, .crd-ag-toolbar .cred-btn
) {
  transition: var(--rdx-surface-transition);
}

html .crd-aging-overlay .crd-aging-page :is(
  .crd-ag-search, .crd-ag-toolbar .cred-btn
) {
  height: 44px;
  border-radius: 14px;
}

html .crd-aging-overlay .crd-aging-page :is(
  .crd-ag-search > .icon, .crd-ag-toolbar .cred-btn, .crd-ag-card-label
) {
  color: var(--rdx-surface-accent);
}

html .crd-aging-overlay .crd-aging-page .crd-ag-toolbar .cred-btn {
  padding-block: 0;
  font-weight: 400;
}

html .crd-aging-overlay .crd-aging-page :is(
  .crd-ag-card:not(.active), .crd-ag-search, .crd-ag-toolbar .cred-btn
):hover:not(:disabled):not(:focus-within) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html .crd-aging-overlay .crd-aging-page .crd-ag-card.active {
  border-color: var(--rdx-surface-border-focus);
  background: var(--rdx-surface-selected);
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow);
}

html .crd-aging-overlay .crd-aging-page .crd-ag-search:focus-within {
  border-color: var(--rdx-surface-border-focus);
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html .crd-aging-overlay .crd-aging-page :is(.crd-ag-card, .crd-ag-toolbar .cred-btn):focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html .crd-aging-overlay .crd-aging-page .crd-ag-search input::placeholder {
  color: var(--rdx-surface-muted);
}

html .crd-aging-overlay .crd-aging-page .sim-panel-head > .icon {
  border: 1px solid var(--rdx-surface-border);
  background: var(--rdx-surface);
  color: var(--rdx-surface-accent);
  box-shadow: var(--rdx-surface-shadow);
}

html .crd-aging-overlay .crd-aging-page :is(.crd-ag-head, .crd-ag-total) {
  background: var(--rdx-surface-selected);
}

html .crd-aging-overlay .crd-aging-page .crd-ag-head {
  color: var(--rdx-surface-accent);
}

html .crd-aging-overlay .crd-aging-page .crd-ag-line {
  border-color: var(--rdx-surface-border);
}

html .crd-aging-overlay .crd-aging-page .crd-ag-line[data-crd-ag-line]:hover {
  background: var(--rdx-surface-selected);
}

html .crd-aging-overlay .crd-aging-page .crd-ag-line[data-crd-ag-line]:focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: -2px;
  background: var(--rdx-surface-selected);
}

html .stats-modal-card.os-checklist-dialog .os-checklist-list,
html .stats-modal-card.os-pick-dialog .os-pick-list {
  margin: -12px;
  padding: 12px 12px 24px;
  gap: 8px;
}

/* Mantém o recorte da lista abaixo da pesquisa, mesmo durante a rolagem. */
html .stats-modal-card.os-pick-dialog .os-pick-list {
  margin-top: 8px;
}

html .stats-modal-card.os-checklist-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: min(900px, calc(100dvh - 32px));
}

html .stats-modal-card.os-checklist-dialog :is(.stats-modal-head, .stats-modal-foot) {
  flex: 0 0 auto;
}

html .stats-modal-card.os-checklist-dialog .stats-modal-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

html .stats-modal-card.os-checklist-dialog .os-checklist-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

html .stats-modal-card.os-checklist-dialog .os-checklist-choice {
  flex: 0 0 auto;
  min-height: 44px;
}

html .stats-modal-card.os-checklist-dialog .os-checklist-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 16px;
  width: 16px;
  visibility: hidden;
}

html .stats-modal-card.os-checklist-dialog .os-checklist-choice.selected .os-checklist-mark {
  visibility: visible;
}

html .stats-modal-card.os-checklist-dialog .stats-modal-foot {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

html .stats-modal-card.os-checklist-dialog .stats-modal-foot > button {
  width: 100%;
  min-width: 0;
}

/* Editor de NF-e/NFC-e: campos, valores e ações no acabamento dos cadastros.
   O escopo evita atingir as outras telas que reutilizam classes notas-page. */
html #app [data-notas-editor-page] {
  border-color: var(--rdx-surface-border);
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
}

html #app [data-notas-editor-page] :is(
  .notas-page-field, .notas-page-total-card,
  .notas-draft-item:not(.pending-fiscal), .notas-page-add-btn,
  .notas-page-add-inline, .notas-page-add-payment, .notas-page-save
) {
  border: 1px solid var(--rdx-surface-border);
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition);
}

html #app [data-notas-editor-page] :is(.notas-page-field, .notas-page-total-card) {
  border-radius: 14px;
}

html #app [data-notas-editor-page] :is(.notas-page-add-btn, .notas-page-add-inline, .notas-page-add-payment, .notas-page-save),
html #app [data-notas-editor-page] :is(.notas-page-add-btn, .notas-page-add-inline, .notas-page-add-payment) .icon,
html #app [data-notas-editor-page] .notas-select-caret {
  color: var(--rdx-surface-accent);
}

html #app [data-notas-editor-page] :is(.notas-page-field, .notas-page-total-card.editable):hover:not(:focus-within):not(.is-disabled):not(:has(input:disabled, textarea:disabled)),
html #app [data-notas-editor-page] :is(.notas-page-add-btn, .notas-page-add-inline, .notas-page-add-payment, .notas-page-save):hover:not(:disabled):not(:focus-visible) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html #app [data-notas-editor-page] :is(.notas-page-field, .notas-page-total-card.editable):focus-within {
  border-color: var(--rdx-surface-border-focus);
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html #app [data-notas-editor-page] :is(
  .notas-page-field > span, .notas-page-field-hint, .notas-page-total-card > span
),
html #app [data-notas-editor-page] :is(.notas-page-field input, .notas-page-field textarea)::placeholder {
  color: var(--rdx-surface-muted);
}

html #app [data-notas-editor-page] :is(
  .notas-page-field input, .notas-page-field textarea,
  .notas-page-total-card input, .notas-page-total-card strong,
  .notas-select-trigger, .notas-select-trigger > span:not(.notas-select-caret)
) {
  color: var(--rdx-surface-ink);
}

html #app [data-notas-editor-page] .notas-page-field textarea {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 14px;
}

html #app [data-notas-editor-page] .notas-select-pop {
  border-color: var(--rdx-surface-border);
  border-radius: 18px;
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html #app [data-notas-editor-page] .notas-select-option {
  color: var(--rdx-surface-ink);
}

html #app [data-notas-editor-page] .notas-select-option:hover,
html #app [data-notas-editor-page] .notas-select-option.is-active {
  background: var(--rdx-surface-selected);
  color: var(--rdx-surface-accent);
}

html #app [data-notas-editor-page] :is(
  .notas-page-add-btn, .notas-page-add-inline, .notas-page-add-payment,
  .notas-page-save, .notas-page-send, .notas-page-back,
  .notas-page-remove-payment, .notas-select-option
):focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

/* Adicionar item fiscal, selecionar produto e preencher/editar item manual. */
html .stats-modal-card.notas-page-dialog {
  border-color: var(--rdx-surface-border);
  border-radius: 24px;
  background: var(--rdx-surface);
}

html .stats-modal-card.notas-page-dialog :is(.stats-modal-head, .stats-modal-foot) {
  border-color: var(--rdx-surface-border);
}

html .stats-modal-card.notas-page-dialog :is(
  .stats-option-tile, .stats-modal-field, .os-pick-search-wrap
) {
  border: 1px solid var(--rdx-surface-border);
  border-radius: 14px;
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition);
}

html .stats-modal-card.notas-page-dialog :is(
  .stats-option-tile, .stats-modal-field, .os-pick-search-wrap
):hover:not(:disabled):not(:focus-within) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html .stats-modal-card.notas-page-dialog :is(
  .stats-option-tile > span:not(.icon), .os-pick-price,
  .stats-modal-field input, .stats-modal-field select,
  .stats-modal-field textarea, .os-pick-search-wrap input
) {
  color: var(--rdx-surface-ink);
}

html .stats-modal-card.notas-page-dialog :is(
  .stats-modal-field span, .os-pick-tile small, .os-pick-empty
),
html .stats-modal-card.notas-page-dialog :is(.stats-modal-field input, .os-pick-search-wrap input)::placeholder {
  color: var(--rdx-surface-muted);
}

html .stats-modal-card.notas-page-dialog :is(.stats-option-tile, .os-pick-search-wrap) .icon {
  color: var(--rdx-surface-accent);
}

html .stats-modal-card.notas-page-dialog :is(.stats-modal-field, .os-pick-search-wrap):focus-within,
html .stats-modal-card.notas-page-dialog .stats-option-tile:focus-visible {
  border-color: var(--rdx-surface-border-focus);
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html .stats-modal-card.notas-page-dialog :is(.stats-option-tile, .stats-modal-foot > button, .stats-modal-close):focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
}

html .stats-modal-card.notas-page-dialog .stats-modal-close {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rdx-surface-border);
  border-radius: 10px;
  background: var(--rdx-surface);
  color: var(--rdx-surface-accent);
}

/* As sombras entram na área de rolagem, sem recorte na borda dos botões. */
html .stats-modal-card.notas-page-choice-dialog .stats-option-list {
  overflow: visible;
}

html .stats-modal-card.notas-page-picker-dialog .os-pick-list {
  max-height: min(calc(56vh + 36px), 556px);
  margin: 0 -14px -14px;
  padding: 12px 14px 24px;
  gap: 8px;
}

/* Novo/Editar conta a pagar: acabamento restrito ao formulário financeiro. */
html .stats-modal-card.pos-dialog.finance-new-dialog:has(#cp-new-desc) {
  --pop-surface: var(--rdx-surface);
  --pop-surface-alt: var(--rdx-surface);
  --pop-hover: var(--rdx-surface-hover);
  --pop-foot: var(--rdx-surface);
  --pop-border: var(--rdx-surface-border);
  --pop-border-soft: var(--rdx-surface-border);
  --pop-ink: var(--rdx-surface-ink);
  --pop-muted: var(--rdx-surface-muted);
  --pop-accent: var(--rdx-surface-accent);
  --pop-accent-soft: var(--rdx-surface-selected);
  --pop-close-ink: var(--rdx-surface-accent);
  border-radius: 24px;
}

html .stats-modal-card.pos-dialog.finance-new-dialog:has(#cp-new-desc) :is(
  .stats-modal-field, .stats-filter-field,
  .stats-modal-foot > .stats-modal-danger
) {
  border-radius: 14px;
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition);
}

html .stats-modal-card.pos-dialog.finance-new-dialog:has(#cp-new-desc) :is(
  .stats-modal-field, .stats-filter-field,
  .stats-modal-foot > .stats-modal-danger
):hover:not(:disabled):not(:focus-within) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html .stats-modal-card.pos-dialog.finance-new-dialog:has(#cp-new-desc) .stats-modal-field:focus-within {
  border-color: var(--rdx-surface-border-focus);
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html .stats-modal-card.pos-dialog.finance-new-dialog:has(#cp-new-desc) :is(
  .stats-filter-field, .stats-modal-foot > button, .cp-inst-remove
):focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html .stats-modal-card.pos-dialog.finance-new-dialog:has(#cp-new-desc) .stats-modal-foot > button {
  border-radius: 14px;
}

html .stats-modal-card.pos-dialog.finance-new-dialog:has(#cp-new-desc) .cp-recdot.on {
  background: var(--rdx-surface-accent);
}

html .stats-modal-card.pos-dialog.finance-new-dialog:has(#cp-new-desc) input[type="date"] {
  color-scheme: light;
}

html[data-theme="dark"] .stats-modal-card.pos-dialog.finance-new-dialog:has(#cp-new-desc) input[type="date"] {
  color-scheme: dark;
}

/* Categoria financeira: respiro uniforme entre nome, tipo e chave Ativa. */
html .stats-modal-root .stats-modal-card.rdx-project-popover.stats-filter-dialog:has(#cp-cat-name) .stats-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

html .stats-modal-root .stats-modal-card.rdx-project-popover.stats-filter-dialog:has(#cp-cat-name) .stats-modal-body > :is(
  .stats-modal-field, .cp-entryexit, .stats-filter-field
) {
  flex-shrink: 0;
  margin: 0;
}

html .stats-modal-root .stats-modal-card.rdx-project-popover.stats-filter-dialog:has(#cp-cat-name) .stats-modal-foot {
  gap: 10px;
  padding: 12px 16px 16px;
}

/* Novo/Editar fornecedor: campos e chaves no mesmo acabamento dos cadastros. */
html .stats-modal-card.pos-dialog.catalog-supplier-dialog {
  border-color: var(--rdx-surface-border);
  border-radius: 24px;
}

html .stats-modal-card.pos-dialog.catalog-supplier-dialog :is(
  .stats-modal-field, .prod-toggle-row[data-toggle-row],
  .stats-modal-foot > .stats-modal-danger
) {
  border: 1px solid var(--rdx-surface-border);
  border-radius: 14px;
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition);
}

html .stats-modal-card.pos-dialog.catalog-supplier-dialog .prod-toggle-row[data-toggle-row] {
  min-height: 49px;
  padding: 0 12px;
}

html .stats-modal-card.pos-dialog.catalog-supplier-dialog :is(
  .stats-modal-field, .prod-toggle-row[data-toggle-row],
  .stats-modal-foot > .stats-modal-danger
):hover:not(:focus-within):not(:disabled) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html .stats-modal-card.pos-dialog.catalog-supplier-dialog :is(
  .stats-modal-field, .prod-toggle-row[data-toggle-row]
):focus-within {
  border-color: var(--rdx-surface-border-focus);
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html .stats-modal-card.pos-dialog.catalog-supplier-dialog .stats-modal-foot > button {
  border-radius: 14px;
}

html .stats-modal-card.pos-dialog.catalog-supplier-dialog .stats-modal-foot > button:focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

/* Novo/Editar cliente, incluindo os campos das seções expansíveis. */
html .stats-modal-card.pos-dialog.client-form-dialog {
  border-color: var(--rdx-surface-border);
  border-radius: 24px;
}

html .stats-modal-card.pos-dialog.client-form-dialog :is(
  .stats-modal-field, .client-form-toggle,
  .stats-modal-foot > .stats-modal-danger
) {
  border: 1px solid var(--rdx-surface-border);
  border-radius: 14px;
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition);
}

html .stats-modal-card.pos-dialog.client-form-dialog .client-form-toggle {
  min-height: 49px;
  padding: 8px 12px;
}

/* CPF e É empresa dividem a mesma altura útil da linha. O espaço externo
   fica na linha para que as margens do campo não reduzam a altura do botão. */
html .stats-modal-card.pos-dialog.client-form-dialog .client-document-row {
  align-items: stretch;
  padding-block: 8px 16px;
}

html .stats-modal-card.pos-dialog.client-form-dialog .client-document-row > :is(.stats-modal-field, .client-form-toggle) {
  align-self: stretch;
  margin-block: 0;
}

@media (max-width: 940px) {
  html .stats-modal-card.pos-dialog.client-form-dialog .client-form-toggle {
    min-height: 52px;
  }
}

html .stats-modal-card.pos-dialog.client-form-dialog .client-section-toggle {
  min-height: 40px;
  padding: 8px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--rdx-surface-ink);
  box-shadow: none;
}

html .stats-modal-card.pos-dialog.client-form-dialog .client-section-toggle > .icon {
  display: none;
}

html .stats-modal-card.pos-dialog.client-form-dialog :is(
  .stats-modal-field:not(.client-form-field-error), .client-form-toggle,
  .stats-modal-foot > .stats-modal-danger
):hover:not(:disabled):not(:focus-within):not(.on) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html .stats-modal-card.pos-dialog.client-form-dialog .client-form-toggle.on {
  border-color: var(--rdx-surface-border-focus);
  background: var(--rdx-surface-selected);
}

html .stats-modal-card.pos-dialog.client-form-dialog .stats-modal-field:not(.client-form-field-error):focus-within,
html .stats-modal-card.pos-dialog.client-form-dialog :is(.client-form-toggle, .stats-modal-foot > button):focus-visible {
  border-color: var(--rdx-surface-border-focus);
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html .stats-modal-card.pos-dialog.client-form-dialog .stats-modal-field.client-form-field-error {
  border-color: var(--pop-danger);
  box-shadow: 0 0 0 2px var(--pop-danger-bg);
}

html .stats-modal-card.pos-dialog.client-form-dialog .stats-modal-foot > button {
  border-radius: 14px;
}

html .stats-modal-card.pos-dialog.client-form-dialog :is(.client-form-toggle, .client-section-toggle, .stats-modal-foot > button):focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
}

html .stats-modal-card.pos-dialog.client-form-dialog .client-section-toggle:hover {
  color: var(--rdx-surface-accent);
}

html .stats-modal-card.pos-dialog.client-form-dialog .client-registration-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--rdx-surface-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

html .stats-modal-card.pos-dialog.client-form-dialog .client-registration-trigger > [data-client-registration-label] {
  color: var(--rdx-surface-ink);
  font-size: 14px;
}

html .stats-modal-card.pos-dialog.client-form-dialog .client-registration-trigger > .icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  color: var(--rdx-surface-accent);
}

html .stats-modal-card.pos-dialog.client-form-dialog .client-registration-trigger:focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
}

/* Composição da campanha: mensagem, personalização, imagem e destinatários. */
html .stats-modal-card.pos-dialog.rel-campaign-dialog {
  border-color: var(--rdx-surface-border);
  border-radius: 24px;
}

html .stats-modal-card.pos-dialog.rel-campaign-dialog :is(
  .rel-c-field > textarea, .rel-c-field > input, .rel-referral-config,
  .rel-token, .rel-btn, .rel-strategy-chip, .rel-c-media-card,
  .rel-c-preview, .rel-c-recipients, .stats-modal-foot > .stats-modal-secondary
) {
  border: 1px solid var(--rdx-surface-border);
  border-radius: 14px;
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition);
}

html .stats-modal-card.pos-dialog.rel-campaign-dialog :is(
  .rel-token, .rel-btn:not(.ai), .rel-strategy-chip
) {
  color: var(--rdx-surface-accent);
}

html .stats-modal-card.pos-dialog.rel-campaign-dialog :is(
  .rel-c-field > textarea, .rel-c-field > input, .rel-token,
  .rel-btn, .rel-strategy-chip, .stats-modal-foot > .stats-modal-secondary
):hover:not(:disabled):not(.active):not(:focus-within) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
  transform: none;
}

html .stats-modal-card.pos-dialog.rel-campaign-dialog .rel-strategy-chip.active {
  border-color: var(--rdx-surface-border-focus);
  background: var(--rdx-surface-selected);
}

html .stats-modal-card.pos-dialog.rel-campaign-dialog :is(.rel-c-field > textarea, .rel-c-field > input):focus,
html .stats-modal-card.pos-dialog.rel-campaign-dialog :is(.rel-token, .rel-btn, .rel-strategy-chip, .stats-modal-foot > button):focus-visible {
  border-color: var(--rdx-surface-border-focus);
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html .stats-modal-card.pos-dialog.rel-campaign-dialog :is(.rel-token, .rel-btn, .rel-strategy-chip, .stats-modal-foot > button):focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
}

html .stats-modal-card.pos-dialog.rel-campaign-dialog :is(.rel-c-preview, .rel-c-recipients, .rel-c-media-card) {
  border-radius: 16px;
}

html .stats-modal-card.pos-dialog.rel-campaign-dialog .rel-c-preview-label {
  color: var(--rdx-surface-muted);
}

html .stats-modal-card.pos-dialog.rel-campaign-dialog .rel-c-rhead {
  background: transparent;
}

html .stats-modal-card.pos-dialog.rel-campaign-dialog .rel-c-rcpt:has(input:checked):not(.is-disabled) {
  background: var(--rdx-surface-selected);
}

html .stats-modal-card.pos-dialog.rel-campaign-dialog .stats-modal-foot > button {
  border-radius: 14px;
}

/* Jornada do cliente: resumos, informações e ícones da linha do tempo. */
html .stats-modal-card.pos-dialog.rel-journey-dialog {
  border-color: var(--rdx-surface-border);
  border-radius: 24px;
}

html .stats-modal-card.pos-dialog.rel-journey-dialog :is(
  .rel-j-tile, .rel-j-facts, .rel-t-dot,
  .stats-modal-foot > .stats-modal-secondary
) {
  border: 1px solid var(--rdx-surface-border);
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition);
}

html .stats-modal-card.pos-dialog.rel-journey-dialog :is(.rel-j-tile, .rel-j-facts) {
  border-radius: 16px;
}

html .stats-modal-card.pos-dialog.rel-journey-dialog .rel-j-fact + .rel-j-fact {
  border-top-color: var(--rdx-surface-border);
}

html .stats-modal-card.pos-dialog.rel-journey-dialog .rel-t-item::before {
  background: var(--rdx-surface-border);
}

html .stats-modal-card.pos-dialog.rel-journey-dialog .rel-t-item:not(.is-send, .is-returned) .rel-t-dot,
html .stats-modal-card.pos-dialog.rel-journey-dialog .stats-modal-foot > .stats-modal-secondary {
  color: var(--rdx-surface-accent);
}

html .stats-modal-card.pos-dialog.rel-journey-dialog .stats-modal-foot > button {
  border-radius: 14px;
}

html .stats-modal-card.pos-dialog.rel-journey-dialog .stats-modal-foot > .stats-modal-secondary:hover:not(:disabled):not(:focus-visible) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html .stats-modal-card.pos-dialog.rel-journey-dialog .stats-modal-foot > button:focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

/* Regras das campanhas neste computador. */
html .stats-modal-card.pos-dialog.rel-settings-dialog {
  border-color: var(--rdx-surface-border);
  border-radius: 24px;
}

html .stats-modal-card.pos-dialog.rel-settings-dialog :is(
  .rel-s-input, .rel-s-field.wide > input, .rel-chip,
  .stats-modal-foot > .stats-modal-secondary
) {
  border: 1px solid var(--rdx-surface-border);
  border-radius: 14px;
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition);
}

html .stats-modal-card.pos-dialog.rel-settings-dialog :is(.rel-chip, .stats-modal-secondary) {
  color: var(--rdx-surface-accent);
}

html .stats-modal-card.pos-dialog.rel-settings-dialog :is(
  .rel-s-input, .rel-s-field.wide > input, .rel-chip,
  .stats-modal-foot > .stats-modal-secondary
):hover:not(:disabled):not(.active):not(:focus-within) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html .stats-modal-card.pos-dialog.rel-settings-dialog .rel-chip.active {
  border-color: var(--rdx-surface-border-focus);
  background: var(--rdx-surface-selected);
  color: var(--rdx-surface-accent);
}

html .stats-modal-card.pos-dialog.rel-settings-dialog .rel-s-input:focus-within,
html .stats-modal-card.pos-dialog.rel-settings-dialog .rel-s-field.wide > input:focus,
html .stats-modal-card.pos-dialog.rel-settings-dialog :is(.rel-chip, .stats-modal-foot > button):focus-visible {
  border-color: var(--rdx-surface-border-focus);
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html .stats-modal-card.pos-dialog.rel-settings-dialog .stats-modal-foot > button {
  border-radius: 14px;
}

html .stats-modal-card.pos-dialog.rel-settings-dialog :is(.rel-chip, .stats-modal-foot > button):focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
}

/* Nova compra / Importar XML: mesma superfície, mantendo a grade das tabelas. */
html #app [data-purchase-form-page] :is(
  .pu-field-wrap, .pu-card, .pu-totals-wrap, .pu-card .prod-input,
  .pu-import-xml, .prod-tool-btn, .prod-icon-btn
) {
  border: 1px solid var(--rdx-surface-border) !important;
  border-radius: 14px !important;
  background: var(--rdx-surface) !important;
  box-shadow: var(--rdx-surface-shadow) !important;
  transition: var(--rdx-surface-transition);
}

html #app [data-purchase-form-page] :is(
  .pu-field-wrap, .pu-card .prod-input, .pu-import-xml,
  .prod-tool-btn, .prod-icon-btn
):hover:not(:disabled):not(:focus-within):not(:has(> input:disabled)) {
  border-color: var(--rdx-surface-border-hover) !important;
  background: var(--rdx-surface-hover) !important;
  box-shadow: var(--rdx-surface-shadow-hover) !important;
}

html #app [data-purchase-form-page] .pu-field-wrap:focus-within,
html #app [data-purchase-form-page] .pu-card .prod-input:focus,
html #app [data-purchase-form-page] :is(.prod-tool-btn, .prod-icon-btn):focus-visible {
  border-color: var(--rdx-surface-border-focus) !important;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover) !important;
}

html #app [data-purchase-form-page] :is(.prod-tool-btn, .pu-import-xml) {
  color: var(--rdx-surface-accent) !important;
}

/* Baixar XML e Meus CNPJs são modais próprios, fora do contêiner #app. */
html .stats-modal-card.pos-dialog:has(#xml-documents, [data-xml-cnpj]) {
  border-color: var(--rdx-surface-border);
  border-radius: 24px;
}

html .stats-modal-card.pos-dialog:has(#xml-documents, [data-xml-cnpj]) :is(
  .prod-input, .prod-tool-btn, .xml-status-filter
) {
  border: 1px solid var(--rdx-surface-border) !important;
  border-radius: 14px !important;
  background: var(--rdx-surface) !important;
  box-shadow: var(--rdx-surface-shadow) !important;
  transition: var(--rdx-surface-transition);
}

html .stats-modal-card.pos-dialog:has(#xml-documents, [data-xml-cnpj]) :is(
  .prod-tool-btn, .xml-status-filter
) {
  color: var(--rdx-surface-accent) !important;
}

html .stats-modal-card.pos-dialog:has(#xml-documents, [data-xml-cnpj]) :is(
  .prod-input, .prod-tool-btn, .xml-status-filter
):hover:not(:disabled):not(.active):not(:focus-visible) {
  border-color: var(--rdx-surface-border-hover) !important;
  background: var(--rdx-surface-hover) !important;
  box-shadow: var(--rdx-surface-shadow-hover) !important;
}

html .stats-modal-card.pos-dialog:has(#xml-documents, [data-xml-cnpj]) .xml-status-filter.active {
  border-color: var(--rdx-surface-border-focus) !important;
  background: var(--rdx-surface-selected) !important;
}

html .stats-modal-card.pos-dialog:has(#xml-documents, [data-xml-cnpj]) .prod-input:focus,
html .stats-modal-card.pos-dialog:has(#xml-documents, [data-xml-cnpj]) :is(.prod-tool-btn, .xml-status-filter):focus-visible {
  border-color: var(--rdx-surface-border-focus) !important;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover) !important;
}

html .stats-modal-card.pos-dialog:has(#xml-documents, [data-xml-cnpj]) :is(.prod-tool-btn, .xml-status-filter):focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
}

html .stats-modal-card.pos-dialog:has(#xml-documents) #xml-documents > div {
  margin-top: 10px;
  padding: 14px !important;
  border: 1px solid var(--rdx-surface-border) !important;
  border-radius: 14px;
  background: var(--rdx-surface);
  box-shadow: var(--rdx-surface-shadow);
}

/* Gatilhos de filtros e períodos, incluindo os filtros rápidos das listas. */
html #app :is(
  .prod-toolbar .prod-tool-btn, .prod-toolbar .prod-btn-new,
  .clients-desktop-controls .prod-tool-btn,
  .clients-desktop-controls .prod-btn-new,
  .vendas-toolbar .vendas-pill:not(.cp-pay-btn),
  .stats-action-card, .stats-tab, .vendas-tab, .cp-statuspill,
  .client-filter-chip, .client-db-filter, .clients-mobile-filter,
  .cash-hero-action, .rel-period-btn
) {
  border: 1px solid var(--rdx-surface-border);
  background: var(--rdx-surface);
  color: var(--rdx-surface-accent);
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition);
}

/* Só os filtros menores, equivalentes a NF-e/NFC-e, compartilham esta curva.
   Cards, abas principais e barras de ações preservam seus raios próprios. */
html #app :is(
  .vendas-tabs .vendas-tab,
  .cp-statusrow .cp-statuspill,
  .client-filter-chip,
  .client-db-controls .client-db-filter
) {
  border-radius: 14px;
}

html #app :is(.stats-action-card, .cash-hero-action) :is(span, small) {
  color: var(--rdx-surface-muted);
}

html #app :is(.stats-action-card, .cash-hero-action) :is(b, strong) {
  color: var(--rdx-surface-ink);
}

html #app :is(.stats-action-card, .cash-hero-action) .icon {
  color: var(--rdx-surface-accent);
}

html #app :is(
  .prod-toolbar .prod-tool-btn, .prod-toolbar .prod-btn-new,
  .clients-desktop-controls .prod-tool-btn,
  .clients-desktop-controls .prod-btn-new,
  .vendas-toolbar .vendas-pill:not(.cp-pay-btn),
  .stats-action-card, .stats-tab, .vendas-tab, .cp-statuspill,
  .client-filter-chip, .client-db-filter, .clients-mobile-filter,
  .cash-hero-action, .rel-period-btn
):hover:not(:disabled):not(.active, [aria-expanded="true"]) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
  transform: none;
}

html #app :is(
  .stats-tab, .vendas-tab, .cp-statuspill, .client-filter-chip,
  .client-db-filter, .vendas-toolbar .vendas-pill:not(.cp-pay-btn)
).active,
html #app :is(.stats-action-card, .prod-tool-btn)[aria-expanded="true"] {
  border-color: var(--rdx-surface-border-focus);
  background: var(--rdx-surface-selected);
  color: var(--rdx-surface-accent);
}

html #app :is(
  .prod-tool-btn, .prod-btn-new, .vendas-pill:not(.cp-pay-btn),
  .stats-action-card, .stats-tab, .vendas-tab, .cp-statuspill,
  .client-filter-chip, .client-db-filter, .clients-mobile-filter,
  .cash-hero-action, .rel-period-btn, .rep-card
):focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 3px;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

/* Contas a Receber: separação entre o destaque e o painel financeiro. */
html #app .cp-page > .cp-hero + .cp-panel {
  margin-top: 20px;
}

/* Preserva a curva anterior dos cards de navegação das páginas. */
html #app .stats-page .stats-tabs .stats-tab {
  border-radius: 20px;
}

/* Folga dentro da área rolável para a sombra das abas não ser recortada.
   As margens compensam essa folga e preservam a posição da linha. */
@media (min-width: 941px) {
  html #app .stats-page .stats-tabs:not(.crediario-section-tabs, .clients-subtabs) {
    height: auto;
    margin: -4px -24px -30px;
    padding: 24px 24px 36px;
  }

  /* Mantém 20px após os botões sem recortar a sombra das abas financeiras. */
  html #app .cp-page > .stats-tabs.cp-maintabs {
    margin-bottom: -16px;
  }

  html #app .clients-page .clients-subtabs {
    height: auto;
    padding-block: 8px;
    overflow: visible;
  }
}

@media (max-width: 940px) {
  html #app .stats-page .stats-tabs:not(.crediario-section-tabs) {
    height: auto;
    margin: 1px -14px -31px;
    padding: 16px 14px 36px;
  }

  html #app .stats-page .stats-tabs.cp-maintabs {
    margin-bottom: -17px;
  }
}

/* O Caixa usa a mesma navegação em um contêiner próprio. */
html #app .cash-page .cash-tabs {
  height: auto;
  min-height: 0;
  margin: -14px -24px -26px;
  padding: 24px 24px 36px;
}

@media (max-width: 940px) {
  html #app .cash-page .cash-tabs {
    margin: -12px -14px -24px;
    padding-inline: 14px;
  }
}

/* Os pop-ups continuam usando a posição, rolagem e fechamento compartilhados. */
html .stats-modal-root .stats-modal-card.rdx-project-popover:is(
  .stats-filter-dialog, .stats-period-dialog, .stats-option-dialog
):not(.pos-dialog) {
  border-color: var(--rdx-surface-border);
  border-radius: 20px;
  background: var(--rdx-surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

html[data-theme="dark"] .stats-modal-root .stats-modal-card.rdx-project-popover:is(
  .stats-filter-dialog, .stats-period-dialog, .stats-option-dialog
):not(.pos-dialog) {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
}

html .stats-modal-root .stats-modal-card.rdx-project-popover:is(
  .stats-filter-dialog, .stats-period-dialog, .stats-option-dialog
):not(.pos-dialog) .stats-modal-body {
  padding: 12px;
}

html .stats-modal-root .stats-modal-card.rdx-project-popover:is(
  .stats-filter-dialog, .stats-period-dialog, .stats-option-dialog
):not(.pos-dialog) :is(
  .stats-filter-field, .stats-modal-field, .stats-option-tile:not(.danger),
  .stats-option-tile[data-os-action="cancel"],
  .stats-option-tile[data-os-action="undoCash"],
  .stats-option-tile[data-os-action="undoStock"],
  .stats-option-tile[data-cra="delete"],
  .stats-period-choice, .prod-toggle-row, .stats-option-search-card,
  .stats-modal-clear, .notas-status-chip
) {
  border: 1px solid var(--rdx-surface-border);
  border-radius: 14px;
  background: var(--rdx-surface);
  color: var(--rdx-surface-ink);
  box-shadow: var(--rdx-surface-shadow);
  transition: var(--rdx-surface-transition);
}

html .stats-modal-root .stats-modal-card.rdx-project-popover:is(
  .stats-filter-dialog, .stats-period-dialog, .stats-option-dialog
):not(.pos-dialog) :is(
  .stats-filter-field, .stats-modal-field, .stats-option-tile:not(.danger),
  .stats-option-tile[data-os-action="cancel"],
  .stats-option-tile[data-os-action="undoCash"],
  .stats-option-tile[data-os-action="undoStock"],
  .stats-option-tile[data-cra="delete"],
  .stats-period-choice, .stats-option-search-card, .stats-modal-clear,
  .notas-status-chip
):hover:not(:disabled):not(.selected, .is-selected, .is-current, .has-value) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
  transform: none;
}

html .stats-modal-root .stats-modal-card.rdx-project-popover:is(
  .stats-filter-dialog, .stats-period-dialog, .stats-option-dialog
):not(.pos-dialog) :is(.stats-period-choice-list, .stats-option-list) {
  gap: 8px;
}

/* A área rolável precisa incluir a sombra, não começar na borda dos cards.
   Mantém os 320px úteis da lista e o alinhamento com os demais campos. */
html .stats-modal-root .stats-modal-card.rdx-project-popover:is(
  .stats-filter-dialog, .stats-period-dialog, .stats-option-dialog
):not(.pos-dialog) .stats-option-list {
  max-height: 356px;
  margin: -12px -12px -12px;
  padding: 12px 12px 24px;
}

html .stats-modal-root .stats-modal-card.rdx-project-popover.stats-filter-dialog:not(.pos-dialog) .prod-toggle-row {
  padding: 10px 12px;
}

html .stats-modal-root .stats-modal-card.rdx-project-popover:is(
  .stats-filter-dialog, .stats-period-dialog, .stats-option-dialog
):not(.pos-dialog) :is(
  .stats-period-choice.selected, .stats-period-choice.is-selected,
  .stats-option-tile.selected, .stats-option-tile.is-current,
  .notas-status-chip.selected, .stats-filter-field.has-value
) {
  border-color: var(--rdx-surface-border-focus);
  background: var(--rdx-surface-selected);
  color: var(--rdx-surface-accent);
}

html .stats-modal-root .stats-modal-card.rdx-project-popover:is(
  .stats-filter-dialog, .stats-period-dialog, .stats-option-dialog
):not(.pos-dialog) :is(
  .stats-option-tile.selected, .stats-option-tile.is-current,
  .notas-status-chip.selected
) > :is(span, .icon) {
  color: inherit;
}

html .stats-modal-root .stats-modal-card.rdx-project-popover:is(
  .stats-filter-dialog, .stats-period-dialog, .stats-option-dialog
):not(.pos-dialog) :is(.stats-filter-field, .stats-option-tile:not(.danger)) > .icon {
  color: var(--rdx-surface-accent);
}

html .stats-modal-root .stats-modal-card.rdx-project-popover:is(
  .stats-filter-dialog, .stats-period-dialog, .stats-option-dialog
):not(.pos-dialog) :is(.stats-filter-field, .stats-period-choice, .stats-option-tile, .notas-status-chip, .stats-modal-clear):focus-visible,
html .stats-modal-root .stats-modal-card.rdx-project-popover:is(
  .stats-filter-dialog, .stats-period-dialog, .stats-option-dialog
):not(.pos-dialog) :is(.stats-modal-field, .stats-option-search-card):focus-within {
  border-color: var(--rdx-surface-border-focus);
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 2px;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

html .stats-modal-root .stats-modal-card.rdx-project-popover:is(
  .stats-filter-dialog, .stats-period-dialog, .stats-option-dialog
):not(.pos-dialog) .stats-modal-foot {
  background: transparent;
}

html .stats-modal-root .stats-modal-card.rdx-project-popover:is(
  .stats-filter-dialog, .stats-period-dialog, .stats-option-dialog
):not(.pos-dialog) .stats-modal-foot > button {
  border-radius: 14px;
}

/* Notificações: o rodapé inteiro é o "Dispensar todas", de borda a borda,
   separado da lista só pelo traço fino. Os cantos de baixo vêm do card, que
   já recorta o conteúdo (overflow: hidden). */
html .stats-modal-root .stats-modal-card.rdx-project-popover.notif-panel-dialog:not(.pos-dialog) .stats-modal-foot {
  padding: 0;
}

html .stats-modal-root .stats-modal-card.rdx-project-popover.notif-panel-dialog:not(.pos-dialog) .stats-modal-foot > .stats-modal-clear.notif-clear[data-notif-clear] {
  width: 100%;
  height: 48px;
  margin: 0;
  padding: 0 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--rdx-surface-accent);
  font-size: 13px;
  font-weight: 400;
  text-align: center;
}

html .stats-modal-root .stats-modal-card.rdx-project-popover.notif-panel-dialog:not(.pos-dialog) .stats-modal-foot > .stats-modal-clear.notif-clear[data-notif-clear]:hover:not(:disabled) {
  background: var(--rdx-surface-selected);
  box-shadow: none;
}

html .stats-modal-root .stats-modal-card.rdx-project-popover.notif-panel-dialog:not(.pos-dialog) .stats-modal-foot > .stats-modal-clear.notif-clear[data-notif-clear]:active {
  background: var(--rdx-surface-selected);
  opacity: 0.8;
}

html .stats-modal-root .stats-modal-card.rdx-project-popover.notif-panel-dialog:not(.pos-dialog) .stats-modal-foot > .stats-modal-clear.notif-clear[data-notif-clear]:focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: -2px;
  box-shadow: none;
}

/* Tipos de movimento de estoque: três opções de mesma largura em uma linha. */
html .stats-modal-root .rdx-project-popover.stats-filter-dialog .prod-chip-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

html .stats-modal-root .rdx-project-popover.stats-filter-dialog .prod-chip-toggle {
  width: 100%;
  min-width: 0;
  height: 38px;
  justify-content: center;
  gap: 4px;
  padding: 0 6px;
  border: 1px solid var(--rdx-surface-border);
  border-radius: 14px;
  background: var(--rdx-surface);
  color: var(--rdx-surface-accent);
  box-shadow: var(--rdx-surface-shadow);
  white-space: nowrap;
  transition: var(--rdx-surface-transition);
}

html .stats-modal-root .rdx-project-popover.stats-filter-dialog .prod-chip-toggle:hover:not(.active) {
  border-color: var(--rdx-surface-border-hover);
  background: var(--rdx-surface-hover);
  box-shadow: var(--rdx-surface-shadow-hover);
}

html .stats-modal-root .rdx-project-popover.stats-filter-dialog .prod-chip-toggle.active {
  border-color: var(--rdx-surface-border-focus);
  background: var(--rdx-surface-selected);
}

html .stats-modal-root .rdx-project-popover.stats-filter-dialog .prod-chip-toggle:focus-visible {
  outline: 2px solid var(--rdx-surface-accent);
  outline-offset: 2px;
  box-shadow: var(--rdx-surface-focus-ring), var(--rdx-surface-shadow-hover);
}

@media (max-width: 680px) {
  html .stats-modal-root .rdx-project-popover.stats-filter-dialog .prod-chip-toggle {
    height: 42px;
  }
}

/* Preferência por movimento reduzido compartilhada pelas novas superfícies. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --rdx-surface-transition: none;
  }
}
