/* ============================================================
   Sectionly — Authentication screens
   Split layout: dark brand panel (left) + form (right).
   Reuses the app design tokens from styles.css.
   ============================================================ */

.auth {
  height: 100%;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ---------- Left brand panel ---------- */
.auth-brand {
  position: relative;
  overflow: hidden;
  background: var(--sb-bg);
  color: var(--sb-text);
  padding: 48px 52px;
  display: flex;
  flex-direction: column;
}
.auth-brand-logo { display: flex; align-items: center; gap: 11px; }
.auth-brand-logo img { height: 32px; width: auto; display: block; }
.auth-brand-body { margin-top: auto; margin-bottom: auto; max-width: 30ch; position: relative; z-index: 2; }
.auth-brand-eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: #6aa8ff; margin-bottom: 18px;
}
.auth-brand h1 {
  font-family: var(--font-display);
  font-size: 40px; line-height: 1.08; letter-spacing: -.03em;
  margin: 0 0 18px; color: #fff;
  text-wrap: balance;
}
.auth-brand p { margin: 0; font-size: 16px; line-height: 1.6; color: var(--sb-text-dim); }
.auth-feats { list-style: none; margin: 30px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.auth-feats li { display: flex; align-items: center; gap: 12px; font-size: 14.5px; color: var(--sb-text); }
.auth-feats .af-ico {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center; color: #fff;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .12);
}
.auth-feats .af-ico svg { width: 16px; height: 16px; }
.auth-brand-foot { position: relative; z-index: 2; font-size: 13px; color: var(--sb-text-dim); }

/* aurora bloom echoing the active sidebar nav item */
.auth-brand::before {
  content: ''; position: absolute; right: -120px; top: -80px;
  width: 460px; height: 460px; border-radius: 50%;
  background:
    radial-gradient(55% 130% at 76% 88%, #a02ef0 0%, rgba(160, 46, 240, 0) 58%),
    radial-gradient(60% 140% at 96% 12%, #54e6e2 0%, rgba(84, 230, 226, 0) 55%),
    radial-gradient(80% 160% at 62% 0%, #f773c8 0%, rgba(247, 115, 200, 0) 60%),
    radial-gradient(50% 130% at 30% 55%, #fbdcb6 0%, rgba(251, 220, 182, 0) 70%);
  filter: blur(40px); opacity: .55; pointer-events: none;
}
.auth-brand::after {
  content: ''; position: absolute; left: -90px; bottom: -120px;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 60%, transparent) 0%, transparent 70%);
  filter: blur(50px); opacity: .5; pointer-events: none;
}

/* ---------- Right form panel ---------- */
.auth-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 40px 32px; overflow-y: auto; min-height: 0;
  background: var(--bg);
}
.auth-card {
  width: 100%; max-width: 408px;
}
/* visible end-state is the base (robust against rAF throttling in previews);
   only a subtle lift is animated, so a frozen first frame is still visible */
@media (prefers-reduced-motion: no-preference) {
  .auth-card { animation: authIn .5s var(--ease) both; }
}
@keyframes authIn { from { transform: translateY(14px); } to { transform: none; } }

.auth-card-logo { display: none; align-items: center; gap: 10px; margin-bottom: 26px; }
.auth-card-logo img { height: 30px; }

.auth-head { margin-bottom: 24px; }
.auth-head h2 {
  font-family: var(--font-display);
  font-size: 27px; letter-spacing: -.02em; margin: 0 0 7px;
}
.auth-head p { margin: 0; font-size: 14.5px; color: var(--text-2); line-height: 1.5; }
.auth-head p b { color: var(--text); font-weight: 600; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-field { display: flex; flex-direction: column; gap: 7px; }
.auth-field > label { font-size: 13px; font-weight: 600; color: var(--text); }
.auth-field .req { color: #ef4444; }

.auth-input {
  position: relative; display: flex; align-items: center;
}
.auth-input > .ai-lead {
  position: absolute; left: 13px; color: var(--text-3); display: grid; place-items: center; pointer-events: none;
}
.auth-input > .ai-lead svg { width: 17px; height: 17px; }
.auth-input input {
  width: 100%; height: 46px; padding: 0 14px 0 40px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 14.5px; outline: none;
  transition: border-color .14s, box-shadow .14s;
}
.auth-input.has-toggle input { padding-right: 44px; }
.auth-input input::placeholder { color: var(--text-3); }
.auth-input input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-input.err input { border-color: #ef4444; box-shadow: 0 0 0 3px color-mix(in srgb, #ef4444 16%, transparent); }
.auth-input.ok input { border-color: color-mix(in srgb, #1a9d5a 60%, var(--border)); }
.auth-eye {
  position: absolute; right: 8px; width: 32px; height: 32px;
  border: none; background: none; border-radius: 7px;
  display: grid; place-items: center; color: var(--text-3); cursor: pointer;
}
.auth-eye:hover { color: var(--text); background: var(--surface-2); }
.auth-eye svg { width: 18px; height: 18px; }

.auth-fielderr { font-size: 12.5px; color: #ef4444; font-weight: 500; display: flex; align-items: center; gap: 5px; }
.auth-hint { font-size: 12.5px; color: var(--text-3); }

/* password rules */
.auth-rules { display: flex; flex-direction: column; gap: 5px; margin-top: 2px; }
.auth-rule { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-3); transition: color .14s; }
.auth-rule .ar-tick {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 1.5px solid var(--border-strong); display: grid; place-items: center; color: transparent;
  transition: background .14s, border-color .14s, color .14s;
}
.auth-rule .ar-tick svg { width: 11px; height: 11px; }
.auth-rule.met { color: #1a9d5a; }
.auth-rule.met .ar-tick { background: #1a9d5a; border-color: #1a9d5a; color: #fff; }

/* options row */
.auth-optrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13.5px; color: var(--text-2); }
.auth-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.auth-check .ac-box {
  width: 19px; height: 19px; border-radius: 6px; flex: none;
  border: 1.5px solid var(--border-strong); display: grid; place-items: center; color: #fff;
  transition: background .14s, border-color .14s;
}
.auth-check .ac-box svg { width: 12px; height: 12px; opacity: 0; transition: opacity .14s; }
.auth-check input:checked + .ac-box { background: var(--accent); border-color: var(--accent); }
.auth-check input:checked + .ac-box svg { opacity: 1; }
.auth-check input:focus-visible + .ac-box { box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-link {
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: inherit; font-size: 13.5px; font-weight: 600; color: var(--accent);
  white-space: nowrap;
}
.auth-link:hover { text-decoration: underline; }

/* primary submit */
.auth-submit {
  height: 47px; width: 100%; border-radius: var(--r-sm);
  background: var(--accent); border: 1px solid var(--accent); color: var(--on-accent);
  font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 2px 10px -2px color-mix(in srgb, var(--accent) 55%, transparent);
  transition: background .14s, transform .08s, opacity .14s;
}
.auth-submit:hover { background: var(--accent-press); }
.auth-submit:active { transform: translateY(1px); }
.auth-submit:disabled { opacity: .55; cursor: not-allowed; }
.auth-submit .spin {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff;
  animation: authSpin .7s linear infinite;
}
@keyframes authSpin { to { transform: rotate(360deg); } }

/* form-level error banner */
.auth-alert {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 13px; border-radius: var(--r-sm);
  background: color-mix(in srgb, #ef4444 9%, var(--surface));
  border: 1px solid color-mix(in srgb, #ef4444 28%, var(--border));
  color: #c0392b; font-size: 13px; font-weight: 500; line-height: 1.45;
  animation: authShake .4s var(--ease);
}
.theme-dark .auth-alert { color: #ff8d80; }
.auth-alert svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
@keyframes authShake { 0%,100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.auth-note {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 13px; border-radius: var(--r-sm);
  background: var(--accent-tint); border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border));
  color: var(--text-2); font-size: 12.5px; line-height: 1.5;
}
.auth-note svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--accent); }
.auth-note b { color: var(--text); font-family: var(--font-mono); letter-spacing: .04em; }

/* divider */
.auth-divider {
  display: flex; align-items: center; gap: 14px;
  color: var(--text-3); font-size: 12.5px; font-weight: 500;
  margin: 2px 0; white-space: nowrap;
}
.auth-divider::before, .auth-divider::after { content: ''; height: 1px; flex: 1; background: var(--border); }

/* Google button */
.auth-google {
  height: 47px; width: 100%; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
  font-family: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 11px;
  transition: background .14s, border-color .14s;
}
.auth-google:hover { background: var(--surface-2); border-color: var(--text-3); }
.auth-google svg { width: 19px; height: 19px; flex: none; }

/* footer switch */
.auth-foot { margin-top: 26px; text-align: center; font-size: 14px; color: var(--text-2); }
.auth-foot .auth-link { font-size: 14px; }

/* theme toggle in corner */
.auth-theme {
  position: absolute; top: 22px; right: 24px; z-index: 5;
  width: 38px; height: 38px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  display: grid; place-items: center;
}
.auth-theme:hover { background: var(--surface-2); color: var(--text); }
.auth-theme svg { width: 18px; height: 18px; }

/* back link */
.auth-back {
  display: inline-flex; align-items: center; gap: 7px;
  background: none; border: none; cursor: pointer; padding: 0; margin-bottom: 20px;
  font-family: inherit; font-size: 13.5px; font-weight: 600; color: var(--text-2);
}
.auth-back:hover { color: var(--text); }
.auth-back svg { width: 16px; height: 16px; }

/* big circular status icon (verify / reset success) */
.auth-bigico {
  width: 60px; height: 60px; border-radius: 50%; margin-bottom: 22px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.auth-bigico.ok { background: color-mix(in srgb, #1a9d5a 14%, var(--surface)); color: #1a9d5a; }
.auth-bigico svg { width: 28px; height: 28px; }

/* verification code inputs */
.auth-code { display: flex; gap: 10px; justify-content: space-between; }
.auth-code input {
  width: 100%; height: 58px; text-align: center;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  font-family: var(--font-mono); font-size: 24px; font-weight: 600; outline: none;
  transition: border-color .14s, box-shadow .14s;
}
.auth-code input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-code input.filled { border-color: var(--accent); }

/* ---------- Google account chooser modal ---------- */
.gc-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(15, 18, 28, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 24px;
}
@media (prefers-reduced-motion: no-preference) {
  .gc-overlay { animation: gcFade .18s ease both; }
}
@keyframes gcFade { from { opacity: 0; } to { opacity: 1; } }
.gc-modal {
  width: 100%; max-width: 412px;
  background: #fff; color: #202124;
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 24px 70px -12px rgba(0,0,0,.45);
  font-family: 'Inter', Roboto, Arial, sans-serif;
}
@media (prefers-reduced-motion: no-preference) {
  .gc-modal { animation: gcPop .22s var(--ease) both; }
}
@keyframes gcPop { from { transform: scale(.96) translateY(8px); } to { transform: none; } }
.gc-head { padding: 22px 24px 18px; border-bottom: 1px solid #ecedee; }
.gc-glogo { height: 20px; display: block; margin-bottom: 16px; }
.gc-head h3 { margin: 0 0 4px; font-size: 16px; font-weight: 400; color: #202124; }
.gc-head p { margin: 0; font-size: 13px; color: #5f6368; }
.gc-head p b { font-weight: 500; color: #202124; }
.gc-list { padding: 6px 0; max-height: 280px; overflow-y: auto; }
.gc-acct {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 12px 24px; border: none; background: none; cursor: pointer; text-align: left;
  font-family: inherit; transition: background .12s;
}
.gc-acct:hover { background: #f7f8f8; }
.gc-ava { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 15px; overflow: hidden; }
.gc-ava img { width: 100%; height: 100%; object-fit: cover; }
.gc-acct-meta { min-width: 0; }
.gc-acct-meta b { display: block; font-size: 14px; font-weight: 500; color: #202124; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc-acct-meta span { font-size: 13px; color: #5f6368; }
.gc-other { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 24px; border: none; border-top: 1px solid #ecedee; background: none; cursor: pointer; text-align: left; font-family: inherit; }
.gc-other:hover { background: #f7f8f8; }
.gc-other .gc-ava { background: #f1f3f4; color: #5f6368; }
.gc-other span { font-size: 14px; color: #3c4043; font-weight: 500; }
.gc-foot { padding: 14px 24px 18px; font-size: 11px; color: #5f6368; line-height: 1.5; }
.gc-foot a { color: #5f6368; }

/* ---------- responsive: collapse brand panel ---------- */
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-card-logo { display: flex; }
}

/* sidebar user dropdown menu (sign out) */
.sb-user-wrap { position: relative; }
.sb-menu {
  position: absolute; bottom: calc(100% + 8px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-lg); overflow: hidden; padding: 5px;
  animation: mcatIn .14s var(--ease) both;
}
.sb-menu-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 11px; border: none; background: none; border-radius: var(--r-xs);
  font-family: inherit; font-size: 13.5px; font-weight: 500; color: var(--text); cursor: pointer; text-align: left;
}
.sb-menu-item svg { width: 17px; height: 17px; color: var(--text-3); }
.sb-menu-item:hover { background: var(--surface-2); }
.sb-menu-item.danger { color: #ef4444; }
.sb-menu-item.danger svg { color: #ef4444; }
.sb-menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.sb-menu-head { padding: 11px 12px 9px; }
.sb-menu-head b { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-menu-head span { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
