.auth-modal[hidden] {
  display: none;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  overflow-y: auto;
  padding: 2rem 1rem;
}

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(14, 27, 20, 0.52);
  backdrop-filter: blur(10px);
}

.auth-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(100% - 2rem, 420px);
  margin: 0 auto;
  max-height: calc(100dvh - 4rem);
  overflow-y: auto;
  border-radius: 26px;
  background: #fffdf8;
  border: 1px solid rgba(46, 76, 56, 0.12);
  box-shadow: 0 34px 80px rgba(17, 35, 24, 0.2);
  padding: 1.5rem;
  font-family: "Bricolage Grotesque", "Manrope", sans-serif;
}

.auth-modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: rgba(44, 68, 53, 0.08);
  color: #284832;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.auth-modal-panel {
  display: grid;
  gap: 0.8rem;
}

.auth-modal-panel[hidden] {
  display: none;
}

.auth-modal-kicker {
  margin: 0;
  color: #68806d;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-modal-head {
  display: grid;
  gap: 0.45rem;
}

.auth-modal-panel h2 {
  margin: 0;
  font-family: "Marcellus", "Fraunces", serif;
  font-size: 2rem;
  line-height: 1;
  color: var(--brand-dark);
}

.auth-modal-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.auth-modal-form {
  display: grid;
  gap: 0.72rem;
}

.auth-modal-form[hidden] {
  display: none;
}

.auth-signup-step[hidden] {
  display: none;
}

.auth-modal-form--verify {
  margin-top: 0.3rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(46, 76, 56, 0.1);
}

.auth-modal-form label {
  color: #36513c;
  font-size: 0.88rem;
  font-weight: 800;
}

.auth-required-star {
  color: #c2472f;
  margin-right: 0.15rem;
}

.auth-modal-form input {
  width: 100%;
  padding: 0.94rem 1rem;
  border: 1px solid rgba(64, 100, 72, 0.18);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.auth-modal-form textarea {
  width: 100%;
  padding: 0.94rem 1rem;
  border: 1px solid rgba(64, 100, 72, 0.18);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.auth-password-field {
  position: relative;
}

.auth-password-field > input {
  padding-right: 3.6rem;
}

.auth-password-toggle {
  position: absolute;
  top: 50%;
  right: 0.55rem;
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #5a7360;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}

.auth-password-toggle:hover,
.auth-password-toggle:focus-visible {
  background: rgba(47, 122, 75, 0.1);
  color: #245c39;
  outline: none;
}

.auth-password-toggle__icon {
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-modal-form input:focus-visible {
  outline: 2px solid rgba(217, 137, 43, 0.3);
  outline-offset: 2px;
  border-color: rgba(217, 137, 43, 0.4);
}

.auth-modal-form textarea:focus-visible {
  outline: 2px solid rgba(217, 137, 43, 0.3);
  outline-offset: 2px;
  border-color: rgba(217, 137, 43, 0.4);
}

.auth-primary-button,
.auth-secondary-button,
.auth-link-button,
.auth-google-fallback,
.auth-back-button {
  font-family: "Bricolage Grotesque", "Manrope", sans-serif;
  font-size: 0.96rem;
  cursor: pointer;
}

.auth-primary-button,
.auth-secondary-button,
.auth-link-button {
  border-radius: 16px;
  padding: 0.96rem 1rem;
  font-weight: 800;
}

.auth-primary-button {
  border: 0;
  color: #f8fdf8;
  background: linear-gradient(135deg, #2f7a4b, #245c39);
  box-shadow: 0 12px 28px rgba(47, 122, 75, 0.16);
}

.auth-primary-button:disabled,
.auth-secondary-button:disabled {
  opacity: 0.68;
  cursor: not-allowed;
}

.auth-modal-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 0.8rem;
  align-items: stretch;
}

.auth-secondary-button {
  border: 1px solid rgba(47, 122, 75, 0.18);
  background: #fff;
  color: #245c39;
}

.auth-google-slot {
  display: flex;
  width: 100%;
}

.auth-google-composite {
  display: flex;
  align-items: stretch;
  width: 100%;
  flex: 1 1 auto;
}

.auth-google-button-shell,
.auth-google-fallback {
  width: 100%;
  min-width: 0;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  border: 1px solid rgba(47, 122, 75, 0.18);
  background: #fff;
}

.auth-google-fallback {
  color: #30513d;
  font-size: 0.96rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  appearance: none;
  cursor: pointer;
  padding: 0 1rem;
  text-align: center;
}

.auth-google-button-shell {
  padding: 0.38rem;
  border-radius: 16px;
  border: 1px solid rgba(47, 122, 75, 0.18);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 251, 247, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
  overflow: hidden;
}

.auth-google-loading {
  opacity: 0;
}

.auth-google-fallback svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.auth-google-fallback {
  gap: 0.55rem;
}

.auth-google-button-shell .auth-google-fallback {
  min-height: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  color: #30513d;
}

.auth-google-fallback:focus-visible {
  outline: 3px solid rgba(53, 111, 70, 0.22);
  outline-offset: 2px;
}

.auth-google-button-shell:focus-within {
  border-color: rgba(217, 137, 43, 0.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 0 0 2px rgba(217, 137, 43, 0.16);
}

.auth-google-button-shell > div,
.auth-google-button-shell iframe {
  width: 100% !important;
  min-width: 100% !important;
}

.auth-google-button-shell > div {
  min-width: 100% !important;
  border-radius: 12px;
  overflow: hidden;
}

.auth-google-fallback:disabled {
  opacity: 0.7;
}

.auth-signup-copy {
  margin: 0.15rem 0 -0.15rem;
  color: #68806d;
  font-size: 0.9rem;
  font-weight: 700;
}

.auth-field-note {
  margin: -0.15rem 0 0.1rem;
  color: #68806d;
  font-size: 0.84rem;
  line-height: 1.45;
}

.auth-signup-verify {
  display: grid;
  gap: 0.72rem;
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.auth-signup-verify[hidden] {
  display: none;
}

.auth-link-button {
  width: 100%;
  border: 0;
  background: linear-gradient(135deg, #2f7a4b, #245c39);
  color: #f8fdf8;
  padding: 0.96rem 1rem;
  text-align: center;
  box-shadow: 0 12px 28px rgba(47, 122, 75, 0.16);
}

.auth-inline-link {
  width: fit-content;
  border: 0;
  background: transparent;
  color: #245c39;
  margin-left: auto;
  padding: 0;
  font-family: "Bricolage Grotesque", "Manrope", sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.auth-back-button {
  width: fit-content;
  border: 0;
  background: transparent;
  color: #245c39;
  padding: 0;
  font-weight: 800;
}

.auth-modal-feedback {
  min-height: 1.25rem;
  margin: 0;
  color: #6e7b72;
  font-size: 0.9rem;
  line-height: 1.45;
}

.auth-modal-feedback.is-error {
  color: #b24034;
}

.auth-modal-feedback.is-success {
  color: #267147;
}

body.auth-modal-open {
  overflow: hidden;
}

@media (max-width: 480px) {
  .auth-modal {
    padding: 0.75rem;
  }

  .auth-modal-dialog {
    width: min(100% - 1rem, 420px);
    max-height: calc(100dvh - 1.5rem);
    padding: 1.25rem;
    border-radius: 22px;
  }

  .auth-modal-row {
    grid-template-columns: 1fr;
  }
}
