/* VoiceType Admin — 复用 style.css 的所有 CSS 变量和主题 */

.admin-app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
  position: relative;
  z-index: 2;
}
.admin-loading {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  gap: 1rem;
  color: var(--text-2);
}
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── 顶部 header ── */
.admin-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-radius: 16px;
  margin-bottom: 1.25rem;
}
.admin-header h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  flex: 1;
  letter-spacing: -0.01em;
}
.back-link {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  text-decoration: none;
  transition: all 200ms var(--ease);
}
.back-link:hover { background: var(--surface-3); color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 0.5rem; }
.me-badge {
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-size: 0.78rem;
  font-weight: 600;
}

/* ── 统计卡 ── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  /* 严格上下两行，禁止数字与标签并排 */
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  gap: 0.2rem;
  min-width: 0;
}
.stat-card .num {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-card .label {
  font-size: 0.78rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-card.warn .num { color: var(--err); }

/* ── 工具栏 ── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.search-wrap {
  position: relative;
  flex: 1;
  max-width: 280px;
  min-width: 180px;
}
.search-wrap svg {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.search-wrap input {
  padding-left: 2.1rem;
  border-radius: 999px;
}

.filter-pills { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.pill {
  font-family: inherit;
  font-size: 0.82rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--text-2);
  cursor: pointer;
  transition: all 180ms var(--ease);
  white-space: nowrap;
}
.pill:hover { background: var(--surface-3); color: var(--text); }
.pill.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border-color: transparent;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
}
.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  cursor: pointer;
  transition: filter 200ms var(--ease), transform 120ms var(--ease);
  white-space: nowrap;
}
.primary-btn:hover { filter: brightness(1.08); }
.primary-btn:active { transform: scale(0.97); }
.ghost-btn {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--text);
  cursor: pointer;
  transition: background 180ms var(--ease);
}
.ghost-btn:hover { background: var(--surface-3); }

/* ── 用户表 ── */
.table-wrap {
  padding: 0.5rem;
  border-radius: 14px;
  overflow-x: auto;
}
.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 720px;
}
.user-table th, .user-table td {
  padding: 0.7rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--hairline);
}
.user-table th {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  user-select: none;
}
.user-table th[data-sort] { cursor: pointer; }
.user-table th[data-sort]:hover { color: var(--text); }
.user-table .sort-arrow { font-size: 0.8em; opacity: 0.4; margin-left: 2px; }
.user-table th.sorted .sort-arrow { opacity: 1; color: var(--accent); }
.user-table tbody tr { transition: background 150ms var(--ease); }
.user-table tbody tr:hover { background: var(--surface-2); }
.user-table tbody tr.selected { background: rgba(var(--accent-rgb), 0.08); }
.user-table .th-check, .user-table .td-check { width: 32px; }
.user-table .th-actions, .user-table .td-actions { text-align: right; }

.role-tag {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  background: var(--surface-3);
  color: var(--text-2);
}
.role-tag.admin {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
}
.access-tag {
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
}
.access-tag.unlimited { color: var(--ok); background: rgba(48, 209, 88, 0.12); }
.access-tag.expired { color: var(--err); background: rgba(255, 69, 58, 0.12); }
.access-tag.warn { color: #c98a00; background: rgba(255, 214, 10, 0.15); }
.row-action {
  font-family: inherit;
  font-size: 0.74rem;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--text-2);
  cursor: pointer;
  margin-left: 0.2rem;
  transition: all 150ms var(--ease);
}
.row-action:hover { background: var(--surface-3); color: var(--text); }
.row-action.danger:hover { background: var(--err); color: white; border-color: var(--err); }
.empty { text-align: center; padding: 3rem 1rem; color: var(--text-3); }
.rich-empty {
  display: grid;
  place-items: center;
  gap: 0.35rem;
  min-height: 180px;
  border: 1px dashed var(--hairline-strong);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 0%, rgba(var(--accent-rgb), 0.08), transparent 42%),
    var(--surface-2);
}
.rich-empty .empty-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(48, 209, 88, 0.12);
  color: var(--ok);
  border: 1px solid rgba(48, 209, 88, 0.22);
  font-weight: 800;
}
.rich-empty strong {
  margin-top: 0.25rem;
  color: var(--text);
  font-size: 0.95rem;
}
.rich-empty span {
  color: var(--text-3);
  font-size: 0.82rem;
}

