:root {
  --bg: #f4f7f5;
  --card: #ffffff;
  --fg: #1a2b23;
  --muted: #6b7f74;
  --border: #e2e9e4;
  --accent: #16794b;
  --accent-dark: #0f5f3a;
  --accent-soft: #e7f4ed;
  --danger: #c0392b;
  --up: #16794b;
  --down: #c0392b;
  --shadow: 0 1px 3px rgba(16, 40, 28, 0.08);
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 顶栏 */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-size: 16px; font-weight: 700; color: var(--accent-dark); }
.brand:hover { text-decoration: none; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.who { color: var(--muted); font-weight: 600; }
.nav-link { color: var(--accent); font-weight: 600; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 20px 60px; }

.page-title { font-size: 22px; margin: 0 0 18px; }

/* 提示条 */
.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; font-weight: 500; }
.flash.success { background: var(--accent-soft); color: var(--accent-dark); border: 1px solid #bfe3cd; }
.flash.error { background: #fdecea; color: var(--danger); border: 1px solid #f5c6c1; }

/* 面板 */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.section-heading h2 { font-size: 17px; margin: 0; }
.eyebrow { margin: 0 0 2px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }

/* 表单 */
.form-stack { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13px; color: #33483e; }
input, textarea, select {
  font: inherit;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--fg);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.file { padding: 7px; }

/* 按钮 */
.btn {
  font: inherit;
  font-weight: 600;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--fg);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.danger { color: var(--danger); border-color: #eccfc9; }
.btn.danger:hover { background: #fdecea; border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.block { width: 100%; }

.actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.inline { display: inline-flex; }
.text-link { font-weight: 600; }

/* 认证卡片 */
.auth-card {
  max-width: 400px;
  margin: 8vh auto 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 32px 30px;
}
.auth-card h1 { margin: 0 0 4px; font-size: 22px; color: var(--accent-dark); }
.auth-card .muted { margin: 0 0 18px; }

/* 余额条 */
.balance-bar {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.balance-main { display: flex; align-items: baseline; gap: 6px; }
.bb-label { font-size: 13px; opacity: 0.9; }
.balance-main strong { font-size: 32px; font-weight: 800; }
.balance-main small { opacity: 0.85; }
.balance-sub { display: flex; gap: 18px; font-size: 13px; opacity: 0.9; }
.balance-bar .btn.primary { background: #fff; color: var(--accent-dark); border-color: #fff; }
.balance-bar .btn.primary:hover { background: #eef6f1; }
.low-balance { background: #fff6e5; color: #8a5b00; border: 1px solid #f0d9a8; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; font-weight: 600; }

/* 名单 */
.offer-hint { color: #8a5b00; font-size: 12px; margin-top: -6px; }
.offer-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-soft); color: var(--accent-dark);
  border: 1px solid #bfe3cd; border-radius: 20px; padding: 4px 10px; font-size: 13px;
}
.tag form { display: inline-flex; }
.tag button { border: none; background: none; color: var(--accent-dark); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.tag.failed { background: #fdecea; color: var(--danger); border-color: #f5c6c1; }

/* 进度 */
.progress-track { height: 10px; background: #eef2ef; border-radius: 999px; overflow: hidden; margin: 6px 0 8px; }
.progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.4s; }
.progress-detail { margin: 0 0 10px; font-size: 13px; }
.log-box {
  background: #0d1f16; color: #c9e4d4; border-radius: 8px; padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px;
  max-height: 260px; overflow-y: auto; white-space: pre-wrap; word-break: break-all;
}
.log-line.ok { color: #7ee2a8; }
.log-line.err { color: #ff9c8f; }
.log-line.info { color: #9fb8a9; }

/* 对比 */
.compare-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.compare-card { border-radius: var(--radius); padding: 14px 16px; }
.compare-card.up { background: var(--accent-soft); border: 1px solid #bfe3cd; }
.compare-card.down { background: #fdecea; border: 1px solid #f5c6c1; }
.compare-card span { display: block; font-size: 13px; color: var(--muted); }
.compare-card strong { font-size: 26px; }
.compare-card.up strong { color: var(--up); }
.compare-card.down strong { color: var(--down); }
.failed-note { margin-bottom: 14px; }
.sub-head { font-size: 14px; margin: 16px 0 8px; }
.sub-head.up { color: var(--up); }
.sub-head.down { color: var(--down); }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.sku-cell { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.clip { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.number { text-align: right; }
.plus { color: var(--up); font-weight: 600; }
.minus { color: var(--down); font-weight: 600; }

/* 徽章 */
.badge { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.new, .badge.restocked { background: var(--accent-soft); color: var(--accent-dark); }
.badge.soldout, .badge.offline { background: #fdecea; color: var(--danger); }
.badge.admin { background: #eef2ff; color: #3b4bd8; }
.badge.pending { background: #fff3e0; color: #9a6b00; }

/* 空状态 */
.empty { color: var(--muted); padding: 22px 8px; text-align: center; }
.empty small { display: block; margin-top: 4px; }

/* 导出/导入 */
.export-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.export-form.tight { gap: 6px; }
.select { min-width: 260px; }
.small-input { width: 90px; }

/* 弹窗 */
dialog { border: none; border-radius: 14px; padding: 0; max-width: 420px; width: 92vw; box-shadow: 0 18px 48px rgba(0,0,0,0.22); }
dialog::backdrop { background: rgba(10, 20, 14, 0.5); }
.dialog-card { padding: 22px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dialog-head h2 { margin: 0; font-size: 17px; }
.dialog-close { border: none; background: none; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1; }
.dialog-body { display: flex; flex-direction: column; gap: 12px; }
.price-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.price-strip > div { background: var(--accent-soft); border-radius: 8px; padding: 12px; }
.price-strip span { display: block; font-size: 12px; color: var(--muted); }
.price-strip strong { font-size: 20px; color: var(--accent-dark); }
.price-strip small { color: var(--muted); }
.qr-box { display: flex; align-items: center; justify-content: center; }
.qr-box img { max-width: 240px; border: 1px solid var(--border); border-radius: 8px; }
.qr-box.small img { max-width: 140px; }
.qr-box.empty { color: var(--muted); border: 1px dashed var(--border); border-radius: 8px; padding: 30px; }

.footer { max-width: 1080px; margin: 0 auto; padding: 6px 20px 32px; color: var(--muted); font-size: 12px; text-align: center; }
.footer span { display: block; margin-top: 2px; opacity: 0.85; }

/* 充值工单 */
.recharge-order { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; background: #fbfdfb; }
.ro-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.ro-id { font-weight: 700; color: var(--accent-dark); }
.ro-vouchers { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.ro-vouchers img { max-width: 140px; max-height: 140px; border: 1px solid var(--border); border-radius: 6px; }
.ro-thread { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.ro-msg { border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.ro-msg.me { background: var(--accent-soft); }
.ro-msg.admin { background: #eef2ff; }
.ro-msg-who { font-weight: 700; margin-right: 8px; color: var(--accent-dark); }
.ro-msg.admin .ro-msg-who { color: #3b4bd8; }
.ro-msg-text { word-break: break-word; }
.ro-msg-time { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.ro-reply { display: flex; gap: 8px; margin-top: 8px; }
.ro-reply input { flex: 1; }
.ro-actions { display: flex; gap: 10px; margin: 8px 0; flex-wrap: wrap; }
.ro-reject input { width: 180px; }

/* 使用教程 */
dialog.dialog-wide { max-width: 560px; }

.tutorial-banner {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left; cursor: pointer;
  background: linear-gradient(120deg, #16794b, #1e9d66 60%, #2bb77d);
  color: #fff; border: none; border-radius: 14px;
  padding: 16px 20px; margin-bottom: 16px; font: inherit;
  box-shadow: 0 4px 18px rgba(22, 121, 75, 0.30);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tutorial-banner:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(22, 121, 75, 0.38); }
.tutorial-banner:active { transform: translateY(0); }
.tutorial-icon { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,0.18); }
.tutorial-icon svg { display: block; }
.tutorial-text { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.tutorial-text strong { font-size: 16px; letter-spacing: 0.2px; }
.tutorial-text small { color: rgba(255,255,255,0.88); font-size: 12.5px; }
.tutorial-cta { flex: 0 0 auto; background: #fff; color: #0f5f3a; font-weight: 700; font-size: 13px; border-radius: 999px; padding: 8px 16px; box-shadow: 0 2px 6px rgba(0,0,0,0.12); }

.tut-sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }

.tut-step { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.tut-num {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #16794b, #2bb77d); color: #fff;
  font-weight: 800; font-size: 15px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(22, 121, 75, 0.28);
}
.tut-step-body { flex: 1; min-width: 0; }
.tut-step-body strong { display: block; font-size: 14.5px; }
.tut-step-body > p { margin: 3px 0 8px; color: var(--muted); font-size: 13px; }
.inline-code { background: #eef4ef; border-radius: 4px; padding: 1px 6px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--accent-dark); }

.tut-code { display: flex; align-items: center; gap: 10px; background: #f3f8f5; border: 1px solid #dfece4; border-radius: 10px; padding: 9px 12px; }
.tut-code-label { flex: 0 0 auto; font-size: 11px; font-weight: 700; color: #0f5f3a; background: #e2f2ea; border-radius: 6px; padding: 2px 8px; }
.tut-code code { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: #0f5f3a; word-break: break-all; }

.tut-divider { border-top: 1px solid var(--border); margin: 6px 0 16px; }

.tut-section-title { font-weight: 700; font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
.tut-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.tut-cmp { display: flex; gap: 10px; align-items: flex-start; border-radius: 10px; padding: 12px 14px; }
.tut-cmp.up { background: #eef8f1; border: 1px solid #cdeadd; }
.tut-cmp.down { background: #fdf0ef; border: 1px solid #f4d2cf; }
.tut-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; }
.tut-dot.up { background: #2e9e63; }
.tut-dot.down { background: #d64545; }
.tut-cmp strong { display: block; font-size: 13.5px; }
.tut-cmp.up strong { color: #1c7c49; }
.tut-cmp.down strong { color: #c0392b; }
.tut-cmp small { color: var(--muted); font-size: 12px; }

.tut-tip { display: flex; gap: 10px; align-items: flex-start; background: #fff9ec; border: 1px solid #f2e4bd; border-radius: 10px; padding: 12px 14px; }
.tut-tip-icon { flex: 0 0 auto; font-size: 18px; line-height: 1.2; }
.tut-tip p { margin: 0; font-size: 13px; color: #6b5a26; line-height: 1.6; }

@media (max-width: 640px) {
  .tut-compare { grid-template-columns: 1fr; }
  .tutorial-cta { display: none; }
}

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .balance-bar { flex-direction: column; align-items: flex-start; gap: 12px; }
  .balance-sub { flex-direction: column; gap: 4px; }
  .topbar { padding: 10px 14px; }
  .wrap { padding: 16px 12px 40px; }
}
