:root {
  --gt-primary: #079447;
  --gt-primary-bright: #0AAF50;
  --gt-primary-dark: #057A3A;
  --gt-primary-soft: #EAF8EF;
  --gt-bg: #EEF1EE;
  --gt-surface: #FFFFFF;
  --gt-ink: #121212;
  --gt-muted: #707070;
  --gt-border: #E3E6E3;
  --gt-danger: #E53935;
  --gt-handle: #D4D4D4;
  --radius-md: 18px;
  --radius-sheet: 32px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body.auth-body {
  margin: 0;
  font-family: var(--font);
  background: var(--gt-bg);
  color: var(--gt-ink);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.auth-body.is-landing {
  background: #EAF8EF;
}

/* ========== Login shell ========== */
.auth-app {
  width: 100%;
  min-height: 100dvh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow-x: hidden;
}

@media (min-width: 768px) {
  .auth-app {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100dvh;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04), 0 24px 64px rgba(0, 0, 0, 0.08);
  }
}

/* ========== Hero ========== */
.auth-hero {
  position: relative;
  flex: 0 0 auto;
  height: clamp(260px, 42dvh, 380px);
  padding: calc(18px + var(--safe-top)) 16px 40px;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 70% at 50% 110%, rgba(7, 148, 71, 0.14), transparent 60%),
    linear-gradient(180deg, #FFFFFF 0%, #F4FAF6 42%, #E7F5ED 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-hero__glow {
  position: absolute;
  inset: auto 10% 8%;
  height: 40%;
  background: radial-gradient(ellipse at center, rgba(10, 175, 80, 0.18), transparent 70%);
  pointer-events: none;
}

.auth-hero__brand {
  position: relative;
  z-index: 2;
  text-align: center;
  margin-top: 4px;
}

.auth-logo {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  line-height: 1;
}

.auth-logo__pin {
  width: 18px;
  height: 24px;
  margin-bottom: -6px;
  transform: translateX(-18px);
}

.auth-logo__text {
  font-size: clamp(34px, 9vw, 42px);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--gt-primary);
  text-transform: lowercase;
}

.auth-hero__slogan {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.35;
  color: #4a4a4a;
  font-weight: 500;
}

.auth-hero__slogan strong {
  color: var(--gt-primary);
  font-weight: 700;
}

.auth-hero__visual {
  position: relative;
  z-index: 2;
  width: min(100%, 440px);
  margin-top: 8px;
  padding: 0 2px 4px;
  animation: authHeroIn .7s ease both;
}

.auth-hero__image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 210px;
  object-fit: cover;
  object-position: center 45%;
  border-radius: 18px;
  background: #eaf6ef;
  box-shadow:
    0 1px 0 rgba(255,255,255,.8) inset,
    0 14px 36px rgba(7, 148, 71, 0.22);
  user-select: none;
  pointer-events: none;
}

@keyframes authHeroIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: none; }
}

/* ========== Sheet ========== */
.auth-sheet {
  position: relative;
  z-index: 3;
  margin-top: -22px;
  background: #fff;
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  min-height: 60dvh;
  flex: 1;
  padding: 28px 24px calc(28px + var(--safe-bottom));
  box-shadow: 0 -10px 35px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
}

.auth-sheet__handle {
  width: 42px;
  height: 5px;
  margin: 0 auto 18px;
  border-radius: 999px;
  background: var(--gt-handle);
}

.auth-sheet__head {
  margin-bottom: 22px;
}

.auth-sheet__title {
  margin: 0;
  font-size: clamp(28px, 7.5vw, 32px);
  font-weight: 750;
  font-weight: 800;
  letter-spacing: -0.7px;
  line-height: 1.15;
  color: #0a0a0a;
}

.auth-sheet__sub {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--gt-muted);
}

/* ========== Form ========== */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auth-field {
  margin-bottom: 14px;
}

.auth-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #2a2a2a;
}

