/* Shared styles for the auth pages (login, register). Apple-like: calm, flat, one card. */
:root {
  --auth-bg: #f5f5f7;
  --auth-surface: #ffffff;
  --auth-text: #1d1d1f;
  --auth-text-soft: #6e6e73;
  --auth-border: #d2d2d7;
  --auth-border-soft: #e8e8ed;
  --auth-fill: #f5f5f7;
  --auth-accent: #0071e3;
  --auth-accent-hover: #0077ed;
  --auth-accent-ring: rgba(0, 113, 227, 0.18);
  --auth-link: #0066cc;
  --auth-success: #1d8a3a;
  --auth-danger: #d70015;
  --auth-warning: #b25000;
  --auth-radius-card: 22px;
  --auth-radius-field: 12px;
  --auth-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", Arial, sans-serif;
  --auth-font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", Arial, sans-serif;
}

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

html,
body {
  background: var(--auth-bg);
}

body.auth-page {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  font-family: var(--auth-font);
  color: var(--auth-text);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

.auth-shell {
  width: 100%;
  max-width: 420px;
}

.auth-card {
  background: var(--auth-surface);
  border-radius: var(--auth-radius-card);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 40px rgba(0, 0, 0, 0.06);
  padding: 40px 36px 32px;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 28px;
}

.auth-brand img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  margin-bottom: 16px;
}

.auth-title {
  font-family: var(--auth-font-display);
  font-size: 28px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--auth-text);
  margin: 0 0 6px;
}

.auth-subtitle {
  font-size: 15px;
  line-height: 1.4;
  color: var(--auth-text-soft);
  margin: 0;
}

/* Fields */
.auth-field {
  margin-bottom: 16px;
}

.auth-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--auth-text);
  margin-bottom: 6px;
}

.auth-input-wrap {
  position: relative;
}

.auth-input {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 16px;
  color: var(--auth-text);
  background: var(--auth-surface);
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius-field);
  outline: none;
  box-shadow: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.auth-input::placeholder {
  color: #a1a1a6;
}

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

.auth-input[readonly] {
  background: var(--auth-fill);
  color: var(--auth-text-soft);
}

.auth-input-wrap .auth-input {
  padding-right: 48px;
}

.auth-reveal {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--auth-text-soft);
  cursor: pointer;
}

.auth-reveal:hover {
  background: var(--auth-fill);
  color: var(--auth-text);
}

.auth-reveal:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--auth-accent-ring);
}

.auth-hint {
  font-size: 12px;
  line-height: 1.4;
  color: var(--auth-text-soft);
  margin-top: 6px;
}

.auth-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--auth-text);
  margin: 4px 0 20px;
  cursor: pointer;
  user-select: none;
}

.auth-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--auth-accent);
}

/* Buttons */
.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 48px;
  padding: 0 20px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  color: #fff;
  background: var(--auth-accent);
  border: 0;
  border-radius: var(--auth-radius-field);
  cursor: pointer;
  transition: background-color 0.15s ease, opacity 0.15s ease;
  text-decoration: none;
}

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

.auth-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--auth-accent-ring);
}

.auth-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.auth-btn-secondary {
  height: 40px;
  width: auto;
  font-size: 14px;
  color: var(--auth-link);
  background: transparent;
  border: 1px solid var(--auth-border);
  border-radius: 999px;
}

.auth-btn-secondary:hover {
  color: var(--auth-link);
  background: var(--auth-fill);
}

.auth-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Links, dividers, notes */
.auth-link {
  color: var(--auth-link);
  font-weight: 500;
  text-decoration: none;
}

.auth-link:hover {
  color: var(--auth-link);
  text-decoration: underline;
}

.auth-center {
  text-align: center;
}

.auth-muted {
  font-size: 14px;
  color: var(--auth-text-soft);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 20px;
  font-size: 13px;
  color: var(--auth-text-soft);
}

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

.auth-steps {
  background: var(--auth-fill);
  border-radius: 14px;
  padding: 16px 18px;
  margin: 0;
  list-style: none;
  counter-reset: auth-step;
}

.auth-steps li {
  counter-increment: auth-step;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  line-height: 1.35;
  color: var(--auth-text);
  padding: 5px 0;
}

.auth-steps li::before {
  content: counter(auth-step);
  flex: 0 0 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--auth-surface);
  color: var(--auth-text-soft);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.auth-agent-cta {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.auth-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 14px;
  color: var(--auth-text-soft);
}

.auth-footer p {
  margin: 0 0 6px;
}

.auth-whatsapp {
  color: var(--auth-success);
  font-weight: 500;
  text-decoration: none;
}

.auth-whatsapp:hover {
  color: var(--auth-success);
  text-decoration: underline;
}

/* Alerts */
.auth-alerts {
  margin-top: 16px;
}

.auth-alert {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  line-height: 1.4;
  padding: 12px 14px;
  border-radius: var(--auth-radius-field);
  margin-bottom: 8px;
  background: var(--auth-fill);
  color: var(--auth-text);
}

.auth-alert.alert-danger {
  background: #fff1f0;
  color: var(--auth-danger);
}

.auth-alert.alert-warning {
  background: #fff7ea;
  color: var(--auth-warning);
}

.auth-alert.alert-success {
  background: #effaf1;
  color: var(--auth-success);
}

.auth-alert .auth-alert-close {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.6;
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}

.auth-alert .auth-alert-close:hover {
  opacity: 1;
}

@media (max-width: 480px) {
  body.auth-page {
    padding: 24px 16px;
    align-items: flex-start;
  }

  .auth-card {
    padding: 32px 22px 26px;
  }

  .auth-title {
    font-size: 24px;
  }
}

.auth-reveal .auth-reveal-slash {
  display: none;
}

.auth-reveal.is-on .auth-reveal-slash {
  display: inline;
}


/* Dark mode: same Apple system dark colours as the app (html[data-bs-theme="dark"]). */
html[data-bs-theme="dark"] {
  color-scheme: dark;
  --auth-bg: #000000;
  --auth-surface: #1c1c1e;
  --auth-text: #f5f5f7;
  --auth-text-soft: #a1a1a6;
  --auth-border: #3a3a3c;
  --auth-border-soft: #2c2c2e;
  --auth-fill: #2c2c2e;
  --auth-accent: #0a84ff;
  --auth-accent-hover: #409cff;
  --auth-accent-ring: rgba(10, 132, 255, 0.32);
  --auth-link: #2997ff;
  --auth-success: #30d158;
  --auth-danger: #ff453a;
  --auth-warning: #ff9f0a;
}

.auth-check-terms {
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.45;
  color: var(--auth-text-soft);
}

.auth-check-terms input {
  flex: 0 0 18px;
  margin-top: 1px;
}

.apl-legal-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 14px;
  font-size: 13px;
}

.apl-legal-links a {
  color: var(--auth-text-soft);
  text-decoration: none;
}

.apl-legal-links a:hover {
  color: var(--auth-link);
}

.apl-legal-footer .apl-legal-links {
  margin-bottom: 6px;
}

.apl-trademark-note {
  margin: 0 auto;
  max-width: 360px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--auth-text-soft);
  opacity: 0.8;
  text-align: center;
}

/* Sign-in choice buttons (login <-> Desktop Agent) */
.auth-agent-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  text-decoration: none;
}

.auth-agent-cta .auth-btn i,
.auth-agent-link i {
  margin-right: 2px;
}
