:root, [data-theme="light"] { --auth-card: #FFFFFF; --auth-field: #FFFFFF; --auth-err: #DC2626; --auth-ok: #047857; }
[data-theme="dark"] { --auth-card: #1C1C1E; --auth-field: #000000; --auth-err: #F87171; --auth-ok: #34D399; }

.auth-page { display: grid; place-items: start center; min-height: calc(100svh - 64px); padding: 24px 20px 72px; }
.auth-shell { width: 100%; max-width: 420px; display: grid; gap: 20px; }
.auth-card { display: grid; background: var(--auth-card); border: 1px solid var(--rule); border-radius: 16px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 16px 40px -18px rgba(15, 23, 42, .22); }
.auth-pane { padding: 32px 28px; display: grid; gap: 22px; align-content: start; }
.auth-page [hidden] { display: none !important; }
.auth-art { display: none; margin: 0; position: relative; background: var(--stage); }
.auth-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 78% 60%; }
[data-theme="dark"] .auth-art img { filter: brightness(.82) saturate(.9); }

@media (min-width: 860px) {
  .auth-page { place-items: center; padding-top: 40px; }
  .auth-shell { max-width: 880px; }
  .auth-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 560px; }
  .auth-pane { padding: 48px 44px; align-content: center; }
  .auth-art { display: block; }
}

.auth-pane h1 { margin: 0; font: 650 28px/1.15 var(--sans); letter-spacing: -.02em; color: var(--ink); }
.auth-line { margin: -10px 0 0; font-size: 15px; line-height: 1.5; color: var(--sub); overflow-wrap: anywhere; }
.auth-line b { color: var(--ink); font-weight: 600; }

.auth-form { display: grid; gap: 16px; }
.fld { display: grid; gap: 8px; }
.fld-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.fld label, .fld-label { font-size: 14px; font-weight: 550; color: var(--ink-2); }
.fld input { width: 100%; height: 46px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--rule-strong); background: var(--auth-field);
  color: var(--ink); font: 500 16px var(--sans); transition: border-color .15s ease, box-shadow .15s ease; }
.fld input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.fld input[aria-invalid="true"] { border-color: var(--auth-err); }
.fld input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-err) 20%, transparent); }

.pw { position: relative; }
.pw input { padding-right: 52px; }
.pw-eye { position: absolute; top: 3px; right: 3px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 8px;
  background: transparent; color: var(--sub); cursor: pointer; }
.pw-eye:hover { color: var(--ink); }
.pw-eye svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pw-eye .eye-off { display: none; }
.pw-eye[aria-pressed="true"] .eye-on { display: none; }
.pw-eye[aria-pressed="true"] .eye-off { display: block; }

.auth-small { font-size: 14px; font-weight: 550; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; background: none; border: 0;
  padding: 0; cursor: pointer; font-family: var(--sans); }
.auth-small:hover { color: var(--accent); }

.auth-form .btn, .auth-actions .btn { width: 100%; justify-content: center; height: 48px; font-size: 16px; }
.btn[disabled] { opacity: .65; cursor: default; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--btn-fg); border-right-color: transparent; animation: auth-spin .7s linear infinite; }
.btn-line.busy::after { border-color: var(--ink); border-right-color: transparent; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.busy::after { animation-duration: 2s; } }

.auth-actions { display: grid; gap: 12px; }
.auth-page button.btn-line { background: transparent; }
.msg { margin: 0; font-size: 14px; line-height: 1.45; color: var(--auth-err); }
.msg.ok { color: var(--auth-ok); }
.auth-switch { margin: 0; font-size: 14px; color: var(--sub); text-align: center; }
.auth-switch a { color: var(--ink); font-weight: 550; text-underline-offset: 3px; }
.tick { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; color: var(--ink-2); cursor: pointer; }
.tick input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); cursor: pointer; }
.tick input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tick input[aria-invalid="true"] { outline: 2px solid var(--auth-err); outline-offset: 2px; }
.tick a { color: var(--ink); font-weight: 550; text-underline-offset: 3px; }

.acct-rows { display: grid; border: 1px solid var(--rule); border-radius: 12px; }
.acct-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 16px; padding: 14px 16px; }
.acct-row + .acct-row { border-top: 1px solid var(--rule); }
.acct-k { font-size: 13px; color: var(--sub); }
.acct-v { grid-column: 1; font-size: 15px; font-weight: 550; color: var(--ink); overflow-wrap: anywhere; }
.acct-row > .auth-small, .acct-row > .chip { grid-column: 2; grid-row: 1 / span 2; }
.chip { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.chip.good { background: color-mix(in srgb, var(--auth-ok) 14%, transparent); color: var(--auth-ok); }
.chip.warn { background: color-mix(in srgb, #D97706 16%, transparent); color: #B45309; }
[data-theme="dark"] .chip.warn { color: #FBBF24; }
.acct-edit { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; grid-column: 1 / -1; }
.acct-edit .btn { height: 46px; }
