:root {
  --fees-indigo: #312783;
  --fees-indigo-dark: #17125f;
  --fees-indigo-soft: #f4f3ff;
  --fees-text: #171630;
  --fees-muted: #626277;
  --fees-border: #dcdde7;
  --fees-shadow: 0 18px 45px rgba(24, 24, 57, .09);
}

body:has(.school-picker),
body:has(.pay-shell) {
  background: #fff;
  color: var(--fees-text);
}

body:has(.school-picker) .site-main,
body:has(.pay-shell) .site-main {
  max-width: 1480px;
  padding-inline: clamp(18px, 4vw, 58px);
}

.school-picker {
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: clamp(38px, 7vh, 76px) 0 64px;
}

.school-picker-heading {
  max-width: 920px;
  margin: 0 auto clamp(34px, 5vw, 52px);
  text-align: center;
}

.school-picker-heading h1 {
  margin: 0;
  color: var(--fees-indigo-dark);
  font-size: clamp(2.35rem, 5vw, 4.25rem);
  font-weight: 900;
  letter-spacing: -.045em;
  line-height: 1.02;
}

.school-picker-heading p {
  margin: 18px auto 0;
  color: #414156;
  font-size: clamp(1rem, 1.6vw, 1.28rem);
  font-weight: 500;
  line-height: 1.55;
}

.school-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 2vw, 28px);
}

