/* ============================================================
   Zoo Forest 平台後台主控台 — Admin Shell
   簡約亮色 + 平台橙 accent；RWD（側欄→抽屜、表格→窄螢幕卡片堆疊）。
   斷點：375（手機）→ 768（平板）→ 1280（桌機）。
   不含任何密鑰；所有權限由後端 guard 把關，前端僅 UX。
   ============================================================ */

:root {
  --brand: #964900;          /* 平台橙 */
  --brand-dim: #ed8200;
  --brand-soft: rgba(150, 73, 0, 0.08);
  --brand-softer: rgba(150, 73, 0, 0.04);
  --surface: #f6f3f2;        /* surface */
  --surface-card: #ffffff;
  --surface-dim: #eae8e7;
  --on-surface: #1b1c1c;
  --on-surface-variant: #564336;
  --outline: #ddc1b1;
  --outline-soft: rgba(221, 193, 177, 0.4);
  --ok: #006e1c;
  --ok-soft: rgba(0, 110, 28, 0.1);
  --warn: #9a6700;
  --warn-soft: rgba(154, 103, 0, 0.12);
  --danger: #ba1a1a;
  --danger-soft: rgba(186, 26, 26, 0.1);
  --info: #1b5e9a;
  --info-soft: rgba(27, 94, 154, 0.1);
  --sidebar-w: 248px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.14);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', 'Noto Sans TC', system-ui, sans-serif;
  background: var(--surface);
  color: var(--on-surface);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
  line-height: 1;
}

/* ---------- App layout ---------- */
.admin-app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.admin-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface-card);
  border-right: 1px solid var(--outline-soft);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  z-index: 60;
  transition: transform 0.25s ease;
  overflow-y: auto;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 18px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--outline-soft);
}
.admin-brand-logo {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.admin-brand-logo .material-symbols-outlined { font-size: 24px; }
.admin-brand-title { font-weight: 800; font-size: 1rem; letter-spacing: -0.3px; line-height: 1.1; }
.admin-brand-sub { font-size: 0.7rem; color: var(--on-surface-variant); margin-top: 2px; }

.admin-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; }
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.admin-nav-item:hover { background: var(--brand-softer); color: var(--brand); }
.admin-nav-item.active { background: var(--brand-soft); color: var(--brand); }
.admin-nav-item .material-symbols-outlined { font-size: 20px; flex-shrink: 0; }

.admin-sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--outline-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.8rem;
}
.admin-user-chip .au-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  flex-shrink: 0;
  overflow: hidden;
}
.admin-user-chip .au-avatar img { width: 100%; height: 100%; object-fit: cover; }
.admin-user-chip .au-name { font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-user-chip .au-role { font-size: 0.68rem; color: var(--on-surface-variant); }

.admin-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--outline-soft);
  background: none;
  color: var(--on-surface-variant);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.admin-logout-btn:hover { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* ---------- Main ---------- */
.admin-main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: rgba(246, 243, 242, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--outline-soft);
}
.admin-burger {
  display: none;
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  color: var(--on-surface-variant);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.admin-burger:hover { background: var(--brand-softer); color: var(--brand); }
.admin-topbar-title { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.3px; }
.admin-topbar-spacer { flex: 1; }
.admin-topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--on-surface-variant);
}
.admin-topbar-link:hover { background: var(--brand-softer); color: var(--brand); }

#admin-view { padding: 24px 20px 64px; max-width: 1180px; width: 100%; }

/* ---------- View header ---------- */
.view-head { margin-bottom: 22px; }
.view-head h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.6px; }
.view-head p { color: var(--on-surface-variant); font-size: 0.88rem; margin-top: 4px; }

