/* Google-style auth: mobile-first stepper */

:root {
  --auth-bg: #f0f4f8;
  --auth-card: #ffffff;
  --auth-text: #1a2332;
  --auth-muted: #5c6b7a;
  --auth-accent: #0d6efd;
  --auth-accent-hover: #0b5ed7;
  --auth-border: #d8e0e8;
  --auth-radius: 16px;
  --auth-touch: 48px;
}

body.auth-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 80% 50% at 10% 0%, #dbeafe 0%, transparent 55%),
    radial-gradient(ellipse 70% 40% at 90% 100%, #e0e7ff 0%, transparent 50%),
    var(--auth-bg);
  color: var(--auth-text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
}

.auth-brand {
  text-align: center;
  margin-bottom: 20px;
}

.auth-brand a {
  color: var(--auth-text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.auth-brand .bi {
  color: var(--auth-accent);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--auth-card);
  border-radius: var(--auth-radius);
  box-shadow: 0 8px 32px rgba(26, 35, 50, 0.08);
  border: 1px solid var(--auth-border);
  padding: 28px 24px;
  overflow: hidden;
}

.auth-step.is-active,
.auth-stack > div {
  min-width: 0;
  max-width: 100%;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  color: var(--auth-muted);
  font-size: 0.95rem;
  margin: 0 0 24px;
  line-height: 1.45;
}

.auth-step {
  display: none;
}

.auth-step.is-active {
  display: block;
}

.auth-label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 8px;
}

.auth-input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: var(--auth-touch);
  padding: 12px 14px;
  border: 1.5px solid var(--auth-border);
  border-radius: 12px;
  font-size: 1.05rem;
  background: #fff;
  color: var(--auth-text);
}

.auth-input:focus {
  outline: none;
  border-color: var(--auth-accent);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: var(--auth-touch);
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

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

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

.auth-btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.auth-btn-ghost {
  background: transparent;
  color: var(--auth-accent);
  border: 1.5px solid transparent;
}

.auth-btn-ghost:hover {
  background: rgba(13, 110, 253, 0.06);
}

.auth-btn-outline {
  background: #fff;
  color: var(--auth-text);
  border: 1.5px solid var(--auth-border);
}

.auth-hint {
  font-size: 0.85rem;
  color: var(--auth-muted);
  margin-top: 8px;
  min-height: 1.2em;
}

.auth-hint.is-error {
  color: #b42318;
}

.auth-hint.is-ok {
  color: #027a48;
}

.auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--auth-muted);
}

.auth-footer a {
  color: var(--auth-accent);
  font-weight: 600;
  text-decoration: none;
}

.auth-role-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 8px;
}

.auth-role-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px;
  border: 1.5px solid var(--auth-border);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  min-height: 72px;
}

.auth-role-card:hover,
.auth-role-card.is-selected {
  border-color: var(--auth-accent);
  background: rgba(13, 110, 253, 0.04);
}

.auth-role-card strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.auth-role-card span {
  font-size: 0.85rem;
  color: var(--auth-muted);
}

.auth-messenger-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-messenger-toggle label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--auth-touch);
  border: 1.5px solid var(--auth-border);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
}

.auth-messenger-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.auth-messenger-toggle input:checked + label {
  border-color: var(--auth-accent);
  background: rgba(13, 110, 253, 0.08);
  color: var(--auth-accent);
}

.auth-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--auth-muted);
  margin: 16px 0;
}

.auth-check input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex-shrink: 0;
}

.auth-alert {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.auth-alert-danger {
  background: #fef3f2;
  color: #b42318;
  border: 1px solid #fecdca;
}

.auth-alert-success {
  background: #ecfdf3;
  color: #027a48;
  border: 1px solid #abefc6;
}

.auth-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 576px) {
  .auth-shell {
    padding: 16px 12px calc(16px + env(safe-area-inset-bottom));
    justify-content: flex-start;
    padding-top: max(24px, env(safe-area-inset-top));
  }

  .auth-card {
    max-width: none;
    border-radius: 14px;
    padding: 22px 18px;
    box-shadow: 0 4px 20px rgba(26, 35, 50, 0.06);
  }

  .auth-title {
    font-size: 1.35rem;
  }

  .auth-btn,
  .auth-input,
  .auth-role-card {
    font-size: 1rem;
  }
}
