.auth-surface {
  display: grid;
  place-items: center;
}

.auth-shell {
  width: min(30rem, 100%);
}

.auth-card {
  padding: 1.2rem;
  border-radius: var(--radius-panel);
  background: var(--surface-card);
  box-shadow: var(--shadow-frame);
}

.auth-card-wide {
  width: 100%;
}

.auth-card-header {
  display: grid;
  gap: 0.2rem;
}

.auth-card-header h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
}

.auth-description {
  margin: 0.2rem 0 0;
  color: var(--text-secondary);
  line-height: 1.55;
  font-size: 0.92rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
  margin-top: 1rem;
  padding: 0.35rem;
  border-radius: var(--radius-control);
  background: var(--surface-input);
  box-shadow: inset 0 0 0 1px var(--border-soft);
}

.auth-tab-button {
  min-height: 2.5rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text-secondary);
  font-weight: 700;
  transition: background-color 140ms ease, color 140ms ease;
}

.auth-tab-button:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.auth-tab-button.is-active {
  background: var(--surface-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-float);
}

.auth-form {
  margin-top: 1rem;
}

.auth-fields {
  display: grid;
  gap: 0.85rem;
}

.field,
.checkbox-field {
  display: grid;
  gap: 0.45rem;
}

.field span,
.checkbox-field span {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.field input {
  min-height: 3rem;
  padding: 0.85rem 0.95rem;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--surface-input);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--border-soft);
}

.field input:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.checkbox-field {
  grid-template-columns: auto 1fr;
  align-items: center;
  margin-top: 0.1rem;
  margin-bottom: 0.8rem;
}

.checkbox-field input[type="checkbox"],
.member-option input[type="checkbox"] {
  appearance: none;
  width: 0.95rem;
  height: 0.95rem;
  margin: 0;
  border-radius: 3px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: none;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.checkbox-field input[type="checkbox"]::before,
.member-option input[type="checkbox"]::before {
  content: "";
  width: 0.48rem;
  height: 0.48rem;
  transform: scale(0);
  transition: transform 120ms ease;
  clip-path: polygon(14% 53%, 0 67%, 40% 100%, 100% 23%, 84% 9%, 38% 67%);
  background: var(--text-primary);
}

.checkbox-field input[type="checkbox"]:checked,
.member-option input[type="checkbox"]:checked {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.32);
}

.checkbox-field input[type="checkbox"]:checked::before,
.member-option input[type="checkbox"]:checked::before {
  transform: scale(1);
}

.checkbox-field input[type="checkbox"]:focus-visible,
.member-option input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--text-secondary);
}

.auth-submit-button {
  min-width: 5.6rem;
  justify-self: start;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(16, 18, 23, 0.74);
  backdrop-filter: blur(8px);
}

.busy-panel {
  display: grid;
  justify-items: center;
  gap: 1rem;
  min-width: 15.5rem;
  padding: 1.15rem 1.2rem 1rem;
  border-radius: var(--radius-panel);
  background: rgba(31, 35, 42, 0.94);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    var(--shadow-frame);
}

.busy-orbit {
  position: relative;
  width: 3.4rem;
  height: 3.4rem;
  display: grid;
  place-items: center;
}

.busy-orbit-ring,
.busy-orbit-core {
  position: absolute;
  border-radius: 999px;
}

.busy-orbit-ring {
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  animation: busyPulse 1.5s ease-out infinite;
}

.busy-orbit-ring-delayed {
  animation-delay: 0.45s;
}

.busy-orbit-core {
  width: 0.7rem;
  height: 0.7rem;
  background: var(--text-primary);
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.18);
  animation: busyCore 1.1s ease-in-out infinite;
}

.busy-copy {
  display: grid;
  justify-items: center;
  gap: 0.24rem;
  text-align: center;
}

.busy-copy strong {
  font-size: 0.98rem;
  font-weight: 700;
}

.busy-copy span {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.45;
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(16, 18, 23, 0.68);
  backdrop-filter: blur(6px);
}

.surface-panel {
  border-radius: var(--radius-panel);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)),
    rgba(31, 35, 42, 0.96);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.055),
    0 24px 56px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.surface-panel-compact {
  padding: 1.05rem 1.05rem 1rem;
}

.surface-panel-wide {
  padding: 1rem;
}

.version-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.15rem;
  background: rgba(16, 18, 23, 0.76);
  backdrop-filter: blur(12px);
}

.version-panel {
  width: min(34rem, 100%);
  padding: 1.05rem 1.05rem 1rem;
}

.version-panel h2 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.2;
}

.version-description {
  margin: 0.55rem 0 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.version-details {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.version-detail {
  margin: 0;
  padding: 0.72rem 0.78rem;
  border-radius: var(--radius-control);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
  line-height: 1.45;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.version-detail strong {
  color: var(--text-primary);
}

.version-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

.dialog-panel {
  width: min(34rem, 100%);
  padding: 1.05rem 1.05rem 1rem;
}

.dialog-copy {
  display: grid;
  gap: 0.2rem;
}

.dialog-copy h2 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.2;
}

.dialog-form {
  display: grid;
  gap: 0.9rem;
}

.field textarea {
  min-height: 6.5rem;
  padding: 0.85rem 0.95rem;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--surface-input);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--border-soft);
  resize: vertical;
}

.field textarea:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.member-picker {
  max-height: 13rem;
  overflow-y: auto;
  display: grid;
  gap: 0.45rem;
  padding: 0.65rem;
  border-radius: var(--radius-control);
  background: var(--surface-input);
  box-shadow: inset 0 0 0 1px var(--border-soft);
  scrollbar-width: none;
}

.member-picker::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.member-picker-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.member-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0.55rem;
  border-radius: var(--radius-control);
  background: rgba(255, 255, 255, 0.02);
}

.member-option:hover {
  background: rgba(255, 255, 255, 0.04);
}

.member-copy {
  display: grid;
  gap: 0.1rem;
}

.member-copy strong {
  font-size: 0.9rem;
}

.member-copy span {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.dialog-helper {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

body.is-busy {
  cursor: progress;
}

body.is-busy .app-shell {
  pointer-events: none;
  user-select: none;
}

@keyframes busyPulse {
  0% {
    transform: scale(0.72);
    opacity: 0;
  }

  35% {
    opacity: 0.5;
  }

  100% {
    transform: scale(1.08);
    opacity: 0;
  }
}

@keyframes busyCore {
  0%,
  100% {
    transform: scale(0.88);
    opacity: 0.82;
  }

  50% {
    transform: scale(1.12);
    opacity: 1;
  }
}

@media (max-width: 640px) {
  .auth-shell {
    width: min(100%, 28rem);
  }

  .auth-card {
    padding: 1rem;
  }
}