.phone-box,
.pass-box {
  display: flex;
  align-items: center;
  height: 60px;
  border: 1px solid var(--gt-border);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 0 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.phone-box:focus-within,
.pass-box:focus-within {
  border-color: var(--gt-primary);
  box-shadow: 0 0 0 3px rgba(7, 148, 71, 0.14);
}

.phone-box.is-invalid,
.pass-box.is-invalid {
  border-color: var(--gt-danger);
  box-shadow: none;
}

.phone-box.is-invalid:focus-within,
.pass-box.is-invalid:focus-within {
  border-color: var(--gt-danger);
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.12);
}

.phone-box__cc {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  padding: 0 4px 0 0;
  color: #1a1a1a;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: default;
  opacity: 1;
}

.phone-box__flag {
  font-size: 16px;
  line-height: 1;
}

.phone-box__dial {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  padding-left: 2px;
  white-space: nowrap;
}

.phone-box__divider {
  width: 1px;
  height: 22px;
  background: #D8DCD8;
  margin: 0 12px;
  flex-shrink: 0;
}

.phone-box__input,
.pass-box__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 16px;
  font-family: inherit;
  color: var(--gt-ink);
  letter-spacing: 0.02em;
}

.phone-box__input::placeholder,
.pass-box__input::placeholder {
  color: #B0B5B0;
  letter-spacing: 0.08em;
}

.pass-box__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-right: -6px;
  border: 0;
  background: transparent;
  color: #8a8f8a;
  cursor: pointer;
  border-radius: 12px;
}

.pass-box__toggle svg[hidden] {
  display: none !important;
}

.pass-box__toggle:active {
  background: #F3F5F3;
}

.auth-field__error {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--gt-danger);
  line-height: 1.35;
}

.auth-field__aside {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.auth-forgot {
  font-size: 13px;
  font-weight: 600;
  color: var(--gt-primary);
  text-decoration: none;
  cursor: default;
  user-select: none;
}

/* CTA */
.auth-cta {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 60px;
  margin-top: 10px;
  border: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0AAF50, #079447);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(7, 148, 71, 0.28);
}

.auth-cta:active:not(:disabled) {
  transform: scale(0.985);
}

.auth-cta:disabled {
  cursor: wait;
  opacity: 0.92;
}

.auth-cta__label {
  flex: 1;
  text-align: center;
  padding-left: 22px;
}

.auth-cta__arrow {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
}

.auth-cta__busy {
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
}

.auth-cta.is-loading .auth-cta__label,
.auth-cta.is-loading .auth-cta__arrow {
  display: none;
}

.auth-cta.is-loading .auth-cta__busy {
  display: inline-flex;
}

.auth-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: authSpin 0.7s linear infinite;
}

@keyframes authSpin {
  to { transform: rotate(360deg); }
}

/* Separator */
.auth-sep {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0 18px;
  color: #A3A8A3;
  font-size: 13px;
  font-weight: 500;
}

.auth-sep::before,
.auth-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #E6E9E6;
}

.auth-sep span {
  flex-shrink: 0;
}

.auth-register {
  text-align: center;
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--gt-muted);
}

.auth-register a {
  color: var(--gt-primary);
  font-weight: 700;
  text-decoration: none;
  margin-left: 4px;
}

.auth-legal {
  margin-top: auto;
  padding-top: 28px;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.5;
  color: #9A9F9A;
}

.auth-legal a {
  color: var(--gt-primary);
  font-weight: 600;
  text-decoration: none;
}

