*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink:          #111210;
  --paper:        #F8F7F3;
  --muted:        #6B6A63;
  --border:       #E0DED6;
  --accent:       #1A6B45;
  --accent-light: #EBF4EE;
  --danger:       #C0392B;
  --danger-light: #FDF0EE;
  --success:      #1A6B45;
  --serif:        'Instrument Serif', Georgia, serif;
  --sans:         'DM Sans', sans-serif;
  --radius:       10px;
  --input-h:      44px;
}

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

/* ── BACKGROUND ─────────────────────────────────── */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
}

/* ── WRAPPER / CARD ─────────────────────────────── */
.auth-wrapper {
  position: relative;
  z-index: 1;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 44px 36px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 2px 40px rgba(0,0,0,.06);
}

/* ── LOGO ───────────────────────────────────────── */
.logo {
  display: block;
  font-family: var(--serif);
  font-size: 20px;
  color: var(--ink);
  text-decoration: none;
  margin-bottom: 28px;
  letter-spacing: -0.3px;
}
.logo span { color: var(--accent); }

/* ── TAB SWITCHER ───────────────────────────────── */
.tab-switcher {
  display: flex;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 28px;
  gap: 3px;
}
.tab-btn {
  flex: 1;
  padding: 8px;
  font-size: 14px;
  font-family: var(--sans);
  font-weight: 400;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all .2s;
}
.tab-btn.active {
  background: #fff;
  color: var(--ink);
  font-weight: 500;
  border: 1px solid var(--border);
}

/* ── FORM HEADER ────────────────────────────────── */
.form-header { margin-bottom: 24px; }
.form-header h1 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 400;
  margin-bottom: 4px;
}
.form-header p { font-size: 14px; color: var(--muted); }

/* ── GOOGLE BUTTON ──────────────────────────────── */
.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--sans);
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .2s, background .2s;
  margin-bottom: 20px;
}
.btn-google:hover { border-color: #aaa; background: var(--paper); }
.btn-google svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ── DIVIDER ────────────────────────────────────── */
.divider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 12px;
}
.divider-row::before,
.divider-row::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── FIELDS ─────────────────────────────────────── */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.field-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.field-group input,
.field-group select {
  height: var(--input-h);
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--sans);
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}
.field-group input:focus,
.field-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,107,69,.10);
}
.field-group input.error,
.field-group select.error { border-color: var(--danger); }
.field-group input.error:focus { box-shadow: 0 0 0 3px rgba(192,57,43,.10); }

.field-group select { cursor: pointer; }

/* ── INPUT WITH PASSWORD TOGGLE ─────────────────── */
.input-wrap { position: relative; }
.input-wrap input { padding-right: 44px; }
.toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--muted);
  display: flex;
  align-items: center;
}
.toggle-pw:hover { color: var(--ink); }
.eye-icon { width: 16px; height: 16px; }

/* ── PASSWORD STRENGTH ──────────────────────────── */
.pw-strength {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.pw-bar {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.pw-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .3s, background .3s;
}
.pw-label { font-size: 11px; min-width: 40px; }

/* ── FIELD ERROR ────────────────────────────────── */
.field-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 5px;
  min-height: 16px;
  display: block;
}

/* ── FORGOT LINK ────────────────────────────────── */
.forgot-link {
  font-size: 12px;
  font-weight: 400;
  color: var(--accent);
  text-decoration: none;
}
.forgot-link:hover { text-decoration: underline; }

/* ── FORM ALERT (success / error) ───────────────── */
.form-alert {
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
}
.form-alert.alert-error {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid #f0bfbb;
}
.form-alert.alert-success {
  background: var(--accent-light);
  color: var(--success);
  border: 1px solid #b2d9c3;
}

/* ── SUBMIT BUTTON ──────────────────────────────── */
.btn-submit {
  width: 100%;
  height: 46px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-family: var(--sans);
  font-weight: 500;
  cursor: pointer;
  transition: background .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}
.btn-submit:hover { background: #155c39; }
.btn-submit:disabled { opacity: .6; cursor: not-allowed; }

/* ── SPINNER ────────────────────────────────────── */
.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TERMS ──────────────────────────────────────── */
.terms-note {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-top: 14px;
  line-height: 1.6;
}
.terms-note a { color: var(--accent); text-decoration: none; }
.terms-note a:hover { text-decoration: underline; }

/* ── BACK BUTTON ────────────────────────────────── */
.back-btn {
  background: none;
  border: none;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  margin-bottom: 20px;
  display: block;
}
.back-btn:hover { color: var(--ink); }

/* ── RESPONSIVE ─────────────────────────────────── */
@media (max-width: 480px) {
  .auth-wrapper { padding: 28px 20px 24px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
}
