:root {
  color-scheme: light;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #11121b;
  background: #fbfbff;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --primary: #6047f5;
  --border: #dfe1ee;
  --hint: #6f738d;
}

* { box-sizing: border-box; }

.legal-links a { color: #6047f5; text-underline-offset: 2px; }
.legal-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 15px; margin: 14px 0 0; padding: 0 0 10px; font-size: 11px; }

body {
  position: relative;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: #f8f8ff url('assets/login-lavender-bg.png') center top / cover no-repeat fixed;
}

button, input { font: inherit; }

.auth-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100% - 48px, 480px);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: 42px 0 28px;
}

.brand {
  display: block;
  width: min(200px, 72vw);
  height: auto;
  overflow: hidden;
  margin: 0 0 66px;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
}

.auth-card {
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.eyebrow {
  color: #6047f5;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2.2px;
}

.auth-intro h1 {
  margin: 15px 0 8px;
  font-size: clamp(30px, 8vw, 38px);
  font-weight: 800;
  letter-spacing: -1.4px;
  line-height: 1.12;
}

.auth-intro p,
.form-copy {
  margin: 0;
  color: var(--hint);
  font-size: 16px;
  line-height: 1.55;
}

.google-auth { margin-top: 32px; }
.google-auth[hidden] { display: none; }

.google-button {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 22px;
  align-items: center;
  justify-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 0 20px;
  border: 1px solid rgba(224, 225, 237, .72);
  border-radius: 18px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 9px 22px rgba(67, 62, 129, .07);
  color: #171821;
  cursor: pointer;
  font-size: 16px;
  font-weight: 750;
  text-decoration: none;
  transition: background .15s, border-color .15s, transform .15s;
}

.google-button:hover { border-color: #c9cbe0; background: #fff; transform: translateY(-1px); }
.google-button > svg:first-child { width: 28px; height: 28px; justify-self: start; }
.google-button .button-arrow { width: 20px; height: 20px; color: #8589a1; justify-self: end; }

.telegram-auth {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
}

.telegram-auth[hidden] {
  display: none !important;
}

.telegram-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid #2aabee;
  border-radius: 18px;
  background: #2aabee;
  box-shadow: 0 9px 22px rgba(42, 171, 238, .18);
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  transition: background .15s, transform .15s;
}

.telegram-button:hover {
  background: #229ed9;
  transform: translateY(-1px);
}

.telegram-button svg {
  flex-shrink: 0;
}

.telegram-hint {
  margin: 16px 0 6px;
  color: #6a7185;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

html[data-env="genesis"] #google-auth,
html[data-env="genesis"] #login-form,
html[data-env="genesis"] #register-form,
html[data-env="genesis"] #consent-form,
html[data-env="genesis"] #resend-form,
html[data-env="genesis"] #forgot-form,
html[data-env="genesis"] #reset-form,
html[data-env="genesis"] .auth-footer,
html[data-env="genesis"] .google-auth,
html[data-env="genesis"] .auth-divider {
  display: none !important;
}

html[data-env="genesis"] .telegram-auth {
  display: flex !important;
}

html[data-env="genesis"] .telegram-button {
  background: #2c6453 !important;
  border-color: #2c6453 !important;
  box-shadow: 0 10px 24px rgba(44, 100, 83, 0.22) !important;
  color: #fff !important;
}

html[data-env="genesis"] .telegram-button svg {
  color: #fff;
  fill: #fff;
}

html[data-env="genesis"] .telegram-button:hover {
  background: #1e473b !important;
  border-color: #1e473b !important;
}

html[data-env="genesis"] .eyebrow {
  color: #2c6453 !important;
}

html[data-env="genesis"] a {
  color: #2c6453 !important;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 30px;
  color: #777b94;
  font-size: 13px;
  white-space: nowrap;
}

.auth-divider::before,
.auth-divider::after { flex: 1; height: 1px; background: #d9dced; content: ''; }

.auth-form {
  display: flex;
  flex-direction: column;
  margin-top: 28px;
}

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

.auth-form label {
  margin: 0 0 8px;
  color: #171821;
  font-size: 15px;
  font-weight: 750;
  text-align: left;
}

.auth-form > input {
  flex: 0 0 auto;
  width: 100%;
  height: 48px;
  margin: 0 0 11px;
  padding: 0 16px;
  border: 1.5px solid var(--border);
  border-radius: 15px;
  outline: none;
  background: rgba(255, 255, 255, .8);
  color: #171821;
  font-size: 15px;
  transition: border-color .16s, box-shadow .16s;
}

.auth-form input::placeholder { color: #9296aa; opacity: 1; }
.auth-form > input:focus,
.input-shell:focus-within { border-color: #7663fa; box-shadow: 0 0 0 3px rgba(102, 84, 241, .1); }

.input-shell {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 15px;
  width: 100%;
  height: 52px;
  margin: 0 0 18px;
  padding: 0 16px;
  border: 1.5px solid var(--border);
  border-radius: 15px;
  background: rgba(255, 255, 255, .8);
  transition: border-color .16s, box-shadow .16s;
}

.input-icon {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  color: #858aa2;
}

.input-shell input {
  flex: 1;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #171821;
  font-size: 15px;
}

.input-shell input:focus { box-shadow: none; }

.input-toggle {
  display: grid;
  flex: 0 0 28px;
  place-items: center;
  width: 28px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #858aa2;
  cursor: pointer;
}

.input-toggle svg { width: 22px; height: 22px; }
.input-toggle .eye-closed { display: none; }
.input-toggle[aria-pressed="true"] .eye-open { display: none; }
.input-toggle[aria-pressed="true"] .eye-closed { display: block; }

.field-hint {
  margin: -14px 0 18px;
  color: var(--hint);
  font-size: 12px;
}

.consent-options {
  display: grid;
  gap: 10px;
  margin: 8px 0 18px;
  padding: 13px 14px;
  border: 1px solid #e4e3f0;
  border-radius: 14px;
  background: rgba(255, 255, 255, .68);
}

.auth-form label.consent-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  color: #575b70;
  font-size: 12px;
  font-weight: 550;
  line-height: 1.5;
  text-align: left;
}

.consent-option input[type="checkbox"] {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: #6547f4;
}

.consent-option a { color: #5637dc; font-weight: 750; text-decoration: underline; text-underline-offset: 2px; }

.form-copy { margin-bottom: 18px; }

.primary-button {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 52px;
  margin-top: 2px;
  padding: 0 22px;
  border: 0;
  border-radius: 17px;
  background: linear-gradient(110deg, #6547f4 0%, #7750f7 53%, #4c83fa 100%);
  box-shadow: 0 9px 20px rgba(102, 84, 241, .22);
  color: #fff;
  cursor: pointer;
  font-size: 17px;
  font-weight: 800;
  transition: transform .15s, box-shadow .15s, opacity .15s;
}

.primary-button svg { width: 22px; height: 22px; }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(102, 84, 241, .27); }
.primary-button:disabled { cursor: wait; opacity: .65; transform: none; }

.form-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 18px;
}

.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #6047f5;
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
  text-align: center;
}

.text-button:hover { text-decoration: underline; }
.text-button.strong { font-size: inherit; font-weight: 800; }

.auth-message {
  margin-top: 20px;
  padding: 12px 14px;
  border: 1px solid #cfeedd;
  border-radius: 12px;
  background: #f0fbf4;
  color: #167448;
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
}

.auth-message.error { border-color: #f3d1d6; background: #fff5f6; color: #a62d42; }
.auth-message[hidden] { display: none; }

.auth-footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid #dedfee;
  color: #555b78;
  font-size: 14px;
  text-align: center;
}

.auth-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: auto 0 0;
  padding-top: 26px;
  color: #8b90a8;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.auth-note svg { flex: 0 0 19px; width: 19px; height: 19px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

.auth-layout { min-height: 100vh; min-height: 100svh; }
.auth-panel { min-width: 0; }
.auth-promo { display: none; }

@media (min-width: 900px) {
  body { min-height: 100vh; min-height: 100svh; height: auto; background: #f8f9fc; }
  .auth-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(440px, 1fr);
    min-height: 100vh;
    min-height: 100svh;
    height: auto;
    overflow: visible;
  }
  .auth-promo {
    display: block;
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    height: 100svh;
    min-height: 100svh;
    overflow: hidden;
    background-color: #f8f8ff;
    background-image: url('assets/login-promo.png');
    background-position: center;
    background-size: auto 100%;
    background-repeat: no-repeat;
  }
  .auth-panel { display: flex; align-items: center; justify-content: center; min-height: 100vh; min-height: 100svh; padding: 24px clamp(20px, 3vw, 44px); overflow: visible; background: #fbfbff; }
  .auth-shell { width: min(100%, 440px); height: auto; min-height: calc(100svh - 48px); margin: 0; padding: 28px 0 24px; }
  .auth-shell > .brand { display: none; }
  .auth-card { display: flex; flex-direction: column; min-height: 0; margin: auto 0; }
  .auth-card > .auth-intro,
  .auth-card > .auth-message,
  .auth-card > .google-auth,
  .auth-card > .auth-footer { flex: 0 0 auto; }
  .auth-card > .auth-form { flex: 0 0 auto; min-height: 0; overflow: visible; }
  .auth-intro h1 { font-size: clamp(30px, 2.55vw, 40px); }
  .auth-note { padding-top: 24px; }
}

@media (min-width: 900px) and (max-height: 760px) {
  .auth-panel { padding-top: 12px; padding-bottom: 12px; }
  .auth-shell { min-height: calc(100svh - 24px); padding-top: 12px; padding-bottom: 12px; }
}

@media (max-width: 520px) {
  .auth-shell { width: min(100% - 48px, 440px); padding-top: 35px; }
  .brand { margin-bottom: 58px; }
  .auth-intro h1 { font-size: clamp(29px, 8.5vw, 36px); }
  .auth-intro p { font-size: 15px; }
  .google-auth { margin-top: 27px; }
  .google-button { min-height: 60px; padding: 0 17px; font-size: 14px; }
  .auth-divider { margin-top: 26px; }
  .auth-form { margin-top: 24px; }
  .auth-footer { margin-top: 27px; }
}

@media (max-height: 760px) {
  .auth-shell { padding-top: 22px; padding-bottom: 16px; }
  .brand { margin-bottom: 16px; }
  .auth-intro h1 { margin-top: 8px; }
  .google-auth { margin-top: 12px; }
  .google-button { min-height: 48px; }
  .auth-divider { margin-top: 12px; }
  .auth-form { margin-top: 11px; }
  .auth-form label { margin-bottom: 4px; font-size: 14px; }
  .auth-form > input { height: 44px; margin-bottom: 8px; }
  .input-shell { height: 46px; margin-bottom: 11px; }
  .primary-button { min-height: 46px; }
  .field-hint { margin: -5px 0 8px; }
  .form-links { margin-top: 8px; }
  .auth-footer { margin-top: 10px; padding-top: 8px; }
  .auth-note { padding-top: 6px; font-size: 11px; }
}

@media (max-height: 760px) {
  body.is-register .brand { margin-bottom: 10px; }
  body.is-register .auth-intro h1 { margin-top: 6px; font-size: 28px; }
  body.is-register .auth-intro p { font-size: 13px; line-height: 1.3; }
  body.is-register .google-auth { margin-top: 8px; }
  body.is-register .google-button { min-height: 42px; }
  body.is-register .google-button > svg:first-child { width: 23px; height: 23px; }
  body.is-register .auth-divider { margin-top: 9px; }
  body.is-register .auth-form { margin-top: 8px; }
  body.is-register .auth-form label { margin-bottom: 3px; font-size: 13px; }
  body.is-register .auth-form > input { height: 40px; margin-bottom: 6px; }
  body.is-register .field-hint { margin: -4px 0 5px; font-size: 11px; }
  body.is-register .primary-button { min-height: 43px; }
  body.is-register .auth-footer { margin-top: 8px; padding-top: 6px; }
  body.is-register .auth-note { padding-top: 4px; font-size: 10px; }
}
