/* Sign-in and account security pages (standalone account shell). Colours come from the
   --account-* tokens in account-security.css, so light and night follow the shared theme. */

.account-security-standalone {
  --auth-danger: #b42318;
  --auth-danger-soft: #fef3f2;
  --auth-success: #067647;
  --auth-success-soft: #ecfdf3;
  --auth-warning: #b54708;
}

.night-mode .account-security-standalone,
.night-mode.account-security-standalone {
  --auth-danger: #fd8a80;
  --auth-danger-soft: #2d1513;
  --auth-success: #47cd89;
  --auth-success-soft: #12271c;
  --auth-warning: #fdb022;
}

/* Header: the way back (or the logo), language and theme */
.account-security-standalone .account-security-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  margin: 0 auto;
}

.account-security-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.account-security-tools .language-corner {
  position: static;
}

.account-security-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 40px;
  padding: 0 14px 0 10px;
  border-radius: 999px;
  color: var(--account-ink);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

.account-security-back:hover {
  background: var(--account-line);
  color: var(--account-ink);
}

.account-security-back span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-security-theme {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--account-line);
  border-radius: 999px;
  background: var(--account-paper);
  color: var(--account-ink);
}

.account-security-theme .theme-icon-light,
.night-mode .account-security-theme .theme-icon-night {
  display: none;
}

.night-mode .account-security-theme .theme-icon-light {
  display: inline;
}

/* Cards that can show "Signing you in" */
.account-security-standalone .account-about-card {
  position: relative;
}

.auth-busy {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-radius: inherit;
  background: color-mix(in srgb, var(--account-paper) 94%, transparent);
  color: var(--account-ink);
  font-weight: 500;
}

.auth-spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--account-line);
  border-top-color: var(--account-accent);
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

.account-security-standalone [aria-busy="true"] {
  cursor: progress;
  opacity: 0.75;
}

/* Sign-in card content */
.auth-subtitle {
  margin: -12px 0 24px;
  color: var(--account-muted);
}

.auth-field-error {
  margin: 4px 0 0;
  color: var(--auth-danger);
  font-size: 14px;
}

.account-security-standalone input[aria-invalid="true"] {
  border-color: var(--auth-danger);
}

.auth-field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.auth-link {
  color: var(--account-accent);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.auth-link:hover {
  color: var(--account-accent-dark);
  text-decoration: underline;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  margin-top: 20px;
}

.auth-links button.auth-link {
  padding: 0;
  border: 0;
  background: none;
}

.auth-links [aria-disabled="true"] {
  color: var(--account-muted);
  cursor: default;
  text-decoration: none;
}

.auth-password {
  position: relative;
}

.auth-password input {
  padding-right: 52px;
}

.auth-password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--account-muted);
  transform: translateY(-50%);
}

.auth-password-toggle .fa-eye,
.auth-password-toggle[aria-pressed="true"] .fa-eye-slash {
  display: none;
}

.auth-password-toggle[aria-pressed="true"] .fa-eye {
  display: inline;
}

.auth-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.auth-optional summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--account-ink);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}

.auth-optional summary::-webkit-details-marker {
  display: none;
}

.auth-optional summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.auth-optional[open] summary::before {
  transform: rotate(45deg);
}

.auth-optional-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 16px;
}

.auth-terms {
  margin: 16px 0 0;
  color: var(--account-muted);
  font-size: 14px;
}

.auth-terms a {
  color: var(--account-ink);
  text-decoration: underline;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 20px;
  color: var(--account-muted);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--account-line);
}

.auth-google {
  display: flex;
  justify-content: center;
  min-height: 44px;
  overflow: hidden;
  border-radius: 9px;
}

.auth-options {
  display: flex;
  flex-direction: column;
}

.auth-foot {
  margin: 24px -28px -28px;
  padding: 18px 28px;
  border-top: 1px solid var(--account-line);
  border-radius: 0 0 var(--account-radius) var(--account-radius);
  background: var(--account-wash);
  color: var(--account-muted);
  font-size: 14px;
  text-align: center;
}

.auth-foot a {
  color: var(--account-accent);
  font-weight: 600;
  text-decoration: none;
}

.auth-mail-links {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.auth-mail-links .account-about-btn {
  flex: 1;
  justify-content: center;
}

/* Code boxes (built by auth-ui.js from a single code field) */
.auth-code-boxes {
  display: grid;
  gap: 8px;
}

.account-security-standalone input.auth-code-box {
  min-height: 56px;
  padding: 0;
  border: 1px solid var(--account-line);
  border-radius: 9px;
  background: var(--account-paper);
  color: var(--account-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
}

.account-security-standalone input.auth-code-box[aria-invalid="true"] {
  border-color: var(--auth-danger);
}

/* New-password strength */
.auth-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.auth-meter[hidden] {
  display: none;
}

.auth-meter-bar {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.auth-meter-bar span {
  height: 4px;
  border-radius: 2px;
  background: var(--account-line);
}

.auth-meter[data-level="1"] .auth-meter-bar span:nth-child(-n+1) { background: var(--auth-danger); }
.auth-meter[data-level="2"] .auth-meter-bar span:nth-child(-n+2) { background: var(--auth-warning); }
.auth-meter[data-level="3"] .auth-meter-bar span { background: var(--auth-success); }

.auth-meter-label {
  min-width: 52px;
  color: var(--account-muted);
  font-size: 13px;
  font-weight: 500;
  text-align: right;
}

.auth-hint-check {
  display: flex;
  align-items: center;
  gap: 6px;
}

.auth-hint-check .fa-circle-check {
  color: var(--account-line);
  transition: color 0.15s ease;
}

.auth-hint-check.is-met .fa-circle-check {
  color: var(--auth-success);
}

.account-security-standalone .auth-btn-danger {
  border-color: var(--auth-danger);
  background: var(--auth-danger);
  color: var(--account-paper);
}

.account-security-standalone .auth-btn-danger-text {
  color: var(--auth-danger);
}

/* Phones: the sign-in card is the page, edge to edge; Google comes first. */
@media (max-width: 480px) {
  .auth-row {
    grid-template-columns: 1fr;
  }

  body.account-security-flow {
    background: var(--account-paper);
  }

  .account-security-flow .account-about-shell {
    padding: 4px 0 32px;
  }

  .account-security-flow .account-about-card {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .account-security-flow .account-security-header {
    padding: 12px 16px;
    min-height: 60px;
  }

  .auth-foot {
    margin: 24px -24px -24px;
    padding: 16px 24px;
    border-radius: 0;
  }

  .auth-google-block {
    display: flex;
    flex-direction: column-reverse;
    order: -1;
  }

  .auth-google-block .auth-divider {
    margin: 20px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-spinner {
    animation-duration: 2s;
  }
}
