/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --bg2: #161b27;
  --bg3: #1e2538;
  --bg4: #252d42;
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.14);
  --text: #e8eaf0;
  --text2: #8b93a8;
  --text3: #555e78;
  --green: #5ee7b0;
  --green-dim: rgba(94,231,176,0.12);
  --red: #ff6b6b;
  --red-dim: rgba(255,107,107,0.12);
  --blue: #7eb8f5;
  --blue-dim: rgba(126,184,245,0.12);
  --amber: #fbbf24;
  --amber-dim: rgba(251,191,36,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --nav-h: 68px;
  --header-h: 56px;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
}

/* ===== SETUP SCREEN ===== */
.setup-screen {
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px 40px;
  overflow-y: auto;
  background: var(--bg);
}

.setup-card {
  width: 100%;
  max-width: 400px;
  padding: 32px 24px;
}

.setup-logo {
  margin-bottom: 20px;
}

.setup-card h1 {
  font-size: 24px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.setup-card > p {
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 28px;
  line-height: 1.6;
}

.setup-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 20px;
  padding: 14px;
  background: var(--bg2);
  border-radius: var(--radius);
  border: 0.5px solid var(--border);
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green-dim);
  color: var(--green);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.step-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.step-content strong {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.step-content small {
  font-size: 12px;
  color: var(--text3);
}

.setup-link {
  font-size: 12px;
  color: var(--blue);
  text-decoration: none;
}

.setup-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 24px 0;
}

.setup-sql-btn {
  margin-top: 6px;
  background: var(--bg4);
  border: 1px solid var(--border2);
  color: var(--blue);
  font-size: 12px;
  font-family: var(--font);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  cursor: pointer;
  display: inline-block;
}

.btn-icon {
  background: var(--bg4);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: 16px;
  border-radius: var(--radius-sm);
  padding: 0 10px;
  cursor: pointer;
  flex-shrink: 0;
  height: 44px;
}

/* ===== APP SHELL ===== */
.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* ===== HEADER ===== */
.app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--bg);
  border-bottom: 0.5px solid var(--border);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

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

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

.header-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sync-dot.synced { background: var(--green); }
.sync-dot.syncing { background: var(--amber); animation: pulse 1.5s infinite; }
.sync-dot.offline { background: var(--text3); }
.sync-dot.local { background: var(--blue); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.month-nav button {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 16px;
  padding: 6px 12px;
  cursor: pointer;
  transition: color .15s;
}

.month-nav button:hover { color: var(--text); }

.month-nav span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  padding: 0 2px;
  white-space: nowrap;
  min-width: 80px;
  text-align: center;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 16px;
}

.page {
  display: none;
  padding: 16px;
  animation: fadeIn .15s ease;
}

.page.active { display: block; }

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

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--bg2);
  border-top: 0.5px solid var(--border);
  flex-shrink: 0;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  transition: color .15s;
  min-height: 48px;
}

.nav-btn span {
  font-size: 10px;
  font-family: var(--font);
  white-space: nowrap;
}

.nav-btn.active { color: var(--green); }
.nav-btn:hover { color: var(--text); }

.nav-btn.center-btn {
  width: 46px;
  height: 46px;
  min-height: 46px;
  flex: 0 0 46px;
  background: var(--green);
  color: #0a1a12;
  border-radius: 50%;
  padding: 0;
  margin: 0 8px;
  box-shadow: 0 0 20px rgba(94,231,176,0.25);
}

.nav-btn.center-btn:hover { background: #7eefc0; }

/* ===== METRICS ===== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.metric-card {
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.metric-card.full { grid-column: 1 / -1; }

.metric-card label {
  display: block;
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 6px;
}

.metric-card span {
  font-size: 22px;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: -0.5px;
}

.metric-card.green span { color: var(--green); }
.metric-card.red span { color: var(--red); }
.metric-card.blue span { color: var(--blue); }
.metric-card.blue.neg span { color: var(--red); }

/* ===== CARDS ===== */
.card {
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}

.card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 12px;
}

.section-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 10px;
  margin-top: 4px;
}

.empty-state {
  text-align: center;
  padding: 20px 12px;
  font-size: 13px;
  color: var(--text3);
}

.page-desc {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 16px;
  line-height: 1.6;
}

/* ===== TRANSACTION ITEMS ===== */
.tx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--border);
}

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

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

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

