.tx-card { min-width: 0; background: white; border: 1px solid #fffdf8; border-radius: 24px; padding: 24px; box-shadow: 0 10px 30px -5px #0000000a; }
.tx-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.tx-btn { border-radius: 999px; padding: 9px 16px; background: #131310; color: white; font-size: 12px; font-weight: 700; cursor: pointer; }
.tx-btn.secondary { background: #efeadf; color: #3d3b36; }
.tx-btn.danger { background: #b42318; }
.tx-btn:disabled { opacity: .45; cursor: not-allowed; }
.tx-actions { display: flex; align-items: center; gap: 6px; }
.tx-btn.tx-action { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 8px; border-radius: 10px; flex-shrink: 0; }
.tx-action-delete:hover { color: #9a1d14; background: #fcefed; }
.tx-input { border: 1px solid #cfc8b9; border-radius: 8px; background: white; padding: 8px; font-size: 12px; width: 100%; min-width: 96px; }
.tx-input:focus, .tx-btn:focus-visible { outline: 2px solid #2e8b57; outline-offset: 2px; }
.tx-scroll { overflow-x: auto; }
.tx-table { border-collapse: collapse; width: 100%; text-align: left; font-size: 12px; }
.tx-table th { background: #f7f4ee; color: #6b675e; font-weight: 700; white-space: nowrap; }
.tx-table td, .tx-table th { padding: 10px 8px; border-bottom: 1px solid #e3ddd0; }
.tx-table td { vertical-align: middle; }
.tx-table tbody tr:hover { background: #f7f4ee; }
.tx-table tfoot { background: #eaf4ed; }
.tx-table .description { min-width: 170px; max-width: 300px; overflow-wrap: anywhere; }
.tx-table .money { font-family: 'JetBrains Mono', monospace; white-space: nowrap; }
.tx-muted { color: #6b675e; font-size: 12px; line-height: 1.7; }
.tx-notice { padding: 12px 16px; background: #eaf4ed; border: 1px solid #b9dcc4; border-radius: 12px; color: #155a33; font-size: 12px; line-height: 1.7; }
.tx-error { color: #9a1d14; font-size: 12px; white-space: pre-wrap; }
.tx-search-field { display: flex; align-items: center; gap: 6px; min-width: 165px; }
.tx-search-field > svg { color: #6b675e; }
.search-select-popup { position: fixed; z-index: 1000; background: white; border: 1px solid #cfc8b9; border-radius: 12px; padding: 4px; overflow-y: auto; box-shadow: 0 12px 32px #0f172a26; }
.search-select-option { display: flex; align-items: center; gap: 8px; text-align: left; width: 100%; border-radius: 8px; padding: 10px; font-size: 12px; color: #3d3b36; }
.search-select-option small { display: block; margin-top: 2px; color: #6b675e; }
.search-select-option:hover, .search-select-option[aria-selected=true] { background: #eaf4ed; color: #1a6a3c; }
.search-select-option input[type=checkbox] { width: 16px; height: 16px; accent-color: #1f7a45; flex-shrink: 0; cursor: pointer; }
.search-select-section { padding: 8px 10px 4px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #a8a295; }
.search-select-option.is-group { background: #f7f4ee; font-weight: 700; margin-top: 2px; border: 1px solid #efeadf; }
.search-select-option.is-category { padding-left: 22px; }
.search-select-badge { display: inline-flex; align-items: center; padding: 1px 6px; border-radius: 999px; font-size: 10px; font-weight: 700; background: #e3ddd0; color: #57534b; margin-left: 6px; vertical-align: middle; }
.hist-legend-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: #f7f4ee; border: 1px solid #e3ddd0; font-size: 11px; font-weight: 600; color: #3d3b36; cursor: pointer; transition: background .15s, border-color .15s; }
.hist-legend-pill:hover { background: #efeadf; border-color: #cfc8b9; }
.hist-legend-line { width: 16px; height: 0; border-top-width: 3px; display: inline-block; flex-shrink: 0; }
.hist-legend-line.dashed { border-top-style: dashed; border-top-width: 2px; }
.hist-stat-info { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 999px; background: #e3ddd0; color: #57534b; font-size: 9px; font-weight: 800; text-transform: none; line-height: 1; cursor: help; flex-shrink: 0; transition: background .15s, color .15s; }
.hist-stat-info:hover, .hist-stat-info:focus-visible { background: #131310; color: #fffdf8; outline: none; }
#histStatTooltip { position: fixed; z-index: 9999; max-width: 270px; padding: 8px 10px; border-radius: 10px; background: #131310; color: #f7f4ee; font-size: 11px; font-weight: 500; line-height: 1.45; box-shadow: 0 10px 28px #0f172a40; pointer-events: none; }
.grupo-ignorado .categoria-totais, .grupo-ignorado .tx-table th:nth-child(2), .grupo-ignorado .tx-table th:nth-child(3), .grupo-ignorado .tx-table td:nth-child(2), .grupo-ignorado .tx-table td:nth-child(3) { display: none; }
.tx-stats { display: flex; flex-wrap: wrap; gap: 18px; padding: 16px 0; font-size: 12px; }
.tx-stats strong { display: block; margin-top: 5px; font-family: 'JetBrains Mono', monospace; font-size: 18px; }
dialog.tx-dialog { padding: 24px; border: 0; border-radius: 24px; max-width: min(1150px, 96vw); width: 100%; max-height: 90vh; overflow: auto; color: #2a2925; box-shadow: 0 25px 80px #0f172a33; }
dialog.tx-dialog::backdrop { background: #0f172a80; backdrop-filter: blur(3px); }
.tx-steps { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0; font-size: 12px; color: #a8a295; }
.tx-steps .active { color: #1a6a3c; font-weight: 800; }
.tx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 20px 0; }
.tx-grid label { display: grid; gap: 8px; font-size: 12px; font-weight: 700; }
.tx-footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding-top: 20px; }
.tx-duplicate { background: #fcf6e6; }
.tx-invalid { background: #fcefed; }
#txImportDialog .tx-import-reused { display: block; margin-top: 4px; color: #1a6a3c; font-size: 11px; }
.tx-table input[type=checkbox] { width: 17px; height: 17px; accent-color: #1f7a45; }
@media (max-width: 640px) {
  .tx-card, dialog.tx-dialog { padding: 16px; }
  #appHeader > div { max-width: 100%; min-width: 0; }
  .app-tabs, .app-period { flex-wrap: wrap; border-radius: 18px; max-width: 100%; }
}
.tx-reconcile-card { border-radius: 16px; padding: 16px; margin-bottom: 18px; border: 1px solid #e3ddd0; }
.tx-reconcile-card.reconcile-ok { background: #eaf4ed; border-color: #86efac; color: #166534; }
.tx-reconcile-card.reconcile-warn { background: #fcf6e6; border-color: #f4dfa5; color: #7f4a00; }
.tx-reconcile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-top: 10px; }
.tx-reconcile-grid div { display: flex; flex-direction: column; gap: 2px; }
.tx-reconcile-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-weight: 700; font-size: 11px; }
.tx-reconcile-badge.badge-ok { background: #d9ecdf; color: #1a6a3c; }
.tx-reconcile-badge.badge-warn { background: #fbedcc; color: #9a5b00; }
.tx-mode-tabs { display: inline-flex; background: #efeadf; padding: 3px; border-radius: 999px; gap: 4px; margin-bottom: 16px; }
.tx-mode-tab { border: none; background: transparent; padding: 6px 14px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #6b675e; cursor: pointer; }
.tx-mode-tab.active { background: white; color: #131310; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

.tx-badge-origem { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; margin-right: 6px; display: inline-block; text-transform: uppercase; letter-spacing: 0.3px; }
.origem-cartao { background: #fce7f3; color: #9d174d; border: 1px solid #fbcfe8; }
.origem-conta { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.tx-btn-icon { display: inline-flex; align-items: center; gap: 6px; }
.tx-mode-tab { display: inline-flex; align-items: center; gap: 6px; }
.tx-mode-tab svg { width: 14px; height: 14px; }
.tx-notice-warn { background: #fcf6e6; border-color: #f4dfa5; color: #7f4a00; }
.tx-code { background: white; padding: 8px; border-radius: 8px; font-family: 'JetBrains Mono', monospace; font-size: 11px; border: 1px solid #fbc7b4; white-space: pre-wrap; }
.tx-grid.tx-grid-compact { margin: 10px 0; }
.tx-check { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; margin-bottom: 16px; background: #f7f4ee; border: 1px solid #e3ddd0; border-radius: 12px; font-size: 12px; line-height: 1.6; color: #3d3b36; cursor: pointer; }
.tx-check input { width: 17px; height: 17px; margin-top: 2px; accent-color: #1f7a45; flex-shrink: 0; }
.tx-avisos { margin-top: 10px; padding-left: 18px; list-style: disc; font-size: 12px; color: #7f4a00; }

/* Telas estreitas: cada transação vira um cartão com rótulos, sem rolagem horizontal. */
@media (max-width: 768px) {
  #viewTransacoes .tx-table thead tr:first-child { display: none; }
  #viewTransacoes .tx-table, #viewTransacoes .tx-table thead, #viewTransacoes .tx-table tbody, #viewTransacoes .tx-table tfoot { display: block; }
  #viewTransacoes .tx-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; padding: 14px; margin-bottom: 10px; border: 1px solid #e3ddd0; border-radius: 16px; background: white; }
  #viewTransacoes .tx-table tbody tr:hover { background: white; }
  #viewTransacoes .tx-table tfoot tr { background: #eaf4ed; border-color: #b9dcc4; }
  #viewTransacoes .tx-table td, #viewTransacoes .tx-table th { display: block; padding: 0; border: 0; min-width: 0; background: transparent; }
  #viewTransacoes .tx-table [data-label]::before { content: attr(data-label); display: block; margin-bottom: 4px; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #a8a295; }
  #viewTransacoes .tx-table td.description, #viewTransacoes .tx-table td[data-label="Observação"],
  #viewTransacoes .tx-table td[data-label="Grupo"], #viewTransacoes .tx-table td[data-label="Categoria"],
  #viewTransacoes .tx-table td[colspan] { grid-column: 1 / -1; max-width: none; }
  #viewTransacoes .tx-table td[data-label="Ações"], #viewTransacoes .tx-table th[data-label="Ações"] { grid-column: 1 / -1; }
  #viewTransacoes .tx-table td[data-label="Ações"]::before, #viewTransacoes .tx-table th[data-label="Ações"]::before { display: none; }
  #viewTransacoes .tx-table td[data-label="Valor"] { font-size: 15px; font-weight: 700; }
  #viewTransacoes .tx-search-field, #viewTransacoes .tx-input { min-width: 0; }
  #viewTransacoes .tx-scroll { overflow: visible; }
}
@media (max-width: 768px) {
  /* Cartão compacto: descrição e valor no topo, conta e data em linha discreta. */
  #viewTransacoes #txTableBody tr { gap: 8px 10px; padding: 12px; }
  #viewTransacoes #txTableBody td.description { order: -3; grid-column: 1 / 2; font-weight: 700; color: #131310; }
  #viewTransacoes #txTableBody td[data-label="Valor"] { order: -2; text-align: right; }
  #viewTransacoes #txTableBody td[data-label="Conta"], #viewTransacoes #txTableBody td[data-label="Data"] { order: -1; font-size: 11px; color: #6b675e; }
  #viewTransacoes #txTableBody td[data-label="Data"] { text-align: right; }
  #viewTransacoes #txTableBody td.description::before, #viewTransacoes #txTableBody td[data-label="Valor"]::before,
  #viewTransacoes #txTableBody td[data-label="Conta"]::before, #viewTransacoes #txTableBody td[data-label="Data"]::before { display: none; }
  #viewTransacoes #txTableBody td[data-label="Grupo"], #viewTransacoes #txTableBody td[data-label="Categoria"] { grid-column: auto; }
  #viewTransacoes #txTableBody td[data-label="Ações"] { grid-column: 2 / 3; align-self: end; }
  #viewTransacoes #txTableBody td[data-label="Ações"] .tx-actions { justify-content: flex-end; }
  #viewTransacoes #txTableBody .tx-search-field > svg { display: none; }
  #viewTransacoes #txTableBody .tx-input { padding: 6px 8px; }
}
/* Nome e tipo da conta lado a lado; o tipo é um seletor de três posições. */
.conta-nome-tipo { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; margin-top: 8px; }
.conta-nome-tipo > label { flex: 1 1 220px; }
.conta-campo { display: grid; gap: 8px; font-size: 12px; font-weight: 700; border: 0; padding: 0; margin: 0; min-width: 0; }
.conta-campo legend { padding: 0; margin-bottom: 8px; }
.conta-tipo { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: #efeadf; }
.conta-tipo label { position: relative; }
.conta-tipo input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.conta-tipo span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 9px; font-size: 12px; font-weight: 600; color: #6b675e; white-space: nowrap; transition: background .15s, color .15s; }
.conta-tipo span svg { width: 14px; height: 14px; }
.conta-tipo label:hover span { color: #131310; }
.conta-tipo input:checked + span { background: white; color: #131310; box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.conta-tipo input:focus-visible + span { outline: 2px solid #2e8b57; outline-offset: 1px; }
.conta-tipo input:disabled + span { opacity: .45; }
.conta-tipo input:disabled { cursor: not-allowed; }
/* Lista de investimentos da Pluggy na edição da instituição (contas anexas). */
.conta-investimentos { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow: auto; padding: 10px 12px; border-radius: 12px; background: #f7f4ee; border: 1px solid #e3ddd0; }
/* Transação dividida entre categorias. */
.tx-divisao-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; font-size: 12px; font-weight: 700; white-space: nowrap; }
.tx-divisao-badge:hover { background: #ede9fe; }
.tx-divisao-lista { display: flex; flex-direction: column; gap: 2px; min-width: 220px; font-size: 12px; }
.tx-divisao-lista li { display: flex; justify-content: space-between; gap: 8px; }
.tx-divisao-lista .money { color: #57534b; }
.tx-divisao-parte { display: grid; grid-template-columns: minmax(0, 1fr) 140px 36px; gap: 8px; align-items: center; }
.tx-divisao-parte .money { font-family: 'JetBrains Mono', monospace; text-align: right; }
.tx-divisao-restante { display: flex; flex-direction: column; align-items: flex-end; padding: 0 6px; }
.tx-divisao-restante small { font-size: 11px; color: #6b675e; }
@media (max-width: 640px) { .tx-divisao-parte { grid-template-columns: minmax(0, 1fr) 110px 36px; } }
