/* Colors come from the God First, Money Wise logo: cross red and halo gold on warm paper. */
:root {
  color-scheme: light;
  /* Calm, welcoming palette: warm cream and soft sage, with the logo's red and gold as gentle accents. */
  --bg: #faf6f0;
  --card: #ffffff;
  --text: #3b322f;
  --muted: #726863;
  --line: #ece4da;
  --brand: #9a4a52;
  --brand-ink: #ffffff;
  --brand-soft: #f6e9e7;
  --gold: #c9a35a;
  --gold-soft: #f5eddd;
  --sage: #7f9c88;
  --sage-soft: #e9f0ea;
  --plus: #4e7359;
  --minus: #b0646a;
  --danger: #a5474f;
  --danger-soft: #f8e8e7;
  --shadow: 0 2px 10px rgba(80, 60, 40, .06);
}
/* Dark colors: used when the device is in dark mode, unless someone picked light with the toggle,
   or whenever someone picked dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1f1b19;
    --card: #2a2421;
    --text: #f1e9e2;
    --muted: #b0a59d;
    --line: #3a322e;
    --brand: #d4868c;
    --brand-ink: #24191a;
    --brand-soft: #3a2a2a;
    --gold: #d8b878;
    --gold-soft: #3a3226;
    --sage: #9cbaa5;
    --sage-soft: #2a352e;
    --plus: #93c1a0;
    --minus: #e0959a;
    --danger: #e0959a;
    --danger-soft: #3a2a2a;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1f1b19;
  --card: #2a2421;
  --text: #f1e9e2;
  --muted: #b0a59d;
  --line: #3a322e;
  --brand: #d4868c;
  --brand-ink: #24191a;
  --brand-soft: #3a2a2a;
  --gold: #d8b878;
  --gold-soft: #3a3226;
  --sage: #9cbaa5;
  --sage-soft: #2a352e;
  --plus: #93c1a0;
  --minus: #e0959a;
  --danger: #e0959a;
  --danger-soft: #3a2a2a;
  --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 'Instrument Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom));
}

h1, h2, .serif, .balance { font-family: 'Fraunces', Georgia, serif; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 24px; margin: 0; line-height: 1.15; }
h2 { font-size: 20px; margin: 0 0 12px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.topbar .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar .who img { width: 40px; height: auto; flex: none; }
.top-actions { display: flex; align-items: center; gap: 18px; flex: none; }
.topbar a, .link { color: var(--brand); text-decoration: none; font-weight: 600; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; white-space: nowrap; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
a.card { display: block; color: inherit; text-decoration: none; }
a.card:active { transform: scale(.99); }

.hero { text-align: center; padding: 28px 18px; }
.hero .label { color: var(--muted); font-size: 15px; }
.balance { font-size: 52px; line-height: 1.05; margin: 6px 0 10px; font-variant-numeric: tabular-nums; }
.balance.sm { font-size: 28px; margin: 0; }
.pill { display: inline-block; background: var(--sage-soft); color: var(--plus); border-radius: 999px; padding: 4px 12px; font-size: 14px; }

/* The child's screen is a passbook page, as in the prototype. */
.passbook { background: linear-gradient(180deg, var(--card), var(--gold-soft)); border-radius: 28px; }

.kid-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--sage-soft); color: var(--plus);
  display: grid; place-items: center; font-family: 'Fraunces', Georgia, serif; font-weight: 700; font-size: 19px; flex: none;
}
.kid-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.kid-name b { font-family: 'Fraunces', Georgia, serif; font-size: 19px; font-weight: 600; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--bg); border-radius: 14px; padding: 12px; }
.stat b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }

form { display: grid; gap: 12px; }
.rate-row { display: grid; grid-template-columns: 1fr 9.5em; gap: 8px; }
label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
input, select {
  width: 100%; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-size: 16px;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; border: 0; border-radius: 14px;
  padding: 13px 16px; cursor: pointer; background: var(--brand); color: var(--brand-ink);
  width: 100%;
}
.btn.secondary { background: var(--card); color: var(--brand); border: 1px dashed var(--line); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn:disabled { opacity: .6; cursor: default; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px; margin-bottom: 16px; }
.tabs button { font: inherit; font-weight: 500; border: 0; background: none; padding: 9px; border-radius: 999px; color: var(--text); cursor: pointer; }
.tabs button.on { background: var(--card); color: var(--brand); box-shadow: var(--shadow); font-weight: 600; }

.error { background: var(--danger-soft); color: var(--danger); border-radius: 10px; padding: 10px 14px; font-size: 14px; font-weight: 600; }
.notice { background: var(--gold-soft); color: var(--text); border-radius: 10px; padding: 10px 14px; font-size: 14px; font-weight: 600; }

.tx { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px dashed var(--line); }
.tx:first-of-type { border-top: 0; }
.tx-icon { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 17px; flex: none; background: var(--bg); }
.tx-main { flex: 1; min-width: 0; }
.tx-main div:first-child { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-amt { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.tx-amt.plus { color: var(--plus); }
.tx-amt.minus { color: var(--minus); }

.spark { width: 100%; height: 90px; display: block; margin-top: 14px; }
.spark polyline { fill: none; stroke: var(--sage); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.spark polygon { fill: var(--sage-soft); }

.center { text-align: center; }
.stack > * + * { margin-top: 10px; }
.brand { text-align: center; margin: 8px 0 18px; }
.brand img { width: 220px; max-width: 70%; height: auto; }
.brand p { margin-top: 4px; }
.foot { color: var(--muted); font-size: 14px; text-align: center; margin: 4px 0 0; }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }

/* Sign-up introduction */
.intro { margin-bottom: 4px; }
.intro h2 { font-size: 20px; margin: 4px 0 6px; }
.intro ul { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 12px; }
.intro li { display: flex; gap: 12px; align-items: flex-start; }
.intro-icon { width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--sage-soft); display: grid; place-items: center; font-size: 17px; }
.intro-note { background: var(--gold-soft); border-radius: 12px; padding: 12px 14px; margin: 0; }
.intro-form-title { padding-top: 16px; margin-top: 16px !important; border-top: 1px solid var(--line); }
.intro-note a { color: var(--brand); font-weight: 600; }
.agree a, .foot a { color: var(--brand); }

/* Light/dark toggle */
.theme-toggle { width: 38px; height: 38px; flex: none; display: inline-grid; place-items: center; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; }
.theme-toggle:hover { color: var(--brand); }
.theme-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Way back to the website */
.home-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.home-row a, .page-links a { color: var(--brand); font-weight: 600; text-decoration: none; }
.page-links { text-align: center; color: var(--muted); font-size: 14px; margin: 22px 0 0; }
.topbar .who a.home { display: flex; flex: none; border-radius: 50%; }

/* Switch between children on a child's page */
.kid-switch { display: flex; gap: 8px; overflow-x: auto; margin: -6px -16px 16px; padding: 2px 16px 6px; scrollbar-width: none; }
.kid-switch::-webkit-scrollbar { display: none; }
.kid-switch a { display: flex; align-items: center; gap: 8px; flex: none; padding: 6px 14px 6px 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text); text-decoration: none; font-weight: 600; font-size: 15px; }
.kid-switch a.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.kid-switch .avatar { width: 30px; height: 30px; font-size: 14px; }
.kid-switch a.on .avatar { background: var(--brand-ink); color: var(--brand); }
.kid-switch .amt { font-weight: 500; opacity: .8; font-variant-numeric: tabular-nums; }
