/* ==========================================================================
   M AUTO — 后台管理样式 v3 · Apple 风浅色版
   与前台 style.css v3 同一套设计变量：白 / 苹果灰 · 近黑文字 · 衬线标题
   胶囊按钮 · 毛玻璃导航 · 细边框卡片 · 金色点缀
   ========================================================================== */

:root {
  --bg: #f5f5f7;
  --panel: #ffffff;

  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #86868b;

  --line: #d2d2d7;
  --line-soft: rgba(0, 0, 0, .09);
  --line-soft-2: rgba(0, 0, 0, .055);

  --gold: #c9a227;
  --gold-2: #a9862c;
  --gold-3: #8a6f18;
  --gold-soft: rgba(201, 162, 39, .12);

  --ok: #1d7a46;  --ok-bg: #e6f4ec;
  --warn: #9a6214; --warn-bg: #fdf1e3;
  --bad: #b3403f;  --bad-bg: #fdeaea;
  --info: #2a6396; --info-bg: #eef5fc;

  --radius: 18px;
  --radius-sm: 12px;
  --pill: 980px;

  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 10px 30px rgba(0, 0, 0, .06);
  --shadow-lg: 0 30px 90px rgba(0, 0, 0, .22);

  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Segoe UI", "Helvetica Neue", "PingFang SC", "PingFang HK",
    "Microsoft YaHei", sans-serif;
  --font-serif: Georgia, "Times New Roman", "Songti SC", "STSong", "SimSun", serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .18); border-radius: 5px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, .3); }

