/* ThriftyGrad look: white page, one green for money saved, ink for
   everything else. Aimed at 15-18 year olds: few colors, big numbers,
   a savings bar and badges. Token names are older than the look:
   --teal holds the green accent, --flag holds ink. */
:root {
  color-scheme: light;
  --sky: #ffffff;        /* page */
  --paper: #ffffff;      /* panels */
  --soft: #f5f6f8;       /* quiet fills */
  --ink: #14181f;        /* text */
  --grey: #636b78;       /* secondary text */
  --line: #e6e8ec;       /* rules, borders */
  --teal: #138a4f;       /* the one accent: savings, links, buttons */
  --teal-lt: #e6f5ec;
  --flag: #14181f;       /* strong highlights */
  --board: #f5f6f8; --board-fg: #14181f; --board-sub: #636b78; --board-line: #e6e8ec;
  --danger: #c0331d; --ok: #138a4f;
  --warn-bg: #fff6e0; --warn-text: #7a4f00; --warn-border: #f0c46c;
  --focus: #2f6fe4;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: var(--font);
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--sky); color: var(--ink);
  font: 16px/1.5 var(--font);
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.mono { font-family: var(--mono); }
a { color: var(--teal); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---------- Top bar ---------- */
.bar { padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top, 0px)); }
.bar-in { max-width: 1240px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.logo i { width: 28px; height: 28px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font-style: normal; font-size: .9rem; }
.switch { font: 600 .85rem var(--mono); color: var(--ink); text-decoration: none; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); }

main { max-width: 1240px; margin: 0 auto; padding: 0 16px 40px; }
.disclaimer { margin: 0 0 20px; color: var(--grey); font-size: .85rem; font-weight: 600; }

/* ---------- Front page ---------- */
.home main { max-width: 560px; }
.home h1 { font-size: clamp(2rem, 8vw, 2.6rem); line-height: 1.05; letter-spacing: -.02em; margin: 18px 0 8px; text-wrap: balance; }
.sub { color: var(--grey); margin: 0 0 20px; max-width: 46ch; }
.board { background: var(--paper); color: var(--board-fg); border: 1px solid var(--line); border-radius: 16px; padding: 6px 16px; }
.board-hd { display: flex; justify-content: space-between; font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--board-sub); padding: 8px 0; border-bottom: 1px solid var(--board-line); }
.dest { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; padding: 16px 0; border-bottom: 1px solid var(--board-line); color: inherit; text-decoration: none; }
.dest:last-child { border-bottom: 0; }
.dest b { font-weight: 800; font-size: 1.35rem; }
.dest small { grid-column: 1 / -1; color: var(--board-sub); font-size: .8rem; }
.dest .gate { background: var(--teal); color: #fff; font-weight: 600; padding: 6px 10px; border-radius: 6px; font-size: .9rem; }
a.dest:hover .gate { filter: brightness(1.1); }
.dest.soon { opacity: .5; }
.dest.soon .gate { background: transparent; color: var(--board-sub); padding: 0; }
.facts { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 8px; color: var(--grey); font-size: .95rem; }
.facts li { padding-left: 22px; position: relative; }
.facts li::before { content: "✓"; position: absolute; left: 0; color: var(--teal); font-weight: 800; }

/* ---------- Calculator intro ---------- */
.intro h1 { font-size: clamp(1.7rem, 6vw, 2.3rem); line-height: 1.08; letter-spacing: -.02em; margin: 4px 0 12px; text-wrap: balance; }
.eyebrow { margin: 10px 0 0; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--grey); font-weight: 800; }

