.user-auth-page {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-top: 4px solid var(--tlfl-blue);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgb(17 24 39 / 0.07);
  max-width: 36rem;
  padding: 1.25rem;
}

.user-profile {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-top: 4px solid var(--tlfl-blue);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgb(17 24 39 / 0.07);
  max-width: calc(100vw - 2rem);
  padding: 1.25rem;
  width: fit-content;
}

.user-admin-form-page {
  max-width: 44rem;
  width: min(44rem, calc(100vw - 2rem));
}

.user-auth-page h1,
.user-profile h1 {
  margin-top: 0;
}

.user-form {
  display: grid;
  gap: 0.85rem;
}

.form-grid {
  display: grid;
  gap: 0.95rem 1.25rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.user-form p {
  margin: 0;
}

.user-password-fields {
  grid-column: 1 / -1;
}

.user-team-field {
  grid-column: 1 / -1;
}

.user-role-fields {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  display: grid;
  gap: 0.7rem;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 0.9rem;
}

.user-role-fields legend {
  color: #172554;
  font-weight: 800;
  padding: 0 0.35rem;
}

.user-role-option {
  cursor: pointer;
  display: block;
  min-width: 0;
}

.user-role-checkbox {
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.user-role-card {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #d6dee9;
  border-radius: 8px;
  color: #334155;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  min-height: 2.9rem;
  padding: 0.65rem 0.75rem;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.user-role-name {
  font-weight: 800;
}

.user-role-switch {
  background: #cbd5e1;
  border-radius: 999px;
  display: inline-flex;
  flex: 0 0 auto;
  height: 1.35rem;
  padding: 0.18rem;
  width: 2.35rem;
}

.user-role-switch::after {
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgb(15 23 42 / 0.22);
  content: "";
  display: block;
  height: 0.99rem;
  transform: translateX(0);
  transition: transform 0.15s ease;
  width: 0.99rem;
}

.user-role-checkbox:checked + .user-role-card {
  background: #eef4ff;
  border-color: var(--tlfl-blue);
  box-shadow: inset 0 0 0 1px rgb(31 85 171 / 0.18);
  color: #172554;
}

.user-role-checkbox:checked + .user-role-card .user-role-switch {
  background: var(--tlfl-blue);
}

.user-role-checkbox:checked + .user-role-card .user-role-switch::after {
  transform: translateX(1rem);
}

.user-role-checkbox:focus-visible + .user-role-card {
  outline: 3px solid rgb(31 85 171 / 0.28);
  outline-offset: 2px;
}

.user-password-fields {
  display: grid;
  gap: 0.95rem;
  max-width: 20rem;
}

.user-form label {
  color: #374151;
  font-weight: 700;
}

.user-form input,
.user-form select {
  border: 1px solid #9ca3af;
  border-radius: 6px;
  box-sizing: border-box;
  font: inherit;
  min-height: 2.35rem;
  padding: 0.4rem 0.55rem;
  width: 100%;
}

.user-form .user-role-checkbox {
  min-height: 1px;
  padding: 0;
  width: 1px;
}

.form-errors {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #7f1d1d;
  padding: 0.8rem 1rem;
}

.form-errors h2 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

.user-profile-header {
  align-items: start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.user-profile-team {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  margin: 0.35rem 0 0;
}

.user-profile-team img {
  height: 2rem;
  object-fit: contain;
  width: 2rem;
}

.user-profile-details {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(3, max-content);
  margin: 1.25rem 0 0;
}

.user-profile-details div {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  min-width: 0;
  padding: 0.85rem;
}

.user-profile-details dt {
  color: #4b5563;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.user-profile-details dd {
  font-weight: 700;
  margin: 0.25rem 0 0;
  min-width: 0;
  white-space: nowrap;
}

.users-admin-page {
  max-width: 72rem;
}

.users-admin-heading {
  align-items: end;
}

.users-admin-count {
  color: #64748b;
  font-size: 0.92rem;
  font-weight: 800;
  margin: 0.45rem 0 0;
}

.users-admin-summary {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(3, minmax(8rem, 1fr));
  margin-bottom: 1rem;
}

.users-admin-summary div {
  background: #f8fafc;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  padding: 0.8rem 0.9rem;
}

.users-admin-summary span {
  color: #64748b;
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.users-admin-summary strong {
  color: #111827;
  display: block;
  font-size: 1.55rem;
  line-height: 1.1;
  margin-top: 0.18rem;
}

.users-admin-table-wrap {
  background: #ffffff;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgb(17 24 39 / 0.06);
  overflow-x: auto;
}

.users-admin-table {
  border-collapse: collapse;
  min-width: 56rem;
  width: 100%;
}

.users-admin-table th,
.users-admin-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 0.85rem 1rem;
  text-align: left;
  vertical-align: middle;
}

.users-admin-table th {
  background: #f8fafc;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.users-admin-table tbody tr:last-child td {
  border-bottom: 0;
}

.users-admin-name {
  color: #111827;
  display: block;
  font-weight: 800;
  white-space: nowrap;
}

.users-admin-email {
  font-weight: 700;
  white-space: nowrap;
}

.users-admin-team {
  align-items: center;
  color: #1f2937;
  display: inline-flex;
  font-weight: 800;
  gap: 0.55rem;
  white-space: nowrap;
}

.users-admin-team img {
  height: 2rem;
  object-fit: contain;
  width: 2rem;
}

.users-admin-muted {
  color: #94a3b8;
  font-weight: 700;
}

.users-admin-credentials {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.users-admin-credential {
  background: #eef4ff;
  border: 1px solid #bfd1f2;
  border-radius: 999px;
  color: #172554;
  display: inline-flex;
  font-size: 0.8rem;
  font-weight: 900;
  line-height: 1;
  padding: 0.42rem 0.55rem;
  white-space: nowrap;
}

.users-admin-credential-muted {
  background: #f3f4f6;
  border-color: #e5e7eb;
  color: #64748b;
}

.users-admin-actions {
  text-align: right;
  width: 1%;
}

.users-admin-edit-link {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #1f2937;
  display: inline-flex;
  font-weight: 800;
  padding: 0.48rem 0.7rem;
}

.users-admin-edit-link:visited {
  color: #1f2937;
}

.users-admin-edit-link:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #111827;
}

@media (max-width: 42rem) {
  .user-admin-form-page .form-grid,
  .user-role-fields,
  .users-admin-summary {
    grid-template-columns: 1fr;
  }

  .users-admin-heading {
    align-items: start;
  }
}

@media (max-width: 640px) {
  .form-grid,
  .user-profile-details {
    grid-template-columns: 1fr;
  }

  .user-password-fields {
    max-width: none;
  }
}
