:root {
  --bg: #f7fbff;
  --panel: #ffffff;
  --text: #17324d;
  --muted: #6b7280;
  --line: #d8e7f5;
  --accent: #1769aa;
  --accent-dark: #0f4f81;
  --accent-warm: #f28c00;
  --error-bg: #fef2f2;
  --error-text: #991b1b;
  --success-text: #166534;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
  padding: 20px;
}

main.narrow {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 48px rgba(24, 32, 47, 0.08);
}

h1 {
  margin: 0 0 8px;
  font-size: 1.8rem;
  line-height: 1.1;
}

p {
  margin: 0 0 20px;
  color: var(--muted);
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
}

input:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

button {
  width: 100%;
  border: 0;
  border-radius: 6px;
  margin-top: 16px;
  padding: 12px 18px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

button:hover {
  background: var(--accent-dark);
}

.button-link {
  display: inline-block;
  border: 0;
  border-radius: 6px;
  margin-top: 8px;
  padding: 12px 18px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.button-link:hover {
  background: var(--accent-dark);
}

.error {
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--error-bg);
  color: var(--error-text);
  font-weight: 700;
}

.success-text {
  color: var(--success-text);
  font-size: 1.1rem;
}

.policy-link {
  margin: -6px 0 16px;
  font-size: 0.9rem;
}

.policy-link a {
  color: var(--muted);
}

.policy-link a:hover {
  color: var(--accent);
}

.policy-page p {
  margin-bottom: 14px;
}

.integrity-reminder {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.student-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 2px solid var(--line);
  margin-bottom: 14px;
  padding-bottom: 12px;
}

.brand-logo {
  width: 112px;
  height: 112px;
  object-fit: contain;
}

.brand-fallback {
  display: none;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 2px solid var(--line);
  color: var(--accent);
  background: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.1;
  padding: 5px;
}

.quote-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdff;
  padding: 16px;
}

.quote-card h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.quote-card-caption {
  margin: 0 0 8px;
  font-size: 0.92rem;
  color: var(--muted);
}

.quote-price {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbff;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.progress-card {
  border: 1px solid #bfdbfe;
  background: #f0f7ff;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.progress-card h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.progress-message {
  margin: 10px 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f4f81;
}

.progress-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #64748b;
  font-weight: 600;
}

.progress-marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: #ffffff;
  flex: 0 0 auto;
}

.progress-step.completed {
  color: #166534;
}

.progress-step.completed .progress-marker {
  border-color: #16a34a;
  background: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18);
}

.progress-step.current {
  color: #0f4f81;
}

.progress-step.current .progress-marker {
  border-color: #1769aa;
  background: #1769aa;
  box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.24);
}

.progress-step.upcoming {
  color: #94a3b8;
}

.payment-notice {
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #f0fdf4;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.payment-notice h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  color: #166534;
}

.payment-notice p {
  margin: 0;
  color: #166534;
  font-weight: 700;
}

.payment-link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.payment-link-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdff;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.payment-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.payment-row-status {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.78rem;
  font-weight: 800;
}

.payment-row-status.paid {
  background: #dcfce7;
  color: #166534;
}

.payment-row-status.unpaid {
  background: #fff7ed;
  color: #9a3412;
}

.payment-row-action {
  flex: 0 0 auto;
  margin-top: 0;
}

.tracking-meta {
  margin: 0 0 16px;
  display: grid;
  grid-template-columns: minmax(130px, auto) 1fr;
  gap: 6px 12px;
}

.tracking-meta dt {
  color: var(--muted);
  font-weight: 700;
}

.tracking-meta dd {
  margin: 0;
}

.quote-actions {
  align-items: stretch;
  gap: 10px;
  margin-top: 8px;
}

.quote-actions form {
  flex: 1 1 0;
  margin: 0;
}

.quote-action {
  margin-top: 0;
}

.quote-action-primary {
  background: var(--accent);
  color: #ffffff;
}

.quote-action-primary:hover {
  background: var(--accent-dark);
}

.quote-action-secondary {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #64748b;
}

.quote-action-secondary:hover {
  background: #f8fafc;
  color: #475569;
}

.decline-subtitle {
  margin-bottom: 14px;
}

.decline-form {
  display: grid;
  gap: 12px;
}

.decline-options {
  display: grid;
  gap: 10px;
  margin-bottom: 2px;
}

.decline-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdff;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.decline-option:hover {
  border-color: #b6d4ef;
  background: #f8fbff;
}

