/* ==========================================================
   卡密兑换 · 纸本与印章
   米白纸底 + 墨黑 + 朱砂红；宋体标题，等宽字体显示卡密
   ========================================================== */

:root {
  --paper: #F3F0E8;
  --card: #FFFDF8;
  --white: #FFFFFF;
  --soft: #F8F5EE;
  --ink: #17160F;
  --ink-hover: #2C2A22;
  --ink-2: #3A382F;
  --muted: #6B675D;
  --line: #DAD5C8;
  --line-2: #E3DED2;
  --line-3: #EFEBE2;
  --field: #D3CCBC;
  --dash: #BDB6A5;
  --dot: #E4DFD3;
  --used: #E9E4D8;
  --accent: #B8412A;
  --on-ink: #FFFDF8;
  --on-ink-2: #CFC9BA;
  --on-ink-3: #A8A192;
  --ring: 0 0 0 4px rgba(23, 22, 15, 0.07);

  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--ink); text-underline-offset: 4px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
::placeholder { color: #7A7467; letter-spacing: 0.04em; opacity: 1; }

svg.i {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.mono { font-family: var(--mono); }
.clip-helper { position: fixed; top: 0; left: -9999px; opacity: 0; }

/* ---------- 共用：品牌 / 按钮 / 表单 ---------- */

.seal-logo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-ink);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 900;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.24em;
  color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:disabled { opacity: .55; }
a.btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-ink { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn-ink:hover:not(:disabled) { background: var(--ink-hover); color: var(--on-ink); }
.btn-line { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-line:hover:not(:disabled) { background: var(--ink); color: var(--on-ink); }
.btn-soft { background: var(--white); border-color: var(--field); color: var(--ink); }
.btn-soft:hover:not(:disabled) { border-color: var(--ink); color: var(--ink); }
.btn-soft.danger { color: var(--accent); }
.btn-soft.danger:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-xl {
  width: 100%;
  height: 60px;
  padding-left: .22em;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .22em;
}
.btn-lg { height: 56px; padding: 0 20px; font-size: 15px; }
.btn-md { height: 44px; padding: 0 18px; border-radius: 10px; font-size: 14px; }
.btn-sm { height: 40px; padding: 0 14px; border-radius: 10px; font-size: 13px; gap: 8px; }

.group { display: flex; flex-direction: column; gap: 12px; }
.group.tight { gap: 8px; }
.fieldset-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.step-label { display: flex; align-items: baseline; gap: 10px; }
.step-no { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.hint { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.hint-sans { font-size: 12px; color: var(--muted); }
.muted-inline { font-weight: 400; color: var(--muted); }

.form-error {
  margin: -14px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
}
.form-error.inline { margin: 0; }

.input, .select, .area {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--field);
  border-radius: 10px;
  background: var(--white);
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.area { height: auto; min-height: 112px; padding: 12px 14px; line-height: 1.6; resize: vertical; }
.input:focus, .select:focus, .area:focus { border-color: var(--ink); box-shadow: var(--ring); }
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B675D' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}
.select:disabled { color: var(--muted); background-color: var(--soft); }
.select.sm, .input.sm { height: 40px; font-size: 13px; }
.mono-input { font-family: var(--mono); letter-spacing: .12em; text-transform: uppercase; }

/* ==========================================================
   用户兑换页
   ========================================================== */

.page-user {
  min-height: 100vh;
  background-color: var(--paper);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 28px 28px;
}
.shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  flex-shrink: 0;
  height: 88px;
  padding: 0 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: .04em; }
.brand-sep { width: 1px; height: 14px; background: var(--dash); }
.brand-sub { font-size: 14px; color: var(--muted); }
.topnav { margin-left: auto; display: flex; align-items: center; gap: 32px; font-size: 14px; }
.topnav a { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }

/* 语言切换：下拉菜单 */
.lang-switch {
  position: relative;
  flex-shrink: 0;
  margin-left: 32px;
  padding-left: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 1px solid var(--line);
  font-size: 13px;
}
.lang-icon { position: absolute; left: 46px; color: var(--muted); pointer-events: none; }
.lang-select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 44px;
  min-width: 148px;
  padding: 10px 36px 10px 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B675D' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.lang-select:hover { border-color: var(--ink); background-color: var(--soft); }
.lang-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; box-shadow: var(--ring); }

/* 非默认语言首帧隐藏（lang-boot.js 设置），文案替换后移除；脚本异常时 1.5s 后兜底显示 */
.i18n-pending .shell { visibility: hidden; animation: i18n-reveal 0s linear 1.5s forwards; }
@keyframes i18n-reveal { to { visibility: visible; } }

/* 各语言字体：繁体 / 日文 / 韩文用对应的 Noto 字体（lang-boot.js 按需加载） */
html:lang(zh-Hant) {
  --serif: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}
html:lang(ja) {
  --serif: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --sans: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
}
html:lang(ko) {
  --serif: "Noto Serif KR", "AppleMyungjo", "Batang", serif;
  --sans: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}
/* 英文单词比两个汉字宽得多：标题字号按左栏实际宽度推算（"Redeem" ≈ 4.1em + 印章），避免压到右侧票券 */
html:lang(en) .hero-title h1 { font-size: clamp(80px, calc((100vw - 940px) / 4.1), 112px); letter-spacing: -.02em; }
html:lang(en) .stamp-cn { font-size: 22px; letter-spacing: .02em; }
html:lang(en) .btn-xl { padding-left: .06em; letter-spacing: .06em; }
html:lang(ko) .stamp-cn { font-size: 24px; }

.stage {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 64px 80px 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 600px;
  gap: 96px;
  align-items: start;
}

.hero { display: flex; flex-direction: column; gap: 52px; padding-top: 12px; }
.hero-head { display: flex; flex-direction: column; gap: 22px; }
.hero .eyebrow { letter-spacing: .28em; }
.hero-title { display: flex; align-items: flex-start; gap: 22px; }
.hero-title h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(112px, 12vw, 172px);
  font-weight: 900;
  line-height: .95;
  letter-spacing: -.03em;
  white-space: nowrap;
}
.chop {
  flex-shrink: 0;
  margin-top: 18px;
  width: 62px;
  height: 62px;
  padding: 7px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  border-radius: 4px;
  background: var(--accent);
  color: var(--on-ink);
  text-align: center;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 900;
  line-height: 1;
  transform: rotate(5deg);
}
.hero-sub {
  margin: 0;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink-2);
}
.steps { list-style: none; margin: 0; padding: 0; max-width: 480px; border-top: 1px solid var(--line); }
.steps li {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.steps .num { padding-top: 3px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.steps b { display: block; font-size: 16px; font-weight: 700; }
.steps .d { display: block; margin-top: 4px; font-size: 14px; color: var(--muted); }

/* 票券 */
.ticket {
  position: relative;
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 1px 0 rgba(23, 22, 15, .04), 0 32px 64px -32px rgba(23, 22, 15, .28);
}
.ticket-body { min-height: 536px; padding: 36px 40px; }
.panel { display: flex; flex-direction: column; gap: 28px; }
.panel:focus { outline: none; }

.perf { position: relative; height: 0; margin: 0 28px; border-top: 1.5px dashed var(--field); }
.perf::before, .perf::after {
  content: "";
  position: absolute;
  top: -17px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--paper);
}
.perf::before { left: -45px; }
.perf::after { right: -45px; }

.stub {
  padding: 26px 40px 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 32px;
}
.stub-title { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; color: var(--muted); }
.stub ul {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-2);
}
.stub li { position: relative; padding-left: 1em; }
.stub li::before { content: "•"; position: absolute; left: 0; color: var(--muted); }
.barcode { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.barcode-bars {
  width: 112px;
  height: 36px;
  background: repeating-linear-gradient(90deg,
    var(--ink) 0 2px, transparent 2px 4px,
    var(--ink) 4px 5px, transparent 5px 8px,
    var(--ink) 8px 11px, transparent 11px 13px);
}
.barcode-label { font-family: var(--mono); font-size: 10px; letter-spacing: .2em; color: var(--muted); }

/* 地区 */
.region-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.region {
  min-height: 100px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  text-align: left;
  transition: border-color .15s, background-color .15s, color .15s;
}
.region:hover { border-color: var(--ink); }
.region[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.region-top { display: flex; align-items: center; justify-content: space-between; }
.region-code { font-family: var(--mono); font-size: 13px; font-weight: 500; letter-spacing: .14em; }
.radio { width: 14px; height: 14px; border: 1.5px solid var(--dash); border-radius: 50%; }
.region[aria-pressed="true"] .radio { border-color: var(--on-ink); background: var(--accent); }
.region-name { display: block; font-size: 18px; font-weight: 700; }
.region-en { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.region[aria-pressed="true"] .region-en { color: var(--dash); }
.region-more { border-style: dashed; border-color: var(--dash); background: transparent; color: var(--muted); }
.region-more:hover { border-color: var(--dash); }
.region-more .region-name { font-size: 16px; }
.region-more .region-code { font-weight: 400; }
.region-skeleton { border-color: var(--line-2); background: var(--soft); }
.region-skeleton:hover { border-color: var(--line-2); }

/* 兑换方式 */
.tabs { display: flex; gap: 32px; border-bottom: 1px solid var(--line-2); }
.tab {
  height: 46px;
  margin-bottom: -1px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}
.tab:hover { color: var(--ink); }
.tab[aria-pressed="true"] { border-bottom-color: var(--ink); color: var(--ink); font-weight: 700; }

/* 输入 */
.field {
  height: 64px;
  padding: 0 8px 0 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--field);
  border-radius: 12px;
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
}
.field:focus-within { border-color: var(--ink); box-shadow: var(--ring); }
.field.is-error, .textarea.is-error { border-color: var(--accent); }
.field input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; background: transparent; }
.code-input { font-family: var(--mono); font-size: 21px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.paste-btn {
  flex-shrink: 0;
  height: 46px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink-2);
  font-size: 13px;
}
.paste-btn:hover { border-color: var(--ink); }
.textarea {
  width: 100%;
  min-height: 196px;
  padding: 16px 20px;
  border: 1px solid var(--field);
  border-radius: 12px;
  background: var(--white);
  outline: none;
  resize: vertical;
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: .06em;
  text-transform: uppercase;
  transition: border-color .15s, box-shadow .15s;
}
.textarea:focus { border-color: var(--ink); box-shadow: var(--ring); }
.textarea::placeholder { text-transform: none; }

/* 兑换结果 */
.result { position: relative; }
.stamp {
  position: absolute;
  top: -6px;
  right: -4px;
  width: 136px;
  height: 136px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  transform: rotate(-14deg);
  animation: stamp .55s cubic-bezier(.2, 1.3, .4, 1) both;
  pointer-events: none;
}
.stamp-inner {
  width: 114px;
  height: 114px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--accent);
  border-radius: 50%;
}
.stamp-en { font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: .24em; }
.stamp-cn { font-family: var(--serif); font-size: 26px; font-weight: 900; line-height: 1; }
.stamp-date { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; }
@keyframes stamp {
  0% { opacity: 0; transform: rotate(-14deg) scale(1.7); }
  100% { opacity: 1; transform: rotate(-14deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .stamp { animation: none; }
}

.result-head { display: flex; flex-direction: column; gap: 12px; padding-right: 160px; }
.result-head.flat { padding-right: 0; }
.result-title { margin: 0; font-family: var(--serif); font-size: 44px; font-weight: 900; line-height: 1.1; }
.result-title.sm { font-size: 38px; }
.result-note { margin: 0; font-size: 14px; line-height: 1.7; color: var(--muted); white-space: pre-line; overflow-wrap: anywhere; }
.kv { margin: 0; display: grid; grid-template-columns: 88px minmax(0, 1fr); border-top: 1px solid var(--line-2); font-size: 14px; }
.kv dt, .kv dd { margin: 0; padding: 15px 0; border-bottom: 1px solid var(--line-2); }
.kv dt { color: var(--muted); }
.kv dd { min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.kv dd.mono { letter-spacing: .06em; }

.batch-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.tally { display: flex; align-items: baseline; gap: 24px; font-size: 13px; color: var(--ink-2); }
.tally span { display: flex; align-items: baseline; gap: 6px; }
.tally b { font-family: var(--mono); font-size: 30px; font-weight: 600; color: var(--ink); }
.tally .fail, .tally .fail b { color: var(--accent); }
.rows {
  max-height: 340px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--white);
}
.rows li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-3);
}
.rows li:last-child { border-bottom: 0; }
.rows .idx { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.rows .code {
  min-width: 0;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rows .sub { display: block; margin-top: 2px; font-family: var(--sans); font-size: 12px; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.rows .bad .code { color: var(--muted); }
.rows .st { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; text-align: right; }
.rows .bad .st { color: var(--accent); }
.notes { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; border-radius: 12px; background: var(--soft); font-size: 13px; }
.notes b { display: block; margin-bottom: 2px; font-weight: 700; }
.notes p { margin: 0; line-height: 1.7; color: var(--ink-2); white-space: pre-line; overflow-wrap: anywhere; }
.btn-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
/* 只剩一个可见按钮时占满整行 */
.btn-row:has(> [hidden]) { grid-template-columns: minmax(0, 1fr); }

/* 批量进度：进度条 + 汇总 */
.progress { display: flex; flex-direction: column; gap: 10px; }
.progress-bar { height: 8px; overflow: hidden; border-radius: 999px; background: var(--line-3); box-shadow: inset 0 0 0 1px var(--line-2); }
.progress-bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--ink); transition: width .4s ease; }
.progress-stats { margin: 0; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .progress-bar span { transition: none; } }

/* 筛选：全部 / 已完成 / 处理中 / 失败 */
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  transition: background-color .15s, border-color .15s, color .15s;
}
.chip b { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--muted); }
.chip:hover:not(:disabled) { border-color: var(--ink); }
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--on-ink); cursor: default; }
.chip[aria-pressed="true"] b { color: var(--on-ink-2); }
.chip:disabled { opacity: .45; }

