/* ── Design tokens ───────────────────────────────────────────────────────── */
:root {
  --bg:             #F4F5F9;
  --surface:        #FFFFFF;
  --surface-raised: #EEF0F6;
  --border:         #E2E4ED;
  --text:           #13131F;
  --muted:          #6B6B8A;
  --faint:          #A0A0B8;

  --primary:        #0EA5C9;
  --primary-hover:  #0993B5;
  --primary-soft:   #E0F5FA;
  --on-primary:     #FFFFFF;

  --amber:          #D97706;
  --amber-soft:     #FEF3C7;
  --green:          #059669;
  --green-soft:     #D1FAE5;
  --red:            #DC2626;
  --red-soft:       #FEE2E2;

  --radius:         10px;
  --radius-lg:      16px;
  --shadow-card:    0 1px 3px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.05);
}

[data-theme="dark"] {
  --bg:             #13131F;
  --surface:        #1E1E2E;
  --surface-raised: #252538;
  --border:         rgba(255,255,255,0.08);
  --text:           #E8E8F4;
  --muted:          #8888AA;
  --faint:          #55557A;

  --primary:        #17C1E8;
  --primary-hover:  #2DCFEF;
  --primary-soft:   rgba(23,193,232,0.12);
  --on-primary:     #0A1628;

  --amber:          #F6C90E;
  --amber-soft:     rgba(246,201,14,0.12);
  --green:          #4CAF50;
  --green-soft:     rgba(76,175,80,0.12);
  --red:            #F87171;
  --red-soft:       rgba(248,113,113,0.12);

  --shadow-card:    0 1px 0 rgba(255,255,255,0.04) inset;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  transition: background-color 0.2s, color 0.2s;
}

/* ── Theme toggle ────────────────────────────────────────────────────────── */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.2s;
  z-index: 100;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ── Auth wrapper ────────────────────────────────────────────────────────── */
.auth-wrapper {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* ── Brand ───────────────────────────────────────────────────────────────── */
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--primary-soft);
  border: 1px solid var(--primary);
  color: var(--primary);
  font-size: 26px;
  font-weight: 700;
  display: grid;
  place-items: center;
  letter-spacing: -1px;
  transition: background 0.2s, border-color 0.2s;
}
[data-theme="dark"] .brand-mark {
  background: var(--primary-soft);
  border-color: rgba(23,193,232,0.3);
}
.brand-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.brand-sub {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
  margin-top: 2px;
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.auth-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 28px 20px;
  box-shadow: var(--shadow-card);
  transition: background 0.2s, border-color 0.2s;
}

