:root {
  --auth-bg: #f6f7f9;
  --auth-card-bg: #ffffff;
  --auth-text: #3f3f47;
  --auth-text-muted: #64748b;
  --auth-border: #d0d7de;
  --auth-border-focus: #566d7e;
  --auth-accent: #566d7e;
  --auth-accent-hover: #455a68;
  --auth-error: #b00020;
  --auth-radius: 7px;
  --auth-card-width: 340px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.auth-body,
body.public-body {
  margin: 0;
  min-height: 100vh;
  color: var(--auth-text);
  background: var(--auth-bg);
  line-height: 1.5;
}

.auth-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--auth-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.auth-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: var(--auth-card-width);
  background: var(--auth-card-bg);
  border: 1px solid var(--auth-border);
  border-radius: 12px;
  padding: 1.5rem 1.25rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.auth-logo {
  display: block;
  margin: 0 auto 1rem;
  max-width: 160px;
  height: auto;
}

.auth-heading {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  color: var(--auth-text);
}

.auth-lead {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--auth-text-muted);
  text-align: center;
}

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

.auth-notices {
  width: 100%;
  max-width: var(--auth-card-width);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--auth-border);
  border-radius: 10px;
  background: var(--auth-card-bg);
}
.auth-notices p { margin: 0; }
.auth-fallback h1 { font-size: 1.25rem; }
.auth-fallback form { display: flex; flex-direction: column; gap: 0.75rem; }
.auth-fallback button {
  padding: 0.55rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--auth-border);
  background: var(--auth-accent);
  color: #fff;
}

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

.auth-field-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.auth-field label {
  font-size: 0.8125rem;
  font-weight: 600;
}

.auth-field input[type="text"],
.auth-field input[type="email"],
.auth-field input[type="password"],
.auth-field input[type="number"] {
  width: 100%;
  padding: 0.45rem 0.65rem;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--auth-text);
  background: #fff;
  border: 1px solid var(--auth-border);
  border-radius: 6px;
}

.auth-field input:focus {
  outline: 2px solid var(--auth-border-focus);
  outline-offset: 0;
  border-color: var(--auth-border-focus);
}

.auth-field-error,
.auth-form-error {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--auth-error);
}

.auth-forgot {
  font-size: 0.8125rem;
  font-weight: 400;
  white-space: nowrap;
}

.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.25;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.auth-btn:hover {
  text-decoration: none;
}

.auth-btn--primary {
  background: var(--auth-accent);
  color: #fafafa;
  border-color: var(--auth-accent);
  margin-top: 0.25rem;
}

.auth-btn--primary:hover {
  background: var(--auth-accent-hover);
  border-color: var(--auth-accent-hover);
  color: #fafafa;
}

.auth-btn--black {
  background: #202220;
  color: #fafafa;
  border-color: #202220;
}

.auth-btn--black:hover {
  background: #111211;
  border-color: #111211;
  color: #fafafa;
}

.auth-btn--secondary {
  background: #fff;
  color: var(--auth-text);
  border-color: var(--auth-border);
}

.auth-btn--secondary:hover {
  background: #f6f8fa;
  color: var(--auth-text);
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.auth-link-btn {
  display: inline;
  padding: 0;
  font: inherit;
  font-size: 0.875rem;
  color: var(--auth-accent);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}

.auth-link-btn:hover {
  color: var(--auth-accent-hover);
}

.auth-section {
  margin: 1rem 0;
  padding: 1rem 0;
  border-top: 1px solid var(--auth-border);
}

.auth-section:first-of-type {
  border-top: none;
  padding-top: 0;
}

.auth-section h2 {
  margin: 0 0 0.35rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.auth-section p {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: var(--auth-text-muted);
}

.auth-backup-list {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  list-style: none;
  background: #f6f8fa;
  border: 1px solid var(--auth-border);
  border-radius: 6px;
}

.auth-backup-list li {
  padding: 0.2rem 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875rem;
}

.auth-qr {
  display: block;
  max-width: 200px;
  margin: 0 auto 1rem;
  padding: 0.5rem;
  background: #fff;
  border: 1px solid var(--auth-border);
  border-radius: 6px;
}

.auth-secret {
  word-break: break-all;
  font-size: 0.8125rem;
  color: var(--auth-text-muted);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0;
  color: var(--auth-text-muted);
  font-size: 0.8125rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--auth-border);
}

.auth-oauth-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-form + .auth-oauth-list {
  margin-top: 0.5rem;
}

.auth-oauth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--auth-text);
  background: #fff;
  border: 1px solid var(--auth-border);
  border-radius: 10px;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.auth-oauth-btn:hover {
  background: #f6f8fa;
  text-decoration: none;
  color: var(--auth-text);
}

.auth-oauth-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.auth-swap {
  margin: 1rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--auth-border);
  font-size: 0.875rem;
  text-align: center;
  color: var(--auth-text);
}

.auth-terms {
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
  color: var(--auth-text-muted);
  text-align: center;
  line-height: 1.45;
}

.auth-footer {
  padding: 1.25rem 1rem;
  font-size: 0.75rem;
  color: var(--auth-text-muted);
  text-align: center;
  border-top: 1px solid var(--auth-border);
}

.auth-footer a {
  color: var(--auth-text-muted);
  margin: 0 0.35rem;
}

.auth-footer a:hover {
  color: var(--auth-accent);
}

.auth-card--wide {
  max-width: 420px;
}

.public-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid var(--auth-border);
}

.public-header__logo {
  flex-shrink: 0;
}

.public-header__logo img {
  display: block;
  max-width: 140px;
  height: auto;
}

.public-header__nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-left: auto;
}

.public-header__link {
  display: inline-block;
  min-width: 50px;
  padding: 0.35rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  border-radius: var(--auth-radius);
  text-decoration: none;
  transition: all 0.15s ease;
}

.public-header__link--ghost {
  color: var(--auth-text);
  background: transparent;
  border: 1px solid transparent;
}

.public-header__link--ghost:hover {
  text-decoration: none;
  background: #f6f8fa;
}

.public-header__link--primary {
  color: #fafafa;
  background: var(--auth-accent);
  border: 1px solid var(--auth-accent);
}

.public-header__link--primary:hover {
  background: var(--auth-accent-hover);
  border-color: var(--auth-accent-hover);
  color: #fafafa;
  text-decoration: none;
}

.public-main {
  flex: 1;
  min-height: calc(100vh - 120px);
}

.public-body {
  display: flex;
  flex-direction: column;
}

.public-footer {
  padding: 1.25rem;
  font-size: 0.75rem;
  color: var(--auth-text-muted);
  text-align: center;
  border-top: 1px solid var(--auth-border);
}

.public-footer a {
  color: var(--auth-text-muted);
}

.public-footer a:hover {
  color: var(--auth-accent);
}
