.entry-dialog {
  width: min(560px, calc(100% - 28px));
  max-height: calc(100vh - 36px);
  border: 1px solid #e6e9ef;
  border-radius: 10px;
  padding: 0;
  background: #fff;
  box-shadow: 0 22px 80px rgba(11, 19, 32, 0.22);
  overflow: auto;
}

.field-hint {
  display: block;
  font-size: 11px;
  color: var(--text-secondary, #6b7a90);
  margin-top: 4px;
  line-height: 1.4;
}

/* Campo obrigatorio — o "*" vermelho depois do texto do label. */
.field-required {
  color: #d64545;
  margin-left: 2px;
}

/* Campo que se preenche sozinho (ex.: endereco do Remetente/Destinatario
   puxado do cadastro do parceiro) — cinza pra deixar claro que normalmente
   nao precisa digitar ali na mao, so conferir. Continua editavel. */
.field-autofill {
  background: #f1f2f4;
  color: #5a6472;
}

.entry-dialog::backdrop {
  background: rgba(11, 19, 32, 0.42);
}

/* ── Modal de confirmação (substitui o confirm() nativo) ── */
.confirm-dialog { width: min(420px, calc(100% - 28px)); }
.confirm-dialog-body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 24px 24px 8px;
}
.confirm-dialog-icon {
  flex-shrink: 0;
  font-size: 26px;
  color: var(--gold, #d4af37);
  margin-top: -2px;
}
.confirm-dialog-message {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #1e293b;
  white-space: pre-line;
}
.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 24px 24px;
}

.entry-form {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.icon-button {
  width: 34px;
  min-height: 34px;
  color: #0b1320;
  background: #f5f7fa;
}

.full {
  width: 100%;
  margin-top: 4px;
}

.attachment-dialog {
  width: min(620px, calc(100% - 28px));
}

.attachment-list {
  display: grid;
  gap: 10px;
}

.entry-attachment-section {
  display: grid;
  gap: 8px;
  border: 1px solid #e6e9ef;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fbfcfe;
}

.entry-attachment-section > span {
  font-size: 13px;
  font-weight: 800;
  color: #344054;
}

.attachment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #e6e9ef;
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}

.attachment-preview-link {
  overflow: hidden;
  color: #0b1320;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-empty,
.attachment-hint {
  margin: 0;
  color: #5f6b7a;
  font-size: 13px;
}

.attachment-button {
  white-space: nowrap;
}

.attachment-add-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}