/* Demo chips (dev only) */
.auth-demo {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.auth-demo button {
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid #cfe9d9;
  background: var(--gt-primary-soft);
  color: var(--gt-primary-dark);
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

/* Short screens */
@media (max-height: 720px) {
  .auth-hero {
    height: clamp(200px, 34dvh, 260px);
    padding-top: calc(10px + var(--safe-top));
    padding-bottom: 28px;
  }

  .auth-logo__text {
    font-size: 30px;
  }

  .auth-hero__slogan {
    font-size: 13px;
    margin-top: 6px;
  }

  .auth-hero__image {
    max-height: 120px;
  }

  .auth-sheet {
    padding-top: 20px;
  }

  .auth-sheet__title {
    font-size: 26px;
  }
}

@media (max-height: 640px) {
  .auth-hero {
    height: clamp(180px, 32dvh, 220px);
    padding-bottom: 24px;
  }

  .auth-hero__slogan {
    font-size: 12px;
    margin-top: 4px;
  }

  .auth-hero__image {
    max-height: 88px;
  }

  .auth-sheet {
    margin-top: -16px;
  }
}

/* ========== Register / legacy panel (shared layout) ========== */
.auth-brand {
  text-align: center;
  margin-top: calc(28px + var(--safe-top));
  margin-bottom: 28px;
  padding: 0 20px;
}

.auth-brand__mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: linear-gradient(145deg, #0aad55, #057A3A);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 28px;
  box-shadow: 0 12px 28px rgba(7, 148, 71, 0.28);
}

.auth-brand__name {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--gt-primary-dark);
}

.auth-brand__tag {
  margin: 8px 0 0;
  color: var(--gt-muted);
  font-size: 15px;
  line-height: 1.4;
}

.auth-panel {
  background: var(--gt-surface);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  padding: 22px 24px calc(28px + var(--safe-bottom));
  box-shadow: 0 -10px 35px rgba(0, 0, 0, 0.05);
  min-height: 55dvh;
  display: flex;
  flex-direction: column;
  max-width: 430px;
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 768px) {
  .auth-brand,
  .auth-panel {
    max-width: 430px;
    margin-left: auto;
    margin-right: auto;
  }

  .auth-panel {
    border-radius: 28px;
    margin-bottom: 40px;
    min-height: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
  }
}

.auth-panel h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 800;
}

.auth-panel__sub {
  margin: 0 0 20px;
  color: var(--gt-muted);
  font-size: 14px;
}

.auth-input {
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  border: 1px solid var(--gt-border);
  border-radius: var(--radius-md);
  background: #F7F8F7;
  font-size: 16px;
  outline: none;
  font-family: inherit;
}

.auth-input:focus {
  border-color: var(--gt-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(7, 148, 71, 0.12);
}

.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #0AAF50, #079447);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-top: 8px;
}

.auth-btn:active { transform: scale(0.98); }

.auth-btn--ghost {
  background: transparent;
  color: var(--gt-primary-dark);
  border: 1px solid var(--gt-border);
}

.auth-alert {
  background: #FDECEC;
  color: var(--gt-danger);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 14px;
}

.auth-footer {
  text-align: center;
  margin-top: auto;
  padding-top: 18px;
  font-size: 14px;
  color: var(--gt-muted);
}

.auth-footer a {
  color: var(--gt-primary);
  font-weight: 700;
  text-decoration: none;
}

.auth-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
}

.auth-progress span {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: #e5e5e5;
}

.auth-progress span.is-on { background: var(--gt-primary); }

.auth-role {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-role label {
  min-height: 52px;
  border: 1px solid var(--gt-border);
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-weight: 600;
  cursor: pointer;
  background: #F7F8F7;
}

.auth-role input { display: none; }

.auth-role input:checked + span {
  color: var(--gt-primary-dark);
}

.auth-role label:has(input:checked) {
  background: var(--gt-primary-soft);
  border-color: transparent;
}

.auth-step { display: none; }
.auth-step.is-active { display: block; animation: authFade .25s ease; }

@keyframes authFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.landing-app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 0 20px calc(28px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #EAF8EF 0%, #F7F8F7 50%, #fff 100%);
}

.landing-app .auth-brand { margin-top: 18vh; }
.landing-app .auth-actions { margin-top: auto; display: grid; gap: 10px; }

.auth-hero--compact {
  height: auto;
  min-height: 0;
  padding-bottom: 28px;
}

.auth-hero--compact .auth-logo__text { font-size: 32px; }

.auth-app--landing .auth-hero {
  height: clamp(280px, 55dvh, 460px);
}

.auth-cta { text-decoration: none; }
