:root {
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --border: #E5E7EB;
  --border-strong: #D1D5DB;
  --text: #111827;
  --muted: #6B7280;
  --accent: #BE346E;
  --accent-hover: #9F285A;
  --accent-soft: #FDF2F7;
  --accent-badge: #F3F4F6;
  --green: #059669;
  --green-soft: #ECFDF5;
  --red: #DC2626;
  --divider: #F3F4F6;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overscroll-behavior: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overscroll-behavior: none;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* Cabeçalho fixo no mobile para não deslocar ao arrastar */
.topbar {
  background: var(--surface);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  padding-top: env(safe-area-inset-top);
  z-index: 30;
}

.topbar-inner {
  position: relative;
  max-width: 820px;
  height: 58px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.header-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  pointer-events: none;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.back-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
}

.back-btn:hover {
  background: var(--divider);
}

.privacy-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.privacy-btn:hover {
  background: var(--divider);
  color: var(--text);
}

.privacy-btn[aria-pressed="true"] {
  color: var(--accent);
}

.privacy-btn-inline {
  display: inline-flex;
  width: 26px;
  height: 26px;
  border-radius: 8px;
}

.hero-label-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

body:not(.on-home) .topbar .brand {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  object-fit: contain;
  background: var(--surface);
  flex-shrink: 0;
}

.month-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--accent-badge);
  color: var(--muted);
  text-transform: capitalize;
}

/* Estrutura com Sidebar (Desktop) */
.app-shell {
  width: 100%;
}

.sidebar {
  display: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
  margin-bottom: 14px;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  background: var(--surface);
  flex-shrink: 0;
}

.sidebar-brand strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-brand small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.sidebar-quick-btn {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.12s ease;
}

.sidebar-quick-btn:hover {
  background: var(--accent-hover);
}

.sidebar-quick-btn:active {
  transform: scale(0.98);
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 10px 12px 4px;
  opacity: 0.8;
}

