/* ============================================================
   FeetSquare beta - the Phase 4 pages (login, set password, home).
   Tokens and control styles are taken from the live app's Css.html
   (classic palette), so these pages look like the app they lead to.
   Phase 5 brings the full Css.html across.
   ============================================================ */
:root {
  --bg: #f4f6f9; --surface: #ffffff; --surface-2: #f8fafc; --surface-3: #eef2f7;
  --border: #e3e8ef; --border-strong: #cfd8e3;
  --text: #1a2233; --text-muted: #667085; --text-faint: #98a2b3;
  --brand: #1a73e8; --brand-hover: #1557b0; --brand-soft: #e8f0fe; --brand-text: #1557b0;
  --success: #1e8e3e; --success-soft: #e6f4ea; --warn: #b06000; --warn-soft: #fef7e0;
  --danger: #d93025; --danger-soft: #fce8e6;
  --shadow-md: 0 4px 8px -2px rgba(16,24,40,.10), 0 2px 4px -2px rgba(16,24,40,.06);
  --shadow-lg: 0 12px 16px -4px rgba(16,24,40,.10), 0 4px 6px -2px rgba(16,24,40,.05);
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-full: 999px;
  --ff: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1420; --surface: #171d2b; --surface-2: #1c2334; --surface-3: #232c40;
    --border: #2a3345; --border-strong: #3a465c;
    --text: #e6ebf5; --text-muted: #94a3b8; --text-faint: #64748b;
    --brand: #5b9dff; --brand-hover: #7db0ff; --brand-soft: #1b2942; --brand-text: #9cc4ff;
    --success: #4ade80; --success-soft: #14301f; --warn: #fbbf24; --warn-soft: #33270a;
    --danger: #f87171; --danger-soft: #3a1a19;
    --shadow-md: 0 4px 10px rgba(0,0,0,.40); --shadow-lg: 0 14px 28px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}
/* Dark picked by hand (theme.js), whatever the phone says */
:root[data-theme="dark"] {
  --bg: #0f1420; --surface: #171d2b; --surface-2: #1c2334; --surface-3: #232c40;
  --border: #2a3345; --border-strong: #3a465c;
  --text: #e6ebf5; --text-muted: #94a3b8; --text-faint: #64748b;
  --brand: #5b9dff; --brand-hover: #7db0ff; --brand-soft: #1b2942; --brand-text: #9cc4ff;
  --success: #4ade80; --success-soft: #14301f; --warn: #fbbf24; --warn-soft: #33270a;
  --danger: #f87171; --danger-soft: #3a1a19;
  --shadow-md: 0 4px 10px rgba(0,0,0,.40); --shadow-lg: 0 14px 28px rgba(0,0,0,.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--ff); font-size: 15px; line-height: 1.5; }
body {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; min-height: 100dvh;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 16px calc(env(safe-area-inset-bottom, 0px) + 24px);
}
a { color: var(--brand-text); }

.beta-tag { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--warn); background: var(--warn-soft); padding: 3px 9px; border-radius: var(--r-full); }

.card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 32px 26px; }
.card + .card { margin-top: 16px; }
.logo { width: 52px; height: 52px; display: grid; place-items: center; margin: 0 auto 16px; background: var(--brand); border-radius: var(--r-md); box-shadow: var(--shadow-md); }
.logo svg { width: 30px; height: 30px; }
h1 { font-size: 22px; text-align: center; margin: 0 0 6px; text-wrap: balance; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { text-align: center; color: var(--text-muted); font-size: 14px; margin: 0 0 24px; }
.head { display: flex; justify-content: center; margin-bottom: 14px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
input { width: 100%; padding: 11px 13px; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--r-sm); font-size: 16px; font-family: inherit; }
input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.hint { font-size: 12.5px; color: var(--text-faint); margin-top: 5px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 11px 16px; font-size: 14px; font-weight: 600; font-family: inherit; border-radius: var(--r-sm); border: 1px solid transparent; min-height: 42px; cursor: pointer; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--brand-soft); outline-offset: 1px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); }
.btn-block { width: 100%; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row .btn { flex: 1 1 140px; }

.alert { padding: 11px 13px; border-radius: var(--r-sm); font-size: 14px; margin-bottom: 16px; }
.alert[hidden] { display: none; }
.alert-error { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); }
.alert-ok { background: var(--success-soft); color: var(--success); border: 1px solid var(--success); }

.or { display: flex; align-items: center; gap: 10px; color: var(--text-faint); font-size: 12.5px; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
#googleButton { display: flex; justify-content: center; min-height: 44px; }

dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 14px; margin: 0 0 20px; font-size: 14px; }
dl.facts dt { color: var(--text-muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: var(--r-full); background: var(--brand-soft); color: var(--brand-text); }
.linkbox { display: flex; gap: 8px; margin-top: 10px; }
.linkbox input { font-size: 13px; }
.muted { color: var(--text-muted); font-size: 13px; }
.center { text-align: center; }

/* The company logo on the sign-in page, straight on the card; dark mode
   (the phone's or picked by hand) shows logo-dark.png instead. It links
   back to the welcome page. */
.brand-logo { display: block; width: 128px; margin: 0 auto 14px; }
.brand-logo img { display: block; width: 100%; height: auto; }
.brand-logo .logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo .logo-light { display: none; }
  :root:not([data-theme="light"]) .brand-logo .logo-dark { display: block; }
}
:root[data-theme="dark"] .brand-logo .logo-light { display: none; }
:root[data-theme="dark"] .brand-logo .logo-dark { display: block; }

/* Light / dark switch (theme.js): a moon while light, a sun while dark */
.theme-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
  background: var(--surface); color: var(--text-muted); border: 1px solid var(--border);
  border-radius: var(--r-full); cursor: pointer; box-shadow: var(--shadow-md);
}
.theme-btn:hover { color: var(--text); border-color: var(--border-strong); }
.theme-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-soft); border-color: var(--brand); }
.theme-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .i-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; }
}
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
.theme-btn-corner {
  position: fixed; z-index: 5;
  top: calc(env(safe-area-inset-top, 0px) + 14px); right: calc(env(safe-area-inset-right, 0px) + 14px);
}
/* On a phone the card spans the width: keep it clear of the switch */
@media (max-width: 520px) {
  body:has(.theme-btn-corner) { padding-top: calc(env(safe-area-inset-top, 0px) + 66px); }
}