/* ---------- Inputs ---------- */
.inputs { display: grid; gap: 16px; }
.stack { display: grid; gap: 16px; align-content: start; }
@media (min-width: 900px) { .inputs { grid-template-columns: 1fr 1.4fr; } }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 16px; min-width: 0; }
.panel h2 { margin: 0 0 8px; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--grey); font-family: var(--mono); font-weight: 600; }
label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: .95rem; }
.panel h2 + label { margin-top: 0; }
select, input[type=text], input[type=number], input[type=email], input:not([type]) {
  display: block; width: 100%; padding: 11px 10px; font: inherit; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink);
}
select:disabled { opacity: 1; background: var(--soft); }
.hint { margin: 4px 0 10px; color: var(--grey); font-size: .85rem; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--teal); }
.check small { display: block; color: var(--grey); font-size: .8rem; font-weight: 400; margin-top: 2px; }
.check.small { font-size: .85rem; margin: 0; align-items: center; }
.check.small input { width: 18px; height: 18px; margin: 0; }
.pell, .state-aid-panel { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.pell label { margin-top: 0; }
.pell label small { font-weight: 400; color: var(--grey); }
.pell .hint { margin: 6px 0 0; }
.pell a { font-weight: 600; }
.state-aid-panel h3 { margin: 0 0 6px; font-size: 1rem; }
.state-aid { margin: 10px 0 0; }
fieldset.state-aid { border: 0; padding: 0; margin: 14px 0 0; display: grid; gap: 4px; }
fieldset.state-aid legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
fieldset.state-aid .check { margin: 4px 0; }
.tag { font-style: normal; font-size: .7rem; font-weight: 600; color: var(--warn-text); background: var(--warn-bg); padding: 1px 6px; border-radius: 4px; white-space: nowrap; }

.aid-row {
  display: grid; gap: 8px; grid-template-columns: 1fr 1fr auto;
  padding: 10px 0; border-bottom: 1px dashed var(--line);
}
.aid-row .aid-name { grid-column: 1 / 3; }
.aid-row .aid-flags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.aid-row.no-flags .aid-flags { display: none; }
.aid-remove {
  grid-row: 1; grid-column: 3; width: 44px; border: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--grey); font-size: 1.3rem; cursor: pointer;
}
@media (min-width: 560px) {
  .aid-row { grid-template-columns: 130px 130px 1fr auto; }
  .aid-row .aid-name { grid-column: 3; }
  .aid-remove { grid-column: 4; }
}
.link-btn {
  margin-top: 10px; background: none; border: 0; padding: 8px 0; font: inherit; font-weight: 600;
  color: var(--teal); cursor: pointer;
}