.tx-desc {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-meta {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}

.tx-val {
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.tx-val.credit { color: var(--green); }
.tx-val.debit { color: var(--red); }

.tx-del {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: color .15s;
}

.tx-del:hover { color: var(--red); }

.badge-ai {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--blue-dim);
  color: var(--blue);
  margin-left: 6px;
  vertical-align: middle;
}

/* ===== FORMS ===== */
.form-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-group label {
  font-size: 12px;
  color: var(--text2);
}

.field-group input,
.field-group select {
  background: var(--bg3);
  border: 0.5px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 9px 12px;
  width: 100%;
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
  appearance: none;
}

.field-group input:focus,
.field-group select:focus {
  border-color: rgba(94,231,176,0.4);
}

.field-group input::placeholder { color: var(--text3); }

.field-group select {
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23555e78' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.optional {
  font-size: 11px;
  color: var(--text3);
  font-weight: 400;
}

/* ===== BUTTONS ===== */
.btn-primary {
  background: var(--green);
  color: #0a1a12;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  padding: 11px 20px;
  cursor: pointer;
  width: 100%;
  transition: opacity .15s, transform .1s;
}

.btn-primary:hover { opacity: .9; }
.btn-primary:active { transform: scale(.98); }

.btn-secondary {
  background: var(--blue-dim);
  color: var(--blue);
  border: 0.5px solid rgba(126,184,245,0.2);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  padding: 11px 20px;
  cursor: pointer;
  width: 100%;
  transition: opacity .15s;
}

.btn-secondary:hover { opacity: .8; }

.btn-ghost {
  background: none;
  color: var(--text2);
  border: 0.5px solid var(--border2);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  padding: 11px 20px;
  cursor: pointer;
  width: 100%;
  margin-top: 8px;
  transition: color .15s;
}

.btn-ghost:hover { color: var(--text); }

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 0.5px solid rgba(255,107,107,0.2);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  padding: 11px 20px;
  cursor: pointer;
  width: 100%;
  margin-top: 8px;
  transition: opacity .15s;
}

.btn-danger:hover { opacity: .8; }

.link-btn {
  background: none;
  border: none;
  color: var(--blue);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* ===== TYPE TOGGLE ===== */
.type-toggle {
  display: flex;
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 16px;
}

.type-btn {
  flex: 1;
  padding: 10px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text3);
  transition: all .15s;
}

.type-btn.active.despesa {
  background: var(--red-dim);
  color: var(--red);
}

.type-btn.active.receita {
  background: var(--green-dim);
  color: var(--green);
}

/* ===== UPLOAD ZONE ===== */
.upload-zone {
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  margin-bottom: 16px;
}

.upload-zone:hover {
  border-color: rgba(94,231,176,0.3);
  background: var(--green-dim);
}

.upload-zone svg {
  color: var(--text3);
  margin-bottom: 10px;
}

.upload-zone p {
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 4px;
}

.upload-zone small {
  font-size: 12px;
  color: var(--text3);
}

/* ===== AI ELEMENTS ===== */
.ai-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  padding: 20px;
  font-size: 13px;
  color: var(--blue);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--bg3);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

.ai-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--green-dim);
  color: var(--green);
  font-size: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  border: 0.5px solid rgba(94,231,176,0.2);
}

/* ===== PROGRESS BARS ===== */
.prog-item {
  margin-bottom: 12px;
}

.prog-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 5px;
}

.prog-label .prog-pct {
  font-family: var(--font-mono);
  font-size: 11px;
}

.prog-track {
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
}

.prog-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .4s ease;
}

/* ===== CONTAS FIXAS ===== */
.conta-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--border);
}

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

.conta-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--border2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
  font-size: 11px;
  font-weight: 500;
}

.conta-check.pago {
  background: var(--green);
  border-color: var(--green);
  color: #0a1a12;
}

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

.conta-nome {
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.conta-meta { font-size: 11px; color: var(--text3); }

.conta-val {
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-mono);
  color: var(--text2);
}

.conta-del {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 15px;
  padding: 4px 5px;
  line-height: 1;
  transition: color .15s;
}

.conta-del:hover { color: var(--red); }

.badge-ok {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--green-dim);
  color: var(--green);
}

.badge-pend {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--amber-dim);
  color: var(--amber);
}

/* ===== CHARTS ===== */
.chart-wrap {
  position: relative;
  width: 100%;
  margin-bottom: 8px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--text2);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ===== SPLIT TABLE ===== */
.split-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 0.5px solid var(--border);
}

.split-row:last-child { border-bottom: none; padding-bottom: 0; }
.split-row:first-child { padding-top: 0; }

.split-name {
  width: 60px;
  font-size: 13px;
  color: var(--text2);
  flex-shrink: 0;
}

