/* Lock screen. */
.auth-gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  background: var(--c-bg);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  padding: var(--sp-6);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
}

.auth-card__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
  font-weight: var(--fw-bold);
  font-size: var(--fs-lg);
}
.auth-card__mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--r-md);
  background: var(--c-ink);
  color: #fff;
  font-weight: var(--fw-bold);
  overflow: hidden;
}
.auth-card__mark:has(img) { background: transparent; }
.auth-card__mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.auth-card__mark svg { width: 1.5rem; height: 1.5rem; display: block; } /* inline Orbo glyph — inherits the mark's #fff */

.auth-title { font-size: var(--fs-2xl); letter-spacing: -0.01em; }
.auth-sub { margin-top: var(--sp-2); color: var(--c-ink-soft); font-size: var(--fs-sm); }

.auth-form { margin-top: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-4); }

.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field label { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--c-ink-soft); }
.field input {
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md);
  background: var(--c-surface);
  color: var(--c-ink);
  font-size: var(--fs-base);
  transition: border-color var(--dur) var(--ease);
}
.field input:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 1px; border-color: var(--c-accent); }

.btn-primary {
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-accent-ink);
  color: var(--c-on-accent);
  border-radius: var(--r-md);
  font-weight: var(--fw-semibold);
  transition: filter var(--dur) var(--ease);
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { cursor: default; filter: none; opacity: 0.85; }

/* Loading spinner shown inside the auth submit button while a request is in
   flight (login / register / reset). Meaning is carried by motion + the label
   text beside it ("Logging in…"), never colour. */
.auth-spin {
  display: inline-block; width: 0.9em; height: 0.9em; margin-right: 0.5em;
  vertical-align: -0.1em; border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: auth-spin 0.6s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .auth-spin { animation-duration: 1.4s; } }

/* Error carries an icon + text, never colour alone. */
.auth-error {
  padding: var(--sp-2) var(--sp-3);
  border-left: 3px solid var(--c-ink);
  background: var(--c-surface-2);
  color: var(--c-ink);
  font-size: var(--fs-sm);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

/* A1 additions: recovery phrase, notes and inline links. */
.auth-phrase { display: flex; align-items: stretch; gap: var(--sp-2); margin-top: var(--sp-5); }
.auth-phrase__box { flex: 1 1 auto; min-width: 0; padding: var(--sp-3) var(--sp-4); background: var(--c-surface-2); border: 1px solid var(--c-border-strong); border-radius: var(--r-md); font-family: var(--font-mono, ui-monospace, monospace); font-size: var(--fs-base); letter-spacing: 0.02em; color: var(--c-ink); word-break: break-word; }
.auth-copy { flex: 0 0 auto; align-self: center; }
.auth-note { margin-top: var(--sp-3); font-size: var(--fs-sm); color: var(--c-ink-soft); }
.auth-phrase + .auth-note { margin-top: var(--sp-3); }
.auth-card .btn-primary { margin-top: var(--sp-4); width: 100%; }
.auth-link { align-self: center; margin-top: var(--sp-1); background: none; border: 0; color: var(--c-accent-ink); font-size: var(--fs-sm); font-weight: var(--fw-medium); cursor: pointer; }
.auth-link:hover { text-decoration: underline; }

.auth-hint { font-size: var(--fs-sm); color: var(--c-ink-faint); }

/* ---- Account picker (multi-account) ----
   Wider card holds a responsive grid of account tiles. Tiles are told apart by
   avatar (photo or initial) + name label, never by colour; hover/focus use a
   thicker border + lift, so selection state doesn't rely on hue either. */
.auth-card--picker { max-width: 560px; }
.acct-grid {
  margin-top: var(--sp-5);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
  gap: var(--sp-4);
}
.acct {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-3);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  color: var(--c-ink);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.acct:hover { border-color: var(--c-accent-ink); background: var(--c-surface-2); transform: translateY(-2px); }
.acct:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.acct__av {
  display: grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  border-radius: var(--r-full);
  background: var(--c-ink);
  color: #fff;
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  overflow: hidden;
}
.acct__av img { width: 100%; height: 100%; object-fit: contain; display: block; }
.acct__av--add { background: var(--c-surface-2); color: var(--c-ink-soft); border: 1px dashed var(--c-border-strong); font-weight: var(--fw-medium); }
.acct--add { border-style: dashed; }
.acct__name {
  max-width: 100%;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 480px) {
  .acct-grid { grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); }
  .acct__av { width: 3.25rem; height: 3.25rem; }
}

/* ---- Manage mode: remove accounts ----
   In manage mode each tile carries a trash badge (a SHAPE, not a colour) so the
   removable state reads even for a colour-blind user; the red is only reinforcement.
   The badge sits over the tile, so the tile needs a positioning context. */
.acct { position: relative; }
.acct--manage { border-color: #b42318; }
.acct--manage:hover { border-color: #b42318; transform: none; }
.acct__badge {
  position: absolute; top: var(--sp-2); right: var(--sp-2);
  display: grid; place-items: center;
  width: 1.6rem; height: 1.6rem;
  border-radius: var(--r-full);
  background: #b42318; color: #fff;
}
[data-theme="dark"] .acct--manage { border-color: #f0705f; }
[data-theme="dark"] .acct__badge { background: #f0705f; color: #14151a; }

/* ---- Destructive button ----
   Meaning is carried by the trash icon + the word + the outline treatment (it's
   an outline, distinct from the filled btn-primary), never by the red hue alone. */
.btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border: 1.5px solid #b42318;
  border-radius: var(--r-md);
  background: transparent;
  color: #b42318;
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn-danger:hover { background: #b42318; color: #fff; }
.btn-danger svg { flex: 0 0 auto; }
.btn-danger.btn-sm { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); }
[data-theme="dark"] .btn-danger { border-color: #f0705f; color: #f0705f; }
[data-theme="dark"] .btn-danger:hover { background: #f0705f; color: #14151a; }
