/* Login page and Users (admin) page. Uses the colour tokens from app.css,
   so light and dark themes work without extra rules. */

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #fff); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; height: 44px; }

/* ---------- forms ---------- */

.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label, .perm-set legend { font-size: 13px; font-weight: 600; color: var(--ink); }
.field-hint { font-size: 12px; }
.field:focus-visible { border-color: var(--accent); }

.check {
  display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap;
  min-height: 40px; padding: 8px 10px; border-radius: 8px; cursor: pointer;
  font-size: 14px;
}
.check:hover { background: var(--surface-2); }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.check-hint { flex-basis: 100%; padding-left: 28px; font-size: 12px; }
.check-row { display: flex; flex-wrap: wrap; gap: 4px 16px; }

/* ---------- login page ---------- */

.auth-main {
  min-height: calc(100vh - 70px);
  align-items: center; justify-content: center;
}
.auth-card { width: 100%; max-width: 400px; padding: 28px; gap: 20px; }
.auth-head { display: flex; flex-direction: column; gap: 6px; }
.auth-head p { margin: 0; font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }

/* ---------- users page ---------- */

.admin-form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.perm-set {
  margin: 0; padding: 12px 14px 8px;
  border: 1px solid var(--border); border-radius: 10px;
}
.perm-set legend { padding: 0 6px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 12px; }
.perm-set.is-locked .check { opacity: 0.55; cursor: default; }
.perm-hint {
  margin: 8px 0 4px; padding: 8px 12px; border-radius: 8px; font-size: 13px;
  background: var(--warn-bg); color: var(--warn-ink);
}

.admin-table-head { padding: 16px 22px; }
.admin-table td { vertical-align: top; }
.user-cell { display: flex; flex-direction: column; gap: 2px; min-height: 36px; justify-content: center; }
.user-name { font-weight: 600; }
.user-sub { font-size: 12px; color: var(--ink-2); }
.pill-row { display: flex; flex-wrap: wrap; gap: 4px; max-width: 360px; }
.nowrap { white-space: nowrap; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn + .btn { margin-left: 6px; }
.admin-table tr.is-inactive .user-name { color: var(--ink-2); }

.edit-row td { background: var(--surface-2); padding: 16px 22px; }
.edit-panel { display: flex; flex-direction: column; gap: 12px; max-width: 960px; }
.edit-panel .field { background: var(--surface); }
.edit-panel p { margin: 0; font-size: 13px; }

@media (max-width: 640px) {
  .auth-card { padding: 20px; }
  .admin-table-head, .edit-row td { padding: 14px 16px; }
}

/* Role buttons above the permission boxes */
.role-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 10px; }
.role-title { font-size: 13px; font-weight: 600; }
.role-btn[aria-pressed="true"] { background: var(--accent-wash); border-color: var(--accent); font-weight: 700; }
.role-now { font-size: 13px; }
