/* Admin: user management (root-only). LTR, neutral admin palette - matches
   the existing admin table look (see admin.css .stats-bydate-table). */

.admin-users {
  direction: ltr;
}

.admin-users-error {
  background: #fde8e8;
  border: 1px solid #f3b4b4;
  color: #9b1c1c;
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

/* One-time credential panel */
.admin-users-onetime {
  background: #fffbeb;
  border: 1px solid #f5d98b;
  border-radius: 8px;
  padding: 0.9rem 1rem;
  margin-bottom: 1.25rem;
}

.admin-users-onetime-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #1a1a2e;
}

.admin-users-onetime-head .fa-key {
  color: #b7791f;
}

.admin-users-onetime-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0.15rem 0.35rem;
  line-height: 1;
}

.admin-users-onetime-close:hover {
  color: #1a1a2e;
}

.admin-users-onetime-body {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.65rem 0 0.4rem;
}

.admin-users-onetime-code {
  font-family: var(--font-mono, monospace);
  font-size: 1rem;
  background: #fff;
  border: 1px solid #e8d9a8;
  border-radius: 6px;
  padding: 0.45rem 0.7rem;
  color: #1a1a2e;
  user-select: all;
}

.admin-users-onetime-note {
  font-size: 0.78rem;
  color: #8a6d3b;
  line-height: 1.45;
  margin: 0;
}

/* Create form */
.admin-users-create {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 1rem 1.1rem;
  margin-bottom: 1.25rem;
}

.admin-users-create-head {
  display: flex;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 500;
  color: #1a1a2e;
  padding-bottom: 0.6rem;
  margin-bottom: 0.8rem;
  border-bottom: 1px solid #f0f0f0;
}

.admin-users-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 1rem;
  max-width: 360px;
}

.admin-users-field label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  font-weight: 500;
}

.admin-users-hint {
  font-size: 0.75rem;
  color: #9ca3af;
  line-height: 1.4;
}

.admin-users-perms {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.6rem 1.2rem;
  margin-bottom: 1rem;
}

.admin-users-perm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.admin-users-perm-label {
  font-size: 0.85rem;
  color: #1a1a2e;
}

.admin-users-perm-select {
  min-width: 130px;
}

.admin-users-create-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Users table */
.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  /* `clip`, not `hidden`: it rounds the corners the same way but does NOT
     establish a scroll container, so the sticky first column below sticks to
     the .adm-table-scroll wrapper instead of being trapped inside this table
     (where it would silently fail to freeze). */
  overflow: clip;
}

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

.admin-users-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  font-weight: 500;
  background: #fafafa;
}

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

.admin-users-name {
  font-weight: 600;
  color: #1a1a2e;
  white-space: nowrap;
}

.admin-users-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #1a1a2e;
  color: #fff;
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.admin-users-badge--you {
  background: #e5e7eb;
  color: #374151;
}

.admin-users-rootnote {
  color: #6b7280;
  font-style: italic;
}

.admin-users-actions-col {
  white-space: nowrap;
}

.admin-users-actions-col .btn {
  margin-left: 0.35rem;
}

.admin-users-actions-col .btn:first-child {
  margin-left: 0;
}

/* The table's horizontal scrolling lives in the .adm-table-scroll wrapper
   (admin.css) at every width - the old display:block/overflow-x hack on the
   table itself is gone with it. */

/* ── Sticky identity column ──────────────────────────────────────────
   REVIEW: verify in a live viewport (this worktree cannot render one). The
   permissions table grows one column per admin page, so it pans sideways; the
   username stays frozen at the inline-start edge so a permission cell is never
   read against the wrong user. The frozen cell needs an opaque background or
   the panned cells bleed through it. This screen is LTR and its rows have no
   hover tint, so only the background is re-asserted. The rootnote cell is the
   SECOND cell (a colspan), never .admin-users-name, so it is left alone. */
.admin-users-table thead th:first-child,
.admin-users-table td.admin-users-name {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  background: #fff;
}

.admin-users-table thead th:first-child {
  z-index: 2;
  background: #fafafa;
}

/* ── Touch floors (admin mobile revamp) ───────────────────────────────
   44px targets and 16px input text below 1025px; an iOS input under 16px
   zooms the whole page on focus. Desktop keeps the compact sizes. */
@media (max-width: 1024px) {
  .admin-users .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .admin-users .form-input,
  .admin-users .form-select {
    font-size: 16px;
    min-height: 44px;
  }

  .admin-users-onetime-close {
    min-height: 44px;
    min-width: 44px;
  }
}
