.brand-logo {
  flex: none;
  background: center / contain no-repeat;
}
.login-page {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  overflow: hidden;
  padding: 24px;
  background: #263b44;
}
.login-page::before,
.login-page::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  content: "";
}
.login-page::before {
  background: linear-gradient(90deg, #17283300 35%, #17283342),
    url("/assets/login-xian-city-wall.webp") 31% center / cover no-repeat;
}
.login-page::after {
  background: radial-gradient(ellipse 36% 48% at 35% 53%, #ffc3824d, transparent 74%);
  opacity: .18;
  animation: login-sunrise 18s ease-in-out 1s infinite alternate;
}
@keyframes login-sunrise {
  from { opacity: .18; }
  to { opacity: .7; transform: translate(1.5%, -1.5%); }
}
.login-page.login-motion-paused::after { animation-play-state: paused; }
.login-motion-toggle {
  position: absolute;
  inset-inline-start: 16px;
  inset-block-end: 16px;
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border-color: #ffffff73;
  border-radius: 50%;
  color: #fff;
  background: #172833b3;
}
.login-motion-toggle svg { width: 18px; height: 18px; }
.login-motion-toggle .login-play-icon,
.login-motion-toggle[aria-pressed="true"] .login-pause-icon { display: none; }
.login-motion-toggle[aria-pressed="true"] .login-play-icon { display: block; }
.login-motion-toggle:hover:not(:disabled) {
  border-color: #fff;
  color: #fff;
  background: #172833;
}
.login-motion-toggle:focus-visible { outline-color: #fff; }
@media (min-width: 900px) {
  .login-page::before { background-position: center; }
}
@media (max-width: 899px) and (max-height: 540px) {
  .login-page { padding-block: 60px; }
}
@media (max-width: 600px) {
  .login-page::before { background-position: center, 15% center; }
}
@media (prefers-reduced-motion: reduce) {
  .login-page::after { animation: none; }
  .login-motion-toggle { display: none; }
}
.login {
  width: min(100%, 392px);
  padding: clamp(22px, 5vw, 32px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 22px 70px #121d27a8;
}
.login .brand-logo { width: 42px; height: 42px; margin: 0 auto 12px; }
.login h1 {
  margin: 0 0 21px;
  font-size: 1.375rem;
  font-weight: 650;
  text-align: center;
  line-height: 1.35;
}
.login-form { display: grid; }
.login-form label { margin: 0 0 5px; color: var(--text); font-weight: 550; }
.login-form input {
  width: 100%;
  min-height: 44px;
  margin-bottom: 11px;
  padding-inline: 10px;
  background: var(--surface);
  font-size: 1rem;
}
.login-form input:focus { border-color: var(--accent); background: var(--surface); }
.login-form button { min-height: 44px; margin-top: 2px; font-size: .875rem; }
.login-form #error:empty { position: absolute; width: 1px; height: 1px; overflow: hidden; }
.login-form #error:not(:empty) {
  margin: 12px 0 0;
  padding: 8px 10px;
  border-radius: 4px;
  color: #982e37;
  background: #fcebec;
}

.dialog {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 14px;
  background: #242e3b69;
}
.dialog form {
  --dialog-pad: clamp(14px, 3vw, 22px);
  width: min(100%, 560px);
  max-height: calc(100vh - 28px);
  max-height: calc(100dvh - 28px);
  overflow: auto;
  padding: var(--dialog-pad);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-overlay);
}
.dialog h2 { margin: 0 0 14px; font-size: 1.125rem; line-height: 1.35; font-weight: 650; }
.dialog label { display: block; margin: 11px 0; color: var(--text); font-weight: 550; }
.dialog input, .dialog select, .dialog textarea { display: block; width: 100%; margin-top: 5px; }
.dialog .checks { display: flex; flex-wrap: wrap; gap: 7px 12px; }
.dialog .checks label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 29px;
  margin: 0;
  font-size: 13px;
}
.dialog .checks input { width: 16px; margin: 0; }
.dialog .actions {
  position: sticky;
  z-index: 1;
  bottom: calc(-1 * var(--dialog-pad));
  margin: 18px calc(-1 * var(--dialog-pad)) calc(-1 * var(--dialog-pad));
  padding: 12px var(--dialog-pad);
  border-top: 1px solid var(--line-soft);
  background: var(--surface);
}

.role-panel .section-heading p { margin: 0; }
.role-panel .section-heading h2 { margin-bottom: 6px; }
.role-grid { margin-top: 12px; border-top: 1px solid var(--line-soft); }
.role-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.role-info { flex: 1; min-width: 0; }
.role-info h3, .role-info p { margin: 0 0 3px; }
.role-info p { color: var(--subtle); font-size: 12px; }
.scope-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  color: var(--accent-text);
  background: var(--accent-soft);
}
.role-card > button { flex: none; font-size: 13px; }
.split > .card:first-child .wb-tabs { gap: 0 10px; }

@media (max-width: 360px) {
  .login-page { padding-inline: 16px; }
  .role-card { flex-wrap: wrap; }
  .role-card > button { margin-left: auto; }
}