.sidebar-section-label:first-child {
  padding-top: 2px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-badge.urgent {
  background: rgba(220, 38, 38, 0.14);
  color: var(--red);
}

.sidebar-user-card {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 8px 10px;
  background: var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.sidebar-user-card:hover {
  background: var(--divider);
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-user-meta {
  min-width: 0;
  flex: 1;
}

.sidebar-user-meta small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.sidebar-footer-actions {
  display: flex;
  gap: 6px;
}

.sidebar-footer-actions .sidebar-theme-btn {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer-actions .sidebar-logout {
  width: auto;
  flex-shrink: 0;
  padding: 9px 12px;
}

.sidebar-nav button {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
}

.sidebar-nav button:hover {
  background: var(--divider);
  color: var(--text);
}

.sidebar-nav button.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* Conteúdo principal */
main {
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  padding: calc(78px + env(safe-area-inset-top)) 16px calc(150px + env(safe-area-inset-bottom));
  overflow-x: clip;
}

.page {
  display: none;
  width: 100%;
  max-width: 100%;
}

.page.active {
  display: block;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.page-header .home-date {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.5;
  margin: 2px 0 12px;
  text-transform: capitalize;
}

.page-title {
  margin-bottom: 0;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.desktop-back {
  display: none;
}

/* Botão + flutuante no mobile */
.btn-add-fab {
  position: fixed;
  right: 18px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 25;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(190, 52, 110, 0.35);
  transition: background 0.15s ease, transform 0.15s ease;
}

.btn-add-fab:hover {
  background: var(--accent-hover);
}

.btn-add-label {
  display: none;
}

.home-date {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.5;
  margin: 2px 0 12px;
  text-transform: capitalize;
}

.page-title {
  display: none;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}

.page-header:has(> .page-title:only-child),
#gastos .page-header,
#receitas .page-header,
#metas .page-header,
#novo-gasto .page-header,
#nova-receita .page-header,
#nova-meta .page-header,
#nova-conta .page-header {
  margin-bottom: 0;
}

h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 12px;
}

/* Card principal claro com gradiente rosa suave */
.hero-card {
  background: linear-gradient(135deg, #FFFFFF 0%, #FDF2F7 55%, #F9DCEB 100%);
  color: var(--text);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: 0 4px 16px rgba(190, 52, 110, 0.08);
}

.hero-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.hero-value {
  display: block;
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 6px;
  word-break: break-word;
  color: var(--text);
}

.hero-forecast {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.hero-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(190, 52, 110, 0.12);
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.hero-split {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.hero-pill {
  background: rgba(255, 255, 255, 0.72);
  border-radius: 10px;
  padding: 10px 12px;
}

.hero-pill span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.hero-pill strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
}

/* Métricas KPI do painel inicial */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.kpi-card {
  margin-bottom: 0;
  padding: 14px;
  text-align: left;
  min-width: 0;
}

.kpi-card .label-muted {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(11px, 3vw, 12px);
}

.kpi-card strong {
  display: block;
  font-size: clamp(14px, 4vw, 17px);
  font-weight: 600;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-sub {
  display: block;
  font-size: clamp(10px, 2.7vw, 11px);
  color: var(--muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-btn {
  width: 100%;
  cursor: pointer;
  border: none;
  outline: none;
}

.kpi-btn:focus,
.kpi-btn:focus-visible {
  outline: none;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-head h3 {
  margin-bottom: 0;
  white-space: nowrap;
}

.text-link {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* Gráfico de barras (6 meses) */
.chart-legend-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--muted);
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  align-items: end;
  padding-top: 10px;
}

.bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.bar-pair {
  width: 100%;
  height: 110px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  padding-bottom: 2px;
}

.bar {
  width: 12px;
  min-height: 3px;
  border-radius: 4px 4px 0 0;
  transition: height 0.25s ease;
}

.bar-income {
  background: var(--green);
}

.bar-expense {
  background: var(--accent);
}

.bar-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: capitalize;
}

.dashboard-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.mini-pie-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.mini-pie {
  width: 148px;
  height: 148px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Painéis e cartões */
.panel {
  background: var(--surface);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(17, 24, 39, 0.04);
  overflow: hidden;
}

.panel-desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

.label-muted {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.quick-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.quick-card {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  cursor: pointer;
  width: 100%;
}

.quick-card strong {
  display: block;
  font-size: 18px;
  font-weight: 600;
  margin-top: 2px;
  color: var(--text);
}

.link-accent {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.green {
  color: var(--green);
}

.red {
  color: var(--red);
}

/* Formulários e campos (regra anti-zoom mobile) */
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}

.mt-label {
  margin-top: 16px;
}

input,
select,
textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: none;
  border-radius: 10px;
  margin-bottom: 13px;
  background: var(--bg);
  color: var(--text);
  font-size: 16px !important;
  touch-action: manipulation;
}

select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  padding-right: 36px;
}

input[type="date"],
input[type="month"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: 44px;
  line-height: 22px;
  box-sizing: border-box;
  text-align: left;
}

input::-webkit-date-and-time-value {
  text-align: left;
  min-height: 22px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  box-shadow: none;
  background-color: #ECEDF0;
}

button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button:focus:not(:focus-visible) {
  outline: none;
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
}

.filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.filters-search-row input {
  margin-bottom: 10px;
}

.filters-extras {
  display: none;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 10px;
  margin-bottom: 8px;
}

.filters-extras.open {
  display: grid;
}

.filters-extras select {
  margin-bottom: 6px;
}

@media (min-width: 768px) {
  .filters-toggle-btn {
    display: none;
  }

  .filters-extras {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px 12px;
  }
}

.filters > div {
  min-width: 0;
}

.btn {
  background: var(--accent);
  color: #FFFFFF;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  width: 100%;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.btn-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Skeleton de carregamento */
.skeleton-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.skeleton {
  background: linear-gradient(90deg, #E5E7EB 25%, #F3F4F6 50%, #E5E7EB 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  border-radius: 14px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.sk-date {
  width: 180px;
  height: 19px;
  margin: 2px 0 14px;
  border-radius: 6px;
}

.sk-hero {
  width: 100%;
  height: 164px;
  border-radius: 16px;
}

.sk-kpi {
  height: 84px;
}

.sk-chart {
  width: 100%;
  height: 180px;
}

.sk-line {
  height: 14px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.sk-line:last-child {
  margin-bottom: 0;
}

.w-40 { width: 40%; }
.w-80 { width: 80%; }
.w-90 { width: 90%; }
.w-100 { width: 100%; }

.btn:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--accent-badge);
  color: var(--text);
  border: none;
}

.btn-secondary:hover {
  background: var(--accent-soft);
}

.btn-danger {
  background: var(--red);
}

.btn-danger:hover {
  background: #962E43;
}

/* Listas e itens */
.item {
  padding: 12px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

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

.item:first-child {
  padding-top: 2px;
}

.item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.item-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.item-icon.expense {
  background: var(--divider);
  color: var(--text);
}

.item-icon.income {
  background: var(--green-soft);
  color: var(--green);
}

.item-title {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  overflow-wrap: anywhere;
}

.item small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.item-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.item-amount {
  font-size: 14px;
  font-weight: 600;
}

.btn-inline {
  border: none;
  background: var(--divider);
  color: var(--text);
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.btn-inline:hover {
  background: var(--accent-badge);
}

.btn-inline-danger {
  color: var(--red);
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.meta-block {
  width: 100%;
}

.empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 18px 8px;
}

/* Gráfico de pizza e legenda */
/* Gráfico de barras horizontais por categoria */
/* Relatórios profissionais */
.report-header {
  flex-wrap: wrap;
}

.report-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  position: relative;
  z-index: 2;
}

.report-controls > div {
  width: 100%;
}

.btn-pdf-compact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 37px;
  padding: 0 12px;
  border: none;
  border-radius: 10px;
  background: var(--surface);
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex: 1;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.04);
  touch-action: manipulation;
  position: relative;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, transform 0.12s ease;
}

.btn-pdf-compact:hover {
  background: rgba(190, 52, 110, 0.08);
}

.btn-pdf-compact:active {
  transform: scale(0.97);
}

.period-select {
  width: 100% !important;
  min-width: 0;
  max-width: 100%;
  height: 37px;
  margin-bottom: 0;
  padding: 0 32px 0 14px;
  background-position: right 12px center;
  border-radius: 10px;
  background-color: var(--surface);
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.04);
  font-size: 16px !important;
  font-weight: 500;
  line-height: 37px;
}

@media (min-width: 768px) {
  .report-controls {
    width: auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
  }

  .report-controls > div {
    width: auto;
  }

  .btn-pdf-compact {
    flex: 0 0 auto;
  }

  .period-select {
    width: auto !important;
    flex: 0 1 auto;
  }
}

.report-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.report-kpi-wide {
  grid-column: span 2;
}

.muted-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--divider);
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.comp-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.comp-item {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.comp-item span {
  font-size: 13px;
  color: var(--muted);
}

.comp-item strong {
  font-size: 14px;
  font-weight: 600;
}

.cat-bars {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cat-bar-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cat-bar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.cat-bar-name {
  font-weight: 500;
  color: var(--text);
}

.cat-bar-val {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.cat-bar-pct {
  font-weight: 400;
  color: var(--muted);
}

.cat-bar-track {
  height: 8px;
  width: 100%;
  background: var(--divider);
  border-radius: 999px;
  overflow: hidden;
}

.cat-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.budget-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--divider);
}

.budget-row:first-child {
  padding-top: 2px;
}

.budget-row:last-child {
  border-bottom: none;
  padding-bottom: 2px;
}

.budget-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.budget-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--divider);
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

.budget-badge.ok {
  background: rgba(22, 163, 74, 0.12);
  color: var(--green);
}

.budget-badge.alerta {
  background: rgba(217, 119, 6, 0.14);
  color: #B45309;
}

.budget-badge.excedido {
  background: rgba(220, 38, 38, 0.12);
  color: var(--red);
}

.budget-amounts {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin: 4px 0 6px;
  font-size: 13px;
  color: var(--muted);
}

.budget-amounts strong {
  color: var(--text);
  font-weight: 600;
}

.budget-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.budget-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tag-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(190, 52, 110, 0.12);
  color: var(--accent);
  vertical-align: middle;
  margin-left: 4px;
  white-space: nowrap;
}

.field-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.export-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.export-actions .btn {
  margin-top: 0;
}

@media (max-width: 520px) {
  .export-actions {
    grid-template-columns: 1fr;
  }
}

/* Pull-to-Refresh */
.pull-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 0;
  overflow: hidden;
  opacity: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: height 0.2s ease, opacity 0.2s ease;
}

.pull-indicator.visible {
  opacity: 1;
}

.pull-indicator.loading {
  height: 42px;
  opacity: 1;
}

.pull-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--divider);
  border-top-color: var(--accent);
  transition: transform 0.15s ease;
}

.pull-indicator.ready .pull-spinner {
  transform: rotate(180deg);
}

.pull-indicator.loading .pull-spinner {
  animation: spin 0.75s linear infinite;
}

/* Animações sutis e feedback tátil visual */
@keyframes pageFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.page.active {
  animation: pageFadeIn 0.18s ease-out;
}

.btn:active,
.btn-inline:active,
.privacy-btn:active,
.btn-add-fab:active,
.bottom-nav button:active {
  transform: scale(0.97);
}

@media (prefers-reduced-motion: reduce) {
  .page.active {
    animation: none;
  }
  .btn:active,
  .btn-inline:active,
  .privacy-btn:active,
  .btn-add-fab:active,
  .bottom-nav button:active {
    transform: none;
  }
}

/* Pull-to-Refresh */
.pull-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 0;
  overflow: hidden;
  opacity: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: height 0.2s ease, opacity 0.2s ease;
}

.pull-indicator.visible {
  opacity: 1;
}

.pull-indicator.loading {
  height: 42px;
  opacity: 1;
}

.pull-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--divider);
  border-top-color: var(--accent);
  transition: transform 0.15s ease;
}

