/* ============================================================
   基础 & 手机端扫码查询页（/?sn=xxx）
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --brand: #1f6feb;
  --brand-dark: #174ea6;
  --text: #1f2328;
  --muted: #6b7280;
  --border: #e5e7eb;
  --ok: #16a34a;
  --err: #dc2626;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(20, 40, 80, .08);
}
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
.hidden { display: none !important; }
.center { text-align: center; }

/* ===== 扫码查询页 ===== */
.app-scan { max-width: 520px; margin: 0 auto; padding: 24px 16px; display: flex; flex-direction: column; min-height: 100vh; }
.site-header { text-align: center; padding: 28px 0 20px; }
.brand { font-size: 22px; font-weight: 700; }
.brand-sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
.main-panel { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 24px; }
.tip { color: var(--muted); }
.tip.sub { margin-top: 6px; font-size: 13px; }
.tip.error { color: var(--err); font-weight: 600; font-size: 18px; }
.scan-ico { color: #c9d4ea; display: flex; justify-content: center; margin-bottom: 14px; }
.qr-tip { color: #667799; font-size: 17px; font-weight: 600; text-align: center; }

/* 密码弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: var(--radius); padding: 26px 24px; width: 100%; max-width: 340px; box-shadow: var(--shadow); text-align: center; }
.modal h2 { font-size: 18px; margin-bottom: 8px; }
.modal p { color: var(--muted); font-size: 13px; }
#pw-input { width: 100%; margin-top: 16px; font-size: 26px; letter-spacing: 10px; text-align: center; padding: 10px; border: 2px solid var(--border); border-radius: 10px; outline: none; }
#pw-input:focus { border-color: var(--brand); }
.pw-error { color: var(--err) !important; margin-top: 10px; font-size: 13px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }

/* 结果卡 */
.result-head { margin-bottom: 14px; }
.pill { display: inline-block; padding: 4px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.pill.ok { background: #e7f6ec; color: var(--ok); }
.record-card { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; text-align: left; }
.record-row { display: flex; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.record-row:last-child { border-bottom: none; }
.record-row .label { color: var(--muted); }
.record-row .value { font-weight: 600; }
.site-footer { text-align: center; color: #9ca3af; font-size: 12px; padding: 20px 0 8px; }

/* ============================================================
   后台管理页（/admin）—— 普通中性色背景 · 马卡龙色点缀菜单/按钮/标题
   ============================================================ */
:root {
  --m-purple: #b39ddb;        /* 马卡龙紫（主色：菜单选中/主按钮/标题） */
  --m-purple-dark: #9f86c9;
  --m-purple-text: #7b5ea7;   /* 品牌名/标题文本 */
  --m-sidebar: #ffffff;       /* 侧边栏：普通白色 */
  --m-bg: #f5f6f8;            /* 内容区：常规后台浅灰 */
  --m-card: #ffffff;
  --m-line: #e9ebef;          /* 分隔线：中性灰 */
  --m-hover: #f3ecf7;         /* 菜单悬停：淡马卡龙紫 */
  --m-text: #1f2937;
  --m-muted: #8a94a6;
  --m-thead: #f2f4f7;         /* 表头：中性浅灰 */
  --m-ok-bg: #c8ecd4; --m-ok-text: #2f7d4f;
  --m-err-bg: #ffd9e0; --m-err-text: #c2446a;
  --m-mint: #8fd3c0;          /* 马卡龙薄荷绿（导出按钮） */
  --m-mint-dark: #76bda9;
  --m-shadow: 0 1px 4px rgba(15, 23, 42, .06);
}

/* ---- 通用控件（仅后台作用域，避免影响扫码页） ---- */
.admin-layout .btn, #login-view .btn { border: none; border-radius: 10px; font-size: 14px; cursor: pointer; padding: 10px 16px; }
.admin-layout .btn.primary, #login-view .btn.primary { background: var(--m-purple); color: #fff; }
.admin-layout .btn.primary:hover, #login-view .btn.primary:hover { background: var(--m-purple-dark); }
.admin-layout .btn.gray, #login-view .btn.gray { background: #f3ecf7; color: var(--m-text); }
.admin-layout .btn.gray:hover { background: #eadff2; }
.admin-layout .btn.mint { background: var(--m-mint); color: #fff; }
.admin-layout .btn.mint:hover { background: var(--m-mint-dark); }
.admin-layout .btn.danger { background: var(--m-err-bg); color: var(--m-err-text); }
.admin-layout .btn.danger:hover { background: #ffc9d4; }
.admin-layout .btn.sm, #login-view .btn.sm { padding: 6px 12px; font-size: 13px; }
.admin-layout .btn:disabled, #login-view .btn:disabled { opacity: .55; cursor: not-allowed; }

.admin-layout .field, #login-view .field { margin-bottom: 14px; }
.admin-layout .field label, #login-view .field label { display: block; font-size: 13px; color: var(--m-muted); margin-bottom: 6px; }
.admin-layout .field input, #login-view .field input,
.admin-layout .select {
  width: 100%; padding: 9px 12px; border: 1px solid #dfe3e8; border-radius: 8px;
  font-size: 14px; outline: none; background: #fff; color: var(--m-text);
}
.admin-layout .field input:focus, #login-view .field input:focus, .admin-layout .select:focus { border-color: var(--m-purple); }
.admin-layout .toolbar .field { margin-bottom: 0; min-width: 140px; }

.msg { font-size: 13px; padding: 6px 0; }
.admin-layout .msg.err, #login-view .msg.err { color: var(--m-err-text); }
.admin-layout .msg.ok, #login-view .msg.ok { color: var(--m-ok-text); }

/* ---- 登录页 ---- */
#login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--m-bg); }
.login-wrap { width: 360px; background: var(--m-card); padding: 34px 32px; border-radius: 16px; box-shadow: var(--m-shadow); }
.login-wrap h1 { font-size: 18px; text-align: center; margin-bottom: 22px; color: var(--m-purple-text); font-weight: 600; }
.login-logo { text-align: center; font-size: 24px; font-weight: 700; color: var(--m-purple-text); margin-bottom: 4px; }

/* ---- 整体布局：左菜单 + 右内容，铺满全屏 ---- */
.admin-layout { display: flex; width: 100vw; height: 100vh; overflow: hidden; background: var(--m-bg); }

/* 左侧菜单栏 */
.sidebar { width: 240px; flex: 0 0 240px; height: 100vh; background: var(--m-sidebar); display: flex; flex-direction: column; border-right: 1px solid var(--m-line); }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 22px 20px; border-bottom: 1px solid var(--m-line); }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--m-purple); box-shadow: 0 0 0 4px #e6dcf2; }
.brand-text b { font-size: 17px; color: var(--m-purple-text); display: block; line-height: 1.2; }
.brand-text span { font-size: 12px; color: var(--m-muted); }
.menu { flex: 1; padding: 14px 12px; display: flex; flex-direction: column; gap: 6px; }
.menu .tab {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 14px; border: none; background: transparent; border-radius: 10px;
  font-size: 14px; color: var(--m-text); cursor: pointer; text-align: left;
  transition: background .15s ease;
}
/* 彩色图标块（马卡龙色底 + 同色图标） */
.menu .tab .ico {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.ico-blue   { background: #eaf1ff; color: #5b8ff9; }
.ico-green  { background: #e6f8f0; color: #22b07d; }
.ico-orange { background: #fff1e6; color: #f5853c; }
.ico-purple { background: #f3ebff; color: #8854d0; }
.menu .tab:hover { background: var(--m-hover); }
.menu .tab.active { background: var(--m-purple); color: #fff; font-weight: 600; }
.menu .tab.active .ico { background: rgba(255,255,255,.22); color: #fff; }
.sidebar-footer { padding: 14px 20px; font-size: 12px; color: var(--m-muted); border-top: 1px solid var(--m-line); }

/* 右侧主区 */
.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar {
  height: 60px; flex: 0 0 60px; background: var(--m-card); border-bottom: 1px solid var(--m-line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
}
.page-title { font-size: 17px; font-weight: 600; color: var(--m-purple-text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user { font-size: 13px; color: var(--m-muted); }

.content { flex: 1; overflow: auto; padding: 24px; }
.panel { background: var(--m-card); border-radius: 12px; box-shadow: var(--m-shadow); padding: 20px; width: 100%; }

/* 查询工具栏 */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--m-line); text-align: left; }
.table th { background: var(--m-thead); color: var(--m-purple-text); font-weight: 600; white-space: nowrap; }
.table td { color: var(--m-text); }
.table tr:hover td { background: #f8f9fb; }

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

/* 徽标 */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; }
.badge.ok, .badge.on { background: var(--m-ok-bg); color: var(--m-ok-text); }
.badge.err, .badge.off { background: var(--m-err-bg); color: var(--m-err-text); }

/* 响应式：窄屏时侧栏收窄为图标条 */
@media (max-width: 768px) {
  .sidebar { width: 64px; flex-basis: 64px; }
  .brand-text, .menu .tab span, .sidebar-footer { display: none; }
  .menu .tab { justify-content: center; padding: 12px 0; }
  .content { padding: 14px; }
}