:root {
  --green: #1db954;
  --green-dark: #17a348;
  --green-light: #e8f8ee;
  --navy: #0f1b2d;
  --text: #1a2332;
  --text-muted: #6b7a8f;
  --surface: #ffffff;
  --bg: #f4f6fa;
  --border: #e4e9f0;
  --red: #e53e3e;
  --radius: 14px;
  --radius-sm: 8px;
  --font: 'DM Sans', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
  padding: 24px;
}

a {
  text-decoration: none;
  color: var(--green);
  font-weight: 600;
  transition: color .2s;
}

a:hover {
  color: var(--green-dark);
}

svg {
  display: block;
}

/* ── CARD ── */
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0, 0, 0, .06), 0 1px 4px rgba(0, 0, 0, .04);
  padding: 40px 36px;
  position: relative;
  z-index: 1;
  animation: cardIn .4s cubic-bezier(.22, 1, .36, 1) both;
}

html.dark .auth-card {
  background: rgba(13, 22, 38, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(52, 211, 153, 0.15);
  box-shadow: 0 8px 40px rgba(0, 0, 0, .45), 0 1px 0 rgba(255,255,255,.04) inset;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── LOGO ── */
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.auth-logo svg {
  width: 24px;
  height: 24px;
  color: var(--green);
}

/* ── HEADER ── */
.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 6px;
}

.auth-header p {
  font-size: 14px;
  color: var(--text-muted);
}

/* ── DIVIDER ── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── FIELD ── */
.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.field-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field-input-wrap svg {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.field-input-wrap input {
  width: 100%;
  height: 48px;
  padding: 0 14px 0 42px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14.5px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

html.dark .field-input-wrap input {
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
  border-color: rgba(52, 211, 153, 0.2);
}

html.dark .field-input-wrap input::placeholder {
  color: #475569;
}

.field-input-wrap input::placeholder {
  color: var(--text-muted);
}

.field-input-wrap input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(29, 185, 84, .15);
  background: #fafffb;
}

.field-input-wrap input::selection {
  background: rgba(29, 185, 84, .25);
}

html.dark .field-input-wrap input:focus {
  box-shadow: 0 0 0 4px rgba(52, 211, 153, .2);
  background: rgba(255, 255, 255, .08);
}

html.dark .field-input-wrap input::selection {
  background: rgba(52, 211, 153, .3);
}

.field-input-wrap.error input {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(229, 62, 62, .08);
}

.field-error {
  display: block;
  font-size: 12px;
  color: var(--red);
  margin-top: 4px;
  min-height: 16px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .2s, transform .2s;
}

.field-error.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── PASSWORD TOGGLE ── */
.toggle-pw {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  display: flex;
  align-items: center;
  transition: color .2s;
  border-radius: 4px;
}

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

.toggle-pw svg {
  position: static;
  width: 18px;
  height: 18px;
}

/* ── FORGOT LINK ── */
.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.label-row label {
  margin-bottom: 0;
}

.forgot-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
}

.forgot-link:hover {
  color: var(--green-dark);
}

/* ── SUBMIT BUTTON ── */
.btn-auth {
  width: 100%;
  height: 50px;
  margin-top: 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--green);
  color: #fff;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .25s, transform .2s, box-shadow .25s;
  position: relative;
  overflow: hidden;
}

.btn-auth::after {
  content: '';
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .18), transparent);
  transform: skewX(-20deg);
  transition: left .6s cubic-bezier(.22, 1, .36, 1);
}

.btn-auth:hover {
  background: var(--green-dark);
  box-shadow: 0 6px 24px rgba(29, 185, 84, .35);
  transform: translateY(-2px);
}

.btn-auth:hover::after {
  left: 125%;
}

.btn-auth:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(29, 185, 84, .25);
}

.btn-auth:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-auth:disabled::after {
  display: none;
}

.btn-auth .btn-spinner {
  display: none;
}

.btn-auth.loading .btn-text,
.btn-auth.loading .btn-arrow {
  opacity: 0;
}

.btn-auth.loading .btn-spinner {
  display: block;
}

.btn-auth.loading:hover {
  transform: none;
  box-shadow: 0 6px 24px rgba(29, 185, 84, .35);
}

.btn-spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  position: absolute;
  inset: 0;
  margin: auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── FOOTER ── */
.auth-footer {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 24px;
}

/* ── TOGGLE ROW (register terms) ── */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0;
  font-size: 14px;
  color: var(--text-muted);
}

.toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
  cursor: pointer;
}

.toggle-row label {
  cursor: pointer;
}

/* ── NAME ROW (first + last) ── */
.name-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── LOADING SPINNER (inline button) ── */
.btn-loadable {
  position: relative;
}

.btn-loadable.is-loading .btn-label {
  visibility: hidden;
}

.btn-loadable .btn-spinner {
  display: none;
}

.btn-loadable.is-loading .btn-spinner {
  display: block;
}

/* ── UTILITY ── */
.hidden {
  display: none !important;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  body {
    padding: 16px;
  }

  .auth-card {
    padding: 36px 28px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 12px;
  }

  .auth-card {
    padding: 28px 20px;
    border-radius: 12px;
  }

  .auth-header h1 {
    font-size: 20px;
  }

  .auth-header p {
    font-size: 13px;
  }

  .auth-header {
    margin-bottom: 24px;
  }

  .field {
    margin-bottom: 16px;
  }

  .field-input-wrap input {
    height: 44px;
    font-size: 14px;
    padding: 0 14px 0 38px;
  }

  .btn-auth {
    height: 46px;
    font-size: 14px;
  }

  .name-row {
    grid-template-columns: 1fr;
  }

  .auth-footer {
    font-size: 13px;
  }
}