:root {
  --primary: #007FFC;
  --primary-dark: #0066CC;
  --primary-darker: #0052A3;
  --primary-light: #E6F2FF;
  --primary-muted: #B3D9FF;
  --bg: #F0F5FA;
  --surface: #FFFFFF;
  --text: #1A2332;
  --text-muted: #5C6B7F;
  --border: #DDE5EF;
  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --purple: #8B5CF6;
  --purple-light: #EDE9FE;
  --shadow: 0 2px 12px rgba(0, 79, 204, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 79, 204, 0.12);
  --radius: 14px;
  --radius-sm: 8px;
  --font: "Inter", system-ui, sans-serif;
  --sidebar-w: 260px;
  --topbar-h: 64px;
}

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

html {
  touch-action: manipulation;
  -ms-touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  max-width: 100%;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100%;
}

.hidden { display: none !important; }

/* ========== AUTH ========== */
.auth-app {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.auth-screen {
  display: none;
  width: 100%;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}

.auth-screen--active { display: flex; }

.auth-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(420px, 100%);
  gap: 1.75rem;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem 2.5rem;
  width: 100%;
  box-shadow: var(--shadow);
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-brand {
  text-align: center;
}

.auth-brand--outside {
  width: 100%;
  margin-bottom: 0;
}

.auth-brand p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.85rem;
  line-height: 1.45;
}

.app-logo {
  display: block;
  object-fit: contain;
}

.app-logo--auth {
  width: min(240px, 78vw);
  height: auto;
  max-height: 112px;
  margin: 0 auto;
}

.app-logo--sidebar {
  height: 32px;
  width: auto;
  max-width: 100%;
}

.app-logo--topbar {
  height: 36px;
  width: auto;
  max-width: 200px;
  flex-shrink: 0;
}

@media (min-width: 769px) {
  .app-logo--topbar { display: none; }
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-switch {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  text-decoration: underline;
}

a.link-btn {
  display: inline;
}

.link-btn:hover { color: var(--primary-dark); }

/* ========== LAYOUT ========== */
.main-app {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  transition: transform 0.3s ease;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  padding: calc(0.6rem + env(safe-area-inset-top)) 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar__nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
}

.account-card {
  max-width: 440px;
}

.account-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 440px;
}

.account-section {
  padding: 1.25rem;
}

.account-section__title {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 700;
}

.account-section--footer {
  padding-bottom: 1rem;
}

.account-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.account-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.account-card__current {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--text-muted);
}

.account-vencimento {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.account-vencimento__label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.account-vencimento__value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.account-card__profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.account-card__avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.account-card__name {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
}

.account-card__email {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  word-break: break-all;
}

.account-card__plan {
  margin-bottom: 1.25rem;
}

.account-card__status {
  margin: 0;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--text-muted);
}

.account-card__status--active {
  background: var(--success-light);
  color: #047857;
}

.account-card__actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
}

.sidebar__link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar__link:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.sidebar__link.active {
  background: var(--primary);
  color: #fff;
}

.sidebar__footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.sidebar__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.sidebar__user strong {
  display: block;
  font-size: 0.85rem;
}

.sidebar__user small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.app-body {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: calc(0.6rem + env(safe-area-inset-top)) 1rem 0.6rem;
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-w);
  z-index: 50;
  min-height: var(--topbar-h);
}

.menu-toggle {
  display: none !important;
}

.topbar__title {
  font-size: 1rem;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
  flex-shrink: 0;
}

.month-picker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
}

.month-picker__btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--primary);
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  line-height: 1;
}

.month-picker__btn:hover { background: var(--primary-light); }

.month-picker span {
  font-size: 0.88rem;
  font-weight: 600;
  min-width: 120px;
  text-align: center;
}

.content {
  flex: 1;
  padding: 1.5rem;
  padding-top: calc(1.5rem + var(--topbar-h) + env(safe-area-inset-top));
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  box-sizing: border-box;
}