.pull-indicator.ready .pull-spinner {
  transform: rotate(180deg);
}

.pull-indicator.loading .pull-spinner {
  animation: spin 0.75s linear infinite;
}

/* Animações sutis e feedback tátil visual */
@keyframes pageFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.page.active {
  animation: pageFadeIn 0.18s ease-out;
}

.btn:active,
.btn-inline:active,
.privacy-btn:active,
.btn-add-fab:active,
.bottom-nav button:active {
  transform: scale(0.97);
}

@media (prefers-reduced-motion: reduce) {
  .page.active {
    animation: none;
  }
  .btn:active,
  .btn-inline:active,
  .privacy-btn:active,
  .btn-add-fab:active,
  .bottom-nav button:active {
    transform: none;
  }
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 8px;
}

/* Barra de progresso das metas */
.progress {
  height: 8px;
  background: var(--accent-soft);
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0 8px;
}

.progress div {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

/* Menu "Mais" */
.menu-list {
  padding: 4px 18px;
}

.menu-row {
  width: 100%;
  background: transparent;
  border: none;
  padding: 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}

.menu-row:last-child {
  border-bottom: none;
}

.menu-row strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.menu-row small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* Barra inferior estilo app nativo */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: var(--surface);
  box-shadow: 0 -2px 12px rgba(17, 24, 39, 0.05);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  z-index: 30;
}

