/* 基础样式与通用组件 / Base styles and shared components
   不含任何内联样式依赖，不引用外部资源。 */

*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: var(--lh-body);
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
html[data-lang="zh"] h1, html[data-lang="zh"] h2, html[data-lang="zh"] h3, html[data-lang="zh"] h4 { letter-spacing: 0; line-height: 1.4; }
p { margin: 0; }
a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
hr { border: 0; border-top: 1px solid var(--c-line); margin: 24px 0; }
code, .mono { font-family: var(--font-mono); font-size: 0.9em; }
code { background: var(--c-bg-sunk); padding: 1px 6px; border-radius: 4px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }

[hidden] { display: none !important; }

/* —— 双语显示：同一处文案写两份，按 <html data-lang> 只显示一份 ——
   Bilingual text: both languages live in the markup, CSS shows one. */
html[data-lang="en"] body [lang="zh-CN"],
html[data-lang="zh"] body [lang="en"] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* —— 图标 / Icons（内联 SVG sprite，stroke 跟随文字颜色） —— */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i {
  width: 1.25em; height: 1.25em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -0.2em;
}
.i--sm { width: 1em; height: 1em; }
.i--lg { width: 1.75em; height: 1.75em; }
.i--xl { width: 2.5em; height: 2.5em; }

/* —— 按钮 / Buttons —— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--r-md);
  background: var(--c-bg); color: var(--c-ink);
  font-weight: 600; font-size: 14px; line-height: 1; white-space: nowrap;
  cursor: pointer; text-decoration: none;
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { box-shadow: var(--focus); }
.btn--primary { background: var(--c-accent); color: var(--c-accent-ink); }
.btn--primary:hover { background: var(--c-accent-hover); }
.btn--secondary { border-color: var(--c-line-strong); background: var(--c-bg); }
.btn--secondary:hover { background: var(--c-bg-soft); border-color: var(--c-ink-3); }
.btn--ghost { color: var(--c-ink-2); }
.btn--ghost:hover { background: var(--c-bg-sunk); }
.btn--danger { background: var(--c-bad); color: #fff; }
.btn--danger:hover { background: #a32c23; }
.btn--danger-ghost { border-color: #e6b8b4; color: var(--c-bad); background: var(--c-bg); }
.btn--danger-ghost:hover { background: var(--c-bad-soft); }
.btn--lg { height: 48px; padding: 0 24px; font-size: 16px; border-radius: 12px; }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn--block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn.is-loading { pointer-events: none; opacity: .85; }
.link-btn { background: none; border: 0; padding: 0; color: var(--c-accent); cursor: pointer; font-weight: 600; }
.link-btn:hover { text-decoration: underline; }
.link-btn[disabled] { color: var(--c-ink-3); cursor: not-allowed; text-decoration: none; }

/* —— 加载 / Loading —— */
.spin {
  width: 1em; height: 1em; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
.spin--lg { width: 40px; height: 40px; border-width: 3px; color: var(--c-accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.skel {
  display: block; border-radius: 6px;
  background: linear-gradient(90deg, var(--c-bg-sunk) 25%, #f4f8f7 37%, var(--c-bg-sunk) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite;
}
.skel--line { height: 12px; margin: 8px 0; }
.skel--title { height: 20px; width: 60%; margin: 10px 0; }
.skel--short { width: 40%; }
.skel--mid { width: 75%; }
.skel--cover { aspect-ratio: 16 / 10; border-radius: 12px; }
.skel--btn { height: 40px; width: 140px; border-radius: 10px; }
.skel--pill { height: 22px; width: 64px; border-radius: 99px; }
.skel--square { width: 48px; height: 48px; border-radius: 10px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) {
  .skel, .spin { animation-duration: 3s; }
}

/* —— 表单 / Forms —— */
.field { display: grid; gap: 6px; align-content: start; }
.label { font-size: 13px; font-weight: 600; color: var(--c-ink-2); }
.label .req { color: var(--c-bad); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--c-line-strong); border-radius: var(--r-md);
  background: var(--c-bg); font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 120px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: #8a9997; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--c-ink-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--c-accent); box-shadow: var(--focus); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--c-bad); background: #fffafa; }
.input[readonly] { background: var(--c-bg-soft); color: var(--c-ink-2); }
.input[disabled] { background: var(--c-bg-sunk); color: var(--c-ink-3); cursor: not-allowed; }
.select { appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--c-ink-3) 50%), linear-gradient(135deg, var(--c-ink-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px;
  background-size: 5px 5px; background-repeat: no-repeat; }
.help { font-size: 12.5px; color: var(--c-ink-3); }
.err-msg { font-size: 12.5px; color: var(--c-bad); display: flex; gap: 6px; align-items: flex-start; }
.input-group { display: flex; }
.input-group .addon {
  display: inline-flex; align-items: center; padding: 0 12px;
  border: 1px solid var(--c-line-strong); border-right: 0;
  border-radius: var(--r-md) 0 0 var(--r-md); background: var(--c-bg-soft);
  color: var(--c-ink-3); font-size: 14px;
}
.input-group .input { border-radius: 0 var(--r-md) var(--r-md) 0; }
.input--code {
  height: 56px; text-align: center; font-family: var(--font-mono);
  font-size: 28px; letter-spacing: .5em; padding-left: .5em;
}
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--c-accent); }
.dropzone {
  display: grid; justify-items: center; gap: 6px; text-align: center;
  padding: 24px 16px; border: 1.5px dashed var(--c-line-strong);
  border-radius: var(--r-md); background: var(--c-bg-soft); color: var(--c-ink-2);
}
.dropzone .i { color: var(--c-ink-3); }
.form-grid { display: grid; gap: 16px; }
.form-grid--2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .form-grid--2 { grid-template-columns: 1fr; } }

/* —— 徽标、提示、卡片 / Badges, alerts, cards —— */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px;
  border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--c-bg-sunk); color: var(--c-ink-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge--nodot::before { display: none; }
.badge--ok { background: var(--c-ok-soft); color: var(--c-ok); }
.badge--warn { background: var(--c-warm-soft); color: var(--c-warm); }
.badge--bad { background: var(--c-bad-soft); color: var(--c-bad); }
.badge--info { background: var(--c-info-soft); color: var(--c-info); }
.badge--accent { background: var(--c-accent-soft); color: var(--c-accent); }

.alert {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px;
  border: 1px solid; border-radius: var(--r-md); font-size: 14px;
}
.alert .i { margin-top: 2px; }
.alert__title { font-weight: 700; }
.alert__body { flex: 1; min-width: 0; }
.alert__act { margin-top: 8px; display: flex; gap: 12px; flex-wrap: wrap; }
.alert--info { background: var(--c-info-soft); border-color: #c5d6f7; color: #1b3f8f; }
.alert--ok { background: var(--c-ok-soft); border-color: #bfe3cd; color: #115c35; }
.alert--warn { background: var(--c-warm-soft); border-color: #f1d4a8; color: #8a3f06; }
.alert--bad { background: var(--c-bad-soft); border-color: #f1c3bf; color: #8f241c; }

.card { background: var(--c-bg); border: 1px solid var(--c-line); border-radius: var(--r-lg); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--c-line); }
.card__title { font-size: 16px; }
.card__body { padding: 20px; }
.card__foot { padding: 14px 20px; border-top: 1px solid var(--c-line); background: var(--c-bg-soft); border-radius: 0 0 var(--r-lg) var(--r-lg); }

.empty {
  display: grid; justify-items: center; gap: 10px; text-align: center;
  padding: 56px 24px; color: var(--c-ink-2);
}
.empty__icon {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
  background: var(--c-accent-soft); color: var(--c-accent); font-size: 28px;
}
.empty--bad .empty__icon { background: var(--c-bad-soft); color: var(--c-bad); }
.empty__title { font-size: 18px; font-weight: 700; color: var(--c-ink); }
.empty__text { max-width: 44ch; }

.toast {
  display: inline-flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: var(--c-ink); color: #fff; border-radius: var(--r-md);
  box-shadow: var(--sh-2); font-size: 14px;
}
.toast .i { color: #6fe0a6; }
.toast--bad .i { color: #ff9b92; }
.toast-dock { position: fixed; top: 76px; right: 20px; z-index: 40; }
@media (max-width: 720px) { .toast-dock { left: 16px; right: 16px; } .toast { width: 100%; } }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(15, 35, 33, .55);
}
.modal { width: min(480px, 100%); background: var(--c-bg); border-radius: var(--r-lg); box-shadow: var(--sh-3); }
.modal__head { padding: 20px 24px 0; }
.modal__body { padding: 12px 24px 20px; display: grid; gap: 14px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--c-line); }

.progress { height: 8px; border-radius: 99px; background: var(--c-bg-sunk); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--c-accent); border-radius: 99px; }
.progress--w60 > i { width: 60%; }

/* 占位符标记：需要用户填写或确认的内容 / Marks content the owner must fill in or confirm */
.ph {
  background: #fff4bd; border-bottom: 1px dotted #a8860a;
  padding: 0 3px; border-radius: 2px; color: var(--c-ink);
}

/* —— 语言切换 / Language switch（前台、后台页头里的真实组件） —— */
.lang-switch {
  display: inline-flex; padding: 2px; border: 1px solid var(--c-line-strong);
  border-radius: 99px; background: var(--c-bg);
}
.lang-switch button {
  height: 28px; min-width: 40px; padding: 0 10px; border: 0; border-radius: 99px;
  background: transparent; color: var(--c-ink-2); font-size: 13px; font-weight: 600; cursor: pointer;
}
.lang-switch button[aria-pressed="true"] { background: var(--c-ink); color: #fff; }
.lang-switch button:focus-visible { box-shadow: var(--focus); }

/* —— 表格 / Tables —— */
.tbl-wrap { border: 1px solid var(--c-line); border-radius: var(--r-lg); background: var(--c-bg); overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; padding: 11px 16px; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--c-ink-3); background: var(--c-bg-soft);
  border-bottom: 1px solid var(--c-line); white-space: nowrap;
}
html[data-lang="zh"] .tbl th { text-transform: none; letter-spacing: 0; font-size: 13px; }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--c-line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #fafcfc; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .nowrap { white-space: nowrap; }

/* —— 通用工具类 / Utilities（代替内联样式） —— */
.row { display: flex; align-items: center; gap: 12px; }
.row--wrap { flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.row--top { align-items: flex-start; }
.stack { display: grid; gap: 12px; }
.stack--sm { gap: 6px; }
.stack--lg { gap: 24px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--c-ink-3); }
.soft { color: var(--c-ink-2); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.bold { font-weight: 700; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; } .mt-48 { margin-top: 48px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.ok { color: var(--c-ok); } .bad { color: var(--c-bad); } .warn { color: var(--c-warm); }
.hide-sm { display: initial; }
@media (max-width: 720px) { .hide-sm { display: none !important; } }
.show-sm { display: none !important; }
@media (max-width: 720px) { .show-sm { display: initial !important; } }

/* 封面占位：用渐变 + 图标代替真实图片 / Cover placeholders (gradient + icon instead of real art) */
.cover {
  position: relative; display: grid; place-items: center; overflow: hidden;
  aspect-ratio: 16 / 10; border-radius: 12px; color: rgba(255, 255, 255, .95);
}
.cover::before, .cover::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.cover::before { width: 60%; aspect-ratio: 1; right: -12%; top: -30%; }
.cover::after { width: 40%; aspect-ratio: 1; left: -8%; bottom: -28%; background: rgba(255, 255, 255, .09); }
.cover .i { position: relative; z-index: 1; width: 3em; height: 3em; font-size: 20px; stroke-width: 1.4; }
.cover--c1 { background: linear-gradient(135deg, #0e7c86, #0a4f5c); }
.cover--c2 { background: linear-gradient(135deg, #3b6fd8, #243a8c); }
.cover--c3 { background: linear-gradient(135deg, #e09a2d, #b45309); }
.cover--c4 { background: linear-gradient(135deg, #d9576b, #8f2740); }
.cover--c5 { background: linear-gradient(135deg, #3ea46b, #1b6b49); }
.cover--c6 { background: linear-gradient(135deg, #7a5fd0, #43308f); }
.cover--sm { width: 56px; aspect-ratio: 1; border-radius: 10px; flex: none; }
.cover--sm .i { width: 1.5em; height: 1.5em; font-size: 16px; }
.cover--sm::before, .cover--sm::after { display: none; }
.cover--xs { width: 36px; aspect-ratio: 1; border-radius: 8px; flex: none; }
.cover--xs .i { width: 1.2em; height: 1.2em; font-size: 16px; }
.cover--xs::before, .cover--xs::after { display: none; }

/* —— 品牌标识（前台、后台、文档页共用） / Brand mark, shared —— */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--c-ink); font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand__mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: var(--c-accent); color: #fff;
}
.brand__mark .i { width: 18px; height: 18px; stroke-width: 2.2; }

/* 状态视图容器不产生盒子，避免破坏 sticky 和 grid 布局 */
[data-view] { display: contents; }

/* 商品封面图（运行时由 common.js 生成）：盖在渐变占位之上 */
.cover__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; }
