/* Auth-specific views: login, tenant picker, and the user/tenant
 * footer that sits at the bottom of the sidebar (oppi-rust is
 * single-tenant + no-auth; these screens + footer are new for
 * oppi-production). Palette tokens match main.css. */

/* Login & tenant picker shared shell */
.auth-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--gray-50);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  padding: 28px;
}

.auth-card h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.auth-card p.muted {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 18px;
}

.auth-card p.dev-hint {
  margin-top: 16px;
  font-size: 11px;
  color: var(--gray-400);
}

.auth-card p.dev-hint code {
  background: var(--gray-100);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
}

.auth-card form > label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-error {
  color: var(--red-500);
  background: var(--red-100);
  border: 1px solid var(--red-500);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
}

.auth-kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 12px;
  margin: 16px 0;
  font-size: 13px;
}

.auth-kv dt {
  color: var(--gray-500);
  font-weight: 600;
}

.auth-kv dd {
  margin: 0;
  color: var(--gray-800);
  overflow-wrap: anywhere;
}

.auth-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Tenant picker list */
.tenant-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tenant-list li button {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--gray-200);
  background: white;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}

.tenant-list li button:hover {
  background: var(--primary-50);
  border-color: var(--primary-500);
}

.tenant-list li button .slug {
  display: block;
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}

/* Sidebar footer — user + current tenant + logout. Sits at the bottom
 * of #sidebar using margin-top: auto since the sidebar is a flex column. */
.sidebar-footer {
  margin-top: auto;
  padding: 12px 14px 16px;
  border-top: 1px solid var(--gray-700);
  color: var(--gray-400);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-footer .user-email {
  color: var(--gray-200);
  font-weight: 500;
  word-break: break-all;
}

.sidebar-footer .tenant-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-footer .tenant-label {
  color: var(--gray-300);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer button.logout,
.sidebar-footer button.tenant-switch {
  background: transparent;
  color: var(--gray-400);
  border: 1px solid var(--gray-700);
  padding: 4px 8px;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}

.sidebar-footer button.logout:hover,
.sidebar-footer button.tenant-switch:hover {
  background: var(--gray-800);
  color: white;
  border-color: var(--gray-600);
}

/* Tenant switcher popover rendered inside the sidebar footer */
.tenant-switch-popover {
  position: fixed;
  bottom: 110px;
  left: 14px;
  background: var(--gray-800);
  border: 1px solid var(--gray-700);
  border-radius: var(--radius);
  padding: 6px;
  min-width: 210px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
}

.tenant-switch-popover button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--gray-200);
  padding: 6px 8px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 3px;
}

.tenant-switch-popover button:hover {
  background: var(--gray-700);
}

.tenant-switch-popover button.current {
  color: white;
  background: rgba(37, 99, 235, 0.25);
}

/* The HTML fallback works even when bootstrap.js cannot be fetched. */
.bootstrap-fallback {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  background: var(--gray-50);
  color: var(--gray-900);
}

.bootstrap-fallback h1 {
  font-size: 20px;
  margin: 0;
}

.bootstrap-fallback p { margin: 0; }

.bootstrap-retry-link {
  visibility: hidden;
  animation: bootstrap-reveal-retry 0s 6s forwards;
}

.bootstrap-retry-link--immediate {
  visibility: visible;
  animation: none;
}

@keyframes bootstrap-reveal-retry { to { visibility: visible; } }

.bootstrap-retry-banner {
  position: fixed;
  z-index: 10000;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--gray-900);
  color: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.bootstrap-retry-banner a { color: white; }