/* ---------- Results: tickets ---------- */
.cards { display: grid; gap: 18px; margin-top: 24px; grid-template-columns: 1fr; }
@media (min-width: 1080px) { .cards { grid-template-columns: repeat(3, 1fr); align-items: start; } }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; min-width: 0; overflow: hidden; padding-bottom: 14px; }
.card-top { background: var(--soft); color: var(--ink); padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  font: 600 .74rem var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.card.best .card-top { background: var(--teal); color: #fff; }
.pill { background: var(--flag); color: #fff; padding: 2px 8px; border-radius: 999px; font-size: .68rem; white-space: nowrap; }
.route { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; padding: 14px 16px 2px; gap: 8px; }
.route .lbl { display: block; font: 600 .66rem var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--grey); }
.route b { font-weight: 800; font-size: clamp(1.5rem, 6vw, 2rem); line-height: 1.05; letter-spacing: -.01em; overflow-wrap: anywhere; }
.route .to { text-align: right; }
.route .arrow { color: var(--teal); font-size: 1.3rem; padding-bottom: 4px; }
.card .detail { margin: 4px 16px 12px; color: var(--grey); font-size: .86rem; }
.headline { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 8px 12px;
  margin: 0 16px 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.total { margin: 0; font-size: 1.9rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.total span { display: block; font: 600 .66rem var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--grey); margin-bottom: 4px; }
.savings { margin: 0; font-weight: 800; color: var(--teal); background: var(--teal-lt); padding: 6px 10px; border-radius: 8px; text-align: right; }
.savings span { font-weight: 600; }
.savings small { display: block; font-size: .72rem; font-weight: 600; color: var(--grey); }
.savings.baseline { color: var(--grey); background: transparent; font-weight: 600; padding: 0; }
.savings.more { color: var(--danger); background: transparent; padding: 0; }
.card h3 { margin: 20px 16px 6px; font: 600 .74rem var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--grey); }
.scroll { overflow-x: auto; padding: 0 16px; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 4px; text-align: right; vertical-align: top; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
thead th { font: 600 .68rem var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--grey); }
td small { display: block; font-size: .72rem; color: var(--grey); font-weight: 400; }
tfoot th, tfoot td { font-weight: 800; border-top: 2px solid var(--ink); border-bottom: 0; }
.gap.short, .owe { color: var(--danger); font-weight: 700; }
.gap.short small { color: var(--danger); }
.gap.ok { color: var(--ok); font-weight: 600; }
td.gap small.summer { color: var(--ok); font-weight: 600; }
td.gap small.summer.worse { color: var(--danger); }
tr.warn td {
  text-align: left; background: var(--warn-bg); color: var(--warn-text);
  border-left: 3px solid var(--warn-border); padding: 6px 8px; font-size: .8rem; line-height: 1.4;
}
.exits tr.finish td { font-weight: 700; }

.note { color: var(--grey); font-size: .82rem; margin: 20px 0 10px; max-width: 90ch; }
#results .disclaimer { margin-bottom: 40px; }

/* ---------- Results: savings checklist ---------- */
.summary { display: grid; gap: 18px; margin-top: 28px; max-width: 640px; }
.sum-head { background: var(--soft); border-radius: 20px; padding: 16px; display: grid; gap: 10px; }
.sum-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.sum-row > div { min-width: 0; }
.sum-row .r { text-align: right; }
.sum-k { margin: 0; font-size: .8rem; font-weight: 800; color: var(--grey); }
.sum-v { margin: 2px 0 0; font-size: clamp(1.7rem, 7vw, 2.2rem); font-weight: 900; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.sum-v.saved { color: var(--teal); }
.sum-v.more { color: var(--danger); font-size: 1.2rem; }
.sum-sub { margin: 4px 0 0; font-size: .78rem; color: var(--grey); font-weight: 600; font-variant-numeric: tabular-nums; }
.sbar { height: 14px; background: var(--paper); border-radius: 999px; overflow: hidden; }
.sbar i { display: block; height: 100%; background: var(--teal); border-radius: 999px; transition: width .4s ease; }
.sum-scale { display: flex; justify-content: space-between; gap: 12px; font-size: .76rem; color: var(--grey); font-weight: 700; font-variant-numeric: tabular-nums; }
.sum-scale span:last-child { text-align: right; white-space: nowrap; }
.sum-label { margin: 0 0 10px; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--grey); font-weight: 800; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.step {
  width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; text-align: left;
  border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--paper); color: var(--ink);
  font: inherit; cursor: pointer; min-height: 60px;
}
.step:hover { border-color: #c6cad1; }
.step[aria-pressed="true"] { border: 2px solid var(--teal); background: var(--teal-lt); padding: 11px; }
.tick { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #c6cad1; display: grid; place-items: center; color: #fff; background: var(--paper); }
.tick svg { width: 16px; height: 16px; }
.step[aria-pressed="true"] .tick { background: var(--teal); border-color: var(--teal); }
.step b { display: block; font-weight: 900; }
.step small { display: block; color: var(--grey); font-size: .8rem; line-height: 1.3; }
.step .amt { text-align: right; font-weight: 900; font-size: .95rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.step .amt small { font-weight: 700; }
.step[aria-pressed="true"] .amt { color: var(--teal); }
.step .amt.more { color: var(--danger); }
.step .tag { margin-left: 6px; color: #fff; background: var(--ink); font-size: .68rem; vertical-align: 2px; }
.step .caution { color: var(--warn-text); font-weight: 700; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 800; border-radius: 999px; padding: 6px 11px; background: var(--teal-lt); color: var(--teal); }
.chip svg { width: 15px; height: 15px; flex: none; }
.chip.locked { background: var(--soft); color: var(--grey); border: 1px dashed #c6cad1; padding: 5px 10px; font-weight: 700; }

.plan { margin-top: 28px; max-width: 640px; border: 1px solid var(--line); border-radius: 20px; padding: 16px; min-width: 0; }
.plan h2 { margin: 2px 0 2px; font-size: 1.35rem; line-height: 1.2; text-wrap: balance; }
.plan .detail { margin: 0 0 14px; color: var(--grey); font-size: .88rem; }
.plan .transfer { margin: 0 0 10px; }
.plan h3 { margin: 22px 0 4px; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--grey); font-weight: 800; }
.yrs { list-style: none; margin: 0; padding: 0; }
.yrs li { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.yrs li > div { min-width: 0; }
.yrs b { font-weight: 900; font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.yrs small { display: block; color: var(--grey); font-size: .8rem; font-variant-numeric: tabular-nums; }
.yrs .r { text-align: right; }
.yrs .covered { color: var(--teal); }
.yrs .saves { display: block; color: var(--teal); font-weight: 800; font-size: .86rem; }
.yrs .saves.worse { color: var(--danger); }
.yrs .saves .why { color: var(--grey); font-weight: 600; font-size: .78rem; }
.yrs li.yr-total { border-bottom: 0; border-top: 2px solid var(--ink); margin-top: -1px; }
.yrs li.warn { display: block; background: var(--warn-bg); color: var(--warn-text); border: 0; border-radius: 10px; padding: 8px 10px; margin: 4px 0; font-size: .82rem; line-height: 1.4; }
.plan .scroll { padding: 0; }
.plan .exits td.owe { color: var(--ink); }

/* ---------- Transfer note ---------- */
.transfer {
  margin: 0 16px 12px; padding: 8px 10px; border-radius: 6px; font-size: .84rem; line-height: 1.4;
  background: var(--warn-bg); color: var(--warn-text); border-left: 3px solid var(--warn-border);
}
.transfer a { color: inherit; font-weight: 700; }
.transfer.ok { background: transparent; color: var(--grey); border-left-color: var(--grey); }
.transfer.strong { font-weight: 600; border-left-width: 5px; }

@media (prefers-reduced-motion: no-preference) {
  a.dest .gate { transition: transform .15s ease; }
  a.dest:hover .gate { transform: translateX(3px); }
}

/* ---------- Footer and privacy page ---------- */
.foot { max-width: 1240px; margin: 0 auto; padding: 0 16px 32px; padding-bottom: max(32px, env(safe-area-inset-bottom, 0px)); color: var(--grey); font-size: .85rem; }
.home .foot { max-width: 560px; }
.privacy main { max-width: 640px; }
.privacy h1 { font-size: clamp(1.8rem, 7vw, 2.3rem); line-height: 1.1; margin: 18px 0 8px; }
.privacy h2 { font-size: 1.15rem; margin: 28px 0 6px; }
.privacy .promise { background: var(--teal-lt); color: var(--ink); border-left: 4px solid var(--teal); padding: 12px 14px; border-radius: 6px; font-weight: 600; }
.privacy ul { padding-left: 20px; }
.privacy li { margin: 4px 0; }

/* ---------- Accounts: save a plan, share with a school ---------- */
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px;
  border: 0; border-radius: 10px; background: var(--teal); color: #fff; font: 700 .95rem var(--font); cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--teal); box-shadow: inset 0 0 0 2px var(--teal); }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link-btn.inline { margin: 0; padding: 0; }
.panel.account { margin-top: 24px; max-width: 640px; }
.panel.account p { margin: 0 0 10px; }
.signin { display: grid; gap: 10px; }
.signin .btn { justify-self: start; }
.email-row, .save-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.save-row label { flex-basis: 100%; margin: 0; }
.email-row input, .save-row input { flex: 1 1 200px; min-width: 0; width: auto; }
.acct-msg { font-size: .88rem; color: var(--grey); min-height: 1.2em; }
.acct-msg:empty { display: none; }
.warn-msg { background: var(--warn-bg); color: var(--warn-text); padding: 6px 10px; border-radius: 6px; }
.who { color: var(--grey); font-size: .9rem; overflow-wrap: anywhere; }
.share-cta { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.share-cta .btn { width: 100%; }
@media (min-width: 560px) { .share-cta .btn { width: auto; } }

dialog.share {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto;
  border: 0; border-radius: 16px; padding: 18px 16px; background: var(--paper); color: var(--ink);
}
dialog.share::backdrop { background: rgba(20, 24, 31, .5); }
dialog.share h2 { margin: 0 0 6px; font-size: 1.25rem; line-height: 1.2; }
dialog.share h3 { margin: 18px 0 6px; font: 600 .74rem var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--grey); }
dialog.share .scroll { padding: 0; }
.report th { text-align: left; font-weight: 600; color: var(--grey); padding-right: 12px; }
.report td { text-align: right; overflow-wrap: anywhere; }
.report tfoot td { border-top: 0; font-weight: 400; text-align: left; }
fieldset.age { border: 0; padding: 0; margin: 16px 0 0; }
fieldset.age legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
.consent { margin-top: 14px; padding: 10px; border-radius: 8px; background: var(--teal-lt); }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.account-page main { max-width: 640px; }
.account-page h1 { font-size: clamp(1.8rem, 7vw, 2.3rem); line-height: 1.1; margin: 18px 0 12px; }
.account-page .panel { margin-top: 16px; }
.plan-list { list-style: none; margin: 0; padding: 0; }
.plan-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.plan-list li > div { min-width: 0; overflow-wrap: anywhere; }
.plan-list small { display: block; color: var(--grey); font-size: .8rem; }
.plan-list .link-btn { margin: 0; flex: none; }
.danger-zone .btn { margin-top: 10px; }