/* ── 底部批量浮动栏 ── */
.bulk-bar {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.85rem 0.65rem 1.1rem;
  background: var(--surface);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  box-shadow: var(--shadow-2);
  animation: slideUp 240ms var(--ease);
}
@keyframes slideUp {
  from { transform: translate(-50%, 30px); opacity: 0; }
  to   { transform: translate(-50%, 0); opacity: 1; }
}
.bulk-info { font-size: 0.85rem; color: var(--text-2); white-space: nowrap; }
.bulk-info b { color: var(--accent); font-variant-numeric: tabular-nums; }
.bulk-actions { display: flex; gap: 0.3rem; }
.bulk-actions button {
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--hairline);
  color: var(--text);
  cursor: pointer;
  transition: all 150ms var(--ease);
}
.bulk-actions button:hover { background: var(--surface); }
.bulk-actions button.danger:hover { background: var(--err); color: white; border-color: var(--err); }
.bulk-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--text-3);
  cursor: pointer;
}

/* "Apply to ALL" floating banner — appears above the bulk-bar when the
   admin selects every row on the current page, offering to escalate the
   action to every non-admin user in the database. Pattern borrowed from
   Gmail's "Select all conversations that match this search". */
.bulk-all-bar {
  position: fixed;
  bottom: 4.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 49;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  font-size: 0.82rem;
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 200, 0, 0.35);
  border-radius: 999px;
  color: #6b4500;
  box-shadow: var(--shadow-1);
  animation: slideUp 240ms var(--ease);
}
.bulk-all-bar b { color: #92580a; font-variant-numeric: tabular-nums; }
.bulk-all-bar .link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}
.bulk-all-bar .link-btn.dim { color: var(--text-3); text-decoration: none; }
.bulk-all-bar .link-btn:hover { opacity: 0.8; }

/* ── 新建用户弹窗 ── */
.form-stack { display: flex; flex-direction: column; gap: 0.6rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.form-stack input,
.form-stack select {
  min-height: 56px;
  font-size: 1rem;
  border-radius: 16px;
}
.error-text { color: var(--err); font-size: 0.85rem; min-height: 1.2em; margin: 0; }

/* ── 日志区共用排版 ── */
.section-title {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 240px;
}
.section-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.16), rgba(var(--accent-rgb), 0.04)),
    var(--surface-2);
  border: 1px solid var(--hairline);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45);
  font-size: 1.18rem;
  flex: 0 0 auto;
}
.section-title h2 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.2;
}
.section-title p {
  margin: 0.25rem 0 0;
  color: var(--text-3);
  font-size: 0.82rem;
  line-height: 1.35;
}

/* ── 审计日志 ── */
.audit-section {
  margin-top: 1.6rem;
  padding: 1.25rem;
  border-radius: 20px;
  overflow: hidden;
}
.audit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.audit-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  justify-content: flex-end;
  min-width: 280px;
}
.audit-tools input {
  min-height: 44px;
  padding: 0.55rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  min-width: min(420px, 100%);
  background: var(--surface);
}
.audit-stats {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  font-size: 0.78rem;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.audit-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 460px;
  overflow-y: auto;
  padding-right: 0.15rem;
}
.audit-row {
  display: grid;
  grid-template-columns: 128px 124px minmax(0, 1fr) auto;
  gap: 0.9rem;
  padding: 0.8rem 0.95rem;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  font-size: 0.82rem;
  align-items: center;
  box-shadow: 0 1px 0 rgba(255,255,255,0.28) inset;
  transition: background 160ms var(--ease), border-color 160ms var(--ease), transform 160ms var(--ease);
}
.audit-row:hover {
  background: var(--surface);
  border-color: rgba(var(--accent-rgb), 0.22);
  transform: translateY(-1px);
}
.audit-time { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 0.75rem; }
.audit-actor {
  color: var(--text);
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audit-detail { color: var(--text-2); word-break: break-word; }
.audit-action {
  display: inline-block;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  white-space: nowrap;
  text-align: center;
}
.audit-action.delete { color: var(--err); }
.audit-action.create { color: var(--ok); }
.audit-foot {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.7rem;
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--hairline);
}
.audit-page {
  min-width: 62px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.audit-foot button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 720px) {
  .audit-section { padding: 1rem; border-radius: 16px; }
  .audit-head { gap: 0.9rem; }
  .audit-tools { width: 100%; min-width: 0; justify-content: stretch; }
  .audit-tools input { min-width: 0; flex: 1; }
  .audit-row {
    grid-template-columns: 1fr;
    gap: 0.4rem;
    padding: 0.75rem 0.85rem;
  }
  .audit-row .audit-time   { order: 1; font-size: 0.7rem; }
  .audit-row .audit-action { order: 2; align-self: flex-start; margin-right: auto; }
  .audit-row .audit-actor  { order: 3; font-size: 0.85rem; }
  .audit-row .audit-detail { order: 4; font-size: 0.78rem; }
}

