/* Contadex APP — overrides locais. CSS principal (incl. .nav-page, .modal, .checkbox-card) vem do Admin via handle C. */

/* Linha de tabela com item ocultado da lista (autocomplete/IA) — atenuação visual sem somit. */
tr.row-unlisted { opacity: 0.55; }
tr.row-unlisted .fa-eye-slash { margin-right: 4px; }

/* Dashboard Financeiro — extras (filtros + section title + card-subtitle). */
.dashboard-commands { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.dashboard-commands .filters.period-filter { display: flex; flex-wrap: nowrap; align-items: stretch; gap: 6px; }
.dashboard-commands .filters.period-filter > select,
.dashboard-commands .filters.period-filter > input { flex: 0 0 auto; margin: 0; }
.dashboard-commands .filters.period-filter > button.period-nav { padding: 6px 10px; }
.dashboard-section-title { font-size: 14px; font-weight: 500; color: #374151; margin: 4px 0 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.card > .card-subtitle { font-size: 13px; color: #1F2937; font-weight: 500; margin-bottom: 8px; line-height: 1.3; }

/* Cards do dashboard: shadow padrão do sistema (sem border). */
.dashboard-grid > .card { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03), 0 2px 4px rgba(0, 0, 0, 0.04); }

/* Mesmo shadow nos containers de gráfico — uniformiza dashboard. */
section[data-page^="dashboard_"] .chart-container { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03), 0 2px 4px rgba(0, 0, 0, 0.04); }

