/* Admin site (A1–C2.2, T1–T5). Load after /assets/auth/auth.css and /assets/billing/billing.css,
   which hold the buttons, fields, notices, stat cards, tables, status labels and modals. */

/* ---------- AdminTopBar ---------- */
.admin-bar__left { display: flex; align-items: center; align-self: stretch; gap: var(--space-40); min-width: 0; }
.admin-bar__brand { display: flex; align-items: center; gap: var(--space-12); }
.admin-nav { display: flex; gap: var(--space-24); align-self: stretch; align-items: flex-end; }
.tab {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 2px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--content-secondary);
  font: var(--text-label-sm);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.tab:hover { color: var(--content-primary); }
.tab[aria-current="page"], .tab[aria-selected="true"] { border-bottom-color: var(--border-focus); color: var(--content-primary); }
.tab:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 4px; }
.admin-nav .tab { height: 70px; }
.tabs { display: flex; gap: var(--space-24); width: 100%; border-bottom: var(--stroke-default) solid var(--border-subtle); overflow-x: auto; }

.icon-button {
  position: relative;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--content-primary);
  cursor: pointer;
}
.icon-button:hover { background: var(--surface-muted); }
.icon-button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.icon-button--sm { width: 32px; height: 32px; }

button.avatar.avatar--36 { width: 36px; height: 36px; }

/* ---------- Page layout ---------- */
.admin-site .topbar__right { gap: var(--space-16); }
.admin-main { padding-top: var(--space-48); }
#list { width: 100%; }
.admin-main .page__title .t-body-lg { max-width: none; }
.admin-page { gap: var(--space-24); }
.admin-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-24); width: 100%; }
.admin-head .page__title { flex: 1 1 480px; gap: var(--space-12); }
.admin-head__actions { display: flex; flex-wrap: wrap; gap: var(--space-12); }
.tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-16); width: 100%; }
.search { width: 400px; max-width: 100%; }
/* Search, then the Sort button 12 px after it; the time-zone note stays on the right. */
.tools__left { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-12); min-width: 0; }
/* SortMenu is the library LanguageMenu (switcher.css), 280 px wide and opening under the
   button's left edge. The chevron takes the button label's colour and points up while open. */
.sort { position: relative; display: inline-flex; flex: none; }
.sort__menu { right: auto; left: 0; width: 280px; max-width: calc(100vw - 32px); }
.sort__chevron { transition: transform .15s; }
.sort [aria-expanded="true"] .sort__chevron { transform: rotate(180deg); }
.t-strong-plain { color: var(--content-primary); }

.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-12); width: 100%; }
.pagination__controls { display: flex; align-items: center; gap: var(--space-12); }

/* Admin tables: 56 px rows */
.table--admin .table__row { min-height: 56px; padding: var(--space-8) var(--space-20); }
.table--admin .table__row--head { min-height: 56px; }
.cell-two { display: flex; flex-direction: column; gap: 2px; }
.cell-two > :first-child { font-weight: 600; }
.cell-two > :last-child { color: var(--content-secondary); }
.cell-wait { font: var(--text-caption); color: var(--content-secondary); }
.cell-wait.is-late { color: var(--content-warning); }
.cell-action { display: flex; justify-content: flex-end; gap: var(--space-8); }
/* E1 · AdminRow: the name, then the YOU badge 8 px after it. */
.cell-name { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-8); }
.cell-name .badge { align-self: center; }
a.table__row { color: inherit; text-decoration: none; }
a.table__row:hover { background: var(--surface-page); }
a.table__row:focus-visible { outline: none; box-shadow: inset var(--focus-ring); }
.table__row .icon--chevron { width: 24px; height: 24px; color: var(--content-secondary); }
/* T1 · TestAccountRow: the name opens the user's page, and so does the rest of an active row. */
.table__row--link { cursor: pointer; }
.table__row--link:hover { background: var(--surface-page); }
.row-link { color: inherit; text-decoration: none; border-radius: 4px; }
.row-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.row-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.empty--large { gap: var(--space-12); padding: 80px var(--space-24); }
.empty-mark { width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-full); background: var(--surface-success-subtle); color: var(--content-success); margin-bottom: var(--space-12); }
.empty--large .t-body-md { max-width: 480px; color: var(--content-secondary); }
.empty--large .btn { margin-top: var(--space-12); }
/* E3.3 · No requests: the icon takes the colour of the title next to it, 8px above it. */
.empty--requests .icon { color: var(--content-primary); margin-bottom: 0; }

/* ---------- SePay gateway (above the tabs) ---------- */
.sepay {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
  width: 100%;
  padding: var(--space-16) var(--space-20);
  background: var(--surface-panel);
  border: var(--stroke-default) solid var(--border-subtle);
  border-radius: var(--radius-card);
}
.sepay__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-8) var(--space-16); }
.sepay__flags { display: flex; flex-wrap: wrap; gap: var(--space-16); }
.sepay__poll { color: var(--content-secondary); margin-left: auto; }
.sepay__list { display: flex; flex-direction: column; gap: var(--space-8); margin: 0; padding: 0; list-style: none; }
.sepay__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-8) var(--space-16);
  padding: var(--space-8) var(--space-12);
  border-radius: var(--radius-control);
  background: var(--surface-muted);
}
.sepay__item strong { font: var(--text-label-sm); }
.sepay__item .t-body-sm { color: var(--content-secondary); }
.sepay__item .btn { margin-left: auto; }