/* ── 登录日志 ────────────────────────────────────────────── */
.login-section {
  margin-top: 1.6rem;
  padding: 1.25rem;
  border-radius: 20px;
  overflow: hidden;
}
.login-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.login-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  min-width: 0;
  flex: 1;
  justify-content: flex-end;
}
.login-tools input {
  min-height: 44px;
  padding: 0.55rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  min-width: 0;
  flex: 1 1 240px;
  max-width: 360px;
  background: var(--surface);
}
.login-select {
  font-family: inherit;
  min-height: 44px;
  font-size: 0.86rem;
  padding: 0.5rem 2.1rem 0.5rem 0.85rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--text);
  cursor: pointer;
}
.login-stats-overall {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  font-size: 0.78rem;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* 24h 概览 */
.login-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.15rem;
}
.lsum-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.10), transparent 58%),
    var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 1rem 1.05rem;
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  gap: 0.35rem;
  min-width: 0;
  min-height: 92px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.30) inset;
}
.lsum-card::after {
  content: "";
  position: absolute;
  right: -22px;
  top: -22px;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.10);
  pointer-events: none;
}
.lsum-card.warn {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--err) 12%, transparent), transparent 58%),
    var(--surface-2);
}
.lsum-num {
  font-size: 1.85rem;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  line-height: 1.1;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lsum-card.warn .lsum-num { color: var(--err); }
.lsum-label {
  font-size: 0.8rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 表格 */
.login-table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
.login-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  min-width: 720px;
  table-layout: fixed;
}
.login-table th, .login-table td {
  padding: 0.82rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
}
.login-table th {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface-2);
  position: sticky; top: 0;
  border-bottom: 1px solid var(--hairline-strong);
}
.login-table th.num, .login-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
/* 列宽分配 */
.login-table th:nth-child(1) { width: 28%; }   /* 用户 */
.login-table th:nth-child(2) { width: 10%; }   /* 登录次数 */
.login-table th:nth-child(3) { width: 14%; }
.login-table th:nth-child(4) { width: 14%; }
.login-table th:nth-child(5) { width: 8%; }
.login-table th:nth-child(6) { width: 14%; }
.login-table th:nth-child(7) { width: 12%; }   /* 近期 IP */

.login-table tbody tr { transition: background 150ms var(--ease); }
.login-table tbody tr:last-child td { border-bottom: 0; }
.login-table tbody tr:hover { background: var(--surface-2); }

