/* Uses the existing Book Universe tokens: one-column form, no new visual system. */
body:has(> main.auth-card) { margin: 0; background: var(--color-background); color: var(--color-text); font-family: Inter, system-ui, sans-serif; }
.auth-card { --auth-top-inset: 24px; box-sizing: border-box; width: min(420px, calc(100% - 32px)); margin: 10vh auto; padding: var(--auth-top-inset) 16px 16px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-panel); box-shadow: var(--shadow-card); }
.auth-card h1 { font-family: Literata, Georgia, serif; font-size: 28px; font-weight: 600; margin: 32px 0 8px; text-align: center; line-height: 1.2; }
.auth-logo { display: block; width: auto; height: 18px; max-width: calc(100% - 40px); margin-inline: auto; object-fit: contain; }
.auth-card p { color: var(--color-text-secondary); line-height: 1.5; }
.auth-card .auth-brand { color: var(--color-accent); font-weight: 600; }
.auth-card form { margin-top: 16px; }
.auth-card input:not([type=hidden]):not([type=checkbox]) { box-sizing: border-box; display: block; width: 100%; min-height: 44px; padding: 10px 16px; border: 0; border-radius: 999px; background: var(--ds-field-soft, #eeeeee); color: inherit; font: inherit; font-size: 16px; box-shadow: none; }
.auth-card input::placeholder { color: var(--color-icon-muted); opacity: 1; }
.auth-card input:not([type=hidden]):not([type=checkbox]):focus { border: 0; background: var(--ds-field-soft, #eeeeee); box-shadow: none; outline: none; }
.auth-card .auth-show { display: flex; align-items: center; gap: 8px; margin-top: 20px; font-size: 14px; cursor: pointer; }
.auth-card .auth-show > input[type=checkbox] {
  --ds-checkbox-size: 20px;
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  margin: 0;
  flex-shrink: 0;
  border: 1.5px solid var(--color-text, #111);
  border-radius: 6px;
  background: var(--color-surface, #fff);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.auth-card .auth-show > input[type=checkbox]:checked {
  background: var(--color-text, #111);
  border-color: var(--color-text, #111);
}
.auth-card .auth-show > input[type=checkbox]:checked::before {
  content: "";
  width: 7px;
  height: 3.5px;
  margin-top: -1px;
  border: solid #fff;
  border-width: 0 0 1.5px 1.5px;
  transform: rotate(-45deg);
}
.auth-password { position: relative; margin-top: 16px; }
.auth-card .auth-password input { padding-inline-end: 48px; }
.auth-password-toggle { position: absolute; inset-block: 0; inset-inline-end: 0; display: grid; place-items: center; width: 44px; padding: 0; border: 0; border-radius: var(--radius-field); background: transparent; color: var(--color-text-secondary); cursor: pointer; }
.auth-password-toggle:hover { color: var(--color-text); }
.auth-password-toggle.is-visible .auth-eye-slash { display: none; }
.auth-card .ds-btn.auth-submit { box-sizing: border-box; width: 100%; height: auto; min-height: 40px; margin-top: 20px; padding: 10px 16px; border: 0; border-radius: 999px; background: var(--color-accent-lime, #C3FF53); color: var(--color-text, #111); font-size: 14px; font-weight: 500; line-height: 1.2; filter: none; }
/* Beat the global primary `.ds-btn` hover (#303030 via :is(#library-view,…)). */
.auth-card .ds-btn.auth-submit:hover:not(:disabled),
.auth-card .ds-btn.auth-submit:focus-visible:not(:disabled),
body .auth-card .ds-btn.auth-submit:hover:not(:disabled),
#public-preview-login .ds-btn.auth-submit:hover:not(:disabled) {
  background: color-mix(in srgb, var(--color-accent-lime, #C3FF53) 82%, #fff) !important;
  border-color: transparent !important;
  color: var(--color-text, #111) !important;
  filter: none;
  opacity: 1;
}
.auth-card .auth-submit:disabled { cursor: wait; }
.auth-card #auth-error:empty { display: none; }
.auth-card :focus-visible, .auth-warning :focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.auth-card .auth-help { font-size: 13px; margin-bottom: 0; }
.auth-card #auth-error { color: var(--color-accent); }
.auth-warning { font: 13px/1.5 Inter, system-ui, sans-serif; padding: 8px 16px; color: var(--color-text); background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.auth-warning { position: fixed; bottom: 0; left: 0; right: 0; z-index: 2147483647; border-top: 2px solid var(--color-accent); }
.auth-warning a { color: var(--color-accent); font-weight: 600; }

.auth-card .auth-local-reader { color: var(--color-text); font-weight: 600; }

.auth-waitlist {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 20px;
  margin-top: 32px;
  padding: 20px;
  border-radius: 16px;
  background: var(--color-background, #f5f5f5);
  color: var(--color-text, #111);
}
.auth-waitlist-copy {
  flex: 1 1 12rem;
  min-width: 0;
  display: grid;
  gap: 6px;
}
.auth-waitlist-title {
  margin: 0;
  color: var(--color-text, #111);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}
.auth-waitlist-text {
  margin: 0;
  color: var(--color-text-secondary, #666);
  font-size: 13px;
  line-height: 1.45;
}
.auth-waitlist-action {
  box-sizing: border-box;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--color-text, #111);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}
.auth-waitlist-action:hover {
  filter: brightness(1.12);
}
.auth-waitlist-icon {
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  color: #fff;
}
.auth-waitlist-icon > :is(svg, .rm-icon) {
  display: block;
  width: 14px;
  height: 14px;
}

.auth-dialog {
  position: fixed;
  inset: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100% - 32px));
  max-width: calc(100% - 32px);
  height: auto;
  max-height: calc(100vh - 32px);
  margin: 0;
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--color-text);
  font-family: var(--font-body);
}
/* Only while open — plain `display: grid` keeps the card visible after close(). */
.auth-dialog[open] {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
}
.auth-dialog .auth-logo {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  align-self: center;
  height: 18px;
  max-width: 100%;
  margin: 0;
}
.auth-dialog .auth-close {
  position: static;
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  align-self: center;
  z-index: 2;
  width: 18px;
  height: 18px;
  margin: 0;
  pointer-events: auto;
  cursor: pointer;
}
.auth-waitlist-copy:not(:has(.auth-waitlist-title)) .auth-waitlist-text {
  font-size: 14px;
  line-height: 1.45;
}
.auth-dialog > :is(h1, form, .auth-waitlist, p) { grid-column: 1 / -1; }
.auth-dialog::backdrop { background: rgb(0 0 0 / 48%); }
body:has(.auth-dialog[open]) { overflow: hidden; }
.auth-close {
  position: absolute;
  top: var(--auth-top-inset);
  right: 12px;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--color-text, #111);
  box-shadow: none;
  cursor: pointer;
}
.auth-close:hover { background: transparent; color: var(--color-text, #111); opacity: 0.72; }
.auth-close > :is(svg, .rm-icon) { display: block; width: 18px; height: 18px; }

@media (max-height: 720px) {
  .auth-dialog {
    --auth-top-inset: 12px;
    padding: 12px 12px 12px;
  }
  .auth-dialog h1 { margin: 16px 0 8px; font-size: 24px; }
  .auth-dialog form { margin-top: 8px; }
  .auth-dialog .auth-password { margin-top: 8px; }
  .auth-dialog .auth-show { margin-top: 10px; }
  .auth-dialog .ds-btn.auth-submit { margin-top: 12px; }
  .auth-dialog .auth-waitlist { margin-top: 16px; padding: 12px 14px; gap: 10px 12px; }
}

/* A restored tab can still contain the previous account's document. */
html.account-session-pending body > :not(.account-session-status) {
  visibility: hidden;
}

.account-session-status {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  padding: 24px;
  background: var(--color-background, #f5f5f5);
  color: var(--color-text);
  font: 14px/1.5 Inter, system-ui, sans-serif;
}
