/* =====================================================================
   Ferreira Soluções Elétricas — finance.css
   Estilos da aba Finanças (reaproveita os tokens de style.css)
   ===================================================================== */

/* ------------------------------- PERÍODO -------------------------------- */
.fin-period {
  margin-bottom: 14px;
}
.fin-period .segmented {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
}
.fin-period .segmented::-webkit-scrollbar { display: none; }
.fin-period .segmented-btn {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  font-size: .74rem;
  font-weight: 700;
  color: var(--text-soft);
  white-space: nowrap;
  transition: background-color .16s ease, color .16s ease;
}
.fin-period .segmented-btn.is-active {
  background: var(--surface);
  color: var(--brand-700);
  box-shadow: var(--shadow-xs);
}
[data-theme="dark"] .fin-period .segmented-btn.is-active {
  color: var(--brand-500);
  background: var(--surface);
}

.fin-period-caption {
  margin-top: 7px;
  font-size: .74rem;
  color: var(--text-muted);
  text-align: center;
  font-weight: 600;
}

/* -------------------------------- ABAS ---------------------------------- */
.fin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.fin-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: 8px;
  font-size: .66rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: background-color .16s ease, color .16s ease;
}
.fin-tab i { font-size: .86rem; }
.fin-tab.is-active {
  background: var(--surface);
  color: var(--brand-700);
  box-shadow: var(--shadow-xs);
}
[data-theme="dark"] .fin-tab.is-active { color: var(--brand-500); }

.fin-panel { display: none; }
.fin-panel.is-active { display: block; animation: screenIn .2s ease both; }

/* -------------------------------- KPIs ---------------------------------- */
.fin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  margin-bottom: 16px;
}

.fin-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 11px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}
.fin-kpi::after {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--text-muted);
}
.fin-kpi--ok::after     { background: var(--ok-500); }
.fin-kpi--brand::after  { background: var(--brand-600); }
.fin-kpi--warn::after   { background: var(--warn-500); }
.fin-kpi--danger::after { background: var(--danger-500); }

.fin-kpi-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: .72rem;
  margin-bottom: 3px;
  background: var(--surface-2);
  color: var(--text-soft);
}
.fin-kpi--ok .fin-kpi-icon     { background: var(--ok-050);     color: var(--ok-500); }
.fin-kpi--brand .fin-kpi-icon  { background: var(--brand-050);  color: var(--brand-700); }
.fin-kpi--warn .fin-kpi-icon   { background: var(--warn-050);   color: var(--warn-500); }
.fin-kpi--danger .fin-kpi-icon { background: var(--danger-050); color: var(--danger-500); }

.fin-kpi-label {
  font-size: .63rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--text-muted);
}
.fin-kpi-value {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -.4px;
  line-height: 1.2;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fin-kpi--danger .fin-kpi-value.is-danger,
.fin-kpi-value.is-danger { color: var(--danger-500); }

.fin-kpi-sub {
  font-size: .64rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------- GRÁFICO -------------------------------- */
.fin-chart-card { margin-bottom: 14px; }
.chart-wrap { padding: 4px 0 0; }

.bar-chart {
  width: 100%;
  height: 150px;
  color: var(--text);
  overflow: visible;
}
.bar { transition: opacity .2s ease; }
.bar--recebido  { fill: var(--ok-500); }
.bar--faturado  { fill: var(--brand-500); opacity: .5; }
.bar-label {
  font-size: 8px;
  font-weight: 700;
  fill: var(--text-muted);
  font-family: var(--font-family);
}

.chart-legend {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 6px;
  font-size: .68rem;
  color: var(--text-muted);
  font-weight: 600;
}
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend .dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  display: inline-block;
}
.dot--recebido { background: var(--ok-500); }
.dot--faturado { background: var(--brand-500); opacity: .5; }

.chart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 26px 12px;
  text-align: center;
  color: var(--text-muted);
}
.chart-empty i { font-size: 1.4rem; opacity: .5; }
.chart-empty p { font-size: .8rem; font-weight: 600; }
.chart-empty small { font-size: .68rem; }

/* ----------------------------- QUICK STATS ------------------------------ */
.fin-quickstats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding-top: 4px;
}
.fin-quickstat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  border: 1px solid var(--border);
}
.fin-quickstat span {
  font-size: .64rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .2px;
}
.fin-quickstat strong {
  font-size: .92rem;
  font-weight: 800;
  color: var(--text);
}
.fin-quickstat strong.is-negative { color: var(--danger-500); }

