/* ============================================================
   卡券队长 · 商用 UI 设计系统
   风格：活力色块 + 玻璃质感（E-commerce / Conversion）
   颜色：暖橙红主色 + 深墨文字 + 成功绿
   ============================================================ */

:root {
  /* 品牌色 */
  --brand-600: #c13508;
  --brand-500: #e8440f;
  --brand-400: #ff7a33;
  --brand-300: #ffb27a;
  --brand-100: #fff0e6;
  --brand-050: #fff7f0;
  --gold: #ffb020;

  /* 语义色 */
  --success: #0fa968;
  --success-bg: #e8f8f0;
  --danger: #e5484d;
  --danger-bg: #fdecec;
  --info: #2563eb;

  /* 文字 */
  --ink-900: #171a21;
  --ink-700: #2b313c;
  --ink-500: #5c6470;
  --ink-400: #8a93a2;
  --ink-300: #b4bac6;

  /* 表面 */
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --bg: #f5f6fa;
  --line: #e9ecf2;

  /* 阴影（统一层级） */
  --shadow-sm: 0 1px 3px rgba(23, 26, 33, 0.05), 0 1px 2px rgba(23, 26, 33, 0.04);
  --shadow-md: 0 4px 14px rgba(23, 26, 33, 0.07), 0 2px 6px rgba(23, 26, 33, 0.04);
  --shadow-lg: 0 16px 40px rgba(23, 26, 33, 0.14), 0 4px 12px rgba(23, 26, 33, 0.06);

  /* 圆角 */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-full: 999px;

  /* 动效 */
  --dur: 180ms;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);

  /* 结构 */
  --topbar-h: 56px;
  --page-w: 720px;
  --article-w: 677px;
  --z-base: 1;
  --z-sticky: 40;
  --z-modal: 100;
  --z-toast: 200;
}

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

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink-900);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }

img { max-width: 100%; }

a { -webkit-tap-highlight-color: transparent; }

button,
[role="button"],
a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

:focus-visible {
  outline: 3px solid rgba(255, 90, 31, 0.45);
  outline-offset: 2px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  border: 0;
  border-radius: var(--r-sm);
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    background var(--dur) var(--ease), opacity var(--dur) var(--ease);
  user-select: none;
}

.btn:active { transform: scale(0.96); }

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
  color: #fff;
  box-shadow: 0 6px 16px rgba(255, 90, 31, 0.28);
}

.btn-primary:hover { box-shadow: 0 8px 22px rgba(255, 90, 31, 0.34); }

.btn-ghost {
  background: var(--surface-2);
  color: var(--ink-700);
  border: 1px solid var(--line);
}

.btn-ghost:hover { background: #f0f2f8; }

.claim-btn {
  flex: 0 0 auto;
  min-height: 34px;
  border-radius: var(--r-full);
  padding: 7px 16px;
  font-size: 13px;
}

.claim-btn .icon { width: 14px; height: 14px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid rgba(233, 236, 242, 0.8);
}

.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }

.logo {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-400));
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(255, 90, 31, 0.3);
  flex: 0 0 auto;
}

