.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;
}

.entry-dialog::backdrop {
  background: rgba(11, 19, 32, 0.42);
}

.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;
}

.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;
}

/* 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 {
  border-color: var(--brand-line);
  color: var(--brand-navy);
  background: #fff;
}

.view:not(#homeView) .report-tab.active,
.view:not(#homeView) .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: 900px) {
  .sidebar {
    position: static;
    width: 100%;
  }

  .menu {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .app {
    width: 100%;
    margin-left: 0;
  }

  .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,
  .home-filter-row,
  .assistant-analysis-form {
    grid-template-columns: 1fr;
  }
}

@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;
  }

  .home-executive-top,
  .home-top-actions,
  .home-brand-lockup {
    align-items: flex-start;
    flex-direction: column;
    display: flex;
  }

  .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;
  }
}

/* ── 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;
}

.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;
}

.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;
}
