*,
*::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: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 226, 221, 0.9);
  border: 1px solid rgba(142, 45, 45, 0.12);
}

.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: #8e2d2d;
  background: rgba(255, 226, 221, 0.9);
  border-color: rgba(142, 45, 45, 0.12);
}

.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[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:focus,
.auth-form select:focus {
  outline: 2px solid rgba(111, 85, 255, 0.18);
  outline-offset: 2px;
}

.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-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);
}

.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%;
  }
}
