:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --field-line: #d8dde6;
  --green: #0a84ff;
  --cyan: #0f766e;
  --red: #d92d20;
  --shadow: 0 14px 34px rgba(17, 24, 39, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}

.auth-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--text);
  text-decoration: none;
}

.auth-brand-image {
  display: block;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  image-rendering: pixelated;
  object-fit: contain;
}

.auth-top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  min-width: 0;
}

.auth-top-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.auth-top-link:hover {
  color: var(--green);
}

.auth-top-cta {
  justify-content: center;
  min-width: 62px;
  padding: 0 12px;
  border: 1px solid #111111;
  border-radius: 8px;
  background: #111111;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.auth-top-cta:hover {
  border-color: #1f2937;
  background: #1f2937;
  color: #fff;
}

.auth-shell {
  display: grid;
  min-height: calc(100vh - 68px);
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(100%, 440px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel.auth-panel-shake {
  animation: authPanelShake 320ms ease both;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.2;
}

.lead,
.muted {
  color: var(--muted);
}

.lead {
  margin: 0 0 22px;
}

form {
  display: grid;
  gap: 10px;
}

label {
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 36px;
  padding: 10px 12px;
  border: 1px solid var(--field-line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}

input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.14);
  outline: none;
}

button {
  min-height: 40px;
  margin-top: 8px;
  padding: 4px 12px;
  border: 1px solid #111111;
  border-radius: 8px;
  background: #111111;
  color: #fff;
  cursor: pointer;
  line-height: 1.15;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  user-select: none;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

button:hover {
  border-color: #1f2937;
  background: #1f2937;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.14);
}

button:focus-visible {
  border-color: #111111;
  background: #111111;
  color: #ffffff;
  outline: 2px solid rgba(10, 132, 255, 0.38);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.12);
}

button:active {
  transform: translateY(1px);
}

a {
  color: var(--cyan);
}

.status-line {
  min-height: 28px;
  margin-top: 12px;
  color: var(--muted);
}

.status-line:empty {
  min-height: 0;
  margin-top: 0;
}

.status-line.ok {
  color: var(--green);
}

.status-line.error {
  color: var(--red);
}

.agreement-links {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.agreement-links a {
  color: var(--text);
  text-decoration: none;
}

.agreement-links a:hover {
  text-decoration: underline;
}

.agreement-page {
  min-height: 100vh;
  background: var(--bg);
  padding: 40px 20px 56px;
}

.agreement-shell {
  width: min(100%, 920px);
  margin: 0 auto;
}

.agreement-card {
  padding: 28px 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.agreement-back {
  display: inline-flex;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.agreement-back:hover {
  color: var(--text);
}

.agreement-meta {
  margin: 8px 0 24px;
  color: var(--muted);
  font-size: 13px;
}

.agreement-card h1 {
  margin-bottom: 8px;
  font-size: 32px;
}

.agreement-card h2 {
  margin: 28px 0 12px;
  font-size: 19px;
  line-height: 1.4;
}

.agreement-card p,
.agreement-card li {
  color: #374151;
  font-size: 14px;
  line-height: 1.9;
}

.agreement-card ul {
  margin: 8px 0 0;
  padding-left: 22px;
}

.agreement-card strong {
  color: var(--text);
}

@media (max-width: 720px) {
  .auth-topbar {
    gap: 12px;
    padding: 12px 16px;
  }

  .auth-brand-image {
    width: 34px;
    height: 34px;
  }

  .auth-top-actions {
    gap: 10px;
    overflow-x: auto;
  }

  .auth-top-link {
    font-size: 13px;
  }

  .agreement-page {
    padding: 20px 12px 32px;
  }

  .agreement-card {
    padding: 22px 18px;
  }

  .agreement-card h1 {
    font-size: 28px;
  }
}

/* Polish pass */
body {
  background: linear-gradient(180deg, #f8fafc 0%, #f4f6f8 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.auth-shell {
  padding: 32px 20px;
}

.auth-panel,
.agreement-card {
  border-color: #e6ebf2;
  box-shadow:
    0 24px 56px rgba(15, 23, 42, 0.07),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.auth-panel {
  padding: 32px;
}

.lead {
  margin-bottom: 24px;
}

input {
  border-color: #dbe2ec;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

input::placeholder {
  color: #9aa4b2;
}

button {
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

.agreement-links {
  font-size: 11px;
  line-height: 1.8;
}

.agreement-links a {
  color: #4b5563;
}

.agreement-links a:hover {
  color: var(--text);
}

form button {
  justify-self: start;
  min-width: 88px;
}

@keyframes authPanelShake {
  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-8px);
  }

  40% {
    transform: translateX(7px);
  }

  60% {
    transform: translateX(-5px);
  }

  80% {
    transform: translateX(4px);
  }
}