.bottom-nav button {
  background: transparent;
  border: none;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.bottom-nav button.active {
  color: var(--accent);
  font-weight: 600;
}

/* Página de Perfil */
.sk-profile {
  width: 100%;
  height: 92px;
}

.sk-stats {
  width: 100%;
  height: 68px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-avatar-btn {
  position: relative;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.profile-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFFFFF 0%, #FDF2F7 55%, #F9DCEB 100%);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  overflow: hidden;
  text-transform: uppercase;
  box-shadow: 0 3px 10px rgba(190, 52, 110, 0.14);
}

.profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-avatar-edit {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(17, 24, 39, 0.2);
}

.profile-info {
  min-width: 0;
  flex: 1;
}

.profile-email-main {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.profile-stat-box {
  margin-bottom: 0;
  padding: 12px 8px;
  text-align: center;
}

.profile-stat-box strong {
  display: block;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.profile-stat-box span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.menu-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-logout-mobile {
  background: var(--surface);
  color: var(--red);
  box-shadow: 0 2px 10px rgba(17, 24, 39, 0.04);
}

.btn-logout-mobile:hover {
  background: var(--divider);
}

/* Skeleton inicial anti-flicker: só aparece quando já existe sessão */
.auth-loading {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
}

html.has-session .auth-loading {
  display: block;
}

html.has-session #telaLogin {
  display: none;
}

.auth-skeleton-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: calc(58px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  background: var(--surface);
}

.sk-top-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

.sk-top-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 16px;
  border-radius: 8px;
}

html[data-loading-page]:not([data-loading-page="inicio"]) .sk-top-logo {
  visibility: hidden;
}

.auth-skeleton-bottomnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--surface);
  box-shadow: 0 -2px 12px rgba(17, 24, 39, 0.05);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
}

.auth-sk-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}

.sk-tab-icon {
  width: 20px;
  height: 20px;
  border-radius: 6px;
}

.sk-tab-lbl {
  width: 38px;
  height: 10px;
  border-radius: 4px;
}

.auth-skeleton-sidebar {
  display: none;
}

.auth-loading-inner {
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  padding: calc(78px + env(safe-area-inset-top)) 16px 96px;
}

.auth-sk-view {
  display: none;
}

.auth-sk-view[data-sk="inicio"] {
  display: block;
}

html[data-loading-page="relatorios"] .auth-sk-view[data-sk="inicio"],
html[data-loading-page="relatorio-pdf"] .auth-sk-view[data-sk="inicio"],
html[data-loading-page="gastos"] .auth-sk-view[data-sk="inicio"],
html[data-loading-page="receitas"] .auth-sk-view[data-sk="inicio"],
html[data-loading-page="metas"] .auth-sk-view[data-sk="inicio"],
html[data-loading-page="contas"] .auth-sk-view[data-sk="inicio"],
html[data-loading-page="cartoes"] .auth-sk-view[data-sk="inicio"],
html[data-loading-page="alterar-senha"] .auth-sk-view[data-sk="inicio"],
html[data-loading-page="mais"] .auth-sk-view[data-sk="inicio"] {
  display: none;
}

html[data-loading-page="relatorios"] .auth-sk-view[data-sk="relatorios"],
html[data-loading-page="relatorio-pdf"] .auth-sk-view[data-sk="relatorio-pdf"],
html[data-loading-page="gastos"] .auth-sk-view[data-sk="gastos"],
html[data-loading-page="receitas"] .auth-sk-view[data-sk="lista"],
html[data-loading-page="metas"] .auth-sk-view[data-sk="lista"],
html[data-loading-page="contas"] .auth-sk-view[data-sk="lista"],
html[data-loading-page="cartoes"] .auth-sk-view[data-sk="lista"],
html[data-loading-page="alterar-senha"] .auth-sk-view[data-sk="mais"],
html[data-loading-page="mais"] .auth-sk-view[data-sk="mais"] {
  display: block;
}

.sk-hero-val {
  width: 55%;
  height: 28px;
  border-radius: 8px;
  margin-top: 10px;
}

.skeleton-wrap .hero-card {
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(17, 24, 39, 0.04);
}

.skeleton-wrap .hero-pill {
  background: #F4F4F5;
}

.sk-kpi-val {
  width: 70%;
  height: 20px;
  border-radius: 6px;
  margin: 6px 0 8px;
}

.sk-bars {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 110px;
  margin-top: 12px;
  padding: 0 6px;
}

.sk-bar {
  flex: 1;
  border-radius: 8px 8px 4px 4px;
}

.sk-list-rows {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sk-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sk-item-ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
}

.sk-item-mid {
  flex: 1;
}

.sk-item-amt {
  width: 68px;
  height: 16px;
  border-radius: 6px;
  flex-shrink: 0;
}

.sk-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sk-page-title {
  display: none;
  width: 140px;
  height: 25px;
  margin-bottom: 14px;
  border-radius: 8px;
}