.page { display: none; animation: fadeIn 0.3s ease; }
.page--active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 150;
}

.sidebar-overlay.show { display: block; }

/* ========== COMPONENTS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

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

.btn--primary:hover:not(:disabled) { background: var(--primary-dark); }

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

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}

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

.btn--danger {
  background: var(--danger-light);
  color: var(--danger);
  border: none;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
}

.btn--danger:hover { background: #FECACA; }

.btn--sm { padding: 0.45rem 0.85rem; font-size: 0.82rem; }
.btn--block { width: 100%; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group--full { grid-column: 1 / -1; }

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 127, 252, 0.15);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

/* ========== STATS ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

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

a.sidebar__link,
a.bottom-nav__item {
  text-decoration: none;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
  min-width: 0;
  max-width: 100%;
}

.stat-card__icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.stat-card__icon--blue { background: var(--primary-light); }
.stat-card__icon--green { background: var(--success-light); }
.stat-card__icon--orange { background: var(--warning-light); }
.stat-card__icon--purple { background: var(--purple-light); }

.stat-card__label {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
}

.stat-card__value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}

.stat-card__value--positivo { color: var(--success); }
.stat-card__value--negativo { color: var(--danger); }

.valor-lancamento--entrada { color: var(--success); }
.valor-lancamento--saida { color: var(--danger); }

.expense-card__value.valor-lancamento--entrada,
.expense-card__value.valor-lancamento--saida {
  font-size: 0.92rem;
  line-height: 1.35rem;
}

/* ========== PANELS ========== */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.panel__header h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.panel__body { padding: 1.25rem; max-width: 100%; min-width: 0; box-sizing: border-box; }
.panel__body--flush { padding: 0; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

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

.day-balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.day-balance__label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.day-balance__value {
  font-size: 1.15rem;
  font-weight: 700;
}

.notification-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  margin-bottom: 0.75rem;
}

.notification-card--global {
  border-left: 3px solid var(--primary);
}

.notification-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.notification-card__title {
  font-size: 0.95rem;
  font-weight: 600;
}

.notification-card__badge {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}

.notification-card__text {
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1.45;
}

.notification-card__time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.notifications-list {
  max-width: 720px;
}

.dashboard-top {
  margin-bottom: 1.5rem;
}

