@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("../fonts/montserrat-cyrillic.woff2") format("woff2");
  unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("../fonts/montserrat-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

body.auth-page { margin: 0; background: #fbfaf8; }

.auth-shell {
  --auth-canvas: #fbfaf8;
  --auth-paper: #ffffff;
  --auth-ink: #25211d;
  --auth-muted: #70675f;
  --auth-accent: #ffa115;
  --auth-link: #925200;
  --auth-border: #d8d1c8;
  --auth-soft-border: #ebe6df;
  --auth-error: #ad3026;
  --auth-error-bg: #fff4f1;
  --auth-success: #326b43;
  --auth-success-bg: #edf6ee;
  --auth-focus: #925200;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  padding: 36px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  background: var(--auth-canvas);
  color: var(--auth-ink);
  color-scheme: light;
  font: 400 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  text-align: left;
  -webkit-text-size-adjust: 100%;
}

.auth-shell *,
.auth-shell *::before,
.auth-shell *::after { box-sizing: border-box; }

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

.auth-shell .auth-frame { width: 100%; max-width: 484px; min-width: 0; }

.auth-shell .auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: fit-content;
  max-width: 100%;
  min-height: 44px;
  margin: 0 auto 24px;
  color: var(--auth-ink);
  font: 700 24px/1.2 "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: -.8px;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.auth-shell .auth-brand-mark { flex: 0 0 32px; color: var(--auth-accent); }
.auth-shell .auth-brand-dot { fill: var(--auth-ink); }
.auth-shell .auth-mobile-help { display: none; }

.auth-shell .auth-card {
  width: 100%;
  padding: 32px;
  border: 1px solid var(--auth-soft-border);
  border-radius: 24px;
  background: var(--auth-paper);
  box-shadow: 0 8px 36px rgb(54 39 22 / 4%);
}

.auth-shell h1,
.auth-shell p,
.auth-shell form { margin: 0; }

.auth-shell .auth-heading { margin: 0 0 26px; text-align: left; }
.auth-shell .auth-heading h1 {
  margin: 0;
  padding: 0;
  color: var(--auth-ink);
  font: 700 27px/1.22 "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: -.8px;
  text-wrap: balance;
}
.auth-shell .auth-heading p { margin-top: 10px; color: var(--auth-muted); font-size: 15px; line-height: 1.5; }
.auth-shell .auth-heading .auth-presence { display: flex; width: fit-content; align-items: center; gap: 7px; padding: 4px 9px; border-radius: 6px; background: var(--auth-success-bg); color: var(--auth-success); font-size: 13px; line-height: 18px; }
.auth-shell .auth-presence strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.auth-shell .auth-presence-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: currentColor; }

.auth-shell .auth-form { display: flex; flex-direction: column; gap: 18px; padding: 0; }
.auth-shell .auth-field { min-width: 0; }
.auth-shell .auth-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.auth-shell .auth-label-row label { margin: 0; color: var(--auth-ink); font-size: 14px; font-weight: 600; line-height: 1.4; }
.auth-shell .auth-label-link { flex-shrink: 0; margin: -8px 0; padding: 8px 0; font-size: 13px; }
.auth-shell .auth-input-wrap { position: relative; width: 100%; }
.auth-shell .auth-input {
  appearance: none;
  display: block;
  width: 100%;
  min-width: 0;
  height: 48px;
  min-height: 48px;
  margin: 0;
  padding: 11px 14px;
  border: 1px solid var(--auth-border);
  border-radius: 11px;
  background: var(--auth-paper);
  box-shadow: none;
  color: var(--auth-ink);
  font: inherit;
  font-size: 16px;
  line-height: 24px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.auth-shell .auth-input:hover { border-color: #a99c8f; }
.auth-shell .auth-input:focus { border-color: var(--auth-focus); outline: 2px solid transparent; box-shadow: 0 0 0 3px rgb(146 82 0 / 14%); }
.auth-shell .auth-input[aria-invalid="true"] { border-color: var(--auth-error); }
.auth-shell .auth-input-wrap--password .auth-input { padding-right: 48px; }
.auth-shell .auth-input::-ms-reveal { display: none; }

.auth-shell .auth-password-toggle {
  appearance: none;
  position: absolute;
  inset: 2px 2px 2px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--auth-muted);
  cursor: pointer;
  touch-action: manipulation;
}
.auth-shell .auth-password-toggle:hover { background: var(--auth-canvas); color: var(--auth-ink); }
.auth-shell .auth-eye-slash { display: none; }
.auth-shell .auth-password-toggle[aria-pressed="true"] .auth-eye-slash { display: block; }
.auth-shell .auth-hint { margin-top: 7px; color: var(--auth-muted); font-size: 13px; line-height: 1.5; }
.auth-shell .auth-field-error { margin: 7px 0 0; color: var(--auth-error); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.auth-shell .auth-consent-error { margin-top: -11px; }
.auth-shell .auth-form-feedback { padding: 11px 13px; border-radius: 10px; background: var(--auth-error-bg); color: var(--auth-error); font-size: 14px; }

.auth-shell a { color: var(--auth-link); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.auth-shell a:hover { color: #693b00; }
.auth-shell a:focus-visible,
.auth-shell button:focus-visible,
.auth-shell input[type="checkbox"]:focus-visible,
.auth-shell [tabindex="-1"]:focus-visible { outline: 3px solid var(--auth-focus); outline-offset: 4px; }

.auth-shell .auth-button {
  appearance: none;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  height: auto;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  box-shadow: none;
  font: 600 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.auth-shell .auth-button--primary { background: var(--auth-accent); color: var(--auth-ink); }
.auth-shell .auth-button--primary:hover { background: #f19608; color: var(--auth-ink); }
.auth-shell .auth-button--primary:active { background: #e88d00; }
.auth-shell .auth-button--secondary,
.auth-shell .auth-button--social { border-color: var(--auth-border); background: var(--auth-paper); color: var(--auth-ink); }
.auth-shell .auth-button--secondary:hover,
.auth-shell .auth-button--social:hover { border-color: #a99c8f; background: var(--auth-canvas); color: var(--auth-ink); }
.auth-shell .auth-button:disabled { cursor: wait; opacity: .7; }
.auth-shell .auth-button.is-loading { opacity: 1; }
.auth-shell .auth-button-spinner { display: none; flex: 0 0 15px; width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; }
.auth-shell .auth-button.is-loading .auth-button-spinner { display: inline-block; animation: auth-spin 700ms linear infinite; }
.auth-shell .auth-button--social.is-loading .auth-provider { display: none; }

.auth-shell .auth-consent.checkbox-holder {
  position: relative;
  display: block;
  min-height: 44px;
  margin: 0;
  padding: 0 0 0 32px;
  color: var(--auth-muted);
  font: 400 13px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.auth-shell .auth-consent.checkbox-holder input[type="checkbox"] {
  appearance: auto;
  position: absolute;
  top: 1px;
  left: 0;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  margin: 0;
  padding: 0;
  opacity: 1;
  accent-color: var(--auth-link);
  cursor: pointer;
}
.auth-shell .auth-consent.checkbox-holder span { position: static; display: inline; width: auto; height: auto; margin: 0; padding: 0; color: inherit; font: inherit; zoom: 1; }
.auth-shell .auth-consent.checkbox-holder span::after { content: none; }
.auth-shell .auth-consent.checkbox-holder > input + span { display: none; }
.auth-shell .auth-consent p { margin: 0; }
.auth-shell .auth-consent a { color: var(--auth-link); font-size: inherit; line-height: inherit; text-decoration: underline; }
.auth-shell .auth-consent a:hover { color: #693b00; }

.auth-shell .auth-divider { display: flex; align-items: center; gap: 12px; margin: 23px 0 17px; color: var(--auth-muted); font-size: 12px; line-height: 1.4; text-align: center; }
.auth-shell .auth-divider::before,
.auth-shell .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--auth-soft-border); }
.auth-shell .auth-social { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.auth-shell .auth-social > :only-child { grid-column: 1 / -1; }
.auth-shell.auth-shell--embed {
  min-height: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
}
.auth-shell.auth-shell--embed .auth-frame { max-width: none; }
.auth-shell.auth-shell--embed .auth-card { margin: 0 0 8px; }
.auth-shell .auth-provider { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%; font: 700 18px/1 Arial, sans-serif; }
.auth-shell .auth-provider--yandex { color: #e42124; }
.auth-shell .auth-provider--mail { color: #0063da; font-size: 22px; }
.auth-shell .auth-switch { margin: 22px 0 0; color: var(--auth-muted); font-size: 14px; line-height: 1.65; text-align: center; }
.auth-shell .auth-switch a { display: inline-block; padding: 7px 0; margin: -7px 0; font-weight: 600; }
.auth-shell .auth-footer { margin: 19px 0 0; color: var(--auth-muted); font-size: 12px; line-height: 1.6; text-align: center; }
.auth-shell .auth-footer a { display: inline-block; margin: -10px 0; padding: 10px 0; }
.auth-shell .auth-back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin: -12px 0 12px; font-size: 13px; text-decoration: none; }
.auth-shell .auth-back span { font-size: 20px; }
.auth-shell .auth-recovery-note { margin-top: 20px; color: var(--auth-muted); font-size: 13px; line-height: 1.55; }
.auth-shell .auth-status { margin: -4px 0 22px; padding: 20px; border: 1px solid var(--auth-soft-border); border-radius: 14px; background: var(--auth-canvas); color: var(--auth-muted); font-size: 14px; }
.auth-shell .auth-status-icon { display: block; margin-bottom: 12px; color: var(--auth-link); }
.auth-shell .auth-status--success .auth-status-icon { color: var(--auth-success); }
.auth-shell .auth-notice { margin-bottom: 20px; padding: 12px 14px; border: 1px solid var(--auth-soft-border); border-radius: 11px; background: var(--auth-canvas); color: var(--auth-ink); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.auth-shell .auth-notice--error { border-color: #edc3bc; background: var(--auth-error-bg); color: var(--auth-error); }
.auth-shell .auth-notice .alert { margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; }

@keyframes auth-spin { to { transform: rotate(360deg); } }

@media (max-width: 520px) {
  .auth-shell { padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .auth-shell .auth-frame { max-width: 420px; }
  .auth-shell .auth-brand { min-height: 28px; margin-bottom: 10px; font-size: 20px; letter-spacing: -.5px; }
  .auth-shell .auth-brand-mark { width: 26px; height: 26px; flex-basis: 26px; }
  .auth-shell[data-auth-flow="register"] .auth-masthead,
  .auth-shell[data-auth-flow="login"] .auth-masthead { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; margin-bottom: 8px; }
  .auth-shell[data-auth-flow="register"] .auth-brand,
  .auth-shell[data-auth-flow="login"] .auth-brand { min-height: 44px; margin: -6px 0; }
  .auth-shell .auth-mobile-help { display: inline-flex; align-items: center; min-height: 44px; margin: -6px 0; font-size: 12px; }
  .auth-shell[data-auth-flow="register"] .auth-footer,
  .auth-shell[data-auth-flow="login"] .auth-footer { display: none; }
  .auth-shell .auth-card { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .auth-shell .auth-heading { margin-bottom: 12px; }
  .auth-shell .auth-heading h1 { font-size: 24px; }
  .auth-shell[data-auth-flow="register"] .auth-heading p,
  .auth-shell[data-auth-flow="login"] .auth-heading p { display: none; }
  .auth-shell[data-auth-flow="register"] .auth-heading .auth-presence { display: flex; margin-top: 4px; padding: 2px 8px; font-size: 12px; line-height: 16px; }
  .auth-shell .auth-form { gap: 10px; }
  /* Permanent inset labels save a row without relying on placeholders. */
  .auth-shell .auth-field { position: relative; }
  .auth-shell .auth-label-row { margin: 0; }
  .auth-shell .auth-label-row label { position: absolute; z-index: 1; top: 6px; left: 14px; max-width: calc(100% - 62px); font-size: 12px; line-height: 14px; }
  .auth-shell .auth-input { height: 56px; min-height: 56px; padding-top: 23px; padding-bottom: 7px; }
  .auth-shell .auth-field--linked { padding-bottom: 40px; }
  .auth-shell .auth-label-link { position: absolute; right: 0; bottom: -4px; display: inline-flex; align-items: center; min-height: 44px; margin: 0; padding: 0; font-size: 13px; }
  .auth-shell .auth-consent.checkbox-holder { padding-left: 28px; font-size: 12px; line-height: 1.45; }
  .auth-shell .auth-divider { margin: 10px 0; }
  .auth-shell .auth-switch { margin-top: 10px; font-size: 13px; line-height: 1.5; }
  .auth-shell .auth-footer { margin-top: 6px; }
  .auth-shell .auth-back { margin: -6px 0 4px; }
  .auth-shell .auth-recovery-note { margin-top: 12px; }
}

/* Small visible phone viewports, including browser chrome. Keep natural scroll
   for validation messages, the keyboard, zoom, or a longer admin agreement. */
@media (max-width: 520px) and (max-height: 660px) {
  .auth-shell { padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
  .auth-shell[data-auth-flow="register"] .auth-masthead,
  .auth-shell[data-auth-flow="login"] .auth-masthead { margin-bottom: 6px; }
  .auth-shell .auth-brand { font-size: 18px; }
  .auth-shell .auth-heading { margin-bottom: 8px; }
  .auth-shell .auth-heading h1 { font-size: 22px; }
  .auth-shell .auth-form { gap: 8px; }
  .auth-shell .auth-input { height: 52px; min-height: 52px; padding-top: 21px; padding-bottom: 5px; }
  .auth-shell .auth-label-row label { top: 5px; }
  .auth-shell .auth-consent.checkbox-holder { line-height: 1.4; }
  .auth-shell .auth-divider { margin: 8px 0; }
  .auth-shell .auth-switch { margin-top: 8px; }
  /* Keep the confirmed range visible without shrinking text or main targets. */
  .auth-shell.auth-shell--presence { padding-top: 4px; padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px)); }
  .auth-shell.auth-shell--presence .auth-heading { margin-bottom: 4px; }
  .auth-shell.auth-shell--presence .auth-input { height: 48px; min-height: 48px; padding-top: 19px; padding-bottom: 3px; }
  .auth-shell.auth-shell--presence .auth-label-row label { top: 3px; }
  .auth-shell.auth-shell--presence .auth-divider { margin: 4px 0; }
}

@media (max-width: 350px) {
  .auth-shell .auth-heading h1 { font-size: 22px; }
  .auth-shell .auth-label-row { flex-wrap: wrap; row-gap: 5px; }
  .auth-shell .auth-social { gap: 8px; }
  .auth-shell .auth-button--social { gap: 6px; padding-right: 8px; padding-left: 8px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-shell *, .auth-shell *::before, .auth-shell *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media (forced-colors: active) {
  .auth-shell .auth-input:focus { outline: 2px solid Highlight; box-shadow: none; }
  .auth-shell .auth-button { border: 1px solid ButtonText; }
}

/* Readable login/registration. Keep the full agreement and existing controls;
   a short viewport may scroll instead of reducing the type or clipping text. */
.auth-shell[data-auth-flow="register"] .auth-brand > span,
.auth-shell[data-auth-flow="login"] .auth-brand > span { display: none; }
.auth-shell[data-auth-flow="register"] .auth-brand,
.auth-shell[data-auth-flow="login"] .auth-brand { min-width: 44px; min-height: 44px; }
.auth-shell[data-auth-flow="register"] .auth-heading h1,
.auth-shell[data-auth-flow="login"] .auth-heading h1 { font-size: 28px; }
.auth-shell[data-auth-flow="register"] .auth-label-row label,
.auth-shell[data-auth-flow="login"] .auth-label-row label { position: static; max-width: none; font-size: 16px; line-height: 20px; }
.auth-shell[data-auth-flow="register"] .auth-label-row,
.auth-shell[data-auth-flow="login"] .auth-label-row { margin-bottom: 6px; }
.auth-shell[data-auth-flow="register"] .auth-input,
.auth-shell[data-auth-flow="login"] .auth-input { height: 48px; min-height: 48px; padding-top: 11px; padding-bottom: 11px; font-size: 18px; line-height: 24px; }
.auth-shell[data-auth-flow="register"] .auth-button,
.auth-shell[data-auth-flow="login"] .auth-button { min-height: 48px; padding-top: 11px; padding-bottom: 11px; font-size: 18px; line-height: 24px; }
.auth-shell[data-auth-flow="register"] .auth-consent.checkbox-holder { font-size: 14px; line-height: 1.4; }
.auth-shell[data-auth-flow="register"] .auth-heading .auth-presence { font-size: 14px; line-height: 20px; }
.auth-shell[data-auth-flow="register"] .auth-field-error,
.auth-shell[data-auth-flow="login"] .auth-field-error { font-size: 14px; }
.auth-shell[data-auth-flow="register"] .auth-divider,
.auth-shell[data-auth-flow="login"] .auth-divider { font-size: 14px; }
.auth-shell[data-auth-flow="register"] .auth-switch,
.auth-shell[data-auth-flow="login"] .auth-switch { font-size: 16px; line-height: 1.5; }
.auth-shell[data-auth-flow="register"] .auth-label-link,
.auth-shell[data-auth-flow="login"] .auth-label-link { font-size: 16px; }

@media (max-width: 520px) {
  .auth-shell[data-auth-flow="register"],
  .auth-shell[data-auth-flow="login"] { padding-top: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  .auth-shell[data-auth-flow="register"] .auth-masthead,
  .auth-shell[data-auth-flow="login"] .auth-masthead { margin-bottom: 4px; }
  .auth-shell[data-auth-flow="register"] .auth-mobile-help,
  .auth-shell[data-auth-flow="login"] .auth-mobile-help { font-size: 14px; }
  .auth-shell[data-auth-flow="register"] .auth-heading,
  .auth-shell[data-auth-flow="login"] .auth-heading { margin-bottom: 10px; }
  .auth-shell[data-auth-flow="register"] .auth-form,
  .auth-shell[data-auth-flow="login"] .auth-form { gap: 10px; }
  .auth-shell[data-auth-flow="register"] .auth-divider,
  .auth-shell[data-auth-flow="login"] .auth-divider { margin: 8px 0; }
  .auth-shell[data-auth-flow="register"] .auth-switch,
  .auth-shell[data-auth-flow="login"] .auth-switch { margin-top: 12px; }
}