/* ---------- Cards / stat grid ---------- */
.card {
  background: var(--surface-card);
  border: 1px solid var(--outline-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}
.card + .card { margin-top: 16px; }
.card-title { font-weight: 800; font-size: 1rem; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-title .material-symbols-outlined { color: var(--brand); font-size: 20px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--outline-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
}
.stat-card .sc-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--on-surface-variant);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-card .sc-label .material-symbols-outlined { font-size: 16px; color: var(--brand); }
.stat-card .sc-value { font-size: 1.8rem; font-weight: 800; color: var(--brand); margin-top: 8px; letter-spacing: -1px; }
.stat-card .sc-sub { font-size: 0.74rem; color: var(--on-surface-variant); margin-top: 2px; }

/* ---------- Dashboard top-games list ---------- */
.dash-tg-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--outline-soft);
}
.dash-tg-row:last-child { border-bottom: 0; }
.dash-tg-rank {
  flex: 0 0 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
}
.dash-tg-name { flex: 1 1 auto; font-weight: 700; }
.dash-tg-count { flex: 0 0 auto; color: var(--on-surface-variant); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Toolbar (search etc.) ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
}
.search-box .material-symbols-outlined {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--on-surface-variant);
  font-size: 20px;
  pointer-events: none;
}
.search-box input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--outline);
  background: var(--surface-card);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--on-surface);
}
.search-box input:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--outline);
  background: var(--surface-card);
  color: var(--on-surface);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-dim); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn .material-symbols-outlined { font-size: 18px; }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dim); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { filter: brightness(1.08); }
.btn-ghost { background: none; border-color: transparent; }
.btn-ghost:hover { background: var(--brand-softer); color: var(--brand); }
.btn-sm { padding: 6px 11px; font-size: 0.78rem; }

/* ---------- Table (desktop) → card stack (mobile) ---------- */
.table-wrap {
  background: var(--surface-card);
  border: 1px solid var(--outline-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.data-table thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--on-surface-variant);
  font-weight: 800;
  background: var(--surface);
  border-bottom: 1px solid var(--outline-soft);
  white-space: nowrap;
}
table.data-table tbody td { padding: 13px 16px; border-bottom: 1px solid var(--outline-soft); vertical-align: middle; }
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr { transition: background 0.12s; }
table.data-table tbody tr:hover { background: var(--brand-softer); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cell-label { display: none; }   /* shown only in mobile card mode */

.member-id-cell { font-family: ui-monospace, monospace; font-size: 0.78rem; color: var(--on-surface-variant); }
.member-name-cell { display: flex; align-items: center; gap: 10px; }
.mnc-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  flex-shrink: 0;
  overflow: hidden;
}
.mnc-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Badges / pills ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.2px;
}
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-neutral { background: var(--surface-dim); color: var(--on-surface-variant); }
.pill-brand { background: var(--brand-soft); color: var(--brand); }
.pill-info { background: var(--info-soft); color: var(--info); }

/* ---------- 通用分類篩選列（seg-tabs，遊戲管理等模組共用） ---------- */
.seg-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 4px 0 18px;
  border-bottom: 1px solid var(--outline-soft);
  padding-bottom: 2px;
}
.seg-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: none;
  background: none;
  color: var(--on-surface-variant);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  font-family: inherit;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border-bottom: 2px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.seg-tab:hover { background: var(--brand-softer); color: var(--brand); }
.seg-tab.active { color: var(--brand); border-bottom-color: var(--brand); background: var(--brand-soft); }
.seg-tab .material-symbols-outlined { font-size: 18px; }
.seg-count {
  font-size: 0.72rem;
  font-weight: 800;
  background: var(--surface-dim);
  color: var(--on-surface-variant);
  border-radius: 9999px;
  padding: 1px 7px;
  min-width: 18px;
  text-align: center;
}
.seg-tab.active .seg-count { background: var(--brand-soft); color: var(--brand); }

/* ---------- Empty / loading / error states ---------- */
.state-block {
  padding: 48px 24px;
  text-align: center;
  color: var(--on-surface-variant);
}
.state-block .material-symbols-outlined { font-size: 44px; opacity: 0.55; display: block; margin: 0 auto 10px; }
.state-block .sb-title { font-weight: 800; font-size: 0.95rem; color: var(--on-surface); }
.state-block .sb-sub { font-size: 0.82rem; margin-top: 4px; }
.spin { animation: admin-spin 1s linear infinite; }
@keyframes admin-spin { to { transform: rotate(360deg); } }

/* ---------- Pagination ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--outline-soft);
  flex-wrap: wrap;
}
.pager-info { font-size: 0.8rem; color: var(--on-surface-variant); }
.pager-btns { display: flex; gap: 8px; }

/* ---------- Toggle switch (games) ---------- */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0;
  background: var(--surface-dim);
  border-radius: 9999px;
  transition: background 0.2s;
  cursor: pointer;
}
.switch .track::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::before { transform: translateX(20px); }
.switch input:disabled + .track { opacity: 0.5; cursor: not-allowed; }