.page-header .sk-page-title {
  margin-bottom: 0;
}

.sk-list-header .sk-pill-sm {
  height: 38px;
}

.report-controls .sk-pill-wide,
.report-controls .sk-pill-sm {
  height: 37px;
  border-radius: 10px;
}

.sk-pill-wide {
  width: 180px;
  height: 36px;
  border-radius: 999px;
}

.sk-pill-sm {
  width: 84px;
  height: 36px;
  border-radius: 999px;
}

.sk-list-header {
  display: none;
}

.sk-field-lbl {
  width: 72px;
  height: 12px;
  border-radius: 6px;
  margin: 14px 0 6px;
}

.sk-input {
  width: 100%;
  height: 44px;
  border-radius: 10px;
}

.sk-fab {
  position: fixed;
  right: 16px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  width: 52px;
  height: 52px;
  border-radius: 50%;
  z-index: 25;
}

@media (min-width: 768px) {
  html.has-session .auth-loading {
    display: flex;
  }

  .auth-skeleton-topbar,
  .auth-skeleton-bottomnav {
    display: none;
  }

  .sk-page-title {
    display: block;
  }

  .sk-list-header {
    display: flex;
  }

  .sk-fab {
    display: none;
  }

  .auth-skeleton-sidebar {
    display: flex;
    flex-direction: column;
    width: 240px;
    flex-shrink: 0;
    height: 100vh;
    padding: 20px 14px;
    background: var(--surface);
    box-shadow: 2px 0 12px rgba(17, 24, 39, 0.03);
  }

  .auth-sk-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 18px;
    margin-bottom: 14px;
  }

  .sk-side-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
  }

  .auth-sk-brand-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .auth-sk-brand-lines .sk-line {
    margin-bottom: 0;
  }

  .auth-sk-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .sk-nav-item {
    height: 38px;
    border-radius: 10px;
  }

  .auth-sk-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 14px;
  }

  .auth-loading-inner {
    flex: 1;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 28px 28px 48px;
  }
}

/* Tela de Login */
.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 18px;
  padding: 26px 22px;
  box-shadow: 0 8px 30px rgba(17, 24, 39, 0.06);
}

.login-brand {
  text-align: center;
  margin-bottom: 22px;
}

.login-logo-wrap {
  width: 148px;
  height: 102px;
  margin: 0 auto 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
}

.login-logo {
  width: 164px;
  height: 164px;
  max-width: none;
  object-fit: contain;
  margin-bottom: 0;
  flex-shrink: 0;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 13px;
}

.login-input-wrap input {
  margin-bottom: 0 !important;
  padding-left: 40px !important;
  width: 100%;
}

.login-input-wrap.has-toggle input {
  padding-right: 42px !important;
}

.login-input-icon {
  position: absolute;
  left: 13px;
  color: var(--muted);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.login-input-wrap:focus-within .login-input-icon {
  color: var(--accent);
}

.login-pass-toggle {
  position: absolute;
  right: 6px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.login-pass-toggle:hover {
  color: var(--text);
  background: var(--divider);
}

.login-pass-toggle[aria-pressed="true"] {
  color: var(--accent);
}

.login-submit-btn {
  background: linear-gradient(135deg, #E6498B 0%, #BE346E 100%);
  box-shadow: 0 6px 18px rgba(190, 52, 110, 0.26);
  transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.login-submit-btn:not(:disabled):active {
  transform: scale(0.985);
}

.login-submit-btn:disabled {
  box-shadow: none;
}

@keyframes loginShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}

.login-card.shake {
  animation: loginShake 0.4s ease-in-out;
}

.cal-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

.cal-nav-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: var(--accent-badge);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.cal-nav-btn:hover {
  background: var(--divider);
}

.pass-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 13px;
}

.pass-field-wrap input {
  margin-bottom: 0 !important;
  padding-right: 42px !important;
  width: 100%;
}

.login-brand h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-brand p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.login-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 14px 0;
  color: var(--muted);
  font-size: 12px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--divider);
}

.login-divider span {
  padding: 0 10px;
}

.login-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 0 16px;
}

.login-options-row .remember-row {
  margin: 0;
}

.login-forgot-link {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}

.login-forgot-link:hover {
  text-decoration: underline;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}

