/* Public membership application. Row layout matches the site form. */

*, *::before, *::after { box-sizing: border-box; }

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page-bg);
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.bar__logo img { display: block; height: auto; max-width: 108px; }

.bar__sign { margin: 0; font-size: 14px; color: var(--muted); }
.bar__sign a { font-weight: 600; color: var(--brand); text-decoration: none; }
.bar__sign a:hover { text-decoration: underline; }

.wrap {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: min(1180px, calc(100% - 56px));
  margin: 22px 0 0 28px;
}

#apply-form {
  display: flex;
  flex: 1;
  flex-direction: column;
}

h1 { margin: 0 0 10px; font-size: 28px; font-weight: 700; }

.form-intro { margin: 0 0 8px; max-width: 70ch; }
.req-note { margin: 0 0 22px; font-size: 13px; color: var(--muted); }
.req { color: var(--danger); }
.opt { font-weight: 500; color: var(--muted); }

fieldset { margin: 0; padding: 0; border: 0; min-inline-size: 0; }

.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--muted);
}

.steps .is-current { color: var(--ink); font-weight: 700; }
.steps .is-done { color: var(--brand); font-weight: 600; }

.form-heading {
  margin: 8px 0 14px;
  padding-bottom: 10px;
  font-size: 18px;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
}

.form-heading:focus { outline: none; }

.form-col h3.sub { margin-top: 22px; }

.hint { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

.choice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0;
  padding: 6px 0 0;
}

.choice--stack { flex-direction: column; align-items: flex-start; gap: 8px; }

.choice label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.frow textarea {
  width: 100%;
  min-height: 88px;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cfd5e0;
  border-radius: 3px;
  resize: vertical;
}

.frow textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }

.doc {
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
  gap: 8px 24px;
  align-items: center;
  margin-bottom: 16px;
}

.doc label { font-size: 14px; font-weight: 600; }
.doc input[type="file"] { font: inherit; font-size: 14px; }

.frow input[type="file"] { height: auto; padding: 0; border: 0; background: transparent; }

.form-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 64px;
  margin-bottom: 28px;
}

.form-col h3 { margin: 0 0 12px; font-size: 15px; font-weight: 700; }

.frow {
  display: grid;
  grid-template-columns: minmax(140px, 46%) minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  margin-bottom: 8px;
}

.frow > label,
.frow > span { padding-top: 7px; font-size: 14px; }

.choice,
.checks {
  margin: 0;
  border: 0;
  padding: 0;
  min-inline-size: 0;
}

.frow input:not([type="radio"]):not([type="checkbox"]),
.frow select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cfd5e0;
  border-radius: 3px;
}

.frow select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237d879b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
  cursor: pointer;
}

.frow input:not([type="radio"]):not([type="checkbox"]):focus,
.frow select:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.frow input[readonly] { background: #f3f5f8; }
.frow [aria-invalid="true"] { border-color: var(--danger); }

.ffield__error { margin: 4px 0 2px; font-size: 12px; color: var(--danger); }
.ffield__error.is-known {
  margin-top: 6px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--brand-tint);
  border-radius: 6px;
}
.ffield__error.is-known a { color: var(--brand); font-weight: 700; }

.checks { display: grid; gap: 8px; }
.checks label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}
.choice input,
.checks input,
.confirm input {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--brand);
  border: 0;
  background: transparent;
  box-shadow: none;
}

.choice input:focus,
.choice input:focus-visible,
.checks input:focus,
.checks input:focus-visible,
.confirm input:focus,
.confirm input:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border: 0;
}
.checks[aria-invalid="true"] { outline: 1px solid var(--danger); outline-offset: 4px; }

.confirm { margin: 4px 0 8px; }
.confirm label { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; cursor: pointer; }

.form-alert {
  margin: 0 0 16px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: 8px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  width: calc(100vw - 56px);
  margin-top: auto;
  padding: 24px 0 28px;
}

.form-actions [hidden] { display: none !important; }

.form-actions .btn-secondary { margin-right: auto; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cfd5e0;
  border-radius: 8px;
  cursor: pointer;
}

.btn-secondary:hover { background: var(--hover); }

.btn-primary {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 8px;
  cursor: pointer;
}

.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-primary:disabled { opacity: 0.7; cursor: wait; }
.btn-primary:focus-visible,
a:focus-visible,
input:not([type="radio"]):not([type="checkbox"]):focus-visible,
select:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.toast {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 80;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 16px 28px;
  font-size: 15px;
  line-height: 1.45;
  text-align: center;
  color: #fff;
  background: var(--brand);
  border-radius: 0;
  box-shadow: 0 8px 24px rgba(10, 20, 40, 0.18);
  animation: toast-in 0.18s ease-out;
}

.toast--bad { background: var(--danger); }

.toast[hidden] { display: none; }

@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
}

@media (max-width: 800px) {
  .form-card { grid-template-columns: 1fr; gap: 8px; }
}

@media (max-width: 700px) {
  .bar { padding: 16px; }
  .wrap { width: calc(100% - 32px); margin: 20px 0 0 16px; }
  .frow { grid-template-columns: 1fr; gap: 4px; }
  .frow > label,
  .frow > span { padding-top: 0; }
  .form-actions { width: 100%; flex-direction: column; }
  .doc { grid-template-columns: 1fr; }
  .btn-primary, .btn-secondary { width: 100%; justify-content: center; }
}

/* Cancel sits with Next on the right; only Back is pushed to the left. */
.form-actions .btn-cancel { margin-right: 0; }

.leave-dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 24px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(10, 20, 40, 0.3);
}

.leave-dialog::backdrop { background: rgba(10, 18, 30, 0.5); }
.leave-dialog h2 { margin: 0 0 8px; font-size: 18px; }
.leave-dialog p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted); }
.leave-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