.decline-option input[type='radio'] {
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.decline-option:has(input[type='radio']:checked) {
  border-color: var(--accent);
  background: #eef6ff;
  box-shadow: 0 0 0 2px rgba(23, 105, 170, 0.12);
}

.decline-note-wrap {
  display: grid;
  gap: 8px;
}
.decline-followup {
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
  padding: 12px;
  display: grid;
  gap: 10px;
  transition: opacity 0.2s ease;
}
.decline-followup[hidden] {
  display: none !important;
  opacity: 0;
}
.decline-followup-text {
  margin: 0;
  color: #334155;
  font-weight: 500;
}

.decline-note-wrap textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
  min-height: 120px;
  resize: vertical;
}

.decline-note-wrap textarea:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

.decline-actions {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.button-link-light {
  display: inline-block;
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 10px 14px;
  background: #ffffff;
  color: #475569;
  text-align: center;
  text-decoration: none;
  font-weight: 600;
}

.button-link-light:hover {
  background: #f8fafc;
  color: #334155;
}

.back-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.95rem;
}

@media (max-width: 640px) {
  .quote-actions {
    flex-direction: column;
  }

  .quote-actions form {
    flex: 1 1 auto;
  }

  .progress-step {
    align-items: flex-start;
  }

  .payment-link-row {
    align-items: stretch;
    flex-direction: column;
  }

  .payment-row-action {
    width: 100%;
    text-align: center;
  }

  .brand-logo,
  .brand-fallback {
    width: 96px;
    height: 96px;
  }

  h1 {
    font-size: 1.6rem;
  }
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-warm);
}