.remember-row input[type="checkbox"] {
  width: 17px !important;
  height: 17px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-email {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  padding: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout {
  width: 100%;
  border: none;
  background: var(--divider);
  color: var(--red);
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.sidebar-logout:hover {
  background: #E5E7EB;
}

/* Modal e Toast do aplicativo */
.hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(45, 34, 38, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}

.modal-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: none;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 20px 40px rgba(45, 34, 38, 0.18);
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  text-transform: none;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.modal-desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

#modalCategoria {
  margin-bottom: 10px;
}

.modal-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 6px;
}

.modal-actions .btn {
  margin-top: 0;
}

.toast {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #FFFFFF 0%, #FDF2F7 55%, #F9DCEB 100%);
  color: var(--text);
  border: none;
  box-shadow: none;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  z-index: 70;
  max-width: calc(100vw - 32px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.toast::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10B981;
  flex-shrink: 0;
}

.toast.toast-error {
  background: #991B1B;
  color: #FFFFFF;
}

.toast.toast-error::before {
  background: #FCA5A5;
}

.toast.toast-warn {
  background: #FEF3C7;
  color: #92400E;
}

.toast.toast-warn::before {
  background: #F59E0B;
}

.extrato-modal-card {
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.extrato-config {
  margin-bottom: 10px;
}

.extrato-config label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.extrato-list {
  flex: 1;
  min-height: 120px;
  max-height: 44vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  padding-right: 2px;
}

.extrato-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: var(--bg);
}

.extrato-row.is-duplicate {
  opacity: 0.65;
}

.extrato-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  flex-shrink: 0;
}

.extrato-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.extrato-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.extrato-desc {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.extrato-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.extrato-controls select {
  width: auto;
  min-width: 112px;
  padding: 5px 8px;
  font-size: 16px;
  border-radius: 8px;
  margin-bottom: 0;
}

.lilac-banner {
  width: 100%;
  background: #FCE4F0;
  color: #9A6B00;
  border: none;
  border-radius: 14px;
  padding: 13px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(230, 46, 138, 0.08);
}

.lilac-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.lilac-banner strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #8A5E00;
}

.lilac-banner small {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #9A6B00;
  margin-top: 2px;
}

.lilac-banner-cta {
  font-size: 12px;
  font-weight: 700;
  color: #8A5E00;
  white-space: nowrap;
  flex-shrink: 0;
}

.pdf-preview-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.pdf-print-btn {
  width: 100%;
  margin-top: 0;
}

@media (min-width: 768px) {
  .pdf-print-btn {
    width: auto;
  }
}

.pdf-preview-sheet {
  background: #FFFFFF;
  color: #18181B;
  border-radius: 14px;
  padding: 18px 16px;
  box-shadow: 0 2px 12px rgba(17, 24, 39, 0.05);
  font-size: 12.5px;
  line-height: 1.45;
  overflow-x: auto;
}

.pdf-preview-sheet .pdf-header,
.print-only .pdf-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 2px solid #E62E8A;
  padding-bottom: 10px;
  margin-bottom: 16px;
}

.pdf-preview-sheet .pdf-header h1,
.print-only .pdf-header h1 {
  font-size: 20px;
  color: #BE346E;
  margin: 0;
}

.pdf-preview-sheet .pdf-header span,
.print-only .pdf-header span {
  font-size: 12px;
  color: #71717A;
}

.pdf-preview-sheet .pdf-meta,
.print-only .pdf-meta {
  font-size: 11.5px;
  color: #52525B;
}

.pdf-preview-sheet .pdf-summary,
.print-only .pdf-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

@media (min-width: 560px) {
  .pdf-preview-sheet .pdf-meta {
    text-align: right;
  }
  .pdf-preview-sheet .pdf-summary {
    grid-template-columns: repeat(4, 1fr);
  }
}

.pdf-preview-sheet .pdf-box,
.print-only .pdf-box {
  border: 1px solid #E4E4E7;
  border-radius: 8px;
  padding: 10px;
}

.pdf-preview-sheet .pdf-box span,
.print-only .pdf-box span {
  display: block;
  font-size: 10px;
  color: #71717A;
  text-transform: uppercase;
}

.pdf-preview-sheet .pdf-box strong,
.print-only .pdf-box strong {
  display: block;
  font-size: 14px;
  margin-top: 3px;
}

.pdf-preview-sheet .pdf-section,
.print-only .pdf-section {
  margin-bottom: 16px;
}

.pdf-preview-sheet .pdf-section h2,
.print-only .pdf-section h2 {
  font-size: 13px;
  color: #2D2226;
  border-bottom: 1px solid #E4E4E7;
  padding-bottom: 4px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pdf-preview-sheet .pdf-table,
.print-only .pdf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.pdf-preview-sheet .pdf-table th,
.pdf-preview-sheet .pdf-table td,
.print-only .pdf-table th,
.print-only .pdf-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid #F4F4F5;
}

.pdf-preview-sheet .pdf-table th,
.print-only .pdf-table th {
  color: #71717A;
  font-weight: 600;
  background: #FAF7F6;
}

.pdf-preview-sheet .pdf-table .num,
.print-only .pdf-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Impressão / Relatório PDF */
.print-only {
  display: none;
}

@media print {
  @page {
    size: A4;
    margin: 14mm;
  }

  html {
  scrollbar-gutter: stable;
}

body {
    background: #FFFFFF !important;
    color: #18181B !important;
  }

  .topbar,
  .sidebar,
  .chat-fab,
  main,
  .bottom-nav,
  .modal-backdrop,
  .toast {
    display: none !important;
  }

  .print-only {
    display: block !important;
    font-size: 12px;
    line-height: 1.45;
  }

  .print-only .pdf-summary {
    grid-template-columns: repeat(4, 1fr);
  }

  .print-only .pdf-meta {
    text-align: right;
  }

  .print-only .pdf-section {
    break-inside: avoid;
  }
}

