:root {
  color-scheme: light;
  --bg: #eef2f7;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #111827;
  --muted: #64748b;
  --line: #d8e0ea;
  --sky: #0369a1;
  --sky-dark: #075985;
  --green: #047857;
  --green-dark: #065f46;
  --orange: #b45309;
  --rose: #be123c;
  --focus: #38bdf8;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #ffffff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input:focus {
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.24);
  outline: 0;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  display: block;
  width: 100%;
  margin-bottom: 12px;
  color: #1f2937;
  font-size: 0.95rem;
  font-weight: 800;
}

.page-shell {
  width: min(100% - 24px, 920px);
  margin: 0 auto;
  padding: 32px 0;
}

.form-card {
  overflow: hidden;
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  padding: clamp(28px, 6vw, 46px);
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(3, 105, 161, 0.94), rgba(12, 74, 110, 0.98)),
    linear-gradient(90deg, #0f766e, #0369a1);
}

.hero::after {
  position: absolute;
  inset: auto 0 0;
  height: 6px;
  background: linear-gradient(90deg, #f59e0b, #10b981, #38bdf8);
  content: "";
}

.eyebrow {
  display: inline-flex;
  margin: 0 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  padding: 4px 12px;
  color: #dff6ff;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2.32rem);
  line-height: 1.28;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 720px;
  margin: 14px 0 0;
  color: #e0f2fe;
  font-size: 0.97rem;
}

.application-form {
  display: grid;
  gap: 30px;
  padding: clamp(22px, 5vw, 40px);
}

.form-section {
  display: grid;
  gap: 20px;
}

.form-section h2,
.fee-panel h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  border-bottom: 2px solid var(--sky);
  padding-bottom: 10px;
  color: #0f172a;
  font-size: 1.08rem;
}

.form-section h2 span {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--sky);
  font-size: 0.9rem;
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: #334155;
  font-size: 0.92rem;
  font-weight: 800;
}

strong {
  color: var(--rose);
  font-size: 0.76rem;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.notice {
  margin: -4px 0 14px;
  color: var(--orange);
  font-size: 0.86rem;
  font-weight: 700;
}

.option-panel,
.target-group,
.fee-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel-soft);
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
}

.choice,
.target-choice {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #334155;
  font-weight: 700;
}

.choice input,
.target-choice input {
  width: 19px;
  min-height: 19px;
  accent-color: var(--sky);
}

.conditional-field {
  display: grid;
  gap: 18px;
}

.conditional-field[hidden],
.hidden {
  display: none !important;
}

.nested {
  margin-top: 18px;
}

.target-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.target-choice {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
}

.fee-panel {
  display: grid;
  gap: 14px;
  border-color: #bae6fd;
  background: #f0f9ff;
}

.fee-panel dl {
  display: grid;
  gap: 0;
  margin: 0;
}

.fee-panel dl > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #d7eefb;
  padding: 10px 0;
}

.fee-panel dt {
  color: #334155;
}

.fee-panel dd {
  margin: 0;
  color: #0f172a;
  font-weight: 900;
  white-space: nowrap;
}

.fee-panel .total-row {
  align-items: baseline;
  border-bottom: 0;
  color: #082f49;
  font-size: 1.02rem;
}

.fee-panel .total-row dd {
  color: var(--sky-dark);
  font-size: 1.36rem;
}

.fee-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.turnstile-panel {
  display: grid;
  gap: 8px;
  justify-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.status {
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.92rem;
  font-weight: 700;
}

.status-warning {
  border: 1px solid #fed7aa;
  color: #9a3412;
  background: #fff7ed;
}

.status-error {
  border: 1px solid #fecdd3;
  color: #9f1239;
  background: #fff1f2;
}

.status-success {
  border: 1px solid #bbf7d0;
  color: #166534;
  background: #f0fdf4;
}

.submit-area {
  display: grid;
}

.primary-button,
.secondary-button,
.success-button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  font-weight: 900;
  transition: background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.primary-button {
  color: #ffffff;
  background: linear-gradient(135deg, var(--sky), var(--sky-dark));
  box-shadow: 0 14px 30px rgba(3, 105, 161, 0.25);
}

.success-button {
  color: #ffffff;
  background: var(--green);
  box-shadow: 0 14px 30px rgba(4, 120, 87, 0.2);
}

.secondary-button {
  color: #334155;
  background: #e2e8f0;
}

.primary-button:hover,
.success-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.success-button:hover {
  background: var(--green-dark);
}

.secondary-button:hover {
  background: #cbd5e1;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.62);
}

.modal-card,
.success-card {
  width: min(100%, 620px);
  max-height: min(92vh, 760px);
  overflow: auto;
  border-radius: 12px;
  padding: clamp(22px, 5vw, 32px);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.modal-header h2,
.success-card h2 {
  margin: 0;
  color: #0f172a;
  font-size: 1.35rem;
}

.modal-header p,
.success-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.review-list {
  display: grid;
  gap: 0;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.review-row {
  display: grid;
  grid-template-columns: minmax(112px, 0.72fr) minmax(0, 1.28fr);
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.review-label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.review-value {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #1e293b;
  font-weight: 700;
  white-space: pre-line;
}

.modal-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 18px 0 0;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 14px;
  color: #064e3b;
  background: #ecfdf5;
}

.modal-total strong {
  color: var(--green);
  font-size: 1.22rem;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.success-card {
  display: grid;
  justify-items: center;
  text-align: center;
}

.success-mark {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  background: #d1fae5;
  font-size: 2.6rem;
  font-weight: 900;
}

.trap-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.submission-frame {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  border: 0;
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 16px, 920px);
    padding: 8px 0 24px;
  }

  .form-card,
  .modal-card,
  .success-card {
    border-radius: 8px;
  }

  .two-column,
  .target-grid,
  .modal-actions {
    grid-template-columns: 1fr;
  }

  .choice-row {
    display: grid;
    gap: 12px;
  }

  .fee-panel dl > div,
  .modal-total {
    align-items: flex-start;
    flex-direction: column;
  }

  .review-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
