/* The admin area: its own chrome, on the app's tokens. Kept in a file of its
   own, to leave with the admin client when that becomes an app of its own. */

.admin {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

/* Pinned, as the app's own top bar is. */
.admin-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 60px;
  padding: 0 24px;
  border-bottom: var(--border-w) solid var(--line);
  background: var(--surface);
}

.admin-brand {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}

.admin-bar-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding-block: 8px;
}

.admin-user {
  margin-left: 8px;
  font-size: 14px;
  color: var(--muted);
}

.admin-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  box-sizing: border-box;
}

.admin-main h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
}

.admin-login {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(380px, 100%);
  margin: 8vh auto 0;
  padding: 28px;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.admin-login label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

.admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.admin-head p {
  margin: 4px 0 0;
}

.admin-table-wrap {
  overflow-x: auto;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

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

.admin-table th {
  padding: 12px 16px;
  border-bottom: var(--border-w) solid var(--line);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: var(--label-spacing);
  text-align: left;
  text-transform: var(--label-transform);
  color: var(--muted);
  white-space: nowrap;
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

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

.admin-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.admin-name {
  display: block;
  font-weight: 500;
}

.admin-email {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

/* --- the overview ---------------------------------------------------- */

.admin-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-section h2 {
  margin: 12px 0 0;
  font-family: var(--font-display);
  font-size: 20px;
}

.admin-card {
  padding: 16px 18px;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.admin-card h3,
.admin-section > h3 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: var(--label-spacing);
  text-transform: var(--label-transform);
  color: var(--muted);
}

/* A list of a section's own, named: the section's gap is its spacing. */
.admin-section > h3 {
  margin: 4px 0 0;
}

/* The headline figures, as many to a row as fit. */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.admin-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-stat-label {
  font-size: 13px;
  color: var(--muted);
}

.admin-stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Time per day: a column per day, its bar as tall as its share of the
   busiest one. */
.admin-bars {
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 180px;
  overflow-x: auto;
}

.admin-bar-col {
  display: flex;
  flex: 1 0 14px;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 14px;
}

.admin-bar-track {
  display: flex;
  flex: 1;
  align-items: flex-end;
  width: 100%;
}

.admin-bar-fill {
  width: 100%;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: var(--accent);
}

.admin-bar-col:hover .admin-bar-fill {
  background: var(--accent-hover);
}

.admin-bar-label {
  min-height: 1.2em;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

/* Where the time went: three cards side by side where they fit. */
.admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.admin-shares {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-share-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 14px;
}

.admin-share-track {
  height: 8px;
  border-radius: 4px;
  background: var(--chip);
  overflow: hidden;
}

.admin-share-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
}

.admin-switches {
  margin: 0;
  font-size: 14px;
}

.admin-table td.muted {
  color: var(--muted);
}

a.admin-brand {
  color: var(--ink);
  text-decoration: none;
}

a.admin-name {
  color: var(--ink);
}

a.admin-name:hover {
  color: var(--accent-text);
}

/* --- one user --------------------------------------------------------- */

.admin-back {
  font-size: 14px;
}

.admin-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 20px;
  margin: 0;
  font-size: 14px;
}

.admin-facts dt {
  color: var(--muted);
}

.admin-facts dd {
  min-width: 0;
  margin: 0;
  /* An address or an id is one long word: it breaks rather than overflows. */
  overflow-wrap: anywhere;
}

.admin-counts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.admin-counts li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.admin-counts .num {
  font-variant-numeric: tabular-nums;
}

/* A sign-in turned away. */
.admin-table td.admin-bad {
  color: var(--danger);
}

/* A request to join, still waiting for a verdict. */
.admin-table tr.admin-pending td {
  background: var(--accent-soft);
}

/* Still a table cell: a flex one would leave the row's grid. */
.admin-table td.admin-actions {
  text-align: right;
  white-space: nowrap;
}

.admin-table td.admin-actions button {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.admin-table td.admin-actions button + button {
  margin-left: 6px;
}
