*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #fff7ef;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: #fffdf9;
  --text: #23160f;
  --muted: #6b5649;
  --line: rgba(113, 74, 46, 0.14);
  --primary: #f1642d;
  --primary-deep: #bf451d;
  --accent: #ffe2b1;
  --violet: #6f55ff;
  --violet-deep: #4f32c8;
  --violet-soft: #eeeaff;
  --violet-line: rgba(111, 85, 255, 0.18);
  --shadow: 0 24px 56px rgba(136, 81, 28, 0.12);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 209, 140, 0.58), transparent 28%),
    radial-gradient(circle at 88% 8%, rgba(111, 85, 255, 0.17), transparent 28%),
    linear-gradient(180deg, #fffaf3 0%, #fff3e5 44%, #fff8f1 100%);
  position: relative;
}

body.auth-modal-open {
  overflow: hidden;
}

.auth-glow {
  position: fixed;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  filter: blur(34px);
  opacity: 0.48;
  pointer-events: none;
}

.auth-glow-left {
  top: -70px;
  left: -90px;
  background: rgba(255, 162, 112, 0.35);
}

.auth-glow-right {
  right: -70px;
  top: 180px;
  background: rgba(111, 85, 255, 0.2);
}

.auth-shell {
  max-width: 760px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 36px 22px 56px;
  position: relative;
  z-index: 1;
}

.auth-card {
  background: var(--panel);
  border: 1px solid rgba(111, 85, 255, 0.12);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.brand-lockup h1,
.panel-head h2 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
}

.brand-lockup h1 {
  font-size: clamp(2.8rem, 7vw, 4.9rem);
  line-height: 0.92;
}

.eyebrow,
.mini-label {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--primary-deep);
}

.auth-card-copy,
.panel-head p,
.auth-section-note,
.role-option small,
.auth-alert p,
.auth-helper,
.otp-copy p,
.auth-inline-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.role-option {
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(113, 74, 46, 0.08);
}

.auth-card {
  border-radius: 34px;
  width: 100%;
  max-width: 700px;
  padding: 30px;
}

.auth-card-brand {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.auth-section-note {
  margin-bottom: 18px;
}

.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(35, 22, 15, 0.28);
  backdrop-filter: blur(10px);
}

.auth-modal-backdrop[hidden] {
  display: none !important;
}

.auth-modal-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 30px;
  padding: 24px;
  background: rgba(255, 253, 249, 0.96);
  border: 1px solid rgba(111, 85, 255, 0.14);
  box-shadow: var(--shadow);
}

.auth-modal-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.auth-modal-copy {
  margin-bottom: 0;
}

.auth-modal-close {
  border: 1px solid var(--violet-line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font: inherit;
  font-weight: 800;
  padding: 12px 16px;
  border-radius: 16px;
  cursor: pointer;
}

.auth-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px;
  border-radius: 20px;
  background: rgba(255, 248, 237, 0.94);
  border: 1px solid var(--violet-line);
}

.auth-tab,
.auth-submit {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.auth-tab {
  padding: 12px 18px;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.auth-tab.is-active,
.auth-submit {
  background: linear-gradient(135deg, var(--primary) 0%, #ff8a57 100%);
  color: #fff;
  box-shadow: 0 14px 28px rgba(241, 100, 45, 0.22);
}

.auth-alert {
  margin-top: 18px;
  padding: 15px 17px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 241, 245, 0.98) 0%, rgba(255, 218, 229, 0.96) 100%);
  border: 1px solid rgba(190, 18, 60, 0.28);
  box-shadow: 0 18px 38px rgba(190, 18, 60, 0.14);
}

.auth-alert p {
  color: #9f1239;
  font-weight: 800;
}

.auth-inline-status {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 248, 237, 0.94);
  border: 1px solid rgba(113, 74, 46, 0.08);
}

.auth-inline-status[data-tone="success"] {
  color: var(--primary-deep);
  background: rgba(223, 244, 233, 0.9);
  border-color: rgba(33, 92, 69, 0.14);
}

.auth-inline-status[data-tone="warning"] {
  color: #72510a;
  background: rgba(255, 241, 201, 0.96);
  border-color: rgba(138, 92, 10, 0.16);
}

.auth-inline-status[data-tone="error"] {
  color: #9f1239;
  background: linear-gradient(135deg, rgba(255, 241, 245, 0.98) 0%, rgba(255, 218, 229, 0.96) 100%);
  border-color: rgba(190, 18, 60, 0.28);
  box-shadow: 0 18px 38px rgba(190, 18, 60, 0.14);
}

