:root {
  --indigo-700: #4338CA;
  --indigo-600: #4F46E5;
  --violet-600: #6D28D9;
  --bg: #F4F5FB;
  --card: #FFFFFF;
  --ink: #1D1E33;
  --ink-soft: #5B5D78;
  --ink-faint: #9698B3;
  --line: #E7E8F3;
  --green: #16A34A;
  --green-soft: #E7F8EE;
  --amber: #D97706;
  --amber-soft: #FDF1DF;
  --red: #DC2626;
  --red-soft: #FCEBEA;
  --gold: #F5B33D;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 24px -12px rgba(41, 34, 94, 0.18);
  --shadow-sm: 0 2px 8px -4px rgba(41, 34, 94, 0.12);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --page-bg: #E7E5F5;
  --badge-blue: #E4EAFE;
  --badge-violet: #F3E8FF;
  --badge-pink: #FEE4EC;
  --badge-teal: #E2F5F8;
  --badge-skyblue: #E0F2FE;
  --badge-gold: #FEF3D6;
  --badge-fb: #E7EEFD;
  --cal-today-bg: #EDEBFB;
}

:root[data-theme="dark"] {
  --indigo-700: #4F46E5;
  --indigo-600: #6366F1;
  --violet-600: #8B5CF6;
  --bg: #15161F;
  --card: #1E2030;
  --ink: #F1F1F8;
  --ink-soft: #B4B6D0;
  --ink-faint: #83849F;
  --line: #2C2E42;
  --green: #34D399;
  --green-soft: rgba(52, 211, 153, 0.16);
  --amber: #FBBF24;
  --amber-soft: rgba(251, 191, 36, 0.16);
  --red: #F87171;
  --red-soft: rgba(248, 113, 113, 0.16);
  --gold: #F5B33D;
  --shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 2px 8px -4px rgba(0, 0, 0, 0.4);
  --page-bg: #0B0C13;
  --badge-blue: rgba(99, 102, 241, 0.18);
  --badge-violet: rgba(139, 92, 246, 0.18);
  --badge-pink: rgba(244, 114, 182, 0.16);
  --badge-teal: rgba(45, 212, 191, 0.16);
  --badge-skyblue: rgba(56, 189, 248, 0.16);
  --badge-gold: rgba(245, 179, 61, 0.18);
  --badge-fb: rgba(99, 102, 241, 0.18);
  --cal-today-bg: rgba(99, 102, 241, 0.16);
}

html, body, .app-shell, .icon-btn, .card, button, input, select, textarea {
  transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}

* { box-sizing: border-box; }

/* The [hidden] attribute must always win over component display rules
   (e.g. .sheet-backdrop{display:flex}, .topbar{display:flex}), otherwise
   elements marked hidden="" still render. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

h1, h2, h3 { font-family: 'Poppins', 'Inter', sans-serif; margin: 0; }

button { font-family: inherit; cursor: pointer; }

.money, .stat-value, .detail-amount, .amount, .cat-amount {
  font-family: 'JetBrains Mono', 'Inter', monospace;
  font-variant-numeric: tabular-nums;
}

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 60px rgba(30, 20, 80, 0.15);
}

/* ===== TOP BAR ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(14px + var(--safe-top)) 14px 14px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-title { flex: 1; text-align: center; font-weight: 700; font-size: 17px; }
.topbar-detail .topbar-title { font-size: 16px; }
.topbar-spacer { width: 36px; }
.icon-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: var(--card);
  border: none;
  border-radius: 12px;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn-bell { position: relative; }
.bell-dot {
  position: absolute; top: 6px; right: 6px;
  min-width: 15px; height: 15px; padding: 0 3px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 9.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--card); font-family: 'Inter', sans-serif;
}

/* ===== SCREEN CONTAINER ===== */
.screen-container {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px calc(96px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}
.screen { display: none; animation: fadeIn .22s ease; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: translateY(0);} }

.screen-title { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.screen-head-row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 16px; gap: 10px; }

