:root {
  --bg: #f3f5f9;
  --card: #ffffff;
  --line: #d7dde7;
  --text: #1f2a37;
  --muted: #5f6b7a;
  --accent: #0d6efd;
  --accent-hover: #0b5ed7;
  --success-bg: #e8f5e9;
  --success-text: #1b7f4a;
  --danger-bg: #fdecea;
  --danger-text: #b42318;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(ellipse 80% 60% at 15% 20%, rgba(13, 110, 253, 0.07), transparent 55%),
    radial-gradient(ellipse 70% 55% at 85% 80%, rgba(30, 182, 232, 0.06), transparent 50%),
    linear-gradient(160deg, #eef2f8 0%, var(--bg) 45%, #e9eef6 100%);
  color: var(--text);
  position: relative;
  overflow-x: hidden;
}

.authBgCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.authCard {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(31, 42, 55, 0.08);
  overflow: hidden;
}

.authFooter {
  position: relative;
  z-index: 1;
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.authHeader {
  position: relative;
  padding: 20px 24px 0;
  border-bottom: 1px solid var(--line);
}

.authLangBar {
  position: absolute;
  top: 22px;
  right: 20px;
  z-index: 2;
}

.authLangControl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.authLangText {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.2s;
  line-height: 1;
}

.authLangText.is-active {
  color: var(--text);
}

.iosSwitch {
  position: relative;
  width: 36px;
  height: 20px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.iosSwitchTrack {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 20px;
  background: #e9e9ea;
  transition: background 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.iosSwitch.is-on .iosSwitchTrack {
  background: #34c759;
}

.iosSwitchKnob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.iosSwitch.is-on .iosSwitchKnob {
  transform: translateX(16px);
}

.iosSwitch:focus-visible .iosSwitchTrack {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.authBrand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
  padding-right: 96px;
}

.authBrandText {
  min-width: 0;
}

.authBrandText h1 {
  margin: 0 0 2px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.authBrandTagline {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.authSubtitle {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.authTabs {
  display: flex;
  gap: 4px;
  margin: 0 -4px;
}

.authTab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.authTab:hover { color: var(--text); }

.authTab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.authBody {
  padding: 20px 24px 24px;
}

.authPanel { display: none; }
.authPanel.is-active { display: block; }

.formGroup {
  margin-bottom: 12px;
}

.formGroup label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 600;
}

.formGroup input,
.formGroup select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  background: #fff;
}

.formGroup input:focus,
.formGroup select:focus {
  border-color: var(--accent);
}

.formRow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.authAlert {
  display: none;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
}

.authAlert.is-visible { display: block; white-space: pre-line; }
.authAlert.is-error { background: var(--danger-bg); color: var(--danger-text); }
.authAlert.is-success { background: var(--success-bg); color: var(--success-text); }

.authSubmit {
  width: 100%;
  margin-top: 6px;
  padding: 11px 14px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  transition: background 0.15s;
}

.authSubmit:hover:not(:disabled) { background: var(--accent-hover); }
.authSubmit:disabled { opacity: 0.65; cursor: not-allowed; }

.authHint {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.authLinkRow {
  margin-top: 12px;
  text-align: center;
  font-size: 13px;
}

.authLink {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
}

.authLink:hover { text-decoration: underline; }

.authFooter a {
  color: #1e6b91;
  text-decoration: none;
}

.authFooterContact {
  margin: 0 0 6px;
}

.authFooter a:hover { text-decoration: underline; }

@media (max-width: 480px) {
  .formRow { grid-template-columns: 1fr; }
  .authCard { max-width: 100%; }
  .authBrand { padding-right: 0; }
  .authLangBar {
    position: static;
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
  }
}
