html {
  position: relative;
  min-height: 100%;
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  min-height: 100vh;
  margin-bottom: 72px;
  background: #f6f7f9;
  color: #1f2937;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.25rem rgba(37, 99, 235, 0.35);
}

.app-nav {
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.04);
}

.app-main {
  padding-top: 28px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-header h1,
.auth-panel h1,
.surface h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.05;
}

.surface h2,
.surface h1 {
  font-size: 1.35rem;
}

.eyebrow {
  margin: 0 0 6px;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.metric-card,
.surface,
.branding-card,
.auth-panel {
  border: 1px solid #dde3ea;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.metric-card {
  min-height: 112px;
  padding: 18px;
}

.metric-card span {
  display: block;
  color: #64748b;
  font-size: 0.85rem;
}

.metric-card strong {
  display: block;
  margin-top: 16px;
  font-size: 1.35rem;
}

.surface {
  padding: 24px;
}

.surface.narrow {
  max-width: 560px;
  margin: 0 auto;
}

.endpoint-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.endpoint-grid code {
  display: block;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  white-space: normal;
}

.auth-shell {
  display: grid;
  min-height: calc(100vh - 220px);
  place-items: center;
  padding: 28px 0;
}

.auth-panel {
  width: min(100%, 460px);
  padding: 32px;
  border-top: 5px solid var(--brand-color, #2563eb);
}

.brand-logo {
  display: block;
  max-width: 180px;
  max-height: 72px;
  margin-bottom: 22px;
  object-fit: contain;
}

.stacked-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-primary {
  --bs-btn-bg: var(--brand-color, #2563eb);
  --bs-btn-border-color: var(--brand-color, #2563eb);
  --bs-btn-hover-bg: #1d4ed8;
  --bs-btn-hover-border-color: #1d4ed8;
}

.scope-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 24px;
}

.scope-list span {
  padding: 6px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand-color, #2563eb) 12%, white);
  color: #1f2937;
  font-size: 0.85rem;
  font-weight: 600;
}

.branding-list {
  display: grid;
  gap: 18px;
}

.branding-card {
  padding: 20px;
  border-left: 5px solid var(--brand-color, #2563eb);
}

.branding-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.branding-preview img,
.logo-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: contain;
  background: #f8fafc;
}

.logo-placeholder {
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--brand-color, #2563eb);
  font-size: 1.4rem;
  font-weight: 700;
}

.branding-preview code {
  display: block;
  margin-top: 4px;
  color: #64748b;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.pill-list,
.role-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-list span,
.role-checklist label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid #dbe3ec;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-size: 0.9rem;
  font-weight: 600;
}

.role-checklist input {
  margin: 0;
}

.user-list {
  display: grid;
  gap: 14px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.35fr) minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.user-role-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 60px;
  line-height: 60px;
  background: #fff;
}

@media (max-width: 640px) {
  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-panel,
  .surface,
  .branding-card {
    padding: 20px;
  }

  .admin-grid,
  .user-row {
    grid-template-columns: 1fr;
  }

  .user-role-form {
    align-items: flex-start;
    flex-direction: column;
  }
}
