:root {
  color-scheme: dark light;
  --background: #050506;
  --surface: #0d1117;
  --surface-hover: #141a22;
  --text: #f7f7f8;
  --muted: #9299a5;
  --border: #343b47;
  --border-strong: #535d6c;
  --accent: #2f80ff;
  --accent-hover: #1f70ee;
  --danger: #ffb5b5;
  --danger-surface: #2a1114;
  --focus-ring: rgba(47, 128, 255, 0.28);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: var(--background);
  color: var(--text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  padding: 48px 24px;
}

.auth-panel {
  width: min(100%, 580px);
  text-align: center;
}

.brand {
  display: grid;
  justify-items: center;
}

.brand-mark {
  display: block;
  width: 220px;
  height: 220px;
  margin-bottom: 18px;
  border-radius: 28px;
  object-fit: cover;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 650;
  letter-spacing: -0.055em;
  line-height: 0.95;
}

.lead {
  margin: 18px 0 38px;
  color: var(--muted);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.4;
}

.message {
  margin: -18px 0 24px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.45;
  text-align: left;
}

.message-error {
  border-color: #6a2b31;
  background: var(--danger-surface);
  color: var(--danger);
}

.auth-form {
  display: grid;
  gap: 10px;
  text-align: left;
}

label {
  margin-top: 10px;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
}

input {
  width: 100%;
  height: 58px;
  border: 1px solid var(--border);
  border-radius: 14px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  caret-color: var(--accent);
  font-size: 1rem;
  line-height: 1;
  padding: 0 17px;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

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

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 76px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 16px;
  padding: 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 650;
  line-height: 1;
}

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

.primary-button,
.secondary-button {
  min-height: 58px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.primary-button {
  margin-top: 18px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

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

.primary-button:active,
.secondary-button:active {
  transform: translateY(1px);
}

.footer-copy {
  margin: 38px 0 0;
  color: #6f7681;
  font-size: 0.8125rem;
  line-height: 1.4;
}

.signed-in .brand::after {
  width: min(100%, 410px);
  height: 1px;
  margin: 34px 0 0;
  background: var(--border);
  content: "";
}

.identity-block .lead {
  margin: 26px 0 8px;
}

.username {
  margin: 0;
  font-size: clamp(2rem, 7vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.support-copy {
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.logout-form {
  margin-top: 34px;
}

.secondary-button {
  width: min(100%, 378px);
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--text);
}

.secondary-button:hover {
  background: var(--surface-hover);
}

@media (prefers-color-scheme: light) {
  :root {
    --background: #ffffff;
    --surface: #f5f7fa;
    --surface-hover: #eef2f7;
    --text: #111318;
    --muted: #626a76;
    --border: #cfd5df;
    --border-strong: #9fa8b6;
    --danger: #8c1d28;
    --danger-surface: #fff2f3;
  }

  .brand-mark {
    filter: invert(1);
  }
}

@media (max-width: 520px) {
  .auth-shell {
    align-items: start;
    padding: 42px 20px 28px;
  }

  .brand-mark {
    width: 124px;
    height: 124px;
    margin-bottom: 14px;
    border-radius: 24px;
  }

  .lead {
    margin-bottom: 26px;
  }

  input,
  .primary-button,
  .secondary-button {
    min-height: 54px;
  }

  .footer-copy {
    margin-top: 30px;
  }
}

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