main.portal-layout {
  width: min(760px, 100%);
  padding: 28px;
  border-radius: 16px;
}
main.portal-dashboard {
  width: min(900px, 100%);
}
.portal-layout {
  overflow-wrap: anywhere;
}
.portal-layout h1 {
  font-size: 2rem;
}
.portal-layout h2 {
  line-height: 1.3;
}
.portal-layout .brand-logo,
.portal-layout .brand-fallback {
  width: 84px;
  height: 84px;
  flex-shrink: 0;
}
.portal-layout .student-brand {
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 18px;
}
.portal-brand-subtitle {
  margin: 6px 0 0;
}
.portal-account-bar,
.portal-dashboard-heading,
.portal-card-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.portal-account-bar {
  margin-bottom: 22px;
  font-size: 0.9rem;
}
.portal-account-bar p,
.portal-dashboard-heading p {
  margin: 0;
}
.portal-account-bar form {
  flex-shrink: 0;
}
.portal-layout .portal-signout {
  width: auto;
  margin: 0;
  padding: 6px 0;
  background: transparent;
  color: var(--accent);
  font-weight: 400;
  text-decoration: underline;
}
.portal-dashboard-heading {
  margin-bottom: 24px;
}
.portal-layout .button-link {
  margin-top: 0;
  text-align: center;
}
.portal-dashboard-heading .button-link {
  flex-shrink: 0;
}
.portal-layout .button-link:hover {
  color: white;
}
.portal-order-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.portal-order-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfdff;
}
.portal-card-heading {
  align-items: flex-start;
  gap: 10px;
}
.portal-card-heading h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
}
.portal-card-heading h2 a {
  color: var(--text);
  text-decoration: none;
}
.portal-card-heading h2 a:hover {
  text-decoration: underline;
}
.portal-card-heading p {
  margin: 0;
  font-size: 0.9rem;
}
.portal-status {
  border-radius: 6px;
  padding: 4px 8px;
  background: #eaf3fc;
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  max-width: 45%;
}
.portal-order-id {
  margin: 14px 0;
  font-size: 0.82rem;
}
.portal-order-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 18px;
}
.portal-order-summary dt {
  color: var(--muted);
  font-size: 0.85rem;
}
.portal-order-summary dd {
  margin: 3px 0 0;
  font-weight: 700;
}
.portal-view-order {
  display: inline-flex;
  justify-content: space-between;
  width: 100%;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  font-weight: 700;
  text-decoration: none;
}
.portal-empty-state {
  border: 1px dashed #b6d4ef;
  border-radius: 12px;
  padding: 28px;
  background: #f8fbff;
}
.portal-empty-state h2 {
  margin: 0 0 12px;
  font-size: 1.35rem;
}
.portal-empty-note {
  margin: 20px 0 0;
  font-size: 0.9rem;
}
.portal-linking-help {
  margin-top: 24px;
}
.portal-order-nav {
  margin: 0 0 20px;
}
.portal-progress-card {
  padding: 18px 20px;
  border: 1px solid #b6d4ef;
  border-radius: 12px;
  background: #f0f7ff;
  margin-bottom: 20px;
}
.portal-progress-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.portal-progress-heading h2 {
  font-size: 1.15rem;
  margin: 0;
}
.portal-stage-count {
  flex-shrink: 0;
  color: var(--accent-dark);
  font-size: 0.8rem;
}
.portal-progress-card > p {
  margin: 12px 0;
  font-size: 0.95rem;
}
.portal-progress-track {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 16px 0;
  width: min(280px, 100%);
}
.portal-progress-track li {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}
.portal-progress-track li:last-child {
  flex: 0;
}
.portal-progress-track li:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 0;
  height: 2px;
  background: #cbd5e1;
}
.portal-progress-track li.completed::after {
  background: #16a34a;
}
.portal-progress-track span {
  position: relative;
  z-index: 1;
  width: 12px;
  height: 12px;
  border: 2px solid #b6c8da;
  border-radius: 50%;
  background: #f0f7ff;
}
.portal-progress-track .completed span {
  background: #16a34a;
  border-color: #16a34a;
}
.portal-progress-track .current span {
  background: var(--accent);
  border-color: var(--accent);
  outline: 3px solid #c7ddf1;
  outline-offset: 1px;
}
.portal-progress-stages {
  margin-top: 12px;
}
.portal-progress-stages summary {
  width: fit-content;
  font-size: 0.85rem;
  color: var(--accent-dark);
  cursor: pointer;
}
.portal-progress-stages .progress-steps {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #d1e2f2;
  font-size: 0.9rem;
  gap: 8px;
}
.portal-layout .form-section {
  margin: 20px 0;
}
.portal-layout .quote-card {
  padding: 20px;
  border-radius: 12px;
}
.portal-layout .button-link-light {
  width: auto;
}
.portal-details {
  display: grid;
  grid-template-columns: minmax(100px, 130px) minmax(0, 1fr);
  gap: 10px 16px;
  margin: 16px 0 0;
}
.portal-details dt {
  color: var(--muted);
}
.portal-details dd {
  margin: 0;
}
.portal-paid-label {
  color: #166534;
  font-size: 0.85rem;
  font-weight: 700;
}
.portal-submitted-documents {
  margin-top: 20px;
}
.portal-submitted-documents h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}
.portal-submitted-documents :is(p, ul) {
  margin: 0;
}
.portal-disclosure > summary {
  font-weight: 700;
  cursor: pointer;
}
.portal-disclosure > summary:hover {
  color: var(--accent);
}
.portal-disclosure-body {
  padding-top: 16px;
}
.portal-history-entry {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.portal-history-entry > summary {
  cursor: pointer;
  font-size: 0.9rem;
}
.portal-history-entry p {
  margin: 14px 0 0;
  white-space: pre-wrap;
}
.portal-order-history {
  margin-top: 16px;
}
.portal-order-history > summary {
  width: fit-content;
  color: #596579;
  font-size: 0.85rem;
  font-weight: 400;
  cursor: pointer;
}
.portal-order-history > summary:hover {
  color: var(--accent);
}
.portal-support {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 18px;
}
.portal-support p {
  margin-bottom: 4px;
}
.portal-revision-list > li {
  margin-bottom: 20px;
}
.portal-revision-list p {
  white-space: pre-wrap;
  margin: 8px 0;
}
.portal-layout :is(input, textarea, select) {
  max-width: 100%;
  font: inherit;
}
.portal-layout textarea {
  width: 100%;
  min-height: 110px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}
.portal-layout select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}
.portal-layout form > label {
  margin-top: 16px;
}
.portal-layout :is(a, button, summary):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
@media (max-width: 700px) {
  .portal-order-list {
    grid-template-columns: 1fr;
  }
  .portal-dashboard-heading {
    align-items: stretch;
    flex-direction: column;
  }
}
@media (max-width: 480px) {
  main.portal-layout {
    padding: 18px;
  }
  .portal-layout h1 {
    font-size: 1.65rem;
  }
  .portal-layout .brand-logo,
  .portal-layout .brand-fallback {
    width: 68px;
    height: 68px;
  }
  .portal-layout .student-brand {
    gap: 12px;
  }
  .portal-layout .quote-card,
  .portal-empty-state,
  .portal-progress-card,
  .portal-order-card {
    padding: 16px;
  }
  .portal-details {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .portal-details dd {
    margin-bottom: 12px;
  }
  .portal-layout .tracking-meta {
    grid-template-columns: 90px minmax(0, 1fr);
    font-size: 0.9rem;
  }
}

#verification-resend:disabled {
  opacity: 0.55;
  cursor: wait;
}