.rows li[data-cat="processing"] .st, .rows li[data-cat="queued"] .st { color: var(--muted); }
.rows li[data-cat="attention"] .st { color: var(--accent); }
.rows-empty { margin: 0; padding: 28px 16px; border: 1px dashed var(--line); border-radius: 12px; text-align: center; font-size: 13px; color: var(--muted); }

/* 批次链接 */
.group-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--soft);
}
.group-link-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 12px; line-height: 1.6; color: var(--muted); }
.group-link-text b { font-size: 13px; color: var(--ink); }
.group-link .btn { flex-shrink: 0; }

/* 在此设备上记住进度 */
.remember { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; }
.remember input { width: 16px; height: 16px; margin: 0; flex-shrink: 0; accent-color: var(--ink); cursor: pointer; }
.remember:has(input:disabled), .remember input:disabled { cursor: default; }

/* 找回订单（支持多行）与返回上次进度 */
/* 表单与找回区是 .ticket-body 里并列的两个 .panel，panel 内部的 gap 管不到它们之间，这里补上同样的节奏 */
#form + #recover-panel { margin-top: 28px; }
.recover-form { display: flex; flex-direction: column; gap: 10px; }
.recover-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 12px; }
.recover-input {
  height: auto;
  min-height: 44px;
  padding: 11px 14px;
  font-family: var(--mono);
  line-height: 1.5;
  letter-spacing: .06em;
  text-transform: uppercase;
  resize: none;
}
.recover-input::placeholder { font-family: var(--sans); letter-spacing: 0; text-transform: none; }
.resume {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px dashed var(--ink);
  border-radius: 12px;
  background: var(--soft);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  transition: background-color .15s, color .15s;
}
.resume:hover { border-style: solid; background: var(--ink); color: var(--on-ink); }

