html.xg-auth-locked body {
  overflow: hidden !important;
}

html.xg-auth-locked body > :not(#xg-auth-overlay) {
  visibility: hidden !important;
}

#xg-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #eef2f6;
  color: #172033;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  visibility: visible !important;
}

html.xg-authenticated #xg-auth-overlay {
  display: none;
}

.xg-auth-card {
  width: min(380px, 100%);
  padding: 32px;
  border: 1px solid #cfd7e3;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 40px rgba(30, 41, 59, 0.12);
}

.xg-auth-brand {
  margin: 0;
  font-size: 24px;
  line-height: 1.3;
  font-weight: 750;
  letter-spacing: 0;
}

.xg-auth-subtitle {
  margin: 8px 0 24px;
  color: #64748b;
  font-size: 14px;
  line-height: 1.6;
}

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

.xg-auth-field {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 650;
}

.xg-auth-field input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #111827;
  font: inherit;
  font-size: 15px;
  font-weight: 400;
  outline: none;
}

.xg-auth-field input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.xg-auth-submit {
  height: 44px;
  border: 1px solid #1d4ed8;
  border-radius: 6px;
  background: #2563eb;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.xg-auth-submit:hover {
  background: #1d4ed8;
}

.xg-auth-submit:disabled {
  cursor: wait;
  opacity: 0.65;
}

.xg-auth-error {
  min-height: 20px;
  margin: 0;
  color: #b42318;
  font-size: 13px;
  line-height: 1.5;
}

.xg-auth-logout {
  min-height: 28px;
  margin-left: 10px;
  padding: 0 9px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #475569;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  vertical-align: middle;
}

.xg-auth-logout:hover {
  border-color: #94a3b8;
  color: #111827;
}

.xg-auth-mode {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 9998;
  padding: 6px 9px;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  background: #fffbeb;
  color: #92400e;
  font-size: 12px;
  line-height: 1.3;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

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

@media (max-width: 520px) {
  #xg-auth-overlay {
    align-items: flex-start;
    padding: 48px 16px 24px;
  }

  .xg-auth-card {
    padding: 26px 22px;
  }
}
