/* Auth pages use the dashboard design tokens (styles.css :root) so login matches the analytics UI. */
:root {
  color-scheme: light;
  --canvas: #f6f6f2;
  --surface: #fff;
  --ink: #202723;
  --ink-soft: #48534d;
  --muted: #77817a;
  --line: #e2e5df;
  --line-strong: #d2d7d0;
  --brand: #d8533f;
  --brand-hover: #c44a37;
  --brand-soft: #fbefeb;
  --red: #b84a42;
  --red-soft: #f9ecea;
  --green: #247d55;
  --green-soft: #eaf5ee;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

.auth-body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "SF Pro Text", "Aptos", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
}

.auth-card {
  width: 100%;
  max-width: 392px;
  padding: 26px 24px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(32, 39, 35, .04), 0 10px 30px rgba(32, 39, 35, .06);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.auth-logo { width: 34px; height: 34px; border-radius: 9px; }

.auth-brand-copy { display: flex; flex-direction: column; line-height: 1.1; }
.auth-brand-copy strong { font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.auth-brand-copy small { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .9px; }

.auth-form { display: grid; gap: 14px; }
.auth-form[hidden], .auth-done[hidden] { display: none; }

.auth-title { margin: 0; font-size: 22px; font-weight: 720; letter-spacing: -.4px; }
.auth-lead { margin: -4px 0 2px; color: var(--muted); font-size: 14px; }

.auth-field { display: grid; gap: 6px; }
.auth-field > span { color: var(--ink-soft); font-size: 13px; font-weight: 600; }

.auth-field input,
.auth-password input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 16px; /* 16px prevents iOS zoom on focus */
}

.auth-field input:focus,
.auth-password input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(216, 83, 63, .16);
}

.auth-password { position: relative; display: block; }
.auth-password input { padding-right: 84px; }

.auth-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: var(--ink-soft);
  background: var(--surface-muted, #f0f1ed);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.auth-submit,
.auth-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 9px;
  font: inherit;
  font-size: 15px;
  font-weight: 680;
  text-decoration: none;
  cursor: pointer;
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
  border: 1px solid var(--brand);
  color: #fff;
  background: var(--brand);
}

.auth-submit:hover { background: var(--brand-hover); }
.auth-submit:disabled { opacity: .6; cursor: progress; }

.auth-link {
  min-height: 40px;
  border: 0;
  color: var(--brand);
  background: transparent;
}

.auth-link:hover { text-decoration: underline; }

.auth-message {
  margin: 0;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 14px;
}
.auth-message[hidden] { display: none; }
.auth-message.is-error { color: var(--red); background: var(--red-soft); border: 1px solid #efcbc5; }
.auth-message.is-info { color: var(--green); background: var(--green-soft); border: 1px solid #c9dfd2; }

.auth-done { display: grid; gap: 14px; }
.auth-done .auth-submit { text-decoration: none; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

@media (max-width: 400px) {
  .auth-card { padding: 22px 18px 18px; }
  .auth-title { font-size: 20px; }
}
