:root {
  --navy: #0d2d52;
  --navy-light: #1a4c8c;
  --navy-dark: #081d38;
  --orange: #f5841f;
  --orange-light: #ffb14d;
  --bg: #f3f5f9;
  --card: #ffffff;
  --text: #1c2733;
  --text-muted: #6b7684;
  --border: #e4e8ee;
  --green: #1aa260;
  --red: #e14b4b;
  --yellow: #d9a441;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(13, 45, 82, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  height: 100%;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding-bottom: 76px;
}

a { color: inherit; text-decoration: none; }

.topbar {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #fff;
  padding: 18px 20px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar img { width: 38px; height: 38px; border-radius: 10px; background: #fff; }
.topbar h1 { font-size: 17px; margin: 0; font-weight: 700; }
.topbar p { margin: 0; font-size: 12px; opacity: 0.8; }

.screen { padding: 18px; flex: 1; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.card h2, .card h3 { margin-top: 0; }

h2.section-title { font-size: 18px; color: var(--navy); margin: 4px 0 14px; }

.balance-hero {
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-light) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: 0 6px 18px rgba(245, 132, 31, 0.3);
}
.balance-hero .label { font-size: 12px; text-transform: uppercase; opacity: 0.85; letter-spacing: 0.03em; }
.balance-hero .value { font-size: 34px; font-weight: 800; margin: 2px 0 10px; }
.balance-hero .meta { font-size: 12px; opacity: 0.9; display: flex; justify-content: space-between; }

.input, select.input, textarea.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  font-size: 15px;
  background: #fff;
  color: var(--text);
  margin-bottom: 12px;
  font-family: inherit;
}
.input:focus, select.input:focus, textarea.input:focus { outline: none; border-color: var(--navy-light); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 16px;
  border-radius: 10px;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: #e07716; }
.btn-secondary { background: var(--navy); color: #fff; }
.btn-outline { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 8px 12px; font-size: 13px; width: auto; }

.message {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  margin: 10px 0;
}
.message.success { background: #e3f7ec; color: var(--green); }
.message.error { background: #fdebeb; color: var(--red); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge-green { background: #e3f7ec; color: var(--green); }
.badge-yellow { background: #fbf1dc; color: var(--yellow); }
.badge-red { background: #fdebeb; color: var(--red); }
.badge-gray { background: #eef0f3; color: var(--text-muted); }

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item .title { font-weight: 600; font-size: 14px; }
.list-item .subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  z-index: 50;
}
.tabbar button {
  flex: 1;
  background: none;
  border: none;
  padding: 10px 2px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  color: var(--text-muted);
  cursor: pointer;
}
.tabbar button.active { color: var(--orange); }
.tabbar button .icon { font-size: 19px; }

.empty-state { text-align: center; padding: 40px 10px; color: var(--text-muted); }
.empty-state .icon { font-size: 40px; margin-bottom: 10px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(13,29,56,0.55);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.modal-content {
  background: #fff; border-radius: 18px; padding: 24px; max-width: 420px; width: 100%;
  max-height: 85vh; overflow-y: auto; position: relative;
}
.modal-content h3 { margin-top: 0; color: var(--navy); }
.modal-close {
  position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border-radius: 50%;
  border: none; background: var(--bg); color: var(--text); font-size: 16px; cursor: pointer;
}

.center-screen {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 30px 24px; text-align: center; max-width: 480px; margin: 0 auto;
}
.center-screen img.logo { width: 92px; height: 92px; border-radius: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.center-screen h1 { color: var(--navy); font-size: 22px; margin: 0 0 4px; }
.center-screen p.sub { color: var(--text-muted); font-size: 13px; margin: 0 0 24px; }
.center-screen form { width: 100%; }

.spinner {
  width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,0.4); border-top-color: #fff;
  border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.muted { color: var(--text-muted); font-size: 13px; }
.hidden { display: none !important; }

.progress-bar { height: 8px; border-radius: 99px; background: var(--border); overflow: hidden; margin: 6px 0; }
.progress-bar .fill { height: 100%; background: var(--orange); border-radius: 99px; }