.brand-name {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-link {
  flex: 0 0 auto;
  font-size: 13px;
  color: var(--ink-500);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: background var(--dur), color var(--dur);
}

.admin-link:hover { color: var(--ink-900); background: #eef0f6; }

.admin-top-actions { display: flex; align-items: center; gap: 8px; }

.link-btn { border: 0; cursor: pointer; }

/* ---------- 头部横幅 ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 34px 20px 30px;
  background:
    radial-gradient(120% 160% at 85% -20%, rgba(255, 176, 32, 0.55) 0%, rgba(255, 176, 32, 0) 45%),
    radial-gradient(120% 140% at 10% 120%, rgba(255, 90, 31, 0.45) 0%, rgba(255, 90, 31, 0) 55%),
    linear-gradient(135deg, #a92c06 0%, #c13508 34%, #e8440f 68%, #ff6a24 100%);
  color: #fff;
  text-align: center;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.22) 1px, transparent 1.5px);
  background-size: 22px 22px;
  pointer-events: none;
}

.hero > * { position: relative; z-index: 1; }

.hero h1 {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 3px 14px rgba(0, 0, 0, 0.16);
}

.hero p {
  margin-top: 8px;
  font-size: 13px;
  opacity: 0.94;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
}

.hero-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.hero-trust span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  opacity: 0.95;
}

.hero-trust .icon { width: 14px; height: 14px; }

.hero-compact { padding: 24px 20px 22px; }

.hero-compact h1 { font-size: 21px; }

/* ---------- 容器 ---------- */
.container {
  max-width: var(--page-w);
  margin: 0 auto;
  padding: 18px max(14px, env(safe-area-inset-right)) 48px max(14px, env(safe-area-inset-left));
}

.footer {
  padding: 26px 18px 38px;
  text-align: center;
  color: var(--ink-400);
  font-size: 12px;
  line-height: 1.8;
}

.footer .disclaimer {
  margin-top: 6px;
  color: var(--ink-300);
  font-size: 11px;
}

/* ---------- 首页：文章目录 ---------- */
.dir-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dir-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid rgba(233, 236, 242, 0.9);
  border-radius: var(--r-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.dir-card:hover { box-shadow: var(--shadow-md); }
.dir-card:active { transform: scale(0.98); }

.dir-cover {
  position: relative;
  flex: 0 0 auto;
  width: 82px;
  height: 82px;
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 -18px 24px rgba(0, 0, 0, 0.12);
}

.dir-cover .icon { width: 38px; height: 38px; color: #fff; filter: drop-shadow(0 2px 4px rgba(0,0,0,.18)); }

.dir-emoji { font-size: 36px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,.12)); }

.dir-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dir-cover.img-missing img { display: none; }

/* 分类封面渐变 */
.cover-waimai { background: linear-gradient(135deg, #ff5a1f, #ffb020); }
.cover-jiudian { background: linear-gradient(135deg, #7c3aed, #c084fc); }
.cover-chuxing { background: linear-gradient(135deg, #0ea5e9, #38bdf8); }
.cover-canyin { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.cover-bendi { background: linear-gradient(135deg, #10b981, #34d399); }
.cover-dianying { background: linear-gradient(135deg, #ef4444, #f87171); }
.cover-chongzhi { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.cover-kuaidi { background: linear-gradient(135deg, #64748b, #94a3b8); }
.cover-qita { background: linear-gradient(135deg, #e8440f, #f59e0b); }
.cover-custom { background: linear-gradient(135deg, #64748b, #94a3b8); }

.dir-info { flex: 1; min-width: 0; }

.dir-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dir-desc {
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--ink-400);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dir-meta {
  margin-top: 9px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dir-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--brand-600);
  background: var(--brand-100);
  border-radius: var(--r-full);
  padding: 3px 10px;
}

.dir-count .icon { width: 12px; height: 12px; }

.dir-hot {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  color: #b45309;
  background: #fef3c7;
  border-radius: var(--r-full);
  padding: 3px 9px;
  font-weight: 600;
}

.dir-arrow {
  flex: 0 0 auto;
  color: var(--ink-300);
  transition: transform var(--dur) var(--ease);
}

.dir-arrow .icon { width: 20px; height: 20px; display: block; }

.dir-card:hover .dir-arrow { transform: translateX(3px); }

/* ---------- 文章页 ---------- */
.article-page { background: #fff; }

.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-right: 2px;
  border-radius: 50%;
  color: var(--ink-900);
  text-decoration: none;
  transition: background var(--dur);
}

.back-btn:hover { background: var(--surface-2); }

.back-btn .icon { width: 22px; height: 22px; }

.wx-article {
  max-width: var(--article-w);
  margin: 0 auto;
  padding: 26px max(18px, env(safe-area-inset-right)) 20px max(18px, env(safe-area-inset-left));
  font-size: 15px;
  color: var(--ink-700);
  line-height: 1.75;
}

.art-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink-900);
  line-height: 1.42;
  letter-spacing: 0.005em;
}

.art-meta {
  margin-top: 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-400);
}

.art-meta .dot { color: var(--ink-300); }

.art-divider {
  height: 1px;
  background: var(--line);
  margin: 18px 0 8px;
}

.art-tip {
  margin: 12px 0;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: #fff8e6;
  border: 1px solid #fdeecb;
  color: #92600a;
  font-size: 12.5px;
}

.art-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--brand-600);
  margin: 28px 0 10px;
  line-height: 1.4;
}

.art-section-title::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--brand-500), var(--brand-400));
}

.art-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px;
  margin: 11px 0;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

.art-row:hover { box-shadow: var(--shadow-md); border-color: #e2d8cf; }
.art-row:active { transform: scale(0.985); }

.art-icon {
  position: relative;
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.art-icon .icon { width: 24px; height: 24px; color: var(--ink-300); }

.art-icon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.art-icon.img-missing img { display: none; }

.art-text { flex: 1; min-width: 0; }

.art-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-900);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.art-desc {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--ink-400);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.art-date {
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--ink-300);
  font-variant-numeric: tabular-nums;
}

.art-more {
  margin-top: 38px;
  padding: 18px 0 6px;
  border-top: 6px solid var(--surface-2);
  border-radius: var(--r-md);
}

.art-more h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-900);
  margin-bottom: 4px;
}

.more-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px;
  color: var(--ink-700);
  font-size: 14px;
  text-decoration: none;
  border-bottom: 1px solid var(--surface-2);
  transition: color var(--dur);
}

.more-link:hover { color: var(--brand-600); }

.more-link .icon { width: 16px; height: 16px; color: var(--ink-300); }

/* 回到顶部 */
.back-top {
  position: fixed;
  right: 18px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: var(--z-sticky);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  color: var(--ink-700);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity var(--dur), transform var(--dur);
  opacity: 0;
  pointer-events: none;
}

.back-top.show { opacity: 1; pointer-events: auto; }

.back-top:active { transform: scale(0.94); }

.back-top .icon { width: 20px; height: 20px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(15, 18, 25, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade-in var(--dur) var(--ease);
}

.modal {
  width: 100%;
  max-width: 330px;
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: modal-in 220ms var(--ease);
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 15px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 20px;
  line-height: 1;
  color: var(--ink-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur);
}

.modal-close:hover { background: #eef0f6; }

.modal-body { padding: 20px 18px 22px; text-align: center; }

.modal-qr {
  width: 190px;
  height: 190px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.modal-tip { margin-top: 13px; font-size: 13px; color: var(--ink-500); }

.modal-actions {
  margin-top: 15px;
  display: flex;
  gap: 9px;
  justify-content: center;
}

.modal-actions .btn { flex: 1; min-height: 40px; }

.modal-hint {
  margin-top: 11px;
  font-size: 11.5px;
  color: var(--ink-400);
  word-break: break-all;
  white-space: pre-line;
}

.jump-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.jump-card { text-align: center; color: var(--ink-500); font-size: 14px; }

.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 12px;
  border: 3px solid #ffe1d0;
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 打开方式选择（底部弹层） ---------- */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(15, 18, 25, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in var(--dur) var(--ease);
}

.sheet {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 20px 20px calc(18px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  animation: sheet-in 240ms var(--ease);
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.sheet-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-900);
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}

.sheet-actions { display: flex; flex-direction: column; gap: 10px; }

.sheet-btn {
  width: 100%;
  min-height: 48px;
  font-size: 15px;
}

.sheet-btn .icon { width: 18px; height: 18px; }

.sheet-cancel {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink-500);
  font-size: 14px;
  cursor: pointer;
  transition: background var(--dur);
}

.sheet-cancel:hover { background: #eef0f6; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(40px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: var(--z-toast);
  max-width: 86vw;
  padding: 11px 20px;
  border-radius: var(--r-full);
  background: rgba(23, 26, 33, 0.92);
  color: #fff;
  font-size: 13px;
  text-align: center;
  box-shadow: var(--shadow-md);
  animation: toast-in 220ms var(--ease);
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- 加载 / 空态 ---------- */
.loading-list { display: flex; flex-direction: column; gap: 14px; }

.skeleton {
  height: 110px;
  border-radius: var(--r-lg);
  background: linear-gradient(90deg, #eef0f5 25%, #f7f8fb 40%, #eef0f5 65%);
  background-size: 300% 100%;
  animation: shimmer 1.3s ease infinite;
}

.skeleton-row {
  height: 78px;
  border-radius: var(--r-md);
  background: linear-gradient(90deg, #f0f1f6 25%, #f8f9fc 40%, #f0f1f6 65%);
  background-size: 300% 100%;
  animation: shimmer 1.3s ease infinite;
  margin: 11px 0;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

.empty {
  padding: 64px 24px;
  text-align: center;
  color: var(--ink-400);
  font-size: 14px;
}

.empty .icon { width: 44px; height: 44px; color: var(--ink-300); margin-bottom: 12px; }

.empty .retry {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-full);
  padding: 9px 18px;
  font-size: 13px;
  color: var(--ink-700);
  cursor: pointer;
  transition: background var(--dur);
}

.empty .retry:hover { background: var(--surface-2); }

/* ---------- 管理后台 ---------- */
.admin { max-width: 760px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 18px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.muted { color: var(--ink-400); font-size: 12.5px; margin-bottom: 12px; line-height: 1.6; }

.error-text { color: var(--danger); }

.field { display: block; margin-bottom: 14px; }

.field span {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--ink-700);
}

.input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0 13px;
  font-size: 14px;
  outline: none;
  background: #fff;
  color: var(--ink-900);
  transition: border-color var(--dur), box-shadow var(--dur);
  font-family: inherit;
}

.input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(255, 90, 31, 0.12);
}

.login-card { max-width: 400px; margin: 44px auto; }

.login-card .btn { width: 100%; margin-top: 12px; min-height: 46px; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

.badge {
  display: inline-flex;
  align-items: center;
  background: var(--brand-100);
  color: var(--brand-600);
  border-radius: var(--r-full);
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}

.table-wrap { overflow-x: auto; margin: 0 -4px; width: 100%; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 560px;
}

.table th, .table td {
  text-align: left;
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table th {
  color: var(--ink-400);
  font-weight: 500;
  white-space: nowrap;
  font-size: 12.5px;
}

.table td:first-child { min-width: 150px; }

.switch {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: var(--r-full);
  background: #d8dbe3;
  border: 0;
  cursor: pointer;
  transition: background var(--dur);
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: left var(--dur) var(--ease);
}

.switch.on { background: var(--success); }

.switch.on::after { left: 23px; }

.wx-group-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.wx-group-row:last-child { border-bottom: 0; }

.wx-group-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
}

.wx-group-row .btn { flex: 0 0 auto; min-height: 38px; padding: 8px 14px; font-size: 13px; }

/* ---------- 响应式 ---------- */
@media (min-width: 640px) {
  .container { padding-top: 24px; }
  .dir-card { padding: 18px; }
  .dir-cover { width: 92px; height: 92px; }
  .wx-article { padding-top: 34px; }
  .art-title { font-size: 24px; }
}

@media (min-width: 1024px) {
  .topbar { padding: 0 max(24px, env(safe-area-inset-right)) 0 max(24px, env(safe-area-inset-left)); }
  .container { padding-left: 24px; padding-right: 24px; }
}

/* ============================================================
   管理后台（商用数据密集型布局）
   ============================================================ */
.admin-body {
  background: #f1f4f9;
  min-height: 100vh;
}

.btn-block { width: 100%; }

/* 登录 */
.admin-login {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background:
    radial-gradient(90% 100% at 80% -10%, rgba(255, 122, 51, 0.18), transparent 60%),
    #f1f4f9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px 26px 24px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.login-logo .logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 22px;
}

.login-logo h1 { font-size: 18px; font-weight: 800; line-height: 1.3; }

.login-logo p { font-size: 12px; color: var(--ink-400); }

.login-hint { margin-top: 12px; text-align: center; }

/* 复制文章弹窗 */
.copy-modal { max-width: 620px; }

.copy-body { text-align: left; }

.copy-preview {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px;
  margin-bottom: 14px;
  background: #fff;
  font-size: 13px;
  line-height: 1.7;
}

.copy-preview img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.copy-preview h2 {
  font-size: 16px;
  color: var(--brand-600);
  border-left: 4px solid var(--brand-500);
  padding-left: 10px;
  margin: 16px 0 8px;
}

/* 整体框架 */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

/* 侧边栏 */
.admin-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: var(--z-sticky);
  width: 232px;
  background: #171a21;
  color: #aab2c0;
  display: flex;
  flex-direction: column;
  padding: 18px 12px 14px;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 12px;
}

.admin-brand .logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 17px;
}

.admin-brand-text { display: flex; flex-direction: column; min-width: 0; }

.admin-brand-text strong {
  font-size: 15px;
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
}

.admin-brand-text span { font-size: 11px; color: #7c8594; }

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: #aab2c0;
  text-decoration: none;
  font-size: 14px;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
  transition: background var(--dur), color var(--dur);
  font-family: inherit;
}

.nav-item .icon { width: 18px; height: 18px; flex: 0 0 auto; }

.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #e8ebf1; }

.nav-item.active {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 90, 31, 0.28);
}

.admin-sidebar-foot {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* 主区域 */
.admin-main {
  flex: 1;
  margin-left: 232px;
  min-width: 0;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.admin-topbar h1 { font-size: 18px; font-weight: 800; }

.admin-topbar-right { display: flex; align-items: center; gap: 12px; }

.admin-user { font-size: 13px; color: var(--ink-500); }

.source-badge {
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--r-full);
  padding: 4px 12px;
}

.source-badge.ok { color: #0d8a57; background: var(--success-bg); }

.source-badge.demo { color: #b45309; background: #fef3c7; }

.admin-content {
  padding: 22px 24px 48px;
  max-width: 1280px;
}

.admin-view { animation: fade-in var(--dur) var(--ease); }

/* KPI 卡片 */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.kpi-label { font-size: 12.5px; color: var(--ink-400); display: block; }

.kpi-value {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink-900);
  line-height: 1.2;
}

.kpi-time { font-size: 15px; font-weight: 600; line-height: 1.5; }

.kpi-foot { margin-top: 6px; font-size: 11.5px; color: var(--ink-300); display: block; }

/* 面板 */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  margin-bottom: 18px;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.panel-head h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}

.admin-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.admin-grid-2 > * { min-width: 0; }

.admin-grid-2 .panel { margin-bottom: 0; }

/* 工具栏 */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box .icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--ink-300);
  pointer-events: none;
}

.search-box .input { padding-left: 36px; width: 240px; }

.select-sm { width: 150px; height: 44px; }

/* 表格 */
.table-hover tbody tr {
  transition: background var(--dur);
  cursor: default;
}

.table-hover tbody tr:hover { background: #f8f9fc; }

.sortable { cursor: pointer; user-select: none; }

.sortable:hover { color: var(--ink-900); }

.sort-mark::after { content: "↕"; font-size: 11px; color: var(--ink-300); }

.act-name { font-weight: 600; }

.act-id { font-size: 11px; margin-top: 2px; }

.num { font-variant-numeric: tabular-nums; }

.rank-cell { display: flex; align-items: center; gap: 8px; }

.rank-no {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--brand-100);
  color: var(--brand-600);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 快捷操作 */
.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quick-actions .btn { min-height: 44px; }

/* 分页 */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.pg-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--ink-700);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--dur), border-color var(--dur);
  font-family: inherit;
}

.pg-btn:hover:not(:disabled) { border-color: var(--brand-400); color: var(--brand-600); }

.pg-btn.active {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
  border-color: transparent;
  color: #fff;
}

.pg-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.pg-ellipsis { color: var(--ink-300); padding: 0 2px; }

/* 首页管理 */
.btn-xs {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #f5c6c8;
}

.btn-danger:hover { background: #fbe0e0; }

.home-ops {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* 后台响应式 */
@media (max-width: 980px) {
  .admin-shell { flex-direction: column; }

  .admin-sidebar {
    position: static;
    width: 100%;
    min-height: auto;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    overflow-x: auto;
  }

  .admin-brand { border-bottom: 0; padding: 0 8px 0 0; margin: 0; }

  .admin-brand-text { display: none; }

  .admin-nav {
    flex-direction: row;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .admin-nav::-webkit-scrollbar { display: none; }

  .nav-item { white-space: nowrap; padding: 8px 12px; }

  .admin-sidebar-foot { border-top: 0; padding: 0; flex-direction: row; }

  .admin-main { margin-left: 0; }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .admin-content { padding: 16px 14px 40px; }
  .admin-topbar { padding: 0 14px; }
  .admin-grid-2 { grid-template-columns: 1fr; }
  .admin-grid-2 .panel { margin-bottom: 18px; }
  .kpi-value { font-size: 24px; }
  .search-box .input { width: 100%; }
  .search-box { flex: 1; min-width: 180px; }
  .select-sm { width: 130px; }
}