/* Info icon ao lado do título do gráfico — tooltip com explicação ao hover/focus. */
.chart-help { position: relative; display: inline-flex; margin-left: 6px; cursor: help; vertical-align: middle; }
.chart-help > i { color: #9CA3AF; font-size: 13px; transition: color 0.12s; }
.chart-help:hover > i,
.chart-help:focus > i { color: #1565C0; }
.chart-help-tooltip {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  z-index: 100; visibility: hidden; opacity: 0;
  min-width: 240px; max-width: 360px;
  background: #1F2937; color: #FFFFFF; font-size: 12px; font-weight: 400; line-height: 1.45;
  padding: 8px 12px; border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  text-align: left; white-space: normal; pointer-events: none;
  transition: opacity 0.12s, visibility 0.12s;
}
.chart-help:hover .chart-help-tooltip,
.chart-help:focus .chart-help-tooltip { visibility: visible; opacity: 1; }
.chart-help-tooltip::before {
  content: ''; position: absolute; top: -5px; left: 50%; transform: translateX(-50%);
  border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 5px solid #1F2937;
}
.chart-help-tooltip ul { margin: 4px 0 0 0; padding-left: 16px; }
.chart-help-tooltip li { margin: 2px 0; }
.chart-help-tooltip b { color: #FCD34D; font-weight: 500; }

/* Cards KPI compactos do dashboard. */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi-mini {
  background: #FFFFFF; border-radius: 6px; padding: 12px 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03), 0 2px 4px rgba(0,0,0,0.04);
}
.kpi-mini-label { font-size: 11px; color: #6B7280; text-transform: uppercase; letter-spacing: 0.4px; }
.kpi-mini-value { font-size: 22px; font-weight: 500; color: #1F2937; margin-top: 4px; }
.kpi-mini-delta { font-size: 12px; margin-top: 2px; display: inline-flex; align-items: center; gap: 4px; }
.kpi-mini-delta.positive { color: #16A34A; }
.kpi-mini-delta.negative { color: #DC2626; }
.kpi-mini-delta.neutral  { color: #6B7280; }

/* Aging inadimplência — barras horizontais empilhadas. */
.aging-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.aging-bar-row > .aging-label { width: 100px; color: #374151; flex-shrink: 0; }
.aging-bar-row > .aging-track { flex: 1; height: 18px; background: #F3F4F6; border-radius: 4px; overflow: hidden; }
.aging-bar-row > .aging-track > div { height: 100%; }
.aging-bar-row > .aging-amount { width: 110px; text-align: right; color: #1F2937; flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* Top providers + Top clients side-by-side. Classe própria do dashboard pra evitar conflito
   com `.row` do template global. */
.dashboard-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.dashboard-row > .dashboard-flex-half  { flex: 1 1 calc(50% - 8px);                min-width: 320px; }
.dashboard-row > .dashboard-flex-third { flex: 1 1 calc((100% - 32px) / 3);        min-width: 280px; }

/* Multi-select de bancos do dashboard — escopado em `.dashboard-bank-*` pra NÃO interferir
   com `.multi-select-filter` que é usado dentro de `.column-filters` no financeiro. */
.dashboard-commands { align-items: center; }
.dashboard-commands > select,
.dashboard-commands > input,
.dashboard-commands > button,
.dashboard-commands .filters.period-filter > select,
.dashboard-commands .filters.period-filter > input,
.dashboard-commands .filters.period-filter > button.period-nav,
.dashboard-commands .dashboard-bank-trigger,
.dashboard-commands .dashboard-toggle { height: 34px; box-sizing: border-box; margin: 0; }

.dashboard-bank-filter { position: relative; min-width: 220px; }
.dashboard-bank-trigger {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-width: 220px; padding: 0 10px;
  background: #FFFFFF !important; color: #1F2937 !important;
  font-size: 13px; font-weight: 400; line-height: 1; text-transform: none; letter-spacing: normal;
  border: 1px solid #D1D5DB; border-radius: 4px; cursor: pointer;
  box-shadow: none;
}
.dashboard-bank-trigger:hover { border-color: #1976D2; background: #FFFFFF !important; color: #1F2937 !important; }
.dashboard-bank-trigger:focus,
.dashboard-bank-trigger:active { outline: none; border-color: #1976D2; background: #FFFFFF !important; color: #1F2937 !important; }
.dashboard-bank-trigger .fa-chevron-down { color: #6B7280; font-size: 11px; }
.dashboard-bank-panel {
  position: absolute; top: calc(100% + 4px); left: 0;
  min-width: 100%; max-width: 320px;
  background: #FFFFFF; border: 1px solid #E5E7EB; border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08); padding: 6px 0; z-index: 50;
  max-height: 280px; overflow-y: auto;
}
.dashboard-bank-panel hr { margin: 4px 0; border: 0; border-top: 1px solid #E5E7EB; }
.dashboard-bank-panel label {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; font-size: 13px; font-weight: 400; color: #1F2937;
  cursor: pointer;
}
.dashboard-bank-panel label:hover { background: #F3F4F6; }
.dashboard-bank-panel label.dashboard-bank-all { font-weight: 500; }
.dashboard-bank-panel input[type=checkbox] { margin: 0; }

/* Toggle "incluir transferências" — checkbox + label inline. */
.dashboard-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 10px; font-size: 13px; color: #1F2937;
  border: 1px solid #D1D5DB; border-radius: 4px; background: #FFFFFF; cursor: pointer;
}
.dashboard-toggle:hover { border-color: #1976D2; background: #FFFFFF; }
.dashboard-toggle input[type=checkbox] { margin: 0; }

/* Subpage content (loading state) */
.subpage-content .loading { display: flex; justify-content: center; padding: 32px; color: #9CA3AF; font-size: 24px; }

/* Página de erro genérica */
.page-error { display: flex; justify-content: center; align-items: center; min-height: 60vh; }
.page-error .error-card { background: #FFFFFF; border-radius: 12px; padding: 48px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); text-align: center; max-width: 480px; }
.page-error .error-card h2 { margin: 16px 0 8px; }
.page-error .error-card p { color: #6B7280; margin-bottom: 16px; }
.page-error .error-card .text-danger { color: #DC2626; }

/* Grid inline (rateio) */
table.row-grid { width: 100%; margin-top: 8px; }
table.row-grid td { padding: 4px; vertical-align: middle; }
table.row-grid .total-row { font-weight: 500; background: #F5F7FA; }
table.row-grid .total-percentage.invalid { color: #DC2626; }

/* Financial */
.launch-type-in    { color: #16A34A; }
.launch-type-out   { color: #DC2626; }
.launch-type-transfer    { color: #6B7280; }
.launch-type-transfer-in { color: #16A34A; }
.launch-type-transfer-out{ color: #DC2626; }
.launch-amount { font-weight: 500; }
.launch-amount.in           { color: #16A34A; }
.launch-amount.out          { color: #DC2626; }
.launch-amount.transfer-in  { color: #16A34A; }
.launch-amount.transfer-out { color: #DC2626; }
/* Toggle Lista|Agrupado: altura igual aos botões adjacentes em .commands. */
.toggle-group { display: inline-flex; gap: 4px; padding: 3px; background: #F5F7FA; border-radius: 4px; align-self: stretch; box-sizing: border-box; }
.toggle-group button { padding: 0 12px; background: transparent; color: #6B7280; font-size: 13px; border: none; cursor: pointer; box-sizing: border-box; line-height: 1; display: inline-flex; align-items: center; gap: 6px; }
.toggle-group button.active { background: white; color: #1565C0; box-shadow: 0 1px 2px rgba(0,0,0,0.05); border-radius: 3px; }
tr.group-header { background: rgba(21, 101, 192, 0.05); font-weight: 500; cursor: pointer; }
tr.group-header td:first-child::before { content: '\f0fe'; font-family: 'Font Awesome 6 Free'; font-weight: 900; margin-right: 8px; }
tr.group-header.expanded td:first-child::before { content: '\f146'; }

/* Invoice */
.nfe-step { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 4px; font-size: 12px; }
.nfe-step.done    { background: rgba(22,163,74,0.15); color: #16A34A; }
.nfe-step.pending { background: rgba(245,158,11,0.15); color: #F59E0B; }
.access-key { font-family: monospace; font-size: 11px; color: #6B7280; word-break: break-all; }

/* Dashboard */
.dashboard-filters { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; padding: 16px; background: #F5F7FA; border-radius: 8px; }
.chart-canvas-wrapper { position: relative; height: 300px; }
.kpi-card { background: linear-gradient(135deg, #1565C0 0%, #0D47A1 100%); color: white; border-radius: 8px; padding: 16px; }
.kpi-card .card-title { color: rgba(255,255,255,0.8); }
.kpi-card .card-value { color: white; font-size: 32px; }
.kpi-card .card-trend { color: rgba(255,255,255,0.9); }

/* ─────────── Loading indicators ─────────── */
#global-loader { position: fixed; top: 0; left: 0; right: 0; height: 4px; background: transparent; z-index: 9999; pointer-events: none; overflow: hidden; }
#global-loader.active { background: rgba(21, 101, 192, 0.18); box-shadow: 0 1px 6px rgba(21, 101, 192, 0.45); }
#global-loader.active::before { content: ''; position: absolute; left: -50%; top: 0; height: 100%; width: 50%; background: linear-gradient(90deg, transparent, #1565C0 35%, #0D47A1 50%, #1565C0 65%, transparent); animation: global-loader-slide 1s linear infinite; }
@keyframes global-loader-slide { 0% { left: -50%; } 100% { left: 100%; } }
tr.table-loading td { color: #6B7280; font-size: 18px; text-align: center; padding: 24px; }
tr.table-loading .fa-spinner { color: #2563EB; }
button.loading, input[type=submit].loading { opacity: 0.7; cursor: wait; }

/* Mini tables inside modals (group launches list) */
.mini-table { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 13px; }
.mini-table th, .mini-table td { padding: 6px 8px; border-bottom: 1px solid #E5E7EB; text-align: left; }
.mini-table th { background: #F5F7FA; font-weight: 600; color: #374151; }
.mini-table .text-right { text-align: right; }
.mini-table .text-success { color: #16A34A; }
.mini-table .text-danger  { color: #DC2626; }
.launch-balance { font-weight: 500; }

/* Status icons na tabela de launch */
.status-icon { font-size: 16px; }
.status-icon.status-pending   { color: #F59E0B; }
.status-icon.status-paid      { color: #16A34A; }
.status-icon.status-cancelled { color: #DC2626; }
.status-icon.status-overdue { color: #DC2626; }
.status-icon.status-today   { color: #F59E0B; }
.status-icon.status-future  { color: #2563EB; }
.autocomplete-item .code-prefix { color: #6B7280; font-family: monospace; font-size: 12px; margin-right: 2px; }

/* Standalone permission-check (uso fora do contexto de profile).
   Usar especificidade alta com `form .field >` pra ganhar de `form .field > label { display:block }`. */
form label.permission-check,
form .field > label.permission-check {
  display: flex !important;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 12px;
  border: 1px solid #E0E4EB;
  border-radius: 4px;
  background: #FFFFFF;
  transition: background 0.12s, border-color 0.12s;
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  color: #1F2937;
}
form label.permission-check:hover { background: rgba(21, 101, 192, 0.06); border-color: #1976D2; }
form label.permission-check input[type=checkbox] { width: 16px; height: 16px; margin: 0; cursor: pointer; accent-color: #1565C0; flex-shrink: 0; }
form label.permission-check span { font-size: 13px; color: #1F2937; line-height: 1.3; }
form label.permission-check:has(input:checked) { border-color: #1976D2; background: rgba(21, 101, 192, 0.04); }
form label.permission-check:has(input:checked) span { font-weight: 500; }
/* Field só com checkbox: empurra para baixo pra alinhar com inputs irmãos (que têm label em cima). */
form .field.field-checkbox-aligned { display: flex; align-items: flex-end; }
form .field.field-checkbox-aligned label.permission-check { width: 100%; }

/* Autocomplete com botão "+" anexo (criar nova entidade inline) */
.autocomplete-with-add { display: flex; gap: 6px; align-items: stretch; }
.autocomplete-with-add .autocomplete { flex: 1; }
.autocomplete-with-add .btn-add-related { padding: 0 12px; background: #1565C0; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; flex-shrink: 0; transition: background 0.12s; }
.autocomplete-with-add .btn-add-related:hover { background: #0D47A1; }

/* Anexos do lançamento */
.attachment-list { list-style: none; padding: 0; margin: 0 0 8px 0; }
.attachment-list li { padding: 6px 8px; background: #F5F7FA; border-radius: 4px; margin-bottom: 4px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.attachment-list li a { color: #1565C0; text-decoration: none; flex: 1; }
.attachment-list li a:hover { text-decoration: underline; }
.attachment-list .btn-remove-attachment { color: #DC2626; cursor: pointer; padding: 4px; }
.attachment-list .btn-remove-attachment:hover { color: #991B1B; }
/* File uploader estilizado (drop zone + botão + lista de pré-visualização) */
.file-uploader { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px dashed #C7CDD8; border-radius: 6px; background: #F5F7FA; transition: background 0.12s, border-color 0.12s; }
.file-uploader.drag-over { background: rgba(21, 101, 192, 0.08); border-color: #1976D2; border-style: solid; }
.file-uploader-hint { color: #6B7280; font-size: 12px; text-align: center; pointer-events: none; }
.file-uploader-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid #1565C0; border-radius: 4px; background: #FFFFFF; color: #1565C0; font-size: 13px; cursor: pointer; transition: background 0.12s; align-self: center; }
.file-uploader-btn:hover { background: rgba(21, 101, 192, 0.06); }
.file-uploader-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.file-uploader-list:empty { display: none; }
.file-uploader-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; background: #FFFFFF; border: 1px solid #E5E7EB; border-radius: 4px; font-size: 13px; }
.file-uploader-list li .file-name { color: #1F2937; flex: 1; word-break: break-word; }
.file-uploader-list li .file-size { color: #6B7280; font-size: 12px; }
.file-uploader-list li .file-remove { color: #DC2626; cursor: pointer; padding: 0 4px; }
.file-uploader-list li .file-remove:hover { color: #991B1B; }

/* Tabela de financeiro: larguras fixas + truncate em descrição/pessoa/conta */
table.launch-table { table-layout: fixed; width: 100%; }
table.launch-table td, table.launch-table th { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.launch-table td.actions, table.launch-table th.actions { white-space: normal; }
/* Força alinhamento à direita (text-align genérico do .text-right pode ser sobrescrito por seletor mais específico de table). */
table.launch-table td.text-right, table.launch-table th.text-right { text-align: right !important; }
.launch-amount, .launch-balance { display: block; }
.launch-balance-cell { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }
.launch-balance-cell .launch-balance-bank { font-size: 12px; }

/* Override do grid 3-col padrão: layout flex em linha única, botões compactos.
   align-items: stretch — botões herdam altura dos inputs/selects. */
.commands .filters.period-filter { display: flex; flex-wrap: nowrap; align-items: stretch; gap: 6px; }
.commands .filters.period-filter > select,
.commands .filters.period-filter > input { flex: 1 1 auto; min-width: 0; width: auto; }
.commands .filters.period-filter .period-nav { flex: 0 0 auto; padding: 0 10px; background: #FFFFFF; border: 1px solid #C7CDD8; border-radius: 4px; color: #1565C0; cursor: pointer; font-size: 12px; line-height: 1; box-sizing: border-box; transition: background 0.12s, border-color 0.12s; }
.commands .filters.period-filter .period-nav:hover { background: rgba(21, 101, 192, 0.06); border-color: #1976D2; }

/* Divisor de dia: borda superior sutil na primeira linha de cada data */
table.launch-table tr.first-of-day td { border-top: 2px solid #C7CDD8 !important; }
table.launch-table tbody tr:first-child.first-of-day td { border-top: none !important; }

/* Input de cor: alinha com inputs/selects (height + border + radius) */
input[type=color] { width: 100%; height: 38px; padding: 4px; border: 1px solid #E0E4EB; border-radius: 4px; background: #FFFFFF; cursor: pointer; box-sizing: border-box; transition: border-color 0.15s, box-shadow 0.15s; }
input[type=color]:focus { border-color: #1976D2; outline: none; box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.12); }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: none; border-radius: 2px; }
input[type=color]::-moz-color-swatch { border: none; border-radius: 2px; }
/* Span de valor/saldo no header de grupo: oculto quando expandido (td preserva background). */
table.launch-table .group-collapsed-cell.is-hidden { display: none; }

/* ─────────── Tools Hub Modal ─────────── */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 8px; }
.tool-card { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid #E5E7EB; border-radius: 6px; background: #FFF; cursor: pointer; transition: background 0.12s, border-color 0.12s, transform 0.12s; position: relative; }
.tool-card:hover:not(.disabled):not(.soon) { background: rgba(21, 101, 192, 0.04); border-color: #1976D2; transform: translateY(-1px); }
.tool-card.disabled, .tool-card.soon { opacity: 0.55; cursor: not-allowed; }
.tool-card .tool-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: rgba(21, 101, 192, 0.08); color: #1565C0; border-radius: 6px; font-size: 18px; flex-shrink: 0; }
.tool-card .tool-text { flex: 1; min-width: 0; }
.tool-card .tool-label { font-weight: 500; color: #1F2937; font-size: 13px; }
.tool-card .tool-desc { color: #6B7280; font-size: 12px; margin-top: 2px; }
.tool-badge { position: absolute; top: 8px; right: 8px; font-size: 10px; padding: 2px 6px; border-radius: 4px; background: #F3F4F6; color: #6B7280; text-transform: uppercase; }
.tool-badge.disabled { background: #FEE2E2; color: #DC2626; }
.tool-badge.soon { background: #FEF3C7; color: #B45309; }

/* ─────────── PDF Import preview ─────────── */
.pdf-import-summary { padding: 8px 12px; background: #F5F7FA; border-radius: 4px; font-size: 13px; color: #1F2937; margin-bottom: 8px; }
.pdf-import-summary:empty { display: none; }
.pdf-import-account-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.pdf-import-account-row label { font-size: 12px; color: #6B7280; flex-shrink: 0; }
.pdf-import-account-row select { flex: 1; }
.pdf-import-table-wrap { max-height: 50vh; overflow: auto; border: 1px solid #E5E7EB; border-radius: 4px; }
.pdf-import-table { width: 100%; min-width: 1670px; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.pdf-import-table th { background: #F5F7FA; padding: 8px; text-align: left; font-weight: 600; color: #374151; position: sticky; top: 0; z-index: 1; }
.pdf-import-table td { padding: 6px 8px; border-bottom: 1px solid #E5E7EB; vertical-align: middle; }
.pdf-import-table select { padding: 4px 6px; font-size: 12px; height: auto; min-height: 0; }
.pdf-import-table tr.excluded { opacity: 0.4; }
.pdf-import-table tr.action-conciliate { background: rgba(22, 163, 74, 0.06); }
.pdf-import-table tr.action-ignore { background: rgba(107, 114, 128, 0.06); }

/* Toolbar do financeiro: scroll horizontal quando os botões não cabem (sem quebrar linha). */
section[data-page="launch"] .commands { flex-wrap: nowrap; overflow-x: auto; align-items: stretch; padding-bottom: 4px; }
section[data-page="launch"] .commands::-webkit-scrollbar { height: 6px; }
section[data-page="launch"] .commands::-webkit-scrollbar-thumb { background: #C7CDD8; border-radius: 3px; }
section[data-page="launch"] .commands::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }
section[data-page="launch"] .commands > * { flex-shrink: 0; }
section[data-page="launch"] .commands .filters.period-filter { min-width: 380px; }

/* Modais Importar (PDF/OFX/Planilha/AI): Step 1 herda largura padrão; Step 2 vai full-width pra tabela. */
aside.modal.new-launch_pdf_import .modal-body,
aside.modal.new-launch_ofx_import .modal-body,
aside.modal.new-launch_ofx_ai_import .modal-body,
aside.modal.new-launch_spreadsheet_import .modal-body,
aside.modal.new-launch_spreadsheet_ai_import .modal-body { transition: max-width 0.18s ease, width 0.18s ease; }
aside.modal.new-launch_pdf_import:has(form[data-modal-mode="step2"]) .modal-body,
aside.modal.new-launch_ofx_import:has(form[data-modal-mode="step2"]) .modal-body,
aside.modal.new-launch_ofx_ai_import:has(form[data-modal-mode="step2"]) .modal-body,
aside.modal.new-launch_spreadsheet_import:has(form[data-modal-mode="step2"]) .modal-body,
aside.modal.new-launch_spreadsheet_ai_import:has(form[data-modal-mode="step2"]) .modal-body { max-width: 95vw; width: 95vw; }

/* Actions dentro dos steps: padrão `form > .actions` (right-aligned, hr top, botões 22%). */
aside.modal.new-launch_pdf_import [data-pdf-import-step] > .actions,
aside.modal.new-launch_ofx_import [data-pdf-import-step] > .actions,
aside.modal.new-launch_ofx_ai_import [data-pdf-import-step] > .actions,
aside.modal.new-launch_spreadsheet_import [data-pdf-import-step] > .actions,
aside.modal.new-launch_spreadsheet_ai_import [data-pdf-import-step] > .actions {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #E0E4EB;
}
aside.modal.new-launch_pdf_import [data-pdf-import-step] > .actions button,
aside.modal.new-launch_ofx_import [data-pdf-import-step] > .actions button,
aside.modal.new-launch_ofx_ai_import [data-pdf-import-step] > .actions button,
aside.modal.new-launch_spreadsheet_import [data-pdf-import-step] > .actions button,
aside.modal.new-launch_spreadsheet_ai_import [data-pdf-import-step] > .actions button {
  width: 22%;
  min-width: 120px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  justify-content: center;
  text-align: center;
}

/* Hub Ferramentas: agrupamento Geral / Conty IA. */
.tool-group { margin-bottom: 20px; }
.tool-group:last-child { margin-bottom: 0; }
.tool-group-title { font-size: 12px; text-transform: uppercase; color: #6B7280; letter-spacing: 0.4px; margin: 0 0 10px; font-weight: 600; }

/* Match status na tabela (substitui antigo action select) */
.pdf-import-table .match-create     { color: #1565C0; font-weight: 500; }
.pdf-import-table .match-conciliate { color: #16A34A; font-weight: 500; }
.pdf-import-table .match-duplicate  { color: #6B7280; font-weight: 500; }
.pdf-import-table tr.match-duplicate { opacity: 0.65; }
.pdf-import-table tr.excluded       { opacity: 0.4; }

/* Descrição editável inline. */
.pdf-import-table .pdf-tx-description { width: 100%; padding: 4px 6px; font-size: 12px; border: 1px solid transparent; background: transparent; }
.pdf-import-table .pdf-tx-description:hover  { border-color: #E5E7EB; background: #FFF; }
.pdf-import-table .pdf-tx-description:focus  { border-color: #1976D2; background: #FFF; outline: none; }

/* Autocomplete inline em células de tabela. */
.pdf-import-table .inline-autocomplete { position: relative; }
.pdf-import-table .inline-autocomplete .autocomplete-input { width: 100%; padding: 4px 6px; font-size: 12px; height: auto; min-height: 0; }
.pdf-import-table .inline-autocomplete .autocomplete-list { position: absolute; top: 100%; left: 0; right: 0; background: #FFF; border: 1px solid #E5E7EB; border-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); max-height: 200px; overflow-y: auto; z-index: 10; }
.pdf-import-table .inline-autocomplete .autocomplete-item { padding: 6px 10px; cursor: pointer; font-size: 12px; }
.pdf-import-table .inline-autocomplete .autocomplete-item:hover { background: rgba(21, 101, 192, 0.06); }

/* Larguras fixas das colunas Step 2 (PDF — 12 colunas). table-layout: fixed garante que larguras
   declaradas sejam respeitadas. Datas todas iguais (100px), descrição mais larga (280px), demais
   campos uniformes (160px), ação um pouco menor (140px). */
.pdf-import-table th:nth-child(1),  .pdf-import-table td:nth-child(1)  { width: 40px;  }   /* checkbox */
.pdf-import-table th:nth-child(2),  .pdf-import-table td:nth-child(2)  { width: 100px; white-space: nowrap; }   /* data extrato */
.pdf-import-table th:nth-child(3),  .pdf-import-table td:nth-child(3)  { width: 100px; }   /* competência */
.pdf-import-table th:nth-child(4),  .pdf-import-table td:nth-child(4)  { width: 100px; }   /* vencimento */
.pdf-import-table th:nth-child(5),  .pdf-import-table td:nth-child(5)  { width: 280px; }   /* descrição */
.pdf-import-table th:nth-child(6),  .pdf-import-table td:nth-child(6)  { width: 110px; white-space: nowrap; }   /* valor */
.pdf-import-table th:nth-child(7),  .pdf-import-table td:nth-child(7)  { width: 160px; }   /* pessoa */
.pdf-import-table th:nth-child(8),  .pdf-import-table td:nth-child(8)  { width: 160px; }   /* categoria */
.pdf-import-table th:nth-child(9),  .pdf-import-table td:nth-child(9)  { width: 160px; }   /* forma pagamento */
.pdf-import-table th:nth-child(10), .pdf-import-table td:nth-child(10) { width: 160px; }   /* centro de custo */
.pdf-import-table th:nth-child(11), .pdf-import-table td:nth-child(11) { width: 160px; }   /* conciliação */
.pdf-import-table th:nth-child(12), .pdf-import-table td:nth-child(12) { width: 140px; }   /* ação */

.pdf-import-table td.pdf-cell-payment_method select,
.pdf-import-table td.pdf-cell-cost_center    select { width: 100%; }

/* Conciliação cell — lupa + remove + link #XX */
.pdf-import-table .pdf-match-search { color: #1565C0; cursor: pointer; margin-left: 6px; padding: 2px 4px; }
.pdf-import-table .pdf-match-search:hover { color: #0D47A1; }
.pdf-import-table .pdf-match-remove { color: #DC2626; cursor: pointer; margin-left: 4px; padding: 2px 4px; }
.pdf-import-table .pdf-match-remove:hover { color: #991B1B; }
.pdf-import-table .pdf-match-launch-link { color: inherit; text-decoration: none; cursor: pointer; }
.pdf-import-table .pdf-match-launch-link:hover { text-decoration: underline; }

/* Date inputs inline na tabela. */
.pdf-import-table input[type=date] { width: 100%; padding: 4px 6px; font-size: 12px; height: auto; min-height: 0; }

/* Sub-modal de match search — full-width pra tabela caber. */
aside.modal.new-launch_pdf_match_search .modal-body { max-width: 95vw; width: 95vw; }
/* Filtro período do sub-modal: layout + estilo `period-nav` igual ao do hub financeiro. */
aside.modal.new-launch_pdf_match_search .filters.period-filter { display: flex; flex-wrap: nowrap; align-items: stretch; gap: 6px; margin: 8px 0; }
aside.modal.new-launch_pdf_match_search .filters.period-filter > input { flex: 1 1 auto; min-width: 0; width: auto; margin: 0; }
aside.modal.new-launch_pdf_match_search .filters.period-filter button.period-nav,
aside.modal.new-launch_pdf_match_search .filters.period-filter button.ghost {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  padding: 0 10px;
  background: #FFFFFF;
  border: 1px solid #C7CDD8;
  border-radius: 4px;
  color: #1565C0;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  box-sizing: border-box;
  transition: background 0.12s, border-color 0.12s;
}
aside.modal.new-launch_pdf_match_search .filters.period-filter button.period-nav:hover,
aside.modal.new-launch_pdf_match_search .filters.period-filter button.ghost:hover {
  background: rgba(21, 101, 192, 0.06);
  border-color: #1976D2;
}
.pdf-match-table-wrap { max-height: 50vh; overflow-y: auto; border: 1px solid #E5E7EB; border-radius: 4px; margin-top: 8px; }
.pdf-match-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pdf-match-table th { background: #F5F7FA; padding: 8px; text-align: left; font-weight: 600; color: #374151; position: sticky; top: 0; }
.pdf-match-table td { padding: 6px 8px; border-bottom: 1px solid #E5E7EB; }
.pdf-match-table .empty { text-align: center; color: #9CA3AF; padding: 20px; }
.pdf-match-table tr:hover td { background: rgba(21, 101, 192, 0.04); cursor: pointer; }

/* Header de transação no sub-modal de match search */
.pdf-match-tx-summary { padding: 10px 12px; background: #F5F7FA; border: 1px solid #E5E7EB; border-radius: 4px; margin: 8px 0; }
.pdf-tx-summary-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.pdf-tx-summary-item { color: #1F2937; }
.pdf-tx-summary-type { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; text-transform: uppercase; }
.pdf-tx-summary-type.pdf-tx-type-in  { background: rgba(22,163,74,0.12);  color: #16A34A; }
.pdf-tx-summary-type.pdf-tx-type-out { background: rgba(220,38,38,0.12);  color: #DC2626; }

/* Ícone "ver lançamento" no sub-modal de match */
.pdf-match-table td.actions { width: 40px; text-align: center; }
.pdf-match-table .pdf-match-view { color: #1565C0; cursor: pointer; padding: 4px 6px; }
.pdf-match-table .pdf-match-view:hover { color: #0D47A1; }

/* Autocomplete-with-add em células de tabela: botão "+" compacto. */
.autocomplete-with-add.inline-add { gap: 4px; }
.autocomplete-with-add.inline-add .btn-add-related { padding: 0 8px; font-size: 11px; min-width: 0; line-height: 1; }

/* ─────────── Multi-select filter (checkbox dropdown) ─────────── */
/* Trigger é estilizado em runtime copiando computed style de <select> sibling — ver
   multi_select_match_style() em launch.js. Aqui só layout/structure. */
.multi-select-filter { position: relative; width: 100%; }
.multi-select-filter .multi-select-trigger {
  width: 100%;
  text-align: left;
  cursor: default;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  box-sizing: border-box;
}
.multi-select-filter .multi-select-trigger::after {
  content: '\f078';                                 /* FA chevron-down */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  color: #555;
  font-size: 10px;
  margin-left: 4px;
  pointer-events: none;
}
/* Painel: position FIXED setado em runtime via JS pra escapar do overflow:hidden do <th>. */
.multi-select-filter .multi-select-panel {
  position: fixed;
  min-width: 220px;
  max-width: 320px;
  max-height: 280px;
  overflow-y: auto;
  background: #FFFFFF;
  border: 1px solid #C7CDD8;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  padding: 6px 0;
  z-index: 9999;
}
.multi-select-filter .multi-select-panel[hidden] { display: none; }
.multi-select-filter .multi-select-panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 400;
  color: #1F2937;
  cursor: pointer;
  white-space: nowrap;
}
.multi-select-filter .multi-select-panel label:hover { background: rgba(21,101,192,0.06); }
.multi-select-filter .multi-select-panel label input[type=checkbox] { width: 14px; height: 14px; flex-shrink: 0; }
.multi-select-filter .multi-select-panel hr { border: 0; border-top: 1px solid #E5E7EB; margin: 4px 0; }

/* ─────────── Receipt Import (mesmo Step 2 do PDF, +1 coluna "Arquivo") ─────────── */
aside.modal.new-launch_receipt_import .modal-body { transition: max-width 0.18s ease, width 0.18s ease; }
aside.modal.new-launch_receipt_import:has(form[data-modal-mode="step2"]) .modal-body { max-width: 95vw; width: 95vw; }

aside.modal.new-launch_receipt_import [data-pdf-import-step] > .actions {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #E0E4EB;
}
aside.modal.new-launch_receipt_import [data-pdf-import-step] > .actions button {
  width: 22%;
  min-width: 120px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  justify-content: center;
  text-align: center;
}

/* Coluna "Arquivo" no Step 2 (receipt). Truncate no nome com ellipsis. */
aside.modal.new-launch_receipt_import .pdf-import-table .td-receipt-file {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #1F2937;
}
aside.modal.new-launch_receipt_import .pdf-import-table .td-receipt-file i { color: #6B7280; margin-right: 4px; }
aside.modal.new-launch_receipt_import .pdf-import-table .receipt-file-name { font-size: 12px; }
aside.modal.new-launch_receipt_import .pdf-import-table .receipt-file-link { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; color: #1565C0; text-decoration: none; }
aside.modal.new-launch_receipt_import .pdf-import-table .receipt-file-link:hover { color: #0D47A1; text-decoration: underline; }
aside.modal.new-launch_receipt_import .pdf-import-table .receipt-file-link i { color: inherit; }
aside.modal.new-launch_receipt_import .pdf-import-table .receipt-file-link .receipt-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Larguras fixas Step 2 quando flavor=receipt — 13 colunas (offset +1 por causa da coluna Arquivo).
   Datas iguais (100px), descrição maior (280px), demais uniformes (160px). Override ao bloco PDF
   acima — escopado pelo seletor `aside.modal.new-launch_receipt_import` (specificity maior). */
aside.modal.new-launch_receipt_import .pdf-import-table th:nth-child(1),
aside.modal.new-launch_receipt_import .pdf-import-table td:nth-child(1)  { width: 40px;  }   /* checkbox */
aside.modal.new-launch_receipt_import .pdf-import-table th:nth-child(2),
aside.modal.new-launch_receipt_import .pdf-import-table td:nth-child(2)  { width: 200px; }   /* arquivo */
aside.modal.new-launch_receipt_import .pdf-import-table th:nth-child(3),
aside.modal.new-launch_receipt_import .pdf-import-table td:nth-child(3)  { width: 100px; white-space: nowrap; }   /* data emissão */
aside.modal.new-launch_receipt_import .pdf-import-table th:nth-child(4),
aside.modal.new-launch_receipt_import .pdf-import-table td:nth-child(4)  { width: 100px; }   /* competência */
aside.modal.new-launch_receipt_import .pdf-import-table th:nth-child(5),
aside.modal.new-launch_receipt_import .pdf-import-table td:nth-child(5)  { width: 100px; }   /* vencimento */
aside.modal.new-launch_receipt_import .pdf-import-table th:nth-child(6),
aside.modal.new-launch_receipt_import .pdf-import-table td:nth-child(6)  { width: 280px; }   /* descrição */
aside.modal.new-launch_receipt_import .pdf-import-table th:nth-child(7),
aside.modal.new-launch_receipt_import .pdf-import-table td:nth-child(7)  { width: 110px; white-space: nowrap; }   /* valor */
aside.modal.new-launch_receipt_import .pdf-import-table th:nth-child(8),
aside.modal.new-launch_receipt_import .pdf-import-table td:nth-child(8)  { width: 160px; }   /* pessoa */
aside.modal.new-launch_receipt_import .pdf-import-table th:nth-child(9),
aside.modal.new-launch_receipt_import .pdf-import-table td:nth-child(9)  { width: 160px; }   /* categoria */
aside.modal.new-launch_receipt_import .pdf-import-table th:nth-child(10),
aside.modal.new-launch_receipt_import .pdf-import-table td:nth-child(10) { width: 160px; }   /* forma pagamento */
aside.modal.new-launch_receipt_import .pdf-import-table th:nth-child(11),
aside.modal.new-launch_receipt_import .pdf-import-table td:nth-child(11) { width: 160px; }   /* centro de custo */
aside.modal.new-launch_receipt_import .pdf-import-table th:nth-child(12),
aside.modal.new-launch_receipt_import .pdf-import-table td:nth-child(12) { width: 160px; }   /* conciliação */
aside.modal.new-launch_receipt_import .pdf-import-table th:nth-child(13),
aside.modal.new-launch_receipt_import .pdf-import-table td:nth-child(13) { width: 140px; }   /* ação */
aside.modal.new-launch_receipt_import .pdf-import-table { min-width: 1830px; }

/* Progress bar pseudo-determinística (multifile single call → fake percentage). */
.receipt-import-errors { margin-left: 10px; }
.receipt-import-errors summary { cursor: pointer; }
.receipt-import-errors ul { margin: 6px 0 0 18px; padding: 0; font-size: 12px; color: #6B7280; }
.receipt-import-errors ul b { color: #1F2937; }

.receipt-import-progress { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.receipt-import-progress-bar { height: 6px; background: #E5E7EB; border-radius: 3px; overflow: hidden; }
.receipt-import-progress-bar > div { height: 100%; background: #1565C0; width: 0%; transition: width 0.3s ease; }
.receipt-import-progress-text { font-size: 12px; color: #6B7280; margin: 0; text-align: center; }