/* Desktop com Sidebar */
@media (min-width: 768px) {
  html {
    scrollbar-gutter: stable;
  }

  .topbar {
    display: none;
  }

  .page-title {
    display: block;
  }

  #gastos .page-header,
  #receitas .page-header,
  #metas .page-header,
  #novo-gasto .page-header,
  #nova-receita .page-header,
  #nova-meta .page-header,
  #nova-conta .page-header {
    margin-bottom: 14px;
  }

  .app-shell {
    display: flex;
    min-height: 100vh;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    box-shadow: 2px 0 12px rgba(17, 24, 39, 0.03);
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
  }

  .bottom-nav {
    display: none;
  }

  .desktop-back {
    display: inline-flex;
    align-items: center;
  }

  /* Botão + normal no desktop */
  .btn-add-fab {
    position: static;
    width: auto;
    height: auto;
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: none;
  }

  .btn-add-fab svg {
    width: 16px;
    height: 16px;
  }

  .btn-add-label {
    display: inline;
  }

  main {
    flex: 1;
    max-width: 960px;
    padding: 28px 28px 48px;
  }

  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .report-kpis {
    grid-template-columns: repeat(3, 1fr);
  }

  .report-kpi-wide {
    grid-column: span 1;
  }

  .comp-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-split {
    grid-template-columns: 1.2fr 1fr;
    gap: 14px;
  }

  .filters {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

/* Seletor de tema (Modo Escuro) */
.theme-row {
  cursor: default;
}

.theme-select {
  width: auto !important;
  min-width: 128px;
  margin-bottom: 0;
  padding: 7px 32px 7px 12px;
  font-size: 16px !important;
  font-weight: 500;
  border-radius: 999px;
}

.sidebar-theme-btn {
  width: 100%;
  border: none;
  background: var(--bg);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 8px;
  text-align: center;
  transition: background-color 0.15s ease;
}

.sidebar-theme-btn:hover {
  background: var(--divider);
}

/* Tema Escuro (Dark Mode) */
html.dark {
  color-scheme: dark;
  --bg: #0F1117;
  --surface: #181B24;
  --border: #262B38;
  --border-strong: #323848;
  --text: #F3F4F6;
  --muted: #9CA3AF;
  --accent: #E6498B;
  --accent-hover: #D63377;
  --accent-soft: rgba(230, 73, 139, 0.15);
  --accent-badge: #232836;
  --green: #34D399;
  --green-soft: rgba(52, 211, 153, 0.14);
  --red: #F87171;
  --divider: #232836;
}

html.dark .hero-card {
  background: linear-gradient(135deg, #1F2433 0%, #261C28 55%, #301B2D 100%);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

html.dark .hero-pill {
  background: rgba(255, 255, 255, 0.06);
}

html.dark .toast,
html.dark .lilac-banner {
  background: linear-gradient(135deg, #1F2433 0%, #261C28 55%, #301B2D 100%);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

html.dark .toast.toast-warn {
  background: #451A03;
  color: #FDE68A;
}

html.dark .toast.toast-warn::before {
  background: #FBBF24;
}

html.dark .skeleton {
  background: linear-gradient(90deg, #222633 25%, #2B3040 50%, #222633 75%);
  background-size: 200% 100%;
}

html.dark .skeleton-wrap .hero-card {
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

html.dark .skeleton-wrap .hero-pill {
  background: #222633;
}

html.dark input:focus,
html.dark select:focus,
html.dark textarea:focus {
  background-color: #222736;
}

html.dark .panel,
html.dark .modal-card {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
}

html.dark .logo-light {
  display: none;
}

html:not(.dark) .logo-dark {
  display: none;
}

html.dark .brand-logo,
html.dark .sidebar-logo {
  background: transparent;
}

html.dark .login-screen {
  background: radial-gradient(circle at 50% 18%, rgba(230, 73, 139, 0.12) 0%, rgba(15, 17, 23, 0) 60%), var(--bg);
}

html.dark .login-card {
  background: linear-gradient(180deg, #1C202B 0%, #171A23 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(230, 73, 139, 0.06);
}

html.dark .login-card input[type="email"],
html.dark .login-card input[type="password"],
html.dark .login-card input[type="text"] {
  background: #11141C;
  border: none;
  box-shadow: none;
  color: var(--text);
}

html.dark .login-card input[type="email"]:focus,
html.dark .login-card input[type="password"]:focus,
html.dark .login-card input[type="text"]:focus {
  border: none;
  background: #141822;
  box-shadow: none;
}

html.dark .sidebar,
html.dark .bottom-nav {
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.35);
}

html.dark .btn-secondary,
html.dark .btn-inline {
  background: #232836;
  color: var(--text);
}

html.dark .btn-inline-danger {
  background: rgba(248, 113, 113, 0.14);
  color: var(--red);
}

html.dark .budget-badge.alerta {
  background: rgba(251, 191, 36, 0.16);
  color: #FBBF24;
}

/* Painel Controle Diário & Ritmo */
.coach-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.coach-item {
  background: var(--bg);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.coach-item strong {
  font-size: 16px;
  color: var(--text);
}

.coach-badge-wrap {
  margin: 2px 0;
}

@media (max-width: 600px) {
  .coach-grid {
    grid-template-columns: 1fr;
  }
}

/* Botão flutuante do Chat e Chat em tela cheia (estilo WhatsApp) */
.chat-fab {
  position: fixed;
  right: 16px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(190, 52, 110, 0.35);
  cursor: pointer;
  z-index: 35;
  transition: transform 0.12s ease;
}

.chat-fab:active {
  transform: scale(0.95);
}

body:not(.on-home) .chat-fab {
  display: none;
}

@media (min-width: 768px) {
  .chat-fab {
    right: 24px;
    bottom: 24px;
  }
}

body.in-chat .topbar,
body.in-subpage .bottom-nav,
body.on-mais .bottom-nav,
html[data-loading-page="mais"] .auth-skeleton-bottomnav,
html[data-loading-page="metas"] .auth-skeleton-bottomnav,
html[data-loading-page="contas"] .auth-skeleton-bottomnav,
html[data-loading-page="cartoes"] .auth-skeleton-bottomnav,
html[data-loading-page="alterar-senha"] .auth-skeleton-bottomnav,
html[data-loading-page="relatorio-pdf"] .auth-skeleton-bottomnav,
body.in-chat .bottom-nav,
body.in-chat .chat-fab {
  display: none !important;
}

body.in-subpage .btn-add-fab {
  bottom: calc(22px + env(safe-area-inset-bottom));
}

@media (max-width: 767px) {
  body.in-chat {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }
}

.chat-fullscreen.active {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  animation: none;
}

.chat-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: var(--surface);
  box-shadow: 0 1px 8px rgba(17, 24, 39, 0.06);
  flex-shrink: 0;
}

.chat-topbar-info {
  flex: 1;
  min-width: 0;
}

.chat-topbar-info strong {
  display: block;
  font-size: 15px;
  color: var(--text);
}

.chat-topbar-info small {
  display: block;
  font-size: 12px;
  color: var(--green);
}

.chat-clear-btn {
  flex-shrink: 0;
}

.chat-bubble-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chat-action-btn {
  border: none;
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg);
  color: var(--text);
  transition: opacity 0.15s ease, transform 0.12s ease;
}

.chat-action-btn.primary {
  background: var(--accent);
  color: #fff;
}

.chat-action-btn:active {
  transform: scale(0.97);
}

.chat-mic-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: var(--bg);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.chat-mic-btn.recording {
  background: rgba(220, 38, 38, 0.14);
  color: var(--red);
}

.chat-chips {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
  padding: 10px 14px 6px;
  flex-shrink: 0;
  scrollbar-width: none;
}

.chat-chips::-webkit-scrollbar {
  display: none;
}

.chat-chip {
  border: none;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface);
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(17, 24, 39, 0.05);
  transition: background-color 0.15s ease;
}

.chat-chip:hover {
  background: var(--divider);
}

.chat-messages {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 10px 14px 16px;
}

.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.chat-bot {
  align-self: flex-start;
  background: var(--surface);
  color: var(--text);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(17, 24, 39, 0.05);
}

.chat-user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-form {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface);
  box-shadow: 0 -1px 8px rgba(17, 24, 39, 0.06);
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .mobile-only-menu {
    display: none !important;
  }

  .page.chat-bg-visible {
    display: block;
  }

  .chat-fullscreen.active {
    inset: auto;
    right: 24px;
    bottom: 24px;
    width: 410px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 48px);
    border-radius: 18px;
    box-shadow: 0 18px 48px rgba(17, 24, 39, 0.22);
  }

  html.dark .chat-fullscreen.active {
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  }
}

.chat-form input {
  flex: 1;
  margin-bottom: 0;
}

.chat-send-btn {
  width: auto;
  margin-top: 0;
  padding: 11px 18px;
  flex-shrink: 0;
}

.shared-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 13px;
}

.shared-summary strong {
  color: var(--accent);
}

.shared-summary span {
  font-size: 12px;
  color: var(--muted);
}

.meta-history {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 8px 0 4px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg);
}

.meta-history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.forecast-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 768px) {
  .forecast-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.forecast-card {
  padding: 12px;
  border-radius: 12px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.forecast-card strong {
  font-size: 13px;
  text-transform: capitalize;
}

.forecast-card small {
  font-size: 12px;
  color: var(--muted);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-dow {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding-bottom: 4px;
}

.cal-day {
  border: none;
  border-radius: 10px;
  padding: 6px 2px;
  min-height: 40px;
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
}

.cal-day.today {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.cal-day.selected {
  outline: 2px solid var(--accent);
}

.cal-dots {
  display: flex;
  gap: 3px;
}

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.cal-dot.pending { background: var(--red); }
.cal-dot.paid { background: var(--green); }
.cal-dot.card { background: var(--accent); }

.cal-detail {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.custom-cats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -6px 0 12px;
}

.custom-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.custom-cat-chip span {
  opacity: 0.75;
  font-weight: 700;
}
