:root {
  --red: #e11d1d;
  --red-hover: #c21414;
  --text: #111827;
  --muted: #4b5563;
  --border: #e5e7eb;
  --page: #f4f5f7;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button, input { font: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid rgba(225, 29, 29, .22); outline-offset: 2px; }

.page { min-height: 100vh; display: grid; place-items: center; padding: 38px 30px; }
.signup-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(620px, 1fr) auto;
  width: min(1100px, 100%);
  min-height: 700px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(17, 24, 39, .05);
  border-radius: 22px;
  box-shadow: 0 18px 55px rgba(17, 24, 39, .1);
}
.form-side { padding: 34px clamp(38px, 5.3vw, 76px) 30px; display: flex; flex-direction: column; justify-content: center; }
.tabs { display: flex; gap: 34px; border-bottom: 1px solid var(--border); margin-bottom: 31px; }
.tab { position: relative; border: 0; padding: 0 4px 14px; background: transparent; color: #6b7280; font-size: 15px; font-weight: 600; cursor: pointer; }
.tab.active { color: var(--text); }
.tab.active::after { content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--red); }
.form-heading { margin-bottom: 24px; }
.form-heading h1 { max-width: 390px; margin: 0 0 11px; font-size: clamp(29px, 2.35vw, 34px); line-height: 1.14; letter-spacing: -.8px; font-weight: 750; }
.form-heading p { max-width: 390px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.form-panel[hidden] { display: none; }
.field { margin-bottom: 15px; }
.field label { display: block; margin-bottom: 7px; color: #374151; font-size: 13px; font-weight: 600; }
.optional-label { color: #89919d; font-size: 11px; font-weight: 400; }
.role-field { min-width: 0; margin: 0 0 16px; padding: 0; border: 0; }
.role-field legend { margin-bottom: 8px; color: #374151; font-size: 13px; font-weight: 650; }
.required-label { color: #89919d; font-size: 11px; font-weight: 400; }
.role-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.role-option { position: relative; min-width: 0; }
.role-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.role-option label { display: flex; min-height: 64px; flex-direction: column; justify-content: center; gap: 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; cursor: pointer; transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease; }
.role-option input:checked + label { border-color: var(--red); background: #fff7f7; box-shadow: 0 0 0 2px rgba(225, 29, 29, .08); }
.role-option input:focus-visible + label { outline: 2px solid var(--red); outline-offset: 2px; }
.role-option-title { color: var(--text); font-size: 13px; font-weight: 700; }
.role-option-description { color: #7b8492; font-size: 11px; line-height: 1.35; }
.role-field .error { display: block; min-height: 0; margin-top: 4px; }
.role-field .error:empty { display: none; }
.input-wrap { position: relative; display: flex; align-items: center; }
.field-icon { position: absolute; z-index: 1; left: 14px; width: 19px; height: 19px; fill: none; stroke: #89919d; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.input-wrap input { width: 100%; height: 49px; padding: 0 45px 0 44px; border: 1px solid var(--border); border-radius: 9px; background: #fff; color: var(--text); font-size: 14px; transition: border-color 150ms ease, box-shadow 150ms ease; }
.input-wrap input::placeholder { color: #9ca3af; opacity: 1; }
.input-wrap input:focus { border-color: rgba(225, 29, 29, .65); box-shadow: 0 0 0 3px rgba(225, 29, 29, .08); outline: none; }
.input-wrap input[aria-invalid="true"] { border-color: var(--red); }
.password-toggle { position: absolute; right: 10px; display: grid; width: 32px; height: 32px; place-items: center; border: 0; border-radius: 6px; background: transparent; color: #6b7280; cursor: pointer; }
.password-toggle:hover { color: var(--red); background: #fff5f5; }
.password-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.error { display: block; min-height: 0; margin-top: 4px; color: var(--red); font-size: 12px; line-height: 1.3; }
.error:empty { display: none; }
.submit-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 49px; margin-top: 6px; border: 0; border-radius: 9px; background: var(--red); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; transition: background 150ms ease, transform 150ms ease, opacity 150ms ease; }
.submit-button:hover { background: var(--red-hover); }
.submit-button:active { transform: translateY(1px); }
.submit-button:disabled {
  background: #d1d5db;
  color: #6b7280;
  cursor: not-allowed;
  transform: none;
}
.submit-button:disabled:hover { background: #d1d5db; }
.submit-button.is-loading { pointer-events: none; }
.submit-button .verify-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: society-code-spin .6s linear infinite;
}
.submit-button.is-loading .verify-spinner { display: inline-block; }

.otp-section { margin-top: 8px; }
.otp-boxes { display: flex; gap: 8px; }
.otp-digit {
  width: 46px;
  height: 52px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}
.otp-digit:focus { border-color: rgba(225, 29, 29, .65); box-shadow: 0 0 0 3px rgba(225, 29, 29, .08); outline: none; }
.otp-timer { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
.otp-resend { display: inline-block; margin: 10px 0 0; background: none; border: 0; padding: 0; }
.otp-resend:disabled { color: #9ca3af; cursor: not-allowed; }

.society-code-row { display: flex; align-items: stretch; gap: 8px; }
.society-code-row .input-wrap { flex: 1; min-width: 0; }
.society-code-row .input-wrap input { text-transform: uppercase; }
.society-code-row .input-wrap input.is-verified { border-color: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, .1); }
.verify-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 98px;
  height: 49px;
  padding: 0 16px;
  border: 1px solid var(--red);
  border-radius: 9px;
  background: #fff;
  color: var(--red);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, opacity 150ms ease;
}
.verify-button:hover { background: #fff5f5; }
.verify-button:disabled { opacity: .55; cursor: not-allowed; }
.verify-button.is-loading { pointer-events: none; }
.verify-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(225, 29, 29, .25);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: society-code-spin .6s linear infinite;
}
.verify-button.is-loading .verify-spinner { display: inline-block; }
.society-code-name {
  display: block;
  min-height: 0;
  margin-top: 6px;
  color: #15803d;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}
.society-code-name:empty { display: none; }
@keyframes society-code-spin { to { transform: rotate(360deg); } }
.switch-prompt { margin: 18px 0 0; color: var(--muted); text-align: center; font-size: 13px; }
.text-link { display: inline; padding: 0; border: 0; background: none; color: var(--red); font-size: inherit; font-weight: 650; text-decoration: none; cursor: pointer; }
.text-link:hover { color: var(--red-hover); text-decoration: underline; }
.forgot-row { margin-top: 8px; text-align: right; font-size: 12px; }
.hero-side { position: relative; min-height: 620px; overflow: hidden; background: radial-gradient(ellipse at 76% 27%, rgba(255, 255, 255, .92), transparent 38%), linear-gradient(145deg, #fff4f2 0%, #fde5e3 52%, #f9c9c7 100%); }
.hero-side::before, .hero-side::after { content: ""; position: absolute; border: 1px solid rgba(225, 29, 29, .09); border-radius: 50%; }
.hero-side::before { width: 510px; height: 510px; right: -135px; top: 55px; }
.hero-side::after { width: 385px; height: 385px; right: -70px; top: 118px; }
.hero-glow { position: absolute; width: 370px; height: 370px; top: 95px; right: 6%; border-radius: 50%; background: rgba(255, 255, 255, .5); filter: blur(2px); }
.hero-image { position: absolute; z-index: 1; right: 4%; bottom: 55px; width: min(88%, 440px); height: min(78%, 515px); object-fit: contain; object-position: center bottom; color: transparent; font-size: 0; }
.hero-caption { position: absolute; z-index: 2; right: 28px; bottom: 25px; left: 28px; display: flex; align-items: center; gap: 12px; padding: 15px 17px; border: 1px solid rgba(255, 255, 255, .78); border-radius: 12px; background: rgba(255, 255, 255, .83); box-shadow: 0 8px 25px rgba(127, 29, 29, .08); backdrop-filter: blur(8px); }
.caption-mark { display: grid; flex: 0 0 34px; height: 34px; place-items: center; border-radius: 50%; background: var(--red); color: #fff; }
.caption-mark svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hero-caption strong, .hero-caption span:not(.caption-mark) { display: block; }
.hero-caption strong { margin-bottom: 3px; font-size: 13px; }
.hero-caption div > span { color: var(--muted); font-size: 12px; }
.benefits { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); align-items: center; gap: 18px; min-height: 91px; padding: 18px 36px; background: #fff4f3; border-top: 1px solid #f9e2e0; }
.benefit { display: flex; align-items: center; gap: 11px; color: #303744; font-size: 13px; font-weight: 600; line-height: 1.35; }
.benefit-icon { display: grid; flex: 0 0 36px; height: 36px; place-items: center; border-radius: 50%; background: #fde2e0; color: var(--red); }
.benefit-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 900px) {
  .page { padding: 24px 18px; }
  .signup-card { grid-template-columns: minmax(0, 1fr) minmax(0, .8fr); grid-template-rows: minmax(600px, 1fr) auto; }
  .form-side { padding-right: 34px; padding-left: 34px; }
  .hero-side { min-height: 600px; }
  .benefits { padding-right: 24px; padding-left: 24px; gap: 12px; }
  .benefit { font-size: 12px; }
}

@media (max-width: 680px) {
  .page { display: block; padding: 18px 12px; }
  .signup-card { display: flex; flex-direction: column; min-height: 0; border-radius: 16px; }
  .form-side { order: 1; padding: 27px 23px 28px; }
  .hero-side { order: 2; min-height: 250px; }
  .hero-image { right: 8%; bottom: 38px; width: 75%; height: 225px; }
  .hero-glow { top: 12px; right: 8%; width: 230px; height: 230px; }
  .hero-side::before { top: -40px; right: -80px; width: 300px; height: 300px; }
  .hero-side::after { top: -5px; right: -35px; width: 220px; height: 220px; }
  .hero-caption { right: 14px; bottom: 12px; left: 14px; padding: 10px 12px; }
  .benefits { order: 3; grid-template-columns: repeat(2, minmax(0, 1fr)); min-height: 0; gap: 15px 10px; padding: 18px; }
  .benefit { align-items: flex-start; font-size: 11px; }
  .benefit-icon { flex-basis: 31px; height: 31px; }
  .tabs { margin-bottom: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* =========================================================
   Toast Notification System (Centered at top)
   ========================================================= */
.toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}

.toast-item {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px 12px 14px;
  border-radius: 9999px;
  background: #18181b;
  color: #f4f4f5;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.32), 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.12);
  animation: toastCenterPop 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast-item.toast-error {
  background: #18181b;
  border: 1px solid rgba(239, 68, 68, 0.45);
  box-shadow: 0 16px 42px rgba(239, 68, 68, 0.2), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.toast-item.toast-success {
  background: #18181b;
  border: 1px solid rgba(34, 197, 94, 0.45);
  box-shadow: 0 16px 42px rgba(34, 197, 94, 0.2), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.toast-item.toast-info,
.toast-item.toast-warning {
  background: #18181b;
  border: 1px solid rgba(234, 179, 8, 0.45);
  box-shadow: 0 16px 42px rgba(234, 179, 8, 0.2), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
}

.toast-error .toast-icon {
  background: rgba(239, 68, 68, 0.16);
  color: #ef4444;
}

.toast-success .toast-icon {
  background: rgba(34, 197, 94, 0.16);
  color: #22c55e;
}

.toast-info .toast-icon,
.toast-warning .toast-icon {
  background: rgba(234, 179, 8, 0.16);
  color: #eab308;
}

.toast-icon svg {
  width: 16px;
  height: 16px;
}

.toast-text {
  max-width: min(520px, 75vw);
  word-break: break-word;
}

.toast-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #a1a1aa;
  font-size: 19px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.toast-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}

.toast-item.toast-dismissing {
  opacity: 0;
  transform: translateY(-16px) scale(0.95);
  pointer-events: none;
}

@keyframes toastCenterPop {
  0% {
    opacity: 0;
    transform: translateY(-24px) scale(0.92);
  }
  60% {
    opacity: 1;
    transform: translateY(4px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
