:root {
  color-scheme: light dark;
  --bg: #fafafa;
  --fg: #1a1a1a;
  --muted: #6b7280;
  --accent: #1a1a1a;
  --accent-fg: #ffffff;
  --border: #e5e7eb;
  --hint-bg: #fef3c7;
  --hint-fg: #78350f;
  --ok-bg: #d1fae5;
  --ok-fg: #065f46;
  --warn-bg: #fee2e2;
  --warn-fg: #991b1b;
  --partial-bg: #fef3c7;
  --partial-fg: #78350f;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f10;
    --fg: #f3f4f6;
    --muted: #9ca3af;
    --accent: #f3f4f6;
    --accent-fg: #0f0f10;
    --border: #27272a;
    --hint-bg: #422006;
    --hint-fg: #fbbf24;
    --ok-bg: #064e3b;
    --ok-fg: #a7f3d0;
    --warn-bg: #7f1d1d;
    --warn-fg: #fecaca;
    --partial-bg: #422006;
    --partial-fg: #fbbf24;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 480px; margin: 0 auto; padding: 32px 20px 64px; }

h1 { font-size: 28px; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.01em; }
h2.section-title { font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 32px 0 12px; }

.subtitle { color: var(--muted); margin: 4px 0 24px; }
p { margin: 12px 0; }
a { color: var(--accent); }
em { font-style: normal; color: var(--muted); }
.muted { color: var(--muted); font-size: 14px; }

.stack { display: flex; flex-direction: column; gap: 12px; margin: 24px 0; }

label { font-size: 14px; font-weight: 600; color: var(--muted); }

input[type="email"],
input[type="text"],
input[type="number"],
textarea {
  font: inherit;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  width: 100%;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button, .btn-primary, .btn-secondary {
  font: inherit; font-weight: 600; min-height: 48px;
  padding: 12px 20px; border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; width: 100%; text-align: center;
}
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-secondary { background: transparent; color: var(--fg); border-color: var(--border); }
.btn-link { display: block; text-decoration: none; }

.hint {
  background: var(--hint-bg); color: var(--hint-fg);
  border-radius: 8px; padding: 12px 14px; font-size: 14px; margin: 16px 0;
}

/* Parent-dashboard callout for pending requests */
.callout {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--accent); color: var(--accent-fg);
  padding: 16px 18px; border-radius: 12px; text-decoration: none;
  margin: 16px 0; min-height: 56px;
}
.callout strong { font-size: 16px; }
.callout span:last-child { opacity: 0.85; font-size: 14px; }

/* Card list (kid links on dashboard) */
.card-list { display: flex; flex-direction: column; gap: 10px; }
.card {
  display: flex; justify-content: space-between; align-items: center;
  background: transparent; border: 1px solid var(--border);
  padding: 14px 16px; border-radius: 12px; text-decoration: none;
  color: var(--fg); min-height: 56px;
}
.card span:first-child { font-weight: 600; }

/* RTA banner on kid view */
.rta {
  display: flex; justify-content: space-between; align-items: baseline;
  background: var(--accent); color: var(--accent-fg);
  padding: 18px 20px; border-radius: 12px; margin: 16px 0 8px;
}
.rta-label { font-size: 14px; opacity: 0.85; }
.rta-amount { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }

/* Envelope cards */
.envelope-card {
  display: flex; justify-content: space-between; align-items: center;
  border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; min-height: 56px;
}
.envelope-name { font-weight: 600; }
.envelope-amount { font-size: 18px; font-variant-numeric: tabular-nums; }

/* History list on kid view */
.history { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 8px; }
.history-item { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.history-row { display: flex; justify-content: space-between; align-items: center; }
.history-reason, .history-note { margin-top: 4px; font-size: 13px; }
.amount { font-variant-numeric: tabular-nums; font-weight: 600; }

.status-pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.status-pending  { background: var(--hint-bg);    color: var(--hint-fg); }
.status-approved { background: var(--ok-bg);      color: var(--ok-fg); }
.status-partial  { background: var(--partial-bg); color: var(--partial-fg); }
.status-declined { background: var(--warn-bg);    color: var(--warn-fg); }
.status-withdrawn{ background: var(--border);     color: var(--muted); }

/* Ask form: envelope radio rows */
.envelope-radio, .decision-radio {
  border: 1px solid var(--border); border-radius: 12px; padding: 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.envelope-radio legend { padding: 0 6px; font-size: 12px; color: var(--muted); }
.radio-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 8px; min-height: 48px; cursor: pointer;
}
.radio-row input[type="radio"] { width: 20px; height: 20px; flex-shrink: 0; }
.radio-row .envelope-name { flex: 1; }

/* Dollar prefix wrap for amount input */
.dollar-wrap { position: relative; }
.dollar-prefix {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none; font-weight: 600;
}
.dollar-wrap input { padding-left: 28px; }

/* Approval queue */
.queue-item {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; margin: 16px 0;
  display: flex; flex-direction: column; gap: 12px;
}
.queue-head { display: flex; justify-content: space-between; align-items: baseline; }
.queue-reason { font-style: italic; color: var(--muted); margin: 0; }
.line-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.line-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center;
}
.line-name { font-weight: 600; }
.line-amount { font-variant-numeric: tabular-nums; color: var(--muted); }
.grant-input {
  width: 100px; min-height: 40px; padding: 8px 10px;
  text-align: right; font-variant-numeric: tabular-nums;
}
