.header-link {
  color: var(--text);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.header-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.header-back-arrow {
  font-size: 1rem;
  line-height: 1;
}

.auth-main {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.5rem 1.25rem 2.5rem;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.auth-title {
  font-size: clamp(1.6rem, 6vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.auth-subtitle {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.role-tabs {
  display: flex;
  width: 100%;
  max-width: 440px;
  gap: 0.4rem;
  margin-bottom: 1.15rem;
  padding: 0.3rem;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
}

.role-tab {
  flex: 1;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.2s ease, color 0.2s ease;
}

.role-tab.is-active {
  background: #fff;
  color: #111;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  padding: 1.35rem 1.15rem 1.25rem;
  text-align: left;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field label .optional {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  opacity: 0.75;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="tel"],
.field input[type="search"],
.phone-input {
  width: 100%;
  min-height: 46px;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.field input:focus,
.phone-input:focus {
  border-color: var(--accent);
}

.field.has-error input[type="text"],
.field.has-error input[type="email"],
.field.has-error input[type="password"],
.field.has-error input[type="tel"],
.field.has-error .phone-input,
.field.has-error .password-wrap input,
.field.has-error .dial-code-btn {
  border-color: #ff8f8f;
}

.field-error {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #ff8f8f;
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap input {
  width: 100%;
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}

.password-toggle:hover,
.password-toggle.is-visible {
  color: #fff;
}

.password-toggle .eye-slash {
  display: block;
}

.password-toggle.is-visible .eye-slash {
  display: none;
}

.password-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.field input::placeholder,
.phone-input::placeholder {
  color: var(--input-placeholder);
}

.phone-group {
  display: flex;
  gap: 0.55rem;
  align-items: stretch;
}

.dial-code {
  position: relative;
  flex: 0 0 auto;
  z-index: 5;
}

.dial-code-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 46px;
  padding: 0 0.7rem;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
}

.dial-flag {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  display: block;
}

.dial-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(255, 255, 255, 0.75);
  margin-left: 0.1rem;
}

.dial-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  width: min(280px, 78vw);
  max-height: 260px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(12, 12, 14, 0.98);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  flex-direction: column;
  display: none;
}

.dial-dropdown.is-open {
  display: flex;
}

.dial-search {
  border: none !important;
  border-bottom: 1px solid var(--border-soft) !important;
  border-radius: 0 !important;
  min-height: 42px !important;
  background: transparent !important;
}

.dial-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  overflow-y: auto;
  max-height: 210px;
}

.dial-list li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  font-size: 0.82rem;
}

.dial-list li:hover,
.dial-list li:focus {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.dial-item-name {
  flex: 1;
  text-align: left;
  color: var(--text);
}

.dial-item-code {
  color: var(--accent);
  font-weight: 600;
}

.phone-input {
  flex: 1;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
}

.toggle-copy {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-align: left;
}

.toggle-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.toggle-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
  cursor: pointer;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  transition: background 0.2s ease;
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}

.switch input:checked + .switch-slider {
  background: var(--accent);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}

.switch input:focus-visible + .switch-slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 420px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 100;
  transform: translateX(-50%) translateY(120%);
  min-width: min(320px, calc(100vw - 2rem));
  max-width: 420px;
  padding: 0.9rem 1.1rem;
  border-radius: 12px;
  background: rgba(12, 12, 14, 0.96);
  border: 1px solid rgba(92, 225, 230, 0.45);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  pointer-events: none;
}

.toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.is-success {
  border-color: rgba(92, 225, 230, 0.55);
  color: var(--accent);
}

.toast.is-error {
  border-color: rgba(255, 143, 143, 0.55);
  color: #ff8f8f;
}