/* ===== HOME ===== */
.hello-row { padding: 4px 0 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hello-mascot { width: 52px; height: 52px; object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 6px 10px rgba(41,34,94,0.18)); }
.hello { font-size: 22px; font-weight: 700; }
.wave { display: inline-block; animation: waveAnim 1.6s ease-in-out infinite; transform-origin: 70% 70%; }
@keyframes waveAnim { 0%,100%{transform:rotate(0);} 15%{transform:rotate(14deg);} 30%{transform:rotate(-8deg);} 45%{transform:rotate(14deg);} 60%{transform:rotate(0);} }
.sub { color: var(--ink-soft); font-size: 14px; margin-top: 2px; }

.students-row {
  display: flex; gap: 14px; overflow-x: auto; padding: 2px 2px 14px;
  -webkit-overflow-scrolling: touch;
}
.students-row::-webkit-scrollbar { display: none; }
.student-chip {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: none; flex-shrink: 0; width: 62px;
}
.student-chip-avatar {
  width: 54px; height: 54px; border-radius: 50%; object-fit: cover;
  background: var(--line); border: 2.5px solid transparent; padding: 0;
}
.student-chip.active .student-chip-avatar { border-color: var(--indigo-600); box-shadow: 0 0 0 2px rgba(79,70,229,0.18); }
.student-chip-name {
  font-size: 11px; font-weight: 600; color: var(--ink-soft); max-width: 62px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.student-chip.active .student-chip-name { color: var(--indigo-600); }
.student-chip-add {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--card); border: 2px dashed var(--line);
  display: flex; align-items: center; justify-content: center; color: var(--indigo-600);
}
.student-chip:active .student-chip-avatar,
.student-chip-add:active { transform: scale(0.94); }

.child-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}
.child-avatar-btn { padding: 0; border: none; background: none; border-radius: 50%; flex-shrink: 0; }
.child-avatar-btn:active { transform: scale(0.94); }
.child-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--line); flex-shrink: 0; display: block; }
.child-name { font-weight: 700; font-size: 15px; }
.child-meta { color: var(--ink-soft); font-size: 13px; margin-top: 1px; }
.link-btn { margin-left: auto; background: none; border: none; color: var(--indigo-600); font-weight: 600; font-size: 13px; padding: 6px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 0 10px; }
.section-head h2 { font-size: 15px; font-weight: 700; }
.muted { color: var(--ink-faint); font-size: 12.5px; }

