:root {
  --navy: #0a1f44;
  --black: #0b0b0b;
  --bg: #f4f4f5;
  --card: #ffffff;
  --border: #d8d9dc;
  --text: #0b0b0b;
  --text-secondary: #55575c;
  --text-muted: #8a8c90;
  --danger: #a32d2d;
  --success: #1f6b3a;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.wrap { max-width: 480px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.hidden { display: none !important; }

.loginCard {
  background: var(--navy);
  border-radius: 14px;
  padding: 2rem 1.5rem;
  margin-top: 3rem;
  text-align: center;
}
.loginTitle { color: #fff; font-size: 20px; font-weight: 600; margin: 0 0 6px; }
.loginSub { color: #c3cbdc; font-size: 14px; margin: 0 0 1.25rem; }
.loginCard input {
  width: 100%; border: 1px solid #23345f; background: #fff;
  border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; font-size: 15px;
}

header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
h1 { font-size: 20px; font-weight: 600; margin: 0; color: var(--black); }
.headBtns { display: flex; gap: 8px; }

.btn {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 14px; font-size: 14px; cursor: pointer; color: var(--text);
}
.btn:active { transform: scale(0.98); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.wide { width: 100%; margin-top: 4px; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text-secondary); }
.btn.danger { border-color: var(--danger); color: var(--danger); }

.err { font-size: 13px; color: #ffb4b4; margin: 8px 0 0; }

.tabs {
  display: flex;
  background: var(--navy);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 1.25rem;
  gap: 4px;
}
.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: #9fb0cc;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.tab-btn.active { background: rgba(255,255,255,0.15); color: #ffffff; }
.tabPanel.hidden { display: none; }

.hero {
  border-radius: 14px;
  padding: 1.5rem 1.25rem;
  margin-bottom: 1.25rem;
  text-align: center;
}
.hero.positive { background: #E6F4EA; }
.hero.negative { background: #FBE4E4; }
.heroLabel { font-size: 14px; font-weight: 500; margin: 0 0 4px; }
.hero.positive .heroLabel { color: #175C2E; }
.hero.negative .heroLabel { color: #7A2020; }
.heroAmount { font-size: 34px; font-weight: 600; margin: 0; }
.hero.positive .heroAmount { color: var(--success); }
.hero.negative .heroAmount { color: var(--danger); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 1.25rem; }
.metric { background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--navy); border-radius: 12px; padding: 1rem; }
.label { font-size: 13px; color: var(--text-secondary); margin: 0 0 4px; }
.value { font-size: 24px; font-weight: 600; margin: 0; color: var(--black); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.cardHead { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.cardTitle { font-weight: 600; margin: 0; color: var(--black); }
.cardDesc { font-size: 12.5px; color: var(--text-muted); margin: 4px 0 10px; line-height: 1.4; }
.cardHint { font-size: 15px; font-weight: 500; color: var(--text-secondary); }

.fieldRow { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; }
.fieldRow label { font-size: 14px; color: var(--text-secondary); }
.fieldRow input { width: 110px; text-align: right; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px; }

.reserveHead { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.reserveHead span:first-child { color: var(--text-secondary); }
.reserveHead span:last-child { font-weight: 600; }
.barTrack { background: var(--bg); border-radius: 6px; height: 10px; overflow: hidden; }
.barFill { height: 100%; width: 0%; background: var(--navy); transition: width 0.3s ease; }

.rowLine { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; font-size: 14px; gap: 8px; }
.rowLine + .rowLine { border-top: 1px solid var(--border); }
.rowLine .rowMain { display: flex; flex-direction: column; min-width: 0; }
.rowLine .rowSub { font-size: 12px; color: var(--text-muted); }
.rowLine .amt { font-weight: 600; white-space: nowrap; }
.rowLine .amt.income { color: var(--success); }
.rowLine .amt.expense { color: var(--danger); }
.rowLine .delBtn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 16px; padding: 0 2px; line-height: 1;
}
.rowLine .editText, .rowLine .editNum, .rowLine .editSel, .rowLine .editDate {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 5px 6px; font-size: 13px;
}
.rowLine .editText { flex: 1; min-width: 70px; }
.rowLine .editNum { width: 70px; }
.rowLine .editDate { width: 130px; }

.addRow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.addRow input, .addRow select {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px; font-size: 13px;
}
.addRow input[type="text"] { flex: 1; min-width: 90px; }
.addRow input[type="number"] { width: 80px; }
.addRow input[type="date"] { width: 130px; }

.editFoot { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
.updated { font-size: 12px; color: var(--text-muted); margin-top: 1rem; }
