/* FinanKey 1.5.14 — contraste integral, texturas e renderização mais leve. */

/* O cabeçalho do modal é deliberadamente escuro nos dois temas. */
.modal-sheet > header,
.modal-sheet-wide > header {
  background-image:
    linear-gradient(90deg, rgba(5, 5, 6, .96), rgba(10, 10, 11, .82) 58%, rgba(8, 7, 5, .70)),
    url("./finankey-bg-obsidian-dollar-1.5.9.webp") !important;
  background-position: center, 58% 46% !important;
  background-size: auto, cover !important;
  box-shadow: inset 0 -1px 0 rgba(214, 179, 93, .18) !important;
}

/* Obsidiana/dourado também nos blocos pretos destacados pelo usuário. */
.bill-summary-card.paid,
.bill-summary-card.pending,
.month-group > header {
  background-image:
    linear-gradient(100deg, rgba(6, 6, 7, .96), rgba(10, 10, 11, .88) 55%, rgba(8, 7, 5, .76)),
    url("./finankey-bg-obsidian-dollar-1.5.9.webp") !important;
  background-position: center, 56% 48% !important;
  background-size: auto, cover !important;
  background-repeat: no-repeat !important;
}

html[data-theme="light"] .bill-summary-card.paid,
html[data-theme="light"] .bill-summary-card.pending,
html[data-theme="light"] .month-group > header {
  color: #fff !important;
}

html[data-theme="light"] .bill-summary-card.paid :where(h1, h2, h3, p, span, small, strong, b, svg):not(.positive):not(.negative),
html[data-theme="light"] .bill-summary-card.pending :where(h1, h2, h3, p, span, small, strong, b, svg):not(.positive):not(.negative),
html[data-theme="light"] .month-group > header :where(h1, h2, h3, p, span, small, strong, b, svg):not(.positive):not(.negative) {
  color: #fff !important;
}

html[data-theme="light"] .bill-summary-card.paid :where(p, small),
html[data-theme="light"] .bill-summary-card.pending :where(p, small),
html[data-theme="light"] .month-group > header :where(p, small) {
  color: rgba(255, 255, 255, .72) !important;
}

html[data-theme="light"] .modal-sheet > header,
html[data-theme="light"] .modal-sheet > header :where(h2, p, button, svg) {
  color: #fff !important;
}

html[data-theme="light"] .modal-sheet > header p {
  color: rgba(255, 255, 255, .72) !important;
}

html[data-theme="light"] .modal-sheet > header > button {
  background: rgba(255, 255, 255, .12) !important;
  border-color: rgba(255, 255, 255, .18) !important;
}

/* Qualquer controle que permanece preto no tema claro recebe conteúdo branco. */
html[data-theme="light"] :where(
  .filter-chips button,
  .history-scope-button,
  .row-actions button,
  .bill-status-toggle.is-pending,
  .bill-edit-button
) {
  color: #fff !important;
}

html[data-theme="light"] :where(
  .filter-chips button,
  .history-scope-button,
  .row-actions button,
  .bill-status-toggle.is-pending,
  .bill-edit-button
) :where(svg, span, strong, small, b, i) {
  color: #fff !important;
}

/* Android: evita repintura contínua de fundos fixos e vidro durante o scroll. */
html[data-fk-platform="android"] body::before {
  display: none !important;
}

html[data-fk-platform="android"] .texture-layer {
  position: absolute !important;
}

html[data-fk-platform="android"] .glass-panel,
html[data-fk-platform="android"] .app-header,
html[data-fk-platform="android"] .bottom-nav,
html[data-fk-platform="android"] .modal-sheet {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* Em telas grandes, reduz o custo do vidro sem eliminar a transparência. */
@media (min-width: 820px) {
  :where(.sidebar.glass-panel, .app-header.glass-panel) {
    -webkit-backdrop-filter: blur(8px) saturate(103%) !important;
    backdrop-filter: blur(8px) saturate(103%) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-stack {
    animation: none !important;
  }
}