.split-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
}

.split-bar { height: 100%; border-radius: 3px; }

.split-val {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text2);
  width: 80px;
  text-align: right;
  flex-shrink: 0;
}

/* ===== SEARCH ===== */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  margin-bottom: 12px;
  color: var(--text3);
}

.search-bar input {
  background: none;
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  flex: 1;
}

.search-bar input::placeholder { color: var(--text3); }

/* ===== MODAL ===== */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: flex-end;
  z-index: 100;
}

.modal-card {
  background: var(--bg2);
  border-radius: var(--radius) var(--radius) 0 0;
  border-top: 0.5px solid var(--border2);
  padding: 20px 20px 32px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

/* ===== NOTICE ===== */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--amber-dim);
  border: 0.5px solid rgba(251,191,36,0.2);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 13px;
  color: var(--amber);
  line-height: 1.5;
}

/* ===== SCROLLBAR ===== */
.main-content::-webkit-scrollbar { width: 3px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 2px; }

/* ===== ORC ITEMS IN RESUMO ===== */
.orc-resumo-item {
  margin-bottom: 12px;
}

.orc-resumo-item:last-child { margin-bottom: 0; }

/* ===== HEADER RIGHT ===== */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-settings {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  transition: color .15s;
}
.btn-settings:hover { color: var(--text); }