.lt-user {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
}
.lt-user .name {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lt-user .email {
  font-size: 0.74rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lt-user .role-mini {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  border-radius: 4px;
  font-size: 0.66rem;
  background: var(--surface-3);
  color: var(--text-2);
  margin-top: 0.15rem;
  align-self: flex-start;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.lt-user .role-mini.admin {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
}

.lt-count {
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.lt-count.zero { color: var(--text-3); font-weight: 400; }
.lt-fail { font-weight: 600; color: var(--err); font-variant-numeric: tabular-nums; }
.lt-fail.zero { color: var(--text-3); font-weight: 400; }
.lt-time {
  color: var(--text-2);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.lt-time.muted { color: var(--text-3); }
.lt-ips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  max-width: 100%;
}
.lt-ip {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  background: var(--surface-3);
  border: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-2);
  white-space: nowrap;
}

.login-foot {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.7rem;
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--hairline);
}
.login-page {
  min-width: 62px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.login-foot button:disabled { opacity: 0.4; cursor: not-allowed; }

/* 登录日志 — 移动端：表格塌陷为卡片堆叠 */
@media (max-width: 720px) {
  .section-title { min-width: 0; }
  .section-icon { width: 38px; height: 38px; border-radius: 11px; }
  .section-title h2 { font-size: 1rem; }
  .section-title p { font-size: 0.76rem; }
  .login-section { padding: 1rem; border-radius: 16px; }
  .login-tools { width: 100%; }
  .login-tools input { flex: 1 1 100%; }
  .login-select { flex: 1 1 100%; }

  /* 24h 概览：保持三列，数字字号缩小 */
  .login-summary { gap: 0.55rem; margin-bottom: 0.9rem; }
  .lsum-card { padding: 0.7rem 0.75rem; min-height: 78px; }
  .lsum-num { font-size: 1.2rem; }
  .lsum-label { font-size: 0.68rem; }

  /* 表格 → 卡片 */
  .login-table-wrap { overflow-x: visible; border: 0; background: transparent; }
  .login-table { min-width: 0; table-layout: auto; }
  .login-table thead { display: none; }
  .login-table tbody { display: flex; flex-direction: column; gap: 0.5rem; }
  .login-table tr {
    display: grid;
    grid-template-columns: 1fr;
    background: var(--surface-2);
    border: 1px solid var(--hairline);
    border-radius: 10px;
    padding: 0.7rem 0.85rem;
  }
  .login-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 0;
    padding: 0.25rem 0;
    gap: 0.6rem;
  }
  .login-table td::before {
    content: attr(data-label);
    color: var(--text-3);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    flex-shrink: 0;
  }
  .login-table td.num { justify-content: space-between; }
  .login-table td:first-child {
    /* 用户单独占顶部，无 label，全宽显示 */
    border-bottom: 1px solid var(--hairline);
    margin-bottom: 0.35rem;
    padding-bottom: 0.5rem;
  }
  .login-table td:first-child::before { display: none; }
  .lt-user {
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  .lt-user .name { flex: 0 1 auto; }
  .lt-user .email { flex: 1 1 100%; }
  .lt-user .role-mini { margin-top: 0; }
  .lt-ips { justify-content: flex-end; max-width: 60%; }
}

/* 极小屏（≤ 380px）：24h 概览改成 1 列堆叠 */
@media (max-width: 380px) {
  .login-summary { grid-template-columns: 1fr; }
}

/* ── 移动端 ── */
@media (max-width: 720px) {
  .admin-app { padding: 1rem 0.85rem; }
  .admin-header h1 { font-size: 1rem; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
  .stat-card { padding: 0.8rem 0.9rem; }
  .stat-card .num { font-size: 1.45rem; }

  .toolbar { flex-direction: column; align-items: stretch; padding: 0.75rem; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .toolbar-right { justify-content: space-between; }
  .search-wrap { max-width: none; }

  /* 用户表 → 卡片堆叠，避免横向溢出 */
  .table-wrap { padding: 0; }
  .user-table { min-width: 0; table-layout: auto; }
  .user-table thead { display: none; }
  .user-table tbody { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.4rem; }
  .user-table tr {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "check  name   role"
      "check  email  status"
      "actions actions actions";
    align-items: center;
    column-gap: 0.55rem;
    row-gap: 0.3rem;
    background: var(--surface-2);
    border: 1px solid var(--hairline);
    border-radius: 10px;
    padding: 0.7rem 0.85rem;
  }
  .user-table .td-check    { grid-area: check; }
  .user-table tr td:nth-child(2) { grid-area: name; font-weight: 600; }
  .user-table tr td:nth-child(3) { grid-area: email; font-size: 0.78rem; color: var(--text-3); }
  .user-table tr td:nth-child(4) { grid-area: role; justify-self: end; }
  .user-table tr td:nth-child(5) { grid-area: status; justify-self: end; }
  .user-table tr td:nth-child(6),
  .user-table tr td:nth-child(7) { display: none; }
  .user-table .td-actions {
    grid-area: actions;
    justify-self: stretch;
    display: flex;
    gap: 0.35rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--hairline);
    margin-top: 0.2rem;
  }
  .user-table .td-actions .row-action {
    flex: 1;
    height: 36px;
    margin-left: 0;
    font-size: 0.78rem;
  }
  .user-table td { border-bottom: 0; padding: 0; }

  .bulk-bar {
    left: 0.5rem;
    right: 0.5rem;
    transform: none;
    border-radius: 16px;
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* 极小屏（≤ 380px）：统计卡也降到 1 列 */
@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr; }
}

/* ============================================================
   Admin v2 — added 2026-05-02
   - User-table pagination footer
   - Operation column dropdown (.row-grant)
   - Suspended row state + access tag
   - Username button + expand arrow
   - Detail drawer (expandable row)
   - Toast notifications
   - Temp-password modal
   ============================================================ */

/* ---- pagination footer under the user table ---- */
.user-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.4);
}
.user-foot-spacer { flex: 1; }
.user-foot .ghost-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.page-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-2, #6b7280);
}
.page-size select {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: white;
  font-size: 0.85rem;
  cursor: pointer;
}

/* ---- per-row grant dropdown ---- */
.row-grant {
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: white;
  font-size: 0.78rem;
  cursor: pointer;
  margin-right: 4px;
  color: var(--text, #1f2937);
}
.row-grant:hover { border-color: rgba(0, 0, 0, 0.25); }
.row-action.warn {
  background: rgba(251, 191, 36, 0.16);
  color: #b45309;
}
.row-action.warn:hover { background: rgba(251, 191, 36, 0.28); }

/* ---- suspended row + tag ---- */
.user-table tr.suspended {
  opacity: 0.55;
  background: rgba(0, 0, 0, 0.02);
}
.access-tag.suspended {
  background: rgba(120, 120, 120, 0.18);
  color: #4b5563;
}

/* "待审核" — drawn in a slightly attention-grabbing amber so the admin's
   eye lands on the row that needs action. Same hue family as `.warn`
   but a touch saturated, mirroring iOS Reminders' "today" pill. */
.access-tag.pending {
  background: rgba(255, 159, 10, 0.18);
  color: #b45309;
  font-weight: 600;
}

/* "VIP" — golden, evokes premium / unlimited. Uses a subtle gold gradient
   so it stands apart from the access-tag's flat fills (trial / expired).
   Custom quota uses a calmer indigo (rare; admin-set numeric override). */
.access-tag.vip {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.22), rgba(255, 175, 50, 0.18));
  color: #92580a;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: inset 0 0 0 1px rgba(255, 200, 0, 0.32);
}
.access-tag.quota-custom {
  background: rgba(99, 102, 241, 0.14);
  color: #3730a3;
  font-weight: 600;
}

