/**
 * P11-R7-U0/U1 — staff UI bootstrap lifecycle and first-paint gate.
 */
[data-staff-ui-bootstrap-state='idle'],
[data-staff-ui-bootstrap-state='loading_config'],
[data-staff-ui-bootstrap-state='resolving_locale'],
[data-staff-ui-bootstrap-state='loading_messages'],
[data-staff-ui-bootstrap-state='resolving_branding'],
[data-staff-ui-bootstrap-state='checking_session'] {
  /* lifecycle in progress */
}

[data-staff-ui-bootstrap-state='ready'],
[data-staff-ui-bootstrap-state='degraded'] {
  /* Bootstrap complete — visible chrome allowed */
}

[data-staff-ui-bootstrap-state='failed'] {
  /* Terminal bootstrap failure — surface-specific handling */
}

/* U1 first-paint gate: hide staff chrome until locale-ready */
html[data-staff-ui-first-paint='pending'] body > *:not(#staff-ui-first-paint-status) {
  visibility: hidden;
}

html[data-staff-ui-first-paint='pending'] #staff-ui-first-paint-status {
  visibility: visible;
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2147483646;
  background: var(--rastan-bg, #0f1419);
  color: var(--rastan-fg, #e8eaed);
  font: 14px/1.4 system-ui, sans-serif;
}

html[data-staff-ui-first-paint='ready'] body,
html:not([data-staff-ui-first-paint='pending']) body {
  visibility: visible;
}

/* P11-R7-U2 — unified staff authentication shell */
.staff-auth-shell--details[open] {
  border-inline-start: 4px solid var(--rastan-primary, #1565c0);
}

.staff-auth-shell--checking_session,
.staff-auth-shell--submitting_credentials,
.staff-auth-shell--logout_in_progress {
  opacity: 0.95;
}

.staff-auth-shell--invalid_credentials,
.staff-auth-shell--session_expired,
.staff-auth-shell--permission_denied,
.staff-auth-shell--role_mismatch,
.staff-auth-shell--branch_mismatch,
.staff-auth-shell--unknown_error {
  border-inline-start-color: var(--rastan-danger, #c62828);
}

.staff-auth-shell--local_unavailable,
.staff-auth-shell--cloud_unavailable,
.staff-auth-shell--offline {
  border-inline-start-color: var(--rastan-warning, #ed6c02);
}

.staff-auth-shell__status {
  flex: 1 1 100%;
  margin: 4px 0 0;
}

.staff-auth-shell--authenticated .staff-auth-shell__status[hidden] {
  display: none !important;
}

[data-staff-auth-a11y='alert'] .staff-auth-shell__status {
  color: var(--rastan-danger, #c62828);
}

#mgr-gate[data-staff-auth-state='checking_session'],
#mgr-gate[data-staff-auth-state='submitting_credentials'] {
  pointer-events: none;
}

#hub_root[data-staff-auth-state='checking_session'] .hub-health-grid {
  opacity: 0.92;
}
