/* Shared auth styling (slice 17): login + signup in the app shell's design
   language. The tokens below are copied from app.html's :root — same warm
   canvas, soft depth, one violet accent — so the auth pages read as the same
   product, not a bolted-on form. Served DB-free from server.js next to the
   pages themselves. */
:root {
  --canvas: #faf8f4;
  --card: #ffffff;
  --ink: #2b2620;
  --muted: #6e6557;
  --faint: #a39a8b;
  --line: #ece6da;
  --hairline: rgba(70, 58, 38, 0.07);
  --accent: #6c5bd4;
  --accent-deep: #54409e;
  --warn-fg: #8c3b22;
  --warn-tint: #fbefe9;
  --shadow-sm: 0 1px 2px rgba(70, 58, 38, 0.05), 0 2px 10px rgba(70, 58, 38, 0.05);
  --shadow-md: 0 2px 4px rgba(70, 58, 38, 0.06), 0 12px 32px rgba(70, 58, 38, 0.1);
  --ring: 0 0 0 3px rgba(108, 91, 212, 0.22);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.4rem; padding: 2rem 1rem;
  font: 16px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-deep); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---- brand header above the card: same mark as the app topbar ---- */
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.05rem; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, #7d6ce0, #5a48c7);
  color: #fff; font-size: 0.82rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(90, 72, 199, 0.35);
}

/* ---- the auth card: app.html's card treatment, sized like the
       create-workspace card the new user meets next ---- */
.auth-card {
  width: 100%; max-width: 24rem;
  background: var(--card); border: 1px solid var(--hairline); border-radius: 16px;
  box-shadow: var(--shadow-md); padding: 1.75rem 1.5rem;
}
.auth-card h1 { margin: 0 0 0.3rem; font-size: 1.4rem; font-weight: 700; letter-spacing: -0.015em; }
.auth-card .lead { margin: 0 0 1.4rem; color: var(--muted); font-size: 0.92rem; }

/* ---- fields: app.html's label.field + input styling ---- */
label.field { display: block; margin: 0 0 0.9rem; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
label.field > input { margin-top: 0.3rem; }
input {
  width: 100%; padding: 0.6rem 0.75rem; font: inherit; font-size: 0.92rem; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder { color: var(--faint); }
input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }

/* ---- inline error: same warm warning treatment as the app shell ---- */
.error {
  background: var(--warn-tint); color: var(--warn-fg);
  border-radius: 12px; padding: 0.7rem 1rem; margin: 0 0 0.9rem; font-size: 0.9rem;
}

/* ---- primary action: app.html's .btn-primary, full width ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; margin-top: 0.35rem;
  padding: 0.6rem 1.05rem; border-radius: 11px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 0.92rem; cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.05s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(108, 91, 212, 0.3); }
.btn-primary:hover:not(:disabled) { background: #5d4bc6; }
/* working indicator while the submit is in flight (JS swaps the label too) */
.btn .spinner {
  width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- the cross-link between login and signup ---- */
.auth-alt {
  margin: 1.4rem 0 0; padding-top: 1.1rem; border-top: 1px solid var(--line);
  text-align: center; color: var(--muted); font-size: 0.9rem;
}

/* ---- small screens: keep the card comfortable, not cramped ---- */
@media (max-width: 480px) {
  body { padding: 1.25rem 0.9rem; justify-content: flex-start; padding-top: 3rem; }
  .auth-card { padding: 1.4rem 1.15rem; }
}