.foot {
  flex-shrink: 0;
  height: 64px;
  padding: 0 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.foot-tag { letter-spacing: .2em; }

@media (max-width: 1320px) {
  .topbar, .foot { padding: 0 40px; }
  .stage { grid-template-columns: minmax(0, 1fr) 560px; gap: 56px; padding: 48px 40px 64px; }
  html:lang(en) .hero-title h1 { font-size: clamp(48px, calc((100vw - 780px) / 4.1), 112px); }
}

@media (max-width: 960px) {
  .page-user { background-size: 24px 24px; }
  .topbar { height: auto; padding: 0 20px; flex-wrap: wrap; }
  .topbar .brand, .topbar .topnav { min-height: 60px; }
  /* 窄屏：语言切换独占一行，居中排列 */
  .lang-switch {
    order: 3;
    flex-basis: 100%;
    margin: 0;
    padding: 8px 0;
    justify-content: center;
    gap: 8px;
    border-left: 0;
    border-top: 1px solid var(--line-2);
    font-size: 12px;
  }
  .lang-icon { left: calc(50% - 60px); }
  .lang-select { width: 148px; font-size: 12px; }
  .seal-logo { width: 28px; height: 28px; font-size: 15px; }
  .brand { gap: 10px; }
  .brand-name { font-size: 15px; }
  .brand-sep, .brand-sub { display: none; }
  .topnav { gap: 18px; font-size: 13px; }
  .stage { max-width: 640px; grid-template-columns: minmax(0, 1fr); gap: 26px; padding: 28px 16px 32px; }
  .hero { gap: 0; padding: 0 4px; }
  .hero-head { gap: 14px; }
  .hero .eyebrow { font-size: 11px; }
  .hero-title { gap: 14px; }
  .hero-title h1 { font-size: 92px; }
  .chop { width: 42px; height: 42px; margin-top: 8px; padding: 5px; border-radius: 3px; font-size: 13px; }
  .hero-sub { font-size: 19px; }
  .steps { display: none; }

  .ticket { border-radius: 16px; }
  .ticket-body { min-height: 0; padding: 24px 20px; }
  .panel { gap: 22px; }
  .region-grid { gap: 8px; }
  .region { min-height: 76px; padding: 12px; gap: 8px; border-radius: 10px; }
  .region-code { font-size: 12px; }
  .radio { width: 12px; height: 12px; }
  .region-name { font-size: 15px; }
  .region-en { display: none; }
  .region-more .region-name { font-size: 14px; }
  .region-more .region-en { display: block; font-size: 11px; }
  .tabs { gap: 28px; }
  .tab { height: 44px; }
  .field { height: 56px; padding: 0 6px 0 14px; border-radius: 10px; }
  .code-input { font-size: 16px; letter-spacing: .04em; }
  .paste-btn { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .paste-btn span { display: none; }
  .textarea { min-height: 168px; padding: 14px 16px; font-size: 15px; }
  .form-error { margin-top: -10px; }
  .btn-xl { height: 56px; }

  .perf { margin: 0 20px; }
  .perf::before, .perf::after { top: -13px; width: 24px; height: 24px; }
  .perf::before { left: -33px; }
  .perf::after { right: -33px; }
  .stub { grid-template-columns: minmax(0, 1fr); padding: 20px 20px 22px; }
  .stub ul { font-size: 12px; gap: 2px; }
  .barcode { display: none; }

  .result-head { padding-right: 112px; }
  .result-title { font-size: 32px; }
  .result-title.sm { font-size: 28px; }
  .stamp { top: -4px; right: -6px; width: 104px; height: 104px; }
  .stamp-inner { width: 86px; height: 86px; gap: 3px; }
  .stamp-cn { font-size: 20px; }
  .stamp-en { font-size: 8px; }
  .stamp-date { font-size: 9px; }
  .batch-head { flex-direction: column; align-items: flex-start; gap: 16px; }
  .rows li { padding: 13px 14px; }
  .group-link { flex-direction: column; align-items: stretch; }
  .recover-row { grid-template-columns: minmax(0, 1fr); }
  .rows .code { font-size: 14px; }
  .btn-row { grid-template-columns: minmax(0, 1fr); }

  .foot { height: auto; padding: 8px 20px 28px; border-top: 0; font-size: 11px; }
  .foot-tag { letter-spacing: .16em; }

  html:lang(en) .hero-title h1 { font-size: clamp(44px, calc((100vw - 100px) / 4.1), 64px); }
}

@media (max-width: 360px) {
  .lang-switch { gap: 4px; }
  .lang-select { font-size: 11px; }
}

/* ==========================================================
   管理后台
   ========================================================== */

.page-admin { background: var(--paper); }

.login {
  min-height: 100vh;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 28px 28px;
}
.login-card {
  width: min(420px, 100%);
  padding: 36px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 1px 0 rgba(23, 22, 15, .04), 0 32px 64px -32px rgba(23, 22, 15, .28);
}
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand .brand-name { font-size: 15px; }
.login-title { margin: 12px 0 0; font-family: var(--serif); font-size: 36px; font-weight: 900; line-height: 1.15; }
.login .btn { margin-top: 4px; }

.admin { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  background: var(--ink);
  color: #E9E4D8;
}
.side-brand { padding: 0 10px; display: flex; align-items: center; gap: 12px; }
.side-brand .seal-logo { width: 34px; height: 34px; font-size: 18px; }
.side-name { font-size: 15px; font-weight: 700; color: var(--on-ink); }
.mono-tag { font-family: var(--mono); font-size: 10px; letter-spacing: .2em; color: var(--on-ink-3); }
.mono-tag.dark { color: var(--muted); }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-group { padding: 0 12px 8px; font-family: var(--mono); font-size: 10px; letter-spacing: .2em; color: #8C8676; }
.side-group.gap { padding-top: 24px; }
.side-link {
  height: 44px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 8px;
  color: var(--on-ink-2);
  font-size: 14px;
  text-decoration: none;
}
.side-link:hover { background: #221F18; color: var(--on-ink); }
.side-link[aria-current="page"] { background: #2A2820; color: var(--on-ink); font-weight: 500; }
.side-link[aria-current="page"]::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--accent);
}
.side-foot {
  margin-top: auto;
  padding: 16px 4px 0 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid #2E2C24;
}
.avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #2A2820;
  color: var(--on-ink);
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 900;
}
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.who-name { font-size: 13px; font-weight: 500; color: var(--on-ink); }
.who-sub { font-size: 11px; color: var(--on-ink-3); }
.icon-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--on-ink-2);
}
.icon-btn:hover { background: #221F18; color: var(--on-ink); }

.admin-main { min-width: 0; padding: 40px 48px 56px; }
.view { display: flex; flex-direction: column; gap: 28px; max-width: 1400px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.page-head-text { display: flex; flex-direction: column; gap: 10px; }
.crumb { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; color: var(--muted); }
.page-title { margin: 0; font-family: var(--serif); font-size: 40px; font-weight: 900; line-height: 1.1; }
.page-sub { margin: 0; font-size: 14px; color: var(--muted); }

.card {
  min-width: 0;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: var(--card);
}
.card-title { margin: 0; font-size: 17px; font-weight: 700; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px 20px; flex-wrap: wrap; }
.card-head-left { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filters .select { width: auto; min-width: 140px; }
.form { gap: 22px; }
/* 嵌在 .card 里的表单：.card 的 gap 管不到表单内部，字段要自己按同样的间距排；按钮保持自身宽度，不拉满宽卡片 */
.form-stack { display: flex; flex-direction: column; gap: 22px; }
.form-stack > .btn { align-self: flex-start; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.split { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 24px; align-items: start; }
.inline-note { padding: 12px 14px; border: 1px dashed var(--dash); border-radius: 10px; font-size: 13px; color: var(--ink-2); }

/* 生成卡密 */
.gen-grid { display: grid; grid-template-columns: minmax(360px, 440px) minmax(0, 1fr); gap: 24px; align-items: stretch; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile {
  height: 64px;
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 2px;
  border: 1px solid var(--field);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  text-align: left;
  text-decoration: none;
}
.tile:hover { border-color: var(--ink); color: var(--ink); }
.tile .c { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .14em; color: var(--muted); }
.tile .n { font-size: 14px; font-weight: 700; }
.tile[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.tile[aria-pressed="true"] .c { color: var(--on-ink-2); }
.tile-more { border-style: dashed; border-color: var(--dash); background: transparent; color: var(--muted); }
.tile-more .c { font-weight: 400; }
.tile-more .n { font-size: 12px; font-weight: 400; }
.stepper { display: flex; gap: 8px; }
.step-btn {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--field);
  border-radius: 10px;
  background: var(--white);
}
.step-btn:hover { border-color: var(--ink); }
.qty-input { text-align: center; font-family: var(--mono); font-size: 18px; font-weight: 500; }
.presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.preset {
  height: 36px;
  border: 1px solid var(--field);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
}
.preset:hover { border-color: var(--ink); }
.preset[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.btn-gen { margin-top: auto; height: 54px; padding-left: .16em; font-size: 15px; font-weight: 700; letter-spacing: .16em; }

.result-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.result-meta { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.batch-eyebrow { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .2em; color: var(--accent); }
.batch-title { margin: 0; font-family: var(--serif); font-size: 28px; font-weight: 900; line-height: 1.15; }
.pills { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); }
.pill { height: 26px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: 999px; background: var(--paper); }
.pill-time { padding-left: 4px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.code-scroll { height: 400px; overflow: auto; border-top: 1px solid var(--line-2); }
.code-grid {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  column-gap: 32px;
}
.code-grid li { display: flex; align-items: center; gap: 16px; padding: 12px 4px; border-bottom: 1px solid var(--line-3); }
.code-grid .idx { width: 28px; flex-shrink: 0; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.code-grid .code { font-family: var(--mono); font-size: 15px; font-weight: 500; letter-spacing: .06em; white-space: nowrap; }
.code-grid .expiry { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.chip-pool { border-color: var(--accent); color: var(--accent); }
.check-row { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.check-row input { width: 16px; height: 16px; margin-top: 3px; accent-color: var(--accent); }
.check-row .hint-sans { display: block; margin-top: 2px; }
.empty {
  flex: 1;
  min-height: 280px;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}
.empty .big { margin-bottom: 4px; font-family: var(--serif); font-size: 22px; font-weight: 900; color: var(--ink-2); }

/* 筛选 / 表格 */
.seg { padding: 4px; display: flex; gap: 4px; border-radius: 10px; background: var(--paper); flex-wrap: wrap; }
.seg button {
  height: 32px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--white); color: var(--ink); box-shadow: 0 1px 2px rgba(23, 22, 15, .12); }
.seg .n { font-family: var(--mono); font-size: 11px; }
.search {
  width: 280px;
  height: 40px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--field);
  border-radius: 10px;
  background: var(--white);
  color: var(--muted);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--ink); box-shadow: var(--ring); }
.search input { flex: 1; min-width: 0; padding: 0; border: 0; outline: none; background: transparent; color: var(--ink); font-size: 13px; }
.filter-pill {
  align-self: flex-start;
  height: 32px;
  padding: 0 4px 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  background: var(--paper);
  font-size: 13px;
  color: var(--ink-2);
}
.filter-pill b { font-family: var(--mono); font-weight: 500; }
.filter-pill button { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.filter-pill button:hover { background: var(--white); color: var(--ink); }

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin-bottom: 8px;
  background: var(--line-3);
  border-radius: 8px;
  font-size: 13px;
}
.bulk-check { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.bulk-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.chk { width: 32px; padding: 0 4px !important; text-align: center; }
.chk input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.tile-check { cursor: pointer; }
.tile-check input { accent-color: var(--accent); }
.tile-check:has(input:checked) { border-color: var(--accent); background: var(--white); }
.chip-sm { height: 22px; padding: 0 8px; font-size: 11px; border: 1px solid var(--line-2); border-radius: 999px; display: inline-flex; align-items: center; }

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  height: 40px;
  padding: 0 16px 0 0;
  border-bottom: 1px solid var(--line-2);
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.tbl td { height: 53px; padding: 8px 16px 8px 0; border-bottom: 1px solid var(--line-3); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; }
.tbl .r { text-align: right; }
.tbl .code { font-family: var(--mono); font-size: 14px; font-weight: 500; letter-spacing: .04em; white-space: nowrap; }
.tbl .code.sm { font-size: 13px; }
.tbl .dim { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.tbl .t { font-family: var(--mono); font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.tbl .num { font-family: var(--mono); font-size: 14px; }
.tbl .strong { font-weight: 700; }
.tbl .clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.tbl .codes-note-cell { max-width: 180px; }
.tbl .codes-note-cell .link-btn {
  display: block;
  max-width: 100%;
  height: auto;
  margin-left: -10px;
  padding: 4px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-2);
  font-weight: 400;
  text-align: left;
  cursor: pointer;
}
.filters .codes-note-select { max-width: 200px; }

/* 提取日志：备注补填 / 修改 */
.tbl .note-cell { min-width: 140px; max-width: 260px; }
.note-view { display: flex; align-items: center; gap: 4px; min-width: 0; }
.note-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.icon-link {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  opacity: 0;
  transition: opacity .15s, background-color .15s, color .15s;
}
.tbl tr:hover .icon-link, .icon-link:focus-visible { opacity: 1; }
.icon-link:hover { background: var(--paper); color: var(--ink); }
.link-btn.note-add { gap: 6px; margin-left: -10px; color: var(--muted); }
.link-btn.note-add:hover { color: var(--ink); }
.note-edit { display: flex; align-items: center; gap: 2px; }
.note-edit .input { width: 180px; height: 34px; padding: 0 10px; font-size: 13px; }
@media (hover: none) { .icon-link { opacity: 1; } }
.tbl tr.is-void .code { color: var(--muted); text-decoration: line-through; }
.tbl-empty { padding: 48px 0; text-align: center; font-size: 14px; color: var(--muted); }
.row-actions { display: inline-flex; gap: 2px; }

.chip {
  height: 26px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.chip-unused { border-color: var(--ink); background: var(--white); color: var(--ink); }
.chip-used { border-color: var(--used); background: var(--used); color: var(--ink-2); }
.chip-void { border: 1px dashed var(--accent); color: var(--accent); }
.chip-expired { border: 1px dashed var(--muted); color: var(--muted); }

.link-btn {
  height: 32px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.link-btn:hover { background: var(--paper); color: var(--ink); }
.link-btn.danger { color: var(--accent); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }
.pager:empty { display: none; }
.pager .btns { display: flex; gap: 8px; }

.switch {
  position: relative;
  width: 40px;
  height: 24px;
  padding: 0;
  flex-shrink: 0;
  border: 0;
  border-radius: 999px;
  background: var(--on-ink-2);
  transition: background-color .15s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--white);
  transition: transform .15s;
}
.switch[aria-checked="true"] { background: var(--ink); }
.switch[aria-checked="true"]::after { transform: translateX(16px); }

/* 弹窗 / 提示 */
.dlg {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 40px 80px -24px rgba(23, 22, 15, .45);
}
.dlg::backdrop { background: rgba(23, 22, 15, .4); }
.dlg form { padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.dlg-title { margin: 0; font-family: var(--serif); font-size: 24px; font-weight: 900; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* 提取记录：单日筛选、当日合计、点击一行展开该次提取的卡密 */
.filters .date-input { width: 160px; padding: 0 10px; font-family: var(--mono); font-size: 12px; }
.settle-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  margin-bottom: 12px;
  padding: 14px 18px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--soft);
  font-size: 13px;
  color: var(--ink-2);
}
.settle-summary:empty { display: none; }
.settle-summary b { font-family: var(--mono); font-size: 18px; color: var(--ink); margin-right: 4px; }
.settle-summary .range { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.tbl tr.extraction-row { cursor: pointer; }
.tbl tr.extraction-row:hover td { background: var(--soft); }
.tbl tr.extraction-row[aria-expanded="true"] td { background: var(--soft); border-bottom-color: transparent; }
.expand-caret { display: inline-block; width: 12px; color: var(--muted); transition: transform .15s; }
tr[aria-expanded="true"] .expand-caret { transform: rotate(90deg); }
.tbl td.extraction-detail-cell { height: auto; padding: 4px 0 18px 28px; background: var(--soft); }
.extraction-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 6px 24px; }
.extraction-code { display: flex; align-items: center; gap: 10px; min-height: 30px; font-size: 12px; }
.extraction-code .code { font-size: 13px; }
.extraction-code.is-void .code { color: var(--muted); text-decoration: line-through; }
.extraction-detail-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* 兑换总览：柱高 / 热度来自脚本写入的 --ratio（0–1） */
.overview { display: flex; flex-direction: column; gap: 20px; }
.overview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.overview-range { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.overview-dates { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.overview-dates .date-input { width: 150px; padding: 0 10px; font-family: var(--mono); font-size: 12px; }
.overview-scope { margin: -8px 0 0; }

.overview-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.overview-stat {
  min-width: 0;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--card);
}
.overview-stat-label { font-size: 12px; color: var(--muted); }
.overview-stat-value { font-family: var(--mono); font-size: 30px; font-weight: 500; line-height: 1.1; color: var(--ink); }
.overview-stat-sub { font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
.overview-stat.is-highlighted { border-color: var(--ink); background: var(--ink); }
.overview-stat.is-highlighted .overview-stat-label,
.overview-stat.is-highlighted .overview-stat-sub { color: var(--on-ink-2); }
.overview-stat.is-highlighted .overview-stat-value { color: var(--on-ink); }

.overview-legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.overview-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.overview-swatch { width: 10px; height: 10px; border-radius: 3px; }
.overview-swatch.is-redemptions { background: var(--used); border: 1px solid var(--dash); }
.overview-swatch.is-customers { background: var(--ink); }

.overview-chart {
  --plot-height: 220px;
  --column-gap: 4px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  grid-template-rows: var(--plot-height) auto;
  column-gap: 10px;
  row-gap: 8px;
}
.overview-chart.is-dense { --column-gap: 1px; }
.overview-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}
.overview-axis span { height: 0; line-height: 0; }
.overview-plot {
  display: flex;
  align-items: stretch;
  gap: var(--column-gap);
  border-bottom: 1px solid var(--line);
  background-image: linear-gradient(var(--line-3) 1px, transparent 1px);
  background-size: 100% 50%;
}
.overview-labels {
  grid-column: 2;
  display: flex;
  gap: var(--column-gap);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}
.overview-labels span { flex: 1 1 0; min-width: 0; text-align: center; white-space: nowrap; overflow: visible; }
.overview-column {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 4px 4px 0 0;
  background: transparent;
}
.overview-column.is-selectable:hover { background: rgba(23, 22, 15, .04); }
.overview-column.is-selectable[aria-pressed="true"] { background: rgba(184, 65, 42, .08); }
.overview-bar {
  position: absolute;
  bottom: 0;
  left: 14%;
  right: 14%;
  height: calc(var(--ratio, 0) * 100%);
  border-radius: 3px 3px 0 0;
  transition: height .2s ease;
}
.overview-bar.is-redemptions { background: var(--used); box-shadow: inset 0 0 0 1px var(--line); }
.overview-bar.is-customers { left: 32%; right: 32%; background: var(--ink); }
.overview-bar.is-hours { background: var(--ink-2); }
.overview-column.is-peak .overview-bar.is-hours { background: var(--accent); }
.overview-column.is-today .overview-bar.is-redemptions { box-shadow: inset 0 0 0 1px var(--ink); }
.overview-column[aria-pressed="true"] .overview-bar.is-customers { background: var(--accent); }
.overview-value {
  position: absolute;
  left: 50%;
  bottom: calc(var(--ratio, 0) * 100% + 4px);
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  color: var(--ink-2);
  white-space: nowrap;
  pointer-events: none;
}
.overview-column.is-peak .overview-value { color: var(--accent); font-weight: 700; }
.overview-empty-note { margin: 12px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.overview-hourly-summary { margin: 12px 0 0; }
.overview-hourly-summary b { font-family: var(--mono), var(--sans); color: var(--accent); }

/* 时段分布图（.overview-chart.is-hourly）：24 个小时槽位、时段分区底色、悬浮浮层；与每日兑换图互不影响 */
.overview-chart.is-hourly {
  --plot-pad-top: 22px;
  grid-template-rows: var(--plot-height) auto auto;
}
.overview-chart.is-hourly .overview-axis { position: relative; display: block; font-size: 11px; overflow: hidden; }
.overview-chart.is-hourly .overview-axis span {
  position: absolute;
  right: 0;
  top: calc(var(--plot-pad-top) + var(--ratio, 0) * (100% - var(--plot-pad-top) - 1px));
  height: 14px;
  line-height: 14px;
  transform: translateY(-50%);
}
.overview-chart.is-hourly .overview-plot {
  position: relative;
  padding-top: var(--plot-pad-top);
  background-size: 100% 25%;
  background-origin: content-box;
  background-clip: content-box;
}
.overview-chart.is-hourly .overview-bands {
  position: absolute;
  top: var(--plot-pad-top);
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  column-gap: var(--column-gap);
  pointer-events: none;
}
.overview-chart.is-hourly .overview-bands span { grid-column: span 6; }
.overview-chart.is-hourly .overview-bands span:nth-child(odd) { background: rgba(23, 22, 15, .035); }
.overview-chart.is-hourly .overview-column { cursor: pointer; }
/* 高亮与浮层：点击切换的 is-active、键盘焦点（:focus-visible）为主；鼠标悬停只在精确指针设备上生效，
   触屏点击后不会残留悬停高亮或浮层 */
.overview-chart.is-hourly .overview-column.is-active,
.overview-chart.is-hourly .overview-column:focus-visible {
  z-index: 2;
  background: rgba(23, 22, 15, .05);
}
@media (hover: hover) and (pointer: fine) {
  .overview-chart.is-hourly .overview-column:hover {
    z-index: 2;
    background: rgba(23, 22, 15, .05);
  }
  .overview-chart.is-hourly .overview-column:hover .overview-tip { display: block; }
}
.overview-chart.is-hourly .overview-bar.is-hours.is-empty { height: 2px; background: var(--line); }
.overview-chart.is-hourly .overview-value { font-size: 12px; }
.overview-chart.is-hourly .overview-tip {
  position: absolute;
  bottom: calc(var(--ratio, 0) * 100% + 22px);
  left: 50%;
  z-index: 3;
  display: none;
  transform: translateX(-50%);
  padding: 5px 9px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--on-ink);
  font-family: var(--mono), var(--sans);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
}
.overview-chart.is-hourly .overview-tip-part { white-space: nowrap; }
.overview-chart.is-hourly .overview-column.is-tip-start .overview-tip { left: 0; transform: none; }
.overview-chart.is-hourly .overview-column.is-tip-end .overview-tip { left: auto; right: 0; transform: none; }
.overview-chart.is-hourly .overview-column.is-active .overview-tip,
.overview-chart.is-hourly .overview-column:focus-visible .overview-tip { display: block; }
.overview-chart.is-hourly .overview-hourly-hours,
.overview-chart.is-hourly .overview-hourly-periods {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  column-gap: var(--column-gap);
  text-align: center;
}
.overview-chart.is-hourly .overview-hourly-hours {
  grid-row: 2;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 16px;
  color: var(--ink-2);
  white-space: nowrap;
}
.overview-chart.is-hourly .overview-hourly-periods { grid-row: 3; }
.overview-chart.is-hourly .overview-hour-period {
  grid-column: span 6;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 16px;
  color: var(--ink-2);
  white-space: nowrap;
}
.overview-chart.is-hourly .overview-hour-period-range { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.overview-table td, .overview-table th { white-space: nowrap; }
.overview-table th:last-child, .overview-table td:last-child { width: 46%; min-width: 280px; }
.tbl tr.overview-row { cursor: pointer; }
.tbl tr.overview-row:hover td { background: var(--soft); }
.tbl tr.overview-row[aria-selected="true"] td { background: rgba(184, 65, 42, .07); }
.overview-today { height: 20px; margin-left: 6px; padding: 0 6px; font-size: 11px; }
.overview-strip, .overview-strip-axis { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 2px; }
.overview-strip span { position: relative; height: 20px; overflow: hidden; border-radius: 3px; background: var(--line-3); }
.overview-strip span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  opacity: var(--ratio, 0);
}
.overview-strip-axis span { font-family: var(--mono); font-size: 10px; font-weight: 400; white-space: nowrap; overflow: visible; }

@media (max-width: 860px) {
  .overview-chart { --plot-height: 180px; --column-gap: 2px; grid-template-columns: 32px minmax(0, 1fr); column-gap: 6px; }
  .overview-chart.is-dense { --column-gap: 0px; }
  .overview-value { display: none; }
  .overview-labels span:nth-child(even) { visibility: hidden; }
  .overview-stat-value { font-size: 24px; }
}

/* 时段图的窄屏规则（≤860px）：
   - 小时标签只显示 00、02…22（第 1 个子元素是 00，所以隐藏 nth-child(even)），位置仍与柱子对齐
   - 浮层：分段纵向排列（每段一行），00–11 列左对齐、12–23 列右对齐，不超出卡片
   - 柱顶数值只显示峰值柱，并与浮层同样左右对齐 */
@media (max-width: 860px) {
  .overview-chart.is-hourly .overview-hourly-hours span:nth-child(even) { visibility: hidden; }
  .overview-chart.is-hourly .overview-hour-period-range { display: none; }
  .overview-chart.is-hourly .overview-value { display: none; }
  .overview-chart.is-hourly .overview-column.is-peak .overview-value { display: block; }
  /* 浮层改为分段纵向排列：每段独占一行，盒子按最宽一段取宽，深色底完整包住全部文字 */
  .overview-chart.is-hourly .overview-tip { width: max-content; max-width: none; white-space: normal; }
  .overview-chart.is-hourly .overview-tip-part { display: block; }
  .overview-chart.is-hourly .overview-tip-part:nth-child(2) { white-space: normal; overflow-wrap: anywhere; }
  .overview-chart.is-hourly .overview-column.is-narrow-tip-start .overview-tip,
  .overview-chart.is-hourly .overview-column.is-narrow-tip-start .overview-value { left: 0; right: auto; transform: none; }
  .overview-chart.is-hourly .overview-column.is-narrow-tip-end .overview-tip,
  .overview-chart.is-hourly .overview-column.is-narrow-tip-end .overview-value { left: auto; right: 0; transform: none; }
}

/* 320–400 宽：日期工具栏占满一行，两个日期框等分宽度，避免固定 150px 撑出横向滚动 */
@media (max-width: 400px) {
  .overview-range { width: 100%; }
  .overview-dates { width: 100%; }
  .overview-dates .date-input { flex: 1 1 0; min-width: 0; width: auto; }
}

/* 用户页「兑换须知」弹窗：标题与底部操作固定，正文区域单独滚动 */
.notice-dlg {
  width: min(600px, calc(100vw - 32px));
  max-height: min(760px, calc(100dvh - 48px));
  overflow: hidden;
}
.notice-dlg[open] { display: flex; flex-direction: column; }
.notice-dlg .notice-dlg-form {
  flex: 1;
  min-height: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.notice-dlg-head {
  flex-shrink: 0;
  padding: 26px 28px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line-2);
}
.notice-dlg-heading { display: flex; flex-direction: column; gap: 8px; }
.notice-dlg-close {
  width: 40px;
  height: 40px;
  margin: -6px -10px 0 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  transition: background-color .15s, color .15s;
}
.notice-dlg-close:hover { background: var(--soft); color: var(--ink); }
.notice-dlg-body {
  flex: 1;
  min-height: 0;
  padding: 20px 28px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.notice-dlg-body:focus { outline: none; }
.notice-section h3 { margin: 0 0 8px; font-size: 15px; font-weight: 700; color: var(--ink); }
.notice-section ol {
  margin: 0;
  padding-left: 1.4em;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-2);
}
.notice-section li::marker { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.notice-dlg-foot {
  flex-shrink: 0;
  padding: 16px 28px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line-2);
}
@media (max-width: 960px) {
  .notice-dlg { max-height: calc(100dvh - 32px); }
  .notice-dlg-head { padding: 20px 20px 14px; }
  .notice-dlg-body { padding: 16px 20px 20px; gap: 18px; }
  .notice-section ol { font-size: 13px; }
  .notice-dlg-foot { padding: 14px 20px 18px; flex-wrap: wrap; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 50;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 14px;
  box-shadow: 0 16px 32px -12px rgba(23, 22, 15, .4);
  transform: translateX(-50%);
}
.toast.is-error { background: var(--accent); }

/* ---------- 令牌导出组件 ---------- */
.token-export { display: flex; flex-direction: column; gap: 12px; }
.token-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 20px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
}
.token-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.token-title { margin: 0; font-size: 16px; font-weight: 500; color: var(--ink); }
.token-list {
  margin: 0;
  padding: 0 4px 0 0;
  list-style: none;
  max-height: 232px;
  overflow-y: auto;
  border-top: 1px solid var(--line-3);
  scrollbar-width: thin;
  scrollbar-color: var(--dash) transparent;
}
.token-list::-webkit-scrollbar { width: 6px; }
.token-list::-webkit-scrollbar-thumb { background: var(--dash); border-radius: 3px; }
.token-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--line-3);
}
.token-check { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); }
.token-index { min-width: 1.5em; font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; }
.token-text {
  overflow-x: auto;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
  scrollbar-width: none;
}
.token-text::-webkit-scrollbar { display: none; }
.token-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink-2);
  font-size: 12px;
  cursor: pointer;
}
.token-copy:hover { border-color: var(--ink); color: var(--ink); }
.token-status { margin: 0; padding: 18px 0; font-size: 13px; color: var(--muted); text-align: center; }
.token-status.is-warning { padding: 0; color: var(--accent); text-align: left; }
.token-status.is-error { color: var(--accent); }
.token-hint, .token-subhint { margin: 0; font-size: 12px; color: var(--muted); }
.token-subhint { margin-top: -4px; text-align: center; }
.token-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) {
  .token-actions { grid-template-columns: minmax(0, 1fr); }
  .token-card { padding: 14px; }
}

@media (max-width: 1180px) {
  .gen-grid, .split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .admin { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: static;
    height: auto;
    padding: 12px 16px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
  }
  .side-brand { padding: 0; }
  .side-nav { order: 3; flex: 1 1 100%; flex-direction: row; overflow-x: auto; }
  .side-group { display: none; }
  .side-link { flex-shrink: 0; }
  .side-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .who { display: none; }
  .admin-main { padding: 24px 16px 40px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-title { font-size: 32px; }
  .card { padding: 20px; }
  .search { width: 100%; }
}

/* 兑换码查询（管理后台与分销商中心共用，组件见 code-lookup.js） */
.lookup { display: flex; flex-direction: column; gap: 28px; }
.lookup-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lookup-input { flex: 1 1 320px; max-width: 480px; }
.lookup-result { display: flex; flex-direction: column; gap: 28px; }
.lookup-result:empty { display: none; }
.lookup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.lookup-code-value { font-size: 22px; font-weight: 500; letter-spacing: .08em; overflow-wrap: anywhere; }
.lookup-kv { margin: 0; display: grid; grid-template-columns: 96px minmax(0, 1fr); border-top: 1px solid var(--line-2); font-size: 13px; }
.lookup-kv dt, .lookup-kv dd { margin: 0; padding: 11px 0; border-bottom: 1px solid var(--line-3); }
.lookup-kv dt { color: var(--muted); }
.lookup-kv dd { min-width: 0; overflow-wrap: anywhere; }
.lookup-kv .dim, .timeline .dim { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.lookup-kv .sm { font-size: 12px; }
.lookup-flag { margin-left: 6px; font-size: 12px; color: var(--accent); }
.tbl .dim.wrap { white-space: normal; }
.tbl .nowrap { white-space: nowrap; }
.tbl .lookup-reason { min-width: 160px; max-width: 220px; }

.timeline { margin: 0; padding: 0; list-style: none; }
.tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  gap: 4px 20px;
  padding: 0 0 18px 22px;
}
.tl-item::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: -2px; width: 1px; background: var(--line); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item:last-child::before { display: none; }
.tl-dot { position: absolute; left: 0; top: 5px; width: 11px; height: 11px; border: 2px solid var(--ink-2); border-radius: 50%; background: var(--card); }
.tl-item.tone-ok .tl-dot { border-color: #2F7D4F; background: #2F7D4F; }
.tl-item.tone-warn .tl-dot { border-color: #B7791F; background: #FBF3E2; }
.tl-item.tone-error .tl-dot { border-color: var(--accent); background: var(--accent); }
.tl-item.tone-pending .tl-dot { border-style: dashed; border-color: var(--muted); }
.tl-time { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--ink-2); }
.tl-gap { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.tl-body { min-width: 0; }
.tl-title { font-size: 14px; font-weight: 600; }
.tl-offset { margin-left: 8px; font-size: 12px; font-weight: 400; color: var(--muted); }
.tl-detail { margin-top: 2px; font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.tl-item.tone-warn .tl-title { color: #8A5A12; }
.tl-item.tone-error .tl-title { color: var(--accent); }

@media (max-width: 1180px) {
  .lookup-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .tl-item { grid-template-columns: minmax(0, 1fr); }
  .tl-time { flex-direction: row; gap: 8px; align-items: baseline; }
  .lookup-kv { grid-template-columns: 80px minmax(0, 1fr); }
}

/* ==========================================================
   用户兑换页：客户兑换码池（组件见 code-pool.js）
   电脑端放在左栏（三步说明下方），兑换卡片跨两行；
   ≤960px 单列时排在兑换卡片下方，默认收起，点标题展开。
   ========================================================== */
.stage > .hero { grid-column: 1; grid-row: 1; }
.stage > .ticket { grid-column: 2; grid-row: 1 / span 2; }
.stage > .pool { grid-column: 1; grid-row: 2; }
.stage { row-gap: 40px; }

.pool {
  min-width: 0;
  max-width: 640px;
  padding: 24px 28px;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: var(--card);
}
.pool-head {
  width: 100%;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  text-align: left;
  pointer-events: none;
}
.pool-head-text { min-width: 0; flex: 1; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pool-title { font-size: 17px; font-weight: 700; }
.pool-sub { font-size: 12px; color: var(--muted); }
.pool-total { flex-shrink: 0; padding: 3px 10px; border-radius: 999px; background: var(--soft); font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.pool-caret { display: none; flex-shrink: 0; color: var(--muted); transition: transform .15s; }
.pool-body { margin-top: 18px; display: flex; flex-direction: column; gap: 18px; }

.pool-import { display: flex; flex-direction: column; gap: 10px; }
.pool-textarea { min-height: 112px; padding: 12px 16px; font-size: 14px; line-height: 1.6; }
.pool-import-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pool-message { margin: 0; font-size: 13px; color: var(--ink-2); }
.pool-message.is-error { color: var(--accent); }
.pool-rejects { padding: 12px 14px; border: 1px dashed var(--dash); border-radius: 10px; font-size: 13px; }
.pool-rejects-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.pool-rejects ol { max-height: 200px; margin: 0; padding: 0; overflow: auto; list-style: none; }
.pool-rejects li { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 4px 14px; padding: 5px 0; border-bottom: 1px solid var(--line-3); }
.pool-rejects li:last-child { border-bottom: 0; }
.pool-rejects li > span:last-child { color: var(--accent); }

.pool-regions { display: flex; flex-direction: column; border-top: 1px solid var(--line-2); }
.pool-region {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 76px auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-3);
}
.pool-region-name { min-width: 0; font-size: 15px; }
.pool-region-name .mono { font-size: 12px; color: var(--muted); }
.pool-region-left { font-family: var(--mono); font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.pool-qty { height: 44px; padding: 0 10px; text-align: center; font-family: var(--mono); }
.pool-hint { margin: 10px 0 0; }
.pool-empty { margin: 14px 0 0; font-size: 13px; line-height: 1.7; color: var(--muted); }

.pool-lists { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.pool-list-toggle { margin-left: -10px; }
.pool-list { width: 100%; max-height: 460px; overflow: auto; border-top: 1px solid var(--line-2); }
.pool-used-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 0; }
.pool-clear { color: var(--accent); }
.pool-rows { margin: 0; padding: 0; list-style: none; }
.pool-rows li { display: flex; flex-direction: column; gap: 4px; padding: 10px 2px; border-bottom: 1px solid var(--line-3); }
.pool-row-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pool-code { font-size: 14px; font-weight: 500; letter-spacing: .04em; }
.pool-chip { padding: 1px 7px; border: 1px solid var(--line-2); border-radius: 999px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.pool-result { font-size: 12px; color: var(--ink-2); }
.pool-result.is-done { color: #2F7D4F; }
.pool-result.is-bad { color: var(--accent); }
.pool-row-meta { display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.pool-row-meta .link-btn, .pool-row-note .link-btn { height: 26px; padding: 0 8px; font-size: 12px; }
.pool-row-note { font-size: 13px; }
.pool-note { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--ink-2); }
.pool-note-text { overflow-wrap: anywhere; }
.pool-note-add { margin-left: -8px; color: var(--muted); }
.pool-unsynced { font-size: 11px; color: var(--accent); }
.pool-note-edit { display: flex; gap: 6px; align-items: center; }
.pool-note-edit .input { height: 36px; font-size: 13px; }
.pool-note-edit .btn { height: 36px; flex-shrink: 0; }
.pool-tokens { width: 100%; }

@media (max-width: 1320px) {
  .stage { row-gap: 32px; }
}

@media (max-width: 960px) {
  .stage > .hero, .stage > .ticket, .stage > .pool { grid-column: auto; grid-row: auto; }
  .stage { row-gap: 26px; }
  .pool { max-width: none; padding: 18px 20px; }
  .pool-head { pointer-events: auto; cursor: pointer; }
  .pool-caret { display: block; }
  .pool:not(.is-collapsed) .pool-caret { transform: rotate(180deg); }
  .pool.is-collapsed .pool-body { display: none; }
  .pool-region { grid-template-columns: minmax(0, 1fr) auto; }
  .pool-qty { grid-column: 1; justify-self: start; width: 96px; }
  .pool-extract { grid-column: 2; }
  .pool-note-edit { flex-wrap: wrap; }
  .pool-note-edit .input { flex: 1 1 100%; }
}

/* 分销商中心：每日提取（按地区） */
.daily-tbl td.is-zero { color: var(--muted); }
.daily-tbl tr.is-today td { background: var(--soft); }
.daily-tbl .chip-sm { margin-left: 6px; font-family: var(--sans); }
.daily-tbl tfoot td {
  height: 48px;
  border-top: 1px solid var(--line-2);
  border-bottom: 0;
  font-weight: 700;
}
.daily-tbl tfoot td.num { font-weight: 700; }
/* 手机上表格横向滚动时，日期列固定在左侧 */
.daily-tbl th:first-child,
.daily-tbl td:first-child { position: sticky; left: 0; z-index: 1; background: var(--card); }
.daily-tbl tr.is-today td:first-child { background: var(--soft); }

/* ---------- 兑换页用户账号 ---------- */
.account-slot { position: relative; flex-shrink: 0; margin-left: 32px; display: flex; align-items: center; }
.account-entry {
  min-height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.account-entry:hover { border-color: var(--ink); background: var(--soft); }
.account-entry .i { color: var(--muted); }
.account-label-short { display: none; }
.account-name { max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-wrap { position: relative; }
.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  min-width: 200px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 20px 40px -20px rgba(23, 22, 15, .35);
}
.account-menu[hidden] { display: none; }
.account-menu-email { margin: 0; padding: 8px 10px 10px; border-bottom: 1px solid var(--line-3); font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.account-menu button, .account-menu a {
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.account-menu a { display: flex; align-items: center; text-decoration: none; }
.account-menu button:hover, .account-menu a:hover { background: var(--soft); color: var(--ink); }

.account-dlg { width: min(440px, calc(100vw - 32px)); }
.account-dlg .account-form { padding: 24px 28px 28px; gap: 16px; }
.account-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-body { display: flex; flex-direction: column; gap: 14px; }
.account-sub { margin: 0; font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.account-field { display: flex; flex-direction: column; gap: 6px; }
.account-field .input { height: 44px; }
.account-msg { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.account-msg.is-error { color: var(--accent); }
.account-msg[hidden] { display: none; }
.account-submit { width: 100%; }
.account-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin: -4px -10px 0; }
.account-foot .link-btn { font-size: 13px; color: var(--ink-2); }
.account-foot .link-btn:disabled { color: var(--muted); cursor: default; }

.pool-banner { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); font-size: 13px; line-height: 1.6; }
.pool-banner[hidden] { display: none; }
.pool-banner p { margin: 0; color: var(--ink-2); }
.pool-banner-actions { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 960px) {
  .account-slot { margin-left: 12px; }
  .account-entry { min-height: 36px; padding: 0 8px; gap: 4px; font-size: 12px; }
  .account-entry .i { width: 14px; height: 14px; }
  .account-label-full, .account-caret { display: none; }
  .account-label-short { display: inline; }
  .account-name { max-width: 6em; }
  .account-dlg .account-form { padding: 20px; }
}

/* 后台：用户账号 */
.acct-setting-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.acct-setting-row p { margin: 4px 0 0; }
.acct-smtp { margin: 0; font-size: 13px; line-height: 1.7; color: var(--ink-2); overflow-wrap: anywhere; }
.acct-inline-form { display: flex; gap: 8px; }
.acct-inline-form .input { flex: 1; min-width: 0; }
.acct-domains { display: flex; flex-wrap: wrap; gap: 6px; }
.acct-domain { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--soft); font-size: 12px; }
.acct-domain button { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.acct-domain button:hover { background: var(--line-2); color: var(--accent); }
.ok-text { color: #2F7A3D; }
.warn-text { color: var(--accent); }
.owner-input { width: 160px; }
.owner-input[hidden] { display: none; }
.owner-link { height: auto; padding: 2px 6px; margin-left: -6px; font-family: var(--mono); font-size: 12px; }
.user-dlg { width: min(860px, calc(100vw - 32px)); }
.user-dlg .ud-tabs { align-self: flex-start; }
.ud-body { max-height: min(56vh, 520px); overflow: auto; }
.ud-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.acct-smtp-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; padding: 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--soft); }
.acct-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.acct-field .input, .acct-field .select { width: 100%; }
.acct-field-wide { grid-column: 1 / -1; }
.acct-smtp-form > .hint-sans { margin: 0; }
.acct-smtp-actions { display: flex; gap: 8px; }
.acct-smtp-actions [hidden] { display: none; }

/* 上游全量暂停：兑换页顶部提示；后台健康面板警示色 */
.service-banner { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-bottom: 1px solid #E8C9A6; background: #FBF1E4; color: #8A4B12; font-size: 14px; font-weight: 500; text-align: center; }
.service-banner[hidden] { display: none; }
.health-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.health-bar .inline-note { flex: 1 1 320px; margin: 0; }
.lookup-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-3); }
.inline-note.is-warning { border-color: #E8C9A6; background: #FBF1E4; color: #8A4B12; }

/* ==========================================================
   个人中心（/account）
   ========================================================== */

.center { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 48px 40px 64px; display: flex; flex-direction: column; gap: 24px; }
.center-head { display: flex; flex-direction: column; gap: 8px; }
.center-title { margin: 0; font-family: var(--serif); font-size: 40px; font-weight: 900; line-height: 1.15; }
.center-who { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.center-who b { color: var(--ink); font-size: 16px; }
.center-tabs { overflow-x: auto; scrollbar-width: none; }
.center-tabs::-webkit-scrollbar { display: none; }
.center-tabs .tab { flex-shrink: 0; }
.center-panel { min-width: 0; }

.ac-h2 { margin: 0; font-family: var(--serif); font-size: 20px; font-weight: 900; }
.ac-empty { margin: 0; padding: 40px 16px; border: 1px dashed var(--line); border-radius: 12px; background: var(--card); text-align: center; font-size: 14px; color: var(--muted); }
.ac-dim { color: var(--muted); }

/* 概览 */
.ac-ov { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.ac-ov-group { display: flex; flex-direction: column; gap: 14px; padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.ac-ov-group .hint-sans { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ac-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ac-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--white); text-align: left; transition: border-color .15s; }
.ac-stat:hover { border-color: var(--ink); }
.ac-stat-n { font-size: 28px; font-weight: 500; line-height: 1.1; }
.ac-stat-label { font-size: 13px; color: var(--ink-2); }
.ac-stat.is-bad .ac-stat-n { color: var(--accent); }
.ac-stat.is-muted .ac-stat-n { color: var(--muted); }

/* 列表：筛选、搜索、批量操作 */
.ac-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.ac-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.ac-filter { height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: var(--ink-2); font-size: 13px; font-weight: 500; }
.ac-filter:hover { border-color: var(--ink); }
.ac-filter[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.ac-search { width: 280px; max-width: 100%; }
.ac-actions { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--card); }
.ac-check-all { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.ac-selected { font-size: 12px; color: var(--muted); }
.ac-action-btns { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.ac-action-btns .btn-sm { height: 34px; padding: 0 12px; border-radius: 8px; }
.ac-danger { color: var(--accent); }
.ac-danger:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.ac-auto { margin: 10px 0 0; }
.ac-table-wrap { margin-top: 14px; padding: 4px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow-x: auto; transition: opacity .15s; }
.ac-table-wrap:has(> .ac-empty) { padding: 0; border: 0; background: transparent; }
.ac-table-wrap.is-stale { opacity: .6; }
.ac-table td { height: 48px; }
.ac-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--ink); }
.ac-cell-check { width: 36px; }
.ac-code { font-size: 13px; font-weight: 500; letter-spacing: .04em; white-space: nowrap; }
.ac-time { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.ac-table tr.is-dead .ac-code { color: var(--muted); }
.ac-table tr.is-open td { border-bottom-color: transparent; }
.ac-note-cell { max-width: 220px; }
.ac-note { max-width: 100%; height: auto; margin-left: -10px; padding: 4px 10px; display: block; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); font-weight: 400; text-align: left; }
.ac-note.is-empty { color: var(--muted); }
.ac-order-btn { height: auto; margin-left: -10px; padding: 4px 10px; font-size: 12px; text-decoration: underline; text-decoration-color: var(--dash); text-underline-offset: 4px; }
.ac-order-btn[aria-expanded="true"] { background: var(--paper); text-decoration: none; }
.ac-pager { margin-top: 14px; display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 12px; color: var(--muted); }
.ac-pager:empty { display: none; }

/* 状态标签 */
.ac-badge { height: 24px; padding: 0 10px; display: inline-flex; align-items: center; border: 1px solid transparent; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.ac-badge.is-open { border-color: var(--ink); background: var(--white); color: var(--ink); }
.ac-badge.is-done { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.ac-badge.is-run { border-color: var(--line); background: var(--soft); color: var(--ink-2); }
.ac-badge.is-warn { border: 1px dashed #C98A3F; color: #8A4B12; }
.ac-badge.is-bad { border: 1px dashed var(--accent); color: var(--accent); }
.ac-badge.is-muted { border: 1px dashed var(--muted); color: var(--muted); }

/* 订单详情：展开在订单行下方 */
.ac-detail-row td { height: auto; padding: 0 0 16px; }
.ac-detail { display: flex; flex-direction: column; gap: 16px; padding: 16px 18px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--white); }
.ac-detail-head { display: flex; flex-direction: column; gap: 4px; }
.ac-detail-head p { margin: 0; }
.ac-detail-label { font-size: 15px; font-weight: 700; }
.ac-detail-msg { margin: 0; font-size: 13px; color: var(--muted); }
.ac-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ac-tokens { max-width: 640px; }

/* 账号安全 */
.ac-sec { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 24px; align-items: start; }
.ac-card { display: flex; flex-direction: column; gap: 14px; padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.ac-card .hint-sans { margin: 0; }
.ac-kv { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.ac-kv div { display: flex; flex-direction: column; gap: 2px; }
.ac-kv dt { font-size: 12px; color: var(--muted); }
.ac-kv dd { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.ac-sec-form .input { height: 44px; }
.ac-sec-form .btn { align-self: flex-start; min-width: 120px; }

.center-dlg { width: min(440px, calc(100vw - 32px)); }
.center-note-form .hint-sans { margin: 0; }
.center-note-form #note-dlg-code { font-family: var(--mono); letter-spacing: .04em; color: var(--ink-2); }

@media (max-width: 960px) {
  .center { padding: 24px 16px 40px; gap: 18px; }
  .center-title { font-size: 30px; }
  .center-tabs { gap: 22px; }
  .ac-ov, .ac-sec { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .ac-ov-group, .ac-card { padding: 18px; }
  .ac-search { width: 100%; }
  .ac-action-btns { margin-left: 0; width: 100%; }
}

/* 窄屏：表格改成卡片，每格前面显示列名 */
@media (max-width: 760px) {
  .ac-stats { gap: 8px; }
  .ac-stat { padding: 12px; }
  .ac-stat-n { font-size: 22px; }
  .ac-table-wrap { padding: 0; border: 0; background: transparent; overflow: visible; }
  .ac-table thead { display: none; }
  .ac-table, .ac-table tbody { display: block; }
  .ac-table tbody tr { position: relative; display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; padding: 14px 14px 14px 46px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
  .ac-table tbody tr.is-open { margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .ac-table td { height: auto; padding: 0; border: 0; display: flex; align-items: baseline; gap: 10px; min-width: 0; }
  .ac-table td[data-label]::before { content: attr(data-label); flex-shrink: 0; width: 5.5em; font-size: 12px; color: var(--muted); }
  .ac-table td.ac-cell-check { position: absolute; top: 14px; left: 14px; width: auto; }
  .ac-table .ac-note-cell { max-width: none; }
  .ac-note, .ac-order-btn { margin-left: -10px; }
  .ac-table tbody tr.ac-detail-row { margin-top: 0; padding: 0; border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
  .ac-detail-row td { display: block; }
  .ac-detail { border: 0; }
}

/* 后台用户详情：账号管理 */
.ud-manage { display: flex; flex-direction: column; gap: 14px; padding: 4px 2px 8px; }
.ud-manage .inline-note { margin: 0; }
.ud-block { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--white); }
.ud-block.is-danger { border-color: #E7C3BA; }
.ud-block .hint-sans { margin: 0; }
.ud-block-title { margin: 0; font-size: 14px; font-weight: 700; }
.ud-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.ud-note-form { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.ud-note-form .area { min-height: 72px; }
.user-note { display: block; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
