/* ------------------------------------------------------------------
   ui-700 — camada visual do Finanças X (v7)

   Interface clean, botões discretos, cores sólidas, sem degradê.
   Instrument Sans com letter-spacing -1 (-0.01em).
   Carregada depois da ui-600, que trata o layout estrutural.

   Tudo aqui é independente de tema: cor vem de variáveis que cada tema
   já define, e as novas usam valor de reserva quando o tema não declara.
   ------------------------------------------------------------------ */

html body {
  --fx-raio: 12px;
  --fx-raio-sm: 8px;
  --fx-linha: var(--line, #e3e3eb);
  --fx-superficie: var(--surface, #fff);
  --fx-tinta: var(--ink, #1a1930);
  --fx-fraco: var(--muted, #6b6a7d);
  --fx-primaria: var(--primary, #4b4a9e);
  --fx-ok: #15803d;
  --fx-atencao: #92610c;
  --fx-erro: #b02a37;
  --fx-gap: 14px;
}

html body .fx-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

/* ============================ ETIQUETAS ============================ */

html body .fx-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--fx-chip-cor, #64748b) 14%, transparent);
  color: color-mix(in srgb, var(--fx-chip-cor, #64748b) 72%, var(--fx-tinta));
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  max-width: 100%;
}
html body .fx-chip-ponto {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--fx-chip-cor, #64748b);
  flex: none;
}
html body .fx-chip-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html body .fx-chip-vazia { background: color-mix(in srgb, var(--fx-fraco) 12%, transparent); color: var(--fx-fraco); padding-left: 9px; }

/* Quando o navegador não tem color-mix, a cor sólida do ponto garante
   que a informação não dependa só do preenchimento do fundo. */
@supports not (background: color-mix(in srgb, red 10%, transparent)) {
  html body .fx-chip { background: #f1f1f5; color: var(--fx-tinta); }
}

/* ======================= SELO DE BANCO ============================= */

html body .fx-bank {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--fx-bank-cor, #64748b);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  flex: none;
}
html body .fx-bank-sm { width: 24px; height: 24px; border-radius: 7px; font-size: 10px; }

/* ===================== BANDEIRA DO CARTÃO ========================== */

html body .fx-brand { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
html body .fx-brand-svg { width: 28px; height: 18px; flex: none; border-radius: 3px; }
html body .fx-brand-nome {
  font-size: 12px; font-weight: 600; color: var(--fx-tinta);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ========================== SEGMENTOS ============================== */

html body .fx-seg {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: color-mix(in srgb, var(--fx-fraco) 8%, transparent);
  border: 1px solid var(--fx-linha);
  border-radius: var(--fx-raio);
  margin-bottom: var(--fx-gap);
  overflow-x: auto;
  scrollbar-width: none;
}
html body .fx-seg::-webkit-scrollbar { height: 0; }
html body .fx-seg-item {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px;
  border-radius: var(--fx-raio-sm);
  font-size: 13px; font-weight: 600;
  color: var(--fx-fraco);
  white-space: nowrap;
  min-height: 40px;
}
html body .fx-seg-item.is-active { background: var(--fx-superficie); color: var(--fx-tinta); border: 1px solid var(--fx-linha); }
html body .fx-seg-item:hover { color: var(--fx-tinta); }
html body .fx-seg-n {
  min-width: 20px; padding: 0 6px; height: 20px;
  display: inline-grid; place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--fx-primaria) 12%, transparent);
  color: var(--fx-primaria);
  font-size: 11px; font-weight: 700;
}

/* =========================== PAINEL =============================== */

html body .fx-dash { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--fx-gap); align-items: start; }
html body .fx-dash > .fx-bloco { margin-bottom: 0; }
html body .fx-bloco-insights { grid-column: 1 / -1; }
@media (max-width: 900px) { html body .fx-dash { grid-template-columns: 1fr; } }

html body .fx-kpi-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html body .fx-kpi-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 560px) { html body .fx-kpi-3 { grid-template-columns: 1fr 1fr; } }

html body .fx-sobra { display: grid; gap: 14px; }
html body .fx-sobra-valor { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
html body .fx-sobra-linhas { display: grid; gap: 8px; }
html body .fx-sobra-linhas > div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
html body .fx-sobra-linhas span { color: var(--fx-fraco); }

html body .fx-barra { height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--fx-fraco) 14%, transparent); overflow: hidden; margin: 10px 0 6px; }
html body .fx-barra > span { display: block; height: 100%; background: var(--fx-primaria); border-radius: 999px; }
html body .fx-barra-fina { height: 6px; margin: 6px 0 0; }

html body .fx-pend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
html body .fx-pend > li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--fx-linha); border-radius: var(--fx-raio); }
html body .fx-pend > li.is-alerta { border-color: color-mix(in srgb, var(--fx-atencao) 40%, var(--fx-linha)); }
html body .fx-pend > li > div { flex: 1; min-width: 0; }
html body .fx-pend strong { display: block; font-size: 13px; }
html body .fx-pend small { color: var(--fx-fraco); font-size: 12px; }
html body .fx-pend-n {
  min-width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 10px; background: color-mix(in srgb, var(--fx-primaria) 10%, transparent);
  color: var(--fx-primaria); font-weight: 700; font-size: 14px; flex: none;
}

html body .fx-cats { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
html body .fx-cats-topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
html body .fx-cats-topo strong { font-size: 13px; white-space: nowrap; }

html body .fx-contas { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
html body .fx-contas > li { display: flex; align-items: center; gap: 11px; padding: 9px 2px; border-bottom: 1px solid var(--fx-linha); }
html body .fx-contas > li:last-child { border-bottom: 0; }
html body .fx-contas-nome { flex: 1; min-width: 0; }
html body .fx-contas-nome strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html body .fx-contas-nome small { color: var(--fx-fraco); font-size: 12px; }

html body .fx-insights { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
html body .fx-insights > li {
  position: relative; padding-left: 16px; font-size: 13px; line-height: 1.55; color: var(--fx-tinta);
}
html body .fx-insights > li::before {
  content: ""; position: absolute; left: 0; top: 8px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--fx-primaria);
}

/* ======================== COMPROVANTES ============================= */

html body .fx-receipts { display: grid; gap: 10px; }
html body .fx-receipt {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 12px; align-items: start;
  padding: 11px; border: 1px solid var(--fx-linha); border-radius: var(--fx-raio);
}
html body .fx-receipt-thumb {
  width: 72px; height: 72px; border-radius: var(--fx-raio-sm);
  overflow: hidden; background: color-mix(in srgb, var(--fx-fraco) 10%, transparent);
  display: grid; place-items: center;
}
html body .fx-receipt-thumb img { width: 100%; height: 100%; object-fit: cover; }
html body .fx-receipt-pdf { font-size: 12px; font-weight: 700; color: var(--fx-fraco); }
html body .fx-receipt-corpo { min-width: 0; display: grid; gap: 4px; }
html body .fx-receipt-corpo strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html body .fx-receipt-corpo small { color: var(--fx-fraco); font-size: 12px; }
html body .fx-receipt-tx { color: var(--fx-ok) !important; }
html body .fx-receipt-link { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
html body .fx-receipt-link select { min-width: 0; flex: 1 1 220px; }
html body .fx-receipt-acoes { display: grid; gap: 6px; justify-items: stretch; }
@media (max-width: 720px) {
  html body .fx-receipt { grid-template-columns: 56px minmax(0, 1fr); }
  html body .fx-receipt-thumb { width: 56px; height: 56px; }
  html body .fx-receipt-acoes { grid-column: 1 / -1; grid-auto-flow: column; }
}

html body .fx-file-btn { position: relative; overflow: hidden; cursor: pointer; }
html body .fx-file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

html body .fx-token { display: block; margin-top: 8px; padding: 9px 11px; background: color-mix(in srgb, var(--fx-fraco) 10%, transparent); border-radius: var(--fx-raio-sm); overflow-wrap: anywhere; font-size: 12px; }

/* ======================== DUPLICIDADES ============================= */

html body .fx-dup {
  display: grid; grid-template-columns: 1fr 1fr auto; gap: 14px; align-items: start;
  padding: 13px; border: 1px solid var(--fx-linha); border-radius: var(--fx-raio); margin-bottom: 10px;
}
html body .fx-dup-lado { min-width: 0; display: grid; gap: 3px; }
html body .fx-dup-lado strong { font-size: 13px; overflow-wrap: anywhere; }
html body .fx-dup-lado small { color: var(--fx-fraco); font-size: 12px; }
html body .fx-dup-acoes { display: grid; gap: 6px; }
@media (max-width: 860px) {
  html body .fx-dup { grid-template-columns: 1fr; }
  html body .fx-dup-acoes { grid-auto-flow: row; }
}

/* ======================= NOTIFICAÇÕES ============================== */

html body .fx-notifs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
html body .fx-notif {
  display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 12px; border: 1px solid var(--fx-linha); border-radius: var(--fx-raio);
}
html body .fx-notif-marca { align-self: stretch; border-radius: 999px; background: var(--fx-fraco); }
html body .fx-notif.is-danger .fx-notif-marca { background: var(--fx-erro); }
html body .fx-notif.is-warning .fx-notif-marca { background: var(--fx-atencao); }
html body .fx-notif.is-info .fx-notif-marca { background: var(--fx-primaria); }
html body .fx-notif.is-lida { opacity: .62; }
html body .fx-notif-corpo { min-width: 0; }
html body .fx-notif-corpo strong { display: block; font-size: 13px; }
html body .fx-notif-corpo p { margin: 2px 0; font-size: 13px; color: var(--fx-tinta); }
html body .fx-notif-corpo small { color: var(--fx-fraco); font-size: 12px; }
html body .fx-notif-acoes { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 720px) {
  html body .fx-notif { grid-template-columns: 4px minmax(0, 1fr); }
  html body .fx-notif-acoes { grid-column: 2; justify-content: flex-start; }
}

/* ========================== DIVERSOS =============================== */

html body .fx-status { font-size: 12px; font-weight: 600; white-space: nowrap; }
html body .fx-status.is-ok { color: var(--fx-ok); }
html body .fx-status.is-wait { color: var(--fx-atencao); }
html body .fx-status.is-off { color: var(--fx-fraco); }
html body tr.is-off { opacity: .6; }

html body .fx-acoes { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
html body .fx-inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
html body .fx-grow { flex: 1 1 200px; }
html body .fx-sub-conta { font-size: 12px; color: var(--fx-fraco); margin-left: 6px; }

html body .fx-dicas { display: grid; gap: 10px; }
html body .fx-dica { padding: 11px 13px; border: 1px solid var(--fx-linha); border-radius: var(--fx-raio); }
html body .fx-dica strong { display: block; font-size: 13px; margin-bottom: 3px; }
html body .fx-dica p { margin: 0; font-size: 13px; color: var(--fx-fraco); line-height: 1.55; }

html body .fx-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
html body .fx-tab {
  padding: 9px 14px; min-height: 40px;
  border: 1px solid var(--fx-linha); background: var(--fx-superficie);
  border-radius: var(--fx-raio-sm); font-size: 13px; font-weight: 600; color: var(--fx-fraco); cursor: pointer;
}
html body .fx-tab.is-active { color: var(--fx-tinta); border-color: color-mix(in srgb, var(--fx-primaria) 45%, var(--fx-linha)); }

html body .fx-pop { position: relative; display: inline-block; }
html body .fx-pop > summary { list-style: none; cursor: pointer; }
html body .fx-pop > summary::-webkit-details-marker { display: none; }
html body .fx-pop-corpo {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  min-width: 260px; padding: 13px;
  background: var(--fx-superficie); border: 1px solid var(--fx-linha); border-radius: var(--fx-raio);
}
@media (max-width: 720px) {
  html body .fx-pop-corpo { position: static; min-width: 0; margin-top: 8px; }
}

html body .fx-blocos-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-bottom: 14px; }

html body .fx-push-painel[hidden] { display: none !important; }

/* ===================== TIPOGRAFIA E BOTÕES ========================= */

html body { letter-spacing: -0.01em; }
html body .btn {
  letter-spacing: -0.01em;
  font-weight: 600;
  border-radius: var(--fx-raio-sm);
}
html body .btn:not(.primary) { background: var(--fx-superficie); }
html body .panel { border-radius: var(--fx-raio); }

/* Nenhum degradê em nenhuma superfície desta camada. */
html body .fx-bloco,
html body .fx-chip,
html body .fx-bank,
html body .fx-seg,
html body .fx-notif,
html body .fx-receipt { background-image: none !important; }

/* Foco sempre visível, inclusive nos controles novos. */
html body .fx-seg-item:focus-visible,
html body .fx-tab:focus-visible,
html body .fx-receipt-thumb:focus-visible,
html body .fx-pop > summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--fx-primaria) 55%, #fff);
  outline-offset: 2px;
}

/* ============ CONTA E CARTÃO NA LISTA DE LANÇAMENTOS ============== */

html body .fx-conta-celula { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
html body .fx-conta-txt { display: grid; min-width: 0; line-height: 1.25; }
html body .fx-conta-txt strong { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html body .fx-conta-txt small { font-size: 11.5px; color: var(--fx-fraco); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html body .fx-conta-celula .fx-brand { flex-basis: 100%; }
@media (min-width: 1200px) { html body .fx-conta-celula .fx-brand { flex-basis: auto; } }

/* ==================== REQUISITOS DA ATUALIZAÇÃO =================== */

html body .fx-checks { border: 1px solid var(--fx-linha); border-radius: var(--fx-raio); overflow: hidden; margin: 0 0 14px; }
html body .fx-check { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 13px; border-bottom: 1px solid var(--fx-linha); font-size: 13px; }
html body .fx-check:last-child { border-bottom: 0; }
html body .fx-check-st { font-size: 12px; font-weight: 700; }
html body .fx-check-st.is-ok { color: var(--fx-ok); }
html body .fx-check-st.is-bad { color: var(--fx-erro); }
html body .fx-backups { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 5px; font-size: 12px; }

/* ===================== SEGUNDO FATOR ============================== */

html body .fx-2fa { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 760px) { html body .fx-2fa { grid-template-columns: 1fr; } }
html body .fx-2fa-qr { display: grid; place-items: center; min-height: 190px; padding: 10px; border: 1px solid var(--fx-linha); border-radius: var(--fx-raio); background: #fff; }
html body .fx-2fa-qr img, html body .fx-2fa-qr canvas { max-width: 100%; height: auto; }
html body .fx-2fa-passos { min-width: 0; }
html body .fx-recovery { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
html body .fx-recovery code { padding: 6px 10px; background: rgba(0,0,0,.05); border-radius: var(--fx-raio-sm); font-size: 13px; letter-spacing: .08em; }

/* ==================================================================
   ACESSIBILIDADE — contraste e área de toque

   O accent configurado (#5271FF na instalação atual) rende 4.07 de
   contraste com branco, abaixo dos 4.5 que o WCAG AA pede para texto
   normal. Em vez de trocar a cor da marca, derivamos uma variante mais
   profunda só para as superfícies que carregam texto branco, e uma
   variante de texto que mistura o accent com a cor de tinta do tema.
   Assim a correção vale no claro e no escuro, sem travar o tema.
   ================================================================== */

html body {
  --fx-primaria-fundo: color-mix(in srgb, var(--primary, #4b4a9e) 80%, #000);
  --fx-primaria-texto: color-mix(in srgb, var(--primary, #4b4a9e) 70%, var(--ink, #172033));
  --fx-perigo-fundo: color-mix(in srgb, var(--red, #e5484d) 82%, #000);
}

html body .btn.primary,
html body button.btn.primary,
html body a.btn.primary {
  background: var(--fx-primaria-fundo) !important;
  border-color: var(--fx-primaria-fundo) !important;
  color: #fff !important;
}
html body .btn.primary:hover { background: color-mix(in srgb, var(--primary, #4b4a9e) 70%, #000) !important; }

html body .brand-mark,
html body .nav-count,
html body .nav-group-badge,
html body .fx-seg-n,
html body .fx-pend-n { background: color-mix(in srgb, var(--primary, #4b4a9e) 14%, transparent) !important; color: var(--fx-primaria-texto) !important; }
html body .brand-mark { background: var(--fx-primaria-fundo) !important; color: #fff !important; }

html body .sidebar nav a.active,
html body .sidebar nav a.active .nav-label,
html body .nav-label,
html body a:not(.btn):not(.fx-seg-item).is-accent,
html body .panel-head > a { color: var(--fx-primaria-texto) !important; }

html body .notification-count,
html body .badge-danger { background: var(--fx-perigo-fundo) !important; color: #fff !important; }

html body .status-chip { color: color-mix(in srgb, currentColor 100%, var(--ink, #172033) 0%); }





/* Controle desabilitado precisa continuar legível, não sumir no fundo. */
html body .btn[disabled],
html body button[disabled],
html body input[disabled],
html body select[disabled] {
  opacity: 1 !important;
  color: var(--fx-fraco) !important;
  background: color-mix(in srgb, var(--fx-fraco) 10%, var(--fx-superficie)) !important;
  border-color: var(--fx-linha) !important;
  cursor: not-allowed;
}
html body .btn.primary[disabled] { background: color-mix(in srgb, var(--fx-fraco) 22%, var(--fx-superficie)) !important; color: var(--fx-fraco) !important; }

/* Área de toque de 44px no celular e no tablet em retrato, como pedido. */
@media (pointer: coarse), (max-width: 1023px) {
  html body .btn:not(#_),
  html body a.btn:not(#_),
  html body button.btn:not(#_),
  html body select:not(#_),
  html body input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not(#_),
  html body textarea:not(#_),
  html body .link-button:not(#_),
  html body summary.btn:not(#_),
  html body .fx-seg-item:not(#_),
  html body .fx-tab:not(#_),
  html body .nav-group-toggle:not(#_),
  html body .nav-tools button:not(#_),
  html body .history-button:not(#_),
  html body .analytics-switch button:not(#_),
  html body .nav-move-buttons button:not(#_),
  html body .sidebar nav a:not(#_) {
    min-height: 44px !important;
  }
  html body .nav-tools button:not(#_),
  html body .history-button:not(#_),
  html body .nav-move-buttons button:not(#_),
  html body .sidebar-collapse-toggle:not(#_),
  html body .analytics-expand:not(#_) { min-width: 44px !important; }
}

/* A informação nunca depende só de cor: valores negativos e positivos
   ganham sinal, e as situações ganham palavra além do tom. */
html body .negative::before { content: ""; }
html body .fx-status::before { content: ""; }

/* Alvos que faltavam no toque: menu, sino, resumos abríveis e caixas de
   seleção das tabelas. A caixa continua pequena visualmente, mas ganha
   área de clique de 44px por um pseudo-elemento. */
@media (pointer: coarse), (max-width: 1023px) {
  html body .menu-btn:not(#_),
  html body .notification-trigger:not(#_),
  html body summary:not(#_),
  html body .section-summary:not(#_),
  html body details > summary:not(#_) { min-height: 44px !important; display: flex; align-items: center; }

  /* O ícone do botão de menu vem do script. Camadas antigas desenhavam um
     segundo hambúrguer no pseudo-elemento, e os dois apareciam empilhados. */
  html body .menu-btn:not(#_) {
    width: 44px !important; min-width: 44px !important;
    justify-content: center !important; padding: 0 !important;
  }
  html body .menu-btn:not(#_)::before,
  html body .menu-btn:not(#_)::after { content: none !important; display: none !important; }
  html body .menu-btn:not(#_) > svg { width: 22px; height: 22px; flex: 0 0 auto; }

  html body input[type=checkbox]:not(#_),
  html body input[type=radio]:not(#_) { position: relative; }
  html body input[type=checkbox]:not(.switch *)::after,
  html body input[type=radio]:not(.switch *)::after {
    content: ""; position: absolute;
    left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 44px; height: 44px;
  }
  html body td input[type=checkbox] { margin: 6px 0; }
}
@media (pointer: fine) and (min-width: 1024px) {
  html body summary.section-summary:not(#_) { min-height: 32px; display: flex; align-items: center; }
}

/* Alvos mínimos também no computador, com mouse: 32px de altura. */
@media (pointer: fine) and (min-width: 1024px) {
  html body .btn:not(#_),
  html body a.btn:not(#_),
  html body button.btn:not(#_),
  html body summary.btn:not(#_),
  html body select:not(#_),
  html body .link-button:not(#_),
  html body summary.link-button:not(#_),
  html body .nav-move-buttons button:not(#_),
  html body .analytics-switch button:not(#_) { min-height: 32px !important; }
}

/* Caixas de seleção: o quadrado cresce e o espaço ao redor completa a
   área de toque, porque pseudo-elemento não funciona em campo de
   formulário. */
@media (pointer: coarse), (max-width: 1023px) {
  html body input[type=checkbox]:not(.switch input),
  html body input[type=radio]:not(.switch input) {
    width: 24px !important; height: 24px !important;
    min-width: 24px !important; min-height: 24px !important;
    margin: 10px !important;
  }
  html body td:has(> input[type=checkbox]),
  html body .select-col { padding: 0 !important; }
}

/* Últimos ajustes de contraste, medidos elemento a elemento.
   Todos aprofundam o tom em direção à cor de tinta do tema, o que
   funciona tanto no claro quanto no escuro. */

html body .category-badge,
html body .category-badge > span { color: color-mix(in srgb, currentColor 62%, var(--ink, #172033)) !important; }

html body .alert a,
html body .alert .link-button { color: color-mix(in srgb, currentColor 60%, var(--ink, #172033)) !important; text-decoration: underline; }

html body .notification-item-copy,
html body .notification-item-copy span,
html body .notification-item small { color: color-mix(in srgb, var(--muted, #6b6a7d) 55%, var(--ink, #172033)) !important; }

html body .notification-head a,
html body .notification-popover a { color: var(--fx-primaria-texto) !important; }

html body .status-chip,
html body .settings-actions .status-chip { color: color-mix(in srgb, currentColor 72%, var(--ink, #172033)) !important; }

/* Na faixa de segmentos, o item inativo precisa de peso suficiente. */
html body .fx-seg-item:not(.is-active) { color: color-mix(in srgb, var(--muted, #6b6a7d) 50%, var(--ink, #172033)); }

/* Contraste: faixa de aviso, ações destrutivas e rótulos auxiliares. */
html body section.alert > strong,
html body section.alert > span,
html body .alert strong,
html body .alert > span { color: color-mix(in srgb, currentColor 58%, var(--ink, #172033)) !important; }

html body .fixed-rule-actions .btn,
html body .finance-row-actions .btn,
html body .btn.is-danger { color: color-mix(in srgb, var(--red, #c84259) 72%, var(--ink, #172033)) !important; }

html body .finance-summary-item > span,
html body .finance-card-primary > span,
html body .finance-overview-head .eyebrow,
html body .eyebrow { color: color-mix(in srgb, var(--muted, #6b6a7d) 58%, var(--ink, #172033)) !important; }

/* Caixa de seleção: 24px atende o mínimo de alvo do WCAG 2.2 no
   computador, e no toque cresce para 28px com folga ao redor, o que
   leva a área clicável efetiva a 44px. */
html body input[type=checkbox]:not(.switch input),
html body input[type=radio]:not(.switch input) { width: 24px; height: 24px; min-width: 24px; min-height: 24px; accent-color: var(--fx-primaria-fundo); }
@media (pointer: coarse), (max-width: 1023px) {
  html body input[type=checkbox]:not(.switch input),
  html body input[type=radio]:not(.switch input) { width: 28px !important; height: 28px !important; min-width: 28px !important; min-height: 28px !important; margin: 8px !important; }
}

/* Barra inferior do celular: rótulos precisavam de mais profundidade. */
html body .mobile-bottom-nav a { color: color-mix(in srgb, var(--muted, #6b6a7d) 52%, var(--ink, #172033)) !important; }
html body .mobile-bottom-nav a.is-active,
html body .mobile-bottom-nav a.is-active span { color: var(--fx-primaria-texto) !important; }
html body .mobile-bottom-nav a span { color: inherit !important; }

/* Caixa de seleção no cabeçalho da tabela: completa os 44px de alvo. */
@media (pointer: coarse), (max-width: 1023px) {
  html body th.select-col,
  html body td.select-col,
  html body .select-col { padding: 8px !important; min-height: 44px; }
  html body input.modern-check { margin: 8px !important; }
}

@media (pointer: coarse), (max-width: 1023px) {
  html body table thead th:has(input[type=checkbox]),
  html body table tbody td:has(input[type=checkbox]),
  html body th.select-col:not(#_),
  html body td.select-col:not(#_) { min-height: 44px !important; height: 44px !important; vertical-align: middle; }
  html body input.modern-check:not(#_) { min-height: 28px !important; min-width: 28px !important; margin: 8px !important; }
}

/* ==================================================================
   TEMA CLARO x TEMA ESCURO

   Aprofundar a cor melhora o contraste sobre fundo claro e piora sobre
   fundo escuro. Por isso cada tema recebe a sua direção: no claro a cor
   caminha para a tinta escura, no escuro caminha para o branco.
   O tema "sistema" segue a preferência do aparelho.
   ================================================================== */

/* --- claro: aprofunda --- */
html body.ui-light .status-chip,
html body.ui-light .status-chip.pending,
html body.ui-light .status-chip.success,
html body.ui-light .status-chip.danger,
html body.ui-light .status-chip.warning { color: color-mix(in srgb, currentColor 70%, #000) !important; }

/* --- escuro: clareia --- */
html body.ui-dark {
  --fx-primaria-fundo: color-mix(in srgb, var(--primary, #5271ff) 86%, #000);
  --fx-primaria-texto: color-mix(in srgb, var(--primary, #5271ff) 45%, #fff);
  --fx-perigo-fundo: color-mix(in srgb, var(--red, #e5484d) 88%, #000);
}
html body.ui-dark .status-chip,
html body.ui-dark .status-chip.pending,
html body.ui-dark .status-chip.success,
html body.ui-dark .status-chip.danger,
html body.ui-dark .status-chip.warning,
html body.ui-dark .negative,
html body.ui-dark .positive,
html body.ui-dark .fx-sobra-valor,
html body.ui-dark td.right,
html body.ui-dark kbd,
html body.ui-dark .category-badge,
html body.ui-dark .category-badge > span,
html body.ui-dark .alert a,
html body.ui-dark section.alert > strong,
html body.ui-dark section.alert > span,
html body.ui-dark .alert strong,
html body.ui-dark .alert > span,
html body.ui-dark .fixed-rule-actions .btn,
html body.ui-dark .finance-row-actions .btn { color: color-mix(in srgb, currentColor 55%, #fff) !important; }

html body.ui-dark .notification-item-copy,
html body.ui-dark .notification-item-copy span,
html body.ui-dark .notification-item small,
html body.ui-dark .finance-summary-item > span,
html body.ui-dark .finance-card-primary > span,
html body.ui-dark .finance-overview-head .eyebrow,
html body.ui-dark .eyebrow,
html body.ui-dark .mobile-bottom-nav a,
html body.ui-dark .fx-seg-item:not(.is-active) { color: color-mix(in srgb, var(--muted, #9aa8bb) 55%, #fff) !important; }

html body.ui-dark strong,
html body.ui-dark b { color: var(--ink, #eef3f8); }
html body.ui-dark .skip-link { background: var(--surface, #121925) !important; color: var(--ink, #eef3f8) !important; border: 1px solid var(--line, #263346); }
html body.ui-light .skip-link { background: #fff !important; color: #172033 !important; border: 1px solid #e3e3eb; }

/* --- sistema: segue o aparelho, com as mesmas direções --- */
@media (prefers-color-scheme: dark) {
  html body.ui-system {
    --fx-primaria-fundo: color-mix(in srgb, var(--primary, #5271ff) 86%, #000);
    --fx-primaria-texto: color-mix(in srgb, var(--primary, #5271ff) 45%, #fff);
  }
  html body.ui-system .status-chip,
  html body.ui-system .negative,
  html body.ui-system .positive,
  html body.ui-system .fx-sobra-valor,
  html body.ui-system td.right,
  html body.ui-system kbd,
  html body.ui-system .category-badge,
  html body.ui-system .category-badge > span { color: color-mix(in srgb, currentColor 55%, #fff) !important; }
  html body.ui-system .eyebrow,
  html body.ui-system .mobile-bottom-nav a,
  html body.ui-system .notification-item-copy span { color: color-mix(in srgb, var(--muted, #9aa8bb) 55%, #fff) !important; }
  html body.ui-system .skip-link { background: var(--surface, #121925) !important; color: var(--ink, #eef3f8) !important; }
}
@media (prefers-color-scheme: light) {
  html body.ui-system .status-chip { color: color-mix(in srgb, currentColor 70%, #000) !important; }
}

/* ==================================================================
   TOKENS QUE DEPENDIAM DO TEMA MAS MORAVAM NO :root

   O system-500 e o analytics-360 declaram variáveis derivadas em
   :root usando var(--surface) e var(--text). Como o tema define essas
   cores no body, o valor de reserva (#fff) era o que valia, e no tema
   escuro isso produzia cartões quase brancos com texto claro em cima,
   ilegíveis. Redeclarar no body resolve, sem tocar nas folhas antigas.
   ================================================================== */
html body {
  --f500-border: color-mix(in srgb, var(--ink, #171728) 14%, transparent);
  --f500-soft: color-mix(in srgb, var(--primary, #4b4a9e) 7%, var(--surface, #fff));
  --f500-muted: var(--muted, #6b7280);
  --analytics-grid: color-mix(in srgb, var(--ink, #171728) 12%, transparent);
  --analytics-soft: color-mix(in srgb, var(--primary, #4b4a9e) 8%, var(--surface, #fff));
}

/* Últimos três no tema escuro: contador do sino, selo de requisito e
   marcação de conta ativa. */
html body.ui-dark .notification-count,
html body.ui-system .notification-count { background: color-mix(in srgb, var(--red, #e5484d) 72%, #000) !important; color: #fff !important; }
html body.ui-dark .fx-check-st.is-ok,
html body.ui-dark .is-active:not(a):not(button) { color: color-mix(in srgb, currentColor 48%, #fff) !important; }
@media (prefers-color-scheme: dark) {
  html body.ui-system .fx-check-st.is-ok,
  html body.ui-system .is-active:not(a):not(button) { color: color-mix(in srgb, currentColor 48%, #fff) !important; }
}

/* Controle desabilitado: o WCAG dispensa contraste em componente
   inativo, mas manter legível evita que pareça defeito. */
html body .btn[disabled],
html body button[disabled],
html body .btn.primary[disabled] { color: color-mix(in srgb, var(--fx-fraco) 45%, var(--ink, #172033)) !important; }

/* Linha de comando da tarefa agendada: precisa poder ser lida e copiada
   inteira, inclusive no celular, sem empurrar a página para o lado. */
html body .fx-cron-linha {
  margin: 10px 0 6px;
  padding: 12px 14px;
  background: var(--surface-2, var(--surface));
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
html body .fx-cron-linha code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  letter-spacing: 0;
  color: var(--ink);
  white-space: pre;
}

/* ------------------------------------------------------------------
   Conciliação de transferências entre contas
   ------------------------------------------------------------------ */
html body .fx-tr-filtro {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
  margin-top: 12px;
}
html body .fx-tr-filtro label { display: grid; gap: 4px; min-width: 150px; flex: 1 1 150px; }
html body .fx-tr-filtro label small { color: var(--muted); font-size: 11.5px; line-height: 1.4; }

html body .fx-tr-tx {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  min-width: 0;
}
html body .fx-tr-tx.is-origem { border-color: var(--primary); background: var(--fx-suave, var(--surface-2, var(--surface))); }
html body .fx-tr-tx-corpo { min-width: 0; flex: 1 1 auto; display: grid; gap: 2px; }
html body .fx-tr-tx-corpo strong {
  font-size: 13.5px; line-height: 1.35;
  overflow-wrap: anywhere;
}
html body .fx-tr-tx-corpo small { color: var(--muted); font-size: 11.5px; line-height: 1.4; }
html body .fx-tr-tx-valor { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

html body .fx-tr-cands,
html body .fx-tr-simples,
html body .fx-tr-pares { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
html body .fx-tr-cands > li,
html body .fx-tr-simples > li,
html body .fx-tr-pares > li { display: grid; gap: 8px; }

html body .fx-tr-cand-meta {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
html body .fx-tr-cand-meta form { margin: 0; margin-left: auto; }

html body .fx-tag {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2, var(--surface));
  color: var(--muted);
  font-size: 11.5px; letter-spacing: 0;
}
html body .fx-tag.is-aviso { border-color: var(--warning, #b25c00); color: var(--warning, #b25c00); }

html body .fx-tr-par-pontas {
  display: grid; gap: 8px; align-items: center;
  grid-template-columns: 1fr auto 1fr;
}
html body .fx-tr-seta { color: var(--muted); font-size: 18px; text-align: center; }

html body .fx-tr-outras-corpo { display: grid; gap: 14px; padding-top: 10px; }
html body .fx-tr-form-linha { display: flex; flex-wrap: wrap; gap: 12px; }
html body .fx-tr-form-linha label { display: grid; gap: 4px; flex: 1 1 150px; min-width: 140px; }
html body .fx-tr-lote { margin-top: 12px; }

/* Marca na lista de transações, para a ponta conciliada se explicar sozinha. */
html body .fx-tr-marca {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted); font-size: 11px; white-space: nowrap;
}

@media (max-width: 720px) {
  html body .fx-tr-par-pontas { grid-template-columns: 1fr; }
  html body .fx-tr-seta { transform: rotate(90deg); }
  html body .fx-tr-cand-meta form { margin-left: 0; width: 100%; }
  html body .fx-tr-cand-meta form .btn { width: 100%; }
}

/* ------------------------------------------------------------------
   Cor do texto do menu lateral

   Regra: o texto da navegação muda apenas entre modo claro e modo
   escuro. Tema, preset e cor de destaque não alteram a leitura.
   Por isso os valores abaixo são literais, e não derivados de
   var(--primary) ou de tokens que os presets reescrevem.

   O destaque continua marcando o item atual, mas pelo fundo e pela
   barra lateral, não pela cor da letra.
   ------------------------------------------------------------------ */
html body .sidebar {
  --fx-nav-txt: #273142;
  --fx-nav-txt-ativo: #0F1726;
  --fx-nav-apagado: #5B6475;
}
html body.ui-dark .sidebar,
html body.ui-light .sidebar { color-scheme: inherit; }
html body.ui-dark .sidebar {
  --fx-nav-txt: #D7DDE7;
  --fx-nav-txt-ativo: #F5F8FC;
  --fx-nav-apagado: #9BA5B5;
}
@media (prefers-color-scheme: dark) {
  html body.ui-system .sidebar {
    --fx-nav-txt: #D7DDE7;
    --fx-nav-txt-ativo: #F5F8FC;
    --fx-nav-apagado: #9BA5B5;
  }
}

html body .sidebar nav a:not(#_),
html body .sidebar .smart-nav a:not(#_),
html body .sidebar .nav-group-items a:not(#_) { color: var(--fx-nav-txt) !important; }

html body .sidebar nav a:not(#_):hover,
html body .sidebar nav a:not(#_):focus-visible { color: var(--fx-nav-txt-ativo) !important; }

html body .sidebar nav a.active:not(#_),
html body .sidebar nav a[aria-current="page"]:not(#_) { color: var(--fx-nav-txt-ativo) !important; }

/* O rótulo fica num span com regra própria, e qualquer elemento novo
   dentro do link teria o mesmo problema. Todos herdam a cor do link. */
html body .sidebar nav a:not(#_) *,
html body .sidebar .nav-group-items a:not(#_) * { color: inherit !important; }

/* Ícones acompanham a letra, inclusive no item atual. */
html body .sidebar nav a:not(#_) svg,
html body .sidebar .smart-nav .nav-icon:not(#_),
html body .sidebar .smart-nav .nav-icon:not(#_) svg { color: currentColor !important; stroke: currentColor !important; }

/* Títulos de grupo e o botão que abre o grupo. */
html body .sidebar .nav-group:not(#_),
html body .sidebar .nav-group-toggle:not(#_),
html body .sidebar .nav-group-toggle:not(#_) .nav-group-chevron { color: var(--fx-nav-apagado) !important; }
html body .sidebar .nav-group-toggle:not(#_):hover { color: var(--fx-nav-txt-ativo) !important; }

/* Contadores: fundo e letra neutros, para o número também não mudar
   de cor quando o destaque muda. */
html body .sidebar .nav-count:not(#_),
html body .sidebar .nav-group-badge:not(#_) {
  background: color-mix(in srgb, var(--fx-nav-apagado) 16%, transparent) !important;
  border-color: color-mix(in srgb, var(--fx-nav-apagado) 30%, transparent) !important;
  color: var(--fx-nav-txt-ativo) !important;
}

/* O nome e o papel do usuário no rodapé do menu seguem a mesma regra. */
html body .sidebar .user strong:not(#_) { color: var(--fx-nav-txt-ativo) !important; }
html body .sidebar .user small:not(#_),
html body .sidebar .user a:not(#_),
html body .sidebar .user .link-button:not(#_) { color: var(--fx-nav-apagado) !important; }

/* ------------------------------------------------------------------
   Área de risco: recomeçar do zero

   A cor de alerta aqui é fixa e não segue o destaque escolhido, porque
   o aviso precisa significar a mesma coisa em qualquer configuração.
   ------------------------------------------------------------------ */
html body .fx-perigo {
  --fx-perigo-cor: #9F1239;
  --fx-perigo-fundo: #FFF5F7;
  border-color: color-mix(in srgb, var(--fx-perigo-cor) 32%, var(--line)) !important;
  border-left: 3px solid var(--fx-perigo-cor) !important;
}
html body.ui-dark .fx-perigo { --fx-perigo-cor: #FB7185; --fx-perigo-fundo: #2A1420; }
@media (prefers-color-scheme: dark) {
  html body.ui-system .fx-perigo { --fx-perigo-cor: #FB7185; --fx-perigo-fundo: #2A1420; }
}
html body .fx-perigo .eyebrow { color: var(--fx-perigo-cor) !important; }

html body .btn.danger:not(#_) {
  border-color: var(--fx-perigo-cor, #9F1239) !important;
  background: var(--fx-perigo-cor, #9F1239) !important;
  color: #fff !important;
  font-weight: 650;
}
html body.ui-dark .btn.danger:not(#_) { color: #2A0A14 !important; }

html body .fx-reset-opcoes { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
html body .fx-reset-opcoes > li {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
html body .fx-reset-opcoes > li.is-escolhido { border-color: var(--primary); }
html body .fx-reset-opcoes > li > div { flex: 1 1 260px; min-width: 0; display: grid; gap: 5px; }
html body .fx-reset-opcoes > li p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
html body .fx-reset-opcoes > li small { color: var(--muted); font-size: 11.5px; line-height: 1.45; }
html body .fx-reset-opcoes > li > .btn { align-self: center; }

@media (max-width: 720px) {
  html body .fx-reset-opcoes > li > .btn { width: 100%; }
}
