/* Host-system connect gate and tenant badge.
   Colours come from the tokens already defined in setup-style.css so this
   reads as part of the existing UI rather than a bolted-on login screen. */

/* ── Connect gate ───────────────────────────────────────────────────────── */

.engine-auth-modal {
  display: none;
  position: fixed;
  inset: 0;
  /* Above Bootstrap's modal layer (1055) — while this is up, nothing behind
     it can complete a request anyway, so it must not be possible to reach a
     dialog through it. */
  z-index: 2000;
  background: rgba(31, 43, 58, 0.55);
  backdrop-filter: blur(2px);
  padding: 1.5rem;
  overflow-y: auto;
}

.engine-auth-modal.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.engine-auth-dialog {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(31, 43, 58, 0.28);
  width: 100%;
  max-width: 460px;
  padding: 1.75rem;
}

.engine-auth-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--secondary-900, #1f2b3a);
  margin: 0 0 0.375rem;
}

.engine-auth-subtitle {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--secondary-500, #5d738f);
  margin: 0 0 1.25rem;
}

.engine-auth-field {
  margin-bottom: 1rem;
}

.engine-auth-field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--secondary-900, #1f2b3a);
  margin-bottom: 0.375rem;
}

.engine-auth-field input {
  width: 100%;
  border: 1px solid var(--bs-gray-300, #dbdfea);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--secondary-900, #1f2b3a);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.engine-auth-field input:focus {
  outline: none;
  border-color: var(--primary-500, #096bef);
  box-shadow: 0 0 0 3px rgba(9, 107, 239, 0.12);
}

.engine-auth-field small {
  display: block;
  font-size: 0.75rem;
  color: var(--secondary-500, #5d738f);
  margin-top: 0.3125rem;
}

.engine-auth-error {
  background: rgba(255, 86, 71, 0.08);
  border: 1px solid rgba(255, 86, 71, 0.28);
  color: #b3392e;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  margin-bottom: 1rem;
  word-break: break-word;
}

.engine-auth-submit {
  width: 100%;
  border: none;
  border-radius: 8px;
  background: var(--primary-500, #096bef);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.engine-auth-submit:hover:not(:disabled) { background: var(--primary-600, #0863ed); }
.engine-auth-submit:disabled { opacity: 0.65; cursor: not-allowed; }

.engine-auth-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: engine-auth-spin 0.7s linear infinite;
}

@keyframes engine-auth-spin { to { transform: rotate(360deg); } }

/* ── Tenant badge ───────────────────────────────────────────────────────── */

.engine-auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bs-grey-50, #f6f8fb);
  border: 1px solid var(--bs-gray-200, #e5e9f2);
  border-radius: 999px;
  padding: 0.25rem 0.375rem 0.25rem 0.75rem;
  font-size: 0.75rem;
  max-width: 100%;
  overflow: hidden;
}

.engine-auth-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success-500, #22c55e);
  flex-shrink: 0;
}

.engine-auth-badge-org {
  font-weight: 600;
  color: var(--secondary-900, #1f2b3a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.engine-auth-badge-meta {
  color: var(--secondary-500, #5d738f);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.engine-auth-badge-switch {
  border: none;
  background: var(--bs-gray-200, #e5e9f2);
  color: var(--secondary-600, #3c4d62);
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.1875rem 0.5rem;
  cursor: pointer;
  flex-shrink: 0;
}

.engine-auth-badge-switch:hover {
  background: var(--bs-gray-300, #dbdfea);
  color: var(--secondary-900, #1f2b3a);
}