/* ── Screen heading ──────────────────────────────────────────────────────── */
.screen-head {
  margin-bottom: 22px;
}
.screen-greeting {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 0 0 8px;
}
.screen-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.screen-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.55;
}

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-error   { background: var(--red-soft);   border: 1px solid var(--red);   color: var(--red);   }
.alert-success { background: var(--green-soft);  border: 1px solid var(--green); color: var(--green); }
[data-theme="dark"] .alert-error  { color: #fca5a5; }
[data-theme="dark"] .alert-success { color: #86efac; }

/* ── Google OAuth button ─────────────────────────────────────────────────── */
.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: 600 14px 'Inter', sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  margin-bottom: 18px;
}
.btn-google:hover {
  border-color: var(--primary);
  background: var(--surface-raised);
  transform: translateY(-1px);
}

/* ── Divider ─────────────────────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  font-size: 12px;
  color: var(--faint);
  letter-spacing: 0.04em;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Fields ──────────────────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.field-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  overflow: hidden;
}
.field-input:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  background: var(--surface);
}
.field-input.has-error { border-color: var(--red); }
.field-input.has-error:focus-within { box-shadow: 0 0 0 3px var(--red-soft); }

.field-icon {
  display: grid;
  place-items: center;
  padding: 0 0 0 13px;
  color: var(--faint);
  flex-shrink: 0;
  transition: color 0.15s;
}
.field-input:focus-within .field-icon { color: var(--primary); }

.field-input input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 11px 13px;
  color: var(--text);
  font: 500 14px 'Inter', sans-serif;
  width: 100%;
  min-width: 0;
}
.field-input input::placeholder { color: var(--faint); font-weight: 400; }

.field-error {
  display: block;
  font-size: 12px;
  color: var(--red);
  margin-top: 5px;
}

/* ── Password reveal ─────────────────────────────────────────────────────── */
.reveal {
  display: grid;
  place-items: center;
  padding: 0 12px;
  height: 42px;
  background: none;
  border: 0;
  color: var(--faint);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s;
}
.reveal:hover { color: var(--text); }

/* ── Password strength ───────────────────────────────────────────────────── */
.strength-wrap { margin: -2px 0 14px; }
.strength-bars {
  display: flex;
  gap: 4px;
  margin-bottom: 5px;
}
.strength-bars span {
  flex: 1;
  height: 3px;
  border-radius: 99px;
  background: var(--border);
  transition: background 0.25s;
}
.strength-label { font-size: 11.5px; color: var(--faint); }

.strength-wrap.s1 .strength-bars span:nth-child(1) { background: var(--red); }
.strength-wrap.s2 .strength-bars span:nth-child(-n+2) { background: var(--amber); }
.strength-wrap.s3 .strength-bars span:nth-child(-n+3) { background: var(--primary); }
.strength-wrap.s4 .strength-bars span { background: var(--green); }

.strength-wrap.s1 .strength-label { color: var(--red); }
.strength-wrap.s2 .strength-label { color: var(--amber); }
.strength-wrap.s3 .strength-label { color: var(--primary); }
.strength-wrap.s4 .strength-label { color: var(--green); }

/* ── Checkbox ────────────────────────────────────────────────────────────── */
.check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check .box {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  display: grid;
  place-items: center;
  color: transparent;
  transition: all 0.15s;
}
.check input:checked + .box {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.check.terms { align-items: flex-start; line-height: 1.55; }
.check.terms .box { margin-top: 2px; }

/* ── Row between ─────────────────────────────────────────────────────────── */
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 20px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: 12px 18px;
  background: var(--primary);
  color: var(--on-primary);
  border: 0;
  border-radius: var(--radius);
  font: 600 14px 'Inter', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(14,165,201,0.3);
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(14,165,201,0.38);
}
.btn-primary:active { transform: translateY(0); }

[data-theme="dark"] .btn-primary {
  box-shadow: 0 4px 14px rgba(23,193,232,0.22);
}

/* ── Links ───────────────────────────────────────────────────────────────── */
.link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  transition: color 0.15s;
}
.link:hover { color: var(--primary-hover); text-decoration: underline; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 20px;
  transition: color 0.15s;
}
.back-link:hover { color: var(--text); }

/* ── Footer text ─────────────────────────────────────────────────────────── */
.screen-foot {
  margin: 18px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.foot-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--faint);
  margin-top: 18px;
}
.foot-note svg { color: var(--green); flex-shrink: 0; }

/* ── Sent confirmation ───────────────────────────────────────────────────── */
.sent-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  margin-bottom: 20px;
}

/* ── Segmented nav ───────────────────────────────────────────────────────── */
.seg {
  display: flex;
  gap: 3px;
  background: var(--surface-raised);
  border-radius: var(--radius);
  padding: 3px;
  margin-top: 22px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  background: transparent;
}
.seg a {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.15s;
  background: transparent;
}
.seg a:hover { color: var(--text); background: var(--surface-raised); }
.seg a.active {
  background: var(--primary-soft);
  color: var(--primary);
}

/* ── Copyright ───────────────────────────────────────────────────────────── */
.auth-copy {
  font-size: 12px;
  color: var(--faint);
  margin: 0;
  text-align: center;
}

/* ── Terms margin ────────────────────────────────────────────────────────── */
.terms-wrap { margin: 4px 0 20px; }
