/* ============================================================
   陪玩 · 后台端（管理端）样式
   配色变量定义，登录页 + 管理台共用
   ============================================================ */
:root {
  --sidebar-bg: #1d2330;
  --sidebar-text: #c8cfdb;
  --sidebar-active: #14181f;
  --content-bg: #f3f5f8;
  --panel: #ffffff;
  --border: #e2e7ef;
  --text: #1f2733;
  --muted: #6b7280;
  --accent: #2456d6;
  --accent-weak: #eef2fc;
  --danger: #d5484b;
  --success: #1f9d5d;
  --warning: #c57b1e;
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--content-bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; }

/* ================= 登录页 ================= */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #232a38 0%, #1d2330 55%, #2b3550 100%);
  padding: 20px;
}
.login-card {
  width: 380px;
  background: var(--panel);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  padding: 38px 36px 30px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.login-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 18px;
}
.login-title { font-size: 20px; font-weight: 700; color: var(--text); }
.login-sub { font-size: 12px; color: var(--muted); margin-bottom: 26px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text); margin-bottom: 6px; }
.input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(36, 86, 214, .12); }
.input::placeholder { color: #b0b7c2; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px;
  padding: 0 18px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s, background .15s;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  height: 42px;
  font-size: 15px;
  font-weight: 500;
}
.btn-primary:hover:not(:disabled) { background: #1b47b4; }

.btn-ghost { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-ghost:hover:not(:disabled) { background: var(--accent-weak); }
.btn-small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-danger { background: #fdf1f1; color: var(--danger); border-color: #f3caca; }
.btn-danger:hover:not(:disabled) { background: #f8e2e2; }

.login-err {
  min-height: 20px;
  font-size: 13px;
  color: var(--danger);
  margin-bottom: 8px;
}
.login-demo {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
}
.login-demo b { color: var(--text); font-weight: 600; }

/* ================= 管理台布局 ================= */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px;
  color: #fff;
}
.sidebar-logo {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}
.sidebar-logo img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.sidebar-brand-text { font-size: 15px; font-weight: 600; }
.sidebar-brand-sub { font-size: 11px; color: var(--sidebar-text); }

.sidebar-nav { flex: 1; padding: 6px 10px 16px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px;
  margin-bottom: 2px;
  border-radius: 7px;
  color: var(--sidebar-text);
  cursor: pointer;
  font-size: 14px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-ico {
  width: 16px; height: 16px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600;
}

.sidebar-foot {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: 12px;
  color: var(--sidebar-text);
}

/* 顶栏 */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 10;
}
.crumb { font-size: 15px; font-weight: 600; color: var(--text); }
.crumb-sub { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.admin-pill {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text);
}
.admin-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-weak); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.link-logout { font-size: 13px; color: var(--muted); cursor: pointer; }
.link-logout:hover { color: var(--danger); }

.content { padding: 22px 24px; flex: 1; }

/* ================= 卡片 / 统计 ================= */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.panel-title { font-size: 15px; font-weight: 600; }
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.stat-label { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-value.accent { color: var(--accent); }
.stat-value.green { color: var(--success); }
.stat-value.red { color: var(--danger); }

/* 数据看板：近 7 天趋势柱状 + 排行 */
.dash-trend { display: flex; align-items: flex-end; gap: 18px; padding: 16px 18px 20px; min-height: 200px; }
.dash-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 160px; }
.dash-bar-val { font-size: 12px; color: var(--muted); margin-bottom: 4px; white-space: nowrap; }
.dash-bar {
  width: 34px; max-width: 60%; border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-soft));
  min-height: 3px;
}
.dash-bar-day { font-size: 12px; color: var(--text); font-weight: 600; margin-top: 6px; }
.dash-bar-cnt { font-size: 12px; color: var(--muted); }

/* ================= 表格 ================= */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  flex-wrap: wrap;
}
.toolbar input.input { width: 220px; height: 34px; }
.toolbar select.input { width: 150px; height: 34px; }
.toolbar-grp { display: flex; align-items: center; gap: 10px; flex-shrink: 0; flex-wrap: nowrap; }
.table-wrap { overflow-x: auto; }
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.tbl th {
  text-align: left;
  padding: 11px 14px;
  background: #f7f9fc;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.tbl td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}
table.tbl tbody tr:hover { background: #fafbfd; }
table.tbl tbody tr:last-child td { border-bottom: none; }
.td-main { color: var(--text); font-weight: 500; }
.td-sub { color: var(--muted); font-size: 12px; }
.empty-row td { text-align: center; color: var(--muted); padding: 40px 0; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12px;
  line-height: 18px;
}
.badge-green { background: #e8f6ee; color: var(--success); }
.badge-blue { background: var(--accent-weak); color: var(--accent); }
.badge-red { background: #fdf0f0; color: var(--danger); }
.badge-gray { background: #f1f3f6; color: var(--muted); }
.badge-orange { background: #fdf3e7; color: var(--warning); }

.role-tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 12px;
  background: #eef1f6; color: #4b5563;
}
.role-tag.admin { background: #fdf0e6; color: var(--warning); }

.role-check {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border: 1px solid var(--border, #dde3ec);
  border-radius: 6px; background: #fff; cursor: pointer; font-size: 13px;
  user-select: none;
}
.role-check:has(input:checked) {
  border-color: var(--accent, #2f6fed); background: #eef4ff; color: var(--accent, #2f6fed);
}

.op { display: inline-flex; gap: 5px; }
.op-link { color: var(--accent); cursor: pointer; font-size: 13px; }
.op-link:hover { text-decoration: underline; }
.op-link.danger { color: var(--danger); }

/* ================= 配置 / 表单 ================= */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-row label { font-size: 13px; color: var(--text); }
.form-row .input { width: 100%; }
.form-inline { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.help { font-size: 12px; color: var(--muted); }
.config-box { padding: 22px; }
.section { margin-bottom: 22px; }
.section-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.section-desc { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

/* 店铺 Logo 预览 */
.logo-preview {
  width: 84px; height: 84px;
  border-radius: 10px;
  background: var(--accent-weak);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 24px; font-weight: 700;
  overflow: hidden; flex-shrink: 0;
}
.logo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* toast */
.toast {
  position: fixed; top: 66px; left: 50%; transform: translateX(-50%);
  z-index: 1000;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 3px solid var(--success);
  border-radius: 6px;
  padding: 11px 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .12);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(4px); }
.toast.err { border-left-color: var(--danger); }

/* 模态框 */
.modal-mask {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(20, 25, 40, .45);
  display: flex; align-items: flex-start; justify-content: center;
}
.modal-box {
  background: #fff; border-radius: 10px; margin: 8vh 0 40px;
  width: 520px; max-width: 94vw; box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 15px;
}
.modal-close { cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 20px; }

/* 列表头像 */
.tbl-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; vertical-align: middle; }

.spinner-note { text-align: center; color: var(--muted); padding: 40px 0; }

/* 商品套餐配置行 */
.plan-row {
  display: grid;
  grid-template-columns: 1fr 90px 130px 110px 34px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.plan-row .input { height: 34px; }

/* ================= 移动端：侧栏收纳为左上角抽屉 ================= */
.menu-btn {
  display: none;
  flex: none;
  width: 36px; height: 36px;
  margin-right: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 56px 0 0 0;
  background: rgba(15, 23, 42, .45);
  z-index: 25;
}

@media (max-width: 820px) {
  .menu-btn { display: flex; }
  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 78vw;
    max-width: 270px;
    height: 100vh;
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 4px 0 18px rgba(15, 23, 42, .16);
    z-index: 30;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .topbar { padding-left: 12px; }
}