/* ------------------------------- FILTROS -------------------------------- */
.fin-filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 10px;
  margin-bottom: 2px;
}
.fin-filters::-webkit-scrollbar { display: none; }

.fin-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-soft);
  white-space: nowrap;
  transition: border-color .16s ease, background-color .16s ease, color .16s ease;
}
.fin-chip:active { transform: scale(.97); }
.fin-chip.is-selected {
  background: var(--brand-050);
  border-color: var(--brand-500);
  color: var(--brand-700);
}
[data-theme="dark"] .fin-chip.is-selected { color: var(--brand-500); }

.fin-chip-badge {
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: .62rem;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
}
.fin-chip.is-selected .fin-chip-badge {
  background: var(--brand-500);
  color: #fff;
}

/* ---------------------------- LINHA FINANCEIRA -------------------------- */
.finance-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  padding: 12px 13px;
  margin-bottom: 9px;
  transition: box-shadow .16s ease, border-color .16s ease;
}
.finance-row.is-overdue { border-color: var(--danger-500); box-shadow: 0 0 0 1px var(--danger-050); }

.finance-row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 9px;
  margin-bottom: 9px;
}
.finance-row-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}
.finance-row-number {
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .3px;
  color: var(--brand-600);
  text-transform: uppercase;
}
[data-theme="dark"] .finance-row-number { color: var(--brand-500); }
.finance-row-client {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.finance-row-meta {
  font-size: .68rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pílulas de status financeiro */
.fin-pill {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  font-size: .63rem;
  font-weight: 800;
  letter-spacing: .2px;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text-soft);
}
.fin-pill[data-token="ok"]     { background: var(--ok-050);     color: var(--ok-500); }
.fin-pill[data-token="okdark"] { background: var(--ok-500);     color: #fff; }
.fin-pill[data-token="brand"]  { background: var(--brand-050);  color: var(--brand-700); }
.fin-pill[data-token="warn"]   { background: var(--warn-050);   color: var(--warn-500); }
.fin-pill[data-token="danger"] { background: var(--danger-050); color: var(--danger-500); }

.finance-row-values {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px 0 9px;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  margin-bottom: 9px;
}
.finance-row-values > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.finance-row-values span {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .2px;
  color: var(--text-muted);
}
.finance-row-values strong {
  font-size: .84rem;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.val-ok { color: var(--ok-500) !important; }
.val-balance { color: var(--brand-700) !important; }
[data-theme="dark"] .val-balance { color: var(--brand-500) !important; }
.val-danger { color: var(--danger-500) !important; }

.finance-progress {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  overflow: hidden;
}
.finance-progress-bar {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--ok-500);
  transition: width .35s ease;
}
.finance-progress-bar[data-token="warn"]   { background: var(--warn-500); }
.finance-progress-bar[data-token="brand"]  { background: var(--brand-500); }
.finance-progress-bar[data-token="okdark"] { background: var(--ok-500); }

.finance-progress-label {
  font-size: .63rem;
  color: var(--text-muted);
  font-weight: 700;
  margin-top: 4px;
  text-align: right;
}

.finance-row-actions {
  display: flex;
  gap: 7px;
  margin-top: 10px;
}
.finance-row-actions .btn { flex: 1; }

/* ------------------------------ RECEBÍVEIS ------------------------------ */
.upcoming-list { display: flex; flex-direction: column; }
.upcoming-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.upcoming-row:last-child { border-bottom: 0; }
.upcoming-date {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.upcoming-date strong {
  font-size: .78rem;
  font-weight: 800;
  color: var(--brand-700);
}
[data-theme="dark"] .upcoming-date strong { color: var(--brand-500); }
.upcoming-date span {
  font-size: .68rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upcoming-value {
  font-size: .84rem;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}

.fin-hint {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 12px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--brand-050);
  color: var(--text-soft);
  font-size: .72rem;
  line-height: 1.45;
  font-weight: 600;
}
.fin-hint i { color: var(--brand-600); margin-top: 2px; font-size: .72rem; }
.fin-hint--sm { margin-top: 4px; font-size: .68rem; }

/* --------------------------- DETALHE FINANCEIRO ------------------------- */
.fin-hero {
  background: linear-gradient(135deg, var(--surface) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.fin-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.fin-hero h2 {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -.3px;
  margin-bottom: 2px;
}
.fin-hero p {
  font-size: .74rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 12px;
}
.fin-hero-total {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 10px;
}
.fin-hero-total span {
  font-size: .62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--text-muted);
}
.fin-hero-total strong {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.7px;
  color: var(--brand-700);
}
[data-theme="dark"] .fin-hero-total strong { color: var(--brand-500); }

.fin-hero-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  font-size: .68rem;
  color: var(--text-muted);
  font-weight: 700;
}

/* Linha do tempo */
.timeline-item strong i {
  font-size: .72rem;
  width: 14px;
  color: var(--brand-600);
}
.timeline-item.is-empty { opacity: .5; }

/* Recebimentos e custos */
.payment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.payment-row:last-child { border-bottom: 0; }
.payment-row-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}
.payment-row-main strong { font-size: .85rem; font-weight: 800; }
.payment-row-main span {
  font-size: .68rem;
  color: var(--text-muted);
  font-weight: 600;
}
.payment-row-main small {
  font-size: .66rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Caixa de margem */
.margin-box {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
  padding: 11px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  border: 1px solid var(--border);
}
.margin-box > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.margin-box span {
  font-size: .61rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .2px;
  color: var(--text-muted);
}
.margin-box strong { font-size: .88rem; font-weight: 800; }
.margin-highlight strong {
  font-size: 1.02rem;
  color: var(--ok-500);
}
.margin-highlight strong.is-negative { color: var(--danger-500); }
.margin-pct {
  grid-column: 1 / -1;
  font-size: .66rem;
  color: var(--text-muted);
  font-weight: 700;
  padding-top: 4px;
  border-top: 1px dashed var(--border);
}

/* --------------------------- RESUMO DO MODAL ---------------------------- */
.pay-summary {
  padding: 11px;
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  margin-bottom: 13px;
}
.pay-summary-client {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 9px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}
.pay-summary-client strong { font-size: .88rem; font-weight: 800; }
.pay-summary-client span {
  font-size: .68rem;
  color: var(--text-muted);
  font-weight: 600;
}
.pay-summary-values {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.pay-summary-values > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.pay-summary-values span {
  font-size: .59rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: .2px;
}
.pay-summary-values strong { font-size: .82rem; font-weight: 800; }

/* --------------------------- LEMBRETE DE BACKUP ------------------------- */
.backup-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  background: var(--warn-050);
  border: 1px solid var(--warn-500);
  box-shadow: var(--shadow-xs);
  animation: screenIn .25s ease both;
}
.backup-banner-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--warn-500);
  color: #fff;
  font-size: .82rem;
}
.backup-banner-body {
  flex: 1;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.backup-banner-body strong {
  font-size: .8rem;
  font-weight: 800;
  color: var(--text);
}
.backup-banner-body span {
  font-size: .7rem;
  line-height: 1.4;
  color: var(--text-soft);
  font-weight: 600;
}
.backup-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 2px;
}
.backup-banner-actions .btn { flex: 1; }
.backup-banner-actions .link-btn { flex: 0 0 auto; }

.backup-status {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--border);
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ------------------------------ RESPONSIVO ------------------------------ */
@media (min-width: 480px) {
  .fin-kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .fin-kpi-value { font-size: 1.05rem; }
}

@media (min-width: 640px) {
  .fin-quickstats { grid-template-columns: repeat(4, 1fr); }
}

@media print {
  .fin-period, .fin-tabs, .fin-filters { display: none !important; }
  .fin-panel { display: block !important; }
}

/* ===================================================================== */
/*  CATÁLOGO DE ITENS — autocomplete no modal                             */
/* ===================================================================== */
.autocomplete {
  position: relative;
}

.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
  overflow: hidden;
  max-height: 264px;
  overflow-y: auto;
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s ease;
}

