:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --border: #e4e2de;
  --border-soft: #eeece8;
  --text: #1b1a18;
  --muted: #6d6a64;
  --faint: #9a968f;
  --accent: #2f5d50;
  --accent-text: #ffffff;
  --error: #9b2c2c;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151618;
    --surface: #1e2023;
    --border: #32353a;
    --border-soft: #26292d;
    --text: #eceae8;
    --muted: #9b968e;
    --faint: #6f6b65;
    --accent: #74b4a1;
    --accent-text: #0f201b;
    --error: #ef938f;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  }
}

:root[data-theme="dark"] {
  --bg: #151618;
  --surface: #1e2023;
  --border: #32353a;
  --border-soft: #26292d;
  --text: #eceae8;
  --muted: #9b968e;
  --faint: #6f6b65;
  --accent: #74b4a1;
  --accent-text: #0f201b;
  --error: #ef938f;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── header ─────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--border-soft);
}

.brand {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.brand span { color: var(--faint); font-weight: 400; }

.topbar nav {
  display: flex;
  gap: 4px;
}

.topbar nav a {
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}

.topbar nav a:hover {
  background: var(--surface);
  color: var(--text);
}

/* ── layout ─────────────────────────────────────────────────────────── */

main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px 56px;
}

.card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 32px;
}

.card.wide { max-width: 520px; }

h1 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sub {
  margin: 0 0 32px;
  color: var(--muted);
  font-size: 15px;
}

.sub:last-child { margin-bottom: 0; }

/* ── actions ────────────────────────────────────────────────────────── */

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

a.btn, button {
  display: block;
  width: 100%;
  padding: 12px 18px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .12s, opacity .12s, background .12s;
}

a.btn:hover, button:hover { border-color: var(--faint); }

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.primary:hover { opacity: .9; border-color: var(--accent); }

button:disabled { opacity: .5; cursor: default; }

/* ── forms ──────────────────────────────────────────────────────────── */

label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

input {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* 16px stops iOS zooming on focus */
}

input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: transparent;
}

.msg {
  min-height: 22px;
  margin: 12px 0 0;
  font-size: 13.5px;
  color: var(--error);
}

/* ── misc ───────────────────────────────────────────────────────────── */

.back {
  display: inline-block;
  margin-top: 28px;
  font-size: 13.5px;
  color: var(--muted);
  text-decoration: none;
}

.back:hover { color: var(--text); }

.foot {
  padding: 0 16px 24px;
  text-align: center;
  font-size: 12.5px;
  color: var(--faint);
}

.tag {
  display: inline-block;
  margin-bottom: 20px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--faint);
}

.rule {
  margin: 28px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 420px) {
  .card { padding: 32px 22px; }
  h1 { font-size: 21px; }
}
