/* ပိုက်ဆံမှတ်တမ်း — mobile-first, clean modern theme */
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1a2233;
  --muted: #6b7689;
  --green: #16a34a;
  --green-bg: #e7f7ee;
  --red: #dc2626;
  --red-bg: #fdeaea;
  --blue: #2563eb;
  --blue-bg: #e8effe;
  --accent: #7c3aed;
  --accent-bg: #f1eafd;
  --line: #e5e9f2;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(20, 30, 60, 0.06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  font-family: "Pyidaungsu", "Myanmar Text", "Noto Sans Myanmar", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: 120px;
}
.hidden { display: none !important; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #6d28d9, #4f46e5);
  color: #fff;
  box-shadow: 0 2px 8px rgba(80, 40, 180, 0.25);
}
.brand { font-size: 1.15rem; font-weight: 700; }
.lang-toggle {
  background: rgba(255,255,255,0.2); color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 20px; padding: 5px 14px;
  font-size: 0.85rem; font-weight: 700; cursor: pointer;
}

main { max-width: 640px; margin: 0 auto; padding: 14px 14px 0; }
.view h2 { margin: 6px 0 12px; font-size: 1.2rem; }
.sub-head { margin: 18px 0 8px; font-size: 1rem; color: var(--muted); }

.month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.month-label { font-size: 1.1rem; font-weight: 700; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card);
  font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--ink);
}

.stat-cards { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.stat-card {
  background: var(--card); border-radius: var(--radius);
  padding: 12px 10px; box-shadow: var(--shadow);
  border-top: 4px solid var(--line); text-align: center;
}
.stat-card.income { border-top-color: var(--green); }
.stat-card.expense { border-top-color: var(--red); }
.stat-card.balance { border-top-color: var(--blue); }
.stat-title { font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.stat-value { font-size: 1rem; font-weight: 700; word-break: break-word; }
.stat-card.income .stat-value { color: var(--green); }
.stat-card.expense .stat-value { color: var(--red); }
.stat-card.balance .stat-value { color: var(--blue); }

.section-head { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 8px; }
.section-head h2 { margin: 0; font-size: 1.05rem; }
.link-btn { background: none; border: none; color: var(--blue); font-size: 0.9rem; cursor: pointer; }

.tx-list { display: flex; flex-direction: column; gap: 8px; }
.tx-day { margin-top: 10px; }
.tx-day-label { font-size: 0.85rem; color: var(--muted); font-weight: 700; margin: 0 0 6px 2px; }
.tx-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: var(--radius);
  padding: 10px 12px; box-shadow: var(--shadow);
}
.tx-emoji { font-size: 1.5rem; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  background: var(--bg); border-radius: 10px; flex-shrink: 0; }
.tx-info { flex: 1; min-width: 0; }
.tx-cat { font-weight: 600; font-size: 0.95rem; }
.tx-note { font-size: 0.8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-amt { font-weight: 700; font-size: 0.95rem; white-space: nowrap; }
.tx-amt.expense { color: var(--red); }
.tx-amt.income { color: var(--green); }
.tx-actions { display: flex; gap: 4px; }
.mini-btn { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 0.9rem; cursor: pointer; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-emoji { font-size: 3rem; margin-bottom: 8px; }
.empty p { line-height: 1.7; margin: 0; }

/* Add form */
.type-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.type-btn {
  padding: 12px; border-radius: var(--radius); font-size: 1rem; font-weight: 700;
  border: 2px solid var(--line); background: var(--card); cursor: pointer; color: var(--ink);
}
.type-btn.active[data-t="expense"] { border-color: var(--red); background: var(--red-bg); color: var(--red); }
.type-btn.active[data-t="income"] { border-color: var(--green); background: var(--green-bg); color: var(--green); }

.field-label { display: block; font-size: 0.85rem; font-weight: 700; color: var(--muted); margin: 12px 0 6px; }
.amount-input {
  width: 100%; font-size: 1.8rem; font-weight: 700; text-align: center;
  padding: 14px; border-radius: var(--radius); border: 2px solid var(--line);
  background: var(--card); color: var(--ink);
}
.amount-input:focus { outline: none; border-color: var(--accent); }
.text-input {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1.5px solid var(--line); background: var(--card);
  font-size: 1rem; color: var(--ink); font-family: inherit;
}
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cat-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 6px; border-radius: 12px; border: 2px solid var(--line);
  background: var(--card); cursor: pointer; font-size: 0.8rem; color: var(--ink); font-family: inherit;
}
.cat-btn .ce { font-size: 1.6rem; }
.cat-btn.selected { border-color: var(--accent); background: var(--accent-bg); font-weight: 700; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-error { color: var(--red); background: var(--red-bg); border-radius: 10px; padding: 10px; margin-top: 12px; font-size: 0.9rem; }
.primary-btn {
  width: 100%; margin-top: 18px; padding: 15px;
  background: linear-gradient(135deg, #6d28d9, #4f46e5); color: #fff;
  border: none; border-radius: var(--radius); font-size: 1.1rem; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.primary-btn:active { transform: scale(0.98); }
.ghost-btn {
  width: 100%; margin-top: 8px; padding: 12px;
  background: transparent; color: var(--muted);
  border: 1.5px solid var(--line); border-radius: var(--radius);
  font-size: 1rem; cursor: pointer; font-family: inherit;
}

/* History filters */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.filters input[type="month"] { grid-column: span 2; }

/* Charts */
.chart-card { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); overflow-x: auto; }
.chart-card svg { display: block; margin: 0 auto; max-width: 100%; }
.chart-legend { display: flex; gap: 16px; justify-content: center; margin-top: 8px; font-size: 0.85rem; }
.legend-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: baseline; }
.cat-totals { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.cat-total-row { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 10px; padding: 8px 12px; box-shadow: var(--shadow); }
.cat-total-row .tx-emoji { font-size: 1.2rem; width: 34px; height: 34px; }
.cat-bar { flex: 1; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.cat-bar > div { height: 100%; border-radius: 4px; }

/* FAB + bottom nav */
.fab {
  position: fixed; right: 18px; bottom: 86px; z-index: 20;
  width: 60px; height: 60px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, #6d28d9, #4f46e5); color: #fff;
  font-size: 2rem; line-height: 1; cursor: pointer;
  box-shadow: 0 4px 16px rgba(109, 40, 217, 0.4);
}
.fab:active { transform: scale(0.94); }
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; font-size: 1.3rem; cursor: pointer;
  color: var(--muted); font-family: inherit; padding: 4px;
}
.nav-btn span { font-size: 0.7rem; }
.nav-btn.active { color: var(--accent); font-weight: 700; }

@media (min-width: 700px) {
  .stat-value { font-size: 1.15rem; }
}
