  :root {
    --ink: #22304a;
    --ink-soft: #4d5a72;
    --paper: #f4f6f2;
    --card: #ffffff;
    --line: #d9ded4;
    --grant: #1e7a46;
    --grant-bg: #e9f4ec;
    --loan: #a05e12;
    --loan-bg: #faf0e0;
    --work: #35618e;
    --work-bg: #e9f0f7;
    --hl: #ffe14d;
    --danger: #b3392f;
    --radius: 10px;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html { scroll-behavior: smooth; }
  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
  }
  body {
    font-family: "Public Sans", system-ui, sans-serif;
    background: var(--paper);
    color: var(--ink);
    line-height: 1.55;
    font-size: 16px;
  }
  .wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

  /* ---------- Header ---------- */
  header { padding: 48px 0 36px; }
  .eyebrow {
    font-size: 16px; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--work);
    display: inline-block; border-bottom: 3px solid var(--hl);
    padding-bottom: 3px; margin-bottom: 2px;
  }
  h1 {
    font-family: "Bitter", Georgia, serif;
    font-weight: 800; font-size: clamp(30px, 5vw, 46px);
    line-height: 1.12; margin: 10px 0 14px; max-width: 22ch;
  }
  h1 .hl-sweep {
    background: linear-gradient(104deg, transparent 0.5%, var(--hl) 3%, var(--hl) 97%, transparent 99.5%);
    padding: 0 6px; margin: 0 -2px;
  }
  .lede { max-width: 60ch; color: var(--ink-soft); font-size: 17px; }

  .steps {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px; margin: 28px 0 8px;
  }
  .step {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 14px 16px; font-size: 14px;
  }
  .step b { display: block; font-family: "Bitter", serif; font-size: 15px; margin-bottom: 3px; }
  .step-grant b { color: var(--grant); }
  .step-loan b { color: var(--loan); }
  .step-work b { color: var(--work); }

  .legend { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 18px 0 0; font-size: 13.5px; font-weight: 600; }
  .legend span { display: inline-flex; align-items: center; gap: 7px; }
  .dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

  /* ---------- View switch + save bar ---------- */
  .control-bar {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
    justify-content: space-between; margin: 0;
  }
  .view-switch { display: inline-flex; border: 1px solid var(--ink); border-radius: 9px; overflow: hidden; }
  .view-switch button {
    font-family: "Public Sans", sans-serif; font-weight: 700; font-size: 14px;
    padding: 10px 16px; border: none; background: var(--card); color: var(--ink); cursor: pointer;
  }
  .view-switch button[aria-pressed="true"] { background: var(--ink); color: #fff; }
  .save-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .btn {
    font-family: "Public Sans", sans-serif; font-weight: 700; font-size: 14px;
    border-radius: 8px; padding: 10px 16px; cursor: pointer; border: 1px solid var(--ink);
  }
  .btn-primary { background: var(--ink); color: #fff; }
  .btn-primary:hover { background: #33456b; }
  .btn-ghost { background: transparent; color: var(--ink); }
  .btn-ghost:hover { background: #eaece6; }
  .save-status { font-size: 12.5px; color: var(--ink-soft); }
  .control-meta {
    display: flex; justify-content: flex-end; align-items: baseline;
    gap: 18px; flex-wrap: wrap; margin: 8px 0 24px;
  }
  @media (max-width: 700px) { .control-meta { justify-content: flex-start; } }
  .save-help { min-width: 0; }
  .save-help summary {
    cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--work);
    text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px;
  }
  .save-help[open] {
    width: 100%; background: var(--card); border: 1px solid var(--line);
    border-radius: 8px; padding: 0 16px; margin-top: 4px;
  }
  .save-help[open] summary { padding: 11px 0; text-decoration: none; font-size: 14px; color: var(--ink); }
  .save-help p { font-size: 13.5px; color: var(--ink-soft); padding: 0 0 12px; }
  .save-help p b { color: var(--ink); }

  /* ---------- School tabs (entry view) ---------- */
  .tabs-bar {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    margin: 6px 0 0; border-bottom: 2px solid var(--ink);
  }
  .tab {
    font-family: "Public Sans", sans-serif; font-weight: 600; font-size: 14.5px;
    background: var(--card); color: var(--ink-soft);
    border: 1px solid var(--line); border-bottom: none;
    border-radius: 8px 8px 0 0; padding: 9px 16px; cursor: pointer;
    max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .tab[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
  .tab:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
    outline: 3px solid var(--work); outline-offset: 2px;
  }
  .tab-add {
    background: none; border: 1px dashed var(--ink-soft); border-radius: 8px 8px 0 0;
    color: var(--work); font-weight: 700; font-size: 14.5px; padding: 9px 14px; cursor: pointer;
  }
  .tab-add:hover { background: var(--work-bg); }

  .main-grid { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; margin-top: 22px; }
  @media (max-width: 860px) { .main-grid { grid-template-columns: 1fr; } }

  /* ---------- Entry form ---------- */
  .school-form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
  .school-name-row { padding: 18px 20px 4px; display: flex; gap: 10px; align-items: center; }
  .school-name-row input {
    flex: 1; font-family: "Bitter", serif; font-weight: 700; font-size: 20px;
    border: none; border-bottom: 2px dashed var(--line); padding: 4px 2px;
    color: var(--ink); background: transparent; min-width: 0;
  }
  .school-name-row input::placeholder { color: #a9b0a4; font-weight: 500; }
  .btn-remove {
    background: none; border: 1px solid var(--line); border-radius: 7px;
    color: var(--danger); font-size: 13px; font-weight: 600; padding: 6px 10px; cursor: pointer;
  }
  .btn-remove:hover { background: #fbeeed; }

  fieldset { border: none; padding: 16px 20px 6px; }
  fieldset + fieldset { border-top: 1px solid var(--line); }
  legend {
    font-family: "Bitter", serif; font-weight: 700; font-size: 16px;
    float: left; width: calc(100% + 40px); color: #2a4d70;
    background: var(--work-bg); margin: 12px -20px 4px;
    padding: 9px 20px;
  }
  .fs-note { clear: both; font-size: 13.5px; color: var(--ink-soft); margin: 2px 0 10px; }
  .badge {
    display: inline-block; font-size: 11.5px;
    font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
    border-radius: 20px; padding: 2px 10px; vertical-align: 2px; margin-left: 8px;
    font-family: "Public Sans", sans-serif;
  }
  .badge-grant { background: var(--grant); color: #fff; }
  .badge-loan { background: var(--loan); color: #fff; }
  .badge-work { background: var(--work); color: #fff; }

  .row {
    display: grid; grid-template-columns: 1fr 150px; gap: 12px;
    align-items: center; padding: 7px 0; clear: both;
  }
  @media (max-width: 480px) { .row { grid-template-columns: 1fr 120px; } }
  .row label { font-size: 14.5px; font-weight: 500; }
  .hint { display: block; font-size: 12.5px; color: var(--ink-soft); font-weight: 400; }
  .money-input { position: relative; }
  .money-input input.input-warn { border-color: var(--danger); background: #fdf0ef; }
  .money-input::before {
    content: "$"; position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
    color: var(--ink-soft); font-size: 14px; pointer-events: none;
  }
  .money-input input {
    width: 100%; font-family: "IBM Plex Mono", monospace; font-weight: 500; font-size: 15px;
    text-align: right; padding: 9px 12px 9px 24px;
    border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fdfdfc;
  }
  .money-input input:focus { border-color: var(--work); }

  .subtotal-row {
    display: flex; justify-content: space-between; align-items: baseline;
    border-top: 1px dashed var(--line); margin-top: 8px; padding: 10px 0 12px;
    font-weight: 700; font-size: 14.5px; clear: both;
  }
  .money { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; }

  /* ---------- Results panel ---------- */
  .results {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; position: sticky; top: 16px;
  }
  @media (max-width: 860px) { .results { position: static; } }
  .results h2 { font-family: "Bitter", serif; font-size: 18px; margin-bottom: 4px; }
  .results .for-school { font-size: 13.5px; color: var(--ink-soft); margin-bottom: 14px; }
  .r-line { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 14px; border-bottom: 1px solid #eff1ec; }
  .r-line .lbl { color: var(--ink-soft); }
  .r-line.strong { font-weight: 700; }
  .r-line.strong .lbl { color: var(--ink); }
  .r-grant .money { color: var(--grant); }
  .r-loan .money { color: var(--loan); }
  .r-work .money { color: var(--work); }

  .grand { margin: 18px -6px 6px; padding: 14px 12px 12px; border-radius: 8px; }
  .grand .g-label { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
  .grand .g-num {
    font-family: "IBM Plex Mono", monospace; font-weight: 600;
    font-size: 30px; line-height: 1.2; display: inline-block;
    background: linear-gradient(104deg, transparent 1%, var(--hl) 4%, var(--hl) 96%, transparent 99%);
    padding: 1px 10px; margin: 4px -4px 2px; transform: rotate(-0.6deg);
  }
  .grand .g-sub { font-size: 13px; color: var(--ink-soft); }
  .gap-note {
    margin-top: 12px; font-size: 13.5px; padding: 12px; border-radius: 8px;
    background: var(--work-bg); border: 1px solid #cfdcea;
  }
  .gap-note.gap-bad { background: #fbeeed; border-color: #ecc9c5; }
  .gap-note b { font-family: "IBM Plex Mono", monospace; }
  .loan-note {
    margin-top: 10px; font-size: 13px; padding: 10px 12px; border-radius: 8px;
    background: var(--loan-bg); border: 1px solid #ecd9bb; color: #6e440f;
  }

  /* ---------- Side-by-side table view ---------- */
  .table-scroller {
    overflow-x: auto; background: var(--card);
    border: 1px solid var(--line); border-radius: var(--radius);
    -webkit-overflow-scrolling: touch;
  }
  .cost-table { border-collapse: collapse; width: 100%; min-width: 560px; }
  .cost-table th, .cost-table td {
    padding: 8px 12px; font-size: 14px; border-bottom: 1px solid #eff1ec;
    text-align: right; vertical-align: middle; white-space: nowrap;
  }
  .cost-table th:first-child, .cost-table td:first-child {
    text-align: left; position: sticky; left: 0; background: var(--card);
    max-width: 240px; min-width: 180px; white-space: normal;
    border-right: 1px solid var(--line); font-weight: 500; z-index: 2;
  }
  .cost-table thead th {
    background: var(--ink); color: #fff; font-family: "Bitter", serif;
    font-size: 14px; padding: 10px 12px; position: sticky; top: 0; z-index: 3;
  }
  .cost-table thead th:first-child { background: var(--ink); z-index: 4; }
  .cost-table thead input {
    font-family: "Bitter", serif; font-weight: 700; font-size: 14px;
    background: transparent; border: none; border-bottom: 1px dashed rgba(255,255,255,0.5);
    color: #fff; width: 130px; text-align: right; padding: 2px;
  }
  .cost-table thead input::placeholder { color: rgba(255,255,255,0.6); }
  .col-remove {
    display: block; margin-left: auto; margin-top: 4px; background: none; border: none;
    color: rgba(255,255,255,0.75); font-size: 11px; cursor: pointer; text-decoration: underline;
  }
  .col-remove:hover { color: #fff; }
  .t-section td {
    background: var(--work-bg); font-family: "Bitter", serif; font-weight: 700;
    font-size: 13.5px; text-align: left; padding-top: 12px;
    color: #2a4d70;
  }
  .t-section td:first-child { background: var(--work-bg); }
  .t-sub td { font-weight: 700; border-top: 1px dashed var(--line); }
  .t-grant td { color: var(--grant); }
  .t-loan td { color: var(--loan); }
  .t-work td { color: var(--work); }
  .t-grand td {
    font-weight: 700; font-size: 15px; background: #fffbe6; border-top: 2px solid var(--ink);
    border-bottom: 2px solid var(--ink);
  }
  .t-grand td:first-child { background: #fffbe6; }
  .t-gap td { font-weight: 700; }
  .cost-table .money-input { display: inline-block; width: 120px; }
  .cost-table .money-input input { padding: 6px 10px 6px 22px; font-size: 14px; }
  .table-hint { font-size: 13px; color: var(--ink-soft); margin: 10px 2px 0; }
  .switch-note {
    margin: 34px 0 14px; font-size: 14.5px; color: var(--ink-soft);
    background: var(--card); border: 1px solid var(--line);
    border-left: 4px solid var(--hl); border-radius: 8px; padding: 12px 16px;
  }
  .switch-note b { color: var(--ink); }
  .glossary a { color: var(--work); font-weight: 600; }
  .cost-table th.th-add { background: var(--ink); vertical-align: middle; }
  .btn-add-col {
    font-family: "Public Sans", sans-serif; font-weight: 700; font-size: 13px;
    background: transparent; color: #fff; border: 1px dashed rgba(255,255,255,0.65);
    border-radius: 7px; padding: 7px 12px; cursor: pointer; white-space: nowrap;
  }
  .btn-add-col:hover { background: rgba(255,255,255,0.15); }
  .cost-table td.td-empty { background: #fafbf8; border-left: 1px dashed var(--line); }

  /* ---------- Comparison cards ---------- */
  .compare-section { margin-top: 44px; }
  .compare-section h2 { font-family: "Bitter", serif; font-size: 26px; margin-bottom: 6px; }
  .compare-sub { color: var(--ink-soft); font-size: 15px; margin-bottom: 18px; max-width: 62ch; }
  .compare-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
  .c-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
  .c-card.best { border: 2px solid var(--grant); }
  .c-card .c-rank {
    font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--grant); margin-bottom: 2px; min-height: 16px;
  }
  .c-card h3 { font-family: "Bitter", serif; font-size: 17px; margin-bottom: 10px; }
  .c-card .c-line { display: flex; justify-content: space-between; font-size: 13.5px; padding: 4px 0; }
  .c-card .c-line .lbl { color: var(--ink-soft); }
  .c-card .c-big {
    border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 9px;
    font-weight: 700; font-size: 15px; display: flex; justify-content: space-between;
  }

  /* ---------- Glossary ---------- */
  .glossary { margin-top: 48px; }
  .glossary h2 { font-family: "Bitter", serif; font-size: 26px; margin-bottom: 14px; }
  .glossary details {
    background: var(--card); border: 1px solid var(--line); border-radius: 8px;
    margin-bottom: 8px; padding: 0 16px;
  }
  .glossary summary { cursor: pointer; font-weight: 600; font-size: 15px; padding: 12px 0; }
  .glossary details p { padding: 0 0 14px; font-size: 14.5px; color: var(--ink-soft); max-width: 70ch; }
  .glossary details ul { margin: 0 0 14px 22px; font-size: 14.5px; color: var(--ink-soft); max-width: 68ch; }
  .glossary details li { margin-bottom: 6px; }

  .toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin: 30px 0 8px; }
  footer { padding: 34px 0 46px; color: var(--ink-soft); font-size: 13.5px; max-width: 72ch; }

  /* ---------- Term tooltips ---------- */
  .term-info {
    display: inline-flex; align-items: center; justify-content: center;
    width: 17px; height: 17px; margin-left: 6px; vertical-align: -2px;
    border: 1px solid var(--work); border-radius: 50%; background: var(--work-bg);
    color: var(--work); font-size: 11px; font-weight: 700;
    font-family: "Public Sans", sans-serif; cursor: pointer; line-height: 1; padding: 0;
  }
  .term-info:hover, .term-info:focus-visible { background: var(--work); color: #fff; }
  .term-tip {
    position: absolute; z-index: 50; max-width: 300px; background: var(--ink); color: #fff;
    font-size: 13px; line-height: 1.5; padding: 10px 12px; border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  }
  .term-tip a { color: var(--hl); font-weight: 600; }
  .glossary details.flash { border-color: var(--work); box-shadow: 0 0 0 2px var(--work-bg); }
  @media print { .term-info, .term-tip { display: none !important; } }

  /* ---------- Print ---------- */
  @media print {
    body { background: #fff; font-size: 12px; }
    .tabs-bar, .toolbar, .btn-remove, .tab-add, .steps, .legend, .site-nav,
    .control-bar, .control-meta, .switch-note, .col-remove { display: none !important; }
    .main-grid { grid-template-columns: 1fr; }
    .results { border: 1px solid #999; position: static; }
    .grand .g-num { background: none; border: 2px solid #000; }
    header { padding: 10px 0; }
    .table-scroller { overflow: visible; border: none; }
    .cost-table th, .cost-table td { white-space: normal; }
    .cost-table thead th { background: #fff !important; color: #000; border-bottom: 2px solid #000; }
    .cost-table thead input { color: #000; border: none; }
    a[href]::after { content: ""; }
  }

  /* ---------- Site navigation ---------- */
  .site-nav { display: flex; gap: 24px; padding: 16px 0 0; font-size: 14px; font-weight: 700; }
  .site-nav a { color: var(--ink-soft); text-decoration: none; padding-bottom: 4px; }
  .site-nav a:hover { color: var(--ink); }
  .site-nav a.active { color: var(--ink); border-bottom: 3px solid var(--hl); }

  /* ---------- Content pages (terms/tips) ---------- */
  .page-header { padding: 34px 0 8px; }
  .page-header h1 { font-size: clamp(26px, 4vw, 38px); }
  .page-header .lede { font-size: 16px; margin-top: 4px; }
  .content-section { margin-top: 26px; }
  .content-section h2 { font-family: "Bitter", serif; font-size: 24px; margin-bottom: 12px; }

  .site-nav .lang {
    margin-left: auto; color: var(--work);
    border: 1.5px solid var(--work); border-radius: 20px; padding: 4px 14px;
  }
  .site-nav .lang:hover { background: var(--work); color: #fff; }

  /* ---------- COA summary band ---------- */
  .coa-band {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
    background: #fff; padding: 12px 20px;
  }
  .coa-band .coa-label { font-family: "Bitter", serif; font-weight: 700; font-size: 15.5px; display: block; }
  .coa-band .coa-sub { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 1px; }
  .coa-band .money { font-weight: 700; font-size: 16px; white-space: nowrap; }
  .cost-table .t-coa td {
    background: #fff; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); font-size: 14px;
  }
  .cost-table .t-coa td:first-child { background: #fff; }

  /* ---------- Footer fine print ---------- */
  footer .fine-print {
    margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
    font-size: 12px; color: var(--ink-soft); max-width: 78ch;
  }