/* ---------- B2 · Check panel ---------- */
.scrim--panel { justify-content: flex-end; align-items: stretch; padding: 0; }
.check-panel {
  width: 520px;
  max-width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface-panel);
  box-shadow: var(--shadow-lg);
}
.check-panel__body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-24); padding: var(--space-32); }
.check-panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-16); }
.check-panel__head > div { display: flex; flex-direction: column; gap: var(--space-4); }
.check-panel__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-12); }
.check-panel__section { display: flex; flex-direction: column; gap: var(--space-12); }
.check-panel__foot { display: flex; flex-wrap: wrap; gap: var(--space-12); padding: var(--space-20) var(--space-32); border-top: var(--stroke-default) solid var(--border-subtle); }
.check-panel__foot .btn { flex: 1 1 0; min-width: 0; }
/* "Check with SePay" asks the gateway, so it gets its own row above Approve and Reject. */
.check-panel__foot [data-check-sepay] { flex: 1 1 100%; }
.details { display: flex; flex-direction: column; gap: var(--space-4); }
.details--muted { padding: var(--space-12) var(--space-16); border-radius: var(--radius-control); background: var(--surface-muted); }
.detail { display: flex; align-items: flex-start; gap: var(--space-16); }
.detail__label { flex: 0 0 150px; font: var(--text-body-sm); color: var(--content-secondary); padding-top: 2px; }
.detail__value { flex: 1; min-width: 0; font: var(--text-label-md); overflow-wrap: anywhere; }

/* ---------- Dialogs (B2.3, B3, C2.1) ---------- */
.radio-list { display: flex; flex-direction: column; gap: var(--space-12); border: 0; margin: 0; padding: 0; min-width: 0; }
.radio-list legend { padding: 0; margin-bottom: var(--space-12); font: var(--text-label-md); }
.radio-option { position: relative; display: flex; align-items: center; gap: var(--space-12); cursor: pointer; }
.radio-option input { position: absolute; width: 16px; height: 16px; margin: 0; opacity: 0; cursor: pointer; }
.radio-option input:focus-visible + .radio { box-shadow: var(--focus-ring); }
.radio-list.is-error .radio { border-color: var(--border-error); }
.field-row { display: flex; gap: var(--space-16); }
.field-row > .field { flex: 1 1 0; min-width: 0; }
.dialog-section { display: flex; flex-direction: column; gap: var(--space-12); }
.file-chip {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: var(--space-8);
  max-width: 100%;
  padding: var(--space-4) var(--space-4) var(--space-4) var(--space-12);
  border: var(--stroke-default) solid var(--border-subtle);
  border-radius: var(--radius-control);
  background: var(--surface-muted);
}
.file-chip__name { font: var(--text-label-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pick.is-error .btn { border-color: var(--border-error); }

/* Toast sits bottom left on the admin site (B2.2, C2.2). */
.admin-site .toast { left: var(--space-40); transform: none; }

/* ---------- A1–A3.2 · Admin access ---------- */
.access { width: 100%; max-width: 440px; display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-24); }
.access > :not(.btn--ghost):not(.badge) { width: 100%; }
.access form { display: flex; flex-direction: column; gap: var(--space-24); }
.access__title { display: flex; flex-direction: column; gap: var(--space-12); }
.access__title .t-body-md, .access__title .t-body-md strong { color: var(--content-secondary); font-weight: 400; }
/* A1.1: the error replaces the helper line. */
.access .field.is-error #email-note, .access .field.is-error #name-note { display: none; }
/* A2 has no button: the 6th digit checks the code. It shows up again as "Send a new code". */
.access #code-submit:disabled:not([aria-busy="true"]) { display: none; }

.status-wrap { width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: var(--space-24); }
.status-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-24);
  padding: var(--space-40);
  background: var(--surface-panel);
  border: var(--stroke-default) solid var(--border-subtle);
  border-radius: var(--radius-card);
}
.status-card > :not(.status-mark) { width: 100%; }
.status-mark { width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-full); }
.status-mark--warning { background: var(--surface-warning-subtle); color: var(--content-warning); }
.status-mark--error { background: var(--surface-error-subtle); color: var(--content-error); }
.status-card__title { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-12); }
.status-card__title .t-body-md { color: var(--content-secondary); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .admin-bar__left { gap: var(--space-16); }
  .admin-bar__brand .badge { display: none; }
  .field-row { flex-direction: column; }
}

@media (max-width: 640px) {
  /* Logo, language and avatar don't leave room for the tabs (Vietnamese is longer), so the
     tabs get a row of their own under them. */
  .admin-site .topbar { flex-wrap: wrap; height: auto; row-gap: 0; }
  .admin-site .admin-bar__left { display: contents; }
  .admin-site .admin-bar__brand { height: 64px; }
  .admin-site .admin-nav { order: 1; flex: 1 0 100%; gap: var(--space-24); }
  .admin-site .admin-nav .tab { height: 44px; }
  .admin-site .toast { left: var(--space-16); right: var(--space-16); }
  .check-panel__body { padding: var(--space-24); }
  .check-panel__foot { padding: var(--space-16) var(--space-24); }
  .detail { flex-direction: column; gap: 0; }
  .detail__label { flex: none; }
  .status-card { padding: var(--space-24); }
}
