@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=Manrope:wght@500;600;700;800&display=swap");

:root {
  color-scheme: light;
  --ink: #2c3347;
  --navy: #101a35;
  --muted: #687086;
  --line: #e3e7ef;
  --surface: #fff;
  --canvas: #f6f8fb;
  --purple: #5b36c9;
  --purple-dark: #482ab1;
  --teal: #168d8d;
  --shadow: 0 12px 34px rgba(20, 29, 52, 0.06);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

button, select { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
[hidden] { display: none !important; }
h1, h2 { color: var(--navy); font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }

.skip-link {
  position: absolute;
  z-index: 20;
  top: -60px;
  left: 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
}
.skip-link:focus { top: 12px; }

.topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 10px max(22px, calc((100vw - 1060px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand img { display: block; width: auto; height: 48px; object-fit: contain; }
.brand span { display: grid; line-height: 1.25; }
.brand strong { font-size: 16px; letter-spacing: -0.02em; }
.brand small { color: var(--muted); font-size: 12px; }

.install-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--purple);
  color: var(--purple-dark);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}
.install-button { color: #fff; }
.install-button:hover { background: var(--purple-dark); }
.install-button svg { width: 17px; height: 17px; }

main { width: min(100% - 40px, 900px); margin: 30px auto 42px; }

.welcome-row { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 0 0 22px; }
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.11em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(24px, 4vw, 32px); line-height: 1.2; letter-spacing: -0.045em; }
h2 { margin-bottom: 0; font-size: 17px; line-height: 1.3; letter-spacing: -0.02em; }
.welcome-copy, .supporting-copy { margin-bottom: 0; color: var(--muted); font-size: 13px; }

.tabs { display: flex; width: fit-content; gap: 4px; margin: 0 0 17px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.tab { display: flex; min-height: 38px; align-items: center; gap: 7px; padding: 0 13px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 700; }
.tab svg { width: 16px; height: 16px; }
.tab.is-active { background: #f1edfb; color: var(--purple-dark); }
.tab:focus-visible, button:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(91, 54, 201, 0.4); outline-offset: 3px; }

.overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.balance-card, .spending-card, .panel, .school-card { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.balance-card { display: flex; min-height: 190px; flex-direction: column; justify-content: space-between; padding: 20px; border-top: 3px solid var(--purple); }
.card-topline, .balance-footer, .section-heading, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.balance-amount { margin: 4px 0 18px; color: var(--navy); font-family: "Manrope", sans-serif; font-size: clamp(27px, 4vw, 35px); font-weight: 800; letter-spacing: -0.045em; line-height: 1.2; }
.student-chip { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; font-weight: 700; }
.balance-caption { color: var(--muted); font-size: 11px; }

.spending-card { min-height: 190px; padding: 19px 20px; }
.section-heading { align-items: start; }
.spending-amount { margin: 17px 0 3px; color: var(--navy); font-family: "Manrope", sans-serif; font-size: 25px; font-weight: 800; letter-spacing: -0.04em; }
.spending-card .supporting-copy { max-width: 280px; font-size: 12px; }

.panel { margin-top: 17px; padding: 19px 20px; }
.panel-heading { margin-bottom: 12px; }
.text-button { padding: 6px 0 6px 8px; border: 0; background: none; color: var(--purple-dark); cursor: pointer; font-size: 12px; font-weight: 800; white-space: nowrap; }
.back-home { display: inline-flex; min-height: 36px; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--purple-dark); cursor: pointer; font-size: 11px; font-weight: 700; white-space: nowrap; }
.back-home svg { width: 15px; height: 15px; }
.back-home:hover { background: #f1edfb; }
.launch-screen { display: flex; min-height: min(660px, calc(100svh - 160px)); flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; text-align: center; }
.launch-mark { display: grid; width: 68px; height: 68px; place-items: center; margin-bottom: 24px; border: 1px solid #e8e1f3; border-radius: 20px; background: #f6f3fb; color: var(--purple-dark); }
.launch-mark svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.launch-screen .eyebrow { margin-bottom: 9px; }
.launch-screen h1 { max-width: 580px; margin: 0; color: var(--ink); font-size: clamp(32px, 6vw, 48px); letter-spacing: -1.5px; line-height: 1.08; }
.launch-copy { max-width: 490px; margin: 17px 0 0; color: var(--muted); font-size: 15px; line-height: 1.7; }
.launch-note { margin: 12px 0 0; color: var(--ink); font-size: 13px; font-weight: 700; }
.launch-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; }
.primary-button, .secondary-button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; padding: 0 18px; border: 1px solid var(--purple-dark); border-radius: 10px; font: inherit; font-size: 13px; font-weight: 700; text-decoration: none; cursor: pointer; }
.primary-button { background: var(--purple-dark); color: #fff; }
.primary-button:hover { filter: brightness(1.08); }
.secondary-button { background: #fff; color: var(--purple-dark); }
.secondary-button:hover { background: #f6f3fb; }
.preview-disclaimer { margin: 18px 0 0; color: var(--muted); font-size: 11px; }
.school-card { display: flex; align-items: center; gap: 12px; margin-top: 17px; padding: 15px 17px; }
.school-icon { display: grid; width: 40px; height: 40px; min-width: 40px; place-items: center; border-radius: 13px; background: #f1edfb; color: var(--purple); }
.school-icon svg { width: 21px; height: 21px; }
.school-card > div { min-width: 0; flex: 1; }
.school-card .eyebrow { margin-bottom: 3px; }
.school-card h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.school-card > div > p:last-child { margin: 3px 0 0; color: var(--muted); font-size: 10px; }

.full-activity { margin-top: 0; }
.empty-state { margin: 0; padding: 20px 14px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 13px; text-align: center; }
.parent-card { margin-top: 0; }
.parent-profile { display: flex; align-items: center; gap: 12px; padding: 17px 0 19px; }
.parent-icon { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 12px; background: #f1edfb; color: var(--purple); }
.parent-icon svg { width: 22px; height: 22px; }
.parent-profile h2 { font-size: 16px; }
.parent-profile p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.account-row { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); font-size: 12px; }
.account-row span { color: var(--muted); }
.account-row strong { text-align: right; }
.account-signin { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; margin-top: 12px; padding: 0 16px; border-radius: 10px; background: var(--purple); color: #fff; font-size: 12px; font-weight: 700; }
.account-signin:hover { background: var(--purple-dark); }
.support-link { display: inline-flex; gap: 6px; margin: 14px 0; color: var(--purple-dark); font-size: 12px; font-weight: 700; }
.app-message { min-height: 20px; margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.app-message[data-state="error"] { color: #a52e38; }
.app-message[data-state="success"] { color: #26734d; }
.app-footer { display: flex; justify-content: center; gap: 8px; padding: 15px 18px max(18px, env(safe-area-inset-bottom)); color: var(--muted); font-size: 11px; }
.app-footer a { color: var(--purple-dark); font-weight: 700; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

@media (max-width: 620px) {
  .topbar { min-height: 64px; padding: 8px 18px; }
  main { width: min(100% - 30px, 440px); margin-top: 19px; }
  .welcome-row { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 17px; }
  .tabs { display: grid; width: 100%; grid-template-columns: repeat(3, 1fr); margin-bottom: 13px; }
  .tab { justify-content: center; padding: 0 5px; }
  .overview-grid { grid-template-columns: 1fr; gap: 12px; }
  .balance-card { min-height: 178px; }
  .spending-card { min-height: 150px; }
  .panel { margin-top: 12px; padding: 16px; }
  .panel-heading { align-items: flex-start; }
  .back-home { gap: 4px; padding: 0 7px; font-size: 10px; }
  .launch-screen { min-height: min(620px, calc(100svh - 140px)); padding: 32px 18px; }
  .launch-screen h1 { letter-spacing: -1px; }
  .launch-copy { font-size: 14px; }
  .launch-actions { width: 100%; }
  .launch-actions a, .launch-actions button { width: 100%; }
  .school-card { margin-top: 12px; padding: 13px; }
  .full-activity { margin-top: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .panel, .balance-card, .spending-card { animation: appear 280ms ease-out both; }
  @keyframes appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
}
