/* css/auth.css
   =================================================================
   AUTH 
   ================================================================= */

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

:root {
  /* Brand */
  --brand:        #2451e0;
  --brand-dark:   #16308f;
  --brand-soft:   #eef2ff;

  /* Surfaces */
  --bg:           #eef1f7;
  --surface:      #ffffff;

  /* Ink */
  --ink:          #101828;
  --ink-soft:     #475467;
  --ink-faint:    #98a2b3;
  --ink-on-brand: #ffffff;
  --ink-on-brand-soft: rgba(255,255,255,.72);

  /* Borders */
  --border:       #e4e7ec;
  --border-hover: #cfd4dc;

  /* Status */
  --success:      #12894f;
  --success-bg:   #ecfdf3;
  --success-line: #abefc6;
  --danger:       #b42318;
  --danger-bg:    #fef3f2;
  --danger-line:  #fda29b;

  /* Radii */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 20px;
  --r-xl: 28px;

  /* Shadows */
  --shadow-card: 0 2px 6px rgba(16,24,40,.04), 0 24px 64px -12px rgba(16,24,40,.14);
  --shadow-btn:  0 1px 2px rgba(16,24,40,.06), 0 8px 20px -4px rgba(36,81,224,.35);

  --t: .16s ease;
}

html, body {
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background:
    radial-gradient(1100px 600px at 12% -10%, #dfe6fb 0%, transparent 55%),
    radial-gradient(900px 500px at 105% 105%, #e7ebfa 0%, transparent 55%),
    var(--bg);
}

.auth-frame {
  width: 100%;
  max-width: 940px;
  min-height: 600px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* ── Brand panel (left) ─────────────────────────────────── */

.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px 42px;
  background: linear-gradient(160deg, var(--brand-dark) 0%, var(--brand) 62%, #4a6ef0 100%);
  color: var(--ink-on-brand);
  overflow: hidden;
}
.auth-brand-glow {
  position: absolute; inset: 0; pointer-events: none;
}
.auth-brand-glow::before, .auth-brand-glow::after {
  content: ""; position: absolute; border-radius: 50%;
  filter: blur(60px); opacity: .35;
}
.auth-brand-glow::before {
  width: 320px; height: 320px; background: #8fa6ff;
  top: -90px; right: -90px;
}
.auth-brand-glow::after {
  width: 260px; height: 260px; background: #1c3fc2;
  bottom: -80px; left: -60px;
}

.auth-brand-top {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 12px;
}
.auth-brand-mark {
  width: 40px; height: 40px; border-radius: 11px;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.28);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; letter-spacing: .02em;
  flex-shrink: 0;
}
.auth-brand-name { display: flex; flex-direction: column; line-height: 1.25; }
.auth-brand-name strong { font-size: 14px; font-weight: 700; }
.auth-brand-name span { font-size: 11.5px; color: var(--ink-on-brand-soft); }

.auth-brand-greet {
  position: relative; z-index: 1;
  padding: 40px 0;
}
.auth-greet-avatar {
  width: 0; height: 0; border-radius: 50%;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.35);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0;
  margin-bottom: 0; opacity: 0;
  transition: all .28s ease;
  overflow: hidden;
}
.auth-greet-avatar.show {
  width: 52px; height: 52px; font-size: 17px;
  margin-bottom: 18px; opacity: 1;
}
.auth-brand-greet h2 {
  font-size: 28px; font-weight: 700; letter-spacing: -.02em;
  line-height: 1.25; margin-bottom: 10px;
  transition: opacity .15s ease;
}
.auth-brand-greet p {
  font-size: 14px; line-height: 1.6;
  color: var(--ink-on-brand-soft);
  max-width: 340px;
  transition: opacity .15s ease;
}

.auth-brand-foot {
  position: relative; z-index: 1;
  font-size: 12px; color: var(--ink-on-brand-soft);
}

/* ── Form panel (right) ─────────────────────────────────── */

.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 44px 46px;
}
.auth-form-inner { width: 100%; max-width: 320px; }

.auth-mobile-brand {
  display: none;
  align-items: center; gap: 10px;
  margin-bottom: 28px;
}
.auth-mobile-brand .auth-brand-mark {
  background: var(--brand-soft); border: 1px solid #dbe3fd; color: var(--brand);
}
.auth-mobile-brand span { font-size: 14px; font-weight: 700; color: var(--ink); }

.auth-form-inner h1 {
  font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--ink);
}
.auth-lede {
  font-size: 13.5px; color: var(--ink-soft); margin-top: 6px; margin-bottom: 26px;
}

.auth-alert {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 11px 14px; border-radius: var(--r-sm);
  font-size: 13px; line-height: 1.5; border: 1px solid;
  margin-bottom: 16px;
}
.auth-alert.error   { background: var(--danger-bg);  border-color: var(--danger-line);  color: var(--danger); }
.auth-alert.success { background: var(--success-bg); border-color: var(--success-line); color: var(--success); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-head-row { display: flex; align-items: center; justify-content: space-between; }
.auth-inline-link { font-size: 12px; font-weight: 600; color: var(--brand); text-decoration: none; }
.auth-inline-link:hover { text-decoration: underline; }
.field label {
  font-size: 12.5px; font-weight: 600; color: var(--ink);
}
.field input {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px; font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.field input::placeholder { color: var(--ink-faint); }
.field input:hover { border-color: var(--border-hover); }
.field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(36,81,224,.12);
}

.field.is-checking input { background-image: none; }
.field.is-checking label::after {
  content: "checking…"; margin-left: 8px; font-weight: 500; color: var(--ink-faint); text-transform: none;
}

.pw-field { position: relative; }
.pw-field input { padding-right: 42px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: 8px;
  border: none; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint);
  transition: background var(--t), color var(--t);
}
.pw-toggle:hover { background: var(--brand-soft); color: var(--brand); }
.pw-toggle svg { width: 18px; height: 18px; }
.pw-toggle .icon-eye-off { display: none; }
.pw-toggle.is-visible .icon-eye { display: none; }
.pw-toggle.is-visible .icon-eye-off { display: block; }

.auth-btn {
  width: 100%; padding: 12px; margin-top: 6px;
  font-size: 14.5px; font-weight: 600; font-family: inherit;
  color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  border: none; border-radius: var(--r); cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: filter var(--t), transform .05s;
}
.auth-btn:hover { filter: brightness(1.06); }
.auth-btn:active { transform: translateY(1px); }
.auth-btn:disabled { opacity: .6; cursor: not-allowed; }

.auth-form-foot {
  margin-top: 26px; font-size: 12px; color: var(--ink-faint); text-align: center;
}
.hint { font-size: 11.5px; color: var(--ink-faint); line-height: 1.5; }

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 860px) {
  .auth-frame { grid-template-columns: 1fr; max-width: 420px; }
  .auth-brand { display: none; }
  .auth-mobile-brand { display: flex; }
  .auth-form-panel { padding: 40px 30px; }
}
@media (max-width: 480px) {
  .auth-wrap { padding: 20px 14px; }
  .auth-frame { border-radius: var(--r-lg); }
  .auth-form-panel { padding: 34px 22px; }
}