/* ===== BADGE PRO ===== */
.badge-pro {
  background: linear-gradient(135deg, #fbbf24, #f97316);
  color: #000;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .05em;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

/* ===== UPGRADE BUTTON ===== */
.btn-upgrade {
  background: linear-gradient(135deg, #fbbf24, #f97316);
  color: #000;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-portal {
  background: var(--bg4);
  color: var(--text2);
  border: 0.5px solid var(--border2);
  border-radius: 8px;
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== UPGRADE MODAL ===== */
.upgrade-card {
  text-align: center;
  padding: 28px 24px 24px;
}

.upgrade-badge {
  display: inline-block;
  background: linear-gradient(135deg, #fbbf24, #f97316);
  color: #000;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 4px 12px;
  border-radius: 20px;
  font-family: var(--font-mono);
}

.upgrade-features {
  text-align: left;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
}

.upgrade-feat {
  font-size: 13px;
  color: var(--text2);
  padding: 4px 0;
}

.upgrade-feat::first-letter { color: var(--green); }

.upgrade-prices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 4px;
}

.upgrade-price-opt {
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  position: relative;
  transition: border-color .15s;
}

.upgrade-price-opt.selected {
  border-color: var(--amber);
}

.opt-label {
  font-size: 11px;
  color: var(--text3);
  margin-bottom: 4px;
}

.opt-price {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.opt-price span {
  font-size: 11px;
  color: var(--text3);
  font-weight: 400;
}

.opt-badge {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: #000;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg3);
  border: 0.5px solid var(--green);
  color: var(--green);
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 20px;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  z-index: 9999;
  white-space: nowrap;
  pointer-events: none;
}

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

/* ===== ENHANCED STYLES (v2) ===== */

/* Setup back link */
.setup-back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text3);
  text-decoration: none;
  margin-bottom: 20px;
  transition: color .15s;
}

.setup-back-link:hover { color: var(--text2); }

/* ===== ENHANCED METRIC CARDS ===== */
.metric-card {
  position: relative;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  opacity: 0;
  transition: opacity .2s;
}

.metric-card:hover { transform: translateY(-2px); }

.metric-card.green {
  background: linear-gradient(135deg, #161b27 0%, #0f1e18 100%);
  border-color: rgba(94, 231, 176, 0.12);
}

.metric-card.green::before {
  background: var(--green);
  opacity: 0.6;
}

.metric-card.green:hover {
  border-color: rgba(94, 231, 176, 0.22);
  box-shadow: 0 8px 24px rgba(94, 231, 176, 0.08);
}

.metric-card.red {
  background: linear-gradient(135deg, #161b27 0%, #1e1214 100%);
  border-color: rgba(255, 107, 107, 0.10);
}

.metric-card.red::before {
  background: var(--red);
  opacity: 0.5;
}

.metric-card.red:hover {
  border-color: rgba(255, 107, 107, 0.20);
  box-shadow: 0 8px 24px rgba(255, 107, 107, 0.06);
}

.metric-card.blue {
  background: linear-gradient(135deg, #161b27 0%, #101625 100%);
  border-color: rgba(126, 184, 245, 0.12);
}

.metric-card.blue::before {
  background: var(--blue);
  opacity: 0.5;
}

.metric-card.blue:hover {
  border-color: rgba(126, 184, 245, 0.22);
  box-shadow: 0 8px 24px rgba(126, 184, 245, 0.07);
}

/* ===== ENHANCED TRANSACTION ITEMS ===== */
.tx-item {
  transition: background .15s ease, padding-left .15s ease;
  border-radius: 8px;
  padding-left: 4px;
  padding-right: 4px;
}

.tx-item:hover {
  background: rgba(255, 255, 255, 0.025);
  padding-left: 8px;
}

/* Slide-in animation for new items */
@keyframes txSlideIn {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.tx-item.new-item {
  animation: txSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* ===== ENHANCED SYNC DOT ===== */
.sync-dot.syncing {
  background: var(--amber);
  box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.4);
  animation: syncPulse 1.5s ease-in-out infinite;
}

@keyframes syncPulse {
  0%   { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.5); opacity: 1; }
  50%  { box-shadow: 0 0 0 5px rgba(251, 191, 36, 0); opacity: 0.6; }
  100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); opacity: 1; }
}

.sync-dot.synced {
  background: var(--green);
  box-shadow: 0 0 6px rgba(94, 231, 176, 0.4);
}

/* ===== ENHANCED PROGRESS BARS ===== */
.prog-fill {
  background: linear-gradient(90deg, var(--green) 0%, #3dd68c 100%);
  position: relative;
  overflow: hidden;
}

.prog-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  animation: shimmer 2.5s ease-in-out infinite;
}

@keyframes shimmer {
  from { left: -100%; }
  to   { left: 100%; }
}

.prog-fill.over-budget {
  background: linear-gradient(90deg, #f97316 0%, #ef4444 100%);
}

.prog-fill.near-budget {
  background: linear-gradient(90deg, var(--amber) 0%, #f97316 100%);
}

.prog-track {
  background: rgba(255, 255, 255, 0.05);
}

/* ===== ENHANCED MODAL ===== */
.modal-overlay {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(0, 0, 0, 0.65);
  animation: overlayFadeIn .2s ease both;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-card {
  background: linear-gradient(180deg, #1a2035 0%, #141928 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 -8px 48px rgba(0, 0, 0, 0.5);
  animation: modalSlideUp .3s cubic-bezier(0.4, 0, 0.2, 1) both;
}

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

/* ===== ENHANCED CHART AREA ===== */
.chart-wrap {
  background: linear-gradient(135deg, #0f1520 0%, #131929 100%);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}

/* ===== ENHANCED BOTTOM NAV ===== */
.bottom-nav {
  background: rgba(22, 27, 39, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 0.5px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
}

.nav-btn {
  transition: color .15s ease, transform .1s ease;
  position: relative;
}

.nav-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--green);
  opacity: 0;
  transition: opacity .15s ease;
}

.nav-btn.active::before { opacity: 1; }

.nav-btn:active { transform: scale(0.9); }

.nav-btn.center-btn:active { transform: scale(0.92); }

/* ===== ENHANCED APP HEADER ===== */
.app-header {
  background: rgba(15, 17, 23, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.06);
}

/* ===== ENHANCED CARDS ===== */
.card {
  transition: border-color .15s ease;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.11);
}

/* ===== SCROLL ENHANCEMENT ===== */
.main-content {
  scroll-behavior: smooth;
}

/* ===== ENHANCED SEARCH BAR ===== */
.search-bar:focus-within {
  border-color: rgba(94, 231, 176, 0.3);
  box-shadow: 0 0 0 3px rgba(94, 231, 176, 0.06);
}

/* ===== ENHANCED FORM INPUTS ===== */
.field-group input:focus,
.field-group select:focus {
  border-color: rgba(94, 231, 176, 0.4);
  box-shadow: 0 0 0 3px rgba(94, 231, 176, 0.06);
  background: var(--bg4);
}

/* ===== UPLOAD ZONE ENHANCEMENT ===== */
.upload-zone:hover {
  border-color: rgba(94, 231, 176, 0.4);
  background: rgba(94, 231, 176, 0.04);
  transform: scale(1.01);
  transition: all .2s ease;
}

/* ===== ENHANCED CONTA ITEMS ===== */
.conta-item {
  transition: background .15s, padding-left .15s;
  border-radius: 8px;
  padding-left: 4px;
}

.conta-item:hover {
  background: rgba(255,255,255,0.02);
  padding-left: 8px;
}

/* ===== PAGE TRANSITION ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page.active {
  animation: fadeIn .2s cubic-bezier(0.4, 0, 0.2, 1) both;
}