.school-choice {
  display: flex;
  min-height: 470px;
  flex-direction: column;
  align-items: center;
  border: 1px solid var(--fees-border);
  border-radius: 24px;
  padding: clamp(24px, 2.7vw, 34px);
  background: #fff;
  box-shadow: 0 8px 24px rgba(24, 24, 57, .055);
  text-align: center;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.school-choice:hover,
.school-choice:focus-within {
  border-color: var(--fees-indigo);
  box-shadow: var(--fees-shadow);
  transform: translateY(-3px);
}

.school-choice-logo-wrap {
  display: grid;
  min-height: 220px;
  place-items: center;
}

.school-choice-logo {
  width: min(100%, 210px);
  max-height: 220px;
  object-fit: contain;
}

.school-choice-mes .school-choice-logo {
  width: min(100%, 195px);
}

.school-bus-icon { width: min(100%, 205px); height: 205px; color: var(--fees-indigo); filter: drop-shadow(0 8px 9px rgba(49,39,131,.12)); }

.school-choice-copy { margin-top: 16px; }

.school-choice-copy h2 {
  margin: 0;
  color: var(--fees-indigo-dark);
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  font-weight: 900;
  letter-spacing: -.025em;
}

.school-choice-copy p {
  margin: 12px 0 0;
  color: var(--fees-muted);
  font-size: 1.18rem;
  font-weight: 600;
}

.school-choice-action {
  display: inline-flex;
  width: 100%;
  min-height: 62px;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: auto;
  border: 2px solid var(--fees-indigo);
  border-radius: 12px;
  padding: 10px 22px;
  color: var(--fees-indigo);
  background: #fff;
  font-size: 1.05rem;
  font-weight: 850;
  text-decoration: none;
  transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.school-choice-ma .school-choice-action,
.school-choice-action:hover {
  color: #fff;
  background: var(--fees-indigo);
  box-shadow: 0 10px 22px rgba(49, 39, 131, .2);
}

.school-choice-bus .school-choice-action { color: var(--fees-indigo); background: #fff; }
.school-choice-bus .school-choice-action:hover { color: #fff; background: var(--fees-indigo); }

.school-choice-action:focus-visible {
  outline: 4px solid rgba(49, 39, 131, .22);
  outline-offset: 4px;
}

.school-choice-action svg,
.pay-change-school svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pay-shell {
  display: grid;
  width: min(100%, 1440px);
  margin: 0 auto 34px;
  gap: 20px;
}

.pay-change-school {
  display: inline-flex;
  width: 100vw;
  min-height: 68px;
  align-items: center;
  gap: 10px;
  margin-left: calc(50% - 50vw);
  padding: 0 max(24px, calc((100vw - 1440px) / 2 + 58px));
  color: #fff;
  background: var(--fees-indigo);
  font-size: 1.02rem;
  font-weight: 800;
  text-decoration: none;
}

.pay-change-school:hover { color: #fff; background: var(--fees-indigo-dark); }
.pay-change-school:focus-visible { outline: 3px solid rgba(255,255,255,.7); outline-offset: -6px; }

.pay-surface {
  overflow: hidden;
  border: 1px solid var(--fees-border);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--fees-shadow);
}

.pay-shell .pay-hero {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(22px, 4vw, 42px);
  border: 0;
  border-bottom: 1px solid var(--fees-border);
  border-radius: 0;
  padding: clamp(24px, 4vw, 38px);
  box-shadow: none;
}

.pay-shell .pay-brand { display: flex; align-items: center; gap: clamp(22px, 4vw, 42px); }
.pay-shell .pay-brand img { width: 190px; height: 190px; border-radius: 0; object-fit: contain; }
.pay-shell .pay-brand-mes img { width: 170px; height: 170px; border-radius: 50%; }
.pay-shell .pay-title { margin: 0; color: var(--fees-indigo); font-size: clamp(2rem, 4vw, 3.75rem); font-weight: 900; letter-spacing: -.04em; }
.pay-shell .pay-sub { margin: 4px 0 0; color: var(--fees-muted); font-size: 1.05rem; font-weight: 600; }
.pay-school-range { margin-top: 12px !important; }

.pay-shell .pay-panel {
  min-width: 0;
  max-width: 100%;
  border: 0;
  border-radius: 0;
  padding: clamp(24px, 4vw, 36px);
  box-shadow: none;
}

.student-search { position: relative; margin-bottom: 26px; }
.pay-shell .student-search-grid { display: grid; grid-template-columns: minmax(220px, .42fr) minmax(320px, 1fr); align-items: end; gap: 30px; min-width: 0; }
.pay-shell .pay-label { display: block; margin-bottom: 8px; color: #27253e; font-size: .95rem; font-weight: 800; }
.pay-shell .pay-input,
.pay-shell .pay-select { width: 100%; min-height: 54px; border: 1px solid #bfc1ce; border-radius: 9px; padding: 0 14px; color: #28263d; background: #fff; font-size: .98rem; font-weight: 600; }
.pay-shell .pay-input:focus,
.pay-shell .pay-select:focus { border-color: var(--fees-indigo); outline: 0; box-shadow: 0 0 0 3px rgba(49,39,131,.13); }
.student-dropdown { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20; display: none; max-height: 260px; overflow-y: auto; border: 1px solid #cfd0db; border-radius: 10px; padding: 6px; background: #fff; box-shadow: 0 18px 38px rgba(24,24,57,.14); }
.student-dropdown.open { display: grid; gap: 6px; }
.student-row { border: 1px solid transparent; border-radius: 8px; padding: 10px 12px; background: #fff; cursor: pointer; text-align: left; }
.student-row:hover,
.student-row.active { border-color: var(--fees-indigo); background: var(--fees-indigo-soft); }
.student-row strong { display: block; color: var(--fees-indigo-dark); }
.student-row span { display: block; color: var(--fees-muted); font-size: .9rem; }
.student-empty { padding: 10px 12px; color: var(--fees-muted); font-weight: 650; }
.student-selected-card { display: none; margin: 0 0 14px; border: 1px solid #dfe0e9; border-radius: 9px; padding: 12px 14px; color: #2b2940; background: #fafaff; }
.student-selected-card.show { display: block; }
.student-selected-card strong { color: var(--fees-indigo-dark); }
.pay-section-title { margin: 0 0 10px; color: var(--fees-indigo); font-size: 1.28rem; font-weight: 900; }
.pay-alert { border-radius: 9px; padding: 12px 14px; font-weight: 700; }
.pay-alert-info { color: #343167; background: #f3f2ff; }
.pay-alert-error { color: #92272f; background: #fff0f1; }
#selectedStudentText { margin-bottom: 14px; font-weight: 600; }
.pay-shell .fee-table-wrap { border-color: #ccd0dc; border-radius: 9px 9px 0 0; }
.fee-table-wrap { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; border: 1px solid #ccd0dc; }
.fee-table { width: 100%; min-width: 780px; border-collapse: separate; border-spacing: 0; }
.pay-shell .fee-table th { background: var(--fees-indigo); padding: .95rem .72rem; }
.fee-table th { color: #fff; font-size: .76rem; text-align: center; text-transform: uppercase; }
.pay-shell .fee-table td { border-top: 1px solid #e6e7ee; padding: 1rem .72rem; color: #2c2a40; text-align: center; vertical-align: middle; }
.fee-table tbody tr:nth-child(odd) td { background: #fcfcff; }
.fee-table tbody tr.is-paid td { color: #8a8998; background: #f5f5f8; }
.pay-shell .pay-total { margin-top: 0; border: 1px solid #e0e1e9; border-top: 0; border-radius: 0 0 9px 9px; padding: 18px 22px; background: #fff; font-size: 1.1rem; }
.pay-total { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--fees-indigo-dark); font-weight: 900; }
.pay-shell .pay-btn { min-width: 190px; min-height: 50px; border: 0; border-radius: 9px; padding: 0 20px; font-weight: 850; cursor: pointer; }
.pay-shell .pay-btn:disabled { cursor: not-allowed; opacity: .48; }
.pay-shell .pay-btn-primary { color: #fff; background: var(--fees-indigo); box-shadow: 0 8px 18px rgba(49,39,131,.18); }

@media (max-width: 900px) {
  .school-choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .school-choice-bus { grid-column: 1 / -1; width: min(100%, 440px); justify-self: center; }
  .school-choice { min-height: 470px; }
  .pay-shell .student-search-grid { grid-template-columns: 1fr; gap: 16px; }
}

@media (max-width: 640px) {
  body:has(.school-picker) .site-main,
  body:has(.pay-shell) .site-main { padding-inline: 14px; }
  .school-picker { padding-top: 30px; }
  .school-choice-grid { grid-template-columns: 1fr; }
  .school-choice-bus { grid-column: auto; width: 100%; }
  .school-choice { min-height: 420px; padding: 24px 20px; border-radius: 18px; }
  .school-choice-logo-wrap { min-height: 220px; }
  .school-choice-logo { max-height: 220px; }
  .school-choice-action { min-height: 56px; font-size: .94rem; }
  .pay-shell .pay-hero { align-items: flex-start; padding: 22px 18px; }
  .pay-change-school { min-height: 58px; padding-inline: 18px; }
  .pay-shell .pay-brand { align-items: flex-start; gap: 15px; }
  .pay-shell .pay-brand img,
  .pay-shell .pay-brand-mes img { width: 82px; height: 82px; }
  .pay-shell .pay-title { font-size: 1.75rem; line-height: 1.08; }
  .pay-shell .pay-sub { font-size: .87rem; line-height: 1.4; }
  .pay-shell .pay-panel { padding: 20px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .school-choice,
  .school-choice-action { transition: none; }
}