::selection { background: rgba(201, 162, 39, .26); color: var(--ink); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ==========================================================================
   登录
   ========================================================================== */
.login-screen {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f5f5f7 62%, #eeeef0 100%);
}
.login-box {
  background: var(--panel);
  border: 1px solid var(--line-soft-2);
  border-radius: 22px;
  padding: 46px 38px 38px;
  width: 100%; max-width: 392px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-logo {
  width: 158px; height: auto; margin: 0 auto 26px;
  user-select: none; -webkit-user-drag: none;
}
.login-box h1 {
  font-family: var(--font-serif);
  font-size: 23px; margin: 0 0 7px; font-weight: 700;
  letter-spacing: -.2px;
}
.login-box > p {
  font-size: 11px; color: var(--ink-3); margin: 0 0 28px;
  letter-spacing: 2.4px; text-transform: uppercase; font-weight: 600;
}
.login-box .hint {
  font-size: 12px; color: var(--ink-3); margin-top: 18px;
  background: var(--bg);
  border: 1px solid var(--line-soft-2);
  border-radius: 12px; padding: 11px 14px;
}

/* ==========================================================================
   布局
   ========================================================================== */
.app { display: none; min-height: 100vh; }
.app.on { display: block; }

/* 顶栏 —— 毛玻璃 */
.adminbar {
  background: rgba(255, 255, 255, .76);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: var(--ink);
  padding: 0 26px; height: 60px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 60;
  border-bottom: 1px solid var(--line-soft-2);
}
.adminbar .logo { display: flex; align-items: center; gap: 11px; min-width: 0; }
.adminbar .logo-mark {
  height: 30px; width: auto; flex-shrink: 0;
  display: flex; align-items: center;
}
.adminbar .logo-mark img { height: 100%; width: auto; display: block; }
.adminbar .logo .logo-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.adminbar .logo strong {
  font-family: var(--font-serif);
  font-size: 16px; font-weight: 700; letter-spacing: .6px; color: var(--ink);
}
.adminbar .logo small {
  font-size: 9px; color: var(--ink-3); letter-spacing: 2.2px;
  text-transform: uppercase; font-weight: 600;
}
.adminbar .spacer { flex: 1; }

/* 标签栏 —— iOS 分段控件 */
.tabs-bar {
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--line-soft-2);
  padding: 11px 26px;
  display: flex; gap: 6px; overflow-x: auto;
  position: sticky; top: 60px; z-index: 50;
}
.tabs-bar::-webkit-scrollbar { height: 0; }
.tabs-bar button {
  background: transparent; border: 0;
  color: var(--ink-2); padding: 8px 17px; cursor: pointer;
  font-weight: 600; font-size: 13.5px; white-space: nowrap;
  border-radius: var(--pill);
  transition: background .24s var(--ease), color .24s var(--ease);
}
.tabs-bar button:hover { background: rgba(0, 0, 0, .05); color: var(--ink); }
.tabs-bar button.on { background: var(--ink); color: #fff; }
.tabs-bar button.on:hover { background: #000; }

.content { max-width: 1280px; margin: 0 auto; padding: 30px 26px 80px; }
.pane { display: none; }
.pane.on { display: block; animation: paneIn .4s var(--ease-out); }
@keyframes paneIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   通用组件
   ========================================================================== */
.pane-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.pane-head h2 {
  font-family: var(--font-serif);
  font-size: 24px; margin: 0; font-weight: 700; letter-spacing: -.3px;
}
.pane-head .spacer { flex: 1; }
.pane-head .total { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.pane-head .total b { color: var(--ink); font-size: 14px; font-weight: 700; }

/* 按钮 —— 胶囊 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 20px; border-radius: var(--pill); border: 1px solid transparent;
  font-weight: 600; font-size: 13.5px; cursor: pointer;
  transition: all .24s var(--ease); white-space: nowrap;
}
.btn-gold { background: var(--ink); color: #fff; }
.btn-gold:hover { background: #000; transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0, 0, 0, .16); }
.btn-line { background: var(--panel); border-color: var(--line); color: var(--ink); }
.btn-line:hover { border-color: var(--ink); }
.btn-danger { background: transparent; color: var(--bad); border-color: rgba(179, 64, 63, .32); }
.btn-danger:hover { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-sm { padding: 6px 14px; font-size: 12.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }

/* 卡片 */
.card {
  background: var(--panel);
  border: 1px solid var(--line-soft-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden; margin-bottom: 20px;
}
.card-head {
  padding: 17px 22px; border-bottom: 1px solid var(--line-soft-2);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-head h3 { font-size: 15px; margin: 0; font-weight: 600; letter-spacing: -.1px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 22px; }

/* 表格 */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 860px; }
table.tbl th {
  text-align: left; font-size: 11px; font-weight: 600;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: .9px;
  padding: 13px 16px;
  background: transparent;
  border-bottom: 1px solid var(--line-soft); white-space: nowrap;
}
table.tbl td {
  padding: 14px 16px; border-bottom: 1px solid var(--line-soft-2);
  font-size: 13.5px; vertical-align: middle;
}
table.tbl tr:hover td { background: #fafafa; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl .num { font-variant-numeric: tabular-nums; font-weight: 600; letter-spacing: -.1px; }
table.tbl .muted { color: var(--ink-3); font-size: 12.5px; font-weight: 400; }

.thumb {
  width: 56px; height: 42px; border-radius: 10px; object-fit: cover;
  background: var(--bg); border: 1px solid var(--line-soft-2);
}
.thumb-ph {
  width: 56px; height: 42px; border-radius: 10px;
  background: var(--gold-soft);
  border: 1px solid rgba(201, 162, 39, .22);
  display: grid; place-items: center; color: var(--gold-3);
  font-weight: 700; font-size: 15px;
}

.row-actions { display: flex; gap: 6px; white-space: nowrap; }

/* 徽标 —— 胶囊 */
.badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 3px 11px; border-radius: var(--pill); letter-spacing: .2px;
}
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-gold { background: var(--gold-soft); color: var(--gold-3); }
.badge-gray { background: rgba(0, 0, 0, .055); color: var(--ink-2); }

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field label .req { color: var(--bad); }
.field .tip { font-size: 11.5px; color: var(--ink-3); }

.input, .select, .textarea {
  background: var(--panel); border: 1px solid var(--line);
  color: var(--ink); padding: 11px 14px; border-radius: var(--radius-sm);
  outline: none; transition: border-color .2s var(--ease), box-shadow .24s var(--ease);
  width: 100%;
}
.input::placeholder, .textarea::placeholder { color: #b0b0b5; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, .05);
}
.textarea { resize: vertical; min-height: 88px; line-height: 1.65; }
.select { cursor: pointer; }

.switch-row { display: flex; align-items: center; gap: 9px; padding-top: 24px; }
.switch-row input { width: 17px; height: 17px; accent-color: var(--gold-2); cursor: pointer; }
.switch-row label { font-size: 13.5px; font-weight: 500; cursor: pointer; }

/* 图片上传 */
.uploader { display: flex; gap: 15px; align-items: flex-start; }
.uploader-preview {
  width: 140px; height: 105px; border-radius: var(--radius-sm);
  border: 1.5px dashed var(--line); background: var(--bg);
  display: grid; place-items: center; overflow: hidden;
  flex-shrink: 0; color: var(--ink-3); font-size: 12px; text-align: center;
}
.uploader-preview img { width: 100%; height: 100%; object-fit: cover; }
.uploader-actions { display: flex; flex-direction: column; gap: 9px; padding-top: 3px; }
.uploader-actions .tip { font-size: 11.5px; color: var(--ink-3); }

.qr-uploader-preview {
  width: 124px; height: 124px; border-radius: var(--radius-sm);
  border: 1.5px dashed var(--line); background: var(--bg);
  display: grid; place-items: center; overflow: hidden;
  flex-shrink: 0; color: var(--ink-3); font-size: 11.5px; text-align: center; padding: 6px;
}
.qr-uploader-preview img { width: 100%; height: 100%; object-fit: contain; }

/* 弹窗 */
.mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, .42);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center; padding: 22px;
  opacity: 0; visibility: hidden; transition: opacity .28s var(--ease), visibility .28s;
  overflow-y: auto;
}
.mask.on { opacity: 1; visibility: visible; }
.dialog {
  background: var(--panel); border-radius: 20px;
  width: 100%; max-width: 660px;
  box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(.985);
  transition: transform .34s var(--ease-out);
  margin: auto; overflow: hidden;
}
.mask.on .dialog { transform: translateY(0) scale(1); }
.dialog-head {
  padding: 20px 24px; border-bottom: 1px solid var(--line-soft-2);
  display: flex; align-items: center;
}
.dialog-head h3 { font-family: var(--font-serif); font-size: 18px; margin: 0; font-weight: 700; }
.dialog-head .x {
  margin-left: auto; width: 32px; height: 32px; border-radius: 50%;
  background: rgba(0, 0, 0, .055); border: 0; color: var(--ink-2);
  cursor: pointer; font-size: 14px; display: grid; place-items: center;
  transition: all .24s var(--ease);
}
.dialog-head .x:hover { background: var(--ink); color: #fff; }
.dialog-body { padding: 24px; max-height: 72vh; overflow-y: auto; }
.dialog-foot {
  padding: 17px 24px; border-top: 1px solid var(--line-soft-2);
  display: flex; gap: 9px; justify-content: flex-end;
}

/* 提示条 */
.alert {
  padding: 13px 16px; border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.7; margin-bottom: 18px;
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid transparent;
}
.alert-info { background: var(--info-bg); color: var(--info); border-color: rgba(42, 99, 150, .14); }
.alert-warn { background: var(--warn-bg); color: var(--warn); border-color: rgba(154, 98, 20, .16); }
.alert::before { flex-shrink: 0; font-weight: 700; }
.alert-info::before { content: 'ℹ'; }
.alert-warn::before { content: '⚠'; }

/* 空态 */
.empty-state { text-align: center; padding: 56px 20px; color: var(--ink-3); }
.empty-state .ico { font-size: 34px; opacity: .38; margin-bottom: 12px; }
.empty-state p { margin: 0 0 16px; font-size: 13.5px; }

/* Toast —— Apple 通知风 */
.toast-wrap {
  position: fixed; right: 24px; bottom: 24px; z-index: 500;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: var(--ink); padding: 13px 20px;
  border-radius: 14px; font-size: 13.5px; font-weight: 500;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .18), 0 0 0 1px var(--line-soft-2);
  animation: tin .32s var(--ease-out);
  border-left: 3px solid var(--gold);
}
.toast.ok { border-left-color: var(--ok); }
.toast.bad { border-left-color: var(--bad); }
@keyframes tin { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }

/* 概览小卡 */
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 16px; margin-bottom: 24px; }
.mini-stat {
  background: var(--panel); border: 1px solid var(--line-soft-2);
  border-radius: var(--radius); padding: 20px 22px;
  box-shadow: var(--shadow); transition: all .28s var(--ease);
}
.mini-stat:hover { transform: translateY(-3px); box-shadow: 0 18px 46px rgba(0, 0, 0, .10); }
.mini-stat b {
  display: block; font-size: 30px; font-weight: 700; line-height: 1.15;
  letter-spacing: -.9px; color: var(--ink);
}
.mini-stat span { font-size: 12.5px; color: var(--ink-3); letter-spacing: .2px; }

/* 响应式 */
@media (max-width: 760px) {
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 22px 16px 60px; }
  .adminbar { padding: 0 16px; gap: 10px; }
  .tabs-bar { padding: 10px 16px; }
  .dialog-body { padding: 20px; }
  .uploader { flex-direction: column; }
  .pane-head { gap: 8px; }
  .pane-head h2 { font-size: 21px; }
  .adminbar .logo .logo-txt { display: none; }
}