/* ---------- Modal ---------- */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.admin-modal-overlay.open { display: flex; }
.admin-modal {
  background: var(--surface-card);
  border-radius: 18px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  -webkit-overflow-scrolling: touch;
}
.admin-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--outline-soft);
  position: sticky;
  top: 0;
  background: var(--surface-card);
}
.admin-modal-head h3 { font-size: 1.05rem; font-weight: 800; }
.admin-modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--surface);
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--on-surface-variant);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.admin-modal-close:hover { background: var(--surface-dim); }
.admin-modal-body { padding: 20px; }
.admin-modal-foot {
  padding: 16px 20px;
  border-top: 1px solid var(--outline-soft);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ---------- Form fields (in modals) ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.78rem; font-weight: 700; color: var(--on-surface-variant); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--outline);
  background: var(--surface-card);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--on-surface);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1; }

.detail-grid { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 0.86rem; }
.detail-grid dt { color: var(--on-surface-variant); font-weight: 700; }
.detail-grid dd { word-break: break-word; }

/* ---------- Toast ---------- */
.admin-toast-wrap {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.admin-toast {
  pointer-events: auto;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 0.86rem;
  font-weight: 700;
  color: #fff;
  background: #333;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: admin-toast-in 0.2s ease;
}
.admin-toast .material-symbols-outlined { font-size: 18px; }
.admin-toast.success { background: var(--ok); }
.admin-toast.error { background: var(--danger); }
.admin-toast.info { background: var(--brand); }
@keyframes admin-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Drawer scrim (mobile) ---------- */
.admin-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 50;
}
.admin-scrim.open { display: block; }

/* ============================================================
   ZFX 機台子 tab 列（zfx 模組）
   ============================================================ */
.zfx-subtabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--outline-soft);
  padding-bottom: 2px;
}
.zfx-subtab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: none;
  background: none;
  color: var(--on-surface-variant);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  font-family: inherit;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border-bottom: 2px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.zfx-subtab:hover { background: var(--brand-softer); color: var(--brand); }
.zfx-subtab.active { color: var(--brand); border-bottom-color: var(--brand); background: var(--brand-soft); }
.zfx-subtab .material-symbols-outlined { font-size: 18px; }

/* checkbox 行（emu 設定） */
.zfx-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  font-size: 0.88rem;
  color: var(--on-surface);
  cursor: pointer;
}
.zfx-check input[type="checkbox"] { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--brand); cursor: pointer; }

/* P1/P2 按鍵雙欄 */
.zfx-keys-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.zfx-key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--outline-soft);
  font-size: 0.85rem;
}
.zfx-key-row:last-child { border-bottom: none; }
.zfx-key-btn {
  flex: 0 0 150px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--outline);
  background: var(--surface);
  color: var(--on-surface);
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}
.zfx-key-btn:hover { border-color: var(--brand); }
.zfx-key-btn.capturing { background: var(--brand); color: #fff; border-color: var(--brand); animation: admin-pulse 1s ease-in-out infinite; }
@keyframes admin-pulse { 50% { opacity: 0.55; } }

/* ============================================================
   系統維護 — 用量進度條（system 模組）
   ============================================================ */
.sys-bar {
  width: 100%;
  height: 14px;
  background: var(--surface-dim);
  border: 1px solid var(--outline-soft);
  border-radius: 7px;
  overflow: hidden;
}
.sys-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #4ade80, #fbbf24, #ef4444);
  transition: width 0.4s;
}

/* ============================================================
   RWD — 表格轉卡片堆疊、側欄轉抽屜
   ============================================================ */
@media (max-width: 1024px) {
  .admin-sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-burger { display: inline-flex; }
}

