:root {
  color-scheme: light dark;
  --page-bg: #f3f6fb;
  --surface: #ffffff;
  --text: #1f2a3d;
  --muted: #637083;
  --border: #dce3ed;
  --primary: #005bff;
  --primary-hover: #004bd6;
  --primary-disabled: #9fc1ff;
  --secondary-bg: #edf4ff;
  --secondary-hover: #dfeaff;
  --secondary-border: #cfe0ff;
  --danger: #c62828;
  --focus-ring: rgba(0, 91, 255, 0.16);
  --shadow: 0 16px 48px rgba(25, 52, 89, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 24px 24px 136px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--page-bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.container {
  position: relative;
  width: 100%;
  max-width: 560px;
  min-height: 470px;
  padding: 28px 48px 40px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(116, 137, 166, 0.12);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.header {
  position: absolute;
  top: 54px;
  left: 25vw;
  z-index: 10;
}

.logo-link {
  display: inline-flex;
  color: var(--text);
  border-radius: 8px;
}

.logo-link:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.hamburger-menu {
  position: absolute;
  top: 18px;
  left: 32px;
  z-index: 13;
  display: grid;
  width: 40px;
  height: 40px;
  padding: 8px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.hamburger-menu svg {
  display: block;
  width: 100%;
  height: 100%;
}

.hamburger-menu path {
  fill: currentColor;
}

.hamburger-menu:hover,
.hamburger-menu[aria-expanded="true"] {
  background: var(--secondary-bg);
  color: var(--primary);
}

.hamburger-menu:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.navigation-menu {
  position: absolute;
  top: 64px;
  left: 32px;
  z-index: 12;
  width: calc(100% - 64px);
  padding: 24px;
  border-radius: 22px;
  background: #25282f;
  box-shadow: 0 18px 46px rgba(9, 18, 32, 0.3);
}

.navigation-menu ul {
  display: flex;
  margin: 0;
  padding: 0;
  flex-direction: column;
  gap: 20px;
  list-style: none;
}

.navigation-menu li {
  min-height: 76px;
  padding: 0;
}

.navigation-menu__action {
  display: flex;
  width: 100%;
  min-height: 76px;
  padding: 0;
  align-items: center;
  gap: 22px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #ffffff;
  font: inherit;
  font-size: clamp(18px, 4.6vw, 26px);
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.navigation-menu__action:hover {
  background: rgba(255, 255, 255, 0.08);
}

.navigation-menu__action:active {
  transform: scale(0.985);
}

.navigation-menu__action:focus-visible {
  outline: 3px solid #5eb7ff;
  outline-offset: 3px;
}

.navigation-menu__icon {
  display: grid;
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
  place-items: center;
  border-radius: 50%;
  background: #293a5b;
  color: #0877ff;
}

.navigation-menu__icon svg {
  width: 40px;
  height: 40px;
}

.back-link {
  position: absolute;
  top: 18px;
  left: 32px;
  z-index: 11;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  transition: background-color 0.2s, color 0.2s;
}

.back-link svg {
  display: block;
  width: 24px;
  height: 24px;
}

.back-link:hover {
  background: var(--secondary-bg);
  color: var(--primary);
}

.back-link:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.content {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
}

.form-section {
  width: 100%;
}

.form-container {
  width: 100%;
  text-align: center;
}

h1 {
  margin: 76px 0 8px;
  color: var(--text);
  font-size: clamp(28px, 6vw, 32px);
  line-height: 1.18;
  text-align: center;
}

.subtitle {
  max-width: 460px;
  margin: 0 auto 24px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
}

.input-wrapper {
  margin-bottom: 18px;
}

.input-label {
  display: block;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-phone {
  position: absolute;
  left: 14px;
  z-index: 1;
  display: flex;
  align-items: center;
  pointer-events: none;
}

.icon-phone svg {
  width: 32px;
  height: 32px;
}

input {
  width: 100%;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 18px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input::placeholder {
  color: #8a96a8;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.input-container input {
  padding-left: 58px;
}

.password-input-container input {
  padding-left: 16px;
  padding-right: 104px;
}

.toggle-password {
  position: absolute;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.eye-icon {
  width: 24px;
  height: 24px;
}

.eye-open {
  display: none;
}

.toggle-password[aria-pressed="true"] .eye-closed {
  display: none;
}

.toggle-password[aria-pressed="true"] .eye-open {
  display: block;
}

.toggle-password:hover {
  background: var(--secondary-bg);
}

.toggle-password:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.otp-inputs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 360px;
  margin: 8px auto 0;
}

.otp-input {
  width: 100%;
  min-width: 0;
  height: 58px;
  padding: 0;
  border-radius: 12px;
  font-size: 24px;
  font-weight: 600;
  text-align: center;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  width: 100%;
  min-height: 54px;
  padding: 14px 20px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 14px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.1s;
}

.btn-primary {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
}

.btn-secondary {
  margin-top: 12px;
  border: 1px solid var(--secondary-border);
  background: var(--secondary-bg);
  color: var(--primary);
}

.btn-secondary:hover {
  border-color: #b8d0fb;
  background: var(--secondary-hover);
}

.btn-primary:active,
.btn-secondary:active {
  transform: scale(0.985);
}

.btn-primary:disabled,
.btn-secondary:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.btn-primary:disabled {
  border-color: var(--primary-disabled);
  background: var(--primary-disabled);
}

.button-link {
  box-sizing: border-box;
}

.timer-container {
  min-height: 46px;
  margin: 2px 0 14px;
}

.timer-text {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.resend-btn {
  margin: 0 0 2px;
}

.error-message {
  min-height: 22px;
  margin: -6px 0 10px;
  color: var(--danger);
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}

.error-message:empty {
  min-height: 0;
  margin: 0;
}

.loading {
  display: none;
  margin-top: 12px;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}

.sms-help-card {
  padding-bottom: 8px;
}

.sms-help-text {
  margin-bottom: 24px;
}

.success-container {
  min-height: 470px;
}

.success-content {
  display: flex;
  min-height: 360px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.success-icon {
  display: grid;
  width: 68px;
  height: 68px;
  margin-top: 52px;
  place-items: center;
  border-radius: 50%;
  background: #eaf8f1;
  color: #168652;
}

.success-icon svg {
  width: 36px;
  height: 36px;
}

.success-content h1 {
  margin-top: 20px;
}

.success-content .btn-primary {
  max-width: 360px;
  margin-top: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.qr-status-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(15, 24, 38, 0.5);
  backdrop-filter: blur(3px);
}

.qr-status-card {
  position: relative;
  width: min(420px, 100%);
  padding: 36px 32px 30px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 22px 64px rgba(16, 35, 64, 0.28);
  text-align: center;
}

.qr-status-card__close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.qr-status-card__close:hover {
  background: var(--secondary-bg);
  color: var(--primary);
}

.qr-status-card__close:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.qr-status-card__icon {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 4px auto 18px;
  place-items: center;
  border-radius: 50%;
  background: var(--secondary-bg);
  color: var(--primary);
  font-size: 32px;
  font-weight: 700;
}

.qr-status-card h2 {
  margin: 0;
  color: var(--text);
  font-size: 25px;
  line-height: 1.25;
}

.qr-status-card p {
  margin: 12px 0 24px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.qr-status-card .btn-secondary {
  margin-top: 10px;
}

.menu-action-status {
  min-height: 22px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.support-chat-button {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 30;
  display: grid;
  width: 64px;
  height: 64px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 10px 28px rgba(0, 91, 255, 0.32);
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.support-chat-button:hover {
  background: var(--primary-hover);
  box-shadow: 0 12px 32px rgba(0, 91, 255, 0.4);
  transform: translateY(-2px);
}

.support-chat-button:active {
  transform: scale(0.96);
}

.support-chat-button:focus-visible,
.support-chat__close:focus-visible,
.support-chat__form button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.support-chat {
  position: fixed;
  right: 28px;
  bottom: 104px;
  z-index: 29;
  display: flex;
  width: min(380px, calc(100vw - 32px));
  height: min(520px, calc(100dvh - 136px));
  min-height: 360px;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 20px 56px rgba(25, 52, 89, 0.24);
}

.support-chat__header {
  display: flex;
  min-height: 76px;
  padding: 14px 14px 14px 18px;
  align-items: center;
  background: var(--primary);
  color: #ffffff;
}

.support-chat__agent {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.support-chat__heading {
  min-width: 0;
  margin-left: 12px;
}

.support-chat__heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.support-chat__heading p {
  display: flex;
  margin: 3px 0 0;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 13px;
}

.support-chat__status {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #68e3a8;
}

.support-chat__close {
  display: grid;
  width: 42px;
  height: 42px;
  margin-left: auto;
  padding: 0;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
}

.support-chat__close:hover {
  background: rgba(255, 255, 255, 0.14);
}

.support-chat__messages {
  display: flex;
  padding: 18px;
  overflow-y: auto;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  background: var(--page-bg);
  overscroll-behavior: contain;
}

.support-message {
  max-width: 84%;
}

.support-message p {
  margin: 0;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.support-message time {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.support-message--agent {
  align-self: flex-start;
}

.support-message--agent p {
  border-bottom-left-radius: 5px;
  background: var(--surface);
  color: var(--text);
}

.support-message--user {
  align-self: flex-end;
}

.support-message--user p {
  border-bottom-right-radius: 5px;
  background: var(--primary);
  color: #ffffff;
}

.support-message--user time {
  text-align: right;
}

.support-chat__form {
  display: flex;
  padding: 12px;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.support-chat__form input {
  min-width: 0;
  padding: 11px 14px;
  flex: 1;
  border-radius: 12px;
  font-size: 15px;
}

.support-chat__form button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
}

.support-chat__form button:hover {
  background: var(--primary-hover);
}

[hidden] {
  display: none !important;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page-bg: #101319;
    --surface: #1b2029;
    --text: #f4f7fb;
    --muted: #b2bdcc;
    --border: #3a4554;
    --secondary-bg: #222e43;
    --secondary-hover: #293a56;
    --secondary-border: #354b70;
    --danger: #ff7d7d;
    --focus-ring: rgba(92, 151, 255, 0.3);
    --shadow: 0 18px 54px rgba(0, 0, 0, 0.38);
  }

  input::placeholder {
    color: #7f8b9b;
  }

  .toggle-password {
    color: #83b2ff;
  }

  .success-icon {
    background: #173c30;
    color: #5ed69d;
  }

  .support-chat {
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.48);
  }

  .qr-status-overlay {
    background: rgba(0, 0, 0, 0.62);
  }
}

@media (max-width: 560px) {
  body {
    padding: 0;
    align-items: stretch;
  }

  .container {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px 20px 32px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .header {
    top: 48px;
    left: 25vw;
  }

  .back-link {
    top: 12px;
    left: 12px;
  }

  .hamburger-menu {
    top: 12px;
    left: 12px;
  }

  .navigation-menu {
    top: 58px;
    left: 12px;
    width: calc(100% - 24px);
    padding: 20px 16px;
    border-radius: 18px;
  }

  .navigation-menu ul {
    gap: 16px;
  }

  .navigation-menu li {
    min-height: 58px;
    gap: 16px;
    font-size: clamp(17px, 4.8vw, 21px);
  }

  .navigation-menu__icon {
    width: 58px;
    height: 58px;
    flex-basis: 58px;
  }

  .navigation-menu__icon svg {
    width: 32px;
    height: 32px;
  }

  .content {
    min-height: calc(100dvh - 56px);
  }

  h1 {
    margin-top: 88px;
  }

  .success-content {
    min-height: calc(100dvh - 56px);
  }

  .otp-inputs {
    gap: 6px;
  }

  .otp-input {
    height: 54px;
    font-size: 22px;
  }

  .support-chat-button {
    right: 18px;
    bottom: 18px;
    width: 58px;
    height: 58px;
  }

  .support-chat {
    right: 12px;
    bottom: 88px;
    width: calc(100vw - 24px);
    height: min(520px, calc(100dvh - 104px));
  }

  .qr-status-overlay {
    padding: 16px;
  }

  .qr-status-card {
    padding: 34px 22px 24px;
  }
}

@media (max-width: 360px) {
  .container {
    padding-right: 16px;
    padding-left: 16px;
  }

  .otp-inputs {
    gap: 4px;
  }

  .otp-input {
    height: 48px;
    border-radius: 10px;
    font-size: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
