:root {
      --flywire-blue: #0067b8;
      --flywire-dark: #0f172a;
      --flywire-gray: #64748b;
      --hull-blue: #003366;
      --blue: #0066cc;
      --blue-hover: #0052a3;
      --teal: #0d9488;
      --text: #1e293b;
      --muted: #64748b;
      --border: #e2e8f0;
      --light-blue: #e0f2fe;
      --radius: 6px;
    }
    * { margin: 0; padding: 0; box-sizing: border-box; }
    body {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
      background: #fff;
      color: var(--text);
      line-height: 1.5;
      min-height: 100vh;
    }
    .page { display: none; min-height: 100vh; }
    .page.active { display: flex; flex-direction: column; }

    /* ========== FLYWIRE HOMEPAGE ========== */
    .header {
      background: #0f172a;
      color: #fff;
      padding: 14px 0;
    }
    .header-inner {
      max-width: 1200px;
      margin: 0 auto;
      padding: 0 24px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .logo img { height: 28px; width: auto; display: block; }
    .nav { display: flex; gap: 28px; align-items: center; }
    .nav a { color: #cbd5e1; text-decoration: none; font-size: 14px; font-weight: 500; }
    .nav a:hover { color: #fff; }
    .payers-badge {
      display: flex; border: 1px solid #3b82f6; border-radius: 999px; overflow: hidden; font-size: 13px;
    }
    .payers-badge .active { background: #3b82f6; color: #fff; padding: 6px 14px; }
    .payers-badge .inactive { padding: 6px 14px; color: #94a3b8; }

    .hero {
      background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
      color: #fff;
      padding: 80px 24px 100px;
      text-align: center;
    }
    .hero h1 {
      font-size: 36px; font-weight: 700; max-width: 700px; margin: 0 auto 16px; line-height: 1.3;
    }
    .hero p { font-size: 18px; color: #94a3b8; max-width: 560px; margin: 0 auto; }

    .institutions {
      max-width: 640px;
      margin: -60px auto 60px;
      background: #fff;
      border-radius: 16px;
      box-shadow: 0 20px 40px rgba(0,0,0,0.12);
      padding: 40px 36px;
      position: relative;
      z-index: 10;
    }
    .institutions__eyebrow {
      font-size: 13px; font-weight: 600; color: var(--flywire-blue);
      text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;
    }
    .institutions__title {
      font-size: 22px; font-weight: 600; margin-bottom: 20px; color: var(--flywire-dark);
    }
    .institutions__title strong { font-weight: 700; }
    .institutions select {
      width: 100%; height: 52px; padding: 0 16px; border: 1px solid #cbd5e1;
      border-radius: 8px; font-size: 15px; font-family: inherit; background: #fff;
      margin-bottom: 20px; appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
      background-repeat: no-repeat; background-position: right 14px center;
    }
    .institutions select:focus {
      outline: none; border-color: var(--flywire-blue);
      box-shadow: 0 0 0 3px rgba(0,103,184,0.15);
    }
    .institutions select:disabled {
      background: #f1f5f9; color: #94a3b8; cursor: not-allowed;
    }
    .btn-continue {
      width: 100%; height: 52px; background: var(--flywire-blue); color: #fff;
      border: none; border-radius: 8px; font-size: 16px; font-weight: 600;
      cursor: pointer; font-family: inherit; margin-top: 8px;
    }
    .btn-continue:hover { background: #005a9e; }
    .btn-continue:disabled { background: #94a3b8; cursor: not-allowed; }

    .video-section { max-width: 900px; margin: 0 auto 80px; padding: 0 24px; }
    .video-section h2 { text-align: center; font-size: 28px; font-weight: 700; margin-bottom: 32px; }
    .video-container {
      position: relative; width: 100%; padding-bottom: 56.25%;
      background: #0f172a; border-radius: 12px; overflow: hidden;
      box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    }
    .video-container iframe {
      position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0;
    }

    .transcript { max-width: 900px; margin: 0 auto 80px; padding: 0 24px; }
    .transcript details {
      background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 12px; overflow: hidden;
    }
    .transcript summary {
      padding: 18px 24px; font-weight: 600; font-size: 16px; cursor: pointer;
      list-style: none; display: flex; justify-content: space-between; align-items: center;
    }
    .transcript summary::-webkit-details-marker { display: none; }
    .transcript .content { padding: 0 24px 24px; font-size: 15px; color: #334155; line-height: 1.7; }
    .transcript .content p { margin-bottom: 14px; }

    .testimonials { background: #f8fafc; padding: 80px 24px; }
    .testimonials h2 { text-align: center; font-size: 28px; font-weight: 700; margin-bottom: 48px; }
    .testimonial-grid {
      max-width: 1100px; margin: 0 auto;
      display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 28px;
    }
    .testimonial-card {
      background: #fff; border-radius: 12px; padding: 28px;
      box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    }
    .testimonial-card p { font-size: 15px; color: #334155; margin-bottom: 20px; line-height: 1.6; }
    .testimonial-card .author { font-weight: 600; color: var(--flywire-dark); }
    .testimonial-card .school { font-size: 13px; color: var(--flywire-gray); }

    .fw-footer {
      background: #0f172a; color: #94a3b8; padding: 48px 24px 32px; text-align: center;
    }
    .fw-footer img { height: 28px; margin-bottom: 16px; filter: brightness(0) invert(1); }
    .fw-footer p { font-size: 13px; margin-top: 20px; }

    /* ========== HULL PAYMENT STYLES ========== */
    .welcome-header {
      display: flex; justify-content: space-between; align-items: center;
      padding: 14px 40px; border-bottom: 1px solid #e5e7eb; background: #fff;
    }
    .logo-area img { height: 52px; width: auto; display: block; }
    .header-links { display: flex; gap: 24px; align-items: center; font-size: 14px; }
    .header-links a { color: #334155; text-decoration: none; }
    .welcome-body {
      flex: 1; display: flex; flex-direction: column; align-items: center;
      justify-content: center; text-align: center; padding: 60px 20px; background: #fff;
    }
    .welcome-body h1 { font-size: 28px; font-weight: 600; margin-bottom: 32px; }
    .btn-start {
      background: var(--blue); color: #fff; border: none; padding: 12px 28px;
      font-size: 15px; font-weight: 600; border-radius: 4px; cursor: pointer;
    }
    .btn-start:hover { background: var(--blue-hover); }
    .welcome-footer {
      border-top: 1px solid #e5e7eb; padding: 16px 40px; font-size: 12px; color: #64748b;
      display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; background: #fff;
    }
    .welcome-footer a { color: var(--blue); text-decoration: none; }

    .ms-bg { background: linear-gradient(135deg, #d4e4f7 0%, #e8f0e3 40%, #f5e8d3 70%, #e0d4e8 100%); }
    .ms-card {
      background: #fff; width: 440px; max-width: 92vw; margin: auto;
      padding: 40px 44px 28px; box-shadow: 0 2px 6px rgba(0,0,0,0.2), 0 10px 20px rgba(0,0,0,0.1);
    }
    .ms-logo-row { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
    .ms-logo-row img.hull-logo { height: 40px; width: auto; }
    .ms-title { font-size: 24px; font-weight: 600; margin-bottom: 16px; }
    .ms-email-display { font-size: 15px; margin-bottom: 18px; display: flex; align-items: center; gap: 8px; }
    .ms-email-display .back { cursor: pointer; color: #0067b8; font-size: 18px; }
    .ms-field { margin-bottom: 16px; }
    .ms-field input {
      width: 100%; border: none; border-bottom: 1px solid #605e5c;
      padding: 8px 0; font-size: 15px; outline: none; background: transparent;
    }
    .ms-field input:focus { border-bottom-color: #0067b8; }
    .ms-links { margin: 12px 0 28px; font-size: 13px; }
    .ms-links a { color: #0067b8; text-decoration: none; display: block; margin-bottom: 8px; }
    .ms-actions { display: flex; justify-content: flex-end; }
    .ms-btn {
      background: #0067b8; color: #fff; border: none; padding: 8px 28px;
      font-size: 15px; font-weight: 600; border-radius: 2px; cursor: pointer;
    }
    .ms-btn:hover { background: #005a9e; }
    .ms-options { margin-top: 28px; padding-top: 16px; border-top: 1px solid #edebe9; text-align: center; }
    .ms-options a { color: #0067b8; text-decoration: none; font-size: 13px; }

    .success-overlay {
      position: fixed; inset: 0; background: #fff;
      display: none; align-items: center; justify-content: center;
      z-index: 100; flex-direction: column; gap: 16px;
    }
    .success-overlay.show { display: flex; }
    .success-icon {
      width: 72px; height: 72px; background: #107c10; color: #fff;
      border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 36px;
    }

    .progress-bar { border-bottom: 1px solid var(--border); padding: 18px 24px; background: #fff; }
    .progress-inner {
      max-width: 960px; margin: 0 auto; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap;
    }
    .step { font-size: 14px; font-weight: 500; color: #94a3b8; white-space: nowrap; }
    .step.active, .step.completed { color: var(--teal); font-weight: 600; }
    .container { flex: 1; max-width: 640px; width: 100%; margin: 0 auto; padding: 48px 24px 80px; }
    .pay-page { display: none; }
    .pay-page.active { display: block; animation: fade 0.25s ease; }
    @keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
    h1 { font-size: 28px; font-weight: 700; text-align: center; margin-bottom: 40px; color: #0f172a; }
    .field { margin-bottom: 20px; }
    .label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; color: #334155; }
    input[type="text"], input[type="email"], input[type="tel"],
    input[type="date"], input[type="number"], select {
      width: 100%; height: 48px; padding: 0 14px; border: 1px solid #cbd5e1;
      border-radius: var(--radius); font-size: 15px; font-family: inherit;
    }
    input:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,102,204,0.12); }
    .amount-wrap { display: flex; height: 48px; }
    .amount-prefix {
      width: 48px; display: flex; align-items: center; justify-content: center;
      background: #f8fafc; border: 1px solid #cbd5e1; border-right: none;
      border-radius: var(--radius) 0 0 var(--radius); font-weight: 500; color: #64748b;
    }
    .amount-wrap input { border-radius: 0 var(--radius) var(--radius) 0; flex: 1; }
    .hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
    .info {
      background: var(--light-blue); border-radius: 8px; padding: 12px 16px;
      font-size: 14px; color: #1e3a5f; margin-bottom: 24px; display: flex; gap: 10px;
    }
    .check { display: flex; gap: 10px; align-items: flex-start; margin: 24px 0 16px; }
    .check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--blue); }
    .check label { font-size: 14px; }
    .check a { color: var(--blue); text-decoration: none; }
    .footnote { font-size: 12px; color: var(--muted); margin-top: 8px; }
    .radio-list { margin: 20px 0 32px; }
    .radio-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; cursor: pointer; }
    .radio-item input { width: 18px; height: 18px; accent-color: var(--blue); }
    .amount-block { text-align: center; margin-bottom: 32px; }
    .amount-block .sub { font-size: 15px; color: var(--muted); margin-bottom: 4px; }
    .amount-block .main-amt { font-size: 24px; font-weight: 700; }
    .section { padding: 24px 0; border-top: 1px solid var(--border); }
    .section-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; text-align: center; }
    .grid-2 {
      display: grid; grid-template-columns: 1fr 1fr; gap: 16px 32px;
      max-width: 480px; margin: 0 auto;
    }
    .meta { text-align: center; }
    .meta label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 2px; }
    .meta .val { font-size: 15px; font-weight: 500; }
    .actions {
      display: flex; justify-content: space-between; align-items: center; margin-top: 40px; gap: 16px;
    }
    .btn {
      display: inline-flex; align-items: center; justify-content: center; gap: 6px;
      height: 44px; padding: 0 24px; font-size: 15px; font-weight: 600;
      border-radius: 6px; border: none; cursor: pointer; font-family: inherit;
    }
    .btn-primary { background: var(--blue); color: #fff; }
    .btn-primary:hover { background: var(--blue-hover); }
    .btn-outline { background: #fff; color: var(--blue); border: 1px solid #cbd5e1; }
    .success-wrap { text-align: center; }
    .success-msg { max-width: 520px; margin: 0 auto 28px; font-size: 15px; color: var(--muted); line-height: 1.6; }
    .table-wrap { margin-top: 40px; text-align: left; }
    .table-wrap h2 { font-size: 18px; font-weight: 600; text-align: center; margin-bottom: 20px; }
    table { width: 100%; border-collapse: collapse; font-size: 14px; }
    th { text-align: left; font-weight: 500; color: var(--muted); padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
    td { padding: 16px 0; border-bottom: 1px solid var(--border); }
    .status-red { color: #dc2626; font-weight: 600; }
    .countdown {
      background: #fef3c7; border: 1px solid #f59e0b; border-radius: 8px;
      padding: 12px 16px; text-align: center; margin: 20px 0; font-size: 15px; color: #92400e;
    }
    .countdown strong { font-size: 18px; }
    .sent-link {
      display: inline-block; margin-top: 20px; color: var(--blue);
      font-weight: 600; text-decoration: underline; cursor: pointer; font-size: 15px;
    }
    footer { border-top: 1px solid var(--border); padding: 40px 24px 32px; background: #fff; }
    .footer-grid {
      max-width: 960px; margin: 0 auto;
      display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 28px;
    }
    .footer-col h4 { font-size: 13px; font-weight: 600; margin-bottom: 12px; }
    .footer-col a { display: block; font-size: 13px; color: var(--muted); text-decoration: none; margin-bottom: 6px; }
    .footer-bottom {
      max-width: 960px; margin: 28px auto 0; padding-top: 20px;
      border-top: 1px solid var(--border); font-size: 12px; color: #94a3b8;
    }

    .final-success {
      display: none; flex-direction: column; align-items: center; justify-content: center;
      min-height: 100vh; text-align: center; padding: 40px 20px; background: #fff;
    }
    .final-success.show { display: flex; }
    .final-success .icon {
      width: 90px; height: 90px; background: #107c10; color: #fff;
      border-radius: 50%; display: flex; align-items: center; justify-content: center;
      font-size: 48px; margin-bottom: 24px;
    }
    .final-success h1 { font-size: 28px; margin-bottom: 12px; }
    .final-success .amount { font-size: 32px; font-weight: 700; color: #0f172a; margin: 16px 0; }
    .final-success .meta { font-size: 15px; color: var(--muted); margin-top: 8px; }

    #invoice-wrapper { position: absolute; left: -9999px; top: 0; width: 210mm; }
    #invoice {
      width: 210mm; min-height: 297mm; padding: 15mm 16mm;
      font-family: Arial, Helvetica, sans-serif; font-size: 10.5pt; color: #222; background: #fff;
    }
    #invoice .top-header { display: flex; justify-content: space-between; margin-bottom: 20px; }
    #invoice .uni-logo { font-size: 18px; font-weight: 700; color: #003366; }
    #invoice .company-info { text-align: right; font-size: 9pt; color: #444; }
    #invoice h1 { font-size: 26pt; margin: 0 0 18px; }
    #invoice .meta-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
    #invoice .meta-table td { padding: 4px 8px 4px 0; vertical-align: top; font-size: 10pt; }
    #invoice .meta-table .label { font-size: 8.5pt; color: #666; display: block; }
    #invoice .amounts-table { width: 100%; border-collapse: collapse; margin: 12px 0 18px; }
    #invoice .amounts-table th, #invoice .amounts-table td {
      padding: 6px 8px; border-bottom: 1px solid #ddd; font-size: 10pt; text-align: left;
    }
    #invoice .amounts-table th { background: #f8fafc; font-weight: 600; }
    #invoice .section-title { font-size: 11pt; font-weight: 700; margin: 18px 0 8px; }
    #invoice .bank-table { width: 100%; border-collapse: collapse; }
    #invoice .bank-table td { padding: 3px 0; font-size: 10pt; vertical-align: top; }
    #invoice .bank-table td:first-child { width: 130px; color: #555; font-weight: 600; }
    #invoice .footer {
      margin-top: 30px; padding-top: 12px; border-top: 1px solid #ddd;
      font-size: 8.5pt; color: #666; display: flex; justify-content: space-between;
    }

    @media (max-width: 600px) {
      .hero h1 { font-size: 26px; }
      .institutions { margin: -40px 16px 40px; padding: 28px 20px; }
      .nav { display: none; }
      .welcome-header { padding: 12px 16px; }
      .ms-card { padding: 28px 24px; }
      .grid-2 { grid-template-columns: 1fr; }
      .actions { flex-direction: column-reverse; }
      .btn { width: 100%; }
    }

/* Hull logo fixes */
.logo-area img,
.ms-logo-row img.hull-logo {
  height: 48px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  display: block;
}
.ms-logo-row img.hull-logo {
  height: 40px;
}


/* Page transition loading overlay */
#pageLoadingOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.92);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
#pageLoadingOverlay.show {
  display: flex;
}
.page-loading-box {
  text-align: center;
  padding: 32px;
}
.page-loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e2e8f0;
  border-top-color: #0066cc;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.page-loading-text {
  font-size: 18px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 6px;
}
.page-loading-dots {
  font-size: 14px;
  color: #64748b;
}
