/* Admin: users. Shares tokens with app.css. */

body.admin {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--panel);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: var(--rail);
  border-bottom: 1px solid var(--line-soft);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.topbar-mark {
  display: block;
  width: auto;
  height: 23px;
}

.topbar-sep {
  width: 1px;
  height: 20px;
  background: var(--line);
}

.topbar-here {
  flex: 1;
  color: var(--muted);
  font-size: 14px;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: 13.5px;
  text-decoration: none;
}

.topbar-link:hover {
  color: var(--text);
  border-color: var(--muted);
}

.topbar-link .icon {
  width: 16px;
  height: 16px;
}

.page {
  flex: 1;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.page-head {
  margin-bottom: 24px;
}

.page-head h1 {
  margin: 0 0 4px;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
}

.card {
  background: var(--raised);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.card + .card {
  margin-top: 24px;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.card-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.card-head p {
  margin: 0;
  color: var(--dim);
  font-size: 13px;
}

.card-body {
  padding: 18px;
}

/* ------------------------------------------------------------ the table */

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  padding: 10px 18px;
  background: #242a35;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
}

tbody td {
  padding: 11px 18px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.cell-user {
  font-weight: 500;
}

.cell-when {
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 12.5px;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill-active {
  background: rgba(79, 189, 126, 0.14);
  color: var(--ok);
}

.pill-off {
  background: rgba(224, 87, 79, 0.14);
  color: #e8847d;
}

.cell-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* ----------------------------------------------------------- form bits */

input,
select {
  background: var(--rail);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px 11px;
  color: var(--text);
}

input::placeholder {
  color: var(--dim);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

select {
  cursor: pointer;
}

.btn {
  padding: 7px 13px;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.12s, color 0.12s, background-color 0.12s;
}

.btn:hover {
  border-color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.btn-danger:hover {
  border-color: var(--danger);
  color: #f0948d;
  background: rgba(224, 87, 79, 0.1);
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.btn-accent:hover {
  background: #336fd8;
  border-color: #336fd8;
}

.create-user {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 10px;
  align-items: end;
}

.create-user .f label {
  display: block;
  margin-bottom: 5px;
  font-size: 12.5px;
  color: var(--muted);
}

.create-user .f input,
.create-user .f select {
  width: 100%;
}

.form-note {
  margin: 12px 0 0;
  color: var(--dim);
  font-size: 12.5px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 10px 16px;
  background: var(--raised-hi);
  border: 1px solid var(--line);
  border-radius: 99px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  font-size: 14px;
  z-index: 80;
}

.toast[hidden] {
  display: none;
}

.toast-bad {
  border-color: rgba(224, 87, 79, 0.5);
  color: #f0948d;
}

/* --------------------------------------------------------- responsive */

@media (max-width: 860px) {
  .create-user {
    grid-template-columns: 1fr 1fr;
  }

  .create-user .f-role,
  .create-user .f-submit {
    grid-column: span 1;
  }
}

/* Below this the table stops being a table and becomes one card per user. */
@media (max-width: 680px) {
  .page {
    padding: 22px 14px 56px;
  }

  thead {
    display: none;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  tbody tr {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line-soft);
  }

  tbody tr:last-child {
    border-bottom: 0;
  }

  tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 4px 0;
    border: 0;
  }

  tbody td::before {
    content: attr(data-label);
    flex: none;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--dim);
  }

  .cell-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    padding-top: 10px !important;
  }

  .cell-actions::before {
    display: none;
  }

  .create-user {
    grid-template-columns: 1fr;
  }

  .topbar-here {
    display: none;
  }
}
