/* ============================================================
   管理后台 · 高端简约风格
   配色：#101012 深色侧栏 / #f5f5f7 页面底 / #1d1d1f 主文字
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --ink: #1d1d1f;
  --muted: #86868b;
  --line: #e8e8ed;
  --dark: #101012;
  --accent: #1d1d1f;
  --danger: #e5484d;
  --ok: #30a46c;
  --radius: 12px;
}

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { opacity: .75; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px; flex-shrink: 0;
  background: var(--dark); color: #f5f5f7;
  padding: 28px 16px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { font-size: 17px; font-weight: 700; letter-spacing: .5px; padding: 0 12px 26px; }
.sidebar .brand small { display: block; font-size: 11px; font-weight: 400; color: rgba(255,255,255,.45); margin-top: 4px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 9px;
  color: rgba(255,255,255,.72); font-size: 14px; margin-bottom: 2px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); opacity: 1; }
.sidebar nav a.active { background: rgba(255,255,255,.1); color: #fff; font-weight: 600; }
.sidebar nav a .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }

.main { flex: 1; min-width: 0; padding: 28px 36px 60px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.topbar h1 { font-size: 22px; font-weight: 700; letter-spacing: -.2px; }
.topbar .meta { color: var(--muted); font-size: 13px; }
.topbar .user { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  padding: 24px; margin-bottom: 20px;
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; }

/* ---------- 统计卡片 ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat {
  background: var(--card); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 26px; font-weight: 700; letter-spacing: -.5px; margin-top: 6px; }
.stat .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; cursor: pointer;
  padding: 8px 16px; border-radius: 8px;
  font-size: 13.5px; font-family: inherit;
  background: var(--accent); color: #fff;
  transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: #f7f7f9; }
.btn-danger { background: var(--danger); }
.btn-danger-ghost { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: 5px 12px; font-size: 12.5px; border-radius: 7px; }

/* ---------- 工具栏 / 筛选 ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }

.input, .select, .textarea {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; font-size: 13.5px; font-family: inherit;
  background: #fff; color: var(--ink); outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: #999; }
.input { width: 200px; }
.textarea { width: 100%; resize: vertical; line-height: 1.7; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 12px; border-bottom: 1px solid #f1f1f3; vertical-align: middle; font-size: 13.5px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafc; }
td .thumb {
  width: 44px; height: 44px; border-radius: 8px; object-fit: cover;
  background: #eee; display: block;
}
td .muted { color: var(--muted); font-size: 12.5px; }
td .title-cell { max-width: 260px; }
td .title-cell b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
}
.badge-on { background: #e8f6ee; color: var(--ok); }
.badge-off { background: #f2f2f4; color: var(--muted); }
.badge-wait { background: #fff2e0; color: #c4841d; }
.badge-done { background: #e8f6ee; color: var(--ok); }
.badge-refund { background: #fdecec; color: var(--danger); }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 10px; margin-top: 16px; justify-content: flex-end; color: var(--muted); font-size: 13px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16,16,18,.45);
  display: none; align-items: center; justify-content: center; z-index: 100;
}
.modal-mask.show { display: flex; }
.modal {
  width: 440px; max-width: calc(100vw - 40px);
  background: #fff; border-radius: 14px; padding: 26px;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
}
.modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.modal .desc { color: var(--muted); font-size: 12.5px; margin-bottom: 18px; }
.modal .form-row { margin-bottom: 14px; }
.modal .form-row label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.modal .select, .modal .input { width: 100%; }

/* ---------- 表单页 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.field .input, .field .select { width: 100%; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.radio-row { display: flex; gap: 20px; align-items: center; }
.radio-row label { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink); cursor: pointer; margin: 0; }
.radio-row input { accent-color: var(--accent); }

/* ---------- 登录页 ---------- */
.login-body { background: var(--dark); display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { width: 360px; }
.login-card .logo { text-align: center; font-size: 20px; font-weight: 700; color: #fff; letter-spacing: .5px; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: rgba(255,255,255,.5); font-size: 13px; margin-bottom: 28px; }
.login-box { background: #fff; border-radius: 16px; padding: 32px; }
.login-box .input { width: 100%; margin-bottom: 14px; padding: 11px 14px; }
.login-box .btn { width: 100%; padding: 11px; border-radius: 9px; font-size: 14px; }
.login-err { color: var(--danger); font-size: 13px; margin-bottom: 10px; min-height: 20px; text-align: center; }

/* ---------- toast ---------- */
#toast-box { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--dark); color: #fff; border-radius: 999px;
  padding: 9px 20px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  animation: toastIn .2s ease;
}
.toast.err { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .sidebar { width: 64px; }
  .sidebar .brand small, .sidebar nav a span, .sidebar .dot { display: none; }
  .sidebar nav a { justify-content: center; }
}