/* Filter-pill counter badge ("待审核 3"). Inherits the pill's color
   when not active; switches to white-on-overlay when the pill is
   active so contrast holds on the accent gradient background. */
.pill .pill-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0 0.4rem;
  min-width: 1.1rem;
  height: 1.1rem;
  line-height: 1.1rem;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(255, 159, 10, 0.22);
  color: #b45309;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.pill.active .pill-badge {
  background: rgba(255, 255, 255, 0.28);
  color: white;
}

/* ---- username as expandable button ---- */
.username-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 0;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 6px;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: left;
}
.username-btn:hover { background: rgba(0, 0, 0, 0.04); }
.expand-arrow {
  font-size: 0.7rem;
  color: var(--text-2, #6b7280);
}
.user-table tr.expanded .expand-arrow { color: var(--accent, #f59e0b); }
.last-login {
  font-size: 0.82rem;
  color: var(--text-2, #6b7280);
  white-space: nowrap;
}

/* ---- detail drawer (inline expandable row) ---- */
.detail-row {
  background: rgba(0, 0, 0, 0.02);
}
.detail-cell {
  padding: 16px 20px !important;
  border-top: 1px dashed rgba(0, 0, 0, 0.10);
}
.detail-loading { padding: 16px; color: var(--text-2, #6b7280); }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.detail-card {
  background: white;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.detail-row-pair {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.85rem;
}
.detail-row-pair span { color: var(--text-2, #6b7280); }
.detail-row-pair b { color: var(--text, #1f2937); font-weight: 600; }
.detail-note {
  font-size: 0.75rem;
  margin-top: 6px;
  font-style: italic;
}
.detail-recent {
  background: white;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.detail-recent h4 {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--text-2, #6b7280);
  font-weight: 600;
}
.detail-tx {
  display: grid;
  grid-template-columns: 130px 60px 130px 1fr;
  gap: 12px;
  padding: 6px 0;
  font-size: 0.78rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.detail-tx:last-child { border-bottom: 0; }
.detail-tx-time { color: var(--text-2, #6b7280); }
.detail-tx-prov { color: #6366f1; }
.detail-tx-len { color: var(--text-2, #6b7280); font-variant-numeric: tabular-nums; }
.detail-tx-text { color: var(--text, #1f2937); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 768px) {
  .detail-grid { grid-template-columns: 1fr; }
  .detail-tx { grid-template-columns: 1fr; gap: 2px; }
}

/* ---- toast notifications ---- */
#admin-toast-host {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.admin-toast {
  background: rgba(20, 20, 20, 0.92);
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: 360px;
  pointer-events: auto;
}
.admin-toast.show { opacity: 1; transform: translateX(0); }
.admin-toast-success { background: rgba(22, 163, 74, 0.95); }
.admin-toast-error { background: rgba(220, 38, 38, 0.95); }

/* ---- temp password modal box ---- */
.temp-pw-box {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #f3f4f6;
  border: 1px solid rgba(0, 0, 0, 0.10);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 12px 0;
}
.temp-pw-box code {
  flex: 1;
  font-family: ui-monospace, SF Mono, Menlo, monospace;
  font-size: 0.95rem;
  color: #1f2937;
  letter-spacing: 0.04em;
  user-select: all;
}

/* ---- bulk-grant dropdown styling ---- */
.bulk-grant {
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.20);
  background: rgba(255, 255, 255, 0.10);
  color: white;
  font-size: 0.85rem;
  cursor: pointer;
}
.bulk-grant option { color: #1f2937; }

/* ============================================================
   Apple-style row menu + sheet system (added 2026-05-02)
   - Compact "···" trigger button per row
   - Liquid-glass popover menu with hairline edge + spring scale-in
   - Modal sheets replacing native prompt/confirm
   ============================================================ */

/* ---- "···" trigger button on each row ---- */
.row-menu-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: transparent;
  border: 0;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-2, #6b7280);
  transition: background 140ms ease, color 140ms ease, transform 80ms ease;
}
.row-menu-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text, #111);
}
.row-menu-btn:active {
  transform: scale(0.92);
}

/* Operation column compact */
.user-table .td-actions {
  text-align: right;
  white-space: nowrap;
  padding: 6px 12px !important;
}

/* ---- Apple popover menu (Liquid Glass) ---- */
.apple-popover {
  position: fixed;
  z-index: 10000;
  min-width: 200px;
  background: rgba(252, 252, 252, 0.85);
  backdrop-filter: blur(48px) saturate(200%);
  -webkit-backdrop-filter: blur(48px) saturate(200%);
  border-radius: 14px;
  padding: 6px;
  box-shadow:
    0 0 0 0.5px rgba(0, 0, 0, 0.08),
    0 12px 32px rgba(0, 0, 0, 0.18),
    0 4px 10px rgba(0, 0, 0, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.50);
  font-size: 0.85rem;
  transform-origin: top right;
}
.ap-section {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-3, #9ca3af);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 12px 4px;
}
.ap-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 12px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text, #1f2937);
  cursor: pointer;
  transition: background 110ms ease;
  letter-spacing: 0.01em;
}
.ap-item:hover {
  background: rgba(0, 122, 255, 0.92);
  color: white;
}
.ap-item-accent {
  color: #0a84ff;
  font-weight: 500;
}
.ap-item-accent:hover { background: #0a84ff; color: white; }
.ap-item-danger {
  color: #ff3b30;
}
.ap-item-danger:hover { background: #ff3b30; color: white; }
.ap-divider {
  height: 0.5px;
  background: rgba(60, 60, 67, 0.18);
  margin: 4px 0;
}

/* Dark theme tweak */
@media (prefers-color-scheme: dark) {
  .apple-popover {
    background: rgba(36, 36, 38, 0.90);
    box-shadow:
      0 0 0 0.5px rgba(255, 255, 255, 0.10),
      0 12px 32px rgba(0, 0, 0, 0.55),
      inset 0 1px 0 rgba(255, 255, 255, 0.06);
  }
  .ap-item { color: #f5f5f7; }
  .ap-divider { background: rgba(255, 255, 255, 0.10); }
}

/* ---- Apple sheet (modal dialog) ---- */
.apple-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0);
  -webkit-backdrop-filter: blur(0);
  transition: background 220ms ease, backdrop-filter 220ms ease;
}
.apple-sheet-overlay.show {
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.apple-sheet-card {
  width: min(420px, calc(100vw - 32px));
  background: rgba(252, 252, 252, 0.92);
  backdrop-filter: blur(48px) saturate(200%);
  -webkit-backdrop-filter: blur(48px) saturate(200%);
  border-radius: 16px;
  padding: 22px 22px 14px;
  box-shadow:
    0 0 0 0.5px rgba(0, 0, 0, 0.08),
    0 24px 60px rgba(0, 0, 0, 0.30),
    0 6px 18px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.50);
  transform: scale(0.94) translateY(-8px);
  opacity: 0;
  transition: transform 240ms cubic-bezier(0.34, 1.56, 0.64, 1), opacity 200ms ease;
}
.apple-sheet-overlay.show .apple-sheet-card {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.aps-title {
  font-size: 1.0rem;
  font-weight: 600;
  color: var(--text, #1f2937);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.aps-msg {
  font-size: 0.88rem;
  color: var(--text-2, #6b7280);
  line-height: 1.5;
  margin: 0 0 14px;
}
.aps-body { margin-bottom: 4px; }

.aps-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.aps-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: white;
  font-size: 1.0rem;
  font-family: inherit;
  color: var(--text, #1f2937);
  transition: border-color 120ms ease, box-shadow 120ms ease;
  outline: none;
  -webkit-appearance: none;
}
.aps-input:focus {
  border-color: #0a84ff;
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.15);
}
.aps-input-unit {
  color: var(--text-2, #6b7280);
  font-size: 0.95rem;
}

.aps-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.aps-btn {
  padding: 8px 18px;
  border-radius: 10px;
  border: 0;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 120ms ease, transform 80ms ease, box-shadow 120ms ease;
  min-width: 72px;
}
.aps-btn:active { transform: scale(0.97); }
.aps-btn-normal {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text, #1f2937);
}
.aps-btn-normal:hover { background: rgba(0, 0, 0, 0.10); }
.aps-btn-primary {
  background: #0a84ff;
  color: white;
  box-shadow: 0 1px 3px rgba(10, 132, 255, 0.25);
}
.aps-btn-primary:hover { background: #0070d4; }
.aps-btn-destructive {
  background: #ff3b30;
  color: white;
  box-shadow: 0 1px 3px rgba(255, 59, 48, 0.30);
}
.aps-btn-destructive:hover { background: #d92a20; }

@media (prefers-color-scheme: dark) {
  .apple-sheet-card {
    background: rgba(36, 36, 38, 0.92);
    box-shadow:
      0 0 0 0.5px rgba(255, 255, 255, 0.10),
      0 24px 60px rgba(0, 0, 0, 0.65),
      inset 0 1px 0 rgba(255, 255, 255, 0.06);
  }
  .aps-input {
    background: #2c2c2e;
    border-color: rgba(255, 255, 255, 0.10);
    color: #f5f5f7;
  }
  .aps-btn-normal { background: rgba(255, 255, 255, 0.10); color: #f5f5f7; }
  .aps-btn-normal:hover { background: rgba(255, 255, 255, 0.16); }
}

/* ---- Refine the row "···" hover state (Apple touch) ---- */
.user-table tr:hover .row-menu-btn {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text, #111);
}