@media (max-width: 720px) {
  #admin-view { padding: 18px 14px 64px; }
  .view-head h1 { font-size: 1.35rem; }

  /* 表格 → 卡片堆疊 */
  table.data-table thead { display: none; }
  table.data-table, table.data-table tbody, table.data-table tr, table.data-table td { display: block; width: 100%; }
  table.data-table tr {
    background: var(--surface-card);
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 6px 4px;
    margin-bottom: 12px;
  }
  table.data-table tbody tr:hover { background: var(--surface-card); }
  .table-wrap { background: none; border: none; box-shadow: none; overflow: visible; }
  table.data-table td {
    border-bottom: 1px solid var(--outline-soft);
    padding: 9px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    text-align: right;
  }
  table.data-table tr td:last-child { border-bottom: none; }
  .cell-label {
    display: inline-block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--on-surface-variant);
    font-weight: 800;
    text-align: left;
    flex-shrink: 0;
  }
  .row-actions { justify-content: flex-end; }
  .member-name-cell { justify-content: flex-end; }
  .field-row { flex-direction: column; gap: 0; }

  /* ZFX 按鍵雙欄 → 單欄 */
  .zfx-keys-grid { grid-template-columns: 1fr; }
  .zfx-subtabs { overflow-x: auto; flex-wrap: nowrap; }
  .seg-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 380px) {
  .admin-modal-foot { flex-direction: column-reverse; }
  .admin-modal-foot .btn { width: 100%; }
}

/* ============================================================
   儀表板趨勢圖表（dashboard）
   ============================================================ */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.chart-card { margin-top: 0 !important; }
.card-sub { font-weight: 500; font-size: 0.74rem; color: var(--on-surface-variant); margin-left: auto; }
.chart-box { min-height: 120px; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-axis { stroke: var(--outline-soft); stroke-width: 1; }
.chart-vlabel { fill: var(--on-surface-variant); font-size: 12px; font-weight: 700; font-family: inherit; }
.chart-xlabel { fill: var(--on-surface-variant); font-size: 12px; font-family: inherit; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.cl-item { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 700; color: var(--on-surface-variant); }
.cl-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* 水平長條（熱門遊戲） */
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar-row { display: flex; align-items: center; gap: 10px; }
.hbar-rank {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 7px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 0.74rem; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}
.hbar-label { flex: 0 0 30%; max-width: 30%; font-weight: 700; font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { flex: 1 1 auto; height: 10px; background: var(--surface-dim); border-radius: 9999px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 9999px; min-width: 3px; transition: width 0.4s ease; }
.hbar-value { flex: 0 0 auto; font-weight: 700; font-size: 0.82rem; color: var(--on-surface-variant); font-variant-numeric: tabular-nums; }

/* ============================================================
   會員詳情強化（餘額 chip / 登入方式 / 遊玩歷程）
   ============================================================ */
.bal-chip {
  display: inline-block; padding: 2px 9px; border-radius: 9999px;
  font-size: 0.74rem; font-weight: 800; margin-right: 6px;
  font-variant-numeric: tabular-nums;
}
.bal-z { background: var(--brand-soft); color: var(--brand); }
.bal-lu { background: var(--info-soft); color: var(--info); }

.ph-section { margin-top: 18px; }
.ph-filter {
  margin-left: auto; font-size: 0.78rem; font-weight: 700; font-family: inherit;
  padding: 5px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--outline-soft); background: var(--surface-card); color: var(--on-surface);
  cursor: pointer;
}
.ph-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ph-stat-chip {
  font-size: 0.72rem; color: var(--on-surface-variant);
  background: var(--surface-dim); border-radius: 9999px; padding: 3px 10px;
}
.ph-stat-chip b { color: var(--on-surface); }
.ph-list { display: flex; flex-direction: column; }
.ph-row {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px;
  padding: 10px 2px; border-bottom: 1px solid var(--outline-soft);
}
.ph-row:last-child { border-bottom: 0; }
.ph-main { display: inline-flex; align-items: center; gap: 8px; }
.ph-game { font-weight: 700; font-size: 0.9rem; }
.ph-sub { font-size: 0.76rem; color: var(--on-surface-variant); grid-column: 1; }
.ph-time {
  grid-column: 2; grid-row: 1 / span 2; align-self: center;
  font-size: 0.76rem; color: var(--on-surface-variant); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ph-more-wrap { text-align: center; padding-top: 12px; }
.ph-more-wrap .sb-sub { font-size: 0.76rem; color: var(--on-surface-variant); }

@media (max-width: 720px) {
  .chart-grid { grid-template-columns: 1fr; }
}