.dashboard-top .panel {
  margin-bottom: 0;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.dashboard-stats .stat-card--saldo {
  grid-column: 1 / -1;
}

.stat-card--stacked {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
  padding: 1.1rem 1.25rem;
}

.stat-card__sub {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-card--stacked .stat-card__icon {
  margin-bottom: 0.1rem;
}

.stat-card--stacked .stat-card__label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.stat-card--stacked .stat-card__value {
  font-size: 1.25rem;
  line-height: 1.2;
  white-space: nowrap;
}

/* ========== CHARTS ========== */
.bar-chart { display: flex; flex-direction: column; gap: 0.75rem; }

.dash-monthly-chart {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.dash-monthly-chart__title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.panel__body--charts-stack {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.col-chart__plot {
  position: relative;
  width: 100%;
  max-width: 100%;
}

.col-chart__bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.25rem;
  min-height: 180px;
  padding: 0 0.15rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.col-chart__trend {
  position: absolute;
  left: 0.15rem;
  right: 0.15rem;
  top: 1.85rem;
  height: 120px;
  width: calc(100% - 0.3rem);
  pointer-events: none;
  z-index: 3;
  overflow: visible;
}

.col-chart__trend polyline {
  fill: none;
  stroke: var(--primary-dark);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.col-chart__trend .col-chart__dot-point {
  fill: var(--primary);
  stroke: var(--surface);
  stroke-width: 0.6;
}

.col-chart__item {
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  font: inherit;
  padding: 0;
  cursor: pointer;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.col-chart__item--active .col-chart__value {
  visibility: visible;
  opacity: 1;
  color: var(--primary);
  font-weight: 700;
}

.col-chart__item--active .col-chart__bar {
  filter: brightness(1.08);
  box-shadow: 0 0 0 2px rgba(0, 127, 252, 0.25);
}

.col-chart__value {
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.15;
  min-height: 1.5rem;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-chart__hint {
  margin: 0.5rem 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
}

.col-chart {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.col-chart__item--ref .col-chart__label {
  color: var(--primary);
  font-weight: 700;
}

.col-chart__bar-wrap {
  width: 100%;
  height: 120px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.col-chart__bar {
  width: 72%;
  min-height: 4px;
  border-radius: 6px 6px 2px 2px;
  transition: height 0.25s ease;
}

.col-chart__bar--real {
  background: var(--primary);
}

.col-chart__bar--projecao {
  background: repeating-linear-gradient(
    -45deg,
    var(--warning),
    var(--warning) 4px,
    #fbbf24 4px,
    #fbbf24 8px
  );
  opacity: 0.92;
}

.col-chart__label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

.col-chart__legend {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 0.85rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.col-chart__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.col-chart__dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.col-chart__dot--real {
  background: var(--primary);
}

.col-chart__dot--projecao {
  background: var(--warning);
}

.pie-chart {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.pie-chart--donut {
  justify-content: center;
  padding: 0.5rem 0;
}

.pie-chart--natureza .pie-chart__ring::after {
  inset: 28%;
}

.pie-chart--natureza .pie-chart__visual {
  width: 160px;
  height: 160px;
}

.pie-chart__visual {
  flex-shrink: 0;
  width: 180px;
  height: 180px;
  position: relative;
}

.pie-chart__ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
}

.pie-chart__ring::after {
  content: "";
  position: absolute;
  inset: 32%;
  background: var(--surface);
  border-radius: 50%;
}

.pie-chart__center {
  position: absolute;
  inset: 32%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  padding: 0.25rem;
}

.pie-chart__center strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
}

.pie-chart__center span {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.pie-chart__legend {
  flex: 0 1 auto;
  min-width: 180px;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.pie-chart__item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.88rem;
}

.pie-chart__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pie-chart__name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pie-chart__pct {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
}

.bar-item {
  display: grid;
  grid-template-columns: 120px 1fr 80px;
  align-items: center;
  gap: 0.75rem;
}

.bar-item__label {
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-item__track {
  height: 10px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}

.bar-item__stack {
  display: flex;
  height: 100%;
  min-width: 4px;
  border-radius: 999px;
  overflow: hidden;
}

.bar-item__fill {
  height: 100%;
  border-radius: 0;
  transition: width 0.5s ease;
  min-width: 0;
}

.bar-item__fill--pago {
  border-radius: 999px 0 0 999px;
  flex-shrink: 0;
}

.bar-item__fill--pendente {
  background: #cbd5e1;
  flex: 1;
}

.bar-chart--status .bar-chart__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.bar-chart__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.bar-chart__dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.bar-chart__dot--entrada { background: var(--success); }
.bar-chart__dot--saida { background: var(--danger); }
.bar-chart__dot--pendente { background: #cbd5e1; }

.bar-item__value {
  font-size: 0.82rem;
  font-weight: 600;
  text-align: right;
}

/* ========== TABLES ========== */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover { background: var(--primary-light); }
.data-table tbody tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.badge--pago { background: var(--success-light); color: #047857; }
.badge--pendente { background: var(--warning-light); color: #B45309; }

.table-actions {
  display: flex;
  gap: 0.35rem;
}

.btn-icon {
  background: var(--primary-light);
  color: var(--primary);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover { background: var(--primary-muted); }
.btn-icon--danger { background: var(--danger-light); color: var(--danger); }
.btn-icon--danger:hover { background: #FECACA; }

.empty-row td {
  text-align: center;
  color: var(--text-muted);
  padding: 2.5rem 1rem;
}

/* ========== FILTERS ========== */
.page-toolbar {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-select,
.filter-search {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.filter-search { min-width: 200px; }

.inline-form {
  display: flex;
  gap: 0.5rem;
}

.inline-form input,
.inline-form select {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-width: 260px;
}

.inline-form select {
  min-width: 180px;
}

.expenses-list {
  display: none;
}

.expenses-list--always {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem;
}

.expense-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
}

.expense-card--latest {
  border: 2px solid var(--success);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.15);
}

.expense-card__line1 {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.expense-card__head {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.expense-card__desc {
  width: 100%;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.expense-card__head .badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.45rem;
}

.expense-card__value {
  flex-shrink: 0;
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.35rem;
}

.expense-card__actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
  padding-top: 0.05rem;
}

.expense-card__line2 {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  overflow: hidden;
}

.expense-card__sep {
  opacity: 0.5;
  flex-shrink: 0;
}

.expense-card__pay-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}

.expense-card__pay-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--text-muted);
}

.expense-card__pay-icon svg {
  width: 14px;
  height: 14px;
}

.expense-card__natureza {
  font-weight: 600;
  flex-shrink: 0;
}

.expense-card__natureza--fixa {
  color: var(--primary);
}

.expense-card__natureza--variavel {
  color: var(--warning);
}

.expense-card__pessoa {
  display: block;
  width: 100%;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.expenses-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 1rem;
  font-size: 0.9rem;
}

.table-wrap--desktop {
  display: block;
}

/* ========== MONTH OVERVIEW ========== */
.month-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.month-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.month-card__value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  display: block;
}

.month-card__label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ========== PAYMENT / COST GRIDS ========== */
.payment-grid,
.cost-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.payment-card,
.cost-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  position: relative;
}

.payment-card__icon,
.cost-card__icon {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.payment-card__icon--svg {
  display: flex;
  align-items: center;
  color: var(--primary);
}

.payment-card__icon--svg svg {
  width: 28px;
  height: 28px;
}

.payment-card__name,
.cost-card__name {
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.25rem;
}

.payment-card__total,
.cost-card__total {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.2rem;
}

.cost-card__pct,
.payment-card__pct {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.payment-card__count,
.cost-card__count {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.cost-card__delete {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s, border-color 0.2s;
}

.cost-card--custom .cost-card__delete {
  opacity: 1;
}

.cost-card:hover .cost-card__delete { opacity: 1; }
.cost-card__delete:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.cost-card__badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
}

.cost-card__badge--default {
  color: var(--text-muted);
  background: var(--bg);
}

.cost-card__badge--entrada {
  color: var(--success);
  background: rgba(16, 185, 129, 0.12);
}

.pick-cards-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0.35rem 0;
}

.cost-card__color {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  margin-bottom: 0.75rem;
}

/* ========== PESSOAS ========== */
.pessoa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.pessoa-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  position: relative;
}

.pessoa-card--favorita {
  border-color: var(--warning);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.2);
}

.pessoa-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.pessoa-card__name {
  font-weight: 700;
  font-size: 1rem;
}

.pessoa-card__actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.pessoa-card__fav {
  background: none;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.15rem;
}

.pessoa-card__fav--active {
  color: var(--warning);
}

.pessoa-card__delete {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.pessoa-card__delete:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.pessoa-card__totais {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.pessoa-card__total-box {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
}

.pessoa-card__total-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.pessoa-card__total-value {
  font-size: 0.95rem;
  font-weight: 700;
}

.pessoa-card__total-value--entrada {
  color: var(--success);
}

.pessoa-card__total-value--saida {
  color: var(--danger);
}

.pessoa-card__saldo {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.pessoa-card__saldo strong {
  color: var(--primary);
}

.pessoa-card__centros-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.pessoa-card__centros {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pessoa-card__centro-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.78rem;
}

.pessoa-card__centro-nome {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pessoa-card__centro-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pessoa-card__centro-valor {
  font-weight: 600;
  white-space: nowrap;
}

.pessoa-card__centro-valor--entrada {
  color: var(--success);
}

.pessoa-card__centro-valor--saida {
  color: var(--danger);
}

.pessoa-card__centro-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ========== OCR ========== */
.ocr-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 1rem;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-zone__icon { font-size: 2.5rem; display: block; margin-bottom: 0.75rem; }
.upload-zone p { font-weight: 500; margin-bottom: 0.25rem; }
.upload-zone small { color: var(--text-muted); font-size: 0.8rem; }

.ocr-preview {
  margin-bottom: 1rem;
  text-align: center;
}

.ocr-preview img {
  max-width: 100%;
  max-height: 240px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
}

.ocr-progress { margin-top: 1rem; }

.ocr-progress__bar {
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.ocr-progress__fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  width: 0%;
  transition: width 0.3s;
}

.ocr-progress span {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.ocr-text {
  margin-bottom: 1rem;
}

.ocr-text label {
  font-size: 0.82rem;
  font-weight: 600;
  display: block;
  margin-bottom: 0.35rem;
}

.ocr-text pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-size: 0.75rem;
  max-height: 120px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.ocr-form { margin-top: 0.5rem; }

/* ========== QR CUPOM ========== */
.qr-cupom__hint {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 1rem;
  text-align: center;
}

.qr-cupom__scan {
  text-align: center;
  padding: 2rem 1rem;
  background: var(--primary-light);
  border-radius: var(--radius);
  border: 2px dashed var(--primary-muted);
}

.qr-cupom__logo {
  height: 56px;
  width: auto;
  margin: 0 auto 1rem;
  opacity: 0.85;
}

.qr-cupom__scan-text {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.btn--scan {
  font-size: 1rem;
  padding: 0.85rem 1.5rem;
}

.qr-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem;
  margin-top: 1rem;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
}

.qr-status p {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--primary-dark);
}

.qr-result {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: var(--success-light);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: #047857;
}

.qr-result strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

.qr-preview {
  margin-top: 1rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.qr-preview h4 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.qr-preview__list {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1.25rem;
}

.qr-preview__item {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 0.5rem;
  align-items: baseline;
}

.qr-preview__item dt {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.qr-preview__item dd {
  font-size: 0.92rem;
  font-weight: 500;
  margin: 0;
  text-align: right;
}

.qr-preview__valor {
  color: var(--primary);
  font-size: 1.05rem !important;
  font-weight: 700 !important;
}

.qr-preview__form {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}

.qr-cupom,
.qr-preview,
.qr-preview__form,
.qr-preview__form .form-group,
.panel__body {
  min-width: 0;
  max-width: 100%;
}

.qr-preview__form input[type="text"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  background: var(--bg);
  color: var(--text);
}

.qr-preview__select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  background: var(--bg);
  color: var(--text);
}

.qr-preview__parcela-hint {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.qr-preview__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

body.auth-page {
  overflow: hidden;
}

body.auth-page .bottom-nav {
  display: none !important;
}

/* ========== MODAL ========== */
.modal {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: 520px;
  width: 92vw;
  box-shadow: var(--shadow-lg);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

.modal:not([open]) {
  display: none;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal__header h3 { font-size: 1.05rem; }

.modal__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal--expense[open] {
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal__body--expense {
  padding: 1rem 1.25rem 1.25rem;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: calc(90dvh - 4rem);
  position: relative;
}

.modal__body--expense .form-grid--expense {
  gap: 0.85rem;
  min-width: 0;
  width: 100%;
}

.modal__body--expense .form-grid--expense > * {
  min-width: 0;
}

.modal__body--expense .form-group--full {
  min-width: 0;
  max-width: 100%;
}

.expense-row-duo {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.expense-row-duo--single .expense-row-duo__col:first-child {
  flex: 1 1 100%;
  max-width: 100%;
}

.expense-row-duo__col {
  flex: 1 1 0;
  min-width: 0;
  max-width: 50%;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
  color: var(--text);
}

.pick-cards-scroll {
  display: block;
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0.1rem 0 0.35rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.pick-cards-scroll::-webkit-scrollbar {
  height: 5px;
}

.pick-cards-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.pick-cards {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.5rem;
  width: max-content;
  padding-right: 0.25rem;
}

.expense-row-duo__col .pick-card {
  min-width: 64px;
  padding: 0.45rem 0.55rem;
}

.expense-row-duo__col .pick-card__label {
  font-size: 0.68rem;
}

.pick-card {
  flex: 0 0 auto;
  min-width: 72px;
  padding: 0.5rem 0.65rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.pick-card--active {
  border-color: var(--pick-accent, var(--primary));
  background: var(--primary-light);
}

.pick-card--tone-entrada.pick-card--active {
  --pick-accent: var(--success);
  border-color: var(--success);
  background: var(--success-light);
}

.pick-card--tone-saida.pick-card--active {
  --pick-accent: var(--danger);
  border-color: var(--danger);
  background: var(--danger-light);
}

.pick-card__icon {
  display: block;
  font-size: 1.15rem;
  line-height: 1.2;
  margin-bottom: 0.2rem;
}

.pick-card__icon--entrada {
  color: var(--success);
}

.pick-card__icon--saida {
  color: var(--danger);
}

.pick-card__icon--svg {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.pick-card--active .pick-card__icon--svg {
  color: var(--primary);
}

.pick-card__icon--svg svg {
  width: 22px;
  height: 22px;
}

.pick-card__label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.pick-card--dot::before {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--pick-accent, var(--primary));
  margin: 0 auto 0.35rem;
}

.modal__loading {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  z-index: 5;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.modal__footer .btn:disabled {
  opacity: 0.65;
  pointer-events: none;
}

.modal__body { padding: 1.5rem; }

.modal__footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  padding-top: 1rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.modal__footer-delete {
  margin-right: auto;
}

/* ========== TOAST ========== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: #fff;
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  opacity: 0;
  transition: all 0.35s ease;
  z-index: 1000;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success { background: var(--primary-dark); }
.toast.error { background: var(--danger); }

/* ========== RESPONSIVE ========== */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .ocr-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root {
    --topbar-h: 72px;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar__nav {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  .app-body {
    margin-left: 0;
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }

  .topbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    padding: calc(0.55rem + env(safe-area-inset-top)) 0.85rem 0.55rem;
    left: 0;
    min-height: var(--topbar-h);
  }

  .app-logo--topbar {
    flex: 0 0 auto;
    height: 38px;
    max-width: 210px;
  }

  .topbar__title {
    display: none;
  }

  .topbar__actions {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
    width: auto;
    min-width: 0;
  }

  .month-picker {
    flex-shrink: 0;
    padding: 0.3rem 0.55rem;
  }

  .month-picker span {
    min-width: auto;
    font-size: 0.84rem;
    font-weight: 600;
    white-space: nowrap;
  }

  .dashboard-grid--charts {
    grid-template-columns: 1fr;
  }

  .dashboard-stats {
    gap: 0.65rem;
  }

  .stat-card--stacked {
    padding: 0.85rem 0.75rem;
  }

  .stat-card--stacked .stat-card__value {
    font-size: 1rem;
  }

  .stat-card__sub {
    font-size: 0.68rem;
  }

  .pie-chart {
    flex-direction: row;
    justify-content: center;
    gap: 1.25rem;
  }

  .pie-chart__visual {
    width: 150px;
    height: 150px;
  }

  .pie-chart__center strong {
    font-size: 0.82rem;
  }

  .pie-chart__legend {
    min-width: 0;
    gap: 0.55rem;
  }

  .pie-chart__item {
    font-size: 0.78rem;
    gap: 0.45rem;
  }

  .stats-grid,
  .month-overview,
  .stat-card { padding: 1rem; }
  .stat-card__value { font-size: 1.1rem; }
  .stat-card__icon { width: 40px; height: 40px; font-size: 1.1rem; }

  .form-grid { grid-template-columns: 1fr; }

  .topbar__actions .btn--primary:not(.bottom-nav *) {
    display: none;
  }

  .bar-item { grid-template-columns: 80px 1fr 65px; gap: 0.5rem; }

  .filters { width: 100%; }
  .filter-select, .filter-search { flex: 1; min-width: 0; }

  .inline-form { flex-direction: column; width: 100%; }
  .inline-form input,
  .inline-form select { min-width: 0; width: 100%; }

  .content {
    padding: 1rem;
    padding-top: calc(1rem + var(--topbar-h) + env(safe-area-inset-top));
    padding-bottom: 0.5rem;
  }

  .modal.modal--expense[open] {
    width: 100%;
    max-width: 100%;
    height: 92dvh;
    max-height: 92dvh;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    margin: 0;
    border-radius: 1rem 1rem 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .modal--expense[open] .modal__header {
    flex-shrink: 0;
    padding: 1rem 1.15rem;
  }

  .modal--expense[open] .modal__body--expense {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: hidden;
    padding: 0.85rem 1rem 1rem;
  }

  .modal--expense[open] .form-grid--expense {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
  }

  .modal--expense[open] .modal__footer {
    flex-shrink: 0;
    margin-top: 0;
    padding-top: 0.85rem;
    padding-bottom: calc(0.25rem + env(safe-area-inset-bottom));
  }

  .ocr-layout { grid-template-columns: 1fr; }

  .table-wrap--desktop { display: none; }
  .expenses-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
  }

  /* Tabelas viram cards no mobile */
  .data-table thead { display: none; }

  .data-table tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    padding: 0.75rem;
  }

  .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0;
    border: none;
    font-size: 0.85rem;
  }

  .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-right: 1rem;
    flex-shrink: 0;
  }

  .data-table td.table-actions {
    justify-content: flex-end;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    margin-top: 0.25rem;
  }

  .data-table td.table-actions::before { display: none; }

  .data-table tbody tr:hover { background: var(--surface); }

  .empty-row td { display: block; text-align: center; }
  .empty-row td::before { display: none; }

  .payment-grid,
  .cost-grid,
  .pessoa-grid { grid-template-columns: 1fr 1fr; }

  .plans-grid { grid-template-columns: 1fr; }

  .dashboard-grid { grid-template-columns: 1fr; }
}

/* ========== BOTTOM NAV (MOBILE) ========== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.55rem 0.35rem calc(0.55rem + env(safe-area-inset-bottom));
  z-index: 300;
  justify-content: space-around;
  align-items: flex-end;
  min-height: 62px;
  overflow: visible;
}

.bottom-nav__cutout {
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 76px;
  height: 38px;
  background: var(--bg);
  border-radius: 0 0 76px 76px;
  pointer-events: none;
  z-index: 0;
  box-shadow: none;
}

.bottom-nav__item {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 500;
  padding: 0.35rem 0.4rem;
  cursor: pointer;
  flex: 1;
  max-width: 72px;
  text-align: center;
}

.bottom-nav__item svg {
  width: 22px;
  height: 22px;
}

.bottom-nav__item.active { color: var(--primary); }

.bottom-nav__fab-slot {
  position: relative;
  z-index: 2;
  flex: 0 0 76px;
  width: 76px;
  height: 1px;
  align-self: flex-end;
  overflow: visible;
}

.bottom-nav__fab {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, -24px);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border: 4px solid var(--surface);
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.14),
    0 6px 18px rgba(0, 127, 252, 0.38);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  padding: 0;
}

.bottom-nav__fab:active {
  transform: translate(-50%, -24px) scale(0.96);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.12),
    0 4px 12px rgba(0, 127, 252, 0.3);
}

.bottom-nav__fab svg {
  width: 28px;
  height: 28px;
}

@media (max-width: 768px) {
  .bottom-nav { display: flex; }
}

/* ========== PLANOS ========== */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  max-width: 880px;
  margin: 0 auto;
}

.plan-card--single {
  width: 100%;
}

.plan-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  position: relative;
  box-shadow: var(--shadow);
}

.plan-card--featured {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.plan-card--current {
  border-color: #047857;
  box-shadow: 0 0 0 2px rgba(4, 120, 87, 0.2);
}

.plan-card__badge--active {
  background: #047857;
}

.plan-card__btn--active:disabled {
  opacity: 1;
  cursor: default;
}

.plan-card__badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
}

.plan-card h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }

.plan-card__price {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.plan-card__price small {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.plan-card__price-note {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: -0.1rem 0 0.5rem;
}

.plan-card__desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 1rem;
}

.plan-card ul {
  list-style: none;
  margin-bottom: 1.25rem;
}

.plan-card li {
  font-size: 0.88rem;
  padding: 0.3rem 0;
  padding-left: 1.25rem;
  position: relative;
}

.plan-card li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 700;
}

.plan-active-banner {
  background: var(--success-light);
  color: #047857;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.plan-usage-banner {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.limite-gratuito-banner {
  background: linear-gradient(135deg, #fef3c7 0%, #fee2e2 100%);
  border-bottom: 2px solid var(--warning);
  padding: 0.9rem 1rem;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.18);
  position: relative;
  z-index: 40;
}

.limite-gratuito-banner__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.limite-gratuito-banner__text {
  flex: 1;
  min-width: 0;
}

.limite-gratuito-banner__title {
  display: block;
  font-size: 0.95rem;
  color: #b45309;
  margin-bottom: 0.25rem;
}

.limite-gratuito-banner__text p {
  margin: 0;
  font-size: 0.82rem;
  color: #92400e;
  line-height: 1.45;
}

.limite-gratuito-banner__cta {
  flex-shrink: 0;
  white-space: nowrap;
}

.limite-gratuito-banner--pulse {
  animation: limiteBannerPulse 0.55s ease 3;
}

@keyframes limiteBannerPulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(245, 158, 11, 0.18); }
  50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.28); }
}

@media (max-width: 768px) {
  .limite-gratuito-banner {
    padding: 0.8rem 0.85rem;
  }

  .limite-gratuito-banner__inner {
    flex-direction: column;
    align-items: stretch;
  }

  .limite-gratuito-banner__cta {
    width: 100%;
    justify-content: center;
  }
}

.plan-modal-desc {
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.plan-pay-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.plan-pay-tab {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.plan-pay-tab--active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}

.plan-pix-panel {
  text-align: center;
}

.plan-pix-panel__hint {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 1rem;
}

.plan-pix-panel__qr img {
  width: min(220px, 100%);
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

.plan-pix-panel__code {
  width: 100%;
  font-size: 0.78rem;
  font-family: ui-monospace, monospace;
  resize: none;
}

.plan-pix-panel__status {
  margin-top: 1rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

#planCardFields.hidden {
  display: none;
}

/* ========== TERMOS / CHECKBOX ========== */
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.88rem;
  cursor: pointer;
  line-height: 1.4;
}

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

.terms-content {
  max-height: 60vh;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.6;
}

.terms-content h3 { color: var(--primary); margin-bottom: 0.75rem; }

.modal--wide { max-width: 640px; }

/* ========== LOADING ========== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.empty-chart {
  color: var(--text-muted);
  text-align: center;
  padding: 1rem;
}

.color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

@media (max-width: 480px) {
  .stats-grid,
  .month-overview,
  .payment-grid,
  .cost-grid,
  .pessoa-grid { grid-template-columns: 1fr; }

  .auth-card { padding: 1.75rem 1.25rem; }
  .app-logo--auth { width: min(260px, 90vw); max-height: 80px; }
}

