:root {
  --purple: #8B1A8C;
  --purple-light: #a020a2;
  --purple-dark: #6a1269;
  --yellow: #F5C200;
  --yellow-light: #fff3cc;
  --green: #2e7d32;
  --green-light: #e8f5e9;
  --red: #c62828;
  --red-light: #ffebee;
  --bg: #f5f5f5;
  --white: #ffffff;
  --text: #222;
  --text-light: #666;
  --border: #e0e0e0;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }

/* LOGIN */
#login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-dark) 100%);
}
.login-box {
  background: var(--white); border-radius: var(--radius); padding: 40px 32px;
  width: 100%; max-width: 360px; text-align: center; box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.login-box h1 { color: var(--purple); font-size: 22px; margin-bottom: 4px; }
.login-box p { color: var(--text-light); font-size: 13px; margin-bottom: 28px; }
.login-box input {
  width: 100%; padding: 12px 16px; border: 2px solid var(--border);
  border-radius: 8px; font-size: 15px; margin-bottom: 12px; outline: none;
  transition: border-color 0.2s;
}
.login-box input:focus { border-color: var(--purple); }
.login-box .error { color: #e53935; font-size: 13px; margin-bottom: 8px; }

/* BOTÕES */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--purple); color: var(--white); }
.btn-primary:hover { background: var(--purple-light); }
.btn-yellow { background: var(--yellow); color: var(--text); }
.btn-yellow:hover { background: #e6b800; }
.btn-ghost { background: transparent; color: var(--text-light); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }
.btn-danger:hover { background: #ffcdd2; }
.btn-full { width: 100%; justify-content: center; padding: 13px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 6px; }

/* APP */
#app { display: none; min-height: 100vh; padding-bottom: 72px; }

/* HEADER */
.header {
  background: var(--purple); color: var(--white); padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.header h2 { font-size: 17px; font-weight: 700; }

/* MONTH BAR */
.month-bar {
  background: var(--white); padding: 10px 16px; display: flex; align-items: center;
  justify-content: center; gap: 12px; border-bottom: 1px solid var(--border);
  position: sticky; top: 57px; z-index: 90;
}
.month-bar input[type="month"] {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px;
  font-size: 14px; font-weight: 600; color: var(--purple);
}

/* VIEWS */
.view { display: none; padding: 16px; }
.view.active { display: block; }

/* CARD */
.card {
  background: var(--white); border-radius: var(--radius); padding: 18px;
  margin-bottom: 14px; box-shadow: var(--shadow);
}
.card h3 { font-size: 15px; margin-bottom: 10px; color: var(--purple); }
.card .hint { font-size: 12px; color: var(--text-light); margin-bottom: 10px; }
.card input, .card select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; margin-bottom: 10px;
}

/* MÉTRICAS */
.metric-row { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.metric-box {
  flex: 1; min-width: 140px; background: var(--white); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.metric-box .label { font-size: 12px; color: var(--text-light); margin-bottom: 4px; }
.metric-box .value { font-size: 20px; font-weight: 700; }
.metric-box.positive .value { color: var(--green); }
.metric-box.negative .value { color: var(--red); }
.metric-box.highlight { background: var(--purple); color: var(--white); }
.metric-box.highlight .label { color: #f0d9f0; }
.metric-box.highlight .value { color: var(--white); }

.cat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.cat-row:last-child { border-bottom: none; }
.cat-row .cat-value { font-weight: 700; }

/* LISTAS */
.list-item {
  background: var(--white); border-radius: var(--radius); padding: 14px 16px;
  margin-bottom: 8px; box-shadow: var(--shadow); display: flex;
  justify-content: space-between; align-items: center; cursor: pointer;
}
.list-item:hover { background: #fafafa; }
.list-item .li-main { flex: 1; }
.list-item .li-desc { font-weight: 600; font-size: 14px; }
.list-item .li-sub { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.list-item .li-value { font-weight: 700; font-size: 15px; text-align: right; white-space: nowrap; margin-left: 10px; }
.list-item .li-value.in { color: var(--green); }
.list-item .li-value.out { color: var(--red); }
.empty-state { text-align: center; color: var(--text-light); padding: 40px 20px; font-size: 14px; }

/* PAYMENT METHODS LIST */
.pm-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.pm-row:last-child { border-bottom: none; }
.pm-row .pm-name { font-weight: 600; font-size: 14px; }
.pm-row .pm-fee { font-size: 13px; color: var(--text-light); }
.pm-row .pm-actions { display: flex; gap: 6px; }

/* BOTTOM NAV */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; background: var(--white);
  border-top: 1px solid var(--border); display: flex; z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 10px 4px 8px; border: none; background: none; cursor: pointer;
  color: var(--text-light); font-size: 11px; font-weight: 500; gap: 3px;
}
.nav-item.active { color: var(--purple); }
.nav-item span { display: block; }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--white); border-radius: 16px 16px 0 0; width: 100%; max-width: 480px;
  padding: 20px; max-height: 85vh; overflow-y: auto;
}
.modal h3 { color: var(--purple); margin-bottom: 14px; font-size: 17px; }
.modal label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--text-light); }
.modal input, .modal select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 15px; margin-bottom: 14px;
}
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.modal-actions .btn { flex: 1; }

@media (min-width: 600px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: 16px; }
}
