/* 卡密商城：买家页和后台共用。沿用 CC Token 的底色、白色面板和墨黑主按钮；订单页是一张小票。 */
:root {
  color-scheme: light;
  --bg: #e9e8e4; --surface: #ffffff; --surface-2: #f4f3f0; --surface-3: #e8e7e2;
  --border: #e9e7e1; --border-strong: #d7d4cc;
  --text: #0f1115; --text-2: #434854; --text-3: #6b707b; --text-4: #a0a4ad;
  --accent: #2347f5; --accent-soft: rgba(35, 71, 245, 0.07);
  --solid: #0f1115; --solid-hover: #2a2e37; --solid-text: #ffffff;
  --good: #1f8a4c; --good-soft: rgba(31, 138, 76, 0.1);
  --warn: #a35f00; --warn-soft: rgba(201, 125, 0, 0.12);
  --danger: #c93434; --danger-soft: rgba(201, 52, 52, 0.08);
  --radius: 16px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --shadow: 0 1px 2px rgba(15, 17, 21, 0.04), 0 8px 24px rgba(15, 17, 21, 0.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0e0f12; --surface: #17191d; --surface-2: #1f2126; --surface-3: #2a2d34;
    --border: #25282e; --border-strong: #363a43;
    --text: #eeeeec; --text-2: #adb0b8; --text-3: #82868f; --text-4: #585c66;
    --accent: #8fa5ff; --accent-soft: rgba(110, 135, 255, 0.14);
    --solid: #f1f1ef; --solid-hover: #ffffff; --solid-text: #0f1115;
    --good: #4ac26b; --good-soft: rgba(74, 194, 107, 0.13);
    --warn: #e0a03a; --warn-soft: rgba(224, 160, 58, 0.14);
    --danger: #ef6b6b; --danger-soft: rgba(239, 107, 107, 0.12);
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--text-3); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.pre { white-space: pre-wrap; word-break: break-word; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 16px; }
.center { text-align: center; justify-content: center; }
.text2 { color: var(--text-2); }
.narrow { max-width: 460px; margin-left: auto; margin-right: auto; width: 100%; }
.boot { margin-top: 20vh; }
.lbl { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.panel h2.title { font-size: 20px; margin: 0; }
.tagline { margin-top: 6px; }

/* 顶栏 */
.top { display: flex; align-items: center; gap: 16px; padding: 22px 0; }
.brand { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.brand:hover { text-decoration: none; }
.top nav { margin-left: auto; display: flex; gap: 4px; }
.top nav a { color: var(--text-2); padding: 6px 12px; border-radius: 999px; font-size: 14px; }
.top nav a:hover, .top nav a.on { background: var(--surface); color: var(--text); text-decoration: none; }
.foot { padding: 40px 0 32px; color: var(--text-4); font-size: 13px; text-align: center; }

/* 面板 */
.panel { background: var(--surface); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.notice { background: var(--surface); border-radius: var(--radius); padding: 14px 20px; color: var(--text-2); font-size: 14px; white-space: pre-wrap; box-shadow: var(--shadow); }
.notice::before { content: "公告"; display: inline-block; font-size: 12px; font-weight: 600; color: var(--warn); background: var(--warn-soft); border-radius: 6px; padding: 0 8px; margin-right: 10px; }
.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }

/* 按钮与表单 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px; padding: 9px 18px; cursor: pointer; font-weight: 600; font-size: 14px; background: var(--surface-2); color: var(--text); text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--solid); color: var(--solid-text); }
.btn.primary:hover { background: var(--solid-hover); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.big { padding: 13px 22px; font-size: 15px; border-radius: 12px; width: 100%; }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.disabled { opacity: 0.45; pointer-events: none; }
label.f { display: block; }
label.f > span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
label.f > small { display: block; font-size: 12px; color: var(--text-3); margin-top: 5px; }
.in, textarea.in, select.in { width: 100%; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 10px; padding: 9px 12px; outline: none; }
.in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.in { resize: vertical; min-height: 90px; line-height: 1.5; }
textarea.in.mono { font-family: var(--mono); font-size: 13px; }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.err { color: var(--danger); font-size: 13px; }
.err:empty { display: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

/* 选择块（支付方式等） */
.choices { display: flex; gap: 8px; flex-wrap: wrap; }
.choice { border: 1px solid var(--border-strong); border-radius: 10px; padding: 8px 16px; cursor: pointer; background: var(--surface); font-weight: 500; font-size: 14px; }
.choice.on { border-color: var(--solid); box-shadow: inset 0 0 0 1px var(--solid); }

/* 数量 */
.qty { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; }
.qty button { border: 0; background: var(--surface-2); width: 38px; cursor: pointer; font-size: 18px; }
.qty input { width: 56px; text-align: center; border: 0; background: var(--surface); padding: 8px 0; outline: none; }

/* 状态标签 */
.tag { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 6px; padding: 1px 8px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--danger-soft); color: var(--danger); }
.tag.info { background: var(--accent-soft); color: var(--accent); }

/* 商品列表 */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.product { background: var(--surface); border-radius: var(--radius); padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.product h3 { margin: 0; font-size: 16px; line-height: 1.4; }
.product .desc { color: var(--text-3); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.product .bottom { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding-top: 6px; }
.price { font-family: var(--mono); font-weight: 700; font-size: 22px; letter-spacing: -0.02em; }
.price small { font-size: 13px; font-weight: 600; margin-right: 1px; }

/* 下单页 */
.buy { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 760px) { .buy { grid-template-columns: 1fr; } }
.total { display: flex; align-items: baseline; justify-content: space-between; padding: 14px 0 4px; border-top: 1px dashed var(--border-strong); }

/* 小票：订单 */
.rcpt { background: var(--surface); max-width: 520px; margin: 0 auto; padding: 26px 28px 30px; border-radius: 4px; position: relative; box-shadow: var(--shadow);
  -webkit-mask: radial-gradient(circle 6px at 50% 100%, transparent 5.5px, #000 6px) 0 100% / 16px 12px repeat-x, linear-gradient(#000, #000) 0 0 / 100% calc(100% - 11px) no-repeat;
          mask: radial-gradient(circle 6px at 50% 100%, transparent 5.5px, #000 6px) 0 100% / 16px 12px repeat-x, linear-gradient(#000, #000) 0 0 / 100% calc(100% - 11px) no-repeat; }
.rcpt .head { text-align: center; padding-bottom: 14px; }
.rcpt .head .st { font-size: 20px; font-weight: 700; margin-top: 4px; }
.rcpt .head .st.good { color: var(--good); }
.rcpt .head .st.warn { color: var(--warn); }
.rcpt .head .st.bad { color: var(--danger); }
.rcpt .head .st.info { color: var(--accent); }
.nowrap { white-space: nowrap; }
.pickup { font-size: 28px; font-weight: 700; letter-spacing: 0.08em; background: var(--surface-2); border-radius: 12px; padding: 18px 12px; user-select: all; word-break: break-all; }
@media (max-width: 420px) { .pickup { font-size: 22px; } }
.rcpt .cut { border-top: 1px dashed var(--border-strong); margin: 14px 0; }
.rline { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; padding: 3px 0; }
.rline > span:first-child { color: var(--text-3); white-space: nowrap; }
.rline > span:last-child { text-align: right; word-break: break-all; }
.rline.big > span:last-child { font-family: var(--mono); font-size: 18px; font-weight: 700; }
.codes { display: flex; flex-direction: column; gap: 8px; }
.code { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 8px; padding: 9px 12px; }
.code .n { color: var(--text-4); font-size: 12px; min-width: 18px; }
.code .v { font-family: var(--mono); font-size: 14px; flex: 1; word-break: break-all; user-select: all; }
.box { border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.box.warn { background: var(--warn-soft); color: var(--warn); }
.box.info { background: var(--accent-soft); color: var(--text-2); }
.box.bad { background: var(--danger-soft); color: var(--danger); }
.recent { display: flex; flex-direction: column; }
.recent a { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px dashed var(--border); color: var(--text); }
.recent .grow { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; column-gap: 12px; align-items: baseline; }
.recent .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.recent .no { word-break: break-all; }
.recent a:first-child { border-top: 0; }
.recent a:hover { text-decoration: none; background: var(--surface-2); }

/* 提示 */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--solid); color: var(--solid-text); padding: 10px 18px; border-radius: 10px; font-size: 14px; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,0.2); }

/* ---------------- 后台 ---------------- */
.adm .top { padding: 16px 0; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { color: var(--text-2); padding: 6px 14px; border-radius: 999px; font-size: 14px; }
.tabs a.on, .tabs a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border-radius: 14px; padding: 14px 18px; box-shadow: var(--shadow); }
.stat .k { font-size: 12px; color: var(--text-3); }
.stat .v { font-family: var(--mono); font-size: 20px; font-weight: 700; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; color: var(--text-3); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl .num { text-align: right; font-family: var(--mono); white-space: nowrap; }
.scroll { overflow-x: auto; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding-top: 12px; font-size: 13px; color: var(--text-3); }
.modal-bg { position: fixed; inset: 0; background: rgba(15, 17, 21, 0.4); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 22px 24px; width: 100%; max-width: 640px; }
.modal h3 { margin: 0 0 14px; font-size: 17px; }
.note { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-all; color: var(--text-2); }
.login { max-width: 360px; margin: 14vh auto 0; }
