:root {
  --text: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #fff;
  --brand: #6c5ce7;
  --ok: #0f9f6e;
  --warn: #b45309;
  --bad: #dc2626;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}
.app { max-width: 1520px; margin: 0 auto; padding: 28px 16px 64px; }
.back { color: var(--muted); text-decoration: none; font-size: 14px; }
h1 { margin: 10px 0 8px; font-size: 28px; }
.header { margin-bottom: 18px; }
.gate, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}
.gate { display: flex; gap: 12px; align-items: center; background: #f5f3ff; }
.gate[hidden] { display: none; }
.gate a, .btn {
  border: 0; border-radius: 9px; background: var(--brand); color: #fff;
  padding: 8px 14px; text-decoration: none; cursor: pointer; font-size: 14px;
}
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid #d9d4fb; }
.btn:disabled { opacity: .55; cursor: default; }
.panel-hd, .row { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.row { justify-content: flex-start; margin-top: 10px; }
.row.tight { margin: 0; }
h2 { margin: 0; font-size: 16px; }
textarea, select {
  width: 100%; margin-top: 12px; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font: 14px/1.5 inherit; resize: vertical;
}
select { width: auto; margin: 0; min-width: 220px; }
.hint { color: var(--muted); font-size: 13px; }
.err { color: var(--bad); font-size: 13px; }
.pill { font-size: 12px; padding: 4px 8px; border-radius: 999px; background: #f1f5f9; color: var(--muted); }
.pill.on { background: #ecfdf3; color: var(--ok); }
.pill.off { background: #fff7ed; color: var(--warn); }
.tablewrap { margin-top: 12px; max-height: 640px; overflow: auto; border: 1px solid #eee; border-radius: 6px; }
table { width: 100%; min-width: 1280px; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 12px; }
col.c-time { width: 58px; } col.c-title { width: 200px; } col.c-spec { width: 168px; }
col.c-pre { width: 72px; } col.c-post { width: 78px; } col.c-flag { width: 180px; } col.c-disc { width: 220px; }
col.c-ship { width: 118px; } col.c-stock { width: 108px; } col.c-ops { width: 88px; }
th, td { padding: 7px 6px; text-align: left; vertical-align: top; border-bottom: 1px solid #f0f0f0; overflow: hidden; }
th { background: #fafafa; position: sticky; top: 0; z-index: 1; font-weight: 600; color: #666; font-size: 11px; border-bottom: 1px solid #e8e8e8; line-height: 1.3; }
th.num, td.num { text-align: right; }
tbody tr.day td { background: #f7f6fb; color: #333; font-weight: 600; font-size: 13px; padding: 8px 10px; }
tbody tr.day .day-n { margin-left: 8px; color: #888; font-weight: 400; font-size: 12px; }
tbody tr.zebra > td { background: #fcfcfd; }
tbody tr.main:hover > td { background: #fff8f3; }
.na, .dl-empty { color: #bbb; }
td.time { color: #888; font-variant-numeric: tabular-nums; line-height: 1.5; }
td.time .d { color: #555; }
td.title .ty { display: inline-block; font-size: 10px; line-height: 15px; padding: 0 4px; border-radius: 3px; margin-bottom: 3px; }
td.title .ty.order { background: #fff1e8; color: #ff5000; }
td.title .ty.detail { background: #f0f0f0; color: #777; }
td.title a { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: #333; text-decoration: none; line-height: 1.45; word-break: break-all; }
td.title a.pending { color: #888; -webkit-line-clamp: 2; }
td.title a:hover { color: #ff5000; }
td.title .shop { color: #999; font-size: 11px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pre { color: #999; text-decoration: line-through; }
.post { color: #ff5000; font-weight: 700; font-size: 13px; }
td.ship .fee { color: #333; }
td.ship .fee.free { color: #1a7f37; }
td.ship .to { color: #999; font-size: 11px; margin-top: 2px; line-height: 1.4; word-break: break-all; }
td.ship.warn .to { color: #b26a00; }
td.stock { color: #555; line-height: 1.4; word-break: break-all; }
td.stock .st-line { color: #333; }
td.stock .st-line.na { color: #bbb; }
td.stock .st-src { color: #aaa; font-size: 10px; }
td.stock .qty { color: #999; font-size: 11px; margin-top: 3px; }
.st { font-weight: 600; font-size: 12px; }
.st.queued, .st.running { color: #b26a00; }
.st.paused { color: #64748b; }
.st.done { color: #1a7f37; }
.st.failed { color: #d93026; }
.sub { color: #d93026; margin-top: 3px; word-break: break-all; }
.empty { color: #aaa; text-align: center; padding: 30px 8px; }
.spec { display: flex; flex-direction: column; gap: 3px; }
.spec-line { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.45; word-break: break-all; }
.spec-k { display: inline-block; color: #999; font-size: 11px; margin-right: 4px; }
.spec-v { color: #333; }
.dl { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dl-item { display: flex; align-items: flex-start; gap: 4px; line-height: 1.45; }
.dl-name { flex: 1; min-width: 0; color: #333; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dl-amt { flex: none; color: #e4393c; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.dl-item.na .dl-name, .dl-item.na .dl-amt { color: #bbb; }
.dl-item.na .tag { background: #f2f2f2; color: #aaa; border-color: #e5e5e5; }
.dl-sep { border-top: 1px solid #eee; margin: 2px 0 1px; }
.dl-total { display: flex; font-weight: 600; color: #333; gap: 8px; white-space: nowrap; }
.dl-total span:first-child { flex: 1; min-width: 4em; }
.dl-total .dl-amt { color: #e4393c; }
.tag { flex: none; display: inline-block; font-size: 10px; line-height: 15px; padding: 0 4px; border-radius: 3px; border: 1px solid transparent; margin-top: 1px; }
.t-shop { background: #fff1e8; color: #ff5000; border-color: #ffd2b8; }
.t-plat { background: #e8f2ff; color: #1a6fd6; border-color: #bcd8fb; }
.t-vip { background: #1f1f1f; color: #f1c86b; }
.t-coupon { background: #fdecec; color: #e4393c; border-color: #f8c6c7; }
.t-sub { background: #e9f7ef; color: #1a7f37; border-color: #bfe5cc; }
.t-bank { background: #fff6e8; color: #b26a00; border-color: #f3ddb0; }
.t-other { background: #f4f4f4; color: #777; border-color: #e5e5e5; }
@media (max-width: 720px) {
  .panel-hd, .gate { flex-wrap: wrap; }
  h1 { font-size: 22px; }
}

.ext-dl { color: var(--muted); font-size: 13px; line-height: 1.6; max-width: 720px; margin: 0 0 4px; }
.ext-dl a { color: var(--brand); }
.dl-sub { margin-top: 8px; font-size: 12px; color: #334155; }
.dl-sub .tag { margin-right: 4px; }

.btn.del, button.row-del {
  background: #fff; color: #a33; border: 1px solid #f0d0d0;
  padding: 2px 8px; font-size: 12px; border-radius: 4px; cursor: pointer;
  margin-top: 6px;
}
.btn.del:hover, button.row-del:hover { background: #fdecec; color: #d93026; }
.btn.del.armed, button.row-del.armed { background: #d93026; color: #fff; border-color: #d93026; }
td.ops { white-space: nowrap; }
.toast-undo {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #333; color: #fff; padding: 10px 16px; border-radius: 6px;
  font-size: 13px; z-index: 20; display: flex; gap: 12px; align-items: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
}
.toast-undo button {
  background: transparent; border: 0; color: #9cf; cursor: pointer; font-size: 13px;
}

.quota-bar {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 14px;
}
.quota-bar span { color: var(--text); }
.quota-bar .low { color: var(--warn); font-weight: 600; }
.quota-bar .blocked { color: var(--bad); font-weight: 600; }
.quota-link {
  margin-left: auto;
  color: #fff;
  background: var(--brand);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 9px;
  font-size: 13px;
}
.topup-packs { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 14px; }
.topup-pack {
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font: inherit;
}
.topup-pack.on { border-color: var(--brand); background: #f5f3ff; color: var(--brand); font-weight: 600; }
.topup-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 16px; align-items: start; }
.topup-qr { display: flex; gap: 12px; flex-wrap: wrap; }
.qr-box { text-align: center; font-size: 12px; color: var(--muted); }
.qr-box img { display: block; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-bottom: 6px; }
.topup-form label { display: block; margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.topup-form input, .topup-form select {
  width: 100%; margin-top: 4px; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font: 14px/1.5 inherit;
}
.ok { color: var(--ok); font-size: 13px; }
@media (max-width: 720px) {
  .topup-grid { grid-template-columns: 1fr; }
  .quota-link { margin-left: 0; }
}

.topup-pack { position: relative; min-width: 140px; text-align: left; line-height: 1.35; }
.topup-pack .pack-label { display: block; }
.topup-pack .pack-sub { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.topup-pack.featured { border-color: #c4b5fd; background: #f5f3ff; box-shadow: 0 0 0 1px #c4b5fd; }
.topup-pack .pack-badge {
  position: absolute; top: -8px; right: 8px;
  background: var(--brand); color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px; letter-spacing: .02em;
}
.topup-pack.on.featured { border-color: var(--brand); }
.qr-box[hidden] { display: none; }

tbody tr.unconfirmed > td { background: #fff8db; }
tbody tr.unconfirmed.zebra > td { background: #fff4c8; }
tbody tr.unconfirmed:hover > td { background: #ffefb0; }
.flag { color: #92400e; font-size: 11px; line-height: 1.45; white-space: normal; overflow-wrap: break-word; word-break: normal; }
.flag-badge { display: inline-block; background: #facc15; color: #78350f; font-weight: 700; font-size: 10px; line-height: 16px; padding: 0 6px; border-radius: 3px; margin-bottom: 3px; }
.flag-empty { color: #bbb; }
.review-filter { display: flex; gap: 0; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.review-filter button { background: #fff; border: 0; border-right: 1px solid #e2e8f0; padding: 6px 10px; font: 12px inherit; color: #475569; cursor: pointer; }
.review-filter button:last-child { border-right: 0; }
.review-filter button.on { background: #fff8db; color: #92400e; font-weight: 600; }
.review-filter #unconfirmedCount { color: #b45309; }
.dl-item.warn-unc { background: #fff8db; border-radius: 4px; padding: 1px 2px; }
.tag.t-unc { background: #facc15; color: #78350f; border-color: #eab308; }

.btn.ghost.danger { color: #dc2626; border-color: #fecaca; }

.row-reset { margin-right: 4px; background: #fff; color: #b45309; border: 1px solid #fde68a; border-radius: 4px; padding: 2px 6px; font-size: 11px; cursor: pointer; }
.row-reset.armed { background: #b45309; color: #fff; border-color: #b45309; }
