:root {
  --mf-green: #178746;
  --mf-green-dark: #116b37;
  --mf-red: #d9171a;
  --mf-ink: #161816;
  --mf-muted: #69716b;
  --mf-line: #dfe5e0;
  --mf-bg: #f4f7f4;
  --mf-white: #fff;
  --mf-danger: #b42318;
  --mf-success: #167342;
  --mf-warning: #8a5a00;
  --mf-radius: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--mf-bg); }
body {
  min-height: 100vh;
  margin: 0;
  font-family: "Nunito", Arial, sans-serif;
  color: var(--mf-ink);
  background:
    radial-gradient(circle at 15% 10%, rgba(23,135,70,.10), transparent 28rem),
    radial-gradient(circle at 85% 85%, rgba(217,23,26,.07), transparent 25rem),
    var(--mf-bg);
}
button, input { font: inherit; }
a { color: inherit; }

.auth-topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid rgba(17,24,17,.08);
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(12px);
}
.auth-brand {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 700;
  letter-spacing: -.035em;
  text-decoration: none;
}
.auth-brand strong { color: var(--mf-red); }
.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  font-weight: 800;
  color: #3f4741;
  padding: 9px 12px;
  border-radius: 11px;
}
.auth-back:hover, .auth-back:focus-visible { background: #edf2ee; }

.auth-shell {
  width: 100%;
  min-height: calc(100vh - 122px);
  display: grid;
  place-items: center;
  padding: 42px 18px 34px;
}
.auth-card {
  width: min(100%, 468px);
  background: rgba(255,255,255,.98);
  border: 1px solid rgba(17,24,17,.09);
  border-radius: var(--mf-radius);
  padding: clamp(24px, 5vw, 38px);
  box-shadow: 0 24px 70px rgba(21,37,25,.13);
}
.auth-card-heading { text-align: center; margin-bottom: 26px; }
.auth-card-heading h1 {
  margin: 0;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: clamp(28px, 5vw, 38px);
  line-height: 1.05;
  letter-spacing: -.025em;
}
.auth-card-heading p {
  margin: 12px auto 0;
  max-width: 38ch;
  color: var(--mf-muted);
  line-height: 1.5;
}

.auth-actions { display: grid; gap: 12px; }
.btn {
  min-height: 50px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 16px;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:focus-visible, input:focus-visible, .password-toggle:focus-visible, .auth-back:focus-visible {
  outline: 3px solid rgba(23,135,70,.22);
  outline-offset: 2px;
}
.btn-primary { color: #fff; background: var(--mf-green); box-shadow: 0 10px 24px rgba(23,135,70,.20); }
.btn-primary:hover:not(:disabled) { background: var(--mf-green-dark); }
.btn-secondary { color: var(--mf-ink); background: #fff; border-color: #cfd7d1; }
.btn-secondary:hover:not(:disabled) { border-color: #aebbb1; background: #f8faf8; }
.btn-danger { color: #fff; background: var(--mf-danger); }
.btn:disabled { cursor: not-allowed; opacity: .55; box-shadow: none; }
.btn.loading::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.google-button-wrap { min-height: 44px; display: grid; place-items: center; overflow: hidden; }
.google-unavailable {
  min-height: 48px;
  border: 1px dashed #c8d0ca;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--mf-muted);
  font-size: 14px;
}
.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: #8a928c; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--mf-line); }

.form-grid { display: grid; gap: 17px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 14px; font-weight: 800; }
.field input[type="email"], .field input[type="text"], .field input[type="password"] {
  width: 100%;
  min-height: 49px;
  border: 1px solid #cfd7d1;
  border-radius: 11px;
  padding: 12px 13px;
  background: #fff;
  color: var(--mf-ink);
  transition: border-color .12s, box-shadow .12s;
}
.field input:hover { border-color: #aebbb1; }
.field input:focus { border-color: var(--mf-green); box-shadow: 0 0 0 3px rgba(23,135,70,.10); outline: 0; }
.field input[aria-invalid="true"] { border-color: var(--mf-danger); }
.field-help { margin: 0; color: var(--mf-muted); font-size: 13px; line-height: 1.4; }
.field-status { min-height: 19px; margin: 0; font-size: 13px; font-weight: 700; }
.field-status.error { color: var(--mf-danger); }
.field-status.success { color: var(--mf-success); }
.field-status.waiting { color: var(--mf-warning); }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 50px !important; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 40px;
  height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  color: #515a53;
  display: grid;
  place-items: center;
}
.password-toggle:hover { background: #edf2ee; }
.password-strength { height: 5px; border-radius: 99px; background: #e7ebe8; overflow: hidden; }
.password-strength span { display: block; height: 100%; width: 0; background: #b42318; transition: width .2s, background .2s; }
.password-strength[data-score="2"] span { width: 50%; background: #b26a00; }
.password-strength[data-score="3"] span { width: 75%; background: #5e8b2c; }
.password-strength[data-score="4"] span { width: 100%; background: var(--mf-green); }

.checkbox-row { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.45; }
.checkbox-row input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--mf-green); flex: 0 0 auto; }
.checkbox-row a, .text-link { color: var(--mf-green-dark); font-weight: 800; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.form-footer { text-align: center; color: var(--mf-muted); font-size: 14px; margin: 18px 0 0; }
.form-footer a { color: var(--mf-green-dark); font-weight: 800; }
.inline-links { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.alert { border-radius: 11px; padding: 12px 14px; margin-bottom: 18px; font-size: 14px; line-height: 1.45; border: 1px solid; }
.alert-error { color: #7a1b13; background: #fff0ee; border-color: #f1c0ba; }
.alert-success { color: #0e5c34; background: #eaf8f0; border-color: #b8dfc8; }
.alert-info { color: #2e5167; background: #eef7fb; border-color: #c4dce8; }
.alert-warning { color: #684500; background: #fff8e5; border-color: #ead59c; }

.legal-note { margin: 18px auto 0; color: #798079; font-size: 12px; line-height: 1.55; text-align: center; }
.legal-note a { color: #505951; font-weight: 700; }
.auth-footer { min-height: 50px; display: grid; place-items: center; color: #7d857f; font-size: 12px; padding: 0 20px 18px; }

.account-grid { display: grid; gap: 14px; }
.account-row { padding: 14px 15px; border: 1px solid var(--mf-line); border-radius: 12px; background: #fbfcfb; }
.account-row small { display: block; color: var(--mf-muted); font-weight: 700; margin-bottom: 4px; }
.account-row strong { overflow-wrap: anywhere; }
.account-nav { display: grid; gap: 10px; margin-top: 20px; }
.account-nav a { text-decoration: none; }
.logout-form { margin-top: 12px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 7px; }
.suggestion { border: 1px solid #cfd7d1; background: #fff; border-radius: 999px; padding: 5px 9px; cursor: pointer; font-size: 12px; font-weight: 800; }
.suggestion:hover { border-color: var(--mf-green); color: var(--mf-green-dark); }

@media (max-width: 600px) {
  .auth-topbar { min-height: 62px; padding: 0 16px; }
  .auth-back span { display: none; }
  .auth-shell { min-height: calc(100vh - 105px); padding: 22px 12px; place-items: start center; }
  .auth-card { padding: 25px 19px; border-radius: 15px; }
  .auth-card-heading { margin-bottom: 22px; }
  .inline-links { align-items: flex-start; flex-direction: column; }
}