.auth-panel {
  display: none;
  margin-top: 22px;
}

.auth-panel.is-active {
  display: block;
}

.panel-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form-inline {
  display: flex;
  justify-content: flex-end;
  margin-top: -2px;
}

.auth-text-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--violet-deep);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.auth-text-link:hover {
  text-decoration: underline;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 700;
}

.auth-form label:has(:is(input, select, textarea)[required]) > span:first-child,
.auth-required-label {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.auth-form label:has(:is(input, select, textarea)[required]) > span:first-child::after,
.auth-required-label::after {
  content: "*";
  color: var(--violet);
  font-weight: 900;
}

.auth-form label.is-invalid > span:first-child {
  color: #be123c;
}

.auth-form label[hidden],
.otp-card[hidden],
.auth-inline-status[hidden] {
  display: none !important;
}

.auth-form input,
.auth-form select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--text);
}

.auth-form input.is-invalid {
  border-color: #e11d48;
  background: #fff5f7;
  box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.12);
}

.auth-form input:focus,
.auth-form select:focus {
  outline: 2px solid rgba(111, 85, 255, 0.18);
  outline-offset: 2px;
}

.auth-form input.is-invalid:focus {
  outline-color: rgba(225, 29, 72, 0.24);
}

.auth-field-error {
  color: #be123c;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.35;
}

.auth-field-error[hidden] {
  display: none !important;
}

.auth-terms-card {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(113, 74, 46, 0.08);
  text-align: center;
}

.auth-terms-card.is-invalid {
  border-color: #e11d48;
  background: #fff5f7;
  box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.1);
}

.auth-form .auth-terms-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 700;
  text-align: left;
}

.auth-form .auth-terms-check input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  border-radius: 4px;
  box-shadow: none;
  accent-color: var(--primary);
}

.auth-terms-details {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.auth-terms-details summary {
  color: var(--violet-deep);
  cursor: pointer;
  font-weight: 800;
}

.auth-terms-details ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.role-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.role-picker.is-collapsed {
  grid-template-columns: 1fr;
}

.role-option {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  cursor: pointer;
}

.role-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.role-option span {
  font-weight: 800;
}

.role-option.is-selected {
  border-color: var(--violet-line);
  box-shadow: 0 18px 34px rgba(111, 85, 255, 0.1);
}

.role-change-button {
  align-self: flex-start;
  margin-top: -2px;
}

.auth-submit {
  margin-top: 8px;
  padding: 14px 18px;
  border-radius: 16px;
  font-weight: 800;
}

.auth-secondary {
  border: 1px solid rgba(191, 69, 29, 0.12);
  background: rgba(255, 241, 201, 0.72);
  color: var(--primary-deep);
  font: inherit;
  font-weight: 800;
  padding: 14px 18px;
  border-radius: 16px;
  cursor: pointer;
}

.auth-submit:disabled,
.auth-secondary:disabled {
  opacity: 0.72;
  cursor: wait;
}

.otp-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(113, 74, 46, 0.08);
}

.otp-copy {
  display: grid;
  gap: 6px;
}

.otp-copy strong {
  font-size: 1rem;
}

.otp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.otp-actions .auth-submit,
.otp-actions .auth-secondary {
  margin-top: 0;
}

.auth-helper {
  font-size: 0.95rem;
}

@media (max-width: 920px) {
  .auth-shell {
    max-width: 760px;
  }
}

@media (max-width: 640px) {
  .auth-shell {
    padding: 18px 14px 32px;
  }

  .auth-card {
    padding: 22px;
  }

  .brand-lockup h1 {
    font-size: clamp(2.4rem, 11vw, 3.6rem);
  }

  .auth-tabs {
    width: 100%;
    justify-content: stretch;
  }

  .auth-tab {
    flex: 1 1 0;
    text-align: center;
  }

  .auth-grid,
  .role-picker {
    grid-template-columns: 1fr;
  }

  .otp-actions {
    flex-direction: column;
  }

  .auth-modal-backdrop {
    padding: 14px;
  }

  .auth-modal-card {
    max-height: calc(100vh - 28px);
    padding: 20px;
  }

  .auth-modal-header {
    flex-direction: column;
  }

  .auth-modal-close {
    width: 100%;
  }
}