.overview-card {
  background: linear-gradient(160deg, var(--indigo-600), var(--violet-600));
  border-radius: var(--radius-lg);
  padding: 20px 18px 18px;
  color: #fff;
  box-shadow: 0 14px 28px -14px rgba(79,70,229,0.55);
}
.overview-stats { display: flex; justify-content: space-between; margin-bottom: 18px; }
.stat-label { font-size: 11.5px; opacity: 0.78; margin-bottom: 4px; letter-spacing: 0.02em; }
.stat-value { font-size: 16.5px; font-weight: 700; }
.overview-card .stat-value { color: #fff; }
.overview-card .stat-paid { color: #A7F3C4; }
.overview-card .stat-balance { color: #FDD3C6; }

.progress-row { display: flex; align-items: center; gap: 16px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.18); }
.ring {
  --pct: 0;
  width: 66px; height: 66px; border-radius: 50%;
  background: conic-gradient(#4ADE80 calc(var(--pct)*1%), rgba(255,255,255,0.25) 0);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.5s ease;
}
.ring::before {
  content: ''; position: absolute;
}
.ring span {
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--indigo-700);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
  font-family: 'JetBrains Mono', monospace;
}
.progress-caption { font-size: 13px; opacity: 0.9; font-weight: 500; }

.event-list { display: flex; flex-direction: column; gap: 10px; }
.event-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.event-date-chip {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0;
  background: var(--indigo-600); color: #fff;
}
.event-date-chip .mo { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; opacity: 0.85; }
.event-date-chip .dy { font-size: 17px; font-weight: 700; line-height: 1; margin-top: 1px; }
.event-info { flex: 1; min-width: 0; }
.event-title { font-weight: 700; font-size: 14px; }
.event-when { color: var(--ink-soft); font-size: 12.5px; margin-top: 2px; }
.event-loc { color: var(--ink-faint); font-size: 12px; margin-top: 1px; }
.chev-right { color: var(--ink-faint); flex-shrink: 0; }

/* FAB */
.fab {
  position: fixed;
  right: calc(50% - 240px + 20px);
  bottom: calc(94px + var(--safe-bottom));
  width: 54px; height: 54px; border-radius: 50%;
  border: none; padding: 0;
  background: linear-gradient(160deg, var(--indigo-600), var(--violet-600));
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 10px 22px -6px rgba(79,70,229,0.55);
  z-index: 60;
  touch-action: manipulation;
}
@media (max-width: 480px) { .fab { right: 20px; } }
.fab:active { transform: scale(0.94); }
.fab.show { display: flex; }

/* ===== TABS ===== */
.tabs { display: flex; gap: 6px; background: var(--card); padding: 4px; border-radius: 12px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.tab { flex: 1; border: none; background: transparent; padding: 9px 0; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--ink-soft); }
.tab.active { background: var(--indigo-600); color: #fff; }

.pill-btn {
  background: linear-gradient(160deg, var(--indigo-600), var(--violet-600));
  color: #fff; border: none; padding: 9px 16px; border-radius: 999px;
  font-weight: 600; font-size: 13px; box-shadow: 0 6px 14px -6px rgba(79,70,229,0.55);
  white-space: nowrap;
}
.pill-btn:active { transform: scale(0.96); }

.list-label { font-size: 13px; font-weight: 700; color: var(--ink-soft); margin: 4px 0 10px; text-transform: uppercase; letter-spacing: 0.04em; }

/* ===== PAYMENT LIST ===== */
.payment-list { display: flex; flex-direction: column; gap: 10px; }
.payment-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: var(--radius-md);
  padding: 12px 14px; box-shadow: var(--shadow-sm);
}
.payment-icon {
  width: 40px; height: 40px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.pi-tuition { background: var(--green-soft); }
.pi-misc { background: var(--badge-blue); }
.pi-books { background: var(--amber-soft); }
.pi-uniform { background: var(--badge-violet); }
.pi-trip { background: var(--badge-pink); }
.pi-other { background: var(--badge-teal); }
.payment-info { flex: 1; min-width: 0; }
.payment-name { font-weight: 700; font-size: 14px; }
.payment-date { color: var(--ink-faint); font-size: 12px; margin-top: 2px; }
.payment-right { text-align: right; flex-shrink: 0; }
.payment-amount { font-weight: 700; font-size: 14px; }
.status-pill {
  display: inline-block; margin-top: 4px; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
}
.status-paid { background: var(--green-soft); color: var(--green); }
.status-partial { background: var(--badge-blue); color: var(--indigo-600); }
.status-pending { background: var(--amber-soft); color: var(--amber); }
.status-unpaid { background: var(--red-soft); color: var(--red); }

.payment-progress { color: var(--ink-faint); font-size: 11px; margin-top: 2px; }

.empty-state { text-align: center; color: var(--ink-faint); font-size: 13.5px; padding: 40px 20px; }

/* ===== ATTENTION DASHBOARD ===== */
.attention-count {
  background: var(--red); color: #fff; font-size: 11px; font-weight: 800;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
}
.attention-list { display: flex; flex-direction: column; gap: 8px; }
.attention-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: var(--radius-md);
  padding: 11px 14px; box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--line);
}
.attention-card.att-overdue { border-left-color: var(--red); }
.attention-card.att-soon { border-left-color: var(--amber); }
.attention-card.att-event { border-left-color: var(--indigo-600); }
.attention-icon {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.att-overdue .attention-icon { background: var(--red-soft); }
.att-soon .attention-icon { background: var(--amber-soft); }
.att-event .attention-icon { background: var(--badge-blue); }
.attention-info { flex: 1; min-width: 0; }
.attention-title { font-weight: 700; font-size: 13.5px; }
.attention-sub { font-size: 12px; margin-top: 2px; }
.att-overdue .attention-sub { color: var(--red); font-weight: 600; }
.att-soon .attention-sub { color: var(--amber); font-weight: 600; }
.att-event .attention-sub { color: var(--indigo-600); font-weight: 600; }
.attention-child-tag {
  font-size: 10.5px; font-weight: 700; color: var(--ink-faint);
  background: var(--bg); padding: 2px 7px; border-radius: 999px; margin-top: 4px; display: inline-block;
}
.attention-amount { font-weight: 700; font-size: 13px; flex-shrink: 0; }
.attention-empty {
  text-align: center; padding: 22px 16px; background: var(--card);
  border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  color: var(--ink-soft); font-size: 13.5px; font-weight: 600;
}
.attention-list-sheet { max-height: 50vh; overflow-y: auto; margin: 4px 0 16px; }

/* ===== STUDY TRACKER ===== */
.study-overview-card { margin-bottom: 18px; }
.study-overview-card .overview-stats { margin-bottom: 0; }
.study-list { display: flex; flex-direction: column; gap: 10px; }
.study-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: var(--radius-md);
  padding: 12px 14px; box-shadow: var(--shadow-sm);
}
.study-card-done { opacity: 0.6; }
.study-card-done .study-title { text-decoration: line-through; }
.study-check {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--line); background: var(--card);
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.study-check.checked { background: var(--green); border-color: var(--green); }
.study-check svg { opacity: 0; }
.study-check.checked svg { opacity: 1; }
.study-icon {
  width: 40px; height: 40px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.si-homework { background: var(--badge-blue); }
.si-reading { background: var(--amber-soft); }
.si-project { background: var(--badge-violet); }
.si-exam { background: var(--badge-pink); }
.si-session { background: var(--green-soft); }
.study-info { flex: 1; min-width: 0; }
.study-title { font-weight: 700; font-size: 14px; }
.study-when { color: var(--ink-soft); font-size: 12.5px; margin-top: 2px; }
.study-due { color: var(--ink-faint); font-size: 12px; margin-top: 1px; }
.study-overdue { color: var(--red); font-weight: 600; }

/* ===== CALENDAR ===== */
.cal-card { background: var(--card); border-radius: var(--radius-lg); padding: 14px 12px; box-shadow: var(--shadow); margin-bottom: 20px; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; }
.cal-month { font-weight: 700; font-size: 15px; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7,1fr); text-align: center; font-size: 10.5px; color: var(--ink-faint); font-weight: 700; margin-bottom: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); row-gap: 4px; }
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 13px; border-radius: 50%; position: relative; color: var(--ink);
}
.cal-day.other-month { color: var(--ink-faint); opacity: 0.45; }
.cal-day.today { background: var(--cal-today-bg); font-weight: 700; color: var(--indigo-700); }
.cal-day.has-event::after {
  content: ''; position: absolute; bottom: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--indigo-600);
}
.cal-day.selected { background: var(--indigo-600); color: #fff; font-weight: 700; }
.cal-day.selected.has-event::after { background: #fff; }
.cal-day.today.selected { background: var(--indigo-600); color: #fff; }

/* ===== MORE / SETTINGS GROUPS ===== */
.settings-label {
  font-size: 12.5px; font-weight: 700; color: var(--ink-faint); text-transform: uppercase;
  letter-spacing: 0.04em; margin: 20px 4px 8px;
}
.settings-group {
  display: flex; flex-direction: column;
  background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.settings-row {
  display: flex; align-items: center; gap: 12px;
  background: none; border: none; border-bottom: 1px solid var(--line);
  padding: 12px 14px; text-align: left; width: 100%; text-decoration: none;
  transition: background-color .12s ease;
}
.settings-row:last-child { border-bottom: none; }
.settings-row:active { background: var(--bg); }
.settings-icon {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.icon-indigo { background: var(--badge-blue); color: var(--indigo-600); }
.icon-violet { background: var(--badge-violet); color: var(--violet-600); }
.icon-green  { background: var(--green-soft); color: var(--green); }
.icon-amber  { background: var(--amber-soft); color: var(--amber); }
.icon-blue   { background: var(--badge-skyblue); color: #0284C7; }
.icon-red    { background: var(--red-soft); color: var(--red); }
.icon-gold   { background: var(--badge-gold); color: #B7791F; }
.settings-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.settings-title { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.settings-sub { font-size: 12px; color: var(--ink-faint); line-height: 1.4; }
.settings-title-danger { color: var(--red); }
.settings-title-accent { color: var(--amber); }
.chev { margin-left: auto; color: var(--ink-faint); flex-shrink: 0; }
.ext-link { margin-left: auto; color: var(--ink-faint); flex-shrink: 0; }

.settings-row-static { cursor: default; }
.settings-row-static:active { background: none; }

/* ===== TOGGLE SWITCH ===== */
.toggle-switch {
  flex-shrink: 0; width: 46px; height: 27px; border-radius: 999px;
  background: var(--line); border: none; position: relative;
  transition: background-color .18s ease;
  padding: 0;
}
.toggle-switch .toggle-knob {
  position: absolute; top: 3px; left: 3px; width: 21px; height: 21px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform .18s ease;
}
.toggle-switch[aria-checked="true"] { background: var(--indigo-600); }
.toggle-switch[aria-checked="true"] .toggle-knob { transform: translateX(19px); }
.toggle-switch:active .toggle-knob { width: 23px; }
.app-footer-note { text-align: center; color: var(--ink-faint); font-size: 12px; margin-top: 28px; line-height: 1.6; }

/* ===== CREATOR CREDITS ===== */
.app-credit-row {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 8px;
}
.app-credit-note {
  text-align: center; margin: 0; line-height: 1.6;
  font-family: 'Inter', sans-serif; font-size: 12.5px; font-weight: 500;
  color: var(--ink-soft); letter-spacing: 0.01em;
}
.app-credit-note strong {
  font-family: 'Poppins', 'Inter', sans-serif; font-weight: 700; color: var(--ink);
}
.credit-heart { color: var(--red); }
.app-credit-fb {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--badge-fb); color: #1877F2;
  transition: transform .12s ease;
}
.app-credit-fb:active { transform: scale(0.88); }

/* ===== TIP JAR ===== */
.tipjar-hero { text-align: center; padding: 4px 4px 2px; }
.tipjar-icon {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 12px;
  background: var(--amber-soft); display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.tipjar-hero h3 { margin-bottom: 8px; }
.tipjar-hero .sheet-text { margin: 0; }
.tipjar-tier:active { background: var(--bg); }
.tipjar-pill {
  margin-left: auto; flex-shrink: 0;
  background: var(--bg); color: var(--ink); font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px; font-weight: 700; padding: 6px 12px; border-radius: 999px;
}
.tipjar-gcash {
  background: var(--bg); border: 1.5px dashed var(--line); border-radius: var(--radius-md);
  padding: 14px 16px;
}
.tipjar-gcash-label { font-size: 12px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 8px; }
.tipjar-gcash-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tipjar-gcash-number { font-family: 'JetBrains Mono', monospace; font-size: 18px; font-weight: 700; color: var(--ink); letter-spacing: 0.02em; }
.tipjar-copy-btn {
  background: var(--indigo-600); color: #fff; border: none; padding: 8px 16px; border-radius: 999px;
  font-weight: 700; font-size: 12.5px; flex-shrink: 0;
}
.tipjar-copy-btn:active { transform: scale(0.95); }
.tipjar-copy-btn.copied { background: var(--green); }
.tipjar-thanks { text-align: center; color: var(--ink-faint); font-size: 12.5px; margin: -4px 0 0; }

/* ===== DETAIL SCREEN ===== */
.screen-detail { padding-top: 6px; }
.detail-hero { text-align: center; padding: 10px 0 24px; }
.detail-icon {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 14px;
  background: var(--green-soft); display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.detail-title { font-weight: 700; font-size: 18px; }
.detail-sub { color: var(--ink-faint); font-size: 12.5px; margin-top: 4px; }
.detail-amount { font-weight: 800; font-size: 32px; margin-top: 14px; }
.detail-fields { background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; margin-top: 6px; }
.detail-field { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.detail-field:last-child { border-bottom: none; }
.detail-field span { color: var(--ink-soft); }
.detail-actions { display: flex; gap: 10px; margin-top: 20px; }
.btn-text-danger { display: block; width: 100%; text-align: center; background: none; border: none; color: var(--red); font-weight: 600; font-size: 14px; padding: 16px 0 4px; }

.detail-history { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 4px 16px; }
.history-title { font-size: 11.5px; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 0 6px; }
.history-row { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; gap: 10px; }
.history-row:first-of-type { border-top: none; }
.history-amt { font-weight: 700; color: var(--green); flex-shrink: 0; }
.history-meta { color: var(--ink-faint); font-size: 11.5px; }
.pay-cta { margin-top: 2px; }

/* ===== FORMS ===== */
.form { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; padding-bottom: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  font-family: 'Inter', sans-serif;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 13px; font-size: 14.5px; color: var(--ink); background: var(--card);
  outline: none; font-weight: 500;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--indigo-600); box-shadow: 0 0 0 3px rgba(79,70,229,0.14); }
.field textarea { resize: vertical; }

.btn-primary {
  background: linear-gradient(160deg, var(--indigo-600), var(--violet-600));
  color: #fff; border: none; padding: 14px; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 14.5px; box-shadow: 0 8px 18px -8px rgba(79,70,229,0.55);
}
.btn-primary:active { transform: scale(0.98); }
.btn-outline {
  background: var(--card); color: var(--ink); border: 1.5px solid var(--line);
  padding: 14px; border-radius: var(--radius-sm); font-weight: 700; font-size: 14.5px;
}
.btn-danger { background: var(--red); color: #fff; border: none; padding: 14px; border-radius: var(--radius-sm); font-weight: 700; font-size: 14.5px; }
.btn-block { width: 100%; }
.detail-actions .btn-outline, .detail-actions .btn-primary { flex: 1; }
.sheet .detail-hero { padding-top: 2px; }
.sheet .detail-fields { background: var(--bg); box-shadow: none; border: 1px solid var(--line); }

/* ===== SUMMARY ===== */
.year-select {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--line);
  background: var(--card); font-weight: 600; font-size: 14px; margin-bottom: 16px; color: var(--ink);
}
.progress-card { background: var(--card); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm); display: flex; align-items: center; gap: 20px; }
.progress-card .ring { --pct: 0; width: 84px; height: 84px; background: conic-gradient(var(--green) calc(var(--pct)*1%), var(--red-soft) 0); }
.progress-card .ring span { width: 62px; height: 62px; background: var(--card); color: var(--ink); font-size: 15px; }
.progress-legend { flex: 1; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.legend-row { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); justify-content: space-between; }
.legend-row strong { color: var(--ink); font-weight: 700; margin-left: auto; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot-paid { background: var(--green); }
.dot-unpaid { background: var(--red); }

.category-breakdown { background: var(--card); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 16px; }
.cat-row .cat-top { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.cat-row .cat-amount { color: var(--ink-soft); font-weight: 600; }
.cat-bar-track { height: 7px; border-radius: 999px; background: var(--line); overflow: hidden; }
.cat-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--indigo-600), var(--violet-600)); }
.cat-pct { font-size: 11.5px; color: var(--ink-faint); margin-top: 4px; }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: 480px;
  display: flex; justify-content: space-around;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 8px 6px calc(8px + var(--safe-bottom));
  z-index: 40;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; color: var(--ink-faint);
  font-size: 10.5px; font-weight: 600; padding: 4px 10px; border-radius: 10px;
}
.nav-item.active { color: var(--indigo-600); }
.nav-item:active { transform: scale(0.95); }

/* ===== SHEETS ===== */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(20,15,50,0.45);
  display: flex; align-items: flex-end; justify-content: center; z-index: 100;
}
.sheet {
  width: 100%; max-width: 480px; background: var(--card);
  border-radius: 22px 22px 0 0; padding: 10px 20px calc(24px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 14px;
  animation: sheetUp .22s ease;
}
@keyframes sheetUp { from { transform: translateY(30px); opacity: 0.4; } to { transform: translateY(0); opacity: 1; } }
.sheet-handle { width: 36px; height: 4px; border-radius: 999px; background: var(--line); margin: 6px auto 2px; }
.sheet h3 { font-size: 17px; }
.sheet-text { color: var(--ink-soft); font-size: 13.5px; margin: -6px 0 0; }
.sheet-actions { display: flex; gap: 10px; margin-top: 4px; }

/* ===== QUICK-ADD SHEET ===== */
.quick-add-list { display: flex; flex-direction: column; gap: 10px; }
.quick-add-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); border: 1.5px solid var(--line); border-radius: var(--radius-md);
  padding: 12px 14px; text-align: left;
}
.quick-add-item:active { transform: scale(0.98); background: var(--line); }
.quick-add-icon {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.qa-payment { background: var(--green-soft); }
.qa-event { background: var(--badge-blue); }
.qa-study { background: var(--badge-violet); }
.quick-add-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.quick-add-text strong { font-size: 14px; font-weight: 700; }
.quick-add-text small { font-size: 12px; color: var(--ink-soft); font-weight: 500; }

/* ===== TOAST ===== */
.toast {
  position: fixed; left: 50%; top: calc(14px + var(--safe-top)); transform: translateX(-50%) translateY(-140%);
  background: #1D1E33; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 600; z-index: 200; transition: transform .25s ease; box-shadow: var(--shadow);
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* Desktop framing */
@media (min-width: 481px) {
  body { display: flex; justify-content: center; padding: 24px 0; background: var(--page-bg); min-height: 100vh; }
  .app-shell { border-radius: 28px; min-height: 90vh; overflow: hidden; }
  .bottom-nav { border-radius: 0 0 28px 28px; }
  .onboarding { border-radius: 28px; max-width: 480px; left: 50%; transform: translateX(-50%); min-height: 90vh; top: 5vh; bottom: 5vh; }
}

/* ===== ONBOARDING / GET STARTED ===== */
.onboarding {
  position: fixed; inset: 0; z-index: 500;
  background: linear-gradient(180deg, var(--cal-today-bg) 0%, var(--bg) 40%);
  overflow-y: auto;
  padding: calc(48px + var(--safe-top)) 24px calc(40px + var(--safe-bottom));
}
.onboarding-inner { max-width: 380px; margin: 0 auto; text-align: center; }
.ob-logo {
  width: 84px; height: 84px; border-radius: 24px; margin: 0 auto 18px;
  background: linear-gradient(160deg, var(--indigo-600), var(--violet-600));
  display: flex; align-items: center; justify-content: center; font-size: 30px;
  box-shadow: 0 14px 28px -14px rgba(79,70,229,0.55);
  overflow: hidden;
}
.ob-logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.ob-brand { font-family: 'Poppins', sans-serif; font-size: 15px; font-weight: 800; color: var(--indigo-600); letter-spacing: 0.02em; margin-bottom: 4px; }
.ob-title { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.ob-sub { color: var(--ink-soft); font-size: 13.5px; margin: 8px 0 26px; line-height: 1.5; }

.ob-avatar-btn {
  position: relative;
  width: 92px; height: 92px; border-radius: 50%;
  background: var(--card); border: 2px dashed var(--line);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto; padding: 0; overflow: visible;
  box-shadow: var(--shadow-sm);
}
.ob-avatar-btn:active { transform: scale(0.97); }
.ob-avatar-placeholder { color: var(--ink-faint); display: flex; }
.ob-avatar-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.ob-avatar-badge {
  position: absolute; right: -2px; bottom: -2px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--indigo-600); border: 2.5px solid var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.ob-avatar-label { color: var(--indigo-600); font-size: 12.5px; font-weight: 600; margin: 10px 0 26px; }
.ob-form { text-align: left; gap: 14px; }
.ob-submit { margin-top: 8px; }

.ob-avatar-btn-sm { width: 64px; height: 64px; flex-shrink: 0; }
.sheet-avatar-row { display: flex; align-items: center; gap: 14px; margin-bottom: 2px; }
.sheet-avatar-hint { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