.autocomplete-item:last-child { border-bottom: 0; }

.autocomplete-item:hover,
.autocomplete-item.is-active {
  background: var(--brand-50, rgba(255, 152, 0, .1));
}

.autocomplete-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.autocomplete-main strong {
  font-size: .86rem;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.autocomplete-main small {
  font-size: .72rem;
  color: var(--text-muted);
}

.autocomplete-icon {
  font-size: .72rem;
  color: var(--brand-500);
  opacity: .8;
  transform: rotate(90deg);
}

[data-theme="dark"] .autocomplete-list {
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
}

/* ------------------------- CATÁLOGO: TELA DEDICADA ---------------------- */
.catalog-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.catalog-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

.catalog-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  font-size: .78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .16s ease;
}

.catalog-chip.is-selected {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #fff;
}

.catalog-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 8px;
}

.catalog-row-main {
  flex: 1;
  min-width: 0;
}

.catalog-row-main strong {
  display: block;
  font-size: .87rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.catalog-row-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.catalog-row-price {
  font-size: .86rem;
  font-weight: 700;
  color: var(--brand-600, #E65100);
  white-space: nowrap;
}

.catalog-row-actions {
  display: flex;
  gap: 4px;
}

.catalog-trend {
  font-size: .68rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
}

.catalog-trend.is-up {
  background: rgba(220, 38, 38, .12);
  color: var(--danger-500);
}

.catalog-trend.is-down {
  background: rgba(22, 163, 74, .12);
  color: var(--ok-500);
}

/* ===================================================================== */
/*  FINANÇAS — registro rápido de recebimento                             */
/* ===================================================================== */
.fin-action-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.fin-action-bar .btn {
  flex: 1;
}

.btn--receipt {
  background: linear-gradient(135deg, #16A34A, #15803D);
  color: #fff;
  border: 0;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(22, 163, 74, .28);
}

.btn--receipt:active { transform: scale(.985); }

/* Alta prioridade: recebíveis em atraso no topo */
.receipt-queue {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.receipt-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-left: 4px solid var(--ok-500);
}

.receipt-card.is-late { border-left-color: var(--danger-500); }
.receipt-card.is-soon { border-left-color: var(--warn-500); }

.receipt-card-main { flex: 1; min-width: 0; }

.receipt-card-main strong {
  display: block;
  font-size: .86rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.receipt-card-main span {
  font-size: .72rem;
  color: var(--text-muted);
}

.receipt-card-value {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.receipt-card-sub {
  font-size: .68rem;
  color: var(--text-muted);
  text-align: right;
}

/* Aging (faixas de atraso) */
.aging-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.aging-cell {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.aging-cell span {
  display: block;
  font-size: .7rem;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.aging-cell strong {
  font-size: .92rem;
  color: var(--text);
}

.aging-cell.is-late strong { color: var(--danger-500); }
.aging-cell.is-empty { opacity: .55; }

/* Barra de metas do mês */
.fin-goal {
  margin-top: 10px;
}

.fin-goal-head {
  display: flex;
  justify-content: space-between;
  font-size: .76rem;
  color: var(--text-soft);
  margin-bottom: 5px;
  font-weight: 600;
}

.goal-bar {
  height: 9px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.goal-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #16A34A, #22C55E);
  transition: width .4s ease;
}

.goal-bar-fill.is-over { background: linear-gradient(90deg, #15803D, #16A34A); }

/* Exportação / relatório */
.export-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.export-row .btn { width: 100%; }

/* =====================================================================
   v2.1 — vencimentos, cobrança, recibo, PIN, nova versão
   ===================================================================== */

/* Aviso de vencimentos na tela inicial */
.due-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  background: var(--warn-050);
  border: 1px solid var(--warn-500);
  box-shadow: var(--shadow-xs);
  animation: screenIn .25s ease both;
}
.due-banner.is-late { background: var(--danger-050); border-color: var(--danger-500); }
.due-banner-icon {
  width: 32px; height: 32px; flex: 0 0 auto;
  border-radius: 9px; display: grid; place-items: center;
  background: var(--warn-500); color: #fff; font-size: .85rem;
}
.due-banner.is-late .due-banner-icon { background: var(--danger-500); }
.due-banner-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.due-banner-body strong { font-size: .82rem; font-weight: 800; color: var(--text); }
.due-banner-body span { font-size: .72rem; line-height: 1.4; color: var(--text-soft); font-weight: 600; }
.due-banner .btn { flex: 0 0 auto; }

/* Contador na aba Finanças */
.nav-btn { position: relative; }
.nav-btn[data-badge]::after {
  content: attr(data-badge);
  position: absolute;
  top: 2px; left: 50%;
  margin-left: 6px;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger-500);
  color: #fff;
  font-size: .6rem;
  font-weight: 800;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg-elev);
}

/* Aviso de nova versão */
.update-banner {
  position: fixed;
  left: 12px; right: 12px;
  margin: 0 auto;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
  z-index: 150;
  display: flex; align-items: center; gap: 10px;
  max-width: 460px;
  padding: 10px 10px 10px 14px;
  border-radius: 14px;
  background: #2b2d33; color: #fff;
  font-size: .8rem; font-weight: 700;
  box-shadow: var(--shadow-lg);
  animation: screenIn .25s ease both;
}
.update-banner span { flex: 1; }
.update-banner .btn { background: var(--brand-500); color: #fff; border-color: var(--brand-500); }

/* Botão WhatsApp */
.btn--wa {
  background: #25D366; border-color: #25D366; color: #fff;
}
.btn--wa:hover { background: #1ebe5b; }

.charge-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.charge-actions .btn { flex: 1; min-width: 140px; }

.charge-history { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.charge-history-title { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }
.charge-history-row {
  display: flex; flex-direction: column; gap: 1px;
  padding: 7px 10px; border-radius: 10px; background: var(--surface-2);
  font-size: .76rem; color: var(--text-soft); font-weight: 600;
}
.charge-history-row small { color: var(--text-muted); font-weight: 500; }

/* Card da fila de cobrança com ações */
.receipt-card--actions { flex-direction: column; align-items: stretch; gap: 9px; }
.receipt-card-row { display: flex; align-items: flex-start; gap: 10px; }
.receipt-card-buttons { display: flex; gap: 6px; }
.receipt-card-buttons .btn { flex: 1; padding-left: 6px; padding-right: 6px; }
.receipt-card-charged { display: block; margin-top: 2px; font-size: .68rem; color: var(--ok-500) !important; font-weight: 700; }
button.receipt-card-sub { padding: 0; font-weight: 700; }
button.receipt-card-sub i { font-size: .6rem; opacity: .7; }
.receipt-card.is-late button.receipt-card-sub { color: var(--danger-500); }

/* Forma preferida */
.pref-tag {
  display: inline-block; margin-left: 4px; padding: 1px 6px;
  border-radius: 999px; background: var(--ok-050); color: var(--ok-500);
  font-size: .62rem; font-weight: 800; text-transform: uppercase; vertical-align: middle;
}
.chip.is-selected { border-color: var(--brand-500); background: var(--brand-050); color: var(--brand-700); }

/* Linha de recebimento com 2 botões (recibo + estorno) */
.payment-row-actions { display: flex; gap: 6px; flex: 0 0 auto; }

/* Bloqueio por PIN */
.pin-lock {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: var(--bg);
}
.pin-lock-box {
  width: 100%; max-width: 320px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.pin-lock-box.is-shake { animation: pinShake .35s ease; }
@keyframes pinShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}
.pin-lock-icon {
  width: 58px; height: 58px; border-radius: 18px;
  display: grid; place-items: center; margin-bottom: 14px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  color: #fff; font-size: 1.4rem; box-shadow: var(--shadow-md);
}
.pin-lock-box h2 { font-size: 1.15rem; color: var(--text); margin: 0 0 4px; }
.pin-lock-box > p { font-size: .82rem; color: var(--text-muted); margin: 0; }
.pin-dots { display: flex; gap: 12px; margin: 22px 0 8px; min-height: 14px; }
.pin-dots span {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--border-strong); transition: background .12s ease, border-color .12s ease;
}
.pin-dots span.is-filled { background: var(--brand-500); border-color: var(--brand-500); }
.pin-error { min-height: 18px; color: var(--danger-500) !important; font-weight: 700; font-size: .78rem !important; }
.pin-pad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  width: 100%; margin: 14px 0 12px;
}
.pin-pad button {
  height: 60px; border-radius: 16px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 1.35rem; font-weight: 700; color: var(--text);
  box-shadow: var(--shadow-xs); cursor: pointer;
}
.pin-pad button:active { background: var(--brand-050); border-color: var(--brand-500); }
.pin-pad .pin-pad-aux { font-size: .85rem; color: var(--text-soft); background: transparent; box-shadow: none; border-color: transparent; }
body.is-pin-locked { overflow: hidden; }
