/* Login / signup / password reset (frontend/scripts/components/auth.js) */
html.auth-open { overflow: hidden; }
.auth {
  width: min(880px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 0; border: 0;
  border-radius: var(--radius-lg); background: transparent; color: var(--ink); overflow: visible;
}
.auth[open] { animation: auth-in .35s var(--ease); }
@keyframes auth-in { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.auth::backdrop { background: rgba(12, 10, 9, .62); backdrop-filter: blur(3px); }
.auth--inline { width: 100%; margin: var(--space-6) auto; max-width: 880px; }

.auth-card {
  display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); min-height: 540px; max-height: calc(100dvh - 32px);
  overflow: hidden; border-radius: var(--radius-lg); background: var(--white); box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .55);
}
.auth--inline .auth-card { max-height: none; box-shadow: var(--shadow-lg); border: var(--hairline); }

/* brand side */
.auth-brand {
  position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: var(--space-3);
  padding: var(--space-7) var(--space-6); color: var(--color-on-dark);
  background:
    radial-gradient(80% 60% at 20% 10%, rgba(248, 182, 0, .28), transparent 70%),
    linear-gradient(160deg, #3a2a1a, var(--ink) 70%);
}
.auth-brand__rings {
  position: absolute; left: -120px; top: -140px; width: 460px; height: 460px; z-index: -1;
  background: repeating-radial-gradient(circle, transparent 0 30px, rgba(248, 182, 0, .1) 31px 32px);
  mask-image: radial-gradient(circle, #000 30%, transparent 70%);
}
.auth-brand img { width: 56px; height: 56px; border-radius: 14px; background: var(--white); padding: 6px; margin-bottom: auto; }
.auth-brand strong { font-size: var(--text-2xl); font-weight: var(--weight-light); color: var(--white); line-height: 1.2; }
.auth-brand p { margin: 0; color: var(--saffron-300); font-size: var(--text-lg); font-weight: var(--weight-light); }
.auth-brand small { display: flex; align-items: center; gap: .4rem; margin-top: var(--space-5); color: var(--color-on-dark-muted); font-size: var(--text-xs); }

/* form side */
.auth-main { position: relative; overflow-y: auto; padding: var(--space-7) clamp(1.25rem, 4vw, 3rem) var(--space-6); }
.auth-close {
  position: absolute; right: var(--space-4); top: var(--space-4); width: 40px; height: 40px; border-radius: 50%;
  border: 0; display: grid; place-items: center; background: var(--stone-100); color: var(--ink); transition: background var(--duration);
}
.auth-close:hover { background: var(--stone-200); }
.auth-body { max-width: 400px; margin: 0 auto; animation: auth-step .3s var(--ease); }
@keyframes auth-step { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
.auth-head { margin-bottom: var(--space-5); }
.auth-head h2 { font-size: var(--text-2xl); font-weight: var(--weight-light); margin: 0 0 .35rem; }
.auth-head p { margin: 0; color: var(--color-muted); font-size: var(--text-sm); }
.auth-head a { color: var(--color-link); }

/* steps */
.auth-steps { display: flex; list-style: none; margin: 0 0 var(--space-5); padding: 0; gap: var(--space-2); }
.auth-steps li { flex: 1; display: flex; align-items: center; gap: .45rem; font-size: var(--text-xs); color: var(--stone-500); padding-top: var(--space-2); border-top: 3px solid var(--stone-200); }
.auth-steps li span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--stone-100); font-weight: var(--weight-semibold); font-size: .7rem; flex-shrink: 0; }
.auth-steps li.is-on { color: var(--ink); border-top-color: var(--saffron-500); font-weight: var(--weight-semibold); }
.auth-steps li.is-on span { background: var(--saffron-500); color: var(--ink); }
.auth-steps li.is-done { border-top-color: var(--saffron-300); color: var(--stone-600); }
.auth-steps li.is-done span { background: var(--ink); color: var(--white); }

/* fields */
.auth-form { display: flex; flex-direction: column; gap: var(--space-4); }
.auth-field label { display: block; margin-bottom: .35rem; font-size: var(--text-sm); font-weight: var(--weight-medium); }
.auth-input { position: relative; }
.auth-input input {
  width: 100%; height: 48px; padding: 0 var(--space-4); border: 1px solid var(--stone-300); border-radius: 12px;
  background: var(--white); font: inherit; font-size: var(--text-base); color: var(--ink);
  transition: border-color var(--duration), box-shadow var(--duration);
}
.auth-input--pw input { padding-right: 52px; }
.auth-input input:focus { outline: 0; border-color: var(--saffron-500); box-shadow: var(--focus-ring); }
.auth-input input.auth-otp { letter-spacing: .6em; font-size: 1.4rem; text-align: center; font-variant-numeric: tabular-nums; padding-left: .6em; }
.auth-eye { position: absolute; right: 6px; top: 6px; width: 36px; height: 36px; border: 0; border-radius: 10px; background: none; color: var(--stone-500); }
.auth-eye:hover { background: var(--stone-100); color: var(--ink); }
.auth-hint { margin: .35rem 0 0; font-size: var(--text-xs); color: var(--color-muted); }
.auth-row { display: flex; justify-content: flex-end; margin-top: calc(var(--space-2) * -1); }
.auth-row a, .auth-link { font-size: var(--text-sm); color: var(--color-link); font-weight: var(--weight-medium); text-decoration: none; background: none; border: 0; padding: 0; }
.auth-link:disabled { color: var(--stone-500); cursor: default; }
.auth-row a:hover, .auth-link:not(:disabled):hover { text-decoration: underline; }

/* password strength */
.auth-meter { display: grid; grid-template-columns: repeat(4, 1fr) auto; align-items: center; gap: 4px; margin-top: calc(var(--space-3) * -1); }
.auth-meter span { height: 4px; border-radius: 2px; background: var(--stone-200); transition: background var(--duration); }
.auth-meter em { min-width: 3.5rem; font-style: normal; font-size: var(--text-xs); color: var(--stone-500); text-align: right; }
.auth-meter.is-1 span:nth-child(-n+1) { background: #dc2626; }
.auth-meter.is-2 span:nth-child(-n+2) { background: #f59e0b; }
.auth-meter.is-3 span:nth-child(-n+3) { background: #65a30d; }
.auth-meter.is-4 span { background: #15803d; }

/* profile choice */
.auth-profiles { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.auth-profiles legend { font-size: var(--text-sm); font-weight: var(--weight-semibold); margin-bottom: .15rem; }
.auth-profiles > p { margin: 0 0 var(--space-2); font-size: var(--text-xs); color: var(--color-muted); }
.auth-profile { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--stone-200); border-radius: 12px; cursor: pointer; transition: border-color var(--duration), background var(--duration); }
.auth-profile:has(input:checked) { border-color: var(--saffron-500); background: var(--saffron-50); }
.auth-profile input { accent-color: var(--saffron-600); width: 18px; height: 18px; }
.auth-profile span { display: flex; flex-direction: column; }
.auth-profile strong { font-size: var(--text-sm); font-weight: var(--weight-medium); }
.auth-profile small { font-size: var(--text-xs); color: var(--color-muted); }

/* messages, buttons */
.auth-msg { margin: 0; font-size: var(--text-sm); border-radius: 10px; }
.auth-msg:empty { display: none; }
.auth-msg.is-error { padding: .65rem .85rem; background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.auth-msg.is-ok { padding: .65rem .85rem; background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.auth-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .55rem; width: 100%; min-height: 48px;
  border: 1px solid transparent; border-radius: 12px; background: var(--ink); color: var(--white);
  font-weight: var(--weight-semibold); font-size: var(--text-base); transition: background var(--duration), transform var(--duration) var(--ease), opacity var(--duration);
}
.auth-btn:hover:not(:disabled) { background: #000; transform: translateY(-1px); }
.auth-btn:disabled { opacity: .7; }
.auth-btn.is-busy { color: transparent; }
.auth-btn.is-busy::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: var(--white); animation: auth-spin .7s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }
.auth-btn--ghost { background: var(--white); color: var(--ink); border-color: var(--stone-300); }
.auth-btn--ghost:hover:not(:disabled) { background: var(--stone-50); }
.auth-or { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-5) 0; color: var(--stone-500); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .1em; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--stone-200); }
.auth-switch { margin: var(--space-5) 0 0; text-align: center; font-size: var(--text-sm); color: var(--color-muted); }
.auth-switch a { color: var(--color-link); font-weight: var(--weight-semibold); }

.auth-done { text-align: center; padding: var(--space-6) 0; }
.auth-done__icon { display: inline-grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: #f0fdf4; color: #15803d; font-size: 2.2rem; margin-bottom: var(--space-4); }
.auth-done h2 { font-size: var(--text-2xl); font-weight: var(--weight-light); }
.auth-done p { color: var(--color-muted); margin-bottom: var(--space-5); }

@media (max-width: 767.98px) {
  .auth { width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; }
  .auth-card { grid-template-columns: minmax(0, 1fr); min-height: 100%; max-height: 100dvh; border-radius: 0; }
  .auth--inline .auth-card { border-radius: var(--radius-lg); }
  .auth-brand { display: none; }
  .auth-main { padding-top: var(--space-8); }
}

/* keep the panel's typography when it sits inside page content (e.g. the /login page block) */
.auth .auth-head h2, .auth .auth-done h2 { font-size: var(--text-2xl) !important; font-weight: var(--weight-light) !important; line-height: 1.2 !important; margin: 0 0 .35rem !important; }
.auth p { max-width: none; }
.auth label { font-weight: var(--weight-medium); }
