.auth-dialog {
  width: min(424px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  color: #eef5f1;
  background: #141c1f;
  border: 1px solid #40514d;
  border-radius: 16px;
  box-shadow: 0 16px 56px #05090b80;
  color-scheme: dark;
  overscroll-behavior: contain;
}

.auth-dialog::backdrop { background: #070c0ed9; }

.auth-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
  border-bottom: 1px solid var(--line);
  background: #141c1f;
}

.auth-head img { width: 124px; height: auto; }
.auth-content, .auth-policy { padding: 24px; }
.auth-content h2 { margin: 0; font-size: 1.5rem; line-height: 1.25; font-weight: 650; }
.auth-subtitle { margin: 8px 0 0; color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }

.auth-close,
.auth-password-toggle {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.auth-close { width: 40px; height: 40px; font-size: 1.375rem; line-height: 1; }
.auth-close:hover, .auth-password-toggle:hover { color: var(--mint); background: #20302e; }

.auth-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-top: 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #101719;
}

.auth-modes button {
  min-height: 36px;
  padding: 4px 8px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: .875rem;
}

.auth-modes button:hover { color: #eef5f1; }
.auth-modes button[aria-pressed="true"] { color: var(--mint); background: #253732; border-color: #3b5149; font-weight: 600; }

.auth-form { display: grid; gap: 12px; margin-top: 16px; }
.auth-field { display: grid; gap: 6px; color: #dce8e2; font-size: .875rem; font-weight: 550; }
.auth-field input {
  width: 100%;
  height: 44px;
  padding: 8px 12px;
  border: 1px solid #41534f;
  border-radius: 8px;
  background: #101719;
  color: #f2f6f3;
  font-size: 1rem;
  font-weight: 400;
}

.auth-field input::placeholder { color: #99aaa6; opacity: 1; }
.auth-field input:focus-visible { border-color: var(--mint); outline-width: 1px; outline-offset: 1px; }
.auth-field input::-ms-reveal { display: none; }
.auth-password-control { position: relative; }
.auth-password-control input { padding-inline-end: 56px; }
.auth-password-toggle { position: absolute; inset: 0 4px 0 auto; width: 44px; height: 44px; }
.auth-password-toggle:focus-visible { outline-offset: -4px; }

.auth-strength {
  --strength-color: #efa495;
  display: flex;
  min-height: 18px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-strength[data-score="0"] .auth-strength-bars { visibility: hidden; }
.auth-strength[data-score="2"] { --strength-color: #e6be76; }
.auth-strength[data-score="3"] { --strength-color: #8dcec3; }
.auth-strength[data-score="4"] { --strength-color: #a5e4bd; }
.auth-strength-bars { display: grid; flex: 1 1 96px; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.auth-strength-bars i { height: 3px; border-radius: 2px; background: #354440; }
.auth-strength[data-score="1"] i:first-child,
.auth-strength[data-score="2"] i:nth-child(-n+2),
.auth-strength[data-score="3"] i:nth-child(-n+3),
.auth-strength[data-score="4"] i { background: var(--strength-color); }
.auth-strength-label { color: var(--strength-color); font-size: .75rem; font-weight: 600; }

.auth-optional { margin-inline-start: 4px; color: var(--muted); font-weight: 400; }
.auth-consent { color: #dce8e2; font-size: .8125rem; line-height: 1.7; }
.auth-consent input { margin: 0 8px 0 0; accent-color: var(--mint); vertical-align: middle; }
.auth-consent button, .auth-link { color: var(--mint); padding: 0; border: 0; background: transparent; text-decoration: underline; text-underline-offset: 3px; }
.auth-submit { width: 100%; margin-top: 4px; }
.auth-error { margin: 0; color: #ffb2a8; font-size: .875rem; }
.auth-error.success { color: var(--mint); }
.auth-policy h3 { font-size: 1rem; margin: 20px 0 8px; }
.auth-policy p { color: var(--muted); line-height: 1.65; }

@media (max-width: 480px) {
  .auth-head, .auth-content, .auth-policy { padding-inline: 16px; }
  .auth-content, .auth-policy { padding-block: 16px; }
  .auth-modes, .auth-form { margin-top: 12px; }
  .auth-form { gap: 9px; }
}