.attachment-file-label {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border: 1px solid var(--brand-line, #d0d7e3);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: #f4f6fa;
  white-space: nowrap;
}

.attachment-file-label input[type="file"] {
  display: none;
}

.attachment-file-name {
  font-size: 12px;
  color: var(--text-secondary, #6b7a90);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Paleta GestoraPro nas telas internas. A tela de Inicio mantem o visual proprio do painel gerencial. */
.view:not(#homeView) {
  --brand-navy: #0b1320;
  --brand-navy-2: #1d2b3a;
  --brand-gold: #d4af37;
  --brand-bg: #ffffff;
  --brand-soft: #f5f7fa;
  --brand-line: #e6e9ef;
  --brand-ink: #0b1320;
  --brand-muted: #5f6b7a;
  color: var(--brand-ink);
  min-height: calc(100vh - 56px);
  background: #fff;
}

.view:not(#homeView) .topbar {
  border-bottom: 1px solid var(--brand-line);
  padding-bottom: 18px;
}

.view:not(#homeView) .eyebrow,
.view:not(#homeView) .page-subtitle {
  color: var(--brand-muted);
}

.view:not(#homeView) .eyebrow {
  color: var(--brand-gold);
}

.view:not(#homeView) h1,
.view:not(#homeView) h2 {
  color: var(--brand-navy);
}

.view:not(#homeView) .panel,
.view:not(#homeView) .table-panel,
.view:not(#homeView) .report-panel,
.view:not(#homeView) .tax-simple-panel,
.view:not(#homeView) .economic-calendar-panel,
.view:not(#homeView) .bank-panel {
  border: 1px solid var(--brand-line);
  background: var(--brand-bg);
  box-shadow: 0 10px 26px rgba(11, 19, 32, 0.06);
}

.view:not(#homeView) .summary-grid .metric,
.view:not(#homeView) .metric,
.view:not(#homeView) .bank-card,
.view:not(#homeView) .home-finance-card,
.view:not(#homeView) .match-card {
  border: 1px solid var(--brand-line);
  border-top: 3px solid var(--brand-gold);
  background: var(--brand-bg);
  box-shadow: 0 8px 22px rgba(11, 19, 32, 0.05);
}

.view:not(#homeView) .metric span,
.view:not(#homeView) .bank-card span,
.view:not(#homeView) .section-heading span,
.view:not(#homeView) label {
  color: var(--brand-muted);
}

.view:not(#homeView) .metric strong,
.view:not(#homeView) .bank-card strong {
  color: var(--brand-navy);
}

.view:not(#homeView) input,
.view:not(#homeView) select,
.view:not(#homeView) textarea {
  border-color: var(--brand-line);
  color: var(--brand-navy);
  background: #fff;
}

.view:not(#homeView) input:focus,
.view:not(#homeView) select:focus,
.view:not(#homeView) textarea:focus {
  border-color: var(--brand-gold);
  outline: 2px solid rgba(212, 175, 55, 0.18);
}

.view:not(#homeView) table th,
.view:not(#homeView) .reports-table th,
.view:not(#homeView) .budget-table th,
.view:not(#homeView) .reconciliation-table th,
.view:not(#homeView) .tax-table th,
.view:not(#homeView) .users-table th,
.view:not(#homeView) .invoice-table th,
.view:not(#homeView) .partners-table th {
  color: #fff;
  background: var(--brand-navy);
}

.view:not(#homeView) table td {
  border-color: var(--brand-line);
}

.view:not(#homeView) tbody tr:nth-child(even) td {
  background: #fbfcfe;
}

.view:not(#homeView) .primary-button,
.view:not(#homeView) .success-button {
  border: 1px solid var(--brand-navy);
  color: #fff;
  background: var(--brand-navy);
}

.view:not(#homeView) .secondary-button,
.view:not(#homeView) .text-button,
.view:not(#homeView) .small-action,
.view:not(#homeView) .icon-button {
  border-color: var(--brand-line);
  color: var(--brand-navy);
  background: #fff;
}

.view:not(#homeView) .danger-button {
  border: 1px solid #ef233c;
  color: #fff;
  background: #ef233c;
}

.view:not(#homeView) .report-tab,
.view:not(#homeView) .tab,
.view:not(#homeView) .sales-report-tab {
  border-color: var(--brand-line);
  color: var(--brand-navy);
  background: #fff;
}

.view:not(#homeView) .report-tab.active,
.view:not(#homeView) .tab.active,
.view:not(#homeView) .sales-report-tab.active {
  border-top-color: var(--brand-gold);
  color: var(--brand-navy);
  background: #fff;
  box-shadow: inset 0 3px 0 var(--brand-gold);
}

.view:not(#homeView) .account-icon,
.view:not(#homeView) .bottom-icon,
.view:not(#homeView) .calendar-row i {
  border-color: var(--brand-gold);
  color: var(--brand-gold);
  background: #fff;
}

.view:not(#homeView) .account-group,
.view:not(#homeView) .account-nature,
.view:not(#homeView) .tag,
.view:not(#homeView) .budget-status,
.view:not(#homeView) .reconciliation-status,
.view:not(#homeView) .account-status {
  border-radius: 999px;
}

.view:not(#homeView) .other-grid-header,
.view:not(#homeView) .other-table-title {
  color: #fff;
  background: var(--brand-navy);
}

.view:not(#homeView) .calendar-weekday,
.view:not(#homeView) .calendar-day-header {
  color: var(--brand-navy);
  background: var(--brand-soft);
}

.view:not(#homeView) .calendar-day.today .calendar-day-header {
  background: #fff4d2;
}

.view:not(#homeView) .selected-row td {
  background: #fff8e1 !important;
}

/* Ajuste fino da tela de Cadastros para manter a leitura operacional das abas. */
#chartView .success-button,
#chartView #openRevenueDialog.success-button {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

#chartView .danger-button,
#chartView #openRevenueDialog.danger-button {
  border-color: var(--red);
  color: #fff;
  background: var(--red);
}

#chartView #newCostCenterAccount,
#chartView #openRevenueDialog.primary-button {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

#chartView .top-actions .success-button,
#chartView .top-actions .danger-button,
#chartView .top-actions .primary-button {
  min-height: 44px;
  padding: 0 22px;
  font-size: 14px;
  line-height: 1.2;
}

#chartView .tabs {
  border-bottom-color: var(--line);
  background: #fff;
}

#chartView .tab {
  color: #344456;
  background: #fff;
  box-shadow: none;
}

#chartView .tab.active {
  background: #fff;
  box-shadow: none;
}

#chartView .tab[data-account-type="receita"].active {
  color: var(--green);
  border-bottom-color: var(--green);
}

#chartView .tab[data-account-type="despesa"].active {
  color: var(--red);
  border-bottom-color: var(--red);
}

#chartView .tab[data-account-type="centro"].active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

#chartView .tab[data-account-type="outros"].active {
  color: var(--navy);
  border-bottom-color: var(--navy);
}

#chartView .chart-title h2 {
  color: var(--green);
}

#chartView .chart-icon {
  color: #fff;
  background: var(--green);
}

#chartView .chart-icon.expense-mode {
  background: var(--red);
}

#chartView .chart-icon.cost-mode {
  background: var(--blue);
}

#chartView .chart-icon.other-mode {
  color: #fff;
  background: var(--navy);
}

#chartView .chart-icon.expense-mode + div h2 {
  color: var(--red);
}

#chartView .chart-icon.cost-mode + div h2 {
  color: var(--blue);
}

#chartView .chart-icon.other-mode + div h2 {
  color: var(--navy);
}

#chartView .other-card {
  border-color: var(--line);
  background: #fff;
}

#chartView .other-card-header {
  color: #fff;
  background: var(--navy);
}

#chartView .other-card-header input {
  color: #fff;
  background: transparent;
}

#chartView .other-card-header input::placeholder {
  color: rgba(255, 255, 255, 0.75);
}

#chartView .other-row strong,
#chartView .other-row span {
  color: var(--navy);
}

#chartView .inline-add-form .primary-button {
  border-color: var(--navy);
  color: #fff;
  background: var(--navy);
}

@media (max-width: 970px) {
  /* Menu vira gaveta (off-canvas) em vez de empilhar como uma parede de
     botões acima do conteúdo — pedido do usuário (2026-09-01). Fica fixo,
     fora da tela à esquerda (translateX), e desliza por cima do conteúdo
     (não empurra) quando o botão hambúrguer (#sidebarToggleButton) abre,
     via body.sidebar-open (ver events.js). Continua .menu em coluna única,
     igual desktop — não faz sentido em grade dentro de uma gaveta estreita. */
  .sidebar {
    z-index: 60;
    width: 280px;
    transform: translateX(-100%);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .app {
    width: 100%;
    margin-left: 0;
    padding-top: 4px;
  }

  .app-topbar {
    position: static;
    inset: auto;
    justify-content: space-between;
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .summary-grid,
  .analysis-kpis,
  .bank-grid,
  .economic-calendar-summary,
  .receivable-summary-grid,
  .home-kpi-row,
  .home-finance-row,
  .home-analytics-grid,
  .home-small-charts,
  .home-bottom-strip,
  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-executive-top,
  .assistant-analysis-form {
    grid-template-columns: 1fr;
  }

  /* Cards do Dashboard (EBITDA, Lucro líquido, Contas a pagar/receber, DRE...)
     ficando só na metade esquerda da tela no celular, com um vão vazio à
     direita — pedido do usuário (2026-09-01), com print mostrando o problema.
     Usa #homeView pra especificidade alta o suficiente pra vencer qualquer
     regra concorrente, já que o motivo exato da coluna sobrando não ficou
     claro só lendo o CSS (sem inspecionar o navegador real). Cobre tanto a
     grade (coluna única cheia) quanto o card em si (100% da coluna). */
  #homeView .home-kpi-row,
  #homeView .home-finance-row,
  #homeView .home-analytics-grid,
  #homeView .home-small-charts,
  #homeView .home-bottom-strip {
    grid-template-columns: 1fr;
  }

  #homeView .home-kpi-card,
  #homeView .home-finance-card,
  #homeView .home-dashboard-panel {
    width: 100%;
  }

  /* .home-filter-row agora é flex-wrap (ver layout.css) — já quebra linha
     sozinho, só reduz a largura mínima de cada campo pra telas estreitas. */
  .home-filter-row label {
    min-width: 110px;
  }
}

@media (max-width: 720px) {
  .app {
    padding: 18px;
  }

  .topbar,
  .top-actions,
  .section-heading,
  .legend,
  .chart-header,
  .chart-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .chart-actions input {
    width: 100%;
  }

    .menu,
    .summary-grid,
    .analysis-kpis,
    .bank-grid,
    .economic-calendar-summary,
    .receivable-summary-grid,
  .filters,
  .other-grid,
  .report-filters,
  .tax-rate-form,
    .tax-info-grid,
    .home-kpi-row,
    .home-finance-row,
    .home-analytics-grid,
    .home-small-charts,
    .home-bottom-strip,
    .home-donut-panel,
    .assistant-layout,
    .training-layout,
    .support-layout,
    .platform-layout,
    .assistant-analysis-form {
    grid-template-columns: 1fr;
  }

  .home-executive-dashboard {
    padding: 16px;
  }

  .economic-calendar-grid {
    grid-template-columns: repeat(7, minmax(130px, 1fr));
    overflow-x: auto;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  .table-wrap table {
    min-width: max-content;
  }

  .home-executive-top,
  .home-top-actions,
  .home-brand-lockup {
    align-items: flex-start;
    flex-direction: column;
    display: flex;
  }

  .home-insights-grid {
    display: flex;
    flex-direction: column;
  }

  .home-cashflow-panel {
    grid-column: unset;
  }

  .home-insights-stack {
    flex-direction: column;
  }

  .home-insights-row2 {
    display: flex;
    flex-direction: column;
    grid-column: unset;
  }

  .home-top-expenses-panel {
    grid-column: unset;
  }

  .home-bottom-strip div {
    border-right: 0;
    border-bottom: 1px solid rgba(212, 175, 55, 0.35);
  }

  .home-bottom-strip div:last-child {
    border-bottom: 0;
  }
}

@media print {
  body.printing-home-dashboard {
    background: #fff;
  }

  body.printing-home-dashboard .sidebar,
  body.printing-home-dashboard .view:not(#homeView),
  body.printing-home-dashboard .home-filter-row,
  body.printing-home-dashboard .home-top-actions {
    display: none !important;
  }

  body.printing-home-dashboard .app {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  body.printing-home-dashboard #homeView {
    display: block !important;
  }

  body.printing-home-dashboard .home-executive-dashboard {
    min-height: auto;
    border-radius: 0;
    padding: 14px;
    box-shadow: none;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  body.printing-home-dashboard .home-executive-top {
    grid-template-columns: 1fr;
  }

  body.printing-home-dashboard .home-kpi-card,
  body.printing-home-dashboard .home-finance-card,
  body.printing-home-dashboard .home-dashboard-panel,
  body.printing-home-dashboard .home-bottom-strip {
    break-inside: avoid;
    box-shadow: none;
  }
}

/* ── DANFE (impressão) ──────────────────────────────────────────── */
#danfePrintView {
  max-width: 900px;
  margin: 24px auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  font-size: 12px;
  color: #111;
}

.danfe-header {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 0;
  border: 1px solid #333;
  margin-bottom: 14px;
}

.danfe-emit-box,
.danfe-title-box,
.danfe-chave-box {
  padding: 10px;
  border-right: 1px solid #333;
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
}
.danfe-chave-box { border-right: none; }

.danfe-emit-box strong { font-size: 14px; }
.danfe-emit-box span { color: var(--muted); font-size: 11px; }

.danfe-title-box { align-items: center; text-align: center; }
.danfe-title-box strong { font-size: 16px; letter-spacing: 1px; }
.danfe-title-box span { font-size: 10px; color: var(--muted); }
.danfe-title-box #danfeNumSerie { font-weight: 700; font-size: 12px; color: #111; margin-top: 4px; }

.danfe-chave-box span { font-size: 10px; color: var(--muted); }
.danfe-chave-box strong { font-family: monospace; font-size: 13px; letter-spacing: 1px; word-break: break-all; }
.danfe-chave-box small { color: var(--muted); font-size: 10px; }

.danfe-section { margin-bottom: 16px; }
.danfe-section h4 {
  margin: 0 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #333;
  font-size: 12px;
  text-transform: uppercase;
}

.danfe-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 16px;
}
.danfe-info-grid div { display: flex; flex-direction: column; }
.danfe-info-grid span { font-size: 10px; color: var(--muted); text-transform: uppercase; }
.danfe-info-grid strong { font-size: 12px; }

.danfe-items-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.danfe-items-table th,
.danfe-items-table td { border: 1px solid #999; padding: 4px 6px; text-align: left; }
.danfe-items-table th { background: #f0f0f0; }
.danfe-items-table td.number,
.danfe-items-table th.number { text-align: right; }

.danfe-actions { display: flex; gap: 10px; margin-top: 20px; }

@media print {
  body.printing-danfe {
    background: #fff;
  }

  body.printing-danfe .sidebar,
  body.printing-danfe .app,
  body.printing-danfe .float-chat-toggle {
    display: none !important;
  }

  body.printing-danfe #danfePrintView {
    display: block !important;
    margin: 0;
    border: none;
    max-width: 100%;
  }

  body.printing-danfe .danfe-actions {
    display: none !important;
  }
}

/* ── Relatório de Contas a Pagar e Receber (impressão) ────────────── */
.aparep-sheet { background: #fff; color: var(--ink, #162033); max-width: 900px; margin: 0 auto; }
.aparep-head {
  background: var(--navy, #0d2844);
  background-image: linear-gradient(135deg, var(--navy, #0d2844) 0%, var(--navy-2, #123a61) 100%);
  color: #fff;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border-bottom: 3px solid var(--gold, #d4af37);
}
.aparep-brand { display: flex; align-items: center; gap: 10px; }
.aparep-brand-mark {
  width: 32px; height: 32px; border-radius: 6px;
  background: var(--gold, #d4af37); color: var(--navy, #0d2844);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.aparep-brand-name { font-size: 12px; letter-spacing: 0.4px; font-weight: 700; }
.aparep-brand-sub { font-size: 10px; color: #b9c8dc; margin-top: 1px; }
.aparep-head-right { text-align: right; }
.aparep-title { font-size: 15px; font-weight: 700; letter-spacing: 0.3px; }
.aparep-meta { font-size: 11px; color: #cfe0f2; margin-top: 4px; line-height: 1.5; }
.aparep-meta strong { color: #fff; }

.aparep-body { padding: 20px 24px 24px; }

.aparep-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 20px; }
.aparep-metric { border: 1px solid var(--line, #d9e2ec); border-radius: 6px; padding: 10px 12px; background: #fafcff; }
.aparep-metric.pagar { border-left: 3px solid var(--red, #ef233c); }
.aparep-metric.receber { border-left: 3px solid var(--green, #16a34a); }
.aparep-metric.saldo { border-left: 3px solid var(--blue, #1b75d0); }
.aparep-metric.gold { border-left: 3px solid var(--gold, #d4af37); }
.aparep-metric span { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted, #667085); margin-bottom: 4px; }
.aparep-metric strong { font-size: 15px; }
.aparep-metric strong.neg { color: var(--red, #ef233c); }
.aparep-metric strong.pos { color: var(--green, #16a34a); }

.aparep-section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--navy, #0d2844);
  margin: 0 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--line, #d9e2ec);
  display: flex; align-items: center; gap: 6px;
}
.aparep-section-title::before { content: ""; width: 4px; height: 12px; background: var(--gold, #d4af37); border-radius: 1px; display: inline-block; }

.aparep-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-bottom: 20px; }
.aparep-table th {
  background: var(--soft-blue, #e9f2ff); color: var(--navy-2, #123a61);
  text-align: left; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.3px;
  padding: 6px 8px; border-bottom: 1px solid var(--line, #d9e2ec);
}
.aparep-table td { padding: 6px 8px; border-bottom: 1px solid var(--line, #d9e2ec); }
.aparep-table td.number, .aparep-table th.number { text-align: right; }
.aparep-table tr.aparep-total-row td { font-weight: 700; background: #f7f9fc; border-top: 2px solid var(--navy, #0d2844); border-bottom: none; }

.aparep-pill { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 9.5px; font-weight: 700; }
.aparep-pill.pendente { background: var(--soft-blue, #e9f2ff); color: var(--blue, #1b75d0); }
.aparep-pill.vencido { background: var(--soft-red, #ffecee); color: var(--red, #ef233c); }
.aparep-pill.pago { background: var(--soft-green, #e8f8ee); color: var(--green, #16a34a); }

.aparep-banks-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.aparep-bank-card { border: 1px solid var(--line, #d9e2ec); border-radius: 6px; padding: 10px 12px; }
.aparep-bank-card .name { font-size: 11px; font-weight: 700; color: var(--navy, #0d2844); }
.aparep-bank-card .value { font-size: 13px; margin-top: 4px; }
.aparep-bank-card .value.neg { color: var(--red, #ef233c); }

.aparep-foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 24px; border-top: 1px solid var(--line, #d9e2ec); font-size: 9.5px; color: var(--muted, #667085); }
.aparep-actions { display: flex; gap: 10px; margin: 16px 0; max-width: 900px; margin-left: auto; margin-right: auto; }
/* O relatório em si agora abre em uma aba nova (ver openApArReportInNewTab em render.js),
   com seu próprio HTML/CSS embutido — as regras acima só populam o "molde" oculto
   #apArReportPrintView nesta página antes de ser copiado pra aba nova. */

/* ── Chat Assistente Flutuante ─────────────────────────────────── */
.float-chat-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 200;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #1b75d0, #0d2844);
  color: #fff;
  box-shadow: 0 6px 24px rgba(13, 40, 68, 0.38);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.float-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 30px rgba(13, 40, 68, 0.5);
}

.float-chat-toggle .material-icons-round {
  font-size: 26px;
}

.float-chat {
  position: fixed;
  bottom: 96px;
  right: 28px;
  z-index: 200;
  width: 380px;
  max-height: 540px;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  transition: opacity 0.2s, transform 0.2s;
}

.float-chat.hidden {
  display: none;
}

.float-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, #0d2844, #1b75d0);
  color: #fff;
}

.float-chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.float-chat-title .material-icons-round {
  font-size: 22px;
  color: #d4af37;
}

.float-chat-title strong {
  display: block;
  font-size: 14px;
}

.float-chat-title small {
  display: block;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
}

.float-chat-close {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.float-chat-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.float-chat-close .material-icons-round {
  font-size: 18px;
}

.float-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f4f7fb;
}

.chat-bubble {
  max-width: 88%;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
}

.chat-bubble p {
  margin: 0 0 6px;
}

.chat-bubble p:last-child {
  margin-bottom: 0;
}

.chat-bubble ul {
  margin: 6px 0 0 0;
  padding-left: 18px;
}

.chat-bubble ul li {
  margin-bottom: 3px;
}

/* ── Assistente IA — reconhecimento de documentos ── */
.assistant-doc-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 20px;
}

.assistant-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-navy);
  margin: 0;
}

.assistant-section-desc {
  font-size: 13px;
  color: var(--text-secondary, #6b7a90);
  margin: 0;
}

.assistant-doc-types {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.assistant-doc-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  border: 2px solid var(--brand-line, #e0e6ef);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary, #6b7a90);
  background: #fff;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  min-width: 72px;
}

.assistant-doc-btn input[type="radio"] { display: none; }

.assistant-doc-btn .material-icons-round {
  font-size: 22px;
}

.assistant-doc-btn:has(input:checked) {
  border-color: var(--brand-navy);
  color: var(--brand-navy);
  background: #f0f4ff;
}

.assistant-doc-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 24px 16px;
  border: 2px dashed var(--brand-line, #cdd5e0);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary, #6b7a90);
  background: #fafbfd;
  transition: border-color 0.15s, background 0.15s;
}

.assistant-doc-upload-area:hover,
.assistant-doc-upload-area.dragover {
  border-color: var(--brand-navy);
  background: #f0f4ff;
}

.assistant-doc-upload-area .material-icons-round {
  font-size: 32px;
  color: var(--brand-navy);
  opacity: 0.6;
}

.assistant-doc-upload-area.has-file {
  border-color: #22c55e;
  background: #f0fdf4;
  color: #15803d;
}

.assistant-doc-upload-area.has-file .material-icons-round {
  color: #22c55e;
  opacity: 1;
}

.assistant-doc-hint {
  font-size: 11px;
  opacity: 0.7;
}

.assistant-doc-status {
  font-size: 13px;
  color: var(--text-secondary, #6b7a90);
  text-align: center;
  padding: 4px 0;
}

.assistant-doc-status.error { color: #c0002a; }
.assistant-doc-status.success { color: #15803d; }

.assistant-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary, #aab2c0);
  font-size: 12px;
  padding: 8px 0;
}

.assistant-divider::before,
.assistant-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--brand-line, #e0e6ef);
}

/* ── fim assistente doc ── */

.chat-bubble.user {
  align-self: flex-end;
  background: #1b75d0;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: #fff;
  color: #162033;
  border: 1px solid #d9e2ec;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.chat-bubble.assistant.error {
  background: #ffecee;
  border-color: #ffc5cb;
  color: #c0002a;
}

/* Typing indicator */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
}

.chat-typing span {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #667085;
  animation: chatTyping 1.2s infinite ease-in-out;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatTyping {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.float-chat-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #d9e2ec;
  background: #fff;
}

.float-chat-input input {
  flex: 1;
  min-height: 38px;
  border: 1px solid #d9e2ec;
  border-radius: 20px;
  padding: 0 14px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.18s;
}

.float-chat-input input:focus {
  border-color: #1b75d0;
}

.float-chat-input input:disabled {
  background: #f4f7fb;
}

.float-chat-input button {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: #1b75d0;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.18s;
}

.float-chat-input button:hover {
  background: #1561b0;
}

.float-chat-input button .material-icons-round {
  font-size: 18px;
}

/* ── Import bar (barra de arquivo selecionado) ─────────────────── */
.float-chat-attach {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.18s, color 0.18s;
}

.float-chat-attach:hover {
  background: var(--soft-blue);
  color: var(--blue);
}

.float-chat-attach .material-icons-round {
  font-size: 18px;
}

.float-chat-import-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--soft-blue);
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.float-chat-import-bar .material-icons-round {
  font-size: 18px;
  color: var(--blue);
  flex-shrink: 0;
}

.float-import-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 600;
}

.float-chat-import-bar select {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 6px;
  font-size: 11px;
  background: #fff;
}

.float-import-send {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.float-import-send .material-icons-round { font-size: 16px; }

.float-import-cancel {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.float-import-cancel .material-icons-round { font-size: 16px; }

/* ── Preview de importação no chat ─────────────────────────────── */
.import-preview {
  font-size: 13px;
}

.import-preview-title {
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.table-wrap table {
  min-width: max-content;
}

.table-wrap table th,
.table-wrap table td {
  white-space: nowrap;
}

.import-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
}

.import-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.import-preview-table th {
  padding: 6px 10px;
  background: var(--soft-blue);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}

.import-preview-table td {
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.import-status-badge.pago {
  background: var(--soft-green);
  color: var(--green);
}

.import-status-badge.pendente {
  background: #fff8e6;
  color: var(--orange);
}

.import-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.import-confirm-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  min-height: 34px;
  padding: 0 14px;
}

.import-cancel-btn {
  font-size: 13px;
  min-height: 34px;
  padding: 0 14px;
}

/* ══ Reaplicado depois do redeploy — ver notas do projeto ══ */
.entry-dialog {
  width: min(1200px, calc(100vw - 32px));
  max-height: calc(100vh - 24px);
}

/* ── Cabeçalhos de seção dentro do diálogo de CT-e (Geral, Transporte,
   Cidades, Tomador...) — h3 puro do navegador ficava grande e genérico
   demais dentro do modal. Troca por um rótulo discreto com barra dourada
   de destaque, no mesmo espírito visual do resto do sistema. */
#cteDialog .cte-dialog-tab-panel h3 {
  position: relative;
  padding-left: 12px;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy);
}
#cteDialog .cte-dialog-tab-panel h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1px;
  bottom: 1px;
  width: 3px;
  border-radius: 2px;
  background: var(--gold);
}
#cteDialog .cte-dialog-tab-panel:first-of-type h3:first-child {
  margin-top: 4px;
}
