.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  color: var(--ink, #eceff1);
  background:
    radial-gradient(circle at 50% -10%, rgba(126, 139, 157, .18), transparent 34rem),
    var(--bg, #070808);
}

.auth-gate[hidden],
.app-shell[hidden],
.account-summary[hidden],
.access-manager[hidden] {
  display: none !important;
}

.auth-gate:empty::after {
  content: "Checking your session…";
  color: var(--muted, #9a9fa6);
  font-size: 14px;
}

.auth-card {
  width: min(100%, 430px);
  padding: 34px;
  border: 1px solid var(--line, #2b2e34);
  border-radius: 12px;
  background: rgba(18, 19, 21, .96);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .42);
  animation: fade-up 260ms var(--ease, ease-out);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 30px;
}

.auth-brand img {
  width: 48px;
  height: 48px;
  padding: 3px;
  object-fit: cover;
  border: 1px solid #343b45;
  border-radius: 50%;
  background: #f6f7f8;
}

.auth-brand strong,
.auth-brand small {
  display: block;
}

.auth-brand strong {
  color: #f5f7f6;
  font-size: 16px;
}

.auth-brand small {
  margin-top: 3px;
  color: var(--muted, #9a9fa6);
  font-size: 12px;
}

.auth-heading {
  margin-bottom: 24px;
}

.auth-heading h1 {
  margin: 0;
  color: #f5f7f6;
  font-size: clamp(25px, 5vw, 31px);
  letter-spacing: -.025em;
}

.auth-heading p {
  margin: 9px 0 0;
  color: var(--muted, #9a9fa6);
  font-size: 14px;
  line-height: 1.55;
}

.auth-form {
  display: grid;
  gap: 17px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: #d9dde1;
  font-size: 13px;
  font-weight: 700;
}

.auth-form label small {
  color: var(--muted, #9a9fa6);
  font-size: 11px;
  font-weight: 400;
}

.auth-form input {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  color: var(--ink, #eceff1);
  border: 1px solid var(--line, #2b2e34);
  border-radius: 7px;
  background: #0c0d0e;
}

.auth-form input::placeholder {
  color: #676d74;
}

.auth-form .auth-otp-input {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .28em;
  text-align: center;
}

.auth-primary {
  min-height: 45px;
  margin-top: 2px;
  border-color: #5a6470;
  background: #e5e9ed;
  color: #101214;
  font-weight: 700;
}

.auth-primary:hover {
  border-color: #f3f5f7;
  background: #f3f5f7;
  color: #070808;
}

.auth-secondary {
  border: 0;
  padding: 4px;
  color: #c3c9d0;
  background: transparent;
  box-shadow: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-secondary:hover {
  border: 0;
  color: #fff;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.auth-switch {
  margin: 22px 0 0;
  color: var(--muted, #9a9fa6);
  font-size: 13px;
  text-align: center;
}

.auth-message {
  margin: 0;
  padding: 11px 12px;
  border: 1px solid #6e4646;
  border-radius: 7px;
  color: #f0b7b7;
  background: rgba(116, 48, 48, .2);
  font-size: 13px;
  line-height: 1.45;
}

.auth-message.info {
  border-color: #3a4654;
  color: #c4ced9;
  background: rgba(76, 92, 110, .15);
}

.auth-delivery {
  margin: -5px 0 0;
  color: var(--muted, #9a9fa6);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.sidebar {
  display: flex;
  flex-direction: column;
}

.account-summary {
  display: grid;
  gap: 10px;
  margin-top: auto;
  flex-shrink: 0;
  padding: 16px 20px max(18px, env(safe-area-inset-bottom));
  border-top: 1px solid #cfd3d8;
}

.account-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.account-avatar {
  flex: 0 0 auto;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid #424954;
  border-radius: 50%;
  color: #edf0f2;
  background: #22262b;
  font-size: 12px;
  font-weight: 700;
}

.account-copy {
  flex: 1;
  min-width: 0;
}

.account-copy strong,
.account-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong {
  color: #2f3944;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.account-copy small {
  margin-top: 2px;
  color: #5e6874;
  font-size: 11px;
  line-height: 1.4;
}

.account-logout {
  width: 100%;
  min-height: 34px;
  padding: 8px 12px;
  color: #354252;
  background: #fff;
  border: 1px solid #cbd3dc;
  border-radius: 3px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

.account-logout:focus-visible {
  outline: 2px solid #3f8ee8;
  outline-offset: 2px;
}

.account-status {
  min-height: 0;
  margin: 0;
  color: #a33b42;
  font-size: 11px;
  line-height: 1.4;
}

.account-status:empty {
  display: none;
}

.access-manager {
  grid-column: 1 / -1;
}

.access-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, .4fr) auto;
  gap: 12px;
  align-items: end;
}

.access-form label {
  display: grid;
  gap: 6px;
  color: #cfd3d7;
  font-size: 12px;
  font-weight: 700;
}

.access-form input,
.access-form select {
  min-height: 39px;
}

.access-form button {
  min-height: 39px;
}

.access-manager-status {
  min-height: 18px;
  margin: 12px 0 4px;
  color: var(--muted, #9a9fa6);
  font-size: 12px;
}

.access-manager-status.error {
  color: #e1a1a1;
}

.access-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line-soft, #202329);
  color: #dfe3e6;
  font-size: 13px;
}

.access-refresh {
  border-color: transparent;
  padding: 5px 7px;
  color: var(--muted, #9a9fa6);
  background: transparent;
  font-size: 12px;
}

.access-list {
  display: grid;
}

.access-list-empty,
.access-list-loading {
  margin: 0;
  padding: 18px 0 4px;
  color: var(--muted, #9a9fa6);
  font-size: 13px;
}

.access-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft, #202329);
}

.access-entry-email {
  overflow: hidden;
  color: #e0e4e7;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-entry-role {
  padding: 4px 7px;
  border: 1px solid #39404a;
  border-radius: 999px;
  color: #bfc6ce;
  background: #1b1e22;
  font-size: 11px;
}

.access-remove {
  padding: 6px 8px;
  color: #d8a1a1;
  background: transparent;
  font-size: 12px;
}

@media (max-width: 760px) {
  .auth-gate {
    padding: 16px;
  }

  .auth-card {
    padding: 25px 21px;
  }

  .access-form {
    grid-template-columns: 1fr;
  }

  .access-entry {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .access-entry-role {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
  }

  .access-remove {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}
