:root {
  --bg: #F7F5F0;
  --card: #FFFFFF;
  --border: #E6E2D6;
  --text: #1B1B18;
  --text-2: #6B675C;
  --accent: #2F6F5E;
  --accent-tint: #E4EEEA;
  --expense: #C1443C;
  --expense-tint: #F7E4E1;
  --warn: #C97A3D;
  --warn-tint: #F6E9DC;
  --blue: #3E6B8A;
  --blue-tint: #E4EDF2;
  --purple: #7D5BA6;
  --purple-tint: #EFE7F5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, .serif { font-family: 'Fraunces', serif; font-weight: 600; }

#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}
.login-card h1 { font-size: 24px; margin: 0 0 20px; }
.erro { color: var(--expense); font-size: 13px; margin-top: 12px; }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

.app-header {
  padding: 20px 20px 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.app-title { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 600; }

#view { flex: 1; padding: 4px 20px 100px; overflow-y: auto; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 480px; margin: 0 auto;
  height: 68px; background: var(--card); border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
}
.nav-item {
  background: none; border: none; font-family: inherit; font-size: 11px;
  color: var(--text-2); cursor: pointer; padding: 8px 4px;
}
.nav-item.active { color: var(--accent); font-weight: 700; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px; margin-bottom: 12px;
}
.card-lg { border-radius: 20px; padding: 20px; }

.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.muted { color: var(--text-2); font-size: 12.5px; }
.big { font-family: 'Fraunces', serif; font-size: 28px; font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; border-radius: 14px; border: none; cursor: pointer;
  font-family: inherit; font-size: 14px; font-weight: 700; width: 100%;
  background: var(--accent); color: #fff;
}
.btn-outline { background: #fff; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-ghost-sm {
  background: none; border: 1px solid var(--border); border-radius: 10px;
  padding: 6px 12px; font-size: 12px; color: var(--text); cursor: pointer;
}
.btn-sm { height: 38px; font-size: 13px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; height: 46px; border-radius: 12px; border: 1px solid var(--border);
  background: #fff; padding: 0 14px; font-size: 14px; font-family: inherit; color: var(--text);
}
.field textarea { width: 100%; border-radius: 12px; border: 1px solid var(--border); padding: 10px 14px; font-family: inherit; }

.chip {
  display: inline-flex; padding: 6px 12px; border-radius: 20px; font-size: 12.5px;
  border: 1px solid var(--border); background: #fff; margin-right: 6px;
}
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.bar-bg { height: 7px; border-radius: 4px; background: #EDEAE2; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); }

.list-item {
  display: flex; align-items: center; gap: 12px; background: #fff;
  border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px;
}
.icon-badge {
  width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; font-size: 16px; background: var(--accent-tint);
}

.pos { color: var(--accent); font-weight: 700; }
.neg { color: var(--expense); font-weight: 700; }

.fab {
  position: fixed; right: max(20px, calc(50% - 220px)); bottom: 88px;
  width: 52px; height: 52px; border-radius: 16px; background: var(--accent);
  color: #fff; border: none; font-size: 24px; cursor: pointer;
  box-shadow: 0 6px 16px rgba(47,111,94,.35);
}

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(27,27,24,.4);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
.modal {
  background: var(--bg); width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 20px;
}

.spinner { text-align: center; padding: 40px 0; color: var(--text-2); font-size: 13px; }

table.simple { width: 100%; border-collapse: collapse; font-size: 13px; }
table.simple td, table.simple th { padding: 8px 4px; border-bottom: 1px solid var(--border); text-align: left; }
